@reinsjs/core 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @reinsjs/core
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f8a3550: Pause codes: a socket’s `onTurnEnd` may now return `{ pause: { reason, code, note } }`. The `code` (your own identifier such as `acme.credits_exhausted`, format `PAUSE_CODE_RE`) and the note are written into `core.run_paused`, the code is on the live `Interruption` and on `RunStatus.paused.code`, so a later request or another process can tell why a run paused. reins never branches on it and it is not part of the resume state. The loop’s own `maxTurns` pause carries `reins.max_turns`. A code that does not match the format is dropped: the run still pauses, and a model-invisible `core.error` (category `input`, `detail.phase: "onTurnEnd"`) is logged before the `core.run_paused`. A `reason` other than `"budget"` / `"host"` is handled the same way and pauses with `host`. New exports: `PAUSE_CODE_RE`, `isPauseCode`, `MAX_TURNS_PAUSE_CODE`, `resolveSocketPause`, `pauseDetailOf`. Note: `core.run_paused` now also records the `note` of loop-originated pauses (aborts, user stop, `maxTurns`), so code that compares that payload for exact equality sees a new optional field.
8
+
9
+ ## 0.14.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 831a50a: Tool-change note: when more than 20 tools are added or removed at once (for example an MCP server's credentials expire), that side now lists 20 names and a total instead of every name. Names that appeared earlier in the session (called, referenced, or mentioned in model-visible text) are listed first. `meta.toolsChanged` still records the full diff, and notes with 20 or fewer changes per side are unchanged.
14
+
3
15
  ## 0.14.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -137,6 +137,7 @@ A `Socket` is the seam brain modules use — five hooks (`beforeModel`, `afterMo
137
137
  - **Bounded retry only on zero output.** A transient failure (network, 5xx, 429 — decided from the status code first, keywords only as a fallback) is retried up to 3 times, but never after a partial response has been appended: the log must not contain two half answers.
138
138
  - **Rollback caveat (0.10).** Sessions that contain a `core.tool_started` event cannot be read by `@reinsjs/core` 0.9 or earlier (unknown event types are rejected).
139
139
  - **Every run is bracketed (0.14).** `runLoop` starts each run with a model-invisible `core.tools_bound` (`marksEnd: true`) and ends it with exactly one end marker: `core.run_paused` for a pause (now with `awaiting` — the calls waiting on an approval, a client tool or a sub-agent — and `stopped` for a user stop), or `core.run_ended` with `status: "done" | "handoff" | "error"`. A `core.error` the loop retries past, or one from a throwing `pullInput`, gets no `run_ended`. `runStatusOf({ held, lastMarker })` turns a lease flag and `lastRunMarker(timeline)` into running / paused / done / handoff / error / interrupted / idle / unknown; `@reinsjs/store-pg` has `pgRunStates` for a whole session list in one statement. Sessions containing `core.run_ended` cannot be read by 0.13 or earlier: upgrade every instance together and do not roll back.
140
+ - **Pause codes (0.15).** A socket's `pause` may carry a `code` — your own short identifier such as `acme.credits_exhausted` — next to `reason` and `note`. It is written into `core.run_paused` together with the note and comes back as `RunStatus.paused.code`, so another request or process can tell why the run paused without guessing. reins never branches on it and it is not part of the resume state. Format: `PAUSE_CODE_RE` (lowercase letters, digits, `_ . : -`, starting with a letter or digit, at most 64 characters); a code that does not match is dropped — the run still pauses, and a model-invisible `core.error` (category `input`, `detail.phase: "onTurnEnd"`, no `run_ended` after it) is logged just before the `core.run_paused`. The same happens when `reason` is anything but `"budget"` or `"host"`: the run pauses with `host`. Put your own reasons in `code`. The `reins.` prefix is used by built-in sources: `reins.max_turns` (the loop's `maxTurns` limit), `reins.budget` and `reins.compact_stalled` (from `@reinsjs/brain`). Aborts and user stops carry no code. A paused sub-agent's code stays in the child session — look it up through `awaiting[].childSessionId`.
140
141
  - **Deterministic given the log.** Time and ids are injected (`now`, `newId`), so a recorded session replays byte-for-byte in tests.
141
142
 
142
143
  ## Documentation
@@ -714,9 +714,16 @@ interface HandoffIntent {
714
714
  }
715
715
  type TurnDecision = "continue" | "stop" | {
716
716
  handoff: HandoffIntent;
717
- } | {
717
+ }
718
+ /**
719
+ * 暂停。`code` 是可选的原因码(2026-11-23,AdRate 建议 16):随 `note` 写进 `core.run_paused`,`runStatusOf` 带出,
720
+ * 事后分得清是谁、为什么停的。只是标注,库不按它做分支;格式见 `PAUSE_CODE_RE`,不合规的码被丢掉并记一条非终结 `core.error`,照常暂停。
721
+ * `reins.` 前缀留给内置来源,宿主用自己的前缀
722
+ */
723
+ | {
718
724
  pause: {
719
725
  reason: "budget" | "host";
726
+ code?: string;
720
727
  note?: string;
721
728
  };
722
729
  };
@@ -851,12 +858,16 @@ type Interruption = {
851
858
  kind: "client_tool";
852
859
  toolCallId: string;
853
860
  call: ToolCallPayload;
854
- } | {
861
+ }
862
+ /** `code`:Socket 给的原因码,或内置来源的 `reins.*`(见 pause-code.ts);宿主中止、用户停止不带 */
863
+ | {
855
864
  kind: "budget";
856
865
  note: string;
866
+ code?: string;
857
867
  } | {
858
868
  kind: "host";
859
869
  note: string;
870
+ code?: string;
860
871
  } | SubagentInterruption;
861
872
  /**
862
873
  * 子代理即工具(§10.1,`asTool`)的暂停冒泡:工具里跑的子 run 暂停了,父 run 不落这条 tool_result(调用留作 pending),
@@ -1190,6 +1201,16 @@ interface BudgetUsagePayload {
1190
1201
  }
1191
1202
  interface RunPausedPayload {
1192
1203
  reason: "approval" | "budget" | "host";
1204
+ /**
1205
+ * 这次暂停的原因码(2026-11-23,AdRate 建议 16):Socket 暂停时给的,或内置来源的 `reins.*`(轮数兜底、budget、compact)。
1206
+ * 只是标注,库不按它做任何分支;格式见 `PAUSE_CODE_RE`。宿主中止、用户停止、审批 / 客户端工具 / 子代理的暂停不带。
1207
+ * 可选字段,不升版本
1208
+ */
1209
+ code?: string;
1210
+ /**
1211
+ * 给人看的说明,与本次 `Interruption.note` 是同一句(budget / host 那条)。排查用,不进 `RunStatus`。可选字段,不升版本
1212
+ */
1213
+ note?: string;
1193
1214
  /** 序列化 run 状态的外部引用(宿主 KV 键、URL 参数等),可选 */
