coding-agent-adapters 0.7.4 → 0.8.0
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.cjs +72 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +72 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ParsedOutput } from 'pty-manager';
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from 'pty-manager';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Approval Presets
|
|
@@ -291,6 +291,17 @@ declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
|
291
291
|
* - General: "esc to interrupt" spinner status line
|
|
292
292
|
*/
|
|
293
293
|
detectLoading(output: string): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Detect if an external tool/process is running within the Claude session.
|
|
296
|
+
*
|
|
297
|
+
* Claude Code can launch external tools (browser, bash, Node, Python, etc.)
|
|
298
|
+
* that show status lines like "Claude in Chrome[javascript_tool]" or
|
|
299
|
+
* "[bash_tool]", "[python_tool]", etc.
|
|
300
|
+
*
|
|
301
|
+
* When detected, stall detection is suppressed and the UI can display
|
|
302
|
+
* which tool is active.
|
|
303
|
+
*/
|
|
304
|
+
detectToolRunning(output: string): ToolRunningInfo | null;
|
|
294
305
|
/**
|
|
295
306
|
* Detect task completion for Claude Code.
|
|
296
307
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ParsedOutput } from 'pty-manager';
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ToolRunningInfo, ParsedOutput } from 'pty-manager';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Approval Presets
|
|
@@ -291,6 +291,17 @@ declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
|
291
291
|
* - General: "esc to interrupt" spinner status line
|
|
292
292
|
*/
|
|
293
293
|
detectLoading(output: string): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Detect if an external tool/process is running within the Claude session.
|
|
296
|
+
*
|
|
297
|
+
* Claude Code can launch external tools (browser, bash, Node, Python, etc.)
|
|
298
|
+
* that show status lines like "Claude in Chrome[javascript_tool]" or
|
|
299
|
+
* "[bash_tool]", "[python_tool]", etc.
|
|
300
|
+
*
|
|
301
|
+
* When detected, stall detection is suppressed and the UI can display
|
|
302
|
+
* which tool is active.
|
|
303
|
+
*/
|
|
304
|
+
detectToolRunning(output: string): ToolRunningInfo | null;
|
|
294
305
|
/**
|
|
295
306
|
* Detect task completion for Claude Code.
|
|
296
307
|
*
|
package/dist/index.js
CHANGED
|
@@ -609,6 +609,15 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
609
609
|
description: "Decline anonymous usage data",
|
|
610
610
|
safe: true
|
|
611
611
|
},
|
|
612
|
+
{
|
|
613
|
+
pattern: /how is claude doing this session\?\s*\(optional\)|1:\s*bad\s+2:\s*fine\s+3:\s*good\s+0:\s*dismiss/i,
|
|
614
|
+
type: "config",
|
|
615
|
+
response: "0",
|
|
616
|
+
responseType: "text",
|
|
617
|
+
description: "Dismiss optional Claude session survey",
|
|
618
|
+
safe: true,
|
|
619
|
+
once: true
|
|
620
|
+
},
|
|
612
621
|
{
|
|
613
622
|
pattern: /continue without.*\[y\/n\]/i,
|
|
614
623
|
type: "config",
|
|
@@ -722,6 +731,39 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
722
731
|
instructions: loginDetection.instructions
|
|
723
732
|
};
|
|
724
733
|
}
|
|
734
|
+
if (/how is claude doing this session\?\s*\(optional\)|1:\s*bad\s+2:\s*fine\s+3:\s*good\s+0:\s*dismiss/i.test(stripped)) {
|
|
735
|
+
return {
|
|
736
|
+
detected: true,
|
|
737
|
+
type: "config",
|
|
738
|
+
prompt: "Claude session survey",
|
|
739
|
+
options: ["1", "2", "3", "0"],
|
|
740
|
+
suggestedResponse: "0",
|
|
741
|
+
canAutoRespond: true,
|
|
742
|
+
instructions: "Optional survey prompt; reply 0 to dismiss"
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
if (/enter\/tab\/space to toggle.*esc to cancel|enter to confirm.*esc to cancel|esc to close/i.test(stripped)) {
|
|
746
|
+
return {
|
|
747
|
+
detected: true,
|
|
748
|
+
type: "config",
|
|
749
|
+
prompt: "Claude dialog awaiting navigation",
|
|
750
|
+
options: ["keys:enter", "keys:esc", "keys:down,enter"],
|
|
751
|
+
suggestedResponse: "keys:esc",
|
|
752
|
+
canAutoRespond: false,
|
|
753
|
+
instructions: "Use Enter/Esc or arrow keys to navigate this dialog"
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
if (/\/agents\b|\/chrome\b|\/config\b|\/tasks\b|\/skills\b|\/remote-env\b|press .* to navigate .* enter .* esc/i.test(stripped)) {
|
|
757
|
+
return {
|
|
758
|
+
detected: true,
|
|
759
|
+
type: "config",
|
|
760
|
+
prompt: "Claude menu navigation required",
|
|
761
|
+
options: ["keys:esc", "keys:enter", "keys:down,enter"],
|
|
762
|
+
suggestedResponse: "keys:esc",
|
|
763
|
+
canAutoRespond: false,
|
|
764
|
+
instructions: "Claude is showing an interactive menu; use arrow keys + Enter or Esc"
|
|
765
|
+
};
|
|
766
|
+
}
|
|
725
767
|
if (/Do you want to|wants? (your )?permission|needs your permission/i.test(stripped)) {
|
|
726
768
|
return {
|
|
727
769
|
detected: true,
|
|
@@ -793,6 +835,36 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
793
835
|
}
|
|
794
836
|
return false;
|
|
795
837
|
}
|
|
838
|
+
/**
|
|
839
|
+
* Detect if an external tool/process is running within the Claude session.
|
|
840
|
+
*
|
|
841
|
+
* Claude Code can launch external tools (browser, bash, Node, Python, etc.)
|
|
842
|
+
* that show status lines like "Claude in Chrome[javascript_tool]" or
|
|
843
|
+
* "[bash_tool]", "[python_tool]", etc.
|
|
844
|
+
*
|
|
845
|
+
* When detected, stall detection is suppressed and the UI can display
|
|
846
|
+
* which tool is active.
|
|
847
|
+
*/
|
|
848
|
+
detectToolRunning(output) {
|
|
849
|
+
const stripped = this.stripAnsi(output);
|
|
850
|
+
const tail = stripped.slice(-500);
|
|
851
|
+
const toolMatch = tail.match(/\[(\w+_tool)\]/i);
|
|
852
|
+
if (toolMatch) {
|
|
853
|
+
const toolType = toolMatch[1].toLowerCase();
|
|
854
|
+
const friendlyName = toolType.replace(/_tool$/i, "");
|
|
855
|
+
const contextMatch = tail.match(/(?:Claude\s+in|Running|Using)\s+(\S+)/i);
|
|
856
|
+
const description = contextMatch ? `${contextMatch[1]} (${toolType})` : toolType;
|
|
857
|
+
return { toolName: friendlyName, description };
|
|
858
|
+
}
|
|
859
|
+
const appMatch = tail.match(/Claude\s+in\s+(\w+)/i);
|
|
860
|
+
if (appMatch) {
|
|
861
|
+
return {
|
|
862
|
+
toolName: appMatch[1].toLowerCase(),
|
|
863
|
+
description: `Claude in ${appMatch[1]}`
|
|
864
|
+
};
|
|
865
|
+
}
|
|
866
|
+
return null;
|
|
867
|
+
}
|
|
796
868
|
/**
|
|
797
869
|
* Detect task completion for Claude Code.
|
|
798
870
|
*
|
|
@@ -807,7 +879,6 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
807
879
|
detectTaskComplete(output) {
|
|
808
880
|
const stripped = this.stripAnsi(output);
|
|
809
881
|
if (!stripped.trim()) return false;
|
|
810
|
-
if (this.detectLoading(stripped)) return false;
|
|
811
882
|
if (/trust.*directory|do you want to|needs? your permission/i.test(stripped)) {
|
|
812
883
|
return false;
|
|
813
884
|
}
|
|
@@ -825,7 +896,6 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
825
896
|
detectReady(output) {
|
|
826
897
|
const stripped = this.stripAnsi(output);
|
|
827
898
|
if (!stripped.trim()) return false;
|
|
828
|
-
if (this.detectLoading(stripped)) return false;
|
|
829
899
|
if (/trust.*directory|do you want to|needs? your permission/i.test(stripped)) {
|
|
830
900
|
return false;
|
|
831
901
|
}
|
|
@@ -1485,7 +1555,6 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
1485
1555
|
detectTaskComplete(output) {
|
|
1486
1556
|
const stripped = this.stripAnsi(output);
|
|
1487
1557
|
if (!stripped.trim()) return false;
|
|
1488
|
-
if (this.detectLoading(stripped)) return false;
|
|
1489
1558
|
const hasWorkedFor = /Worked\s+for\s+\d+(?:h\s+\d{2}m\s+\d{2}s|m\s+\d{2}s|s)/.test(stripped);
|
|
1490
1559
|
const hasComposerPrompt = /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(stripped) || /^\s*›\s*(?!\d+\.)\S.*$/m.test(stripped);
|
|
1491
1560
|
const hasIdleFooterHints = /\?\s+for\s+shortcuts/i.test(stripped) || /context\s+left/i.test(stripped) || /tab\s+to\s+queue\s+message/i.test(stripped);
|
|
@@ -1503,7 +1572,6 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
1503
1572
|
detectReady(output) {
|
|
1504
1573
|
const stripped = this.stripAnsi(output);
|
|
1505
1574
|
if (!stripped.trim()) return false;
|
|
1506
|
-
if (this.detectLoading(stripped)) return false;
|
|
1507
1575
|
const tail = stripped.slice(-1200);
|
|
1508
1576
|
const hasComposerPrompt = /^\s*›\s*(?!\d+\.)\S.*$/m.test(tail) || /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(tail);
|
|
1509
1577
|
const hasComposerFooter = /\?\s+for\s+shortcuts/i.test(tail) || /context\s+left/i.test(tail) || /tab\s+to\s+queue\s+message/i.test(tail) || /shift\s*\+\s*enter\s+for\s+newline/i.test(tail);
|