@tangle-network/agent-app 0.44.60 → 0.45.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant/index.js +3 -3
- package/dist/chat-routes/index.js +4 -4
- package/dist/{chunk-CQZSAR77.js → chunk-73F3CKVK.js} +28 -18
- package/dist/chunk-73F3CKVK.js.map +1 -0
- package/dist/{chunk-APFJITYT.js → chunk-AOQ4FCSH.js} +5 -343
- package/dist/chunk-AOQ4FCSH.js.map +1 -0
- package/dist/{chunk-S4YW2Y52.js → chunk-BATKJP3P.js} +1 -1
- package/dist/chunk-BATKJP3P.js.map +1 -0
- package/dist/{chunk-ICOHEZK6.js → chunk-ITCINLSU.js} +2 -2
- package/dist/{chunk-3EJ6SFJI.js → chunk-IVEKCOM7.js} +68 -26
- package/dist/chunk-IVEKCOM7.js.map +1 -0
- package/dist/{chunk-WXWU2FEB.js → chunk-RDK3CN7Y.js} +2 -2
- package/dist/design-canvas/index.d.ts +2 -1
- package/dist/design-canvas/index.js +1 -1
- package/dist/harness/index.d.ts +25 -8
- package/dist/harness/index.js +1 -1
- package/dist/mcp-BOgNWSED.d.ts +174 -0
- package/dist/run/index.js +1 -1
- package/dist/runtime/index.d.ts +17 -7
- package/dist/runtime/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +42 -503
- package/dist/sandbox/index.js +4 -38
- package/dist/sequences/index.d.ts +2 -1
- package/dist/sequences/index.js +1 -1
- package/dist/skills-placement/index.js +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +5 -3
- package/dist/web-react/index.js +3 -3
- package/dist/web-react/terminal.d.ts +9 -13
- package/dist/web-react/terminal.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-3EJ6SFJI.js.map +0 -1
- package/dist/chunk-APFJITYT.js.map +0 -1
- package/dist/chunk-CQZSAR77.js.map +0 -1
- package/dist/chunk-S4YW2Y52.js.map +0 -1
- package/dist/mcp-Dt4V4ZLT.d.ts +0 -95
- /package/dist/{chunk-ICOHEZK6.js.map → chunk-ITCINLSU.js.map} +0 -0
- /package/dist/{chunk-WXWU2FEB.js.map → chunk-RDK3CN7Y.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/harness/index.ts"],"sourcesContent":["/**\n * Coding-agent harness selection — taxonomy, coercion, and the session-lock invariant.\n *\n * A \"harness\" is the coding-agent CLI a sandbox drives (opencode / codex /\n * claude-code / …). The shell governs WHICH harness a chat session uses and\n * enforces that a session is LOCKED to the harness it started with — the model\n * may change mid-session, the harness may not (swapping it mid-session would\n * orphan the session's running agent state). Every product otherwise hand-rolls\n * this and hard-codes a single harness; this is the one place the rule lives.\n *\n * Substrate-free: the harness list mirrors the sandbox SDK's `BackendType` as a\n * plain string union (no sandbox dependency). The consumer owns storage — which\n * harness a workspace defaults to, which one a session locked — and maps the\n * resolved value onto the SDK's `backend.type`.\n *\n * Harness↔model COMPATIBILITY (which models a harness can run, snapping) is NOT defined here — it\n * comes from `@tangle-network/agent-interface`, the single source of truth shared with the\n * sandbox-ui pickers and the cli-bridge backends. This module owns the harness TAXONOMY + the\n * session lock.\n */\n\nimport {\n harnessSupportsModel,\n modelProvider,\n preferredHarnessForModel,\n snapHarnessToModel as aiSnapHarnessToModel,\n snapModelToHarness as aiSnapModelToHarness,\n type HarnessType,\n} from '@tangle-network/agent-interface'\n\n/** The known coding-agent backends. Mirrors `@tangle-network/sandbox`'s\n * `BackendType`; kept structural so this module needs no sandbox dependency. */\nexport const KNOWN_HARNESSES = [\n 'opencode',\n 'claude-code',\n 'nanoclaw',\n 'kimi-code',\n 'codex',\n 'amp',\n 'factory-droids',\n 'pi',\n 'hermes',\n 'forge',\n 'openclaw',\n 'acp',\n 'cursor',\n 'cli-base',\n] as const\n\n/** Resolve a valid harness identifier from the predefined KNOWN_HARNESSES array */\nexport type Harness = (typeof KNOWN_HARNESSES)[number]\n\n/** Define the default harness to use for code execution and testing environments */\nexport const DEFAULT_HARNESS: Harness = 'opencode'\n\nconst HARNESS_SET: ReadonlySet<string> = new Set(KNOWN_HARNESSES)\n\n/** Determine if a value is a recognized harness string identifier */\nexport function isHarness(value: unknown): value is Harness {\n return typeof value === 'string' && HARNESS_SET.has(value)\n}\n\n/** Coerce an arbitrary value to a known harness, falling back (default `opencode`). */\nexport function coerceHarness(value: unknown, fallback: Harness = DEFAULT_HARNESS): Harness {\n return isHarness(value) ? value : fallback\n}\n\n/** Resolve input options to determine the appropriate session harness to use */\nexport interface ResolveSessionHarnessInput {\n /** The harness already locked to this session (recorded at its first turn). */\n sessionHarness?: unknown\n /** The harness requested now — a new session's choice, or a turn's attempt to switch. */\n requested?: unknown\n /** The workspace's default harness, used only when starting a fresh session. */\n workspaceDefault?: unknown\n /** Final fallback when nothing else resolves (default `opencode`). */\n fallback?: Harness\n}\n\n/** Represent resolved session state including harness, lock status, and swap attempt flag */\nexport interface ResolvedSessionHarness {\n /** The harness to actually run — the locked one when the session already has it. */\n harness: Harness\n /** True when the session already had a locked harness (this turn did not pick it). */\n locked: boolean\n /** True when `requested` differs from the locked harness — a forbidden mid-session\n * swap the caller should reject or warn on. The lock always wins regardless. */\n swapAttempted: boolean\n}\n\n/**\n * Resolve the harness for a turn, enforcing the session lock.\n *\n * - **Session already started** (`sessionHarness` is a known harness): that harness\n * wins (`locked: true`); a differing `requested` sets `swapAttempted` so the caller\n * can reject the swap. The model is a separate per-turn concern and is unaffected.\n * - **Fresh session**: pick `requested → workspaceDefault → fallback`. The caller\n * persists the result as the session's lock for every subsequent turn.\n */\nexport function resolveSessionHarness(input: ResolveSessionHarnessInput = {}): ResolvedSessionHarness {\n const fallback = input.fallback ?? DEFAULT_HARNESS\n if (isHarness(input.sessionHarness)) {\n const locked = input.sessionHarness\n const swapAttempted = isHarness(input.requested) && input.requested !== locked\n return { harness: locked, locked: true, swapAttempted }\n }\n const harness = coerceHarness(input.requested, coerceHarness(input.workspaceDefault, fallback))\n return { harness, locked: false, swapAttempted: false }\n}\n\n/**\n * Harness ↔ model compatibility + snapping — delegated to `@tangle-network/agent-interface`.\n *\n * agent-app's `Harness` taxonomy is a superset of agent-interface's `HarnessType` (it carries\n * `forge`/`cursor`, which agent-interface doesn't list). Those extra runners have no provider lock\n * there, so they resolve as router-backed (any model) — the correct behavior — which makes the\n * `as HarnessType` casts safe. The snap helpers only ever return a vendor-locked harness or\n * `opencode`, all of which are valid `Harness` values.\n */\n\nexport { modelProvider }\n\n/** Provider-less ids (sentinels like \"default\", or a session's own config) are\n * compatible everywhere — every harness honors its own configuration. */\nexport function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean {\n return harnessSupportsModel(harness as HarnessType, modelId)\n}\n\n/** Keep `modelId` when the harness can run it; else the harness's best compatible\n * catalog id (preferred patterns in order, highest version). When nothing in the\n * catalog fits, return the original so the caller sees the incompatibility. */\nexport function snapModelToHarness(harness: Harness, modelId: string, canonicalIds: readonly string[]): string {\n return aiSnapModelToHarness(harness as HarnessType, modelId, canonicalIds)\n}\n\n/** Keep the harness when it can run `modelId`; else the model's native harness\n * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */\nexport function snapHarnessToModel(harness: Harness, modelId: string): Harness {\n return aiSnapHarnessToModel(harness as HarnessType, modelId) as Harness\n}\n\n/** Fail-loud server guard: throw when a harness is asked to run a model it can't.\n * Call before dispatching a sandbox turn so a bypassed UI can't reach the sidecar\n * with an incompatible pair. */\nexport function assertHarnessModelCompatible(harness: Harness, modelId: string): void {\n if (!isModelCompatibleWithHarness(harness, modelId)) {\n const provider = modelProvider(modelId)\n const native = preferredHarnessForModel(modelId)\n throw new Error(\n `Harness \"${harness}\" cannot run model \"${modelId}\" (provider \"${provider}\"). ` +\n `Use ${native ?? 'a router-backed harness (opencode)'} or an allowed model.`,\n )\n }\n}\n"],"mappings":";AAqBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,OAEjB;AAIA,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,WAChE,UAAU,oCAAoC;AAAA,IACzD;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/web-react/sandbox-terminal.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/** Define the connection details and status for a sandbox terminal session */\nexport interface SandboxTerminalConnection {\n runtimeUrl: string | null\n sidecarUrl: string | null\n token: string | null\n expiresAt: string | null\n status: string\n error: string | null\n loading: boolean\n sandboxId?: string\n connectionId?: string\n}\n\n/**\n * Define the response structure for a sandbox terminal connection including URLs, token, status, and errors\n *\n * Transport-agnostic by construction (#341/#349): the browser-direct\n * scoped-token route (`createSandboxTerminalConnectionRoute`,\n * `src/sandbox/terminal-connection.ts`) returns `sidecarUrl` only — no\n * `runtimeUrl` — while the (now `@deprecated`) same-origin proxy route\n * returns both. `useSandboxTerminalConnection` below resolves\n * `runtimeUrl ?? sidecarUrl` so either shape lands on the same connection\n * state without a hook change.\n *\n * `connectionId` is the id the route's minted token's `sid` is bound to\n * (echoed back from the `connectionId` the hook sent) — pass it straight\n * through as `TerminalView`'s `connectionId` prop, since any other value\n * fails the WS upgrade on the current platform.\n */\nexport interface SandboxTerminalConnectionResponse {\n runtimeUrl?: string\n sidecarUrl?: string\n token?: string\n expiresAt?: string\n status?: string\n error?: string\n sandboxId?: string\n connectionId?: string\n}\n\n/**\n * Define options for configuring a sandbox terminal connection including workspace ID and connection parameters\n *\n * `connectionId`, when set, is passed to\n * `createSandboxTerminalConnectionRoute` as the `connectionId` query\n * parameter — pass `tabTerminalConnectionId()` here so the route mints a\n * token whose `sid` is bound to the same id `TerminalView` will dial. Give\n * `TerminalView` the response's echoed `connectionId` (not this input\n * value) alongside `sidecarUrl` as `apiUrl` and `token`, since a product's\n * `resolveConnectionId` seam may rewrite it server-side.\n */\nexport interface UseSandboxTerminalConnectionOptions {\n workspaceId: string\n connectionUrl?: string | ((workspaceId: string) => string)\n connectionId?: string\n fetcher?: typeof fetch\n provisionPollIntervalMs?: number\n provisionPollTimeoutMs?: number\n tokenRefreshSkewMs?: number\n}\n\n/** Resolve sandbox terminal connection status and provide a method to initiate the connection */\nexport interface UseSandboxTerminalConnectionResult extends SandboxTerminalConnection {\n connect: () => Promise<void>\n}\n\nconst DEFAULT_PROVISION_POLL_INTERVAL_MS = 2_000\nconst DEFAULT_PROVISION_POLL_TIMEOUT_MS = 90_000\nconst DEFAULT_TOKEN_REFRESH_SKEW_MS = 120_000\n\nconst EMPTY_CONNECTION: SandboxTerminalConnection = {\n runtimeUrl: null,\n sidecarUrl: null,\n token: null,\n expiresAt: null,\n status: 'idle',\n error: null,\n loading: false,\n}\n\n/**\n * Manage and maintain a sandbox terminal connection with automatic polling and token refresh handling\n *\n * Transport-agnostic (#341/#349): this hook does not care whether\n * `connectionUrl` is backed by the fleet-default browser-direct\n * scoped-token route (`createSandboxTerminalConnectionRoute`,\n * `src/sandbox/terminal-connection.ts`, `sidecarUrl` only) or the\n * `@deprecated` same-origin proxy route (`runtimeUrl` + `sidecarUrl`) — it\n * resolves `runtimeUrl ?? sidecarUrl` either way.\n *\n * Pass `tabTerminalConnectionId()` as `opts.connectionId` — the hook forwards\n * it as the `connectionId` query parameter the browser-direct route requires\n * to mint a token whose `sid` is bound to that exact id (the orchestrator's\n * terminal WS gate fails closed on any other value). Give `TerminalView` the\n * RESULT's echoed `connectionId` (not the input value — a product's\n * `resolveConnectionId` seam may rewrite it), the resolved `sidecarUrl`/\n * `runtimeUrl` as `apiUrl`, and `token` as its token prop.\n */\nexport function useSandboxTerminalConnection(opts: UseSandboxTerminalConnectionOptions): UseSandboxTerminalConnectionResult {\n const [conn, setConn] = useState<SandboxTerminalConnection>(EMPTY_CONNECTION)\n const mountedRef = useRef(false)\n const generationRef = useRef(0)\n const fetcher = opts.fetcher ?? fetch\n const pollIntervalMs = opts.provisionPollIntervalMs ?? DEFAULT_PROVISION_POLL_INTERVAL_MS\n const pollTimeoutMs = opts.provisionPollTimeoutMs ?? DEFAULT_PROVISION_POLL_TIMEOUT_MS\n const refreshSkewMs = opts.tokenRefreshSkewMs ?? DEFAULT_TOKEN_REFRESH_SKEW_MS\n\n const connectionUrl = useCallback(() => {\n const base = typeof opts.connectionUrl === 'function'\n ? opts.connectionUrl(opts.workspaceId)\n : opts.connectionUrl ?? `/api/workspaces/${encodeURIComponent(opts.workspaceId)}/sandbox/connection`\n if (!opts.connectionId) return base\n // `base` may be relative (SSR-safe), so a plain `URL` parse isn't always\n // possible — string-append with proper encoding covers both shapes.\n const separator = base.includes('?') ? '&' : '?'\n return `${base}${separator}connectionId=${encodeURIComponent(opts.connectionId)}`\n }, [opts.connectionUrl, opts.workspaceId, opts.connectionId])\n\n const connect = useCallback(async () => {\n const generation = generationRef.current + 1\n generationRef.current = generation\n const isCurrent = () => mountedRef.current && generationRef.current === generation\n const setCurrentConn: typeof setConn = (value) => {\n if (!isCurrent()) return\n setConn(value)\n }\n\n setCurrentConn((current) => ({ ...current, loading: true, error: null }))\n const deadline = Date.now() + pollTimeoutMs\n while (isCurrent()) {\n try {\n const res = await fetcher(connectionUrl())\n const data = (await res.json()) as SandboxTerminalConnectionResponse\n if (!isCurrent()) return\n const runtimeUrl = data.runtimeUrl ?? data.sidecarUrl\n if (res.ok && runtimeUrl && data.token && data.expiresAt) {\n setCurrentConn({\n runtimeUrl,\n sidecarUrl: data.sidecarUrl ?? runtimeUrl,\n token: data.token,\n expiresAt: data.expiresAt,\n status: data.status ?? 'running',\n error: null,\n loading: false,\n ...(data.sandboxId ? { sandboxId: data.sandboxId } : {}),\n ...(data.connectionId ? { connectionId: data.connectionId } : {}),\n })\n return\n }\n if (res.ok) {\n setCurrentConn({\n runtimeUrl: null,\n sidecarUrl: null,\n token: null,\n expiresAt: null,\n loading: false,\n error: 'Sandbox connection response is missing required fields',\n status: data.status ?? 'error',\n ...(data.sandboxId ? { sandboxId: data.sandboxId } : {}),\n })\n return\n }\n if (res.status === 503 && Date.now() < deadline) {\n setCurrentConn((current) => ({\n ...current,\n loading: true,\n status: data.status ?? 'provisioning',\n error: null,\n }))\n await sleep(pollIntervalMs)\n continue\n }\n setCurrentConn((current) => ({\n ...current,\n runtimeUrl: null,\n sidecarUrl: null,\n token: null,\n expiresAt: null,\n loading: false,\n error: data.error ?? 'Sandbox not available',\n status: data.status ?? 'error',\n }))\n return\n } catch (err) {\n if (!isCurrent()) return\n if (Date.now() < deadline) {\n await sleep(pollIntervalMs)\n continue\n }\n setCurrentConn((current) => ({\n ...current,\n runtimeUrl: null,\n sidecarUrl: null,\n token: null,\n expiresAt: null,\n loading: false,\n error: err instanceof Error ? err.message : 'Connection failed',\n }))\n return\n }\n }\n }, [connectionUrl, fetcher, pollIntervalMs, pollTimeoutMs])\n\n useEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n generationRef.current += 1\n }\n }, [])\n\n useEffect(() => {\n void connect()\n }, [connect])\n\n useEffect(() => {\n if (!conn.runtimeUrl || !conn.token || !conn.expiresAt) return\n const refreshAt = Date.parse(conn.expiresAt) - Date.now() - refreshSkewMs\n if (!Number.isFinite(refreshAt)) {\n setConn((current) => ({\n ...current,\n runtimeUrl: null,\n sidecarUrl: null,\n token: null,\n expiresAt: null,\n status: 'error',\n error: 'Sandbox token expiry is invalid',\n }))\n return\n }\n const timer = window.setTimeout(() => {\n void connect()\n }, Math.max(1_000, refreshAt))\n return () => window.clearTimeout(timer)\n }, [conn.runtimeUrl, conn.token, conn.expiresAt, connect, refreshSkewMs])\n\n return { ...conn, connect }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => window.setTimeout(resolve, ms))\n}\n\nconst DEFAULT_TERMINAL_CID_KEY = 'agent-app:terminal-connection-id'\n\nfunction newConnectionId(): string {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') return crypto.randomUUID()\n return `cid-${Date.now().toString(36)}-${Math.floor(Math.random() * 1e9).toString(36)}`\n}\n\n/**\n * Stable-per-tab, unique-per-client terminal connection id.\n *\n * Persists in `sessionStorage` so a reload in the same tab reuses the id (the\n * sidecar restores the same PTY session via `TerminalView.connectionId`), while\n * separate tabs/windows each get a distinct id. Pass the result as\n * `TerminalView`'s `connectionId`. Without it (e.g. gtm-agent today) every tab\n * shares one connection id and their reconnects evict each other.\n *\n * Falls back to an ephemeral id when `sessionStorage` is unavailable (SSR,\n * privacy mode) — still unique per call, just not reload-stable.\n */\nexport function tabTerminalConnectionId(storageKey: string = DEFAULT_TERMINAL_CID_KEY): string {\n try {\n const store = globalThis.sessionStorage\n const existing = store?.getItem(storageKey)\n if (existing) return existing\n const id = newConnectionId()\n store?.setItem(storageKey, id)\n return id\n } catch {\n return newConnectionId()\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAoEzD,IAAM,qCAAqC;AAC3C,IAAM,oCAAoC;AAC1C,IAAM,gCAAgC;AAEtC,IAAM,mBAA8C;AAAA,EAClD,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS;AACX;AAoBO,SAAS,6BAA6B,MAA+E;AAC1H,QAAM,CAAC,MAAM,OAAO,IAAI,SAAoC,gBAAgB;AAC5E,QAAM,aAAa,OAAO,KAAK;AAC/B,QAAM,gBAAgB,OAAO,CAAC;AAC9B,QAAM,UAAU,KAAK,WAAW;AAChC,QAAM,iBAAiB,KAAK,2BAA2B;AACvD,QAAM,gBAAgB,KAAK,0BAA0B;AACrD,QAAM,gBAAgB,KAAK,sBAAsB;AAEjD,QAAM,gBAAgB,YAAY,MAAM;AACtC,UAAM,OAAO,OAAO,KAAK,kBAAkB,aACvC,KAAK,cAAc,KAAK,WAAW,IACnC,KAAK,iBAAiB,mBAAmB,mBAAmB,KAAK,WAAW,CAAC;AACjF,QAAI,CAAC,KAAK,aAAc,QAAO;AAG/B,UAAM,YAAY,KAAK,SAAS,GAAG,IAAI,MAAM;AAC7C,WAAO,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Definition } from './types-DbU-oO5h.js';
|
|
2
|
-
import { T as ToolHeaderNames } from './auth-DJs6lfAs.js';
|
|
3
|
-
|
|
4
|
-
/** Default route path each app tool is served at. A product mounts its routes
|
|
5
|
-
* at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */
|
|
6
|
-
declare const DEFAULT_APP_TOOL_PATHS: Record<AppToolName, string>;
|
|
7
|
-
/** The portable MCP server entry the sandbox SDK accepts (transport + url +
|
|
8
|
-
* headers). Matches `AgentProfileMcpServer` structurally without importing the
|
|
9
|
-
* sandbox SDK — products spread it into their profile's `mcp` map. */
|
|
10
|
-
interface AppToolMcpServer {
|
|
11
|
-
transport: 'http';
|
|
12
|
-
url: string;
|
|
13
|
-
headers: Record<string, string>;
|
|
14
|
-
enabled: true;
|
|
15
|
-
metadata: {
|
|
16
|
-
description: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** Define configuration options for building an HTTP MCP server including path, baseUrl, token, context, and description */
|
|
20
|
-
interface BuildHttpMcpServerOptions {
|
|
21
|
-
/** Route path on the app the sandbox POSTs to (e.g. `/api/tools/propose`). */
|
|
22
|
-
path: string;
|
|
23
|
-
/** App base URL the sandbox reaches back to (no trailing slash required). */
|
|
24
|
-
baseUrl: string;
|
|
25
|
-
/** Per-user capability token, baked into the Authorization header. */
|
|
26
|
-
token: string;
|
|
27
|
-
ctx: AppToolContext;
|
|
28
|
-
/** Tool description the model sees. */
|
|
29
|
-
description: string;
|
|
30
|
-
headerNames?: ToolHeaderNames;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build ONE HTTP MCP server entry — the generic agent→app bridge. The
|
|
34
|
-
* capability token + the user/workspace/thread ids ride in server-set headers
|
|
35
|
-
* (never tool args), so the model can't forge identity or target another
|
|
36
|
-
* workspace. Workspace/thread headers are omitted when their `ctx` value is
|
|
37
|
-
* empty/null (e.g. an integration-invoke bridge that's user-scoped only). Used
|
|
38
|
-
* directly for non-app-tool bridges (integration_invoke) and via
|
|
39
|
-
* {@link buildAppToolMcpServer} for the four app tools.
|
|
40
|
-
*/
|
|
41
|
-
declare function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer;
|
|
42
|
-
/** Options for a per-document/scoped MCP channel entry (design-canvas,
|
|
43
|
-
* sequences, …). The capability token + path scope ONE resource; the document
|
|
44
|
-
* id lives in the path, never a tool argument. */
|
|
45
|
-
interface ScopedMcpServerEntryOptions {
|
|
46
|
-
/** App base URL the sandbox reaches back to (trailing slash tolerated). */
|
|
47
|
-
baseUrl: string;
|
|
48
|
-
/** Product route serving the resource's MCP handler — id is part of the path. */
|
|
49
|
-
path: string;
|
|
50
|
-
/** Capability token the product minted for this (user, resource) scope. With
|
|
51
|
-
* no token there is no entry to build — omit the server instead. */
|
|
52
|
-
token: string;
|
|
53
|
-
/** Override the channel's default tool-server description. */
|
|
54
|
-
description?: string;
|
|
55
|
-
/** Identity headers for products whose route recovers the user via
|
|
56
|
-
* `authenticateToolRequest`. Omit when the bearer token is self-contained. */
|
|
57
|
-
ctx?: AppToolContext;
|
|
58
|
-
headerNames?: ToolHeaderNames;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Build the `AgentProfileMcpServer`-shaped entry for a scoped, per-resource MCP
|
|
62
|
-
* channel. The shared mechanism behind the per-domain entry builders
|
|
63
|
-
* (`buildDesignCanvasMcpServerEntry`, `buildSequencesMcpServerEntry`): same
|
|
64
|
-
* token/path guards, same description default, same ctx-vs-self-contained-token
|
|
65
|
-
* branching. The domain is two parameters — `label` (for guard messages) and
|
|
66
|
-
* `defaultDescription` — never baked.
|
|
67
|
-
*
|
|
68
|
-
* The no-`ctx` branch is a GENUINE behavioral path, not a shortcut: it emits a
|
|
69
|
-
* self-contained-token entry with ONLY `Authorization` + `Content-Type`.
|
|
70
|
-
* Routing it through {@link buildHttpMcpServer} would unconditionally write a
|
|
71
|
-
* `userId` identity header (here `undefined`), so it stays a distinct branch.
|
|
72
|
-
*/
|
|
73
|
-
declare function buildScopedMcpServerEntry(opts: ScopedMcpServerEntryOptions & {
|
|
74
|
-
label: string;
|
|
75
|
-
defaultDescription: string;
|
|
76
|
-
}): AppToolMcpServer;
|
|
77
|
-
/** Define configuration options required to build an MCP server including tool, baseUrl, token, and context */
|
|
78
|
-
interface BuildMcpServerOptions {
|
|
79
|
-
/** A built-in app tool name, or a product-registered {@link AppToolDefinition}.
|
|
80
|
-
* A custom tool supplies its route via `AppToolDefinition.path` (or `paths`). */
|
|
81
|
-
tool: AppToolName | AppToolDefinition;
|
|
82
|
-
baseUrl: string;
|
|
83
|
-
token: string;
|
|
84
|
-
ctx: AppToolContext;
|
|
85
|
-
description: string;
|
|
86
|
-
headerNames?: ToolHeaderNames;
|
|
87
|
-
paths?: Partial<Record<string, string>>;
|
|
88
|
-
}
|
|
89
|
-
/** Build one app-tool MCP server entry — a thin wrapper over
|
|
90
|
-
* {@link buildHttpMcpServer} that resolves the tool's route path. Built-ins map
|
|
91
|
-
* through {@link DEFAULT_APP_TOOL_PATHS}; a custom tool uses its own `path`
|
|
92
|
-
* (or a `paths` override). */
|
|
93
|
-
declare function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer;
|
|
94
|
-
|
|
95
|
-
export { type AppToolMcpServer as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type ScopedMcpServerEntryOptions as S, type BuildMcpServerOptions as a, buildAppToolMcpServer as b, buildHttpMcpServer as c, buildScopedMcpServerEntry as d };
|
|
File without changes
|
|
File without changes
|