@linnlabs/linnkit 0.31.1 → 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 +22 -0
- package/dist/cli.cjs +14 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +14 -1
- 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} +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.cjs +14 -1
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- 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} +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.cjs +14 -1
- 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 +14 -1
- 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 +14 -1
- 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 +14 -1
- package/dist/testkit.js.map +1 -1
- package/docs/integration/host-originated-tools.md +9 -0
- 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-B2kGX0iA.d.ts +0 -905
- package/dist/defaultGraphExecutor-CO3ztZdG.d.cts +0 -905
- package/dist/index-1pE6gSpV.d.cts +0 -172
- package/dist/index-CMUnmxhM.d.ts +0 -1966
- package/dist/index-CZtZq3T1.d.cts +0 -1966
- 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
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { R as RuntimeResourceRef, A as AiMessage, P as ProviderContinuation, g as SerializableJsonValue, a as AssistantReplayPart } from './provider-continuation-CTZdCB--.js';
|
|
2
|
-
import { d as ReasoningEffort, C as CanonicalLlmUsage } from './reasoning-bffu9R2B.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Host 注入的一段结构化 Agent 上下文。
|
|
6
|
-
*
|
|
7
|
-
* 中文备注:
|
|
8
|
-
* - runtime 只负责把注入透传给 context pipeline,不解释 kind 的产品语义;
|
|
9
|
-
* - formatter、placement 与 lifetime 仍由 Host 注册的 FenceDescriptor 决定。
|
|
10
|
-
*/
|
|
11
|
-
interface AgentContextInjection {
|
|
12
|
-
kind: string;
|
|
13
|
-
content: string;
|
|
14
|
-
attrs?: Record<string, unknown>;
|
|
15
|
-
metadata?: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Agent runtime 最小调用协议。
|
|
19
|
-
*
|
|
20
|
-
* 中文备注:
|
|
21
|
-
* - 这里只声明 runtime-kernel / context-core 真正读取的字段;
|
|
22
|
-
* - 产品层的 AgentInvokeRequest 可以通过结构类型自然满足该接口;
|
|
23
|
-
* - agent package 不再从 app core 反向导入调用协议;
|
|
24
|
-
* - 公共合同面不依赖产品 enum:promptKey 在 ports 层是 opaque string。
|
|
25
|
-
*/
|
|
26
|
-
interface AgentInvocationRequest {
|
|
27
|
-
query: string;
|
|
28
|
-
currentUserEventId?: string;
|
|
29
|
-
currentUserAttachments?: RuntimeResourceRef[];
|
|
30
|
-
promptKey: string;
|
|
31
|
-
model_id?: string;
|
|
32
|
-
maxSteps?: number;
|
|
33
|
-
enableTools?: boolean;
|
|
34
|
-
availableTools?: string[];
|
|
35
|
-
conversationHistory?: AiMessage[];
|
|
36
|
-
fences?: AgentContextInjection[];
|
|
37
|
-
/** 用户选择的思考努力程度(统一语义);null/undefined 表示走模型默认 */
|
|
38
|
-
reasoning_effort?: ReasoningEffort | null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type JsonSchemaValue = string | number | boolean | null | JsonSchemaValue[] | {
|
|
42
|
-
[key: string]: JsonSchemaValue;
|
|
43
|
-
};
|
|
44
|
-
type ToolParameterType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array';
|
|
45
|
-
interface ToolParameterProperty {
|
|
46
|
-
type: ToolParameterType;
|
|
47
|
-
description: string;
|
|
48
|
-
default?: JsonSchemaValue;
|
|
49
|
-
enum?: string[];
|
|
50
|
-
minimum?: number;
|
|
51
|
-
maximum?: number;
|
|
52
|
-
minLength?: number;
|
|
53
|
-
maxLength?: number;
|
|
54
|
-
minItems?: number;
|
|
55
|
-
maxItems?: number;
|
|
56
|
-
properties?: Record<string, ToolParameterProperty>;
|
|
57
|
-
items?: ToolParameterProperty;
|
|
58
|
-
required?: string[];
|
|
59
|
-
additionalProperties?: boolean;
|
|
60
|
-
oneOf?: ToolParameterProperty[];
|
|
61
|
-
}
|
|
62
|
-
interface ToolParameterSchema {
|
|
63
|
-
type: 'object';
|
|
64
|
-
properties: Record<string, ToolParameterProperty>;
|
|
65
|
-
required?: string[];
|
|
66
|
-
additionalProperties?: boolean;
|
|
67
|
-
oneOf?: ToolParameterSchema[];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
interface CanonicalInferenceTextBlock {
|
|
71
|
-
readonly type: 'text';
|
|
72
|
-
readonly text: string;
|
|
73
|
-
}
|
|
74
|
-
interface CanonicalInferenceImageBlock {
|
|
75
|
-
readonly type: 'image';
|
|
76
|
-
readonly media_type: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
77
|
-
readonly bytes: Uint8Array;
|
|
78
|
-
}
|
|
79
|
-
type CanonicalInferenceContentBlock = CanonicalInferenceTextBlock | CanonicalInferenceImageBlock;
|
|
80
|
-
interface CanonicalCompletedToolCall {
|
|
81
|
-
readonly id: string;
|
|
82
|
-
readonly name: string;
|
|
83
|
-
readonly arguments: Record<string, SerializableJsonValue>;
|
|
84
|
-
readonly continuation?: readonly ProviderContinuation[];
|
|
85
|
-
}
|
|
86
|
-
type CanonicalAssistantReplayPart = {
|
|
87
|
-
readonly type: 'text';
|
|
88
|
-
readonly text: string;
|
|
89
|
-
readonly continuation?: readonly ProviderContinuation[];
|
|
90
|
-
} | {
|
|
91
|
-
readonly type: 'reasoning';
|
|
92
|
-
readonly text: string;
|
|
93
|
-
readonly continuation?: readonly ProviderContinuation[];
|
|
94
|
-
} | {
|
|
95
|
-
readonly type: 'tool_call';
|
|
96
|
-
readonly call: CanonicalCompletedToolCall;
|
|
97
|
-
};
|
|
98
|
-
type CanonicalInferenceMessage = {
|
|
99
|
-
readonly role: 'system';
|
|
100
|
-
readonly content: string;
|
|
101
|
-
} | {
|
|
102
|
-
readonly role: 'user';
|
|
103
|
-
readonly content: readonly CanonicalInferenceContentBlock[];
|
|
104
|
-
} | {
|
|
105
|
-
readonly role: 'assistant';
|
|
106
|
-
readonly parts: readonly CanonicalAssistantReplayPart[];
|
|
107
|
-
} | {
|
|
108
|
-
readonly role: 'tool';
|
|
109
|
-
readonly tool_call_id: string;
|
|
110
|
-
readonly content: readonly CanonicalInferenceContentBlock[];
|
|
111
|
-
};
|
|
112
|
-
interface CanonicalInferenceTool {
|
|
113
|
-
readonly name: string;
|
|
114
|
-
readonly description: string;
|
|
115
|
-
readonly parameters: ToolParameterSchema;
|
|
116
|
-
}
|
|
117
|
-
type CanonicalToolChoice = 'auto' | 'none' | {
|
|
118
|
-
readonly type: 'tool';
|
|
119
|
-
readonly name: string;
|
|
120
|
-
};
|
|
121
|
-
type CanonicalInferenceCacheAnchor = 'end_of_system_prompt' | 'end_of_history_summary';
|
|
122
|
-
interface CanonicalInferenceCachePolicy {
|
|
123
|
-
/**
|
|
124
|
-
* Linnkit 只声明稳定前缀在 canonical messages 中的结束位置。
|
|
125
|
-
* Provider adapter 可以投影为原生断点;不支持显式断点时必须忽略,不能改变请求语义。
|
|
126
|
-
*/
|
|
127
|
-
readonly breakpoints: readonly {
|
|
128
|
-
readonly anchor: CanonicalInferenceCacheAnchor;
|
|
129
|
-
readonly message_index: number;
|
|
130
|
-
}[];
|
|
131
|
-
}
|
|
132
|
-
interface CanonicalInferenceRequest {
|
|
133
|
-
readonly model_id: string;
|
|
134
|
-
readonly messages: readonly CanonicalInferenceMessage[];
|
|
135
|
-
readonly tools: readonly CanonicalInferenceTool[];
|
|
136
|
-
readonly tool_choice: CanonicalToolChoice;
|
|
137
|
-
readonly cache_policy?: CanonicalInferenceCachePolicy;
|
|
138
|
-
readonly sampling: {
|
|
139
|
-
readonly temperature?: number;
|
|
140
|
-
readonly top_p?: number;
|
|
141
|
-
readonly max_output_tokens?: number;
|
|
142
|
-
readonly reasoning_effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
143
|
-
};
|
|
144
|
-
readonly signal?: AbortSignal;
|
|
145
|
-
readonly invocation: {
|
|
146
|
-
readonly trace_id: string;
|
|
147
|
-
readonly attempt_id: string;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
type CanonicalInferenceFinishReason = 'stop' | 'length' | 'tool_use' | 'content_filter';
|
|
151
|
-
type CanonicalInferenceFailureKind = 'aborted' | 'transport' | 'provider' | 'protocol';
|
|
152
|
-
type CanonicalInferenceEvent = {
|
|
153
|
-
readonly type: 'start';
|
|
154
|
-
readonly model_id: string;
|
|
155
|
-
readonly attempt_id: string;
|
|
156
|
-
} | {
|
|
157
|
-
readonly type: 'answer_delta';
|
|
158
|
-
readonly text: string;
|
|
159
|
-
} | {
|
|
160
|
-
readonly type: 'thought_delta';
|
|
161
|
-
readonly text: string;
|
|
162
|
-
} | {
|
|
163
|
-
readonly type: 'tool_call_start';
|
|
164
|
-
readonly index: number;
|
|
165
|
-
/** 当前 Assistant 产出内跨 text/reasoning/tool 的全局 part 顺序。 */
|
|
166
|
-
readonly part_index: number;
|
|
167
|
-
readonly id?: string;
|
|
168
|
-
readonly name?: string;
|
|
169
|
-
} | {
|
|
170
|
-
readonly type: 'tool_argument_delta';
|
|
171
|
-
readonly index: number;
|
|
172
|
-
readonly json_delta: string;
|
|
173
|
-
} | {
|
|
174
|
-
readonly type: 'tool_call_end';
|
|
175
|
-
readonly index: number;
|
|
176
|
-
readonly call: CanonicalCompletedToolCall;
|
|
177
|
-
} | {
|
|
178
|
-
readonly type: 'assistant_part_end';
|
|
179
|
-
readonly index: number;
|
|
180
|
-
readonly part: Exclude<CanonicalAssistantReplayPart, {
|
|
181
|
-
readonly type: 'tool_call';
|
|
182
|
-
}>;
|
|
183
|
-
} | {
|
|
184
|
-
readonly type: 'usage';
|
|
185
|
-
readonly usage: CanonicalLlmUsage;
|
|
186
|
-
} | {
|
|
187
|
-
readonly type: 'finish';
|
|
188
|
-
readonly reason: CanonicalInferenceFinishReason;
|
|
189
|
-
} | {
|
|
190
|
-
readonly type: 'failure';
|
|
191
|
-
readonly kind: CanonicalInferenceFailureKind;
|
|
192
|
-
readonly code: string;
|
|
193
|
-
readonly retryable: boolean;
|
|
194
|
-
};
|
|
195
|
-
interface CanonicalInferencePort {
|
|
196
|
-
stream(request: CanonicalInferenceRequest): AsyncIterable<CanonicalInferenceEvent>;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/** Runtime 内部持久化和工具执行使用的工具调用结果。 */
|
|
200
|
-
interface ToolCall {
|
|
201
|
-
id: string;
|
|
202
|
-
type: 'function';
|
|
203
|
-
function: {
|
|
204
|
-
name: string;
|
|
205
|
-
arguments: string;
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
type LlmRequestMessage = AiMessage | {
|
|
209
|
-
role: 'system';
|
|
210
|
-
content: string;
|
|
211
|
-
} | {
|
|
212
|
-
role: 'user';
|
|
213
|
-
content: string;
|
|
214
|
-
attachments?: RuntimeResourceRef[];
|
|
215
|
-
} | {
|
|
216
|
-
role: 'assistant';
|
|
217
|
-
content: string;
|
|
218
|
-
assistant_replay_parts?: AssistantReplayPart[];
|
|
219
|
-
} | {
|
|
220
|
-
role: 'assistant';
|
|
221
|
-
content: string | null;
|
|
222
|
-
tool_calls: unknown[];
|
|
223
|
-
provider_continuations?: ProviderContinuation[];
|
|
224
|
-
assistant_replay_parts?: AssistantReplayPart[];
|
|
225
|
-
} | {
|
|
226
|
-
role: 'tool';
|
|
227
|
-
tool_call_id: string;
|
|
228
|
-
content: string;
|
|
229
|
-
attachments?: RuntimeResourceRef[];
|
|
230
|
-
};
|
|
231
|
-
interface LlmCallOptions {
|
|
232
|
-
tools?: CanonicalInferenceTool[];
|
|
233
|
-
/** Provider 无关的稳定前缀断点;不支持显式缓存的 adapter 可以忽略。 */
|
|
234
|
-
cache_policy?: CanonicalInferenceCachePolicy;
|
|
235
|
-
/**
|
|
236
|
-
* 工具选择策略(Linnkit canonical inference 语义)
|
|
237
|
-
*
|
|
238
|
-
* 说明:
|
|
239
|
-
* - 'auto' / 'none':常见 provider 统一语义;
|
|
240
|
-
* - {type:'tool', name}:强制调用指定工具(用于步数收尾策略 force_tools 等)。
|
|
241
|
-
* Provider 的私有字段由 Host adapter 映射,不能进入内核。
|
|
242
|
-
*/
|
|
243
|
-
tool_choice?: CanonicalToolChoice;
|
|
244
|
-
temperature?: number;
|
|
245
|
-
top_p?: number;
|
|
246
|
-
max_tokens?: number;
|
|
247
|
-
/**
|
|
248
|
-
* 重试策略(仅影响客户端侧 `LlmCaller.callWithRetries`)。
|
|
249
|
-
*
|
|
250
|
-
* 背景(中文说明):
|
|
251
|
-
* - BYOK(本地直连)模式下,客户端重试是合理的:成本由用户自带 key 承担;
|
|
252
|
-
* - Cloud(积分计费)模式下,客户端重试会导致"一次点击一个 request_id"的账单语义被破坏,
|
|
253
|
-
* 因为同一次点击可能触发多次上游调用,造成对账困难或平台资损。
|
|
254
|
-
*
|
|
255
|
-
* 约定:
|
|
256
|
-
* - `client`:允许客户端按本地 retryConfig 重试(默认);
|
|
257
|
-
* - `none`:强制不重试(只执行一次,失败直接返回错误)。Cloud 模式推荐使用该值或在模型配置中关闭客户端重试。
|
|
258
|
-
*/
|
|
259
|
-
retry_policy?: 'client' | 'none';
|
|
260
|
-
/**
|
|
261
|
-
* 是否允许 LLM 层在一次调用失败后自动切换到其它模型。
|
|
262
|
-
*
|
|
263
|
-
* 中文说明:
|
|
264
|
-
* - `false` 用于固定模型语义:模型不可用时应直接暴露失败,不能被 policy switch
|
|
265
|
-
* 或 cloud quota fallback 掩盖。
|
|
266
|
-
* - 未设置时保持历史行为,由 retry/fallback 层按策略决定是否切模型。
|
|
267
|
-
*/
|
|
268
|
-
allow_model_fallback?: boolean;
|
|
269
|
-
/**
|
|
270
|
-
* 云端模型限额降级目标(同一个 run 内续跑专用)
|
|
271
|
-
*
|
|
272
|
-
* 中文说明:
|
|
273
|
-
* - 仅当"同一个 run 内已经不是第一次 LLM 调用"时由上层传入;
|
|
274
|
-
* - 如果本次 LLM 调用因为云端 quota/限额被拒,LlmCaller 会静默切到该模型继续,
|
|
275
|
-
* 不向前端发 error 事件(前端无感知);
|
|
276
|
-
* - 若为 undefined 或空字符串,则 quota 错误仍按"不可重试"处理(即新请求直接报错)。
|
|
277
|
-
*/
|
|
278
|
-
cloud_quota_fallback_model_id?: string;
|
|
279
|
-
/**
|
|
280
|
-
* 思考努力程度(统一语义,prepareCallStage 已降级后的最终档位)。
|
|
281
|
-
* adapter 负责翻译为 provider 原生字段,不得原样进入请求体。
|
|
282
|
-
*/
|
|
283
|
-
reasoning_effort?: ReasoningEffort;
|
|
284
|
-
}
|
|
285
|
-
interface LlmRetryConfig {
|
|
286
|
-
maxRetries: number;
|
|
287
|
-
/**
|
|
288
|
-
* 单次 LLM 编排允许触发的真实上游调用总数。
|
|
289
|
-
*
|
|
290
|
-
* 中文备注:
|
|
291
|
-
* - `maxRetries` 只表达“同一模型失败后的客户端重试次数”;
|
|
292
|
-
* - `maxTotalAttempts` 额外覆盖 policy switch / cloud quota fallback 造成的切模型调用,
|
|
293
|
-
* 避免多级 fallback 绕开 retry 配额。
|
|
294
|
-
*/
|
|
295
|
-
maxTotalAttempts?: number;
|
|
296
|
-
enableEmptyResponseRetry: boolean;
|
|
297
|
-
retryDelayMs: number;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
type LlmImageInputPlacement = 'user_image' | 'tool_result_image';
|
|
301
|
-
/**
|
|
302
|
-
* 图片估算只需要 durable 元数据,不允许 Context Manager 读取文件或 host route 配置。
|
|
303
|
-
*/
|
|
304
|
-
interface LlmImageInputDescriptor {
|
|
305
|
-
readonly id: string;
|
|
306
|
-
readonly resourceId: string;
|
|
307
|
-
readonly mediaType: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
308
|
-
readonly byteLength: number;
|
|
309
|
-
readonly width: number;
|
|
310
|
-
readonly height: number;
|
|
311
|
-
readonly placement: LlmImageInputPlacement;
|
|
312
|
-
}
|
|
313
|
-
interface LlmImageInputEstimate {
|
|
314
|
-
readonly estimatedTokens: number;
|
|
315
|
-
readonly profileId: string;
|
|
316
|
-
readonly estimatorVersion: string;
|
|
317
|
-
}
|
|
318
|
-
interface LlmImageInputEstimatorPort {
|
|
319
|
-
estimateImageInput(activeModelId: string, descriptor: LlmImageInputDescriptor): LlmImageInputEstimate;
|
|
320
|
-
}
|
|
321
|
-
interface ImageInputAdmissionAttachmentEvidence {
|
|
322
|
-
readonly messageIndex: number;
|
|
323
|
-
readonly attachmentIndex: number;
|
|
324
|
-
readonly id: string;
|
|
325
|
-
readonly resourceId: string;
|
|
326
|
-
readonly placement: LlmImageInputPlacement;
|
|
327
|
-
readonly estimatedTokens: number;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Context Manager 的短生命周期输出。fallback 只能据此复核预算,不能从 trace 反推输入。
|
|
331
|
-
*/
|
|
332
|
-
interface ImageInputAdmissionEvidence {
|
|
333
|
-
readonly inputBudget: number;
|
|
334
|
-
readonly nonImageEstimatedTokens: number;
|
|
335
|
-
readonly initialProfileId: string;
|
|
336
|
-
readonly attachments: readonly ImageInputAdmissionAttachmentEvidence[];
|
|
337
|
-
}
|
|
338
|
-
interface ResolvedLlmImageAttachment {
|
|
339
|
-
readonly id: string;
|
|
340
|
-
readonly resourceId: string;
|
|
341
|
-
readonly mediaType: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
342
|
-
readonly byteLength: number;
|
|
343
|
-
readonly width: number;
|
|
344
|
-
readonly height: number;
|
|
345
|
-
readonly placement: LlmImageInputPlacement;
|
|
346
|
-
readonly bytes: Uint8Array;
|
|
347
|
-
}
|
|
348
|
-
type ReplaceDurableAttachments<T> = T extends {
|
|
349
|
-
attachments?: unknown;
|
|
350
|
-
} ? Omit<T, 'attachments'> & {
|
|
351
|
-
readonly attachments?: readonly ResolvedLlmImageAttachment[];
|
|
352
|
-
} : T;
|
|
353
|
-
/**
|
|
354
|
-
* Canonical inference request builder 的短生命周期输入。该类型不能进入 durable event、context state 或 audit schema。
|
|
355
|
-
*/
|
|
356
|
-
type ResolvedLlmInputMessage = ReplaceDurableAttachments<LlmRequestMessage>;
|
|
357
|
-
interface LlmInputMaterializationAttempt {
|
|
358
|
-
readonly activeModelId: string;
|
|
359
|
-
readonly messages: readonly LlmRequestMessage[];
|
|
360
|
-
readonly admissionEvidence: ImageInputAdmissionEvidence;
|
|
361
|
-
}
|
|
362
|
-
interface LlmInputMaterializerPort {
|
|
363
|
-
materialize(attempt: LlmInputMaterializationAttempt): Promise<ResolvedLlmInputMessage[]>;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export type { AgentContextInjection as A, ToolParameterSchema as B, CanonicalAssistantReplayPart as C, ToolParameterType as D, ImageInputAdmissionEvidence as I, JsonSchemaValue as J, LlmImageInputPlacement as L, ResolvedLlmImageAttachment as R, ToolCall as T, LlmImageInputEstimatorPort as a, AgentInvocationRequest as b, CanonicalCompletedToolCall as c, CanonicalInferenceCacheAnchor as d, CanonicalInferenceCachePolicy as e, CanonicalInferenceContentBlock as f, CanonicalInferenceEvent as g, CanonicalInferenceFailureKind as h, CanonicalInferenceFinishReason as i, CanonicalInferenceImageBlock as j, CanonicalInferenceMessage as k, CanonicalInferencePort as l, CanonicalInferenceRequest as m, CanonicalInferenceTextBlock as n, CanonicalInferenceTool as o, CanonicalToolChoice as p, ImageInputAdmissionAttachmentEvidence as q, LlmCallOptions as r, LlmImageInputDescriptor as s, LlmImageInputEstimate as t, LlmInputMaterializationAttempt as u, LlmInputMaterializerPort as v, LlmRequestMessage as w, LlmRetryConfig as x, ResolvedLlmInputMessage as y, ToolParameterProperty as z };
|