adhdev 0.6.75 → 0.6.76

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.js CHANGED
@@ -560,6 +560,10 @@ var init_ide_detector = __esm({
560
560
  });
561
561
 
562
562
  // ../../oss/packages/daemon-core/src/detection/cli-detector.ts
563
+ function parseVersion(raw) {
564
+ const match = raw.match(/v?(\d+\.\d+(?:\.\d+)?(?:-[a-zA-Z0-9.]+)?)/);
565
+ return match ? match[1] : raw.split("\n")[0].slice(0, 100);
566
+ }
563
567
  function execAsync(cmd, timeoutMs = 5e3) {
564
568
  return new Promise((resolve10) => {
565
569
  const child = (0, import_child_process2.exec)(cmd, { encoding: "utf-8", timeout: timeoutMs }, (err, stdout) => {
@@ -584,10 +588,18 @@ async function detectCLIs(providerLoader) {
584
588
  const firstPath = pathResult.split("\n")[0];
585
589
  let version2;
586
590
  try {
587
- const versionResult = await execAsync(`${cli.command} --version 2>/dev/null`, 3e3);
588
- if (versionResult) {
589
- const match = versionResult.match(/(\d+\.\d+[\.\d]*)/);
590
- version2 = match ? match[1] : versionResult.split("\n")[0].slice(0, 30);
591
+ const versionCommands = [
592
+ cli.versionCommand,
593
+ `${cli.command} --version 2>/dev/null`,
594
+ `${cli.command} -V 2>/dev/null`,
595
+ `${cli.command} -v 2>/dev/null`
596
+ ].filter((v2) => !!v2);
597
+ for (const versionCommand of versionCommands) {
598
+ const versionResult = await execAsync(versionCommand, 3e3);
599
+ if (versionResult) {
600
+ version2 = parseVersion(versionResult);
601
+ break;
602
+ }
591
603
  }
592
604
  } catch {
593
605
  }
@@ -3210,7 +3222,7 @@ function buildManagedClis(cliStates) {
3210
3222
  cliType: s15.type,
3211
3223
  cliName: s15.name,
3212
3224
  status: s15.status,
3213
- mode: s15.mode,
3225
+ mode: "terminal",
3214
3226
  workspace: s15.workspace || "",
3215
3227
  activeChat: s15.activeChat
3216
3228
  }));
@@ -4804,8 +4816,13 @@ var init_handler = __esm({
4804
4816
  getCliAdapter(type) {
4805
4817
  const target = type || this._currentIdeType;
4806
4818
  if (!target || !this._ctx.adapters) return null;
4819
+ let normalizedTarget = target;
4820
+ const colonIdx = normalizedTarget.lastIndexOf(":");
4821
+ if (colonIdx >= 0) normalizedTarget = normalizedTarget.substring(colonIdx + 1);
4822
+ const direct = this._ctx.adapters.get(normalizedTarget);
4823
+ if (direct) return direct;
4807
4824
  for (const [key, adapter] of this._ctx.adapters.entries()) {
4808
- if (adapter.cliType === target || key.startsWith(target)) {
4825
+ if (adapter.cliType === target || adapter.cliType === normalizedTarget || key === normalizedTarget || key.startsWith(target) || key.startsWith(normalizedTarget)) {
4809
4826
  return adapter;
4810
4827
  }
4811
4828
  }
@@ -5314,10 +5331,10 @@ var init_readdirp = __esm({
5314
5331
  }
5315
5332
  async _formatEntry(dirent, path15) {
5316
5333
  let entry;
5317
- const basename5 = this._isDirent ? dirent.name : dirent;
5334
+ const basename6 = this._isDirent ? dirent.name : dirent;
5318
5335
  try {
5319
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path15, basename5));
5320
- entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename5 };
5336
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path15, basename6));
5337
+ entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename6 };
5321
5338
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
5322
5339
  } catch (err) {
5323
5340
  this._onError(err);
@@ -5848,9 +5865,9 @@ var init_handler2 = __esm({
5848
5865
  _watchWithNodeFs(path15, listener) {
5849
5866
  const opts = this.fsw.options;
5850
5867
  const directory = sp.dirname(path15);
5851
- const basename5 = sp.basename(path15);
5868
+ const basename6 = sp.basename(path15);
5852
5869
  const parent = this.fsw._getWatchedDir(directory);
5853
- parent.add(basename5);
5870
+ parent.add(basename6);
5854
5871
  const absolutePath = sp.resolve(path15);
5855
5872
  const options = {
5856
5873
  persistent: opts.persistent
@@ -5860,7 +5877,7 @@ var init_handler2 = __esm({
5860
5877
  let closer;
5861
5878
  if (opts.usePolling) {
5862
5879
  const enableBin = opts.interval !== opts.binaryInterval;
5863
- options.interval = enableBin && isBinaryPath(basename5) ? opts.binaryInterval : opts.interval;
5880
+ options.interval = enableBin && isBinaryPath(basename6) ? opts.binaryInterval : opts.interval;
5864
5881
  closer = setFsWatchFileListener(path15, absolutePath, options, {
5865
5882
  listener,
5866
5883
  rawEmitter: this.fsw._emitRaw
@@ -5883,10 +5900,10 @@ var init_handler2 = __esm({
5883
5900
  return;
5884
5901
  }
5885
5902
  const dirname8 = sp.dirname(file2);
5886
- const basename5 = sp.basename(file2);
5903
+ const basename6 = sp.basename(file2);
5887
5904
  const parent = this.fsw._getWatchedDir(dirname8);
5888
5905
  let prevStats = stats;
5889
- if (parent.has(basename5))
5906
+ if (parent.has(basename6))
5890
5907
  return;
5891
5908
  const listener = async (path15, newStats) => {
5892
5909
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
@@ -5911,9 +5928,9 @@ var init_handler2 = __esm({
5911
5928
  prevStats = newStats2;
5912
5929
  }
5913
5930
  } catch (error48) {
5914
- this.fsw._remove(dirname8, basename5);
5931
+ this.fsw._remove(dirname8, basename6);
5915
5932
  }
5916
- } else if (parent.has(basename5)) {
5933
+ } else if (parent.has(basename6)) {
5917
5934
  const at2 = newStats.atimeMs;
5918
5935
  const mt2 = newStats.mtimeMs;
5919
5936
  if (!at2 || at2 <= mt2 || mt2 !== prevStats.mtimeMs) {
@@ -7068,12 +7085,15 @@ var init_provider_loader = __esm({
7068
7085
  const result = [];
7069
7086
  for (const p of this.providers.values()) {
7070
7087
  if ((p.category === "cli" || p.category === "acp") && p.spawn?.command) {
7088
+ const verCmdConfig = p.versionCommand;
7089
+ const versionCommand = typeof verCmdConfig === "object" && verCmdConfig !== null ? verCmdConfig[process.platform] : verCmdConfig;
7071
7090
  result.push({
7072
7091
  id: p.type,
7073
7092
  displayName: p.displayName || p.name,
7074
7093
  icon: p.icon || "\u{1F527}",
7075
7094
  command: p.spawn.command,
7076
- category: p.category
7095
+ category: p.category,
7096
+ ...typeof versionCommand === "string" && versionCommand.trim() ? { versionCommand: versionCommand.trim() } : {}
7077
7097
  });
7078
7098
  }
7079
7099
  }
@@ -18113,6 +18133,12 @@ __export(provider_cli_adapter_exports, {
18113
18133
  function stripAnsi(str) {
18114
18134
  return str.replace(/\x1B\[\d*[A-HJKSTfG]/g, " ").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "").replace(/ +/g, " ");
18115
18135
  }
18136
+ function stripTerminalNoise(str) {
18137
+ return String(str || "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "").replace(/(^|[\s([])(?:\??\d{1,4}(?:;\d{1,4})*[A-Za-z])(?=$|[\s)\]])/g, "$1").replace(/(^|[\s([])(?:\[\??\d{1,4}(?:;\d{1,4})*[A-Za-z])(?=$|[\s)\]])/g, "$1").replace(/(^|[\s([])(?:\d{1,4};\?)(?=$|[\s)\]])/g, "$1").replace(/\r+/g, "\n").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").replace(/ {2,}/g, " ");
18138
+ }
18139
+ function sanitizeTerminalText(str) {
18140
+ return stripTerminalNoise(stripAnsi(str));
18141
+ }
18116
18142
  function findBinary(name) {
18117
18143
  const isWin = os12.platform() === "win32";
18118
18144
  try {
@@ -18345,6 +18371,9 @@ var init_provider_cli_adapter = __esm({
18345
18371
  // Approval state machine
18346
18372
  approvalTransitionBuffer = "";
18347
18373
  approvalExitTimeout = null;
18374
+ pendingScriptStatus = null;
18375
+ pendingScriptStatusSince = 0;
18376
+ pendingScriptStatusTimer = null;
18348
18377
  // Output settle debounce — fires after PTY output goes quiet
18349
18378
  settleTimer = null;
18350
18379
  settledBuffer = "";
@@ -18410,6 +18439,7 @@ var init_provider_cli_adapter = __esm({
18410
18439
  sendDelayMs;
18411
18440
  sendKey;
18412
18441
  submitStrategy;
18442
+ static SCRIPT_STATUS_DEBOUNCE_MS = 1e3;
18413
18443
  /** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
18414
18444
  setCliScripts(scripts) {
18415
18445
  this.cliScripts = scripts;
@@ -18536,7 +18566,7 @@ var init_provider_cli_adapter = __esm({
18536
18566
  handleOutput(rawData) {
18537
18567
  this.terminalScreen.write(rawData);
18538
18568
  this.terminalHistory = mergeTerminalHistory(this.terminalHistory, this.terminalScreen.getText());
18539
- const cleanData = stripAnsi(rawData);
18569
+ const cleanData = sanitizeTerminalText(rawData);
18540
18570
  if (this.isWaitingForResponse && cleanData) {
18541
18571
  this.responseBuffer = (this.responseBuffer + cleanData).slice(-8e3);
18542
18572
  }
@@ -18633,24 +18663,39 @@ var init_provider_cli_adapter = __esm({
18633
18663
  const scriptStatus = rawScriptStatus;
18634
18664
  if (!scriptStatus) return;
18635
18665
  const prevStatus = this.currentStatus;
18636
- if (scriptStatus === "waiting_approval") {
18637
- const modalMessage = modal?.message || "";
18638
- const screenText = this.terminalScreen.getText() || this.accumulatedBuffer;
18639
- const autoAcceptPatterns = [
18640
- /be able to read, edit, and execute/i,
18641
- /Security guide/i,
18642
- /Enter to confirm/i,
18643
- /Quick safety check/i,
18644
- /Do you trust the files/i,
18645
- /Is this a project/i
18646
- ];
18647
- if (autoAcceptPatterns.some((p) => p.test(modalMessage) || p.test(screenText))) {
18648
- LOG.info("CLI", `[${this.cliType}] Auto-accepting startup dialog: ${modalMessage.slice(0, 80)}`);
18649
- setTimeout(() => this.ptyProcess?.write("\r"), 200);
18650
- this.lastApprovalResolvedAt = Date.now();
18651
- this.activeModal = null;
18666
+ const clearPendingScriptStatus = () => {
18667
+ this.pendingScriptStatus = null;
18668
+ this.pendingScriptStatusSince = 0;
18669
+ if (this.pendingScriptStatusTimer) {
18670
+ clearTimeout(this.pendingScriptStatusTimer);
18671
+ this.pendingScriptStatusTimer = null;
18672
+ }
18673
+ };
18674
+ const armPendingScriptStatus = (delayMs) => {
18675
+ if (this.pendingScriptStatusTimer) clearTimeout(this.pendingScriptStatusTimer);
18676
+ this.pendingScriptStatusTimer = setTimeout(() => {
18677
+ this.pendingScriptStatusTimer = null;
18678
+ this.settledBuffer = this.recentOutputBuffer;
18679
+ this.evaluateSettled();
18680
+ }, delayMs);
18681
+ };
18682
+ const shouldDebouncePromotion = (status) => prevStatus === "idle" && !this.isWaitingForResponse && !this.currentTurnScope && (status === "generating" || status === "waiting_approval");
18683
+ if (shouldDebouncePromotion(scriptStatus)) {
18684
+ if (this.pendingScriptStatus !== scriptStatus) {
18685
+ this.pendingScriptStatus = scriptStatus;
18686
+ this.pendingScriptStatusSince = now;
18687
+ armPendingScriptStatus(_ProviderCliAdapter.SCRIPT_STATUS_DEBOUNCE_MS);
18688
+ return;
18689
+ }
18690
+ const elapsed = now - this.pendingScriptStatusSince;
18691
+ if (elapsed < _ProviderCliAdapter.SCRIPT_STATUS_DEBOUNCE_MS) {
18692
+ armPendingScriptStatus(_ProviderCliAdapter.SCRIPT_STATUS_DEBOUNCE_MS - elapsed);
18652
18693
  return;
18653
18694
  }
18695
+ } else {
18696
+ clearPendingScriptStatus();
18697
+ }
18698
+ if (scriptStatus === "waiting_approval") {
18654
18699
  const inCooldown = this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
18655
18700
  if (!inCooldown) {
18656
18701
  this.isWaitingForResponse = true;
@@ -18663,6 +18708,12 @@ var init_provider_cli_adapter = __esm({
18663
18708
  }
18664
18709
  }
18665
18710
  if (scriptStatus === "generating") {
18711
+ const screenText = this.terminalScreen.getText() || this.accumulatedBuffer;
18712
+ const noActiveTurn = !this.currentTurnScope;
18713
+ const looksIdleChrome = /(^|\n)\s*[❯›>]\s*(?:\n|$)/m.test(screenText) || /accept edits on/i.test(screenText) && (/Update available!/i.test(screenText) || /\/effort/i.test(screenText) || /^.*➜\s+\S+/m.test(screenText));
18714
+ if (prevStatus === "idle" && !this.isWaitingForResponse && noActiveTurn && !modal && looksIdleChrome) {
18715
+ return;
18716
+ }
18666
18717
  if (prevStatus === "waiting_approval") {
18667
18718
  if (this.approvalExitTimeout) {
18668
18719
  clearTimeout(this.approvalExitTimeout);
@@ -19120,7 +19171,7 @@ ${data.message || ""}`.trim();
19120
19171
  committedMessages: this.committedMessages.slice(-20),
19121
19172
  structuredMessages: this.structuredMessages.slice(-20),
19122
19173
  messageCount: this.committedMessages.length,
19123
- screenText: this.terminalScreen.getText().slice(-4e3),
19174
+ screenText: sanitizeTerminalText(this.terminalScreen.getText()).slice(-4e3),
19124
19175
  terminalHistory: this.terminalHistory.slice(-8e3),
19125
19176
  currentTurnScope: this.currentTurnScope,
19126
19177
  startupBuffer: this.startupBuffer.slice(-4e3),
@@ -19129,6 +19180,7 @@ ${data.message || ""}`.trim();
19129
19180
  accumulatedBufferLength: this.accumulatedBuffer.length,
19130
19181
  accumulatedRawBufferLength: this.accumulatedRawBuffer.length,
19131
19182
  rawBufferPreview: this.accumulatedRawBuffer.slice(-1e3),
19183
+ sanitizedRawPreview: sanitizeTerminalText(this.accumulatedRawBuffer).slice(-1e3),
19132
19184
  responseBuffer: this.responseBuffer.slice(-1e3),
19133
19185
  isWaitingForResponse: this.isWaitingForResponse,
19134
19186
  activeModal: this.activeModal,
@@ -19212,19 +19264,6 @@ var init_cli_provider_instance = __esm({
19212
19264
  getState() {
19213
19265
  const adapterStatus = this.adapter.getStatus();
19214
19266
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
19215
- const recentMessages = adapterStatus.messages.slice(-50).map((m) => {
19216
- const content = typeof m.content === "string" && m.content.length > 8e3 ? m.content.slice(0, 8e3) + "\n... (truncated)" : m.content;
19217
- return { ...m, content };
19218
- });
19219
- if (recentMessages.length > 0) {
19220
- const dirName2 = this.workingDir.split("/").filter(Boolean).pop() || "session";
19221
- this.historyWriter.appendNewMessages(
19222
- this.type,
19223
- recentMessages,
19224
- `${this.provider.name} \xB7 ${dirName2}`,
19225
- this.instanceId
19226
- );
19227
- }
19228
19267
  if (adapterStatus.terminalHistory?.trim()) {
19229
19268
  this.historyWriter.appendTerminalHistory(
19230
19269
  this.type,
@@ -19238,12 +19277,12 @@ var init_cli_provider_instance = __esm({
19238
19277
  name: this.provider.name,
19239
19278
  category: "cli",
19240
19279
  status: adapterStatus.status,
19241
- mode: this.settings.mode || "terminal",
19280
+ mode: "terminal",
19242
19281
  activeChat: {
19243
19282
  id: `${this.type}_${this.workingDir}`,
19244
19283
  title: `${this.provider.name} \xB7 ${dirName}`,
19245
19284
  status: adapterStatus.status,
19246
- messages: recentMessages,
19285
+ messages: [],
19247
19286
  activeModal: adapterStatus.activeModal,
19248
19287
  terminalHistory: adapterStatus.terminalHistory,
19249
19288
  inputContent: ""
@@ -19257,11 +19296,15 @@ var init_cli_provider_instance = __esm({
19257
19296
  }
19258
19297
  onEvent(event, data) {
19259
19298
  if (event === "send_message" && data?.text) {
19260
- this.adapter.sendMessage(data.text);
19299
+ void this.adapter.sendMessage(data.text).catch((e) => {
19300
+ LOG.warn("CLI", `[${this.type}] send_message failed: ${e?.message || e}`);
19301
+ });
19261
19302
  } else if (event === "server_connected" && data?.serverConn) {
19262
19303
  this.adapter.setServerConn(data.serverConn);
19263
19304
  } else if (event === "resolve_action" && data) {
19264
- this.adapter.resolveAction(data);
19305
+ void this.adapter.resolveAction(data).catch((e) => {
19306
+ LOG.warn("CLI", `[${this.type}] resolve_action failed: ${e?.message || e}`);
19307
+ });
19265
19308
  }
19266
19309
  }
19267
19310
  dispose() {
@@ -37702,18 +37745,18 @@ function findBinary2(name) {
37702
37745
  const result = runCommand(cmd, 5e3);
37703
37746
  return result ? result.split("\n")[0] : null;
37704
37747
  }
37705
- function parseVersion(raw) {
37748
+ function parseVersion2(raw) {
37706
37749
  const match = raw.match(/v?(\d+\.\d+(?:\.\d+)?(?:-[a-zA-Z0-9.]+)?)/);
37707
37750
  return match ? match[1] : raw.split("\n")[0].substring(0, 100);
37708
37751
  }
37709
37752
  function getVersion(binary, versionCommand) {
37710
37753
  if (versionCommand) {
37711
37754
  const raw = runCommand(versionCommand);
37712
- return raw ? parseVersion(raw) : null;
37755
+ return raw ? parseVersion2(raw) : null;
37713
37756
  }
37714
37757
  for (const flag of ["--version", "-V", "-v"]) {
37715
37758
  const raw = runCommand(`"${binary}" ${flag}`);
37716
- if (raw && raw.length < 500) return parseVersion(raw);
37759
+ if (raw && raw.length < 500) return parseVersion2(raw);
37717
37760
  }
37718
37761
  return null;
37719
37762
  }
@@ -40047,16 +40090,16 @@ var init_dev_server = __esm({
40047
40090
  resolveAutoImplWritableProviderDir(category, type, requestedDir) {
40048
40091
  const canonicalUserDir = path12.resolve(this.providerLoader.getUserProviderDir(category, type));
40049
40092
  const desiredDir = requestedDir ? path12.resolve(requestedDir) : canonicalUserDir;
40050
- if (desiredDir !== canonicalUserDir) {
40051
- return null;
40093
+ const upstreamRoot = path12.resolve(this.providerLoader.getUpstreamDir());
40094
+ if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path12.sep}`)) {
40095
+ return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
40052
40096
  }
40053
- const userRoot = path12.resolve(this.providerLoader.getUserDir());
40054
- if (desiredDir !== userRoot && !desiredDir.startsWith(`${userRoot}${path12.sep}`)) {
40055
- return null;
40097
+ if (path12.basename(desiredDir) !== type) {
40098
+ return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
40056
40099
  }
40057
40100
  const sourceDir = this.findProviderDir(type);
40058
40101
  if (!sourceDir) {
40059
- return null;
40102
+ return { dir: null, reason: `Provider source directory not found for '${type}'` };
40060
40103
  }
40061
40104
  if (!fs10.existsSync(desiredDir)) {
40062
40105
  fs10.mkdirSync(path12.dirname(desiredDir), { recursive: true });
@@ -40065,7 +40108,7 @@ var init_dev_server = __esm({
40065
40108
  }
40066
40109
  const providerJson = path12.join(desiredDir, "provider.json");
40067
40110
  if (!fs10.existsSync(providerJson)) {
40068
- return null;
40111
+ return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
40069
40112
  }
40070
40113
  try {
40071
40114
  const providerData = JSON.parse(fs10.readFileSync(providerJson, "utf-8"));
@@ -40073,10 +40116,13 @@ var init_dev_server = __esm({
40073
40116
  providerData.disableUpstream = true;
40074
40117
  fs10.writeFileSync(providerJson, JSON.stringify(providerData, null, 2));
40075
40118
  }
40076
- } catch {
40077
- return null;
40119
+ } catch (error48) {
40120
+ return {
40121
+ dir: null,
40122
+ reason: `Failed to update provider.json in writable provider directory: ${error48.message}`
40123
+ };
40078
40124
  }
40079
- return desiredDir;
40125
+ return { dir: desiredDir };
40080
40126
  }
40081
40127
  loadAutoImplReferenceScripts(referenceType) {
40082
40128
  if (!referenceType) return {};
@@ -40111,13 +40157,14 @@ var init_dev_server = __esm({
40111
40157
  this.json(res, 404, { error: `Provider not found: ${type}` });
40112
40158
  return;
40113
40159
  }
40114
- const providerDir = this.resolveAutoImplWritableProviderDir(provider.category, type, requestedProviderDir);
40115
- if (!providerDir) {
40160
+ const writableProvider = this.resolveAutoImplWritableProviderDir(provider.category, type, requestedProviderDir);
40161
+ if (!writableProvider.dir) {
40116
40162
  this.json(res, 409, {
40117
- error: `Auto-implement only writes to the canonical user provider directory for '${type}'.`
40163
+ error: writableProvider.reason || `Auto-implement only writes to the canonical user provider directory for '${type}'.`
40118
40164
  });
40119
40165
  return;
40120
40166
  }
40167
+ const providerDir = writableProvider.dir;
40121
40168
  try {
40122
40169
  const resolvedReference = this.resolveAutoImplReference(provider.category, reference, type);
40123
40170
  this.sendAutoImplSSE({
@@ -40810,6 +40857,9 @@ var init_dev_server = __esm({
40810
40857
  lines.push("8. Keep exports compatible with the existing `scripts.js` router (`module.exports = function ...`).");
40811
40858
  lines.push("9. Do not rewrite unrelated provider config. Only touch the scripts needed for this task unless a tiny supporting change is required.");
40812
40859
  lines.push("10. When the verification API returns `instanceId`, keep using that exact instance for follow-up `send`, `resolve`, `raw`, and `stop` calls. Do not assume type-only routing is safe if multiple sessions exist.");
40860
+ lines.push("11. Do NOT repeatedly dump the same target files. Read the target scripts once, reproduce the bug, then move directly to patching.");
40861
+ lines.push("12. If the user instructions include concrete screen text, raw PTY snippets, or a specific repro, treat that as the primary acceptance criteria.");
40862
+ lines.push("13. After the first successful live repro, stop broad diagnosis. Edit the scripts, reload, and verify. Do not burn tokens on repeated re-inspection without code changes.");
40813
40863
  lines.push("");
40814
40864
  lines.push("## Task");
40815
40865
  lines.push(`Edit files in \`${providerDir}\` to implement: **${functions.join(", ")}**`);
@@ -40851,6 +40901,9 @@ var init_dev_server = __esm({
40851
40901
  lines.push("");
40852
40902
  lines.push("Use `resolve` when the parsed modal buttons are correct. Use `raw` when the CLI expects a literal keystroke like `1`, `y`, or Enter. Repeat until idle.");
40853
40903
  lines.push("");
40904
+ lines.push("### Patch Discipline");
40905
+ lines.push("Once the repro is confirmed, immediately edit the target files. Avoid loops where you keep re-reading long files or re-running the same debug commands without changing code.");
40906
+ lines.push("");
40854
40907
  lines.push("### 5. Verify the side effects outside the CLI");
40855
40908
  lines.push("```bash");
40856
40909
  lines.push("test -f tmp/adhdev_provider_fix_test.py");
@@ -42754,7 +42807,7 @@ var init_adhdev_daemon = __esm({
42754
42807
  fs12 = __toESM(require("fs"));
42755
42808
  path14 = __toESM(require("path"));
42756
42809
  import_chalk2 = __toESM(require("chalk"));
42757
- pkgVersion = "0.6.75";
42810
+ pkgVersion = "0.6.76";
42758
42811
  if (pkgVersion === "unknown") {
42759
42812
  try {
42760
42813
  const possiblePaths = [