@librechat/agents 4.2.10 → 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.
Files changed (261) hide show
  1. package/dist/cjs/runtime/admission.cjs +135 -0
  2. package/dist/cjs/runtime/admission.cjs.map +1 -0
  3. package/dist/cjs/runtime/checkpoint.cjs +40 -0
  4. package/dist/cjs/runtime/checkpoint.cjs.map +1 -0
  5. package/dist/cjs/runtime/client.cjs +435 -0
  6. package/dist/cjs/runtime/client.cjs.map +1 -0
  7. package/dist/cjs/runtime/files.cjs +301 -0
  8. package/dist/cjs/runtime/files.cjs.map +1 -0
  9. package/dist/cjs/runtime/hostTools.cjs +165 -0
  10. package/dist/cjs/runtime/hostTools.cjs.map +1 -0
  11. package/dist/cjs/runtime/index.cjs +11 -0
  12. package/dist/cjs/runtime/model.cjs +303 -0
  13. package/dist/cjs/runtime/model.cjs.map +1 -0
  14. package/dist/cjs/runtime/peer.cjs +209 -0
  15. package/dist/cjs/runtime/peer.cjs.map +1 -0
  16. package/dist/cjs/runtime/policy.cjs +77 -0
  17. package/dist/cjs/runtime/policy.cjs.map +1 -0
  18. package/dist/cjs/runtime/recovery/client.cjs +172 -0
  19. package/dist/cjs/runtime/recovery/client.cjs.map +1 -0
  20. package/dist/cjs/runtime/recovery/log.cjs +47 -0
  21. package/dist/cjs/runtime/recovery/log.cjs.map +1 -0
  22. package/dist/cjs/runtime/recovery/redis.cjs +239 -0
  23. package/dist/cjs/runtime/recovery/redis.cjs.map +1 -0
  24. package/dist/cjs/runtime/recovery/server.cjs +190 -0
  25. package/dist/cjs/runtime/recovery/server.cjs.map +1 -0
  26. package/dist/cjs/runtime/recovery/socket.cjs +298 -0
  27. package/dist/cjs/runtime/recovery/socket.cjs.map +1 -0
  28. package/dist/cjs/runtime/resume.cjs +115 -0
  29. package/dist/cjs/runtime/resume.cjs.map +1 -0
  30. package/dist/cjs/runtime/sealed.cjs +107 -0
  31. package/dist/cjs/runtime/sealed.cjs.map +1 -0
  32. package/dist/cjs/runtime/server.cjs +415 -0
  33. package/dist/cjs/runtime/server.cjs.map +1 -0
  34. package/dist/cjs/runtime/snapshot.cjs +61 -0
  35. package/dist/cjs/runtime/snapshot.cjs.map +1 -0
  36. package/dist/cjs/runtime/types.cjs +20 -0
  37. package/dist/cjs/runtime/types.cjs.map +1 -0
  38. package/dist/cjs/runtime/wire.cjs +84 -0
  39. package/dist/cjs/runtime/wire.cjs.map +1 -0
  40. package/dist/esm/runtime/admission.mjs +133 -0
  41. package/dist/esm/runtime/admission.mjs.map +1 -0
  42. package/dist/esm/runtime/checkpoint.mjs +39 -0
  43. package/dist/esm/runtime/checkpoint.mjs.map +1 -0
  44. package/dist/esm/runtime/client.mjs +432 -0
  45. package/dist/esm/runtime/client.mjs.map +1 -0
  46. package/dist/esm/runtime/files.mjs +299 -0
  47. package/dist/esm/runtime/files.mjs.map +1 -0
  48. package/dist/esm/runtime/hostTools.mjs +164 -0
  49. package/dist/esm/runtime/hostTools.mjs.map +1 -0
  50. package/dist/esm/runtime/index.mjs +5 -0
  51. package/dist/esm/runtime/model.mjs +301 -0
  52. package/dist/esm/runtime/model.mjs.map +1 -0
  53. package/dist/esm/runtime/peer.mjs +209 -0
  54. package/dist/esm/runtime/peer.mjs.map +1 -0
  55. package/dist/esm/runtime/policy.mjs +75 -0
  56. package/dist/esm/runtime/policy.mjs.map +1 -0
  57. package/dist/esm/runtime/recovery/client.mjs +172 -0
  58. package/dist/esm/runtime/recovery/client.mjs.map +1 -0
  59. package/dist/esm/runtime/recovery/log.mjs +46 -0
  60. package/dist/esm/runtime/recovery/log.mjs.map +1 -0
  61. package/dist/esm/runtime/recovery/redis.mjs +239 -0
  62. package/dist/esm/runtime/recovery/redis.mjs.map +1 -0
  63. package/dist/esm/runtime/recovery/server.mjs +189 -0
  64. package/dist/esm/runtime/recovery/server.mjs.map +1 -0
  65. package/dist/esm/runtime/recovery/socket.mjs +297 -0
  66. package/dist/esm/runtime/recovery/socket.mjs.map +1 -0
  67. package/dist/esm/runtime/resume.mjs +111 -0
  68. package/dist/esm/runtime/resume.mjs.map +1 -0
  69. package/dist/esm/runtime/sealed.mjs +106 -0
  70. package/dist/esm/runtime/sealed.mjs.map +1 -0
  71. package/dist/esm/runtime/server.mjs +413 -0
  72. package/dist/esm/runtime/server.mjs.map +1 -0
  73. package/dist/esm/runtime/snapshot.mjs +60 -0
  74. package/dist/esm/runtime/snapshot.mjs.map +1 -0
  75. package/dist/esm/runtime/types.mjs +19 -0
  76. package/dist/esm/runtime/types.mjs.map +1 -0
  77. package/dist/esm/runtime/wire.mjs +80 -0
  78. package/dist/esm/runtime/wire.mjs.map +1 -0
  79. package/dist/types/agents/AgentContext.d.ts +4 -4
  80. package/dist/types/agents/projection.d.ts +1 -1
  81. package/dist/types/events.d.ts +2 -2
  82. package/dist/types/graphs/Graph.d.ts +13 -13
  83. package/dist/types/graphs/MultiAgentGraph.d.ts +2 -2
  84. package/dist/types/graphs/acceptedModelResponse.d.ts +1 -1
  85. package/dist/types/graphs/createGraph.d.ts +4 -4
  86. package/dist/types/graphs/graphFactory.d.ts +1 -1
  87. package/dist/types/graphs/handoff.d.ts +1 -1
  88. package/dist/types/harness/index.d.ts +2 -2
  89. package/dist/types/harness/model.d.ts +3 -3
  90. package/dist/types/harness/providerText.d.ts +2 -2
  91. package/dist/types/hitl/approvalReview.d.ts +1 -1
  92. package/dist/types/hitl/askUserQuestion.d.ts +1 -1
  93. package/dist/types/hitl/askUserQuestions.d.ts +1 -1
  94. package/dist/types/hitl/askUserQuestionsInterrupt.d.ts +1 -1
  95. package/dist/types/hooks/types.d.ts +2 -2
  96. package/dist/types/instrumentation.d.ts +1 -1
  97. package/dist/types/langfuse.d.ts +3 -3
  98. package/dist/types/langfuseConfig.d.ts +2 -2
  99. package/dist/types/langfuseRuntimeContext.d.ts +1 -1
  100. package/dist/types/langfuseRuntimeScope.d.ts +2 -2
  101. package/dist/types/langfuseSpanRegistry.d.ts +1 -1
  102. package/dist/types/langfuseToolOutputTracing.d.ts +3 -3
  103. package/dist/types/llm/anthropic/index.d.ts +1 -1
  104. package/dist/types/llm/bedrock/index.d.ts +1 -1
  105. package/dist/types/llm/bedrock/toolCache.d.ts +2 -2
  106. package/dist/types/llm/contextOverflowRecovery.d.ts +2 -2
  107. package/dist/types/llm/contextPressureMeter.d.ts +2 -2
  108. package/dist/types/llm/google/index.d.ts +1 -1
  109. package/dist/types/llm/init.d.ts +1 -1
  110. package/dist/types/llm/invoke.d.ts +9 -9
  111. package/dist/types/llm/mistral/index.d.ts +1 -1
  112. package/dist/types/llm/openai/index.d.ts +2 -2
  113. package/dist/types/llm/openrouter/index.d.ts +2 -2
  114. package/dist/types/llm/openrouter/toolCache.d.ts +2 -2
  115. package/dist/types/llm/prepareProviderRequest.d.ts +3 -3
  116. package/dist/types/llm/promptCacheTools.d.ts +1 -1
  117. package/dist/types/llm/providerRegistry.d.ts +1 -1
  118. package/dist/types/llm/providerTextBoundary.d.ts +2 -2
  119. package/dist/types/llm/providerTextControls.d.ts +1 -1
  120. package/dist/types/llm/providers.d.ts +2 -2
  121. package/dist/types/llm/request.d.ts +1 -1
  122. package/dist/types/llm/stream/chunkAdapters.d.ts +1 -1
  123. package/dist/types/llm/streamLimits.d.ts +1 -1
  124. package/dist/types/llm/truncation.d.ts +1 -1
  125. package/dist/types/llm/vertexai/index.d.ts +1 -1
  126. package/dist/types/messages/alternation.d.ts +1 -1
  127. package/dist/types/messages/anthropicToolCache.d.ts +2 -2
  128. package/dist/types/messages/assistantPhase.d.ts +3 -3
  129. package/dist/types/messages/budget.d.ts +1 -1
  130. package/dist/types/messages/cache.d.ts +1 -1
  131. package/dist/types/messages/contextPruning.d.ts +2 -2
  132. package/dist/types/messages/core.d.ts +1 -1
  133. package/dist/types/messages/fading.d.ts +1 -1
  134. package/dist/types/messages/format.d.ts +2 -2
  135. package/dist/types/messages/ids.d.ts +2 -2
  136. package/dist/types/messages/injected.d.ts +1 -1
  137. package/dist/types/messages/langchain.d.ts +1 -1
  138. package/dist/types/messages/prune.d.ts +4 -4
  139. package/dist/types/messages/recency.d.ts +1 -1
  140. package/dist/types/messages/toolResultTypes.d.ts +1 -1
  141. package/dist/types/openai/arguments.d.ts +1 -1
  142. package/dist/types/openai/index.d.ts +1 -1
  143. package/dist/types/openai/toolProjection.d.ts +1 -1
  144. package/dist/types/prompts/activityLabel.d.ts +2 -2
  145. package/dist/types/prompts/reasoningLabel.d.ts +1 -1
  146. package/dist/types/rerank/search.d.ts +1 -1
  147. package/dist/types/responses/index.d.ts +1 -1
  148. package/dist/types/run.d.ts +3 -3
  149. package/dist/types/runtime/admission.d.ts +30 -0
  150. package/dist/types/runtime/checkpoint.d.ts +14 -0
  151. package/dist/types/runtime/client.d.ts +12 -0
  152. package/dist/types/runtime/files.d.ts +75 -0
  153. package/dist/types/runtime/hostTools.d.ts +22 -0
  154. package/dist/types/runtime/identity.d.ts +2 -0
  155. package/dist/types/runtime/index.d.ts +12 -0
  156. package/dist/types/runtime/model.d.ts +42 -0
  157. package/dist/types/runtime/peer.d.ts +55 -0
  158. package/dist/types/runtime/policy.d.ts +43 -0
  159. package/dist/types/runtime/recovery/client.d.ts +12 -0
  160. package/dist/types/runtime/recovery/journal.d.ts +62 -0
  161. package/dist/types/runtime/recovery/log.d.ts +9 -0
  162. package/dist/types/runtime/recovery/redis.d.ts +17 -0
  163. package/dist/types/runtime/recovery/server.d.ts +37 -0
  164. package/dist/types/runtime/recovery/socket.d.ts +72 -0
  165. package/dist/types/runtime/resume.d.ts +66 -0
  166. package/dist/types/runtime/sealed.d.ts +19 -0
  167. package/dist/types/runtime/server.d.ts +21 -0
  168. package/dist/types/runtime/snapshot.d.ts +12 -0
  169. package/dist/types/runtime/types.d.ts +125 -0
  170. package/dist/types/runtime/wire.d.ts +3 -0
  171. package/dist/types/session/handlers.d.ts +1 -1
  172. package/dist/types/session/types.d.ts +1 -1
  173. package/dist/types/stream.d.ts +3 -3
  174. package/dist/types/summarization/index.d.ts +1 -1
  175. package/dist/types/summarization/input.d.ts +1 -1
  176. package/dist/types/summarization/node.d.ts +6 -6
  177. package/dist/types/summarization/retry.d.ts +2 -2
  178. package/dist/types/summarization/semanticIndex.d.ts +2 -2
  179. package/dist/types/summarization/toolBudget.d.ts +1 -1
  180. package/dist/types/summarization/usage.d.ts +1 -1
  181. package/dist/types/tools/ArtifactDelivery.d.ts +1 -1
  182. package/dist/types/tools/ArtifactTruncation.d.ts +1 -1
  183. package/dist/types/tools/BashExecutor.d.ts +2 -2
  184. package/dist/types/tools/BashProgrammaticToolCalling.d.ts +2 -2
  185. package/dist/types/tools/CallerCapabilities.d.ts +1 -1
  186. package/dist/types/tools/CodeExecutor.d.ts +4 -4
  187. package/dist/types/tools/CodeSessionFileSummary.d.ts +1 -1
  188. package/dist/types/tools/ProgrammaticCallerPolicy.d.ts +1 -1
  189. package/dist/types/tools/ProgrammaticToolCalling.d.ts +2 -2
  190. package/dist/types/tools/ReadFile.d.ts +1 -1
  191. package/dist/types/tools/SkillTool.d.ts +1 -1
  192. package/dist/types/tools/SubagentTool.d.ts +3 -3
  193. package/dist/types/tools/ToolNode.d.ts +5 -5
  194. package/dist/types/tools/ToolSearch.d.ts +2 -2
  195. package/dist/types/tools/cloudflare/CloudflareBridgeRuntime.d.ts +1 -1
  196. package/dist/types/tools/cloudflare/CloudflareProgrammaticToolCalling.d.ts +1 -1
  197. package/dist/types/tools/cloudflare/CloudflareSandboxExecutionEngine.d.ts +2 -2
  198. package/dist/types/tools/cloudflare/CloudflareSandboxTools.d.ts +1 -1
  199. package/dist/types/tools/diagnostics.d.ts +1 -1
  200. package/dist/types/tools/eagerEventExecution.d.ts +1 -1
  201. package/dist/types/tools/handlers.d.ts +3 -3
  202. package/dist/types/tools/intentArg.d.ts +1 -1
  203. package/dist/types/tools/local/CompileCheckTool.d.ts +2 -2
  204. package/dist/types/tools/local/FileCheckpointer.d.ts +1 -1
  205. package/dist/types/tools/local/LocalCodingTools.d.ts +2 -2
  206. package/dist/types/tools/local/LocalExecutionEngine.d.ts +1 -1
  207. package/dist/types/tools/local/LocalExecutionTools.d.ts +1 -1
  208. package/dist/types/tools/local/LocalProgrammaticToolCalling.d.ts +1 -1
  209. package/dist/types/tools/local/bashAst.d.ts +1 -1
  210. package/dist/types/tools/local/resolveLocalExecutionTools.d.ts +1 -1
  211. package/dist/types/tools/local/syntaxCheck.d.ts +1 -1
  212. package/dist/types/tools/ptcTimeout.d.ts +1 -1
  213. package/dist/types/tools/runStepResume.d.ts +1 -1
  214. package/dist/types/tools/schema.d.ts +1 -1
  215. package/dist/types/tools/search/anthropic.d.ts +1 -1
  216. package/dist/types/tools/skillCatalog.d.ts +1 -1
  217. package/dist/types/tools/subagent/InMemorySubagentTaskStore.d.ts +1 -1
  218. package/dist/types/tools/subagent/SubagentExecutor.d.ts +5 -5
  219. package/dist/types/tools/subagent/SubagentReplay.d.ts +3 -3
  220. package/dist/types/tools/subagent/childGraphConfig.d.ts +2 -2
  221. package/dist/types/tools/subagent/diagnostics.d.ts +2 -2
  222. package/dist/types/tools/subagent/hostArgs.d.ts +2 -2
  223. package/dist/types/tools/toolBatchReplay.d.ts +3 -3
  224. package/dist/types/types/activityLabel.d.ts +2 -2
  225. package/dist/types/types/graph.d.ts +10 -10
  226. package/dist/types/types/llm.d.ts +9 -9
  227. package/dist/types/types/reasoningLabel.d.ts +1 -1
  228. package/dist/types/types/run.d.ts +8 -8
  229. package/dist/types/types/stream.d.ts +5 -5
  230. package/dist/types/types/summarize.d.ts +2 -2
  231. package/dist/types/types/tools.d.ts +8 -8
  232. package/dist/types/utils/errors.d.ts +1 -1
  233. package/dist/types/utils/events.d.ts +3 -3
  234. package/dist/types/utils/handlers.d.ts +3 -3
  235. package/dist/types/utils/llm.d.ts +2 -2
  236. package/dist/types/utils/llmConfig.d.ts +1 -1
  237. package/dist/types/utils/title.d.ts +1 -1
  238. package/dist/types/utils/toolSessions.d.ts +1 -1
  239. package/package.json +22 -3
  240. package/src/runtime/admission.ts +224 -0
  241. package/src/runtime/checkpoint.ts +66 -0
  242. package/src/runtime/client.ts +674 -0
  243. package/src/runtime/files.ts +503 -0
  244. package/src/runtime/hostTools.ts +243 -0
  245. package/src/runtime/identity.ts +3 -0
  246. package/src/runtime/index.ts +33 -0
  247. package/src/runtime/model.ts +452 -0
  248. package/src/runtime/peer.ts +262 -0
  249. package/src/runtime/policy.ts +150 -0
  250. package/src/runtime/recovery/client.ts +232 -0
  251. package/src/runtime/recovery/journal.ts +88 -0
  252. package/src/runtime/recovery/log.ts +70 -0
  253. package/src/runtime/recovery/redis.ts +342 -0
  254. package/src/runtime/recovery/server.ts +280 -0
  255. package/src/runtime/recovery/socket.ts +422 -0
  256. package/src/runtime/resume.ts +268 -0
  257. package/src/runtime/sealed.ts +144 -0
  258. package/src/runtime/server.ts +653 -0
  259. package/src/runtime/snapshot.ts +87 -0
  260. package/src/runtime/types.ts +184 -0
  261. package/src/runtime/wire.ts +96 -0
