@botiverse/oar 0.5.1 → 0.7.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.
Files changed (102) hide show
  1. package/README.md +10 -33
  2. package/dist/contracts/records.d.ts +41 -11
  3. package/dist/contracts/records.d.ts.map +1 -1
  4. package/dist/contracts/session.d.ts +51 -15
  5. package/dist/contracts/session.d.ts.map +1 -1
  6. package/dist/contracts/status.d.ts +25 -0
  7. package/dist/contracts/status.d.ts.map +1 -0
  8. package/dist/contracts/status.js +2 -0
  9. package/dist/contracts/status.js.map +1 -0
  10. package/dist/index.d.ts +6 -4
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/kernel.d.ts +12 -0
  15. package/dist/kernel.d.ts.map +1 -0
  16. package/dist/kernel.js +11 -0
  17. package/dist/kernel.js.map +1 -0
  18. package/dist/observe/agent-status.d.ts +4 -18
  19. package/dist/observe/agent-status.d.ts.map +1 -1
  20. package/dist/observe/agent-status.js +41 -0
  21. package/dist/observe/agent-status.js.map +1 -1
  22. package/dist/observe/conversation.d.ts +44 -0
  23. package/dist/observe/conversation.d.ts.map +1 -0
  24. package/dist/observe/conversation.js +95 -0
  25. package/dist/observe/conversation.js.map +1 -0
  26. package/dist/observe/events.d.ts.map +1 -1
  27. package/dist/observe/events.js +1 -2
  28. package/dist/observe/events.js.map +1 -1
  29. package/dist/observe/index.d.ts +7 -3
  30. package/dist/observe/index.d.ts.map +1 -1
  31. package/dist/observe/index.js +4 -2
  32. package/dist/observe/index.js.map +1 -1
  33. package/dist/observe/session-view-events.d.ts +11 -0
  34. package/dist/observe/session-view-events.d.ts.map +1 -0
  35. package/dist/observe/session-view-events.js +228 -0
  36. package/dist/observe/session-view-events.js.map +1 -0
  37. package/dist/observe/session-view-fold.d.ts +56 -0
  38. package/dist/observe/session-view-fold.d.ts.map +1 -0
  39. package/dist/observe/session-view-fold.js +154 -0
  40. package/dist/observe/session-view-fold.js.map +1 -0
  41. package/dist/observe/session-view.d.ts +151 -0
  42. package/dist/observe/session-view.d.ts.map +1 -0
  43. package/dist/observe/session-view.js +80 -0
  44. package/dist/observe/session-view.js.map +1 -0
  45. package/dist/observe/turns.d.ts +45 -7
  46. package/dist/observe/turns.d.ts.map +1 -1
  47. package/dist/observe/turns.js +77 -7
  48. package/dist/observe/turns.js.map +1 -1
  49. package/dist/runtimes/claude/projection.d.ts.map +1 -1
  50. package/dist/runtimes/claude/projection.js +10 -3
  51. package/dist/runtimes/claude/projection.js.map +1 -1
  52. package/dist/runtimes/claude/session.d.ts.map +1 -1
  53. package/dist/runtimes/claude/session.js +17 -16
  54. package/dist/runtimes/claude/session.js.map +1 -1
  55. package/dist/runtimes/codex/item-detail.d.ts +2 -0
  56. package/dist/runtimes/codex/item-detail.d.ts.map +1 -1
  57. package/dist/runtimes/codex/item-detail.js +12 -5
  58. package/dist/runtimes/codex/item-detail.js.map +1 -1
  59. package/dist/runtimes/codex/projection.d.ts.map +1 -1
  60. package/dist/runtimes/codex/projection.js +20 -5
  61. package/dist/runtimes/codex/projection.js.map +1 -1
  62. package/dist/runtimes/codex/session.js +17 -17
  63. package/dist/runtimes/codex/session.js.map +1 -1
  64. package/dist/runtimes/pi/installation.d.ts.map +1 -1
  65. package/dist/runtimes/pi/installation.js +3 -1
  66. package/dist/runtimes/pi/installation.js.map +1 -1
  67. package/dist/runtimes/pi/projection.d.ts.map +1 -1
  68. package/dist/runtimes/pi/projection.js +19 -2
  69. package/dist/runtimes/pi/projection.js.map +1 -1
  70. package/dist/runtimes/pi/session.d.ts.map +1 -1
  71. package/dist/runtimes/pi/session.js +10 -10
  72. package/dist/runtimes/pi/session.js.map +1 -1
  73. package/dist/shared/acp/projection.d.ts.map +1 -1
  74. package/dist/shared/acp/projection.js +30 -1
  75. package/dist/shared/acp/projection.js.map +1 -1
  76. package/dist/shared/acp/session.js +6 -6
  77. package/dist/shared/acp/session.js.map +1 -1
  78. package/dist/shared/acp/terminal.d.ts.map +1 -1
  79. package/dist/shared/acp/terminal.js +9 -2
  80. package/dist/shared/acp/terminal.js.map +1 -1
  81. package/dist/shared/acp/turns.js +2 -2
  82. package/dist/shared/acp/turns.js.map +1 -1
  83. package/dist/shared/executable/index.d.ts +1 -1
  84. package/dist/shared/executable/index.d.ts.map +1 -1
  85. package/dist/shared/executable/index.js +1 -1
  86. package/dist/shared/executable/index.js.map +1 -1
  87. package/dist/shared/executable/process.d.ts +48 -1
  88. package/dist/shared/executable/process.d.ts.map +1 -1
  89. package/dist/shared/executable/process.js +66 -1
  90. package/dist/shared/executable/process.js.map +1 -1
  91. package/dist/shared/seal-session.d.ts +14 -6
  92. package/dist/shared/seal-session.d.ts.map +1 -1
  93. package/dist/shared/seal-session.js +49 -13
  94. package/dist/shared/seal-session.js.map +1 -1
  95. package/dist/shared/session-kernel.d.ts +1 -0
  96. package/dist/shared/session-kernel.d.ts.map +1 -1
  97. package/dist/shared/session-kernel.js +3 -3
  98. package/dist/shared/session-kernel.js.map +1 -1
  99. package/dist/voyage.d.ts.map +1 -1
  100. package/dist/voyage.js +2 -1
  101. package/dist/voyage.js.map +1 -1
  102. package/package.json +5 -1