1194
1215
  stateRef?: string;
1195
1216
  /**
@@ -1303,4 +1324,4 @@ type ExtEvent = Event<`ext.${string}`, unknown>;
1303
1324
  /** 日志里可能出现的任何事件 */
1304
1325
  type AnyEvent = CoreEvent | ExtEvent;
1305
1326
 
1306
- export { DEFAULT_TRUST as $, type AwaitingCall as A, type BudgetUsagePayload as B, type ContentPart as C, type ApprovalDecisionPayload as D, type Event as E, type ApprovalRequestPayload as F, type ApprovalRequestSpec as G, type AudioPart as H, type Interruption as I, type BeforeModelPatch as J, type BeforeToolDecision as K, type LoopConfig as L, type ModelRef as M, type BoundModel as N, CORE_SCHEMAS as O, type PauseReason as P, type CompactionPayload as Q, type RunResult as R, type SerializedRunState as S, type ToolCallEvent as T, type CoreEvent as U, type CoreEventPayloads as V, type CoreEventType as W, type CreateEventInput as X, DEFAULT_RETRY_BASE_DELAY_MS as Y, DEFAULT_RETRY_MAX_ATTEMPTS as Z, DEFAULT_RETRY_MAX_DELAY_MS as _, type ToolResultEvent as a, createEvent as a$, type ErrorEventPayload as a0, type ErrorPayload as a1, type EventBase as a2, type EventSchema as a3, type ExtEvent as a4, type HandoffIntent as a5, type HandoffPayload as a6, type ImagePart as a7, type LandingRecord as a8, type LandingSpec as a9, type SkillSource as aA, type Socket as aB, type SocketSetup as aC, type StaticContribution as aD, type SystemNotePayload as aE, type TextPart as aF, type ToRequestInput as aG, type TokenUsage as aH, type ToolBatch as aI, type ToolCallPayload as aJ, type ToolContext as aK, type ToolReferencePart as aL, type ToolResultDraft as aM, type ToolResultPayload as aN, type ToolSide as aO, type ToolStartedPayload as aP, type ToolsBoundPayload as aQ, type TurnContext as aR, type TurnDecision as aS, type Upcaster as aT, type UserMessagePayload as aU, type VideoPart as aV, backoffDelayMs as aW, contextOverheadOf as aX, contextTokensOf as aY, createCoreEvent as aZ, createCoreRegistry as a_, type LossKind as aa, type LossMatrix as ab, type LoweredRequest as ac, type Lowering as ad, type LoweringCapabilities as ae, type LoweringDelta as af, type LoweringOutcome as ag, type LoweringStreamContext as ah, type MaybePromise as ai, type MemoryOpPayload as aj, type ModelCallFailure as ak, type ModelTextPayload as al, type ModelThinkingPayload as am, type Principal as an, type ProjectionStep as ao, type ProjectionStepStats as ap, type Provenance as aq, type PullInputContext as ar, type ResolvedRetry as as, type RetryOptions as at, type RunEndedPayload as au, type RunPausedPayload as av, type RunResumedPayload as aw, SchemaError as ax, type SchemaErrorCode as ay, type SessionInfo as az, type EventLog as b, defaultSleep as b0, isTransientFailure as b1, lossesOf as b2, renderToolReference as b3, resolveRetry as b4, statusFromMessage as b5, type EventDraft as c, type Tool as d, EventSchemaRegistry as e, type SubagentInterruption as f, type ToolSpec as g, type ToolResult as h, type Trust as i, type CoreEventOf as j, type CoreEventDraft as k, type ProjectionBudget as l, type ProjectionStrategy as m, type ProjectionContext as n, type TokenEstimator as o, type ProjectionResult as p, type ProjectionStats as q, type BlobStore as r, type BlobMeta as s, type ReadOptions as t, type MemoryStore as u, type RunLease as v, type Stores as w, type Actor as x, type AnyEvent as y, type ApprovalDecisionInput as z };
1327
+ export { DEFAULT_RETRY_MAX_DELAY_MS as $, type AwaitingCall as A, type BudgetUsagePayload as B, type ContentPart as C, type ApprovalDecisionInput as D, type Event as E, type ApprovalDecisionPayload as F, type ApprovalRequestPayload as G, type ApprovalRequestSpec as H, type Interruption as I, type AudioPart as J, type BeforeModelPatch as K, type LoopConfig as L, type ModelRef as M, type BeforeToolDecision as N, type BoundModel as O, type PauseReason as P, CORE_SCHEMAS as Q, type RunResult as R, type SerializedRunState as S, type ToolCallEvent as T, type CompactionPayload as U, type CoreEvent as V, type CoreEventPayloads as W, type CoreEventType as X, type CreateEventInput as Y, DEFAULT_RETRY_BASE_DELAY_MS as Z, DEFAULT_RETRY_MAX_ATTEMPTS as _, type ToolResultEvent as a, createEvent as a$, DEFAULT_TRUST as a0, type ErrorEventPayload as a1, type EventBase as a2, type EventSchema as a3, type ExtEvent as a4, type HandoffIntent as a5, type HandoffPayload as a6, type ImagePart as a7, type LandingRecord as a8, type LandingSpec as a9, type SkillSource as aA, type Socket as aB, type SocketSetup as aC, type StaticContribution as aD, type SystemNotePayload as aE, type TextPart as aF, type ToRequestInput as aG, type TokenUsage as aH, type ToolBatch as aI, type ToolCallPayload as aJ, type ToolContext as aK, type ToolReferencePart as aL, type ToolResultDraft as aM, type ToolResultPayload as aN, type ToolSide as aO, type ToolStartedPayload as aP, type ToolsBoundPayload as aQ, type TurnContext as aR, type TurnDecision as aS, type Upcaster as aT, type UserMessagePayload as aU, type VideoPart as aV, backoffDelayMs as aW, contextOverheadOf as aX, contextTokensOf as aY, createCoreEvent as aZ, createCoreRegistry as a_, type LossKind as aa, type LossMatrix as ab, type LoweredRequest as ac, type Lowering as ad, type LoweringCapabilities as ae, type LoweringDelta as af, type LoweringOutcome as ag, type LoweringStreamContext as ah, type MaybePromise as ai, type MemoryOpPayload as aj, type ModelCallFailure as ak, type ModelTextPayload as al, type ModelThinkingPayload as am, type Principal as an, type ProjectionStep as ao, type ProjectionStepStats as ap, type Provenance as aq, type PullInputContext as ar, type ResolvedRetry as as, type RetryOptions as at, type RunEndedPayload as au, type RunPausedPayload as av, type RunResumedPayload as aw, SchemaError as ax, type SchemaErrorCode as ay, type SessionInfo as az, type EventLog as b, defaultSleep as b0, isTransientFailure as b1, lossesOf as b2, renderToolReference as b3, resolveRetry as b4, statusFromMessage as b5, type ErrorPayload as c, type EventDraft as d, type Tool as e, EventSchemaRegistry as f, type SubagentInterruption as g, type ToolSpec as h, type ToolResult as i, type Trust as j, type CoreEventOf as k, type CoreEventDraft as l, type ProjectionBudget as m, type ProjectionStrategy as n, type ProjectionContext as o, type TokenEstimator as p, type ProjectionResult as q, type ProjectionStats as r, type BlobStore as s, type BlobMeta as t, type ReadOptions as u, type MemoryStore as v, type RunLease as w, type Stores as x, type Actor as y, type AnyEvent as z };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Event, T as ToolCallEvent, a as ToolResultEvent, b as EventLog, L as LoopConfig, c as EventDraft, R as RunResult, P as PauseReason, A as AwaitingCall, d as Tool, I as Interruption, e as EventSchemaRegistry, S as SerializedRunState, M as ModelRef, f as SubagentInterruption, g as ToolSpec, C as ContentPart, h as ToolResult, i as Trust, j as CoreEventOf, k as CoreEventDraft, l as ProjectionBudget, m as ProjectionStrategy, n as ProjectionContext, o as TokenEstimator, p as ProjectionResult, q as ProjectionStats, B as BudgetUsagePayload, r as BlobStore, s as BlobMeta, t as ReadOptions, u as MemoryStore, v as RunLease, w as Stores } from './core-BhmO9N-j.js';
2
- export { x as Actor, y as AnyEvent, z as ApprovalDecisionInput, D as ApprovalDecisionPayload, F as ApprovalRequestPayload, G as ApprovalRequestSpec, H as AudioPart, J as BeforeModelPatch, K as BeforeToolDecision, N as BoundModel, O as CORE_SCHEMAS, Q as CompactionPayload, U as CoreEvent, V as CoreEventPayloads, W as CoreEventType, X as CreateEventInput, Y as DEFAULT_RETRY_BASE_DELAY_MS, Z as DEFAULT_RETRY_MAX_ATTEMPTS, _ as DEFAULT_RETRY_MAX_DELAY_MS, $ as DEFAULT_TRUST, a0 as ErrorEventPayload, a1 as ErrorPayload, a2 as EventBase, a3 as EventSchema, a4 as ExtEvent, a5 as HandoffIntent, a6 as HandoffPayload, a7 as ImagePart, a8 as LandingRecord, a9 as LandingSpec, aa as LossKind, ab as LossMatrix, ac as LoweredRequest, ad as Lowering, ae as LoweringCapabilities, af as LoweringDelta, ag as LoweringOutcome, ah as LoweringStreamContext, ai as MaybePromise, aj as MemoryOpPayload, ak as ModelCallFailure, al as ModelTextPayload, am as ModelThinkingPayload, an as Principal, ao as ProjectionStep, ap as ProjectionStepStats, aq as Provenance, ar as PullInputContext, as as ResolvedRetry, at as RetryOptions, au as RunEndedPayload, av as RunPausedPayload, aw as RunResumedPayload, ax as SchemaError, ay as SchemaErrorCode, az as SessionInfo, aA as SkillSource, aB as Socket, aC as SocketSetup, aD as StaticContribution, aE as SystemNotePayload, aF as TextPart, aG as ToRequestInput, aH as TokenUsage, aI as ToolBatch, aJ as ToolCallPayload, aK as ToolContext, aL as ToolReferencePart, aM as ToolResultDraft, aN as ToolResultPayload, aO as ToolSide, aP as ToolStartedPayload, aQ as ToolsBoundPayload, aR as TurnContext, aS as TurnDecision, aT as Upcaster, aU as UserMessagePayload, aV as VideoPart, aW as backoffDelayMs, aX as contextOverheadOf, aY as contextTokensOf, aZ as createCoreEvent, a_ as createCoreRegistry, a$ as createEvent, b0 as defaultSleep, b1 as isTransientFailure, b2 as lossesOf, b3 as renderToolReference, b4 as resolveRetry, b5 as statusFromMessage } from './core-BhmO9N-j.js';
1
+ import { E as Event, T as ToolCallEvent, a as ToolResultEvent, b as EventLog, I as Interruption, c as ErrorPayload, L as LoopConfig, d as EventDraft, R as RunResult, P as PauseReason, A as AwaitingCall, e as Tool, f as EventSchemaRegistry, S as SerializedRunState, M as ModelRef, g as SubagentInterruption, h as ToolSpec, C as ContentPart, i as ToolResult, j as Trust, k as CoreEventOf, l as CoreEventDraft, m as ProjectionBudget, n as ProjectionStrategy, o as ProjectionContext, p as TokenEstimator, q as ProjectionResult, r as ProjectionStats, B as BudgetUsagePayload, s as BlobStore, t as BlobMeta, u as ReadOptions, v as MemoryStore, w as RunLease, x as Stores } from './core-iqk8S_mU.js';
2
+ export { y as Actor, z as AnyEvent, D as ApprovalDecisionInput, F as ApprovalDecisionPayload, G as ApprovalRequestPayload, H as ApprovalRequestSpec, J as AudioPart, K as BeforeModelPatch, N as BeforeToolDecision, O as BoundModel, Q as CORE_SCHEMAS, U as CompactionPayload, V as CoreEvent, W as CoreEventPayloads, X as CoreEventType, Y as CreateEventInput, Z as DEFAULT_RETRY_BASE_DELAY_MS, _ as DEFAULT_RETRY_MAX_ATTEMPTS, $ as DEFAULT_RETRY_MAX_DELAY_MS, a0 as DEFAULT_TRUST, a1 as ErrorEventPayload, a2 as EventBase, a3 as EventSchema, a4 as ExtEvent, a5 as HandoffIntent, a6 as HandoffPayload, a7 as ImagePart, a8 as LandingRecord, a9 as LandingSpec, aa as LossKind, ab as LossMatrix, ac as LoweredRequest, ad as Lowering, ae as LoweringCapabilities, af as LoweringDelta, ag as LoweringOutcome, ah as LoweringStreamContext, ai as MaybePromise, aj as MemoryOpPayload, ak as ModelCallFailure, al as ModelTextPayload, am as ModelThinkingPayload, an as Principal, ao as ProjectionStep, ap as ProjectionStepStats, aq as Provenance, ar as PullInputContext, as as ResolvedRetry, at as RetryOptions, au as RunEndedPayload, av as RunPausedPayload, aw as RunResumedPayload, ax as SchemaError, ay as SchemaErrorCode, az as SessionInfo, aA as SkillSource, aB as Socket, aC as SocketSetup, aD as StaticContribution, aE as SystemNotePayload, aF as TextPart, aG as ToRequestInput, aH as TokenUsage, aI as ToolBatch, aJ as ToolCallPayload, aK as ToolContext, aL as ToolReferencePart, aM as ToolResultDraft, aN as ToolResultPayload, aO as ToolSide, aP as ToolStartedPayload, aQ as ToolsBoundPayload, aR as TurnContext, aS as TurnDecision, aT as Upcaster, aU as UserMessagePayload, aV as VideoPart, aW as backoffDelayMs, aX as contextOverheadOf, aY as contextTokensOf, aZ as createCoreEvent, a_ as createCoreRegistry, a$ as createEvent, b0 as defaultSleep, b1 as isTransientFailure, b2 as lossesOf, b3 as renderToolReference, b4 as resolveRetry, b5 as statusFromMessage } from './core-iqk8S_mU.js';
3
3
 
