@adhdev/daemon-core 0.9.77-rc.6 → 0.9.77-rc.8

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.mjs CHANGED
@@ -2695,6 +2695,8 @@ var init_provider_cli_adapter = __esm({
2695
2695
  statusHistory = [];
2696
2696
  // ─── CLI Scripts (script-based parsing) ───
2697
2697
  cliScripts;
2698
+ /** Per-session opaque state object created by cliScripts.createState(), reset on stop. */
2699
+ scriptState = null;
2698
2700
  runtimeSettings = {};
2699
2701
  /** Full accumulated rendered PTY transcript for parser/readback use */
2700
2702
  accumulatedBuffer = "";
@@ -2876,6 +2878,7 @@ ${lastSnapshot}`;
2876
2878
  this.cliScripts = scripts;
2877
2879
  this.parsedStatusCache = null;
2878
2880
  this.parseErrorMessage = null;
2881
+ this.scriptState = typeof scripts.createState === "function" ? scripts.createState() : null;
2879
2882
  const scriptNames = listCliScriptNames(scripts);
2880
2883
  LOG.info("CLI", `[${this.cliType}] CLI scripts injected: [${scriptNames.join(", ")}]`);
2881
2884
  }
@@ -2993,6 +2996,7 @@ ${lastSnapshot}`;
2993
2996
  this.ready = false;
2994
2997
  this.startupParseGate = false;
2995
2998
  this.spawnAt = 0;
2999
+ this.scriptState = null;
2996
3000
  this.onStatusChange?.();
2997
3001
  });
2998
3002
  this.spawnAt = Date.now();
@@ -3766,7 +3770,7 @@ ${lastSnapshot}`;
3766
3770
  scope: this.currentTurnScope,
3767
3771
  runtimeSettings: this.runtimeSettings
3768
3772
  });
3769
- const session = this.cliScripts.parseSession({ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
3773
+ const session = this.cliScripts.parseSession(this.scriptState, { ...input, tail, tailScreen: buildCliScreenSnapshot(tail) });
3770
3774
  this.parseErrorMessage = null;
3771
3775
  return session && typeof session === "object" ? session : null;
3772
3776
  } catch (e) {
@@ -3780,7 +3784,7 @@ ${lastSnapshot}`;
3780
3784
  if (!this.cliScripts?.detectStatus) return null;
3781
3785
  try {
3782
3786
  const screenText = this.terminalScreen.getText();
3783
- const status = this.cliScripts.detectStatus({
3787
+ const status = this.cliScripts.detectStatus(this.scriptState, {
3784
3788
  tail: text.slice(-500),
3785
3789
  screenText,
3786
3790
  rawBuffer: this.accumulatedRawBuffer,
@@ -3799,7 +3803,7 @@ ${lastSnapshot}`;
3799
3803
  try {
3800
3804
  const screenText = this.terminalScreen.getText();
3801
3805
  const buffer = screenText || this.accumulatedBuffer;
3802
- return this.cliScripts.parseApproval({
3806
+ return this.cliScripts.parseApproval(this.scriptState, {
3803
3807
  buffer,
3804
3808
  screenText,
3805
3809
  rawBuffer: this.accumulatedRawBuffer,
@@ -3907,7 +3911,7 @@ ${lastSnapshot}`;
3907
3911
  scope: this.currentTurnScope,
3908
3912
  runtimeSettings: this.runtimeSettings
3909
3913
  });
3910
- return await Promise.resolve(fn({
3914
+ return await Promise.resolve(fn(this.scriptState, {
3911
3915
  ...input,
3912
3916
  args: args && typeof args === "object" ? { ...args } : {}
3913
3917
  }));