@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/runtime-kernel/llm/canonical-inference/definitions/canonicalInferenceStreamState.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CanonicalInferenceFinishReason, CanonicalInferenceFailureKind } from '../../../../ports/canonical-inference.js';
|
|
2
|
+
|
|
3
|
+
type CanonicalInferenceTerminal = {
|
|
4
|
+
readonly type: 'finish';
|
|
5
|
+
readonly reason: CanonicalInferenceFinishReason;
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: 'failure';
|
|
8
|
+
readonly kind: CanonicalInferenceFailureKind;
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly retryable: boolean;
|
|
11
|
+
};
|
|
12
|
+
interface OpenCanonicalToolCall {
|
|
13
|
+
readonly index: number;
|
|
14
|
+
readonly part_index: number;
|
|
15
|
+
readonly id?: string;
|
|
16
|
+
readonly name?: string;
|
|
17
|
+
}
|
|
18
|
+
interface CanonicalInferenceStreamState {
|
|
19
|
+
readonly phase: 'idle' | 'streaming' | 'terminal';
|
|
20
|
+
readonly open_tool_calls: readonly OpenCanonicalToolCall[];
|
|
21
|
+
readonly usage_seen: boolean;
|
|
22
|
+
readonly assistant_part_indices: readonly number[];
|
|
23
|
+
readonly terminal?: CanonicalInferenceTerminal;
|
|
24
|
+
}
|
|
25
|
+
declare const INITIAL_CANONICAL_INFERENCE_STREAM_STATE: CanonicalInferenceStreamState;
|
|
26
|
+
|
|
27
|
+
export { INITIAL_CANONICAL_INFERENCE_STREAM_STATE };
|
|
28
|
+
export type { CanonicalInferenceStreamState, CanonicalInferenceTerminal, OpenCanonicalToolCall };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CanonicalInferenceEvent } from '../../../../ports/canonical-inference.cjs';
|
|
2
|
+
import { CanonicalInferenceStreamState } from '../definitions/canonicalInferenceStreamState.cjs';
|
|
3
|
+
|
|
4
|
+
declare function advanceCanonicalInferenceStreamState(state: CanonicalInferenceStreamState, event: CanonicalInferenceEvent): CanonicalInferenceStreamState;
|
|
5
|
+
|
|
6
|
+
export { advanceCanonicalInferenceStreamState };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CanonicalInferenceEvent } from '../../../../ports/canonical-inference.js';
|
|
2
|
+
import { CanonicalInferenceStreamState } from '../definitions/canonicalInferenceStreamState.js';
|
|
3
|
+
|
|
4
|
+
declare function advanceCanonicalInferenceStreamState(state: CanonicalInferenceStreamState, event: CanonicalInferenceEvent): CanonicalInferenceStreamState;
|
|
5
|
+
|
|
6
|
+
export { advanceCanonicalInferenceStreamState };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CanonicalInferenceEvent } from '../../../../ports/canonical-inference.cjs';
|
|
2
|
+
import { CanonicalInferenceTerminal } from '../definitions/canonicalInferenceStreamState.cjs';
|
|
3
|
+
|
|
4
|
+
declare function consumeCanonicalInferenceStream(events: AsyncIterable<CanonicalInferenceEvent>, onEvent: (event: CanonicalInferenceEvent) => void): Promise<CanonicalInferenceTerminal>;
|
|
5
|
+
|
|
6
|
+
export { consumeCanonicalInferenceStream };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CanonicalInferenceEvent } from '../../../../ports/canonical-inference.js';
|
|
2
|
+
import { CanonicalInferenceTerminal } from '../definitions/canonicalInferenceStreamState.js';
|
|
3
|
+
|
|
4
|
+
declare function consumeCanonicalInferenceStream(events: AsyncIterable<CanonicalInferenceEvent>, onEvent: (event: CanonicalInferenceEvent) => void): Promise<CanonicalInferenceTerminal>;
|
|
5
|
+
|
|
6
|
+
export { consumeCanonicalInferenceStream };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.cjs';
|
|
2
|
+
import { LlmRequestMessage } from '../../../ports/llm-call.cjs';
|
|
3
|
+
import { ImageInputAdmissionEvidence } from '../../../ports/llm-input-materialization.cjs';
|
|
4
|
+
import { ModelInputRequirement } from '../input-capabilities/definitions/modelInputCapability.cjs';
|
|
5
|
+
import { ToolCallStreamingPolicy } from '../../tools/toolContracts.cjs';
|
|
6
|
+
import { FallbackPromptCapacityAdmission } from '../functions/evaluateFallbackPromptCapacity.cjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 单次 LLM 调用的短生命周期上下文。
|
|
10
|
+
*
|
|
11
|
+
* 中文备注:这里的信息只参与 runtime preflight,不能混入 LlmCallOptions,
|
|
12
|
+
* 否则 provider request builder 可能把内部预算证据原样发到外部服务。
|
|
13
|
+
*/
|
|
14
|
+
interface LlmCallInvocationContext {
|
|
15
|
+
readonly imageInputAdmissionEvidence?: ImageInputAdmissionEvidence;
|
|
16
|
+
/** 来自本次实际暴露工具的静态输入要求,不会进入 provider options。 */
|
|
17
|
+
readonly additionalModelInputRequirement?: ModelInputRequirement;
|
|
18
|
+
/**
|
|
19
|
+
* 本次实际暴露工具的流式生命周期声明。
|
|
20
|
+
* 该调用上下文不会进入 provider options,请求适配器不得接触此字段。
|
|
21
|
+
*/
|
|
22
|
+
readonly toolCallStreamingPolicies?: Readonly<Record<string, ToolCallStreamingPolicy>>;
|
|
23
|
+
/** 每个真实 provider attempt 发送前,按 active route 测量最终 Prompt。 */
|
|
24
|
+
readonly measurePromptUsage?: (activeModelId: string, messages: readonly LlmRequestMessage[]) => Promise<ContextUsageSnapshot>;
|
|
25
|
+
/** fallback candidate 在真实 attempt 前的本地容量 admission。 */
|
|
26
|
+
readonly evaluateFallbackPromptCapacity?: (candidateModelId: string) => FallbackPromptCapacityAdmission;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { LlmCallInvocationContext };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.js';
|
|
2
|
+
import { LlmRequestMessage } from '../../../ports/llm-call.js';
|
|
3
|
+
import { ImageInputAdmissionEvidence } from '../../../ports/llm-input-materialization.js';
|
|
4
|
+
import { ModelInputRequirement } from '../input-capabilities/definitions/modelInputCapability.js';
|
|
5
|
+
import { ToolCallStreamingPolicy } from '../../tools/toolContracts.js';
|
|
6
|
+
import { FallbackPromptCapacityAdmission } from '../functions/evaluateFallbackPromptCapacity.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 单次 LLM 调用的短生命周期上下文。
|
|
10
|
+
*
|
|
11
|
+
* 中文备注:这里的信息只参与 runtime preflight,不能混入 LlmCallOptions,
|
|
12
|
+
* 否则 provider request builder 可能把内部预算证据原样发到外部服务。
|
|
13
|
+
*/
|
|
14
|
+
interface LlmCallInvocationContext {
|
|
15
|
+
readonly imageInputAdmissionEvidence?: ImageInputAdmissionEvidence;
|
|
16
|
+
/** 来自本次实际暴露工具的静态输入要求,不会进入 provider options。 */
|
|
17
|
+
readonly additionalModelInputRequirement?: ModelInputRequirement;
|
|
18
|
+
/**
|
|
19
|
+
* 本次实际暴露工具的流式生命周期声明。
|
|
20
|
+
* 该调用上下文不会进入 provider options,请求适配器不得接触此字段。
|
|
21
|
+
*/
|
|
22
|
+
readonly toolCallStreamingPolicies?: Readonly<Record<string, ToolCallStreamingPolicy>>;
|
|
23
|
+
/** 每个真实 provider attempt 发送前,按 active route 测量最终 Prompt。 */
|
|
24
|
+
readonly measurePromptUsage?: (activeModelId: string, messages: readonly LlmRequestMessage[]) => Promise<ContextUsageSnapshot>;
|
|
25
|
+
/** fallback candidate 在真实 attempt 前的本地容量 admission。 */
|
|
26
|
+
readonly evaluateFallbackPromptCapacity?: (candidateModelId: string) => FallbackPromptCapacityAdmission;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type { LlmCallInvocationContext };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ModelInputPlacement } from '../input-capabilities/definitions/modelInputCapability.cjs';
|
|
2
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.cjs';
|
|
3
|
+
|
|
4
|
+
type ModelFallbackPolicy = 'policy-switch' | 'cloud-quota';
|
|
5
|
+
interface ModelFallbackAppliedInfo {
|
|
6
|
+
readonly fromModelId: string;
|
|
7
|
+
readonly toModelId: string;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
readonly policy: ModelFallbackPolicy;
|
|
10
|
+
}
|
|
11
|
+
interface ModelFallbackRejectedInfo {
|
|
12
|
+
readonly fromModelId: string;
|
|
13
|
+
readonly candidateModelId?: string;
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
readonly policy: ModelFallbackPolicy;
|
|
16
|
+
readonly requiredPlacements: readonly ModelInputPlacement[];
|
|
17
|
+
}
|
|
18
|
+
interface LlmFallbackObserver {
|
|
19
|
+
/** 每次调用只在最终真实 provider attempt 成功后触发一次。 */
|
|
20
|
+
readonly onLlmAttemptSucceeded?: (activeModelId: string, contextUsage?: ContextUsageSnapshot) => void;
|
|
21
|
+
readonly onCloudQuotaFallbackApplied?: (fallbackModelId: string) => void;
|
|
22
|
+
readonly onModelFallbackApplied?: (info: ModelFallbackAppliedInfo) => void;
|
|
23
|
+
readonly onModelFallbackRejected?: (info: ModelFallbackRejectedInfo) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type { LlmFallbackObserver, ModelFallbackAppliedInfo, ModelFallbackPolicy, ModelFallbackRejectedInfo };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ModelInputPlacement } from '../input-capabilities/definitions/modelInputCapability.js';
|
|
2
|
+
import { ContextUsageSnapshot } from '../../../contracts/token-usage.js';
|
|
3
|
+
|
|
4
|
+
type ModelFallbackPolicy = 'policy-switch' | 'cloud-quota';
|
|
5
|
+
interface ModelFallbackAppliedInfo {
|
|
6
|
+
readonly fromModelId: string;
|
|
7
|
+
readonly toModelId: string;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
readonly policy: ModelFallbackPolicy;
|
|
10
|
+
}
|
|
11
|
+
interface ModelFallbackRejectedInfo {
|
|
12
|
+
readonly fromModelId: string;
|
|
13
|
+
readonly candidateModelId?: string;
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
readonly policy: ModelFallbackPolicy;
|
|
16
|
+
readonly requiredPlacements: readonly ModelInputPlacement[];
|
|
17
|
+
}
|
|
18
|
+
interface LlmFallbackObserver {
|
|
19
|
+
/** 每次调用只在最终真实 provider attempt 成功后触发一次。 */
|
|
20
|
+
readonly onLlmAttemptSucceeded?: (activeModelId: string, contextUsage?: ContextUsageSnapshot) => void;
|
|
21
|
+
readonly onCloudQuotaFallbackApplied?: (fallbackModelId: string) => void;
|
|
22
|
+
readonly onModelFallbackApplied?: (info: ModelFallbackAppliedInfo) => void;
|
|
23
|
+
readonly onModelFallbackRejected?: (info: ModelFallbackRejectedInfo) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type { LlmFallbackObserver, ModelFallbackAppliedInfo, ModelFallbackPolicy, ModelFallbackRejectedInfo };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type FallbackPromptCapacityRejectionReason = 'fallback_inference_route_missing' | 'fallback_output_limit_unsupported' | 'fallback_context_window_exceeded';
|
|
2
|
+
type FallbackPromptCapacityAdmission = {
|
|
3
|
+
admitted: true;
|
|
4
|
+
} | {
|
|
5
|
+
admitted: false;
|
|
6
|
+
reason: FallbackPromptCapacityRejectionReason;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type { FallbackPromptCapacityAdmission, FallbackPromptCapacityRejectionReason };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type FallbackPromptCapacityRejectionReason = 'fallback_inference_route_missing' | 'fallback_output_limit_unsupported' | 'fallback_context_window_exceeded';
|
|
2
|
+
type FallbackPromptCapacityAdmission = {
|
|
3
|
+
admitted: true;
|
|
4
|
+
} | {
|
|
5
|
+
admitted: false;
|
|
6
|
+
reason: FallbackPromptCapacityRejectionReason;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type { FallbackPromptCapacityAdmission, FallbackPromptCapacityRejectionReason };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { LlmCaller } from './caller.cjs';
|
|
2
|
+
export { CanonicalInferenceStreamState, CanonicalInferenceTerminal, INITIAL_CANONICAL_INFERENCE_STREAM_STATE } from './canonical-inference/definitions/canonicalInferenceStreamState.cjs';
|
|
3
|
+
export { advanceCanonicalInferenceStreamState } from './canonical-inference/functions/advanceCanonicalInferenceStreamState.cjs';
|
|
4
|
+
export { consumeCanonicalInferenceStream } from './canonical-inference/orchestration/consumeCanonicalInferenceStream.cjs';
|
|
5
|
+
export { ModelReasoningConfig, REASONING_EFFORTS, ReasoningEffort, isValidReasoningEffort, resolveEffectiveEffort } from '../../contracts/reasoning.cjs';
|
|
6
|
+
export { ProviderContinuation } from '../../contracts/provider-continuation.cjs';
|
|
7
|
+
export { LlmCallOptions, LlmRequestMessage, LlmRetryConfig, ToolCall } from '../../ports/llm-call.cjs';
|
|
8
|
+
export { DefaultTokenizerPort, DefaultTokenizerPortConfig, createDefaultTokenizerPort } from '../../shared/defaultTokenizerPort.cjs';
|
|
9
|
+
export { ModelResolver } from './modelResolver.cjs';
|
|
10
|
+
export { defaultPolicyEngine } from './policies/defaultPolicyEngine.cjs';
|
|
11
|
+
export { LLMPolicyEngine } from './policies/policyEngine.cjs';
|
|
12
|
+
export { LlmFallbackObserver, ModelFallbackAppliedInfo, ModelFallbackPolicy, ModelFallbackRejectedInfo } from './definitions/llmFallbackObserver.cjs';
|
|
13
|
+
export { LlmCallInvocationContext } from './definitions/llmCallInvocationContext.cjs';
|
|
14
|
+
export { ModelCatalogEntry, ModelCatalogLike, createFixedChatModelCatalog } from './modelCatalog.cjs';
|
|
15
|
+
export { AdapterInputSupport, EMPTY_MODEL_INPUT_REQUIREMENT, MODEL_INPUT_PLACEMENTS, ModelInputCompatibility, ModelInputIncompatibilityReason, ModelInputPlacement, ModelInputRequirement } from './input-capabilities/definitions/modelInputCapability.cjs';
|
|
16
|
+
export { LLM_MODEL_ELIGIBILITY_ERROR_CODE, LlmModelEligibilityError, MODEL_INPUT_ERROR_CODES, ModelInputCapabilityError, ModelInputErrorCode, ModelInputErrorMetadata } from './input-capabilities/definitions/modelInputCapabilityError.cjs';
|
|
17
|
+
export { createModelInputCompatibilityError } from './input-capabilities/functions/createModelInputCompatibilityError.cjs';
|
|
18
|
+
export { deriveModelInputRequirement } from './input-capabilities/functions/deriveModelInputRequirement.cjs';
|
|
19
|
+
export { evaluateModelInputCompatibility, listCompatibleModelIds } from './input-capabilities/functions/evaluateModelInputCompatibility.cjs';
|
|
20
|
+
export { assertModelInputCompatibility } from './input-capabilities/orchestration/assertModelInputCompatibility.cjs';
|
|
21
|
+
export { LLM_IMAGE_INPUT_ERROR_CODES, LlmImageInputError, LlmImageInputErrorCode, LlmImageInputErrorMetadata, LlmImageInputLimitKind } from '../../shared/llmImageInputError.cjs';
|
|
22
|
+
export { LLMPolicy, LLMPolicyErrorDecision, LLMPolicyMatchContext } from './policies/types.cjs';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { LlmCaller } from './caller.js';
|
|
2
|
+
export { CanonicalInferenceStreamState, CanonicalInferenceTerminal, INITIAL_CANONICAL_INFERENCE_STREAM_STATE } from './canonical-inference/definitions/canonicalInferenceStreamState.js';
|
|
3
|
+
export { advanceCanonicalInferenceStreamState } from './canonical-inference/functions/advanceCanonicalInferenceStreamState.js';
|
|
4
|
+
export { consumeCanonicalInferenceStream } from './canonical-inference/orchestration/consumeCanonicalInferenceStream.js';
|
|
5
|
+
export { ModelReasoningConfig, REASONING_EFFORTS, ReasoningEffort, isValidReasoningEffort, resolveEffectiveEffort } from '../../contracts/reasoning.js';
|
|
6
|
+
export { ProviderContinuation } from '../../contracts/provider-continuation.js';
|
|
7
|
+
export { LlmCallOptions, LlmRequestMessage, LlmRetryConfig, ToolCall } from '../../ports/llm-call.js';
|
|
8
|
+
export { DefaultTokenizerPort, DefaultTokenizerPortConfig, createDefaultTokenizerPort } from '../../shared/defaultTokenizerPort.js';
|
|
9
|
+
export { ModelResolver } from './modelResolver.js';
|
|
10
|
+
export { defaultPolicyEngine } from './policies/defaultPolicyEngine.js';
|
|
11
|
+
export { LLMPolicyEngine } from './policies/policyEngine.js';
|
|
12
|
+
export { LlmFallbackObserver, ModelFallbackAppliedInfo, ModelFallbackPolicy, ModelFallbackRejectedInfo } from './definitions/llmFallbackObserver.js';
|
|
13
|
+
export { LlmCallInvocationContext } from './definitions/llmCallInvocationContext.js';
|
|
14
|
+
export { ModelCatalogEntry, ModelCatalogLike, createFixedChatModelCatalog } from './modelCatalog.js';
|
|
15
|
+
export { AdapterInputSupport, EMPTY_MODEL_INPUT_REQUIREMENT, MODEL_INPUT_PLACEMENTS, ModelInputCompatibility, ModelInputIncompatibilityReason, ModelInputPlacement, ModelInputRequirement } from './input-capabilities/definitions/modelInputCapability.js';
|
|
16
|
+
export { LLM_MODEL_ELIGIBILITY_ERROR_CODE, LlmModelEligibilityError, MODEL_INPUT_ERROR_CODES, ModelInputCapabilityError, ModelInputErrorCode, ModelInputErrorMetadata } from './input-capabilities/definitions/modelInputCapabilityError.js';
|
|
17
|
+
export { createModelInputCompatibilityError } from './input-capabilities/functions/createModelInputCompatibilityError.js';
|
|
18
|
+
export { deriveModelInputRequirement } from './input-capabilities/functions/deriveModelInputRequirement.js';
|
|
19
|
+
export { evaluateModelInputCompatibility, listCompatibleModelIds } from './input-capabilities/functions/evaluateModelInputCompatibility.js';
|
|
20
|
+
export { assertModelInputCompatibility } from './input-capabilities/orchestration/assertModelInputCompatibility.js';
|
|
21
|
+
export { LLM_IMAGE_INPUT_ERROR_CODES, LlmImageInputError, LlmImageInputErrorCode, LlmImageInputErrorMetadata, LlmImageInputLimitKind } from '../../shared/llmImageInputError.js';
|
|
22
|
+
export { LLMPolicy, LLMPolicyErrorDecision, LLMPolicyMatchContext } from './policies/types.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LlmImageInputPlacement } from '../../../../ports/llm-input-materialization.cjs';
|
|
2
|
+
|
|
3
|
+
declare const MODEL_INPUT_PLACEMENTS: readonly ["user_image", "tool_result_image"];
|
|
4
|
+
type ModelInputPlacement = LlmImageInputPlacement;
|
|
5
|
+
interface AdapterInputSupport {
|
|
6
|
+
readonly user_image: boolean;
|
|
7
|
+
readonly tool_result_image: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ModelInputRequirement {
|
|
10
|
+
readonly requires_image_input: boolean;
|
|
11
|
+
readonly placements: readonly ModelInputPlacement[];
|
|
12
|
+
}
|
|
13
|
+
type ModelInputIncompatibilityReason = 'model_missing' | 'model_disabled' | 'chat_unsupported' | 'image_input_unsupported' | 'placement_unsupported';
|
|
14
|
+
type ModelInputCompatibility = {
|
|
15
|
+
readonly compatible: true;
|
|
16
|
+
} | {
|
|
17
|
+
readonly compatible: false;
|
|
18
|
+
readonly reason: ModelInputIncompatibilityReason;
|
|
19
|
+
readonly missing_placements: readonly ModelInputPlacement[];
|
|
20
|
+
};
|
|
21
|
+
declare const EMPTY_MODEL_INPUT_REQUIREMENT: ModelInputRequirement;
|
|
22
|
+
|
|
23
|
+
export { EMPTY_MODEL_INPUT_REQUIREMENT, MODEL_INPUT_PLACEMENTS };
|
|
24
|
+
export type { AdapterInputSupport, ModelInputCompatibility, ModelInputIncompatibilityReason, ModelInputPlacement, ModelInputRequirement };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LlmImageInputPlacement } from '../../../../ports/llm-input-materialization.js';
|
|
2
|
+
|
|
3
|
+
declare const MODEL_INPUT_PLACEMENTS: readonly ["user_image", "tool_result_image"];
|
|
4
|
+
type ModelInputPlacement = LlmImageInputPlacement;
|
|
5
|
+
interface AdapterInputSupport {
|
|
6
|
+
readonly user_image: boolean;
|
|
7
|
+
readonly tool_result_image: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ModelInputRequirement {
|
|
10
|
+
readonly requires_image_input: boolean;
|
|
11
|
+
readonly placements: readonly ModelInputPlacement[];
|
|
12
|
+
}
|
|
13
|
+
type ModelInputIncompatibilityReason = 'model_missing' | 'model_disabled' | 'chat_unsupported' | 'image_input_unsupported' | 'placement_unsupported';
|
|
14
|
+
type ModelInputCompatibility = {
|
|
15
|
+
readonly compatible: true;
|
|
16
|
+
} | {
|
|
17
|
+
readonly compatible: false;
|
|
18
|
+
readonly reason: ModelInputIncompatibilityReason;
|
|
19
|
+
readonly missing_placements: readonly ModelInputPlacement[];
|
|
20
|
+
};
|
|
21
|
+
declare const EMPTY_MODEL_INPUT_REQUIREMENT: ModelInputRequirement;
|
|
22
|
+
|
|
23
|
+
export { EMPTY_MODEL_INPUT_REQUIREMENT, MODEL_INPUT_PLACEMENTS };
|
|
24
|
+
export type { AdapterInputSupport, ModelInputCompatibility, ModelInputIncompatibilityReason, ModelInputPlacement, ModelInputRequirement };
|
package/dist/runtime-kernel/llm/input-capabilities/definitions/modelInputCapabilityError.d.cts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ModelInputPlacement } from './modelInputCapability.cjs';
|
|
2
|
+
|
|
3
|
+
declare const MODEL_INPUT_ERROR_CODES: {
|
|
4
|
+
readonly MODEL_UNSUPPORTED: "llm.image_input.model_unsupported";
|
|
5
|
+
readonly PLACEMENT_UNSUPPORTED: "llm.image_input.placement_unsupported";
|
|
6
|
+
readonly MATERIALIZATION_PENDING: "llm.image_input.materialization_pending";
|
|
7
|
+
};
|
|
8
|
+
type ModelInputErrorCode = typeof MODEL_INPUT_ERROR_CODES[keyof typeof MODEL_INPUT_ERROR_CODES];
|
|
9
|
+
declare const LLM_MODEL_ELIGIBILITY_ERROR_CODE: "llm.unsupported_capability";
|
|
10
|
+
interface ModelInputErrorMetadata {
|
|
11
|
+
readonly active_model_id: string;
|
|
12
|
+
readonly required_placements: readonly ModelInputPlacement[];
|
|
13
|
+
readonly missing_conditions?: readonly string[];
|
|
14
|
+
readonly compatible_model_ids?: readonly string[];
|
|
15
|
+
readonly fallback_rejections?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
declare class ModelInputCapabilityError extends Error {
|
|
18
|
+
readonly errorCode: ModelInputErrorCode;
|
|
19
|
+
readonly recoverable = false;
|
|
20
|
+
readonly metadata: ModelInputErrorMetadata;
|
|
21
|
+
constructor(errorCode: ModelInputErrorCode, message: string, metadata: ModelInputErrorMetadata);
|
|
22
|
+
}
|
|
23
|
+
declare class LlmModelEligibilityError extends Error {
|
|
24
|
+
readonly errorCode: "llm.unsupported_capability";
|
|
25
|
+
readonly recoverable = false;
|
|
26
|
+
readonly metadata: ModelInputErrorMetadata;
|
|
27
|
+
constructor(message: string, metadata: ModelInputErrorMetadata);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { LLM_MODEL_ELIGIBILITY_ERROR_CODE, LlmModelEligibilityError, MODEL_INPUT_ERROR_CODES, ModelInputCapabilityError };
|
|
31
|
+
export type { ModelInputErrorCode, ModelInputErrorMetadata };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ModelInputPlacement } from './modelInputCapability.js';
|
|
2
|
+
|
|
3
|
+
declare const MODEL_INPUT_ERROR_CODES: {
|
|
4
|
+
readonly MODEL_UNSUPPORTED: "llm.image_input.model_unsupported";
|
|
5
|
+
readonly PLACEMENT_UNSUPPORTED: "llm.image_input.placement_unsupported";
|
|
6
|
+
readonly MATERIALIZATION_PENDING: "llm.image_input.materialization_pending";
|
|
7
|
+
};
|
|
8
|
+
type ModelInputErrorCode = typeof MODEL_INPUT_ERROR_CODES[keyof typeof MODEL_INPUT_ERROR_CODES];
|
|
9
|
+
declare const LLM_MODEL_ELIGIBILITY_ERROR_CODE: "llm.unsupported_capability";
|
|
10
|
+
interface ModelInputErrorMetadata {
|
|
11
|
+
readonly active_model_id: string;
|
|
12
|
+
readonly required_placements: readonly ModelInputPlacement[];
|
|
13
|
+
readonly missing_conditions?: readonly string[];
|
|
14
|
+
readonly compatible_model_ids?: readonly string[];
|
|
15
|
+
readonly fallback_rejections?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
declare class ModelInputCapabilityError extends Error {
|
|
18
|
+
readonly errorCode: ModelInputErrorCode;
|
|
19
|
+
readonly recoverable = false;
|
|
20
|
+
readonly metadata: ModelInputErrorMetadata;
|
|
21
|
+
constructor(errorCode: ModelInputErrorCode, message: string, metadata: ModelInputErrorMetadata);
|
|
22
|
+
}
|
|
23
|
+
declare class LlmModelEligibilityError extends Error {
|
|
24
|
+
readonly errorCode: "llm.unsupported_capability";
|
|
25
|
+
readonly recoverable = false;
|
|
26
|
+
readonly metadata: ModelInputErrorMetadata;
|
|
27
|
+
constructor(message: string, metadata: ModelInputErrorMetadata);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { LLM_MODEL_ELIGIBILITY_ERROR_CODE, LlmModelEligibilityError, MODEL_INPUT_ERROR_CODES, ModelInputCapabilityError };
|
|
31
|
+
export type { ModelInputErrorCode, ModelInputErrorMetadata };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModelInputCapabilityError, LlmModelEligibilityError } from '../definitions/modelInputCapabilityError.cjs';
|
|
2
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../definitions/modelInputCapability.cjs';
|
|
3
|
+
|
|
4
|
+
declare function createModelInputCompatibilityError(input: {
|
|
5
|
+
readonly modelId: string;
|
|
6
|
+
readonly requirement: ModelInputRequirement;
|
|
7
|
+
readonly incompatibility: Exclude<ModelInputCompatibility, {
|
|
8
|
+
readonly compatible: true;
|
|
9
|
+
}>;
|
|
10
|
+
readonly compatibleModelIds?: readonly string[];
|
|
11
|
+
}): ModelInputCapabilityError | LlmModelEligibilityError;
|
|
12
|
+
|
|
13
|
+
export { createModelInputCompatibilityError };
|
package/dist/runtime-kernel/llm/input-capabilities/functions/createModelInputCompatibilityError.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModelInputCapabilityError, LlmModelEligibilityError } from '../definitions/modelInputCapabilityError.js';
|
|
2
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../definitions/modelInputCapability.js';
|
|
3
|
+
|
|
4
|
+
declare function createModelInputCompatibilityError(input: {
|
|
5
|
+
readonly modelId: string;
|
|
6
|
+
readonly requirement: ModelInputRequirement;
|
|
7
|
+
readonly incompatibility: Exclude<ModelInputCompatibility, {
|
|
8
|
+
readonly compatible: true;
|
|
9
|
+
}>;
|
|
10
|
+
readonly compatibleModelIds?: readonly string[];
|
|
11
|
+
}): ModelInputCapabilityError | LlmModelEligibilityError;
|
|
12
|
+
|
|
13
|
+
export { createModelInputCompatibilityError };
|
package/dist/runtime-kernel/llm/input-capabilities/functions/deriveModelInputRequirement.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LlmRequestMessage } from '../../../../ports/llm-call.cjs';
|
|
2
|
+
import { ModelInputRequirement } from '../definitions/modelInputCapability.cjs';
|
|
3
|
+
|
|
4
|
+
declare function deriveModelInputRequirement(messages: readonly LlmRequestMessage[]): ModelInputRequirement;
|
|
5
|
+
|
|
6
|
+
export { deriveModelInputRequirement };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LlmRequestMessage } from '../../../../ports/llm-call.js';
|
|
2
|
+
import { ModelInputRequirement } from '../definitions/modelInputCapability.js';
|
|
3
|
+
|
|
4
|
+
declare function deriveModelInputRequirement(messages: readonly LlmRequestMessage[]): ModelInputRequirement;
|
|
5
|
+
|
|
6
|
+
export { deriveModelInputRequirement };
|
package/dist/runtime-kernel/llm/input-capabilities/functions/evaluateModelInputCompatibility.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModelCatalogEntry } from '../../modelCatalog.cjs';
|
|
2
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../definitions/modelInputCapability.cjs';
|
|
3
|
+
|
|
4
|
+
declare function evaluateModelInputCompatibility(model: ModelCatalogEntry | undefined, requirement: ModelInputRequirement): ModelInputCompatibility;
|
|
5
|
+
declare function listCompatibleModelIds(models: readonly ModelCatalogEntry[], requirement: ModelInputRequirement): readonly string[];
|
|
6
|
+
|
|
7
|
+
export { evaluateModelInputCompatibility, listCompatibleModelIds };
|
package/dist/runtime-kernel/llm/input-capabilities/functions/evaluateModelInputCompatibility.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModelCatalogEntry } from '../../modelCatalog.js';
|
|
2
|
+
import { ModelInputRequirement, ModelInputCompatibility } from '../definitions/modelInputCapability.js';
|
|
3
|
+
|
|
4
|
+
declare function evaluateModelInputCompatibility(model: ModelCatalogEntry | undefined, requirement: ModelInputRequirement): ModelInputCompatibility;
|
|
5
|
+
declare function listCompatibleModelIds(models: readonly ModelCatalogEntry[], requirement: ModelInputRequirement): readonly string[];
|
|
6
|
+
|
|
7
|
+
export { evaluateModelInputCompatibility, listCompatibleModelIds };
|
package/dist/runtime-kernel/llm/input-capabilities/orchestration/assertModelInputCompatibility.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModelCatalogLike } from '../../modelCatalog.cjs';
|
|
2
|
+
import { ModelInputRequirement } from '../definitions/modelInputCapability.cjs';
|
|
3
|
+
|
|
4
|
+
declare function assertModelInputCompatibility(input: {
|
|
5
|
+
readonly modelCatalog: ModelCatalogLike;
|
|
6
|
+
readonly modelId: string;
|
|
7
|
+
readonly requirement: ModelInputRequirement;
|
|
8
|
+
}): void;
|
|
9
|
+
|
|
10
|
+
export { assertModelInputCompatibility };
|
package/dist/runtime-kernel/llm/input-capabilities/orchestration/assertModelInputCompatibility.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModelCatalogLike } from '../../modelCatalog.js';
|
|
2
|
+
import { ModelInputRequirement } from '../definitions/modelInputCapability.js';
|
|
3
|
+
|
|
4
|
+
declare function assertModelInputCompatibility(input: {
|
|
5
|
+
readonly modelCatalog: ModelCatalogLike;
|
|
6
|
+
readonly modelId: string;
|
|
7
|
+
readonly requirement: ModelInputRequirement;
|
|
8
|
+
}): void;
|
|
9
|
+
|
|
10
|
+
export { assertModelInputCompatibility };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TokenRoute } from '../../contracts/token-usage.cjs';
|
|
2
|
+
import { ModelReasoningConfig } from '../../contracts/reasoning.cjs';
|
|
3
|
+
import { AdapterInputSupport } from './input-capabilities/definitions/modelInputCapability.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file src/agent/runtime-kernel/llm/modelCatalog.ts
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* Agent runtime 对“模型目录”的最小协议定义。
|
|
10
|
+
* runtime-kernel 只依赖这些查询能力,不直接依赖 app 的 Model Catalog 实现。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface ModelCatalogEntry {
|
|
14
|
+
id: string;
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
api_key?: string;
|
|
17
|
+
billing_mode?: 'byok' | 'cloud';
|
|
18
|
+
/**
|
|
19
|
+
* 是否允许客户端侧重试。
|
|
20
|
+
*
|
|
21
|
+
* 说明:
|
|
22
|
+
* - runtime-kernel 会基于该字段与 billing_mode 决定重试策略;
|
|
23
|
+
* - 该字段来自上层 Model Catalog(对齐 `src/domains/model-catalog/definitions/modelCatalog.ts`),避免在 runtime 侧出现类型漂移。
|
|
24
|
+
*/
|
|
25
|
+
enable_client_retry?: boolean;
|
|
26
|
+
model_name?: string;
|
|
27
|
+
capabilities?: readonly string[];
|
|
28
|
+
ui_visibility?: readonly string[];
|
|
29
|
+
/** Host 根据显式 inference route/capability 解析出的输入 placement 支持。 */
|
|
30
|
+
adapter_input_support?: AdapterInputSupport;
|
|
31
|
+
/**
|
|
32
|
+
* 思考努力程度能力契约。
|
|
33
|
+
*
|
|
34
|
+
* 说明:
|
|
35
|
+
* - 来自上层 Model Catalog 的 `ModelConfig.reasoning`(宿主 `defaultModelCatalog` 透传完整 `ModelConfig`);
|
|
36
|
+
* - kernel 侧 `prepareCallStage` 用它 + 用户请求档位调 `resolveEffectiveEffort()` 做统一降级;
|
|
37
|
+
* - 缺失表示该模型不支持 reasoning 控制,调用方不发任何思考相关字段。
|
|
38
|
+
*/
|
|
39
|
+
reasoning?: ModelReasoningConfig;
|
|
40
|
+
/** Chat route 的容量事实;fallback admission 只能读取正式 route。 */
|
|
41
|
+
inference_route?: {
|
|
42
|
+
context_window_tokens: number;
|
|
43
|
+
max_output_tokens: number;
|
|
44
|
+
};
|
|
45
|
+
/** Host 已解析的 token accounting route。 */
|
|
46
|
+
token_route?: TokenRoute;
|
|
47
|
+
}
|
|
48
|
+
interface ModelCatalogLike {
|
|
49
|
+
getModelById(id: string): ModelCatalogEntry | undefined;
|
|
50
|
+
getModelsByCapability(capability: string): ModelCatalogEntry[];
|
|
51
|
+
getModelsByUIVisibility(visibility: string): ModelCatalogEntry[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 为已由调用方提供的外部聊天引擎建立最小 catalog。
|
|
55
|
+
*
|
|
56
|
+
* quickstart 的 canonical inference port 本身承诺该 ID 可聊天;但它没有 Host route profile,
|
|
57
|
+
* 因此图片 placement 必须保持关闭,不能从“能聊天”推断“能识图”。
|
|
58
|
+
*/
|
|
59
|
+
declare function createFixedChatModelCatalog(modelId: string): ModelCatalogLike;
|
|
60
|
+
|
|
61
|
+
export { createFixedChatModelCatalog };
|
|
62
|
+
export type { ModelCatalogEntry, ModelCatalogLike };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TokenRoute } from '../../contracts/token-usage.js';
|
|
2
|
+
import { ModelReasoningConfig } from '../../contracts/reasoning.js';
|
|
3
|
+
import { AdapterInputSupport } from './input-capabilities/definitions/modelInputCapability.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file src/agent/runtime-kernel/llm/modelCatalog.ts
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* Agent runtime 对“模型目录”的最小协议定义。
|
|
10
|
+
* runtime-kernel 只依赖这些查询能力,不直接依赖 app 的 Model Catalog 实现。
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface ModelCatalogEntry {
|
|
14
|
+
id: string;
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
api_key?: string;
|
|
17
|
+
billing_mode?: 'byok' | 'cloud';
|
|
18
|
+
/**
|
|
19
|
+
* 是否允许客户端侧重试。
|
|
20
|
+
*
|
|
21
|
+
* 说明:
|
|
22
|
+
* - runtime-kernel 会基于该字段与 billing_mode 决定重试策略;
|
|
23
|
+
* - 该字段来自上层 Model Catalog(对齐 `src/domains/model-catalog/definitions/modelCatalog.ts`),避免在 runtime 侧出现类型漂移。
|
|
24
|
+
*/
|
|
25
|
+
enable_client_retry?: boolean;
|
|
26
|
+
model_name?: string;
|
|
27
|
+
capabilities?: readonly string[];
|
|
28
|
+
ui_visibility?: readonly string[];
|
|
29
|
+
/** Host 根据显式 inference route/capability 解析出的输入 placement 支持。 */
|
|
30
|
+
adapter_input_support?: AdapterInputSupport;
|
|
31
|
+
/**
|
|
32
|
+
* 思考努力程度能力契约。
|
|
33
|
+
*
|
|
34
|
+
* 说明:
|
|
35
|
+
* - 来自上层 Model Catalog 的 `ModelConfig.reasoning`(宿主 `defaultModelCatalog` 透传完整 `ModelConfig`);
|
|
36
|
+
* - kernel 侧 `prepareCallStage` 用它 + 用户请求档位调 `resolveEffectiveEffort()` 做统一降级;
|
|
37
|
+
* - 缺失表示该模型不支持 reasoning 控制,调用方不发任何思考相关字段。
|
|
38
|
+
*/
|
|
39
|
+
reasoning?: ModelReasoningConfig;
|
|
40
|
+
/** Chat route 的容量事实;fallback admission 只能读取正式 route。 */
|
|
41
|
+
inference_route?: {
|
|
42
|
+
context_window_tokens: number;
|
|
43
|
+
max_output_tokens: number;
|
|
44
|
+
};
|
|
45
|
+
/** Host 已解析的 token accounting route。 */
|
|
46
|
+
token_route?: TokenRoute;
|
|
47
|
+
}
|
|
48
|
+
interface ModelCatalogLike {
|
|
49
|
+
getModelById(id: string): ModelCatalogEntry | undefined;
|
|
50
|
+
getModelsByCapability(capability: string): ModelCatalogEntry[];
|
|
51
|
+
getModelsByUIVisibility(visibility: string): ModelCatalogEntry[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 为已由调用方提供的外部聊天引擎建立最小 catalog。
|
|
55
|
+
*
|
|
56
|
+
* quickstart 的 canonical inference port 本身承诺该 ID 可聊天;但它没有 Host route profile,
|
|
57
|
+
* 因此图片 placement 必须保持关闭,不能从“能聊天”推断“能识图”。
|
|
58
|
+
*/
|
|
59
|
+
declare function createFixedChatModelCatalog(modelId: string): ModelCatalogLike;
|
|
60
|
+
|
|
61
|
+
export { createFixedChatModelCatalog };
|
|
62
|
+
export type { ModelCatalogEntry, ModelCatalogLike };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ModelCatalogLike } from './modelCatalog.cjs';
|
|
2
|
+
import { ModelInputRequirement } from './input-capabilities/definitions/modelInputCapability.cjs';
|
|
3
|
+
|
|
4
|
+
interface ModelResolverOptions {
|
|
5
|
+
fallbackModelPreferredOrder?: readonly string[];
|
|
6
|
+
modelCatalog?: ModelCatalogLike;
|
|
7
|
+
}
|
|
8
|
+
interface ModelResolverLike {
|
|
9
|
+
resolveModelId(requestedModelId?: string): string;
|
|
10
|
+
pickFallbackChatModel(excludedModelIds: Set<string>, requirement: ModelInputRequirement): string | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 模型解析职责单独收口,避免 caller / executor stage 混入 registry 选模细节。
|
|
14
|
+
*/
|
|
15
|
+
declare class ModelResolver implements ModelResolverLike {
|
|
16
|
+
private readonly fallbackModelPreferredOrder;
|
|
17
|
+
private readonly modelCatalog;
|
|
18
|
+
constructor(options?: ModelResolverOptions);
|
|
19
|
+
resolveModelId(requestedModelId?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* 选模规则(严格、可解释):
|
|
22
|
+
* - “默认聊天模型”应来自主对话下拉(ui_visibility: 'chat'),而不是“任何具备 chat capability 的模型”。
|
|
23
|
+
*
|
|
24
|
+
* 根因说明:
|
|
25
|
+
* - default_models.json 中存在 mock-chat(capabilities: ['chat'],但 ui_visibility 是 'chat1');
|
|
26
|
+
* - 若按 capability='chat' 取第一个,会导致内部流程(如 deep_search 子 Agent)默认落到 mock 模型,
|
|
27
|
+
* 从而无法产生 tool_calls / final_answer(只会 yield thought)。
|
|
28
|
+
*/
|
|
29
|
+
private getDefaultChatModel;
|
|
30
|
+
/**
|
|
31
|
+
* 选择一个可用的“策略切模备用聊天模型”:
|
|
32
|
+
* - 必须具备 chat 能力
|
|
33
|
+
* - 必须已解析到 api_key(否则必然失败)
|
|
34
|
+
* - Host 可通过 fallbackModelPreferredOrder 显式声明顺序;Linnkit 不解释 URL 或 Provider 名称
|
|
35
|
+
*/
|
|
36
|
+
pickFallbackChatModel(excludedModelIds: Set<string>, requirement: ModelInputRequirement): string | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { ModelResolver };
|
|
40
|
+
export type { ModelResolverLike, ModelResolverOptions };
|