@botiverse/oar 0.6.0 → 0.8.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/README.md +4 -2
- package/dist/contracts/records.d.ts +33 -10
- package/dist/contracts/records.d.ts.map +1 -1
- package/dist/contracts/session.d.ts +66 -13
- package/dist/contracts/session.d.ts.map +1 -1
- package/dist/contracts/status.d.ts +25 -0
- package/dist/contracts/status.d.ts.map +1 -0
- package/dist/contracts/status.js +2 -0
- package/dist/contracts/status.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/kernel.d.ts +12 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +11 -0
- package/dist/kernel.js.map +1 -0
- package/dist/observe/agent-status.d.ts +4 -18
- package/dist/observe/agent-status.d.ts.map +1 -1
- package/dist/observe/agent-status.js +41 -0
- package/dist/observe/agent-status.js.map +1 -1
- package/dist/observe/events.d.ts.map +1 -1
- package/dist/observe/events.js +1 -2
- package/dist/observe/events.js.map +1 -1
- package/dist/observe/index.d.ts +6 -4
- package/dist/observe/index.d.ts.map +1 -1
- package/dist/observe/index.js +4 -3
- package/dist/observe/index.js.map +1 -1
- package/dist/observe/session-view-events.d.ts +11 -0
- package/dist/observe/session-view-events.d.ts.map +1 -0
- package/dist/observe/session-view-events.js +233 -0
- package/dist/observe/session-view-events.js.map +1 -0
- package/dist/observe/session-view-fold.d.ts +57 -0
- package/dist/observe/session-view-fold.d.ts.map +1 -0
- package/dist/observe/session-view-fold.js +156 -0
- package/dist/observe/session-view-fold.js.map +1 -0
- package/dist/observe/session-view.d.ts +153 -0
- package/dist/observe/session-view.d.ts.map +1 -0
- package/dist/observe/session-view.js +81 -0
- package/dist/observe/session-view.js.map +1 -0
- package/dist/observe/turns.d.ts +45 -7
- package/dist/observe/turns.d.ts.map +1 -1
- package/dist/observe/turns.js +77 -7
- package/dist/observe/turns.js.map +1 -1
- package/dist/observe/usage.d.ts +2 -0
- package/dist/observe/usage.d.ts.map +1 -1
- package/dist/observe/usage.js +18 -0
- package/dist/observe/usage.js.map +1 -1
- package/dist/runtimes/claude/effort.d.ts +14 -0
- package/dist/runtimes/claude/effort.d.ts.map +1 -0
- package/dist/runtimes/claude/effort.js +62 -0
- package/dist/runtimes/claude/effort.js.map +1 -0
- package/dist/runtimes/claude/projection.js +1 -1
- package/dist/runtimes/claude/projection.js.map +1 -1
- package/dist/runtimes/claude/session.d.ts.map +1 -1
- package/dist/runtimes/claude/session.js +46 -6
- package/dist/runtimes/claude/session.js.map +1 -1
- package/dist/runtimes/codex/item-detail.d.ts +2 -0
- package/dist/runtimes/codex/item-detail.d.ts.map +1 -1
- package/dist/runtimes/codex/item-detail.js +12 -5
- package/dist/runtimes/codex/item-detail.js.map +1 -1
- package/dist/runtimes/codex/open.d.ts +42 -0
- package/dist/runtimes/codex/open.d.ts.map +1 -0
- package/dist/runtimes/codex/open.js +116 -0
- package/dist/runtimes/codex/open.js.map +1 -0
- package/dist/runtimes/codex/projection.d.ts.map +1 -1
- package/dist/runtimes/codex/projection.js +29 -4
- package/dist/runtimes/codex/projection.js.map +1 -1
- package/dist/runtimes/codex/session.d.ts.map +1 -1
- package/dist/runtimes/codex/session.js +53 -59
- package/dist/runtimes/codex/session.js.map +1 -1
- package/dist/runtimes/grok/list-models.d.ts +6 -0
- package/dist/runtimes/grok/list-models.d.ts.map +1 -1
- package/dist/runtimes/grok/list-models.js +17 -2
- package/dist/runtimes/grok/list-models.js.map +1 -1
- package/dist/runtimes/kimi/list-models.d.ts +7 -4
- package/dist/runtimes/kimi/list-models.d.ts.map +1 -1
- package/dist/runtimes/kimi/list-models.js +9 -5
- package/dist/runtimes/kimi/list-models.js.map +1 -1
- package/dist/runtimes/pi/installation.d.ts.map +1 -1
- package/dist/runtimes/pi/installation.js +3 -1
- package/dist/runtimes/pi/installation.js.map +1 -1
- package/dist/runtimes/pi/list-models.d.ts +16 -4
- package/dist/runtimes/pi/list-models.d.ts.map +1 -1
- package/dist/runtimes/pi/list-models.js +24 -7
- package/dist/runtimes/pi/list-models.js.map +1 -1
- package/dist/runtimes/pi/open.d.ts +22 -0
- package/dist/runtimes/pi/open.d.ts.map +1 -1
- package/dist/runtimes/pi/open.js +50 -0
- package/dist/runtimes/pi/open.js.map +1 -1
- package/dist/runtimes/pi/projection.d.ts.map +1 -1
- package/dist/runtimes/pi/projection.js +21 -2
- package/dist/runtimes/pi/projection.js.map +1 -1
- package/dist/runtimes/pi/session.d.ts.map +1 -1
- package/dist/runtimes/pi/session.js +14 -12
- package/dist/runtimes/pi/session.js.map +1 -1
- package/dist/shared/acp/effort.d.ts +25 -0
- package/dist/shared/acp/effort.d.ts.map +1 -0
- package/dist/shared/acp/effort.js +47 -0
- package/dist/shared/acp/effort.js.map +1 -0
- package/dist/shared/acp/model.d.ts +19 -0
- package/dist/shared/acp/model.d.ts.map +1 -1
- package/dist/shared/acp/model.js +27 -0
- package/dist/shared/acp/model.js.map +1 -1
- package/dist/shared/acp/profile.d.ts.map +1 -1
- package/dist/shared/acp/profile.js +7 -0
- package/dist/shared/acp/profile.js.map +1 -1
- package/dist/shared/acp/projection.d.ts.map +1 -1
- package/dist/shared/acp/projection.js +37 -3
- package/dist/shared/acp/projection.js.map +1 -1
- package/dist/shared/acp/records.d.ts +1 -1
- package/dist/shared/acp/records.d.ts.map +1 -1
- package/dist/shared/acp/records.js +6 -2
- package/dist/shared/acp/records.js.map +1 -1
- package/dist/shared/acp/session.d.ts.map +1 -1
- package/dist/shared/acp/session.js +4 -4
- package/dist/shared/acp/session.js.map +1 -1
- package/dist/shared/acp/terminal.d.ts.map +1 -1
- package/dist/shared/acp/terminal.js +9 -2
- package/dist/shared/acp/terminal.js.map +1 -1
- package/dist/shared/acp/turns.js +2 -2
- package/dist/shared/acp/turns.js.map +1 -1
- package/dist/shared/executable/index.d.ts +1 -1
- package/dist/shared/executable/index.d.ts.map +1 -1
- package/dist/shared/executable/index.js +1 -1
- package/dist/shared/executable/index.js.map +1 -1
- package/dist/shared/executable/process.d.ts +48 -1
- package/dist/shared/executable/process.d.ts.map +1 -1
- package/dist/shared/executable/process.js +66 -1
- package/dist/shared/executable/process.js.map +1 -1
- package/dist/shared/seal-session.d.ts +15 -7
- package/dist/shared/seal-session.d.ts.map +1 -1
- package/dist/shared/seal-session.js +42 -17
- package/dist/shared/seal-session.js.map +1 -1
- package/dist/shared/session-kernel.d.ts +1 -0
- package/dist/shared/session-kernel.d.ts.map +1 -1
- package/dist/shared/session-kernel.js +3 -3
- package/dist/shared/session-kernel.js.map +1 -1
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/scripted-runtime.d.ts +50 -0
- package/dist/testing/scripted-runtime.d.ts.map +1 -0
- package/dist/testing/scripted-runtime.js +187 -0
- package/dist/testing/scripted-runtime.js.map +1 -0
- package/dist/voyage.d.ts +2 -0
- package/dist/voyage.d.ts.map +1 -1
- package/dist/voyage.js +4 -1
- package/dist/voyage.js.map +1 -1
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ if (installation?.kind === "available") {
|
|
|
26
26
|
|
|
27
27
|
`session.events()` delivers flat, attributed `Event`s (text, reasoning,
|
|
28
28
|
tool call start / progress / end, turn start and end, usage, model,
|
|
29
|
-
compaction start / end, retry, runtime→app requests and oar's answers,
|
|
29
|
+
effort, compaction start / end, retry, runtime→app requests and oar's answers,
|
|
30
30
|
control rejections, the process exit), each carrying the `seq` and
|
|
31
31
|
`agentPath` of the record it was read from. Kinds a runtime never says
|
|
32
32
|
(claude has no compaction start, ACP runtimes no compaction or retry) simply
|
|
@@ -42,11 +42,13 @@ identity, including steer → queue fallback. See the
|
|
|
42
42
|
|
|
43
43
|
## Public exports
|
|
44
44
|
|
|
45
|
-
The package has
|
|
45
|
+
The package has five public entry points:
|
|
46
46
|
|
|
47
47
|
- `@botiverse/oar`: the full surface (runtime registry, adapters, and everything below). Node-only (adapters import `node:child_process` and runtime SDKs).
|
|
48
48
|
- `@botiverse/oar/brands`: browser-safe runtime names and SVG icons.
|
|
49
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.
|
|
51
|
+
- `@botiverse/oar/testing`: `scriptedRuntime({ turn })`, a ready-made runtime on the kernel SPI whose model is a script. It yields a real `Session` (same records, folds and control semantics) with no binary, login or provider, for hosts' tests and demos. Node-only.
|
|
50
52
|
|
|
51
53
|
Any other deep import (`@botiverse/oar/dist/...`, source paths) is internal and may break without notice.
|
|
52
54
|
|
|
@@ -125,10 +125,12 @@ export type RuntimeEventBody = UserMessage | {
|
|
|
125
125
|
} | {
|
|
126
126
|
readonly kind: "tool_call_ended";
|
|
127
127
|
readonly callId: string;
|
|
128
|
-
/** 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. */
|
|
129
129
|
readonly output?: string;
|
|
130
130
|
/** The runtime's explicit tool outcome; absent when it reported none. */
|
|
131
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;
|
|
132
134
|
}
|
|
133
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. */
|
|
134
136
|
| {
|
|
@@ -177,6 +179,11 @@ export type RuntimeEventBody = UserMessage | {
|
|
|
177
179
|
| {
|
|
178
180
|
readonly kind: "model";
|
|
179
181
|
readonly model: string;
|
|
182
|
+
}
|
|
183
|
+
/** The reasoning-effort level the runtime reports as in effect, in its own spelling (codex `reasoningEffort`, an ACP `thought_level` option's current value, pi `thinkingLevel`): its own report, never the request echoed. claude's stream carries none. */
|
|
184
|
+
| {
|
|
185
|
+
readonly kind: "effort";
|
|
186
|
+
readonly effort: string;
|
|
180
187
|
};
|
|
181
188
|
/** The toRuntime control actions a Session issues. */
|
|
182
189
|
export type ControlAction = "prompt" | "steer" | "queue" | "abort" | "dispose";
|
|
@@ -193,13 +200,13 @@ export type ControlEventBody =
|
|
|
193
200
|
readonly kind: "turn_started";
|
|
194
201
|
readonly requestId: string;
|
|
195
202
|
readonly input: string;
|
|
196
|
-
readonly lineage?: PromptLineage;
|
|
197
203
|
}
|
|
198
204
|
/** A `toRuntime` control action was rejected; the caller still owns the input. */
|
|
199
205
|
| {
|
|
200
206
|
readonly kind: "control_rejected";
|
|
201
207
|
readonly requestId: string;
|
|
202
208
|
readonly action: ControlAction;
|
|
209
|
+
readonly code: RejectionCode;
|
|
203
210
|
readonly reason: string;
|
|
204
211
|
}
|
|
205
212
|
/** 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. */
|
|
@@ -233,7 +240,6 @@ export type RequestBody = {
|
|
|
233
240
|
readonly kind: "prompt";
|
|
234
241
|
readonly inputId?: string;
|
|
235
242
|
readonly input: string;
|
|
236
|
-
readonly lineage?: PromptLineage;
|
|
237
243
|
} | {
|
|
238
244
|
readonly kind: "steer";
|
|
239
245
|
readonly inputId?: string;
|
|
@@ -253,12 +259,28 @@ export type RequestBody = {
|
|
|
253
259
|
readonly type: string;
|
|
254
260
|
readonly native: unknown;
|
|
255
261
|
};
|
|
256
|
-
/**
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
/**
|
|
263
|
+
* Why a control action was not taken over, as one word an application can
|
|
264
|
+
* branch on without parsing prose. `reason` on the same body keeps the prose
|
|
265
|
+
* (the runtime's own message when it gave one). Every adapter answers the
|
|
266
|
+
* same situation with the same code: `busy` iff `Session.status()` was
|
|
267
|
+
* running when the prompt was recorded.
|
|
268
|
+
*/
|
|
269
|
+
export type RejectionCode =
|
|
270
|
+
/** prompt: another turn is active (≤1 active turn; nothing is queued implicitly). */
|
|
271
|
+
"busy"
|
|
272
|
+
/** steer / abort: nothing is running; a late abort is a normal race, not an error. */
|
|
273
|
+
| "no_active_turn"
|
|
274
|
+
/** The runtime cannot do this at all: queue on a runtime that holds no input, steer on one that cannot inject. */
|
|
275
|
+
| "unsupported"
|
|
276
|
+
/** The stream already holds the process exit. */
|
|
277
|
+
| "runtime_exited"
|
|
278
|
+
/** The stream already holds this session's dispose request. */
|
|
279
|
+
| "disposed"
|
|
280
|
+
/** The runtime answered no (its typed refusal, an RPC error); `reason` is its message. */
|
|
281
|
+
| "runtime_refused"
|
|
282
|
+
/** The adapter could not deliver (a thrown transport error); `reason` is the exception message. */
|
|
283
|
+
| "error";
|
|
262
284
|
/**
|
|
263
285
|
* Control responses answer only "accepted or not"; final states and landing
|
|
264
286
|
* points are always events. The remaining bodies are outcomes only oar
|
|
@@ -270,9 +292,10 @@ export type ResponseBody =
|
|
|
270
292
|
readonly kind: "accepted";
|
|
271
293
|
readonly native?: unknown;
|
|
272
294
|
}
|
|
273
|
-
/** Not taken over; the caller still owns the input. `
|
|
295
|
+
/** Not taken over; the caller still owns the input. `code` says why in one word; `reason` is the prose. */
|
|
274
296
|
| {
|
|
275
297
|
readonly kind: "rejected";
|
|
298
|
+
readonly code: RejectionCode;
|
|
276
299
|
readonly reason: string;
|
|
277
300
|
readonly native?: unknown;
|
|
278
301
|
}
|
|
@@ -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,uFAAuF;IACvF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wIAAwI;IACxI,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE1D,wJAAwJ;AACxJ,MAAM,WAAW,KAAM,SAAQ,cAAc;IAC3C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,OAAO,CAAC;AAErD,8OAA8O;AAC9O,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,2NAA2N;AAC3N,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAA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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,6 +1,8 @@
|
|
|
1
|
-
import type { ContextUsage, Cursor, Event,
|
|
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,
|
|
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;
|
|
@@ -11,10 +13,6 @@ export interface InputOptions {
|
|
|
11
13
|
/** UUID identifying one logical input across delivery attempts; generated when omitted. */
|
|
12
14
|
readonly inputId?: string;
|
|
13
15
|
}
|
|
14
|
-
export interface PromptOptions extends InputOptions {
|
|
15
|
-
/** Host continuity pointer recorded verbatim on the prompt request. */
|
|
16
|
-
readonly lineage?: PromptLineage;
|
|
17
|
-
}
|
|
18
16
|
/**
|
|
19
17
|
* Session contract: one ordered, resumable record stream.
|
|
20
18
|
*
|
|
@@ -50,6 +48,25 @@ export interface SessionOptions {
|
|
|
50
48
|
readonly cwd: string;
|
|
51
49
|
/** Runtime-native model identifier; the runtime's default when omitted. */
|
|
52
50
|
readonly model?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Runtime-native reasoning-effort level for every turn of this Session, one
|
|
53
|
+
* of the chosen model's `ModelEntry.effortLevels`. Applied at open, with or
|
|
54
|
+
* without `resume`: a resumed session runs at the level given here. When
|
|
55
|
+
* omitted the runtime chooses (its default, or on resume what it restores;
|
|
56
|
+
* the runtime pages say which).
|
|
57
|
+
*
|
|
58
|
+
* Invariant: a runtime whose `listModels` reports `effortLevels` accepts
|
|
59
|
+
* `effort`, and a runtime that accepts it lists the levels. A requested
|
|
60
|
+
* effort is never ignored: the adapter applies it through the runtime's
|
|
61
|
+
* native channel and reads the runtime's own report back. When the runtime
|
|
62
|
+
* refuses the level, or would run another one (drop it for the model, clamp
|
|
63
|
+
* it, fall back to its default), or has no effort channel at all, starting
|
|
64
|
+
* the session rejects with an Error naming the requested level and what the
|
|
65
|
+
* runtime did instead. A runtime that forwards the level unchecked (codex)
|
|
66
|
+
* reads it back as given, and its provider's refusal fails the first turn.
|
|
67
|
+
* `Session.effort()` is the runtime's report, where it gives one.
|
|
68
|
+
*/
|
|
69
|
+
readonly effort?: string;
|
|
53
70
|
/** Resume the runtime-native session identified by a previous Session.id. */
|
|
54
71
|
readonly resume?: string;
|
|
55
72
|
/** Extra environment overlaid on the host env for the processes THIS session spawns. Subprocess runtimes: the runtime process itself (tools inherit). In-process runtimes: only the agent's tool subprocesses; provider config needs the runtime's native channel there. CAVEAT for PATH-like entries: a runtime that runs tools through a login shell (codex: zsh/bash -lc) lets profile scripts reorder or rebuild PATH (probed: codex demotes injected entries on Linux and macOS path_helper/.zprofile can drop them). Injected CLIs should be invoked by ABSOLUTE path. */
|
|
@@ -65,11 +82,30 @@ export interface SessionOptions {
|
|
|
65
82
|
* runtime's message).
|
|
66
83
|
*/
|
|
67
84
|
export type StartSession = (installation: AvailableInstallation, options: SessionOptions) => Promise<Session>;
|
|
68
|
-
/** Both records a control call produced: the request (its `seq` is where the action sits in the stream) and the accept/reject response. */
|
|
85
|
+
/** 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). */
|
|
69
86
|
export interface ControlResult {
|
|
70
87
|
readonly request: RequestRecord;
|
|
71
88
|
readonly response: ResponseRecord;
|
|
72
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* What `Session.prompt / steer / queue / abort` return (the API face): the
|
|
92
|
+
* answer read off the two records, with the records still underneath. A
|
|
93
|
+
* consumer branches on `kind` (two cases, not the four a response body can
|
|
94
|
+
* carry) and on the typed `code`; `seq` is the request's position in the
|
|
95
|
+
* stream, what `awaitTurnEnd` takes. `request` / `response` remain for
|
|
96
|
+
* consumers who want the stream's own word (`native`, the exact records).
|
|
97
|
+
*/
|
|
98
|
+
export type ControlOutcome = (ControlResult & {
|
|
99
|
+
readonly kind: "accepted";
|
|
100
|
+
readonly seq: number;
|
|
101
|
+
readonly requestId: string;
|
|
102
|
+
}) | (ControlResult & {
|
|
103
|
+
readonly kind: "rejected";
|
|
104
|
+
readonly seq: number;
|
|
105
|
+
readonly requestId: string;
|
|
106
|
+
readonly code: RejectionCode;
|
|
107
|
+
readonly reason: string;
|
|
108
|
+
});
|
|
73
109
|
/**
|
|
74
110
|
* Which tier of the attribution spectrum the adapter carries, declared
|
|
75
111
|
* explicitly and required to match what the runtime exposes (adapter red
|
|
@@ -113,7 +149,7 @@ export interface EventsOptions {
|
|
|
113
149
|
export interface AdapterSession {
|
|
114
150
|
readonly id: string;
|
|
115
151
|
readonly capabilities: SessionCapabilities;
|
|
116
|
-
prompt(input: string, options?:
|
|
152
|
+
prompt(input: string, options?: InputOptions): Promise<ControlResult>;
|
|
117
153
|
steer(input: string, options?: InputOptions): Promise<ControlResult>;
|
|
118
154
|
queue(input: string, options?: InputOptions): Promise<ControlResult>;
|
|
119
155
|
abort(): Promise<ControlResult>;
|
|
@@ -122,8 +158,12 @@ export interface AdapterSession {
|
|
|
122
158
|
graph(): SessionGraph;
|
|
123
159
|
dispose(): Promise<void>;
|
|
124
160
|
}
|
|
125
|
-
/** The API face: the SPI plus surfaces sealSession derives from the stream. */
|
|
161
|
+
/** The API face: the SPI plus surfaces sealSession derives from the stream. Control members answer with `ControlOutcome`: the same records, read. */
|
|
126
162
|
export interface Session extends AdapterSession {
|
|
163
|
+
prompt(input: string, options?: InputOptions): Promise<ControlOutcome>;
|
|
164
|
+
steer(input: string, options?: InputOptions): Promise<ControlOutcome>;
|
|
165
|
+
queue(input: string, options?: InputOptions): Promise<ControlOutcome>;
|
|
166
|
+
abort(): Promise<ControlOutcome>;
|
|
127
167
|
/**
|
|
128
168
|
* The consumer face of the stream: every fact oar read, flat and attributed
|
|
129
169
|
* (`eventsOf` applied to each record). One frame with three readings is
|
|
@@ -134,10 +174,20 @@ export interface Session extends AdapterSession {
|
|
|
134
174
|
events(observer: EventObserver, options?: EventsOptions): Unsubscribe;
|
|
135
175
|
/** Latest `model` event; null until the runtime has said one. A fold, not an echo of the request. */
|
|
136
176
|
model(): QueryResult<string | null>;
|
|
177
|
+
/** Latest `effort` event: the reasoning-effort level the runtime reports in effect; null until it has said one (claude never does). A fold, not an echo of `SessionOptions.effort`. */
|
|
178
|
+
effort(): QueryResult<string | null>;
|
|
137
179
|
/** THIS session's token total plus a per-agent breakdown when children reported: deduplicated, directly summable (sum = total). A derived child session (own `sessionId`, in `graph()`) is not aggregated here; its usage is in its own records. */
|
|
138
180
|
usage(): QueryResult<SessionUsage>;
|
|
139
181
|
/** Latest context fullness the runtime reported for this session's root agent; null before any. */
|
|
140
182
|
contextUsage(): QueryResult<ContextUsage | null>;
|
|
183
|
+
/**
|
|
184
|
+
* The root agent's status, folded from the stream (`reduceStatus`): idle,
|
|
185
|
+
* or running since the prompt request (or the first event of an adopted
|
|
186
|
+
* turn). Invariant every adapter must keep: a prompt recorded while this
|
|
187
|
+
* says `running` is rejected `busy`, and one recorded while it says `idle`
|
|
188
|
+
* is never rejected `busy`. `awaitIdle` waits on it.
|
|
189
|
+
*/
|
|
190
|
+
status(): QueryResult<AgentStatus>;
|
|
141
191
|
/**
|
|
142
192
|
* DERIVED: steer when the runtime can, fall back to queueing, always report
|
|
143
193
|
* where the input landed. `rejected` means the input was NOT taken over and
|
|
@@ -156,13 +206,16 @@ export interface SessionUsage {
|
|
|
156
206
|
}
|
|
157
207
|
export type SteerOrQueueResult = {
|
|
158
208
|
readonly landed: "steered";
|
|
159
|
-
readonly result:
|
|
209
|
+
readonly result: ControlOutcome;
|
|
160
210
|
} | {
|
|
161
211
|
readonly landed: "queued";
|
|
162
|
-
readonly result:
|
|
163
|
-
}
|
|
212
|
+
readonly result: ControlOutcome;
|
|
213
|
+
}
|
|
214
|
+
/** `result` is the last attempt (the queue when one was made, else the steer); `code` / `reason` are its. */
|
|
215
|
+
| {
|
|
164
216
|
readonly landed: "rejected";
|
|
217
|
+
readonly code: RejectionCode;
|
|
165
218
|
readonly reason: string;
|
|
166
|
-
readonly result:
|
|
219
|
+
readonly result: ControlOutcome;
|
|
167
220
|
};
|
|
168
221
|
//# 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,
|
|
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,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,YAAY,EACV,YAAY,EACZ,aAA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C3G;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAAC,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 @@
|
|
|
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,
|
|
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,9 +21,9 @@ 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";
|
|
26
|
-
export { contextUsageOf, modelOf, usageOf } from "./observe/usage.js";
|
|
24
|
+
export { awaitIdle, awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
|
|
25
|
+
export type { PromptRun, PromptRunOptions } from "./observe/turns.js";
|
|
26
|
+
export { contextUsageOf, effortOf, 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";
|
|
29
29
|
export { claudeSession } from "./runtimes/claude/session.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,KAAK,EACL,SAAS,EACT,aAAa,EACb,aAAa,EACb,YAAY,EACZ,KAAK,EACL,SAAS,EACT,
|
|
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,cAAc,EACd,aAAa,EACb,MAAM,EACN,KAAK,EACL,SAAS,EACT,aAAa,EACb,aAAa,EACb,YAAY,EACZ,KAAK,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB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C;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,12 +9,12 @@ 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";
|
|
17
|
-
export { contextUsageOf, modelOf, usageOf } from "./observe/usage.js";
|
|
16
|
+
export { awaitIdle, awaitTurnEnd, promptAndWait, turnEndAfter } from "./observe/turns.js";
|
|
17
|
+
export { contextUsageOf, effortOf, 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";
|
|
20
20
|
export { claudeSession } from "./runtimes/claude/session.js";
|
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;AAuFnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EACL,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EACL,aAAa,EACb,YAAY,EACZ,OAAO,
|
|
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,CAA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E,MAAM,2BAA2B,CAAC"}
|
package/dist/kernel.d.ts
ADDED
|
@@ -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 {
|
|
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,
|
|
1
|
+
{"version":3,"file":"agent-status.d.ts","sourceRoot":"","sources":["../../src/observe/agent-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAkC,MAAM,yBAAyB,CAAC;AAElH,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAO,MAAM,aAAa,EAAE,WAA8B,CAAC;AAE3D,8HAA8H;AAC9H,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,CAQnG;AAcD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAiCrG;AAwCD,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;
|
|
@@ -65,6 +105,7 @@ function reduceEvent(previous, record, event) {
|
|
|
65
105
|
case "user_message":
|
|
66
106
|
case "usage":
|
|
67
107
|
case "model":
|
|
108
|
+
case "effort":
|
|
68
109
|
return previous;
|
|
69
110
|
}
|
|
70
111
|
return previous;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-status.js","sourceRoot":"","sources":["../../src/observe/agent-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-status.js","sourceRoot":"","sources":["../../src/observe/agent-status.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAE3D,8HAA8H;AAC9H,MAAM,UAAU,QAAQ,CAAC,OAA4B,EAAE,SAAkB;IACvE,IAAI,KAAK,GAAG,aAAa,CAAC;IAC1B,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;IACb,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAA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AAa,EACb,WAAmB;IAEnB,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;IAC/C,OAAO,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observe/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAa,GAAG,SAAS,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/observe/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAa,GAAG,SAAS,KAAK,EAAE,CAmCpH;AAED,0HAA0H;AAC1H,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAQjG;AAED,0IAA0I;AAC1I,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,gBAAgB,CAatE;AAuBD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5C,aAAa,CA0Cf"}
|