@muse-code/sdk 1.4.9 → 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.
|
@@ -224,7 +224,7 @@ export type SessionStateMethod = ViewEvent["method"] & `session/${string}`;
|
|
|
224
224
|
* and could never match exhaustively. A future arm that starts dropping
|
|
225
225
|
* widens this deliberately (PR #23087 review round).
|
|
226
226
|
*/
|
|
227
|
-
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";
|
|
228
228
|
/**
|
|
229
229
|
* The `NoStaleViewArm` sibling for the union above: these are hand-typed
|
|
230
230
|
* literals, so without this pin a typo'd or later-retired member compiles
|
|
@@ -372,10 +372,13 @@ export type FoldOutcome = {
|
|
|
372
372
|
} | {
|
|
373
373
|
/**
|
|
374
374
|
* A recognized frame the fold deliberately dropped, leaving state
|
|
375
|
-
* unchanged: a `turn/started
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
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
|
|
379
382
|
* approval/prompt that already has its durable terminal. Truthful by
|
|
380
383
|
* contract: a "pending" kind here would make a renderer show an entry
|
|
381
384
|
* the fold does not hold (PR #23087 review round).
|
|
@@ -282,14 +282,27 @@ export class SessionFold {
|
|
|
282
282
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
|
283
283
|
}
|
|
284
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
|
+
}
|
|
285
301
|
const turn = this.#turnFor(params.turnId);
|
|
286
302
|
turn.commandId = params.commandId;
|
|
287
303
|
// A retract is NOT a `TurnTerminal`; leaving `terminal` unset is the whole
|
|
288
304
|
// point (INV-006). On accepted, the retracted user message re-arrives via
|
|
289
|
-
// `item/updated` with `retracted: true`, which the item half folds
|
|
290
|
-
// (a declined outcome also lands here for now: the entry reads retracted
|
|
291
|
-
// and the later turn/completed arrives as a stale frame, so its terminal
|
|
292
|
-
// is dropped too - a known gap in this fold, behavior unchanged).
|
|
305
|
+
// `item/updated` with `retracted: true`, which the item half folds.
|
|
293
306
|
turn.state = "retracted";
|
|
294
307
|
this.#clearActive(params.turnId);
|
|
295
308
|
return { kind: "turn", turnId: params.turnId, state: turn.state };
|
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",
|