@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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RemoteSdkLimits, RemoteSdkRecoveryOptions } from '../types';
|
|
2
|
+
import type { RecoveryClaim } from './server';
|
|
3
|
+
import { RecoverySocket } from './socket';
|
|
4
|
+
export declare function connectRecoveringSdkSocket(options: {
|
|
5
|
+
url: string;
|
|
6
|
+
token: (claim: RecoveryClaim) => string;
|
|
7
|
+
generation?: string;
|
|
8
|
+
limits: RemoteSdkLimits;
|
|
9
|
+
recovery: RemoteSdkRecoveryOptions;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
onError?: (error: unknown) => void;
|
|
12
|
+
}): Promise<RecoverySocket>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Durable wire frames, independent of SDK objects, sockets, and browser rendering. */
|
|
2
|
+
export interface RuntimeJournalLease {
|
|
3
|
+
owner: string;
|
|
4
|
+
epoch: number;
|
|
5
|
+
}
|
|
6
|
+
export interface RuntimeJournalSession {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
/** Hash of verified runtime/agent/run/caller/tenant/thread/generation identity, never a request-body authority. */
|
|
9
|
+
scope: string;
|
|
10
|
+
}
|
|
11
|
+
export type RuntimeJournalFailure = 'missing' | 'scope_mismatch' | 'fenced' | 'closed' | 'limit' | 'cursor_ahead' | 'batch_conflict' | 'already_exists';
|
|
12
|
+
export type RuntimeJournalResult<T> = {
|
|
13
|
+
ok: true;
|
|
14
|
+
value: T;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
error: {
|
|
18
|
+
code: RuntimeJournalFailure;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type RuntimeJournalState = 'open' | 'completed' | 'failed' | 'cancelled' | 'paused';
|
|
22
|
+
export interface RuntimeJournalPage {
|
|
23
|
+
state: RuntimeJournalState;
|
|
24
|
+
started: boolean;
|
|
25
|
+
head: number;
|
|
26
|
+
acknowledged: number;
|
|
27
|
+
frames: Array<{
|
|
28
|
+
sequence: number;
|
|
29
|
+
payload: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Acknowledgements never evict frames: a replacement connection may need the full prefix.
|
|
34
|
+
* Expiration/limits bound retention. A claimed session with started=true MUST NOT start a
|
|
35
|
+
* second SDK Run; execution adoption needs a separate, explicit recovery protocol.
|
|
36
|
+
* Session IDs are single-use. A missing/expired replay session must fail, not silently
|
|
37
|
+
* create another execution. Store durability depends on the deployment persistence policy.
|
|
38
|
+
*/
|
|
39
|
+
export interface RuntimeJournal {
|
|
40
|
+
readonly leaseMs: number;
|
|
41
|
+
readonly maxBatchFrames: number;
|
|
42
|
+
readonly maxBatchBytes?: number;
|
|
43
|
+
/** Privileged lifecycle cleanup; callers must authenticate deletion authority before storage access. */
|
|
44
|
+
purge(session: RuntimeJournalSession): Promise<RuntimeJournalResult<null>>;
|
|
45
|
+
create(session: RuntimeJournalSession, owner: string): Promise<RuntimeJournalResult<RuntimeJournalLease>>;
|
|
46
|
+
claim(session: RuntimeJournalSession, owner: string): Promise<RuntimeJournalResult<RuntimeJournalLease & {
|
|
47
|
+
started: boolean;
|
|
48
|
+
}>>;
|
|
49
|
+
renew(session: RuntimeJournalSession, lease: RuntimeJournalLease): Promise<RuntimeJournalResult<null>>;
|
|
50
|
+
markStarted(session: RuntimeJournalSession, lease: RuntimeJournalLease): Promise<RuntimeJournalResult<{
|
|
51
|
+
first: boolean;
|
|
52
|
+
}>>;
|
|
53
|
+
append(session: RuntimeJournalSession, lease: RuntimeJournalLease, batchId: string, payloads: readonly string[], terminal?: Exclude<RuntimeJournalState, 'open'>): Promise<RuntimeJournalResult<{
|
|
54
|
+
first: number;
|
|
55
|
+
last: number;
|
|
56
|
+
}>>;
|
|
57
|
+
acknowledge(session: RuntimeJournalSession, lease: RuntimeJournalLease, sequence: number): Promise<RuntimeJournalResult<{
|
|
58
|
+
acknowledged: number;
|
|
59
|
+
}>>;
|
|
60
|
+
read(session: RuntimeJournalSession, after: number, limit: number): Promise<RuntimeJournalResult<RuntimeJournalPage>>;
|
|
61
|
+
finish(session: RuntimeJournalSession, lease: RuntimeJournalLease, state: Exclude<RuntimeJournalState, 'open'>, head: number): Promise<RuntimeJournalResult<null>>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RuntimeJournal, RuntimeJournalLease, RuntimeJournalSession, RuntimeJournalResult } from './journal';
|
|
2
|
+
import type { RecoveryLog } from './socket';
|
|
3
|
+
export declare function journalValue<T>(result: RuntimeJournalResult<T>): T;
|
|
4
|
+
export declare function createJournalRecoveryLog(options: {
|
|
5
|
+
journal: RuntimeJournal;
|
|
6
|
+
session: RuntimeJournalSession;
|
|
7
|
+
lease?: RuntimeJournalLease;
|
|
8
|
+
head: number;
|
|
9
|
+
}): RecoveryLog;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RuntimeJournal } from './journal';
|
|
2
|
+
/** Operator-supplied client; no app singleton or credentials cross the runtime boundary. */
|
|
3
|
+
export interface RuntimeJournalRedis {
|
|
4
|
+
evalsha?(sha: string, numberOfKeys: number, ...args: Array<string | number>): Promise<unknown>;
|
|
5
|
+
eval(script: string, numberOfKeys: number, ...args: Array<string | number>): Promise<unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface RuntimeJournalLimits {
|
|
8
|
+
prefix: string;
|
|
9
|
+
retentionMs: number;
|
|
10
|
+
leaseMs: number;
|
|
11
|
+
maxFrames: number;
|
|
12
|
+
maxBytes: number;
|
|
13
|
+
maxBatchFrames: number;
|
|
14
|
+
maxBatchBytes: number;
|
|
15
|
+
}
|
|
16
|
+
/** Redis persistence/AOF policy is deployment-owned; storage acknowledgement precedes publication. */
|
|
17
|
+
export declare function createRedisRuntimeJournal(redis: RuntimeJournalRedis, limits: RuntimeJournalLimits): RuntimeJournal;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { WebSocket } from 'ws';
|
|
3
|
+
import type { RuntimeJournal, RuntimeJournalState } from './journal';
|
|
4
|
+
import type { SdkAgentIdentity } from '../identity';
|
|
5
|
+
import { RecoverySocket } from './socket';
|
|
6
|
+
export interface RecoveryClaim {
|
|
7
|
+
ownerId?: string;
|
|
8
|
+
sessionId: string;
|
|
9
|
+
after: number;
|
|
10
|
+
resume: boolean;
|
|
11
|
+
generation?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const recoveryClaimSchema: z.ZodType<RecoveryClaim>;
|
|
14
|
+
export interface RuntimeRecoveryOptions {
|
|
15
|
+
/** Stable operator identity used for direct reconnect routing. */
|
|
16
|
+
ownerId?: string;
|
|
17
|
+
journal: RuntimeJournal;
|
|
18
|
+
maxDisconnectMs?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface RuntimeRecoverySession {
|
|
21
|
+
socket: RecoverySocket;
|
|
22
|
+
controller: AbortController;
|
|
23
|
+
needsEngine: boolean;
|
|
24
|
+
begin: () => Promise<void>;
|
|
25
|
+
complete: (state: Exclude<RuntimeJournalState, 'open'>) => Promise<void>;
|
|
26
|
+
attach: (socket: WebSocket, after: number) => void;
|
|
27
|
+
dispose: () => void;
|
|
28
|
+
}
|
|
29
|
+
/** One live execution owner; reconnect only replaces its wire. A restart never repeats a started Run. */
|
|
30
|
+
export declare function createRuntimeRecovery(options: RuntimeRecoveryOptions & {
|
|
31
|
+
maxFrameBytes: number;
|
|
32
|
+
maxBufferedBytes: number;
|
|
33
|
+
onError?: (error: unknown) => void;
|
|
34
|
+
}): {
|
|
35
|
+
prepare(identity: Readonly<SdkAgentIdentity>, threadId: string, claim: RecoveryClaim): Promise<RuntimeRecoverySession>;
|
|
36
|
+
close(): void;
|
|
37
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { WebSocket } from 'ws';
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
/** Fixed protocol envelope budget; payload limits continue to apply to the inner SDK frame. */
|
|
4
|
+
export declare const RECOVERY_HEADER_BYTES = 512;
|
|
5
|
+
export interface RecoveryLog {
|
|
6
|
+
append(id: string, payload: string): Promise<number>;
|
|
7
|
+
appendBatch?(id: string, payloads: string[]): Promise<{
|
|
8
|
+
first: number;
|
|
9
|
+
last: number;
|
|
10
|
+
}>;
|
|
11
|
+
maxBatchFrames?: number;
|
|
12
|
+
maxBatchBytes?: number;
|
|
13
|
+
read(after: number): Promise<Array<{
|
|
14
|
+
sequence: number;
|
|
15
|
+
payload: string;
|
|
16
|
+
}>>;
|
|
17
|
+
acknowledge(sequence: number): Promise<void>;
|
|
18
|
+
head(): number;
|
|
19
|
+
}
|
|
20
|
+
/** Bounded request-local host log; host-process execution adoption is deliberately not implied. */
|
|
21
|
+
export declare function createMemoryRecoveryLog(maxBytes: number): RecoveryLog;
|
|
22
|
+
/**
|
|
23
|
+
* A physical close detaches only the wire. Frames are committed before publication and duplicate
|
|
24
|
+
* sequence numbers never enter the existing SDK handlers twice. Logical close is an acknowledged,
|
|
25
|
+
* replayable control frame, so cancellation survives a transient wire failure.
|
|
26
|
+
*/
|
|
27
|
+
export declare class RecoverySocket extends EventEmitter {
|
|
28
|
+
private readonly options;
|
|
29
|
+
private wire?;
|
|
30
|
+
private connection?;
|
|
31
|
+
private tail;
|
|
32
|
+
private pendingFrames;
|
|
33
|
+
private scheduled;
|
|
34
|
+
private acknowledgement?;
|
|
35
|
+
private requestedAck;
|
|
36
|
+
private received;
|
|
37
|
+
private acknowledged;
|
|
38
|
+
private queuedBytes;
|
|
39
|
+
private closed;
|
|
40
|
+
private ending;
|
|
41
|
+
private generation;
|
|
42
|
+
private replaying;
|
|
43
|
+
private failure?;
|
|
44
|
+
private endSequence?;
|
|
45
|
+
private endResolve?;
|
|
46
|
+
private readonly ended;
|
|
47
|
+
constructor(options: {
|
|
48
|
+
log: RecoveryLog;
|
|
49
|
+
maxFrameBytes: number;
|
|
50
|
+
maxBufferedBytes: number;
|
|
51
|
+
onDisconnect: () => void;
|
|
52
|
+
onFailure: (error: unknown) => void;
|
|
53
|
+
terminalFailure?: boolean;
|
|
54
|
+
});
|
|
55
|
+
get readyState(): number;
|
|
56
|
+
get bufferedAmount(): number;
|
|
57
|
+
get cursor(): number;
|
|
58
|
+
get hasWire(): boolean;
|
|
59
|
+
get isEnding(): boolean;
|
|
60
|
+
private fail;
|
|
61
|
+
private publish;
|
|
62
|
+
private scheduleFlush;
|
|
63
|
+
private queue;
|
|
64
|
+
private persistAcknowledgement;
|
|
65
|
+
send(data: string): void;
|
|
66
|
+
close(_code?: number): void;
|
|
67
|
+
/** Abort is reserved for expiry, shutdown, or a definitively failed journal. */
|
|
68
|
+
terminate(): void;
|
|
69
|
+
flush(): Promise<void>;
|
|
70
|
+
waitForClose(): Promise<void>;
|
|
71
|
+
attach(wire: WebSocket, connection: string, after: number, ready?: string): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { EventHandler, MessageContentComplex, RunStep } from '../index.js';
|
|
2
|
+
import type { RemoteSdkSnapshot } from './types';
|
|
3
|
+
type ResumableRunStep = {
|
|
4
|
+
id: string;
|
|
5
|
+
index: number;
|
|
6
|
+
stepDetails: {
|
|
7
|
+
type: string;
|
|
8
|
+
tool_calls?: readonly {
|
|
9
|
+
id?: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare function normalizeResumeRunStepIndices<T extends ResumableRunStep>(runSteps: readonly T[], seedContent?: readonly ({
|
|
14
|
+
type?: string;
|
|
15
|
+
tool_call?: {
|
|
16
|
+
id?: string;
|
|
17
|
+
};
|
|
18
|
+
} | undefined)[]): T[];
|
|
19
|
+
/**
|
|
20
|
+
* Restore the streamed run-step sidecars that a fresh SDK Run cannot recover
|
|
21
|
+
* from the LangGraph checkpoint by itself.
|
|
22
|
+
*
|
|
23
|
+
* Human-review resume can happen in a later request or process. The checkpoint
|
|
24
|
+
* restarts directly inside ToolNode, so it does not replay ON_RUN_STEP before
|
|
25
|
+
* dispatching ON_RUN_STEP_COMPLETED. Seeding both maps lets the ToolNode emit
|
|
26
|
+
* the original step id and lets the content aggregator resolve that id back to
|
|
27
|
+
* the already-rendered tool card.
|
|
28
|
+
*/
|
|
29
|
+
export declare function hydrateResumeRunSteps(runSteps: readonly RunStep[], stepMap: Map<string, RunStep | undefined> | undefined, graph: {
|
|
30
|
+
toolCallStepIds?: Map<string, string>;
|
|
31
|
+
} | null | undefined, seedContent?: readonly ({
|
|
32
|
+
type?: string;
|
|
33
|
+
tool_call?: {
|
|
34
|
+
id?: string;
|
|
35
|
+
};
|
|
36
|
+
} | undefined)[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Wrap a resume run's event handlers so every content index the rebuilt graph
|
|
39
|
+
* emits is shifted past the pre-pause content.
|
|
40
|
+
*
|
|
41
|
+
* WHY: a resumed run rebuilds the graph from the checkpoint, and the fresh
|
|
42
|
+
* graph assigns content indices from its own empty `contentData` — starting at
|
|
43
|
+
* 0. The host, meanwhile, seeds the (also fresh) content aggregator with the
|
|
44
|
+
* pre-pause parts, which occupy exactly those low indices. Without an offset
|
|
45
|
+
* the resumed model turn collides with the seed: when the types match at an
|
|
46
|
+
* index the new text silently MERGES into a pre-pause part, and when they
|
|
47
|
+
* don't (e.g. a reasoning/`think` part at index 0 with Anthropic models) every
|
|
48
|
+
* delta is dropped with `Content type mismatch` — the entire post-resume
|
|
49
|
+
* output vanishes from both the live stream and the saved message.
|
|
50
|
+
*
|
|
51
|
+
* The index enters the pipeline at exactly one point: `ON_RUN_STEP`'s payload
|
|
52
|
+
* (the `RunStep`, whose `index` every subsequent delta resolves through the
|
|
53
|
+
* aggregator's `stepMap`). `ON_AGENT_UPDATE` carries its own inline index and
|
|
54
|
+
* is offset likewise. All other handlers pass through untouched — same object
|
|
55
|
+
* references, so stateful handler instances keep working.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createContentIndexOffsetHandlers(handlers: Record<string, EventHandler> | undefined, seedContent?: Array<{
|
|
58
|
+
type?: string;
|
|
59
|
+
tool_call?: {
|
|
60
|
+
id?: string;
|
|
61
|
+
output?: unknown;
|
|
62
|
+
};
|
|
63
|
+
}>): Record<string, EventHandler> | undefined;
|
|
64
|
+
/** Merge a worker continuation with the host’s already rendered prefix. */
|
|
65
|
+
export declare function reconcileRemoteResumeContent(seededProjection: readonly (MessageContentComplex | undefined)[], snapshot: RemoteSdkSnapshot): MessageContentComplex[];
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
type Purpose = 'provider-text' | 'model' | 'files';
|
|
3
|
+
declare const envelopeSchema: z.ZodObject<{
|
|
4
|
+
version: z.ZodLiteral<1>;
|
|
5
|
+
publicKey: z.ZodString;
|
|
6
|
+
nonce: z.ZodString;
|
|
7
|
+
tag: z.ZodString;
|
|
8
|
+
ciphertext: z.ZodString;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type Envelope = z.infer<typeof envelopeSchema>;
|
|
11
|
+
/** Per-run private key stays with its recipient; recovery journals receive ciphertext and public keys only. */
|
|
12
|
+
export declare function createPolicyReceiver(maxBytes: number, purpose?: Purpose): {
|
|
13
|
+
publicKey: string;
|
|
14
|
+
open(envelope: unknown): string;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
};
|
|
17
|
+
/** Encrypt before handing the candidate to a peer, queue, or replay log. */
|
|
18
|
+
export declare function createPolicySender(receiverKey: string, maxBytes: number, purpose?: Purpose): (text: string) => Envelope;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Server } from 'node:http';
|
|
2
|
+
import type { RemoteSdkFactoryInput, RemoteSdkLimits, SdkRun } from './types';
|
|
3
|
+
import type { RuntimeRecoveryOptions } from './recovery/server';
|
|
4
|
+
import type { SdkAgentIdentity } from './identity';
|
|
5
|
+
export interface RemoteSdkServerOptions extends Partial<RemoteSdkLimits> {
|
|
6
|
+
recovery?: RuntimeRecoveryOptions;
|
|
7
|
+
runtimeId: string;
|
|
8
|
+
secret: string;
|
|
9
|
+
/** Authorize the signed saved-agent identity against this worker's deployment policy. */
|
|
10
|
+
authorize: (identity: Readonly<SdkAgentIdentity>, signal: AbortSignal) => boolean | Promise<boolean>;
|
|
11
|
+
createRun: (input: RemoteSdkFactoryInput) => Promise<SdkRun>;
|
|
12
|
+
maxConcurrentRuns?: number;
|
|
13
|
+
maxReplayEntries?: number;
|
|
14
|
+
/** Trusted operator diagnostics; errors are never forwarded over the bridge. */
|
|
15
|
+
onError?: (error: unknown) => void;
|
|
16
|
+
}
|
|
17
|
+
/** A separately hosted, operator-trusted SDK runtime. The caller owns listen/TLS and shutdown. */
|
|
18
|
+
export declare function createRemoteSdkServer(options: RemoteSdkServerOptions): {
|
|
19
|
+
server: Server;
|
|
20
|
+
close: () => Promise<void>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RemoteSdkSnapshot, RemoteSdkLimits } from './types';
|
|
2
|
+
/** One bounded transfer per execution; chunks precede the terminal receipt in the ordered durable stream. */
|
|
3
|
+
export declare function createSnapshotReceiver(maxBytes: number): {
|
|
4
|
+
accept(data: unknown): null;
|
|
5
|
+
finish(data: unknown): RemoteSdkSnapshot;
|
|
6
|
+
};
|
|
7
|
+
export declare function sendSnapshot(peer: {
|
|
8
|
+
send: (frame: {
|
|
9
|
+
type: 'snapshot' | 'done';
|
|
10
|
+
data: unknown;
|
|
11
|
+
}) => void;
|
|
12
|
+
}, snapshot: RemoteSdkSnapshot, limits: RemoteSdkLimits, flush?: () => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { RunStep, AgentInputs, createHostFileService, HostFileBindings, HostFileDescriptor, HostFileServiceDescriptor, createHostProviderTextService, createHostModelService, HostModelDescriptor, HostChatModel, HostProviderTextDescriptor, HostToolDescriptor, HostToolBindings, Run, RunConfig, EventHandler, IState, HookEvent } from '../index.js';
|
|
2
|
+
import type { HostModelLifecycle } from './admission';
|
|
3
|
+
import type { SdkAgentIdentity } from './identity';
|
|
4
|
+
export interface RemoteSdkRecoveryOptions {
|
|
5
|
+
/** Operator-allowlisted direct worker routes, keyed by stable owner identity. */
|
|
6
|
+
routes?: Record<string, string>;
|
|
7
|
+
maxDisconnectMs: number;
|
|
8
|
+
retryDelayMs: number;
|
|
9
|
+
maxJournalBytes: number;
|
|
10
|
+
}
|
|
11
|
+
export interface RemoteSdkOptions {
|
|
12
|
+
/** Opt in to the saved-agent host model, configured by the operator. */
|
|
13
|
+
hostModel?: boolean;
|
|
14
|
+
/** Opt in to native host attachment reads. */
|
|
15
|
+
hostFiles?: boolean;
|
|
16
|
+
recovery?: RemoteSdkRecoveryOptions;
|
|
17
|
+
url: string;
|
|
18
|
+
secret: string;
|
|
19
|
+
connectTimeoutMs?: number;
|
|
20
|
+
rpcTimeoutMs?: number;
|
|
21
|
+
maxFrameBytes?: number;
|
|
22
|
+
maxBufferedBytes?: number;
|
|
23
|
+
maxRunMs?: number;
|
|
24
|
+
/** Trusted host diagnostics; never delivered to the browser or runtime. */
|
|
25
|
+
onError?: (error: unknown) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface RemoteSdkLimits {
|
|
28
|
+
connectTimeoutMs: number;
|
|
29
|
+
rpcTimeoutMs: number;
|
|
30
|
+
maxFrameBytes: number;
|
|
31
|
+
maxBufferedBytes: number;
|
|
32
|
+
maxRunMs: number;
|
|
33
|
+
}
|
|
34
|
+
export declare function remoteSdkLimits(options: Partial<RemoteSdkLimits>): RemoteSdkLimits;
|
|
35
|
+
export type SdkRun = Awaited<ReturnType<typeof Run.create>>;
|
|
36
|
+
export type SdkRunInput = Parameters<SdkRun['processStream']>[0];
|
|
37
|
+
export type SdkRunOptions = Parameters<SdkRun['processStream']>[1];
|
|
38
|
+
export type SdkEventData = Parameters<EventHandler['handle']>[1];
|
|
39
|
+
/** Public primary-model configuration required by the worker graph. */
|
|
40
|
+
export interface RemoteSdkModelProfile {
|
|
41
|
+
provider: AgentInputs['provider'];
|
|
42
|
+
name: string;
|
|
43
|
+
streaming: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Explicit host-owned capabilities; never reconstructed from worker claims or YAML. */
|
|
46
|
+
export interface RemoteSdkHostServices {
|
|
47
|
+
/** Already authorized host binding; storage credentials and policy stay with the host. */
|
|
48
|
+
files?: ReturnType<typeof createHostFileService> & {
|
|
49
|
+
sources: readonly HostFileDescriptor[];
|
|
50
|
+
};
|
|
51
|
+
modelLifecycle?: HostModelLifecycle;
|
|
52
|
+
modelProfile?: RemoteSdkModelProfile;
|
|
53
|
+
model?: ReturnType<typeof createHostModelService>;
|
|
54
|
+
providerText?: ReturnType<typeof createHostProviderTextService>;
|
|
55
|
+
}
|
|
56
|
+
export interface RemoteSdkStart {
|
|
57
|
+
transportVersion: 2;
|
|
58
|
+
files?: {
|
|
59
|
+
version: 1;
|
|
60
|
+
publicKey: string;
|
|
61
|
+
descriptor: HostFileServiceDescriptor;
|
|
62
|
+
sources: HostFileDescriptor[];
|
|
63
|
+
};
|
|
64
|
+
modelAdmission?: {
|
|
65
|
+
version: 1;
|
|
66
|
+
maxEntries: number;
|
|
67
|
+
};
|
|
68
|
+
model?: {
|
|
69
|
+
version: 1;
|
|
70
|
+
publicKey: string;
|
|
71
|
+
descriptor: HostModelDescriptor;
|
|
72
|
+
};
|
|
73
|
+
providerText?: {
|
|
74
|
+
version: 1;
|
|
75
|
+
publicKey: string;
|
|
76
|
+
limits: HostProviderTextDescriptor;
|
|
77
|
+
};
|
|
78
|
+
hostTools?: HostToolDescriptor[];
|
|
79
|
+
operation: 'start' | 'resume';
|
|
80
|
+
input: IState;
|
|
81
|
+
resume?: unknown;
|
|
82
|
+
commandOptions?: Parameters<SdkRun['resume']>[3];
|
|
83
|
+
options: Pick<SdkRunOptions, 'recursionLimit' | 'configurable'>;
|
|
84
|
+
handlers: string[];
|
|
85
|
+
hooks: HookEvent[];
|
|
86
|
+
checkpoint: boolean;
|
|
87
|
+
humanInTheLoop?: RunConfig['humanInTheLoop'];
|
|
88
|
+
streamLimits?: RunConfig['streamLimits'];
|
|
89
|
+
agent: {
|
|
90
|
+
id: string;
|
|
91
|
+
name?: string;
|
|
92
|
+
instructions?: string;
|
|
93
|
+
model?: RemoteSdkModelProfile;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface RemoteSdkSnapshot {
|
|
97
|
+
state?: {
|
|
98
|
+
[K in 'getDiscoveredTools' | 'getCalibrationRatio' | 'getFadingTier' | 'getFadingTiers' | 'getFadingTierResetAgentIds' | 'getResolvedInstructionOverhead' | 'getToolCount' | 'getOutputTruncated' | 'getHandoffOutcome']: ReturnType<SdkRun[K]>;
|
|
99
|
+
};
|
|
100
|
+
content?: ReturnType<NonNullable<SdkRun['Graph']>['getContentParts']>;
|
|
101
|
+
messages?: ReturnType<SdkRun['getRunMessages']>;
|
|
102
|
+
interrupt?: ReturnType<SdkRun['getInterrupt']>;
|
|
103
|
+
haltReason?: string;
|
|
104
|
+
runSteps?: ReturnType<NonNullable<SdkRun['Graph']>['createRunStepResumeState']>;
|
|
105
|
+
}
|
|
106
|
+
export interface RemoteSdkFactoryInput {
|
|
107
|
+
hostFiles?: HostFileBindings & {
|
|
108
|
+
readonly sources: readonly HostFileDescriptor[];
|
|
109
|
+
};
|
|
110
|
+
/** Retain this model as Graph.overrideModel when supplied by the authenticated host. */
|
|
111
|
+
hostModel?: ReturnType<HostChatModel['bindTools']>;
|
|
112
|
+
hostTools?: HostToolBindings;
|
|
113
|
+
identity: Readonly<SdkAgentIdentity>;
|
|
114
|
+
/** Host-owned event, hook, and checkpoint adapters. Retain these in the returned Run. */
|
|
115
|
+
config: Pick<RunConfig, 'runId' | 'customHandlers' | 'hooks' | 'humanInTheLoop' | 'streamLimits' | 'providerTextProtection'>;
|
|
116
|
+
compileOptions: NonNullable<RunConfig['graphConfig']['compileOptions']>;
|
|
117
|
+
signal: AbortSignal;
|
|
118
|
+
agent: RemoteSdkStart['agent'];
|
|
119
|
+
}
|
|
120
|
+
export interface RemoteSdkResumeState {
|
|
121
|
+
content: NonNullable<RemoteSdkSnapshot['content']>;
|
|
122
|
+
steps: RunStep[];
|
|
123
|
+
}
|
|
124
|
+
/** Missing environment substitutions must never become predictable signing keys. */
|
|
125
|
+
export declare function isRemoteSdkSecret(secret: unknown): secret is string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
2
|
import type { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
3
3
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
4
|
-
import type * as t from '
|
|
4
|
+
import type * as t from '../types/index.js';
|
|
5
5
|
export type JsonPrimitive = string | number | boolean | null;
|
|
6
6
|
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
7
7
|
[key: string]: JsonValue;
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AIMessageChunk } from '@langchain/core/messages';
|
|
2
|
-
import type { AgentContext } from '
|
|
3
|
-
import type { StandardGraph } from '
|
|
4
|
-
import type * as t from '
|
|
2
|
+
import type { AgentContext } from './agents/AgentContext.js';
|
|
3
|
+
import type { StandardGraph } from './graphs/index.js';
|
|
4
|
+
import type * as t from './types/index.js';
|
|
5
5
|
export declare function getChunkContent({ chunk, provider, reasoningKey, }: {
|
|
6
6
|
chunk?: Partial<AIMessageChunk>;
|
|
7
7
|
provider?: t.ProviderName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SummarizationTrigger } from '
|
|
1
|
+
import type { SummarizationTrigger } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The summary-boundary seam a caller compacting outside a run needs. The two
|
|
4
4
|
* default prompts stay out of it: LibreChat's manual flow deliberately words
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { ProviderName, TokenCounter } from '
|
|
2
|
+
import type { ProviderName, TokenCounter } from '../types/index.js';
|
|
3
3
|
export declare const DEFAULT_SUMMARY_OUTPUT_TOKENS = 4096;
|
|
4
4
|
export declare const DEFAULT_RETAIN_RECENT_TOKENS = 16000;
|
|
5
5
|
export declare class SummarizationInputTooLargeError extends Error {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
-
import type { StreamLimitState } from '
|
|
4
|
-
import type { AgentContext } from '
|
|
5
|
-
import type { HookRegistry } from '
|
|
6
|
-
import type { OnChunk } from '
|
|
7
|
-
import type * as t from '
|
|
8
|
-
import { type PromptCacheTtl } from '
|
|
3
|
+
import type { StreamLimitState } from '../llm/streamLimits.js';
|
|
4
|
+
import type { AgentContext } from '../agents/AgentContext.js';
|
|
5
|
+
import type { HookRegistry } from '../hooks/index.js';
|
|
6
|
+
import type { OnChunk } from '../llm/invoke.js';
|
|
7
|
+
import type * as t from '../types/index.js';
|
|
8
|
+
import { type PromptCacheTtl } from '../messages/cache.js';
|
|
9
9
|
/**
|
|
10
10
|
* What one summarization round has streamed. Deltas go out as the provider
|
|
11
11
|
* produces them, so an attempt that is then abandoned has already published
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SummarizationErrorCode } from '
|
|
2
|
-
import type * as t from '
|
|
1
|
+
import type { SummarizationErrorCode } from '../types/summarize.js';
|
|
2
|
+
import type * as t from '../types/index.js';
|
|
3
3
|
/** Compaction owns retries; model/transport defaults must not multiply attempts. */
|
|
4
4
|
export declare function withSummarizationRetryOwner<T extends object>(provider: t.ProviderName, clientOptions: T): T & {
|
|
5
5
|
maxRetries: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { CompactionSemanticIndex } from '
|
|
3
|
-
export { COMPACTION_SEMANTIC_INDEX_LIMITS } from '
|
|
2
|
+
import type { CompactionSemanticIndex } from '../types/index.js';
|
|
3
|
+
export { COMPACTION_SEMANTIC_INDEX_LIMITS } from '../common/index.js';
|
|
4
4
|
/** Records producer-side omissions without retaining the discarded entries. */
|
|
5
5
|
export declare function setCompactionSemanticIndexProvidedEntryCount(index: CompactionSemanticIndex, providedEntryCount: number): void;
|
|
6
6
|
/** Reads producer-side cardinality without exposing snapshot bookkeeping. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GraphTools, ProviderName, ClientOptions, TokenCounter } from '
|
|
1
|
+
import type { GraphTools, ProviderName, ClientOptions, TokenCounter } from '../types/index.js';
|
|
2
2
|
/** Counts only the resolved bound inventory, using the serving model's counter. */
|
|
3
3
|
export declare function countSummarizationToolTokens({ tools, provider, clientOptions, count, }: {
|
|
4
4
|
tools?: GraphTools;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UsageMetadata, BaseMessage } from '@langchain/core/messages';
|
|
2
|
-
import type { SummarizationAttemptUsage } from '
|
|
2
|
+
import type { SummarizationAttemptUsage } from '../types/summarize.js';
|
|
3
3
|
export declare function readSummarizationUsage(response: BaseMessage | undefined): Partial<UsageMetadata> | undefined;
|
|
4
4
|
export declare function buildSummarizationStepUsage(attempts: readonly SummarizationAttemptUsage[]): {
|
|
5
5
|
prompt_tokens: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArtifactDeliveryFailure } from '
|
|
1
|
+
import type { ArtifactDeliveryFailure } from '../types/index.js';
|
|
2
2
|
export declare const ARTIFACT_DELIVERY_WARNING_PREFIX = "Artifact delivery warning:";
|
|
3
3
|
export declare function normalizeArtifactDeliveryFailure(value: unknown): ArtifactDeliveryFailure | undefined;
|
|
4
4
|
export declare function appendArtifactDeliveryWarning(output: string, delivery: ArtifactDeliveryFailure | undefined): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ArtifactTruncation } from '
|
|
1
|
+
import type { ArtifactTruncation } from '../types/index.js';
|
|
2
2
|
export declare function normalizeArtifactTruncation(value: unknown): ArtifactTruncation | undefined;
|
|
3
3
|
export declare function appendArtifactTruncationWarning(output: string, truncation: ArtifactTruncation | undefined): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
|
-
import type * as t from '
|
|
3
|
-
import { Constants } from '
|
|
2
|
+
import type * as t from '../types/index.js';
|
|
3
|
+
import { Constants } from '../common/index.js';
|
|
4
4
|
export declare const BashExecutionToolSchema: {
|
|
5
5
|
readonly type: "object";
|
|
6
6
|
readonly properties: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
2
|
import type { ProgrammaticToolCallingJsonSchema } from './ptcTimeout';
|
|
3
|
-
import type * as t from '
|
|
4
|
-
import { Constants } from '
|
|
3
|
+
import type * as t from '../types/index.js';
|
|
4
|
+
import { Constants } from '../common/index.js';
|
|
5
5
|
export declare function createBashProgrammaticToolCallingSchema(maxRunTimeoutMs?: number): ProgrammaticToolCallingJsonSchema;
|
|
6
6
|
export declare const BashProgrammaticToolCallingSchema: ProgrammaticToolCallingJsonSchema;
|
|
7
7
|
export declare const BashProgrammaticToolCallingName = Constants.BASH_PROGRAMMATIC_TOOL_CALLING;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
2
|
-
import type { CodeApiMethod } from '
|
|
3
|
-
import type * as t from '
|
|
4
|
-
import { Constants } from '
|
|
5
|
-
export { appendCodeSessionFileSummary, stripCodeSessionFileSummary, } from '
|
|
2
|
+
import type { CodeApiMethod } from './diagnostics.js';
|
|
3
|
+
import type * as t from '../types/index.js';
|
|
4
|
+
import { Constants } from '../common/index.js';
|
|
5
|
+
export { appendCodeSessionFileSummary, stripCodeSessionFileSummary, } from './CodeSessionFileSummary.js';
|
|
6
6
|
export declare const getCodeBaseURL: () => string;
|
|
7
7
|
export declare function buildCodeApiEndpoint(baseUrl: string, route: string): string;
|
|
8
8
|
export declare function selectRuntimeSessionHint(factoryHint?: string, injectedHint?: string): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as t from '
|
|
1
|
+
import type * as t from '../types/index.js';
|
|
2
2
|
export declare function stripCodeSessionFileSummary(output: string): string;
|
|
3
3
|
export declare function appendCodeSessionFileSummary(output: string, files: t.FileRefs | undefined): string;
|
|
4
4
|
/** Attached-worker artifacts are delivered out of execution-private scratch,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as t from '
|
|
1
|
+
import type * as t from '../types/index.js';
|
|
2
2
|
export type ProgrammaticInvocationParams = {
|
|
3
3
|
code: string;
|
|
4
4
|
tool_manifest?: string[];
|
|
@@ -29,4 +29,5 @@ export declare function selectProgrammaticTools(args: {
|
|
|
29
29
|
allowedToolDefs?: t.LCTool[];
|
|
30
30
|
disallowedToolDefs?: t.LCTool[];
|
|
31
31
|
programmaticToolName: string;
|
|
32
|
+
normalizeIdentifier?: (name: string) => string;
|
|
32
33
|
}): t.LCTool[];
|