4
4
  /**
5
5
  * UUID v7 生成(RFC 9562):前 48 位为 Unix 毫秒时间戳,字典序即时间序。
@@ -39,6 +39,70 @@ declare function forkSession(log: EventLog, opts: ForkOptions): Promise<{
39
39
  toSessionId: string;
40
40
  }>;
41
41
 
42
+ /**
43
+ * 暂停原因码(2026-11-23,AdRate 建议 16)。
44
+ *
45
+ * `reason` 是三选一的闭集(approval / budget / host),事后只凭它分不清"是谁、为什么停的":积分用完、预算触顶、
46
+ * 连续整理失败落库后都是 budget。Socket 暂停时可以再带一个原因码 `code`,随 `note` 一起写进 `core.run_paused`,
47
+ * `runStatusOf` 带出 `code`——另一个请求、另一个进程、列表轮询都读得到暂停那一刻的原因(宪法二)。
48
+ *
49
+ * `code` 只是标注:库不解释它、不按它做任何分支,也不进续跑状态与签名。`reins.` 前缀留给内置来源
50
+ * (循环的 `MAX_TURNS_PAUSE_CODE`、brain 的 budget / compact),靠约定不靠校验——循环分不出一个 Socket 是内置的还是宿主的;
51
+ * 宿主用自己的前缀(如 `acme.credits_exhausted`)。
52
+ *
53
+ * 标注写错不能改变结局:Socket 要求暂停就一定暂停(那是边界动作,也只有暂停才带续跑凭据)。意见里不合规的地方
54
+ * 被改正(码丢掉、reason 退成 host),改正处记一条模型不可见的非终结 `core.error`——不静默,也不把受控暂停变成 error。
55
+ *
56
+ * 这里是口径的唯一一处(真源索引):格式判定 `isPauseCode` 写入与读取共用;Socket 的暂停意见怎么变成一条中断
57
+ * (`resolveSocketPause`)、中断怎么变成 `run_paused` 里的字段(`pauseDetailOf`),runLoop 与 TanStack 适配器调同一对函数。
58
+ */
59
+
60
+ /**
61
+ * 原因码的格式:小写字母或数字开头,其后小写字母 / 数字 / `_` `.` `:` `-`,总长 1~64。
62
+ * 收这么紧是为了让它在下游能直接当标识符用(前端文案键、日志字段、switch 的 case),而不是一句自由文本。
63
+ * 只许收紧不许放宽:读侧对不合规的码判 unknown,放宽之后老版本的读者会把带新码的会话整个判成 unknown(连 awaiting 一起丢),
64
+ * 真要放宽得按"所有实例一起升级、不回滚"对待
65
+ */
66
+ declare const PAUSE_CODE_RE: RegExp;
67
+ /** 写入(循环校验 Socket 给的码)与读取(`runStatusOf` 的形状守卫)共用的格式判定 */
68
+ declare function isPauseCode(x: unknown): x is string;
69
+ /** 循环自带的轮数兜底(`LoopConfig.maxTurns`)触顶时的原因码 */
70
+ declare const MAX_TURNS_PAUSE_CODE = "reins.max_turns";
71
+ /** Socket 暂停产生的中断:budget / host 两种,可带原因码 */
72
+ type SocketPauseInterruption = Extract<Interruption, {
73
+ kind: "budget" | "host";
74
+ }>;
75
+ interface SocketPauseResolution {
76
+ /** 按这条中断暂停:`kind` 即暂停原因 */
77
+ interruption: SocketPauseInterruption;
78
+ /**
79
+ * 意见里有不合规、已被改正的地方时给出:调用方在暂停之前把它记成一条非终结的 `core.error`(模型不可见)。
80
+ * 全合规时没有这个字段
81
+ */
82
+ error?: ErrorPayload;
83
+ }
84
+ /**
85
+ * Socket 的暂停意见 → 一条中断:补上缺省 note,校验 reason 与 code。永不抛错、永远给得出一条可暂停的中断:
86
+ * - `reason` 不是 budget / host(JS 宿主想自定义原因时最容易这么写)→ 按 host 暂停。照原样写进 `run_paused` 的话
87
+ * `runStatusOf` 只能判 unknown,自定义原因该放进 `code`;
88
+ * - `code` 不满足 `isPauseCode` → 丢掉,不合规的码不进时间线。
89
+ * 入参按 unknown 对待:类型挡得住 TS 宿主,挡不住 JS 宿主与运行时算出来的码
90
+ */
91
+ declare function resolveSocketPause(pause: {
92
+ reason: unknown;
93
+ code?: unknown;
94
+ note?: string;
95
+ }): SocketPauseResolution;
96
+ /**
97
+ * 一次暂停的中断列表 → 写进 `core.run_paused` 的原因码与说明:取 budget / host 那一条(一次暂停里至多一条)。
98
+ * 审批 / 客户端工具 / 子代理的暂停没有这一条,返回空对象——它们等的是谁已经在 `awaiting` 里;
99
+ * 子代理自己的原因码不上浮,按 `awaiting[].childSessionId` 查子会话
100
+ */
101
+ declare function pauseDetailOf(interruptions: readonly Interruption[]): {
102
+ code?: string;
103
+ note?: string;
104
+ };
105
+
42
106
  /**
43
107
  * runLoop:reins 的默认循环(技术方案 §2、§6、§7)。
44
108
  *
@@ -161,6 +225,11 @@ type RunStatus = {
161
225
  stopped: boolean;
162
226
  /** 老版本写的 run_paused 不带,为 undefined */
