@moxt-ai/mobius 0.0.366 → 0.0.367

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./chunk-6B5KEII2.js";
3
+ } from "./chunk-LNJNELNJ.js";
4
4
 
5
5
  // ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
6
6
  var require_constants = __commonJS({
@@ -1999,4 +1999,4 @@ var require_semver2 = __commonJS({
1999
1999
  export {
2000
2000
  require_semver2 as require_semver
2001
2001
  };
2002
- //# sourceMappingURL=chunk-YLRX5R7J.js.map
2002
+ //# sourceMappingURL=chunk-AJRLEZKJ.js.map
@@ -3,7 +3,7 @@ import {
3
3
  __export,
4
4
  __using,
5
5
  package_default
6
- } from "./chunk-6B5KEII2.js";
6
+ } from "./chunk-LNJNELNJ.js";
7
7
 
8
8
  // src/engine/runtime/relay/runtime-revocation.ts
9
9
  var runtimeRevocationCloseCode = 1008;
@@ -88874,7 +88874,7 @@ var ActiveRuntimeTurn = class {
88874
88874
  }
88875
88875
  this.#dispatch = { kind: "queued", promotion: Promise.withResolvers() };
88876
88876
  };
88877
- isQueued = () => this.#dispatch.kind === "queued" && !this.#controller.signal.aborted;
88877
+ isQueued = () => (this.#dispatch.kind === "queued" || this.#dispatch.kind === "admitted" && this.#dispatch.disposition === SessionPromptDisposition.Queue) && !this.#controller.signal.aborted;
88878
88878
  abortRuntime = () => {
88879
88879
  this.#controller.abort();
88880
88880
  };
@@ -88886,13 +88886,30 @@ var ActiveRuntimeTurn = class {
88886
88886
  return { epoch: this.#epoch, sequence: 0 };
88887
88887
  };
88888
88888
  promoteQueuedPrompt = (command) => {
88889
- if (command.commandId !== this.command.commandId || command.sessionId !== this.command.sessionId || this.#dispatch.kind !== "queued") {
88890
- return false;
88889
+ if (command.commandId !== this.command.commandId || command.sessionId !== this.command.sessionId || this.#controller.signal.aborted) {
88890
+ return "unavailable";
88891
+ }
88892
+ switch (this.#dispatch.kind) {
88893
+ case "queued": {
88894
+ const promotion = this.#dispatch.promotion;
88895
+ this.#dispatch = { kind: "promoted" };
88896
+ promotion.resolve();
88897
+ return "accepted";
88898
+ }
88899
+ case "promoted":
88900
+ return "accepted";
88901
+ case "admitted":
88902
+ return this.#dispatch.disposition === SessionPromptDisposition.Steer ? "accepted" : "already-started";
88903
+ case "running":
88904
+ return "already-started";
88905
+ case "pending":
88906
+ return "unavailable";
88891
88907
  }
88892
- const promotion = this.#dispatch.promotion;
88893
- this.#dispatch = { kind: "promoted" };
88894
- promotion.resolve();
88895
- return true;
88908
+ };
88909
+ admit = () => {
88910
+ const disposition = this.effectiveDisposition();
88911
+ this.#dispatch = { kind: "admitted", disposition };
88912
+ return disposition;
88896
88913
  };
88897
88914
  queuePromotion = () => {
88898
88915
  if (this.#dispatch.kind === "queued") {
@@ -89036,13 +89053,13 @@ var SessionExecutionState = class {
89036
89053
  onQueued();
89037
89054
  }
89038
89055
  if (turn.effectiveDisposition() === SessionPromptDisposition.Steer) {
89039
- return { disposition: SessionPromptDisposition.Steer, kind: "available" };
89056
+ return { disposition: turn.admit(), kind: "available" };
89040
89057
  }
89041
89058
  for (; ; ) {
89042
89059
  waitSignal.throwIfAborted();
89043
89060
  const first = head();
89044
89061
  if (first === void 0 || first === turn) {
89045
- return { disposition: turn.effectiveDisposition(), kind: "available" };
89062
+ return { disposition: turn.admit(), kind: "available" };
89046
89063
  }
89047
89064
  if (command.disposition !== SessionPromptDisposition.Queue) {
89048
89065
  return { kind: "busy" };
@@ -89056,7 +89073,7 @@ var SessionExecutionState = class {
89056
89073
  promotion.then(() => "promoted")
89057
89074
  ]);
89058
89075
  if (decision === "promoted") {
89059
- return { disposition: SessionPromptDisposition.Steer, kind: "available" };
89076
+ return { disposition: turn.admit(), kind: "available" };
89060
89077
  }
89061
89078
  }
89062
89079
  };
@@ -91280,19 +91297,23 @@ var sessionCloseCommand = {
91280
91297
  };
91281
91298
  var promptDispositionCommand = {
91282
91299
  kind: SESSION_PROMPT_DISPOSITION_KIND,
91283
- handle: ({ sessionTurns, socket }, message) => {
91300
+ handle: ({ diagnostics, operations, sessionTurns, socket }, message) => {
91284
91301
  if (message.kind !== SESSION_PROMPT_DISPOSITION_KIND) {
91285
91302
  throw new Error("Command kind mismatch");
91286
91303
  }
91287
91304
  const turn = sessionTurns.get(message.commandId, message.sessionId);
91288
- if (turn === void 0 || !turn.promoteQueuedPrompt(message)) {
91289
- reportOperationFailure(
91290
- socket,
91291
- message.commandId,
91292
- message.sessionId,
91293
- new Error("The queued prompt is unavailable")
91294
- );
91305
+ const result = turn?.promoteQueuedPrompt(message) ?? "unavailable";
91306
+ if (result === "accepted") {
91307
+ return;
91295
91308
  }
91309
+ const started = result === "already-started" || operations.hasStarted(message.commandId, message.sessionId);
91310
+ const error62 = started ? new SessionError("turn_already_started", "The message already left the queue and could not be steered") : new SessionError("turn_not_active", "The message is no longer waiting to be steered");
91311
+ diagnostics.daemonDiagnostic("session_prompt_disposition_failed", message.commandId, {
91312
+ code: error62.code,
91313
+ commandId: message.commandId,
91314
+ sessionId: message.sessionId
91315
+ });
91316
+ reportOperationFailure(socket, message.commandId, message.sessionId, error62);
91296
91317
  }
91297
91318
  };
91298
91319
  var permissionRespondCommand = {
@@ -93458,4 +93479,4 @@ export {
93458
93479
  * MIT Licensed
93459
93480
  *)
93460
93481
  */
93461
- //# sourceMappingURL=chunk-T6KRS6AF.js.map
93482
+ //# sourceMappingURL=chunk-KEI2PNYS.js.map