Skip to content

Commit f2d8fac

Browse files
committed
docs: document agent bundle runtimes
1 parent b851ba2 commit f2d8fac

13 files changed

Lines changed: 22 additions & 3 deletions

src/agents/agent-bundle-lsp-runtime.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Tests embedded LSP runtime JSON-RPC, tool behavior, and cleanup. */
12
import { EventEmitter } from "node:events";
23
import { PassThrough, Writable } from "node:stream";
34
import { afterEach, describe, expect, it, vi } from "vitest";

src/agents/agent-bundle-lsp-runtime.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Session-scoped embedded LSP runtime and tool materialization for agent bundles. */
12
import { spawn, type ChildProcess } from "node:child_process";
23
import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce";
34
import type { OpenClawConfig } from "../config/types.openclaw.js";
@@ -46,6 +47,7 @@ type LspServerCapabilities = {
4647
[key: string]: unknown;
4748
};
4849

50+
/** Materialized LSP tools plus session capabilities and cleanup handle. */
4951
export type BundleLspToolRuntime = {
5052
tools: AnyAgentTool[];
5153
sessions: Array<{ serverName: string; capabilities: LspServerCapabilities }>;
@@ -69,6 +71,7 @@ function delay(ms: number): Promise<void> {
6971
});
7072
}
7173

74+
/** Spawns one LSP server process using sanitized host env and Windows shim handling. */
7275
export function spawnLspServerProcess(config: StdioMcpServerLaunchConfig): ChildProcess {
7376
const mergedEnv = sanitizeHostExecEnv({ baseEnv: process.env, overrides: config.env ?? null });
7477
const program = resolveWindowsSpawnProgram({

src/agents/agent-bundle-lsp-runtime.windows-spawn.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Tests LSP server spawning with Windows shim and sanitized env handling. */
12
import { describe, expect, it, vi, beforeEach } from "vitest";
23
import { spawnLspServerProcess } from "./agent-bundle-lsp-runtime.js";
34

src/agents/agent-bundle-mcp-materialize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Materializes configured MCP catalog entries into agent tools and runtime helpers. */
12
import crypto from "node:crypto";
23
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
34
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";

src/agents/agent-bundle-mcp-names.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Tests MCP server/tool name sanitization, truncation, and collision handling. */
12
import { describe, expect, it } from "vitest";
23
import {
34
buildSafeToolName,

src/agents/agent-bundle-mcp-names.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Sanitizes MCP server/tool names into stable model-facing tool ids. */
12
import {
23
normalizeLowercaseStringOrEmpty,
34
normalizeOptionalLowercaseString,
@@ -38,6 +39,7 @@ function sanitizeToolName(raw: string): string {
3839
return sanitizeToolFragment(raw, "tool");
3940
}
4041

42+
/** Normalizes reserved tool names for collision checks. */
4143
export function normalizeReservedToolNames(names?: Iterable<string>): Set<string> {
4244
return new Set(
4345
Array.from(names ?? [], (name) => normalizeOptionalLowercaseString(name)).filter(

src/agents/agent-bundle-mcp-runtime.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Tests session-scoped MCP runtime catalog, transport, validation, and lifecycle behavior. */
12
import fs from "node:fs/promises";
23
import http from "node:http";
34
import os from "node:os";

src/agents/agent-bundle-mcp-runtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Session-scoped MCP runtime manager, catalog loader, and transport lifecycle. */
12
import crypto from "node:crypto";
23
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
34
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

src/agents/agent-bundle-mcp-test-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Test helper for resetting bundle MCP runtime state between harness tests.
1+
/** Test helper for resetting bundle MCP runtime state between harness tests. */
22
/** Reset session-scoped bundle MCP runtime manager state. */
33
export async function cleanupBundleMcpHarness(): Promise<void> {
44
const { testing } = await import("./agent-bundle-mcp-tools.js");

src/agents/agent-bundle-mcp-tools.materialize.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** Tests materializing MCP catalog tools into agent tool definitions and results. */
12
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
23
import { validateToolArguments } from "openclaw/plugin-sdk/llm";
34
import { describe, expect, it } from "vitest";

0 commit comments

Comments
 (0)