@muse-code/sdk 1.4.8 → 1.4.10
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.
|
@@ -279,6 +279,7 @@ export class Session {
|
|
|
279
279
|
case "turn/retryScheduled": // non-terminal by contract (SS4.5.1)
|
|
280
280
|
case "turn/modelRetryScheduled": // non-terminal by contract (SS4.5.1)
|
|
281
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
|
|
282
283
|
case "approval/resolved":
|
|
283
284
|
case "userInput/requested":
|
|
284
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
|
*
|
|
@@ -69,6 +69,9 @@ export type ViewEvent = {
|
|
|
69
69
|
} | {
|
|
70
70
|
readonly method: "approval/requested";
|
|
71
71
|
readonly params: ApprovalRequestParams;
|
|
72
|
+
} | {
|
|
73
|
+
readonly method: "approval/reviewing";
|
|
74
|
+
readonly params: ApprovalRequestParams;
|
|
72
75
|
} | {
|
|
73
76
|
readonly method: "approval/updated";
|
|
74
77
|
readonly params: ApprovalUpdatedParams;
|
|
@@ -221,7 +224,7 @@ export type SessionStateMethod = ViewEvent["method"] & `session/${string}`;
|
|
|
221
224
|
* and could never match exhaustively. A future arm that starts dropping
|
|
222
225
|
* widens this deliberately (PR #23087 review round).
|
|
223
226
|
*/
|
|
224
|
-
export type StaleDroppableMethod = "turn/started" | "turn/completed" | "turn/foregroundCompleted" | "turn/retryScheduled" | "turn/modelRetryScheduled" | "approval/requested" | "approval/updated" | "userInput/requested";
|
|
227
|
+
export type StaleDroppableMethod = "turn/started" | "turn/completed" | "turn/retracted" | "turn/foregroundCompleted" | "turn/retryScheduled" | "turn/modelRetryScheduled" | "approval/requested" | "approval/updated" | "userInput/requested";
|
|
225
228
|
/**
|
|
226
229
|
* The `NoStaleViewArm` sibling for the union above: these are hand-typed
|
|
227
230
|
* literals, so without this pin a typo'd or later-retired member compiles
|
|
@@ -291,6 +294,17 @@ export type FoldOutcome = {
|
|
|
291
294
|
| {
|
|
292
295
|
readonly kind: "sessionState";
|
|
293
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;
|
|
294
308
|
} | {
|
|
295
309
|
readonly kind: "approvalPending";
|
|
296
310
|
readonly approvalId: string;
|
|
@@ -358,10 +372,13 @@ export type FoldOutcome = {
|
|
|
358
372
|
} | {
|
|
359
373
|
/**
|
|
360
374
|
* A recognized frame the fold deliberately dropped, leaving state
|
|
361
|
-
* unchanged: a `turn/started
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
375
|
+
* unchanged: a `turn/started`, `turn/retryScheduled`,
|
|
376
|
+
* `turn/modelRetryScheduled` or `turn/foregroundCompleted` for a turn
|
|
377
|
+
* that already left `running`; a `turn/completed` for a `retracted` or
|
|
378
|
+
* `unqueued` turn; a declined `turn/retracted` for a turn the fold has
|
|
379
|
+
* not seen; an `approval/updated` for an approval it never saw
|
|
380
|
+
* requested (or whose entry a resolution already deleted); or a
|
|
381
|
+
* redelivered `approval/requested` / `userInput/requested` for an
|
|
365
382
|
* approval/prompt that already has its durable terminal. Truthful by
|
|
366
383
|
* contract: a "pending" kind here would make a renderer show an entry
|
|
367
384
|
* the fold does not hold (PR #23087 review round).
|
|
@@ -169,6 +169,8 @@ export class SessionFold {
|
|
|
169
169
|
return this.#turnForegroundCompleted(typed.params);
|
|
170
170
|
case "approval/requested":
|
|
171
171
|
return this.#approvalRequested(typed.params);
|
|
172
|
+
case "approval/reviewing":
|
|
173
|
+
return this.#approvalReviewing(typed.params);
|
|
172
174
|
case "approval/updated":
|
|
173
175
|
return this.#approvalUpdated(typed.params);
|
|
174
176
|
case "approval/resolved":
|
|
@@ -280,14 +282,27 @@ export class SessionFold {
|
|
|
280
282
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
|
281
283
|
}
|
|
282
284
|
#turnRetracted(params) {
|
|
285
|
+
// A declined retract means the submission stood, so the fold keeps the
|
|
286
|
+
// turn's prior state: a running turn stays running and its
|
|
287
|
+
// `turn/completed` still settles it, and a settled turn stays settled.
|
|
288
|
+
// The fold records the standing submission's commandId on a turn it
|
|
289
|
+
// holds. A declined retract carries no lifecycle fact, so for a turn the
|
|
290
|
+
// fold has not seen it creates no entry. Only an explicit "declined"
|
|
291
|
+
// counts; an absent or unrecognized outcome reads as accepted (tdd
|
|
292
|
+
// SS4.5.1).
|
|
293
|
+
if (params.outcome === "declined") {
|
|
294
|
+
const held = this.#turns.get(params.turnId);
|
|
295
|
+
if (held === undefined) {
|
|
296
|
+
return { kind: "ignoredStaleFrame", method: "turn/retracted", id: params.turnId };
|
|
297
|
+
}
|
|
298
|
+
held.commandId = params.commandId;
|
|
299
|
+
return { kind: "turn", turnId: params.turnId, state: held.state };
|
|
300
|
+
}
|
|
283
301
|
const turn = this.#turnFor(params.turnId);
|
|
284
302
|
turn.commandId = params.commandId;
|
|
285
303
|
// A retract is NOT a `TurnTerminal`; leaving `terminal` unset is the whole
|
|
286
304
|
// point (INV-006). On accepted, the retracted user message re-arrives via
|
|
287
|
-
// `item/updated` with `retracted: true`, which the item half folds
|
|
288
|
-
// (a declined outcome also lands here for now: the entry reads retracted
|
|
289
|
-
// and the later turn/completed arrives as a stale frame, so its terminal
|
|
290
|
-
// is dropped too - a known gap in this fold, behavior unchanged).
|
|
305
|
+
// `item/updated` with `retracted: true`, which the item half folds.
|
|
291
306
|
turn.state = "retracted";
|
|
292
307
|
this.#clearActive(params.turnId);
|
|
293
308
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
|
@@ -402,6 +417,15 @@ export class SessionFold {
|
|
|
402
417
|
this.#pendingApprovals.set(params.approvalId, { requested: params });
|
|
403
418
|
return { kind: "approvalPending", approvalId: params.approvalId, requested: params };
|
|
404
419
|
}
|
|
420
|
+
#approvalReviewing(params) {
|
|
421
|
+
// The reviewer-held twin of `approval/requested` (tdd SS5.5.1): typed
|
|
422
|
+
// activity, not a request. It opens NO pending entry — a client that
|
|
423
|
+
// showed a decision card here would defeat the presentation hold that
|
|
424
|
+
// spec 209 FR-52080-1 exists for — and touches no other store; the
|
|
425
|
+
// release arrives as `approval/requested` (or `approval/resolved`) on
|
|
426
|
+
// this id.
|
|
427
|
+
return { kind: "approvalReviewing", approvalId: params.approvalId };
|
|
428
|
+
}
|
|
405
429
|
#approvalUpdated(params) {
|
|
406
430
|
// An update REFRESHES a pending view; it never opens one. An update for an
|
|
407
431
|
// approval this fold never saw requested (a pre-join frame) is dropped
|
package/dist/src/msp.d.ts
CHANGED
|
@@ -866,6 +866,8 @@ export interface Item {
|
|
|
866
866
|
declaredPhase?: string;
|
|
867
867
|
/** `subagent`: nesting depth. */
|
|
868
868
|
depth?: number;
|
|
869
|
+
/** `toolCall`: the tool's own words for this call; absent = none (tdd SS4.5.5). */
|
|
870
|
+
displayLabel?: ToolDisplayLabel;
|
|
869
871
|
/** `userMessage`: presentation form (tdd SS3.2); absent when the client sent none. */
|
|
870
872
|
displayText?: string;
|
|
871
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. */
|
|
@@ -2758,6 +2760,16 @@ export interface TokenUsage {
|
|
|
2758
2760
|
reasoningTokens: number;
|
|
2759
2761
|
}
|
|
2760
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
|
+
|
|
2761
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; };
|
|
2762
2774
|
|
|
2763
2775
|
/** Which operation within the family the receipt describes (ADR 43399 D1/D2). Open — registered per family, never derived from the tool name. */
|
|
@@ -3481,7 +3493,7 @@ export interface WorkflowTokenBudget {
|
|
|
3481
3493
|
/** Every wire method in this schema (SS1.9 index). */
|
|
3482
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";
|
|
3483
3495
|
/** Every wire notification in this schema (SS1.9 index). */
|
|
3484
|
-
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/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";
|
|
3485
3497
|
/** Every server-initiated wire request in this schema (SS5.3/SS5.10.1 index). */
|
|
3486
3498
|
export type MspServerRequest = "approval/request" | "userInput/request";
|
|
3487
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.10",
|
|
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",
|