163
227
  awaiting: AwaitingCall[] | undefined;
228
+ /**
229
+ * 暂停原因码(AdRate 建议 16):Socket 暂停时给的,或内置来源的 `reins.*`。没给码的暂停(宿主中止、用户停止、
230
+ * 审批 / 客户端工具 / 子代理)与老版本写的事件没有这个字段。给人看的 `note` 只在事件里,不进这里
231
+ */
232
+ code?: string;
164
233
  };
165
234
  /**
166
235
  * 纯函数:租约 + 最后一条 run 标记 → 运行状态(真源索引)。
@@ -441,8 +510,14 @@ declare function diffToolNames(previous: readonly string[], next: readonly strin
441
510
  /**
442
511
  * 给模型看的变化说明(英文,进模型上下文)。只列名字:说明在工具表里,重复一遍既费 token 又可能与工具表不一致;
443
512
  * 被移除的工具明说"不能再调用",模型才不会按记忆去调一个已经不存在的工具。
513
+ *
514
+ * 一侧超过 `TOOL_CHANGE_LIST_MAX` 件(MCP 凭据过期 / 恢复会一次增删几百件,AdRate 建议 15)只列这么多个、报总数。
515
+ * `tiers` 是优先档,前档先列、档内按字母序;不在任何档的按字母序补足,让模型看得出是哪一类工具变了。
516
+ * `toolsBoundDrafts` 传 [调用过的, 只在文本里出现过的](见 `toolMentionTiers`):往期工具表不进历史,
517
+ * 模型只可能凭记忆去调这些。说明写进日志后每次请求都回放,几百个名字会常驻上下文;
518
+ * 完整增删照旧记在 `meta.toolsChanged` 与 tools_bound,压缩的只是这句话。
444
519
  */
