@demicodes/agent 0.3.2 → 0.3.4

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.
Files changed (2) hide show
  1. package/dist/index.mjs +6 -3
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -925,6 +925,7 @@ var ProviderTurnLoop = class {
925
925
  let autoCompactions = 0;
926
926
  while (true) {
927
927
  throwIfAborted(this.host.currentSignal());
928
+ await this.host.materializePendingSteers();
928
929
  const steerContinuationBeforeStream = this.host.steerContinuationCount;
929
930
  const shouldAutoRecover = await this.streamProviderOnce();
930
931
  throwIfAborted(this.host.currentSignal());
@@ -1294,7 +1295,8 @@ var AgentSession = class AgentSession {
1294
1295
  runWithCompactingPhase: (fn) => self.runWithCompactingPhase(fn),
1295
1296
  commitTranscript: () => self.commitTranscript(),
1296
1297
  emit: (event) => self.emit(event),
1297
- materializeSteersArrivedSince: (count) => self.materializePendingSteersArrivedSince(count)
1298
+ materializeSteersArrivedSince: (count) => self.materializePendingSteersArrivedSince(count),
1299
+ materializePendingSteers: () => self.materializePendingSteersForCurrentTurn()
1298
1300
  };
1299
1301
  this.turnLoop = new ProviderTurnLoop(turnLoopHost);
1300
1302
  }
@@ -1647,13 +1649,13 @@ var AgentSession = class AgentSession {
1647
1649
  steerDelivery() {
1648
1650
  if (!this.activeTurnId || !this.currentAbortController || !this.activeTurnPhase) throw new Error("AgentSession: no active turn to steer");
1649
1651
  if (this.currentAbortController.signal.aborted) throw new Error("AgentSession: active turn is aborted");
1650
- if (this.activeTurnPhase === "compacting" || this.activeTurnPhase === "finalizing") throw new Error(`AgentSession: active turn cannot accept steering while ${this.activeTurnPhase}`);
1652
+ if (this.activeTurnPhase === "finalizing") throw new Error("AgentSession: active turn cannot accept steering while finalizing");
1651
1653
  const run = this.activeProviderRun;
1652
1654
  if (run?.steer) return {
1653
1655
  type: "provider",
1654
1656
  run
1655
1657
  };
1656
- if (this.activeTurnPhase === "tool_executing" || this.activeTurnPhase === "provider_streaming") return { type: "next_provider_continuation" };
1658
+ if (this.activeTurnPhase === "tool_executing" || this.activeTurnPhase === "provider_streaming" || this.activeTurnPhase === "compacting") return { type: "next_provider_continuation" };
1657
1659
  throw new Error("AgentSession: active turn cannot accept steering now");
1658
1660
  }
1659
1661
  enqueue(action) {
@@ -1760,6 +1762,7 @@ var AgentSession = class AgentSession {
1760
1762
  this.setPhase("compacting");
1761
1763
  this.activeTurnPhase = "compacting";
1762
1764
  await this.compaction.run();
1765
+ await this.materializePendingSteersForCurrentTurn();
1763
1766
  return;
1764
1767
  }
1765
1768
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/agent",
3
3
  "description": "Session runtime and transport-neutral client and server protocol for Demi.",
4
- "version": "0.3.2",
4
+ "version": "0.3.4",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@demicodes/core": "^0.3.2",
23
- "@demicodes/provider": "^0.3.2",
23
+ "@demicodes/provider": "^0.4.2",
24
24
  "@demicodes/shell": "^0.3.2",
25
25
  "@demicodes/utils": "^0.3.2"
26
26
  },