@mcp-use/agent 0.0.0-bootstrap.0 → 2.0.0-beta.0

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.
Files changed (131) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/adapters/base.d.ts +112 -0
  3. package/dist/adapters/base.d.ts.map +1 -0
  4. package/dist/adapters/index.d.ts +3 -0
  5. package/dist/adapters/index.d.ts.map +1 -0
  6. package/dist/adapters/langchain_adapter.d.ts +26 -0
  7. package/dist/adapters/langchain_adapter.d.ts.map +1 -0
  8. package/dist/adapters/native_adapter.d.ts +27 -0
  9. package/dist/adapters/native_adapter.d.ts.map +1 -0
  10. package/dist/agents/agent_options.d.ts +38 -0
  11. package/dist/agents/agent_options.d.ts.map +1 -0
  12. package/dist/agents/base.d.ts +27 -0
  13. package/dist/agents/base.d.ts.map +1 -0
  14. package/dist/agents/display.d.ts +6 -0
  15. package/dist/agents/display.d.ts.map +1 -0
  16. package/dist/agents/index.d.ts +9 -0
  17. package/dist/agents/index.d.ts.map +1 -0
  18. package/dist/agents/mcp_agent.d.ts +90 -0
  19. package/dist/agents/mcp_agent.d.ts.map +1 -0
  20. package/dist/agents/mcp_agent_langchain.d.ts +283 -0
  21. package/dist/agents/mcp_agent_langchain.d.ts.map +1 -0
  22. package/dist/agents/normalize_run_options.d.ts +12 -0
  23. package/dist/agents/normalize_run_options.d.ts.map +1 -0
  24. package/dist/agents/prompts/index.d.ts +10 -0
  25. package/dist/agents/prompts/index.d.ts.map +1 -0
  26. package/dist/agents/prompts/system_prompt_builder.d.ts +4 -0
  27. package/dist/agents/prompts/system_prompt_builder.d.ts.map +1 -0
  28. package/dist/agents/prompts/templates.d.ts +3 -0
  29. package/dist/agents/prompts/templates.d.ts.map +1 -0
  30. package/dist/agents/remote.d.ts +48 -0
  31. package/dist/agents/remote.d.ts.map +1 -0
  32. package/dist/agents/run_options.d.ts +13 -0
  33. package/dist/agents/run_options.d.ts.map +1 -0
  34. package/dist/agents/types.d.ts +79 -0
  35. package/dist/agents/types.d.ts.map +1 -0
  36. package/dist/agents/utils/ai_sdk.d.ts +22 -0
  37. package/dist/agents/utils/ai_sdk.d.ts.map +1 -0
  38. package/dist/agents/utils/index.d.ts +3 -0
  39. package/dist/agents/utils/index.d.ts.map +1 -0
  40. package/dist/agents/utils/llm_provider.d.ts +53 -0
  41. package/dist/agents/utils/llm_provider.d.ts.map +1 -0
  42. package/dist/browser-agent.cjs +3272 -0
  43. package/dist/browser-agent.cjs.map +1 -0
  44. package/dist/browser-agent.d.ts +9 -0
  45. package/dist/browser-agent.d.ts.map +1 -0
  46. package/dist/browser-agent.js +3227 -0
  47. package/dist/browser-agent.js.map +1 -0
  48. package/dist/index.cjs +3299 -0
  49. package/dist/index.cjs.map +1 -0
  50. package/dist/index.d.ts +14 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +3248 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/langchain.cjs +46340 -0
  55. package/dist/langchain.cjs.map +1 -0
  56. package/dist/langchain.d.ts +11 -0
  57. package/dist/langchain.d.ts.map +1 -0
  58. package/dist/langchain.js +46328 -0
  59. package/dist/langchain.js.map +1 -0
  60. package/dist/llm/chat.d.ts +8 -0
  61. package/dist/llm/chat.d.ts.map +1 -0
  62. package/dist/llm/driver.d.ts +40 -0
  63. package/dist/llm/driver.d.ts.map +1 -0
  64. package/dist/llm/messageFormat.d.ts +48 -0
  65. package/dist/llm/messageFormat.d.ts.map +1 -0
  66. package/dist/llm/native_runner.d.ts +23 -0
  67. package/dist/llm/native_runner.d.ts.map +1 -0
  68. package/dist/llm/ndjson.d.ts +5 -0
  69. package/dist/llm/ndjson.d.ts.map +1 -0
  70. package/dist/llm/provider_config.d.ts +13 -0
  71. package/dist/llm/provider_config.d.ts.map +1 -0
  72. package/dist/llm/providers/anthropic.d.ts +19 -0
  73. package/dist/llm/providers/anthropic.d.ts.map +1 -0
  74. package/dist/llm/providers/google.d.ts +19 -0
  75. package/dist/llm/providers/google.d.ts.map +1 -0
  76. package/dist/llm/providers/index.d.ts +19 -0
  77. package/dist/llm/providers/index.d.ts.map +1 -0
  78. package/dist/llm/providers/ollama/index.d.ts +18 -0
  79. package/dist/llm/providers/ollama/index.d.ts.map +1 -0
  80. package/dist/llm/providers/ollama/utils.d.ts +7 -0
  81. package/dist/llm/providers/ollama/utils.d.ts.map +1 -0
  82. package/dist/llm/providers/openai-chat-completions.d.ts +25 -0
  83. package/dist/llm/providers/openai-chat-completions.d.ts.map +1 -0
  84. package/dist/llm/providers/openai-responses-driver.d.ts +22 -0
  85. package/dist/llm/providers/openai-responses-driver.d.ts.map +1 -0
  86. package/dist/llm/providers/openai-responses.d.ts +37 -0
  87. package/dist/llm/providers/openai-responses.d.ts.map +1 -0
  88. package/dist/llm/providers/openai-shared.d.ts +6 -0
  89. package/dist/llm/providers/openai-shared.d.ts.map +1 -0
  90. package/dist/llm/schemaUtils.d.ts +2 -0
  91. package/dist/llm/schemaUtils.d.ts.map +1 -0
  92. package/dist/llm/sse.d.ts +15 -0
  93. package/dist/llm/sse.d.ts.map +1 -0
  94. package/dist/llm/toolLoop.d.ts +41 -0
  95. package/dist/llm/toolLoop.d.ts.map +1 -0
  96. package/dist/llm/toolResultParts.d.ts +28 -0
  97. package/dist/llm/toolResultParts.d.ts.map +1 -0
  98. package/dist/llm/types.d.ts +116 -0
  99. package/dist/llm/types.d.ts.map +1 -0
  100. package/dist/llm/usage.d.ts +4 -0
  101. package/dist/llm/usage.d.ts.map +1 -0
  102. package/dist/managers/server_manager.d.ts +19 -0
  103. package/dist/managers/server_manager.d.ts.map +1 -0
  104. package/dist/managers/tools/acquire_active_mcp_server.d.ts +13 -0
  105. package/dist/managers/tools/acquire_active_mcp_server.d.ts.map +1 -0
  106. package/dist/managers/tools/add_server_from_config.d.ts +15 -0
  107. package/dist/managers/tools/add_server_from_config.d.ts.map +1 -0
  108. package/dist/managers/tools/base.d.ts +19 -0
  109. package/dist/managers/tools/base.d.ts.map +1 -0
  110. package/dist/managers/tools/connect_mcp_server.d.ts +18 -0
  111. package/dist/managers/tools/connect_mcp_server.d.ts.map +1 -0
  112. package/dist/managers/tools/index.d.ts +6 -0
  113. package/dist/managers/tools/index.d.ts.map +1 -0
  114. package/dist/managers/tools/list_mcp_servers.d.ts +13 -0
  115. package/dist/managers/tools/list_mcp_servers.d.ts.map +1 -0
  116. package/dist/managers/tools/release_mcp_server_connection.d.ts +13 -0
  117. package/dist/managers/tools/release_mcp_server_connection.d.ts.map +1 -0
  118. package/dist/managers/types.d.ts +14 -0
  119. package/dist/managers/types.d.ts.map +1 -0
  120. package/dist/observability/index.d.ts +9 -0
  121. package/dist/observability/index.d.ts.map +1 -0
  122. package/dist/observability/langfuse.d.ts +26 -0
  123. package/dist/observability/langfuse.d.ts.map +1 -0
  124. package/dist/observability/manager.d.ts +89 -0
  125. package/dist/observability/manager.d.ts.map +1 -0
  126. package/dist/telemetry/utils.d.ts +4 -0
  127. package/dist/telemetry/utils.d.ts.map +1 -0
  128. package/dist/version.d.ts +3 -0
  129. package/dist/version.d.ts.map +1 -0
  130. package/package.json +109 -8
  131. package/README.md +0 -5