445
- declare function renderToolChangeNote(diff: ToolNamesDiff): string;
520
+ declare function renderToolChangeNote(diff: ToolNamesDiff, tiers?: readonly ReadonlySet<string>[]): string;
446
521
  /**
447
522
  * 起步要 append 的草稿:一条 tools_bound,工具表与上一条相比有增删且 `announce` 为真时再加一条 system_note。
448
523
  * 顺序固定:快照在前、说明在后 —— 说明是从快照比对得出的,日志里的因果也该这么排。
@@ -573,7 +648,10 @@ declare function estimateBudgetOf(budget: ProjectionBudget): number;
573
648
  /**
574
649
  * 默认对模型不可见的运维事件。它们服务于宿主与审计,对模型没有信息量或已由别的事件承载:
575
650
  * - approval_*:审批结果由 B7 以 tool_result(isError) 告知模型
576
- * - run_paused / run_resumed / budget_usage / memory_op:运行记录,感知模块会把要点提炼进 system_note
651
+ * - run_paused / run_resumed:run 的起止记录,只给宿主判状态与续跑用;没有模块把它转述给模型
652
+ * (宿主想让模型知道上次为什么停,自己按 run_paused 的原因码写一条 system_note)
653
+ * - budget_usage:用量记录,感知模块把要点提炼进 system_note
654
+ * - memory_op:记忆读写的审计记录,模型已从工具结果得知
577
655
  * - handoff:交接后当前会话结束,新会话首条 user 消息承载 triggerMessage
578
656
  * - error:provider 级错误由循环层处理;工具错误已在 tool_result.isError
579
657
  * - tools_bound:每次 run 起步的工具表快照(P1);工具表本身在请求里,增删由循环以 system_note(kind=host) 告知模型
@@ -925,6 +1003,6 @@ declare function readTimeline(log: EventLog, sessionId: string, opts: ReadTimeli
925
1003
  */
926
1004
 
927
1005
  /** 库版本,与 packages/core/package.json 的 version 同步(发布前 `pnpm check:dist` 会核对) */
928
- declare const REINS_VERSION = "0.14.0";
1006
+ declare const REINS_VERSION = "0.15.0";
929
1007
 
