{"version":3,"file":"runtime-tool-surface.d.ts","sourceRoot":"","sources":["../../src/core/runtime-tool-surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,6BAA6B;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IAC1C,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,0BAA0B,EAAE,6BAA6B,EAAE,CAAC;IAC5D,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC1B;AAQD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,YAAY,GAAG,0BAA0B,CAc3F","sourcesContent":["import type { AgentSession } from \"./agent-session.js\";\n\nexport interface RuntimeToolDefinitionSnapshot {\n\tname: string;\n\tdescription: string;\n\tparameters: unknown;\n}\n\nexport interface RuntimeToolSurfaceSnapshot {\n\teffectiveModel: string | undefined;\n\teffectiveProvider: string | undefined;\n\tactiveToolNames: string[];\n\tmodelFacingToolDefinitions: RuntimeToolDefinitionSnapshot[];\n\tdispatcherToolNames: string[];\n\tpromptToolNames: string[];\n}\n\nfunction extractPromptToolNames(systemPrompt: string): string[] {\n\tconst toolsSection =\n\t\tsystemPrompt.match(/Available tools:\\n([\\s\\S]*?)\\n\\n(?:Execution environment|In addition)/)?.[1] ?? \"\";\n\treturn [...toolsSection.matchAll(/^- ([a-z][a-z0-9_]*):/gm)].map((match) => match[1]);\n}\n\n/**\n * Capture the tool surface of an already-constructed runtime without making a\n * provider request. The model-facing definitions and dispatcher references are\n * deliberately read from Agent.state.tools, the exact collection used by the\n * agent loop at the provider boundary.\n */\nexport function captureRuntimeToolSurface(session: AgentSession): RuntimeToolSurfaceSnapshot {\n\tconst activeTools = session.agent.state.tools;\n\treturn {\n\t\teffectiveModel: session.model?.id,\n\t\teffectiveProvider: session.model?.provider,\n\t\tactiveToolNames: activeTools.map((tool) => tool.name),\n\t\tmodelFacingToolDefinitions: activeTools.map((tool) => ({\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description,\n\t\t\tparameters: tool.parameters,\n\t\t})),\n\t\tdispatcherToolNames: activeTools.map((tool) => tool.name),\n\t\tpromptToolNames: extractPromptToolNames(session.systemPrompt),\n\t};\n}\n"]}