@moxt-ai/mobius 0.0.428 → 0.0.429

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.
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-HFF7ZGCS.js";
6
+ } from "./chunk-NRP5QMEO.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -20082,7 +20082,15 @@ var workspaceEntrySchema = external_exports.object({
20082
20082
  name: external_exports.string().min(1).max(255)
20083
20083
  }).readonly();
20084
20084
  var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
20085
- external_exports.object({ kind: external_exports.literal("idle") }).readonly(),
20085
+ external_exports.object({
20086
+ kind: external_exports.literal("idle"),
20087
+ /**
20088
+ * Present when the Session's most recent started command failed, while the Runtime retains its receipt, so
20089
+ * a client that did not watch it can still show the Session failed until another command starts. It
20090
+ * carries what the execution's `lastTurn` reports for that failure. Runtimes before it existed omit it.
20091
+ */
20092
+ failedTurn: external_exports.object({ code: identifierStringSchema, commandId: identifierStringSchema, message: external_exports.string().min(1).max(500) }).readonly().optional().catch(void 0)
20093
+ }).readonly(),
20086
20094
  external_exports.object({
20087
20095
  commandId: identifierStringSchema,
20088
20096
  kind: external_exports.literal("working")
@@ -90908,6 +90916,7 @@ var SessionManager2 = class {
90908
90916
  changed: () => this.#processes.notifyChanged()
90909
90917
  });
90910
90918
  #executions;
90919
+ #lastTurn;
90911
90920
  #agentSettingsObserver = new NullSessionObserver();
90912
90921
  #nativeOperations = /* @__PURE__ */ new Set();
90913
90922
  #sessionClosures = /* @__PURE__ */ new Map();
@@ -90926,14 +90935,20 @@ var SessionManager2 = class {
90926
90935
  sessionIdentity,
90927
90936
  onSessionStatusChanged,
90928
90937
  onSessionClosed = () => void 0,
90938
+ lastTurn = () => void 0,
90929
90939
  timer
90930
90940
  }) {
90931
90941
  this.#observer = observer;
90932
90942
  this.#processes = processes;
90933
90943
  this.#store = store;
90934
90944
  this.#sessionIdentity = sessionIdentity;
90945
+ this.#lastTurn = lastTurn;
90935
90946
  this.#executions = new ActiveExecutions(
90936
- (sessionId, status) => onSessionStatusChanged({ kind: "session.status.changed", sessionId, status })
90947
+ (sessionId, status) => onSessionStatusChanged({
90948
+ kind: "session.status.changed",
90949
+ sessionId,
90950
+ status: this.#reported(sessionId, status)
90951
+ })
90937
90952
  );
90938
90953
  this.#onSessionClosed = onSessionClosed;
90939
90954
  this.#timer = timer;
@@ -91543,7 +91558,18 @@ var SessionManager2 = class {
91543
91558
  const stored = this.#store.read(sessionId);
91544
91559
  return stored instanceof FoundStoredSession ? [stored.session] : [];
91545
91560
  });
91546
- sessionStatus = (sessionId) => this.#executions.status(sessionId);
91561
+ sessionStatus = (sessionId) => this.#reported(sessionId, this.#executions.status(sessionId));
91562
+ /** An idle Session whose last started command failed says so, so a client that did not watch it still knows. */
91563
+ #reported = (sessionId, status) => {
91564
+ if (status.kind !== "idle") {
91565
+ return status;
91566
+ }
91567
+ const lastTurn = this.#lastTurn(sessionId);
91568
+ return lastTurn?.state === "failed" ? {
91569
+ ...status,
91570
+ failedTurn: { code: lastTurn.code, commandId: lastTurn.commandId, message: lastTurn.message }
91571
+ } : status;
91572
+ };
91547
91573
  listSessions = (limit) => this.#store.list().filter((session) => session.prompted).slice(0, limit);
91548
91574
  findLinkedSessions = (agentId, nativeSessionId) => this.#store.findNative(agentId, nativeSessionId);
91549
91575
  interactionSnapshot = (options) => {
@@ -93505,6 +93531,7 @@ function buildSessionLayer(options) {
93505
93531
  sessionIdentity: "native",
93506
93532
  onSessionStatusChanged: sink.publishStatus,
93507
93533
  onSessionClosed: sink.publishClosed,
93534
+ lastTurn: operations.lastTurn,
93508
93535
  timer
93509
93536
  });
93510
93537
  const eventProjection = new PromptLifecycle(
@@ -97722,4 +97749,4 @@ export {
97722
97749
  * MIT Licensed
97723
97750
  *)
97724
97751
  */
97725
- //# sourceMappingURL=chunk-6BCVMXHM.js.map
97752
+ //# sourceMappingURL=chunk-JRH5V326.js.map