930
- export { AwaitingCall, BUILTIN_APPROVAL_POLICY, BlobMeta, BlobStore, type BudgetTruncateOptions, BudgetUsagePayload, type CompactionEvent, ContentPart, type ContributionConfig, CoreEventDraft, CoreEventOf, DEFAULT_CUT_TO_RATIO, DEFAULT_MAX_TURNS, DEFAULT_MODEL_INVISIBLE_TYPES, DEFAULT_RESERVE_RATIO, type DecodedToolArguments, type DefaultChainOptions, Event, EventDraft, EventLog, EventSchemaRegistry, type FoldOptions, type FoldedToolResult, type FoldedToolResultOptions, type ForkOptions, INPUT_DRAFT_TYPES, INTERRUPTED_IN_PROGRESS_TEXT, INTERRUPTED_NOT_EXECUTED_TEXT, InMemoryBlobStore, InMemoryEventLog, InMemoryMemoryStore, InMemoryRunLease, Interruption, LoopConfig, LoweringError, type LoweringErrorCode, type MarkedContent, MemoryStore, ModelRef, OUTCOME_UNKNOWN_TEXT, PauseReason, type ProjectOptions, ProjectionBudget, ProjectionContext, ProjectionResult, ProjectionStats, ProjectionStrategy, REINS_VERSION, RUN_MARKER_TYPES, ReadOptions, type ReadTimelineOptions, type RenderManifestOptions, type ReplayOptions, type ReplayResult, type ReplayedTurn, type ResolvedContributions, RunLease, RunResult, RunStateError, type RunStateErrorCode, type RunStatus, RunStop, STOPPED_IN_PROGRESS_TEXT, STOPPED_NOTE, STOPPED_NOT_EXECUTED_TEXT, SerializedRunState, type StopTexts, StoreError, type StoreErrorCode, Stores, SubagentInterruption, type SubagentPause, type SubagentPauseDetail, type ThresholdSummarizer, TokenEstimator, Tool, ToolCallEvent, type ToolNamesDiff, ToolResult, ToolResultEvent, ToolSpec, type ToolsBoundEvent, Trust, UNTRUSTED_CLOSE_TAG, UNTRUSTED_TAG, type VisibilityFilterOptions, assertRunStateShape, awaitingOf, budgetTruncate, computeConfigHash, computeModelDigest, computePendingDigest, computePendingToolsDigest, covers, decodeToolArgumentsText, defaultProjectionChain, defaultThresholdSummary, deferredToolSpecOf, defineTool, diffToolNames, digestArgs, errorMessageOf, escapeUntrustedText, estimateBudgetOf, estimateTextTokens, estimateTotal, foldCompactions, foldedToolResults, forkSession, inputDrafts, isClientTool, isCompaction, isContentPart, isModelOutput, isPinNote, isReplayable, isStopReason, isStopped, isSubagentPause, keptBy, lastRunMarker, lastToolsBound, markUntrusted, markUntrustedText, memoryStore, needsUntrustedMark, normalizeToolOutput, outcomeUnknownText, pausedStateOf, pendingToolCalls, project, readEvents, readTimeline, reinjectPins, renderFoldedToolResults, renderToolChangeNote, replayTurns, resolveSocketContributions, roughTokenEstimate, runLoop, runStatusOf, serializeRunState, signRunState, splitTurns, startedToolCallIds, stopTextsOf, subagentPause, supersededIds, toolBatchOf, toolCallArgumentsMeta, toolResultTrust, toolSpecOf, toolStartedAt, toolsBoundDrafts, untrustedOpenTag, untrustedSourceOf, unwrapToolArguments, uuidv7, validateResume, verifyRunState, visibilityFilter, withStartedAt };
1008
+ export { AwaitingCall, BUILTIN_APPROVAL_POLICY, BlobMeta, BlobStore, type BudgetTruncateOptions, BudgetUsagePayload, type CompactionEvent, ContentPart, type ContributionConfig, CoreEventDraft, CoreEventOf, DEFAULT_CUT_TO_RATIO, DEFAULT_MAX_TURNS, DEFAULT_MODEL_INVISIBLE_TYPES, DEFAULT_RESERVE_RATIO, type DecodedToolArguments, type DefaultChainOptions, ErrorPayload, Event, EventDraft, EventLog, EventSchemaRegistry, type FoldOptions, type FoldedToolResult, type FoldedToolResultOptions, type ForkOptions, INPUT_DRAFT_TYPES, INTERRUPTED_IN_PROGRESS_TEXT, INTERRUPTED_NOT_EXECUTED_TEXT, InMemoryBlobStore, InMemoryEventLog, InMemoryMemoryStore, InMemoryRunLease, Interruption, LoopConfig, LoweringError, type LoweringErrorCode, MAX_TURNS_PAUSE_CODE, type MarkedContent, MemoryStore, ModelRef, OUTCOME_UNKNOWN_TEXT, PAUSE_CODE_RE, PauseReason, type ProjectOptions, ProjectionBudget, ProjectionContext, ProjectionResult, ProjectionStats, ProjectionStrategy, REINS_VERSION, RUN_MARKER_TYPES, ReadOptions, type ReadTimelineOptions, type RenderManifestOptions, type ReplayOptions, type ReplayResult, type ReplayedTurn, type ResolvedContributions, RunLease, RunResult, RunStateError, type RunStateErrorCode, type RunStatus, RunStop, STOPPED_IN_PROGRESS_TEXT, STOPPED_NOTE, STOPPED_NOT_EXECUTED_TEXT, SerializedRunState, type SocketPauseInterruption, type SocketPauseResolution, type StopTexts, StoreError, type StoreErrorCode, Stores, SubagentInterruption, type SubagentPause, type SubagentPauseDetail, type ThresholdSummarizer, TokenEstimator, Tool, ToolCallEvent, type ToolNamesDiff, ToolResult, ToolResultEvent, ToolSpec, type ToolsBoundEvent, Trust, UNTRUSTED_CLOSE_TAG, UNTRUSTED_TAG, type VisibilityFilterOptions, assertRunStateShape, awaitingOf, budgetTruncate, computeConfigHash, computeModelDigest, computePendingDigest, computePendingToolsDigest, covers, decodeToolArgumentsText, defaultProjectionChain, defaultThresholdSummary, deferredToolSpecOf, defineTool, diffToolNames, digestArgs, errorMessageOf, escapeUntrustedText, estimateBudgetOf, estimateTextTokens, estimateTotal, foldCompactions, foldedToolResults, forkSession, inputDrafts, isClientTool, isCompaction, isContentPart, isModelOutput, isPauseCode, isPinNote, isReplayable, isStopReason, isStopped, isSubagentPause, keptBy, lastRunMarker, lastToolsBound, markUntrusted, markUntrustedText, memoryStore, needsUntrustedMark, normalizeToolOutput, outcomeUnknownText, pauseDetailOf, pausedStateOf, pendingToolCalls, project, readEvents, readTimeline, reinjectPins, renderFoldedToolResults, renderToolChangeNote, replayTurns, resolveSocketContributions, resolveSocketPause, roughTokenEstimate, runLoop, runStatusOf, serializeRunState, signRunState, splitTurns, startedToolCallIds, stopTextsOf, subagentPause, supersededIds, toolBatchOf, toolCallArgumentsMeta, toolResultTrust, toolSpecOf, toolStartedAt, toolsBoundDrafts, untrustedOpenTag, untrustedSourceOf, unwrapToolArguments, uuidv7, validateResume, verifyRunState, visibilityFilter, withStartedAt };
package/dist/index.js CHANGED
@@ -616,6 +616,56 @@ async function forkSession(log, opts) {
616
616
  return { toSessionId };
617
617
  }
618
618
 