package/README.md CHANGED
@@ -35,12 +35,19 @@ and `session.records()` expose that stream (`RawEvent`: `Frame` with the
35
35
  native payload verbatim, `RequestRecord`, `ResponseRecord`) for consumers
36
36
  who need the runtime's own frames.
37
37
 
38
+ For conversation UIs, use the browser-safe `reduceConversation` projection over
39
+ `session.rawEvents()`. It joins input requests, responses and native echoes by
40
+ identity, including steer → queue fallback. See the
41
+ [conversation contract](https://github.com/botiverse/oar/blob/main/docs/spec/conversation.md).
42
+
38
43
  ## Public exports
39
44
 
40
- The package has exactly two public entry points:
45
+ The package has four public entry points:
41
46
 
42
47
  - `@botiverse/oar`: the full surface (runtime registry, adapters, and everything below). Node-only (adapters import `node:child_process` and runtime SDKs).
48
+ - `@botiverse/oar/brands`: browser-safe runtime names and SVG icons.
43
49
  - `@botiverse/oar/observe`: browser-safe subset, the pure derivation utilities over `RawEvent`s and `Event`s (`eventsOf`, `coalesceText`, `observeAgent`, `reduceStatus`, `observeStalls`, `classifyTool`, …) with zero Node and zero adapter imports. A browser or Electron-renderer bundle can import this subpath directly without dragging Node-only modules in. The root export re-exports the same utilities for Node consumers.
50
+ - `@botiverse/oar/kernel`: the runtime-author SPI. `createSessionKernel` is the record stream every built-in adapter is built on (dense `seq`, cursor replay, control recording, the reachability rule) and `sealSession` derives the `Session` API face over an adapter. Pair with `defineRuntime` to ship a custom runtime (a scripted runtime for a host's tests, an in-process agent) without re-implementing the stream contract.
44
51
 
45
52
  Any other deep import (`@botiverse/oar/dist/...`, source paths) is internal and may break without notice.
46
53
 
@@ -48,38 +55,8 @@ Grok and Kimi share an internal ACP v1 transport and session kernel, but only th
48
55
 
49
56
  The command-line interface is a separate package: `@botiverse/oar-cli`.
50
57
 
51
- ## Account usage reasons
52
-
53
- Unsuccessful account-usage snapshots retain `kind: "unsupported"` or
54
- `kind: "reauth_required"` and now include a stable `reason` from built-in readers.
55
- Consumers should use `reason` rather than infer a cause from the runtime name.
56
- The field is optional for compatibility with older/custom adapters; absent
57
- reasons must be presented as unknown rather than guessed.
58
-
59
- | Kind | Reason | Meaning |
60
- | --- | --- | --- |
61
- | unsupported | capability_unavailable | The runtime has no account-usage reader (reported by the CLI/embedding app). |
62
- | unsupported | unsupported_installation | This reader cannot query this installation type. |
63
- | unsupported | unsupported_auth_mode | The selected authentication mode is not supported by the usage reader. This is the adapter's decision, not proof that a token was rejected. |
64
- | unsupported | unsupported_auth_storage | The configured credential storage is not supported. |
65
- | unsupported | auth_configuration_unavailable | The reader could not resolve the provider/auth configuration; no more specific cause is known. |
66
- | unsupported | endpoint_unavailable | The provider/runtime does not expose the queried usage endpoint. |
67
- | unsupported | quota_unavailable | The response does not expose a quota configuration. |
68
- | reauth_required | not_authenticated | The runtime requires a login. |
69
- | reauth_required | credentials_missing | No usable persisted credential was found. |
70
- | reauth_required | scope_missing | The credential lacks the scope needed for usage queries. |
71
- | reauth_required | credentials_rejected | The usage endpoint rejected the credential (401/403). |
72
-
73
- Operational failures (network errors, timeouts, malformed responses) still reject
74
- the promise. Reasons do not include tokens, credential values, or raw provider
75
- responses.
76
-
77
- Claude account usage delegates to its native stream-json `get_usage` request
78
- (with `skip_behaviors: true`). OAR does not read Claude credentials or call its
79
- HTTP quota endpoint. A native `rate_limits_available: false` becomes
80
- `quota_unavailable`; it does not prove invalid credentials. Older CLIs that
81
- reject the control request return `endpoint_unavailable`. Query-process session
82
- totals are not returned as account usage.
58
+ Account quota queries and failure semantics are documented in the
59
+ [account usage reference](https://github.com/botiverse/oar/blob/main/docs/spec/account-usage.md).
83
60
 
84
61
  ## Native inventories
85
62
 
@@ -93,13 +93,22 @@ export interface UsageReport {
93
93
  readonly context?: ContextUsage;
94
94
  readonly tokens?: TokenTotals;
95
95
  }
96
+ /** A native user-message observation, not proof of model consumption. */
97
+ export interface UserMessage {
98
+ readonly kind: "user_message";
99
+ readonly input: string;
100
+ readonly inputId?: string;
101
+ readonly nativeMessageId?: string;
102
+ readonly turnId?: string;
103
+ readonly evidence: "acknowledged" | "turn_item" | "conversation";
104
+ }
96
105
  /**
97
106
  * The runtime-said event kinds: what a Frame can carry. `text_delta` is at
98
107
  * the granularity the runtime emits (claude: a whole text block per frame;
99
108
  * pi and codex: token-sized pieces); `Session.events({ coalesceText })`
100
109
  * merges consecutive pieces for consumers who want blocks.
101
110
  */
102
- export type RuntimeEventBody = {
111
+ export type RuntimeEventBody = UserMessage | {
103
112
  readonly kind: "text_delta";
104
113
  readonly text: string;
105
114
  }
@@ -116,10 +125,12 @@ export type RuntimeEventBody = {
116
125
  } | {
117
126
  readonly kind: "tool_call_ended";
118
127
  readonly callId: string;
119
- /** Best-effort human-readable result detail when the runtime exposes it. */
128
+ /** Best-effort human-readable result detail when the runtime exposes it: the result's text when the frame carries text parts, otherwise its JSON. */
120
129
  readonly output?: string;
121
130
  /** The runtime's explicit tool outcome; absent when it reported none. */
122
131
  readonly result?: "ok" | "failed";
132
+ /** The process exit status the runtime reported for a command it ran (codex `commandExecution.exitCode`, grok `rawOutput.exit_code`); `null` when the runtime says it ended without one (a signal). Absent when the runtime reports none (claude, pi), never derived from `result` or output. */
133
+ readonly exitCode?: number | null;
123
134
  }
124
135
  /** Partial output of a running tool call, when the runtime streams it (pi `tool_execution_update`, codex `item/commandExecution/outputDelta`, an ACP `tool_call_update` carrying `rawOutput`). claude streams none. */
125
136
  | {
@@ -184,13 +195,13 @@ export type ControlEventBody =
184
195
  readonly kind: "turn_started";
185
196
  readonly requestId: string;
186
197
  readonly input: string;
187
- readonly lineage?: PromptLineage;
188
198
  }
189
199
  /** A `toRuntime` control action was rejected; the caller still owns the input. */
190
200
  | {
191
201
  readonly kind: "control_rejected";
192
202
  readonly requestId: string;
193
203
  readonly action: ControlAction;
204
+ readonly code: RejectionCode;
194
205
  readonly reason: string;
195
206
  }
196
207
  /** The runtime asked the application something (a `toApp` request: approval, question, terminal). `type` is the runtime's method or subtype; the body is on the request record. */
@@ -222,13 +233,15 @@ export type EventBody = RuntimeEventBody | ControlEventBody;
222
233
  export type Event = EventBody & RecordEnvelope;
223
234
  export type RequestBody = {
224
235
  readonly kind: "prompt";
236
+ readonly inputId?: string;
225
237
  readonly input: string;
226
- readonly lineage?: PromptLineage;
227
238
  } | {
228
239
  readonly kind: "steer";
240
+ readonly inputId?: string;
229
241
  readonly input: string;
230
242
  } | {
231
243
  readonly kind: "queue";
244
+ readonly inputId?: string;
232
245
  readonly input: string;
233
246
  } | {
234
247
  readonly kind: "abort";
@@ -241,12 +254,28 @@ export type RequestBody = {
241
254
  readonly type: string;
242
255
  readonly native: unknown;
243
256
  };
244
- /** Host supplied continuity pointer for a new session's first prompt. */
245
- export interface PromptLineage {
246
- /** Runtime.id of the session being continued. */
247
- readonly runtime: string;
248
- readonly sessionId: string;
249
- }
257
+ /**
258
+ * Why a control action was not taken over, as one word an application can
259
+ * branch on without parsing prose. `reason` on the same body keeps the prose
260
+ * (the runtime's own message when it gave one). Every adapter answers the
261
+ * same situation with the same code: `busy` iff `Session.status()` was
262
+ * running when the prompt was recorded.
263
+ */
264
+ export type RejectionCode =
265
+ /** prompt: another turn is active (≤1 active turn; nothing is queued implicitly). */
266
+ "busy"
267
+ /** steer / abort: nothing is running; a late abort is a normal race, not an error. */
268
+ | "no_active_turn"
269
+ /** The runtime cannot do this at all: queue on a runtime that holds no input, steer on one that cannot inject. */
270
+ | "unsupported"
271
+ /** The stream already holds the process exit. */
272
+ | "runtime_exited"
273
+ /** The stream already holds this session's dispose request. */
274
+ | "disposed"
275
+ /** The runtime answered no (its typed refusal, an RPC error); `reason` is its message. */
276
+ | "runtime_refused"
277
+ /** The adapter could not deliver (a thrown transport error); `reason` is the exception message. */
278
+ | "error";
250
279
  /**
251
280
  * Control responses answer only "accepted or not"; final states and landing
252
281
  * points are always events. The remaining bodies are outcomes only oar
@@ -258,9 +287,10 @@ export type ResponseBody =
258
287
  readonly kind: "accepted";
259
288
  readonly native?: unknown;
260
289
  }
261
- /** Not taken over; the caller still owns the input. `busy` (another turn is active), `not_steerable`, a dead process, or the runtime's typed refusal. */
290
+ /** Not taken over; the caller still owns the input. `code` says why in one word; `reason` is the prose. */
262
291
  | {
263
292
  readonly kind: "rejected";
293
+ readonly code: RejectionCode;
264
294
  readonly reason: string;
265
295
  readonly native?: unknown;
266
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/contracts/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,mRAAmR;IACnR,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6KAA6K;IAC7K,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,2IAA2I;IAC3I,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,uF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AAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;CACxC;AAED,2FAA2F;AAC3F,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
@@ -1,15 +1,17 @@
1
- import type { ContextUsage, Cursor, Event, PromptLineage, RawEvent, RequestRecord, ResponseRecord, SessionGraph, TokenTotals } from "./records.js";
1
+ import type { ContextUsage, Cursor, Event, RawEvent, RejectionCode, RequestRecord, ResponseRecord, SessionGraph, TokenTotals } from "./records.js";
2
+ import type { AgentStatus } from "./status.js";
2
3
  import type { AvailableInstallation } from "./installation.js";
3
- export type { ContextUsage, ControlAction, ControlEventBody, Cursor, Event, EventBody, FailureClass, Frame, FrameBody, PromptLineage, ReasoningContent, RecordEnvelope, RecordKind, RequestBody, RequestDirection, RequestRecord, ResponseBody, ResponseRecord, RuntimeEventBody, SessionEdge, SessionGraph, SessionNode, RawEvent, TokenTotals, TurnOutcome, UsageReport, } from "./records.js";
4
+ export type { ContextUsage, ControlAction, ControlEventBody, Cursor, Event, EventBody, FailureClass, Frame, FrameBody, ReasoningContent, RecordEnvelope, RecordKind, RejectionCode, RequestBody, RequestDirection, RequestRecord, ResponseBody, ResponseRecord, RuntimeEventBody, UserMessage, SessionEdge, SessionGraph, SessionNode, RawEvent, TokenTotals, TurnOutcome, UsageReport, } from "./records.js";
5
+ export type { AgentStatus, RunningPhase } from "./status.js";
4
6
  export interface QueryResult<T> {
5
7
  /** The fold's current value. */
6
8
  readonly value: T;
7
9
  /** The seq of the last consumed record, or -1 before any record. */
8
10
  readonly seq: number;
9
11
  }
10
- export interface PromptOptions {
11
- /** Host continuity pointer recorded verbatim on the prompt request. */
12
- readonly lineage?: PromptLineage;
12
+ export interface InputOptions {
13
+ /** UUID identifying one logical input across delivery attempts; generated when omitted. */
14
+ readonly inputId?: string;
13
15
  }
14
16
  /**
15
17
  * Session contract: one ordered, resumable record stream.
@@ -61,11 +63,30 @@ export interface SessionOptions {
61
63
  * runtime's message).
62
64
  */
63
65
  export type StartSession = (installation: AvailableInstallation, options: SessionOptions) => Promise<Session>;
64
- /** Both records a control call produced: the request (its `seq` is where the action sits in the stream) and the accept/reject response. */
66
+ /** Both records a control call produced: the request (its `seq` is where the action sits in the stream) and the accept/reject response. What an adapter returns (the SPI face). */
65
67
  export interface ControlResult {
66
68
  readonly request: RequestRecord;
67
69
  readonly response: ResponseRecord;
68
70
  }
71
+ /**
72
+ * What `Session.prompt / steer / queue / abort` return (the API face): the
73
+ * answer read off the two records, with the records still underneath. A
74
+ * consumer branches on `kind` (two cases, not the four a response body can
75
+ * carry) and on the typed `code`; `seq` is the request's position in the
76
+ * stream, what `awaitTurnEnd` takes. `request` / `response` remain for
77
+ * consumers who want the stream's own word (`native`, the exact records).
78
+ */
79
+ export type ControlOutcome = (ControlResult & {
80
+ readonly kind: "accepted";
81
+ readonly seq: number;
82
+ readonly requestId: string;
83
+ }) | (ControlResult & {
84
+ readonly kind: "rejected";
85
+ readonly seq: number;
86
+ readonly requestId: string;
87
+ readonly code: RejectionCode;
88
+ readonly reason: string;
89
+ });
69
90
  /**
70
91
  * Which tier of the attribution spectrum the adapter carries, declared
71
92
  * explicitly and required to match what the runtime exposes (adapter red
@@ -109,17 +130,21 @@ export interface EventsOptions {
109
130
  export interface AdapterSession {
110
131
  readonly id: string;
111
132
  readonly capabilities: SessionCapabilities;
112
- prompt(input: string, options?: PromptOptions): Promise<ControlResult>;
113
- steer(input: string): Promise<ControlResult>;
114
- queue(input: string): Promise<ControlResult>;
133
+ prompt(input: string, options?: InputOptions): Promise<ControlResult>;
134
+ steer(input: string, options?: InputOptions): Promise<ControlResult>;
135
+ queue(input: string, options?: InputOptions): Promise<ControlResult>;
115
136
  abort(): Promise<ControlResult>;
116
137
  rawEvents(observer: RawEventObserver, cursor?: Cursor): Unsubscribe;
117
138
  records(): readonly RawEvent[];
118
139
  graph(): SessionGraph;
119
140
  dispose(): Promise<void>;
120
141
  }
121
- /** The API face: the SPI plus surfaces sealSession derives from the stream. */
142
+ /** The API face: the SPI plus surfaces sealSession derives from the stream. Control members answer with `ControlOutcome`: the same records, read. */
122
143
  export interface Session extends AdapterSession {
144
+ prompt(input: string, options?: InputOptions): Promise<ControlOutcome>;
145
+ steer(input: string, options?: InputOptions): Promise<ControlOutcome>;
146
+ queue(input: string, options?: InputOptions): Promise<ControlOutcome>;
147
+ abort(): Promise<ControlOutcome>;
123
148
  /**
124
149
  * The consumer face of the stream: every fact oar read, flat and attributed
125
150
  * (`eventsOf` applied to each record). One frame with three readings is
@@ -134,12 +159,20 @@ export interface Session extends AdapterSession {
134
159
  usage(): QueryResult<SessionUsage>;
135
160
  /** Latest context fullness the runtime reported for this session's root agent; null before any. */
136
161
  contextUsage(): QueryResult<ContextUsage | null>;
162
+ /**
163
+ * The root agent's status, folded from the stream (`reduceStatus`): idle,
164
+ * or running since the prompt request (or the first event of an adopted
165
+ * turn). Invariant every adapter must keep: a prompt recorded while this
166
+ * says `running` is rejected `busy`, and one recorded while it says `idle`
167
+ * is never rejected `busy`. `awaitIdle` waits on it.
168
+ */
169
+ status(): QueryResult<AgentStatus>;
137
170
  /**
138
171
  * DERIVED: steer when the runtime can, fall back to queueing, always report
139
172
  * where the input landed. `rejected` means the input was NOT taken over and
140
173
  * the caller still owns it.
141
174
  */
142
- steerOrQueue(input: string): Promise<SteerOrQueueResult>;
175
+ steerOrQueue(input: string, options?: InputOptions): Promise<SteerOrQueueResult>;
143
176
  }
144
177
  export interface SessionUsage {
145
178
  /** Null until the runtime has reported token totals, never a guessed zero (kimi's ACP surface reports context only). */
@@ -152,13 +185,16 @@ export interface SessionUsage {
152
185
  }
153
186
  export type SteerOrQueueResult = {
154
187
  readonly landed: "steered";
155
- readonly result: ControlResult;
188
+ readonly result: ControlOutcome;
156
189
  } | {
157
190
  readonly landed: "queued";
158
- readonly result: ControlResult;
159
- } | {
191
+ readonly result: ControlOutcome;
192
+ }
193
+ /** `result` is the last attempt (the queue when one was made, else the steer); `code` / `reason` are its. */
194
+ | {
160
195
  readonly landed: "rejected";
196
+ readonly code: RejectionCode;
161
197
  readonly reason: string;
162
- readonly result: ControlResult;
198
+ readonly result: ControlOutcome;
163
199
  };
164
200
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/contracts/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,KAAK,EACL,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,oEAAoE;IACpE,QA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QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { TurnOutcome } from "./records.js";
2
+ /**
3
+ * The root agent's status: a fold over the record stream (the reducer is
4
+ * `observe/agent-status.ts`; `Session.status()` is that fold over the
5
+ * session's retained records). Time-qualified judgments (stalled) stay
6
+ * outside the type: they are fold × clock, provided by `stallOf`.
7
+ */
8
+ export type RunningPhase = "waiting_model" | "thinking" | "responding" | "compacting" | {
9
+ readonly tool: string;
10
+ readonly callId: string;
11
+ };
12
+ export type AgentStatus = {
13
+ readonly kind: "idle";
14
+ readonly lastTurnOutcome?: TurnOutcome;
15
+ } | {
16
+ readonly kind: "running";
17
+ /** seq of the record that opened this running span: the prompt request, or the first event of an adopted turn. */
18
+ readonly sinceSeq: number;
19
+ /** The prompt request id when the turn was opened through this Session; absent for adopted turns. */
20
+ readonly requestId?: string;
21
+ readonly phase: RunningPhase;
22
+ /** Envelope receivedAt (unix epoch ms) of the latest folded record. */
23
+ readonly lastEventAt: number;
24
+ };
25
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/contracts/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,UAAU,GACV,YAAY,GACZ,YAAY,GACZ;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,WAAW,CAAA;CAAE,GACjE;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,kHAAkH;IAClH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qGAAqG;IACrG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/contracts/status.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -6,14 +6,14 @@ export type { ProviderAuthFacade, ProviderAuthStatus, ProviderLoginEvent, Provid
6
6
  export type { CatalogModel, CatalogProvider, CatalogRefreshOptions, CatalogRefreshResult, ModelCatalogFacade, } from "./contracts/model-catalog.js";
7
7
  export type { ListModelsOptions, ListModelsResult, ModelEntry, ModelLister, } from "./contracts/list-models.js";
8
8
  export type { Runtime } from "./contracts/runtime.js";
9
- export type { AdapterSession, AttributionTier, ContextUsage, ControlAction, ControlEventBody, ControlResult, Cursor, Event, EventBody, EventObserver, EventsOptions, FailureClass, Frame, FrameBody, PromptLineage, PromptOptions, QueryResult, ReasoningContent, RecordEnvelope, RecordKind, RequestBody, RequestDirection, RequestRecord, ResponseBody, ResponseRecord, RuntimeEventBody, Session, SessionCapabilities, SessionEdge, SessionGraph, SessionNode, RawEventObserver, SessionOptions, RawEvent, SessionUsage, StartSession, SteerOrQueueResult, TokenTotals, TurnOutcome, Unsubscribe, UsageReport, } from "./contracts/session.js";
9
+ export type { AdapterSession, AttributionTier, ContextUsage, ControlAction, ControlEventBody, ControlOutcome, ControlResult, Cursor, Event, EventBody, EventObserver, EventsOptions, FailureClass, Frame, FrameBody, InputOptions, QueryResult, ReasoningContent, RecordEnvelope, RecordKind, RejectionCode, RequestBody, RequestDirection, RequestRecord, ResponseBody, ResponseRecord, RuntimeEventBody, UserMessage, Session, SessionCapabilities, SessionEdge, SessionGraph, SessionNode, RawEventObserver, SessionOptions, RawEvent, SessionUsage, StartSession, SteerOrQueueResult, TokenTotals, TurnOutcome, Unsubscribe, UsageReport, } from "./contracts/session.js";
10
10
  export { defineRuntime } from "./contracts/runtime.js";
11
11
  export { utcInstantFromDate } from "./shared/instant.js";
12
12
  export { RuntimeRegistry, createRuntimeRegistry } from "./registry.js";
13
13
  export { VOYAGE_FORMAT, endLine, headerLine, openVoyage, recordLine, } from "./voyage.js";
14
14
  export type { VoyageHeader, VoyageRecorder } from "./voyage.js";
15
15
  export { coalesceText, controlActionsOf, eventsOf, eventsReader } from "./observe/events.js";
16
- export { initialStatus, reduceStatus, stallOf, } from "./observe/agent-status.js";
16
+ export { initialStatus, reduceStatus, stallOf, statusOf, } from "./observe/agent-status.js";
17
17
  export type { AgentStatus, RunningPhase } from "./observe/agent-status.js";
18
18
  export { observeStalls } from "./observe/stall-observer.js";
19
19
  export type { StallInfo } from "./observe/stall-observer.js";
@@ -21,8 +21,8 @@ export { observeAgent, simpleStateOf } from "./observe/observe-agent.js";
21
21
  export { classifyTool, toolActionLabel } from "./observe/tool-activity.js";
22
22
  export type { ToolAction, ToolActionKind } from "./observe/tool-activity.js";
23
23
  export type { AgentObserver, AgentView, ObserveAgentOptions } from "./observe/observe-agent.js";
24
- export { awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
25
- export type { PromptRun } from "./observe/turns.js";
24
+ export { awaitIdle, awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
25
+ export type { PromptRun, PromptRunOptions } from "./observe/turns.js";
26
26
  export { contextUsageOf, modelOf, usageOf } from "./observe/usage.js";
27
27
  export { claudeRuntime } from "./runtimes/claude/index.js";
28
28
  export { claudeListModels, projectClaudeModels } from "./runtimes/claude/list-models.js";
@@ -51,4 +51,6 @@ export { piInstallation } from "./runtimes/pi/installation.js";
51
51
  export declare const runtimes: RuntimeRegistry;
52
52
  export { runtimeBrands, runtimeBrandIcon } from "./brands.js";
53
53
  export type { RuntimeBrand } from "./brands.js";
54
+ export { initialConversation, reduceConversation, conversationOf, observeConversation } from "./observe/conversation.js";
55
+ export type { ConversationState, ConversationInput, ConversationUpdate, InputAttempt } from "./observe/conversation.js";
54
56
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAOhD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9K,YAAY,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,YAAY,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,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AChE,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,QAAQ,iBAMnB,CAAC;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzH,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -9,11 +9,11 @@ export { utcInstantFromDate } from "./shared/instant.js";
9
9
  export { RuntimeRegistry, createRuntimeRegistry } from "./registry.js";
10
10
  export { VOYAGE_FORMAT, endLine, headerLine, openVoyage, recordLine, } from "./voyage.js";
11
11
  export { coalesceText, controlActionsOf, eventsOf, eventsReader } from "./observe/events.js";
12
- export { initialStatus, reduceStatus, stallOf, } from "./observe/agent-status.js";
12
+ export { initialStatus, reduceStatus, stallOf, statusOf, } from "./observe/agent-status.js";
13
13
  export { observeStalls } from "./observe/stall-observer.js";
14
14
  export { observeAgent, simpleStateOf } from "./observe/observe-agent.js";
15
15
  export { classifyTool, toolActionLabel } from "./observe/tool-activity.js";
16
- export { awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
16
+ export { awaitIdle, awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
17
17
  export { contextUsageOf, modelOf, usageOf } from "./observe/usage.js";
18
18
  export { claudeRuntime } from "./runtimes/claude/index.js";
19
19
  export { claudeListModels, projectClaudeModels } from "./runtimes/claude/list-models.js";
@@ -45,4 +45,5 @@ export const runtimes = new RuntimeRegistry([
45
45
  piRuntime,
46
46
  ]);
47
47
  export { runtimeBrands, runtimeBrandIcon } from "./brands.js";
48
+ export { initialConversation, reduceConversation, conversationOf, observeConversation } from "./observe/conversation.js";
48
49
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAqFnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,qBAAqB,E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EhE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;IAC1C,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,SAAS;CACV,CAAC,CAAC;AAEH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The runtime-author SPI: the record stream every built-in adapter is built
3
+ * on (`createSessionKernel`) and the API face derived over it
4
+ * (`sealSession`). Pair with `defineRuntime` to ship a custom runtime (a
5
+ * scripted runtime for a host's tests, an in-process agent) without
6
+ * re-implementing the stream contract: dense seq, cursor replay, the
7
+ * reachability rule, and control recording all come with the kernel.
8
+ */
9
+ export { createSessionKernel } from "./shared/session-kernel.js";
10
+ export type { RecordAt, SessionKernel } from "./shared/session-kernel.js";
11
+ export { controlOutcomeOf, sealSession } from "./shared/seal-session.js";
12
+ //# sourceMappingURL=kernel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
package/dist/kernel.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The runtime-author SPI: the record stream every built-in adapter is built
3
+ * on (`createSessionKernel`) and the API face derived over it
4
+ * (`sealSession`). Pair with `defineRuntime` to ship a custom runtime (a
5
+ * scripted runtime for a host's tests, an in-process agent) without
6
+ * re-implementing the stream contract: dense seq, cursor replay, the
7
+ * reachability rule, and control recording all come with the kernel.
8
+ */
9
+ export { createSessionKernel } from "./shared/session-kernel.js";
10
+ export { controlOutcomeOf, sealSession } from "./shared/seal-session.js";
11
+ //# sourceMappingURL=kernel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kernel.js","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { RawEvent, TurnOutcome } from "../contracts/session.js";
1
+ import type { AgentStatus, QueryResult, RawEvent } from "../contracts/session.js";
2
+ export type { AgentStatus, RunningPhase } from "../contracts/session.js";
2
3
  /**
3
4
  * status = fold(records). The reducer is pure (no clock, no IO), so status
4
5
  * is replayable from any record log and snapshot-testable. Time-qualified
@@ -29,24 +30,9 @@ import type { RawEvent, TurnOutcome } from "../contracts/session.js";
29
30
  * The fold is total: a mid-turn event while idle adopts that turn (a consumer
30
31
  * may subscribe mid-turn, and a queued input runs as a turn with no request).
31
32
  */
32
- export type RunningPhase = "waiting_model" | "thinking" | "responding" | "compacting" | {
33
- readonly tool: string;
34
- readonly callId: string;
35
- };
36
- export type AgentStatus = {
37
- readonly kind: "idle";
38
- readonly lastTurnOutcome?: TurnOutcome;
39
- } | {
40
- readonly kind: "running";
41
- /** seq of the record that opened this running span: the prompt request, or the first event of an adopted turn. */
42
- readonly sinceSeq: number;
43
- /** The prompt request id when the turn was opened through this Session; absent for adopted turns. */
44
- readonly requestId?: string;
45
- readonly phase: RunningPhase;
46
- /** Envelope receivedAt (unix epoch ms) of the latest folded record. */
47
- readonly lastEventAt: number;
48
- };
49
33
  export declare const initialStatus: AgentStatus;
34
+ /** The status fold over a retained log, as a query (`Session.status()`): `seq` is the last record consumed, -1 before any. */
35
+ export declare function statusOf(records: readonly RawEvent[], sessionId?: string): QueryResult<AgentStatus>;
50
36
  export declare function reduceStatus(previous: AgentStatus, record: RawEvent, sessionId?: string): AgentStatus;
51
37
  /** fold(records) × clock: how long a running status has been silent, if beyond the threshold. */
52
38
  export declare function stallOf(status: AgentStatus, nowMs: number, thresholdMs: number): {
@@ -1 +1 @@
1
- {"version":3,"file":"agent-status.d.ts","sourceRoot":"","sources":["../../src/observe/agent-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAoB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,UAAU,GACV,YAAY,GACZ,YAAY,GACZ;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,IAA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AAY,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAiCrG;AAuCD,iGAAiG;AACjG,wBAAgB,OAAO,CACrB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMpE"}
@@ -1,4 +1,44 @@
1
+ /**
2
+ * status = fold(records). The reducer is pure (no clock, no IO), so status
3
+ * is replayable from any record log and snapshot-testable. Time-qualified
4
+ * judgments (stalled) are deliberately OUTSIDE the ontology: they are
5
+ * fold(records) × clock, provided by `stallOf` next to it.
6
+ *
7
+ * Scope: the ROOT AGENT of ONE SESSION. Pass the session id so a derived
8
+ * child session's records (codex child threads, grok child sessions carry
9
+ * their own sessionId with agentPath []) never drive the root's phase; without
10
+ * it, every root-agent record of any session is folded (single-session
11
+ * streams). Phase transitions come from the root agent's own records only;
12
+ * `lastEventAt`, the liveness clock, refreshes on EVERY record attributable
13
+ * to the session (child agents, child sessions, frames oar read nothing from), because a
14
+ * delegated sub-agent working is not a stalled root.
15
+ *
16
+ * Transition table:
17
+ * request prompt (toRuntime) → running/waiting_model (the turn's start IS the request)
18
+ * response rejected → that request → idle again (the turn never began)
19
+ * event reasoning → running/thinking
20
+ * event text_delta → running/responding
21
+ * event tool_call_started → running/{tool, callId}
22
+ * event tool_call_ended → running/waiting_model (the model consumes the result next)
23
+ * event tool_call_progress → running, phase unchanged (the clock moves)
24
+ * event compaction_started → running/compacting
25
+ * event compaction_ended, retry → running/waiting_model
26
+ * event turn_ended → idle{lastTurnOutcome} (the runtime's own completion)
27
+ * response exited → idle{failed runtime_exited} if a turn was running
28
+ * The fold is total: a mid-turn event while idle adopts that turn (a consumer
29
+ * may subscribe mid-turn, and a queued input runs as a turn with no request).
30
+ */
1
31
  export const initialStatus = { kind: "idle" };
32
+ /** The status fold over a retained log, as a query (`Session.status()`): `seq` is the last record consumed, -1 before any. */
33
+ export function statusOf(records, sessionId) {
34
+ let value = initialStatus;
35
+ let seq = -1;
36
+ for (const record of records) {
37
+ value = reduceStatus(value, record, sessionId);
38
+ seq = record.seq;
39
+ }
40
+ return { value, seq };
41
+ }
2
42
  function running(previous, record, phase) {
3
43
  const sinceSeq = previous.kind === "running" ? previous.sinceSeq : record.seq;
4
44
  const requestId = previous.kind === "running" ? previous.requestId : undefined;
@@ -62,6 +102,7 @@ function reduceEvent(previous, record, event) {
62
102
  return previous.kind === "running" ? { ...previous, lastEventAt: record.receivedAt } : previous;
63
103
  case "turn_ended":
64
104
  return { kind: "idle", lastTurnOutcome: event.outcome };
105
+ case "user_message":
65
106
  case "usage":
66
107
  case "model":
67
108
  return previous;