@@ -1,5 +1,5 @@
1
1
  import type { MessageContent } from '@langchain/core/messages';
2
- import type * as t from '@/types';
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 '@/types/graph';
2
+ import type { ContextPruningConfig, FadingTier } from '../types/graph.js';
3
3
  import type { FadingCaps } from './fading';
4
- import type { TokenCounter } from '@/types/run';
5
- import type { ProviderName } from '@/types';
6
- import { ContentTypes } from '@/common';
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 '@/types/llm';
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 '@/types/llm';
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 '@/utils/acceptedToolArguments';
2
+ export { serializeToolArguments } from '../utils/acceptedToolArguments.js';
@@ -1,4 +1,4 @@
1
- import type * as t from '@/types';
1
+ import type * as t from '../types/index.js';
2
2
  export interface OpenAICompatibleWriter {
3
3
  write(data: string): void | Promise<void>;
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import type { OpenAIChatCompletionChunkChoice, OpenAIToolCall, OpenAIStreamTracker } from './index';
2
- import type { EventHandler } from '@/types';
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 '@/types/activityLabel';
2
- import type { ResolvedLangfuseToolOutputTracingConfig } from '@/langfuseRuntimeContext';
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 '@/langfuseRuntimeContext';
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 '@/tools/search/types';
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?: {
@@ -1,4 +1,4 @@
1
- import type * as t from '@/types';
1
+ import type * as t from '../types/index.js';
2
2
  export interface ResponsesCompatibleWriter {
3
3
  write(data: string): void | Promise<void>;
4
4
  }
@@ -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 '@/graphs/MultiAgentGraph';
5
- import type { StandardGraph } from '@/graphs/Graph';
6
- import type * as t from '@/types';
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,2 @@
1
+ import type { ExecutionIdentity } from '../index.js';
2
+ export type SdkAgentIdentity = Readonly<ExecutionIdentity>;
@@ -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;
@@ -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
+ }