619
+ // src/loop/pause-code.ts
620
+ var PAUSE_CODE_RE = /^[a-z0-9][a-z0-9_.:-]{0,63}$/;
621
+ function isPauseCode(x) {
622
+ return typeof x === "string" && PAUSE_CODE_RE.test(x);
623
+ }
624
+ var MAX_TURNS_PAUSE_CODE = "reins.max_turns";
625
+ function describeValue(value) {
626
+ if (typeof value !== "string") return value === null ? "null" : typeof value;
627
+ return JSON.stringify(value.length > 80 ? `${value.slice(0, 80)}\u2026` : value);
628
+ }
629
+ function resolveSocketPause(pause) {
630
+ const problems = [];
631
+ let kind;
632
+ if (pause.reason === "budget" || pause.reason === "host") {
633
+ kind = pause.reason;
634
+ } else {
635
+ kind = "host";
636
+ problems.push(
637
+ `pause.reason must be "budget" or "host", got ${describeValue(pause.reason)}; paused with reason "host" instead.`
638
+ );
639
+ }
640
+ let code;
641
+ if (isPauseCode(pause.code)) {
642
+ code = pause.code;
643
+ } else if (pause.code !== void 0) {
644
+ problems.push(
645
+ `pause.code must match ${PAUSE_CODE_RE.source}, got ${describeValue(pause.code)}; the code was dropped.`
646
+ );
647
+ }
648
+ const note = pause.note ?? `a socket requested a pause (${kind})`;
649
+ const interruption = { kind, note, ...code !== void 0 ? { code } : {} };
650
+ if (problems.length === 0) return { interruption };
651
+ return {
652
+ interruption,
653
+ error: {
654
+ category: "input",
655
+ message: problems.join(" "),
656
+ retryable: false,
657
+ detail: { phase: "onTurnEnd" }
658
+ }
659
+ };
660
+ }
661
+ function pauseDetailOf(interruptions) {
662
+ for (const i of interruptions) {
663
+ if (i.kind !== "budget" && i.kind !== "host") continue;
664
+ return { ...i.code !== void 0 ? { code: i.code } : {}, note: i.note };
665
+ }
666
+ return {};
667
+ }
668
+
619
669
  // src/lowering/errors.ts
