agent-framework-js 0.1.1
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/AGENT_USAGE.md +207 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/agents/index.cjs +35 -0
- package/dist/agents/index.cjs.map +1 -0
- package/dist/agents/index.d.cts +8 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/index.js +10 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/chunk-5M6ER4ZX.cjs +4 -0
- package/dist/chunk-5M6ER4ZX.cjs.map +1 -0
- package/dist/chunk-5PDJOBTD.js +38 -0
- package/dist/chunk-5PDJOBTD.js.map +1 -0
- package/dist/chunk-7ZXUIHLH.js +18 -0
- package/dist/chunk-7ZXUIHLH.js.map +1 -0
- package/dist/chunk-ACBIHS5H.js +30 -0
- package/dist/chunk-ACBIHS5H.js.map +1 -0
- package/dist/chunk-DEABART4.js +54 -0
- package/dist/chunk-DEABART4.js.map +1 -0
- package/dist/chunk-FOTCUNP5.cjs +34 -0
- package/dist/chunk-FOTCUNP5.cjs.map +1 -0
- package/dist/chunk-FSDMBWQV.cjs +20 -0
- package/dist/chunk-FSDMBWQV.cjs.map +1 -0
- package/dist/chunk-GYDY3KX5.cjs +72 -0
- package/dist/chunk-GYDY3KX5.cjs.map +1 -0
- package/dist/chunk-HGEPXJDG.js +129 -0
- package/dist/chunk-HGEPXJDG.js.map +1 -0
- package/dist/chunk-IJASUMIQ.cjs +57 -0
- package/dist/chunk-IJASUMIQ.cjs.map +1 -0
- package/dist/chunk-IU3LS5FC.cjs +10 -0
- package/dist/chunk-IU3LS5FC.cjs.map +1 -0
- package/dist/chunk-IUKD54F7.js +8 -0
- package/dist/chunk-IUKD54F7.js.map +1 -0
- package/dist/chunk-IXV4UIF5.js +79 -0
- package/dist/chunk-IXV4UIF5.js.map +1 -0
- package/dist/chunk-KEI3EALJ.cjs +10 -0
- package/dist/chunk-KEI3EALJ.cjs.map +1 -0
- package/dist/chunk-LMN75W3W.cjs +87 -0
- package/dist/chunk-LMN75W3W.cjs.map +1 -0
- package/dist/chunk-MCLVWCOB.js +3 -0
- package/dist/chunk-MCLVWCOB.js.map +1 -0
- package/dist/chunk-MQ2XTH3S.cjs +87 -0
- package/dist/chunk-MQ2XTH3S.cjs.map +1 -0
- package/dist/chunk-QJ5XHA6S.cjs +95 -0
- package/dist/chunk-QJ5XHA6S.cjs.map +1 -0
- package/dist/chunk-RD5YUB2E.js +190 -0
- package/dist/chunk-RD5YUB2E.js.map +1 -0
- package/dist/chunk-RZ43WNHR.js +8 -0
- package/dist/chunk-RZ43WNHR.js.map +1 -0
- package/dist/chunk-RZP2ZUUX.cjs +252 -0
- package/dist/chunk-RZP2ZUUX.cjs.map +1 -0
- package/dist/chunk-T2GHJ5R4.js +241 -0
- package/dist/chunk-T2GHJ5R4.js.map +1 -0
- package/dist/chunk-TAMJ5HSR.cjs +137 -0
- package/dist/chunk-TAMJ5HSR.cjs.map +1 -0
- package/dist/chunk-TLACSVEZ.cjs +201 -0
- package/dist/chunk-TLACSVEZ.cjs.map +1 -0
- package/dist/chunk-UVWQWOLO.js +196 -0
- package/dist/chunk-UVWQWOLO.js.map +1 -0
- package/dist/chunk-V472N2PK.js +91 -0
- package/dist/chunk-V472N2PK.js.map +1 -0
- package/dist/chunk-V6O6SYAN.cjs +43 -0
- package/dist/chunk-V6O6SYAN.cjs.map +1 -0
- package/dist/chunk-VLSVL5N2.js +48 -0
- package/dist/chunk-VLSVL5N2.js.map +1 -0
- package/dist/chunk-WSMYH2IN.cjs +86 -0
- package/dist/chunk-WSMYH2IN.cjs.map +1 -0
- package/dist/chunk-XPXTXOYQ.js +81 -0
- package/dist/chunk-XPXTXOYQ.js.map +1 -0
- package/dist/chunk-YBFLWRO5.cjs +194 -0
- package/dist/chunk-YBFLWRO5.cjs.map +1 -0
- package/dist/chunk-YCBDEEAV.js +82 -0
- package/dist/chunk-YCBDEEAV.js.map +1 -0
- package/dist/chunk-YH5746OF.js +69 -0
- package/dist/chunk-YH5746OF.js.map +1 -0
- package/dist/chunk-YKZJRE32.cjs +50 -0
- package/dist/chunk-YKZJRE32.cjs.map +1 -0
- package/dist/declarative/index.cjs +19 -0
- package/dist/declarative/index.cjs.map +1 -0
- package/dist/declarative/index.d.cts +60 -0
- package/dist/declarative/index.d.ts +60 -0
- package/dist/declarative/index.js +10 -0
- package/dist/declarative/index.js.map +1 -0
- package/dist/errors-CjVz4W_5.d.cts +68 -0
- package/dist/errors-CjVz4W_5.d.ts +68 -0
- package/dist/index-C2vzfbBz.d.cts +57 -0
- package/dist/index-C2vzfbBz.d.ts +57 -0
- package/dist/index-D7-znzrc.d.ts +153 -0
- package/dist/index-DdYZeNIu.d.cts +153 -0
- package/dist/index.cjs +236 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +51 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.cjs +19 -0
- package/dist/mcp/index.cjs.map +1 -0
- package/dist/mcp/index.d.cts +72 -0
- package/dist/mcp/index.d.ts +72 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/middleware/index.cjs +17 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +29 -0
- package/dist/middleware/index.d.ts +29 -0
- package/dist/middleware/index.js +4 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/observability/index.cjs +29 -0
- package/dist/observability/index.cjs.map +1 -0
- package/dist/observability/index.d.cts +1 -0
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/persistence/index.cjs +24 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +51 -0
- package/dist/persistence/index.d.ts +51 -0
- package/dist/persistence/index.js +7 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/provider-CMAymr1b.d.cts +82 -0
- package/dist/provider-osAtfZ7x.d.ts +82 -0
- package/dist/providers/index.cjs +26 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +107 -0
- package/dist/providers/index.d.ts +107 -0
- package/dist/providers/index.js +5 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/registry-CpO0yH5v.d.ts +57 -0
- package/dist/registry-D4fThGiN.d.cts +57 -0
- package/dist/skill-DfNChtJN.d.cts +45 -0
- package/dist/skill-DfNChtJN.d.ts +45 -0
- package/dist/skills/index.cjs +20 -0
- package/dist/skills/index.cjs.map +1 -0
- package/dist/skills/index.d.cts +30 -0
- package/dist/skills/index.d.ts +30 -0
- package/dist/skills/index.js +3 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/thread-CWVzTyti.d.ts +51 -0
- package/dist/thread-Dfo9LLf7.d.cts +51 -0
- package/dist/tool-BZg_znMZ.d.cts +50 -0
- package/dist/tool-CSCC87OD.d.ts +50 -0
- package/dist/tools/index.cjs +27 -0
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +21 -0
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types-Cn1g9Tg4.d.cts +63 -0
- package/dist/types-Cn1g9Tg4.d.ts +63 -0
- package/dist/workflows/index.cjs +50 -0
- package/dist/workflows/index.cjs.map +1 -0
- package/dist/workflows/index.d.cts +182 -0
- package/dist/workflows/index.d.ts +182 -0
- package/dist/workflows/index.js +5 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +145 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agents/loop.ts","../src/agents/agent.ts"],"names":["textMessage","ToolRegistry","SkillIndex","hasImage","ProviderError","composeMiddleware","Thread"],"mappings":";;;;;;;;;AA4CA,eAAsB,OAAA,CACrB,QAAA,EACA,QAAA,EACA,QAAA,EACA,OAAA,EACsB;AACtB,EAAA,MAAM,aAAA,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,EAAE,MAAA,EAAQ,IAAA,EAAM,QAAQ,YAAA,EAAc,OAAA,EAAS,IAAA,EAAM,KAAA,EAAO,MAAA;AAAO,OAC5E;AACA,MAAA;AAAA,IACD;AAEA,IAAA,IAAI,IAAA,EAAM,MAAA,CAAO,GAAA,CAAI,EAAE,MAAM,WAAA,EAAa,KAAA,EAAO,CAAC,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,GAAG,CAAA;AAC3E,IAAA,MAAM;AAAA,MACL,IAAA,EAAM,MAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACP,MAAA,EAAQ,IAAA;AAAA,QACR,WAAW,MAAA,CAAO,QAAA,CAAS,YAAA,CAAa,iBAAA,GAAoB,aAAa,MAAA,GAAY,MAAA;AAAA,QACrF,MAAA,EAAQ,WAAA;AAAA,QACR,OAAA,EAAS,KAAA;AAAA,QACT;AAAA;AACD,KACD;AAAA,EACD;AAEA,EAAA,OAAO,EAAE,IAAA,EAAM,MAAA,CAAO,IAAA,EAAM,KAAK,SAAA,EAAU;AAC5C","file":"chunk-YBFLWRO5.cjs","sourcesContent":["/**\n * The agent run loop: drives provider calls, executes requested tool calls,\n * feeds typed results (including errors, for self-correction) back to the model,\n * and stops on a final answer, the iteration cap, or an abort. (FR-011a, FR-012b)\n *\n * @packageDocumentation\n */\n\nimport type { Message } from \"../core/types.js\";\nimport { textMessage } from \"../core/types.js\";\nimport type { GenerateRequest, GenerateResponse } from \"../providers/provider.js\";\nimport type { ToolRegistry } from \"../tools/registry.js\";\n\n/** Outcome status of a run. */\nexport type RunStatus = \"completed\" | \"failed\" | \"incomplete\" | \"limit-exceeded\";\n\n/** A function that produces a model response (optionally through middleware). */\nexport type GenerateFn = (req: GenerateRequest) => Promise<GenerateResponse>;\n\n/** Settings controlling the loop. */\nexport interface LoopOptions {\n\t/** Maximum iterations; -1 means unlimited. Default 10. (FR-012b) */\n\tmaxIterations?: number;\n\t/** Per-tool-call timeout in ms. (FR-012c) */\n\ttoolTimeoutMs?: number;\n\t/** Abort signal. */\n\tsignal?: AbortSignal;\n}\n\n/** Result of running the loop. */\nexport interface LoopResult {\n\tmessages: Message[];\n\tfinal: GenerateResponse;\n\tstatus: RunStatus;\n}\n\n/**\n * Execute the tool-call loop against a generate function and tool registry.\n *\n * @param generate - Produces a model response (typically the middleware pipeline).\n * @param registry - Tools available to the agent (may be empty).\n * @param messages - Initial conversation (system + user, etc.).\n * @param options - Loop tuning.\n */\nexport async function runLoop(\n\tgenerate: GenerateFn,\n\tregistry: ToolRegistry,\n\tmessages: Message[],\n\toptions?: LoopOptions,\n): Promise<LoopResult> {\n\tconst maxIterations = options?.maxIterations ?? 10;\n\tconst working = [...messages];\n\tlet iteration = 0;\n\n\tfor (; ;) {\n\t\tif (maxIterations !== -1 && iteration >= maxIterations) {\n\t\t\treturn {\n\t\t\t\tmessages: working,\n\t\t\t\tfinal: { text: \"\" },\n\t\t\t\tstatus: \"limit-exceeded\",\n\t\t\t};\n\t\t}\n\t\titeration++;\n\n\t\tconst specs = registry.specs();\n\t\tconst response = await generate({\n\t\t\tmessages: working,\n\t\t\ttools: specs.length > 0 ? specs : undefined,\n\t\t\tsignal: options?.signal,\n\t\t});\n\n\t\tif (!response.toolCalls || response.toolCalls.length === 0) {\n\t\t\treturn { messages: working, final: response, status: \"completed\" };\n\t\t}\n\n\t\t// Record the assistant's tool-call turn.\n\t\tworking.push({\n\t\t\trole: \"assistant\",\n\t\t\tparts: response.text ? [{ type: \"text\", text: response.text }] : [],\n\t\t});\n\n\t\t// Execute each requested tool and feed results (or typed errors) back.\n\t\tfor (const call of response.toolCalls) {\n\t\t\tconst result = await registry.invoke(call.name, call.arguments, options?.toolTimeoutMs);\n\t\t\tconst payload = result.error\n\t\t\t\t? `ERROR (${result.error.reason}): ${result.error.message}`\n\t\t\t\t: JSON.stringify(result.value ?? null);\n\t\t\tworking.push({\n\t\t\t\trole: \"tool\",\n\t\t\t\tname: call.name,\n\t\t\t\ttoolCallId: call.id,\n\t\t\t\tparts: [{ type: \"text\", text: payload }],\n\t\t\t});\n\t\t}\n\t}\n}\n\n/** Build the initial message list from instructions + input. */\nexport function buildMessages(instructions: string, input: Message[]): Message[] {\n\treturn [textMessage(\"system\", instructions), ...input];\n}\n","/**\n * The agent: a configured actor that runs against a provider, optionally using\n * tools and skills, with streaming, reasoning output, multimodal input gating,\n * conversation threads with compaction, and a middleware pipeline.\n *\n * @packageDocumentation\n */\n\nimport type { Message, ContentPart } from \"../core/types.js\";\nimport { hasImage, textMessage } from \"../core/types.js\";\nimport { ProviderError } from \"../core/errors.js\";\nimport type { Provider, GenerateResponse, GenerateRequest } from \"../providers/provider.js\";\nimport { ToolRegistry } from \"../tools/registry.js\";\nimport type { Tool } from \"../tools/tool.js\";\nimport type { Skill } from \"../skills/skill.js\";\nimport { SkillIndex } from \"../skills/index.js\";\nimport type { Middleware, MiddlewareContext } from \"../middleware/middleware.js\";\nimport { composeMiddleware } from \"../middleware/middleware.js\";\nimport { Thread, type ThreadOptions } from \"./thread.js\";\nimport { runLoop, type RunStatus } from \"./loop.js\";\n\n/** Configuration for {@link createAgent}. */\nexport interface AgentConfig {\n\tname: string;\n\tinstructions: string;\n\tprovider: Provider;\n\ttools?: Tool[];\n\tskills?: Skill[];\n\t/** Max tool-call iterations per run; -1 = unlimited. Default 10. (FR-012b) */\n\tmaxIterations?: number;\n\t/** Per-tool-call timeout in ms. (FR-012c) */\n\ttoolTimeoutMs?: number;\n\t/** Compaction threshold as a fraction of maxInputTokens. Default 0.9. (FR-004a) */\n\tcompactionThreshold?: number;\n\t/** Optional override model for compaction summaries. (FR-004b) */\n\tcompactionModel?: Provider;\n\t/** Middleware applied around provider calls. (FR-023) */\n\tmiddleware?: Middleware[];\n}\n\n/** Options for a single run. */\nexport interface RunOptions {\n\t/** Continue an existing conversation. (FR-004) */\n\tthread?: Thread;\n\t/** Abort signal. */\n\tsignal?: AbortSignal;\n}\n\n/** The result of a non-streaming run. */\nexport interface RunResult {\n\toutput: string;\n\t/** Reasoning content — only for reasoning-capable models. (FR-003a) */\n\treasoning?: string;\n\tstatus: RunStatus;\n\t/** True when the run was interrupted before completing. (FR-003b) */\n\tpartial: boolean;\n\terror?: ProviderError;\n\t/** The thread used/updated by this run. */\n\tthread: Thread;\n}\n\n/** Streamed run chunk. */\nexport type RunChunk =\n\t| { type: \"text\"; text: string }\n\t| { type: \"reasoning\"; text: string }\n\t| { type: \"done\"; result: RunResult };\n\n/** Agent input: plain text or structured (multimodal) messages. (FR-002) */\nexport type AgentInput = string | Message | Message[];\n\n/** A runnable agent. */\nexport interface Agent {\n\treadonly name: string;\n\trun(input: AgentInput, opts?: RunOptions): Promise<RunResult>;\n\trunStream(input: AgentInput, opts?: RunOptions): AsyncIterable<RunChunk>;\n}\n\nfunction normalizeInput(input: AgentInput): Message[] {\n\tif (typeof input === \"string\") return [textMessage(\"user\", input)];\n\treturn Array.isArray(input) ? input : [input];\n}\n\nfunction promptText(messages: Message[]): string {\n\treturn messages\n\t\t.flatMap((m) => m.parts)\n\t\t.filter((p): p is { type: \"text\"; text: string } => p.type === \"text\")\n\t\t.map((p) => p.text)\n\t\t.join(\" \");\n}\n\n/**\n * Create an agent.\n *\n * @example\n * ```ts\n * const agent = createAgent({ name: \"Helper\", instructions: \"Be concise.\", provider });\n * const res = await agent.run(\"Say hello.\");\n * console.log(res.status, res.output);\n * ```\n */\nexport function createAgent(config: AgentConfig): Agent {\n\tconst registry = new ToolRegistry(config.tools ?? []);\n\tconst skillIndex = new SkillIndex(config.skills ?? []);\n\tconst middleware = config.middleware ?? [];\n\n\tfunction gateVision(messages: Message[]): void {\n\t\tif (!config.provider.capabilities.supportsVision && messages.some(hasImage)) {\n\t\t\tthrow new ProviderError(\n\t\t\t\t\"Image input was provided but the configured model does not support vision\",\n\t\t\t\t\"client\",\n\t\t\t);\n\t\t}\n\t}\n\n\tasync function injectSkills(userMessages: Message[]): Promise<Message[]> {\n\t\tif ((config.skills ?? []).length === 0) return userMessages;\n\t\tconst selected = skillIndex.select(promptText(userMessages));\n\t\tif (selected.length === 0) return userMessages;\n\t\tconst contents = await Promise.all(selected.map((s) => skillIndex.load(s)));\n\t\tconst skillBlock = textMessage(\n\t\t\t\"system\",\n\t\t\t`Relevant skill knowledge:\\n${contents.join(\"\\n\\n\")}`,\n\t\t);\n\t\treturn [skillBlock, ...userMessages];\n\t}\n\n\tasync function callProvider(req: GenerateRequest): Promise<GenerateResponse> {\n\t\tconst ctx: MiddlewareContext = {\n\t\t\tagentName: config.name,\n\t\t\trequest: req,\n\t\t};\n\t\tconst pipeline = composeMiddleware(middleware, (c) => config.provider.generate(c.request));\n\t\treturn pipeline(ctx);\n\t}\n\n\tasync function prepare(input: AgentInput, opts?: RunOptions): Promise<Thread> {\n\t\tconst userMessages = normalizeInput(input);\n\t\tgateVision(userMessages);\n\t\tconst thread =\n\t\t\topts?.thread ??\n\t\t\tnew Thread(undefined, [textMessage(\"system\", config.instructions)]);\n\t\tconst withSkills = await injectSkills(userMessages);\n\t\tfor (const m of withSkills) thread.add(m);\n\t\tawait thread.maybeCompact(config.provider, {\n\t\t\tcompactionThreshold: config.compactionThreshold,\n\t\t\tcompactionModel: config.compactionModel,\n\t\t} satisfies ThreadOptions);\n\t\treturn thread;\n\t}\n\n\tasync function run(input: AgentInput, opts?: RunOptions): Promise<RunResult> {\n\t\tlet thread: Thread;\n\t\ttry {\n\t\t\tthread = await prepare(input, opts);\n\t\t} catch (e) {\n\t\t\tif (e instanceof ProviderError) {\n\t\t\t\treturn { output: \"\", status: \"failed\", partial: false, error: e, thread: opts?.thread ?? new Thread() };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\n\t\ttry {\n\t\t\tconst loop = await runLoop(callProvider, registry, thread.messages, {\n\t\t\t\tmaxIterations: config.maxIterations,\n\t\t\t\ttoolTimeoutMs: config.toolTimeoutMs,\n\t\t\t\tsignal: opts?.signal,\n\t\t\t});\n\t\t\tif (loop.final.text) {\n\t\t\t\tthread.add({ role: \"assistant\", parts: [{ type: \"text\", text: loop.final.text }] });\n\t\t\t}\n\t\t\treturn {\n\t\t\t\toutput: loop.final.text,\n\t\t\t\treasoning: config.provider.capabilities.supportsReasoning ? loop.final.reasoning : undefined,\n\t\t\t\tstatus: loop.status,\n\t\t\t\tpartial: loop.status === \"incomplete\",\n\t\t\t\tthread,\n\t\t\t};\n\t\t} catch (e) {\n\t\t\tif (e instanceof ProviderError) {\n\t\t\t\treturn { output: \"\", status: \"failed\", partial: false, error: e, thread };\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\n\tasync function* runStream(input: AgentInput, opts?: RunOptions): AsyncIterable<RunChunk> {\n\t\t// Streaming path: single provider streaming call (tool loops use non-streaming\n\t\t// internally). Suitable for the common single-turn streaming case.\n\t\tlet thread: Thread;\n\t\ttry {\n\t\t\tthread = await prepare(input, opts);\n\t\t} catch (e) {\n\t\t\tif (e instanceof ProviderError) {\n\t\t\t\tyield { type: \"done\", result: { output: \"\", status: \"failed\", partial: false, error: e, thread: opts?.thread ?? new Thread() } };\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\n\t\tlet text = \"\";\n\t\tlet reasoning = \"\";\n\t\ttry {\n\t\t\tfor await (const chunk of config.provider.generateStream({\n\t\t\t\tmessages: thread.messages,\n\t\t\t\ttools: registry.specs(),\n\t\t\t\tsignal: opts?.signal,\n\t\t\t})) {\n\t\t\t\tif (chunk.type === \"text\") {\n\t\t\t\t\ttext += chunk.text;\n\t\t\t\t\tyield { type: \"text\", text: chunk.text };\n\t\t\t\t} else if (chunk.type === \"reasoning\" && config.provider.capabilities.supportsReasoning) {\n\t\t\t\t\treasoning += chunk.text;\n\t\t\t\t\tyield { type: \"reasoning\", text: chunk.text };\n\t\t\t\t} else if (chunk.type === \"done\") {\n\t\t\t\t\ttext = chunk.response.text || text;\n\t\t\t\t\treasoning = chunk.response.reasoning || reasoning;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconst error = e instanceof ProviderError ? e : new ProviderError((e as Error).message, \"transient\");\n\t\t\tyield {\n\t\t\t\ttype: \"done\",\n\t\t\t\tresult: { output: text, status: \"incomplete\", partial: true, error, thread },\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\n\t\tif (text) thread.add({ role: \"assistant\", parts: [{ type: \"text\", text }] });\n\t\tyield {\n\t\t\ttype: \"done\",\n\t\t\tresult: {\n\t\t\t\toutput: text,\n\t\t\t\treasoning: config.provider.capabilities.supportsReasoning ? reasoning || undefined : undefined,\n\t\t\t\tstatus: \"completed\",\n\t\t\t\tpartial: false,\n\t\t\t\tthread,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn { name: config.name, run, runStream };\n}\n\nexport type { ContentPart };\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/skills/skill.ts
|
|
2
|
+
function defineSkill(skill) {
|
|
3
|
+
return skill;
|
|
4
|
+
}
|
|
5
|
+
async function loadSource(source) {
|
|
6
|
+
switch (source.kind) {
|
|
7
|
+
case "inline":
|
|
8
|
+
return source.content;
|
|
9
|
+
case "code":
|
|
10
|
+
return source.load();
|
|
11
|
+
case "file": {
|
|
12
|
+
const { readFile } = await import('fs/promises');
|
|
13
|
+
return readFile(source.path, "utf8");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/skills/index.ts
|
|
19
|
+
var STOPWORDS = /* @__PURE__ */ new Set([
|
|
20
|
+
"the",
|
|
21
|
+
"a",
|
|
22
|
+
"an",
|
|
23
|
+
"and",
|
|
24
|
+
"or",
|
|
25
|
+
"of",
|
|
26
|
+
"to",
|
|
27
|
+
"in",
|
|
28
|
+
"for",
|
|
29
|
+
"on",
|
|
30
|
+
"is",
|
|
31
|
+
"are",
|
|
32
|
+
"with",
|
|
33
|
+
"how",
|
|
34
|
+
"what",
|
|
35
|
+
"do",
|
|
36
|
+
"does",
|
|
37
|
+
"i",
|
|
38
|
+
"you",
|
|
39
|
+
"it",
|
|
40
|
+
"this",
|
|
41
|
+
"that"
|
|
42
|
+
]);
|
|
43
|
+
function tokenize(text) {
|
|
44
|
+
return new Set(
|
|
45
|
+
text.toLowerCase().split(/[^a-z0-9]+/).filter((w) => w.length > 2 && !STOPWORDS.has(w))
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
var SkillIndex = class {
|
|
49
|
+
entries = [];
|
|
50
|
+
constructor(skills = []) {
|
|
51
|
+
for (const s of skills) this.add(s);
|
|
52
|
+
}
|
|
53
|
+
/** Add a skill to the index (description-only). */
|
|
54
|
+
add(skill) {
|
|
55
|
+
this.entries.push({ skill, tokens: tokenize(`${skill.name} ${skill.description}`) });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Select skills relevant to `prompt` by keyword overlap with their descriptions.
|
|
59
|
+
*
|
|
60
|
+
* @param prompt - The user prompt.
|
|
61
|
+
* @param minOverlap - Minimum overlapping tokens to count as relevant. Default 1.
|
|
62
|
+
*/
|
|
63
|
+
select(prompt, minOverlap = 1) {
|
|
64
|
+
const promptTokens = tokenize(prompt);
|
|
65
|
+
const scored = [];
|
|
66
|
+
for (const { skill, tokens } of this.entries) {
|
|
67
|
+
let score = 0;
|
|
68
|
+
for (const t of tokens) if (promptTokens.has(t)) score++;
|
|
69
|
+
if (score >= minOverlap) scored.push({ skill, score });
|
|
70
|
+
}
|
|
71
|
+
return scored.sort((a, b) => b.score - a.score).map((s) => s.skill);
|
|
72
|
+
}
|
|
73
|
+
/** Load the full content of a selected skill (concatenated sources). (FR-017) */
|
|
74
|
+
async load(skill) {
|
|
75
|
+
const parts = await Promise.all(skill.sources.map(loadSource));
|
|
76
|
+
return parts.join("\n\n");
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { SkillIndex, defineSkill, loadSource };
|
|
81
|
+
//# sourceMappingURL=chunk-YCBDEEAV.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-YCBDEEAV.js.map
|
|
@@ -0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C7D,IAAA,OAAO,KAAA,CAAM,KAAK,MAAM,CAAA;AAAA,EACzB;AACD","file":"chunk-YCBDEEAV.js","sourcesContent":["/**\n * Skills: domain-specific knowledge bundles attached to agents. Skills use\n * progressive disclosure — only a skill's short description is used to decide\n * relevance, and its full content is loaded only when the skill is deemed needed.\n * (FR-016, FR-017)\n *\n * @packageDocumentation\n */\n\n/** A source of skill content, loaded on demand. */\nexport type SkillSource =\n\t| { kind: \"inline\"; content: string }\n\t| { kind: \"file\"; path: string }\n\t| { kind: \"code\"; load: () => Promise<string> };\n\n/** A domain knowledge bundle. */\nexport interface Skill {\n\t/** Unique skill name. */\n\tname: string;\n\t/** Short description — the ONLY text used to decide relevance. (FR-017) */\n\tdescription: string;\n\t/** Content sources, read only when the skill is selected. */\n\tsources: SkillSource[];\n}\n\n/**\n * Define a skill.\n *\n * @example\n * ```ts\n * const refund = defineSkill({\n * name: \"refund-policy\",\n * description: \"Company refund and return rules.\",\n * sources: [{ kind: \"inline\", content: \"Refunds allowed within 30 days...\" }],\n * });\n * ```\n */\nexport function defineSkill(skill: Skill): Skill {\n\treturn skill;\n}\n\n/** Read a single source's content. File sources require a Node runtime. */\nexport async function loadSource(source: SkillSource): Promise<string> {\n\tswitch (source.kind) {\n\t\tcase \"inline\":\n\t\t\treturn source.content;\n\t\tcase \"code\":\n\t\t\treturn source.load();\n\t\tcase \"file\": {\n\t\t\tconst { readFile } = await import(\"node:fs/promises\");\n\t\t\treturn readFile(source.path, \"utf8\");\n\t\t}\n\t}\n}\n","/**\n * Client-side keyword/text index over skill descriptions. No embeddings and no\n * extra provider — relevance is decided by simple token overlap so it runs fully\n * in the browser/edge. Full content is loaded only after a skill is selected.\n * (FR-017, FR-017a)\n *\n * @packageDocumentation\n */\n\nimport type { Skill } from \"./skill.js\";\nimport { loadSource } from \"./skill.js\";\n\nexport * from \"./skill.js\";\n\nconst STOPWORDS = new Set([\n\t\"the\", \"a\", \"an\", \"and\", \"or\", \"of\", \"to\", \"in\", \"for\", \"on\", \"is\", \"are\",\n\t\"with\", \"how\", \"what\", \"do\", \"does\", \"i\", \"you\", \"it\", \"this\", \"that\",\n]);\n\nfunction tokenize(text: string): Set<string> {\n\treturn new Set(\n\t\ttext\n\t\t\t.toLowerCase()\n\t\t\t.split(/[^a-z0-9]+/)\n\t\t\t.filter((w) => w.length > 2 && !STOPWORDS.has(w)),\n\t);\n}\n\n/** Indexes skills by description and selects relevant ones for a prompt. */\nexport class SkillIndex {\n\tprivate readonly entries: Array<{ skill: Skill; tokens: Set<string> }> = [];\n\n\tconstructor(skills: Skill[] = []) {\n\t\tfor (const s of skills) this.add(s);\n\t}\n\n\t/** Add a skill to the index (description-only). */\n\tadd(skill: Skill): void {\n\t\tthis.entries.push({ skill, tokens: tokenize(`${skill.name} ${skill.description}`) });\n\t}\n\n\t/**\n\t * Select skills relevant to `prompt` by keyword overlap with their descriptions.\n\t *\n\t * @param prompt - The user prompt.\n\t * @param minOverlap - Minimum overlapping tokens to count as relevant. Default 1.\n\t */\n\tselect(prompt: string, minOverlap = 1): Skill[] {\n\t\tconst promptTokens = tokenize(prompt);\n\t\tconst scored: Array<{ skill: Skill; score: number }> = [];\n\t\tfor (const { skill, tokens } of this.entries) {\n\t\t\tlet score = 0;\n\t\t\tfor (const t of tokens) if (promptTokens.has(t)) score++;\n\t\t\tif (score >= minOverlap) scored.push({ skill, score });\n\t\t}\n\t\treturn scored.sort((a, b) => b.score - a.score).map((s) => s.skill);\n\t}\n\n\t/** Load the full content of a selected skill (concatenated sources). (FR-017) */\n\tasync load(skill: Skill): Promise<string> {\n\t\tconst parts = await Promise.all(skill.sources.map(loadSource));\n\t\treturn parts.join(\"\\n\\n\");\n\t}\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { requireCapability } from './chunk-ACBIHS5H.js';
|
|
2
|
+
import { MCPError } from './chunk-IXV4UIF5.js';
|
|
3
|
+
|
|
4
|
+
// src/mcp/adapter.ts
|
|
5
|
+
function mcpToolToTool(serverId, def, client) {
|
|
6
|
+
return {
|
|
7
|
+
name: def.name,
|
|
8
|
+
description: def.description ?? "",
|
|
9
|
+
inputSchema: def.inputSchema,
|
|
10
|
+
source: serverId,
|
|
11
|
+
enabled: true,
|
|
12
|
+
async run(args) {
|
|
13
|
+
try {
|
|
14
|
+
const result = await client.callTool({ name: def.name, arguments: args });
|
|
15
|
+
return result.content ?? result;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw new MCPError(`MCP tool "${def.name}" failed: ${e.message}`, serverId);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/mcp/connection.ts
|
|
24
|
+
async function createTransport(config) {
|
|
25
|
+
if (config.transport.kind === "stdio") {
|
|
26
|
+
requireCapability("canSpawnProcess", "MCP stdio transport");
|
|
27
|
+
const { StdioClientTransport } = await import('@modelcontextprotocol/sdk/client/stdio.js');
|
|
28
|
+
return new StdioClientTransport({
|
|
29
|
+
command: config.transport.command,
|
|
30
|
+
args: config.transport.args ?? []
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const { StreamableHTTPClientTransport } = await import('@modelcontextprotocol/sdk/client/streamableHttp.js');
|
|
34
|
+
return new StreamableHTTPClientTransport(new URL(config.transport.url));
|
|
35
|
+
}
|
|
36
|
+
async function connectMCP(config) {
|
|
37
|
+
let client;
|
|
38
|
+
async function connect() {
|
|
39
|
+
try {
|
|
40
|
+
const { Client } = await import('@modelcontextprotocol/sdk/client/index.js');
|
|
41
|
+
const transport = await createTransport(config);
|
|
42
|
+
client = new Client({ name: "agent-framework-js", version: "0.1.0" }, { capabilities: {} });
|
|
43
|
+
await client.connect(transport);
|
|
44
|
+
} catch (e) {
|
|
45
|
+
if (e.name === "RuntimeUnsupportedError") throw e;
|
|
46
|
+
throw new MCPError(`Failed to connect to MCP server: ${e.message}`, config.id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function listTools() {
|
|
50
|
+
if (!client) throw new MCPError("Not connected", config.id);
|
|
51
|
+
try {
|
|
52
|
+
const result = await client.listTools();
|
|
53
|
+
return (result.tools ?? []).map(
|
|
54
|
+
(t) => mcpToolToTool(config.id, t, client)
|
|
55
|
+
);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
throw new MCPError(`Failed to list tools: ${e.message}`, config.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function close() {
|
|
61
|
+
await client?.close?.();
|
|
62
|
+
client = void 0;
|
|
63
|
+
}
|
|
64
|
+
return { id: config.id, connect, listTools, close };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { connectMCP, mcpToolToTool };
|
|
68
|
+
//# sourceMappingURL=chunk-YH5746OF.js.map
|
|
69
|
+
//# sourceMappingURL=chunk-YH5746OF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/adapter.ts","../src/mcp/connection.ts"],"names":[],"mappings":";;;;AAqBO,SAAS,aAAA,CAAc,QAAA,EAAkB,GAAA,EAAiB,MAAA,EAAmB;AACnF,EAAA,OAAO;AAAA,IACN,MAAM,GAAA,CAAI,IAAA;AAAA,IACV,WAAA,EAAa,IAAI,WAAA,IAAe,EAAA;AAAA,IAChC,aAAa,GAAA,CAAI,WAAA;AAAA,IACjB,MAAA,EAAQ,QAAA;AAAA,IACR,OAAA,EAAS,IAAA;AAAA,IACT,MAAM,IAAI,IAAA,EAAiC;AAC1C,MAAA,IAAI;AACH,QAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,QAAA,CAAS,EAAE,MAAM,GAAA,CAAI,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,CAAA;AACxE,QAAA,OAAO,OAAO,OAAA,IAAW,MAAA;AAAA,MAC1B,SAAS,CAAA,EAAG;AACX,QAAA,MAAM,IAAI,SAAS,CAAA,UAAA,EAAa,GAAA,CAAI,IAAI,CAAA,UAAA,EAAc,CAAA,CAAY,OAAO,CA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AO,CAAA,CAAA,EAAI,OAAO,EAAE,CAAA;AAAA,IACzF;AAAA,EACD;AAEA,EAAA,eAAe,SAAA,GAA6B;AAC3C,IAAA,IAAI,CAAC,MAAA,EAAQ,MAAM,IAAI,QAAA,CAAS,eAAA,EAAiB,OAAO,EAAE,CAAA;AAC1D,IAAA,IAAI;AACH,MAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,SAAA,EAAU;AACtC,MAAA,OAAA,CAAQ,MAAA,CAAO,KAAA,IAAS,EAAC,EAAG,GAAA;AAAA,QAAI,CAAC,CAAA,KAChC,aAAA,CAAc,MAAA,CAAO,EAAA,EAAI,GAAG,MAAM;AAAA,OACnC;AAAA,IACD,SAAS,CAAA,EAAG;AACX,MAAA,MAAM,IAAI,QAAA,CAAS,CAAA,sBAAA,EAA0B,EAAY,OAAO,CAAA,CAAA,EAAI,OAAO,EAAE,CAAA;AAAA,IAC9E;AAAA,EACD;AAEA,EAAA,eAAe,KAAA,GAAuB;AACrC,IAAA,MAAM,QAAQ,KAAA,IAAQ;AACtB,IAAA,MAAA,GAAS,MAAA;AAAA,EACV;AAEA,EAAA,OAAO,EAAE,EAAA,EAAI,MAAA,CAAO,EAAA,EAAI,OAAA,EAAS,WAAW,KAAA,EAAM;AACnD","file":"chunk-YH5746OF.js","sourcesContent":["/**\n * Adapts MCP-provided tools onto the framework's uniform {@link Tool} contract,\n * namespaced by the connection id so collisions are impossible. (FR-014, FR-014a)\n *\n * @packageDocumentation\n */\n\nimport type { Tool } from \"../tools/tool.js\";\nimport { MCPError } from \"../core/errors.js\";\n\ninterface MCPToolDef {\n\tname: string;\n\tdescription?: string;\n\tinputSchema: Record<string, unknown>;\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Wrap an MCP tool definition as a framework tool. Invocation calls back through\n * the MCP client; failures surface as typed {@link MCPError}/tool errors.\n */\nexport function mcpToolToTool(serverId: string, def: MCPToolDef, client: any): Tool {\n\treturn {\n\t\tname: def.name,\n\t\tdescription: def.description ?? \"\",\n\t\tinputSchema: def.inputSchema,\n\t\tsource: serverId,\n\t\tenabled: true,\n\t\tasync run(args: unknown): Promise<unknown> {\n\t\t\ttry {\n\t\t\t\tconst result = await client.callTool({ name: def.name, arguments: args });\n\t\t\t\treturn result.content ?? result;\n\t\t\t} catch (e) {\n\t\t\t\tthrow new MCPError(`MCP tool \"${def.name}\" failed: ${(e as Error).message}`, serverId);\n\t\t\t}\n\t\t},\n\t};\n}\n","/**\n * MCP (Model Context Protocol) integration. Connects to MCP servers and exposes\n * their tools through the framework's uniform tool interface.\n *\n * Remote transport (HTTP/SSE) works in all runtimes; stdio (spawning a server\n * process) works only where process spawning is permitted (Node). Requesting\n * stdio elsewhere throws a typed {@link RuntimeUnsupportedError}. (FR-013, FR-013a,\n * FR-013b, FR-030a)\n *\n * The `@modelcontextprotocol/sdk` package is an optional peer dependency and is\n * loaded lazily so browser bundles that do not use MCP pay no cost.\n *\n * @packageDocumentation\n */\n\nimport { MCPError } from \"../core/errors.js\";\nimport { requireCapability } from \"../core/runtime.js\";\nimport type { Tool } from \"../tools/tool.js\";\nimport { mcpToolToTool } from \"./adapter.js\";\n\n/** Transport options for an MCP connection. */\nexport type MCPTransport =\n\t| { kind: \"remote\"; url: string }\n\t| { kind: \"stdio\"; command: string; args?: string[] };\n\n/** Configuration for connecting to an MCP server. */\nexport interface MCPConnectionConfig {\n\t/** Connection id; becomes the namespace prefix for discovered tools. (FR-014a) */\n\tid: string;\n\ttransport: MCPTransport;\n\t/** Whether the connection's tools are enabled. Defaults to true. */\n\tenabled?: boolean;\n}\n\n/** A live connection to an MCP server. */\nexport interface MCPConnection {\n\treadonly id: string;\n\tconnect(): Promise<void>;\n\tlistTools(): Promise<Tool[]>;\n\tclose(): Promise<void>;\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype AnyClient = any;\n\nasync function createTransport(config: MCPConnectionConfig): Promise<AnyClient> {\n\tif (config.transport.kind === \"stdio\") {\n\t\t// Gate on runtime capability before attempting to spawn. (FR-013b, FR-030a)\n\t\trequireCapability(\"canSpawnProcess\", \"MCP stdio transport\");\n\t\tconst { StdioClientTransport } = await import(\n\t\t\t\"@modelcontextprotocol/sdk/client/stdio.js\"\n\t\t);\n\t\treturn new StdioClientTransport({\n\t\t\tcommand: config.transport.command,\n\t\t\targs: config.transport.args ?? [],\n\t\t});\n\t}\n\tconst { StreamableHTTPClientTransport } = await import(\n\t\t\"@modelcontextprotocol/sdk/client/streamableHttp.js\"\n\t);\n\treturn new StreamableHTTPClientTransport(new URL(config.transport.url));\n}\n\n/**\n * Connect to an MCP server.\n *\n * @example\n * ```ts\n * const mcp = await connectMCP({ id: \"docs\", transport: { kind: \"remote\", url: \"https://mcp.example.com\" } });\n * const tools = await mcp.listTools(); // namespaced as docs.<tool>\n * ```\n */\nexport async function connectMCP(config: MCPConnectionConfig): Promise<MCPConnection> {\n\tlet client: AnyClient | undefined;\n\n\tasync function connect(): Promise<void> {\n\t\ttry {\n\t\t\tconst { Client } = await import(\"@modelcontextprotocol/sdk/client/index.js\");\n\t\t\tconst transport = await createTransport(config);\n\t\t\tclient = new Client({ name: \"agent-framework-js\", version: \"0.1.0\" }, { capabilities: {} });\n\t\t\tawait client.connect(transport);\n\t\t} catch (e) {\n\t\t\t// Preserve typed runtime errors; wrap everything else as an MCP error.\n\t\t\tif ((e as Error).name === \"RuntimeUnsupportedError\") throw e;\n\t\t\tthrow new MCPError(`Failed to connect to MCP server: ${(e as Error).message}`, config.id);\n\t\t}\n\t}\n\n\tasync function listTools(): Promise<Tool[]> {\n\t\tif (!client) throw new MCPError(\"Not connected\", config.id);\n\t\ttry {\n\t\t\tconst result = await client.listTools();\n\t\t\treturn (result.tools ?? []).map((t: { name: string; description?: string; inputSchema: Record<string, unknown> }) =>\n\t\t\t\tmcpToolToTool(config.id, t, client),\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tthrow new MCPError(`Failed to list tools: ${(e as Error).message}`, config.id);\n\t\t}\n\t}\n\n\tasync function close(): Promise<void> {\n\t\tawait client?.close?.();\n\t\tclient = undefined;\n\t}\n\n\treturn { id: config.id, connect, listTools, close };\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkYBFLWRO5_cjs = require('./chunk-YBFLWRO5.cjs');
|
|
4
|
+
var chunkMQ2XTH3S_cjs = require('./chunk-MQ2XTH3S.cjs');
|
|
5
|
+
|
|
6
|
+
// src/declarative/loader.ts
|
|
7
|
+
function looksLikeJson(source) {
|
|
8
|
+
const t = source.trimStart();
|
|
9
|
+
return t.startsWith("{") || t.startsWith("[");
|
|
10
|
+
}
|
|
11
|
+
async function parse(source) {
|
|
12
|
+
if (looksLikeJson(source)) {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(source);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
throw new chunkMQ2XTH3S_cjs.ValidationError(`Invalid JSON definition: ${e.message}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const YAML = await import('yaml');
|
|
20
|
+
try {
|
|
21
|
+
return YAML.parse(source);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
throw new chunkMQ2XTH3S_cjs.ValidationError(`Invalid YAML definition: ${e.message}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function assertDefinition(value) {
|
|
27
|
+
const d = value;
|
|
28
|
+
if (!d || typeof d.name !== "string" || typeof d.instructions !== "string" || !d.provider) {
|
|
29
|
+
throw new chunkMQ2XTH3S_cjs.ValidationError("Definition must include name, instructions, and provider");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function loadAgentDefinition(source, deps) {
|
|
33
|
+
const parsed = await parse(source);
|
|
34
|
+
assertDefinition(parsed);
|
|
35
|
+
const provider = deps.providerFactory(parsed.provider, deps.getCredential);
|
|
36
|
+
const tools = (parsed.tools ?? []).map((name) => deps.tools?.[name]).filter((t) => !!t);
|
|
37
|
+
const skills = (parsed.skills ?? []).map((name) => deps.skills?.[name]).filter((s) => !!s);
|
|
38
|
+
return chunkYBFLWRO5_cjs.createAgent({
|
|
39
|
+
name: parsed.name,
|
|
40
|
+
instructions: parsed.instructions,
|
|
41
|
+
provider,
|
|
42
|
+
tools,
|
|
43
|
+
skills,
|
|
44
|
+
maxIterations: parsed.maxIterations
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.loadAgentDefinition = loadAgentDefinition;
|
|
49
|
+
//# sourceMappingURL=chunk-YKZJRE32.cjs.map
|
|
50
|
+
//# sourceMappingURL=chunk-YKZJRE32.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/declarative/loader.ts"],"names":["ValidationError","createAgent"],"mappings":";;;;;;AA+CA,SAAS,cAAc,MAAA,EAAyB;AAC/C,EAAA,MAAM,CAAA,GAAI,OAAO,SAAA,EAAU;AAC3B,EAAA,OAAO,EAAE,UAAA,CAAW,GAAG,CAAA,IAAK,CAAA,CAAE,WAAW,GAAG,CAAA;AAC7C;AAEA,eAAe,MAAM,MAAA,EAAkC;AACtD,EAAA,IAAI,aAAA,CAAc,MAAM,CAAA,EAAG;AAC1B,IAAA,IAAI;AACH,MAAA,OAAO,IAAA,CAAK,MAAM,MAAM,CAAA;AAAA,IACzB,SAAS,CAAA,EAAG;AACX,MAAA,MAAM,IAAIA,iCAAA,CAAgB,CAAA,yBAAA,EAA6B,CAAA,CAAY,OAAO,CAAA,CAAE,CAAA;AAAA,IAC7E;AAAA,EACD;AAEA,EAAA,MAAM,IAAA,GAAO,MAAM,OAAO,MAAM,CAAA;AAChC,EAAA,IAAI;AACH,IAAA,OAAO,IAAA,CAAK,MAAM,MAAM,CAAA;AAAA,EACzB,SAAS,CAAA,EAAG;AACX,IAAA,MAAM,IAAIA,iCAAA,CAAgB,CAAA,yBAAA,EAA6B,CAAA,CAAY,OAAO,CAAA,CAAE,CAAA;AAAA,EAC7E;AACD;AAEA,SAAS,iBAAiB,KAAA,EAAkD;AAC3E,EAAA,MAAM,CAAA,GAAI,KAAA;AACV,EAAA,IAAI,CAAC,CAAA,IAAK,OAAO,CAAA,CAAE,IAAA,KAAS,QAAA,IAAY,OAAO,CAAA,CAAE,YAAA,KAAiB,QAAA,IAAY,CAAC,CAAA,CAAE,QAAA,EAAU;AAC1F,IAAA,MAAM,IAAIA,kCAAgB,0DAA0D,CAAA;AAAA,EACrF;AACD;AAaA,eAAsB,mBAAA,CAAoB,QAAgB,IAAA,EAAkC;AAC3F,EAAA,MAAM,MAAA,GAAS,MAAM,KAAA,CAAM,MAAM,CAAA;AACjC,EAAA,gBAAA,CAAiB,MAAM,CAAA;AAEvB,EAAA,MAAM,WAAW,IAAA,CAAK,eAAA,CAAgB,MAAA,CAAO,QAAA,EAAU,KAAK,aAAa,CAAA;AACzE,EAAA,MAAM,SAAS,MAAA,CAAO,KAAA,IAAS,EAAC,EAC9B,GAAA,CAAI,CAAC,IAAA,KAAS,IAAA,CAAK,KAAA,GAAQ,IAAI,CAAC,CAAA,CAChC,MAAA,CAAO,CAAC,CAAA,KAAiB,CAAC,CAAC,CAAC,CAAA;AAC9B,EAAA,MAAM,UAAU,MAAA,CAAO,MAAA,IAAU,EAAC,EAChC,GAAA,CAAI,CAAC,IAAA,KAAS,IAAA,CAAK,MAAA,GAAS,IAAI,CAAC,CAAA,CACjC,MAAA,CAAO,CAAC,CAAA,KAAkB,CAAC,CAAC,CAAC,CAAA;AAE/B,EAAA,OAAOC,6BAAA,CAAY;AAAA,IAClB,MAAM,MAAA,CAAO,IAAA;AAAA,IACb,cAAc,MAAA,CAAO,YAAA;AAAA,IACrB,QAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,eAAe,MAAA,CAAO;AAAA,GACtB,CAAA;AACF","file":"chunk-YKZJRE32.cjs","sourcesContent":["/**\n * Declarative agent definitions. Agents can be defined in YAML or JSON against a\n * single shared schema; the loader auto-detects the format (the YAML parser is\n * lazy-loaded so JSON-only/browser use pays no cost) and builds an equivalent\n * runnable agent. Credentials are still injected via callback, never embedded.\n * (FR-027, FR-005a)\n *\n * @packageDocumentation\n */\n\nimport type { ModelCapabilities } from \"../core/types.js\";\nimport type { Provider } from \"../providers/provider.js\";\nimport type { Tool } from \"../tools/tool.js\";\nimport type { Skill } from \"../skills/skill.js\";\nimport { createAgent, type Agent } from \"../agents/agent.js\";\nimport { ValidationError } from \"../core/errors.js\";\n\n/** Provider section of a declarative definition. */\nexport interface ProviderDefinition extends ModelCapabilities {\n\ttype: \"copilot\" | \"openai-compatible\";\n\tbaseUrl?: string;\n}\n\n/** A declarative agent definition (shared by YAML and JSON). */\nexport interface AgentDefinition {\n\tname: string;\n\tinstructions: string;\n\tprovider: ProviderDefinition;\n\t/** Names referencing tools provided in `deps.tools`. */\n\ttools?: string[];\n\t/** Names referencing skills provided in `deps.skills`. */\n\tskills?: string[];\n\tmaxIterations?: number;\n}\n\n/** Dependencies the loader needs to construct a live agent. */\nexport interface LoaderDeps {\n\t/** Build a provider from the definition + injected credential. */\n\tproviderFactory: (def: ProviderDefinition, getCredential: () => string | Promise<string>) => Provider;\n\t/** Credential callback — never embedded in the definition. (FR-005a) */\n\tgetCredential: () => string | Promise<string>;\n\t/** Registered tools available for reference by name. */\n\ttools?: Record<string, Tool>;\n\t/** Registered skills available for reference by name. */\n\tskills?: Record<string, Skill>;\n}\n\nfunction looksLikeJson(source: string): boolean {\n\tconst t = source.trimStart();\n\treturn t.startsWith(\"{\") || t.startsWith(\"[\");\n}\n\nasync function parse(source: string): Promise<unknown> {\n\tif (looksLikeJson(source)) {\n\t\ttry {\n\t\t\treturn JSON.parse(source);\n\t\t} catch (e) {\n\t\t\tthrow new ValidationError(`Invalid JSON definition: ${(e as Error).message}`);\n\t\t}\n\t}\n\t// Lazy-load the YAML parser only when needed. (FR-027)\n\tconst YAML = await import(\"yaml\");\n\ttry {\n\t\treturn YAML.parse(source);\n\t} catch (e) {\n\t\tthrow new ValidationError(`Invalid YAML definition: ${(e as Error).message}`);\n\t}\n}\n\nfunction assertDefinition(value: unknown): asserts value is AgentDefinition {\n\tconst d = value as Partial<AgentDefinition>;\n\tif (!d || typeof d.name !== \"string\" || typeof d.instructions !== \"string\" || !d.provider) {\n\t\tthrow new ValidationError(\"Definition must include name, instructions, and provider\");\n\t}\n}\n\n/**\n * Load an agent from a YAML or JSON definition string.\n *\n * @example\n * ```ts\n * const agent = await loadAgentDefinition(yamlOrJson, {\n * providerFactory,\n * getCredential: () => process.env.LMSTUDIO_KEY ?? \"\",\n * });\n * ```\n */\nexport async function loadAgentDefinition(source: string, deps: LoaderDeps): Promise<Agent> {\n\tconst parsed = await parse(source);\n\tassertDefinition(parsed);\n\n\tconst provider = deps.providerFactory(parsed.provider, deps.getCredential);\n\tconst tools = (parsed.tools ?? [])\n\t\t.map((name) => deps.tools?.[name])\n\t\t.filter((t): t is Tool => !!t);\n\tconst skills = (parsed.skills ?? [])\n\t\t.map((name) => deps.skills?.[name])\n\t\t.filter((s): s is Skill => !!s);\n\n\treturn createAgent({\n\t\tname: parsed.name,\n\t\tinstructions: parsed.instructions,\n\t\tprovider,\n\t\ttools,\n\t\tskills,\n\t\tmaxIterations: parsed.maxIterations,\n\t});\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkYKZJRE32_cjs = require('../chunk-YKZJRE32.cjs');
|
|
4
|
+
require('../chunk-YBFLWRO5.cjs');
|
|
5
|
+
require('../chunk-WSMYH2IN.cjs');
|
|
6
|
+
require('../chunk-TAMJ5HSR.cjs');
|
|
7
|
+
require('../chunk-FSDMBWQV.cjs');
|
|
8
|
+
require('../chunk-LMN75W3W.cjs');
|
|
9
|
+
require('../chunk-MQ2XTH3S.cjs');
|
|
10
|
+
require('../chunk-IJASUMIQ.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Object.defineProperty(exports, "loadAgentDefinition", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkYKZJRE32_cjs.loadAgentDefinition; }
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { a as ModelCapabilities } from '../types-Cn1g9Tg4.cjs';
|
|
2
|
+
import { P as Provider } from '../provider-CMAymr1b.cjs';
|
|
3
|
+
import { T as Tool } from '../tool-BZg_znMZ.cjs';
|
|
4
|
+
import { S as Skill } from '../skill-DfNChtJN.cjs';
|
|
5
|
+
import { A as Agent } from '../index-DdYZeNIu.cjs';
|
|
6
|
+
import '../errors-CjVz4W_5.cjs';
|
|
7
|
+
import '../thread-Dfo9LLf7.cjs';
|
|
8
|
+
import '../registry-D4fThGiN.cjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Declarative agent definitions. Agents can be defined in YAML or JSON against a
|
|
12
|
+
* single shared schema; the loader auto-detects the format (the YAML parser is
|
|
13
|
+
* lazy-loaded so JSON-only/browser use pays no cost) and builds an equivalent
|
|
14
|
+
* runnable agent. Credentials are still injected via callback, never embedded.
|
|
15
|
+
* (FR-027, FR-005a)
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Provider section of a declarative definition. */
|
|
21
|
+
interface ProviderDefinition extends ModelCapabilities {
|
|
22
|
+
type: "copilot" | "openai-compatible";
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A declarative agent definition (shared by YAML and JSON). */
|
|
26
|
+
interface AgentDefinition {
|
|
27
|
+
name: string;
|
|
28
|
+
instructions: string;
|
|
29
|
+
provider: ProviderDefinition;
|
|
30
|
+
/** Names referencing tools provided in `deps.tools`. */
|
|
31
|
+
tools?: string[];
|
|
32
|
+
/** Names referencing skills provided in `deps.skills`. */
|
|
33
|
+
skills?: string[];
|
|
34
|
+
maxIterations?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Dependencies the loader needs to construct a live agent. */
|
|
37
|
+
interface LoaderDeps {
|
|
38
|
+
/** Build a provider from the definition + injected credential. */
|
|
39
|
+
providerFactory: (def: ProviderDefinition, getCredential: () => string | Promise<string>) => Provider;
|
|
40
|
+
/** Credential callback — never embedded in the definition. (FR-005a) */
|
|
41
|
+
getCredential: () => string | Promise<string>;
|
|
42
|
+
/** Registered tools available for reference by name. */
|
|
43
|
+
tools?: Record<string, Tool>;
|
|
44
|
+
/** Registered skills available for reference by name. */
|
|
45
|
+
skills?: Record<string, Skill>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Load an agent from a YAML or JSON definition string.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const agent = await loadAgentDefinition(yamlOrJson, {
|
|
53
|
+
* providerFactory,
|
|
54
|
+
* getCredential: () => process.env.LMSTUDIO_KEY ?? "",
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare function loadAgentDefinition(source: string, deps: LoaderDeps): Promise<Agent>;
|
|
59
|
+
|
|
60
|
+
export { type AgentDefinition, type LoaderDeps, type ProviderDefinition, loadAgentDefinition };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { a as ModelCapabilities } from '../types-Cn1g9Tg4.js';
|
|
2
|
+
import { P as Provider } from '../provider-osAtfZ7x.js';
|
|
3
|
+
import { T as Tool } from '../tool-CSCC87OD.js';
|
|
4
|
+
import { S as Skill } from '../skill-DfNChtJN.js';
|
|
5
|
+
import { A as Agent } from '../index-D7-znzrc.js';
|
|
6
|
+
import '../errors-CjVz4W_5.js';
|
|
7
|
+
import '../thread-CWVzTyti.js';
|
|
8
|
+
import '../registry-CpO0yH5v.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Declarative agent definitions. Agents can be defined in YAML or JSON against a
|
|
12
|
+
* single shared schema; the loader auto-detects the format (the YAML parser is
|
|
13
|
+
* lazy-loaded so JSON-only/browser use pays no cost) and builds an equivalent
|
|
14
|
+
* runnable agent. Credentials are still injected via callback, never embedded.
|
|
15
|
+
* (FR-027, FR-005a)
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Provider section of a declarative definition. */
|
|
21
|
+
interface ProviderDefinition extends ModelCapabilities {
|
|
22
|
+
type: "copilot" | "openai-compatible";
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A declarative agent definition (shared by YAML and JSON). */
|
|
26
|
+
interface AgentDefinition {
|
|
27
|
+
name: string;
|
|
28
|
+
instructions: string;
|
|
29
|
+
provider: ProviderDefinition;
|
|
30
|
+
/** Names referencing tools provided in `deps.tools`. */
|
|
31
|
+
tools?: string[];
|
|
32
|
+
/** Names referencing skills provided in `deps.skills`. */
|
|
33
|
+
skills?: string[];
|
|
34
|
+
maxIterations?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Dependencies the loader needs to construct a live agent. */
|
|
37
|
+
interface LoaderDeps {
|
|
38
|
+
/** Build a provider from the definition + injected credential. */
|
|
39
|
+
providerFactory: (def: ProviderDefinition, getCredential: () => string | Promise<string>) => Provider;
|
|
40
|
+
/** Credential callback — never embedded in the definition. (FR-005a) */
|
|
41
|
+
getCredential: () => string | Promise<string>;
|
|
42
|
+
/** Registered tools available for reference by name. */
|
|
43
|
+
tools?: Record<string, Tool>;
|
|
44
|
+
/** Registered skills available for reference by name. */
|
|
45
|
+
skills?: Record<string, Skill>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Load an agent from a YAML or JSON definition string.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const agent = await loadAgentDefinition(yamlOrJson, {
|
|
53
|
+
* providerFactory,
|
|
54
|
+
* getCredential: () => process.env.LMSTUDIO_KEY ?? "",
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare function loadAgentDefinition(source: string, deps: LoaderDeps): Promise<Agent>;
|
|
59
|
+
|
|
60
|
+
export { type AgentDefinition, type LoaderDeps, type ProviderDefinition, loadAgentDefinition };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { loadAgentDefinition } from '../chunk-VLSVL5N2.js';
|
|
2
|
+
import '../chunk-RD5YUB2E.js';
|
|
3
|
+
import '../chunk-YCBDEEAV.js';
|
|
4
|
+
import '../chunk-HGEPXJDG.js';
|
|
5
|
+
import '../chunk-7ZXUIHLH.js';
|
|
6
|
+
import '../chunk-XPXTXOYQ.js';
|
|
7
|
+
import '../chunk-IXV4UIF5.js';
|
|
8
|
+
import '../chunk-DEABART4.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error hierarchy. Every failure surfaced by the framework is one of these
|
|
3
|
+
* typed errors so callers (and agents) can branch on `kind` rather than parsing
|
|
4
|
+
* messages. All error serialization passes through redaction (see `redaction.ts`).
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/** Discriminator for {@link FrameworkError} subclasses. */
|
|
9
|
+
type ErrorKind = "provider" | "tool" | "mcp" | "checkpoint" | "runtime-unsupported" | "validation";
|
|
10
|
+
/** Base class for all framework errors. */
|
|
11
|
+
declare abstract class FrameworkError extends Error {
|
|
12
|
+
abstract readonly kind: ErrorKind;
|
|
13
|
+
/** Optional structured details (already redaction-safe at serialization time). */
|
|
14
|
+
readonly details?: Record<string, unknown>;
|
|
15
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
16
|
+
/** Redaction-safe JSON form used by logs/traces. */
|
|
17
|
+
toJSON(): Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/** Reason a provider call failed. Transient reasons are retryable. */
|
|
20
|
+
type ProviderErrorReason = "transient" | "auth" | "client" | "malformed";
|
|
21
|
+
/** LLM provider failure. (FR-008a) */
|
|
22
|
+
declare class ProviderError extends FrameworkError {
|
|
23
|
+
readonly kind: "provider";
|
|
24
|
+
readonly reason: ProviderErrorReason;
|
|
25
|
+
readonly status?: number;
|
|
26
|
+
constructor(message: string, reason: ProviderErrorReason, opts?: {
|
|
27
|
+
status?: number;
|
|
28
|
+
details?: Record<string, unknown>;
|
|
29
|
+
});
|
|
30
|
+
/** Whether this error should be retried with backoff. */
|
|
31
|
+
get retryable(): boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Reason a tool invocation failed. */
|
|
34
|
+
type ToolErrorReason = "not-found" | "invalid-arguments" | "timeout" | "run-failure";
|
|
35
|
+
/** Tool invocation failure. (FR-011a, FR-012c) */
|
|
36
|
+
declare class ToolError extends FrameworkError {
|
|
37
|
+
readonly kind: "tool";
|
|
38
|
+
readonly reason: ToolErrorReason;
|
|
39
|
+
readonly toolName: string;
|
|
40
|
+
constructor(message: string, reason: ToolErrorReason, toolName: string, details?: Record<string, unknown>);
|
|
41
|
+
}
|
|
42
|
+
/** MCP server failure (e.g., unavailable). (FR-015) */
|
|
43
|
+
declare class MCPError extends FrameworkError {
|
|
44
|
+
readonly kind: "mcp";
|
|
45
|
+
readonly serverId: string;
|
|
46
|
+
constructor(message: string, serverId: string, details?: Record<string, unknown>);
|
|
47
|
+
}
|
|
48
|
+
/** Reason a checkpoint could not be restored. (FR-022a) */
|
|
49
|
+
type CheckpointErrorReason = "corrupt" | "version-mismatch";
|
|
50
|
+
/** Checkpoint restore failure. Fails closed — no partial restore. */
|
|
51
|
+
declare class CheckpointError extends FrameworkError {
|
|
52
|
+
readonly kind: "checkpoint";
|
|
53
|
+
readonly reason: CheckpointErrorReason;
|
|
54
|
+
constructor(message: string, reason: CheckpointErrorReason, details?: Record<string, unknown>);
|
|
55
|
+
}
|
|
56
|
+
/** A feature was requested that the current runtime cannot support. (FR-030a) */
|
|
57
|
+
declare class RuntimeUnsupportedError extends FrameworkError {
|
|
58
|
+
readonly kind: "runtime-unsupported";
|
|
59
|
+
readonly feature: string;
|
|
60
|
+
constructor(feature: string, details?: Record<string, unknown>);
|
|
61
|
+
}
|
|
62
|
+
/** Schema validation failure. (FR-011) */
|
|
63
|
+
declare class ValidationError extends FrameworkError {
|
|
64
|
+
readonly kind: "validation";
|
|
65
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { CheckpointError as C, type ErrorKind as E, FrameworkError as F, MCPError as M, ProviderError as P, RuntimeUnsupportedError as R, ToolError as T, ValidationError as V, type CheckpointErrorReason as a, type ProviderErrorReason as b, type ToolErrorReason as c };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error hierarchy. Every failure surfaced by the framework is one of these
|
|
3
|
+
* typed errors so callers (and agents) can branch on `kind` rather than parsing
|
|
4
|
+
* messages. All error serialization passes through redaction (see `redaction.ts`).
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/** Discriminator for {@link FrameworkError} subclasses. */
|
|
9
|
+
type ErrorKind = "provider" | "tool" | "mcp" | "checkpoint" | "runtime-unsupported" | "validation";
|
|
10
|
+
/** Base class for all framework errors. */
|
|
11
|
+
declare abstract class FrameworkError extends Error {
|
|
12
|
+
abstract readonly kind: ErrorKind;
|
|
13
|
+
/** Optional structured details (already redaction-safe at serialization time). */
|
|
14
|
+
readonly details?: Record<string, unknown>;
|
|
15
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
16
|
+
/** Redaction-safe JSON form used by logs/traces. */
|
|
17
|
+
toJSON(): Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/** Reason a provider call failed. Transient reasons are retryable. */
|
|
20
|
+
type ProviderErrorReason = "transient" | "auth" | "client" | "malformed";
|
|
21
|
+
/** LLM provider failure. (FR-008a) */
|
|
22
|
+
declare class ProviderError extends FrameworkError {
|
|
23
|
+
readonly kind: "provider";
|
|
24
|
+
readonly reason: ProviderErrorReason;
|
|
25
|
+
readonly status?: number;
|
|
26
|
+
constructor(message: string, reason: ProviderErrorReason, opts?: {
|
|
27
|
+
status?: number;
|
|
28
|
+
details?: Record<string, unknown>;
|
|
29
|
+
});
|
|
30
|
+
/** Whether this error should be retried with backoff. */
|
|
31
|
+
get retryable(): boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Reason a tool invocation failed. */
|
|
34
|
+
type ToolErrorReason = "not-found" | "invalid-arguments" | "timeout" | "run-failure";
|
|
35
|
+
/** Tool invocation failure. (FR-011a, FR-012c) */
|
|
36
|
+
declare class ToolError extends FrameworkError {
|
|
37
|
+
readonly kind: "tool";
|
|
38
|
+
readonly reason: ToolErrorReason;
|
|
39
|
+
readonly toolName: string;
|
|
40
|
+
constructor(message: string, reason: ToolErrorReason, toolName: string, details?: Record<string, unknown>);
|
|
41
|
+
}
|
|
42
|
+
/** MCP server failure (e.g., unavailable). (FR-015) */
|
|
43
|
+
declare class MCPError extends FrameworkError {
|
|
44
|
+
readonly kind: "mcp";
|
|
45
|
+
readonly serverId: string;
|
|
46
|
+
constructor(message: string, serverId: string, details?: Record<string, unknown>);
|
|
47
|
+
}
|
|
48
|
+
/** Reason a checkpoint could not be restored. (FR-022a) */
|
|
49
|
+
type CheckpointErrorReason = "corrupt" | "version-mismatch";
|
|
50
|
+
/** Checkpoint restore failure. Fails closed — no partial restore. */
|
|
51
|
+
declare class CheckpointError extends FrameworkError {
|
|
52
|
+
readonly kind: "checkpoint";
|
|
53
|
+
readonly reason: CheckpointErrorReason;
|
|
54
|
+
constructor(message: string, reason: CheckpointErrorReason, details?: Record<string, unknown>);
|
|
55
|
+
}
|
|
56
|
+
/** A feature was requested that the current runtime cannot support. (FR-030a) */
|
|
57
|
+
declare class RuntimeUnsupportedError extends FrameworkError {
|
|
58
|
+
readonly kind: "runtime-unsupported";
|
|
59
|
+
readonly feature: string;
|
|
60
|
+
constructor(feature: string, details?: Record<string, unknown>);
|
|
61
|
+
}
|
|
62
|
+
/** Schema validation failure. (FR-011) */
|
|
63
|
+
declare class ValidationError extends FrameworkError {
|
|
64
|
+
readonly kind: "validation";
|
|
65
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { CheckpointError as C, type ErrorKind as E, FrameworkError as F, MCPError as M, ProviderError as P, RuntimeUnsupportedError as R, ToolError as T, ValidationError as V, type CheckpointErrorReason as a, type ProviderErrorReason as b, type ToolErrorReason as c };
|