@truefoundry/trueforge-core 0.2.0 → 0.3.0-rc.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 (78) hide show
  1. package/dist/core/index.d.ts +1 -0
  2. package/dist/core/index.d.ts.map +1 -1
  3. package/dist/core/index.js +7 -0
  4. package/dist/core/index.js.map +1 -1
  5. package/dist/core/index.mjs +4 -0
  6. package/dist/core/index.mjs.map +1 -1
  7. package/dist/core/llm/LLMTypes.js +2 -2
  8. package/dist/core/llm/LLMTypes.js.map +1 -1
  9. package/dist/core/llm/LLMTypes.mjs +2 -2
  10. package/dist/core/llm/LLMTypes.mjs.map +1 -1
  11. package/dist/core/llm/VercelAILLM.d.ts.map +1 -1
  12. package/dist/core/llm/VercelAILLM.js +10 -0
  13. package/dist/core/llm/VercelAILLM.js.map +1 -1
  14. package/dist/core/llm/VercelAILLM.mjs +10 -0
  15. package/dist/core/llm/VercelAILLM.mjs.map +1 -1
  16. package/dist/core/llm/toOpenAIChatMessage.d.ts +4 -3
  17. package/dist/core/llm/toOpenAIChatMessage.d.ts.map +1 -1
  18. package/dist/core/llm/toOpenAIChatMessage.js.map +1 -1
  19. package/dist/core/llm/toOpenAIChatMessage.mjs.map +1 -1
  20. package/dist/core/mcp/RemoteMCP.d.ts +2 -1
  21. package/dist/core/mcp/RemoteMCP.d.ts.map +1 -1
  22. package/dist/core/mcp/RemoteMCP.js +65 -20
  23. package/dist/core/mcp/RemoteMCP.js.map +1 -1
  24. package/dist/core/mcp/RemoteMCP.mjs +65 -20
  25. package/dist/core/mcp/RemoteMCP.mjs.map +1 -1
  26. package/dist/core/mcp/remoteMcpClient.d.ts.map +1 -1
  27. package/dist/core/mcp/remoteMcpClient.js +2 -5
  28. package/dist/core/mcp/remoteMcpClient.js.map +1 -1
  29. package/dist/core/mcp/remoteMcpClient.mjs +2 -5
  30. package/dist/core/mcp/remoteMcpClient.mjs.map +1 -1
  31. package/dist/core/runtime/AgentThread.d.ts.map +1 -1
  32. package/dist/core/runtime/AgentThread.js +7 -1
  33. package/dist/core/runtime/AgentThread.js.map +1 -1
  34. package/dist/core/runtime/AgentThread.mjs +7 -1
  35. package/dist/core/runtime/AgentThread.mjs.map +1 -1
  36. package/dist/core/sandbox/provider/TFYSandboxProvider.d.ts.map +1 -1
  37. package/dist/core/sandbox/provider/TFYSandboxProvider.js +56 -14
  38. package/dist/core/sandbox/provider/TFYSandboxProvider.js.map +1 -1
  39. package/dist/core/sandbox/provider/TFYSandboxProvider.mjs +57 -16
  40. package/dist/core/sandbox/provider/TFYSandboxProvider.mjs.map +1 -1
  41. package/dist/core/util/errorLogFields.d.ts +1 -0
  42. package/dist/core/util/errorLogFields.d.ts.map +1 -1
  43. package/dist/core/util/errorLogFields.js +33 -6
  44. package/dist/core/util/errorLogFields.js.map +1 -1
  45. package/dist/core/util/errorLogFields.mjs +33 -6
  46. package/dist/core/util/errorLogFields.mjs.map +1 -1
  47. package/dist/core/util/ssrfGuard.d.ts +10 -0
  48. package/dist/core/util/ssrfGuard.d.ts.map +1 -0
  49. package/dist/core/util/ssrfGuard.js +333 -0
  50. package/dist/core/util/ssrfGuard.js.map +1 -0
  51. package/dist/core/util/ssrfGuard.mjs +305 -0
  52. package/dist/core/util/ssrfGuard.mjs.map +1 -0
  53. package/dist/core/web-search/ParallelWebSearchProvider.d.ts.map +1 -1
  54. package/dist/core/web-search/ParallelWebSearchProvider.js +5 -1
  55. package/dist/core/web-search/ParallelWebSearchProvider.js.map +1 -1
  56. package/dist/core/web-search/ParallelWebSearchProvider.mjs +5 -1
  57. package/dist/core/web-search/ParallelWebSearchProvider.mjs.map +1 -1
  58. package/dist/request-reply/client.d.ts +2 -2
  59. package/dist/request-reply/client.d.ts.map +1 -1
  60. package/dist/request-reply/client.js.map +1 -1
  61. package/dist/request-reply/client.mjs.map +1 -1
  62. package/dist/request-reply/executor.d.ts +3 -3
  63. package/dist/request-reply/executor.d.ts.map +1 -1
  64. package/dist/request-reply/executor.js +0 -1
  65. package/dist/request-reply/executor.js.map +1 -1
  66. package/dist/request-reply/executor.mjs +0 -1
  67. package/dist/request-reply/executor.mjs.map +1 -1
  68. package/dist/request-reply/index.d.ts +1 -0
  69. package/dist/request-reply/index.d.ts.map +1 -1
  70. package/dist/request-reply/index.js.map +1 -1
  71. package/dist/request-reply/index.mjs.map +1 -1
  72. package/dist/request-reply/redisClient.d.ts +4 -0
  73. package/dist/request-reply/redisClient.d.ts.map +1 -0
  74. package/dist/request-reply/redisClient.js +19 -0
  75. package/dist/request-reply/redisClient.js.map +1 -0
  76. package/dist/request-reply/redisClient.mjs +1 -0
  77. package/dist/request-reply/redisClient.mjs.map +1 -0
  78. package/package.json +1 -1
