@ordewell/core 0.10.11 → 0.10.12

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/index.d.mts CHANGED
@@ -3952,6 +3952,8 @@ declare class StructuredSession extends AbstractRunnerSession {
3952
3952
  private interrupting;
3953
3953
  /** The wind-down once {@link stop} was asked for: the same for every caller, and nothing new is sent meanwhile. */
3954
3954
  private stopping;
3955
+ /** The process is handling its exit: nothing new may be queued, so a held report can still publish. */
3956
+ private exiting;
3955
3957
  private lastSessionId;
3956
3958
  private lastSessionCost;
3957
3959
  private readonly structuredEmitter;
package/dist/index.d.ts CHANGED
@@ -3952,6 +3952,8 @@ declare class StructuredSession extends AbstractRunnerSession {
3952
3952
  private interrupting;
3953
3953
  /** The wind-down once {@link stop} was asked for: the same for every caller, and nothing new is sent meanwhile. */
3954
3954
  private stopping;
3955
+ /** The process is handling its exit: nothing new may be queued, so a held report can still publish. */
3956
+ private exiting;
3955
3957
  private lastSessionId;
3956
3958
  private lastSessionCost;
3957
3959
  private readonly structuredEmitter;
package/dist/index.js CHANGED
@@ -36632,6 +36632,8 @@ var StructuredSession = class extends AbstractRunnerSession {
36632
36632
  interrupting = null;
36633
36633
  /** The wind-down once {@link stop} was asked for: the same for every caller, and nothing new is sent meanwhile. */
36634
36634
  stopping = null;
36635
+ /** The process is handling its exit: nothing new may be queued, so a held report can still publish. */
36636
+ exiting = false;
36635
36637
  lastSessionId = null;
36636
36638
  lastSessionCost = null;
36637
36639
  structuredEmitter = new import_events2.EventEmitter();
@@ -36716,6 +36718,7 @@ var StructuredSession = class extends AbstractRunnerSession {
36716
36718
  this.toolToken = null;
36717
36719
  }
36718
36720
  baseHandleExit(code) {
36721
+ this.exiting = true;
36719
36722
  this.undeliverQueued();
36720
36723
  this.flushCompletion();
36721
36724
  this.ended.abort();
@@ -36813,7 +36816,7 @@ var StructuredSession = class extends AbstractRunnerSession {
36813
36816
  this.messageCount += 1;
36814
36817
  const id = `msg-${this.messageCount}`;
36815
36818
  const sender2 = opening.from ? { from: opening.from } : {};
36816
- if (this.exited || this.stopping) this.emitEvent({ type: "message_undelivered", messageId: id, text: text3, ...sender2 });
36819
+ if (this.exited || this.exiting || this.stopping) this.emitEvent({ type: "message_undelivered", messageId: id, text: text3, ...sender2 });
36817
36820
  else if (this.state === "idle" && this.adapterStarted && !this.sending) this.deliver(text3, opening);
36818
36821
  else {
36819
36822
  this.state = "working";
@@ -36858,7 +36861,6 @@ var StructuredSession = class extends AbstractRunnerSession {
36858
36861
  * "waiting for input" between the two (F3).
36859
36862
  */
36860
36863
  force(message) {
36861
- this.discardCompletion();
36862
36864
  message.forced = true;
36863
36865
  const at = this.queue.findIndex((m) => !m.forced);
36864
36866
  this.queue.splice(at < 0 ? this.queue.length : at, 0, message);
@@ -36869,7 +36871,7 @@ var StructuredSession = class extends AbstractRunnerSession {
36869
36871
  });
36870
36872
  }
36871
36873
  runningTurn() {
36872
- return !this.exited && !this.stopping && this.adapter !== null && this.turn !== null && !this.turn.ended;
36874
+ return !this.exited && !this.exiting && !this.stopping && this.adapter !== null && this.turn !== null && !this.turn.ended;
36873
36875
  }
36874
36876
  /** No runner can recall a message once offered to it, so only a queued one comes back. */
36875
36877
  removeQueued(id) {
@@ -37049,7 +37051,7 @@ var StructuredSession = class extends AbstractRunnerSession {
37049
37051
  offerNext() {
37050
37052
  const adapter = this.adapter;
37051
37053
  const turn = this.turn;
37052
- if (!adapter?.steer || !turn || turn.ended || turn.steerRefused || this.interrupting || this.exited || this.stopping) return;
37054
+ if (!adapter?.steer || !turn || turn.ended || turn.steerRefused || this.interrupting || this.exited || this.exiting || this.stopping) return;
37053
37055
  if (this.queue.some((m) => m.stage === "steering")) return;
37054
37056
  const next = this.queue.find((m) => m.stage === "queued");
37055
37057
  if (!next || next.command) return;
@@ -37215,7 +37217,7 @@ var StructuredSession = class extends AbstractRunnerSession {
37215
37217
  * back in Ordewell's hands: while it is on offer or owed, nothing overtakes it.
37216
37218
  */
37217
37219
  deliverNext() {
37218
- if (this.exited || this.stopping || this.sending || this.turn && !this.turn.ended) return;
37220
+ if (this.exited || this.exiting || this.stopping || this.sending || this.turn && !this.turn.ended) return;
37219
37221
  const head = this.queue[0];
37220
37222
  if (!head || this.queue.some((message) => message.stage !== "queued")) return;
37221
37223
  this.queue.shift();