@linnlabs/linnkit 0.32.0 → 0.32.2
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 +20 -0
- package/dist/cli.cjs +35 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +35 -14
- package/dist/cli.js.map +1 -1
- 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} +7 -7
- package/dist/{audit-XsNMTt0-.d.ts → contracts/audit.d.ts} +7 -7
- 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-B0_kx5_U.d.cts → contracts/events.d.cts} +422 -425
- package/dist/{final-answer-oOQ_7nPt.d.ts → contracts/events.d.ts} +422 -425
- package/dist/{execution-B7e01ZjW.d.cts → contracts/execution.d.cts} +13 -13
- package/dist/{execution-B7e01ZjW.d.ts → contracts/execution.d.ts} +13 -13
- 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} +11 -758
- package/dist/{provider-continuation-CTZdCB--.d.ts → contracts/messages.d.ts} +11 -758
- 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} +455 -811
- package/dist/{index-JYf6n2Ik.d.cts → contracts/sse.d.ts} +455 -811
- 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.cjs +35 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -77
- package/dist/index.d.ts +14 -77
- package/dist/index.js +35 -14
- package/dist/index.js.map +1 -1
- 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.cjs +35 -14
- package/dist/quickstart.cjs.map +1 -1
- package/dist/quickstart.d.cts +5 -23
- package/dist/quickstart.d.ts +5 -23
- package/dist/quickstart.js +35 -14
- package/dist/quickstart.js.map +1 -1
- 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} +33 -32
- package/dist/{agentEvents-DhXdKeXD.d.ts → runtime-kernel/events/agentEvents.d.ts} +33 -32
- 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.cjs +35 -14
- package/dist/runtime-kernel.cjs.map +1 -1
- package/dist/runtime-kernel.d.cts +106 -20
- package/dist/runtime-kernel.d.ts +106 -20
- package/dist/runtime-kernel.js +35 -14
- package/dist/runtime-kernel.js.map +1 -1
- 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.cjs +35 -14
- package/dist/testkit.cjs.map +1 -1
- package/dist/testkit.d.cts +17 -277
- package/dist/testkit.d.ts +17 -277
- package/dist/testkit.js +35 -14
- package/dist/testkit.js.map +1 -1
- 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,59 @@
|
|
|
1
|
+
import { LlmCaller } from '../llm/caller.cjs';
|
|
2
|
+
import { ModelCatalogLike } from '../llm/modelCatalog.cjs';
|
|
3
|
+
import { ModelResolverLike } from '../llm/modelResolver.cjs';
|
|
4
|
+
import { TelemetryPort } from '../telemetry/telemetryPort.cjs';
|
|
5
|
+
import { TokenRoute } from '../../contracts/token-usage.cjs';
|
|
6
|
+
import { AuditPort } from '../../ports/audit.cjs';
|
|
7
|
+
import { TokenCounterPort } from '../../ports/token-counter.cjs';
|
|
8
|
+
import { TokenizerPort } from '../../ports/tokenizer.cjs';
|
|
9
|
+
import { ToolCatalogPort } from '../tools/ports.cjs';
|
|
10
|
+
import { GraphExecutorContextBuilder } from './executorContextBuilder.cjs';
|
|
11
|
+
import { TickInput, TickEvent, TickOutput } from './tick-pipeline/types.cjs';
|
|
12
|
+
export { AgentStepDecision } from './tick-pipeline/types.cjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @file src/agent/runtime-kernel/graph-engine/executor.ts
|
|
16
|
+
*
|
|
17
|
+
* @brief 图执行引擎的单步推理执行器
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface GraphAgentExecutorOptions {
|
|
21
|
+
cloudQuotaFallbackModelId?: string;
|
|
22
|
+
modelCatalog?: ModelCatalogLike;
|
|
23
|
+
modelResolver?: Pick<ModelResolverLike, 'resolveModelId'>;
|
|
24
|
+
}
|
|
25
|
+
type GraphAgentExecutorToolRuntime = Pick<ToolCatalogPort, 'getToolSchemas' | 'getToolDefinition'>;
|
|
26
|
+
interface GraphAgentExecutorLlmCaller extends Pick<LlmCaller, 'callWithRetries'>, Partial<Pick<LlmCaller, 'call'>> {
|
|
27
|
+
}
|
|
28
|
+
interface GraphAgentExecutorDependencies extends GraphAgentExecutorOptions {
|
|
29
|
+
llmCaller: GraphAgentExecutorLlmCaller;
|
|
30
|
+
toolRuntime: GraphAgentExecutorToolRuntime;
|
|
31
|
+
contextBuilder: GraphExecutorContextBuilder;
|
|
32
|
+
/**
|
|
33
|
+
* 可选:宿主提供的 TelemetryPort 实现。
|
|
34
|
+
* 不传时使用 noopTelemetry(保持当前行为:observability 默认关闭,零业务影响)。
|
|
35
|
+
*/
|
|
36
|
+
telemetryPort?: TelemetryPort;
|
|
37
|
+
auditPort?: AuditPort;
|
|
38
|
+
tokenizer?: TokenizerPort;
|
|
39
|
+
tokenCounter?: TokenCounterPort;
|
|
40
|
+
resolveTokenRoute?: (modelId: string) => TokenRoute | undefined;
|
|
41
|
+
}
|
|
42
|
+
declare class GraphAgentExecutor {
|
|
43
|
+
private readonly llmCaller;
|
|
44
|
+
private readonly toolRuntime;
|
|
45
|
+
private readonly contextBuilder;
|
|
46
|
+
private readonly cloudQuotaFallbackModelId?;
|
|
47
|
+
private readonly modelResolver;
|
|
48
|
+
private readonly modelCatalog;
|
|
49
|
+
private readonly telemetryPort;
|
|
50
|
+
private readonly auditPort;
|
|
51
|
+
private readonly tokenizer;
|
|
52
|
+
private readonly stages;
|
|
53
|
+
private readonly middlewares;
|
|
54
|
+
constructor(dependencies: GraphAgentExecutorDependencies);
|
|
55
|
+
tick(input: TickInput, eventHandler?: (event: TickEvent) => void): Promise<TickOutput>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { GraphAgentExecutor, TickEvent, TickInput, TickOutput };
|
|
59
|
+
export type { GraphAgentExecutorDependencies, GraphAgentExecutorLlmCaller, GraphAgentExecutorOptions, GraphAgentExecutorToolRuntime };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { LlmCaller } from '../llm/caller.js';
|
|
2
|
+
import { ModelCatalogLike } from '../llm/modelCatalog.js';
|
|
3
|
+
import { ModelResolverLike } from '../llm/modelResolver.js';
|
|
4
|
+
import { TelemetryPort } from '../telemetry/telemetryPort.js';
|
|
5
|
+
import { TokenRoute } from '../../contracts/token-usage.js';
|
|
6
|
+
import { AuditPort } from '../../ports/audit.js';
|
|
7
|
+
import { TokenCounterPort } from '../../ports/token-counter.js';
|
|
8
|
+
import { TokenizerPort } from '../../ports/tokenizer.js';
|
|
9
|
+
import { ToolCatalogPort } from '../tools/ports.js';
|
|
10
|
+
import { GraphExecutorContextBuilder } from './executorContextBuilder.js';
|
|
11
|
+
import { TickInput, TickEvent, TickOutput } from './tick-pipeline/types.js';
|
|
12
|
+
export { AgentStepDecision } from './tick-pipeline/types.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @file src/agent/runtime-kernel/graph-engine/executor.ts
|
|
16
|
+
*
|
|
17
|
+
* @brief 图执行引擎的单步推理执行器
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface GraphAgentExecutorOptions {
|
|
21
|
+
cloudQuotaFallbackModelId?: string;
|
|
22
|
+
modelCatalog?: ModelCatalogLike;
|
|
23
|
+
modelResolver?: Pick<ModelResolverLike, 'resolveModelId'>;
|
|
24
|
+
}
|
|
25
|
+
type GraphAgentExecutorToolRuntime = Pick<ToolCatalogPort, 'getToolSchemas' | 'getToolDefinition'>;
|
|
26
|
+
interface GraphAgentExecutorLlmCaller extends Pick<LlmCaller, 'callWithRetries'>, Partial<Pick<LlmCaller, 'call'>> {
|
|
27
|
+
}
|
|
28
|
+
interface GraphAgentExecutorDependencies extends GraphAgentExecutorOptions {
|
|
29
|
+
llmCaller: GraphAgentExecutorLlmCaller;
|
|
30
|
+
toolRuntime: GraphAgentExecutorToolRuntime;
|
|
31
|
+
contextBuilder: GraphExecutorContextBuilder;
|
|
32
|
+
/**
|
|
33
|
+
* 可选:宿主提供的 TelemetryPort 实现。
|
|
34
|
+
* 不传时使用 noopTelemetry(保持当前行为:observability 默认关闭,零业务影响)。
|
|
35
|
+
*/
|
|
36
|
+
telemetryPort?: TelemetryPort;
|
|
37
|
+
auditPort?: AuditPort;
|
|
38
|
+
tokenizer?: TokenizerPort;
|
|
39
|
+
tokenCounter?: TokenCounterPort;
|
|
40
|
+
resolveTokenRoute?: (modelId: string) => TokenRoute | undefined;
|
|
41
|
+
}
|
|
42
|
+
declare class GraphAgentExecutor {
|
|
43
|
+
private readonly llmCaller;
|
|
44
|
+
private readonly toolRuntime;
|
|
45
|
+
private readonly contextBuilder;
|
|
46
|
+
private readonly cloudQuotaFallbackModelId?;
|
|
47
|
+
private readonly modelResolver;
|
|
48
|
+
private readonly modelCatalog;
|
|
49
|
+
private readonly telemetryPort;
|
|
50
|
+
private readonly auditPort;
|
|
51
|
+
private readonly tokenizer;
|
|
52
|
+
private readonly stages;
|
|
53
|
+
private readonly middlewares;
|
|
54
|
+
constructor(dependencies: GraphAgentExecutorDependencies);
|
|
55
|
+
tick(input: TickInput, eventHandler?: (event: TickEvent) => void): Promise<TickOutput>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { GraphAgentExecutor, TickEvent, TickInput, TickOutput };
|
|
59
|
+
export type { GraphAgentExecutorDependencies, GraphAgentExecutorLlmCaller, GraphAgentExecutorOptions, GraphAgentExecutorToolRuntime };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AgentInvocationRequest } from '../../ports/agent-invocation.cjs';
|
|
2
|
+
import { CanonicalInferenceCachePolicy } from '../../ports/canonical-inference.cjs';
|
|
3
|
+
import { ContextCompactionCandidate, ResolvedContextCompactionPolicy, ContextCompactionPlan } from '../../contracts/contextCompaction.cjs';
|
|
4
|
+
import { RuntimeEvent, HistorySummaryEvent } from '../../contracts/events.cjs';
|
|
5
|
+
import { PromptUsageMeasurementPolicy } from '../../contracts/token-usage.cjs';
|
|
6
|
+
import { ContextTokenComponent, ContextComponentTokenLedgerEntry } from '../../contracts/token-accounting.cjs';
|
|
7
|
+
import { ContextBuildTokenEstimate } from '../../contracts/token-calibration.cjs';
|
|
8
|
+
import { LlmRequestMessage } from '../../ports/llm-call.cjs';
|
|
9
|
+
import { ImageInputAdmissionEvidence } from '../../ports/llm-input-materialization.cjs';
|
|
10
|
+
import { EffectivePromptBudget } from '../../shared/prompt-budget.cjs';
|
|
11
|
+
|
|
12
|
+
interface GraphExecutorOutputProcessor {
|
|
13
|
+
/**
|
|
14
|
+
* 中文备注:outputProcessor 来自 host task 实例,方法可能依赖 `this`。
|
|
15
|
+
* runtime-kernel 调用时必须保留对象接收者,不要拆成裸函数传递。
|
|
16
|
+
*/
|
|
17
|
+
processResponse?(this: GraphExecutorOutputProcessor, rawResponse: string): string;
|
|
18
|
+
processStreamChunk?(this: GraphExecutorOutputProcessor, chunk: string): string;
|
|
19
|
+
}
|
|
20
|
+
interface GraphExecutorContextBuildInput {
|
|
21
|
+
request: AgentInvocationRequest;
|
|
22
|
+
history: RuntimeEvent[];
|
|
23
|
+
modelId: string;
|
|
24
|
+
/** `prepare_call` 对最终 tools/control 的本地估算,Context Builder 必须先从输入预算扣除。 */
|
|
25
|
+
toolDefinitionTokens: number;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
interface GraphExecutorContextBuildOutput {
|
|
29
|
+
llmMessages: LlmRequestMessage[];
|
|
30
|
+
/** 当前正式主 Prompt 的稳定前缀锚点;由 Host 根据消息语义标注。 */
|
|
31
|
+
cachePolicy?: CanonicalInferenceCachePolicy;
|
|
32
|
+
/** 模型 route、Agent policy 与 prepared tools 合并后的单一预算事实。 */
|
|
33
|
+
promptBudget?: EffectivePromptBudget;
|
|
34
|
+
/** reminder 后最终 Prompt 计数必须遵守的 route、remote count 与 calibration 策略。 */
|
|
35
|
+
promptUsageMeasurementPolicy?: PromptUsageMeasurementPolicy;
|
|
36
|
+
/** Context Manager 产出的短生命周期图片预算证据;不得写入 checkpoint 或 provider options。 */
|
|
37
|
+
imageInputAdmissionEvidence?: ImageInputAdmissionEvidence;
|
|
38
|
+
/** 最终 Prompt 达阈值时,Graph 可消费的纯压缩计划。 */
|
|
39
|
+
contextCompactionCandidate?: GraphContextCompactionCandidate;
|
|
40
|
+
/** 即使当前没有可替换区段,Graph 仍需知道策略以正确结算硬超限。 */
|
|
41
|
+
contextCompactionPolicy?: ResolvedContextCompactionPolicy;
|
|
42
|
+
/**
|
|
43
|
+
* Host 注入的输出文本处理器。
|
|
44
|
+
*
|
|
45
|
+
* 中文备注:
|
|
46
|
+
* - runtime-kernel 只知道“把模型输出字符串交给一个可选函数处理”;
|
|
47
|
+
* - 具体规则仍由 host 的 agent/task 定义提供,避免 framework 反向识别 promptKey 或产品语义。
|
|
48
|
+
*/
|
|
49
|
+
outputProcessor?: GraphExecutorOutputProcessor;
|
|
50
|
+
/**
|
|
51
|
+
* 上下文构建旁路 trace。
|
|
52
|
+
*
|
|
53
|
+
* 中文备注:runtime-kernel 只负责透传,不理解 context-manager 的具体 trace 类型,
|
|
54
|
+
* 避免 graph-engine 反向依赖 context-manager。
|
|
55
|
+
*/
|
|
56
|
+
contextTrace?: unknown;
|
|
57
|
+
/**
|
|
58
|
+
* 构建期 token 估算快照。
|
|
59
|
+
*
|
|
60
|
+
* 中文备注:runtime-kernel 只透传稳定 DTO;它不解析 context-manager 内部 trace,
|
|
61
|
+
* 也不把 provider remote count 当成本地估算样本来源。
|
|
62
|
+
*/
|
|
63
|
+
tokenEstimate?: ContextBuildTokenEstimate;
|
|
64
|
+
/**
|
|
65
|
+
* 构建期上下文分项 token 估算。
|
|
66
|
+
*
|
|
67
|
+
* 中文备注:context-manager 只产稳定 DTO,runtime-kernel 在带 run/turn scope 的地方
|
|
68
|
+
* 再创建账本条目,避免反向读取 ContextTrace 内部结构。
|
|
69
|
+
*/
|
|
70
|
+
tokenComponents?: ContextTokenComponent[];
|
|
71
|
+
tokenLedgerEntry?: ContextComponentTokenLedgerEntry;
|
|
72
|
+
}
|
|
73
|
+
type GraphContextCompactionCandidate = ContextCompactionCandidate;
|
|
74
|
+
interface GraphExecutorContextApplyInput extends GraphExecutorContextBuildInput {
|
|
75
|
+
plan: ContextCompactionPlan;
|
|
76
|
+
checkpointContent: string;
|
|
77
|
+
summaryId: string;
|
|
78
|
+
conversationId: string;
|
|
79
|
+
turnId: string;
|
|
80
|
+
timestamp: number;
|
|
81
|
+
maxOutputTokens: number;
|
|
82
|
+
}
|
|
83
|
+
type GraphExecutorContextApplyOutput = {
|
|
84
|
+
kind: 'ready';
|
|
85
|
+
rebuiltContext: GraphExecutorContextBuildOutput;
|
|
86
|
+
pendingSummaryEvent: HistorySummaryEvent;
|
|
87
|
+
compressionRatio: number;
|
|
88
|
+
summaryTokenEstimate: number;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'invalid';
|
|
91
|
+
reason: string;
|
|
92
|
+
tokenEstimate?: number;
|
|
93
|
+
messageId?: string;
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'ineffective';
|
|
96
|
+
compressionRatio: number;
|
|
97
|
+
summaryTokenEstimate: number;
|
|
98
|
+
};
|
|
99
|
+
interface GraphExecutorContextBuilder {
|
|
100
|
+
build(input: GraphExecutorContextBuildInput): Promise<GraphExecutorContextBuildOutput>;
|
|
101
|
+
applyCompaction?(input: GraphExecutorContextApplyInput): Promise<GraphExecutorContextApplyOutput>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type { GraphContextCompactionCandidate, GraphExecutorContextApplyInput, GraphExecutorContextApplyOutput, GraphExecutorContextBuildInput, GraphExecutorContextBuildOutput, GraphExecutorContextBuilder, GraphExecutorOutputProcessor };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AgentInvocationRequest } from '../../ports/agent-invocation.js';
|
|
2
|
+
import { CanonicalInferenceCachePolicy } from '../../ports/canonical-inference.js';
|
|
3
|
+
import { ContextCompactionCandidate, ResolvedContextCompactionPolicy, ContextCompactionPlan } from '../../contracts/contextCompaction.js';
|
|
4
|
+
import { RuntimeEvent, HistorySummaryEvent } from '../../contracts/events.js';
|
|
5
|
+
import { PromptUsageMeasurementPolicy } from '../../contracts/token-usage.js';
|
|
6
|
+
import { ContextTokenComponent, ContextComponentTokenLedgerEntry } from '../../contracts/token-accounting.js';
|
|
7
|
+
import { ContextBuildTokenEstimate } from '../../contracts/token-calibration.js';
|
|
8
|
+
import { LlmRequestMessage } from '../../ports/llm-call.js';
|
|
9
|
+
import { ImageInputAdmissionEvidence } from '../../ports/llm-input-materialization.js';
|
|
10
|
+
import { EffectivePromptBudget } from '../../shared/prompt-budget.js';
|
|
11
|
+
|
|
12
|
+
interface GraphExecutorOutputProcessor {
|
|
13
|
+
/**
|
|
14
|
+
* 中文备注:outputProcessor 来自 host task 实例,方法可能依赖 `this`。
|
|
15
|
+
* runtime-kernel 调用时必须保留对象接收者,不要拆成裸函数传递。
|
|
16
|
+
*/
|
|
17
|
+
processResponse?(this: GraphExecutorOutputProcessor, rawResponse: string): string;
|
|
18
|
+
processStreamChunk?(this: GraphExecutorOutputProcessor, chunk: string): string;
|
|
19
|
+
}
|
|
20
|
+
interface GraphExecutorContextBuildInput {
|
|
21
|
+
request: AgentInvocationRequest;
|
|
22
|
+
history: RuntimeEvent[];
|
|
23
|
+
modelId: string;
|
|
24
|
+
/** `prepare_call` 对最终 tools/control 的本地估算,Context Builder 必须先从输入预算扣除。 */
|
|
25
|
+
toolDefinitionTokens: number;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
interface GraphExecutorContextBuildOutput {
|
|
29
|
+
llmMessages: LlmRequestMessage[];
|
|
30
|
+
/** 当前正式主 Prompt 的稳定前缀锚点;由 Host 根据消息语义标注。 */
|
|
31
|
+
cachePolicy?: CanonicalInferenceCachePolicy;
|
|
32
|
+
/** 模型 route、Agent policy 与 prepared tools 合并后的单一预算事实。 */
|
|
33
|
+
promptBudget?: EffectivePromptBudget;
|
|
34
|
+
/** reminder 后最终 Prompt 计数必须遵守的 route、remote count 与 calibration 策略。 */
|
|
35
|
+
promptUsageMeasurementPolicy?: PromptUsageMeasurementPolicy;
|
|
36
|
+
/** Context Manager 产出的短生命周期图片预算证据;不得写入 checkpoint 或 provider options。 */
|
|
37
|
+
imageInputAdmissionEvidence?: ImageInputAdmissionEvidence;
|
|
38
|
+
/** 最终 Prompt 达阈值时,Graph 可消费的纯压缩计划。 */
|
|
39
|
+
contextCompactionCandidate?: GraphContextCompactionCandidate;
|
|
40
|
+
/** 即使当前没有可替换区段,Graph 仍需知道策略以正确结算硬超限。 */
|
|
41
|
+
contextCompactionPolicy?: ResolvedContextCompactionPolicy;
|
|
42
|
+
/**
|
|
43
|
+
* Host 注入的输出文本处理器。
|
|
44
|
+
*
|
|
45
|
+
* 中文备注:
|
|
46
|
+
* - runtime-kernel 只知道“把模型输出字符串交给一个可选函数处理”;
|
|
47
|
+
* - 具体规则仍由 host 的 agent/task 定义提供,避免 framework 反向识别 promptKey 或产品语义。
|
|
48
|
+
*/
|
|
49
|
+
outputProcessor?: GraphExecutorOutputProcessor;
|
|
50
|
+
/**
|
|
51
|
+
* 上下文构建旁路 trace。
|
|
52
|
+
*
|
|
53
|
+
* 中文备注:runtime-kernel 只负责透传,不理解 context-manager 的具体 trace 类型,
|
|
54
|
+
* 避免 graph-engine 反向依赖 context-manager。
|
|
55
|
+
*/
|
|
56
|
+
contextTrace?: unknown;
|
|
57
|
+
/**
|
|
58
|
+
* 构建期 token 估算快照。
|
|
59
|
+
*
|
|
60
|
+
* 中文备注:runtime-kernel 只透传稳定 DTO;它不解析 context-manager 内部 trace,
|
|
61
|
+
* 也不把 provider remote count 当成本地估算样本来源。
|
|
62
|
+
*/
|
|
63
|
+
tokenEstimate?: ContextBuildTokenEstimate;
|
|
64
|
+
/**
|
|
65
|
+
* 构建期上下文分项 token 估算。
|
|
66
|
+
*
|
|
67
|
+
* 中文备注:context-manager 只产稳定 DTO,runtime-kernel 在带 run/turn scope 的地方
|
|
68
|
+
* 再创建账本条目,避免反向读取 ContextTrace 内部结构。
|
|
69
|
+
*/
|
|
70
|
+
tokenComponents?: ContextTokenComponent[];
|
|
71
|
+
tokenLedgerEntry?: ContextComponentTokenLedgerEntry;
|
|
72
|
+
}
|
|
73
|
+
type GraphContextCompactionCandidate = ContextCompactionCandidate;
|
|
74
|
+
interface GraphExecutorContextApplyInput extends GraphExecutorContextBuildInput {
|
|
75
|
+
plan: ContextCompactionPlan;
|
|
76
|
+
checkpointContent: string;
|
|
77
|
+
summaryId: string;
|
|
78
|
+
conversationId: string;
|
|
79
|
+
turnId: string;
|
|
80
|
+
timestamp: number;
|
|
81
|
+
maxOutputTokens: number;
|
|
82
|
+
}
|
|
83
|
+
type GraphExecutorContextApplyOutput = {
|
|
84
|
+
kind: 'ready';
|
|
85
|
+
rebuiltContext: GraphExecutorContextBuildOutput;
|
|
86
|
+
pendingSummaryEvent: HistorySummaryEvent;
|
|
87
|
+
compressionRatio: number;
|
|
88
|
+
summaryTokenEstimate: number;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'invalid';
|
|
91
|
+
reason: string;
|
|
92
|
+
tokenEstimate?: number;
|
|
93
|
+
messageId?: string;
|
|
94
|
+
} | {
|
|
95
|
+
kind: 'ineffective';
|
|
96
|
+
compressionRatio: number;
|
|
97
|
+
summaryTokenEstimate: number;
|
|
98
|
+
};
|
|
99
|
+
interface GraphExecutorContextBuilder {
|
|
100
|
+
build(input: GraphExecutorContextBuildInput): Promise<GraphExecutorContextBuildOutput>;
|
|
101
|
+
applyCompaction?(input: GraphExecutorContextApplyInput): Promise<GraphExecutorContextApplyOutput>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type { GraphContextCompactionCandidate, GraphExecutorContextApplyInput, GraphExecutorContextApplyOutput, GraphExecutorContextBuildInput, GraphExecutorContextBuildOutput, GraphExecutorContextBuilder, GraphExecutorOutputProcessor };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SerializableJsonRecord } from '../../../contracts/json.cjs';
|
|
2
|
+
import { ToolCallDecisionEvent, RuntimeEvent } from '../../../contracts/events.cjs';
|
|
3
|
+
import { StandardToolCall, ToolBatchCompletionMode } from '../types.cjs';
|
|
4
|
+
|
|
5
|
+
interface HostToolCallBootstrapInput {
|
|
6
|
+
readonly eventId: string;
|
|
7
|
+
readonly conversationId: string;
|
|
8
|
+
readonly turnId: string;
|
|
9
|
+
readonly toolName: string;
|
|
10
|
+
readonly toolCallId: string;
|
|
11
|
+
readonly args: SerializableJsonRecord;
|
|
12
|
+
readonly history?: readonly RuntimeEvent[];
|
|
13
|
+
readonly timestamp?: number;
|
|
14
|
+
readonly metadata?: SerializableJsonRecord;
|
|
15
|
+
readonly decisionMeta?: SerializableJsonRecord;
|
|
16
|
+
readonly parentToolCallId?: string;
|
|
17
|
+
/** 工具批次完成后继续交还 LLM,或直接把执行权交还 Host。 */
|
|
18
|
+
readonly completionMode?: ToolBatchCompletionMode;
|
|
19
|
+
}
|
|
20
|
+
interface HostToolCallBootstrapLocalPatch {
|
|
21
|
+
readonly conversationId: string;
|
|
22
|
+
readonly turnId: string;
|
|
23
|
+
readonly history: RuntimeEvent[];
|
|
24
|
+
readonly pendingToolCalls: StandardToolCall[];
|
|
25
|
+
readonly toolBatchCompletionMode?: ToolBatchCompletionMode;
|
|
26
|
+
}
|
|
27
|
+
interface HostToolCallBootstrap {
|
|
28
|
+
readonly nodeId: 'tool';
|
|
29
|
+
readonly toolCall: StandardToolCall;
|
|
30
|
+
readonly decisionEvent: ToolCallDecisionEvent;
|
|
31
|
+
readonly localPatch: HostToolCallBootstrapLocalPatch;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 为 host 主动发起的单次工具调用构造同源 Graph 起点。
|
|
35
|
+
*
|
|
36
|
+
* host 仍负责发布和持久化 decisionEvent,并将其它运行时 local 与 localPatch 合并后 prime GraphExecutor。
|
|
37
|
+
*/
|
|
38
|
+
declare function createHostToolCallBootstrap(input: HostToolCallBootstrapInput): HostToolCallBootstrap;
|
|
39
|
+
|
|
40
|
+
export { createHostToolCallBootstrap };
|
|
41
|
+
export type { HostToolCallBootstrap, HostToolCallBootstrapInput, HostToolCallBootstrapLocalPatch };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SerializableJsonRecord } from '../../../contracts/json.js';
|
|
2
|
+
import { ToolCallDecisionEvent, RuntimeEvent } from '../../../contracts/events.js';
|
|
3
|
+
import { StandardToolCall, ToolBatchCompletionMode } from '../types.js';
|
|
4
|
+
|
|
5
|
+
interface HostToolCallBootstrapInput {
|
|
6
|
+
readonly eventId: string;
|
|
7
|
+
readonly conversationId: string;
|
|
8
|
+
readonly turnId: string;
|
|
9
|
+
readonly toolName: string;
|
|
10
|
+
readonly toolCallId: string;
|
|
11
|
+
readonly args: SerializableJsonRecord;
|
|
12
|
+
readonly history?: readonly RuntimeEvent[];
|
|
13
|
+
readonly timestamp?: number;
|
|
14
|
+
readonly metadata?: SerializableJsonRecord;
|
|
15
|
+
readonly decisionMeta?: SerializableJsonRecord;
|
|
16
|
+
readonly parentToolCallId?: string;
|
|
17
|
+
/** 工具批次完成后继续交还 LLM,或直接把执行权交还 Host。 */
|
|
18
|
+
readonly completionMode?: ToolBatchCompletionMode;
|
|
19
|
+
}
|
|
20
|
+
interface HostToolCallBootstrapLocalPatch {
|
|
21
|
+
readonly conversationId: string;
|
|
22
|
+
readonly turnId: string;
|
|
23
|
+
readonly history: RuntimeEvent[];
|
|
24
|
+
readonly pendingToolCalls: StandardToolCall[];
|
|
25
|
+
readonly toolBatchCompletionMode?: ToolBatchCompletionMode;
|
|
26
|
+
}
|
|
27
|
+
interface HostToolCallBootstrap {
|
|
28
|
+
readonly nodeId: 'tool';
|
|
29
|
+
readonly toolCall: StandardToolCall;
|
|
30
|
+
readonly decisionEvent: ToolCallDecisionEvent;
|
|
31
|
+
readonly localPatch: HostToolCallBootstrapLocalPatch;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 为 host 主动发起的单次工具调用构造同源 Graph 起点。
|
|
35
|
+
*
|
|
36
|
+
* host 仍负责发布和持久化 decisionEvent,并将其它运行时 local 与 localPatch 合并后 prime GraphExecutor。
|
|
37
|
+
*/
|
|
38
|
+
declare function createHostToolCallBootstrap(input: HostToolCallBootstrapInput): HostToolCallBootstrap;
|
|
39
|
+
|
|
40
|
+
export { createHostToolCallBootstrap };
|
|
41
|
+
export type { HostToolCallBootstrap, HostToolCallBootstrapInput, HostToolCallBootstrapLocalPatch };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EngineLocalState } from '../types.cjs';
|
|
2
|
+
|
|
3
|
+
/** checkpoint 上一旦存在 contextUsage,就必须按公共合同严格 admission。 */
|
|
4
|
+
declare function readCheckpointContextUsage(local: EngineLocalState | Record<string, unknown> | undefined): {
|
|
5
|
+
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
6
|
+
basis: "last_completed_llm_prompt";
|
|
7
|
+
budget_model_id: string;
|
|
8
|
+
used_tokens: number;
|
|
9
|
+
components: {
|
|
10
|
+
system_prompt_tokens: number;
|
|
11
|
+
conversation_tokens: number;
|
|
12
|
+
tool_definition_tokens: number;
|
|
13
|
+
};
|
|
14
|
+
component_attribution: "normalized_local_estimate";
|
|
15
|
+
input_budget_tokens: number;
|
|
16
|
+
remaining_tokens: number;
|
|
17
|
+
output_limit_tokens: number;
|
|
18
|
+
confidence: "estimate" | "provider-estimate" | "actual";
|
|
19
|
+
measured_at: number;
|
|
20
|
+
served_model_id?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
|
|
23
|
+
export { readCheckpointContextUsage };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EngineLocalState } from '../types.js';
|
|
2
|
+
|
|
3
|
+
/** checkpoint 上一旦存在 contextUsage,就必须按公共合同严格 admission。 */
|
|
4
|
+
declare function readCheckpointContextUsage(local: EngineLocalState | Record<string, unknown> | undefined): {
|
|
5
|
+
source: "local-estimate" | "provider-preflight-count" | "provider-response-usage" | "host-supplied" | "test-fixture";
|
|
6
|
+
basis: "last_completed_llm_prompt";
|
|
7
|
+
budget_model_id: string;
|
|
8
|
+
used_tokens: number;
|
|
9
|
+
components: {
|
|
10
|
+
system_prompt_tokens: number;
|
|
11
|
+
conversation_tokens: number;
|
|
12
|
+
tool_definition_tokens: number;
|
|
13
|
+
};
|
|
14
|
+
component_attribution: "normalized_local_estimate";
|
|
15
|
+
input_budget_tokens: number;
|
|
16
|
+
remaining_tokens: number;
|
|
17
|
+
output_limit_tokens: number;
|
|
18
|
+
confidence: "estimate" | "provider-estimate" | "actual";
|
|
19
|
+
measured_at: number;
|
|
20
|
+
served_model_id?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
|
|
23
|
+
export { readCheckpointContextUsage };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.cjs';
|
|
2
|
+
|
|
3
|
+
type PrimaryPromptCapacityAdmission = {
|
|
4
|
+
admitted: true;
|
|
5
|
+
} | {
|
|
6
|
+
admitted: false;
|
|
7
|
+
usedTokens: number;
|
|
8
|
+
inputBudgetTokens: number;
|
|
9
|
+
exceededByTokens: number;
|
|
10
|
+
};
|
|
11
|
+
/** Provider 前的主模型 Prompt 容量判定;等于预算仍可提交,只有严格超出才拒绝。 */
|
|
12
|
+
declare function evaluatePrimaryPromptCapacity(snapshot: ContextUsageSnapshot): PrimaryPromptCapacityAdmission;
|
|
13
|
+
|
|
14
|
+
export { evaluatePrimaryPromptCapacity };
|
|
15
|
+
export type { PrimaryPromptCapacityAdmission };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.js';
|
|
2
|
+
|
|
3
|
+
type PrimaryPromptCapacityAdmission = {
|
|
4
|
+
admitted: true;
|
|
5
|
+
} | {
|
|
6
|
+
admitted: false;
|
|
7
|
+
usedTokens: number;
|
|
8
|
+
inputBudgetTokens: number;
|
|
9
|
+
exceededByTokens: number;
|
|
10
|
+
};
|
|
11
|
+
/** Provider 前的主模型 Prompt 容量判定;等于预算仍可提交,只有严格超出才拒绝。 */
|
|
12
|
+
declare function evaluatePrimaryPromptCapacity(snapshot: ContextUsageSnapshot): PrimaryPromptCapacityAdmission;
|
|
13
|
+
|
|
14
|
+
export { evaluatePrimaryPromptCapacity };
|
|
15
|
+
export type { PrimaryPromptCapacityAdmission };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RoutedRuntimeEvent } from '../../../contracts/events.cjs';
|
|
2
|
+
import { RuntimeFailureFact } from '../types.cjs';
|
|
3
|
+
|
|
4
|
+
/** 校验 Runtime error 已具备 lifecycle 结算所需的稳定分类字段。 */
|
|
5
|
+
declare function isRuntimeFailureFact(event: RoutedRuntimeEvent): event is RuntimeFailureFact;
|
|
6
|
+
|
|
7
|
+
export { isRuntimeFailureFact };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RoutedRuntimeEvent } from '../../../contracts/events.js';
|
|
2
|
+
import { RuntimeFailureFact } from '../types.js';
|
|
3
|
+
|
|
4
|
+
/** 校验 Runtime error 已具备 lifecycle 结算所需的稳定分类字段。 */
|
|
5
|
+
declare function isRuntimeFailureFact(event: RoutedRuntimeEvent): event is RuntimeFailureFact;
|
|
6
|
+
|
|
7
|
+
export { isRuntimeFailureFact };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { GraphExecutor } from './engine.cjs';
|
|
2
|
+
export { GraphAgentExecutor, GraphAgentExecutorDependencies } from './executor.cjs';
|
|
3
|
+
export { LlmNode } from './nodes/llmNode.cjs';
|
|
4
|
+
export { ToolNode } from './nodes/toolNode.cjs';
|
|
5
|
+
export { UserNode } from './nodes/userNode.cjs';
|
|
6
|
+
export { WaitUserNode } from './nodes/waitUserNode.cjs';
|
|
7
|
+
export { MemoryCheckpointer } from './checkpointer/memoryCheckpointer.cjs';
|
|
8
|
+
export { CheckpointListFilter, CheckpointMeta, CheckpointSummary, Checkpointer, summarizeCheckpoint } from './checkpointer/base.cjs';
|
|
9
|
+
export { MemoryEventStore } from './event-store/memoryEventStore.cjs';
|
|
10
|
+
export { EventRangeOptions, EventStore, PersistedEvent, createMonotonicEventStoreIdFactory, requireEventStoreId } from './event-store/base.cjs';
|
|
11
|
+
export { HostToolCallBootstrap, HostToolCallBootstrapInput, HostToolCallBootstrapLocalPatch, createHostToolCallBootstrap } from './functions/createHostToolCallBootstrap.cjs';
|
|
12
|
+
export { EffectivePromptBudget, ResolveEffectivePromptBudgetInput, resolveEffectivePromptBudget } from '../../shared/prompt-budget.cjs';
|
|
13
|
+
export { PrimaryPromptCapacityAdmission, evaluatePrimaryPromptCapacity } from './functions/evaluatePrimaryPromptCapacity.cjs';
|
|
14
|
+
export { PRIMARY_PROMPT_CAPACITY_ERROR_CODE, PrimaryPromptCapacityError, PrimaryPromptCapacityErrorMetadata } from './definitions/primaryPromptCapacityError.cjs';
|
|
15
|
+
export { readCheckpointContextUsage } from './functions/engineStateSnapshot.cjs';
|
|
16
|
+
export { isRuntimeFailureFact } from './functions/runtimeFailureFact.cjs';
|
|
17
|
+
export { ENGINE_STATE_SCHEMA_VERSION, EngineState, ExecutorLlmInvocationKind, ExecutorLocalPatch, ExecutorLocalState, GraphNode, RuntimeEventCommitPort, RuntimeEventSink, RuntimeFailureFact, RuntimeFailureFactSink, ToolBatchCompletionMode } from './types.cjs';
|
|
18
|
+
export { GraphContextCompactionCandidate, GraphExecutorContextApplyInput, GraphExecutorContextApplyOutput, GraphExecutorContextBuildInput, GraphExecutorContextBuildOutput, GraphExecutorContextBuilder, GraphExecutorOutputProcessor } from './executorContextBuilder.cjs';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { GraphExecutor } from './engine.js';
|
|
2
|
+
export { GraphAgentExecutor, GraphAgentExecutorDependencies } from './executor.js';
|
|
3
|
+
export { LlmNode } from './nodes/llmNode.js';
|
|
4
|
+
export { ToolNode } from './nodes/toolNode.js';
|
|
5
|
+
export { UserNode } from './nodes/userNode.js';
|
|
6
|
+
export { WaitUserNode } from './nodes/waitUserNode.js';
|
|
7
|
+
export { MemoryCheckpointer } from './checkpointer/memoryCheckpointer.js';
|
|
8
|
+
export { CheckpointListFilter, CheckpointMeta, CheckpointSummary, Checkpointer, summarizeCheckpoint } from './checkpointer/base.js';
|
|
9
|
+
export { MemoryEventStore } from './event-store/memoryEventStore.js';
|
|
10
|
+
export { EventRangeOptions, EventStore, PersistedEvent, createMonotonicEventStoreIdFactory, requireEventStoreId } from './event-store/base.js';
|
|
11
|
+
export { HostToolCallBootstrap, HostToolCallBootstrapInput, HostToolCallBootstrapLocalPatch, createHostToolCallBootstrap } from './functions/createHostToolCallBootstrap.js';
|
|
12
|
+
export { EffectivePromptBudget, ResolveEffectivePromptBudgetInput, resolveEffectivePromptBudget } from '../../shared/prompt-budget.js';
|
|
13
|
+
export { PrimaryPromptCapacityAdmission, evaluatePrimaryPromptCapacity } from './functions/evaluatePrimaryPromptCapacity.js';
|
|
14
|
+
export { PRIMARY_PROMPT_CAPACITY_ERROR_CODE, PrimaryPromptCapacityError, PrimaryPromptCapacityErrorMetadata } from './definitions/primaryPromptCapacityError.js';
|
|
15
|
+
export { readCheckpointContextUsage } from './functions/engineStateSnapshot.js';
|
|
16
|
+
export { isRuntimeFailureFact } from './functions/runtimeFailureFact.js';
|
|
17
|
+
export { ENGINE_STATE_SCHEMA_VERSION, EngineState, ExecutorLlmInvocationKind, ExecutorLocalPatch, ExecutorLocalState, GraphNode, RuntimeEventCommitPort, RuntimeEventSink, RuntimeFailureFact, RuntimeFailureFactSink, ToolBatchCompletionMode } from './types.js';
|
|
18
|
+
export { GraphContextCompactionCandidate, GraphExecutorContextApplyInput, GraphExecutorContextApplyOutput, GraphExecutorContextBuildInput, GraphExecutorContextBuildOutput, GraphExecutorContextBuilder, GraphExecutorOutputProcessor } from './executorContextBuilder.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GraphNode, EngineState, NodeResult } from '../types.cjs';
|
|
2
|
+
import { TickInput, TickOutput } from '../tick-pipeline/types.cjs';
|
|
3
|
+
import { TickEvent } from './llmNode.eventBridge.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LlmNode 只依赖"单步推理"能力,不直接依赖具体执行器实现。
|
|
7
|
+
*
|
|
8
|
+
* 中文备注:
|
|
9
|
+
* - 这样节点本身只关注图节点职责,不负责组装 `LlmCaller` / `ToolRegistry`;
|
|
10
|
+
* - 默认依赖装配放到工厂里,方便测试替换,也降低构造函数耦合。
|
|
11
|
+
*/
|
|
12
|
+
interface LlmNodeReasoner {
|
|
13
|
+
tick(input: TickInput, eventHandler?: (event: TickEvent) => void): Promise<TickOutput>;
|
|
14
|
+
}
|
|
15
|
+
interface LlmNodeDependencies {
|
|
16
|
+
reasoner: LlmNodeReasoner;
|
|
17
|
+
}
|
|
18
|
+
declare class LlmNode implements GraphNode {
|
|
19
|
+
id: string;
|
|
20
|
+
private readonly reasoner;
|
|
21
|
+
constructor(dependencies: LlmNodeDependencies);
|
|
22
|
+
run(state: EngineState): Promise<NodeResult>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { LlmNode };
|
|
26
|
+
export type { LlmNodeDependencies, LlmNodeReasoner };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { GraphNode, EngineState, NodeResult } from '../types.js';
|
|
2
|
+
import { TickInput, TickOutput } from '../tick-pipeline/types.js';
|
|
3
|
+
import { TickEvent } from './llmNode.eventBridge.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LlmNode 只依赖"单步推理"能力,不直接依赖具体执行器实现。
|
|
7
|
+
*
|
|
8
|
+
* 中文备注:
|
|
9
|
+
* - 这样节点本身只关注图节点职责,不负责组装 `LlmCaller` / `ToolRegistry`;
|
|
10
|
+
* - 默认依赖装配放到工厂里,方便测试替换,也降低构造函数耦合。
|
|
11
|
+
*/
|
|
12
|
+
interface LlmNodeReasoner {
|
|
13
|
+
tick(input: TickInput, eventHandler?: (event: TickEvent) => void): Promise<TickOutput>;
|
|
14
|
+
}
|
|
15
|
+
interface LlmNodeDependencies {
|
|
16
|
+
reasoner: LlmNodeReasoner;
|
|
17
|
+
}
|
|
18
|
+
declare class LlmNode implements GraphNode {
|
|
19
|
+
id: string;
|
|
20
|
+
private readonly reasoner;
|
|
21
|
+
constructor(dependencies: LlmNodeDependencies);
|
|
22
|
+
run(state: EngineState): Promise<NodeResult>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { LlmNode };
|
|
26
|
+
export type { LlmNodeDependencies, LlmNodeReasoner };
|