@librechat/agents 4.2.9 → 4.2.11
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/dist/cjs/agents/AgentContext.cjs +32 -2
- package/dist/cjs/agents/AgentContext.cjs.map +1 -1
- package/dist/cjs/harness/fileBindings.cjs +93 -0
- package/dist/cjs/harness/fileBindings.cjs.map +1 -0
- package/dist/cjs/harness/fileService.cjs +141 -0
- package/dist/cjs/harness/fileService.cjs.map +1 -0
- package/dist/cjs/harness/fileStream.cjs +76 -0
- package/dist/cjs/harness/fileStream.cjs.map +1 -0
- package/dist/cjs/harness/files.cjs +106 -0
- package/dist/cjs/harness/files.cjs.map +1 -0
- package/dist/cjs/harness/index.cjs +3 -0
- package/dist/cjs/harness/index.cjs.map +1 -1
- package/dist/cjs/llm/google/utils/signatures.cjs +5 -3
- package/dist/cjs/llm/google/utils/signatures.cjs.map +1 -1
- package/dist/cjs/main.cjs +13 -0
- package/dist/cjs/runtime/admission.cjs +135 -0
- package/dist/cjs/runtime/admission.cjs.map +1 -0
- package/dist/cjs/runtime/checkpoint.cjs +40 -0
- package/dist/cjs/runtime/checkpoint.cjs.map +1 -0
- package/dist/cjs/runtime/client.cjs +435 -0
- package/dist/cjs/runtime/client.cjs.map +1 -0
- package/dist/cjs/runtime/files.cjs +301 -0
- package/dist/cjs/runtime/files.cjs.map +1 -0
- package/dist/cjs/runtime/hostTools.cjs +165 -0
- package/dist/cjs/runtime/hostTools.cjs.map +1 -0
- package/dist/cjs/runtime/index.cjs +11 -0
- package/dist/cjs/runtime/model.cjs +303 -0
- package/dist/cjs/runtime/model.cjs.map +1 -0
- package/dist/cjs/runtime/peer.cjs +209 -0
- package/dist/cjs/runtime/peer.cjs.map +1 -0
- package/dist/cjs/runtime/policy.cjs +77 -0
- package/dist/cjs/runtime/policy.cjs.map +1 -0
- package/dist/cjs/runtime/recovery/client.cjs +172 -0
- package/dist/cjs/runtime/recovery/client.cjs.map +1 -0
- package/dist/cjs/runtime/recovery/log.cjs +47 -0
- package/dist/cjs/runtime/recovery/log.cjs.map +1 -0
- package/dist/cjs/runtime/recovery/redis.cjs +239 -0
- package/dist/cjs/runtime/recovery/redis.cjs.map +1 -0
- package/dist/cjs/runtime/recovery/server.cjs +190 -0
- package/dist/cjs/runtime/recovery/server.cjs.map +1 -0
- package/dist/cjs/runtime/recovery/socket.cjs +298 -0
- package/dist/cjs/runtime/recovery/socket.cjs.map +1 -0
- package/dist/cjs/runtime/resume.cjs +115 -0
- package/dist/cjs/runtime/resume.cjs.map +1 -0
- package/dist/cjs/runtime/sealed.cjs +107 -0
- package/dist/cjs/runtime/sealed.cjs.map +1 -0
- package/dist/cjs/runtime/server.cjs +415 -0
- package/dist/cjs/runtime/server.cjs.map +1 -0
- package/dist/cjs/runtime/snapshot.cjs +61 -0
- package/dist/cjs/runtime/snapshot.cjs.map +1 -0
- package/dist/cjs/runtime/types.cjs +20 -0
- package/dist/cjs/runtime/types.cjs.map +1 -0
- package/dist/cjs/runtime/wire.cjs +84 -0
- package/dist/cjs/runtime/wire.cjs.map +1 -0
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs +3 -2
- package/dist/cjs/tools/BashProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs +24 -1
- package/dist/cjs/tools/ProgrammaticCallerPolicy.cjs.map +1 -1
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs +3 -2
- package/dist/cjs/tools/ProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs +2 -1
- package/dist/cjs/tools/local/LocalProgrammaticToolCalling.cjs.map +1 -1
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs +15 -3
- package/dist/cjs/tools/subagent/SubagentExecutor.cjs.map +1 -1
- package/dist/cjs/tools/subagent/childGraphConfig.cjs +13 -1
- package/dist/cjs/tools/subagent/childGraphConfig.cjs.map +1 -1
- package/dist/cjs/tools/subagent/hostArgs.cjs +2 -0
- package/dist/cjs/tools/subagent/hostArgs.cjs.map +1 -1
- package/dist/esm/agents/AgentContext.mjs +32 -2
- package/dist/esm/agents/AgentContext.mjs.map +1 -1
- package/dist/esm/harness/fileBindings.mjs +93 -0
- package/dist/esm/harness/fileBindings.mjs.map +1 -0
- package/dist/esm/harness/fileService.mjs +140 -0
- package/dist/esm/harness/fileService.mjs.map +1 -0
- package/dist/esm/harness/fileStream.mjs +76 -0
- package/dist/esm/harness/fileStream.mjs.map +1 -0
- package/dist/esm/harness/files.mjs +97 -0
- package/dist/esm/harness/files.mjs.map +1 -0
- package/dist/esm/harness/index.mjs +3 -0
- package/dist/esm/harness/index.mjs.map +1 -1
- package/dist/esm/llm/google/utils/signatures.mjs +5 -3
- package/dist/esm/llm/google/utils/signatures.mjs.map +1 -1
- package/dist/esm/main.mjs +5 -2
- package/dist/esm/runtime/admission.mjs +133 -0
- package/dist/esm/runtime/admission.mjs.map +1 -0
- package/dist/esm/runtime/checkpoint.mjs +39 -0
- package/dist/esm/runtime/checkpoint.mjs.map +1 -0
- package/dist/esm/runtime/client.mjs +432 -0
- package/dist/esm/runtime/client.mjs.map +1 -0
- package/dist/esm/runtime/files.mjs +299 -0
- package/dist/esm/runtime/files.mjs.map +1 -0
- package/dist/esm/runtime/hostTools.mjs +164 -0
- package/dist/esm/runtime/hostTools.mjs.map +1 -0
- package/dist/esm/runtime/index.mjs +5 -0
- package/dist/esm/runtime/model.mjs +301 -0
- package/dist/esm/runtime/model.mjs.map +1 -0
- package/dist/esm/runtime/peer.mjs +209 -0
- package/dist/esm/runtime/peer.mjs.map +1 -0
- package/dist/esm/runtime/policy.mjs +75 -0
- package/dist/esm/runtime/policy.mjs.map +1 -0
- package/dist/esm/runtime/recovery/client.mjs +172 -0
- package/dist/esm/runtime/recovery/client.mjs.map +1 -0
- package/dist/esm/runtime/recovery/log.mjs +46 -0
- package/dist/esm/runtime/recovery/log.mjs.map +1 -0
- package/dist/esm/runtime/recovery/redis.mjs +239 -0
- package/dist/esm/runtime/recovery/redis.mjs.map +1 -0
- package/dist/esm/runtime/recovery/server.mjs +189 -0
- package/dist/esm/runtime/recovery/server.mjs.map +1 -0
- package/dist/esm/runtime/recovery/socket.mjs +297 -0
- package/dist/esm/runtime/recovery/socket.mjs.map +1 -0
- package/dist/esm/runtime/resume.mjs +111 -0
- package/dist/esm/runtime/resume.mjs.map +1 -0
- package/dist/esm/runtime/sealed.mjs +106 -0
- package/dist/esm/runtime/sealed.mjs.map +1 -0
- package/dist/esm/runtime/server.mjs +413 -0
- package/dist/esm/runtime/server.mjs.map +1 -0
- package/dist/esm/runtime/snapshot.mjs +60 -0
- package/dist/esm/runtime/snapshot.mjs.map +1 -0
- package/dist/esm/runtime/types.mjs +19 -0
- package/dist/esm/runtime/types.mjs.map +1 -0
- package/dist/esm/runtime/wire.mjs +80 -0
- package/dist/esm/runtime/wire.mjs.map +1 -0
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs +3 -2
- package/dist/esm/tools/BashProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs +24 -1
- package/dist/esm/tools/ProgrammaticCallerPolicy.mjs.map +1 -1
- package/dist/esm/tools/ProgrammaticToolCalling.mjs +3 -2
- package/dist/esm/tools/ProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs +2 -1
- package/dist/esm/tools/local/LocalProgrammaticToolCalling.mjs.map +1 -1
- package/dist/esm/tools/subagent/SubagentExecutor.mjs +15 -3
- package/dist/esm/tools/subagent/SubagentExecutor.mjs.map +1 -1
- package/dist/esm/tools/subagent/childGraphConfig.mjs +13 -1
- package/dist/esm/tools/subagent/childGraphConfig.mjs.map +1 -1
- package/dist/esm/tools/subagent/hostArgs.mjs +2 -1
- package/dist/esm/tools/subagent/hostArgs.mjs.map +1 -1
- package/dist/types/agents/AgentContext.d.ts +4 -4
- package/dist/types/agents/projection.d.ts +1 -1
- package/dist/types/events.d.ts +2 -2
- package/dist/types/graphs/Graph.d.ts +13 -13
- package/dist/types/graphs/MultiAgentGraph.d.ts +2 -2
- package/dist/types/graphs/acceptedModelResponse.d.ts +1 -1
- package/dist/types/graphs/createGraph.d.ts +4 -4
- package/dist/types/graphs/graphFactory.d.ts +1 -1
- package/dist/types/graphs/handoff.d.ts +1 -1
- package/dist/types/harness/fileBindings.d.ts +13 -0
- package/dist/types/harness/fileService.d.ts +37 -0
- package/dist/types/harness/fileStream.d.ts +7 -0
- package/dist/types/harness/files.d.ts +108 -0
- package/dist/types/harness/index.d.ts +8 -2
- package/dist/types/harness/model.d.ts +3 -3
- package/dist/types/harness/providerText.d.ts +2 -2
- package/dist/types/hitl/approvalReview.d.ts +1 -1
- package/dist/types/hitl/askUserQuestion.d.ts +1 -1
- package/dist/types/hitl/askUserQuestions.d.ts +1 -1
- package/dist/types/hitl/askUserQuestionsInterrupt.d.ts +1 -1
- package/dist/types/hooks/types.d.ts +2 -2
- package/dist/types/instrumentation.d.ts +1 -1
- package/dist/types/langfuse.d.ts +3 -3
- package/dist/types/langfuseConfig.d.ts +2 -2
- package/dist/types/langfuseRuntimeContext.d.ts +1 -1
- package/dist/types/langfuseRuntimeScope.d.ts +2 -2
- package/dist/types/langfuseSpanRegistry.d.ts +1 -1
- package/dist/types/langfuseToolOutputTracing.d.ts +3 -3
- package/dist/types/llm/anthropic/index.d.ts +1 -1
- package/dist/types/llm/bedrock/index.d.ts +1 -1
- package/dist/types/llm/bedrock/toolCache.d.ts +2 -2
- package/dist/types/llm/contextOverflowRecovery.d.ts +2 -2
- package/dist/types/llm/contextPressureMeter.d.ts +2 -2
- package/dist/types/llm/google/index.d.ts +1 -1
- package/dist/types/llm/init.d.ts +1 -1
- package/dist/types/llm/invoke.d.ts +9 -9
- package/dist/types/llm/mistral/index.d.ts +1 -1
- package/dist/types/llm/openai/index.d.ts +2 -2
- package/dist/types/llm/openrouter/index.d.ts +2 -2
- package/dist/types/llm/openrouter/toolCache.d.ts +2 -2
- package/dist/types/llm/prepareProviderRequest.d.ts +3 -3
- package/dist/types/llm/promptCacheTools.d.ts +1 -1
- package/dist/types/llm/providerRegistry.d.ts +1 -1
- package/dist/types/llm/providerTextBoundary.d.ts +2 -2
- package/dist/types/llm/providerTextControls.d.ts +1 -1
- package/dist/types/llm/providers.d.ts +2 -2
- package/dist/types/llm/request.d.ts +1 -1
- package/dist/types/llm/stream/chunkAdapters.d.ts +1 -1
- package/dist/types/llm/streamLimits.d.ts +1 -1
- package/dist/types/llm/truncation.d.ts +1 -1
- package/dist/types/llm/vertexai/index.d.ts +1 -1
- package/dist/types/messages/alternation.d.ts +1 -1
- package/dist/types/messages/anthropicToolCache.d.ts +2 -2
- package/dist/types/messages/assistantPhase.d.ts +3 -3
- package/dist/types/messages/budget.d.ts +1 -1
- package/dist/types/messages/cache.d.ts +1 -1
- package/dist/types/messages/contextPruning.d.ts +2 -2
- package/dist/types/messages/core.d.ts +1 -1
- package/dist/types/messages/fading.d.ts +1 -1
- package/dist/types/messages/format.d.ts +2 -2
- package/dist/types/messages/ids.d.ts +2 -2
- package/dist/types/messages/injected.d.ts +1 -1
- package/dist/types/messages/langchain.d.ts +1 -1
- package/dist/types/messages/prune.d.ts +4 -4
- package/dist/types/messages/recency.d.ts +1 -1
- package/dist/types/messages/toolResultTypes.d.ts +1 -1
- package/dist/types/openai/arguments.d.ts +1 -1
- package/dist/types/openai/index.d.ts +1 -1
- package/dist/types/openai/toolProjection.d.ts +1 -1
- package/dist/types/prompts/activityLabel.d.ts +2 -2
- package/dist/types/prompts/reasoningLabel.d.ts +1 -1
- package/dist/types/rerank/search.d.ts +1 -1
- package/dist/types/responses/index.d.ts +1 -1
- package/dist/types/run.d.ts +3 -3
- package/dist/types/runtime/admission.d.ts +30 -0
- package/dist/types/runtime/checkpoint.d.ts +14 -0
- package/dist/types/runtime/client.d.ts +12 -0
- package/dist/types/runtime/files.d.ts +75 -0
- package/dist/types/runtime/hostTools.d.ts +22 -0
- package/dist/types/runtime/identity.d.ts +2 -0
- package/dist/types/runtime/index.d.ts +12 -0
- package/dist/types/runtime/model.d.ts +42 -0
- package/dist/types/runtime/peer.d.ts +55 -0
- package/dist/types/runtime/policy.d.ts +43 -0
- package/dist/types/runtime/recovery/client.d.ts +12 -0
- package/dist/types/runtime/recovery/journal.d.ts +62 -0
- package/dist/types/runtime/recovery/log.d.ts +9 -0
- package/dist/types/runtime/recovery/redis.d.ts +17 -0
- package/dist/types/runtime/recovery/server.d.ts +37 -0
- package/dist/types/runtime/recovery/socket.d.ts +72 -0
- package/dist/types/runtime/resume.d.ts +66 -0
- package/dist/types/runtime/sealed.d.ts +19 -0
- package/dist/types/runtime/server.d.ts +21 -0
- package/dist/types/runtime/snapshot.d.ts +12 -0
- package/dist/types/runtime/types.d.ts +125 -0
- package/dist/types/runtime/wire.d.ts +3 -0
- package/dist/types/session/handlers.d.ts +1 -1
- package/dist/types/session/types.d.ts +1 -1
- package/dist/types/stream.d.ts +3 -3
- package/dist/types/summarization/index.d.ts +1 -1
- package/dist/types/summarization/input.d.ts +1 -1
- package/dist/types/summarization/node.d.ts +6 -6
- package/dist/types/summarization/retry.d.ts +2 -2
- package/dist/types/summarization/semanticIndex.d.ts +2 -2
- package/dist/types/summarization/toolBudget.d.ts +1 -1
- package/dist/types/summarization/usage.d.ts +1 -1
- package/dist/types/tools/ArtifactDelivery.d.ts +1 -1
- package/dist/types/tools/ArtifactTruncation.d.ts +1 -1
- package/dist/types/tools/BashExecutor.d.ts +2 -2
- package/dist/types/tools/BashProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/CallerCapabilities.d.ts +1 -1
- package/dist/types/tools/CodeExecutor.d.ts +4 -4
- package/dist/types/tools/CodeSessionFileSummary.d.ts +1 -1
- package/dist/types/tools/ProgrammaticCallerPolicy.d.ts +2 -1
- package/dist/types/tools/ProgrammaticToolCalling.d.ts +2 -2
- package/dist/types/tools/ReadFile.d.ts +1 -1
- package/dist/types/tools/SkillTool.d.ts +1 -1
- package/dist/types/tools/SubagentTool.d.ts +3 -3
- package/dist/types/tools/ToolNode.d.ts +5 -5
- package/dist/types/tools/ToolSearch.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareBridgeRuntime.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +2 -2
- package/dist/types/tools/cloudflare/CloudflareSandboxTools.d.ts +1 -1
- package/dist/types/tools/diagnostics.d.ts +1 -1
- package/dist/types/tools/eagerEventExecution.d.ts +1 -1
- package/dist/types/tools/handlers.d.ts +3 -3
- package/dist/types/tools/intentArg.d.ts +1 -1
- package/dist/types/tools/local/CompileCheckTool.d.ts +2 -2
- package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
- package/dist/types/tools/local/LocalCodingTools.d.ts +2 -2
- package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
- package/dist/types/tools/local/LocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/LocalProgrammaticToolCalling.d.ts +1 -1
- package/dist/types/tools/local/bashAst.d.ts +1 -1
- package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +1 -1
- package/dist/types/tools/local/syntaxCheck.d.ts +1 -1
- package/dist/types/tools/ptcTimeout.d.ts +1 -1
- package/dist/types/tools/runStepResume.d.ts +1 -1
- package/dist/types/tools/schema.d.ts +1 -1
- package/dist/types/tools/search/anthropic.d.ts +1 -1
- package/dist/types/tools/skillCatalog.d.ts +1 -1
- package/dist/types/tools/subagent/InMemorySubagentTaskStore.d.ts +1 -1
- package/dist/types/tools/subagent/SubagentExecutor.d.ts +5 -5
- package/dist/types/tools/subagent/SubagentReplay.d.ts +3 -3
- package/dist/types/tools/subagent/childGraphConfig.d.ts +2 -2
- package/dist/types/tools/subagent/diagnostics.d.ts +2 -2
- package/dist/types/tools/subagent/hostArgs.d.ts +8 -2
- package/dist/types/tools/subagent/index.d.ts +1 -1
- package/dist/types/tools/toolBatchReplay.d.ts +3 -3
- package/dist/types/types/activityLabel.d.ts +2 -2
- package/dist/types/types/graph.d.ts +16 -13
- package/dist/types/types/llm.d.ts +9 -9
- package/dist/types/types/reasoningLabel.d.ts +1 -1
- package/dist/types/types/run.d.ts +8 -8
- package/dist/types/types/stream.d.ts +5 -5
- package/dist/types/types/summarize.d.ts +2 -2
- package/dist/types/types/tools.d.ts +8 -8
- package/dist/types/utils/errors.d.ts +1 -1
- package/dist/types/utils/events.d.ts +3 -3
- package/dist/types/utils/handlers.d.ts +3 -3
- package/dist/types/utils/llm.d.ts +2 -2
- package/dist/types/utils/llmConfig.d.ts +1 -1
- package/dist/types/utils/title.d.ts +1 -1
- package/dist/types/utils/toolSessions.d.ts +1 -1
- package/package.json +22 -3
- package/src/agents/AgentContext.ts +68 -2
- package/src/harness/fileBindings.ts +156 -0
- package/src/harness/fileService.ts +217 -0
- package/src/harness/fileStream.ts +99 -0
- package/src/harness/files.ts +185 -0
- package/src/harness/index.ts +24 -0
- package/src/llm/google/utils/signatures.ts +10 -3
- package/src/runtime/admission.ts +224 -0
- package/src/runtime/checkpoint.ts +66 -0
- package/src/runtime/client.ts +674 -0
- package/src/runtime/files.ts +503 -0
- package/src/runtime/hostTools.ts +243 -0
- package/src/runtime/identity.ts +3 -0
- package/src/runtime/index.ts +33 -0
- package/src/runtime/model.ts +452 -0
- package/src/runtime/peer.ts +262 -0
- package/src/runtime/policy.ts +150 -0
- package/src/runtime/recovery/client.ts +232 -0
- package/src/runtime/recovery/journal.ts +88 -0
- package/src/runtime/recovery/log.ts +70 -0
- package/src/runtime/recovery/redis.ts +342 -0
- package/src/runtime/recovery/server.ts +280 -0
- package/src/runtime/recovery/socket.ts +422 -0
- package/src/runtime/resume.ts +268 -0
- package/src/runtime/sealed.ts +144 -0
- package/src/runtime/server.ts +653 -0
- package/src/runtime/snapshot.ts +87 -0
- package/src/runtime/types.ts +184 -0
- package/src/runtime/wire.ts +96 -0
- package/src/tools/BashProgrammaticToolCalling.ts +5 -2
- package/src/tools/ProgrammaticCallerPolicy.ts +42 -3
- package/src/tools/ProgrammaticToolCalling.ts +4 -1
- package/src/tools/local/LocalProgrammaticToolCalling.ts +4 -0
- package/src/tools/subagent/SubagentExecutor.ts +98 -32
- package/src/tools/subagent/childGraphConfig.ts +33 -1
- package/src/tools/subagent/hostArgs.ts +7 -0
- package/src/tools/subagent/index.ts +1 -0
- package/src/types/graph.ts +6 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
2
|
import type { ProviderFamily, ProviderRegistrationOptions } from '../provider-registration';
|
|
3
|
-
import type { ProviderModelConstructor, ProviderName } from '
|
|
3
|
+
import type { ProviderModelConstructor, ProviderName } from '../types/index.js';
|
|
4
4
|
type ProviderModelClass = new (config: never) => BaseChatModel;
|
|
5
5
|
/** Registers one host provider until the returned disposer is called. */
|
|
6
6
|
export declare function registerProvider<TOptions extends object, TModel extends BaseChatModel>(options: ProviderRegistrationOptions<TOptions, TModel>): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProviderTextProtection } from '
|
|
2
|
-
import type { ChatModel, ProviderName } from '
|
|
1
|
+
import type { ProviderTextProtection } from '../protection/providerText.js';
|
|
2
|
+
import type { ChatModel, ProviderName } from '../types/index.js';
|
|
3
3
|
/** Clone only known runnable shells. Never mutate a shared provider or its callback configuration. */
|
|
4
4
|
export declare function withProviderTextBoundary(model: ChatModel, policy: ProviderTextProtection, provider?: ProviderName): ChatModel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type { ProviderTextAttempt } from '
|
|
2
|
+
import type { ProviderTextAttempt } from '../protection/providerText.js';
|
|
3
3
|
export declare const GEMINI_SIGNATURES = "__gemini_function_call_thought_signatures__";
|
|
4
4
|
export declare const RESPONSES_POSITIONS = "__openai_responses_replay_positions__";
|
|
5
5
|
export declare function keys(value: unknown, allowed: readonly string[]): value is Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProviderModelConstructor, ProviderName } from '
|
|
1
|
+
import type { ProviderModelConstructor, ProviderName } from '../types/index.js';
|
|
2
2
|
export declare const getChatModelClass: <P extends ProviderName>(provider: P) => ProviderModelConstructor<P>;
|
|
3
|
-
export { getProviderFamily, providerRequiresStrictAlternation, providerUsesManualToolStream, registerProvider, } from '
|
|
3
|
+
export { getProviderFamily, providerRequiresStrictAlternation, providerUsesManualToolStream, registerProvider, } from './providerRegistry.js';
|
|
4
4
|
export type { ProviderFamily, ProviderRegistrationOptions, } from '../provider-registration';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AIMessageChunk } from '@langchain/core/messages';
|
|
2
2
|
import { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
3
3
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
4
|
-
import type { SmoothItem, SmoothPiece } from '
|
|
4
|
+
import type { SmoothItem, SmoothPiece } from './smoother.js';
|
|
5
5
|
/**
|
|
6
6
|
* Rebuilds a generation chunk carrying one piece of a split plain-text chunk.
|
|
7
7
|
* Unsplit pieces return the original chunk untouched, so disabled smoothing is
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AIMessageChunk, BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { ProviderName } from '
|
|
2
|
+
import type { ProviderName } from '../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Normalized truncation reasons across providers. Providers disagree on the
|
|
5
5
|
* key and the value: Anthropic/Bedrock use `max_tokens`, OpenAI uses `length`,
|
|
@@ -4,7 +4,7 @@ import type { GeminiContent, GoogleAIModelRequestParams, GoogleAbstractedClient
|
|
|
4
4
|
import type { CallbackManagerForLLMRun } from '@langchain/core/callbacks/manager';
|
|
5
5
|
import type { ChatGenerationChunk } from '@langchain/core/outputs';
|
|
6
6
|
import type { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
7
|
-
import type { GoogleThinkingConfig, VertexAIClientOptions } from '
|
|
7
|
+
import type { GoogleThinkingConfig, VertexAIClientOptions } from '../../types/index.js';
|
|
8
8
|
/**
|
|
9
9
|
* `@langchain/google-common`'s `_streamResponseChunks` emits usage on TWO
|
|
10
10
|
* different paths within the same stream:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import { Providers } from '
|
|
2
|
+
import { Providers } from '../common/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Providers whose APIs specify strict user/assistant alternation. Mistral
|
|
5
5
|
* rejects consecutive user turns outright. Bedrock's Converse API documents
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
* never mutating the original tool instance, since callers may share them
|
|
25
25
|
* across runs.
|
|
26
26
|
*/
|
|
27
|
-
import type { GraphTools } from '
|
|
28
|
-
import { type PromptCacheTtl } from '
|
|
27
|
+
import type { GraphTools } from '../types/index.js';
|
|
28
|
+
import { type PromptCacheTtl } from './cache.js';
|
|
29
29
|
/**
|
|
30
30
|
* Returns a callable that reports whether a given tool *name* is deferred
|
|
31
31
|
* according to the supplied registry of tool definitions. Tools without
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AssistantTextPhase } from '
|
|
2
|
-
import type { MessageContentComplex } from '
|
|
3
|
-
import { ContentTypes } from '
|
|
1
|
+
import type { AssistantTextPhase } from '../types/assistantPhase.js';
|
|
2
|
+
import type { MessageContentComplex } from '../types/stream.js';
|
|
3
|
+
import { ContentTypes } from '../common/index.js';
|
|
4
4
|
export type MessageCreationContentMetadata = {
|
|
5
5
|
content_type?: ContentTypes.TEXT | ContentTypes.THINK;
|
|
6
6
|
phase?: AssistantTextPhase;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
-
import type * as t from '
|
|
3
|
+
import type * as t from '../types/index.js';
|
|
4
4
|
/** Counts retained tool exchanges without serializing arguments or result content. */
|
|
5
5
|
export interface ToolMessageUsageAccumulator {
|
|
6
6
|
add(message: BaseMessage, getRawTokens: () => number): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseMessage, MessageContentComplex } from '@langchain/core/messages';
|
|
2
|
-
import type { AnthropicMessage } from '
|
|
2
|
+
import type { AnthropicMessage } from '../types/messages.js';
|
|
3
3
|
type MessageWithContent = {
|
|
4
4
|
content?: string | MessageContentComplex[];
|
|
5
5
|
};
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { type BaseMessage } from '@langchain/core/messages';
|
|
16
16
|
import type { ContextPruningSettings } from './contextPruningSettings';
|
|
17
|
-
import type { ContextPruningConfig } from '
|
|
18
|
-
import type { TokenCounter } from '
|
|
17
|
+
import type { ContextPruningConfig } from '../types/graph.js';
|
|
18
|
+
import type { TokenCounter } from '../types/run.js';
|
|
19
19
|
export interface ContextPruningResult {
|
|
20
20
|
/** Number of messages that were soft-trimmed. */
|
|
21
21
|
softTrimmed: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AIMessage, BaseMessage, ToolMessage, HumanMessage, AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type * as t from '
|
|
2
|
+
import type * as t from '../types/index.js';
|
|
3
3
|
import type { ToolHistoryPreparation } from './toolHistoryProjection';
|
|
4
4
|
export declare function getConverseOverrideMessage({ userMessage, lastMessageX, lastMessageY, }: {
|
|
5
5
|
userMessage: string[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AIMessage, ToolMessage, BaseMessage, HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { MessageContentImageUrl } from '@langchain/core/messages';
|
|
3
3
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
4
|
-
import type { MessageContentComplex, TPayload, ProviderName, CompactionSemanticIndex, CompactionSemanticIndexSnapshot } from '
|
|
4
|
+
import type { MessageContentComplex, TPayload, ProviderName, CompactionSemanticIndex, CompactionSemanticIndexSnapshot } from '../types/index.js';
|
|
5
5
|
import type { ToolHistoryPreparation } from './toolHistoryProjection';
|
|
6
|
-
import { Providers } from '
|
|
6
|
+
import { Providers } from '../common/index.js';
|
|
7
7
|
interface MediaMessageParams {
|
|
8
8
|
message: {
|
|
9
9
|
role: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { Graph } from '
|
|
2
|
-
import type * as t from '
|
|
1
|
+
import type { Graph } from '../graphs/index.js';
|
|
2
|
+
import type * as t from '../types/index.js';
|
|
3
3
|
export declare const getMessageId: (stepKey: string, graph: Graph<t.BaseGraphState>, returnExistingId?: boolean) => string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MessageContent } from '@langchain/core/messages';
|
|
2
|
-
import type * as t from '
|
|
2
|
+
import type * as t from '../types/index.js';
|
|
3
3
|
type LibreChatMessageContent = MessageContent | string | t.MessageContentComplex[] | t.ExtendedMessageContent[];
|
|
4
4
|
type WithLangChainContent<T extends {
|
|
5
5
|
content: LibreChatMessageContent;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
|
|
2
|
-
import type { ContextPruningConfig, FadingTier } from '
|
|
2
|
+
import type { ContextPruningConfig, FadingTier } from '../types/graph.js';
|
|
3
3
|
import type { FadingCaps } from './fading';
|
|
4
|
-
import type { TokenCounter } from '
|
|
5
|
-
import type { ProviderName } from '
|
|
6
|
-
import { ContentTypes } from '
|
|
4
|
+
import type { TokenCounter } from '../types/run.js';
|
|
5
|
+
import type { ProviderName } from '../types/index.js';
|
|
6
|
+
import { ContentTypes } from '../common/index.js';
|
|
7
7
|
/** Default fraction of the token budget reserved as headroom (5 %). */
|
|
8
8
|
export declare const DEFAULT_RESERVE_RATIO = 0.05;
|
|
9
9
|
/** Provider framing reserved for the assistant reply label. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { ProviderName } from '
|
|
2
|
+
import type { ProviderName } from '../types/llm.js';
|
|
3
3
|
export declare const DEFAULT_RETAIN_RECENT_TURNS = 2;
|
|
4
4
|
export declare const DEFAULT_INTRA_TURN_RETAIN_RATIO = 0.16;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { ProviderName } from '
|
|
2
|
+
import type { ProviderName } from '../types/llm.js';
|
|
3
3
|
export type ProviderToolCallKind = 'tool' | 'server' | 'anthropic-server' | 'mcp' | 'google' | 'bedrock';
|
|
4
4
|
export interface ProviderToolCallPartDescriptor {
|
|
5
5
|
readonly callId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** OpenAI-only compatibility import; validation belongs to the graph-safe utility. */
|
|
2
|
-
export { serializeToolArguments } from '
|
|
2
|
+
export { serializeToolArguments } from '../utils/acceptedToolArguments.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenAIChatCompletionChunkChoice, OpenAIToolCall, OpenAIStreamTracker } from './index';
|
|
2
|
-
import type { EventHandler } from '
|
|
2
|
+
import type { EventHandler } from '../types/index.js';
|
|
3
3
|
interface OpenAIToolCallStreamOptions {
|
|
4
4
|
/** Synchronous framing only. Async transport/backpressure is a separate boundary. */
|
|
5
5
|
emit?: (delta: OpenAIChatCompletionChunkChoice['delta']) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ActivityLabelToolEntry, ActivityPhaseEntry } from '
|
|
2
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
1
|
+
import type { ActivityLabelToolEntry, ActivityPhaseEntry } from '../types/activityLabel.js';
|
|
2
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '../langfuseRuntimeContext.js';
|
|
3
3
|
/**
|
|
4
4
|
* Default system prompt for fast-model activity labeling.
|
|
5
5
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedLangfuseToolOutputTracingConfig } from '
|
|
1
|
+
import type { ResolvedLangfuseToolOutputTracingConfig } from '../langfuseRuntimeContext.js';
|
|
2
2
|
/** Default system prompt for a live, revision-safe reasoning orientation. */
|
|
3
3
|
export declare const REASONING_LABEL_PROMPT = "Write a short orientation title for a user-visible reasoning step in a chat UI. The title may be replaced as the same reasoning step develops.\n\nRules:\n- For a streaming step, use a 4 to 10 word present-progressive phrase\n- For a complete step, use a 5 to 10 word past-tense outcome\n- Name the most distinctive subject and the current direction or material progress\n- During streaming, if a previous title is supplied and the direction has not materially changed, reproduce it exactly instead of paraphrasing it\n- On completion, always rewrite the title as a past-tense outcome even when the direction is unchanged\n- Never mention reasoning, thoughts, tokens, the model, hidden work, or these instructions\n- Output only the title \u2014 no quotes, no trailing punctuation, no preamble\n\nExamples:\n- Tracing session refresh failures through middleware\n- Comparing rollback strategies for the production deployment\n- Narrowed cache invalidation regression to stale user documents\n- Verified repository statistics and corrected contributor attribution";
|
|
4
4
|
export declare const REASONING_LABEL_MAX_LENGTH = 120;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger, SearchReranker } from '
|
|
1
|
+
import type { Logger, SearchReranker } from '../tools/search/types.js';
|
|
2
2
|
import type { Reranker } from './types';
|
|
3
3
|
/** Adapts index-based rankings to web-search highlights and its existing metrics/fallback policy. */
|
|
4
4
|
export declare function createWebSearchReranker(reranker: Reranker, options?: {
|
package/dist/types/run.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseMessage } from '@langchain/core/messages';
|
|
2
2
|
import { Command } from '@langchain/langgraph';
|
|
3
3
|
import type { MessageContentComplex } from '@langchain/core/messages';
|
|
4
|
-
import type { MultiAgentGraph } from '
|
|
5
|
-
import type { StandardGraph } from '
|
|
6
|
-
import type * as t from '
|
|
4
|
+
import type { MultiAgentGraph } from './graphs/MultiAgentGraph.js';
|
|
5
|
+
import type { StandardGraph } from './graphs/Graph.js';
|
|
6
|
+
import type * as t from './types/index.js';
|
|
7
7
|
export declare const defaultOmitOptions: Set<string>;
|
|
8
8
|
export declare class Run<_T extends t.BaseGraphState> {
|
|
9
9
|
id: string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Callbacks } from '@langchain/core/callbacks/manager';
|
|
3
|
+
import type { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
4
|
+
import type { SdkRpc } from './peer';
|
|
5
|
+
import { HostChatModel } from '../index.js';
|
|
6
|
+
export interface RemoteModelAttempt {
|
|
7
|
+
nodeId: string;
|
|
8
|
+
modelId: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const modelAttemptSchema: z.ZodType<RemoteModelAttempt>;
|
|
11
|
+
/** Additive SDK capability: older SDKs keep the input-only model adapter during rollout. */
|
|
12
|
+
export declare const supportsModelInvocationContext: boolean;
|
|
13
|
+
export interface HostModelLifecycle {
|
|
14
|
+
attach(callbacks: Callbacks | undefined): boolean;
|
|
15
|
+
readonly maxEntries: number;
|
|
16
|
+
failure(): Error | undefined;
|
|
17
|
+
invoke<T>(context: RemoteModelAttempt | undefined, operation: () => Promise<T>): Promise<T>;
|
|
18
|
+
stream<T>(context: RemoteModelAttempt | undefined, operation: () => AsyncIterable<T>): AsyncIterable<T>;
|
|
19
|
+
end(data: unknown): boolean;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
}
|
|
22
|
+
export interface WorkerModelLifecycle {
|
|
23
|
+
callback: BaseCallbackHandler;
|
|
24
|
+
current(context?: unknown): RemoteModelAttempt | undefined;
|
|
25
|
+
model(options: ConstructorParameters<typeof HostChatModel>[0]): HostChatModel;
|
|
26
|
+
}
|
|
27
|
+
/** Only callbacks installed on this root execution can enroll a model attempt. No message text is relayed. */
|
|
28
|
+
export declare function createWorkerModelLifecycle(agentId: string, maxEntries: number, peer: {
|
|
29
|
+
call: SdkRpc;
|
|
30
|
+
}): WorkerModelLifecycle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SdkRpc } from './peer';
|
|
2
|
+
import { BaseCheckpointSaver } from '../index.js';
|
|
3
|
+
type Saver = BaseCheckpointSaver;
|
|
4
|
+
/** The host retains its durable saver; the worker never receives database credentials. */
|
|
5
|
+
export declare class RemoteSdkCheckpointer extends BaseCheckpointSaver {
|
|
6
|
+
private readonly call;
|
|
7
|
+
constructor(call: SdkRpc);
|
|
8
|
+
getTuple(...args: Parameters<Saver['getTuple']>): ReturnType<Saver['getTuple']>;
|
|
9
|
+
list(...args: Parameters<Saver['list']>): ReturnType<Saver['list']>;
|
|
10
|
+
put(...args: Parameters<Saver['put']>): ReturnType<Saver['put']>;
|
|
11
|
+
putWrites(...args: Parameters<Saver['putWrites']>): ReturnType<Saver['putWrites']>;
|
|
12
|
+
deleteThread(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RunConfig } from '../index.js';
|
|
2
|
+
import type { RemoteSdkHostServices, RemoteSdkOptions, RemoteSdkResumeState } from './types';
|
|
3
|
+
import type { SdkAgentIdentity } from './identity';
|
|
4
|
+
import { Run } from '../index.js';
|
|
5
|
+
/** Construct a real local Run whose execution is delegated to one operator-trusted runtime. */
|
|
6
|
+
export declare function createRemoteSdkRun({ config, identity, remote, resumeState, hostServices, }: {
|
|
7
|
+
config: RunConfig;
|
|
8
|
+
hostServices?: RemoteSdkHostServices;
|
|
9
|
+
identity: Readonly<SdkAgentIdentity>;
|
|
10
|
+
remote: RemoteSdkOptions;
|
|
11
|
+
resumeState?: RemoteSdkResumeState;
|
|
12
|
+
}): ReturnType<typeof Run.create>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { HostFileDescriptor, HostFileBindings } from '../index.js';
|
|
3
|
+
import type { RemoteSdkHostServices, RemoteSdkLimits, RemoteSdkStart } from './types';
|
|
4
|
+
import type { SdkAgentIdentity } from './identity';
|
|
5
|
+
import type { SdkRpc } from './peer';
|
|
6
|
+
export declare const fileChannelSchema: z.ZodObject<{
|
|
7
|
+
version: z.ZodLiteral<1>;
|
|
8
|
+
publicKey: z.ZodString;
|
|
9
|
+
descriptor: z.ZodObject<{
|
|
10
|
+
version: z.ZodLiteral<1>;
|
|
11
|
+
operations: z.ZodArray<z.ZodEnum<{
|
|
12
|
+
read: "read";
|
|
13
|
+
stage: "stage";
|
|
14
|
+
publish: "publish";
|
|
15
|
+
}>>;
|
|
16
|
+
maxFileBytes: z.ZodNumber;
|
|
17
|
+
maxChunkBytes: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
sources: z.ZodArray<z.ZodObject<{
|
|
20
|
+
reference: z.ZodString;
|
|
21
|
+
revision: z.ZodString;
|
|
22
|
+
filename: z.ZodString;
|
|
23
|
+
mediaType: z.ZodString;
|
|
24
|
+
bytes: z.ZodNumber;
|
|
25
|
+
sha256: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
declare const resultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
+
version: z.ZodLiteral<1>;
|
|
30
|
+
ok: z.ZodLiteral<true>;
|
|
31
|
+
value: z.ZodUnknown;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
version: z.ZodLiteral<1>;
|
|
34
|
+
ok: z.ZodLiteral<false>;
|
|
35
|
+
code: z.ZodEnum<{
|
|
36
|
+
unavailable: "unavailable";
|
|
37
|
+
timeout: "timeout";
|
|
38
|
+
overflow: "overflow";
|
|
39
|
+
cancelled: "cancelled";
|
|
40
|
+
incompatible: "incompatible";
|
|
41
|
+
conflict: "conflict";
|
|
42
|
+
forbidden: "forbidden";
|
|
43
|
+
}>;
|
|
44
|
+
}, z.core.$strict>], "ok">;
|
|
45
|
+
type FileChannelResult = z.infer<typeof resultSchema>;
|
|
46
|
+
type FileChannelCall = (method: string, data: unknown, signal?: AbortSignal) => Promise<FileChannelResult>;
|
|
47
|
+
/** File contents are sealed before they reach RPC queues or durable recovery journals. */
|
|
48
|
+
export declare function createHostFileChannel(options: {
|
|
49
|
+
files: NonNullable<RemoteSdkHostServices['files']>;
|
|
50
|
+
identity: Readonly<SdkAgentIdentity>;
|
|
51
|
+
peer: {
|
|
52
|
+
call: SdkRpc;
|
|
53
|
+
};
|
|
54
|
+
limits: RemoteSdkLimits;
|
|
55
|
+
signal: AbortSignal;
|
|
56
|
+
}): {
|
|
57
|
+
descriptor: NonNullable<RemoteSdkStart['files']>;
|
|
58
|
+
dispose(): void;
|
|
59
|
+
call: FileChannelCall;
|
|
60
|
+
};
|
|
61
|
+
/** Pull uploads one chunk at a time; no whole-file buffer and no speculative producer reads. */
|
|
62
|
+
export declare function createWorkerFileChannel(options: {
|
|
63
|
+
peer: {
|
|
64
|
+
call: SdkRpc;
|
|
65
|
+
};
|
|
66
|
+
limits: RemoteSdkLimits;
|
|
67
|
+
signal: AbortSignal;
|
|
68
|
+
}): {
|
|
69
|
+
dispose(): void;
|
|
70
|
+
accept(data: unknown, signal?: AbortSignal): Promise<FileChannelResult>;
|
|
71
|
+
bind(identity: Readonly<SdkAgentIdentity>, input: NonNullable<RemoteSdkStart['files']>): HostFileBindings & {
|
|
72
|
+
sources: readonly HostFileDescriptor[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EventHandler, HostToolDescriptor, HostToolService, ToolExecuteResult } from '../index.js';
|
|
2
|
+
import type { SdkAgentIdentity } from './identity';
|
|
3
|
+
import type { SdkRpc } from './peer';
|
|
4
|
+
/** Local credentials/configuration are supplied by the authenticated host, never by the worker. */
|
|
5
|
+
export declare function createHostToolService(options: {
|
|
6
|
+
identity: Readonly<SdkAgentIdentity>;
|
|
7
|
+
tools: HostToolDescriptor[];
|
|
8
|
+
handler: EventHandler;
|
|
9
|
+
graph?: Parameters<EventHandler['handle']>[3];
|
|
10
|
+
configurable: Record<string, unknown>;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
peer: {
|
|
13
|
+
call: SdkRpc;
|
|
14
|
+
};
|
|
15
|
+
signal: AbortSignal;
|
|
16
|
+
}): (data: unknown, invocationSignal?: AbortSignal) => Promise<ToolExecuteResult[]>;
|
|
17
|
+
export declare function createWorkerToolService(peer: {
|
|
18
|
+
call: SdkRpc;
|
|
19
|
+
}): {
|
|
20
|
+
service: HostToolService;
|
|
21
|
+
accept: (data: unknown, kind?: 'result' | 'session') => null;
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { createRemoteSdkServer } from './server';
|
|
2
|
+
export { createRemoteSdkRun } from './client';
|
|
3
|
+
export { createRedisRuntimeJournal } from './recovery/redis';
|
|
4
|
+
export type { RemoteSdkServerOptions } from './server';
|
|
5
|
+
export type { SdkAgentIdentity } from './identity';
|
|
6
|
+
export type { RemoteSdkFactoryInput, RemoteSdkHostServices, RemoteSdkOptions, RemoteSdkResumeState, RemoteSdkLimits, RemoteSdkModelProfile, } from './types';
|
|
7
|
+
export type { HostModelLifecycle, RemoteModelAttempt } from './admission';
|
|
8
|
+
export type { RuntimeJournalRedis, RuntimeJournalLimits, } from './recovery/redis';
|
|
9
|
+
export type { RuntimeJournal, RuntimeJournalSession, RuntimeJournalLease, RuntimeJournalResult, RuntimeJournalState, RuntimeJournalFailure, } from './recovery/journal';
|
|
10
|
+
export type { RuntimeRecoveryOptions } from './recovery/server';
|
|
11
|
+
export type { RemoteSdkRecoveryOptions } from './types';
|
|
12
|
+
export { normalizeResumeRunStepIndices, hydrateResumeRunSteps, createContentIndexOffsetHandlers, } from './resume';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RemoteSdkFactoryInput, RemoteSdkHostServices, RemoteSdkLimits, RemoteSdkStart } from './types';
|
|
2
|
+
import type { HostModelErrorCode } from '../index.js';
|
|
3
|
+
import type { HostModelLifecycle, WorkerModelLifecycle } from './admission';
|
|
4
|
+
import type { SdkAgentIdentity } from './identity';
|
|
5
|
+
import type { SdkRpc } from './peer';
|
|
6
|
+
import { createPolicySender } from './sealed';
|
|
7
|
+
type ModelFailure = {
|
|
8
|
+
version: 1;
|
|
9
|
+
ok: false;
|
|
10
|
+
code: HostModelErrorCode;
|
|
11
|
+
};
|
|
12
|
+
type ModelReply = ModelFailure | {
|
|
13
|
+
version: 1;
|
|
14
|
+
ok: true;
|
|
15
|
+
message?: ReturnType<ReturnType<typeof createPolicySender>>;
|
|
16
|
+
};
|
|
17
|
+
/** One byte window shared by every model stream on this execution's connection. */
|
|
18
|
+
export declare function createHostModelChannel(options: {
|
|
19
|
+
model: NonNullable<RemoteSdkHostServices['model']>;
|
|
20
|
+
lifecycle?: HostModelLifecycle;
|
|
21
|
+
peer: {
|
|
22
|
+
call: SdkRpc;
|
|
23
|
+
};
|
|
24
|
+
limits: RemoteSdkLimits;
|
|
25
|
+
signal: AbortSignal;
|
|
26
|
+
}): {
|
|
27
|
+
call(method: string, data: unknown, signal?: AbortSignal): Promise<ModelReply>;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
descriptor: NonNullable<RemoteSdkStart['model']>;
|
|
30
|
+
};
|
|
31
|
+
/** Chunk receipts release credits only when consumed, so a slow graph bounds host production. */
|
|
32
|
+
export declare function createWorkerModelChannel(options: {
|
|
33
|
+
peer: {
|
|
34
|
+
call: SdkRpc;
|
|
35
|
+
};
|
|
36
|
+
limits: RemoteSdkLimits;
|
|
37
|
+
signal: AbortSignal;
|
|
38
|
+
}): {
|
|
39
|
+
bind(identity: Readonly<SdkAgentIdentity>, descriptor: NonNullable<RemoteSdkStart['model']>, admission?: WorkerModelLifecycle): NonNullable<RemoteSdkFactoryInput['hostModel']>;
|
|
40
|
+
accept(data: unknown, signal?: AbortSignal): Promise<ModelReply>;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { WebSocket } from 'ws';
|
|
2
|
+
/** Logical connections may survive replacement of their underlying WebSocket. */
|
|
3
|
+
export interface SdkSocket {
|
|
4
|
+
readonly readyState: number;
|
|
5
|
+
readonly bufferedAmount: number;
|
|
6
|
+
send(data: string): void;
|
|
7
|
+
close(code?: number): void;
|
|
8
|
+
on(event: 'message', listener: (data: WebSocket.RawData) => void): this;
|
|
9
|
+
on(event: 'close' | 'error', listener: () => void): this;
|
|
10
|
+
once(event: 'close' | 'error', listener: () => void): this;
|
|
11
|
+
}
|
|
12
|
+
/** Cancellation requests remote cleanup; settlement waits for its reply (or the RPC deadline). */
|
|
13
|
+
export type SdkRpc = (method: string, data: unknown, timeoutMs?: number, signal?: AbortSignal) => Promise<unknown>;
|
|
14
|
+
export type SdkFrame = {
|
|
15
|
+
type: 'call';
|
|
16
|
+
id: string;
|
|
17
|
+
method: string;
|
|
18
|
+
data: unknown;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'cancel';
|
|
21
|
+
id: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'result';
|
|
24
|
+
id: string;
|
|
25
|
+
data: unknown;
|
|
26
|
+
failed?: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
type: 'event';
|
|
29
|
+
name: string;
|
|
30
|
+
data: unknown;
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'snapshot';
|
|
34
|
+
data: unknown;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'done';
|
|
37
|
+
data: unknown;
|
|
38
|
+
} | {
|
|
39
|
+
type: 'error';
|
|
40
|
+
};
|
|
41
|
+
export interface SdkPeer {
|
|
42
|
+
call: SdkRpc;
|
|
43
|
+
send(frame: SdkFrame): void;
|
|
44
|
+
close(): void;
|
|
45
|
+
}
|
|
46
|
+
/** Ordered dispatch and bounded RPC lifetime. Errors on this boundary never disclose upstream text. */
|
|
47
|
+
export declare function createSdkPeer(socket: SdkSocket, options: {
|
|
48
|
+
maxFrameBytes: number;
|
|
49
|
+
maxBufferedBytes: number;
|
|
50
|
+
timeoutMs: number;
|
|
51
|
+
onCall: SdkRpc;
|
|
52
|
+
onFrame: (frame: SdkFrame) => Promise<void>;
|
|
53
|
+
onClose: (error: Error) => void;
|
|
54
|
+
onError?: (error: unknown) => void;
|
|
55
|
+
}): SdkPeer;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { HostProviderTextDescriptor, ProviderTextProtectionErrorCode, ProviderTextProtection } from '../index.js';
|
|
3
|
+
import type { RemoteSdkHostServices, RemoteSdkStart, RemoteSdkLimits } from './types';
|
|
4
|
+
import type { SdkAgentIdentity } from './identity';
|
|
5
|
+
import type { SdkRpc } from './peer';
|
|
6
|
+
export declare const policyDescriptorSchema: z.ZodObject<{
|
|
7
|
+
version: z.ZodLiteral<1>;
|
|
8
|
+
publicKey: z.ZodString;
|
|
9
|
+
limits: z.ZodObject<{
|
|
10
|
+
version: z.ZodLiteral<1>;
|
|
11
|
+
timeoutMs: z.ZodNumber;
|
|
12
|
+
maxAttemptBytes: z.ZodNumber;
|
|
13
|
+
maxBufferedBytes: z.ZodNumber;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
/** Only sanitized failures and approved canonical text enter the peer's reply/logging path. */
|
|
17
|
+
export declare function createHostPolicyChannel(providerText: NonNullable<RemoteSdkHostServices['providerText']>, limits: RemoteSdkLimits): {
|
|
18
|
+
descriptor: {
|
|
19
|
+
version: 1;
|
|
20
|
+
publicKey: string;
|
|
21
|
+
limits: HostProviderTextDescriptor;
|
|
22
|
+
};
|
|
23
|
+
dispose: () => void;
|
|
24
|
+
inspect: (data: unknown, signal?: AbortSignal) => Promise<{
|
|
25
|
+
readonly version: 1;
|
|
26
|
+
readonly ok: false;
|
|
27
|
+
readonly error: {
|
|
28
|
+
readonly code: ProviderTextProtectionErrorCode;
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
version: 1;
|
|
32
|
+
ok: true;
|
|
33
|
+
content: string;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
export declare function createWorkerProviderTextPolicy(options: {
|
|
37
|
+
descriptor: NonNullable<RemoteSdkStart['providerText']>;
|
|
38
|
+
identity: Readonly<SdkAgentIdentity>;
|
|
39
|
+
peer: {
|
|
40
|
+
call: SdkRpc;
|
|
41
|
+
};
|
|
42
|
+
limits: RemoteSdkLimits;
|
|
43
|
+
}): ProviderTextProtection;
|