@linnlabs/linnkit 0.8.0 → 0.9.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.
- package/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/cli.cjs +118 -28
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +118 -28
- package/dist/cli.js.map +1 -1
- package/dist/context-manager.cjs +0 -4
- package/dist/context-manager.cjs.map +1 -1
- package/dist/context-manager.js +0 -4
- package/dist/context-manager.js.map +1 -1
- package/dist/{index-Cm-JbzTH.d.cts → index-BanRABEt.d.cts} +14 -3
- package/dist/{index-DRBWi1fy.d.ts → index-Z8NXKNwI.d.ts} +14 -3
- package/dist/index.cjs +146 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +146 -30
- package/dist/index.js.map +1 -1
- package/dist/quickstart.cjs +115 -25
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.js +115 -25
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-kernel.cjs +142 -26
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +1 -1
- package/dist/runtime-kernel.d.ts +1 -1
- package/dist/runtime-kernel.js +140 -27
- package/dist/runtime-kernel.js.map +1 -1
- package/dist/testkit.cjs +155 -39
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.js +155 -39
- package/dist/testkit.js.map +1 -1
- package/package.json +3 -3
|
@@ -75,6 +75,10 @@ declare class LLMPolicyEngine {
|
|
|
75
75
|
|
|
76
76
|
declare const defaultPolicyEngine: LLMPolicyEngine;
|
|
77
77
|
|
|
78
|
+
declare function appendStreamingProviderReasoningDetails(existing: unknown[], incoming: unknown[]): unknown[];
|
|
79
|
+
declare function compactProviderReasoningDetails(reasoningDetails: unknown[]): unknown[];
|
|
80
|
+
declare function compactReasoningDetailsInValue<T>(value: T): T;
|
|
81
|
+
|
|
78
82
|
type index$c_DefaultTokenizerPort = DefaultTokenizerPort;
|
|
79
83
|
declare const index$c_DefaultTokenizerPort: typeof DefaultTokenizerPort;
|
|
80
84
|
type index$c_DefaultTokenizerPortConfig = DefaultTokenizerPortConfig;
|
|
@@ -97,10 +101,13 @@ declare const index$c_ProviderReasoningDetails: typeof ProviderReasoningDetails;
|
|
|
97
101
|
declare const index$c_ToolCall: typeof ToolCall;
|
|
98
102
|
declare const index$c_ToolCallChunk: typeof ToolCallChunk;
|
|
99
103
|
declare const index$c_ToolCallExtraContent: typeof ToolCallExtraContent;
|
|
104
|
+
declare const index$c_appendStreamingProviderReasoningDetails: typeof appendStreamingProviderReasoningDetails;
|
|
105
|
+
declare const index$c_compactProviderReasoningDetails: typeof compactProviderReasoningDetails;
|
|
106
|
+
declare const index$c_compactReasoningDetailsInValue: typeof compactReasoningDetailsInValue;
|
|
100
107
|
declare const index$c_createDefaultTokenizerPort: typeof createDefaultTokenizerPort;
|
|
101
108
|
declare const index$c_defaultPolicyEngine: typeof defaultPolicyEngine;
|
|
102
109
|
declare namespace index$c {
|
|
103
|
-
export { index$c_DefaultTokenizerPort as DefaultTokenizerPort, type index$c_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index$c_LLMPolicy as LLMPolicy, index$c_LLMPolicyEngine as LLMPolicyEngine, index$c_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index$c_LLMPolicyMatchContext as LLMPolicyMatchContext, index$c_LLMPolicyRequestContext as LLMPolicyRequestContext, index$c_LLMPolicyResponseContext as LLMPolicyResponseContext, index$c_LlmCallOptions as LlmCallOptions, index$c_LlmCaller as LlmCaller, index$c_LlmRequestMessage as LlmRequestMessage, index$c_LlmResponseContent as LlmResponseContent, index$c_LlmRetryConfig as LlmRetryConfig, index$c_ModelCatalogEntry as ModelCatalogEntry, index$c_ModelCatalogLike as ModelCatalogLike, index$c_ModelResolver as ModelResolver, index$c_ProviderReasoningDetails as ProviderReasoningDetails, index$c_ToolCall as ToolCall, index$c_ToolCallChunk as ToolCallChunk, index$c_ToolCallExtraContent as ToolCallExtraContent, index$c_createDefaultTokenizerPort as createDefaultTokenizerPort, index$c_defaultPolicyEngine as defaultPolicyEngine };
|
|
110
|
+
export { index$c_DefaultTokenizerPort as DefaultTokenizerPort, type index$c_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index$c_LLMPolicy as LLMPolicy, index$c_LLMPolicyEngine as LLMPolicyEngine, index$c_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index$c_LLMPolicyMatchContext as LLMPolicyMatchContext, index$c_LLMPolicyRequestContext as LLMPolicyRequestContext, index$c_LLMPolicyResponseContext as LLMPolicyResponseContext, index$c_LlmCallOptions as LlmCallOptions, index$c_LlmCaller as LlmCaller, index$c_LlmRequestMessage as LlmRequestMessage, index$c_LlmResponseContent as LlmResponseContent, index$c_LlmRetryConfig as LlmRetryConfig, index$c_ModelCatalogEntry as ModelCatalogEntry, index$c_ModelCatalogLike as ModelCatalogLike, index$c_ModelResolver as ModelResolver, index$c_ProviderReasoningDetails as ProviderReasoningDetails, index$c_ToolCall as ToolCall, index$c_ToolCallChunk as ToolCallChunk, index$c_ToolCallExtraContent as ToolCallExtraContent, index$c_appendStreamingProviderReasoningDetails as appendStreamingProviderReasoningDetails, index$c_compactProviderReasoningDetails as compactProviderReasoningDetails, index$c_compactReasoningDetailsInValue as compactReasoningDetailsInValue, index$c_createDefaultTokenizerPort as createDefaultTokenizerPort, index$c_defaultPolicyEngine as defaultPolicyEngine };
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
interface GraphExecutorSummarizationCallbacks {
|
|
@@ -286,6 +293,7 @@ declare class ToolNode implements GraphNode {
|
|
|
286
293
|
private emitToolCallTelemetry;
|
|
287
294
|
private emitToolDecisionAudit;
|
|
288
295
|
run(state: EngineState): Promise<NodeResult>;
|
|
296
|
+
private runNextPendingToolCall;
|
|
289
297
|
private handleSuccess;
|
|
290
298
|
private handleRequireUserSuccess;
|
|
291
299
|
private handleError;
|
|
@@ -1398,8 +1406,11 @@ declare const index_UserNode: typeof UserNode;
|
|
|
1398
1406
|
type index_WaitUserNode = WaitUserNode;
|
|
1399
1407
|
declare const index_WaitUserNode: typeof WaitUserNode;
|
|
1400
1408
|
declare const index_agentHasToolTrigger: typeof agentHasToolTrigger;
|
|
1409
|
+
declare const index_appendStreamingProviderReasoningDetails: typeof appendStreamingProviderReasoningDetails;
|
|
1401
1410
|
declare const index_applySystemReminders: typeof applySystemReminders;
|
|
1402
1411
|
declare const index_budgetWarningTrigger: typeof budgetWarningTrigger;
|
|
1412
|
+
declare const index_compactProviderReasoningDetails: typeof compactProviderReasoningDetails;
|
|
1413
|
+
declare const index_compactReasoningDetailsInValue: typeof compactReasoningDetailsInValue;
|
|
1403
1414
|
declare const index_computeToolIdempotencyKey: typeof computeToolIdempotencyKey;
|
|
1404
1415
|
declare const index_consoleAudit: typeof consoleAudit;
|
|
1405
1416
|
declare const index_contextBudgetWarningTemplate: typeof contextBudgetWarningTemplate;
|
|
@@ -1444,7 +1455,7 @@ declare const index_toDisplayStep: typeof toDisplayStep;
|
|
|
1444
1455
|
declare const index_toolCallStreakTemplate: typeof toolCallStreakTemplate;
|
|
1445
1456
|
declare const index_toolCallStreakTrigger: typeof toolCallStreakTrigger;
|
|
1446
1457
|
declare namespace index {
|
|
1447
|
-
export { index_AgentTool as AgentTool, index_AnswerNode as AnswerNode, index_AuditEnvelopePersistenceError as AuditEnvelopePersistenceError, index_BUILTIN_SYSTEM_REMINDER_TEMPLATES as BUILTIN_SYSTEM_REMINDER_TEMPLATES, index_BUILTIN_SYSTEM_REMINDER_TRIGGERS as BUILTIN_SYSTEM_REMINDER_TRIGGERS, index_BaseTool as BaseTool, index_CheckpointListFilter as CheckpointListFilter, index_CheckpointMeta as CheckpointMeta, index_CheckpointSummary as CheckpointSummary, index_Checkpointer as Checkpointer, index_CommonParameterTypes as CommonParameterTypes, type index_CompositeAuditOptions as CompositeAuditOptions, index_CompositeAuditPort as CompositeAuditPort, type index_ConsoleAuditOptions as ConsoleAuditOptions, type index_ContextCheckpointPayload as ContextCheckpointPayload, type index_ContextCheckpointPayloadExtension as ContextCheckpointPayloadExtension, index_ContextCheckpointTool as ContextCheckpointTool, type index_ContextCheckpointToolArgs as ContextCheckpointToolArgs, type index_ContextCheckpointToolHookParams as ContextCheckpointToolHookParams, type index_ContextCheckpointToolOptions as ContextCheckpointToolOptions, index_ConversationArtifactContext as ConversationArtifactContext, index_DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME as DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME, index_DefaultGraphExecutorOptions as DefaultGraphExecutorOptions, index_DefaultTokenizerPort as DefaultTokenizerPort, type index_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index_ENGINE_ERROR_CODES as ENGINE_ERROR_CODES, index_ENGINE_STATE_SCHEMA_VERSION as ENGINE_STATE_SCHEMA_VERSION, type index_EmitAuditEnvelopeParams as EmitAuditEnvelopeParams, index_EngineState as EngineState, type index_EnrichmentContext as EnrichmentContext, type index_EnrichmentResult as EnrichmentResult, type index_ErrorClassification as ErrorClassification, index_EventBusSubRunTracePublisher as EventBusSubRunTracePublisher, index_EventRangeOptions as EventRangeOptions, index_EventStore as EventStore, type index_EventStoreAuditOptions as EventStoreAuditOptions, index_EventStoreAuditPort as EventStoreAuditPort, index_ExecutorLocalState as ExecutorLocalState, type index_FileAuditOptions as FileAuditOptions, index_FileAuditPort as FileAuditPort, index_GraphAgentExecutor as GraphAgentExecutor, type index_GraphAgentExecutorDependencies as GraphAgentExecutorDependencies, index_GraphExecutor as GraphExecutor, type index_GraphExecutorContextBuildInput as GraphExecutorContextBuildInput, type index_GraphExecutorContextBuildOutput as GraphExecutorContextBuildOutput, type index_GraphExecutorContextBuilder as GraphExecutorContextBuilder, index_GraphLoopHarness as GraphLoopHarness, index_GraphLoopHarnessOptions as GraphLoopHarnessOptions, index_GraphLoopHarnessRunResult as GraphLoopHarnessRunResult, index_GraphLoopLlmNodeFactoryParams as GraphLoopLlmNodeFactoryParams, index_GraphNode as GraphNode, index_JsonObjectSchema as JsonObjectSchema, index_LLMPolicy as LLMPolicy, index_LLMPolicyEngine as LLMPolicyEngine, index_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index_LLMPolicyMatchContext as LLMPolicyMatchContext, index_LLMPolicyRequestContext as LLMPolicyRequestContext, index_LLMPolicyResponseContext as LLMPolicyResponseContext, index_LlmCallOptions as LlmCallOptions, index_LlmCaller as LlmCaller, index_LlmNode as LlmNode, index_LlmRequestMessage as LlmRequestMessage, index_LlmResponseContent as LlmResponseContent, index_LlmRetryConfig as LlmRetryConfig, index_MemoryCheckpointer as MemoryCheckpointer, index_MemoryEventStore as MemoryEventStore, index_ModelCatalogEntry as ModelCatalogEntry, index_ModelCatalogLike as ModelCatalogLike, index_ModelResolver as ModelResolver, index_ObservationPreviewContext as ObservationPreviewContext, index_ObservationPreviewMeta as ObservationPreviewMeta, index_ObservationPreviewPort as ObservationPreviewPort, index_ObservationPreviewResult as ObservationPreviewResult, index_OpenAIToolSchema as OpenAIToolSchema, type index_PendingContextRuntimeEvent as PendingContextRuntimeEvent, index_PersistedEvent as PersistedEvent, index_ProviderReasoningDetails as ProviderReasoningDetails, type index_RegistryEnrichmentResult as RegistryEnrichmentResult, type index_RequestEnricher as RequestEnricher, index_SYSTEM_REMINDER_RULES as SYSTEM_REMINDER_RULES, index_StructuredToolResult as StructuredToolResult, index_SubRunTracePublisher as SubRunTracePublisher, type index_SystemReminderContentTemplate as SystemReminderContentTemplate, type index_SystemReminderContext as SystemReminderContext, index_SystemReminderRegistry as SystemReminderRegistry, type index_SystemReminderRule as SystemReminderRule, type index_SystemReminderRuleDefinition as SystemReminderRuleDefinition, type index_SystemReminderTriggerEvaluator as SystemReminderTriggerEvaluator, index_ToolArgs as ToolArgs, index_ToolCall as ToolCall, index_ToolCallChunk as ToolCallChunk, index_ToolCallExtraContent as ToolCallExtraContent, index_ToolCallResult as ToolCallResult, index_ToolCatalogPort as ToolCatalogPort, index_ToolContextCompatibilityFields as ToolContextCompatibilityFields, index_ToolContextConversationView as ToolContextConversationView, index_ToolContextPatch as ToolContextPatch, index_ToolControlInfo as ToolControlInfo, index_ToolDisplayOptions as ToolDisplayOptions, index_ToolExecutionContext as ToolExecutionContext, index_ToolExecutionPort as ToolExecutionPort, index_ToolExecutionResult as ToolExecutionResult, index_ToolLayoutOptions as ToolLayoutOptions, index_ToolNode as ToolNode, index_ToolParameterProperty as ToolParameterProperty, index_ToolParameterSchema as ToolParameterSchema, index_ToolPresentationPort as ToolPresentationPort, index_ToolRegistryEntry as ToolRegistryEntry, index_ToolResult as ToolResult, index_ToolRuntimeDefinition as ToolRuntimeDefinition, index_ToolRuntimePort as ToolRuntimePort, index_ToolSchemaContext as ToolSchemaContext, index_UnifiedToolResult as UnifiedToolResult, index_UserNode as UserNode, index_WaitUserNode as WaitUserNode, index_agentHasToolTrigger as agentHasToolTrigger, index_applySystemReminders as applySystemReminders, index$2 as audit, index_budgetWarningTrigger as budgetWarningTrigger, index$6 as childRunTrace, index$7 as childRuns, index_computeToolIdempotencyKey as computeToolIdempotencyKey, index_consoleAudit as consoleAudit, index_contextBudgetWarningTemplate as contextBudgetWarningTemplate, index_countToolCallsInCurrentRequest as countToolCallsInCurrentRequest, index_createCompositeAudit as createCompositeAudit, index_createConsoleAudit as createConsoleAudit, index_createContextCheckpointTool as createContextCheckpointTool, index_createDefaultGraphExecutor as createDefaultGraphExecutor, index_createDefaultSystemReminderRegistry as createDefaultSystemReminderRegistry, index_createDefaultTokenizerPort as createDefaultTokenizerPort, index_createEventStoreAudit as createEventStoreAudit, index_createFileAudit as createFileAudit, index_createGraphLoopHarness as createGraphLoopHarness, index_createMonotonicEventIdFactory as createMonotonicEventIdFactory, index_createSystemReminderRules as createSystemReminderRules, index_defaultPolicyEngine as defaultPolicyEngine, index_defaultSystemReminderRegistry as defaultSystemReminderRegistry, index_emitAuditEnvelope as emitAuditEnvelope, index_emitSandboxDecisionAudit as emitSandboxDecisionAudit, index$5 as enrichment, index_ensureToolContextRuntimeCapability as ensureToolContextRuntimeCapability, index$d as events, index$9 as execution, index_findCachedToolOutputByIdempotencyKey as findCachedToolOutputByIdempotencyKey, index_getToolContextRuntimeBinding as getToolContextRuntimeBinding, index$b as graph, index_lastStepsHintTemplate as lastStepsHintTemplate, index$c as llm, index_maxStepsForceFinalAnswerTemplate as maxStepsForceFinalAnswerTemplate, index_noopAudit as noopAudit, index_normalizeToolArgs as normalizeToolArgs, index_periodicTaskstateReflectionTemplate as periodicTaskstateReflectionTemplate, index_phaseEqualsTrigger as phaseEqualsTrigger, index_readContextCheckpointToolName as readContextCheckpointToolName, index_readNonEmptyStrings as readNonEmptyStrings, index_readToolContextModelId as readToolContextModelId, index_readToolContextPersistedHistory as readToolContextPersistedHistory, index_readToolContextRunContext as readToolContextRunContext, index_readToolContextUserQuery as readToolContextUserQuery, index_readToolContextWorkingHistory as readToolContextWorkingHistory, index_remainingStepsLeqTrigger as remainingStepsLeqTrigger, index_requestEnricherRegistry as requestEnricherRegistry, index$8 as runContext, index$4 as runSupervisor, index_stepCountModuloTrigger as stepCountModuloTrigger, index_stripRuntimeReservedToolContextPatch as stripRuntimeReservedToolContextPatch, index_summarizeCheckpoint as summarizeCheckpoint, index$1 as systemReminder, index$3 as telemetry, index_toDisplayStep as toDisplayStep, index_toolCallStreakTemplate as toolCallStreakTemplate, index_toolCallStreakTrigger as toolCallStreakTrigger, index$a as tools };
|
|
1458
|
+
export { index_AgentTool as AgentTool, index_AnswerNode as AnswerNode, index_AuditEnvelopePersistenceError as AuditEnvelopePersistenceError, index_BUILTIN_SYSTEM_REMINDER_TEMPLATES as BUILTIN_SYSTEM_REMINDER_TEMPLATES, index_BUILTIN_SYSTEM_REMINDER_TRIGGERS as BUILTIN_SYSTEM_REMINDER_TRIGGERS, index_BaseTool as BaseTool, index_CheckpointListFilter as CheckpointListFilter, index_CheckpointMeta as CheckpointMeta, index_CheckpointSummary as CheckpointSummary, index_Checkpointer as Checkpointer, index_CommonParameterTypes as CommonParameterTypes, type index_CompositeAuditOptions as CompositeAuditOptions, index_CompositeAuditPort as CompositeAuditPort, type index_ConsoleAuditOptions as ConsoleAuditOptions, type index_ContextCheckpointPayload as ContextCheckpointPayload, type index_ContextCheckpointPayloadExtension as ContextCheckpointPayloadExtension, index_ContextCheckpointTool as ContextCheckpointTool, type index_ContextCheckpointToolArgs as ContextCheckpointToolArgs, type index_ContextCheckpointToolHookParams as ContextCheckpointToolHookParams, type index_ContextCheckpointToolOptions as ContextCheckpointToolOptions, index_ConversationArtifactContext as ConversationArtifactContext, index_DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME as DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME, index_DefaultGraphExecutorOptions as DefaultGraphExecutorOptions, index_DefaultTokenizerPort as DefaultTokenizerPort, type index_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index_ENGINE_ERROR_CODES as ENGINE_ERROR_CODES, index_ENGINE_STATE_SCHEMA_VERSION as ENGINE_STATE_SCHEMA_VERSION, type index_EmitAuditEnvelopeParams as EmitAuditEnvelopeParams, index_EngineState as EngineState, type index_EnrichmentContext as EnrichmentContext, type index_EnrichmentResult as EnrichmentResult, type index_ErrorClassification as ErrorClassification, index_EventBusSubRunTracePublisher as EventBusSubRunTracePublisher, index_EventRangeOptions as EventRangeOptions, index_EventStore as EventStore, type index_EventStoreAuditOptions as EventStoreAuditOptions, index_EventStoreAuditPort as EventStoreAuditPort, index_ExecutorLocalState as ExecutorLocalState, type index_FileAuditOptions as FileAuditOptions, index_FileAuditPort as FileAuditPort, index_GraphAgentExecutor as GraphAgentExecutor, type index_GraphAgentExecutorDependencies as GraphAgentExecutorDependencies, index_GraphExecutor as GraphExecutor, type index_GraphExecutorContextBuildInput as GraphExecutorContextBuildInput, type index_GraphExecutorContextBuildOutput as GraphExecutorContextBuildOutput, type index_GraphExecutorContextBuilder as GraphExecutorContextBuilder, index_GraphLoopHarness as GraphLoopHarness, index_GraphLoopHarnessOptions as GraphLoopHarnessOptions, index_GraphLoopHarnessRunResult as GraphLoopHarnessRunResult, index_GraphLoopLlmNodeFactoryParams as GraphLoopLlmNodeFactoryParams, index_GraphNode as GraphNode, index_JsonObjectSchema as JsonObjectSchema, index_LLMPolicy as LLMPolicy, index_LLMPolicyEngine as LLMPolicyEngine, index_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index_LLMPolicyMatchContext as LLMPolicyMatchContext, index_LLMPolicyRequestContext as LLMPolicyRequestContext, index_LLMPolicyResponseContext as LLMPolicyResponseContext, index_LlmCallOptions as LlmCallOptions, index_LlmCaller as LlmCaller, index_LlmNode as LlmNode, index_LlmRequestMessage as LlmRequestMessage, index_LlmResponseContent as LlmResponseContent, index_LlmRetryConfig as LlmRetryConfig, index_MemoryCheckpointer as MemoryCheckpointer, index_MemoryEventStore as MemoryEventStore, index_ModelCatalogEntry as ModelCatalogEntry, index_ModelCatalogLike as ModelCatalogLike, index_ModelResolver as ModelResolver, index_ObservationPreviewContext as ObservationPreviewContext, index_ObservationPreviewMeta as ObservationPreviewMeta, index_ObservationPreviewPort as ObservationPreviewPort, index_ObservationPreviewResult as ObservationPreviewResult, index_OpenAIToolSchema as OpenAIToolSchema, type index_PendingContextRuntimeEvent as PendingContextRuntimeEvent, index_PersistedEvent as PersistedEvent, index_ProviderReasoningDetails as ProviderReasoningDetails, type index_RegistryEnrichmentResult as RegistryEnrichmentResult, type index_RequestEnricher as RequestEnricher, index_SYSTEM_REMINDER_RULES as SYSTEM_REMINDER_RULES, index_StructuredToolResult as StructuredToolResult, index_SubRunTracePublisher as SubRunTracePublisher, type index_SystemReminderContentTemplate as SystemReminderContentTemplate, type index_SystemReminderContext as SystemReminderContext, index_SystemReminderRegistry as SystemReminderRegistry, type index_SystemReminderRule as SystemReminderRule, type index_SystemReminderRuleDefinition as SystemReminderRuleDefinition, type index_SystemReminderTriggerEvaluator as SystemReminderTriggerEvaluator, index_ToolArgs as ToolArgs, index_ToolCall as ToolCall, index_ToolCallChunk as ToolCallChunk, index_ToolCallExtraContent as ToolCallExtraContent, index_ToolCallResult as ToolCallResult, index_ToolCatalogPort as ToolCatalogPort, index_ToolContextCompatibilityFields as ToolContextCompatibilityFields, index_ToolContextConversationView as ToolContextConversationView, index_ToolContextPatch as ToolContextPatch, index_ToolControlInfo as ToolControlInfo, index_ToolDisplayOptions as ToolDisplayOptions, index_ToolExecutionContext as ToolExecutionContext, index_ToolExecutionPort as ToolExecutionPort, index_ToolExecutionResult as ToolExecutionResult, index_ToolLayoutOptions as ToolLayoutOptions, index_ToolNode as ToolNode, index_ToolParameterProperty as ToolParameterProperty, index_ToolParameterSchema as ToolParameterSchema, index_ToolPresentationPort as ToolPresentationPort, index_ToolRegistryEntry as ToolRegistryEntry, index_ToolResult as ToolResult, index_ToolRuntimeDefinition as ToolRuntimeDefinition, index_ToolRuntimePort as ToolRuntimePort, index_ToolSchemaContext as ToolSchemaContext, index_UnifiedToolResult as UnifiedToolResult, index_UserNode as UserNode, index_WaitUserNode as WaitUserNode, index_agentHasToolTrigger as agentHasToolTrigger, index_appendStreamingProviderReasoningDetails as appendStreamingProviderReasoningDetails, index_applySystemReminders as applySystemReminders, index$2 as audit, index_budgetWarningTrigger as budgetWarningTrigger, index$6 as childRunTrace, index$7 as childRuns, index_compactProviderReasoningDetails as compactProviderReasoningDetails, index_compactReasoningDetailsInValue as compactReasoningDetailsInValue, index_computeToolIdempotencyKey as computeToolIdempotencyKey, index_consoleAudit as consoleAudit, index_contextBudgetWarningTemplate as contextBudgetWarningTemplate, index_countToolCallsInCurrentRequest as countToolCallsInCurrentRequest, index_createCompositeAudit as createCompositeAudit, index_createConsoleAudit as createConsoleAudit, index_createContextCheckpointTool as createContextCheckpointTool, index_createDefaultGraphExecutor as createDefaultGraphExecutor, index_createDefaultSystemReminderRegistry as createDefaultSystemReminderRegistry, index_createDefaultTokenizerPort as createDefaultTokenizerPort, index_createEventStoreAudit as createEventStoreAudit, index_createFileAudit as createFileAudit, index_createGraphLoopHarness as createGraphLoopHarness, index_createMonotonicEventIdFactory as createMonotonicEventIdFactory, index_createSystemReminderRules as createSystemReminderRules, index_defaultPolicyEngine as defaultPolicyEngine, index_defaultSystemReminderRegistry as defaultSystemReminderRegistry, index_emitAuditEnvelope as emitAuditEnvelope, index_emitSandboxDecisionAudit as emitSandboxDecisionAudit, index$5 as enrichment, index_ensureToolContextRuntimeCapability as ensureToolContextRuntimeCapability, index$d as events, index$9 as execution, index_findCachedToolOutputByIdempotencyKey as findCachedToolOutputByIdempotencyKey, index_getToolContextRuntimeBinding as getToolContextRuntimeBinding, index$b as graph, index_lastStepsHintTemplate as lastStepsHintTemplate, index$c as llm, index_maxStepsForceFinalAnswerTemplate as maxStepsForceFinalAnswerTemplate, index_noopAudit as noopAudit, index_normalizeToolArgs as normalizeToolArgs, index_periodicTaskstateReflectionTemplate as periodicTaskstateReflectionTemplate, index_phaseEqualsTrigger as phaseEqualsTrigger, index_readContextCheckpointToolName as readContextCheckpointToolName, index_readNonEmptyStrings as readNonEmptyStrings, index_readToolContextModelId as readToolContextModelId, index_readToolContextPersistedHistory as readToolContextPersistedHistory, index_readToolContextRunContext as readToolContextRunContext, index_readToolContextUserQuery as readToolContextUserQuery, index_readToolContextWorkingHistory as readToolContextWorkingHistory, index_remainingStepsLeqTrigger as remainingStepsLeqTrigger, index_requestEnricherRegistry as requestEnricherRegistry, index$8 as runContext, index$4 as runSupervisor, index_stepCountModuloTrigger as stepCountModuloTrigger, index_stripRuntimeReservedToolContextPatch as stripRuntimeReservedToolContextPatch, index_summarizeCheckpoint as summarizeCheckpoint, index$1 as systemReminder, index$3 as telemetry, index_toDisplayStep as toDisplayStep, index_toolCallStreakTemplate as toolCallStreakTemplate, index_toolCallStreakTrigger as toolCallStreakTrigger, index$a as tools };
|
|
1448
1459
|
}
|
|
1449
1460
|
|
|
1450
|
-
export {
|
|
1461
|
+
export { index$7 as $, AnswerNode as A, BUILTIN_SYSTEM_REMINDER_TEMPLATES as B, type CompositeAuditOptions as C, DefaultTokenizerPort as D, ENGINE_ERROR_CODES as E, type FileAuditOptions as F, GraphAgentExecutor as G, type SystemReminderContentTemplate as H, type SystemReminderContext as I, SystemReminderRegistry as J, type SystemReminderRule as K, LLMPolicyEngine as L, MemoryCheckpointer as M, type SystemReminderRuleDefinition as N, type SystemReminderTriggerEvaluator as O, type PendingContextRuntimeEvent as P, agentHasToolTrigger as Q, type RegistryEnrichmentResult as R, SYSTEM_REMINDER_RULES as S, ToolNode as T, UserNode as U, appendStreamingProviderReasoningDetails as V, WaitUserNode as W, applySystemReminders as X, index$2 as Y, budgetWarningTrigger as Z, index$6 as _, AuditEnvelopePersistenceError as a, compactProviderReasoningDetails as a0, compactReasoningDetailsInValue as a1, consoleAudit as a2, contextBudgetWarningTemplate as a3, countToolCallsInCurrentRequest as a4, createCompositeAudit as a5, createConsoleAudit as a6, createContextCheckpointTool as a7, createDefaultSystemReminderRegistry as a8, createDefaultTokenizerPort as a9, index$4 as aA, stepCountModuloTrigger as aB, stripRuntimeReservedToolContextPatch as aC, index$1 as aD, index$3 as aE, toDisplayStep as aF, toolCallStreakTemplate as aG, toolCallStreakTrigger as aH, index$a as aI, createEventStoreAudit as aa, createFileAudit as ab, createSystemReminderRules as ac, defaultPolicyEngine as ad, defaultSystemReminderRegistry as ae, emitAuditEnvelope as af, emitSandboxDecisionAudit as ag, index$5 as ah, ensureToolContextRuntimeCapability as ai, index$9 as aj, getToolContextRuntimeBinding as ak, index$b as al, lastStepsHintTemplate as am, index$c as an, maxStepsForceFinalAnswerTemplate as ao, noopAudit as ap, normalizeToolArgs as aq, periodicTaskstateReflectionTemplate as ar, phaseEqualsTrigger as as, readContextCheckpointToolName as at, readNonEmptyStrings as au, readToolContextPersistedHistory as av, readToolContextWorkingHistory as aw, remainingStepsLeqTrigger as ax, requestEnricherRegistry as ay, index$8 as az, BUILTIN_SYSTEM_REMINDER_TRIGGERS as b, CompositeAuditPort as c, type ConsoleAuditOptions as d, type ContextCheckpointPayload as e, type ContextCheckpointPayloadExtension as f, ContextCheckpointTool as g, type ContextCheckpointToolArgs as h, index as i, type ContextCheckpointToolHookParams as j, type ContextCheckpointToolOptions as k, type DefaultTokenizerPortConfig as l, type EmitAuditEnvelopeParams as m, type EnrichmentContext as n, type EnrichmentResult as o, type ErrorClassification as p, EventBusSubRunTracePublisher as q, type EventStoreAuditOptions as r, EventStoreAuditPort as s, FileAuditPort as t, type GraphAgentExecutorDependencies as u, type GraphExecutorContextBuildInput as v, type GraphExecutorContextBuildOutput as w, type GraphExecutorContextBuilder as x, LlmNode as y, type RequestEnricher as z };
|
|
@@ -75,6 +75,10 @@ declare class LLMPolicyEngine {
|
|
|
75
75
|
|
|
76
76
|
declare const defaultPolicyEngine: LLMPolicyEngine;
|
|
77
77
|
|
|
78
|
+
declare function appendStreamingProviderReasoningDetails(existing: unknown[], incoming: unknown[]): unknown[];
|
|
79
|
+
declare function compactProviderReasoningDetails(reasoningDetails: unknown[]): unknown[];
|
|
80
|
+
declare function compactReasoningDetailsInValue<T>(value: T): T;
|
|
81
|
+
|
|
78
82
|
type index$c_DefaultTokenizerPort = DefaultTokenizerPort;
|
|
79
83
|
declare const index$c_DefaultTokenizerPort: typeof DefaultTokenizerPort;
|
|
80
84
|
type index$c_DefaultTokenizerPortConfig = DefaultTokenizerPortConfig;
|
|
@@ -97,10 +101,13 @@ declare const index$c_ProviderReasoningDetails: typeof ProviderReasoningDetails;
|
|
|
97
101
|
declare const index$c_ToolCall: typeof ToolCall;
|
|
98
102
|
declare const index$c_ToolCallChunk: typeof ToolCallChunk;
|
|
99
103
|
declare const index$c_ToolCallExtraContent: typeof ToolCallExtraContent;
|
|
104
|
+
declare const index$c_appendStreamingProviderReasoningDetails: typeof appendStreamingProviderReasoningDetails;
|
|
105
|
+
declare const index$c_compactProviderReasoningDetails: typeof compactProviderReasoningDetails;
|
|
106
|
+
declare const index$c_compactReasoningDetailsInValue: typeof compactReasoningDetailsInValue;
|
|
100
107
|
declare const index$c_createDefaultTokenizerPort: typeof createDefaultTokenizerPort;
|
|
101
108
|
declare const index$c_defaultPolicyEngine: typeof defaultPolicyEngine;
|
|
102
109
|
declare namespace index$c {
|
|
103
|
-
export { index$c_DefaultTokenizerPort as DefaultTokenizerPort, type index$c_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index$c_LLMPolicy as LLMPolicy, index$c_LLMPolicyEngine as LLMPolicyEngine, index$c_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index$c_LLMPolicyMatchContext as LLMPolicyMatchContext, index$c_LLMPolicyRequestContext as LLMPolicyRequestContext, index$c_LLMPolicyResponseContext as LLMPolicyResponseContext, index$c_LlmCallOptions as LlmCallOptions, index$c_LlmCaller as LlmCaller, index$c_LlmRequestMessage as LlmRequestMessage, index$c_LlmResponseContent as LlmResponseContent, index$c_LlmRetryConfig as LlmRetryConfig, index$c_ModelCatalogEntry as ModelCatalogEntry, index$c_ModelCatalogLike as ModelCatalogLike, index$c_ModelResolver as ModelResolver, index$c_ProviderReasoningDetails as ProviderReasoningDetails, index$c_ToolCall as ToolCall, index$c_ToolCallChunk as ToolCallChunk, index$c_ToolCallExtraContent as ToolCallExtraContent, index$c_createDefaultTokenizerPort as createDefaultTokenizerPort, index$c_defaultPolicyEngine as defaultPolicyEngine };
|
|
110
|
+
export { index$c_DefaultTokenizerPort as DefaultTokenizerPort, type index$c_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index$c_LLMPolicy as LLMPolicy, index$c_LLMPolicyEngine as LLMPolicyEngine, index$c_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index$c_LLMPolicyMatchContext as LLMPolicyMatchContext, index$c_LLMPolicyRequestContext as LLMPolicyRequestContext, index$c_LLMPolicyResponseContext as LLMPolicyResponseContext, index$c_LlmCallOptions as LlmCallOptions, index$c_LlmCaller as LlmCaller, index$c_LlmRequestMessage as LlmRequestMessage, index$c_LlmResponseContent as LlmResponseContent, index$c_LlmRetryConfig as LlmRetryConfig, index$c_ModelCatalogEntry as ModelCatalogEntry, index$c_ModelCatalogLike as ModelCatalogLike, index$c_ModelResolver as ModelResolver, index$c_ProviderReasoningDetails as ProviderReasoningDetails, index$c_ToolCall as ToolCall, index$c_ToolCallChunk as ToolCallChunk, index$c_ToolCallExtraContent as ToolCallExtraContent, index$c_appendStreamingProviderReasoningDetails as appendStreamingProviderReasoningDetails, index$c_compactProviderReasoningDetails as compactProviderReasoningDetails, index$c_compactReasoningDetailsInValue as compactReasoningDetailsInValue, index$c_createDefaultTokenizerPort as createDefaultTokenizerPort, index$c_defaultPolicyEngine as defaultPolicyEngine };
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
interface GraphExecutorSummarizationCallbacks {
|
|
@@ -286,6 +293,7 @@ declare class ToolNode implements GraphNode {
|
|
|
286
293
|
private emitToolCallTelemetry;
|
|
287
294
|
private emitToolDecisionAudit;
|
|
288
295
|
run(state: EngineState): Promise<NodeResult>;
|
|
296
|
+
private runNextPendingToolCall;
|
|
289
297
|
private handleSuccess;
|
|
290
298
|
private handleRequireUserSuccess;
|
|
291
299
|
private handleError;
|
|
@@ -1398,8 +1406,11 @@ declare const index_UserNode: typeof UserNode;
|
|
|
1398
1406
|
type index_WaitUserNode = WaitUserNode;
|
|
1399
1407
|
declare const index_WaitUserNode: typeof WaitUserNode;
|
|
1400
1408
|
declare const index_agentHasToolTrigger: typeof agentHasToolTrigger;
|
|
1409
|
+
declare const index_appendStreamingProviderReasoningDetails: typeof appendStreamingProviderReasoningDetails;
|
|
1401
1410
|
declare const index_applySystemReminders: typeof applySystemReminders;
|
|
1402
1411
|
declare const index_budgetWarningTrigger: typeof budgetWarningTrigger;
|
|
1412
|
+
declare const index_compactProviderReasoningDetails: typeof compactProviderReasoningDetails;
|
|
1413
|
+
declare const index_compactReasoningDetailsInValue: typeof compactReasoningDetailsInValue;
|
|
1403
1414
|
declare const index_computeToolIdempotencyKey: typeof computeToolIdempotencyKey;
|
|
1404
1415
|
declare const index_consoleAudit: typeof consoleAudit;
|
|
1405
1416
|
declare const index_contextBudgetWarningTemplate: typeof contextBudgetWarningTemplate;
|
|
@@ -1444,7 +1455,7 @@ declare const index_toDisplayStep: typeof toDisplayStep;
|
|
|
1444
1455
|
declare const index_toolCallStreakTemplate: typeof toolCallStreakTemplate;
|
|
1445
1456
|
declare const index_toolCallStreakTrigger: typeof toolCallStreakTrigger;
|
|
1446
1457
|
declare namespace index {
|
|
1447
|
-
export { index_AgentTool as AgentTool, index_AnswerNode as AnswerNode, index_AuditEnvelopePersistenceError as AuditEnvelopePersistenceError, index_BUILTIN_SYSTEM_REMINDER_TEMPLATES as BUILTIN_SYSTEM_REMINDER_TEMPLATES, index_BUILTIN_SYSTEM_REMINDER_TRIGGERS as BUILTIN_SYSTEM_REMINDER_TRIGGERS, index_BaseTool as BaseTool, index_CheckpointListFilter as CheckpointListFilter, index_CheckpointMeta as CheckpointMeta, index_CheckpointSummary as CheckpointSummary, index_Checkpointer as Checkpointer, index_CommonParameterTypes as CommonParameterTypes, type index_CompositeAuditOptions as CompositeAuditOptions, index_CompositeAuditPort as CompositeAuditPort, type index_ConsoleAuditOptions as ConsoleAuditOptions, type index_ContextCheckpointPayload as ContextCheckpointPayload, type index_ContextCheckpointPayloadExtension as ContextCheckpointPayloadExtension, index_ContextCheckpointTool as ContextCheckpointTool, type index_ContextCheckpointToolArgs as ContextCheckpointToolArgs, type index_ContextCheckpointToolHookParams as ContextCheckpointToolHookParams, type index_ContextCheckpointToolOptions as ContextCheckpointToolOptions, index_ConversationArtifactContext as ConversationArtifactContext, index_DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME as DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME, index_DefaultGraphExecutorOptions as DefaultGraphExecutorOptions, index_DefaultTokenizerPort as DefaultTokenizerPort, type index_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index_ENGINE_ERROR_CODES as ENGINE_ERROR_CODES, index_ENGINE_STATE_SCHEMA_VERSION as ENGINE_STATE_SCHEMA_VERSION, type index_EmitAuditEnvelopeParams as EmitAuditEnvelopeParams, index_EngineState as EngineState, type index_EnrichmentContext as EnrichmentContext, type index_EnrichmentResult as EnrichmentResult, type index_ErrorClassification as ErrorClassification, index_EventBusSubRunTracePublisher as EventBusSubRunTracePublisher, index_EventRangeOptions as EventRangeOptions, index_EventStore as EventStore, type index_EventStoreAuditOptions as EventStoreAuditOptions, index_EventStoreAuditPort as EventStoreAuditPort, index_ExecutorLocalState as ExecutorLocalState, type index_FileAuditOptions as FileAuditOptions, index_FileAuditPort as FileAuditPort, index_GraphAgentExecutor as GraphAgentExecutor, type index_GraphAgentExecutorDependencies as GraphAgentExecutorDependencies, index_GraphExecutor as GraphExecutor, type index_GraphExecutorContextBuildInput as GraphExecutorContextBuildInput, type index_GraphExecutorContextBuildOutput as GraphExecutorContextBuildOutput, type index_GraphExecutorContextBuilder as GraphExecutorContextBuilder, index_GraphLoopHarness as GraphLoopHarness, index_GraphLoopHarnessOptions as GraphLoopHarnessOptions, index_GraphLoopHarnessRunResult as GraphLoopHarnessRunResult, index_GraphLoopLlmNodeFactoryParams as GraphLoopLlmNodeFactoryParams, index_GraphNode as GraphNode, index_JsonObjectSchema as JsonObjectSchema, index_LLMPolicy as LLMPolicy, index_LLMPolicyEngine as LLMPolicyEngine, index_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index_LLMPolicyMatchContext as LLMPolicyMatchContext, index_LLMPolicyRequestContext as LLMPolicyRequestContext, index_LLMPolicyResponseContext as LLMPolicyResponseContext, index_LlmCallOptions as LlmCallOptions, index_LlmCaller as LlmCaller, index_LlmNode as LlmNode, index_LlmRequestMessage as LlmRequestMessage, index_LlmResponseContent as LlmResponseContent, index_LlmRetryConfig as LlmRetryConfig, index_MemoryCheckpointer as MemoryCheckpointer, index_MemoryEventStore as MemoryEventStore, index_ModelCatalogEntry as ModelCatalogEntry, index_ModelCatalogLike as ModelCatalogLike, index_ModelResolver as ModelResolver, index_ObservationPreviewContext as ObservationPreviewContext, index_ObservationPreviewMeta as ObservationPreviewMeta, index_ObservationPreviewPort as ObservationPreviewPort, index_ObservationPreviewResult as ObservationPreviewResult, index_OpenAIToolSchema as OpenAIToolSchema, type index_PendingContextRuntimeEvent as PendingContextRuntimeEvent, index_PersistedEvent as PersistedEvent, index_ProviderReasoningDetails as ProviderReasoningDetails, type index_RegistryEnrichmentResult as RegistryEnrichmentResult, type index_RequestEnricher as RequestEnricher, index_SYSTEM_REMINDER_RULES as SYSTEM_REMINDER_RULES, index_StructuredToolResult as StructuredToolResult, index_SubRunTracePublisher as SubRunTracePublisher, type index_SystemReminderContentTemplate as SystemReminderContentTemplate, type index_SystemReminderContext as SystemReminderContext, index_SystemReminderRegistry as SystemReminderRegistry, type index_SystemReminderRule as SystemReminderRule, type index_SystemReminderRuleDefinition as SystemReminderRuleDefinition, type index_SystemReminderTriggerEvaluator as SystemReminderTriggerEvaluator, index_ToolArgs as ToolArgs, index_ToolCall as ToolCall, index_ToolCallChunk as ToolCallChunk, index_ToolCallExtraContent as ToolCallExtraContent, index_ToolCallResult as ToolCallResult, index_ToolCatalogPort as ToolCatalogPort, index_ToolContextCompatibilityFields as ToolContextCompatibilityFields, index_ToolContextConversationView as ToolContextConversationView, index_ToolContextPatch as ToolContextPatch, index_ToolControlInfo as ToolControlInfo, index_ToolDisplayOptions as ToolDisplayOptions, index_ToolExecutionContext as ToolExecutionContext, index_ToolExecutionPort as ToolExecutionPort, index_ToolExecutionResult as ToolExecutionResult, index_ToolLayoutOptions as ToolLayoutOptions, index_ToolNode as ToolNode, index_ToolParameterProperty as ToolParameterProperty, index_ToolParameterSchema as ToolParameterSchema, index_ToolPresentationPort as ToolPresentationPort, index_ToolRegistryEntry as ToolRegistryEntry, index_ToolResult as ToolResult, index_ToolRuntimeDefinition as ToolRuntimeDefinition, index_ToolRuntimePort as ToolRuntimePort, index_ToolSchemaContext as ToolSchemaContext, index_UnifiedToolResult as UnifiedToolResult, index_UserNode as UserNode, index_WaitUserNode as WaitUserNode, index_agentHasToolTrigger as agentHasToolTrigger, index_applySystemReminders as applySystemReminders, index$2 as audit, index_budgetWarningTrigger as budgetWarningTrigger, index$6 as childRunTrace, index$7 as childRuns, index_computeToolIdempotencyKey as computeToolIdempotencyKey, index_consoleAudit as consoleAudit, index_contextBudgetWarningTemplate as contextBudgetWarningTemplate, index_countToolCallsInCurrentRequest as countToolCallsInCurrentRequest, index_createCompositeAudit as createCompositeAudit, index_createConsoleAudit as createConsoleAudit, index_createContextCheckpointTool as createContextCheckpointTool, index_createDefaultGraphExecutor as createDefaultGraphExecutor, index_createDefaultSystemReminderRegistry as createDefaultSystemReminderRegistry, index_createDefaultTokenizerPort as createDefaultTokenizerPort, index_createEventStoreAudit as createEventStoreAudit, index_createFileAudit as createFileAudit, index_createGraphLoopHarness as createGraphLoopHarness, index_createMonotonicEventIdFactory as createMonotonicEventIdFactory, index_createSystemReminderRules as createSystemReminderRules, index_defaultPolicyEngine as defaultPolicyEngine, index_defaultSystemReminderRegistry as defaultSystemReminderRegistry, index_emitAuditEnvelope as emitAuditEnvelope, index_emitSandboxDecisionAudit as emitSandboxDecisionAudit, index$5 as enrichment, index_ensureToolContextRuntimeCapability as ensureToolContextRuntimeCapability, index$d as events, index$9 as execution, index_findCachedToolOutputByIdempotencyKey as findCachedToolOutputByIdempotencyKey, index_getToolContextRuntimeBinding as getToolContextRuntimeBinding, index$b as graph, index_lastStepsHintTemplate as lastStepsHintTemplate, index$c as llm, index_maxStepsForceFinalAnswerTemplate as maxStepsForceFinalAnswerTemplate, index_noopAudit as noopAudit, index_normalizeToolArgs as normalizeToolArgs, index_periodicTaskstateReflectionTemplate as periodicTaskstateReflectionTemplate, index_phaseEqualsTrigger as phaseEqualsTrigger, index_readContextCheckpointToolName as readContextCheckpointToolName, index_readNonEmptyStrings as readNonEmptyStrings, index_readToolContextModelId as readToolContextModelId, index_readToolContextPersistedHistory as readToolContextPersistedHistory, index_readToolContextRunContext as readToolContextRunContext, index_readToolContextUserQuery as readToolContextUserQuery, index_readToolContextWorkingHistory as readToolContextWorkingHistory, index_remainingStepsLeqTrigger as remainingStepsLeqTrigger, index_requestEnricherRegistry as requestEnricherRegistry, index$8 as runContext, index$4 as runSupervisor, index_stepCountModuloTrigger as stepCountModuloTrigger, index_stripRuntimeReservedToolContextPatch as stripRuntimeReservedToolContextPatch, index_summarizeCheckpoint as summarizeCheckpoint, index$1 as systemReminder, index$3 as telemetry, index_toDisplayStep as toDisplayStep, index_toolCallStreakTemplate as toolCallStreakTemplate, index_toolCallStreakTrigger as toolCallStreakTrigger, index$a as tools };
|
|
1458
|
+
export { index_AgentTool as AgentTool, index_AnswerNode as AnswerNode, index_AuditEnvelopePersistenceError as AuditEnvelopePersistenceError, index_BUILTIN_SYSTEM_REMINDER_TEMPLATES as BUILTIN_SYSTEM_REMINDER_TEMPLATES, index_BUILTIN_SYSTEM_REMINDER_TRIGGERS as BUILTIN_SYSTEM_REMINDER_TRIGGERS, index_BaseTool as BaseTool, index_CheckpointListFilter as CheckpointListFilter, index_CheckpointMeta as CheckpointMeta, index_CheckpointSummary as CheckpointSummary, index_Checkpointer as Checkpointer, index_CommonParameterTypes as CommonParameterTypes, type index_CompositeAuditOptions as CompositeAuditOptions, index_CompositeAuditPort as CompositeAuditPort, type index_ConsoleAuditOptions as ConsoleAuditOptions, type index_ContextCheckpointPayload as ContextCheckpointPayload, type index_ContextCheckpointPayloadExtension as ContextCheckpointPayloadExtension, index_ContextCheckpointTool as ContextCheckpointTool, type index_ContextCheckpointToolArgs as ContextCheckpointToolArgs, type index_ContextCheckpointToolHookParams as ContextCheckpointToolHookParams, type index_ContextCheckpointToolOptions as ContextCheckpointToolOptions, index_ConversationArtifactContext as ConversationArtifactContext, index_DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME as DEFAULT_CONTEXT_CHECKPOINT_TOOL_NAME, index_DefaultGraphExecutorOptions as DefaultGraphExecutorOptions, index_DefaultTokenizerPort as DefaultTokenizerPort, type index_DefaultTokenizerPortConfig as DefaultTokenizerPortConfig, index_ENGINE_ERROR_CODES as ENGINE_ERROR_CODES, index_ENGINE_STATE_SCHEMA_VERSION as ENGINE_STATE_SCHEMA_VERSION, type index_EmitAuditEnvelopeParams as EmitAuditEnvelopeParams, index_EngineState as EngineState, type index_EnrichmentContext as EnrichmentContext, type index_EnrichmentResult as EnrichmentResult, type index_ErrorClassification as ErrorClassification, index_EventBusSubRunTracePublisher as EventBusSubRunTracePublisher, index_EventRangeOptions as EventRangeOptions, index_EventStore as EventStore, type index_EventStoreAuditOptions as EventStoreAuditOptions, index_EventStoreAuditPort as EventStoreAuditPort, index_ExecutorLocalState as ExecutorLocalState, type index_FileAuditOptions as FileAuditOptions, index_FileAuditPort as FileAuditPort, index_GraphAgentExecutor as GraphAgentExecutor, type index_GraphAgentExecutorDependencies as GraphAgentExecutorDependencies, index_GraphExecutor as GraphExecutor, type index_GraphExecutorContextBuildInput as GraphExecutorContextBuildInput, type index_GraphExecutorContextBuildOutput as GraphExecutorContextBuildOutput, type index_GraphExecutorContextBuilder as GraphExecutorContextBuilder, index_GraphLoopHarness as GraphLoopHarness, index_GraphLoopHarnessOptions as GraphLoopHarnessOptions, index_GraphLoopHarnessRunResult as GraphLoopHarnessRunResult, index_GraphLoopLlmNodeFactoryParams as GraphLoopLlmNodeFactoryParams, index_GraphNode as GraphNode, index_JsonObjectSchema as JsonObjectSchema, index_LLMPolicy as LLMPolicy, index_LLMPolicyEngine as LLMPolicyEngine, index_LLMPolicyErrorDecision as LLMPolicyErrorDecision, index_LLMPolicyMatchContext as LLMPolicyMatchContext, index_LLMPolicyRequestContext as LLMPolicyRequestContext, index_LLMPolicyResponseContext as LLMPolicyResponseContext, index_LlmCallOptions as LlmCallOptions, index_LlmCaller as LlmCaller, index_LlmNode as LlmNode, index_LlmRequestMessage as LlmRequestMessage, index_LlmResponseContent as LlmResponseContent, index_LlmRetryConfig as LlmRetryConfig, index_MemoryCheckpointer as MemoryCheckpointer, index_MemoryEventStore as MemoryEventStore, index_ModelCatalogEntry as ModelCatalogEntry, index_ModelCatalogLike as ModelCatalogLike, index_ModelResolver as ModelResolver, index_ObservationPreviewContext as ObservationPreviewContext, index_ObservationPreviewMeta as ObservationPreviewMeta, index_ObservationPreviewPort as ObservationPreviewPort, index_ObservationPreviewResult as ObservationPreviewResult, index_OpenAIToolSchema as OpenAIToolSchema, type index_PendingContextRuntimeEvent as PendingContextRuntimeEvent, index_PersistedEvent as PersistedEvent, index_ProviderReasoningDetails as ProviderReasoningDetails, type index_RegistryEnrichmentResult as RegistryEnrichmentResult, type index_RequestEnricher as RequestEnricher, index_SYSTEM_REMINDER_RULES as SYSTEM_REMINDER_RULES, index_StructuredToolResult as StructuredToolResult, index_SubRunTracePublisher as SubRunTracePublisher, type index_SystemReminderContentTemplate as SystemReminderContentTemplate, type index_SystemReminderContext as SystemReminderContext, index_SystemReminderRegistry as SystemReminderRegistry, type index_SystemReminderRule as SystemReminderRule, type index_SystemReminderRuleDefinition as SystemReminderRuleDefinition, type index_SystemReminderTriggerEvaluator as SystemReminderTriggerEvaluator, index_ToolArgs as ToolArgs, index_ToolCall as ToolCall, index_ToolCallChunk as ToolCallChunk, index_ToolCallExtraContent as ToolCallExtraContent, index_ToolCallResult as ToolCallResult, index_ToolCatalogPort as ToolCatalogPort, index_ToolContextCompatibilityFields as ToolContextCompatibilityFields, index_ToolContextConversationView as ToolContextConversationView, index_ToolContextPatch as ToolContextPatch, index_ToolControlInfo as ToolControlInfo, index_ToolDisplayOptions as ToolDisplayOptions, index_ToolExecutionContext as ToolExecutionContext, index_ToolExecutionPort as ToolExecutionPort, index_ToolExecutionResult as ToolExecutionResult, index_ToolLayoutOptions as ToolLayoutOptions, index_ToolNode as ToolNode, index_ToolParameterProperty as ToolParameterProperty, index_ToolParameterSchema as ToolParameterSchema, index_ToolPresentationPort as ToolPresentationPort, index_ToolRegistryEntry as ToolRegistryEntry, index_ToolResult as ToolResult, index_ToolRuntimeDefinition as ToolRuntimeDefinition, index_ToolRuntimePort as ToolRuntimePort, index_ToolSchemaContext as ToolSchemaContext, index_UnifiedToolResult as UnifiedToolResult, index_UserNode as UserNode, index_WaitUserNode as WaitUserNode, index_agentHasToolTrigger as agentHasToolTrigger, index_appendStreamingProviderReasoningDetails as appendStreamingProviderReasoningDetails, index_applySystemReminders as applySystemReminders, index$2 as audit, index_budgetWarningTrigger as budgetWarningTrigger, index$6 as childRunTrace, index$7 as childRuns, index_compactProviderReasoningDetails as compactProviderReasoningDetails, index_compactReasoningDetailsInValue as compactReasoningDetailsInValue, index_computeToolIdempotencyKey as computeToolIdempotencyKey, index_consoleAudit as consoleAudit, index_contextBudgetWarningTemplate as contextBudgetWarningTemplate, index_countToolCallsInCurrentRequest as countToolCallsInCurrentRequest, index_createCompositeAudit as createCompositeAudit, index_createConsoleAudit as createConsoleAudit, index_createContextCheckpointTool as createContextCheckpointTool, index_createDefaultGraphExecutor as createDefaultGraphExecutor, index_createDefaultSystemReminderRegistry as createDefaultSystemReminderRegistry, index_createDefaultTokenizerPort as createDefaultTokenizerPort, index_createEventStoreAudit as createEventStoreAudit, index_createFileAudit as createFileAudit, index_createGraphLoopHarness as createGraphLoopHarness, index_createMonotonicEventIdFactory as createMonotonicEventIdFactory, index_createSystemReminderRules as createSystemReminderRules, index_defaultPolicyEngine as defaultPolicyEngine, index_defaultSystemReminderRegistry as defaultSystemReminderRegistry, index_emitAuditEnvelope as emitAuditEnvelope, index_emitSandboxDecisionAudit as emitSandboxDecisionAudit, index$5 as enrichment, index_ensureToolContextRuntimeCapability as ensureToolContextRuntimeCapability, index$d as events, index$9 as execution, index_findCachedToolOutputByIdempotencyKey as findCachedToolOutputByIdempotencyKey, index_getToolContextRuntimeBinding as getToolContextRuntimeBinding, index$b as graph, index_lastStepsHintTemplate as lastStepsHintTemplate, index$c as llm, index_maxStepsForceFinalAnswerTemplate as maxStepsForceFinalAnswerTemplate, index_noopAudit as noopAudit, index_normalizeToolArgs as normalizeToolArgs, index_periodicTaskstateReflectionTemplate as periodicTaskstateReflectionTemplate, index_phaseEqualsTrigger as phaseEqualsTrigger, index_readContextCheckpointToolName as readContextCheckpointToolName, index_readNonEmptyStrings as readNonEmptyStrings, index_readToolContextModelId as readToolContextModelId, index_readToolContextPersistedHistory as readToolContextPersistedHistory, index_readToolContextRunContext as readToolContextRunContext, index_readToolContextUserQuery as readToolContextUserQuery, index_readToolContextWorkingHistory as readToolContextWorkingHistory, index_remainingStepsLeqTrigger as remainingStepsLeqTrigger, index_requestEnricherRegistry as requestEnricherRegistry, index$8 as runContext, index$4 as runSupervisor, index_stepCountModuloTrigger as stepCountModuloTrigger, index_stripRuntimeReservedToolContextPatch as stripRuntimeReservedToolContextPatch, index_summarizeCheckpoint as summarizeCheckpoint, index$1 as systemReminder, index$3 as telemetry, index_toDisplayStep as toDisplayStep, index_toolCallStreakTemplate as toolCallStreakTemplate, index_toolCallStreakTrigger as toolCallStreakTrigger, index$a as tools };
|
|
1448
1459
|
}
|
|
1449
1460
|
|
|
1450
|
-
export {
|
|
1461
|
+
export { index$7 as $, AnswerNode as A, BUILTIN_SYSTEM_REMINDER_TEMPLATES as B, type CompositeAuditOptions as C, DefaultTokenizerPort as D, ENGINE_ERROR_CODES as E, type FileAuditOptions as F, GraphAgentExecutor as G, type SystemReminderContentTemplate as H, type SystemReminderContext as I, SystemReminderRegistry as J, type SystemReminderRule as K, LLMPolicyEngine as L, MemoryCheckpointer as M, type SystemReminderRuleDefinition as N, type SystemReminderTriggerEvaluator as O, type PendingContextRuntimeEvent as P, agentHasToolTrigger as Q, type RegistryEnrichmentResult as R, SYSTEM_REMINDER_RULES as S, ToolNode as T, UserNode as U, appendStreamingProviderReasoningDetails as V, WaitUserNode as W, applySystemReminders as X, index$2 as Y, budgetWarningTrigger as Z, index$6 as _, AuditEnvelopePersistenceError as a, compactProviderReasoningDetails as a0, compactReasoningDetailsInValue as a1, consoleAudit as a2, contextBudgetWarningTemplate as a3, countToolCallsInCurrentRequest as a4, createCompositeAudit as a5, createConsoleAudit as a6, createContextCheckpointTool as a7, createDefaultSystemReminderRegistry as a8, createDefaultTokenizerPort as a9, index$4 as aA, stepCountModuloTrigger as aB, stripRuntimeReservedToolContextPatch as aC, index$1 as aD, index$3 as aE, toDisplayStep as aF, toolCallStreakTemplate as aG, toolCallStreakTrigger as aH, index$a as aI, createEventStoreAudit as aa, createFileAudit as ab, createSystemReminderRules as ac, defaultPolicyEngine as ad, defaultSystemReminderRegistry as ae, emitAuditEnvelope as af, emitSandboxDecisionAudit as ag, index$5 as ah, ensureToolContextRuntimeCapability as ai, index$9 as aj, getToolContextRuntimeBinding as ak, index$b as al, lastStepsHintTemplate as am, index$c as an, maxStepsForceFinalAnswerTemplate as ao, noopAudit as ap, normalizeToolArgs as aq, periodicTaskstateReflectionTemplate as ar, phaseEqualsTrigger as as, readContextCheckpointToolName as at, readNonEmptyStrings as au, readToolContextPersistedHistory as av, readToolContextWorkingHistory as aw, remainingStepsLeqTrigger as ax, requestEnricherRegistry as ay, index$8 as az, BUILTIN_SYSTEM_REMINDER_TRIGGERS as b, CompositeAuditPort as c, type ConsoleAuditOptions as d, type ContextCheckpointPayload as e, type ContextCheckpointPayloadExtension as f, ContextCheckpointTool as g, type ContextCheckpointToolArgs as h, index as i, type ContextCheckpointToolHookParams as j, type ContextCheckpointToolOptions as k, type DefaultTokenizerPortConfig as l, type EmitAuditEnvelopeParams as m, type EnrichmentContext as n, type EnrichmentResult as o, type ErrorClassification as p, EventBusSubRunTracePublisher as q, type EventStoreAuditOptions as r, EventStoreAuditPort as s, FileAuditPort as t, type GraphAgentExecutorDependencies as u, type GraphExecutorContextBuildInput as v, type GraphExecutorContextBuildOutput as w, type GraphExecutorContextBuilder as x, LlmNode as y, type RequestEnricher as z };
|
package/dist/index.cjs
CHANGED
|
@@ -48,11 +48,14 @@ __export(runtime_kernel_exports, {
|
|
|
48
48
|
UserNode: () => UserNode,
|
|
49
49
|
WaitUserNode: () => WaitUserNode,
|
|
50
50
|
agentHasToolTrigger: () => agentHasToolTrigger,
|
|
51
|
+
appendStreamingProviderReasoningDetails: () => appendStreamingProviderReasoningDetails,
|
|
51
52
|
applySystemReminders: () => applySystemReminders,
|
|
52
53
|
audit: () => audit_exports,
|
|
53
54
|
budgetWarningTrigger: () => budgetWarningTrigger,
|
|
54
55
|
childRunTrace: () => child_run_trace_exports,
|
|
55
56
|
childRuns: () => child_runs_exports,
|
|
57
|
+
compactProviderReasoningDetails: () => compactProviderReasoningDetails,
|
|
58
|
+
compactReasoningDetailsInValue: () => compactReasoningDetailsInValue,
|
|
56
59
|
computeToolIdempotencyKey: () => computeToolIdempotencyKey,
|
|
57
60
|
consoleAudit: () => consoleAudit,
|
|
58
61
|
contextBudgetWarningTemplate: () => contextBudgetWarningTemplate,
|
|
@@ -137,7 +140,6 @@ var Logger = class {
|
|
|
137
140
|
constructor(moduleName) {
|
|
138
141
|
this.moduleName = moduleName;
|
|
139
142
|
}
|
|
140
|
-
moduleName;
|
|
141
143
|
debug(message, data) {
|
|
142
144
|
this.log(0 /* DEBUG */, "debug", message, data);
|
|
143
145
|
}
|
|
@@ -1549,7 +1551,6 @@ var GraphExecutor = class {
|
|
|
1549
1551
|
};
|
|
1550
1552
|
this.telemetryPort = config.telemetryPort ?? noopTelemetry;
|
|
1551
1553
|
}
|
|
1552
|
-
checkpointer;
|
|
1553
1554
|
nodes = /* @__PURE__ */ new Map();
|
|
1554
1555
|
ephemeralLocals = /* @__PURE__ */ new Map();
|
|
1555
1556
|
config;
|
|
@@ -4970,6 +4971,22 @@ var ToolNode = class {
|
|
|
4970
4971
|
});
|
|
4971
4972
|
}
|
|
4972
4973
|
async run(state) {
|
|
4974
|
+
const events = [];
|
|
4975
|
+
while (true) {
|
|
4976
|
+
const result = await this.runNextPendingToolCall(state);
|
|
4977
|
+
if (Array.isArray(result.events) && result.events.length > 0) {
|
|
4978
|
+
events.push(...result.events);
|
|
4979
|
+
}
|
|
4980
|
+
if (result.kind === "route" && result.nextNodeId === "tool") {
|
|
4981
|
+
continue;
|
|
4982
|
+
}
|
|
4983
|
+
return {
|
|
4984
|
+
...result,
|
|
4985
|
+
events
|
|
4986
|
+
};
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
async runNextPendingToolCall(state) {
|
|
4973
4990
|
const calls = state.local?.pendingToolCalls ?? [];
|
|
4974
4991
|
const signalRaw = state.local?.signal;
|
|
4975
4992
|
if (isAbortSignal(signalRaw) && signalRaw.aborted) {
|
|
@@ -5177,18 +5194,25 @@ var ToolNode = class {
|
|
|
5177
5194
|
rawArguments: context.call.function?.arguments,
|
|
5178
5195
|
parsedArguments: context.toolArgs
|
|
5179
5196
|
});
|
|
5197
|
+
const remainingCalls = context.calls.slice(1);
|
|
5180
5198
|
context.state.local = buildErrorLocalState({
|
|
5181
5199
|
local: context.local,
|
|
5182
|
-
remainingCalls
|
|
5200
|
+
remainingCalls,
|
|
5183
5201
|
conversationId: context.conversationId,
|
|
5184
5202
|
turnId: context.turnId,
|
|
5185
5203
|
runtimeEvents: context.bridge.getRuntimeEvents(),
|
|
5186
5204
|
nextProtocolErrorCount: fuse.nextCount
|
|
5187
5205
|
});
|
|
5188
|
-
if (fuse.shouldFuse) {
|
|
5206
|
+
if (fuse.shouldFuse && remainingCalls.length === 0) {
|
|
5189
5207
|
throw createToolProtocolFuseError(fuse.nextCount, context.exec.error);
|
|
5190
5208
|
}
|
|
5191
|
-
return {
|
|
5209
|
+
return {
|
|
5210
|
+
kind: "route",
|
|
5211
|
+
// 同一个 assistant.tool_calls batch 必须为每个 call 产出 tool_output。
|
|
5212
|
+
// 出错时也继续消费剩余 call,ToolNode.run 会在本节点内 drain 完 batch 再回 LLM。
|
|
5213
|
+
nextNodeId: remainingCalls.length > 0 ? "tool" : "llm",
|
|
5214
|
+
events: context.bridge.getRuntimeEvents()
|
|
5215
|
+
};
|
|
5192
5216
|
}
|
|
5193
5217
|
};
|
|
5194
5218
|
|
|
@@ -5925,18 +5949,18 @@ function createClassification(category, reason, suggestedDelay, extras) {
|
|
|
5925
5949
|
}
|
|
5926
5950
|
var ErrorClassifier = class {
|
|
5927
5951
|
static classify(error, context) {
|
|
5928
|
-
const
|
|
5952
|
+
const isRecord25 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
5929
5953
|
const baseMsg = (error.message || "").toLowerCase();
|
|
5930
5954
|
const causeMsg = (() => {
|
|
5931
5955
|
const cause = error.cause;
|
|
5932
5956
|
if (typeof cause === "string") return cause.toLowerCase();
|
|
5933
5957
|
if (cause instanceof Error) return (cause.message || "").toLowerCase();
|
|
5934
|
-
if (
|
|
5958
|
+
if (isRecord25(cause) && typeof cause["message"] === "string") return String(cause["message"]).toLowerCase();
|
|
5935
5959
|
return "";
|
|
5936
5960
|
})();
|
|
5937
5961
|
const causeCode = (() => {
|
|
5938
5962
|
const cause = error.cause;
|
|
5939
|
-
if (
|
|
5963
|
+
if (isRecord25(cause) && typeof cause["code"] === "string") return String(cause["code"]);
|
|
5940
5964
|
return "";
|
|
5941
5965
|
})();
|
|
5942
5966
|
const errorMessage = `${baseMsg} ${causeMsg}`.trim();
|
|
@@ -6428,6 +6452,9 @@ __export(llm_exports, {
|
|
|
6428
6452
|
LLMPolicyEngine: () => LLMPolicyEngine,
|
|
6429
6453
|
LlmCaller: () => LlmCaller,
|
|
6430
6454
|
ModelResolver: () => ModelResolver,
|
|
6455
|
+
appendStreamingProviderReasoningDetails: () => appendStreamingProviderReasoningDetails,
|
|
6456
|
+
compactProviderReasoningDetails: () => compactProviderReasoningDetails,
|
|
6457
|
+
compactReasoningDetailsInValue: () => compactReasoningDetailsInValue,
|
|
6431
6458
|
createDefaultTokenizerPort: () => createDefaultTokenizerPort,
|
|
6432
6459
|
defaultPolicyEngine: () => defaultPolicyEngine
|
|
6433
6460
|
});
|
|
@@ -6817,6 +6844,90 @@ function assertToolCallsHaveValidJsonArguments(toolCalls) {
|
|
|
6817
6844
|
}
|
|
6818
6845
|
}
|
|
6819
6846
|
|
|
6847
|
+
// src/runtime-kernel/llm/reasoning-details.ts
|
|
6848
|
+
var mergeableTextFields = ["reasoning_content"];
|
|
6849
|
+
function isRecord20(value) {
|
|
6850
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
6851
|
+
}
|
|
6852
|
+
function findMergeableTextField(detail) {
|
|
6853
|
+
if (!isRecord20(detail)) return void 0;
|
|
6854
|
+
if (typeof detail.provider !== "string") return void 0;
|
|
6855
|
+
if (typeof detail.type !== "string") return void 0;
|
|
6856
|
+
for (const field of mergeableTextFields) {
|
|
6857
|
+
if (typeof detail[field] === "string") {
|
|
6858
|
+
return field;
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
return void 0;
|
|
6862
|
+
}
|
|
6863
|
+
function hasOnlyStableTextDetailFields(detail, textField) {
|
|
6864
|
+
const allowedKeys = /* @__PURE__ */ new Set(["provider", "type", textField]);
|
|
6865
|
+
return Object.keys(detail).every((key) => allowedKeys.has(key));
|
|
6866
|
+
}
|
|
6867
|
+
function canMergeTextDetails(previous, incoming) {
|
|
6868
|
+
if (!isRecord20(previous) || !isRecord20(incoming)) return false;
|
|
6869
|
+
const previousField = findMergeableTextField(previous);
|
|
6870
|
+
const incomingField = findMergeableTextField(incoming);
|
|
6871
|
+
if (!previousField || previousField !== incomingField) return false;
|
|
6872
|
+
return previous.provider === incoming.provider && previous.type === incoming.type && hasOnlyStableTextDetailFields(previous, previousField) && hasOnlyStableTextDetailFields(incoming, incomingField);
|
|
6873
|
+
}
|
|
6874
|
+
function mergeStreamingText(previous, incoming) {
|
|
6875
|
+
if (!previous) return incoming;
|
|
6876
|
+
if (!incoming) return previous;
|
|
6877
|
+
if (incoming.startsWith(previous)) {
|
|
6878
|
+
return incoming;
|
|
6879
|
+
}
|
|
6880
|
+
if (previous.endsWith(incoming)) {
|
|
6881
|
+
return previous;
|
|
6882
|
+
}
|
|
6883
|
+
return `${previous}${incoming}`;
|
|
6884
|
+
}
|
|
6885
|
+
function appendStreamingProviderReasoningDetails(existing, incoming) {
|
|
6886
|
+
const next = [...existing];
|
|
6887
|
+
for (const detail of incoming) {
|
|
6888
|
+
const previous = next[next.length - 1];
|
|
6889
|
+
if (canMergeTextDetails(previous, detail)) {
|
|
6890
|
+
const textField = findMergeableTextField(previous);
|
|
6891
|
+
if (textField && isRecord20(detail)) {
|
|
6892
|
+
const mergedText = mergeStreamingText(String(previous[textField]), String(detail[textField]));
|
|
6893
|
+
if (mergedText === previous[textField]) {
|
|
6894
|
+
continue;
|
|
6895
|
+
}
|
|
6896
|
+
next[next.length - 1] = {
|
|
6897
|
+
...previous,
|
|
6898
|
+
[textField]: mergedText
|
|
6899
|
+
};
|
|
6900
|
+
continue;
|
|
6901
|
+
}
|
|
6902
|
+
}
|
|
6903
|
+
next.push(detail);
|
|
6904
|
+
}
|
|
6905
|
+
return next;
|
|
6906
|
+
}
|
|
6907
|
+
function compactProviderReasoningDetails(reasoningDetails) {
|
|
6908
|
+
return appendStreamingProviderReasoningDetails([], reasoningDetails);
|
|
6909
|
+
}
|
|
6910
|
+
function compactReasoningDetailsInValue(value) {
|
|
6911
|
+
return compactValue(value);
|
|
6912
|
+
}
|
|
6913
|
+
function compactValue(value) {
|
|
6914
|
+
if (Array.isArray(value)) {
|
|
6915
|
+
return value.map((item) => compactValue(item));
|
|
6916
|
+
}
|
|
6917
|
+
if (!isRecord20(value)) {
|
|
6918
|
+
return value;
|
|
6919
|
+
}
|
|
6920
|
+
const compacted = {};
|
|
6921
|
+
for (const [key, childValue] of Object.entries(value)) {
|
|
6922
|
+
if (key === "reasoning_details" && Array.isArray(childValue)) {
|
|
6923
|
+
compacted[key] = compactProviderReasoningDetails(childValue);
|
|
6924
|
+
continue;
|
|
6925
|
+
}
|
|
6926
|
+
compacted[key] = compactValue(childValue);
|
|
6927
|
+
}
|
|
6928
|
+
return compacted;
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6820
6931
|
// src/runtime-kernel/llm/streaming-adapter.ts
|
|
6821
6932
|
async function callLlmStream(params) {
|
|
6822
6933
|
const {
|
|
@@ -6829,7 +6940,7 @@ async function callLlmStream(params) {
|
|
|
6829
6940
|
} = params;
|
|
6830
6941
|
let fullResponse = "";
|
|
6831
6942
|
let streamError = null;
|
|
6832
|
-
|
|
6943
|
+
let reasoningDetails = [];
|
|
6833
6944
|
const streamAnswerId = generateMessageId();
|
|
6834
6945
|
let streamChunkSeq = 0;
|
|
6835
6946
|
let capturedUsage = void 0;
|
|
@@ -6899,13 +7010,21 @@ async function callLlmStream(params) {
|
|
|
6899
7010
|
const reasoning = isRecord19(chunk) ? chunk["reasoning_details"] : void 0;
|
|
6900
7011
|
if (reasoning !== void 0) {
|
|
6901
7012
|
const newReasoningDetails = Array.isArray(reasoning) ? reasoning : [reasoning];
|
|
6902
|
-
reasoningDetails
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
7013
|
+
const previousReasoningDetails = reasoningDetails;
|
|
7014
|
+
const previousLength = previousReasoningDetails.length;
|
|
7015
|
+
const compactedReasoningDetails = appendStreamingProviderReasoningDetails(reasoningDetails, newReasoningDetails);
|
|
7016
|
+
reasoningDetails = compactedReasoningDetails;
|
|
7017
|
+
const previousLastChanged = previousLength > 0 && compactedReasoningDetails[previousLength - 1] !== previousReasoningDetails[previousLength - 1];
|
|
7018
|
+
const emitFromIndex = previousLastChanged ? previousLength - 1 : previousLength;
|
|
7019
|
+
const emittedReasoningDetails = compactedReasoningDetails.slice(Math.max(0, emitFromIndex));
|
|
7020
|
+
if (emittedReasoningDetails.length > 0) {
|
|
7021
|
+
eventHandler({
|
|
7022
|
+
type: "provider_sidecar",
|
|
7023
|
+
id: generateMessageId(),
|
|
7024
|
+
timestamp: Date.now(),
|
|
7025
|
+
reasoning_details: emittedReasoningDetails
|
|
7026
|
+
});
|
|
7027
|
+
}
|
|
6909
7028
|
}
|
|
6910
7029
|
if (chunk.tool_calls) {
|
|
6911
7030
|
emitThoughtComplete(thoughtSegmenter.onBoundary());
|
|
@@ -7331,7 +7450,6 @@ var DefaultTokenizerPort = class {
|
|
|
7331
7450
|
constructor(config = {}) {
|
|
7332
7451
|
this.config = config;
|
|
7333
7452
|
}
|
|
7334
|
-
config;
|
|
7335
7453
|
estimateText(text, _modelId) {
|
|
7336
7454
|
return TokenCalculator.estimateTokens(text, {
|
|
7337
7455
|
encoding: this.config.encoding,
|
|
@@ -7473,8 +7591,6 @@ var FinalAnswerCollector = class {
|
|
|
7473
7591
|
this.conversationId = conversationId;
|
|
7474
7592
|
this.turnId = turnId;
|
|
7475
7593
|
}
|
|
7476
|
-
conversationId;
|
|
7477
|
-
turnId;
|
|
7478
7594
|
answerId;
|
|
7479
7595
|
chunks = [];
|
|
7480
7596
|
chunkCount = 0;
|
|
@@ -7522,7 +7638,7 @@ var FinalAnswerCollector = class {
|
|
|
7522
7638
|
};
|
|
7523
7639
|
|
|
7524
7640
|
// src/runtime-kernel/child-runs/childRunTraceSink.ts
|
|
7525
|
-
function
|
|
7641
|
+
function isRecord21(v) {
|
|
7526
7642
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
7527
7643
|
}
|
|
7528
7644
|
function getString2(obj, key) {
|
|
@@ -7555,7 +7671,7 @@ function createChildRunTraceSink(params) {
|
|
|
7555
7671
|
const { publisher, conversationId, turnId } = params;
|
|
7556
7672
|
const finalAnswerCollector = new FinalAnswerCollector(conversationId, turnId);
|
|
7557
7673
|
const sink = (evt) => {
|
|
7558
|
-
if (!
|
|
7674
|
+
if (!isRecord21(evt)) {
|
|
7559
7675
|
return [];
|
|
7560
7676
|
}
|
|
7561
7677
|
const type = getString2(evt, "type");
|
|
@@ -8224,7 +8340,7 @@ function runRecordToMeta(record) {
|
|
|
8224
8340
|
errorIfAny: record.errorIfAny ? { ...record.errorIfAny } : void 0
|
|
8225
8341
|
};
|
|
8226
8342
|
}
|
|
8227
|
-
function
|
|
8343
|
+
function isRecord22(value) {
|
|
8228
8344
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8229
8345
|
}
|
|
8230
8346
|
function readStringField(record, key) {
|
|
@@ -8245,7 +8361,7 @@ function getRunIdFromMetadata(event) {
|
|
|
8245
8361
|
return snakeCaseRunId;
|
|
8246
8362
|
}
|
|
8247
8363
|
const runContext = metadata["run_context"];
|
|
8248
|
-
if (
|
|
8364
|
+
if (isRecord22(runContext)) {
|
|
8249
8365
|
return readStringField(runContext, "runId") ?? readStringField(runContext, "run_id");
|
|
8250
8366
|
}
|
|
8251
8367
|
return void 0;
|
|
@@ -8463,7 +8579,7 @@ function runMetaFromRecord(record) {
|
|
|
8463
8579
|
}
|
|
8464
8580
|
|
|
8465
8581
|
// src/runtime-kernel/run-supervisor/runSupervisor.ts
|
|
8466
|
-
function
|
|
8582
|
+
function isRecord23(value) {
|
|
8467
8583
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8468
8584
|
}
|
|
8469
8585
|
function readStringField2(record, key) {
|
|
@@ -8480,7 +8596,7 @@ function readRunIdFromRuntimeEvent(event) {
|
|
|
8480
8596
|
return directRunId;
|
|
8481
8597
|
}
|
|
8482
8598
|
const runContext = metadata["run_context"];
|
|
8483
|
-
if (!
|
|
8599
|
+
if (!isRecord23(runContext)) {
|
|
8484
8600
|
return void 0;
|
|
8485
8601
|
}
|
|
8486
8602
|
return readStringField2(runContext, "runId") ?? readStringField2(runContext, "run_id");
|
|
@@ -8492,7 +8608,7 @@ function readAwaitingUserReason(event) {
|
|
|
8492
8608
|
if (typeof event.prompt === "string" && event.prompt.trim().length > 0) {
|
|
8493
8609
|
return event.prompt;
|
|
8494
8610
|
}
|
|
8495
|
-
if (
|
|
8611
|
+
if (isRecord23(event.form)) {
|
|
8496
8612
|
const prompt = readStringField2(event.form, "prompt");
|
|
8497
8613
|
if (prompt && prompt.trim().length > 0) {
|
|
8498
8614
|
return prompt;
|
|
@@ -9374,7 +9490,7 @@ function createQuickstartTelemetryPort(collector) {
|
|
|
9374
9490
|
}
|
|
9375
9491
|
|
|
9376
9492
|
// src/quickstart/runAgent.ts
|
|
9377
|
-
function
|
|
9493
|
+
function isRecord24(value) {
|
|
9378
9494
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9379
9495
|
}
|
|
9380
9496
|
function readString4(value) {
|
|
@@ -9388,7 +9504,7 @@ function resolveModelId(agent, options) {
|
|
|
9388
9504
|
return modelId;
|
|
9389
9505
|
}
|
|
9390
9506
|
function isQuickstartStreamChunkEvent(value) {
|
|
9391
|
-
return
|
|
9507
|
+
return isRecord24(value) && value.type === "stream_chunk" && typeof value.content === "string";
|
|
9392
9508
|
}
|
|
9393
9509
|
function createNoopObservationPreview() {
|
|
9394
9510
|
return {
|
|
@@ -9428,7 +9544,7 @@ function readFinalAnswer(events, checkpointLocal) {
|
|
|
9428
9544
|
if (chunks.length > 0) {
|
|
9429
9545
|
return chunks.join("");
|
|
9430
9546
|
}
|
|
9431
|
-
if (
|
|
9547
|
+
if (isRecord24(checkpointLocal)) {
|
|
9432
9548
|
const finalAnswer = checkpointLocal["finalAnswer"];
|
|
9433
9549
|
if (typeof finalAnswer === "string") {
|
|
9434
9550
|
return finalAnswer;
|
|
@@ -9437,7 +9553,7 @@ function readFinalAnswer(events, checkpointLocal) {
|
|
|
9437
9553
|
return "";
|
|
9438
9554
|
}
|
|
9439
9555
|
function readContextTrace(checkpointLocal) {
|
|
9440
|
-
if (!
|
|
9556
|
+
if (!isRecord24(checkpointLocal)) return void 0;
|
|
9441
9557
|
return checkpointLocal["contextTrace"];
|
|
9442
9558
|
}
|
|
9443
9559
|
async function emitRunEvent(event, sink) {
|