@muse-code/sdk 1.4.7 → 1.4.9
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/facade/client.js +3 -1
- package/dist/src/facade/session.js +2 -0
- package/dist/src/fingerprint.d.ts +1 -1
- package/dist/src/fingerprint.js +1 -1
- package/dist/src/fold/session-fold.d.ts +28 -4
- package/dist/src/fold/session-fold.js +33 -2
- package/dist/src/msp.d.ts +107 -6
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ const START_FORWARDED = [
|
|
|
60
60
|
* Every `ResumeParams` member `resumeSession` forwards. `config` has the same
|
|
61
61
|
* temporary capability-check boundary as the start facade above.
|
|
62
62
|
*/
|
|
63
|
-
const RESUME_FORWARDED = ["sessionId", "cursor", "excludeItems", "history"];
|
|
63
|
+
const RESUME_FORWARDED = ["sessionId", "cursor", "excludeItems", "history", "permissionProfile"];
|
|
64
64
|
/**
|
|
65
65
|
* The committed profile id a session snapshot claims, or null when the
|
|
66
66
|
* snapshot is silent (the stable bundle strips the member; absent and null
|
|
@@ -340,6 +340,8 @@ export class MuseClient {
|
|
|
340
340
|
params.excludeItems = options.excludeItems;
|
|
341
341
|
if (options.history != null)
|
|
342
342
|
params.history = options.history;
|
|
343
|
+
if (options.permissionProfile != null)
|
|
344
|
+
params.permissionProfile = options.permissionProfile;
|
|
343
345
|
return this.#open("session/resume", params, (raw) => ({
|
|
344
346
|
result: raw,
|
|
345
347
|
verb: "session/resume",
|
|
@@ -277,7 +277,9 @@ export class Session {
|
|
|
277
277
|
case "view/gap":
|
|
278
278
|
case "turn/retracted": // the turn still reaches its own terminal
|
|
279
279
|
case "turn/retryScheduled": // non-terminal by contract (SS4.5.1)
|
|
280
|
+
case "turn/modelRetryScheduled": // non-terminal by contract (SS4.5.1)
|
|
280
281
|
case "turn/foregroundCompleted": // non-terminal by contract (SS4.5.12)
|
|
282
|
+
case "approval/reviewing": // reviewer-held twin of approval/requested (tdd SS5.5.1): a notice, no decide is open
|
|
281
283
|
case "approval/resolved":
|
|
282
284
|
case "userInput/requested":
|
|
283
285
|
case "userInput/settled":
|
|
@@ -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:5d3b43e5ccdb7dc4f5a32c380f5f2cde0f10e3059b93610afb2e73f73b1d914c";
|
|
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:5d3b43e5ccdb7dc4f5a32c380f5f2cde0f10e3059b93610afb2e73f73b1d914c";
|
|
17
17
|
/**
|
|
18
18
|
* What a build-time mismatch MEANS, in the words a human needs at 2am.
|
|
19
19
|
*
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* are neither an item nor a state family:
|
|
14
14
|
*
|
|
15
15
|
* - the TURN LIFECYCLE — `turn/started`, `turn/completed`, `turn/retracted`,
|
|
16
|
-
* `turn/unqueued`, and the non-terminal `turn/retryScheduled
|
|
17
|
-
* `turn/foregroundCompleted`;
|
|
16
|
+
* `turn/unqueued`, and the non-terminal `turn/retryScheduled`,
|
|
17
|
+
* `turn/modelRetryScheduled`, and `turn/foregroundCompleted`;
|
|
18
18
|
* - the APPROVAL and USER-INPUT view events as fold INPUTS — the pending
|
|
19
19
|
* sets and their first durable terminal. The decision flow (choosing and
|
|
20
20
|
* sending a resolution) is the facade's, not the fold's;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* unrecognized `TurnTerminal` is kept verbatim, and a second resolution never
|
|
28
28
|
* displaces the first durable one.
|
|
29
29
|
*/
|
|
30
|
-
import type { ApprovalRequestParams, ApprovalResolvedParams, ApprovalUpdatedParams, Item, ItemCompletedParams, ItemDeltaParams, ItemStartedParams, ItemUpdatedParams, MspNotification, SessionApprovalModeChangedParams, SessionBranchChangedParams, SessionContextUsageParams, SessionGoalChangedParams, SessionModelChangedParams, SessionModelRouteUnservedParams, SessionNameChangedParams, SessionReasoningEffortChangedParams, SessionTodoListChangedParams, SessionTokenUsageParams, TurnCompletedParams, TurnError, TurnForegroundCompletedParams, TurnRetractedParams, TurnRetryScheduledParams, TurnStartedParams, TurnTerminal, TurnUnqueuedParams, UserInputRequestParams, UserInputSettledParams, ViewGapParams } from "../msp.js";
|
|
30
|
+
import type { ApprovalRequestParams, ApprovalResolvedParams, ApprovalUpdatedParams, Item, ItemCompletedParams, ItemDeltaParams, ItemStartedParams, ItemUpdatedParams, MspNotification, SessionApprovalModeChangedParams, SessionBranchChangedParams, SessionContextUsageParams, SessionGoalChangedParams, SessionModelChangedParams, SessionModelRouteUnservedParams, SessionNameChangedParams, SessionReasoningEffortChangedParams, SessionTodoListChangedParams, SessionTokenUsageParams, TurnCompletedParams, TurnError, TurnForegroundCompletedParams, TurnModelRetryScheduledParams, TurnRetractedParams, TurnRetryScheduledParams, TurnStartedParams, TurnTerminal, TurnUnqueuedParams, UserInputRequestParams, UserInputSettledParams, ViewGapParams } from "../msp.js";
|
|
31
31
|
import type { DeltaApplyOutcome, ItemApplyOutcome, TerminalUnknownItemAnnotation } from "./item-store.js";
|
|
32
32
|
import type { StateApplyOutcome, StateValue } from "./state-store.js";
|
|
33
33
|
/** The session-state families, each keyed in the store by its method name. */
|
|
@@ -60,12 +60,18 @@ export type ViewEvent = {
|
|
|
60
60
|
} | {
|
|
61
61
|
readonly method: "turn/retryScheduled";
|
|
62
62
|
readonly params: TurnRetryScheduledParams;
|
|
63
|
+
} | {
|
|
64
|
+
readonly method: "turn/modelRetryScheduled";
|
|
65
|
+
readonly params: TurnModelRetryScheduledParams;
|
|
63
66
|
} | {
|
|
64
67
|
readonly method: "turn/unqueued";
|
|
65
68
|
readonly params: TurnUnqueuedParams;
|
|
66
69
|
} | {
|
|
67
70
|
readonly method: "approval/requested";
|
|
68
71
|
readonly params: ApprovalRequestParams;
|
|
72
|
+
} | {
|
|
73
|
+
readonly method: "approval/reviewing";
|
|
74
|
+
readonly params: ApprovalRequestParams;
|
|
69
75
|
} | {
|
|
70
76
|
readonly method: "approval/updated";
|
|
71
77
|
readonly params: ApprovalUpdatedParams;
|
|
@@ -218,7 +224,7 @@ export type SessionStateMethod = ViewEvent["method"] & `session/${string}`;
|
|
|
218
224
|
* and could never match exhaustively. A future arm that starts dropping
|
|
219
225
|
* widens this deliberately (PR #23087 review round).
|
|
220
226
|
*/
|
|
221
|
-
export type StaleDroppableMethod = "turn/started" | "turn/completed" | "turn/foregroundCompleted" | "turn/retryScheduled" | "approval/requested" | "approval/updated" | "userInput/requested";
|
|
227
|
+
export type StaleDroppableMethod = "turn/started" | "turn/completed" | "turn/foregroundCompleted" | "turn/retryScheduled" | "turn/modelRetryScheduled" | "approval/requested" | "approval/updated" | "userInput/requested";
|
|
222
228
|
/**
|
|
223
229
|
* The `NoStaleViewArm` sibling for the union above: these are hand-typed
|
|
224
230
|
* literals, so without this pin a typo'd or later-retired member compiles
|
|
@@ -241,6 +247,13 @@ export interface TurnEntry {
|
|
|
241
247
|
readonly error?: TurnError;
|
|
242
248
|
/** The latest scheduled model retry; non-terminal (tdd SS4.5.1, D-026). */
|
|
243
249
|
readonly retryScheduled?: TurnRetryScheduledParams;
|
|
250
|
+
/**
|
|
251
|
+
* The latest scheduled provider-backoff retry; non-terminal
|
|
252
|
+
* (tdd SS4.5.1, ADR 50047 D1/D2). The model-attempt twin of
|
|
253
|
+
* `retryScheduled`: a failing model attempt's backoff is waiting out
|
|
254
|
+
* its delay. Clears on the turn's terminal.
|
|
255
|
+
*/
|
|
256
|
+
readonly modelRetryScheduled?: TurnModelRetryScheduledParams;
|
|
244
257
|
/**
|
|
245
258
|
* The latest foreground-completed notice; non-terminal (tdd SS4.5.12).
|
|
246
259
|
* Tells a renderer the answer is done while `blockingAgents` hold the
|
|
@@ -281,6 +294,17 @@ export type FoldOutcome = {
|
|
|
281
294
|
| {
|
|
282
295
|
readonly kind: "sessionState";
|
|
283
296
|
readonly outcome: DeepReadonly<StateApplyOutcome<SessionStateParams>>;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* `approval/reviewing` (tdd SS5.5.1, spec 209 FR-52080-1): the native
|
|
300
|
+
* reviewer holds this approval. A typed-activity NOTICE, never a pending
|
|
301
|
+
* entry — the approval is absent from `pendingRequests` and no decide is
|
|
302
|
+
* open until `approval/requested` releases it (or `approval/resolved`
|
|
303
|
+
* settles it) on the same id. Ids only, so nothing here needs sealing.
|
|
304
|
+
*/
|
|
305
|
+
| {
|
|
306
|
+
readonly kind: "approvalReviewing";
|
|
307
|
+
readonly approvalId: string;
|
|
284
308
|
} | {
|
|
285
309
|
readonly kind: "approvalPending";
|
|
286
310
|
readonly approvalId: string;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* are neither an item nor a state family:
|
|
14
14
|
*
|
|
15
15
|
* - the TURN LIFECYCLE — `turn/started`, `turn/completed`, `turn/retracted`,
|
|
16
|
-
* `turn/unqueued`, and the non-terminal `turn/retryScheduled
|
|
17
|
-
* `turn/foregroundCompleted`;
|
|
16
|
+
* `turn/unqueued`, and the non-terminal `turn/retryScheduled`,
|
|
17
|
+
* `turn/modelRetryScheduled`, and `turn/foregroundCompleted`;
|
|
18
18
|
* - the APPROVAL and USER-INPUT view events as fold INPUTS — the pending
|
|
19
19
|
* sets and their first durable terminal. The decision flow (choosing and
|
|
20
20
|
* sending a resolution) is the facade's, not the fold's;
|
|
@@ -163,10 +163,14 @@ export class SessionFold {
|
|
|
163
163
|
return this.#turnUnqueued(typed.params);
|
|
164
164
|
case "turn/retryScheduled":
|
|
165
165
|
return this.#turnRetryScheduled(typed.params);
|
|
166
|
+
case "turn/modelRetryScheduled":
|
|
167
|
+
return this.#turnModelRetryScheduled(typed.params);
|
|
166
168
|
case "turn/foregroundCompleted":
|
|
167
169
|
return this.#turnForegroundCompleted(typed.params);
|
|
168
170
|
case "approval/requested":
|
|
169
171
|
return this.#approvalRequested(typed.params);
|
|
172
|
+
case "approval/reviewing":
|
|
173
|
+
return this.#approvalReviewing(typed.params);
|
|
170
174
|
case "approval/updated":
|
|
171
175
|
return this.#approvalUpdated(typed.params);
|
|
172
176
|
case "approval/resolved":
|
|
@@ -268,6 +272,9 @@ export class SessionFold {
|
|
|
268
272
|
// turn's next event — which a completion is (tdd SS4.5.1). Leaving it set
|
|
269
273
|
// makes a renderer show the countdown on a finished turn.
|
|
270
274
|
turn.retryScheduled = undefined;
|
|
275
|
+
// Same for the provider-backoff hint: a finished turn is not waiting
|
|
276
|
+
// out a backoff (tdd SS4.5.1).
|
|
277
|
+
turn.modelRetryScheduled = undefined;
|
|
271
278
|
// Same for the foreground hint: a finished turn is not background-waiting
|
|
272
279
|
// (tdd SS4.5.12).
|
|
273
280
|
turn.foregroundCompleted = undefined;
|
|
@@ -313,6 +320,18 @@ export class SessionFold {
|
|
|
313
320
|
turn.retryScheduled = params;
|
|
314
321
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
|
315
322
|
}
|
|
323
|
+
#turnModelRetryScheduled(params) {
|
|
324
|
+
// Non-terminal by contract: it never resolves a turn-wait (tdd SS4.5.1).
|
|
325
|
+
const turn = this.#turnFor(params.turnId);
|
|
326
|
+
// …but it is still a turn frame, so it takes the same redelivery guard
|
|
327
|
+
// as the retry hint: a replayed page must not re-plant the
|
|
328
|
+
// provider-backoff hint on a turn that already left `running`.
|
|
329
|
+
if (turn.state !== "running") {
|
|
330
|
+
return { kind: "ignoredStaleFrame", method: "turn/modelRetryScheduled", id: params.turnId };
|
|
331
|
+
}
|
|
332
|
+
turn.modelRetryScheduled = params;
|
|
333
|
+
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
|
334
|
+
}
|
|
316
335
|
#turnForegroundCompleted(params) {
|
|
317
336
|
// Non-terminal by contract: it never resolves a turn-wait (tdd SS4.5.12).
|
|
318
337
|
const turn = this.#turnFor(params.turnId);
|
|
@@ -345,6 +364,9 @@ export class SessionFold {
|
|
|
345
364
|
...(turn.terminal !== undefined ? { terminal: turn.terminal } : {}),
|
|
346
365
|
...(turn.error !== undefined ? { error: turn.error } : {}),
|
|
347
366
|
...(turn.retryScheduled !== undefined ? { retryScheduled: turn.retryScheduled } : {}),
|
|
367
|
+
...(turn.modelRetryScheduled !== undefined
|
|
368
|
+
? { modelRetryScheduled: turn.modelRetryScheduled }
|
|
369
|
+
: {}),
|
|
348
370
|
...(turn.foregroundCompleted !== undefined
|
|
349
371
|
? { foregroundCompleted: turn.foregroundCompleted }
|
|
350
372
|
: {}),
|
|
@@ -382,6 +404,15 @@ export class SessionFold {
|
|
|
382
404
|
this.#pendingApprovals.set(params.approvalId, { requested: params });
|
|
383
405
|
return { kind: "approvalPending", approvalId: params.approvalId, requested: params };
|
|
384
406
|
}
|
|
407
|
+
#approvalReviewing(params) {
|
|
408
|
+
// The reviewer-held twin of `approval/requested` (tdd SS5.5.1): typed
|
|
409
|
+
// activity, not a request. It opens NO pending entry — a client that
|
|
410
|
+
// showed a decision card here would defeat the presentation hold that
|
|
411
|
+
// spec 209 FR-52080-1 exists for — and touches no other store; the
|
|
412
|
+
// release arrives as `approval/requested` (or `approval/resolved`) on
|
|
413
|
+
// this id.
|
|
414
|
+
return { kind: "approvalReviewing", approvalId: params.approvalId };
|
|
415
|
+
}
|
|
385
416
|
#approvalUpdated(params) {
|
|
386
417
|
// An update REFRESHES a pending view; it never opens one. An update for an
|
|
387
418
|
// approval this fold never saw requested (a pre-join frame) is dropped
|
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" | "computerUseSetup" | "computerUseHostSetup" | (string & {});
|
|
248
|
+
export type CapabilityName = "userShell" | "sessionMcp" | "sessionListStream" | "feedback" | "computerUseSetup" | "computerUseHostSetup" | "sessionRename" | (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 {
|
|
@@ -320,6 +320,36 @@ export type CompactionOutcome = "compacted" | "noop" | "failed" | "cancelled" |
|
|
|
320
320
|
/** What initiated a compaction (tdd SS4.5.10). Open. */
|
|
321
321
|
export type CompactionTrigger = "manual" | "auto" | (string & {});
|
|
322
322
|
|
|
323
|
+
/** One row of the Settings apps list. */
|
|
324
|
+
export interface ComputerUseApp {
|
|
325
|
+
/** The app's bundle ID: the stored key. */
|
|
326
|
+
bundleId: string;
|
|
327
|
+
/** The choice as it applies: a block wins over a grant. */
|
|
328
|
+
choice: ComputerUseAppChoice;
|
|
329
|
+
/** When Computer Use last showed an approval card for the app, RFC3339 UTC; absent when it never has. */
|
|
330
|
+
lastAskedAt?: string;
|
|
331
|
+
/** Settings can't change this row; its choice is `blocked`. Omitted means false. */
|
|
332
|
+
locked?: boolean;
|
|
333
|
+
/** Why the row is locked, when it is. */
|
|
334
|
+
lockedBy?: ComputerUseAppLock;
|
|
335
|
+
/** The name the approval card shows for it, else the name stored with its grant or its last card; absent when there is none. */
|
|
336
|
+
name?: string;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** A per-app choice. **Open**, like `ComputerUseChoice`. */
|
|
340
|
+
export type ComputerUseAppChoice = "ask" | "alwaysAllow" | "blocked" | (string & {});
|
|
341
|
+
|
|
342
|
+
/** Why Settings can't change a row. **Open**. */
|
|
343
|
+
export type ComputerUseAppLock = "builtIn" | "file" | (string & {});
|
|
344
|
+
|
|
345
|
+
/** One per-app choice to set in `computerUseSettings/update`. */
|
|
346
|
+
export interface ComputerUseAppPatch {
|
|
347
|
+
/** The app's bundle ID. */
|
|
348
|
+
bundleId: string;
|
|
349
|
+
/** `ask` removes the app's grant and the user's block; `alwaysAllow` saves a grant and removes the user's block; `blocked` adds the user's block and removes the grant. */
|
|
350
|
+
choice: ComputerUseAppChoice;
|
|
351
|
+
}
|
|
352
|
+
|
|
323
353
|
/** One row of the Settings blocked-apps list. */
|
|
324
354
|
export interface ComputerUseBlockedApp {
|
|
325
355
|
/** The app's bundle ID, or the family prefix when `prefix` is true. */
|
|
@@ -333,27 +363,43 @@ export interface ComputerUseBlockedApp {
|
|
|
333
363
|
/** 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
364
|
export type ComputerUseChoice = "ask" | "alwaysAllow" | (string & {});
|
|
335
365
|
|
|
366
|
+
/** One installed or running app, for Settings' app picker. */
|
|
367
|
+
export interface ComputerUseInstalledApp {
|
|
368
|
+
/** The app's bundle ID. */
|
|
369
|
+
bundleId: string;
|
|
370
|
+
/** The name the approval card shows for it. */
|
|
371
|
+
name: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
336
374
|
/** One macOS permission as setup last saw it. **Open**, like the phase. */
|
|
337
375
|
export type ComputerUsePermission = "granted" | "missing" | "unknown" | (string & {});
|
|
338
376
|
|
|
339
377
|
/** `computerUseSettings/read` result, also answered by `computerUseSettings/update`. */
|
|
340
378
|
export interface ComputerUseSettings {
|
|
379
|
+
/** The apps list: apps Computer Use has asked about, most recent first; then the other saved grants, then the user's other blocks; then the locked rows. Each app once. A host that serves the list always answers it, so its absence means an older host. */
|
|
380
|
+
apps?: ComputerUseApp[];
|
|
341
381
|
/** The user's blocks in the order they were added, then the built-in blocks when `showBuiltIns` asked for them. */
|
|
342
382
|
blockedApps: ComputerUseBlockedApp[];
|
|
343
383
|
/** The computer-control dropdown, as it applies: `ask` while the stored blocked-apps list can't be read (ADR 630 D18.4). */
|
|
344
384
|
computerControl: ComputerUseChoice;
|
|
385
|
+
/** The installed and running apps, sorted by name, when the read asked for `installed`. */
|
|
386
|
+
installedApps?: ComputerUseInstalledApp[];
|
|
345
387
|
/** The screenshots dropdown, under the same rule. */
|
|
346
388
|
screenshots: ComputerUseChoice;
|
|
347
389
|
}
|
|
348
390
|
|
|
349
391
|
/** `computerUseSettings/read` params. */
|
|
350
392
|
export interface ComputerUseSettingsReadParams {
|
|
393
|
+
/** Also answer `installedApps`, for an app picker. Omitted means false. */
|
|
394
|
+
installed?: boolean;
|
|
351
395
|
/** Also list the built-in blocks as locked rows (the D18.8 toggle). Omitted means false. */
|
|
352
396
|
showBuiltIns?: boolean;
|
|
353
397
|
}
|
|
354
398
|
|
|
355
399
|
/** `computerUseSettings/update` params: a patch. Omitted members are left alone; the whole patch applies or none of it does. */
|
|
356
400
|
export interface ComputerUseSettingsUpdateParams {
|
|
401
|
+
/** Per-app choices to set. A locked app is refused; so is a bundle ID named twice, or also in `blockApps` or `unblockApps`. */
|
|
402
|
+
apps?: ComputerUseAppPatch[];
|
|
357
403
|
/** Bundle IDs to add to the user's blocked apps. A built-in block is refused: it is already blocked. */
|
|
358
404
|
blockApps?: string[];
|
|
359
405
|
/** The new computer-control dropdown value. */
|
|
@@ -820,6 +866,8 @@ export interface Item {
|
|
|
820
866
|
declaredPhase?: string;
|
|
821
867
|
/** `subagent`: nesting depth. */
|
|
822
868
|
depth?: number;
|
|
869
|
+
/** `toolCall`: the tool's own words for this call; absent = none (tdd SS4.5.5). */
|
|
870
|
+
displayLabel?: ToolDisplayLabel;
|
|
823
871
|
/** `userMessage`: presentation form (tdd SS3.2); absent when the client sent none. */
|
|
824
872
|
displayText?: string;
|
|
825
873
|
/** `userShell`/`subagent`: observed wall-clock duration. `workflow`: the run's wall time from launch to reconciliation, set only on the settling `item/completed` — never a sum of child durations. */
|
|
@@ -852,8 +900,14 @@ export interface Item {
|
|
|
852
900
|
label?: string;
|
|
853
901
|
/** `workflow`: the reconciled terminal message, set on completion. */
|
|
854
902
|
message?: string;
|
|
903
|
+
/** `agentMessage`: the phase the model declared on the commit; see [`MessagePhase`]. */
|
|
904
|
+
messagePhase?: MessagePhase;
|
|
855
905
|
/** `toolCall`: rich content the model saw beyond text; base64 is not inlined on the view (tdd SS4.5.5). */
|
|
856
906
|
modelVisibleContent?: ModelVisibleContent[];
|
|
907
|
+
/** `monitorFeed`: the monitor's arm-time description with the durable `"Monitor event: "` summary prefix stripped; model- controlled tool input under the 64 KiB per-surface budget — sanitize before render (ADR 50058-monitor-feed-wire D1/D3). */
|
|
908
|
+
monitorDescription?: string;
|
|
909
|
+
/** `monitorFeed`: the monitor task id — the same value as that monitor's `toolCall` `itemId` (ADR 50058-monitor-feed-wire D1). */
|
|
910
|
+
monitorId?: string;
|
|
857
911
|
/** `subagent`: objective as spawned, bounded on the wire at the 64 KiB retained-text budget (tdd SS4.5.4, ADR 35691 D9); a cut sets `truncated`. The durable record stays verbatim. */
|
|
858
912
|
objective?: string;
|
|
859
913
|
/** `compaction`: terminal only — folds installed/fallback status. */
|
|
@@ -936,9 +990,9 @@ export interface Item {
|
|
|
936
990
|
trigger?: CompactionTrigger;
|
|
937
991
|
/** `workflow`: camelCased `WorkflowLaunchTriggerSource`, verbatim (durable runtime vocabulary, e.g. `"modelProposal"`). */
|
|
938
992
|
triggerSource?: string;
|
|
939
|
-
/** `true` when the server's per-surface text budget saturated a streamed surface (`agentMessage.text`, `reasoning.summary[*]`, `toolCall.visibleOutput`, `userShell.visibleOutput`),
|
|
993
|
+
/** `true` when the server's per-surface text budget saturated a streamed surface (`agentMessage.text`, `reasoning.summary[*]`, `toolCall.visibleOutput`, `userShell.visibleOutput`), cut a `subagent` surface (`objective`, `fallbackText`, `result.summary`, `result.text`), or cut a `monitorFeed` surface (`text`, `fallbackText`, `monitorDescription`) (ADR 50058-monitor-feed-wire D3). On a `subagent` item the flag is item-level and never cleared: once any of those four is cut, every later update keeps it, even when `result.text` arrives whole (ADR 35691 D9). The durable full text remains in the log (tdd SS4.5.4). */
|
|
940
994
|
truncated?: boolean;
|
|
941
|
-
/** The owning turn (== the submitting `commandId` for fresh turns, tdd SS3.1.4). `null`
|
|
995
|
+
/** The owning turn (== the submitting `commandId` for fresh turns, tdd SS3.1.4). `null` for the kinds outside a turn: `userShell` always (tdd SS4.5.6), `hookRun` for session-boundary runs, `monitorFeed` always (ADR 50058-monitor-feed-wire D1). */
|
|
942
996
|
turnId?: string | null;
|
|
943
997
|
/** `subagent`: **transitive** observed usage — the child and its own descendants; updated in place, absent until first observation; never folded into `session/tokenUsage.cumulative` (tdd SS4.6.5). */
|
|
944
998
|
usage?: TokenUsage;
|
|
@@ -975,7 +1029,7 @@ export interface ItemDeltaParams {
|
|
|
975
1029
|
}
|
|
976
1030
|
|
|
977
1031
|
/** 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 & {});
|
|
1032
|
+
export type ItemKind = "userMessage" | "agentMessage" | "reasoning" | "toolCall" | "userShell" | "subagent" | "workflow" | "reminderChild" | "compaction" | "hookRun" | "sideChat" | "webSearch" | "monitorFeed" | (string & {});
|
|
979
1033
|
|
|
980
1034
|
/** 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. */
|
|
981
1035
|
export type ItemReadOutputEncoding = "utf8" | "base64";
|
|
@@ -1095,6 +1149,9 @@ export interface MessageAttachment {
|
|
|
1095
1149
|
width?: number;
|
|
1096
1150
|
}
|
|
1097
1151
|
|
|
1152
|
+
/** `agentMessage.messagePhase` (tdd SS4.5.3, #50254): the phase the model declared on the commit, never inferred from position. Set on the completed item only; absent on `item/started`, which opens before the phase is recorded. Open: a client reads an absent or unknown value on a completed item as `"finalAnswer"` and still decodes the item. Not a turn-done signal; `turn/completed` is. */
|
|
1153
|
+
export type MessagePhase = "commentary" | "finalAnswer" | (string & {});
|
|
1154
|
+
|
|
1098
1155
|
/** One visible catalog row (tdd SS3.10). Catalog rows marked hidden never reach the wire, so a client cannot select one. */
|
|
1099
1156
|
export interface ModelCatalogEntry {
|
|
1100
1157
|
/** Context limit; `null` when the catalog source declared nothing. */
|
|
@@ -1623,6 +1680,8 @@ export interface Session {
|
|
|
1623
1680
|
firstUserPrompt?: string;
|
|
1624
1681
|
/** `null` for root sessions; fork provenance otherwise (tdd SS2.4). */
|
|
1625
1682
|
forkedFrom: ForkProvenance | null;
|
|
1683
|
+
/** The served generated short title (tdd SS2.4/SS2.14.1, #50048; ADR 50048-generated-name D1). **Additive-optional**, **fold-only**: the snapshot fold derives the latest retained generated pair's short title from the log; `session/list` rows never carry it. Omitted when no pair was ever published — absent reads as unpublished, never fabricated, never inferred from the name text. `name` stays the canonical name it always was. */
|
|
1684
|
+
generatedName?: string;
|
|
1626
1685
|
/** What kind of session this is (spec 42713 FR-001, ADR 42713 D1/D4). **Open enum**, v1 values `"root"` and `"subagent"`; a client treats an unknown value as an unknown-but-present kind and renders it, never rejecting the row. **Additive-optional**: absence asserts nothing — the host could not determine the home shape (FM-001), or the value is not yet available to serve (FM-003). */
|
|
1627
1686
|
kind?: SessionKind;
|
|
1628
1687
|
/** Content-activity recency, RFC3339 (tdd SS2.4, ADR 31983 D5). **Additive-optional**: omitted when no content record exists. Never advanced by lifecycle bookkeeping (the resume marker, re-stamps) or a fork's copied seed-replay records, and never precedes `createdAt`. */
|
|
@@ -1908,6 +1967,8 @@ export interface SessionModelRouteUnservedParams {
|
|
|
1908
1967
|
|
|
1909
1968
|
/** `session/nameChanged` params (tdd SS4.6.7, #27598): the fold of ANY durable session-name record — the FIRST-NAMING automatic allocate as well as an accepted `session/rename` (or the same in-process runtime command). Replace-wholesale like every SS4.6 sibling. */
|
|
1910
1969
|
export interface SessionNameChangedParams {
|
|
1970
|
+
/** The latest retained generated short title (tdd SS2.4/SS4.6.7, #50048; ADR 50048-generated-name D1). **Additive-optional**: carried at generated-pair publication and at settlement when a pair is already published; omitted when no pair was ever published — absent reads as unpublished, never fabricated. `name` stays canonical. */
|
|
1971
|
+
generatedName?: string;
|
|
1911
1972
|
/** The new canonical name now in effect. */
|
|
1912
1973
|
name: string;
|
|
1913
1974
|
/** 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. */
|
|
@@ -1991,6 +2052,8 @@ export interface SessionResumeParams {
|
|
|
1991
2052
|
excludeItems?: boolean;
|
|
1992
2053
|
/** History mode preference, default `auto`. A PREFERENCE, not a budget override: when the requested mode does not fit the history budget the server downgrades it and `history.mode` reports what was actually served (tdd SS2.5.2). Ignored when `cursor` or `excludeItems` makes it moot. */
|
|
1993
2054
|
history?: HistoryPreference;
|
|
2055
|
+
/** The launch permission-profile pick (amendment 42624 FR-42624-1, #50054): a profile id the host catalog already admits. Select, never create. Omitted means today's behavior: restore retained authority only, no override. The host restores first, then applies the pick in the same pre-marker step; a pick that fails admission refuses the resume `commandRejected` (-32030; `permission_profile_unknown` / `permission_profile_unavailable`) before any durable byte. Explicit `null` is invalid params (the same closed null-tolerant set as at start). */
|
|
2056
|
+
permissionProfile?: string;
|
|
1994
2057
|
/** The session to load. */
|
|
1995
2058
|
sessionId: string;
|
|
1996
2059
|
}
|
|
@@ -2097,7 +2160,7 @@ export interface SessionStartParams {
|
|
|
2097
2160
|
config?: SessionConfig;
|
|
2098
2161
|
/** Initial model; server default when omitted. */
|
|
2099
2162
|
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/
|
|
2163
|
+
/** 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/fork` does not admit the member; `session/resume` admits it as the launch pick (FR-42624-1, #50054). Explicit `null` is invalid params: the set of members that tolerate `null` is closed and excludes this one, exactly as it excludes `workspaceRoots`. */
|
|
2101
2164
|
permissionProfile?: string;
|
|
2102
2165
|
/** Initial provider routing; server default when omitted or explicit `null` — both spellings select the default (#23468). */
|
|
2103
2166
|
providerId?: string | null;
|
|
@@ -2241,6 +2304,8 @@ export interface SkillCatalogEntry {
|
|
|
2241
2304
|
selector: string;
|
|
2242
2305
|
/** Where the skill comes from. */
|
|
2243
2306
|
source: SkillSource;
|
|
2307
|
+
/** The skill's declared human-readable name (`SKILL.md` `metadata.display-name`), for clients to show where people read the skill's name; absent when the skill declares none (ADR 56597 D2). The palette keeps showing `displayName`. */
|
|
2308
|
+
title?: string;
|
|
2244
2309
|
}
|
|
2245
2310
|
|
|
2246
2311
|
/** `skill/changed` params (tdd SS3.22.2): the session's user-invocable set changed; clients re-issue `skill/list`. Advisory — the host may coalesce bursts and guarantees no ordering relative to view events (ADR 32471 D3). */
|
|
@@ -2695,6 +2760,16 @@ export interface TokenUsage {
|
|
|
2695
2760
|
reasoningTokens: number;
|
|
2696
2761
|
}
|
|
2697
2762
|
|
|
2763
|
+
/** `toolCall.displayLabel`: the call's words in three forms, each one line of plain text, always present together. The item's `status` picks the form. */
|
|
2764
|
+
export interface ToolDisplayLabel {
|
|
2765
|
+
/** Shown while the call runs (`inProgress`), e.g. "Setting up Computer Use". */
|
|
2766
|
+
active: string;
|
|
2767
|
+
/** Shown after the call succeeds (`completed`), e.g. "Set up Computer Use". */
|
|
2768
|
+
done: string;
|
|
2769
|
+
/** Shown for every other status (failed, rejected, timed out, cancelled), beside that status; never implies success. */
|
|
2770
|
+
neutral: string;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2698
2773
|
export type ToolReceipt = { details?: CronReceipt; family: "cron"; operation: ToolReceiptOperation; outcome: ToolReceiptOutcome; } | { details?: CodeModeReceipt; family: "codeMode"; operation: ToolReceiptOperation; outcome: ToolReceiptOutcome; } | { details?: Record<string, unknown>; family: string; operation: string; outcome: string; };
|
|
2699
2774
|
|
|
2700
2775
|
/** Which operation within the family the receipt describes (ADR 43399 D1/D2). Open — registered per family, never derived from the tool name. */
|
|
@@ -2831,6 +2906,32 @@ export interface TurnInterruptResult {
|
|
|
2831
2906
|
turnId: string;
|
|
2832
2907
|
}
|
|
2833
2908
|
|
|
2909
|
+
/** `turn/modelRetryScheduled` params (tdd SS4.5.1; ADR `50047-model-retry-scheduled-members` D1): a durable model-stream retry-scheduled fact folded — the provider backoff behind one model attempt is observable BEFORE the turn terminates, so a streaming client can render "system words · retrying in Ss · attempt N/M" instead of dead air. Non-terminal: it never resolves a turn-wait. The sibling `turn/retryScheduled` shape at the model layer: same member names and semantics (attempt/nextAttempt/maxAttempts/ retryDelayMs/system/errorKind/httpStatus), minus `reason` — the row's words derive from `errorKind` through the shared gate-off mapping, and the recorded machine message is not user text. The delay is the recorded scheduled backoff, never an absolute fire time — clients derive any countdown locally. `sourceRange` cites the session stream's mirror of the task-lifecycle record (tdd SS4.2). */
|
|
2910
|
+
export interface TurnModelRetryScheduledParams {
|
|
2911
|
+
/** The failed model attempt (producer-normalized, >= 1). */
|
|
2912
|
+
attempt: number;
|
|
2913
|
+
/** The failing model attempt's durable kind, verbatim (ADR 50047 D2) — a plain string: the durable vocabulary is open-ended. */
|
|
2914
|
+
errorKind?: string;
|
|
2915
|
+
/** The failing model attempt's HTTP status (ADR 50047 D2). */
|
|
2916
|
+
httpStatus?: number;
|
|
2917
|
+
/** The model-retry chain bound. */
|
|
2918
|
+
maxAttempts: number;
|
|
2919
|
+
/** The scheduled model attempt (producer contract: attempt < nextAttempt <= maxAttempts; not a schema constraint). */
|
|
2920
|
+
nextAttempt: number;
|
|
2921
|
+
/** The scheduled backoff delay in milliseconds, verbatim from the durable fact. */
|
|
2922
|
+
retryDelayMs: number;
|
|
2923
|
+
/** The owning session. */
|
|
2924
|
+
sessionId: string;
|
|
2925
|
+
/** The durable record this event folded from (the session stream's mirror of the scheduled model task status; `first == last`). */
|
|
2926
|
+
sourceRange: SourceRange;
|
|
2927
|
+
/** The failing model attempt's provider system, verbatim (ADR 50047 D2) — e.g. `"meta"`. Always present from this producer (the durable `system` is a required `String`); optional on the wire so a future omission folds absent instead of failing the frame. */
|
|
2928
|
+
system?: string;
|
|
2929
|
+
/** The running turn whose model attempt is being retried. */
|
|
2930
|
+
turnId: string;
|
|
2931
|
+
/** Opaque, strictly monotonic view cursor (tdd SS4.1). */
|
|
2932
|
+
viewCursor: string;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2834
2935
|
/** A turn named by the snapshot's active/queued lists (tdd SS4.9.1). */
|
|
2835
2936
|
export interface TurnRef {
|
|
2836
2937
|
/** The `commandId` of the submit that minted it. */
|
|
@@ -3392,7 +3493,7 @@ export interface WorkflowTokenBudget {
|
|
|
3392
3493
|
/** Every wire method in this schema (SS1.9 index). */
|
|
3393
3494
|
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";
|
|
3394
3495
|
/** Every wire notification in this schema (SS1.9 index). */
|
|
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";
|
|
3496
|
+
export type MspNotification = "initialized" | "session/started" | "session/closed" | "skill/changed" | "turn/started" | "turn/completed" | "turn/retracted" | "turn/retryScheduled" | "turn/modelRetryScheduled" | "turn/unqueued" | "turn/foregroundCompleted" | "item/started" | "item/updated" | "item/delta" | "item/completed" | "view/gap" | "approval/requested" | "approval/updated" | "approval/reviewing" | "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";
|
|
3396
3497
|
/** Every server-initiated wire request in this schema (SS5.3/SS5.10.1 index). */
|
|
3397
3498
|
export type MspServerRequest = "approval/request" | "userInput/request";
|
|
3398
3499
|
/** Every error `data.kind` in this schema's error table (SS1.6) — each code's primary kind plus its override kinds. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muse-code/sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
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",
|