@linnlabs/linnkit 0.32.0 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/context-manager/features/context-compaction/definitions/contextCheckpointFormat.d.cts +3 -0
- package/dist/context-manager/features/context-compaction/definitions/contextCheckpointFormat.d.ts +3 -0
- package/dist/context-manager/features/context-compaction/definitions/historySummaryDraft.d.cts +22 -0
- package/dist/context-manager/features/context-compaction/definitions/historySummaryDraft.d.ts +22 -0
- package/dist/context-manager/profiles/agent/config.d.cts +33 -0
- package/dist/context-manager/profiles/agent/config.d.ts +33 -0
- package/dist/context-manager/profiles/agent/context/AgentContextManager.d.cts +132 -0
- package/dist/context-manager/profiles/agent/context/AgentContextManager.d.ts +132 -0
- package/dist/context-manager/profiles/agent/context/ConversationSession.d.cts +131 -0
- package/dist/context-manager/profiles/agent/context/ConversationSession.d.ts +131 -0
- package/dist/context-manager/profiles/agent/context/config.d.cts +191 -0
- package/dist/context-manager/profiles/agent/context/config.d.ts +191 -0
- package/dist/context-manager/profiles/agent/context/index.d.cts +8 -0
- package/dist/context-manager/profiles/agent/context/index.d.ts +8 -0
- package/dist/context-manager/profiles/agent/context/providers/AgentCoreContextProvider.d.cts +52 -0
- package/dist/context-manager/profiles/agent/context/providers/AgentCoreContextProvider.d.ts +52 -0
- package/dist/context-manager/profiles/agent/context/providers/AgentWorkingMemoryProvider.d.cts +50 -0
- package/dist/context-manager/profiles/agent/context/providers/AgentWorkingMemoryProvider.d.ts +50 -0
- package/dist/context-manager/profiles/agent/context/providers/base.d.cts +11 -0
- package/dist/context-manager/profiles/agent/context/providers/base.d.ts +11 -0
- package/dist/context-manager/profiles/agent/context/providers/index.d.cts +12 -0
- package/dist/context-manager/profiles/agent/context/providers/index.d.ts +12 -0
- package/dist/context-manager/profiles/agent/contracts.d.cts +27 -0
- package/dist/context-manager/profiles/agent/contracts.d.ts +27 -0
- package/dist/context-manager/profiles/agent/orchestration/AgentMessageOrchestrator.d.cts +140 -0
- package/dist/context-manager/profiles/agent/orchestration/AgentMessageOrchestrator.d.ts +140 -0
- package/dist/context-manager/profiles/agent/orchestration/index.d.cts +1 -0
- package/dist/context-manager/profiles/agent/orchestration/index.d.ts +1 -0
- package/dist/context-manager/profiles/agent/preprocessors/base.d.cts +17 -0
- package/dist/context-manager/profiles/agent/preprocessors/base.d.ts +17 -0
- package/dist/context-manager/profiles/agent/preprocessors/index.d.cts +117 -0
- package/dist/context-manager/profiles/agent/preprocessors/index.d.ts +117 -0
- package/dist/context-manager/profiles/agent/preprocessors/toolHistoryCompressor.d.cts +47 -0
- package/dist/context-manager/profiles/agent/preprocessors/toolHistoryCompressor.d.ts +47 -0
- package/dist/context-manager/profiles/agent/preprocessors/toolReplayProtocolGuard.d.cts +27 -0
- package/dist/context-manager/profiles/agent/preprocessors/toolReplayProtocolGuard.d.ts +27 -0
- package/dist/context-manager/profiles/agent/tasks/BaseAgentTask.d.cts +43 -0
- package/dist/context-manager/profiles/agent/tasks/BaseAgentTask.d.ts +43 -0
- package/dist/context-manager/profiles/agent/tasks/base.d.cts +18 -0
- package/dist/context-manager/profiles/agent/tasks/base.d.ts +18 -0
- package/dist/context-manager/profiles/agent/tasks/index.d.cts +2 -0
- package/dist/context-manager/profiles/agent/tasks/index.d.ts +2 -0
- package/dist/context-manager/profiles/agent/tools/ToolManager.d.cts +27 -0
- package/dist/context-manager/profiles/agent/tools/ToolManager.d.ts +27 -0
- package/dist/context-manager/profiles/agent/tools/index.d.cts +1 -0
- package/dist/context-manager/profiles/agent/tools/index.d.ts +1 -0
- package/dist/context-manager/profiles/agent/utils/eventConverter.d.cts +15 -0
- package/dist/context-manager/profiles/agent/utils/eventConverter.d.ts +15 -0
- package/dist/context-manager/profiles/agent/utils/index.d.cts +2 -0
- package/dist/context-manager/profiles/agent/utils/index.d.ts +2 -0
- package/dist/context-manager/profiles/agent/utils/toolOutputSummarizer.d.cts +26 -0
- package/dist/context-manager/profiles/agent/utils/toolOutputSummarizer.d.ts +26 -0
- package/dist/context-manager/shared/MessageFormatter.d.cts +55 -0
- package/dist/context-manager/shared/MessageFormatter.d.ts +55 -0
- package/dist/context-manager/shared/agentSpecAdapter.d.cts +63 -0
- package/dist/context-manager/shared/agentSpecAdapter.d.ts +63 -0
- package/dist/context-manager/shared/context-manager-base.d.cts +102 -0
- package/dist/context-manager/shared/context-manager-base.d.ts +102 -0
- package/dist/context-manager/shared/context-pipeline.d.cts +42 -0
- package/dist/context-manager/shared/context-pipeline.d.ts +42 -0
- package/dist/context-manager/shared/context-trace.d.cts +102 -0
- package/dist/context-manager/shared/context-trace.d.ts +102 -0
- package/dist/context-manager/shared/contextPolicyMerge.d.cts +19 -0
- package/dist/context-manager/shared/contextPolicyMerge.d.ts +19 -0
- package/dist/context-manager/shared/contracts/chatLineMessage.d.cts +15 -0
- package/dist/context-manager/shared/contracts/chatLineMessage.d.ts +15 -0
- package/dist/context-manager/shared/fences/FenceRegistry.d.cts +24 -0
- package/dist/context-manager/shared/fences/FenceRegistry.d.ts +24 -0
- package/dist/context-manager/shared/image-input-estimation.d.cts +16 -0
- package/dist/context-manager/shared/image-input-estimation.d.ts +16 -0
- package/dist/context-manager/shared/policies/MustKeepPolicy.d.cts +19 -0
- package/dist/context-manager/shared/policies/MustKeepPolicy.d.ts +19 -0
- package/dist/context-manager/shared/preprocessors/base.d.cts +43 -0
- package/dist/context-manager/shared/preprocessors/base.d.ts +43 -0
- package/dist/context-manager/shared/preprocessors/currentTurnMessageAssembler.d.cts +26 -0
- package/dist/context-manager/shared/preprocessors/currentTurnMessageAssembler.d.ts +26 -0
- package/dist/context-manager/shared/preprocessors/fenceLifetimeManager.d.cts +18 -0
- package/dist/context-manager/shared/preprocessors/fenceLifetimeManager.d.ts +18 -0
- package/dist/context-manager/shared/preprocessors/historyPurification.d.cts +19 -0
- package/dist/context-manager/shared/preprocessors/historyPurification.d.ts +19 -0
- package/dist/context-manager/shared/preprocessors/priority.d.cts +17 -0
- package/dist/context-manager/shared/preprocessors/priority.d.ts +17 -0
- package/dist/context-manager/shared/providers/base.d.cts +106 -0
- package/dist/context-manager/shared/providers/base.d.ts +106 -0
- package/dist/context-manager/shared/providers/registry.d.cts +11 -0
- package/dist/context-manager/shared/providers/registry.d.ts +11 -0
- package/dist/context-manager/shared/token-calibration.d.cts +25 -0
- package/dist/context-manager/shared/token-calibration.d.ts +25 -0
- package/dist/context-manager.d.cts +34 -1559
- package/dist/context-manager.d.ts +34 -1559
- package/dist/contracts/agentSpec.d.cts +869 -0
- package/dist/contracts/agentSpec.d.ts +869 -0
- package/dist/{audit-XsNMTt0-.d.cts → contracts/audit.d.cts} +33 -33
- package/dist/{audit-XsNMTt0-.d.ts → contracts/audit.d.ts} +33 -33
- package/dist/contracts/constants.d.cts +3 -0
- package/dist/contracts/constants.d.ts +3 -0
- package/dist/contracts/contextCompaction.d.cts +43 -0
- package/dist/contracts/contextCompaction.d.ts +43 -0
- package/dist/contracts/contextPolicy.d.cts +1121 -0
- package/dist/contracts/contextPolicy.d.ts +1121 -0
- package/dist/{final-answer-oOQ_7nPt.d.ts → contracts/events.d.cts} +1219 -1222
- package/dist/{final-answer-B0_kx5_U.d.cts → contracts/events.d.ts} +1219 -1222
- package/dist/{execution-B7e01ZjW.d.cts → contracts/execution.d.cts} +21 -21
- package/dist/{execution-B7e01ZjW.d.ts → contracts/execution.d.ts} +21 -21
- package/dist/contracts/final-answer.d.cts +7 -0
- package/dist/contracts/final-answer.d.ts +7 -0
- package/dist/contracts/identity/definitions.d.cts +70 -0
- package/dist/contracts/identity/definitions.d.ts +70 -0
- package/dist/contracts/identity/generators.d.cts +33 -0
- package/dist/contracts/identity/generators.d.ts +33 -0
- package/dist/contracts/identity/invariants.d.cts +24 -0
- package/dist/contracts/identity/invariants.d.ts +24 -0
- package/dist/contracts/json.d.cts +12 -0
- package/dist/contracts/json.d.ts +12 -0
- package/dist/{provider-continuation-CTZdCB--.d.cts → contracts/messages.d.cts} +210 -957
- package/dist/{provider-continuation-CTZdCB--.d.ts → contracts/messages.d.ts} +210 -957
- package/dist/contracts/provider-continuation.d.cts +609 -0
- package/dist/contracts/provider-continuation.d.ts +609 -0
- package/dist/contracts/reasoning.d.cts +77 -0
- package/dist/contracts/reasoning.d.ts +77 -0
- package/dist/contracts/resource-ref.d.cts +73 -0
- package/dist/contracts/resource-ref.d.ts +73 -0
- package/dist/contracts/runtime-status.d.cts +8 -0
- package/dist/contracts/runtime-status.d.ts +8 -0
- package/dist/contracts/sse-framing.d.cts +28 -0
- package/dist/contracts/sse-framing.d.ts +28 -0
- package/dist/{index-Cp1_oUj0.d.ts → contracts/sse.d.cts} +1218 -1574
- package/dist/{index-JYf6n2Ik.d.cts → contracts/sse.d.ts} +1218 -1574
- package/dist/contracts/sub-run-trace-payload.d.cts +187 -0
- package/dist/contracts/sub-run-trace-payload.d.ts +187 -0
- package/dist/{summarization-CMMLhaCe.d.ts → contracts/summarization.d.cts} +2 -2
- package/dist/{summarization-kLeweZ5-.d.cts → contracts/summarization.d.ts} +2 -2
- package/dist/contracts/token-accounting.d.cts +1177 -0
- package/dist/contracts/token-accounting.d.ts +1177 -0
- package/dist/{token-calibration-GtFyMJtM.d.cts → contracts/token-calibration.d.cts} +1 -42
- package/dist/{token-calibration-GtFyMJtM.d.ts → contracts/token-calibration.d.ts} +1 -42
- package/dist/{reasoning-bffu9R2B.d.cts → contracts/token-usage.d.cts} +9 -84
- package/dist/{reasoning-bffu9R2B.d.ts → contracts/token-usage.d.ts} +9 -84
- package/dist/contracts.d.cts +24 -10
- package/dist/contracts.d.ts +24 -10
- package/dist/index.d.cts +14 -77
- package/dist/index.d.ts +14 -77
- package/dist/ports/agent-invocation.d.cts +42 -0
- package/dist/ports/agent-invocation.d.ts +42 -0
- package/dist/{audit-DnuOSwWE.d.ts → ports/audit.d.cts} +2 -2
- package/dist/{audit-C9LPbPib.d.cts → ports/audit.d.ts} +2 -2
- package/dist/ports/canonical-inference.d.cts +135 -0
- package/dist/ports/canonical-inference.d.ts +135 -0
- package/dist/ports/llm-call.d.cts +109 -0
- package/dist/ports/llm-call.d.ts +109 -0
- package/dist/ports/llm-input-materialization.d.cts +69 -0
- package/dist/ports/llm-input-materialization.d.ts +69 -0
- package/dist/{token-counter-BjiHQEJ-.d.ts → ports/token-counter.d.cts} +3 -3
- package/dist/{token-counter-DiGIoaq2.d.cts → ports/token-counter.d.ts} +3 -3
- package/dist/{tokenizer-yIFTTc-W.d.ts → ports/tokenizer.d.cts} +2 -2
- package/dist/{tokenizer-Dz5Y3KT0.d.cts → ports/tokenizer.d.ts} +2 -2
- package/dist/ports/tool-schema.d.cts +30 -0
- package/dist/ports/tool-schema.d.ts +30 -0
- package/dist/ports/usage-normalizer.d.cts +16 -0
- package/dist/ports/usage-normalizer.d.ts +16 -0
- package/dist/ports.d.cts +10 -9
- package/dist/ports.d.ts +10 -9
- package/dist/quickstart/defineAgent.d.cts +12 -0
- package/dist/quickstart/defineAgent.d.ts +12 -0
- package/dist/quickstart/defineConfig.d.cts +7 -0
- package/dist/quickstart/defineConfig.d.ts +7 -0
- package/dist/quickstart/runAgent.d.cts +12 -0
- package/dist/quickstart/runAgent.d.ts +12 -0
- package/dist/quickstart/toolRuntime.d.cts +14 -0
- package/dist/quickstart/toolRuntime.d.ts +14 -0
- package/dist/{runAgent-jxZ0uNto.d.ts → quickstart/types.d.cts} +10 -28
- package/dist/{runAgent-QiBiFXHR.d.cts → quickstart/types.d.ts} +10 -28
- package/dist/quickstart.d.cts +5 -23
- package/dist/quickstart.d.ts +5 -23
- package/dist/runtime-kernel/audit/compositeAudit.d.cts +23 -0
- package/dist/runtime-kernel/audit/compositeAudit.d.ts +23 -0
- package/dist/runtime-kernel/audit/consoleAudit.d.cts +10 -0
- package/dist/runtime-kernel/audit/consoleAudit.d.ts +10 -0
- package/dist/runtime-kernel/audit/emitAudit.d.cts +31 -0
- package/dist/runtime-kernel/audit/emitAudit.d.ts +31 -0
- package/dist/runtime-kernel/audit/eventStoreAudit.d.cts +27 -0
- package/dist/runtime-kernel/audit/eventStoreAudit.d.ts +27 -0
- package/dist/runtime-kernel/audit/fileAudit.d.cts +22 -0
- package/dist/runtime-kernel/audit/fileAudit.d.ts +22 -0
- package/dist/runtime-kernel/audit/index.d.cts +6 -0
- package/dist/runtime-kernel/audit/index.d.ts +6 -0
- package/dist/runtime-kernel/audit/noopAudit.d.cts +5 -0
- package/dist/runtime-kernel/audit/noopAudit.d.ts +5 -0
- package/dist/runtime-kernel/child-run-trace/childRunParentTraceProjection.d.cts +26 -0
- package/dist/runtime-kernel/child-run-trace/childRunParentTraceProjection.d.ts +26 -0
- package/dist/runtime-kernel/child-run-trace/index.d.cts +4 -0
- package/dist/runtime-kernel/child-run-trace/index.d.ts +4 -0
- package/dist/runtime-kernel/child-run-trace/projectChildRuntimeEventToSubRunTrace.d.cts +10 -0
- package/dist/runtime-kernel/child-run-trace/projectChildRuntimeEventToSubRunTrace.d.ts +10 -0
- package/dist/runtime-kernel/child-run-trace/runtimeEventSubRunTracePublisher.d.cts +47 -0
- package/dist/runtime-kernel/child-run-trace/runtimeEventSubRunTracePublisher.d.ts +47 -0
- package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.cts +81 -0
- package/dist/runtime-kernel/child-run-trace/subrunTrace.types.d.ts +81 -0
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.cts +101 -0
- package/dist/runtime-kernel/child-runs/childRunInvoker.d.ts +101 -0
- package/dist/runtime-kernel/child-runs/historyPolicy.d.cts +9 -0
- package/dist/runtime-kernel/child-runs/historyPolicy.d.ts +9 -0
- package/dist/runtime-kernel/child-runs/index.d.cts +3 -0
- package/dist/runtime-kernel/child-runs/index.d.ts +3 -0
- package/dist/runtime-kernel/child-runs/types.d.cts +82 -0
- package/dist/runtime-kernel/child-runs/types.d.ts +82 -0
- package/dist/runtime-kernel/enrichment/index.d.cts +2 -0
- package/dist/runtime-kernel/enrichment/index.d.ts +2 -0
- package/dist/runtime-kernel/enrichment/registry.d.cts +25 -0
- package/dist/runtime-kernel/enrichment/registry.d.ts +25 -0
- package/dist/runtime-kernel/enrichment/types.d.cts +83 -0
- package/dist/runtime-kernel/enrichment/types.d.ts +83 -0
- package/dist/runtime-kernel/events/agent-to-runtime.d.cts +6 -0
- package/dist/runtime-kernel/events/agent-to-runtime.d.ts +6 -0
- package/dist/{agentEvents-yvamy9xt.d.cts → runtime-kernel/events/agentEvents.d.cts} +127 -126
- package/dist/{agentEvents-DhXdKeXD.d.ts → runtime-kernel/events/agentEvents.d.ts} +127 -126
- package/dist/runtime-kernel/events/eventGovernance.d.cts +47 -0
- package/dist/runtime-kernel/events/eventGovernance.d.ts +47 -0
- package/dist/runtime-kernel/events/eventMappers.d.cts +41 -0
- package/dist/runtime-kernel/events/eventMappers.d.ts +41 -0
- package/dist/runtime-kernel/events/finalAnswerAssembler.d.cts +27 -0
- package/dist/runtime-kernel/events/finalAnswerAssembler.d.ts +27 -0
- package/dist/runtime-kernel/events/finalAnswerCompletion.d.cts +6 -0
- package/dist/runtime-kernel/events/finalAnswerCompletion.d.ts +6 -0
- package/dist/runtime-kernel/events/provider-sidecar.d.cts +33 -0
- package/dist/runtime-kernel/events/provider-sidecar.d.ts +33 -0
- package/dist/runtime-kernel/events/runtime-to-ai-message.d.cts +14 -0
- package/dist/runtime-kernel/events/runtime-to-ai-message.d.ts +14 -0
- package/dist/runtime-kernel/events.d.cts +7 -5
- package/dist/runtime-kernel/events.d.ts +7 -5
- package/dist/runtime-kernel/execution/event-bus.d.cts +52 -0
- package/dist/runtime-kernel/execution/event-bus.d.ts +52 -0
- package/dist/runtime-kernel/execution/eventBusEventPersistence.d.cts +40 -0
- package/dist/runtime-kernel/execution/eventBusEventPersistence.d.ts +40 -0
- package/dist/runtime-kernel/execution/index.d.cts +5 -0
- package/dist/runtime-kernel/execution/index.d.ts +5 -0
- package/dist/runtime-kernel/execution/runtimeErrorEventFactory.d.cts +46 -0
- package/dist/runtime-kernel/execution/runtimeErrorEventFactory.d.ts +46 -0
- package/dist/runtime-kernel/execution/runtimeEventPublisher.d.cts +34 -0
- package/dist/runtime-kernel/execution/runtimeEventPublisher.d.ts +34 -0
- package/dist/runtime-kernel/execution/sequencer.d.cts +69 -0
- package/dist/runtime-kernel/execution/sequencer.d.ts +69 -0
- package/dist/runtime-kernel/graph-engine/checkpointer/base.d.cts +59 -0
- package/dist/runtime-kernel/graph-engine/checkpointer/base.d.ts +59 -0
- package/dist/runtime-kernel/graph-engine/checkpointer/memoryCheckpointer.d.cts +14 -0
- package/dist/runtime-kernel/graph-engine/checkpointer/memoryCheckpointer.d.ts +14 -0
- package/dist/runtime-kernel/graph-engine/definitions/primaryPromptCapacityError.d.cts +22 -0
- package/dist/runtime-kernel/graph-engine/definitions/primaryPromptCapacityError.d.ts +22 -0
- package/dist/runtime-kernel/graph-engine/engine.d.cts +64 -0
- package/dist/runtime-kernel/graph-engine/engine.d.ts +64 -0
- package/dist/runtime-kernel/graph-engine/event-store/base.d.cts +26 -0
- package/dist/runtime-kernel/graph-engine/event-store/base.d.ts +26 -0
- package/dist/runtime-kernel/graph-engine/event-store/memoryEventStore.d.cts +14 -0
- package/dist/runtime-kernel/graph-engine/event-store/memoryEventStore.d.ts +14 -0
- package/dist/runtime-kernel/graph-engine/executor.d.cts +59 -0
- package/dist/runtime-kernel/graph-engine/executor.d.ts +59 -0
- package/dist/runtime-kernel/graph-engine/executorContextBuilder.d.cts +104 -0
- package/dist/runtime-kernel/graph-engine/executorContextBuilder.d.ts +104 -0
- package/dist/runtime-kernel/graph-engine/functions/createHostToolCallBootstrap.d.cts +41 -0
- package/dist/runtime-kernel/graph-engine/functions/createHostToolCallBootstrap.d.ts +41 -0
- package/dist/runtime-kernel/graph-engine/functions/engineStateSnapshot.d.cts +23 -0
- package/dist/runtime-kernel/graph-engine/functions/engineStateSnapshot.d.ts +23 -0
- package/dist/runtime-kernel/graph-engine/functions/evaluatePrimaryPromptCapacity.d.cts +15 -0
- package/dist/runtime-kernel/graph-engine/functions/evaluatePrimaryPromptCapacity.d.ts +15 -0
- package/dist/runtime-kernel/graph-engine/functions/runtimeFailureFact.d.cts +7 -0
- package/dist/runtime-kernel/graph-engine/functions/runtimeFailureFact.d.ts +7 -0
- package/dist/runtime-kernel/graph-engine/index.d.cts +18 -0
- package/dist/runtime-kernel/graph-engine/index.d.ts +18 -0
- package/dist/runtime-kernel/graph-engine/nodes/llmNode.d.cts +26 -0
- package/dist/runtime-kernel/graph-engine/nodes/llmNode.d.ts +26 -0
- package/dist/runtime-kernel/graph-engine/nodes/llmNode.eventBridge.d.cts +6 -0
- package/dist/runtime-kernel/graph-engine/nodes/llmNode.eventBridge.d.ts +6 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.cts +44 -0
- package/dist/runtime-kernel/graph-engine/nodes/toolNode.d.ts +44 -0
- package/dist/runtime-kernel/graph-engine/nodes/userNode.d.cts +8 -0
- package/dist/runtime-kernel/graph-engine/nodes/userNode.d.ts +8 -0
- package/dist/runtime-kernel/graph-engine/nodes/waitUserNode.d.cts +15 -0
- package/dist/runtime-kernel/graph-engine/nodes/waitUserNode.d.ts +15 -0
- package/dist/runtime-kernel/graph-engine/tick-pipeline/types.d.cts +57 -0
- package/dist/runtime-kernel/graph-engine/tick-pipeline/types.d.ts +57 -0
- package/dist/runtime-kernel/graph-engine/types.d.cts +143 -0
- package/dist/runtime-kernel/graph-engine/types.d.ts +143 -0
- package/dist/runtime-kernel/llm/caller.d.cts +50 -0
- package/dist/runtime-kernel/llm/caller.d.ts +50 -0
- package/dist/runtime-kernel/llm/canonical-inference/definitions/canonicalInferenceStreamState.d.cts +28 -0
- package/dist/runtime-kernel/llm/canonical-inference/definitions/canonicalInferenceStreamState.d.ts +28 -0
- package/dist/runtime-kernel/llm/canonical-inference/functions/advanceCanonicalInferenceStreamState.d.cts +6 -0
- package/dist/runtime-kernel/llm/canonical-inference/functions/advanceCanonicalInferenceStreamState.d.ts +6 -0
- package/dist/runtime-kernel/llm/canonical-inference/orchestration/consumeCanonicalInferenceStream.d.cts +6 -0
- package/dist/runtime-kernel/llm/canonical-inference/orchestration/consumeCanonicalInferenceStream.d.ts +6 -0
- package/dist/runtime-kernel/llm/definitions/llmCallInvocationContext.d.cts +29 -0
- package/dist/runtime-kernel/llm/definitions/llmCallInvocationContext.d.ts +29 -0
- package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.cts +26 -0
- package/dist/runtime-kernel/llm/definitions/llmFallbackObserver.d.ts +26 -0
- package/dist/runtime-kernel/llm/functions/evaluateFallbackPromptCapacity.d.cts +9 -0
- package/dist/runtime-kernel/llm/functions/evaluateFallbackPromptCapacity.d.ts +9 -0
- package/dist/runtime-kernel/llm/index.d.cts +22 -0
- package/dist/runtime-kernel/llm/index.d.ts +22 -0
- package/dist/runtime-kernel/llm/input-capabilities/definitions/modelInputCapability.d.cts +24 -0
- package/dist/runtime-kernel/llm/input-capabilities/definitions/modelInputCapability.d.ts +24 -0
- package/dist/runtime-kernel/llm/input-capabilities/definitions/modelInputCapabilityError.d.cts +31 -0
- package/dist/runtime-kernel/llm/input-capabilities/definitions/modelInputCapabilityError.d.ts +31 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/createModelInputCompatibilityError.d.cts +13 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/createModelInputCompatibilityError.d.ts +13 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/deriveModelInputRequirement.d.cts +6 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/deriveModelInputRequirement.d.ts +6 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/evaluateModelInputCompatibility.d.cts +7 -0
- package/dist/runtime-kernel/llm/input-capabilities/functions/evaluateModelInputCompatibility.d.ts +7 -0
- package/dist/runtime-kernel/llm/input-capabilities/orchestration/assertModelInputCompatibility.d.cts +10 -0
- package/dist/runtime-kernel/llm/input-capabilities/orchestration/assertModelInputCompatibility.d.ts +10 -0
- package/dist/runtime-kernel/llm/modelCatalog.d.cts +62 -0
- package/dist/runtime-kernel/llm/modelCatalog.d.ts +62 -0
- package/dist/runtime-kernel/llm/modelResolver.d.cts +40 -0
- package/dist/runtime-kernel/llm/modelResolver.d.ts +40 -0
- package/dist/runtime-kernel/llm/policies/defaultPolicyEngine.d.cts +15 -0
- package/dist/runtime-kernel/llm/policies/defaultPolicyEngine.d.ts +15 -0
- package/dist/runtime-kernel/llm/policies/policyEngine.d.cts +18 -0
- package/dist/runtime-kernel/llm/policies/policyEngine.d.ts +18 -0
- package/dist/runtime-kernel/llm/policies/types.d.cts +27 -0
- package/dist/runtime-kernel/llm/policies/types.d.ts +27 -0
- package/dist/runtime-kernel/llm/request-builder.d.cts +22 -0
- package/dist/runtime-kernel/llm/request-builder.d.ts +22 -0
- package/dist/runtime-kernel/llm/usage-telemetry.d.cts +17 -0
- package/dist/runtime-kernel/llm/usage-telemetry.d.ts +17 -0
- package/dist/runtime-kernel/run-context/index.d.cts +1 -0
- package/dist/runtime-kernel/run-context/index.d.ts +1 -0
- package/dist/runtime-kernel/run-context/types.d.cts +44 -0
- package/dist/runtime-kernel/run-context/types.d.ts +44 -0
- package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.cts +131 -0
- package/dist/runtime-kernel/run-supervisor/definitions/runSupervisorContracts.d.ts +131 -0
- package/dist/runtime-kernel/run-supervisor/index.d.cts +6 -0
- package/dist/runtime-kernel/run-supervisor/index.d.ts +6 -0
- package/dist/runtime-kernel/run-supervisor/memoryRunRegistryStore.d.cts +15 -0
- package/dist/runtime-kernel/run-supervisor/memoryRunRegistryStore.d.ts +15 -0
- package/dist/runtime-kernel/run-supervisor/runErrors.d.cts +24 -0
- package/dist/runtime-kernel/run-supervisor/runErrors.d.ts +24 -0
- package/dist/runtime-kernel/run-supervisor/runHandle.d.cts +155 -0
- package/dist/runtime-kernel/run-supervisor/runHandle.d.ts +155 -0
- package/dist/runtime-kernel/run-supervisor/runRegistryStorePort.d.cts +47 -0
- package/dist/runtime-kernel/run-supervisor/runRegistryStorePort.d.ts +47 -0
- package/dist/runtime-kernel/run-supervisor/runSupervisor.d.cts +57 -0
- package/dist/runtime-kernel/run-supervisor/runSupervisor.d.ts +57 -0
- package/dist/runtime-kernel/system-reminder/apply.d.cts +38 -0
- package/dist/runtime-kernel/system-reminder/apply.d.ts +38 -0
- package/dist/runtime-kernel/system-reminder/helpers.d.cts +11 -0
- package/dist/runtime-kernel/system-reminder/helpers.d.ts +11 -0
- package/dist/runtime-kernel/system-reminder/index.d.cts +7 -0
- package/dist/runtime-kernel/system-reminder/index.d.ts +7 -0
- package/dist/runtime-kernel/system-reminder/registry.d.cts +17 -0
- package/dist/runtime-kernel/system-reminder/registry.d.ts +17 -0
- package/dist/runtime-kernel/system-reminder/rules.d.cts +20 -0
- package/dist/runtime-kernel/system-reminder/rules.d.ts +20 -0
- package/dist/runtime-kernel/system-reminder/templates.d.cts +10 -0
- package/dist/runtime-kernel/system-reminder/templates.d.ts +10 -0
- package/dist/runtime-kernel/system-reminder/triggers.d.cts +10 -0
- package/dist/runtime-kernel/system-reminder/triggers.d.ts +10 -0
- package/dist/runtime-kernel/system-reminder/types.d.cts +46 -0
- package/dist/runtime-kernel/system-reminder/types.d.ts +46 -0
- package/dist/runtime-kernel/telemetry/index.d.cts +3 -0
- package/dist/runtime-kernel/telemetry/index.d.ts +3 -0
- package/dist/runtime-kernel/telemetry/noopTelemetry.d.cts +5 -0
- package/dist/runtime-kernel/telemetry/noopTelemetry.d.ts +5 -0
- package/dist/runtime-kernel/telemetry/telemetryEvents.d.cts +5 -0
- package/dist/runtime-kernel/telemetry/telemetryEvents.d.ts +5 -0
- package/dist/runtime-kernel/telemetry/telemetryPort.d.cts +95 -0
- package/dist/runtime-kernel/telemetry/telemetryPort.d.ts +95 -0
- package/dist/runtime-kernel/testkit/defaultGraphExecutor.d.cts +23 -0
- package/dist/runtime-kernel/testkit/defaultGraphExecutor.d.ts +23 -0
- package/dist/runtime-kernel/testkit/graphLoopHarness.d.cts +49 -0
- package/dist/runtime-kernel/testkit/graphLoopHarness.d.ts +49 -0
- package/dist/runtime-kernel/token-accounting/functions.d.cts +27 -0
- package/dist/runtime-kernel/token-accounting/functions.d.ts +27 -0
- package/dist/runtime-kernel/token-accounting/index.d.cts +1 -0
- package/dist/runtime-kernel/token-accounting/index.d.ts +1 -0
- package/dist/runtime-kernel/tools/argNormalizer.d.cts +10 -0
- package/dist/runtime-kernel/tools/argNormalizer.d.ts +10 -0
- package/dist/runtime-kernel/tools/conversationView.d.cts +22 -0
- package/dist/runtime-kernel/tools/conversationView.d.ts +22 -0
- package/dist/runtime-kernel/tools/idempotency/toolIdempotency.d.cts +25 -0
- package/dist/runtime-kernel/tools/idempotency/toolIdempotency.d.ts +25 -0
- package/dist/runtime-kernel/tools/index.d.cts +15 -0
- package/dist/runtime-kernel/tools/index.d.ts +15 -0
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInput.d.cts +51 -0
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInput.d.ts +51 -0
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInputPolicy.d.cts +17 -0
- package/dist/runtime-kernel/tools/model-input/definitions/toolModelInputPolicy.d.ts +17 -0
- package/dist/runtime-kernel/tools/model-input/functions/parseToolModelInputDeclaration.d.cts +17 -0
- package/dist/runtime-kernel/tools/model-input/functions/parseToolModelInputDeclaration.d.ts +17 -0
- package/dist/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.d.cts +16 -0
- package/dist/runtime-kernel/tools/model-input/orchestration/resolveToolModelInput.d.ts +16 -0
- package/dist/runtime-kernel/tools/ports.d.cts +119 -0
- package/dist/runtime-kernel/tools/ports.d.ts +119 -0
- package/dist/runtime-kernel/tools/schema/functions/assertToolParameterSchema.d.cts +15 -0
- package/dist/runtime-kernel/tools/schema/functions/assertToolParameterSchema.d.ts +15 -0
- package/dist/runtime-kernel/tools/toolContextPatch.d.cts +14 -0
- package/dist/runtime-kernel/tools/toolContextPatch.d.ts +14 -0
- package/dist/runtime-kernel/tools/toolContextRuntime.d.cts +37 -0
- package/dist/runtime-kernel/tools/toolContextRuntime.d.ts +37 -0
- package/dist/runtime-kernel/tools/toolContracts.d.cts +109 -0
- package/dist/runtime-kernel/tools/toolContracts.d.ts +109 -0
- package/dist/runtime-kernel/tools/toolExecutionContext.d.cts +104 -0
- package/dist/runtime-kernel/tools/toolExecutionContext.d.ts +104 -0
- package/dist/runtime-kernel/tools/ui-types.d.cts +72 -0
- package/dist/runtime-kernel/tools/ui-types.d.ts +72 -0
- package/dist/runtime-kernel.d.cts +106 -20
- package/dist/runtime-kernel.d.ts +106 -20
- package/dist/shared/defaultTokenizerPort.d.cts +29 -0
- package/dist/shared/defaultTokenizerPort.d.ts +29 -0
- package/dist/shared/errorClassifier.d.cts +42 -0
- package/dist/shared/errorClassifier.d.ts +42 -0
- package/dist/shared/llmAuditProjection.d.cts +11 -0
- package/dist/shared/llmAuditProjection.d.ts +11 -0
- package/dist/shared/llmAuditRecorder.d.cts +44 -0
- package/dist/shared/llmAuditRecorder.d.ts +44 -0
- package/dist/shared/llmImageInputError.d.cts +34 -0
- package/dist/shared/llmImageInputError.d.ts +34 -0
- package/dist/shared/llmTelemetryContext.d.cts +52 -0
- package/dist/shared/llmTelemetryContext.d.ts +52 -0
- package/dist/shared/logger.d.cts +12 -0
- package/dist/shared/logger.d.ts +12 -0
- package/dist/{prompt-budget-yciFkC9U.d.cts → shared/prompt-budget.d.cts} +2 -1
- package/dist/{prompt-budget-yciFkC9U.d.ts → shared/prompt-budget.d.ts} +2 -1
- package/dist/testkit/agent-harness/assertions.d.cts +10 -0
- package/dist/testkit/agent-harness/assertions.d.ts +10 -0
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.cts +52 -0
- package/dist/testkit/agent-harness/scriptedInferenceHarness.d.ts +52 -0
- package/dist/testkit/context-harness/invariants/index.d.cts +7 -0
- package/dist/testkit/context-harness/invariants/index.d.ts +7 -0
- package/dist/testkit/context-harness/invariants/types.d.cts +32 -0
- package/dist/testkit/context-harness/invariants/types.d.ts +32 -0
- package/dist/testkit/context-harness/replayHarness.d.cts +18 -0
- package/dist/testkit/context-harness/replayHarness.d.ts +18 -0
- package/dist/testkit/mocks/tokenizerPort.d.cts +17 -0
- package/dist/testkit/mocks/tokenizerPort.d.ts +17 -0
- package/dist/testkit/run-harness/collectingAuditPort.d.cts +21 -0
- package/dist/testkit/run-harness/collectingAuditPort.d.ts +21 -0
- package/dist/testkit/run-harness/invariants/index.d.cts +7 -0
- package/dist/testkit/run-harness/invariants/index.d.ts +7 -0
- package/dist/testkit/run-harness/invariants/types.d.cts +48 -0
- package/dist/testkit/run-harness/invariants/types.d.ts +48 -0
- package/dist/testkit/run-harness/mockTelemetryPort.d.cts +35 -0
- package/dist/testkit/run-harness/mockTelemetryPort.d.ts +35 -0
- package/dist/testkit/run-harness/runSupervisorHarness.d.cts +60 -0
- package/dist/testkit/run-harness/runSupervisorHarness.d.ts +60 -0
- package/dist/testkit/tool-fixtures/toolContext.d.cts +19 -0
- package/dist/testkit/tool-fixtures/toolContext.d.ts +19 -0
- package/dist/testkit.d.cts +17 -277
- package/dist/testkit.d.ts +17 -277
- package/package.json +6 -4
- package/dist/base-DRRrRhxS.d.cts +0 -216
- package/dist/base-DVyQIl_d.d.ts +0 -216
- package/dist/defaultGraphExecutor-Chr16eYO.d.cts +0 -914
- package/dist/defaultGraphExecutor-hT7dchpC.d.ts +0 -914
- package/dist/index-1pE6gSpV.d.cts +0 -172
- package/dist/index-C2PSqU1I.d.cts +0 -1971
- package/dist/index-CZMXtw4h.d.ts +0 -1971
- package/dist/index-D_csW7Zl.d.ts +0 -172
- package/dist/index-DpSWZ1L6.d.ts +0 -67
- package/dist/index-oCM3XEu2.d.cts +0 -67
- package/dist/llm-input-materialization-Vce5Swvc.d.ts +0 -366
- package/dist/llm-input-materialization-r-V3n9U-.d.cts +0 -366
- package/dist/runHandle--l0kE205.d.cts +0 -490
- package/dist/runHandle-ouLd6Tgp.d.ts +0 -490
- package/dist/token-accounting-19cXG7hM.d.cts +0 -3342
- package/dist/token-accounting-CVW37Uri.d.ts +0 -3342
- package/dist/toolContracts--KrHHNCY.d.cts +0 -424
- package/dist/toolContracts-BQ4kIso_.d.ts +0 -424
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CanonicalLlmUsage } from '../../contracts/token-usage.js';
|
|
2
|
+
import { LlmUsageTokenLedgerEntry, ContextTokenComponent, TokenLedgerAggregate, TokenUsageTotals, TokenLedgerEntry, TokenPricing, CostBreakdown, ContextComponentTokenLedgerEntry, RunTokenUsageAggregate } from '../../contracts/token-accounting.js';
|
|
3
|
+
|
|
4
|
+
type LedgerEntryScope = Pick<LlmUsageTokenLedgerEntry, 'runId' | 'parentRunId' | 'conversationId' | 'turnId' | 'stepId' | 'route' | 'createdAt'>;
|
|
5
|
+
interface CreateLlmUsageLedgerEntryInput extends LedgerEntryScope {
|
|
6
|
+
id: string;
|
|
7
|
+
modelId?: string;
|
|
8
|
+
usage: CanonicalLlmUsage;
|
|
9
|
+
}
|
|
10
|
+
interface CreateContextComponentLedgerEntryInput extends LedgerEntryScope {
|
|
11
|
+
id: string;
|
|
12
|
+
components: readonly ContextTokenComponent[];
|
|
13
|
+
}
|
|
14
|
+
declare function aggregateCanonicalUsage(usages: readonly CanonicalLlmUsage[]): TokenUsageTotals | undefined;
|
|
15
|
+
declare function createLlmUsageLedgerEntry(input: CreateLlmUsageLedgerEntryInput): LlmUsageTokenLedgerEntry;
|
|
16
|
+
declare function createContextComponentLedgerEntry(input: CreateContextComponentLedgerEntryInput): ContextComponentTokenLedgerEntry;
|
|
17
|
+
declare function addUsageTotals(left: TokenUsageTotals | undefined, right: TokenUsageTotals | undefined): TokenUsageTotals | undefined;
|
|
18
|
+
declare function addLedgerAggregate(left: TokenLedgerAggregate, right: TokenLedgerAggregate): TokenLedgerAggregate;
|
|
19
|
+
declare function aggregateTokenLedgerEntries(entries: readonly TokenLedgerEntry[]): TokenLedgerAggregate;
|
|
20
|
+
declare function createRunTokenUsageAggregate(input: {
|
|
21
|
+
ownEntries: readonly TokenLedgerEntry[];
|
|
22
|
+
childAggregates?: readonly TokenLedgerAggregate[];
|
|
23
|
+
}): RunTokenUsageAggregate;
|
|
24
|
+
declare function computeCost(usage: CanonicalLlmUsage, pricing?: TokenPricing): CostBreakdown;
|
|
25
|
+
|
|
26
|
+
export { addLedgerAggregate, addUsageTotals, aggregateCanonicalUsage, aggregateTokenLedgerEntries, computeCost, createContextComponentLedgerEntry, createLlmUsageLedgerEntry, createRunTokenUsageAggregate };
|
|
27
|
+
export type { CreateContextComponentLedgerEntryInput, CreateLlmUsageLedgerEntryInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateContextComponentLedgerEntryInput, CreateLlmUsageLedgerEntryInput, addLedgerAggregate, addUsageTotals, aggregateCanonicalUsage, aggregateTokenLedgerEntries, computeCost, createContextComponentLedgerEntry, createLlmUsageLedgerEntry, createRunTokenUsageAggregate } from './functions.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CreateContextComponentLedgerEntryInput, CreateLlmUsageLedgerEntryInput, addLedgerAggregate, addUsageTotals, aggregateCanonicalUsage, aggregateTokenLedgerEntries, computeCost, createContextComponentLedgerEntry, createLlmUsageLedgerEntry, createRunTokenUsageAggregate } from './functions.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ToolParameterSchema } from '../../ports/tool-schema.cjs';
|
|
2
|
+
|
|
3
|
+
type UnknownRecord = Record<string, unknown>;
|
|
4
|
+
type NormalizeToolArgsOptions = {
|
|
5
|
+
toolName?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function normalizeToolArgs(schema: ToolParameterSchema, args: UnknownRecord, options?: NormalizeToolArgsOptions): UnknownRecord;
|
|
9
|
+
|
|
10
|
+
export { normalizeToolArgs };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ToolParameterSchema } from '../../ports/tool-schema.js';
|
|
2
|
+
|
|
3
|
+
type UnknownRecord = Record<string, unknown>;
|
|
4
|
+
type NormalizeToolArgsOptions = {
|
|
5
|
+
toolName?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
};
|
|
8
|
+
declare function normalizeToolArgs(schema: ToolParameterSchema, args: UnknownRecord, options?: NormalizeToolArgsOptions): UnknownRecord;
|
|
9
|
+
|
|
10
|
+
export { normalizeToolArgs };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RuntimeEvent } from '../../contracts/events.cjs';
|
|
2
|
+
|
|
3
|
+
interface ToolContextConversationView {
|
|
4
|
+
/**
|
|
5
|
+
* 当前工具执行可见的 working history
|
|
6
|
+
*
|
|
7
|
+
* 中文备注:
|
|
8
|
+
* - 该视图允许工具读取“本轮 run 中已产生、但可能尚未持久化”的最新事实事件;
|
|
9
|
+
* - ToolNode / graph runtime 后续只应更新这一层背后的 source,而不是覆写顶层 getter。
|
|
10
|
+
*/
|
|
11
|
+
getWorkingHistoryEvents(): ReadonlyArray<RuntimeEvent>;
|
|
12
|
+
/**
|
|
13
|
+
* run 启动时的 persisted history 视图
|
|
14
|
+
*
|
|
15
|
+
* 中文备注:
|
|
16
|
+
* - 该视图对应 EventStore 回放得到的稳定历史;
|
|
17
|
+
* - 与 working history 显式区分,避免调用方误把“最新运行态”当成“已持久化事实”。
|
|
18
|
+
*/
|
|
19
|
+
getPersistedHistoryEvents(): ReadonlyArray<RuntimeEvent>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type { ToolContextConversationView };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RuntimeEvent } from '../../contracts/events.js';
|
|
2
|
+
|
|
3
|
+
interface ToolContextConversationView {
|
|
4
|
+
/**
|
|
5
|
+
* 当前工具执行可见的 working history
|
|
6
|
+
*
|
|
7
|
+
* 中文备注:
|
|
8
|
+
* - 该视图允许工具读取“本轮 run 中已产生、但可能尚未持久化”的最新事实事件;
|
|
9
|
+
* - ToolNode / graph runtime 后续只应更新这一层背后的 source,而不是覆写顶层 getter。
|
|
10
|
+
*/
|
|
11
|
+
getWorkingHistoryEvents(): ReadonlyArray<RuntimeEvent>;
|
|
12
|
+
/**
|
|
13
|
+
* run 启动时的 persisted history 视图
|
|
14
|
+
*
|
|
15
|
+
* 中文备注:
|
|
16
|
+
* - 该视图对应 EventStore 回放得到的稳定历史;
|
|
17
|
+
* - 与 working history 显式区分,避免调用方误把“最新运行态”当成“已持久化事实”。
|
|
18
|
+
*/
|
|
19
|
+
getPersistedHistoryEvents(): ReadonlyArray<RuntimeEvent>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type { ToolContextConversationView };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolExecutionContext } from '../toolExecutionContext.cjs';
|
|
2
|
+
import { RuntimeResourceRef } from '../../../contracts/resource-ref.cjs';
|
|
3
|
+
import { RuntimeEvent } from '../../../contracts/events.cjs';
|
|
4
|
+
|
|
5
|
+
type ToolIdempotencyScope = 'conversation' | 'turn';
|
|
6
|
+
type ToolIdempotencyPolicy = {
|
|
7
|
+
scope: ToolIdempotencyScope;
|
|
8
|
+
};
|
|
9
|
+
declare function computeToolIdempotencyKey(params: {
|
|
10
|
+
policy: ToolIdempotencyPolicy;
|
|
11
|
+
toolName: string;
|
|
12
|
+
args: Record<string, unknown>;
|
|
13
|
+
context: ToolExecutionContext;
|
|
14
|
+
}): string;
|
|
15
|
+
declare function findCachedToolOutputByIdempotencyKey(params: {
|
|
16
|
+
history: ReadonlyArray<RuntimeEvent>;
|
|
17
|
+
toolName: string;
|
|
18
|
+
idempotencyKey: string;
|
|
19
|
+
}): {
|
|
20
|
+
result: string;
|
|
21
|
+
attachments?: readonly RuntimeResourceRef[];
|
|
22
|
+
} | undefined;
|
|
23
|
+
|
|
24
|
+
export { computeToolIdempotencyKey, findCachedToolOutputByIdempotencyKey };
|
|
25
|
+
export type { ToolIdempotencyPolicy, ToolIdempotencyScope };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolExecutionContext } from '../toolExecutionContext.js';
|
|
2
|
+
import { RuntimeResourceRef } from '../../../contracts/resource-ref.js';
|
|
3
|
+
import { RuntimeEvent } from '../../../contracts/events.js';
|
|
4
|
+
|
|
5
|
+
type ToolIdempotencyScope = 'conversation' | 'turn';
|
|
6
|
+
type ToolIdempotencyPolicy = {
|
|
7
|
+
scope: ToolIdempotencyScope;
|
|
8
|
+
};
|
|
9
|
+
declare function computeToolIdempotencyKey(params: {
|
|
10
|
+
policy: ToolIdempotencyPolicy;
|
|
11
|
+
toolName: string;
|
|
12
|
+
args: Record<string, unknown>;
|
|
13
|
+
context: ToolExecutionContext;
|
|
14
|
+
}): string;
|
|
15
|
+
declare function findCachedToolOutputByIdempotencyKey(params: {
|
|
16
|
+
history: ReadonlyArray<RuntimeEvent>;
|
|
17
|
+
toolName: string;
|
|
18
|
+
idempotencyKey: string;
|
|
19
|
+
}): {
|
|
20
|
+
result: string;
|
|
21
|
+
attachments?: readonly RuntimeResourceRef[];
|
|
22
|
+
} | undefined;
|
|
23
|
+
|
|
24
|
+
export { computeToolIdempotencyKey, findCachedToolOutputByIdempotencyKey };
|
|
25
|
+
export type { ToolIdempotencyPolicy, ToolIdempotencyScope };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { AgentTool, BaseTool, CommonParameterTypes, FunctionToolSchema, ToolArgs, ToolCallResult, ToolCallStreamingPolicy, ToolRegistryEntry, ToolResult, UnifiedToolResult } from './toolContracts.cjs';
|
|
2
|
+
export { normalizeToolArgs } from './argNormalizer.cjs';
|
|
3
|
+
export { ToolParameterSchemaError, assertToolParameterSchema } from './schema/functions/assertToolParameterSchema.cjs';
|
|
4
|
+
export { computeToolIdempotencyKey, findCachedToolOutputByIdempotencyKey } from './idempotency/toolIdempotency.cjs';
|
|
5
|
+
export { copyToolContextRuntimeCapability, ensureToolContextRuntimeCapability, getToolContextRuntimeBinding, readToolContextPersistedHistory, readToolContextWorkingHistory, stripRuntimeReservedToolContextPatch } from './toolContextRuntime.cjs';
|
|
6
|
+
export { ObservationPreviewContext, ObservationPreviewMeta, ObservationPreviewPort, ObservationPreviewResult, ToolCatalogPort, ToolExecutionPort, ToolExecutionResult, ToolModelInputCapabilityValidatorPort, ToolRuntimeDefinition, ToolRuntimePort, ToolSchemaBuildRequest } from './ports.cjs';
|
|
7
|
+
export { ToolContextConversationView } from './conversationView.cjs';
|
|
8
|
+
export { ToolExecutionContext } from './toolExecutionContext.cjs';
|
|
9
|
+
export { ToolContextPatch } from './toolContextPatch.cjs';
|
|
10
|
+
export { StructuredToolResult, ToolControlInfo, ToolObservationPreviewMeta, ToolResultImageMedia } from './ui-types.cjs';
|
|
11
|
+
export { CompleteToolModelInputParams, ResolveToolModelInputParams, ToolModelInputAttachmentSelection, ToolModelInputDeclaration, ToolModelInputResolutionError, ToolModelInputResolverPort } from './model-input/definitions/toolModelInput.cjs';
|
|
12
|
+
export { ToolModelInputAdmission, ToolModelInputDelivery } from './model-input/definitions/toolModelInputPolicy.cjs';
|
|
13
|
+
export { ToolModelInputDeclarationValidation, parseToolModelInputDeclaration } from './model-input/functions/parseToolModelInputDeclaration.cjs';
|
|
14
|
+
export { resolveToolModelInput } from './model-input/orchestration/resolveToolModelInput.cjs';
|
|
15
|
+
export { JsonSchemaValue, ToolParameterProperty, ToolParameterSchema, ToolParameterType } from '../../ports/tool-schema.cjs';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { AgentTool, BaseTool, CommonParameterTypes, FunctionToolSchema, ToolArgs, ToolCallResult, ToolCallStreamingPolicy, ToolRegistryEntry, ToolResult, UnifiedToolResult } from './toolContracts.js';
|
|
2
|
+
export { normalizeToolArgs } from './argNormalizer.js';
|
|
3
|
+
export { ToolParameterSchemaError, assertToolParameterSchema } from './schema/functions/assertToolParameterSchema.js';
|
|
4
|
+
export { computeToolIdempotencyKey, findCachedToolOutputByIdempotencyKey } from './idempotency/toolIdempotency.js';
|
|
5
|
+
export { copyToolContextRuntimeCapability, ensureToolContextRuntimeCapability, getToolContextRuntimeBinding, readToolContextPersistedHistory, readToolContextWorkingHistory, stripRuntimeReservedToolContextPatch } from './toolContextRuntime.js';
|
|
6
|
+
export { ObservationPreviewContext, ObservationPreviewMeta, ObservationPreviewPort, ObservationPreviewResult, ToolCatalogPort, ToolExecutionPort, ToolExecutionResult, ToolModelInputCapabilityValidatorPort, ToolRuntimeDefinition, ToolRuntimePort, ToolSchemaBuildRequest } from './ports.js';
|
|
7
|
+
export { ToolContextConversationView } from './conversationView.js';
|
|
8
|
+
export { ToolExecutionContext } from './toolExecutionContext.js';
|
|
9
|
+
export { ToolContextPatch } from './toolContextPatch.js';
|
|
10
|
+
export { StructuredToolResult, ToolControlInfo, ToolObservationPreviewMeta, ToolResultImageMedia } from './ui-types.js';
|
|
11
|
+
export { CompleteToolModelInputParams, ResolveToolModelInputParams, ToolModelInputAttachmentSelection, ToolModelInputDeclaration, ToolModelInputResolutionError, ToolModelInputResolverPort } from './model-input/definitions/toolModelInput.js';
|
|
12
|
+
export { ToolModelInputAdmission, ToolModelInputDelivery } from './model-input/definitions/toolModelInputPolicy.js';
|
|
13
|
+
export { ToolModelInputDeclarationValidation, parseToolModelInputDeclaration } from './model-input/functions/parseToolModelInputDeclaration.js';
|
|
14
|
+
export { resolveToolModelInput } from './model-input/orchestration/resolveToolModelInput.js';
|
|
15
|
+
export { JsonSchemaValue, ToolParameterProperty, ToolParameterSchema, ToolParameterType } from '../../ports/tool-schema.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RuntimeResourceRef } from '../../../../contracts/resource-ref.cjs';
|
|
2
|
+
import { ToolExecutionContext } from '../../toolExecutionContext.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 工具对模型输入附件的声明。
|
|
6
|
+
*
|
|
7
|
+
* 中文说明:
|
|
8
|
+
* - 这里只表达工具选择了哪个资源,不代表资源已经可信或可读;
|
|
9
|
+
* - `uri` 的协议、作用域与完整性由 host resolver 校验;
|
|
10
|
+
* - path、bytes、base64 和 durable ref 都不属于工具声明面。
|
|
11
|
+
*/
|
|
12
|
+
interface ToolModelInputAttachmentSelection {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly uri: string;
|
|
15
|
+
readonly label?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ToolModelInputDeclaration {
|
|
18
|
+
readonly attachments: readonly ToolModelInputAttachmentSelection[];
|
|
19
|
+
}
|
|
20
|
+
interface ResolveToolModelInputParams {
|
|
21
|
+
readonly toolName: string;
|
|
22
|
+
readonly toolCallId: string;
|
|
23
|
+
readonly selections: readonly ToolModelInputAttachmentSelection[];
|
|
24
|
+
readonly context: ToolExecutionContext;
|
|
25
|
+
}
|
|
26
|
+
interface CompleteToolModelInputParams {
|
|
27
|
+
readonly toolName: string;
|
|
28
|
+
readonly toolCallId: string;
|
|
29
|
+
readonly context: ToolExecutionContext;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* host 把不可信 selection 解析为 durable resource ref 的唯一端口。
|
|
33
|
+
* framework 不知道 host 存储、资源路径或授权规则。
|
|
34
|
+
*/
|
|
35
|
+
interface ToolModelInputResolverPort {
|
|
36
|
+
resolveToolModelInput(params: ResolveToolModelInputParams): Promise<readonly RuntimeResourceRef[]>;
|
|
37
|
+
/**
|
|
38
|
+
* 一次工具调用完成后释放尚未消费的临时模型输入授权。
|
|
39
|
+
*
|
|
40
|
+
* framework 只表达调用生命周期,不知道 host 使用的是 claim、lease 或其他机制。
|
|
41
|
+
*/
|
|
42
|
+
completeToolModelInput(params: CompleteToolModelInputParams): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
declare class ToolModelInputResolutionError extends Error {
|
|
45
|
+
readonly name = "ToolModelInputResolutionError";
|
|
46
|
+
readonly errorCode = "tool.model_input.resolution_failed";
|
|
47
|
+
constructor(message: string);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ToolModelInputResolutionError };
|
|
51
|
+
export type { CompleteToolModelInputParams, ResolveToolModelInputParams, ToolModelInputAttachmentSelection, ToolModelInputDeclaration, ToolModelInputResolverPort };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RuntimeResourceRef } from '../../../../contracts/resource-ref.js';
|
|
2
|
+
import { ToolExecutionContext } from '../../toolExecutionContext.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 工具对模型输入附件的声明。
|
|
6
|
+
*
|
|
7
|
+
* 中文说明:
|
|
8
|
+
* - 这里只表达工具选择了哪个资源,不代表资源已经可信或可读;
|
|
9
|
+
* - `uri` 的协议、作用域与完整性由 host resolver 校验;
|
|
10
|
+
* - path、bytes、base64 和 durable ref 都不属于工具声明面。
|
|
11
|
+
*/
|
|
12
|
+
interface ToolModelInputAttachmentSelection {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly uri: string;
|
|
15
|
+
readonly label?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ToolModelInputDeclaration {
|
|
18
|
+
readonly attachments: readonly ToolModelInputAttachmentSelection[];
|
|
19
|
+
}
|
|
20
|
+
interface ResolveToolModelInputParams {
|
|
21
|
+
readonly toolName: string;
|
|
22
|
+
readonly toolCallId: string;
|
|
23
|
+
readonly selections: readonly ToolModelInputAttachmentSelection[];
|
|
24
|
+
readonly context: ToolExecutionContext;
|
|
25
|
+
}
|
|
26
|
+
interface CompleteToolModelInputParams {
|
|
27
|
+
readonly toolName: string;
|
|
28
|
+
readonly toolCallId: string;
|
|
29
|
+
readonly context: ToolExecutionContext;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* host 把不可信 selection 解析为 durable resource ref 的唯一端口。
|
|
33
|
+
* framework 不知道 host 存储、资源路径或授权规则。
|
|
34
|
+
*/
|
|
35
|
+
interface ToolModelInputResolverPort {
|
|
36
|
+
resolveToolModelInput(params: ResolveToolModelInputParams): Promise<readonly RuntimeResourceRef[]>;
|
|
37
|
+
/**
|
|
38
|
+
* 一次工具调用完成后释放尚未消费的临时模型输入授权。
|
|
39
|
+
*
|
|
40
|
+
* framework 只表达调用生命周期,不知道 host 使用的是 claim、lease 或其他机制。
|
|
41
|
+
*/
|
|
42
|
+
completeToolModelInput(params: CompleteToolModelInputParams): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
declare class ToolModelInputResolutionError extends Error {
|
|
45
|
+
readonly name = "ToolModelInputResolutionError";
|
|
46
|
+
readonly errorCode = "tool.model_input.resolution_failed";
|
|
47
|
+
constructor(message: string);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ToolModelInputResolutionError };
|
|
51
|
+
export type { CompleteToolModelInputParams, ResolveToolModelInputParams, ToolModelInputAttachmentSelection, ToolModelInputDeclaration, ToolModelInputResolverPort };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModelInputRequirement } from '../../../llm/input-capabilities/definitions/modelInputCapability.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 工具结果模型输入的交付语义。
|
|
5
|
+
*
|
|
6
|
+
* `required` 表示附件是工具业务结果的一部分,当前模型不兼容时必须拒绝工具;
|
|
7
|
+
* `when_supported` 表示附件只是成功结果的增强反馈,不兼容时工具仍可返回文本结果。
|
|
8
|
+
*/
|
|
9
|
+
type ToolModelInputDelivery = 'required' | 'when_supported';
|
|
10
|
+
/** ToolNode 在真实 active model 上完成的本次调用准入事实。 */
|
|
11
|
+
interface ToolModelInputAdmission {
|
|
12
|
+
readonly requirement: ModelInputRequirement;
|
|
13
|
+
readonly delivery: ToolModelInputDelivery;
|
|
14
|
+
readonly admitted: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { ToolModelInputAdmission, ToolModelInputDelivery };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModelInputRequirement } from '../../../llm/input-capabilities/definitions/modelInputCapability.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 工具结果模型输入的交付语义。
|
|
5
|
+
*
|
|
6
|
+
* `required` 表示附件是工具业务结果的一部分,当前模型不兼容时必须拒绝工具;
|
|
7
|
+
* `when_supported` 表示附件只是成功结果的增强反馈,不兼容时工具仍可返回文本结果。
|
|
8
|
+
*/
|
|
9
|
+
type ToolModelInputDelivery = 'required' | 'when_supported';
|
|
10
|
+
/** ToolNode 在真实 active model 上完成的本次调用准入事实。 */
|
|
11
|
+
interface ToolModelInputAdmission {
|
|
12
|
+
readonly requirement: ModelInputRequirement;
|
|
13
|
+
readonly delivery: ToolModelInputDelivery;
|
|
14
|
+
readonly admitted: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { ToolModelInputAdmission, ToolModelInputDelivery };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ToolModelInputDeclaration } from '../definitions/toolModelInput.cjs';
|
|
2
|
+
|
|
3
|
+
type ToolModelInputDeclarationValidation = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly declaration: ToolModelInputDeclaration;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 只校验 framework 拥有的声明形状。
|
|
12
|
+
* URI scheme、资源授权与图片完整性必须留给 host resolver,避免 host 存储语义反向进入 linnkit。
|
|
13
|
+
*/
|
|
14
|
+
declare function parseToolModelInputDeclaration(value: unknown): ToolModelInputDeclarationValidation;
|
|
15
|
+
|
|
16
|
+
export { parseToolModelInputDeclaration };
|
|
17
|
+
export type { ToolModelInputDeclarationValidation };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ToolModelInputDeclaration } from '../definitions/toolModelInput.js';
|
|
2
|
+
|
|
3
|
+
type ToolModelInputDeclarationValidation = {
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly declaration: ToolModelInputDeclaration;
|
|
6
|
+
} | {
|
|
7
|
+
readonly ok: false;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 只校验 framework 拥有的声明形状。
|
|
12
|
+
* URI scheme、资源授权与图片完整性必须留给 host resolver,避免 host 存储语义反向进入 linnkit。
|
|
13
|
+
*/
|
|
14
|
+
declare function parseToolModelInputDeclaration(value: unknown): ToolModelInputDeclarationValidation;
|
|
15
|
+
|
|
16
|
+
export { parseToolModelInputDeclaration };
|
|
17
|
+
export type { ToolModelInputDeclarationValidation };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RuntimeResourceRef } from '../../../../contracts/resource-ref.cjs';
|
|
2
|
+
import { ToolExecutionContext } from '../../toolExecutionContext.cjs';
|
|
3
|
+
import { ToolModelInputCapabilityValidatorPort } from '../../ports.cjs';
|
|
4
|
+
import { ToolModelInputAttachmentSelection, ToolModelInputResolverPort } from '../definitions/toolModelInput.cjs';
|
|
5
|
+
|
|
6
|
+
declare function resolveToolModelInput(input: {
|
|
7
|
+
readonly activeModelId: string | undefined;
|
|
8
|
+
readonly toolName: string;
|
|
9
|
+
readonly toolCallId: string;
|
|
10
|
+
readonly selections: readonly ToolModelInputAttachmentSelection[] | undefined;
|
|
11
|
+
readonly context: ToolExecutionContext;
|
|
12
|
+
readonly resolver?: ToolModelInputResolverPort;
|
|
13
|
+
readonly capabilityValidator?: ToolModelInputCapabilityValidatorPort;
|
|
14
|
+
}): Promise<readonly RuntimeResourceRef[] | undefined>;
|
|
15
|
+
|
|
16
|
+
export { resolveToolModelInput };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RuntimeResourceRef } from '../../../../contracts/resource-ref.js';
|
|
2
|
+
import { ToolExecutionContext } from '../../toolExecutionContext.js';
|
|
3
|
+
import { ToolModelInputCapabilityValidatorPort } from '../../ports.js';
|
|
4
|
+
import { ToolModelInputAttachmentSelection, ToolModelInputResolverPort } from '../definitions/toolModelInput.js';
|
|
5
|
+
|
|
6
|
+
declare function resolveToolModelInput(input: {
|
|
7
|
+
readonly activeModelId: string | undefined;
|
|
8
|
+
readonly toolName: string;
|
|
9
|
+
readonly toolCallId: string;
|
|
10
|
+
readonly selections: readonly ToolModelInputAttachmentSelection[] | undefined;
|
|
11
|
+
readonly context: ToolExecutionContext;
|
|
12
|
+
readonly resolver?: ToolModelInputResolverPort;
|
|
13
|
+
readonly capabilityValidator?: ToolModelInputCapabilityValidatorPort;
|
|
14
|
+
}): Promise<readonly RuntimeResourceRef[] | undefined>;
|
|
15
|
+
|
|
16
|
+
export { resolveToolModelInput };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ToolObservationPreviewMeta } from './ui-types.cjs';
|
|
2
|
+
import { ToolExecutionContext } from './toolExecutionContext.cjs';
|
|
3
|
+
import { AgentInvocationRequest } from '../../ports/agent-invocation.cjs';
|
|
4
|
+
import { RuntimeResourceRef } from '../../contracts/resource-ref.cjs';
|
|
5
|
+
import { ToolParameterSchema } from '../../ports/tool-schema.cjs';
|
|
6
|
+
import { FunctionToolSchema, ToolArgs, ToolCallStreamingPolicy } from './toolContracts.cjs';
|
|
7
|
+
import { ToolIdempotencyPolicy } from './idempotency/toolIdempotency.cjs';
|
|
8
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../llm/input-capabilities/definitions/modelInputCapability.cjs';
|
|
9
|
+
import { ToolModelInputDelivery } from './model-input/definitions/toolModelInputPolicy.cjs';
|
|
10
|
+
|
|
11
|
+
interface ToolRuntimeDefinition {
|
|
12
|
+
parameters: ToolParameterSchema;
|
|
13
|
+
/**
|
|
14
|
+
* 工具 owner 的深层参数 admission。
|
|
15
|
+
*
|
|
16
|
+
* ToolNode 在发布 tool_process(start) 之前调用它;失败会直接结算为
|
|
17
|
+
* tool_output(error),避免把尚未真正启动的调用展示成 running。
|
|
18
|
+
*/
|
|
19
|
+
validateArguments?: (args: ToolArgs) => {
|
|
20
|
+
success: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
};
|
|
23
|
+
idempotency?: ToolIdempotencyPolicy;
|
|
24
|
+
/** 静态声明该工具成功结果可能要求的模型输入能力。 */
|
|
25
|
+
modelInputRequirement?: ModelInputRequirement;
|
|
26
|
+
/** 未声明时保持既有 required 语义。 */
|
|
27
|
+
modelInputDelivery?: ToolModelInputDelivery;
|
|
28
|
+
/**
|
|
29
|
+
* 按本次规范化参数解析执行前的模型输入要求。
|
|
30
|
+
*
|
|
31
|
+
* 中文说明:
|
|
32
|
+
* - 只用于同一工具既可能返回纯文本、也可能返回模型附件的真实场景;
|
|
33
|
+
* - 动态 resolver 存在时取代静态声明,返回 undefined 表示本次调用无额外要求;
|
|
34
|
+
* - prepare 阶段仍只消费静态声明,不能在模型产生工具参数前猜测动态结果。
|
|
35
|
+
* - resolver 抛错时 ToolNode 会拒绝本次调用、生成配对 error output,并继续同批其他调用;
|
|
36
|
+
* 宿主异常原文不会进入模型上下文或审计 reason。
|
|
37
|
+
*/
|
|
38
|
+
resolveModelInputRequirement?: (args: ToolArgs) => ModelInputRequirement | undefined;
|
|
39
|
+
/** LLM 流式 tool_call 的通用事件发布策略;未声明即不发布早期生命周期事件。 */
|
|
40
|
+
streaming?: ToolCallStreamingPolicy;
|
|
41
|
+
}
|
|
42
|
+
interface ToolExecutionResult {
|
|
43
|
+
success: boolean;
|
|
44
|
+
result?: string;
|
|
45
|
+
error?: string;
|
|
46
|
+
/** 工具 owner 声明的稳定业务错误码;不得从自然语言错误文本反推。 */
|
|
47
|
+
errorCode?: string;
|
|
48
|
+
errorKind?: 'protocol' | 'execution' | 'capability';
|
|
49
|
+
durationMs: number;
|
|
50
|
+
idempotency?: {
|
|
51
|
+
key: string;
|
|
52
|
+
cacheHit: boolean;
|
|
53
|
+
};
|
|
54
|
+
/** 幂等历史命中时复用已经完成授权与完整性校验的正式资源引用。 */
|
|
55
|
+
cachedAttachments?: readonly RuntimeResourceRef[];
|
|
56
|
+
}
|
|
57
|
+
interface ToolModelInputCapabilityValidatorPort {
|
|
58
|
+
evaluate(input: {
|
|
59
|
+
readonly activeModelId: string;
|
|
60
|
+
readonly requirement: ModelInputRequirement;
|
|
61
|
+
}): ModelInputCompatibility;
|
|
62
|
+
assertCompatible(input: {
|
|
63
|
+
readonly activeModelId: string;
|
|
64
|
+
readonly requirement: ModelInputRequirement;
|
|
65
|
+
}): void;
|
|
66
|
+
}
|
|
67
|
+
type ObservationPreviewMeta = ToolObservationPreviewMeta;
|
|
68
|
+
type ObservationPreviewContext = ToolExecutionContext;
|
|
69
|
+
/**
|
|
70
|
+
* Host 按本次 Agent 调用构建工具 Schema 的最小输入。
|
|
71
|
+
*
|
|
72
|
+
* Linnkit 只规定调用时机并转交通用 invocation;Host 如何验证扩展字段并
|
|
73
|
+
* 派生 concrete tools 的窄动态 Schema 上下文,属于 Host 工具注册表职责。
|
|
74
|
+
*/
|
|
75
|
+
interface ToolSchemaBuildRequest {
|
|
76
|
+
readonly toolNames?: readonly string[];
|
|
77
|
+
readonly invocation: AgentInvocationRequest;
|
|
78
|
+
}
|
|
79
|
+
type ObservationPreviewResult = {
|
|
80
|
+
truncated: false;
|
|
81
|
+
preview: string;
|
|
82
|
+
} | {
|
|
83
|
+
truncated: true;
|
|
84
|
+
preview: string;
|
|
85
|
+
blob_id: string;
|
|
86
|
+
originalChars?: number;
|
|
87
|
+
previewChars?: number;
|
|
88
|
+
originalLines?: number;
|
|
89
|
+
previewLines?: number;
|
|
90
|
+
};
|
|
91
|
+
interface ToolCatalogPort {
|
|
92
|
+
getToolSchemas(input: ToolSchemaBuildRequest): FunctionToolSchema[];
|
|
93
|
+
getToolDefinition(toolName: string): ToolRuntimeDefinition | undefined;
|
|
94
|
+
}
|
|
95
|
+
interface ToolExecutionPort {
|
|
96
|
+
executeTool(toolName: string, args: ToolArgs, context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
97
|
+
}
|
|
98
|
+
interface ObservationPreviewPort {
|
|
99
|
+
/**
|
|
100
|
+
* 执行期 observation 预览/落盘治理。
|
|
101
|
+
*
|
|
102
|
+
* 中文说明:
|
|
103
|
+
* - framework 只把 `maxChars/maxLines` 和工具上下文传给 host;
|
|
104
|
+
* - 完整内容写到本地目录、对象存储还是数据库,由 host 的这个 port 决定;
|
|
105
|
+
* - 如果返回 `blob_id`,host 需要保证对应读取工具使用同一个 store。
|
|
106
|
+
*/
|
|
107
|
+
truncateObservation(params: {
|
|
108
|
+
context: ObservationPreviewContext;
|
|
109
|
+
toolName: string;
|
|
110
|
+
text: string;
|
|
111
|
+
maxChars: number;
|
|
112
|
+
maxLines: number;
|
|
113
|
+
meta?: ObservationPreviewMeta;
|
|
114
|
+
}): Promise<ObservationPreviewResult>;
|
|
115
|
+
}
|
|
116
|
+
interface ToolRuntimePort extends ToolCatalogPort, ToolExecutionPort {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type { ObservationPreviewContext, ObservationPreviewMeta, ObservationPreviewPort, ObservationPreviewResult, ToolCatalogPort, ToolExecutionPort, ToolExecutionResult, ToolModelInputCapabilityValidatorPort, ToolRuntimeDefinition, ToolRuntimePort, ToolSchemaBuildRequest };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ToolObservationPreviewMeta } from './ui-types.js';
|
|
2
|
+
import { ToolExecutionContext } from './toolExecutionContext.js';
|
|
3
|
+
import { AgentInvocationRequest } from '../../ports/agent-invocation.js';
|
|
4
|
+
import { RuntimeResourceRef } from '../../contracts/resource-ref.js';
|
|
5
|
+
import { ToolParameterSchema } from '../../ports/tool-schema.js';
|
|
6
|
+
import { FunctionToolSchema, ToolArgs, ToolCallStreamingPolicy } from './toolContracts.js';
|
|
7
|
+
import { ToolIdempotencyPolicy } from './idempotency/toolIdempotency.js';
|
|
8
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../llm/input-capabilities/definitions/modelInputCapability.js';
|
|
9
|
+
import { ToolModelInputDelivery } from './model-input/definitions/toolModelInputPolicy.js';
|
|
10
|
+
|
|
11
|
+
interface ToolRuntimeDefinition {
|
|
12
|
+
parameters: ToolParameterSchema;
|
|
13
|
+
/**
|
|
14
|
+
* 工具 owner 的深层参数 admission。
|
|
15
|
+
*
|
|
16
|
+
* ToolNode 在发布 tool_process(start) 之前调用它;失败会直接结算为
|
|
17
|
+
* tool_output(error),避免把尚未真正启动的调用展示成 running。
|
|
18
|
+
*/
|
|
19
|
+
validateArguments?: (args: ToolArgs) => {
|
|
20
|
+
success: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
};
|
|
23
|
+
idempotency?: ToolIdempotencyPolicy;
|
|
24
|
+
/** 静态声明该工具成功结果可能要求的模型输入能力。 */
|
|
25
|
+
modelInputRequirement?: ModelInputRequirement;
|
|
26
|
+
/** 未声明时保持既有 required 语义。 */
|
|
27
|
+
modelInputDelivery?: ToolModelInputDelivery;
|
|
28
|
+
/**
|
|
29
|
+
* 按本次规范化参数解析执行前的模型输入要求。
|
|
30
|
+
*
|
|
31
|
+
* 中文说明:
|
|
32
|
+
* - 只用于同一工具既可能返回纯文本、也可能返回模型附件的真实场景;
|
|
33
|
+
* - 动态 resolver 存在时取代静态声明,返回 undefined 表示本次调用无额外要求;
|
|
34
|
+
* - prepare 阶段仍只消费静态声明,不能在模型产生工具参数前猜测动态结果。
|
|
35
|
+
* - resolver 抛错时 ToolNode 会拒绝本次调用、生成配对 error output,并继续同批其他调用;
|
|
36
|
+
* 宿主异常原文不会进入模型上下文或审计 reason。
|
|
37
|
+
*/
|
|
38
|
+
resolveModelInputRequirement?: (args: ToolArgs) => ModelInputRequirement | undefined;
|
|
39
|
+
/** LLM 流式 tool_call 的通用事件发布策略;未声明即不发布早期生命周期事件。 */
|
|
40
|
+
streaming?: ToolCallStreamingPolicy;
|
|
41
|
+
}
|
|
42
|
+
interface ToolExecutionResult {
|
|
43
|
+
success: boolean;
|
|
44
|
+
result?: string;
|
|
45
|
+
error?: string;
|
|
46
|
+
/** 工具 owner 声明的稳定业务错误码;不得从自然语言错误文本反推。 */
|
|
47
|
+
errorCode?: string;
|
|
48
|
+
errorKind?: 'protocol' | 'execution' | 'capability';
|
|
49
|
+
durationMs: number;
|
|
50
|
+
idempotency?: {
|
|
51
|
+
key: string;
|
|
52
|
+
cacheHit: boolean;
|
|
53
|
+
};
|
|
54
|
+
/** 幂等历史命中时复用已经完成授权与完整性校验的正式资源引用。 */
|
|
55
|
+
cachedAttachments?: readonly RuntimeResourceRef[];
|
|
56
|
+
}
|
|
57
|
+
interface ToolModelInputCapabilityValidatorPort {
|
|
58
|
+
evaluate(input: {
|
|
59
|
+
readonly activeModelId: string;
|
|
60
|
+
readonly requirement: ModelInputRequirement;
|
|
61
|
+
}): ModelInputCompatibility;
|
|
62
|
+
assertCompatible(input: {
|
|
63
|
+
readonly activeModelId: string;
|
|
64
|
+
readonly requirement: ModelInputRequirement;
|
|
65
|
+
}): void;
|
|
66
|
+
}
|
|
67
|
+
type ObservationPreviewMeta = ToolObservationPreviewMeta;
|
|
68
|
+
type ObservationPreviewContext = ToolExecutionContext;
|
|
69
|
+
/**
|
|
70
|
+
* Host 按本次 Agent 调用构建工具 Schema 的最小输入。
|
|
71
|
+
*
|
|
72
|
+
* Linnkit 只规定调用时机并转交通用 invocation;Host 如何验证扩展字段并
|
|
73
|
+
* 派生 concrete tools 的窄动态 Schema 上下文,属于 Host 工具注册表职责。
|
|
74
|
+
*/
|
|
75
|
+
interface ToolSchemaBuildRequest {
|
|
76
|
+
readonly toolNames?: readonly string[];
|
|
77
|
+
readonly invocation: AgentInvocationRequest;
|
|
78
|
+
}
|
|
79
|
+
type ObservationPreviewResult = {
|
|
80
|
+
truncated: false;
|
|
81
|
+
preview: string;
|
|
82
|
+
} | {
|
|
83
|
+
truncated: true;
|
|
84
|
+
preview: string;
|
|
85
|
+
blob_id: string;
|
|
86
|
+
originalChars?: number;
|
|
87
|
+
previewChars?: number;
|
|
88
|
+
originalLines?: number;
|
|
89
|
+
previewLines?: number;
|
|
90
|
+
};
|
|
91
|
+
interface ToolCatalogPort {
|
|
92
|
+
getToolSchemas(input: ToolSchemaBuildRequest): FunctionToolSchema[];
|
|
93
|
+
getToolDefinition(toolName: string): ToolRuntimeDefinition | undefined;
|
|
94
|
+
}
|
|
95
|
+
interface ToolExecutionPort {
|
|
96
|
+
executeTool(toolName: string, args: ToolArgs, context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
97
|
+
}
|
|
98
|
+
interface ObservationPreviewPort {
|
|
99
|
+
/**
|
|
100
|
+
* 执行期 observation 预览/落盘治理。
|
|
101
|
+
*
|
|
102
|
+
* 中文说明:
|
|
103
|
+
* - framework 只把 `maxChars/maxLines` 和工具上下文传给 host;
|
|
104
|
+
* - 完整内容写到本地目录、对象存储还是数据库,由 host 的这个 port 决定;
|
|
105
|
+
* - 如果返回 `blob_id`,host 需要保证对应读取工具使用同一个 store。
|
|
106
|
+
*/
|
|
107
|
+
truncateObservation(params: {
|
|
108
|
+
context: ObservationPreviewContext;
|
|
109
|
+
toolName: string;
|
|
110
|
+
text: string;
|
|
111
|
+
maxChars: number;
|
|
112
|
+
maxLines: number;
|
|
113
|
+
meta?: ObservationPreviewMeta;
|
|
114
|
+
}): Promise<ObservationPreviewResult>;
|
|
115
|
+
}
|
|
116
|
+
interface ToolRuntimePort extends ToolCatalogPort, ToolExecutionPort {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type { ObservationPreviewContext, ObservationPreviewMeta, ObservationPreviewPort, ObservationPreviewResult, ToolCatalogPort, ToolExecutionPort, ToolExecutionResult, ToolModelInputCapabilityValidatorPort, ToolRuntimeDefinition, ToolRuntimePort, ToolSchemaBuildRequest };
|