@@ -0,0 +1,8 @@
1
+ import type { ProviderConfig, ProviderMessage } from "./types.js";
2
+ /** Single-shot chat completion without tools (sampling, props generation). */
3
+ export declare function completeChat(params: {
4
+ config: ProviderConfig;
5
+ messages: ProviderMessage[];
6
+ signal?: AbortSignal;
7
+ }): Promise<string>;
8
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/llm/chat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE,8EAA8E;AAC9E,wBAAsB,YAAY,CAAC,MAAM,EAAE;IACzC,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlB"}
@@ -0,0 +1,40 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool, ProviderToolCall } from "./types.js";
2
+ import type { ToolLoopParams } from "./toolLoop.js";
3
+ export interface LlmDriverStreamParams {
4
+ messages: ProviderMessage[];
5
+ tools: ProviderTool[];
6
+ signal?: AbortSignal;
7
+ }
8
+ export interface LlmDriverCompleteParams extends LlmDriverStreamParams {
9
+ messages: ProviderMessage[];
10
+ tools: ProviderTool[];
11
+ signal?: AbortSignal;
12
+ }
13
+ export interface LlmDriverCompleteResult {
14
+ text: string;
15
+ toolCalls: ProviderToolCall[];
16
+ }
17
+ /** Pluggable LLM backend for the native tool loop. */
18
+ export interface LlmDriver {
19
+ readonly managesToolLoop?: boolean;
20
+ stream(params: LlmDriverStreamParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
21
+ complete(params: LlmDriverCompleteParams): Promise<LlmDriverCompleteResult>;
22
+ streamToolLoop?(params: ToolLoopParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
23
+ runToolLoopNonStreaming?(params: ToolLoopParams): Promise<{
24
+ content: string;
25
+ toolCalls: {
26
+ toolName: string;
27
+ args: Record<string, unknown>;
28
+ result: unknown;
29
+ }[];
30
+ }>;
31
+ }
32
+ export declare function createLlmDriver(config: ProviderConfig): LlmDriver;
33
+ /** Raw fetch + SSE/NDJSON providers (non-OpenAI and legacy proxy paths). */
34
+ export declare class RestLlmDriver implements LlmDriver {
35
+ private readonly config;
36
+ constructor(config: ProviderConfig);
37
+ stream(params: LlmDriverStreamParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
38
+ complete(params: LlmDriverCompleteParams): Promise<LlmDriverCompleteResult>;
39
+ }
40
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/llm/driver.ts"],"names":[],"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EAAE,cAAc,GAAG,SAAS,CAKjE;AAED,4EAA4E;AAC5E,qBAAa,aAAc,YAAW,SAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAEnD,MAAM,CACJ,MAAM,EAAE,qBAAqB,GAC5B,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC;IAS1C,QAAQ,CACZ,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;CASpC"}
@@ -0,0 +1,48 @@
1
+ import type { ProviderMessage } from "./types.js";
2
+ interface InspectorAttachment {
3
+ type: "image" | "file";
4
+ data: string;
5
+ mimeType: string;
6
+ }
7
+ interface InspectorMessagePart {
8
+ type: "text" | "tool-invocation";
9
+ text?: string;
10
+ toolInvocation?: {
11
+ toolName: string;
12
+ args: Record<string, unknown>;
13
+ result?: unknown;
14
+ };
15
+ }
16
+ interface InspectorMessageLike {
17
+ role: "user" | "assistant";
18
+ content: unknown;
19
+ attachments?: InspectorAttachment[];
20
+ parts?: InspectorMessagePart[];
21
+ }
22
+ /**
23
+ * Convert inspector chat `Message[]` to provider-neutral `ProviderMessage[]`.
24
+ *
25
+ * Assistant messages with completed tool invocations are expanded into an
26
+ * assistant message (bearing `toolCalls`) followed by one `tool` message per
27
+ * invocation carrying the serialized result. This mirrors what the inspector
28
+ * previously built using LangChain's AIMessage + ToolMessage pair.
29
+ */
30
+ export declare function convertMessagesToProvider(messages: InspectorMessageLike[]): ProviderMessage[];
31
+ /**
32
+ * Extract the top-level `system` instruction (if any) from a ProviderMessage
33
+ * list and return both the system text and the messages without it.
34
+ *
35
+ * Anthropic and Google do not accept a `system` role inside their `messages`
36
+ * array; they take it as a top-level field instead.
37
+ */
38
+ export declare function extractSystem(messages: ProviderMessage[]): {
39
+ system?: string;
40
+ rest: ProviderMessage[];
41
+ };
42
+ /** Parse a `data:...;base64,...` URL. */
43
+ export declare function parseDataUrl(url: string): {
44
+ mimeType: string;
45
+ data: string;
46
+ } | null;
47
+ export {};
48
+ //# sourceMappingURL=messageFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageFormat.d.ts","sourceRoot":"","sources":["../../src/llm/messageFormat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/D,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAsBD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,EAAE,GAC/B,eAAe,EAAE,CAgEnB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,eAAe,EAAE,CAAC;CACzB,CAiBA;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,GACV;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAI3C"}
@@ -0,0 +1,23 @@
1
+ import type { LlmDriver } from "./driver.js";
2
+ import type { LlmStreamEvent, ProviderMessage, ProviderTool } from "./types.js";
3
+ export interface NativeRunOptions {
4
+ messages: ProviderMessage[];
5
+ tools: ProviderTool[];
6
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
7
+ maxSteps?: number;
8
+ signal?: AbortSignal;
9
+ }
10
+ export interface AgentStep {
11
+ action: {
12
+ tool: string;
13
+ toolInput: Record<string, unknown>;
14
+ log: string;
15
+ };
16
+ observation: string;
17
+ }
18
+ /** Internal native agent runtime: loop → fetch + callTool. */
19
+ export declare function streamNativeAgent(driver: LlmDriver, options: NativeRunOptions): AsyncGenerator<LlmStreamEvent, void, unknown>;
20
+ /** Map LlmStreamEvent stream to legacy AgentStep yields for MCPAgent.stream(). */
21
+ export declare function streamNativeAgentSteps(driver: LlmDriver, options: NativeRunOptions): AsyncGenerator<AgentStep, string, void>;
22
+ export declare function runNativeAgent(driver: LlmDriver, options: NativeRunOptions): Promise<string>;
23
+ //# sourceMappingURL=native_runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native_runner.d.ts","sourceRoot":"","sources":["../../src/llm/native_runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnC,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,8DAA8D;AAC9D,wBAAuB,iBAAiB,CACtC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAS/C;AAED,kFAAkF;AAClF,wBAAuB,sBAAsB,CAC3C,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,GACxB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAiCzC;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAUjB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Minimal newline-delimited JSON parser for Ollama streaming responses.
3
+ */
4
+ export declare function parseNDJSON(body: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<unknown, void, unknown>;
5
+ //# sourceMappingURL=ndjson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson.d.ts","sourceRoot":"","sources":["../../src/llm/ndjson.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAuB,WAAW,CAChC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAuCxC"}
@@ -0,0 +1,13 @@
1
+ import type { ProviderConfig, ProviderName } from "./types.js";
2
+ export interface NativeLLMConfig {
3
+ apiKey?: string;
4
+ temperature?: number;
5
+ maxTokens?: number;
6
+ baseUrl?: string;
7
+ extraHeaders?: Record<string, string>;
8
+ credentials?: RequestCredentials;
9
+ }
10
+ /** Parse "provider/model" into native ProviderConfig (no LangChain). */
11
+ export declare function parseLLMStringToProviderConfig(llmString: string, config?: NativeLLMConfig): ProviderConfig;
12
+ export declare function providerConfigFromOptions(provider: ProviderName, model: string, config?: NativeLLMConfig): ProviderConfig;
13
+ //# sourceMappingURL=provider_config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider_config.d.ts","sourceRoot":"","sources":["../../src/llm/provider_config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AA6BD,wEAAwE;AACxE,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,eAAe,GACvB,cAAc,CAgChB;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,eAAe,GACvB,cAAc,CAWhB"}
@@ -0,0 +1,19 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../types.js";
2
+ interface ChatParams {
3
+ config: ProviderConfig;
4
+ messages: ProviderMessage[];
5
+ tools?: ProviderTool[];
6
+ signal?: AbortSignal;
7
+ }
8
+ export declare function toAnthropicMessages(messages: ProviderMessage[]): unknown[];
9
+ export declare function streamChat(params: ChatParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
10
+ export declare function chat(params: ChatParams): Promise<{
11
+ text: string;
12
+ toolCalls: {
13
+ id: string;
14
+ name: string;
15
+ args: Record<string, unknown>;
16
+ }[];
17
+ }>;
18
+ export {};
19
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/anthropic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAmED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CA+C1E;AAuBD,wBAAuB,UAAU,CAC/B,MAAM,EAAE,UAAU,GACjB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAkI/C;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E,CAAC,CAyCD"}
@@ -0,0 +1,19 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../types.js";
2
+ interface ChatParams {
3
+ config: ProviderConfig;
4
+ messages: ProviderMessage[];
5
+ tools?: ProviderTool[];
6
+ signal?: AbortSignal;
7
+ }
8
+ export declare function toGeminiContents(messages: ProviderMessage[]): unknown[];
9
+ export declare function streamChat(params: ChatParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
10
+ export declare function chat(params: ChatParams): Promise<{
11
+ text: string;
12
+ toolCalls: {
13
+ id: string;
14
+ name: string;
15
+ args: Record<string, unknown>;
16
+ }[];
17
+ }>;
18
+ export {};
19
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/google.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EAEb,MAAM,aAAa,CAAC;AAGrB,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAyFD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAoDvE;AA+BD,wBAAuB,UAAU,CAC/B,MAAM,EAAE,UAAU,GACjB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAuE/C;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E,CAAC,CAuCD"}
@@ -0,0 +1,19 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../types.js";
2
+ interface ChatParams {
3
+ config: ProviderConfig;
4
+ messages: ProviderMessage[];
5
+ tools?: ProviderTool[];
6
+ signal?: AbortSignal;
7
+ }
8
+ interface ChatResult {
9
+ text: string;
10
+ toolCalls: {
11
+ id: string;
12
+ name: string;
13
+ args: Record<string, unknown>;
14
+ }[];
15
+ }
16
+ export declare function streamChat(params: ChatParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
17
+ export declare function chat(params: ChatParams): Promise<ChatResult>;
18
+ export {};
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAMrB,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E;AAiBD,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,GACjB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAmB/C;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB5D"}
@@ -0,0 +1,18 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../../types.js";
2
+ interface ChatParams {
3
+ config: ProviderConfig;
4
+ messages: ProviderMessage[];
5
+ tools?: ProviderTool[];
6
+ signal?: AbortSignal;
7
+ }
8
+ export declare function streamChat(params: ChatParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
9
+ export declare function chat(params: ChatParams): Promise<{
10
+ text: string;
11
+ toolCalls: {
12
+ id: string;
13
+ name: string;
14
+ args: Record<string, unknown>;
15
+ }[];
16
+ }>;
17
+ export {};
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/llm/providers/ollama/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EAEb,MAAM,gBAAgB,CAAC;AAIxB,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA2JD,wBAAuB,UAAU,CAC/B,MAAM,EAAE,UAAU,GACjB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAoF/C;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E,CAAC,CA2BD"}
@@ -0,0 +1,7 @@
1
+ export declare const DEFAULT_OLLAMA_BASE_URL = "http://localhost:11434";
2
+ export declare function normalizeOllamaBaseUrl(baseUrl?: string): string;
3
+ export declare function buildOllamaApiUrl(baseUrl: string | undefined, path: `/api/${string}`): string;
4
+ export declare class OllamaCorsError extends Error {
5
+ constructor(cause: unknown);
6
+ }
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/llm/providers/ollama/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAS/D;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,IAAI,EAAE,QAAQ,MAAM,EAAE,GACrB,MAAM,CAER;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,KAAK,EAAE,OAAO;CAQ3B"}
@@ -0,0 +1,25 @@
1
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../types.js";
2
+ /** Structured HTTP error from an LLM provider fetch (preserves status + JSON body). */
3
+ export declare class LlmRequestError extends Error {
4
+ readonly status: number;
5
+ readonly body?: unknown;
6
+ constructor(status: number, message: string, body?: unknown);
7
+ }
8
+ interface ChatParams {
9
+ config: ProviderConfig;
10
+ messages: ProviderMessage[];
11
+ tools?: ProviderTool[];
12
+ signal?: AbortSignal;
13
+ }
14
+ export declare function toOpenAIMessages(messages: ProviderMessage[]): unknown[];
15
+ export declare function streamChat(params: ChatParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
16
+ export declare function chat(params: ChatParams): Promise<{
17
+ text: string;
18
+ toolCalls: {
19
+ id: string;
20
+ name: string;
21
+ args: Record<string, unknown>;
22
+ }[];
23
+ }>;
24
+ export {};
25
+ //# sourceMappingURL=openai-chat-completions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-chat-completions.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai-chat-completions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAGrB,uFAAuF;AACvF,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAM5D;AAmBD,UAAU,UAAU;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AA2BD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAoDvE;AAED,wBAAuB,UAAU,CAC/B,MAAM,EAAE,UAAU,GACjB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAmI/C;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E,CAAC,CAiDD"}
@@ -0,0 +1,22 @@
1
+ import type { ToolLoopParams } from "../toolLoop.js";
2
+ import type { LlmDriver, LlmDriverCompleteParams, LlmDriverCompleteResult, LlmDriverStreamParams } from "../driver.js";
3
+ import type { LlmStreamEvent, ProviderConfig } from "../types.js";
4
+ /** OpenAI direct provider — Responses API only. */
5
+ export declare class OpenAIResponsesDriver implements LlmDriver {
6
+ private readonly config;
7
+ readonly managesToolLoop = true;
8
+ constructor(config: ProviderConfig);
9
+ stream(params: LlmDriverStreamParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
10
+ complete(params: LlmDriverCompleteParams): Promise<LlmDriverCompleteResult>;
11
+ streamToolLoop(params: ToolLoopParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
12
+ runToolLoopNonStreaming(params: ToolLoopParams): Promise<{
13
+ content: string;
14
+ toolCalls: {
15
+ toolName: string;
16
+ args: Record<string, unknown>;
17
+ result: unknown;
18
+ }[];
19
+ }>;
20
+ private streamSingleTurn;
21
+ }
22
+ //# sourceMappingURL=openai-responses-driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-responses-driver.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai-responses-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAUlE,mDAAmD;AACnD,qBAAa,qBAAsB,YAAW,SAAS;IAGzC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,QAAQ,CAAC,eAAe,QAAQ;gBAEH,MAAM,EAAE,cAAc;IAEnD,MAAM,CACJ,MAAM,EAAE,qBAAqB,GAC5B,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC;IAI1C,QAAQ,CACZ,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAY5B,cAAc,CACnB,MAAM,EAAE,cAAc,GACrB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC;IAmE1C,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC;QAC7D,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE;YACT,QAAQ,EAAE,MAAM,CAAC;YACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC9B,MAAM,EAAE,OAAO,CAAC;SACjB,EAAE,CAAC;KACL,CAAC;YAwDa,gBAAgB;CAkBhC"}
@@ -0,0 +1,37 @@
1
+ import { isToolResultError } from "../toolResultParts.js";
2
+ import type { LlmStreamEvent, ProviderConfig, ProviderMessage, ProviderTool } from "../types.js";
3
+ export interface ResponsesSeed {
4
+ instructions?: string;
5
+ input: unknown[];
6
+ }
7
+ interface ResponsesTurnParams {
8
+ config: ProviderConfig;
9
+ instructions?: string;
10
+ input: unknown[];
11
+ tools?: ProviderTool[];
12
+ signal?: AbortSignal;
13
+ }
14
+ /** Seed Responses `input` from prior UI/history messages (once per tool-loop run). */
15
+ export declare function seedInputFromMessages(messages: ProviderMessage[]): ResponsesSeed;
16
+ export declare function toResponsesTools(tools: ProviderTool[]): unknown[];
17
+ export declare function serializeToolOutput(result: unknown): string;
18
+ export declare function appendToolOutputsToInput(input: unknown[], callId: string, toolName: string | undefined, result: unknown): void;
19
+ interface FunctionCallItem {
20
+ call_id: string;
21
+ name: string;
22
+ arguments: string;
23
+ }
24
+ export declare function extractFunctionCalls(output: unknown[]): FunctionCallItem[];
25
+ /** Map Responses SSE JSON events → LlmStreamEvent; returns output[] from response.completed. */
26
+ export declare function streamResponsesTurn(params: ResponsesTurnParams): AsyncGenerator<LlmStreamEvent, unknown[], unknown>;
27
+ export declare function completeResponsesTurn(params: ResponsesTurnParams): Promise<{
28
+ text: string;
29
+ output: unknown[];
30
+ toolCalls: {
31
+ id: string;
32
+ name: string;
33
+ args: Record<string, unknown>;
34
+ }[];
35
+ }>;
36
+ export { isToolResultError };
37
+ //# sourceMappingURL=openai-responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-responses.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai-responses.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAC;AAQrB,MAAM,WAAW,aAAa;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAUD,sFAAsF;AACtF,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,eAAe,EAAE,GAC1B,aAAa,CA0Ef;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,CAQjE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQ3D;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,OAAO,GACd,IAAI,CA+BN;AAwBD,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,CAgB1E;AA8BD,gGAAgG;AAChG,wBAAuB,mBAAmB,CACxC,MAAM,EAAE,mBAAmB,GAC1B,cAAc,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,CAwHpD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;CAC1E,CAAC,CAkCD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ProviderConfig } from "../types.js";
2
+ export declare const OPENAI_BASE_URL = "https://api.openai.com/v1";
3
+ export declare function buildEndpoint(config: ProviderConfig, path: string): string;
4
+ export declare function buildHeaders(config: ProviderConfig): Record<string, string>;
5
+ export declare function readOpenAIError(res: Response): Promise<string>;
6
+ //# sourceMappingURL=openai-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-shared.d.ts","sourceRoot":"","sources":["../../../src/llm/providers/openai-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,eAAe,8BAA8B,CAAC;AAE3D,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1E;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS3E;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAGpE"}
@@ -0,0 +1,2 @@
1
+ export declare function sanitizeSchemaForGemini(schema: unknown): Record<string, unknown>;
2
+ //# sourceMappingURL=schemaUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaUtils.d.ts","sourceRoot":"","sources":["../../src/llm/schemaUtils.ts"],"names":[],"mappings":"AA6BA,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Minimal Server-Sent Events parser for provider streaming responses.
3
+ *
4
+ * All three target providers (OpenAI, Anthropic, Google) expose SSE streams
5
+ * over `fetch`. This helper turns the raw `ReadableStream<Uint8Array>` into
6
+ * an async iterable of `{ event, data }` objects. It tolerates CR/LF, blank
7
+ * separator lines, and multi-line `data:` fields.
8
+ */
9
+ interface SseEvent {
10
+ event?: string;
11
+ data: string;
12
+ }
13
+ export declare function parseSSE(body: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<SseEvent, void, unknown>;
14
+ export {};
15
+ //# sourceMappingURL=sse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/llm/sse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,QAAQ;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAuB,QAAQ,CAC7B,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAgCzC"}
@@ -0,0 +1,41 @@
1
+ import type { LlmDriver } from "./driver.js";
2
+ import type { LlmStreamEvent, ProviderMessage, ProviderTool } from "./types.js";
3
+ interface ToolCallFn {
4
+ (name: string, args: Record<string, unknown>): Promise<unknown>;
5
+ }
6
+ export interface ToolLoopParams {
7
+ driver: LlmDriver;
8
+ /** Initial conversation history + the user turn that triggers the run. */
9
+ messages: ProviderMessage[];
10
+ /** Tools available to the LLM (already filtered by the caller). */
11
+ tools: ProviderTool[];
12
+ /** Executes an MCP tool and returns its raw result. */
13
+ callTool: ToolCallFn;
14
+ /** Cap on assistant↔tool turns. */
15
+ maxSteps?: number;
16
+ signal?: AbortSignal;
17
+ }
18
+ /**
19
+ * Provider-agnostic tool loop. Streams the assistant response, executes any
20
+ * tool calls via `callTool`, appends their results, and continues until the
21
+ * assistant produces a response with no more tool calls, or `maxSteps` is
22
+ * exhausted.
23
+ *
24
+ * This replaces MCPAgent.streamEvents() without pulling in langchain.
25
+ */
26
+ export declare function runToolLoop(params: ToolLoopParams): AsyncGenerator<LlmStreamEvent, void, unknown>;
27
+ /**
28
+ * Non-streaming helper used by the server-side `handleChatRequest` path.
29
+ * Runs the same tool loop but collects the final assistant text and tool
30
+ * invocations into a result object.
31
+ */
32
+ export declare function runToolLoopNonStreaming(params: ToolLoopParams): Promise<{
33
+ content: string;
34
+ toolCalls: {
35
+ toolName: string;
36
+ args: Record<string, unknown>;
37
+ result: unknown;
38
+ }[];
39
+ }>;
40
+ export {};
41
+ //# sourceMappingURL=toolLoop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolLoop.d.ts","sourceRoot":"","sources":["../../src/llm/toolLoop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhF,UAAU,UAAU;IAClB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,SAAS,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,mEAAmE;IACnE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,uDAAuD;IACvD,QAAQ,EAAE,UAAU,CAAC;IACrB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAuB,WAAW,CAChC,MAAM,EAAE,cAAc,GACrB,cAAc,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CA4F/C;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,EAAE,OAAO,CAAC;KACjB,EAAE,CAAC;CACL,CAAC,CA6DD"}
@@ -0,0 +1,28 @@
1
+ import type { ContentPart, ImageContentPart } from "./types.js";
2
+ /**
3
+ * Returns true when a tool result carries the MCP `isError: true` flag.
4
+ * Used by both the live tool loop and the replay path so a tool that
5
+ * successfully returns `{ isError: true, content: [...] }` is treated the
6
+ * same as one that threw.
7
+ */
8
+ export declare function isToolResultError(result: unknown): boolean;
9
+ export declare function extractToolResultParts(result: unknown): ContentPart[];
10
+ /**
11
+ * Convenience wrapper used by `toolLoop` and `messageFormat`: returns a string
12
+ * for text-only results and a `ContentPart[]` when any non-text part (currently
13
+ * just images) is present.
14
+ */
15
+ export declare function toolResultToContent(result: unknown): string | ContentPart[];
16
+ /**
17
+ * Split a tool-message `content` field into joined text + image parts. Used by
18
+ * providers (OpenAI, Gemini) that can't carry image bytes inside their tool
19
+ * role and must forward them as a synthetic follow-up user turn.
20
+ */
21
+ export declare function partitionToolContent(content: string | ContentPart[]): {
22
+ text: string;
23
+ imageParts: ImageContentPart[];
24
+ isString: boolean;
25
+ };
26
+ /** Header text introducing image bytes that follow a tool result. */
27
+ export declare function toolImageFollowupHeader(toolName: string | undefined, count: number): string;
28
+ //# sourceMappingURL=toolResultParts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolResultParts.d.ts","sourceRoot":"","sources":["../../src/llm/toolResultParts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AA0EpB;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAM1D;AAoED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,EAAE,CAsCrE;AAeD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,EAAE,CAI3E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAcA;AAED,qEAAqE;AACrE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GACZ,MAAM,CAIR"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Provider-agnostic LLM types used by the inspector.
3
+ *
4
+ * These replace the langchain BaseMessage / StreamEvent types that the
5
+ * inspector previously depended on. The goal is to keep the inspector free
6
+ * of any @langchain/* or langchain runtime imports so that consumers of
7
+ * @mcp-use/inspector (and, transitively, of mcp-use) do not need to install
8
+ * langchain to bundle their apps.
9
+ */
10
+ export type ProviderName = "openai" | "openai-compatible" | "anthropic" | "google" | "openrouter" | "ollama";
11
+ export interface ProviderConfig {
12
+ provider: ProviderName;
13
+ model: string;
14
+ apiKey: string;
15
+ temperature?: number;
16
+ maxTokens?: number;
17
+ baseUrl?: string;
18
+ /** Extra HTTP headers to merge into every request (e.g. OpenRouter's HTTP-Referer). */
19
+ extraHeaders?: Record<string, string>;
20
+ /** Fetch credentials (e.g. `include` for session-cookie auth against a proxy). */
21
+ credentials?: RequestCredentials;
22
+ /** Responses API reasoning effort (direct OpenAI provider). */
23
+ reasoningEffort?: "none" | "low" | "medium" | "high";
24
+ }
25
+ export interface ImageContentPart {
26
+ type: "image";
27
+ /** Full data URL (`data:image/png;base64,...`) or raw https URL. */
28
+ url: string;
29
+ /** Extracted mime type; filled in by `messageFormat` when converting. */
30
+ mimeType?: string;
31
+ /** Base64 payload without the data-URL prefix (when available). */
32
+ data?: string;
33
+ }
34
+ export interface TextContentPart {
35
+ type: "text";
36
+ text: string;
37
+ }
38
+ export type ContentPart = TextContentPart | ImageContentPart;
39
+ /**
40
+ * Provider-neutral message shape. Each provider module is responsible for
41
+ * mapping this into its wire format (OpenAI chat.completions, Anthropic
42
+ * messages, Gemini generateContent).
43
+ */
44
+ export interface ProviderMessage {
45
+ role: "system" | "user" | "assistant" | "tool";
46
+ /** Text content, OR a list of rich content parts (for multimodal input). */
47
+ content: string | ContentPart[];
48
+ /** Tool calls emitted by the assistant (assistant messages only). */
49
+ toolCalls?: ProviderToolCall[];
50
+ /** Tool result payload (tool messages only). */
51
+ toolCallId?: string;
52
+ toolName?: string;
53
+ toolResult?: unknown;
54
+ toolIsError?: boolean;
55
+ }
56
+ export interface ProviderToolCall {
57
+ id: string;
58
+ name: string;
59
+ args: Record<string, unknown>;
60
+ }
61
+ export interface ProviderTool {
62
+ name: string;
63
+ description?: string;
64
+ /** JSON Schema object describing the tool's input. */
65
+ inputSchema: Record<string, unknown>;
66
+ }
67
+ export interface TokenUsage {
68
+ inputTokens?: number;
69
+ outputTokens?: number;
70
+ totalTokens?: number;
71
+ cachedInputTokens?: number;
72
+ reasoningTokens?: number;
73
+ }
74
+ /**
75
+ * Stream events emitted by the tool loop. These replace LangChain's
76
+ * `on_chat_model_stream`, `on_tool_start`, `on_tool_end` events. The shape
77
+ * is deliberately narrow and tailored to what the inspector UI needs.
78
+ */
79
+ export type LlmStreamEvent = {
80
+ type: "text-delta";
81
+ delta: string;
82
+ } | {
83
+ type: "tool-call-start";
84
+ /** Stable per-turn index so multiple parallel calls can be tracked. */
85
+ index: number;
86
+ toolCallId: string;
87
+ toolName: string;
88
+ } | {
89
+ type: "tool-call-args-delta";
90
+ index: number;
91
+ toolCallId: string;
92
+ toolName: string;
93
+ /** Partial JSON fragment. Concatenate across deltas, then parse. */
94
+ argsDelta: string;
95
+ } | {
96
+ type: "tool-call-ready";
97
+ index: number;
98
+ toolCallId: string;
99
+ toolName: string;
100
+ args: Record<string, unknown>;
101
+ } | {
102
+ type: "tool-result";
103
+ toolCallId: string;
104
+ toolName: string;
105
+ result: unknown;
106
+ isError: boolean;
107
+ } | {
108
+ type: "usage";
109
+ usage: TokenUsage;
110
+ } | {
111
+ type: "error";
112
+ message: string;
113
+ } | {
114
+ type: "done";
115
+ };
116
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {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