620
670
  var LoweringError = class extends Error {
621
671
  constructor(code, message, context = {}) {
@@ -945,13 +995,15 @@ function runStatusOf(input) {
945
995
  if (p.stopped !== void 0 && p.stopped !== true) return { state: "unknown" };
946
996
  if (p.awaiting !== void 0 && !(Array.isArray(p.awaiting) && p.awaiting.every(isAwaitingCall)))
947
997
  return { state: "unknown" };
998
+ if (p.code !== void 0 && !isPauseCode(p.code)) return { state: "unknown" };
948
999
  return {
949
1000
  state: "paused",
950
1001
  seq,
951
1002
  endedAt: at,
952
1003
  reason: p.reason,
953
1004
  stopped: p.stopped === true,
954
- awaiting: p.awaiting
1005
+ awaiting: p.awaiting,
1006
+ ...p.code !== void 0 ? { code: p.code } : {}
955
1007
  };
956
1008
  }
957
1009
  case "core.run_ended": {
@@ -1228,13 +1280,95 @@ function diffToolNames(previous, next) {
1228
1280
  if (added.length === 0 && removed.length === 0) return void 0;
1229
1281
  return { added, removed };
1230
1282
  }
1231
- function renderToolChangeNote(diff) {
1283
+ var TOOL_CHANGE_LIST_MAX = 20;
1284
+ function renderToolChangeNote(diff, tiers = []) {
1232
1285
  const lines = ["Your available tools changed since the previous run."];
1233
- if (diff.added.length > 0) lines.push(`Added: ${diff.added.join(", ")}.`);
1234
- if (diff.removed.length > 0)
1235
- lines.push(`Removed (no longer callable, even if earlier turns used them): ${diff.removed.join(", ")}.`);
1286
+ const { added, removed } = diff;
1287
+ if (added.length > TOOL_CHANGE_LIST_MAX)
1288
+ lines.push(`Added ${added.length} tools, including ${sampleNames(added, tiers)}.`);
1289
+ else if (added.length > 0) lines.push(`Added: ${added.join(", ")}.`);
1290
+ if (removed.length > TOOL_CHANGE_LIST_MAX)
1291
+ lines.push(
1292
+ `Removed ${removed.length} tools (no longer callable, even if earlier turns used them), including ${sampleNames(removed, tiers)}.`
1293
+ );
1294
+ else if (removed.length > 0)
1295
+ lines.push(`Removed (no longer callable, even if earlier turns used them): ${removed.join(", ")}.`);
1236
1296
  return lines.join(" ");
1237
1297
  }
1298
+ function sampleNames(names, tiers) {
1299
+ const rank = (n) => {
1300
+ const i = tiers.findIndex((t) => t.has(n));
1301
+ return i < 0 ? tiers.length : i;
1302
+ };
1303
+ const picked = names.map((n, i) => ({ n, i, r: rank(n) })).sort((a, b) => a.r - b.r || a.i - b.i).slice(0, TOOL_CHANGE_LIST_MAX).map((x) => x.n);
1304
+ return `${picked.join(", ")}, and ${names.length - picked.length} more`;
1305
+ }
1306
+ function toolMentionTiers(timeline, candidates) {
1307
+ const wanted = new Set(candidates);
1308
+ const called = /* @__PURE__ */ new Set();
1309
+ const mentioned = /* @__PURE__ */ new Set();
1310
+ const call = (name) => {
1311
+ if (wanted.has(name)) called.add(name);
1312
+ };
1313
+ const scan = (text) => {
1314
+ TOOL_WORD_RE.lastIndex = 0;
1315
+ for (let m = TOOL_WORD_RE.exec(text); m !== null; m = TOOL_WORD_RE.exec(text))
1316
+ if (wanted.has(m[0])) mentioned.add(m[0]);
1317
+ };
1318
+ const scanValue = (v) => {
1319
+ if (typeof v === "string") scan(v);
1320
+ else if (Array.isArray(v)) for (const x of v) scanValue(x);
1321
+ else if (typeof v === "object" && v !== null) for (const x of Object.values(v)) scanValue(x);
1322
+ };
1323
+ const scanParts = (parts) => {
1324
+ for (const part of parts) {
1325
+ if (part.type === "text") scan(part.text);
1326
+ else if (part.type === "tool_reference") call(part.name);
1327
+ }
1328
+ };
1329
+ for (const e of timeline) {
1330
+ switch (e.type) {
1331
+ case "core.user_message":
1332
+ scanParts(e.payload.content);
1333
+ break;
1334
+ case "core.model_text":
1335
+ scan(e.payload.text);
1336
+ break;
1337
+ case "core.model_thinking":
1338
+ scan(e.payload.text);
1339
+ break;
1340
+ case "core.compaction":
1341
+ scan(e.payload.summary);
1342
+ break;
1343
+ case "core.system_note": {
1344
+ const p = e.payload;
1345
+ if (p.meta?.toolsChanged === void 0) scan(p.text);
1346
+ break;
1347
+ }
1348
+ case "core.tool_call": {
1349
+ const p = e.payload;
1350
+ call(p.name);
1351
+ if (typeof p.args === "string") {
1352
+ try {
1353
+ scanValue(JSON.parse(p.args));
1354
+ } catch {
1355
+ scan(p.args);
1356
+ }
1357
+ } else scanValue(p.args);
1358
+ break;
1359
+ }
1360
+ case "core.tool_result": {
1361
+ const p = e.payload;
1362
+ call(p.name);
1363
+ scanParts(p.content);
1364
+ break;
1365
+ }
1366
+ }
1367
+ }
1368
+ for (const n of called) mentioned.delete(n);
1369
+ return [called, mentioned];
1370
+ }
1371
+ var TOOL_WORD_RE = /[A-Za-z0-9_-]+/g;
1238
1372
  function toolsBoundDrafts(input) {
1239
1373
  const toolNames = [...input.toolNames].sort();
1240
1374
  const drafts = [
@@ -1252,10 +1386,11 @@ function toolsBoundDrafts(input) {
1252
1386
  if (!input.announce || previous === void 0) return drafts;
1253
1387
  const diff = diffToolNames(previous.payload.toolNames, toolNames);
1254
1388
  if (!diff) return drafts;
1389
+ const tiers = diff.added.length > TOOL_CHANGE_LIST_MAX || diff.removed.length > TOOL_CHANGE_LIST_MAX ? toolMentionTiers(input.timeline, [...diff.added, ...diff.removed]) : [];
1255
1390
  drafts.push({
1256
1391
  type: "core.system_note",
1257
1392
  actor: "host",
1258
- payload: { kind: "host", text: renderToolChangeNote(diff), meta: { toolsChanged: diff } }
1393
+ payload: { kind: "host", text: renderToolChangeNote(diff, tiers), meta: { toolsChanged: diff } }
1259
1394
  });
1260
1395
  return drafts;
1261
1396
  }
@@ -1444,7 +1579,15 @@ async function* runLoop(cfg) {
1444
1579
  {
1445
1580
  type: "core.run_paused",
1446
1581
  actor: "system",
1447
- payload: { reason, state, awaiting, ...texts ? { stopped: true } : {} }
1582
+ // 原因码与说明随暂停落库(AdRate 建议 16):取本次中断里 budget / host 那条,口径只走 pauseDetailOf。
1583
+ // 用户停止时 interruptions 已换成停止那条,Socket 给的码随之不写
1584
+ payload: {
1585
+ reason,
1586
+ state,
1587
+ awaiting,
1588
+ ...texts ? { stopped: true } : {},
1589
+ ...pauseDetailOf(interruptions)
1590
+ }
1448
1591
  }
1449
1592
  ])
1450
1593
  ];
@@ -1663,7 +1806,7 @@ async function* runLoop(cfg) {
1663
1806
  }
1664
1807
  if (turns >= maxTurns) {
1665
1808
  const note = `reached the per-run turn limit of ${maxTurns}`;
1666
- const { events, result } = await pause("budget", [{ kind: "budget", note }]);
1809
+ const { events, result } = await pause("budget", [{ kind: "budget", note, code: MAX_TURNS_PAUSE_CODE }]);
1667
1810
  yield* events;
1668
1811
  return result;
1669
1812
  }
@@ -1847,9 +1990,11 @@ async function* runLoop(cfg) {
1847
1990
  return { status: "done", sessionId, lastSeq };
1848
1991
  }
1849
1992
  if ("pause" in decision) {
1850
- const note = decision.pause.note ?? `a socket requested a pause (${decision.pause.reason})`;
1851
- const kind = decision.pause.reason;
1852
- const { events, result } = await pause(kind, [{ kind, note }]);
1993
+ const { interruption, error } = resolveSocketPause(decision.pause);
1994
+ if (error !== void 0) {
1995
+ yield* await append([{ type: "core.error", actor: "system", payload: error }]);
1996
+ }
1997
+ const { events, result } = await pause(interruption.kind, [interruption]);
1853
1998
  yield* events;
1854
1999
  return result;
1855
2000
  }
@@ -2343,7 +2488,7 @@ function memoryStore() {
2343
2488
  }
2344
2489
 
2345
2490
  // src/index.ts
2346
- var REINS_VERSION = "0.14.0";
2491
+ var REINS_VERSION = "0.15.0";
2347
2492
  export {
2348
2493
  BUILTIN_APPROVAL_POLICY,
2349
2494
  CORE_SCHEMAS,
@@ -2364,7 +2509,9 @@ export {
2364
2509
  InMemoryMemoryStore,
2365
2510
  InMemoryRunLease,
2366
2511
  LoweringError,
2512
+ MAX_TURNS_PAUSE_CODE,
2367
2513
  OUTCOME_UNKNOWN_TEXT,
2514
+ PAUSE_CODE_RE,
2368
2515
  REINS_VERSION,
2369
2516
  RUN_MARKER_TYPES,
2370
2517
  RunStateError,
@@ -2411,6 +2558,7 @@ export {
2411
2558
  isCompaction,
2412
2559
  isContentPart,
2413
2560
  isModelOutput,
2561
+ isPauseCode,
2414
2562
  isPinNote,
2415
2563
  isReplayable,
2416
2564
  isStopReason,
@@ -2427,6 +2575,7 @@ export {
2427
2575
  needsUntrustedMark,
2428
2576
  normalizeToolOutput,
2429
2577
  outcomeUnknownText,
2578
+ pauseDetailOf,
2430
2579
  pausedStateOf,
2431
2580
  pendingToolCalls,
2432
2581
  project,
@@ -2439,6 +2588,7 @@ export {
2439
2588
  replayTurns,
2440
2589
  resolveRetry,
2441
2590
  resolveSocketContributions,
2591
+ resolveSocketPause,
2442
2592
  roughTokenEstimate,
2443
2593
  runLoop,
2444
2594
  runStatusOf,