@muse-code/sdk 1.4.4 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/errors.d.ts +17 -0
- package/dist/src/errors.js +25 -0
- package/dist/src/facade/approval.js +34 -2
- package/dist/src/facade/client.d.ts +11 -1
- package/dist/src/facade/client.js +64 -2
- package/dist/src/facade/turn-submit.js +4 -0
- package/dist/src/fingerprint.d.ts +1 -1
- package/dist/src/fingerprint.js +1 -1
- package/dist/src/fold/session-fold.d.ts +2 -2
- package/dist/src/fold/session-fold.js +5 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/msp.d.ts +423 -17
- package/package.json +1 -1
package/dist/src/errors.d.ts
CHANGED
|
@@ -52,3 +52,20 @@ export declare class MuseGapFillError extends Error {
|
|
|
52
52
|
readonly next: string;
|
|
53
53
|
constructor(reason: GapFillFailureReason, after: string, next: string, cause?: unknown);
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A required session-start permission-profile selection the client could not
|
|
57
|
+
* prove applied (TEST-42624-10, amendment 42624 § Compatibility): the start
|
|
58
|
+
* result carried no `permissionState`, and the `session/read` read-back
|
|
59
|
+
* served a different profile — or none at all. Never a silent default: the
|
|
60
|
+
* session stays open and the caller decides (set/retry or close) via
|
|
61
|
+
* `sessionId`, with no auto-close and no auto-set.
|
|
62
|
+
*/
|
|
63
|
+
export declare class PermissionProfileNotApplied extends Error {
|
|
64
|
+
/** The profile id the caller required. */
|
|
65
|
+
readonly requested: string;
|
|
66
|
+
/** The committed profile id the read-back served, or null when unknown. */
|
|
67
|
+
readonly served: string | null;
|
|
68
|
+
/** The open session, so the caller can set, retry, or close it. */
|
|
69
|
+
readonly sessionId: string;
|
|
70
|
+
constructor(requested: string, served: string | null, sessionId: string);
|
|
71
|
+
}
|
package/dist/src/errors.js
CHANGED
|
@@ -49,3 +49,28 @@ export class MuseGapFillError extends Error {
|
|
|
49
49
|
this.next = next;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* A required session-start permission-profile selection the client could not
|
|
54
|
+
* prove applied (TEST-42624-10, amendment 42624 § Compatibility): the start
|
|
55
|
+
* result carried no `permissionState`, and the `session/read` read-back
|
|
56
|
+
* served a different profile — or none at all. Never a silent default: the
|
|
57
|
+
* session stays open and the caller decides (set/retry or close) via
|
|
58
|
+
* `sessionId`, with no auto-close and no auto-set.
|
|
59
|
+
*/
|
|
60
|
+
export class PermissionProfileNotApplied extends Error {
|
|
61
|
+
/** The profile id the caller required. */
|
|
62
|
+
requested;
|
|
63
|
+
/** The committed profile id the read-back served, or null when unknown. */
|
|
64
|
+
served;
|
|
65
|
+
/** The open session, so the caller can set, retry, or close it. */
|
|
66
|
+
sessionId;
|
|
67
|
+
constructor(requested, served, sessionId) {
|
|
68
|
+
super(`required permissionProfile ${JSON.stringify(requested)} was not applied:` +
|
|
69
|
+
` the committed selection is ${served === null ? "unknown" : JSON.stringify(served)}` +
|
|
70
|
+
` (session ${sessionId})`);
|
|
71
|
+
this.name = "PermissionProfileNotApplied";
|
|
72
|
+
this.requested = requested;
|
|
73
|
+
this.served = served;
|
|
74
|
+
this.sessionId = sessionId;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -80,6 +80,15 @@ export class ApprovalRouter {
|
|
|
80
80
|
* with a frontier the host already closed, right before `approval/resolved`.
|
|
81
81
|
*/
|
|
82
82
|
#terminalApprovals = new Set();
|
|
83
|
+
/**
|
|
84
|
+
* The most recently sent decide each approval has on the wire, settled when
|
|
85
|
+
* its ack lands or the decide fails. A trailing `stageResolved` update read
|
|
86
|
+
* in the SAME chunk as a `terminal: true` ack is routed before
|
|
87
|
+
* {@link #decide} resumes from that ack, so {@link updated} waits for it
|
|
88
|
+
* instead of re-asking. Scoped to the round trip: an open handler or a
|
|
89
|
+
* decide that never started blocks nobody.
|
|
90
|
+
*/
|
|
91
|
+
#inFlight = new Map();
|
|
83
92
|
constructor(sessionId, connection) {
|
|
84
93
|
this.#sessionId = sessionId;
|
|
85
94
|
this.#connection = connection;
|
|
@@ -171,8 +180,18 @@ export class ApprovalRouter {
|
|
|
171
180
|
// parent's own approvals by contract (#36182 `skip_serializing_if`).
|
|
172
181
|
if (params.subagentOrigin !== undefined)
|
|
173
182
|
refreshed.subagentOrigin = params.subagentOrigin;
|
|
183
|
+
const acked = this.#inFlight.get(requested.approvalId);
|
|
184
|
+
if (acked !== undefined)
|
|
185
|
+
return this.#afterAck(acked, refreshed);
|
|
174
186
|
return this.requested(refreshed);
|
|
175
187
|
}
|
|
188
|
+
/** {@link updated}'s same-chunk arm: decide only once our own ack is in. */
|
|
189
|
+
async #afterAck(acked, refreshed) {
|
|
190
|
+
await acked;
|
|
191
|
+
if (this.#terminalApprovals.has(refreshed.approvalId))
|
|
192
|
+
return;
|
|
193
|
+
await this.requested(refreshed);
|
|
194
|
+
}
|
|
176
195
|
static #stageKey(params) {
|
|
177
196
|
const requirement = params.currentRequirementId;
|
|
178
197
|
return `${params.approvalId} ${requirement.approvalId}:${String(requirement.sourceIndex)}`;
|
|
@@ -231,6 +250,14 @@ export class ApprovalRouter {
|
|
|
231
250
|
// a plain-JS caller would be rejected by the host.
|
|
232
251
|
if (decision.feedback != null)
|
|
233
252
|
decideParams.feedback = decision.feedback;
|
|
253
|
+
// The wait covers only this round trip: an update for this approval read
|
|
254
|
+
// before the ack lands waits for it (see `#inFlight`).
|
|
255
|
+
const approvalId = params.approvalId;
|
|
256
|
+
let settle;
|
|
257
|
+
const acked = new Promise((resolve) => {
|
|
258
|
+
settle = resolve;
|
|
259
|
+
});
|
|
260
|
+
this.#inFlight.set(approvalId, acked);
|
|
234
261
|
try {
|
|
235
262
|
// No explicit `commandId`: unlike `sendUserTurn`, nothing here needs the
|
|
236
263
|
// id before the ack, so `Connection.command()` mints and stamps it — and
|
|
@@ -239,10 +266,15 @@ export class ApprovalRouter {
|
|
|
239
266
|
// A `terminal: true` ack closed the WHOLE approval; remember it so the
|
|
240
267
|
// trailing stale-frontier update #37538 permits cannot re-prompt.
|
|
241
268
|
if (ack["terminal"] === true)
|
|
242
|
-
this.#terminalApprovals.add(
|
|
269
|
+
this.#terminalApprovals.add(approvalId);
|
|
243
270
|
}
|
|
244
271
|
catch (error) {
|
|
245
|
-
this.#report({ approvalId
|
|
272
|
+
this.#report({ approvalId, error, kind: "submitFailed" });
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
settle();
|
|
276
|
+
if (this.#inFlight.get(approvalId) === acked)
|
|
277
|
+
this.#inFlight.delete(approvalId);
|
|
246
278
|
}
|
|
247
279
|
}
|
|
248
280
|
#report(failure) {
|
|
@@ -46,7 +46,17 @@ import type { InitializeParams, InitializeResult, SessionResumeParams, SessionSt
|
|
|
46
46
|
* `config` is excluded as well as `commandId` until the facade implements the
|
|
47
47
|
* required `sessionMcp` grant check and forwarding.
|
|
48
48
|
*/
|
|
49
|
-
export type StartSessionOptions = Readonly<Omit<SessionStartParams, "commandId" | "config"
|
|
49
|
+
export type StartSessionOptions = Readonly<Omit<SessionStartParams, "commandId" | "config"> & {
|
|
50
|
+
/**
|
|
51
|
+
* Require the `permissionProfile` selection (TEST-42624-10): when set,
|
|
52
|
+
* the client proves the committed selection equals the requested id —
|
|
53
|
+
* from the start result's `session.permissionState`, else a
|
|
54
|
+
* `session/read` read-back — and throws `PermissionProfileNotApplied`
|
|
55
|
+
* instead of proceeding on the host default. Client-local: never sent
|
|
56
|
+
* on the wire. Setting it without `permissionProfile` is a usage error.
|
|
57
|
+
*/
|
|
58
|
+
requirePermissionProfile?: boolean;
|
|
59
|
+
}>;
|
|
50
60
|
/** Caller-facing options for `session/resume` (tdd SS2.5.2). */
|
|
51
61
|
export type ResumeSessionOptions = Readonly<Omit<SessionResumeParams, "commandId" | "config">>;
|
|
52
62
|
/**
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* it is forwarded (or explicitly allow-listed as unforwardable).
|
|
37
37
|
*/
|
|
38
38
|
import { initializeAnswered, spawnMspConnection } from "../connection/spawn.js";
|
|
39
|
-
import { MuseSessionDiscardedError } from "../errors.js";
|
|
39
|
+
import { MuseSessionDiscardedError, PermissionProfileNotApplied } from "../errors.js";
|
|
40
40
|
import { DiscardedSessions } from "./discarded.js";
|
|
41
41
|
import { isAbnormalHostDeath, readSessionDurability } from "./host-death.js";
|
|
42
42
|
import { MspError, ProtocolError } from "../connection/connection.js";
|
|
@@ -54,12 +54,29 @@ const START_FORWARDED = [
|
|
|
54
54
|
"workspaceRoot",
|
|
55
55
|
"workspaceRoots",
|
|
56
56
|
"modelId",
|
|
57
|
+
"permissionProfile",
|
|
57
58
|
];
|
|
58
59
|
/**
|
|
59
60
|
* Every `ResumeParams` member `resumeSession` forwards. `config` has the same
|
|
60
61
|
* temporary capability-check boundary as the start facade above.
|
|
61
62
|
*/
|
|
62
63
|
const RESUME_FORWARDED = ["sessionId", "cursor", "excludeItems", "history"];
|
|
64
|
+
/**
|
|
65
|
+
* The committed profile id a session snapshot claims, or null when the
|
|
66
|
+
* snapshot is silent (the stable bundle strips the member; absent and null
|
|
67
|
+
* both mean unknown, never applied). Structural on purpose: the stable
|
|
68
|
+
* `Session` type carries no `permissionState`, and an unknown wire shape
|
|
69
|
+
* must read as unknown rather than throw.
|
|
70
|
+
*/
|
|
71
|
+
function committedProfileId(snapshot) {
|
|
72
|
+
if (typeof snapshot !== "object" || snapshot === null)
|
|
73
|
+
return null;
|
|
74
|
+
const state = snapshot.permissionState;
|
|
75
|
+
if (typeof state !== "object" || state === null)
|
|
76
|
+
return null;
|
|
77
|
+
const id = state.profileId;
|
|
78
|
+
return typeof id === "string" ? id : null;
|
|
79
|
+
}
|
|
63
80
|
/**
|
|
64
81
|
* Your entry point to the SDK.
|
|
65
82
|
*
|
|
@@ -252,13 +269,58 @@ export class MuseClient {
|
|
|
252
269
|
params.workspaceRoots = options.workspaceRoots;
|
|
253
270
|
if (options.modelId != null)
|
|
254
271
|
params.modelId = options.modelId;
|
|
272
|
+
// The initial permission-profile selection, forwarded verbatim like the
|
|
273
|
+
// other start members (undefined stays omitted).
|
|
274
|
+
if (options.permissionProfile != null)
|
|
275
|
+
params.permissionProfile = options.permissionProfile;
|
|
276
|
+
// TEST-42624-10: a caller that requires its selection proves it, never
|
|
277
|
+
// assuming the host default. The flag without the member is API misuse
|
|
278
|
+
// (plain Error, like the other misuse guards here), raised pre-wire.
|
|
279
|
+
const required = options.requirePermissionProfile === true;
|
|
280
|
+
if (required && options.permissionProfile == null) {
|
|
281
|
+
throw new Error("requirePermissionProfile needs permissionProfile: require the selection you pass");
|
|
282
|
+
}
|
|
255
283
|
// Keyed by the id the SERVER named, never the one the caller asked for:
|
|
256
284
|
// `sessionId` is a REQUEST on start, and a session keyed by a hopeful id
|
|
257
285
|
// would reject every one of its own events as foreign.
|
|
258
|
-
|
|
286
|
+
const session = await this.#open("session/start", params, (raw) => ({
|
|
259
287
|
result: raw,
|
|
260
288
|
verb: "session/start",
|
|
261
289
|
}));
|
|
290
|
+
if (!required)
|
|
291
|
+
return session;
|
|
292
|
+
return this.#proveSelection(session, options.permissionProfile);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Prove a required start selection (TEST-42624-10): the start result's own
|
|
296
|
+
* `session.permissionState` first (absent = unknown, never applied); else a
|
|
297
|
+
* point-in-time `session/read`, which never subscribes. Only `profileId ==
|
|
298
|
+
* requested` proceeds; anything else throws `PermissionProfileNotApplied`
|
|
299
|
+
* BEFORE any turn is sent. The refused session is dropped from the client
|
|
300
|
+
* (no orphan keeps folding for an id the caller can never reach — the SDK
|
|
301
|
+
* has no set/close-by-id verb); the error's `sessionId` is the caller's
|
|
302
|
+
* handle to resume via `sessionId` or start again. A failed read-back
|
|
303
|
+
* propagates: the client still never proceeds on the default.
|
|
304
|
+
*/
|
|
305
|
+
async #proveSelection(session, requested) {
|
|
306
|
+
const opening = session.opening;
|
|
307
|
+
const started = opening !== undefined && opening.verb === "session/start"
|
|
308
|
+
? committedProfileId(opening.result.session)
|
|
309
|
+
: null;
|
|
310
|
+
if (started !== null) {
|
|
311
|
+
if (started === requested)
|
|
312
|
+
return session;
|
|
313
|
+
this.#sessions.delete(session);
|
|
314
|
+
throw new PermissionProfileNotApplied(requested, started, session.sessionId);
|
|
315
|
+
}
|
|
316
|
+
const read = await this.#connection.command("session/read", {
|
|
317
|
+
sessionId: session.sessionId,
|
|
318
|
+
});
|
|
319
|
+
const served = committedProfileId(read["session"]);
|
|
320
|
+
if (served === requested)
|
|
321
|
+
return session;
|
|
322
|
+
this.#sessions.delete(session);
|
|
323
|
+
throw new PermissionProfileNotApplied(requested, served, session.sessionId);
|
|
262
324
|
}
|
|
263
325
|
/**
|
|
264
326
|
* Load an existing session and subscribe this connection to its view
|
|
@@ -26,6 +26,8 @@ const TURN_START_FORWARDED = [
|
|
|
26
26
|
// No "tokenBudget" (#45454): experimental-gated, and this SDK serves the
|
|
27
27
|
// stable surface only.
|
|
28
28
|
"workspaceRoots",
|
|
29
|
+
// v1 stable member, forwarded like any other.
|
|
30
|
+
"userShell",
|
|
29
31
|
];
|
|
30
32
|
/**
|
|
31
33
|
* An `MspError` as the pending set reads it (SS4.13's settlement test).
|
|
@@ -174,6 +176,8 @@ export class TurnSubmitter {
|
|
|
174
176
|
// No tokenBudget forward (#45454): experimental-gated, stable SDK omits it.
|
|
175
177
|
if (options.workspaceRoots != null)
|
|
176
178
|
params.workspaceRoots = options.workspaceRoots;
|
|
179
|
+
if (options.userShell != null)
|
|
180
|
+
params.userShell = options.userShell;
|
|
177
181
|
return params;
|
|
178
182
|
}
|
|
179
183
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (tdd SS1.4.1) — additive-optional evolution means an older SDK keeps
|
|
14
14
|
* working against a newer host.
|
|
15
15
|
*/
|
|
16
|
-
export declare const EXPECTED_SCHEMA_FINGERPRINT = "sha256:
|
|
16
|
+
export declare const EXPECTED_SCHEMA_FINGERPRINT = "sha256:6de32db08bbbe0deb478d2bfcaba001e9fb490986bc80db3aceb4d996abf7df9";
|
|
17
17
|
/**
|
|
18
18
|
* What a build-time mismatch MEANS, in the words a human needs at 2am.
|
|
19
19
|
*
|
package/dist/src/fingerprint.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (tdd SS1.4.1) — additive-optional evolution means an older SDK keeps
|
|
14
14
|
* working against a newer host.
|
|
15
15
|
*/
|
|
16
|
-
export const EXPECTED_SCHEMA_FINGERPRINT = "sha256:
|
|
16
|
+
export const EXPECTED_SCHEMA_FINGERPRINT = "sha256:6de32db08bbbe0deb478d2bfcaba001e9fb490986bc80db3aceb4d996abf7df9";
|
|
17
17
|
/**
|
|
18
18
|
* What a build-time mismatch MEANS, in the words a human needs at 2am.
|
|
19
19
|
*
|
|
@@ -170,9 +170,9 @@ export type ViewEvent = {
|
|
|
170
170
|
* client's notification callback rather than this fold.
|
|
171
171
|
*/
|
|
172
172
|
type AssertNever<T extends never> = T;
|
|
173
|
-
type LiveHostStateProjection = "skill/changed" | "usage/changed" | "session/statusChanged" | "session/listChanged";
|
|
173
|
+
type LiveHostStateProjection = "skill/changed" | "usage/changed" | "session/statusChanged" | "session/listChanged" | "plugin/changed" | "plugin/marketplaceChanged" | "computerUseSetup/changed";
|
|
174
174
|
type SessionLifecycleBroadcast = "session/started" | "session/closed";
|
|
175
|
-
type NonFoldNotification = "initialized" | "userInput/engaged" | "session/viewHealthChanged" | SessionLifecycleBroadcast | LiveHostStateProjection;
|
|
175
|
+
type NonFoldNotification = "initialized" | "userInput/engaged" | "session/viewHealthChanged" | "recap/completed" | SessionLifecycleBroadcast | LiveHostStateProjection;
|
|
176
176
|
type UnfoldedViewNotification = Exclude<MspNotification, NonFoldNotification | ViewEvent["method"]>;
|
|
177
177
|
export type EveryViewNotificationIsFolded = AssertNever<UnfoldedViewNotification>;
|
|
178
178
|
/**
|
|
@@ -278,8 +278,11 @@ export class SessionFold {
|
|
|
278
278
|
const turn = this.#turnFor(params.turnId);
|
|
279
279
|
turn.commandId = params.commandId;
|
|
280
280
|
// A retract is NOT a `TurnTerminal`; leaving `terminal` unset is the whole
|
|
281
|
-
// point (INV-006).
|
|
282
|
-
// with `retracted: true`, which the item half folds
|
|
281
|
+
// point (INV-006). On accepted, the retracted user message re-arrives via
|
|
282
|
+
// `item/updated` with `retracted: true`, which the item half folds
|
|
283
|
+
// (a declined outcome also lands here for now: the entry reads retracted
|
|
284
|
+
// and the later turn/completed arrives as a stale frame, so its terminal
|
|
285
|
+
// is dropped too - a known gap in this fold, behavior unchanged).
|
|
283
286
|
turn.state = "retracted";
|
|
284
287
|
this.#clearActive(params.turnId);
|
|
285
288
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export { MuseClient } from "./facade/client.js";
|
|
|
50
50
|
export type { MuseClientOptions, MuseClientSpawnOptions, ResumeSessionOptions, StartSessionOptions, } from "./facade/client.js";
|
|
51
51
|
export type { ExitClassification, MuseServeChildOptions, ProcessExit, SpawnMspConnectionOptions, } from "./connection/spawn.js";
|
|
52
52
|
export { DiscardedSessions } from "./facade/discarded.js";
|
|
53
|
-
export { MuseForeignSessionError, MuseGapFillError, MuseSessionDiscardedError, } from "./errors.js";
|
|
53
|
+
export { MuseForeignSessionError, MuseGapFillError, MuseSessionDiscardedError, PermissionProfileNotApplied, } from "./errors.js";
|
|
54
54
|
export type { GapFillFailureReason } from "./errors.js";
|
|
55
55
|
export type { GapFillFailureHandler } from "./facade/gap-fill.js";
|
|
56
56
|
export { MuseHostDiedError, readSessionDurability } from "./facade/host-death.js";
|
package/dist/src/index.js
CHANGED
|
@@ -40,7 +40,7 @@ export { MuseClient } from "./facade/client.js";
|
|
|
40
40
|
// none — the cross-client sharing knob was declined (Constitution XI; see the
|
|
41
41
|
// constructor note in `facade/client.ts`).
|
|
42
42
|
export { DiscardedSessions } from "./facade/discarded.js";
|
|
43
|
-
export { MuseForeignSessionError, MuseGapFillError, MuseSessionDiscardedError, } from "./errors.js";
|
|
43
|
+
export { MuseForeignSessionError, MuseGapFillError, MuseSessionDiscardedError, PermissionProfileNotApplied, } from "./errors.js";
|
|
44
44
|
// Trimmed deliberately (Constitution XI): `isAbnormalHostDeath`,
|
|
45
45
|
// `isItemInProgress`, and `survivesHostDeath` are `Session`'s own internals
|
|
46
46
|
// with no consumer, and a barrel export would freeze them into `@muse-code/sdk`'s
|
package/dist/src/msp.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ export interface BranchState {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
/** A grantable capability name (SS1.4.4). Open: the reserved `rawLog` entry joins this domain as an additive open-enum extension when SS6 un-defers (#13929, Scenario 5 AS-3) — closed would make that a retype. */
|
|
248
|
-
export type CapabilityName = "userShell" | "sessionMcp" | "sessionListStream" | "feedback" | (string & {});
|
|
248
|
+
export type CapabilityName = "userShell" | "sessionMcp" | "sessionListStream" | "feedback" | "computerUseSetup" | "computerUseHostSetup" | (string & {});
|
|
249
249
|
|
|
250
250
|
/** The client's requested capability posture (SS1.4.1). Every member defaults; an absent `capabilities` object means all defaults. */
|
|
251
251
|
export interface ClientCapabilities {
|
|
@@ -333,6 +333,9 @@ export interface ComputerUseBlockedApp {
|
|
|
333
333
|
/** A capability dropdown's value (ADR 630 D18.4). **Open**: the read result carries it, so an older client tolerates a value it does not know. */
|
|
334
334
|
export type ComputerUseChoice = "ask" | "alwaysAllow" | (string & {});
|
|
335
335
|
|
|
336
|
+
/** One macOS permission as setup last saw it. **Open**, like the phase. */
|
|
337
|
+
export type ComputerUsePermission = "granted" | "missing" | "unknown" | (string & {});
|
|
338
|
+
|
|
336
339
|
/** `computerUseSettings/read` result, also answered by `computerUseSettings/update`. */
|
|
337
340
|
export interface ComputerUseSettings {
|
|
338
341
|
/** The user's blocks in the order they were added, then the built-in blocks when `showBuiltIns` asked for them. */
|
|
@@ -361,6 +364,47 @@ export interface ComputerUseSettingsUpdateParams {
|
|
|
361
364
|
unblockApps?: string[];
|
|
362
365
|
}
|
|
363
366
|
|
|
367
|
+
/** `computerUseSetup/changed` params. */
|
|
368
|
+
export interface ComputerUseSetupChanged {
|
|
369
|
+
/** The session whose setup state changed; absent for the host's own setup, which only `computerUseHostSetup` holders receive. */
|
|
370
|
+
sessionId?: string;
|
|
371
|
+
/** Its new state. */
|
|
372
|
+
state: ComputerUseSetupState;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Where the session's setup stands: `cua_setup`'s state codes, camelCase. **Open**: a result vocabulary, so an older client tolerates a new state. */
|
|
376
|
+
export type ComputerUseSetupPhase = "dormant" | "inProgress" | "restartRequired" | "readyForTarget" | "stopped" | (string & {});
|
|
377
|
+
|
|
378
|
+
/** `computerUseSetup/read` params. */
|
|
379
|
+
export interface ComputerUseSetupReadParams {
|
|
380
|
+
/** The session whose setup to read. Omitted reads the host's own setup, which needs the `computerUseHostSetup` grant. */
|
|
381
|
+
sessionId?: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** `computerUseSetup/start` params: a human command. */
|
|
385
|
+
export interface ComputerUseSetupStartParams {
|
|
386
|
+
/** The client's id for this command. */
|
|
387
|
+
commandId: string;
|
|
388
|
+
/** The session whose setup to start. Omitted starts the host's own setup, which needs the `computerUseHostSetup` grant. */
|
|
389
|
+
sessionId?: string;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** The session's setup state: the result of both methods and the `computerUseSetup/changed` payload's `state`. */
|
|
393
|
+
export interface ComputerUseSetupState {
|
|
394
|
+
/** Accessibility. */
|
|
395
|
+
accessibility: ComputerUsePermission;
|
|
396
|
+
/** Input Monitoring: computer use is ready without it; some actions need it. */
|
|
397
|
+
inputMonitoring: ComputerUsePermission;
|
|
398
|
+
/** The sentence `cua_setup` gives the user for this answer. */
|
|
399
|
+
message?: string;
|
|
400
|
+
/** The `cua_setup` refusal code when the call was refused, verbatim. */
|
|
401
|
+
refused?: string;
|
|
402
|
+
/** Screen Recording. */
|
|
403
|
+
screenRecording: ComputerUsePermission;
|
|
404
|
+
/** Where setup stands. */
|
|
405
|
+
setup: ComputerUseSetupPhase;
|
|
406
|
+
}
|
|
407
|
+
|
|
364
408
|
/** Context pressure level (tdd SS4.6.6): hard threshold first, both inclusive `>=`. Open. */
|
|
365
409
|
export type ContextPressureLevel = "normal" | "warning" | "blocked" | (string & {});
|
|
366
410
|
|
|
@@ -472,6 +516,10 @@ export interface ErrorData {
|
|
|
472
516
|
latestBoundaryCursor?: string | null;
|
|
473
517
|
/** The exceeded byte limit, on `inputTooLarge` errors. */
|
|
474
518
|
limitBytes?: number;
|
|
519
|
+
/** The store on `pluginNotFound` (`-32035`, SS3.29.1). */
|
|
520
|
+
marketplace?: string;
|
|
521
|
+
/** The rejected marketplace name on `marketplaceNotFound` (`-32034`, SS3.29.7) and `marketplaceAlreadyExists` (`-32036`, SS3.29.2); the rejected plugin name on `pluginNotFound` (`-32035`, SS3.29.1). */
|
|
522
|
+
name?: string;
|
|
475
523
|
/** The requested `outputRef.id`, on the same `item/readOutput` arms. */
|
|
476
524
|
outputRef?: string;
|
|
477
525
|
/** Candidate retained paths on `sessionAmbiguous`. */
|
|
@@ -482,6 +530,10 @@ export interface ErrorData {
|
|
|
482
530
|
resolution?: ApprovalResolutionSummary;
|
|
483
531
|
/** Whether retrying can succeed (e.g. `overloaded`). When present, overrides the error table row's `retryable` default for this code. */
|
|
484
532
|
retryable?: boolean;
|
|
533
|
+
/** Why the branch seed did not use a checkpoint, on the same arms: one of `no_usable_checkpoint`, `unsupported_checkpoint_shape`, `checkpoint_has_model_visible_tail`, `checkpoint_missing_suffix`; absent when the seed used a checkpoint or no fallback was recorded. */
|
|
534
|
+
seedFallbackReason?: string;
|
|
535
|
+
/** The branch-seed path the host read before rejecting, on branch-validation rejections (`session/fork`, `session/sideChat`: the `forkBoundaryInvalid`, `commandRejected` and `sessionNotFound` arms; SS2.5.3, SS2.5.7; #51365): one of `runtime_checkpoint_tail`, `runtime_full_replay`, `legacy_session_data` — the durable branch-seed vocabulary, so the client cites the real seed decision instead of guessing at a stale binary. */
|
|
536
|
+
seedPath?: string;
|
|
485
537
|
/** The rejected skill selector on `skillNotFound` (`-32032`, SS3.22.4). */
|
|
486
538
|
selector?: string;
|
|
487
539
|
/** Session identity on errors whose lookup is session-scoped. */
|
|
@@ -497,7 +549,7 @@ export interface ErrorData {
|
|
|
497
549
|
}
|
|
498
550
|
|
|
499
551
|
/** A stable `error.data.kind` category (SS1.6): camelCase, the value clients branch on. Open: SS2–SS5 lanes add kinds additively as their methods land (Appendix B already registers them), and the spec's edge-case rule makes a new `kind` additive only because this domain is declared open. */
|
|
500
|
-
export type ErrorKind = "parseError" | "invalidRequest" | "notInitialized" | "alreadyInitialized" | "methodNotFound" | "invalidParams" | "experimentalRequired" | "internal" | "pageEventTooLarge" | "outputResultTooLarge" | "overloaded" | "inputTooLarge" | "capabilityRequired" | "notFound" | "interrupted" | "cancelled" | "sessionNotFound" | "sessionInUse" | "sessionAmbiguous" | "forkBoundaryInvalid" | "sessionNotLoaded" | "sessionStreamMismatch" | "commandRejected" | "backpressured" | "skillNotFound" | "computerUseUnavailable" | "uploadNotFound" | "viewTruncated" | "outputUnavailable" | "boundaryPruned" | "boundaryUnusable" | "noBoundary" | "approvalNotFound" | "approvalAlreadyResolved" | "approvalChoiceInvalid" | "approvalRequirementStale" | "approvalReviewerUnavailable" | "userInputNotFound" | "userInputAlreadySettled" | "userInputAnswerInvalid" | (string & {});
|
|
552
|
+
export type ErrorKind = "parseError" | "invalidRequest" | "notInitialized" | "alreadyInitialized" | "methodNotFound" | "invalidParams" | "experimentalRequired" | "internal" | "pageEventTooLarge" | "outputResultTooLarge" | "overloaded" | "inputTooLarge" | "capabilityRequired" | "notFound" | "interrupted" | "cancelled" | "sessionNotFound" | "sessionInUse" | "sessionAmbiguous" | "forkBoundaryInvalid" | "sessionNotLoaded" | "sessionStreamMismatch" | "commandRejected" | "backpressured" | "skillNotFound" | "computerUseUnavailable" | "marketplaceNotFound" | "pluginNotFound" | "marketplaceAlreadyExists" | "pluginMutationsDisabled" | "uploadNotFound" | "viewTruncated" | "outputUnavailable" | "boundaryPruned" | "boundaryUnusable" | "noBoundary" | "approvalNotFound" | "approvalAlreadyResolved" | "approvalChoiceInvalid" | "approvalRequirementStale" | "approvalReviewerUnavailable" | "userInputNotFound" | "userInputAlreadySettled" | "userInputAnswerInvalid" | (string & {});
|
|
501
553
|
|
|
502
554
|
/** The `error` member of an error response (SS1.2 §2.4). */
|
|
503
555
|
export interface ErrorObject {
|
|
@@ -716,6 +768,10 @@ export interface InitializeResult {
|
|
|
716
768
|
platformFamily: PlatformFamily;
|
|
717
769
|
/** Server operating system. */
|
|
718
770
|
platformOs: PlatformOs;
|
|
771
|
+
/** Whether this host can enforce the sandbox (ADR 50064-startup-report-sandbox-availability D2/D4). Optional so the addition is additive under SS1.5.4; a v1 host always sends it, and a client reads absent as unknown — the host predates the field, so the client falls back to its own probe rather than inventing an answer. */
|
|
772
|
+
sandboxAvailability?: SandboxAvailability;
|
|
773
|
+
/** Why enforcement is impossible. Sent only when `sandbox_availability` is `unavailable`; a client MUST NOT infer a reason when none is sent. */
|
|
774
|
+
sandboxUnavailableReason?: SandboxUnavailableReason;
|
|
719
775
|
/** Envelope schema version and stable-surface fingerprint. */
|
|
720
776
|
schema: SchemaInfo;
|
|
721
777
|
/** Server identification. */
|
|
@@ -758,6 +814,8 @@ export interface Item {
|
|
|
758
814
|
commandText?: string;
|
|
759
815
|
/** `subagent`: camelCased `SubagentControlStatus` (open enum); `status` stays the generic item vocabulary. */
|
|
760
816
|
controlStatus?: SubagentControlStatus;
|
|
817
|
+
/** `agentMessage`: `true` when the provider stream died mid-reply and the run failed with this partial text committed (ADR 50063 D2) — the wire mark for the gate-off "incomplete response" rule (#13328). Absent otherwise; never cleared once set. */
|
|
818
|
+
cutOff?: boolean;
|
|
761
819
|
/** `workflow`: the run-level declared-phase label — the last `Phase` detail-row label of the reconciled projection; terminal-only, absent while live (tdd SS4.5.8, #45449). */
|
|
762
820
|
declaredPhase?: string;
|
|
763
821
|
/** `subagent`: nesting depth. */
|
|
@@ -916,8 +974,8 @@ export interface ItemDeltaParams {
|
|
|
916
974
|
viewCursor: string;
|
|
917
975
|
}
|
|
918
976
|
|
|
919
|
-
/** The eleven v1 item kinds (tdd SS4.5.2–4.5.13). Open: a new kind is additive evolution, and clients MUST render unknown kinds generically (tdd SS4.10). */
|
|
920
|
-
export type ItemKind = "userMessage" | "agentMessage" | "reasoning" | "toolCall" | "userShell" | "subagent" | "workflow" | "reminderChild" | "compaction" | "hookRun" | "sideChat" | (string & {});
|
|
977
|
+
/** The eleven v1 item kinds (tdd SS4.5.2–4.5.13) plus post-v1 kinds (tdd SS4.5.14+). Open: a new kind is additive evolution, and clients MUST render unknown kinds generically (tdd SS4.10). */
|
|
978
|
+
export type ItemKind = "userMessage" | "agentMessage" | "reasoning" | "toolCall" | "userShell" | "subagent" | "workflow" | "reminderChild" | "compaction" | "hookRun" | "sideChat" | "webSearch" | (string & {});
|
|
921
979
|
|
|
922
980
|
/** The `item/readOutput` content encoding (tdd SS4.7.4). Closed: text media is ALWAYS `utf8` and binary media `base64`; a third value would change the client's decode contract. */
|
|
923
981
|
export type ItemReadOutputEncoding = "utf8" | "base64";
|
|
@@ -994,6 +1052,9 @@ export interface LastTurn {
|
|
|
994
1052
|
turnId: string;
|
|
995
1053
|
}
|
|
996
1054
|
|
|
1055
|
+
/** Quota limit kinds (tdd SS4.5.1, ADR 50047 D2): open for evolution. */
|
|
1056
|
+
export type LimitKind = "tierLimit" | (string & {});
|
|
1057
|
+
|
|
997
1058
|
/** `media/upload` params (tdd SS3.33, ADR 45443 D5): one chunk of a client-minted upload. All members required. */
|
|
998
1059
|
export interface MediaUploadParams {
|
|
999
1060
|
/** This chunk's bytes; each call's frame stays in the SS1.1 budget. */
|
|
@@ -1239,6 +1300,75 @@ export interface PluginCatalogEntry {
|
|
|
1239
1300
|
version: string;
|
|
1240
1301
|
}
|
|
1241
1302
|
|
|
1303
|
+
/** `plugin/changed` params (tdd SS3.29.5): an install landed; clients re-issue `plugin/list` (plus `hook/list` and `skill/list`). */
|
|
1304
|
+
export interface PluginChangedParams {
|
|
1305
|
+
/** The installed record's own switch. */
|
|
1306
|
+
enabled: boolean;
|
|
1307
|
+
/** The installed record's identifier. */
|
|
1308
|
+
id: string;
|
|
1309
|
+
/** The acting session. */
|
|
1310
|
+
sessionId: string;
|
|
1311
|
+
/** The installed-list provenance vocabulary (tdd SS3.26.2). */
|
|
1312
|
+
source: PluginSource;
|
|
1313
|
+
/** The installed record's version. */
|
|
1314
|
+
version: string;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/** The `plugin/install` local-path arm (tdd SS3.29.1). */
|
|
1318
|
+
export interface PluginInstallLocalPathTarget {
|
|
1319
|
+
/** The host folder to install from; absolute recommended, relative resolves against the host working directory. */
|
|
1320
|
+
path: string;
|
|
1321
|
+
/** The install lane; omitted means `default`. */
|
|
1322
|
+
scope?: PluginInstallScope;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/** The `plugin/install` marketplace arm (tdd SS3.29.1). */
|
|
1326
|
+
export interface PluginInstallMarketplaceTarget {
|
|
1327
|
+
/** The configured marketplace name. */
|
|
1328
|
+
marketplace: string;
|
|
1329
|
+
/** The plugin name within the store. */
|
|
1330
|
+
name: string;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
/** `plugin/install` params (tdd SS3.29.1). Per-session params plus a client-generated `commandId` (UUIDv7) with the uniform SS3.1.1 idempotency contract. */
|
|
1334
|
+
export interface PluginInstallParams {
|
|
1335
|
+
/** The client-generated idempotency key (UUIDv7). */
|
|
1336
|
+
commandId: string;
|
|
1337
|
+
/** The target session; its workspace resolves project scope. */
|
|
1338
|
+
sessionId: string;
|
|
1339
|
+
/** Exactly one install target arm. */
|
|
1340
|
+
target: PluginInstallTarget;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/** `plugin/install` result (tdd SS3.29.1): the SS3.1.2 ack envelope plus the installed receipt. */
|
|
1344
|
+
export interface PluginInstallResult {
|
|
1345
|
+
/** The echoed idempotency key. */
|
|
1346
|
+
commandId: string;
|
|
1347
|
+
/** The installed record's own switch. */
|
|
1348
|
+
enabled: boolean;
|
|
1349
|
+
/** The installed record's identifier. */
|
|
1350
|
+
id: string;
|
|
1351
|
+
/** The installed-list provenance vocabulary (tdd SS3.26.2). */
|
|
1352
|
+
source: PluginSource;
|
|
1353
|
+
/** The ack status. */
|
|
1354
|
+
status: CommandStatus;
|
|
1355
|
+
/** The installed record's version. */
|
|
1356
|
+
version: string;
|
|
1357
|
+
/** The installer's advisory text when the install succeeded with a caveat; absent otherwise. */
|
|
1358
|
+
warning?: string;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/** The `plugin/install` local-path scope (tdd SS3.29.1). Closed: an unknown scope is `-32602 invalidParams`. */
|
|
1362
|
+
export type PluginInstallScope = "default" | "user" | "project";
|
|
1363
|
+
|
|
1364
|
+
/** The one structured install target (tdd SS3.29.1): a flat object with two optional arms, exactly one present — the `TurnInputPart` convention, since the v1 schema model names no object-variant union. Both arms or neither is `-32602 invalidParams`. */
|
|
1365
|
+
export interface PluginInstallTarget {
|
|
1366
|
+
/** The local-path arm: install from a host folder. */
|
|
1367
|
+
localPath?: PluginInstallLocalPathTarget;
|
|
1368
|
+
/** The marketplace arm: install a named plugin from a store. */
|
|
1369
|
+
marketplace?: PluginInstallMarketplaceTarget;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1242
1372
|
/** `plugin/list` params (tdd SS3.26.2). Per-session params; rows are the installed plugin records. */
|
|
1243
1373
|
export interface PluginListParams {
|
|
1244
1374
|
/** The target session. */
|
|
@@ -1251,9 +1381,108 @@ export interface PluginListResult {
|
|
|
1251
1381
|
plugins: PluginCatalogEntry[];
|
|
1252
1382
|
}
|
|
1253
1383
|
|
|
1384
|
+
/** `plugin/marketplaceAdd` params (tdd SS3.29.2). Per-session params plus a client-generated `commandId` (UUIDv7). */
|
|
1385
|
+
export interface PluginMarketplaceAddParams {
|
|
1386
|
+
/** The client-generated idempotency key (UUIDv7). */
|
|
1387
|
+
commandId: string;
|
|
1388
|
+
/** The marketplace name to configure. */
|
|
1389
|
+
name: string;
|
|
1390
|
+
/** The target session. */
|
|
1391
|
+
sessionId: string;
|
|
1392
|
+
/** The app's source vocabulary: `owner/repo`, a git URL, a `file://` URL, or a local path. */
|
|
1393
|
+
source: string;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
/** What happened to a marketplace (tdd SS3.29.6). Closed: an unknown change is a contract violation, never tolerated. */
|
|
1397
|
+
export type PluginMarketplaceChange = "added" | "updated" | "removed";
|
|
1398
|
+
|
|
1399
|
+
/** `plugin/marketplaceChanged` params (tdd SS3.29.6): a marketplace was added, updated, or removed. */
|
|
1400
|
+
export interface PluginMarketplaceChangedParams {
|
|
1401
|
+
/** What happened. */
|
|
1402
|
+
change: PluginMarketplaceChange;
|
|
1403
|
+
/** The marketplace name. */
|
|
1404
|
+
name: string;
|
|
1405
|
+
/** The stored record's plugin count; omitted on `removed`, never fabricated. */
|
|
1406
|
+
pluginCount?: number;
|
|
1407
|
+
/** The acting session. */
|
|
1408
|
+
sessionId: string;
|
|
1409
|
+
/** The stored record's skipped count; omitted on `removed`, never fabricated. */
|
|
1410
|
+
skippedCount?: number;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/** The stored marketplace record both add and update answer (tdd SS3.29.2, SS3.29.3): the SS3.1.2 ack envelope plus the record. */
|
|
1414
|
+
export interface PluginMarketplaceRecordResult {
|
|
1415
|
+
/** The echoed idempotency key. */
|
|
1416
|
+
commandId: string;
|
|
1417
|
+
/** The configured marketplace name. */
|
|
1418
|
+
name: string;
|
|
1419
|
+
/** The plugins the store now offers. */
|
|
1420
|
+
pluginCount: number;
|
|
1421
|
+
/** Entries the store could not offer, with the reason each was skipped; empty when nothing was skipped. */
|
|
1422
|
+
skipped: PluginMarketplaceSkippedEntry[];
|
|
1423
|
+
/** The normalized stored source. */
|
|
1424
|
+
source: PluginMarketplaceSourceShape;
|
|
1425
|
+
/** The ack status. */
|
|
1426
|
+
status: CommandStatus;
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/** `plugin/marketplaceRemove` params (tdd SS3.29.4). Per-session params plus a client-generated `commandId` (UUIDv7). */
|
|
1430
|
+
export interface PluginMarketplaceRemoveParams {
|
|
1431
|
+
/** The client-generated idempotency key (UUIDv7). */
|
|
1432
|
+
commandId: string;
|
|
1433
|
+
/** The marketplace name to remove. */
|
|
1434
|
+
name: string;
|
|
1435
|
+
/** The target session. */
|
|
1436
|
+
sessionId: string;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/** `plugin/marketplaceRemove` result (tdd SS3.29.4): the SS3.1.2 ack envelope plus the removed name. */
|
|
1440
|
+
export interface PluginMarketplaceRemoveResult {
|
|
1441
|
+
/** The echoed idempotency key. */
|
|
1442
|
+
commandId: string;
|
|
1443
|
+
/** The removed marketplace name. */
|
|
1444
|
+
name: string;
|
|
1445
|
+
/** The ack status. */
|
|
1446
|
+
status: CommandStatus;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
/** One skipped marketplace entry (tdd SS3.29.2). */
|
|
1450
|
+
export interface PluginMarketplaceSkippedEntry {
|
|
1451
|
+
/** The skipped plugin. */
|
|
1452
|
+
plugin: string;
|
|
1453
|
+
/** Why it was skipped. */
|
|
1454
|
+
reason: string;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/** The normalized stored marketplace source (tdd SS3.29.2). */
|
|
1458
|
+
export interface PluginMarketplaceSourceShape {
|
|
1459
|
+
/** The stored source kind. */
|
|
1460
|
+
kind: string;
|
|
1461
|
+
/** The stored source path. */
|
|
1462
|
+
path: string;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/** `plugin/marketplaceUpdate` params (tdd SS3.29.3). Per-session params plus a client-generated `commandId` (UUIDv7). */
|
|
1466
|
+
export interface PluginMarketplaceUpdateParams {
|
|
1467
|
+
/** The client-generated idempotency key (UUIDv7). */
|
|
1468
|
+
commandId: string;
|
|
1469
|
+
/** The marketplace name to refresh. */
|
|
1470
|
+
name: string;
|
|
1471
|
+
/** The target session. */
|
|
1472
|
+
sessionId: string;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1254
1475
|
/** A plugin row's source provenance (tdd SS3.26.2, ADR 33398 D7 item 3): camelCase of `PluginSourceProvenance`. Open (server-produced result vocabulary, the #22785 enum-openness rule): a future provenance is additive. */
|
|
1255
1476
|
export type PluginSource = "curated" | "marketplaceUserAdded" | "foreignImport" | "nativeLocal" | (string & {});
|
|
1256
1477
|
|
|
1478
|
+
/** Typed quota-exhaustion detail (tdd SS4.5.1, ADR 50047 D2): the limit kind plus the provider's reset instant. */
|
|
1479
|
+
export interface QuotaDetail {
|
|
1480
|
+
/** Which quota was exhausted (open enum; unknown values fall back). */
|
|
1481
|
+
limitKind: LimitKind;
|
|
1482
|
+
/** Epoch milliseconds at which the provider says usage resets. */
|
|
1483
|
+
resetsAtMs: number;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1257
1486
|
/** The reasoning-effort tier sampled at submission (tdd SS3.2, SS3.3). The **same closed tier vocabulary** on both the fresh-turn and steer lanes, spelled identically; invalid tiers are invalid params. `none` is a tier of the vocabulary (ask for no reasoning), not a way to say "unset". */
|
|
1258
1487
|
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
|
|
1259
1488
|
|
|
@@ -1268,6 +1497,60 @@ export interface ReasoningEffortState {
|
|
|
1268
1497
|
source: ReasoningEffortChangeSource;
|
|
1269
1498
|
}
|
|
1270
1499
|
|
|
1500
|
+
/** `recap/cancel` params (tdd SS3.28.5): the session plus the cancel's own retry id. No target — one in-flight slot per session makes the target unambiguous. */
|
|
1501
|
+
export interface RecapCancelParams {
|
|
1502
|
+
/** The cancel's own retry id (required, SS3.1.1). */
|
|
1503
|
+
commandId: string;
|
|
1504
|
+
/** The session whose in-flight recap to cancel (required). */
|
|
1505
|
+
sessionId: string;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
/** `recap/cancel` result (tdd SS3.28.5): admission only. In flight → the recap settles `cancelled`; idle → accepted no-op. */
|
|
1509
|
+
export interface RecapCancelResult {
|
|
1510
|
+
/** The cancel's id, echoed. */
|
|
1511
|
+
commandId: string;
|
|
1512
|
+
/** Always `accepted` on this path. */
|
|
1513
|
+
status: CommandStatus;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/** `recap/completed` params (tdd SS3.28.2): the settlement, delivered to the requesting connection outside the view stream — no `viewCursor`, no `sourceRange`. `text` is required on `completed` (plus optional `title`, untrusted model output — clients MUST sanitize per spec 442 INV-015); `reason` is required on `failed`; neither rides `cancelled`/`timedOut`. The struct marks the conditional members optional; the SS prose pins the per-outcome rule, the `turn/completed` usage/error convention. */
|
|
1517
|
+
export interface RecapCompletedParams {
|
|
1518
|
+
/** The request's id — the correlation key. */
|
|
1519
|
+
commandId: string;
|
|
1520
|
+
/** How the request settled. */
|
|
1521
|
+
outcome: RecapOutcome;
|
|
1522
|
+
/** Why the side-call failed (on `failed`). */
|
|
1523
|
+
reason?: RecapFailureReason;
|
|
1524
|
+
/** The recapped session. */
|
|
1525
|
+
sessionId: string;
|
|
1526
|
+
/** The recap text verbatim (on `completed`). */
|
|
1527
|
+
text?: string;
|
|
1528
|
+
/** The model-produced short title (on `completed`, when produced). */
|
|
1529
|
+
title?: string;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/** `recap/completed` failure reason (tdd SS3.28.2/SS3.28.8): post-ack failures fold to the single initial value. **Open**: later splits stay additive (#22785 E2). */
|
|
1533
|
+
export type RecapFailureReason = "providerFailed" | (string & {});
|
|
1534
|
+
|
|
1535
|
+
/** `recap/completed` outcome (tdd SS3.28.2): the terminal vocabulary, camelCase per SS1.6. **Open**: a server-produced result vocabulary (#22785 E2). */
|
|
1536
|
+
export type RecapOutcome = "completed" | "failed" | "cancelled" | "timedOut" | (string & {});
|
|
1537
|
+
|
|
1538
|
+
/** `recap/request` params (tdd SS3.28.1): the session plus the client-minted UUIDv7 retry id. No other param; unknown fields are `invalidParams`. */
|
|
1539
|
+
export interface RecapRequestParams {
|
|
1540
|
+
/** The client-minted retry id (required, SS3.1.1). */
|
|
1541
|
+
commandId: string;
|
|
1542
|
+
/** The session to recap (required). */
|
|
1543
|
+
sessionId: string;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/** `recap/request` result (tdd SS3.28.1): admission only — the ack is never the recap. */
|
|
1547
|
+
export interface RecapRequestResult {
|
|
1548
|
+
/** The request's id, echoed. */
|
|
1549
|
+
commandId: string;
|
|
1550
|
+
/** Always `accepted` on this path. */
|
|
1551
|
+
status: CommandStatus;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1271
1554
|
/** One end of a [`SourceRange`]: a record's event id and its sequence number within the stream (tdd SS4.2). */
|
|
1272
1555
|
export interface RecordPosition {
|
|
1273
1556
|
/** The record's event id. */
|
|
@@ -1297,6 +1580,15 @@ export type RequestId = number | string;
|
|
|
1297
1580
|
export interface RequestReceipt {
|
|
1298
1581
|
}
|
|
1299
1582
|
|
|
1583
|
+
/** A `turn/retracted` settlement outcome (tdd SS4.5.1, ADR 50074 D1). Open enum (D-033): decode is tolerant — a value outside the list reads as `Accepted` (the event's historical meaning — pre-feature hosts emit it only for accepted retracts), never fails. The bundle keeps enumerating the known values for codegen and docs. */
|
|
1584
|
+
export type RetractOutcome = "accepted" | "declined" | (string & {});
|
|
1585
|
+
|
|
1586
|
+
/** Whether this host can enforce the sandbox (ADR 50064-startup-report-sandbox-availability D2/D4). A property of the host process, probed once at construction and identical for every session and every connection it serves — never requested, granted, or negotiated, which is why it is not a capability. Open: a future enforcement posture arrives as a new value, read by older clients as unknown. */
|
|
1587
|
+
export type SandboxAvailability = "available" | "unavailable" | (string & {});
|
|
1588
|
+
|
|
1589
|
+
/** Why sandbox enforcement is impossible on this host. Sent only when [`SandboxAvailability`] is `unavailable`; a client MUST NOT infer a reason when none is sent. Open: a future reason arrives as a new value, read by older clients as unknown. */
|
|
1590
|
+
export type SandboxUnavailableReason = "userNamespacesDenied" | "bubblewrapUnavailable" | (string & {});
|
|
1591
|
+
|
|
1300
1592
|
/** The `schema` pair in [`InitializeResult`] (SS1.4.1, SS1.5.3). `version` is the wire **envelope** schema version — distinct from the session-view `schemaVersion`, the raw-log `schema_version`, and the 0.x/1.0 stability posture, which is not on the wire at all (INV-006a). */
|
|
1301
1593
|
export interface SchemaInfo {
|
|
1302
1594
|
/** `sha256:<64 lower hex>` content hash of this server binary's stable-surface bundle (INV-003). A mismatch is a warning condition, not an error (SS1.4.1). */
|
|
@@ -1339,6 +1631,8 @@ export interface Session {
|
|
|
1339
1631
|
modelId: string | null;
|
|
1340
1632
|
/** The durable allocated session name (tdd SS2.4/SS2.14.1, #27598; ADR 27598 D2/D4). **Additive-optional**: present when the serving path holds an allocated name, omitted otherwise — absent is never fabricated. Authoritative and renameable via `session/rename`. */
|
|
1341
1633
|
name?: string;
|
|
1634
|
+
/** How the served `name` was set (tdd SS2.4/SS2.14.1, #50048; ADR 50048 D1/D2). **Additive-optional**, **fold-only**: the snapshot fold (`session/read`, the resume/start/fork-ack snapshot) derives and carries it from the log; `session/list` rows never carry it. Absent — and any value the client does not recognize — reads as unknown, never fabricated. */
|
|
1635
|
+
nameOrigin?: SessionNameOrigin;
|
|
1342
1636
|
/** The containing session's id when `kind` is `"subagent"` (FR-002, INV-002) — the id of the TOP-LEVEL session whose home holds this child, which is **not necessarily the session that spawned it**: native-child homes are physical siblings under the outer session's `subagent/` directory, so a subagent spawned by another subagent resolves to the outer session, not to its spawner. A client building a tree from this field gets one level, not a chain. Flat rather than nested: there is exactly one fact to carry, unlike `forkedFrom`'s four-field `ForkProvenance`. **Additive-optional**; a root carries none. */
|
|
1343
1637
|
parentSessionId?: string;
|
|
1344
1638
|
/** Absolute path of the session's durable log; non-nullable. Under the ephemeral session profile it is the **empty string**, meaning "no durable log exists" (tdd SS2.13.2) — the one value a client must not hand to a filesystem call. */
|
|
@@ -1348,7 +1642,7 @@ export interface Session {
|
|
|
1348
1642
|
/** The session identity. */
|
|
1349
1643
|
sessionId: string;
|
|
1350
1644
|
/** `null` for root sessions and forks; side provenance otherwise (tdd SS2.4/SS2.5.7; ADR 45435 D2). A session carries at most one of `forkedFrom` and `sideFrom`. */
|
|
1351
|
-
sideFrom?: SideProvenance;
|
|
1645
|
+
sideFrom?: SideProvenance | null;
|
|
1352
1646
|
/** Load state as this host knows it; `session/list` reports `notLoaded` for sessions loaded by *other* hosts (tdd SS2.4). */
|
|
1353
1647
|
status: SessionStatus;
|
|
1354
1648
|
/** Derived display title (tdd SS2.14.1, #27598): a heuristic that may evolve — its carriage, not its derivation, is the contract. **Additive-optional**, omitted when underivable. */
|
|
@@ -1382,7 +1676,7 @@ export interface SessionApprovalModeChangedParams {
|
|
|
1382
1676
|
/** `session/branchChanged` params (tdd SS4.6.4): a durable workspace-branch observation landed. */
|
|
1383
1677
|
export interface SessionBranchChangedParams {
|
|
1384
1678
|
/** The observed branch; `null` on a detached-HEAD observation — a fact, not "unchanged" (tdd SS4.6.4). */
|
|
1385
|
-
branch
|
|
1679
|
+
branch: string | null;
|
|
1386
1680
|
/** The owning session. */
|
|
1387
1681
|
sessionId: string;
|
|
1388
1682
|
/** The durable records this event folded from. */
|
|
@@ -1480,7 +1774,7 @@ export interface SessionForkResult {
|
|
|
1480
1774
|
/** `session/goalChanged` params (tdd SS4.6.2): the projected goal block's value changed — identical adoptions emit nothing (the change gate), and an explicit `null` clears. Replace wholesale; `null` never means unchanged. */
|
|
1481
1775
|
export interface SessionGoalChangedParams {
|
|
1482
1776
|
/** The full current goal block, or `null` to clear. */
|
|
1483
|
-
goal
|
|
1777
|
+
goal: Goal | null;
|
|
1484
1778
|
/** The owning session. */
|
|
1485
1779
|
sessionId: string;
|
|
1486
1780
|
/** The durable records this event folded from. */
|
|
@@ -1583,7 +1877,7 @@ export interface SessionModelChangedParams {
|
|
|
1583
1877
|
/** The selected model. */
|
|
1584
1878
|
modelId: string;
|
|
1585
1879
|
/** The selected provider; `null` when the selection names none. */
|
|
1586
|
-
providerId
|
|
1880
|
+
providerId: string | null;
|
|
1587
1881
|
/** The owning session. */
|
|
1588
1882
|
sessionId: string;
|
|
1589
1883
|
/** What drove the selection. */
|
|
@@ -1603,7 +1897,7 @@ export interface SessionModelRouteUnservedParams {
|
|
|
1603
1897
|
/** The standing (still bound, now unroutable) model. */
|
|
1604
1898
|
modelId: string;
|
|
1605
1899
|
/** The standing model's provider; `null` when the selection names none. */
|
|
1606
|
-
providerId
|
|
1900
|
+
providerId: string | null;
|
|
1607
1901
|
/** The owning session. */
|
|
1608
1902
|
sessionId: string;
|
|
1609
1903
|
/** The durable records this event folded from. */
|
|
@@ -1616,6 +1910,8 @@ export interface SessionModelRouteUnservedParams {
|
|
|
1616
1910
|
export interface SessionNameChangedParams {
|
|
1617
1911
|
/** The new canonical name now in effect. */
|
|
1618
1912
|
name: string;
|
|
1913
|
+
/** How the new name was set (tdd SS2.4/SS4.6.7, #50048; ADR 50048 D1/D2). **Additive-optional**: omitted when the emitting fold cannot prove an origin — absent reads as unknown, never fabricated. */
|
|
1914
|
+
nameOrigin?: SessionNameOrigin;
|
|
1619
1915
|
/** The owning session. */
|
|
1620
1916
|
sessionId: string;
|
|
1621
1917
|
/** The durable records this event folded from. */
|
|
@@ -1624,6 +1920,9 @@ export interface SessionNameChangedParams {
|
|
|
1624
1920
|
viewCursor: string;
|
|
1625
1921
|
}
|
|
1626
1922
|
|
|
1923
|
+
/** How the served session name was set (tdd SS2.4/SS4.6.7, #50048; ADR 50048 D1). **Open enum** (`x-msp-openness: open`): v1 serves `automatic` and `custom`; a client MUST read absent — and any value it does not recognize — as unknown, never fabricated. Open: a future source such as conversation-generated names (#35260) adds a value here, so closed would make that a breaking change. */
|
|
1924
|
+
export type SessionNameOrigin = "automatic" | "custom" | (string & {});
|
|
1925
|
+
|
|
1627
1926
|
/** `session/read` params (tdd SS2.5.5): read one stored session **without attaching** — no writer lease, no load, no subscription, no `SessionResumed` record. */
|
|
1628
1927
|
export interface SessionReadParams {
|
|
1629
1928
|
/** Metadata-only unless you ask: `false` carries the folded item history. Same name and polarity as `session/resume`/`session/fork`; only the default differs — here it is `true` (tdd SS2.5.5). */
|
|
@@ -1798,6 +2097,8 @@ export interface SessionStartParams {
|
|
|
1798
2097
|
config?: SessionConfig;
|
|
1799
2098
|
/** Initial model; server default when omitted. */
|
|
1800
2099
|
modelId?: string;
|
|
2100
|
+
/** The new session's initial permission profile (amendment 42624 FR-42624-1, ADR 42197 D2): a profile id the host catalog already admits — the rows `permissionProfile/list` serves without `sessionId`. Select, never create. Omitted means today's behavior: the host's configured default under native admission, unchanged. An id the catalog does not carry, or one it serves unavailable, refuses the start `commandRejected` (-32030; `permission_profile_unknown` / `permission_profile_unavailable`) before any durable byte, and an ephemeral host refuses any id (`permission_profile_ephemeral_fixed`). `session/resume` and `session/fork` do not admit the member. Explicit `null` is invalid params: the set of members that tolerate `null` is closed and excludes this one, exactly as it excludes `workspaceRoots`. */
|
|
2101
|
+
permissionProfile?: string;
|
|
1801
2102
|
/** Initial provider routing; server default when omitted or explicit `null` — both spellings select the default (#23468). */
|
|
1802
2103
|
providerId?: string | null;
|
|
1803
2104
|
/** Exact identity for this new root session. When omitted the server mints a UUIDv7. This field never selects an existing session: a retained or reserved id is rejected `commandRejected` with reason `session_id_conflict` (tdd SS2.5.1). */
|
|
@@ -1862,7 +2163,7 @@ export interface SessionTokenUsageParams {
|
|
|
1862
2163
|
/** Provider finish reason when reported (open vocabulary, verbatim). */
|
|
1863
2164
|
finishReason?: string;
|
|
1864
2165
|
/** The effective model that produced this usage; `null` on pre-schema records — never back-filled, an unpriced leg (tdd SS4.6.5). */
|
|
1865
|
-
modelId
|
|
2166
|
+
modelId: string | null;
|
|
1866
2167
|
/** Prompt tokens counted exactly once under the provider's cache convention (#8803). Server-derived; deterministic — the provider is in the log. */
|
|
1867
2168
|
promptTokens: number;
|
|
1868
2169
|
/** The owning session. */
|
|
@@ -1948,6 +2249,73 @@ export interface SkillChangedParams {
|
|
|
1948
2249
|
sessionId: string;
|
|
1949
2250
|
}
|
|
1950
2251
|
|
|
2252
|
+
/** The four receipt-list lengths (tdd SS3.30.2): a client renders counts without walking lists. */
|
|
2253
|
+
export interface SkillImportCounts {
|
|
2254
|
+
/** `failed.len()`. */
|
|
2255
|
+
failed: number;
|
|
2256
|
+
/** `installed.len()`. */
|
|
2257
|
+
installed: number;
|
|
2258
|
+
/** `quarantined.len()`. */
|
|
2259
|
+
quarantined: number;
|
|
2260
|
+
/** `skipped.len()`. */
|
|
2261
|
+
skipped: number;
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/** One import candidate that could neither install nor quarantine (tdd SS3.30.2): recorded so the run continues past it. `id` is null when the candidate never yielded one — present-but-null, never omitted. */
|
|
2265
|
+
export interface SkillImportFailure {
|
|
2266
|
+
/** The candidate's id, or null when it never yielded one. */
|
|
2267
|
+
id: string | null;
|
|
2268
|
+
/** Why the candidate failed. */
|
|
2269
|
+
reason: string;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
/** `skill/import` params (tdd SS3.30.2, #45433): import foreign skills through the single `SkillsService::import_skills` seam. */
|
|
2273
|
+
export interface SkillImportParams {
|
|
2274
|
+
/** The SS3.1.1 idempotency handle (UUIDv7) — required even for `dryRun` previews. */
|
|
2275
|
+
commandId: string;
|
|
2276
|
+
/** Preview for the consent UI; writes nothing. Additive-optional, default false. */
|
|
2277
|
+
dryRun?: boolean;
|
|
2278
|
+
/** Re-import over already-imported ids (the CLI `--force` twin). Additive-optional, default false. */
|
|
2279
|
+
force?: boolean;
|
|
2280
|
+
/** The target session. */
|
|
2281
|
+
sessionId: string;
|
|
2282
|
+
/** The foreign ecosystem to import from. */
|
|
2283
|
+
source: SkillImportSource;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
/** One quarantined import candidate (tdd SS3.30.2): kept, not loaded. */
|
|
2287
|
+
export interface SkillImportQuarantine {
|
|
2288
|
+
/** The candidate's id. */
|
|
2289
|
+
id: string;
|
|
2290
|
+
/** The quarantine reasons. */
|
|
2291
|
+
reasons: string[];
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
/** `skill/import` result (tdd SS3.30.2, #45433): the ack envelope plus the service receipt projection. */
|
|
2295
|
+
export interface SkillImportResult {
|
|
2296
|
+
/** Echoes the client's id. */
|
|
2297
|
+
commandId: string;
|
|
2298
|
+
/** The four list lengths. */
|
|
2299
|
+
counts: SkillImportCounts;
|
|
2300
|
+
/** Echoes the call's preview flag. */
|
|
2301
|
+
dryRun: boolean;
|
|
2302
|
+
/** Candidates that could neither install nor quarantine. Import never aborts the whole run on one bad candidate. */
|
|
2303
|
+
failed: SkillImportFailure[];
|
|
2304
|
+
/** The ids the run installed, in pipeline order. */
|
|
2305
|
+
installed: string[];
|
|
2306
|
+
/** Kept, not loaded, with reasons. */
|
|
2307
|
+
quarantined: SkillImportQuarantine[];
|
|
2308
|
+
/** Ids the run did not install: already-imported ids and in-run duplicates, verbatim from the seam's `skipped` vec. */
|
|
2309
|
+
skipped: string[];
|
|
2310
|
+
/** Echoes the call's ecosystem. */
|
|
2311
|
+
source: SkillImportSource;
|
|
2312
|
+
/** Admission status. */
|
|
2313
|
+
status: CommandStatus;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/** `skill/import` foreign ecosystem (tdd SS3.30.2). **Closed**: a client-selected write vocabulary (ADR 45433 D2) — a write must fail an ecosystem the host does not implement rather than import from an unknown dir. The host resolves its own foreign dir (the `foreign_skills_sources` derivation); no client paths cross the wire. */
|
|
2317
|
+
export type SkillImportSource = "claude" | "codex";
|
|
2318
|
+
|
|
1951
2319
|
/** `skill/list` params (tdd SS3.22.1, SS3.30.3). Per-session because skill scope follows the session's workspace and plugin state. */
|
|
1952
2320
|
export interface SkillListParams {
|
|
1953
2321
|
/** The target session. */
|
|
@@ -2018,7 +2386,7 @@ export interface SnapshotState {
|
|
|
2018
2386
|
/** Every item, in first-opened order, each at its latest revision at the snapshot cursor. One schema per kind, shared with the notification item object — which is what makes snapshot+suffix a pure splice (tdd SS4.9.1). */
|
|
2019
2387
|
items: Item[];
|
|
2020
2388
|
/** The settled canonical session name; `null` when the session was never named (#27598, tdd SS4.9.1 / SS2.14). Folds the same durable `session/nameChanged` record `Session.name` reports. */
|
|
2021
|
-
name?: string;
|
|
2389
|
+
name?: string | null;
|
|
2022
2390
|
/** The pending-approval half of the pending set. */
|
|
2023
2391
|
pendingApprovals: PendingApprovalPointer[];
|
|
2024
2392
|
/** The pending-user-input half of the pending set. */
|
|
@@ -2393,12 +2761,14 @@ export interface TurnError {
|
|
|
2393
2761
|
kind: TurnErrorKind;
|
|
2394
2762
|
/** Human-readable failure text. */
|
|
2395
2763
|
message: string;
|
|
2764
|
+
/** Typed quota-exhaustion detail (ADR 50047 D2/D3): present iff the stopping failure was the quota class. Clients branch on presence, never by parsing `message`. */
|
|
2765
|
+
quota?: QuotaDetail;
|
|
2396
2766
|
/** The server's judgment that resubmitting the same input may succeed. */
|
|
2397
2767
|
retryable: boolean;
|
|
2398
2768
|
}
|
|
2399
2769
|
|
|
2400
2770
|
/** Turn failure classes (tdd SS4.5.1, `TerminalErrorKind` plus the model-task failure class). Open. */
|
|
2401
|
-
export type TurnErrorKind = "stepLimit" | "configError" | "projectionError" | "logError" | "workflowLaunchError" | "environmentError" | "modelError" | "launchError" | "authRequired" | (string & {});
|
|
2771
|
+
export type TurnErrorKind = "stepLimit" | "configError" | "projectionError" | "logError" | "workflowLaunchError" | "environmentError" | "modelError" | "launchError" | "authRequired" | "mcpLinkError" | (string & {});
|
|
2402
2772
|
|
|
2403
2773
|
/** `turn/foregroundCompleted` params (tdd SS4.5.12): the turn's foreground work is done and named background reminder checks hold the turn open. Explicitly non-terminal: the turn ends only at `turn/completed` / `turn/unqueued`. */
|
|
2404
2774
|
export interface TurnForegroundCompletedParams {
|
|
@@ -2473,10 +2843,12 @@ export interface TurnRef {
|
|
|
2473
2843
|
turnId: string;
|
|
2474
2844
|
}
|
|
2475
2845
|
|
|
2476
|
-
/** `turn/retracted` params (tdd SS4.5.1): an interrupt-paired retract
|
|
2846
|
+
/** `turn/retracted` params (tdd SS4.5.1): an interrupt-paired retract durably settled, accepted or declined (ADR 50074 D1). On `"accepted"` the retracted user-message item is re-emitted via `item/updated` with `retracted: true`; on `"declined"` the client folds the legacy declined rollback instead and no item is re-emitted. */
|
|
2477
2847
|
export interface TurnRetractedParams {
|
|
2478
2848
|
/** The retracted submission's command id. */
|
|
2479
2849
|
commandId: string;
|
|
2850
|
+
/** The retract settlement outcome (tdd SS4.5.1, ADR 50074 D1). Additive-optional: absent reads as `"accepted"` — pre-feature hosts emit the event only for accepted retracts — and so does an unrecognized value (open enum, D-033). */
|
|
2851
|
+
outcome?: RetractOutcome;
|
|
2480
2852
|
/** The owning session. */
|
|
2481
2853
|
sessionId: string;
|
|
2482
2854
|
/** The durable records this event folded from. */
|
|
@@ -2491,6 +2863,10 @@ export interface TurnRetractedParams {
|
|
|
2491
2863
|
export interface TurnRetryScheduledParams {
|
|
2492
2864
|
/** The attempt that failed (producer-normalized, >= 1). */
|
|
2493
2865
|
attempt: number;
|
|
2866
|
+
/** The failing model attempt's durable kind, verbatim (ADR 50047 D2/D3) — a plain string: the durable vocabulary is open-ended. */
|
|
2867
|
+
errorKind?: string;
|
|
2868
|
+
/** The failing model attempt's HTTP status (ADR 50047 D2/D3). */
|
|
2869
|
+
httpStatus?: number;
|
|
2494
2870
|
/** The turn's model-retry chain bound. */
|
|
2495
2871
|
maxAttempts: number;
|
|
2496
2872
|
/** The attempt about to run (producer contract: attempt < nextAttempt <= maxAttempts; not a schema constraint). */
|
|
@@ -2503,6 +2879,8 @@ export interface TurnRetryScheduledParams {
|
|
|
2503
2879
|
sessionId: string;
|
|
2504
2880
|
/** The durable record this event folded from (the session stream's mirror of the retry-scheduled task status; `first == last`). */
|
|
2505
2881
|
sourceRange: SourceRange;
|
|
2882
|
+
/** The failing model attempt's provider system, verbatim (ADR 50047 D2/D3) — e.g. `"meta"`. Absent when no model-attempt facet precedes the retry status on the task (old logs). */
|
|
2883
|
+
system?: string;
|
|
2506
2884
|
/** The running turn whose model attempt is being retried. */
|
|
2507
2885
|
turnId: string;
|
|
2508
2886
|
/** Opaque, strictly monotonic view cursor (tdd SS4.1). */
|
|
@@ -2512,7 +2890,7 @@ export interface TurnRetryScheduledParams {
|
|
|
2512
2890
|
/** What `turn/start` did with the input (tdd SS3.2). Resolves OQ-H in v1: since `queue` is the default `ifBusy`, clients need to distinguish these without folding history. */
|
|
2513
2891
|
export type TurnStartDisposition = "started" | "queued" | "steered" | (string & {});
|
|
2514
2892
|
|
|
2515
|
-
/** `turn/start.providerRequestOptions` is deliberately absent: **RULED (#22785 E3, owner, 2026-08-26) to stay off the published schema.** The schema is the contract, and a free-form-object node kind is revisited only if the experimental field graduates.
|
|
2893
|
+
/** `turn/start` params (tdd SS3.2). `turn/start.providerRequestOptions` is deliberately absent: **RULED (#22785 E3, owner, 2026-08-26) to stay off the published schema.** The schema is the contract, and a free-form-object node kind is revisited only if the experimental field graduates. */
|
|
2516
2894
|
export interface TurnStartParams {
|
|
2517
2895
|
/** The SS3.1.1 idempotency handle (UUIDv7). The fresh turn's `turnId` derives from it (tdd SS3.1.4). */
|
|
2518
2896
|
commandId: string;
|
|
@@ -2526,6 +2904,8 @@ export interface TurnStartParams {
|
|
|
2526
2904
|
reasoningEffort?: ReasoningEffort;
|
|
2527
2905
|
/** The target session. */
|
|
2528
2906
|
sessionId: string;
|
|
2907
|
+
/** A queued `!` shell action riding this turn (tdd SS3.2, ADR 50034): the `!cmd` typed while a turn runs, executed at the next model-call boundary before any later steer. Exclusive with `text` and `skill` input; `input` may be empty only when this member is present. Capability-gated on `userShell`: a carrying turn on a connection without the grant fails `-32010 capabilityRequired`. Explicit `null` is invalid params (the null-tolerant set is closed). A v1 stable member. */
|
|
2908
|
+
userShell?: TurnUserShell;
|
|
2529
2909
|
/** A sticky REPLACEMENT of the session's runtime workspace-root set, binding at this turn's launch and persisting for subsequent turns until replaced again — unlike `reasoningEffort`, which is this-turn-only. Same shape and validation as `session/start.workspaceRoots`; invalid params on an explicit `ifBusy: "steer"` submit and so is explicit `null` (the D-049 null-tolerant set is closed); omitted means "unchanged", never "reset" (tdd SS3.2, ADR 37313 D3, #37313). */
|
|
2530
2910
|
workspaceRoots?: string[];
|
|
2531
2911
|
}
|
|
@@ -2619,6 +2999,12 @@ export interface TurnUnqueuedParams {
|
|
|
2619
2999
|
viewCursor: string;
|
|
2620
3000
|
}
|
|
2621
3001
|
|
|
3002
|
+
/** The queued `!` shell action a `turn/start` carries (tdd SS3.2, ADR 50034): the `!cmd` typed while a turn runs. The shell's command id derives from the carrying turn's `commandId`, exactly as the app's own queued submit does; the params' sibling `displayText` carries the `!…` presentation form. */
|
|
3003
|
+
export interface TurnUserShell {
|
|
3004
|
+
/** The shell command text, without the leading `!`. */
|
|
3005
|
+
commandText: string;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
2622
3008
|
/** One element of a `view/page` result's `events` array: an **unframed view notification** exactly as tdd SS4.2.1 defines it — the nested pair `{"method", "params"}`, which is the live notification minus `jsonrpc` and `emittedAtMs`, with nothing lifted out of `params` and nothing spliced into it. SS4.2.1 is the single normative definition; SS4.7.3 and SS7.4 both cite it, so the two surfaces cannot drift. */
|
|
2623
3009
|
export interface UnframedViewNotification {
|
|
2624
3010
|
/** The event type — the live notification's method name, retained because the type lives only in the notification name and would otherwise be lost (tdd SS4.2.1). */
|
|
@@ -2977,6 +3363,26 @@ export interface WorkflowPauseParams {
|
|
|
2977
3363
|
workflowRunId: string;
|
|
2978
3364
|
}
|
|
2979
3365
|
|
|
3366
|
+
/** `workflow/resume` params (tdd SS3.34, ADR 45437 D3): resume a paused workflow run, host-driven. */
|
|
3367
|
+
export interface WorkflowResumeParams {
|
|
3368
|
+
/** The SS3.1.1 idempotency handle (UUIDv7). */
|
|
3369
|
+
commandId: string;
|
|
3370
|
+
/** The target session. */
|
|
3371
|
+
sessionId: string;
|
|
3372
|
+
/** The paused run to resume, exactly as the `workflow` item names it (SS4.5.8); required, non-empty. */
|
|
3373
|
+
workflowRunId: string;
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
/** `workflow/resume` result (tdd SS3.34): admission-only plus the driven turn — always present, since resume always drives (idle fresh turn or busy steer). */
|
|
3377
|
+
export interface WorkflowResumeResult {
|
|
3378
|
+
/** Echoes the client's id. */
|
|
3379
|
+
commandId: string;
|
|
3380
|
+
/** Admission status. */
|
|
3381
|
+
status: CommandStatus;
|
|
3382
|
+
/** The turn the host drove: the fresh resume turn on an idle session, the admission-time active turn on a busy session (a routing fact like the SS3.18 wake-gate's, not settlement). */
|
|
3383
|
+
turnId: string;
|
|
3384
|
+
}
|
|
3385
|
+
|
|
2980
3386
|
/** `workflow`: the run's launch token budget (tdd SS4.5.8, #45449). */
|
|
2981
3387
|
export interface WorkflowTokenBudget {
|
|
2982
3388
|
/** The effective launch budget in tokens, verbatim from the launch fact. */
|
|
@@ -2984,10 +3390,10 @@ export interface WorkflowTokenBudget {
|
|
|
2984
3390
|
}
|
|
2985
3391
|
|
|
2986
3392
|
/** Every wire method in this schema (SS1.9 index). */
|
|
2987
|
-
export type MspMethod = "initialize" | "subagent/sendMessage" | "subagent/followupTask" | "subagent/interrupt" | "subagent/stop" | "subagent/resume" | "subagent/reopen" | "subagent/close" | "subagent/readResult" | "session/start" | "session/resume" | "session/fork" | "session/list" | "session/read" | "session/sideChat" | "turn/start" | "turn/steer" | "turn/interrupt" | "turn/cancel" | "turn/unqueue" | "session/compact" | "session/setModel" | "session/rename" | "session/setReasoningEffort" | "session/userShell" | "model/list" | "skill/list" | "skill/setActivation" | "hook/list" | "plugin/list" | "task/background" | "task/stop" | "task/stopAll" | "goal/set" | "goal/edit" | "goal/clear" | "goal/pause" | "goal/resume" | "workflow/cancel" | "workflow/childControl" | "workflow/pause" | "media/upload" | "view/subscribe" | "view/unsubscribe" | "view/page" | "item/readOutput" | "approval/decide" | "approval/listPending" | "session/setApprovalMode" | "userInput/answer" | "userInput/cancel" | "userInput/clarify" | "userInput/interrupt" | "usage/read" | "feedback/submit" | "computerUseSettings/read" | "computerUseSettings/update";
|
|
3393
|
+
export type MspMethod = "initialize" | "subagent/sendMessage" | "subagent/followupTask" | "subagent/interrupt" | "subagent/stop" | "subagent/resume" | "subagent/reopen" | "subagent/close" | "subagent/readResult" | "session/start" | "session/resume" | "session/fork" | "session/list" | "session/read" | "session/sideChat" | "turn/start" | "turn/steer" | "turn/interrupt" | "turn/cancel" | "turn/unqueue" | "session/compact" | "session/setModel" | "session/rename" | "session/setReasoningEffort" | "session/userShell" | "model/list" | "skill/list" | "skill/setActivation" | "skill/import" | "hook/list" | "plugin/list" | "plugin/install" | "plugin/marketplaceAdd" | "plugin/marketplaceUpdate" | "plugin/marketplaceRemove" | "task/background" | "task/stop" | "task/stopAll" | "task/list" | "goal/set" | "goal/edit" | "goal/clear" | "goal/pause" | "goal/resume" | "workflow/cancel" | "workflow/childControl" | "workflow/pause" | "workflow/resume" | "media/upload" | "view/subscribe" | "view/unsubscribe" | "view/page" | "item/readOutput" | "approval/decide" | "approval/listPending" | "session/setApprovalMode" | "userInput/answer" | "userInput/cancel" | "userInput/clarify" | "userInput/interrupt" | "usage/read" | "feedback/submit" | "recap/request" | "recap/cancel" | "computerUseSettings/read" | "computerUseSettings/update" | "computerUseSetup/read" | "computerUseSetup/start" | "computerUseSetup/check";
|
|
2988
3394
|
/** Every wire notification in this schema (SS1.9 index). */
|
|
2989
|
-
export type MspNotification = "initialized" | "session/started" | "session/closed" | "skill/changed" | "turn/started" | "turn/completed" | "turn/retracted" | "turn/retryScheduled" | "turn/unqueued" | "turn/foregroundCompleted" | "item/started" | "item/updated" | "item/delta" | "item/completed" | "view/gap" | "approval/requested" | "approval/updated" | "approval/resolved" | "userInput/requested" | "userInput/settled" | "userInput/engaged" | "session/modelChanged" | "session/reasoningEffortChanged" | "session/statusChanged" | "session/goalChanged" | "session/todoListChanged" | "session/branchChanged" | "session/tokenUsage" | "session/contextUsage" | "session/approvalModeChanged" | "session/modelRouteUnserved" | "session/nameChanged" | "session/viewHealthChanged" | "session/listChanged" | "usage/changed";
|
|
3395
|
+
export type MspNotification = "initialized" | "session/started" | "session/closed" | "skill/changed" | "turn/started" | "turn/completed" | "turn/retracted" | "turn/retryScheduled" | "turn/unqueued" | "turn/foregroundCompleted" | "item/started" | "item/updated" | "item/delta" | "item/completed" | "view/gap" | "approval/requested" | "approval/updated" | "approval/resolved" | "userInput/requested" | "userInput/settled" | "userInput/engaged" | "session/modelChanged" | "session/reasoningEffortChanged" | "session/statusChanged" | "session/goalChanged" | "session/todoListChanged" | "session/branchChanged" | "session/tokenUsage" | "session/contextUsage" | "session/approvalModeChanged" | "recap/completed" | "session/modelRouteUnserved" | "session/nameChanged" | "session/viewHealthChanged" | "session/listChanged" | "usage/changed" | "computerUseSetup/changed" | "plugin/changed" | "plugin/marketplaceChanged";
|
|
2990
3396
|
/** Every server-initiated wire request in this schema (SS5.3/SS5.10.1 index). */
|
|
2991
3397
|
export type MspServerRequest = "approval/request" | "userInput/request";
|
|
2992
3398
|
/** Every error `data.kind` in this schema's error table (SS1.6) — each code's primary kind plus its override kinds. */
|
|
2993
|
-
export type MspErrorDataKind = "parseError" | "invalidRequest" | "notInitialized" | "alreadyInitialized" | "methodNotFound" | "experimentalRequired" | "invalidParams" | "internal" | "pageEventTooLarge" | "outputResultTooLarge" | "overloaded" | "inputTooLarge" | "capabilityRequired" | "notFound" | "interrupted" | "cancelled" | "sessionNotFound" | "sessionInUse" | "sessionAmbiguous" | "forkBoundaryInvalid" | "sessionNotLoaded" | "sessionStreamMismatch" | "commandRejected" | "backpressured" | "skillNotFound" | "computerUseUnavailable" | "uploadNotFound" | "viewTruncated" | "outputUnavailable" | "boundaryPruned" | "boundaryUnusable" | "noBoundary" | "approvalNotFound" | "approvalAlreadyResolved" | "approvalChoiceInvalid" | "approvalRequirementStale" | "approvalReviewerUnavailable" | "userInputNotFound" | "userInputAlreadySettled" | "userInputAnswerInvalid";
|
|
3399
|
+
export type MspErrorDataKind = "parseError" | "invalidRequest" | "notInitialized" | "alreadyInitialized" | "methodNotFound" | "experimentalRequired" | "invalidParams" | "internal" | "pageEventTooLarge" | "outputResultTooLarge" | "overloaded" | "inputTooLarge" | "capabilityRequired" | "notFound" | "interrupted" | "cancelled" | "sessionNotFound" | "sessionInUse" | "sessionAmbiguous" | "forkBoundaryInvalid" | "sessionNotLoaded" | "sessionStreamMismatch" | "commandRejected" | "backpressured" | "skillNotFound" | "computerUseUnavailable" | "marketplaceNotFound" | "pluginNotFound" | "marketplaceAlreadyExists" | "pluginMutationsDisabled" | "uploadNotFound" | "viewTruncated" | "outputUnavailable" | "boundaryPruned" | "boundaryUnusable" | "noBoundary" | "approvalNotFound" | "approvalAlreadyResolved" | "approvalChoiceInvalid" | "approvalRequirementStale" | "approvalReviewerUnavailable" | "userInputNotFound" | "userInputAlreadySettled" | "userInputAnswerInvalid";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muse-code/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "TypeScript SDK for the Muse Session Protocol (MSP): connect to a Muse Code session, drive turns, and fold the event stream. Zero runtime dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/meta-models/muse-code-sdk",
|