@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
package/dist/testkit.d.ts
CHANGED
|
@@ -1,277 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import './execution-B7e01ZjW.js';
|
|
19
|
-
|
|
20
|
-
type ScriptedLlmCaller = LlmCaller;
|
|
21
|
-
interface ScriptedLlmCall {
|
|
22
|
-
readonly request: CanonicalInferenceRequest;
|
|
23
|
-
readonly modelId: string;
|
|
24
|
-
readonly messages: CanonicalInferenceRequest['messages'];
|
|
25
|
-
readonly options: LlmCallOptions;
|
|
26
|
-
}
|
|
27
|
-
interface ScriptedToolCall {
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
argumentsJson: string;
|
|
31
|
-
index?: number;
|
|
32
|
-
continuations?: ProviderContinuation[];
|
|
33
|
-
}
|
|
34
|
-
interface ScriptedLlmTurn {
|
|
35
|
-
thoughtDeltas?: string[];
|
|
36
|
-
contentChunks?: string[];
|
|
37
|
-
toolCalls?: ScriptedToolCall[];
|
|
38
|
-
textContinuations?: ProviderContinuation[];
|
|
39
|
-
reasoningContinuations?: ProviderContinuation[];
|
|
40
|
-
canonicalUsage?: CanonicalLlmUsage;
|
|
41
|
-
finishReason?: CanonicalInferenceFinishReason;
|
|
42
|
-
failure?: {
|
|
43
|
-
kind: 'aborted' | 'transport' | 'provider' | 'protocol';
|
|
44
|
-
code: string;
|
|
45
|
-
retryable: boolean;
|
|
46
|
-
};
|
|
47
|
-
throwAfterEvents?: string | Error;
|
|
48
|
-
assertCall?: (call: ScriptedLlmCall) => void;
|
|
49
|
-
}
|
|
50
|
-
interface ScriptedInferenceHarness {
|
|
51
|
-
getCalls(): ScriptedLlmCall[];
|
|
52
|
-
getConsumedTurnCount(): number;
|
|
53
|
-
getLlmCaller(): ScriptedLlmCaller;
|
|
54
|
-
assertAllTurnsConsumed(): void;
|
|
55
|
-
}
|
|
56
|
-
interface ScriptedInferenceHarnessOptions {
|
|
57
|
-
modelCatalog?: ModelCatalogLike;
|
|
58
|
-
llmInputMaterializer?: LlmInputMaterializerPort;
|
|
59
|
-
}
|
|
60
|
-
declare function createScriptedInferenceHarness(turns: ScriptedLlmTurn[], options?: ScriptedInferenceHarnessOptions): ScriptedInferenceHarness;
|
|
61
|
-
|
|
62
|
-
declare function expectMessagesContainToolResult(call: ScriptedLlmCall, expectedText: string): void;
|
|
63
|
-
declare function expectToolOutputFedBackToHistory(call: ScriptedLlmCall, expectedText: string): void;
|
|
64
|
-
declare function expectFinalStepForcedTools(call: ScriptedLlmCall, forcedToolName: string): void;
|
|
65
|
-
declare function expectRunEndedWithFinalAnswer(events: RuntimeEvent[], expectedText: string): void;
|
|
66
|
-
declare function expectMessagesContainText(call: ScriptedLlmCall, expectedText: string): void;
|
|
67
|
-
|
|
68
|
-
declare const assertions_expectFinalStepForcedTools: typeof expectFinalStepForcedTools;
|
|
69
|
-
declare const assertions_expectMessagesContainText: typeof expectMessagesContainText;
|
|
70
|
-
declare const assertions_expectMessagesContainToolResult: typeof expectMessagesContainToolResult;
|
|
71
|
-
declare const assertions_expectRunEndedWithFinalAnswer: typeof expectRunEndedWithFinalAnswer;
|
|
72
|
-
declare const assertions_expectToolOutputFedBackToHistory: typeof expectToolOutputFedBackToHistory;
|
|
73
|
-
declare namespace assertions {
|
|
74
|
-
export { assertions_expectFinalStepForcedTools as expectFinalStepForcedTools, assertions_expectMessagesContainText as expectMessagesContainText, assertions_expectMessagesContainToolResult as expectMessagesContainToolResult, assertions_expectRunEndedWithFinalAnswer as expectRunEndedWithFinalAnswer, assertions_expectToolOutputFedBackToHistory as expectToolOutputFedBackToHistory };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 中文备注:
|
|
79
|
-
* - ReplayHarness 负责把“持久化事实事件 -> LLM 回放消息”这个协议边界显式化;
|
|
80
|
-
* - 测试不再直接散落调用 eventConverter,而是通过统一夹具观察回放结果;
|
|
81
|
-
* - 这样后续如果回放语义升级,测试入口可以保持稳定。
|
|
82
|
-
*/
|
|
83
|
-
interface ReplayHarness {
|
|
84
|
-
replay(): AiMessage[];
|
|
85
|
-
getAssistantToolCallMessages(): AiMessage[];
|
|
86
|
-
getToolOutputMessages(): AiMessage[];
|
|
87
|
-
}
|
|
88
|
-
declare function createReplayHarness(events: RuntimeEvent[]): ReplayHarness;
|
|
89
|
-
|
|
90
|
-
type ContextPolicyInvariantId = 'C1_TRACE_ENABLED_MATCHES_POLICY' | 'C2_EFFECTIVE_POLICY_MATCHES_EXPECTED' | 'C3_TRACE_OPTIONS_MATCH_POLICY' | 'C4_TRACE_EVENT_LIMIT' | 'C5_FINAL_COUNTS_MATCH_MESSAGES' | 'C6_FINAL_TOKENS_WITHIN_BUDGET' | 'C7_PROVIDER_TOKEN_DELTA' | 'C8_TRACE_DETAIL_OPTIONS' | 'C9_MESSAGE_DECISION_REASON' | 'C10_TOOL_PAIR_DECISIONS_STAY_TOGETHER' | 'C11_MUST_KEEP_TYPES_KEPT' | 'C12_HOST_TOKENIZER_DRIVES_BUDGET';
|
|
91
|
-
interface ContextPolicyInvariantFailure {
|
|
92
|
-
id: ContextPolicyInvariantId;
|
|
93
|
-
title: string;
|
|
94
|
-
message: string;
|
|
95
|
-
details?: Record<string, unknown>;
|
|
96
|
-
}
|
|
97
|
-
interface ContextPolicyInvariantReport {
|
|
98
|
-
ok: boolean;
|
|
99
|
-
failures: ContextPolicyInvariantFailure[];
|
|
100
|
-
}
|
|
101
|
-
interface ContextPolicyInvariantContext {
|
|
102
|
-
expectedPolicy?: AgentSpecContextPolicy;
|
|
103
|
-
trace?: ContextTrace;
|
|
104
|
-
originalMessages?: readonly AiMessage[];
|
|
105
|
-
finalMessages?: readonly AiMessage[];
|
|
106
|
-
tokenizer?: TokenizerPort;
|
|
107
|
-
tokenizerModelId?: string;
|
|
108
|
-
}
|
|
109
|
-
type ContextPolicyInvariantValidator = (context: ContextPolicyInvariantContext) => ContextPolicyInvariantFailure[];
|
|
110
|
-
interface ValidateContextPolicyInvariantsOptions {
|
|
111
|
-
enabled?: readonly ContextPolicyInvariantId[];
|
|
112
|
-
disabled?: readonly ContextPolicyInvariantId[];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
declare function validateContextPolicyInvariants(context: ContextPolicyInvariantContext, options?: ValidateContextPolicyInvariantsOptions): ContextPolicyInvariantReport;
|
|
116
|
-
declare function assertContextPolicyInvariants(report: ContextPolicyInvariantReport): void;
|
|
117
|
-
|
|
118
|
-
interface CollectingAuditPortHarness {
|
|
119
|
-
port: AuditPort;
|
|
120
|
-
getEnvelopes(action?: string): AuditEnvelope[];
|
|
121
|
-
assertEmitted(action: string): AuditEnvelope;
|
|
122
|
-
assertEmittedInOrder(actions: readonly string[]): AuditEnvelope[];
|
|
123
|
-
reset(): void;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* 收集型 AuditPort。
|
|
127
|
-
*
|
|
128
|
-
* 中文备注:
|
|
129
|
-
* - 用于测试“某次 run 做过哪些决策”,不写文件、不进 EventStore;
|
|
130
|
-
* - 断言方法故意抛普通 Error,让 Vitest/Jest 能直接显示友好的失败原因。
|
|
131
|
-
*/
|
|
132
|
-
declare function createCollectingAuditPort(): CollectingAuditPortHarness;
|
|
133
|
-
|
|
134
|
-
type TelemetryEvent$1 = TelemetryEvent$2;
|
|
135
|
-
type RunCostCollector = RunCostCollector$1;
|
|
136
|
-
interface TelemetryUsageTotal {
|
|
137
|
-
tokensInput: number;
|
|
138
|
-
tokensOutput: number;
|
|
139
|
-
latencyMs: number;
|
|
140
|
-
llmCallCount: number;
|
|
141
|
-
toolCallCount: number;
|
|
142
|
-
}
|
|
143
|
-
interface MockTelemetryPortHarness {
|
|
144
|
-
port: {
|
|
145
|
-
emit(event: TelemetryEvent$1): void;
|
|
146
|
-
flush(): Promise<void>;
|
|
147
|
-
};
|
|
148
|
-
costCollector: RunCostCollector;
|
|
149
|
-
emit(event: TelemetryEvent$1): void;
|
|
150
|
-
getEvents(runId?: string): TelemetryEvent$1[];
|
|
151
|
-
getTotalUsageByRun(runId: string): TelemetryUsageTotal;
|
|
152
|
-
getKnownRunIds(): string[];
|
|
153
|
-
reset(): void;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* TelemetryPort 测试夹具。
|
|
157
|
-
*
|
|
158
|
-
* 中文备注:
|
|
159
|
-
* - 它同时保留 ground truth 事件列表和一个 RunCostCollector;
|
|
160
|
-
* - 父子 run 通过 scope.parentRunId 关联,方便验证 B.3 的 childrenTotal。
|
|
161
|
-
*/
|
|
162
|
-
declare function createMockTelemetryPort(): MockTelemetryPortHarness;
|
|
163
|
-
|
|
164
|
-
type RunHandle<TRequest extends RunRequestSnapshot$1> = RunHandle$1<TRequest>;
|
|
165
|
-
type RunRecord$1 = RunRecord$2;
|
|
166
|
-
type RunRequestSnapshot = RunRequestSnapshot$1;
|
|
167
|
-
type RunExecutorPort<TRequest extends RunRequestSnapshot> = RunExecutorPort$1<TRequest>;
|
|
168
|
-
interface RunSupervisorHarness<TRequest extends RunRequestSnapshot = RunRequestSnapshot> {
|
|
169
|
-
supervisor: DefaultRunSupervisor<TRequest>;
|
|
170
|
-
registry: MemoryRunRegistryStore;
|
|
171
|
-
eventStore: MemoryEventStore;
|
|
172
|
-
eventBus: EventBus;
|
|
173
|
-
audit: CollectingAuditPortHarness;
|
|
174
|
-
telemetry: MockTelemetryPortHarness;
|
|
175
|
-
registerRun(params?: Partial<{
|
|
176
|
-
runId: string;
|
|
177
|
-
parentRunId: string;
|
|
178
|
-
conversationId: string;
|
|
179
|
-
agentSpec: AgentSpec;
|
|
180
|
-
request: TRequest;
|
|
181
|
-
metadata: Record<string, unknown>;
|
|
182
|
-
}>): Promise<RunHandle<TRequest>>;
|
|
183
|
-
spawnDetached(params?: Partial<{
|
|
184
|
-
runId: string;
|
|
185
|
-
parentRunId: string;
|
|
186
|
-
conversationId: string;
|
|
187
|
-
agentSpec: AgentSpec;
|
|
188
|
-
request: TRequest;
|
|
189
|
-
metadata: Record<string, unknown>;
|
|
190
|
-
}>): Promise<RunHandle<TRequest>>;
|
|
191
|
-
publish(event: RoutedRuntimeEvent, seq?: number): void;
|
|
192
|
-
persist(event: RoutedRuntimeEvent, eventStoreId?: string): Promise<void>;
|
|
193
|
-
getRegisteredRuns(): Promise<RunRecord$1[]>;
|
|
194
|
-
restore(): void;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* RunSupervisor 一站式测试夹具。
|
|
198
|
-
*
|
|
199
|
-
* 中文备注:
|
|
200
|
-
* - 只使用 linnkit package 内部 port,不依赖具体 host;
|
|
201
|
-
* - 适合协议测试、外部接入方测试、Quickstart/CLI 的最小 run 验证。
|
|
202
|
-
*/
|
|
203
|
-
declare function createRunSupervisorHarness<TRequest extends RunRequestSnapshot = RunRequestSnapshot>(options?: Partial<{
|
|
204
|
-
executionId: string;
|
|
205
|
-
now: () => number;
|
|
206
|
-
runIdFactory: () => string;
|
|
207
|
-
executor: RunExecutorPort<TRequest>;
|
|
208
|
-
}>): RunSupervisorHarness<TRequest>;
|
|
209
|
-
|
|
210
|
-
type PersistedEvent = PersistedEvent$1;
|
|
211
|
-
type RunCost = RunCost$1;
|
|
212
|
-
type RunRecord = RunRecord$2;
|
|
213
|
-
type RunOutcome = RunOutcome$1;
|
|
214
|
-
type TelemetryEvent = TelemetryEvent$2;
|
|
215
|
-
type RunInvariantId = 'I1_FINAL_STATUS' | 'I2_CHILDREN_COST_TOTAL' | 'I3_TOOL_CALL_OUTPUT_PAIR' | 'I4_LLM_MODEL_SELECT_AUDIT' | 'I5_CANCEL_AUDIT' | 'I6_EVENT_RUN_IDENTITY' | 'I7_PERSISTED_EVENT_ORDER' | 'I8_NO_ACTION_EVENT' | 'I9_CANCEL_SIGNAL_STATUS' | 'I10_TELEMETRY_RUN_REGISTERED' | 'I11_COST_NON_NEGATIVE' | 'I12_AUDIT_RUN_REGISTERED' | 'I13_WAIT_USER_STATUS' | 'I14_DETACHED_TERMINAL_OUTCOME' | 'I15_DRAIN_NO_INFLIGHT';
|
|
216
|
-
interface RunInvariantFailure {
|
|
217
|
-
id: RunInvariantId;
|
|
218
|
-
title: string;
|
|
219
|
-
message: string;
|
|
220
|
-
details?: Record<string, unknown>;
|
|
221
|
-
}
|
|
222
|
-
interface RunInvariantReport {
|
|
223
|
-
ok: boolean;
|
|
224
|
-
failures: RunInvariantFailure[];
|
|
225
|
-
}
|
|
226
|
-
interface RunInvariantContext {
|
|
227
|
-
rootRunId: string;
|
|
228
|
-
runRecords: readonly RunRecord[];
|
|
229
|
-
events?: readonly RuntimeEvent[];
|
|
230
|
-
persistedEvents?: readonly PersistedEvent[];
|
|
231
|
-
telemetryEvents?: readonly TelemetryEvent[];
|
|
232
|
-
auditEnvelopes?: readonly AuditEnvelope[];
|
|
233
|
-
terminalOutcomes?: readonly RunOutcome[];
|
|
234
|
-
inFlightRunIds?: readonly string[];
|
|
235
|
-
signal?: AbortSignal;
|
|
236
|
-
getCost?: (runId: string) => RunCost | Promise<RunCost>;
|
|
237
|
-
}
|
|
238
|
-
interface ValidateRunInvariantsOptions {
|
|
239
|
-
enabled?: readonly RunInvariantId[];
|
|
240
|
-
disabled?: readonly RunInvariantId[];
|
|
241
|
-
/**
|
|
242
|
-
* 中文备注:
|
|
243
|
-
* N-3.B.0 只给同步 child-run 透传 runId,并未正式注册 child RunRecord。
|
|
244
|
-
* 默认严格校验会暴露这个缺口;过渡测试可显式允许 parentRunId 场景下的未注册 child telemetry。
|
|
245
|
-
*/
|
|
246
|
-
allowUnregisteredChildTelemetry?: boolean;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
declare function validateRunInvariants(context: RunInvariantContext, options?: ValidateRunInvariantsOptions): Promise<RunInvariantReport>;
|
|
250
|
-
declare function assertRunInvariants(report: RunInvariantReport): void;
|
|
251
|
-
|
|
252
|
-
interface MockTokenizerPortOptions {
|
|
253
|
-
/** 每段 text 固定返回的 token 数,默认 10。 */
|
|
254
|
-
tokensPerText?: number;
|
|
255
|
-
/** 每条 message 固定返回的 token 数,默认 50。 */
|
|
256
|
-
tokensPerMessage?: number;
|
|
257
|
-
/** 自定义 text 估算逻辑,优先级高于 tokensPerText。 */
|
|
258
|
-
estimateText?: (text: string, modelId?: string) => number;
|
|
259
|
-
/** 自定义 message 估算逻辑,优先级高于 tokensPerMessage。 */
|
|
260
|
-
estimateMessage?: (message: LlmRequestMessage, modelId?: string) => number;
|
|
261
|
-
}
|
|
262
|
-
declare function createMockTokenizerPort(options?: MockTokenizerPortOptions): TokenizerPort;
|
|
263
|
-
|
|
264
|
-
type ToolExecutionContext = ToolExecutionContext$1;
|
|
265
|
-
type ToolContextPatch = ToolContextPatch$1;
|
|
266
|
-
type ToolContextFixture = ToolExecutionContext & Record<string, unknown>;
|
|
267
|
-
interface ToolContextFixtureOptions {
|
|
268
|
-
conversationId?: string;
|
|
269
|
-
turnId?: string;
|
|
270
|
-
historyEvents?: RuntimeEvent[];
|
|
271
|
-
workingHistoryEvents?: RuntimeEvent[];
|
|
272
|
-
persistedHistoryEvents?: RuntimeEvent[];
|
|
273
|
-
patch?: ToolContextPatch;
|
|
274
|
-
}
|
|
275
|
-
declare function createToolContextFixture(options?: ToolContextFixtureOptions): ToolContextFixture;
|
|
276
|
-
|
|
277
|
-
export { type CollectingAuditPortHarness, type ContextPolicyInvariantContext, type ContextPolicyInvariantFailure, type ContextPolicyInvariantId, type ContextPolicyInvariantReport, type ContextPolicyInvariantValidator, type MockTelemetryPortHarness, type MockTokenizerPortOptions, type ReplayHarness, type RunInvariantContext, type RunInvariantFailure, type RunInvariantId, type RunInvariantReport, type RunSupervisorHarness, type ScriptedInferenceHarness, type ScriptedInferenceHarnessOptions, type ScriptedLlmCall, type ScriptedLlmTurn, type ScriptedToolCall, type TelemetryUsageTotal, type ToolContextFixture, type ToolContextFixtureOptions, type ValidateContextPolicyInvariantsOptions, type ValidateRunInvariantsOptions, assertContextPolicyInvariants, assertRunInvariants, assertions, createCollectingAuditPort, createMockTelemetryPort, createMockTokenizerPort, createReplayHarness, createRunSupervisorHarness, createScriptedInferenceHarness, createToolContextFixture, expectFinalStepForcedTools, expectMessagesContainText, expectMessagesContainToolResult, expectRunEndedWithFinalAnswer, expectToolOutputFedBackToHistory, validateContextPolicyInvariants, validateRunInvariants };
|
|
1
|
+
import * as assertions from './testkit/agent-harness/assertions.js';
|
|
2
|
+
export { assertions };
|
|
3
|
+
export { expectFinalStepForcedTools, expectMessagesContainText, expectMessagesContainToolResult, expectRunEndedWithFinalAnswer, expectToolOutputFedBackToHistory } from './testkit/agent-harness/assertions.js';
|
|
4
|
+
export { GraphLoopHarness, GraphLoopHarnessOptions, GraphLoopHarnessRunResult, GraphLoopLlmNodeFactoryParams, createGraphLoopHarness } from './runtime-kernel/testkit/graphLoopHarness.js';
|
|
5
|
+
export { DefaultGraphExecutorOptions, createDefaultGraphExecutor } from './runtime-kernel/testkit/defaultGraphExecutor.js';
|
|
6
|
+
export { ScriptedInferenceHarness, ScriptedInferenceHarnessOptions, ScriptedLlmCall, ScriptedLlmTurn, ScriptedToolCall, createScriptedInferenceHarness } from './testkit/agent-harness/scriptedInferenceHarness.js';
|
|
7
|
+
import './context-manager/profiles/agent/preprocessors/base.js';
|
|
8
|
+
export { ReplayHarness, createReplayHarness } from './testkit/context-harness/replayHarness.js';
|
|
9
|
+
export { assertContextPolicyInvariants, validateContextPolicyInvariants } from './testkit/context-harness/invariants/index.js';
|
|
10
|
+
export { CollectingAuditPortHarness, createCollectingAuditPort } from './testkit/run-harness/collectingAuditPort.js';
|
|
11
|
+
export { MockTelemetryPortHarness, TelemetryUsageTotal, createMockTelemetryPort } from './testkit/run-harness/mockTelemetryPort.js';
|
|
12
|
+
export { RunSupervisorHarness, createRunSupervisorHarness } from './testkit/run-harness/runSupervisorHarness.js';
|
|
13
|
+
export { assertRunInvariants, validateRunInvariants } from './testkit/run-harness/invariants/index.js';
|
|
14
|
+
export { MockTokenizerPortOptions, createMockTokenizerPort } from './testkit/mocks/tokenizerPort.js';
|
|
15
|
+
export { ToolContextFixture, ToolContextFixtureOptions, createToolContextFixture } from './testkit/tool-fixtures/toolContext.js';
|
|
16
|
+
export { ContextPolicyInvariantContext, ContextPolicyInvariantFailure, ContextPolicyInvariantId, ContextPolicyInvariantReport, ContextPolicyInvariantValidator, ValidateContextPolicyInvariantsOptions } from './testkit/context-harness/invariants/types.js';
|
|
17
|
+
export { RunInvariantContext, RunInvariantFailure, RunInvariantId, RunInvariantReport, ValidateRunInvariantsOptions } from './testkit/run-harness/invariants/types.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linnlabs/linnkit",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A fine-grained context engineering framework for Agent applications — control every token sent to the model, with clear run lifecycle, audit records, and testable protocol boundaries.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"./package.json": "./package.json"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
|
-
"build": "tsup",
|
|
80
|
+
"build": "tsup && node build/declarations.ts",
|
|
81
81
|
"build:clean": "rm -rf dist",
|
|
82
82
|
"prepublishOnly": "npm run build:clean && npm run build && npm run test:smoke && npm run test:smoke:dist",
|
|
83
83
|
"publish:npm": "npm publish",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"typecheck": "tsc --noEmit -p tsconfig.src.json && tsc --noEmit -p tsconfig.json",
|
|
86
86
|
"test": "vitest run",
|
|
87
87
|
"test:smoke": "vitest run __tests__/package.shell.test.ts",
|
|
88
|
-
"test:smoke:dist": "vitest run __tests__/package.runtime-import.test.ts __tests__/package.events-browser-safe.test.ts"
|
|
88
|
+
"test:smoke:dist": "vitest run __tests__/package.runtime-import.test.ts __tests__/package.events-browser-safe.test.ts __tests__/package.declarations.test.ts"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"eventsource-parser": "^3.1.0",
|
|
@@ -102,12 +102,14 @@
|
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@types/node": "^24.3.0",
|
|
105
|
+
"rollup": "4.63.1",
|
|
106
|
+
"rollup-plugin-dts": "6.5.1",
|
|
105
107
|
"tsup": "^8.0.0",
|
|
106
108
|
"typescript": "^5.5.4",
|
|
107
109
|
"vitest": "^3.2.4"
|
|
108
110
|
},
|
|
109
111
|
"linnkit": {
|
|
110
|
-
"phase": "development (0.32.
|
|
112
|
+
"phase": "development (0.32.1 — preserve published namespace types)",
|
|
111
113
|
"sourceOfTruth": "CHANGELOG.md",
|
|
112
114
|
"notes": [
|
|
113
115
|
"子入口 ./runtime-kernel/events 是 browser-safe slim seam:仅暴露 events governance 纯函数,禁止扩展任何 Node-only 依赖(如 node:async_hooks / crypto / fs)",
|
package/dist/base-DRRrRhxS.d.cts
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { A as AiMessage } from './provider-continuation-CTZdCB--.cjs';
|
|
2
|
-
import { d as AgentSpecContextPolicy, C as ContextTokenComponent, a as AgentSpecContextTracePolicy } from './token-accounting-19cXG7hM.cjs';
|
|
3
|
-
import { T as TokenUsageCalibrationTrace } from './token-calibration-GtFyMJtM.cjs';
|
|
4
|
-
import { T as TokenRoute, a as TokenCountSource, b as TokenCountConfidence } from './reasoning-bffu9R2B.cjs';
|
|
5
|
-
|
|
6
|
-
interface RemoteTokenCountTrace {
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
attempted: boolean;
|
|
9
|
-
applied: boolean;
|
|
10
|
-
route?: TokenRoute;
|
|
11
|
-
inputTokens?: number;
|
|
12
|
-
localEstimateTokens?: number;
|
|
13
|
-
deltaTokens?: number;
|
|
14
|
-
source?: TokenCountSource;
|
|
15
|
-
confidence?: TokenCountConfidence;
|
|
16
|
-
failureBehavior?: 'use-local-estimate' | 'fail-fast';
|
|
17
|
-
failureReason?: string;
|
|
18
|
-
skipReason?: 'image_input_local_only';
|
|
19
|
-
}
|
|
20
|
-
interface MessageProcessingState {
|
|
21
|
-
readonly message: AiMessage;
|
|
22
|
-
readonly originalIndex: number;
|
|
23
|
-
action: 'keep_core' | 'keep_working_memory' | 'skip';
|
|
24
|
-
tokens: number;
|
|
25
|
-
tokenCalibration?: TokenUsageCalibrationTrace;
|
|
26
|
-
overrideContent?: string;
|
|
27
|
-
overrideMetadata?: AiMessage['metadata'];
|
|
28
|
-
contentType?: 'full' | 'final_answer_only' | 'thinking_only';
|
|
29
|
-
phase?: string;
|
|
30
|
-
replacementSourceIds?: string[];
|
|
31
|
-
}
|
|
32
|
-
interface ProviderContext<TConfig = unknown> {
|
|
33
|
-
totalBudget: number;
|
|
34
|
-
config: TConfig;
|
|
35
|
-
debugMode: boolean;
|
|
36
|
-
estimateTokens: (message: AiMessage) => number;
|
|
37
|
-
estimateTokensWithTrace?: (message: AiMessage) => {
|
|
38
|
-
tokens: number;
|
|
39
|
-
tokenCalibration?: TokenUsageCalibrationTrace;
|
|
40
|
-
};
|
|
41
|
-
remoteTokenCount?: RemoteTokenCountTrace;
|
|
42
|
-
}
|
|
43
|
-
interface ProviderResult {
|
|
44
|
-
states: MessageProcessingState[];
|
|
45
|
-
tokensUsed: number;
|
|
46
|
-
strategiesApplied: string[];
|
|
47
|
-
stats: {
|
|
48
|
-
processedCount: number;
|
|
49
|
-
skippedCount: number;
|
|
50
|
-
addedCount: number;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
declare const TOOL_HISTORY_OVERFLOW_ERROR_CODE: "TOOL_HISTORY_OVERFLOW";
|
|
54
|
-
declare const TOOL_REPLAY_PROTOCOL_ERROR_CODE: "TOOL_REPLAY_PROTOCOL_INVALID";
|
|
55
|
-
type ContextProviderErrorCode = 'context_provider_failed' | typeof TOOL_HISTORY_OVERFLOW_ERROR_CODE | typeof TOOL_REPLAY_PROTOCOL_ERROR_CODE;
|
|
56
|
-
interface ContextProviderErrorOptions {
|
|
57
|
-
code: ContextProviderErrorCode;
|
|
58
|
-
fatal?: boolean;
|
|
59
|
-
providerName: string;
|
|
60
|
-
message: string;
|
|
61
|
-
cause?: unknown;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Provider 内部向 pipeline 传递的结构化错误。
|
|
65
|
-
*
|
|
66
|
-
* 中文备注:
|
|
67
|
-
* - pipeline 只能依赖 code/fatal 这类稳定字段做控制流判断;
|
|
68
|
-
* - message 只用于日志和用户可见错误,不再承担协议语义。
|
|
69
|
-
*/
|
|
70
|
-
declare class ContextProviderError extends Error {
|
|
71
|
-
readonly code: ContextProviderErrorCode;
|
|
72
|
-
readonly errorCode: ContextProviderErrorCode;
|
|
73
|
-
readonly recoverable: boolean;
|
|
74
|
-
readonly fatal: boolean;
|
|
75
|
-
readonly providerName: string;
|
|
76
|
-
readonly metadata: Readonly<{
|
|
77
|
-
providerName: string;
|
|
78
|
-
fatal: boolean;
|
|
79
|
-
}>;
|
|
80
|
-
readonly cause?: unknown;
|
|
81
|
-
constructor(options: ContextProviderErrorOptions);
|
|
82
|
-
}
|
|
83
|
-
declare function isContextProviderError(error: unknown): error is ContextProviderError;
|
|
84
|
-
interface IContextProvider<TConfig = unknown> {
|
|
85
|
-
readonly name: string;
|
|
86
|
-
readonly description: string;
|
|
87
|
-
readonly priority: number;
|
|
88
|
-
provide(states: MessageProcessingState[], availableBudget: number, context: ProviderContext<TConfig>): Promise<ProviderResult>;
|
|
89
|
-
shouldSkip?(states: MessageProcessingState[], availableBudget: number, context: ProviderContext<TConfig>): boolean;
|
|
90
|
-
}
|
|
91
|
-
declare abstract class BaseContextProvider<TConfig = unknown> implements IContextProvider<TConfig> {
|
|
92
|
-
abstract readonly name: string;
|
|
93
|
-
abstract readonly description: string;
|
|
94
|
-
abstract readonly priority: number;
|
|
95
|
-
private readonly logger;
|
|
96
|
-
abstract provide(states: MessageProcessingState[], availableBudget: number, context: ProviderContext<TConfig>): Promise<ProviderResult>;
|
|
97
|
-
shouldSkip(_states: MessageProcessingState[], availableBudget: number, _context: ProviderContext<TConfig>): boolean;
|
|
98
|
-
protected debug(message: string, data?: Record<string, unknown>, context?: ProviderContext<TConfig>): void;
|
|
99
|
-
protected createResult(states: MessageProcessingState[], tokensUsed?: number, strategiesApplied?: string[], stats?: {
|
|
100
|
-
processedCount: number;
|
|
101
|
-
skippedCount: number;
|
|
102
|
-
addedCount: number;
|
|
103
|
-
}): ProviderResult;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type ContextTraceEvent = ContextTraceProviderEvent | ContextTraceMessageDecisionEvent;
|
|
107
|
-
interface ContextTraceProviderEvent {
|
|
108
|
-
kind: 'provider';
|
|
109
|
-
providerName: string;
|
|
110
|
-
skipped: boolean;
|
|
111
|
-
durationMs: number;
|
|
112
|
-
beforeTokens: number;
|
|
113
|
-
afterTokens: number;
|
|
114
|
-
tokenDelta: number;
|
|
115
|
-
tokensUsed: number;
|
|
116
|
-
beforeKeptCount: number;
|
|
117
|
-
afterKeptCount: number;
|
|
118
|
-
strategiesApplied: string[];
|
|
119
|
-
remainingBudget: number;
|
|
120
|
-
}
|
|
121
|
-
interface ContextTraceMessageDecisionEvent {
|
|
122
|
-
kind: 'message-decision';
|
|
123
|
-
originalIndex: number;
|
|
124
|
-
messageId?: string;
|
|
125
|
-
role: AiMessage['role'];
|
|
126
|
-
type: AiMessage['type'];
|
|
127
|
-
action: MessageProcessingState['action'];
|
|
128
|
-
phase?: string;
|
|
129
|
-
tokens: number;
|
|
130
|
-
kept: boolean;
|
|
131
|
-
reason: string;
|
|
132
|
-
replacementSourceIds?: string[];
|
|
133
|
-
tokenCalibration?: TokenUsageCalibrationTrace;
|
|
134
|
-
}
|
|
135
|
-
interface ContextTrace {
|
|
136
|
-
enabled: true;
|
|
137
|
-
includeMessageIds: boolean;
|
|
138
|
-
includeTokenBreakdown: boolean;
|
|
139
|
-
maxTraceEvents: number;
|
|
140
|
-
overflowed: boolean;
|
|
141
|
-
effectivePolicy?: AgentSpecContextPolicy;
|
|
142
|
-
totalBudget: number;
|
|
143
|
-
originalCount: number;
|
|
144
|
-
finalCount: number;
|
|
145
|
-
finalTokens: number;
|
|
146
|
-
tokenLedgerEntryIds?: string[];
|
|
147
|
-
tokenComponents?: ContextTokenComponent[];
|
|
148
|
-
tokenCalibration?: TokenUsageCalibrationTrace;
|
|
149
|
-
remoteTokenCount?: RemoteTokenCountTrace;
|
|
150
|
-
truncated: boolean;
|
|
151
|
-
events: ContextTraceEvent[];
|
|
152
|
-
}
|
|
153
|
-
interface ContextTraceCollectorOptions {
|
|
154
|
-
policy?: AgentSpecContextTracePolicy;
|
|
155
|
-
effectivePolicy?: AgentSpecContextPolicy;
|
|
156
|
-
totalBudget: number;
|
|
157
|
-
originalCount: number;
|
|
158
|
-
tokenCalibration?: TokenUsageCalibrationTrace;
|
|
159
|
-
remoteTokenCount?: RemoteTokenCountTrace;
|
|
160
|
-
}
|
|
161
|
-
interface ProviderTraceInput {
|
|
162
|
-
providerName: string;
|
|
163
|
-
skipped: boolean;
|
|
164
|
-
durationMs: number;
|
|
165
|
-
beforeStates: ReadonlyArray<MessageProcessingState>;
|
|
166
|
-
afterStates: ReadonlyArray<MessageProcessingState>;
|
|
167
|
-
tokensUsed: number;
|
|
168
|
-
strategiesApplied: readonly string[];
|
|
169
|
-
remainingBudget: number;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* ContextTrace 的最小采集器。
|
|
173
|
-
*
|
|
174
|
-
* 中文备注:
|
|
175
|
-
* - trace 只描述“本次上下文构建如何选择消息”,不进入 LLM 输入;
|
|
176
|
-
* - 采集器内部做 maxTraceEvents 限流,避免观测数据反过来膨胀。
|
|
177
|
-
*/
|
|
178
|
-
declare class ContextTraceCollector {
|
|
179
|
-
private readonly includeMessageIds;
|
|
180
|
-
private readonly includeTokenBreakdown;
|
|
181
|
-
private readonly maxTraceEvents;
|
|
182
|
-
private readonly effectivePolicy?;
|
|
183
|
-
private readonly totalBudget;
|
|
184
|
-
private readonly originalCount;
|
|
185
|
-
private readonly tokenCalibration?;
|
|
186
|
-
private remoteTokenCount?;
|
|
187
|
-
private tokenComponents?;
|
|
188
|
-
private readonly events;
|
|
189
|
-
private overflowed;
|
|
190
|
-
private constructor();
|
|
191
|
-
static create(options: ContextTraceCollectorOptions): ContextTraceCollector | undefined;
|
|
192
|
-
recordProvider(input: ProviderTraceInput): void;
|
|
193
|
-
recordMessageDecisions(states: ReadonlyArray<MessageProcessingState>): void;
|
|
194
|
-
recordRemoteTokenCount(trace: RemoteTokenCountTrace): void;
|
|
195
|
-
recordTokenComponents(components: ReadonlyArray<ContextTokenComponent>): void;
|
|
196
|
-
build(finalMessages: ReadonlyArray<AiMessage>, finalTokens: number): ContextTrace;
|
|
197
|
-
private push;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
interface ToolReplayProtocolPolicy {
|
|
201
|
-
provider?: string;
|
|
202
|
-
requiresProviderContinuationForToolReplay?: boolean;
|
|
203
|
-
}
|
|
204
|
-
declare module '../../../shared/preprocessors/base' {
|
|
205
|
-
interface PreprocessorContext {
|
|
206
|
-
/**
|
|
207
|
-
* Agent profile 专属的 provider replay 治理策略。
|
|
208
|
-
*
|
|
209
|
-
* 中文说明:基类实现仍归 shared;agent 只通过类型增广补自己的上下文字段,
|
|
210
|
-
* 避免为了一个 profile 字段复制整套 BasePreprocessor。
|
|
211
|
-
*/
|
|
212
|
-
toolReplayProtocolPolicy?: ToolReplayProtocolPolicy;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export { BaseContextProvider as B, ContextTraceCollector as C, type IContextProvider as I, type MessageProcessingState as M, type ProviderContext as P, type RemoteTokenCountTrace as R, type ToolReplayProtocolPolicy as T, type ProviderResult as a, type ContextTrace as b, ContextProviderError as c, type ContextProviderErrorCode as d, type ContextProviderErrorOptions as e, type ContextTraceEvent as f, type ContextTraceMessageDecisionEvent as g, type ContextTraceProviderEvent as h, TOOL_HISTORY_OVERFLOW_ERROR_CODE as i, TOOL_REPLAY_PROTOCOL_ERROR_CODE as j, isContextProviderError as k };
|