@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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -32390,6 +32390,8 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32390
32390
|
interrupting = null;
|
|
32391
32391
|
/** The wind-down once {@link stop} was asked for: the same for every caller, and nothing new is sent meanwhile. */
|
|
32392
32392
|
stopping = null;
|
|
32393
|
+
/** The process is handling its exit: nothing new may be queued, so a held report can still publish. */
|
|
32394
|
+
exiting = false;
|
|
32393
32395
|
lastSessionId = null;
|
|
32394
32396
|
lastSessionCost = null;
|
|
32395
32397
|
structuredEmitter = new EventEmitter2();
|
|
@@ -32474,6 +32476,7 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32474
32476
|
this.toolToken = null;
|
|
32475
32477
|
}
|
|
32476
32478
|
baseHandleExit(code) {
|
|
32479
|
+
this.exiting = true;
|
|
32477
32480
|
this.undeliverQueued();
|
|
32478
32481
|
this.flushCompletion();
|
|
32479
32482
|
this.ended.abort();
|
|
@@ -32571,7 +32574,7 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32571
32574
|
this.messageCount += 1;
|
|
32572
32575
|
const id = `msg-${this.messageCount}`;
|
|
32573
32576
|
const sender2 = opening.from ? { from: opening.from } : {};
|
|
32574
|
-
if (this.exited || this.stopping) this.emitEvent({ type: "message_undelivered", messageId: id, text, ...sender2 });
|
|
32577
|
+
if (this.exited || this.exiting || this.stopping) this.emitEvent({ type: "message_undelivered", messageId: id, text, ...sender2 });
|
|
32575
32578
|
else if (this.state === "idle" && this.adapterStarted && !this.sending) this.deliver(text, opening);
|
|
32576
32579
|
else {
|
|
32577
32580
|
this.state = "working";
|
|
@@ -32616,7 +32619,6 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32616
32619
|
* "waiting for input" between the two (F3).
|
|
32617
32620
|
*/
|
|
32618
32621
|
force(message) {
|
|
32619
|
-
this.discardCompletion();
|
|
32620
32622
|
message.forced = true;
|
|
32621
32623
|
const at = this.queue.findIndex((m) => !m.forced);
|
|
32622
32624
|
this.queue.splice(at < 0 ? this.queue.length : at, 0, message);
|
|
@@ -32627,7 +32629,7 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32627
32629
|
});
|
|
32628
32630
|
}
|
|
32629
32631
|
runningTurn() {
|
|
32630
|
-
return !this.exited && !this.stopping && this.adapter !== null && this.turn !== null && !this.turn.ended;
|
|
32632
|
+
return !this.exited && !this.exiting && !this.stopping && this.adapter !== null && this.turn !== null && !this.turn.ended;
|
|
32631
32633
|
}
|
|
32632
32634
|
/** No runner can recall a message once offered to it, so only a queued one comes back. */
|
|
32633
32635
|
removeQueued(id) {
|
|
@@ -32807,7 +32809,7 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32807
32809
|
offerNext() {
|
|
32808
32810
|
const adapter = this.adapter;
|
|
32809
32811
|
const turn = this.turn;
|
|
32810
|
-
if (!adapter?.steer || !turn || turn.ended || turn.steerRefused || this.interrupting || this.exited || this.stopping) return;
|
|
32812
|
+
if (!adapter?.steer || !turn || turn.ended || turn.steerRefused || this.interrupting || this.exited || this.exiting || this.stopping) return;
|
|
32811
32813
|
if (this.queue.some((m) => m.stage === "steering")) return;
|
|
32812
32814
|
const next = this.queue.find((m) => m.stage === "queued");
|
|
32813
32815
|
if (!next || next.command) return;
|
|
@@ -32973,7 +32975,7 @@ var StructuredSession = class extends AbstractRunnerSession {
|
|
|
32973
32975
|
* back in Ordewell's hands: while it is on offer or owed, nothing overtakes it.
|
|
32974
32976
|
*/
|
|
32975
32977
|
deliverNext() {
|
|
32976
|
-
if (this.exited || this.stopping || this.sending || this.turn && !this.turn.ended) return;
|
|
32978
|
+
if (this.exited || this.exiting || this.stopping || this.sending || this.turn && !this.turn.ended) return;
|
|
32977
32979
|
const head = this.queue[0];
|
|
32978
32980
|
if (!head || this.queue.some((message) => message.stage !== "queued")) return;
|
|
32979
32981
|
this.queue.shift();
|