@@ -49,6 +49,7 @@ export { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from
49
49
  export { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';
50
50
  export { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';
51
51
  export { PromiseTimeoutError, withTimeout } from './util/promiseUtils';
52
+ export { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';
52
53
  export { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';
53
54
  export type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';
54
55
  export type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,YAAY,EACV,SAAS,EACT,WAAW,EACX,cAAc,EACd,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;A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AAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnH,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,YAAY,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
@@ -92,8 +92,10 @@ __export(core_exports, {
92
92
  WebSearchProviders: () => import_WebSearchProvider.WebSearchProviders,
93
93
  absolutizeRelativeExecEnv: () => import_execEnv.absolutizeRelativeExecEnv,
94
94
  askUserQuestion: () => import_AskUserQuestion.askUserQuestion,
95
+ assertSafeOutboundUrl: () => import_ssrfGuard.assertSafeOutboundUrl,
95
96
  buildWebSearchInstruction: () => import_WebSearch.buildWebSearchInstruction,
96
97
  buildWriteAndRunScriptCommand: () => import_Sandbox.buildWriteAndRunScriptCommand,
98
+ configureOutboundUrlGuard: () => import_ssrfGuard.configureOutboundUrlGuard,
97
99
  contextCompaction: () => import_ContextCompaction.contextCompaction,
98
100
  currentDateTime: () => import_CurrentDateTime.currentDateTime,
99
101
  defineTool: () => import_LocalToolMCP.defineTool,
@@ -116,6 +118,7 @@ __export(core_exports, {
116
118
  redisKey: () => import_redisKeys.redisKey,
117
119
  renderSkillPromptBody: () => import_skills.renderSkillPromptBody,
118
120
  shellEscape: () => import_Provider.shellEscape,
121
+ ssrfFetch: () => import_ssrfGuard.ssrfFetch,
119
122
  toOpenAIResponseFormat: () => import_responseFormat.toOpenAIResponseFormat,
120
123
  toolResultResponse: () => import_IMCPServer.toolResultResponse,
121
124
  validateNoPathTraversal: () => import_SandboxErrors.validateNoPathTraversal,
@@ -151,6 +154,7 @@ var import_errors = require("./errors.js");
151
154
  var import_redisKeys = require("./redisKeys.js");
152
155
  var import_errorLogFields = require("./util/errorLogFields.js");
153
156
  var import_promiseUtils = require("./util/promiseUtils.js");
157
+ var import_ssrfGuard = require("./util/ssrfGuard.js");
154
158
  var import_CodeModeDispatcher = require("./sandbox/codeMode/CodeModeDispatcher.js");
155
159
  var import_types = require("./sandbox/codeMode/types.js");
156
160
  var import_DaytonaProvider = require("./sandbox/provider/DaytonaProvider.js");
@@ -239,8 +243,10 @@ var import_skills = require("./sandbox/skills/index.js");
239
243
  WebSearchProviders,
240
244
  absolutizeRelativeExecEnv,
241
245
  askUserQuestion,
246
+ assertSafeOutboundUrl,
242
247
  buildWebSearchInstruction,
243
248
  buildWriteAndRunScriptCommand,
249
+ configureOutboundUrlGuard,
244
250
  contextCompaction,
245
251
  currentDateTime,
246
252
  defineTool,
@@ -263,6 +269,7 @@ var import_skills = require("./sandbox/skills/index.js");
263
269
  redisKey,
264
270
  renderSkillPromptBody,
265
271
  shellEscape,
272
+ ssrfFetch,
266
273
  toOpenAIResponseFormat,
267
274
  toolResultResponse,
268
275
  validateNoPathTraversal,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAA4B;AAY5B,qCAAwC;AAExC,8BAAkF;AAalF,6BAAgC;AAChC,+BAGO;AACP,6BAAgC;AAChC,8BAAqD;AACrD,+BAKO;AACP,oBAAuB;AACvB,uBAOO;AAIP,4BAA+B;AAC/B,wBAAmD;AAUnD,0BAAyC;AAMzC,uBAA0B;AAE1B,6BAA+C;AAG/C,2BAOO;AACP,qBAAwB;AAIxB,4BAA6D;AAE7D,yBAAmF;AAInF,oBAmBO;AASP,sBAAsC;AAEtC,IAAAA,sBAAkC;AAElC,qBAAyC;AAYzC,oBAAgF;AAChF,uBAA8C;AAC9C,4BAA4D;AAC5D,0BAAiD;AAGjD,gCAAmC;AAGnC,mBAAsF;AAEtF,6BAAuC;AAEvC,qBAA0C;AAC1C,sBAA+C;AAY/C,gCAAmC;AACnC,qBAAuF;AAEvF,2BAQO;AACP,0BAAkC;AAClC,wBAA4F;AAI5F,uCAA0C;AAE1C,+BAAmC;AAUnC,gCAAmC;AACnC,oBAAmF;","names":["import_AgentThread"]}
1
+ {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\nexport { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AmF;","names":["import_AgentThread"]}
@@ -67,6 +67,7 @@ import { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from
67
67
  import { REDIS_KEY_NAMESPACE, redisKey } from "./redisKeys.mjs";
68
68
  import { describeUnknownError, extractErrorLogFields } from "./util/errorLogFields.mjs";
69
69
  import { PromiseTimeoutError, withTimeout } from "./util/promiseUtils.mjs";
70
+ import { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from "./util/ssrfGuard.mjs";
70
71
  import { CodeModeDispatcher } from "./sandbox/codeMode/CodeModeDispatcher.mjs";
71
72
  import { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from "./sandbox/codeMode/types.mjs";
72
73
  import { DaytonaSandboxProvider } from "./sandbox/provider/DaytonaProvider.mjs";
@@ -162,8 +163,10 @@ export {
162
163
  WebSearchProviders,
163
164
  absolutizeRelativeExecEnv,
164
165
  askUserQuestion,
166
+ assertSafeOutboundUrl,
165
167
  buildWebSearchInstruction,
166
168
  buildWriteAndRunScriptCommand,
169
+ configureOutboundUrlGuard,
167
170
  contextCompaction,
168
171
  currentDateTime,
169
172
  defineTool,
@@ -186,6 +189,7 @@ export {
186
189
  redisKey,
187
190
  renderSkillPromptBody,
188
191
  shellEscape,
192
+ ssrfFetch,
189
193
  toOpenAIResponseFormat,
190
194
  toolResultResponse,
191
195
  validateNoPathTraversal,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";AAOA,SAAS,mBAAmB;AAY5B,SAAS,+BAA+B;AAExC,SAAS,yBAAyB,uBAAuB,yBAAyB;AAalF,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,oBAAoB,wBAAwB;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA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ts"],"sourcesContent":["/**\n * Public agent execution harness.\n * Intentional consumer-facing exports only (production API).\n */\n\n// Runtime\nexport type { AgentDefinition, ModelParams } from './runtime/AgentDefinition';\nexport { AgentThread } from './runtime/AgentThread';\nexport type {\n AgentInfo,\n AgentParent,\n AgentSendInput,\n AgentThreadAppendContext,\n AgentThreadCreateSubAgent,\n AgentThreadEvent,\n AgentThreadExecutionEvent,\n AgentThreadExecutionResult,\n SubAgentCompletionMarker,\n} from './runtime/AgentThread.types';\nexport { AgentThreadOrchestrator } from './runtime/AgentThreadOrchestrator';\nexport type { CreateDynamicSubAgentThread } from './runtime/CreateDynamicSubAgentThread';\nexport { isAgentInputUserMessage, isEmptyMessageContent, isFileContentPart } from './runtime/UserInputMessage';\nexport type { AgentInputUserMessage } from './runtime/UserInputMessage';\n\n// Capability contracts\nexport type { AgentCapability, CapabilityState, JsonValue } from './capabilities/AgentCapability';\nexport type {\n AgentContextProcessorOutput,\n AgentThreadExecutionContext,\n PostToolCallAgentContextProcessor,\n PreLLMEphemeralAgentContextProcessor,\n} from './capabilities/AgentContextProcessor';\n\n// Built-in factories\nexport { askUserQuestion } from './capabilities/builtins/AskUserQuestion';\nexport {\n DEFAULT_CONTEXT_COMPACTION_THRESHOLD_TOKENS,\n contextCompaction,\n} from './capabilities/builtins/ContextCompaction';\nexport { currentDateTime } from './capabilities/builtins/CurrentDateTime';\nexport { SUB_AGENT_IDENTITY, dynamicSubAgents } from './capabilities/builtins/DynamicSubAgents';\nexport {\n DEFAULT_INDIVIDUAL_TOOL_TOKEN_THRESHOLD,\n DEFAULT_PREVIEW_NUMBER_OF_CHARACTERS,\n DEFAULT_TOTAL_TOOL_TOKEN_THRESHOLD,\n largeToolResponse,\n} from './capabilities/builtins/LargeToolResponse';\nexport { openUI } from './capabilities/builtins/OpenUI';\nexport {\n WEB_FETCH_TOOL_NAME,\n WEB_SEARCH_REMINDER_TAG,\n WEB_SEARCH_SERVER_ID,\n WEB_SEARCH_TOOL_NAME,\n buildWebSearchInstruction,\n webSearch,\n} from './capabilities/builtins/WebSearch';\n\n// MCP contracts\nexport type { ApprovalDecision } from './events/schema';\nexport { ClientSideTool } from './mcp/ClientSideTool';\nexport { isAuthRequired, toolResultResponse } from './mcp/IMCPServer';\nexport type {\n AgentToolSchema,\n AuthRequiredResponse,\n CallToolResponse,\n IToolSet,\n ListToolsResponse,\n MCPAuthRequired,\n ToolSource,\n} from './mcp/IMCPServer';\nexport { LocalToolMCP, defineTool } from './mcp/LocalToolMCP';\nexport type { ToolDefinition } from './mcp/LocalToolMCP';\n\n// Remote MCP server, split into a shared, policy-free connection (`RemoteMCP`) and a per-agent policy\n// wrapper (`ToolSet`). `RemoteMCP` connects itself from a `url` + `headers`; the networking helpers\n// live in the harness-internal `remoteMcpClient` module.\nexport { RemoteMCP } from './mcp/RemoteMCP';\nexport type { RemoteMcpHeaders, ResolveHeadersResult } from './mcp/RemoteMCP';\nexport { DEFAULT_MAX_MCP_RESPONSE_BYTES } from './mcp/remoteMcpClient';\nexport type { RemoteMcpConnection, RemoteMcpTransportType } from './mcp/remoteMcpClient';\nexport type { ToolSelectorConfig } from './mcp/ToolSelectorPolicy';\nexport {\n DEFAULT_DISABLE_TOOLS,\n DEFAULT_ENABLE_TOOLS,\n DEFAULT_PRELOAD_TOOLS,\n DEFAULT_REQUIRE_APPROVAL_FOR_TOOLS,\n REQUIRE_APPROVAL_TOOLS_SELECTOR_TAGS,\n TOOLS_SELECTOR_TAGS,\n} from './mcp/toolSelectors';\nexport { ToolSet } from './mcp/ToolSet';\n\n// LLM contracts\nexport type { AgentMetadata, ILLM, LLMCreateParams, LLMCreateParamsStreaming } from './llm/ILLM';\nexport { ResponseFormatSchema, toOpenAIResponseFormat } from './llm/responseFormat';\nexport type { ResponseFormat } from './llm/responseFormat';\nexport { SUPPORTED_REASONING_EFFORTS, VERCEL_AI_PROVIDER_NAMES, VercelAILLM } from './llm/VercelAILLM';\nexport type { VercelAILLMConfig, VercelAIProviderConfig, VercelAIProviderName } from './llm/VercelAILLM';\n\n// Event contracts\nexport {\n ActionRequiredEventSchema,\n AgentInputUserMessageSchema,\n EventIdSchema,\n EventType,\n MCPAuthRequiredEventSchema,\n MCPInitializeEventSchema,\n ModelMessageDeltaEventSchema,\n ModelMessageEventSchema,\n SandboxCreatedEventSchema,\n ThreadCreatedEventSchema,\n ThreadDoneEventSchema,\n ThreadOverwriteContextEventSchema,\n ToolApprovalRequiredEventSchema,\n ToolResponseEventSchema,\n ToolResponseRequiredEventSchema,\n UserToolApprovalMessageSchema,\n UserToolResponseMessageSchema,\n newEventId,\n} from './events/schema';\nexport type {\n AgentOutputEvent,\n MCPAuthRequiredEvent,\n MCPServerAuthInfo,\n MCPServerInitInfo,\n ThreadDoneEvent,\n ThreadOverwriteContextEvent,\n} from './events/schema';\nexport { CompletionUsageSchema } from './llm/LLMTypes';\nexport type { CompletionUsage } from './llm/LLMTypes';\nexport { InternalEventType } from './runtime/AgentThread.types';\nexport type { AgentThreadSendBatch, ContextMessage } from './runtime/AgentThread.types';\nexport { AgentThreadMetricsSchema } from './runtime/metrics';\nexport type { AgentThreadMetrics } from './runtime/metrics';\n\n// Tracing\nexport type {\n AgentExecutionTrace,\n AgentLocalToolTrace,\n AgentRemoteMcpToolTrace,\n AgentTracing,\n} from './tracing/AgentTracing';\n\n// Errors / utils\nexport { AgentHarnessError, McpConnectionError, McpDcrConfigurationError } from './errors';\nexport { REDIS_KEY_NAMESPACE, redisKey } from './redisKeys';\nexport { describeUnknownError, extractErrorLogFields } from './util/errorLogFields';\nexport { PromiseTimeoutError, withTimeout } from './util/promiseUtils';\nexport { assertSafeOutboundUrl, configureOutboundUrlGuard, ssrfFetch } from './util/ssrfGuard';\n\n// Sandbox (concrete implementation; provider details exported for composition)\nexport { CodeModeDispatcher } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeLogger } from './sandbox/codeMode/CodeModeDispatcher';\nexport type { CodeModeClientInstall, CodeModeTransport } from './sandbox/codeMode/CodeModeTransport';\nexport { CodeModeErrorSourceSchema, CodeModeReplySchema, CodeModeRequestSchema } from './sandbox/codeMode/types';\nexport type { CodeModeErrorSource, CodeModeReply, CodeModeRequest } from './sandbox/codeMode/types';\nexport { DaytonaSandboxProvider } from './sandbox/provider/DaytonaProvider';\nexport type { DaytonaSandboxProviderOptions } from './sandbox/provider/DaytonaProvider';\nexport { absolutizeRelativeExecEnv } from './sandbox/provider/execEnv';\nexport { ensureExecSuccess, shellEscape } from './sandbox/provider/Provider';\nexport type {\n ExecErrorResult,\n ExecResult,\n ExecSuccessResult,\n SandboxBuild,\n SandboxBuildMetadata,\n SandboxBuildStatus,\n SandboxExecParams,\n SandboxInit,\n SandboxProvider,\n} from './sandbox/provider/Provider';\nexport { TFYSandboxProvider } from './sandbox/provider/TFYSandboxProvider';\nexport { SKILL_DOWNLOAD_TIMEOUT_SECONDS, Sandbox, buildWriteAndRunScriptCommand } from './sandbox/Sandbox';\nexport type { SandboxInfo } from './sandbox/Sandbox';\nexport {\n SandboxError,\n SandboxFileNotFoundError,\n SandboxFileTooLargeError,\n SandboxNotAvailableError,\n SandboxPathIsDirectoryError,\n validateNoPathTraversal,\n validateSandboxOwnedByTenant,\n} from './sandbox/SandboxErrors';\nexport { SANDBOX_IMAGE_URI } from './sandbox/sandboxImage';\nexport { existingSandboxIdForProvider, formatSandboxId, parseSandboxId, rawSandboxId } from './sandbox/sandboxRef';\nexport type { SandboxRefParts } from './sandbox/sandboxRef';\n\n// Web search\nexport { ParallelWebSearchProvider } from './web-search/ParallelWebSearchProvider';\nexport type { ParallelSearchMode, ParallelWebSearchProviderOptions } from './web-search/ParallelWebSearchProvider';\nexport { WebSearchProviders } from './web-search/WebSearchProvider';\nexport type {\n IWebSearchProvider,\n WebFetchPage,\n WebFetchPages,\n WebSearchHit,\n WebSearchHits,\n} from './web-search/WebSearchProvider';\n\n// Skills: the ISkillMounter seam lets hosts plug in their own skill sources\nexport { InstructionBuilder } from './InstructionBuilder';\nexport { SKILLS_PREAMBLE, SkillMounter, getSkillPath, renderSkillPromptBody } from './sandbox/skills';\nexport type { GitSkill, ISkillMounter, Skill } from './sandbox/skills';\n"],"mappings":";AAOA,SAAS,mBAAmB;AAY5B,SAAS,+BAA+B;AAExC,SAAS,yBAAyB,uBAAuB,yBAAyB;AAalF,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,oBAAoB,wBAAwB;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,0BAA0B;AAUnD,SAAS,cAAc,kBAAkB;AAMzC,SAAS,iBAAiB;AAE1B,SAAS,sCAAsC;AAG/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AAIxB,SAAS,sBAAsB,8BAA8B;AAE7D,SAAS,6BAA6B,0BAA0B,mBAAmB;AAInF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,6BAA6B;AAEtC,SAAS,yBAAyB;AAElC,SAAS,gCAAgC;AAYzC,SAAS,mBAAmB,oBAAoB,gCAAgC;AAChF,SAAS,qBAAqB,gBAAgB;AAC9C,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,qBAAqB,mBAAmB;AACjD,SAAS,uBAAuB,2BAA2B,iBAAiB;AAG5E,SAAS,0BAA0B;AAGnC,SAAS,2BAA2B,qBAAqB,6BAA6B;AAEtF,SAAS,8BAA8B;AAEvC,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB,mBAAmB;AAY/C,SAAS,0BAA0B;AACnC,SAAS,gCAAgC,SAAS,qCAAqC;AAEvF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,8BAA8B,iBAAiB,gBAAgB,oBAAoB;AAI5F,SAAS,iCAAiC;AAE1C,SAAS,0BAA0B;AAUnC,SAAS,0BAA0B;AACnC,SAAS,iBAAiB,cAAc,cAAc,6BAA6B;","names":[]}
@@ -93,7 +93,7 @@ var RawAssistantMessageSchema = import_openaiSchemas.ChatCompletionAssistantMess
93
93
  }).extend({
94
94
  tool_calls: import_zod_openapi.z.array(RawToolCallSchema).optional(),
95
95
  thinking_blocks: import_zod_openapi.z.array(ThinkingBlockUnionSchema).optional(),
96
- /** Plain-text thinking content streamed incrementally for frontend display; redundant with thinking_blocks[].thinking. */
96
+ /** Plain-text thinking for frontend display; exact concat of streamed deltas when set on the assembled message. */
97
97
  reasoning_content: import_zod_openapi.z.string().optional(),
98
98
  /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */
99
99
  source: import_zod_openapi.z.string().optional()
@@ -118,7 +118,7 @@ var ExtendedChunkDeltaSchema = import_openaiSchemas.ChatCompletionChunkDeltaSche
118
118
  tool_calls: import_zod_openapi.z.array(ExtendedChunkDeltaToolCallSchema).optional(),
119
119
  /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */
120
120
  thinking_blocks: import_zod_openapi.z.array(ThinkingBlockUnionSchema).optional(),
121
- /** Plain-text thinking content streamed incrementally for frontend display; not stored redundant with thinking_blocks[].thinking. */
121
+ /** Plain-text thinking fragment for frontend display; assembled message stores the full concat separately. */
122
122
  reasoning_content: import_zod_openapi.z.string().optional()
123
123
  }).openapi("ExtendedChunkDelta");
124
124
  var LLMUserMessageSchema = import_openaiSchemas.ChatCompletionUserMessageParamSchema.pick({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/llm/LLMTypes.ts"],"sourcesContent":["// TODO(agent): We should not maintain choices anymore.\n// https://platform.claude.com/docs/en/api/messages/create\n// https://platform.openai.com/docs/api-reference/responses/object#responses-object-output\n// Check the above page and check code to and come up with a streaming structure that does not expose\n// choices to upstream.\n\n// TODO(agent): At this point, we can write the types from scratch. No point in keeping the old OpenAI baggage.\nimport { z } from '@hono/zod-openapi';\nimport type { ChatCompletionChunk } from 'openai/resources/chat';\nimport {\n ChatCompletionAssistantMessageParamSchema,\n ChatCompletionChunkDeltaSchema,\n ChatCompletionChunkDeltaToolCallSchema,\n ChatCompletionChunkFinishReasonSchema,\n ChatCompletionMessageToolCallSchema,\n ChatCompletionToolMessageParamSchema,\n ChatCompletionUserMessageParamSchema,\n} from './openaiSchemas';\n\nexport const ThinkingBlockSchema = z\n .object({\n type: z.literal('thinking').describe('Structured thinking block.'),\n thinking: z.string().describe('Thinking text content.'),\n signature: z.string().optional().describe('Optional provider signature for multi-turn replay.'),\n })\n .openapi('ThinkingBlock');\n\nexport const RedactedThinkingBlockSchema = z\n .object({\n type: z.literal('redacted_thinking').describe('Redacted thinking block.'),\n data: z.string().describe('Opaque redacted thinking payload from the provider.'),\n })\n .openapi('RedactedThinkingBlock');\n\nexport const ThinkingBlockUnionSchema = z.union([ThinkingBlockSchema, RedactedThinkingBlockSchema]);\n\nexport const InternalToolCallInfoSchema = z.object({\n type: z.enum(['truefoundry-system', 'mcp']).describe('Whether the tool is a system tool or MCP tool.'),\n mcp_server_id: z.string().describe('Internal MCP server id (empty for system tools).'),\n mcp_server_name: z.string().describe('Configured MCP server name (empty for system tools).'),\n original_tool_name: z.string().describe('Original tool name before any remapping.'),\n is_approval_required: z.boolean().optional().describe('Whether this tool call requires human approval.'),\n is_deferred: z.boolean().optional().describe('Whether the tool was loaded via deferred discovery.'),\n is_client_side: z.boolean().optional().describe('Whether the client must supply the tool result.'),\n // Runtime + wire: deviation from origin/main OpenAPI (which omitted this field) is accepted.\n is_thread_creation: z.boolean().optional().describe('Whether this tool call creates a subagent thread.'),\n});\n\nexport const TrueFoundrySystemToolInfoSchema = z\n .object({\n type: z.literal('truefoundry-system').describe('Built-in harness system tool.'),\n name: z.string().describe('System tool name.'),\n })\n .openapi('TrueFoundrySystemToolInfo');\n\nexport const MCPToolInfoSchema = z\n .object({\n type: z.literal('mcp').describe('Tool hosted on an MCP server.'),\n server_id: z.string().describe('Internal MCP server id.'),\n server_name: z.string().describe('Configured MCP server name.'),\n name: z.string().describe('Tool name on the MCP server.'),\n })\n .openapi('MCPToolInfo');\n\nexport const RawToolCallSchema = ChatCompletionMessageToolCallSchema.extend({\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('RawToolCall');\n\nexport const InternalEnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: InternalToolCallInfoSchema,\n});\n\nexport const ToolInfoSchema = z\n .discriminatedUnion('type', [TrueFoundrySystemToolInfoSchema, MCPToolInfoSchema])\n .openapi('ToolInfo');\n\nexport const EnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: ToolInfoSchema,\n}).openapi('ToolCall');\n\nexport const RawAssistantMessageSchema = ChatCompletionAssistantMessageParamSchema.omit({\n tool_calls: true,\n audio: true,\n function_call: true,\n})\n .extend({\n tool_calls: z.array(RawToolCallSchema).optional(),\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking content streamed incrementally for frontend display; redundant with thinking_blocks[].thinking. */\n reasoning_content: z.string().optional(),\n /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */\n source: z.string().optional(),\n })\n .openapi('RawAssistantMessage');\n\nexport const InternalEnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n}).extend({\n tool_calls: z.array(InternalEnrichedToolCallSchema).optional(),\n});\n\n// `thinking_blocks` / `source` omitted: kept on the internal message for context replay, hidden from the client event.\nexport const EnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n thinking_blocks: true,\n source: true,\n})\n .extend({\n tool_calls: z.array(EnrichedToolCallSchema).optional(),\n })\n .openapi('EnrichedAssistantMessage');\n\nexport const ExtendedChunkDeltaToolCallSchema = ChatCompletionChunkDeltaToolCallSchema.extend({\n tool_info: ToolInfoSchema.optional(),\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('ExtendedChunkDeltaToolCall');\n\nexport const ExtendedChunkDeltaSchema = ChatCompletionChunkDeltaSchema.omit({ tool_calls: true })\n .extend({\n tool_calls: z.array(ExtendedChunkDeltaToolCallSchema).optional(),\n /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking content streamed incrementally for frontend display; not stored — redundant with thinking_blocks[].thinking. */\n reasoning_content: z.string().optional(),\n })\n .openapi('ExtendedChunkDelta');\n\nexport const LLMUserMessageSchema = ChatCompletionUserMessageParamSchema.pick({\n role: true,\n content: true,\n}).openapi('LLMUserMessage');\n\nexport const LLMToolMessageSchema = ChatCompletionToolMessageParamSchema.omit({ content: true })\n .extend({\n // TODO(agent): Where do I update the Zod code for this change?\n content: z.string(),\n })\n .openapi('LLMToolMessage');\n\nexport const CompletionUsageSchema = z\n .object({\n input_tokens: z.number().int().nonnegative().describe('Input tokens for this completion.'),\n output_tokens: z.number().int().nonnegative().describe('Output tokens for this completion.'),\n total_tokens: z.number().int().nonnegative().describe('Total tokens (input + output).'),\n cache_read_tokens: z.number().int().nonnegative().optional().describe('Optional cache-read tokens.'),\n cache_write_tokens: z.number().int().nonnegative().optional().describe('Optional cache-write tokens.'),\n reasoning_tokens: z.number().int().nonnegative().optional().describe('Optional reasoning tokens.'),\n cost_in_usd: z.number().nonnegative().optional().describe('Optional estimated cost in USD.'),\n })\n .openapi('CompletionUsage');\n\nexport const FinishReasonSchema = ChatCompletionChunkFinishReasonSchema.openapi('FinishReason');\n\nexport type ThinkingBlock = z.infer<typeof ThinkingBlockSchema>;\nexport type RedactedThinkingBlock = z.infer<typeof RedactedThinkingBlockSchema>;\nexport type InternalToolCallInfo = z.infer<typeof InternalToolCallInfoSchema>;\nexport type TrueFoundrySystemToolInfo = z.infer<typeof TrueFoundrySystemToolInfoSchema>;\nexport type MCPToolInfo = z.infer<typeof MCPToolInfoSchema>;\nexport type ToolInfo = z.infer<typeof ToolInfoSchema>;\nexport type InternalEnrichedToolCall = z.infer<typeof InternalEnrichedToolCallSchema>;\nexport type EnrichedToolCall = z.infer<typeof EnrichedToolCallSchema>;\nexport type RawAssistantMessage = z.infer<typeof RawAssistantMessageSchema>;\nexport type InternalEnrichedAssistantMessage = z.infer<typeof InternalEnrichedAssistantMessageSchema>;\nexport type EnrichedAssistantMessage = z.infer<typeof EnrichedAssistantMessageSchema>;\nexport type ExtendedDeltaToolCall = z.infer<typeof ExtendedChunkDeltaToolCallSchema>;\nexport type ExtendedDelta = z.infer<typeof ExtendedChunkDeltaSchema>;\nexport type LLMUserMessage = z.infer<typeof LLMUserMessageSchema>;\nexport type LLMToolMessage = z.infer<typeof LLMToolMessageSchema>;\nexport type CompletionUsage = z.infer<typeof CompletionUsageSchema>;\nexport type FinishReason = z.infer<typeof FinishReasonSchema>;\n\nexport function getEmptyUsage(): CompletionUsage {\n return { input_tokens: 0, output_tokens: 0, total_tokens: 0 };\n}\n\n/**\n * Extended choice type that includes thought_signature in the delta.\n */\ninterface ExtendedChoice extends Omit<ChatCompletionChunk.Choice, 'delta'> {\n /**\n * A chat completion delta generated by streamed model responses, with thought_signature support.\n */\n delta: ExtendedDelta;\n}\n\n/**\n * Extended chat completion chunk that includes thought_signature in tool calls.\n * `usage` is harness-normalized; the LLM adapter maps the wire `usage` payload at the adapter boundary.\n */\nexport interface ExtendedChatCompletionChunk extends Omit<ChatCompletionChunk, 'choices' | 'usage'> {\n /**\n * A list of chat completion choices, with thought_signature support in deltas.\n */\n choices: ExtendedChoice[];\n usage?: CompletionUsage | null;\n}\n\nexport interface RawAssistantMessageWithUsage {\n output: RawAssistantMessage;\n usage: CompletionUsage;\n /** null when the stream ended without a finish_reason chunk (e.g. provider omitted it). */\n finish_reason: FinishReason | null;\n}\n\nexport const UNKNOWN_TOOL_NAME = 'unknown';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAAkB;AAElB,2BAQO;AAEA,IAAM,sBAAsB,qBAChC,OAAO;AAAA,EACN,MAAM,qBAAE,QAAQ,UAAU,EAAE,SAAS,4BAA4B;AAAA,EACjE,UAAU,qBAAE,OAAO,EAAE,SAAS,wBAAwB;AAAA,EACtD,WAAW,qBAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oDAAoD;AAChG,CAAC,EACA,QAAQ,eAAe;AAEnB,IAAM,8BAA8B,qBACxC,OAAO;AAAA,EACN,MAAM,qBAAE,QAAQ,mBAAmB,EAAE,SAAS,0BAA0B;AAAA,EACxE,MAAM,qBAAE,OAAO,EAAE,SAAS,qDAAqD;AACjF,CAAC,EACA,QAAQ,uBAAuB;AAE3B,IAAM,2BAA2B,qBAAE,MAAM,CAAC,qBAAqB,2BAA2B,CAAC;AAE3F,IAAM,6BAA6B,qBAAE,OAAO;AAAA,EACjD,MAAM,qBAAE,KAAK,CAAC,sBAAsB,KAAK,CAAC,EAAE,SAAS,gDAAgD;AAAA,EACrG,eAAe,qBAAE,OAAO,EAAE,SAAS,kDAAkD;AAAA,EACrF,iBAAiB,qBAAE,OAAO,EAAE,SAAS,sDAAsD;AAAA,EAC3F,oBAAoB,qBAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EAClF,sBAAsB,qBAAE,QAAQ,EAAE,SAAS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O;AACpB,CAAC,EACA,QAAQ,gBAAgB;AAEpB,IAAM,wBAAwB,qBAClC,OAAO;AAAA,EACN,cAAc,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,mCAAmC;AAAA,EACzF,eAAe,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,oCAAoC;AAAA,EAC3F,cAAc,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,gCAAgC;AAAA,EACtF,mBAAmB,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,6BAA6B;AAAA,EACnG,oBAAoB,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,8BAA8B;AAAA,EACrG,kBAAkB,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,4BAA4B;AAAA,EACjG,aAAa,qBAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,iCAAiC;AAC7F,CAAC,EACA,QAAQ,iBAAiB;AAErB,IAAM,qBAAqB,2DAAsC,QAAQ,cAAc;AAoBvF,SAAS,gBAAiC;AAC/C,SAAO,EAAE,cAAc,GAAG,eAAe,GAAG,cAAc,EAAE;AAC9D;AA+BO,IAAM,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/llm/LLMTypes.ts"],"sourcesContent":["// TODO(agent): We should not maintain choices anymore.\n// https://platform.claude.com/docs/en/api/messages/create\n// https://platform.openai.com/docs/api-reference/responses/object#responses-object-output\n// Check the above page and check code to and come up with a streaming structure that does not expose\n// choices to upstream.\n\n// TODO(agent): At this point, we can write the types from scratch. No point in keeping the old OpenAI baggage.\nimport { z } from '@hono/zod-openapi';\nimport type { ChatCompletionChunk } from 'openai/resources/chat';\nimport {\n ChatCompletionAssistantMessageParamSchema,\n ChatCompletionChunkDeltaSchema,\n ChatCompletionChunkDeltaToolCallSchema,\n ChatCompletionChunkFinishReasonSchema,\n ChatCompletionMessageToolCallSchema,\n ChatCompletionToolMessageParamSchema,\n ChatCompletionUserMessageParamSchema,\n} from './openaiSchemas';\n\nexport const ThinkingBlockSchema = z\n .object({\n type: z.literal('thinking').describe('Structured thinking block.'),\n thinking: z.string().describe('Thinking text content.'),\n signature: z.string().optional().describe('Optional provider signature for multi-turn replay.'),\n })\n .openapi('ThinkingBlock');\n\nexport const RedactedThinkingBlockSchema = z\n .object({\n type: z.literal('redacted_thinking').describe('Redacted thinking block.'),\n data: z.string().describe('Opaque redacted thinking payload from the provider.'),\n })\n .openapi('RedactedThinkingBlock');\n\nexport const ThinkingBlockUnionSchema = z.union([ThinkingBlockSchema, RedactedThinkingBlockSchema]);\n\nexport const InternalToolCallInfoSchema = z.object({\n type: z.enum(['truefoundry-system', 'mcp']).describe('Whether the tool is a system tool or MCP tool.'),\n mcp_server_id: z.string().describe('Internal MCP server id (empty for system tools).'),\n mcp_server_name: z.string().describe('Configured MCP server name (empty for system tools).'),\n original_tool_name: z.string().describe('Original tool name before any remapping.'),\n is_approval_required: z.boolean().optional().describe('Whether this tool call requires human approval.'),\n is_deferred: z.boolean().optional().describe('Whether the tool was loaded via deferred discovery.'),\n is_client_side: z.boolean().optional().describe('Whether the client must supply the tool result.'),\n // Runtime + wire: deviation from origin/main OpenAPI (which omitted this field) is accepted.\n is_thread_creation: z.boolean().optional().describe('Whether this tool call creates a subagent thread.'),\n});\n\nexport const TrueFoundrySystemToolInfoSchema = z\n .object({\n type: z.literal('truefoundry-system').describe('Built-in harness system tool.'),\n name: z.string().describe('System tool name.'),\n })\n .openapi('TrueFoundrySystemToolInfo');\n\nexport const MCPToolInfoSchema = z\n .object({\n type: z.literal('mcp').describe('Tool hosted on an MCP server.'),\n server_id: z.string().describe('Internal MCP server id.'),\n server_name: z.string().describe('Configured MCP server name.'),\n name: z.string().describe('Tool name on the MCP server.'),\n })\n .openapi('MCPToolInfo');\n\nexport const RawToolCallSchema = ChatCompletionMessageToolCallSchema.extend({\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('RawToolCall');\n\nexport const InternalEnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: InternalToolCallInfoSchema,\n});\n\nexport const ToolInfoSchema = z\n .discriminatedUnion('type', [TrueFoundrySystemToolInfoSchema, MCPToolInfoSchema])\n .openapi('ToolInfo');\n\nexport const EnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: ToolInfoSchema,\n}).openapi('ToolCall');\n\nexport const RawAssistantMessageSchema = ChatCompletionAssistantMessageParamSchema.omit({\n tool_calls: true,\n audio: true,\n function_call: true,\n})\n .extend({\n tool_calls: z.array(RawToolCallSchema).optional(),\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking for frontend display; exact concat of streamed deltas when set on the assembled message. */\n reasoning_content: z.string().optional(),\n /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */\n source: z.string().optional(),\n })\n .openapi('RawAssistantMessage');\n\nexport const InternalEnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n}).extend({\n tool_calls: z.array(InternalEnrichedToolCallSchema).optional(),\n});\n\n// `thinking_blocks` / `source` omitted: kept on the internal message for context replay, hidden from the client event.\nexport const EnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n thinking_blocks: true,\n source: true,\n})\n .extend({\n tool_calls: z.array(EnrichedToolCallSchema).optional(),\n })\n .openapi('EnrichedAssistantMessage');\n\nexport const ExtendedChunkDeltaToolCallSchema = ChatCompletionChunkDeltaToolCallSchema.extend({\n tool_info: ToolInfoSchema.optional(),\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('ExtendedChunkDeltaToolCall');\n\nexport const ExtendedChunkDeltaSchema = ChatCompletionChunkDeltaSchema.omit({ tool_calls: true })\n .extend({\n tool_calls: z.array(ExtendedChunkDeltaToolCallSchema).optional(),\n /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking fragment for frontend display; assembled message stores the full concat separately. */\n reasoning_content: z.string().optional(),\n })\n .openapi('ExtendedChunkDelta');\n\nexport const LLMUserMessageSchema = ChatCompletionUserMessageParamSchema.pick({\n role: true,\n content: true,\n}).openapi('LLMUserMessage');\n\nexport const LLMToolMessageSchema = ChatCompletionToolMessageParamSchema.omit({ content: true })\n .extend({\n // TODO(agent): Where do I update the Zod code for this change?\n content: z.string(),\n })\n .openapi('LLMToolMessage');\n\nexport const CompletionUsageSchema = z\n .object({\n input_tokens: z.number().int().nonnegative().describe('Input tokens for this completion.'),\n output_tokens: z.number().int().nonnegative().describe('Output tokens for this completion.'),\n total_tokens: z.number().int().nonnegative().describe('Total tokens (input + output).'),\n cache_read_tokens: z.number().int().nonnegative().optional().describe('Optional cache-read tokens.'),\n cache_write_tokens: z.number().int().nonnegative().optional().describe('Optional cache-write tokens.'),\n reasoning_tokens: z.number().int().nonnegative().optional().describe('Optional reasoning tokens.'),\n cost_in_usd: z.number().nonnegative().optional().describe('Optional estimated cost in USD.'),\n })\n .openapi('CompletionUsage');\n\nexport const FinishReasonSchema = ChatCompletionChunkFinishReasonSchema.openapi('FinishReason');\n\nexport type ThinkingBlock = z.infer<typeof ThinkingBlockSchema>;\nexport type RedactedThinkingBlock = z.infer<typeof RedactedThinkingBlockSchema>;\nexport type InternalToolCallInfo = z.infer<typeof InternalToolCallInfoSchema>;\nexport type TrueFoundrySystemToolInfo = z.infer<typeof TrueFoundrySystemToolInfoSchema>;\nexport type MCPToolInfo = z.infer<typeof MCPToolInfoSchema>;\nexport type ToolInfo = z.infer<typeof ToolInfoSchema>;\nexport type InternalEnrichedToolCall = z.infer<typeof InternalEnrichedToolCallSchema>;\nexport type EnrichedToolCall = z.infer<typeof EnrichedToolCallSchema>;\nexport type RawAssistantMessage = z.infer<typeof RawAssistantMessageSchema>;\nexport type InternalEnrichedAssistantMessage = z.infer<typeof InternalEnrichedAssistantMessageSchema>;\nexport type EnrichedAssistantMessage = z.infer<typeof EnrichedAssistantMessageSchema>;\nexport type ExtendedDeltaToolCall = z.infer<typeof ExtendedChunkDeltaToolCallSchema>;\nexport type ExtendedDelta = z.infer<typeof ExtendedChunkDeltaSchema>;\nexport type LLMUserMessage = z.infer<typeof LLMUserMessageSchema>;\nexport type LLMToolMessage = z.infer<typeof LLMToolMessageSchema>;\nexport type CompletionUsage = z.infer<typeof CompletionUsageSchema>;\nexport type FinishReason = z.infer<typeof FinishReasonSchema>;\n\nexport function getEmptyUsage(): CompletionUsage {\n return { input_tokens: 0, output_tokens: 0, total_tokens: 0 };\n}\n\n/**\n * Extended choice type that includes thought_signature in the delta.\n */\ninterface ExtendedChoice extends Omit<ChatCompletionChunk.Choice, 'delta'> {\n /**\n * A chat completion delta generated by streamed model responses, with thought_signature support.\n */\n delta: ExtendedDelta;\n}\n\n/**\n * Extended chat completion chunk that includes thought_signature in tool calls.\n * `usage` is harness-normalized; the LLM adapter maps the wire `usage` payload at the adapter boundary.\n */\nexport interface ExtendedChatCompletionChunk extends Omit<ChatCompletionChunk, 'choices' | 'usage'> {\n /**\n * A list of chat completion choices, with thought_signature support in deltas.\n */\n choices: ExtendedChoice[];\n usage?: CompletionUsage | null;\n}\n\nexport interface RawAssistantMessageWithUsage {\n output: RawAssistantMessage;\n usage: CompletionUsage;\n /** null when the stream ended without a finish_reason chunk (e.g. provider omitted it). */\n finish_reason: FinishReason | null;\n}\n\nexport const UNKNOWN_TOOL_NAME = 'unknown';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAAkB;AAElB,2BAQO;AAEA,IAAM,sBAAsB,qBAChC,OAAO;AAAA,EACN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B;AAAA,EACrG,kBAAkB,qBAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,4BAA4B;AAAA,EACjG,aAAa,qBAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,iCAAiC;AAC7F,CAAC,EACA,QAAQ,iBAAiB;AAErB,IAAM,qBAAqB,2DAAsC,QAAQ,cAAc;AAoBvF,SAAS,gBAAiC;AAC/C,SAAO,EAAE,cAAc,GAAG,eAAe,GAAG,cAAc,EAAE;AAC9D;AA+BO,IAAM,oBAAoB;","names":[]}
@@ -57,7 +57,7 @@ var RawAssistantMessageSchema = ChatCompletionAssistantMessageParamSchema.omit({
57
57
  }).extend({
58
58
  tool_calls: z.array(RawToolCallSchema).optional(),
59
59
  thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),
60
- /** Plain-text thinking content streamed incrementally for frontend display; redundant with thinking_blocks[].thinking. */
60
+ /** Plain-text thinking for frontend display; exact concat of streamed deltas when set on the assembled message. */
61
61
  reasoning_content: z.string().optional(),
62
62
  /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */
63
63
  source: z.string().optional()
@@ -82,7 +82,7 @@ var ExtendedChunkDeltaSchema = ChatCompletionChunkDeltaSchema.omit({ tool_calls:
82
82
  tool_calls: z.array(ExtendedChunkDeltaToolCallSchema).optional(),
83
83
  /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */
84
84
  thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),
85
- /** Plain-text thinking content streamed incrementally for frontend display; not stored redundant with thinking_blocks[].thinking. */
85
+ /** Plain-text thinking fragment for frontend display; assembled message stores the full concat separately. */
86
86
  reasoning_content: z.string().optional()
87
87
  }).openapi("ExtendedChunkDelta");
88
88
  var LLMUserMessageSchema = ChatCompletionUserMessageParamSchema.pick({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/llm/LLMTypes.ts"],"sourcesContent":["// TODO(agent): We should not maintain choices anymore.\n// https://platform.claude.com/docs/en/api/messages/create\n// https://platform.openai.com/docs/api-reference/responses/object#responses-object-output\n// Check the above page and check code to and come up with a streaming structure that does not expose\n// choices to upstream.\n\n// TODO(agent): At this point, we can write the types from scratch. No point in keeping the old OpenAI baggage.\nimport { z } from '@hono/zod-openapi';\nimport type { ChatCompletionChunk } from 'openai/resources/chat';\nimport {\n ChatCompletionAssistantMessageParamSchema,\n ChatCompletionChunkDeltaSchema,\n ChatCompletionChunkDeltaToolCallSchema,\n ChatCompletionChunkFinishReasonSchema,\n ChatCompletionMessageToolCallSchema,\n ChatCompletionToolMessageParamSchema,\n ChatCompletionUserMessageParamSchema,\n} from './openaiSchemas';\n\nexport const ThinkingBlockSchema = z\n .object({\n type: z.literal('thinking').describe('Structured thinking block.'),\n thinking: z.string().describe('Thinking text content.'),\n signature: z.string().optional().describe('Optional provider signature for multi-turn replay.'),\n })\n .openapi('ThinkingBlock');\n\nexport const RedactedThinkingBlockSchema = z\n .object({\n type: z.literal('redacted_thinking').describe('Redacted thinking block.'),\n data: z.string().describe('Opaque redacted thinking payload from the provider.'),\n })\n .openapi('RedactedThinkingBlock');\n\nexport const ThinkingBlockUnionSchema = z.union([ThinkingBlockSchema, RedactedThinkingBlockSchema]);\n\nexport const InternalToolCallInfoSchema = z.object({\n type: z.enum(['truefoundry-system', 'mcp']).describe('Whether the tool is a system tool or MCP tool.'),\n mcp_server_id: z.string().describe('Internal MCP server id (empty for system tools).'),\n mcp_server_name: z.string().describe('Configured MCP server name (empty for system tools).'),\n original_tool_name: z.string().describe('Original tool name before any remapping.'),\n is_approval_required: z.boolean().optional().describe('Whether this tool call requires human approval.'),\n is_deferred: z.boolean().optional().describe('Whether the tool was loaded via deferred discovery.'),\n is_client_side: z.boolean().optional().describe('Whether the client must supply the tool result.'),\n // Runtime + wire: deviation from origin/main OpenAPI (which omitted this field) is accepted.\n is_thread_creation: z.boolean().optional().describe('Whether this tool call creates a subagent thread.'),\n});\n\nexport const TrueFoundrySystemToolInfoSchema = z\n .object({\n type: z.literal('truefoundry-system').describe('Built-in harness system tool.'),\n name: z.string().describe('System tool name.'),\n })\n .openapi('TrueFoundrySystemToolInfo');\n\nexport const MCPToolInfoSchema = z\n .object({\n type: z.literal('mcp').describe('Tool hosted on an MCP server.'),\n server_id: z.string().describe('Internal MCP server id.'),\n server_name: z.string().describe('Configured MCP server name.'),\n name: z.string().describe('Tool name on the MCP server.'),\n })\n .openapi('MCPToolInfo');\n\nexport const RawToolCallSchema = ChatCompletionMessageToolCallSchema.extend({\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('RawToolCall');\n\nexport const InternalEnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: InternalToolCallInfoSchema,\n});\n\nexport const ToolInfoSchema = z\n .discriminatedUnion('type', [TrueFoundrySystemToolInfoSchema, MCPToolInfoSchema])\n .openapi('ToolInfo');\n\nexport const EnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: ToolInfoSchema,\n}).openapi('ToolCall');\n\nexport const RawAssistantMessageSchema = ChatCompletionAssistantMessageParamSchema.omit({\n tool_calls: true,\n audio: true,\n function_call: true,\n})\n .extend({\n tool_calls: z.array(RawToolCallSchema).optional(),\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking content streamed incrementally for frontend display; redundant with thinking_blocks[].thinking. */\n reasoning_content: z.string().optional(),\n /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */\n source: z.string().optional(),\n })\n .openapi('RawAssistantMessage');\n\nexport const InternalEnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n}).extend({\n tool_calls: z.array(InternalEnrichedToolCallSchema).optional(),\n});\n\n// `thinking_blocks` / `source` omitted: kept on the internal message for context replay, hidden from the client event.\nexport const EnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n thinking_blocks: true,\n source: true,\n})\n .extend({\n tool_calls: z.array(EnrichedToolCallSchema).optional(),\n })\n .openapi('EnrichedAssistantMessage');\n\nexport const ExtendedChunkDeltaToolCallSchema = ChatCompletionChunkDeltaToolCallSchema.extend({\n tool_info: ToolInfoSchema.optional(),\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('ExtendedChunkDeltaToolCall');\n\nexport const ExtendedChunkDeltaSchema = ChatCompletionChunkDeltaSchema.omit({ tool_calls: true })\n .extend({\n tool_calls: z.array(ExtendedChunkDeltaToolCallSchema).optional(),\n /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking content streamed incrementally for frontend display; not stored — redundant with thinking_blocks[].thinking. */\n reasoning_content: z.string().optional(),\n })\n .openapi('ExtendedChunkDelta');\n\nexport const LLMUserMessageSchema = ChatCompletionUserMessageParamSchema.pick({\n role: true,\n content: true,\n}).openapi('LLMUserMessage');\n\nexport const LLMToolMessageSchema = ChatCompletionToolMessageParamSchema.omit({ content: true })\n .extend({\n // TODO(agent): Where do I update the Zod code for this change?\n content: z.string(),\n })\n .openapi('LLMToolMessage');\n\nexport const CompletionUsageSchema = z\n .object({\n input_tokens: z.number().int().nonnegative().describe('Input tokens for this completion.'),\n output_tokens: z.number().int().nonnegative().describe('Output tokens for this completion.'),\n total_tokens: z.number().int().nonnegative().describe('Total tokens (input + output).'),\n cache_read_tokens: z.number().int().nonnegative().optional().describe('Optional cache-read tokens.'),\n cache_write_tokens: z.number().int().nonnegative().optional().describe('Optional cache-write tokens.'),\n reasoning_tokens: z.number().int().nonnegative().optional().describe('Optional reasoning tokens.'),\n cost_in_usd: z.number().nonnegative().optional().describe('Optional estimated cost in USD.'),\n })\n .openapi('CompletionUsage');\n\nexport const FinishReasonSchema = ChatCompletionChunkFinishReasonSchema.openapi('FinishReason');\n\nexport type ThinkingBlock = z.infer<typeof ThinkingBlockSchema>;\nexport type RedactedThinkingBlock = z.infer<typeof RedactedThinkingBlockSchema>;\nexport type InternalToolCallInfo = z.infer<typeof InternalToolCallInfoSchema>;\nexport type TrueFoundrySystemToolInfo = z.infer<typeof TrueFoundrySystemToolInfoSchema>;\nexport type MCPToolInfo = z.infer<typeof MCPToolInfoSchema>;\nexport type ToolInfo = z.infer<typeof ToolInfoSchema>;\nexport type InternalEnrichedToolCall = z.infer<typeof InternalEnrichedToolCallSchema>;\nexport type EnrichedToolCall = z.infer<typeof EnrichedToolCallSchema>;\nexport type RawAssistantMessage = z.infer<typeof RawAssistantMessageSchema>;\nexport type InternalEnrichedAssistantMessage = z.infer<typeof InternalEnrichedAssistantMessageSchema>;\nexport type EnrichedAssistantMessage = z.infer<typeof EnrichedAssistantMessageSchema>;\nexport type ExtendedDeltaToolCall = z.infer<typeof ExtendedChunkDeltaToolCallSchema>;\nexport type ExtendedDelta = z.infer<typeof ExtendedChunkDeltaSchema>;\nexport type LLMUserMessage = z.infer<typeof LLMUserMessageSchema>;\nexport type LLMToolMessage = z.infer<typeof LLMToolMessageSchema>;\nexport type CompletionUsage = z.infer<typeof CompletionUsageSchema>;\nexport type FinishReason = z.infer<typeof FinishReasonSchema>;\n\nexport function getEmptyUsage(): CompletionUsage {\n return { input_tokens: 0, output_tokens: 0, total_tokens: 0 };\n}\n\n/**\n * Extended choice type that includes thought_signature in the delta.\n */\ninterface ExtendedChoice extends Omit<ChatCompletionChunk.Choice, 'delta'> {\n /**\n * A chat completion delta generated by streamed model responses, with thought_signature support.\n */\n delta: ExtendedDelta;\n}\n\n/**\n * Extended chat completion chunk that includes thought_signature in tool calls.\n * `usage` is harness-normalized; the LLM adapter maps the wire `usage` payload at the adapter boundary.\n */\nexport interface ExtendedChatCompletionChunk extends Omit<ChatCompletionChunk, 'choices' | 'usage'> {\n /**\n * A list of chat completion choices, with thought_signature support in deltas.\n */\n choices: ExtendedChoice[];\n usage?: CompletionUsage | null;\n}\n\nexport interface RawAssistantMessageWithUsage {\n output: RawAssistantMessage;\n usage: CompletionUsage;\n /** null when the stream ended without a finish_reason chunk (e.g. provider omitted it). */\n finish_reason: FinishReason | null;\n}\n\nexport const UNKNOWN_TOOL_NAME = 'unknown';\n"],"mappings":";AAOA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,sBAAsB,EAChC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,UAAU,EAAE,SAAS,4BAA4B;AAAA,EACjE,UAAU,EAAE,OAAO,EAAE,SAAS,wBAAwB;AAAA,EACtD,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oDAAoD;AAChG,CAAC,EACA,QAAQ,eAAe;AAEnB,IAAM,8BAA8B,EACxC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,mBAAmB,EAAE,SAAS,0BAA0B;AAAA,EACxE,MAAM,EAAE,OAAO,EAAE,SAAS,qDAAqD;AACjF,CAAC,EACA,QAAQ,uBAAuB;AAE3B,IAAM,2BAA2B,EAAE,MAAM,CAAC,qBAAqB,2BAA2B,CAAC;AAE3F,IAAM,6BAA6B,EAAE,OAAO;AAAA,EACjD,MAAM,EAAE,KAAK,CAAC,sBAAsB,KAAK,CAAC,EAAE,SAAS,gDAAgD;AAAA,EACrG,eAAe,EAAE,OAAO,EAAE,SAAS,kDAAkD;AAAA,EACrF,iBAAiB,EAAE,OAAO,EAAE,SAAS,sDAAsD;AAAA,EAC3F,oBAAoB,EAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EAClF,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,iDAAiD;AAAA,EACvG,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,qDAAqD;AAAA,EAClG,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,iDAAiD;AAAA;AAAA,EAEjG,oBAAoB,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,mDAAmD;AACzG,CAA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AY,EAAE,SAAS,gCAAgC;AAAA,EACtF,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,6BAA6B;AAAA,EACnG,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,8BAA8B;AAAA,EACrG,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,4BAA4B;AAAA,EACjG,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,iCAAiC;AAC7F,CAAC,EACA,QAAQ,iBAAiB;AAErB,IAAM,qBAAqB,sCAAsC,QAAQ,cAAc;AAoBvF,SAAS,gBAAiC;AAC/C,SAAO,EAAE,cAAc,GAAG,eAAe,GAAG,cAAc,EAAE;AAC9D;AA+BO,IAAM,oBAAoB;","names":[]}
1
+ {"version":3,"sources":["../../../src/core/llm/LLMTypes.ts"],"sourcesContent":["// TODO(agent): We should not maintain choices anymore.\n// https://platform.claude.com/docs/en/api/messages/create\n// https://platform.openai.com/docs/api-reference/responses/object#responses-object-output\n// Check the above page and check code to and come up with a streaming structure that does not expose\n// choices to upstream.\n\n// TODO(agent): At this point, we can write the types from scratch. No point in keeping the old OpenAI baggage.\nimport { z } from '@hono/zod-openapi';\nimport type { ChatCompletionChunk } from 'openai/resources/chat';\nimport {\n ChatCompletionAssistantMessageParamSchema,\n ChatCompletionChunkDeltaSchema,\n ChatCompletionChunkDeltaToolCallSchema,\n ChatCompletionChunkFinishReasonSchema,\n ChatCompletionMessageToolCallSchema,\n ChatCompletionToolMessageParamSchema,\n ChatCompletionUserMessageParamSchema,\n} from './openaiSchemas';\n\nexport const ThinkingBlockSchema = z\n .object({\n type: z.literal('thinking').describe('Structured thinking block.'),\n thinking: z.string().describe('Thinking text content.'),\n signature: z.string().optional().describe('Optional provider signature for multi-turn replay.'),\n })\n .openapi('ThinkingBlock');\n\nexport const RedactedThinkingBlockSchema = z\n .object({\n type: z.literal('redacted_thinking').describe('Redacted thinking block.'),\n data: z.string().describe('Opaque redacted thinking payload from the provider.'),\n })\n .openapi('RedactedThinkingBlock');\n\nexport const ThinkingBlockUnionSchema = z.union([ThinkingBlockSchema, RedactedThinkingBlockSchema]);\n\nexport const InternalToolCallInfoSchema = z.object({\n type: z.enum(['truefoundry-system', 'mcp']).describe('Whether the tool is a system tool or MCP tool.'),\n mcp_server_id: z.string().describe('Internal MCP server id (empty for system tools).'),\n mcp_server_name: z.string().describe('Configured MCP server name (empty for system tools).'),\n original_tool_name: z.string().describe('Original tool name before any remapping.'),\n is_approval_required: z.boolean().optional().describe('Whether this tool call requires human approval.'),\n is_deferred: z.boolean().optional().describe('Whether the tool was loaded via deferred discovery.'),\n is_client_side: z.boolean().optional().describe('Whether the client must supply the tool result.'),\n // Runtime + wire: deviation from origin/main OpenAPI (which omitted this field) is accepted.\n is_thread_creation: z.boolean().optional().describe('Whether this tool call creates a subagent thread.'),\n});\n\nexport const TrueFoundrySystemToolInfoSchema = z\n .object({\n type: z.literal('truefoundry-system').describe('Built-in harness system tool.'),\n name: z.string().describe('System tool name.'),\n })\n .openapi('TrueFoundrySystemToolInfo');\n\nexport const MCPToolInfoSchema = z\n .object({\n type: z.literal('mcp').describe('Tool hosted on an MCP server.'),\n server_id: z.string().describe('Internal MCP server id.'),\n server_name: z.string().describe('Configured MCP server name.'),\n name: z.string().describe('Tool name on the MCP server.'),\n })\n .openapi('MCPToolInfo');\n\nexport const RawToolCallSchema = ChatCompletionMessageToolCallSchema.extend({\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('RawToolCall');\n\nexport const InternalEnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: InternalToolCallInfoSchema,\n});\n\nexport const ToolInfoSchema = z\n .discriminatedUnion('type', [TrueFoundrySystemToolInfoSchema, MCPToolInfoSchema])\n .openapi('ToolInfo');\n\nexport const EnrichedToolCallSchema = RawToolCallSchema.extend({\n tool_info: ToolInfoSchema,\n}).openapi('ToolCall');\n\nexport const RawAssistantMessageSchema = ChatCompletionAssistantMessageParamSchema.omit({\n tool_calls: true,\n audio: true,\n function_call: true,\n})\n .extend({\n tool_calls: z.array(RawToolCallSchema).optional(),\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking for frontend display; exact concat of streamed deltas when set on the assembled message. */\n reasoning_content: z.string().optional(),\n /** Source of the message: which provider/model sent it (`provider_type/provider_name/model_name`). */\n source: z.string().optional(),\n })\n .openapi('RawAssistantMessage');\n\nexport const InternalEnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n}).extend({\n tool_calls: z.array(InternalEnrichedToolCallSchema).optional(),\n});\n\n// `thinking_blocks` / `source` omitted: kept on the internal message for context replay, hidden from the client event.\nexport const EnrichedAssistantMessageSchema = RawAssistantMessageSchema.omit({\n tool_calls: true,\n thinking_blocks: true,\n source: true,\n})\n .extend({\n tool_calls: z.array(EnrichedToolCallSchema).optional(),\n })\n .openapi('EnrichedAssistantMessage');\n\nexport const ExtendedChunkDeltaToolCallSchema = ChatCompletionChunkDeltaToolCallSchema.extend({\n tool_info: ToolInfoSchema.optional(),\n provider_specific_fields: z.record(z.string(), z.unknown()).optional(),\n}).openapi('ExtendedChunkDeltaToolCall');\n\nexport const ExtendedChunkDeltaSchema = ChatCompletionChunkDeltaSchema.omit({ tool_calls: true })\n .extend({\n tool_calls: z.array(ExtendedChunkDeltaToolCallSchema).optional(),\n /** Structured thinking blocks from the gateway; accumulated into complete blocks (with signatures) for multi-turn replay. */\n thinking_blocks: z.array(ThinkingBlockUnionSchema).optional(),\n /** Plain-text thinking fragment for frontend display; assembled message stores the full concat separately. */\n reasoning_content: z.string().optional(),\n })\n .openapi('ExtendedChunkDelta');\n\nexport const LLMUserMessageSchema = ChatCompletionUserMessageParamSchema.pick({\n role: true,\n content: true,\n}).openapi('LLMUserMessage');\n\nexport const LLMToolMessageSchema = ChatCompletionToolMessageParamSchema.omit({ content: true })\n .extend({\n // TODO(agent): Where do I update the Zod code for this change?\n content: z.string(),\n })\n .openapi('LLMToolMessage');\n\nexport const CompletionUsageSchema = z\n .object({\n input_tokens: z.number().int().nonnegative().describe('Input tokens for this completion.'),\n output_tokens: z.number().int().nonnegative().describe('Output tokens for this completion.'),\n total_tokens: z.number().int().nonnegative().describe('Total tokens (input + output).'),\n cache_read_tokens: z.number().int().nonnegative().optional().describe('Optional cache-read tokens.'),\n cache_write_tokens: z.number().int().nonnegative().optional().describe('Optional cache-write tokens.'),\n reasoning_tokens: z.number().int().nonnegative().optional().describe('Optional reasoning tokens.'),\n cost_in_usd: z.number().nonnegative().optional().describe('Optional estimated cost in USD.'),\n })\n .openapi('CompletionUsage');\n\nexport const FinishReasonSchema = ChatCompletionChunkFinishReasonSchema.openapi('FinishReason');\n\nexport type ThinkingBlock = z.infer<typeof ThinkingBlockSchema>;\nexport type RedactedThinkingBlock = z.infer<typeof RedactedThinkingBlockSchema>;\nexport type InternalToolCallInfo = z.infer<typeof InternalToolCallInfoSchema>;\nexport type TrueFoundrySystemToolInfo = z.infer<typeof TrueFoundrySystemToolInfoSchema>;\nexport type MCPToolInfo = z.infer<typeof MCPToolInfoSchema>;\nexport type ToolInfo = z.infer<typeof ToolInfoSchema>;\nexport type InternalEnrichedToolCall = z.infer<typeof InternalEnrichedToolCallSchema>;\nexport type EnrichedToolCall = z.infer<typeof EnrichedToolCallSchema>;\nexport type RawAssistantMessage = z.infer<typeof RawAssistantMessageSchema>;\nexport type InternalEnrichedAssistantMessage = z.infer<typeof InternalEnrichedAssistantMessageSchema>;\nexport type EnrichedAssistantMessage = z.infer<typeof EnrichedAssistantMessageSchema>;\nexport type ExtendedDeltaToolCall = z.infer<typeof ExtendedChunkDeltaToolCallSchema>;\nexport type ExtendedDelta = z.infer<typeof ExtendedChunkDeltaSchema>;\nexport type LLMUserMessage = z.infer<typeof LLMUserMessageSchema>;\nexport type LLMToolMessage = z.infer<typeof LLMToolMessageSchema>;\nexport type CompletionUsage = z.infer<typeof CompletionUsageSchema>;\nexport type FinishReason = z.infer<typeof FinishReasonSchema>;\n\nexport function getEmptyUsage(): CompletionUsage {\n return { input_tokens: 0, output_tokens: 0, total_tokens: 0 };\n}\n\n/**\n * Extended choice type that includes thought_signature in the delta.\n */\ninterface ExtendedChoice extends Omit<ChatCompletionChunk.Choice, 'delta'> {\n /**\n * A chat completion delta generated by streamed model responses, with thought_signature support.\n */\n delta: ExtendedDelta;\n}\n\n/**\n * Extended chat completion chunk that includes thought_signature in tool calls.\n * `usage` is harness-normalized; the LLM adapter maps the wire `usage` payload at the adapter boundary.\n */\nexport interface ExtendedChatCompletionChunk extends Omit<ChatCompletionChunk, 'choices' | 'usage'> {\n /**\n * A list of chat completion choices, with thought_signature support in deltas.\n */\n choices: ExtendedChoice[];\n usage?: CompletionUsage | null;\n}\n\nexport interface RawAssistantMessageWithUsage {\n output: RawAssistantMessage;\n usage: CompletionUsage;\n /** null when the stream ended without a finish_reason chunk (e.g. provider omitted it). */\n finish_reason: FinishReason | null;\n}\n\nexport const UNKNOWN_TOOL_NAME = 'unknown';\n"],"mappings":";AAOA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,sBAAsB,EAChC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,UAAU,EAAE,SAAS,4BAA4B;AAAA,EACjE,UAAU,EAAE,OAAO,EAAE,SAAS,wBAAwB;AAAA,EACtD,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oDAAoD;AAChG,CAAC,EACA,QAAQ,eAAe;AAEnB,IAAM,8BAA8B,EACxC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,mBAAmB,EAAE,SAAS,0BAA0B;AAAA,EACxE,MAAM,EAAE,OAAO,EAAE,SAAS,qDAAqD;AACjF,CAAC,EACA,QAAQ,uBAAuB;AAE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,wBAAwB,GAC7B,cAAc,CAAC,2BAA2B,EAAE,4BAA4B,EAAE,OAAO,CAAC,CAoGpF;IAEK,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAQlF;CACF"}
@@ -52,6 +52,7 @@ var import_openai = require("@ai-sdk/openai");
52
52
  var import_openai_compatible = require("@ai-sdk/openai-compatible");
53
53
  var import_ai = require("ai");
54
54
  var import_errorLogFields = require("../util/errorLogFields.js");
55
+ var import_ssrfGuard = require("../util/ssrfGuard.js");
55
56
  var import_LLMTypes = require("./LLMTypes.js");
56
57
  var VERCEL_AI_PROVIDER_NAMES = [
57
58
  "openai",
@@ -83,6 +84,7 @@ function compatibleModel(config) {
83
84
  name: provider.type,
84
85
  baseURL: baseUrl,
85
86
  apiKey,
87
+ fetch: import_ssrfGuard.ssrfFetch,
86
88
  // Without this the adapter silently downgrades json_schema to a schema-less json_object.
87
89
  supportsStructuredOutputs: true,
88
90
  // These endpoints omit token counts from streamed responses unless asked.
@@ -98,6 +100,7 @@ function buildLanguageModel(config) {
98
100
  case "openai": {
99
101
  const client = (0, import_openai.createOpenAI)({
100
102
  apiKey,
103
+ fetch: import_ssrfGuard.ssrfFetch,
101
104
  ...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
102
105
  ...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
103
106
  });
@@ -106,6 +109,7 @@ function buildLanguageModel(config) {
106
109
  case "anthropic": {
107
110
  const client = (0, import_anthropic.createAnthropic)({
108
111
  apiKey,
112
+ fetch: import_ssrfGuard.ssrfFetch,
109
113
  ...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
110
114
  ...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
111
115
  });
@@ -114,6 +118,7 @@ function buildLanguageModel(config) {
114
118
  case "google-gemini": {
115
119
  const client = (0, import_google.createGoogle)({
116
120
  apiKey,
121
+ fetch: import_ssrfGuard.ssrfFetch,
117
122
  ...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
118
123
  ...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
119
124
  });
@@ -122,6 +127,7 @@ function buildLanguageModel(config) {
122
127
  case "moonshot": {
123
128
  const client = (0, import_moonshotai.createMoonshotAI)({
124
129
  apiKey,
130
+ fetch: import_ssrfGuard.ssrfFetch,
125
131
  ...baseUrl !== void 0 ? { baseURL: baseUrl } : {},
126
132
  ...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
127
133
  });
@@ -134,6 +140,7 @@ function buildLanguageModel(config) {
134
140
  const client = (0, import_alibaba.createAlibaba)({
135
141
  apiKey,
136
142
  baseURL: baseUrl,
143
+ fetch: import_ssrfGuard.ssrfFetch,
137
144
  ...extraHeaders !== void 0 ? { headers: extraHeaders } : {}
138
145
  });
139
146
  return client(model.id);
@@ -726,6 +733,7 @@ async function* mapStreamToChunks({
726
733
  const toolCallStates = /* @__PURE__ */ new Map();
727
734
  let nextToolIndex = 0;
728
735
  let accumulatedText = "";
736
+ let accumulatedReasoning = "";
729
737
  const accumulatedThinking = [];
730
738
  const thinkingByReasoningItem = /* @__PURE__ */ new Map();
731
739
  let currentThinkingBlock = null;
@@ -771,6 +779,7 @@ async function* mapStreamToChunks({
771
779
  case "reasoning-delta": {
772
780
  currentThinkingBlock ??= openThinkingBlock(part.providerMetadata);
773
781
  currentThinkingBlock.thinking += part.text;
782
+ accumulatedReasoning += part.text;
774
783
  applyReasoningSignature({ block: currentThinkingBlock, providerMetadata: part.providerMetadata });
775
784
  yield {
776
785
  ...makeBase(),
@@ -910,6 +919,7 @@ async function* mapStreamToChunks({
910
919
  const output = {
911
920
  role: "assistant",
912
921
  content: accumulatedText || null,
922
+ ...accumulatedReasoning.length > 0 ? { reasoning_content: accumulatedReasoning } : {},
913
923
  ...accumulatedThinking.length > 0 ? { thinking_blocks: accumulatedThinking } : {},
914
924
  ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
915
925
  };