@adhdev/daemon-core 0.6.58 → 0.6.60
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.ts +1 -1
- package/dist/index.js +87 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/detection/ide-detector.ts +1 -1
- package/src/providers/provider-loader.ts +3 -6
- package/providers/_builtin/.github/workflows/generate-registry.yml +0 -76
- package/providers/_builtin/COMPATIBILITY.md +0 -217
- package/providers/_builtin/CONTRIBUTING.md +0 -200
- package/providers/_builtin/README.md +0 -119
- package/providers/_builtin/_helpers/index.js +0 -188
- package/providers/_builtin/acp/agentpool/provider.json +0 -54
- package/providers/_builtin/acp/amp/provider.json +0 -52
- package/providers/_builtin/acp/auggie/provider.json +0 -57
- package/providers/_builtin/acp/autodev/provider.json +0 -54
- package/providers/_builtin/acp/autohand/provider.json +0 -52
- package/providers/_builtin/acp/blackbox-ai/provider.json +0 -54
- package/providers/_builtin/acp/claude-agent/provider.json +0 -57
- package/providers/_builtin/acp/cline-acp/provider.json +0 -54
- package/providers/_builtin/acp/codebuddy/provider.json +0 -54
- package/providers/_builtin/acp/codex-cli/provider.json +0 -57
- package/providers/_builtin/acp/corust-agent/provider.json +0 -52
- package/providers/_builtin/acp/crow-cli/provider.json +0 -54
- package/providers/_builtin/acp/cursor-acp/provider.json +0 -54
- package/providers/_builtin/acp/deepagents/provider.json +0 -52
- package/providers/_builtin/acp/dimcode/provider.json +0 -54
- package/providers/_builtin/acp/docker-cagent/provider.json +0 -57
- package/providers/_builtin/acp/factory-droid/provider.json +0 -60
- package/providers/_builtin/acp/fast-agent/provider.json +0 -52
- package/providers/_builtin/acp/gemini-cli/provider.json +0 -114
- package/providers/_builtin/acp/github-copilot/provider.json +0 -54
- package/providers/_builtin/acp/goose/provider.json +0 -57
- package/providers/_builtin/acp/junie/provider.json +0 -52
- package/providers/_builtin/acp/kilo/provider.json +0 -54
- package/providers/_builtin/acp/kimi-cli/provider.json +0 -57
- package/providers/_builtin/acp/minion-code/provider.json +0 -52
- package/providers/_builtin/acp/mistral-vibe/provider.json +0 -57
- package/providers/_builtin/acp/nova/provider.json +0 -54
- package/providers/_builtin/acp/openclaw/provider.json +0 -54
- package/providers/_builtin/acp/opencode/provider.json +0 -52
- package/providers/_builtin/acp/openhands/provider.json +0 -54
- package/providers/_builtin/acp/pi-acp/provider.json +0 -52
- package/providers/_builtin/acp/qoder/provider.json +0 -54
- package/providers/_builtin/acp/qwen-code/provider.json +0 -60
- package/providers/_builtin/acp/stakpak/provider.json +0 -54
- package/providers/_builtin/acp/vtcode/provider.json +0 -54
- package/providers/_builtin/cli/aider-cli/provider.json +0 -37
- package/providers/_builtin/cli/aider-cli/scripts/1.0/detect_status.js +0 -20
- package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_approval.js +0 -10
- package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_output.js +0 -97
- package/providers/_builtin/cli/aider-cli/scripts/1.0/scripts.js +0 -7
- package/providers/_builtin/cli/claude-cli/provider.json +0 -121
- package/providers/_builtin/cli/claude-cli/scripts/1.0/detect_status.js +0 -83
- package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_approval.js +0 -97
- package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_output.js +0 -417
- package/providers/_builtin/cli/claude-cli/scripts/1.0/scripts.js +0 -42
- package/providers/_builtin/cli/codex-cli/provider.json +0 -90
- package/providers/_builtin/cli/codex-cli/scripts/1.0/detect_status.js +0 -54
- package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_approval.js +0 -91
- package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_output.js +0 -522
- package/providers/_builtin/cli/codex-cli/scripts/1.0/scripts.js +0 -11
- package/providers/_builtin/cli/cursor-cli/provider.json +0 -37
- package/providers/_builtin/cli/cursor-cli/scripts/1.0/detect_status.js +0 -19
- package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_approval.js +0 -10
- package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_output.js +0 -48
- package/providers/_builtin/cli/cursor-cli/scripts/1.0/scripts.js +0 -7
- package/providers/_builtin/cli/gemini-cli/provider.json +0 -109
- package/providers/_builtin/cli/gemini-cli/scripts/1.0/detect_status.js +0 -26
- package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_approval.js +0 -22
- package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_output.js +0 -71
- package/providers/_builtin/cli/gemini-cli/scripts/1.0/scripts.js +0 -12
- package/providers/_builtin/cli/github-copilot-cli/provider.json +0 -37
- package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/detect_status.js +0 -19
- package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_approval.js +0 -9
- package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_output.js +0 -48
- package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/scripts.js +0 -7
- package/providers/_builtin/cli/goose-cli/provider.json +0 -37
- package/providers/_builtin/cli/goose-cli/scripts/1.0/detect_status.js +0 -20
- package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_approval.js +0 -10
- package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_output.js +0 -48
- package/providers/_builtin/cli/goose-cli/scripts/1.0/scripts.js +0 -7
- package/providers/_builtin/cli/opencode-cli/provider.json +0 -37
- package/providers/_builtin/cli/opencode-cli/scripts/1.0/detect_status.js +0 -15
- package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_approval.js +0 -9
- package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_output.js +0 -48
- package/providers/_builtin/cli/opencode-cli/scripts/1.0/scripts.js +0 -7
- package/providers/_builtin/docs/CDP_SELECTOR_GUIDE.md +0 -370
- package/providers/_builtin/docs/PROVIDER_GUIDE.md +0 -916
- package/providers/_builtin/extension/cline/provider.json +0 -37
- package/providers/_builtin/extension/cline/scripts/1.0/focus_editor.js +0 -48
- package/providers/_builtin/extension/cline/scripts/1.0/list_chats.js +0 -100
- package/providers/_builtin/extension/cline/scripts/1.0/list_models.js +0 -43
- package/providers/_builtin/extension/cline/scripts/1.0/list_modes.js +0 -35
- package/providers/_builtin/extension/cline/scripts/1.0/new_session.js +0 -85
- package/providers/_builtin/extension/cline/scripts/1.0/open_panel.js +0 -25
- package/providers/_builtin/extension/cline/scripts/1.0/read_chat.js +0 -270
- package/providers/_builtin/extension/cline/scripts/1.0/resolve_action.js +0 -83
- package/providers/_builtin/extension/cline/scripts/1.0/scripts.js +0 -82
- package/providers/_builtin/extension/cline/scripts/1.0/send_message.js +0 -95
- package/providers/_builtin/extension/cline/scripts/1.0/set_mode.js +0 -36
- package/providers/_builtin/extension/cline/scripts/1.0/set_model.js +0 -36
- package/providers/_builtin/extension/cline/scripts/1.0/switch_session.js +0 -206
- package/providers/_builtin/extension/codex/provider.json +0 -38
- package/providers/_builtin/extension/codex/scripts/1.0/click_conversation_webview.js +0 -24
- package/providers/_builtin/extension/codex/scripts/1.0/explore_chat_webview.js +0 -110
- package/providers/_builtin/extension/codex/scripts/1.0/explore_controls_webview.js +0 -75
- package/providers/_builtin/extension/codex/scripts/1.0/explore_dom.js +0 -58
- package/providers/_builtin/extension/codex/scripts/1.0/explore_dropdown_webview.js +0 -64
- package/providers/_builtin/extension/codex/scripts/1.0/inspect_code_webview.js +0 -55
- package/providers/_builtin/extension/codex/scripts/1.0/list_models.js +0 -63
- package/providers/_builtin/extension/codex/scripts/1.0/list_modes.js +0 -140
- package/providers/_builtin/extension/codex/scripts/1.0/message_structure_webview.js +0 -79
- package/providers/_builtin/extension/codex/scripts/1.0/new_session.js +0 -26
- package/providers/_builtin/extension/codex/scripts/1.0/read_chat.js +0 -516
- package/providers/_builtin/extension/codex/scripts/1.0/resolve_action.js +0 -82
- package/providers/_builtin/extension/codex/scripts/1.0/send_message.js +0 -42
- package/providers/_builtin/extension/codex/scripts/1.0/set_mode.js +0 -165
- package/providers/_builtin/extension/codex/scripts/1.0/set_model.js +0 -86
- package/providers/_builtin/extension/roo-code/provider.json +0 -37
- package/providers/_builtin/extension/roo-code/scripts/1.0/scripts.js +0 -82
- package/providers/_builtin/ide/antigravity/provider.json +0 -88
- package/providers/_builtin/ide/antigravity/scripts/1.0/focus_editor.js +0 -20
- package/providers/_builtin/ide/antigravity/scripts/1.0/list_chats.js +0 -137
- package/providers/_builtin/ide/antigravity/scripts/1.0/list_models.js +0 -61
- package/providers/_builtin/ide/antigravity/scripts/1.0/list_modes.js +0 -72
- package/providers/_builtin/ide/antigravity/scripts/1.0/new_session.js +0 -75
- package/providers/_builtin/ide/antigravity/scripts/1.0/read_chat.js +0 -352
- package/providers/_builtin/ide/antigravity/scripts/1.0/resolve_action.js +0 -63
- package/providers/_builtin/ide/antigravity/scripts/1.0/scripts.js +0 -67
- package/providers/_builtin/ide/antigravity/scripts/1.0/send_message.js +0 -56
- package/providers/_builtin/ide/antigravity/scripts/1.0/set_mode.js +0 -67
- package/providers/_builtin/ide/antigravity/scripts/1.0/set_model.js +0 -72
- package/providers/_builtin/ide/antigravity/scripts/1.0/switch_session.js +0 -114
- package/providers/_builtin/ide/cursor/provider.json +0 -70
- package/providers/_builtin/ide/cursor/scripts/1.0/dismiss_notification.js +0 -30
- package/providers/_builtin/ide/cursor/scripts/1.0/focus_editor.js +0 -13
- package/providers/_builtin/ide/cursor/scripts/1.0/list_models.js +0 -78
- package/providers/_builtin/ide/cursor/scripts/1.0/list_modes.js +0 -40
- package/providers/_builtin/ide/cursor/scripts/1.0/list_notifications.js +0 -23
- package/providers/_builtin/ide/cursor/scripts/1.0/list_sessions.js +0 -42
- package/providers/_builtin/ide/cursor/scripts/1.0/new_session.js +0 -20
- package/providers/_builtin/ide/cursor/scripts/1.0/open_panel.js +0 -23
- package/providers/_builtin/ide/cursor/scripts/1.0/read_chat.js +0 -318
- package/providers/_builtin/ide/cursor/scripts/1.0/resolve_action.js +0 -19
- package/providers/_builtin/ide/cursor/scripts/1.0/scripts.js +0 -78
- package/providers/_builtin/ide/cursor/scripts/1.0/send_message.js +0 -23
- package/providers/_builtin/ide/cursor/scripts/1.0/set_mode.js +0 -38
- package/providers/_builtin/ide/cursor/scripts/1.0/set_model.js +0 -81
- package/providers/_builtin/ide/cursor/scripts/1.0/switch_session.js +0 -28
- package/providers/_builtin/ide/kiro/provider.json +0 -68
- package/providers/_builtin/ide/kiro/scripts/1.0/focus_editor.js +0 -20
- package/providers/_builtin/ide/kiro/scripts/1.0/open_panel.js +0 -47
- package/providers/_builtin/ide/kiro/scripts/1.0/resolve_action.js +0 -54
- package/providers/_builtin/ide/kiro/scripts/1.0/send_message.js +0 -29
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_dump_html.js +0 -1
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_models.js +0 -42
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_modes.js +0 -22
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_sessions.js +0 -21
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_new_session.js +0 -34
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_read_chat.js +0 -161
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_resolve_action.js +0 -62
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_send_message.js +0 -94
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_mode.js +0 -34
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_model.js +0 -47
- package/providers/_builtin/ide/kiro/scripts/1.0/webview_switch_session.js +0 -26
- package/providers/_builtin/ide/pearai/.tmp/after_rich.json +0 -157
- package/providers/_builtin/ide/pearai/.tmp/after_rich_raw.json +0 -161
- package/providers/_builtin/ide/pearai/.tmp/after_switch.json +0 -592
- package/providers/_builtin/ide/pearai/.tmp/after_switch_raw.json +0 -596
- package/providers/_builtin/ide/pearai/.tmp/home_dump_raw.json +0 -176
- package/providers/_builtin/ide/pearai/.tmp/items_raw.json +0 -778
- package/providers/_builtin/ide/pearai/.tmp/webview_dump.json +0 -157
- package/providers/_builtin/ide/pearai/.tmp/webview_dump_raw.json +0 -161
- package/providers/_builtin/ide/pearai/provider.json +0 -71
- package/providers/_builtin/ide/pearai/scripts/1.0/focus_editor.js +0 -16
- package/providers/_builtin/ide/pearai/scripts/1.0/list_models.js +0 -45
- package/providers/_builtin/ide/pearai/scripts/1.0/list_modes.js +0 -44
- package/providers/_builtin/ide/pearai/scripts/1.0/list_sessions.js +0 -93
- package/providers/_builtin/ide/pearai/scripts/1.0/new_session.js +0 -38
- package/providers/_builtin/ide/pearai/scripts/1.0/open_panel.js +0 -23
- package/providers/_builtin/ide/pearai/scripts/1.0/read_chat.js +0 -169
- package/providers/_builtin/ide/pearai/scripts/1.0/resolve_action.js +0 -60
- package/providers/_builtin/ide/pearai/scripts/1.0/scripts.js +0 -111
- package/providers/_builtin/ide/pearai/scripts/1.0/send_message.js +0 -104
- package/providers/_builtin/ide/pearai/scripts/1.0/set_mode.js +0 -51
- package/providers/_builtin/ide/pearai/scripts/1.0/set_model.js +0 -54
- package/providers/_builtin/ide/pearai/scripts/1.0/switch_session.js +0 -81
- package/providers/_builtin/ide/trae/provider.json +0 -72
- package/providers/_builtin/ide/trae/scripts/1.0/focus_editor.js +0 -20
- package/providers/_builtin/ide/trae/scripts/1.0/list_chats.js +0 -24
- package/providers/_builtin/ide/trae/scripts/1.0/list_models.js +0 -39
- package/providers/_builtin/ide/trae/scripts/1.0/list_modes.js +0 -39
- package/providers/_builtin/ide/trae/scripts/1.0/new_session.js +0 -30
- package/providers/_builtin/ide/trae/scripts/1.0/open_panel.js +0 -44
- package/providers/_builtin/ide/trae/scripts/1.0/read_chat.js +0 -113
- package/providers/_builtin/ide/trae/scripts/1.0/resolve_action.js +0 -54
- package/providers/_builtin/ide/trae/scripts/1.0/scripts.js +0 -82
- package/providers/_builtin/ide/trae/scripts/1.0/send_message.js +0 -69
- package/providers/_builtin/ide/trae/scripts/1.0/set_mode.js +0 -15
- package/providers/_builtin/ide/trae/scripts/1.0/set_model.js +0 -15
- package/providers/_builtin/ide/trae/scripts/1.0/switch_session.js +0 -23
- package/providers/_builtin/ide/vscode/provider.json +0 -74
- package/providers/_builtin/ide/vscode/scripts/1.0/focus_editor.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/list_models.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/list_sessions.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/new_session.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/open_panel.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/read_chat.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/resolve_action.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/scripts.js +0 -25
- package/providers/_builtin/ide/vscode/scripts/1.0/send_message.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/set_model.js +0 -1
- package/providers/_builtin/ide/vscode/scripts/1.0/switch_session.js +0 -1
- package/providers/_builtin/ide/vscode-insiders/provider.json +0 -68
- package/providers/_builtin/ide/vscodium/provider.json +0 -69
- package/providers/_builtin/ide/windsurf/provider.json +0 -57
- package/providers/_builtin/ide/windsurf/scripts/1.0/focus_editor.js +0 -36
- package/providers/_builtin/ide/windsurf/scripts/1.0/list_chats.js +0 -23
- package/providers/_builtin/ide/windsurf/scripts/1.0/list_models.js +0 -56
- package/providers/_builtin/ide/windsurf/scripts/1.0/list_modes.js +0 -63
- package/providers/_builtin/ide/windsurf/scripts/1.0/list_sessions.js +0 -79
- package/providers/_builtin/ide/windsurf/scripts/1.0/new_session.js +0 -58
- package/providers/_builtin/ide/windsurf/scripts/1.0/open_panel.js +0 -67
- package/providers/_builtin/ide/windsurf/scripts/1.0/read_chat.js +0 -253
- package/providers/_builtin/ide/windsurf/scripts/1.0/resolve_action.js +0 -82
- package/providers/_builtin/ide/windsurf/scripts/1.0/scripts.js +0 -82
- package/providers/_builtin/ide/windsurf/scripts/1.0/send_message.js +0 -20
- package/providers/_builtin/ide/windsurf/scripts/1.0/set_mode.js +0 -43
- package/providers/_builtin/ide/windsurf/scripts/1.0/set_model.js +0 -49
- package/providers/_builtin/ide/windsurf/scripts/1.0/switch_session.js +0 -82
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/focus_editor.js +0 -30
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_chats.js +0 -117
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_models.js +0 -39
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_modes.js +0 -39
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/new_session.js +0 -69
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/open_panel.js +0 -58
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/read_chat.js +0 -315
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/resolve_action.js +0 -68
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/scripts.js +0 -82
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/send_message.js +0 -87
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_mode.js +0 -15
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_model.js +0 -15
- package/providers/_builtin/ide/windsurf/scripts/1.0.bak/switch_session.js +0 -58
- package/providers/_builtin/registry.json +0 -376
- package/providers/_builtin/validate.js +0 -156
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "cline",
|
|
3
|
-
"name": "Cline",
|
|
4
|
-
"category": "extension",
|
|
5
|
-
"extensionId": "saoudrizwan.claude-dev",
|
|
6
|
-
"extensionIdPattern": "extensionId=saoudrizwan\\.claude-dev",
|
|
7
|
-
"extensionIdPattern_flags": "i",
|
|
8
|
-
"vscodeCommands": {
|
|
9
|
-
"focusPanel": "claude-dev.SidebarProvider.focus"
|
|
10
|
-
},
|
|
11
|
-
"settings": {
|
|
12
|
-
"approvalAlert": {
|
|
13
|
-
"type": "boolean",
|
|
14
|
-
"default": true,
|
|
15
|
-
"public": true,
|
|
16
|
-
"label": "Approval Notifications",
|
|
17
|
-
"description": "Show notification when approval is needed"
|
|
18
|
-
},
|
|
19
|
-
"longGeneratingAlert": {
|
|
20
|
-
"type": "boolean",
|
|
21
|
-
"default": true,
|
|
22
|
-
"public": true,
|
|
23
|
-
"label": "Long Generation Alert",
|
|
24
|
-
"description": "Alert when generation takes too long"
|
|
25
|
-
},
|
|
26
|
-
"longGeneratingThresholdSec": {
|
|
27
|
-
"type": "number",
|
|
28
|
-
"default": 180,
|
|
29
|
-
"public": true,
|
|
30
|
-
"label": "Long Generation Threshold (sec)",
|
|
31
|
-
"min": 30,
|
|
32
|
-
"max": 600
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"defaultScriptDir": "scripts/1.0",
|
|
36
|
-
"compatibility": []
|
|
37
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline v1 — focus_editor
|
|
3
|
-
*
|
|
4
|
-
* Cline webview iframe focus on input field inside.
|
|
5
|
-
* send_message Call before send_message or use for dashboard Focus button.
|
|
6
|
-
*
|
|
7
|
-
* final Check: 2026-03-07
|
|
8
|
-
*/
|
|
9
|
-
(() => {
|
|
10
|
-
try {
|
|
11
|
-
const inner = document.querySelector('iframe');
|
|
12
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
13
|
-
if (!doc) return 'no doc';
|
|
14
|
-
|
|
15
|
-
// data-testid first → fallback
|
|
16
|
-
let target = doc.querySelector('[data-testid="chat-input"]');
|
|
17
|
-
if (!target) {
|
|
18
|
-
const textareas = doc.querySelectorAll('textarea');
|
|
19
|
-
for (const ta of textareas) {
|
|
20
|
-
if (ta.offsetParent !== null && ta.offsetHeight > 20) {
|
|
21
|
-
target = ta;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (!target) {
|
|
27
|
-
// contenteditable fallback
|
|
28
|
-
const editables = doc.querySelectorAll('[contenteditable="true"]');
|
|
29
|
-
for (const el of editables) {
|
|
30
|
-
if (el.offsetParent !== null && el.offsetHeight > 10) {
|
|
31
|
-
target = el;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (!target) return 'no input';
|
|
37
|
-
|
|
38
|
-
target.focus();
|
|
39
|
-
// Move cursor to end
|
|
40
|
-
if (target.tagName === 'TEXTAREA' || target.tagName === 'INPUT') {
|
|
41
|
-
const len = (target.value || '').length;
|
|
42
|
-
target.setSelectionRange(len, len);
|
|
43
|
-
}
|
|
44
|
-
return 'focused';
|
|
45
|
-
} catch (e) {
|
|
46
|
-
return 'error: ' + e.message;
|
|
47
|
-
}
|
|
48
|
-
})()
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline v1 — list_chats (Fiber + DOM dual access)
|
|
3
|
-
*
|
|
4
|
-
* 1st: extract taskHistory array from React Fiber
|
|
5
|
-
* Search all of __reactFiber, __reactProps, __reactContainer
|
|
6
|
-
* 2nd: Virtuoso DOM parsing
|
|
7
|
-
*
|
|
8
|
-
* Return: JSON string — [{id, title, status, time, cost, tokensIn, tokensOut, modelId}]
|
|
9
|
-
*
|
|
10
|
-
* final Check: 2026-03-07
|
|
11
|
-
*/
|
|
12
|
-
(() => {
|
|
13
|
-
try {
|
|
14
|
-
const inner = document.querySelector('iframe');
|
|
15
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
16
|
-
if (!doc) return JSON.stringify({ error: 'no_doc', panel: 'hidden' });
|
|
17
|
-
|
|
18
|
-
// Fiber key search helper — search all __reactFiber, __reactProps, __reactContainer
|
|
19
|
-
const findFiberKey = (el) => Object.keys(el).find(k =>
|
|
20
|
-
k.startsWith('__reactFiber') || k.startsWith('__reactProps') || k.startsWith('__reactContainer'));
|
|
21
|
-
|
|
22
|
-
const getFiber = (el) => {
|
|
23
|
-
const fk = findFiberKey(el);
|
|
24
|
-
if (!fk) return null;
|
|
25
|
-
let fiber = el[fk];
|
|
26
|
-
// If __reactContainer, access inner fiber tree root
|
|
27
|
-
if (fk.startsWith('__reactContainer') && fiber?._internalRoot?.current) {
|
|
28
|
-
fiber = fiber._internalRoot.current;
|
|
29
|
-
}
|
|
30
|
-
return fiber;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// ─── 1st: search taskHistory from Fiber props ───
|
|
34
|
-
const allEls = doc.querySelectorAll('*');
|
|
35
|
-
let taskHistory = null;
|
|
36
|
-
|
|
37
|
-
for (const el of allEls) {
|
|
38
|
-
let fiber = getFiber(el);
|
|
39
|
-
if (!fiber) continue;
|
|
40
|
-
|
|
41
|
-
for (let d = 0; d < 30 && fiber; d++) {
|
|
42
|
-
const props = fiber.memoizedProps || fiber.pendingProps;
|
|
43
|
-
if (props && props.taskHistory && Array.isArray(props.taskHistory)) {
|
|
44
|
-
taskHistory = props.taskHistory;
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
// Also search in memoizedState chain
|
|
48
|
-
if (fiber.memoizedState) {
|
|
49
|
-
let st = fiber.memoizedState;
|
|
50
|
-
while (st) {
|
|
51
|
-
try {
|
|
52
|
-
const ms = st.memoizedState;
|
|
53
|
-
if (ms && typeof ms === 'object' && !Array.isArray(ms)) {
|
|
54
|
-
if (ms.taskHistory && Array.isArray(ms.taskHistory)) {
|
|
55
|
-
taskHistory = ms.taskHistory;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
} catch { }
|
|
60
|
-
st = st.next;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (taskHistory) break;
|
|
64
|
-
fiber = fiber.return;
|
|
65
|
-
}
|
|
66
|
-
if (taskHistory) break;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (taskHistory && taskHistory.length > 0) {
|
|
70
|
-
const results = taskHistory.slice(0, 50).map((task, i) => ({
|
|
71
|
-
id: task.id || String(task.ts),
|
|
72
|
-
title: (task.task || '').substring(0, 120),
|
|
73
|
-
status: i === 0 ? 'current' : '',
|
|
74
|
-
time: task.ts ? new Date(task.ts).toISOString() : '',
|
|
75
|
-
cost: task.totalCost ? `$${task.totalCost.toFixed(4)}` : '',
|
|
76
|
-
tokensIn: task.tokensIn || 0,
|
|
77
|
-
tokensOut: task.tokensOut || 0,
|
|
78
|
-
modelId: task.modelId || '',
|
|
79
|
-
size: task.size || 0,
|
|
80
|
-
isFavorited: !!task.isFavorited,
|
|
81
|
-
}));
|
|
82
|
-
return JSON.stringify(results);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ─── 2nd: Virtuoso DOM parsing ───
|
|
86
|
-
const items = doc.querySelectorAll('[data-item-index]');
|
|
87
|
-
if (items.length > 0) {
|
|
88
|
-
const results = Array.from(items).slice(0, 50).map(el => ({
|
|
89
|
-
id: el.getAttribute('data-item-index') || '',
|
|
90
|
-
title: (el.textContent || '').trim().substring(0, 120),
|
|
91
|
-
status: '',
|
|
92
|
-
}));
|
|
93
|
-
return JSON.stringify(results);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return JSON.stringify([]);
|
|
97
|
-
} catch (e) {
|
|
98
|
-
return JSON.stringify({ error: e.message || String(e) });
|
|
99
|
-
}
|
|
100
|
-
})()
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline — list_models
|
|
3
|
-
* Available from dropdown Model list + current Select return model
|
|
4
|
-
* → { models: string[], current: string }
|
|
5
|
-
*/
|
|
6
|
-
(async () => {
|
|
7
|
-
try {
|
|
8
|
-
const inner = document.querySelector('iframe');
|
|
9
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
10
|
-
if (!doc) return JSON.stringify({ models: [], current: '', error: 'no doc' });
|
|
11
|
-
|
|
12
|
-
// Current model: read from mode-switch or model selector
|
|
13
|
-
let current = '';
|
|
14
|
-
const modeSwitch = doc.querySelector('[data-testid="mode-switch"]');
|
|
15
|
-
if (modeSwitch) current = (modeSwitch.textContent || '').trim();
|
|
16
|
-
if (!current) {
|
|
17
|
-
const modelSel = doc.querySelector('[data-testid*="model"], [aria-label*="model" i]');
|
|
18
|
-
if (modelSel) current = (modelSel.textContent || '').trim();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Dropdown trigger search
|
|
22
|
-
const trigger = doc.querySelector('[data-testid="model-selector"], [data-testid*="model-dropdown"], [data-testid="dropdown-trigger"]');
|
|
23
|
-
if (!trigger) return JSON.stringify({ models: [], current, error: 'no model trigger' });
|
|
24
|
-
|
|
25
|
-
// Open dropdown
|
|
26
|
-
trigger.click();
|
|
27
|
-
await new Promise(r => setTimeout(r, 300));
|
|
28
|
-
|
|
29
|
-
// collect options
|
|
30
|
-
const options = doc.querySelectorAll('[data-testid*="dropdown-option"], [role="option"], [class*="dropdown"] [class*="item"], [class*="listbox"] [class*="option"]');
|
|
31
|
-
const models = [];
|
|
32
|
-
for (const opt of options) {
|
|
33
|
-
const text = (opt.textContent || '').trim();
|
|
34
|
-
if (text && text.length > 1 && text.length < 100) models.push(text);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// close
|
|
38
|
-
doc.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
|
|
39
|
-
if (trigger.click) trigger.click(); // fallback close
|
|
40
|
-
|
|
41
|
-
return JSON.stringify({ models: [...new Set(models)], current });
|
|
42
|
-
} catch (e) { return JSON.stringify({ models: [], current: '', error: e.message }); }
|
|
43
|
-
})()
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline — list_modes
|
|
3
|
-
* Available Mode list from mode selector + Return current mode
|
|
4
|
-
* → { modes: string[], current: string }
|
|
5
|
-
*/
|
|
6
|
-
(async () => {
|
|
7
|
-
try {
|
|
8
|
-
const inner = document.querySelector('iframe');
|
|
9
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
10
|
-
if (!doc) return JSON.stringify({ modes: [], current: '', error: 'no doc' });
|
|
11
|
-
|
|
12
|
-
// Current mode
|
|
13
|
-
const trigger = doc.querySelector('[data-testid="mode-selector-trigger"], [data-testid="mode-switch"]');
|
|
14
|
-
if (!trigger) return JSON.stringify({ modes: [], current: '', error: 'no mode trigger' });
|
|
15
|
-
const current = (trigger.textContent || '').trim();
|
|
16
|
-
|
|
17
|
-
// Open dropdown
|
|
18
|
-
trigger.click();
|
|
19
|
-
await new Promise(r => setTimeout(r, 300));
|
|
20
|
-
|
|
21
|
-
// collect options
|
|
22
|
-
const options = doc.querySelectorAll('[data-testid*="mode-option"], [role="option"], [class*="dropdown"] [class*="item"], [class*="listbox"] [class*="option"]');
|
|
23
|
-
const modes = [];
|
|
24
|
-
for (const opt of options) {
|
|
25
|
-
const text = (opt.textContent || '').trim();
|
|
26
|
-
if (text && text.length > 1 && text.length < 50) modes.push(text);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// close
|
|
30
|
-
doc.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
|
|
31
|
-
if (trigger.click) trigger.click(); // fallback close
|
|
32
|
-
|
|
33
|
-
return JSON.stringify({ modes: [...new Set(modes)], current });
|
|
34
|
-
} catch (e) { return JSON.stringify({ modes: [], current: '', error: e.message }); }
|
|
35
|
-
})()
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline v1 — new_session
|
|
3
|
-
*
|
|
4
|
-
* structure:
|
|
5
|
-
* 1. Click "New Task" button or "+" button
|
|
6
|
-
* 2. data-testid first → aria-label → text matching
|
|
7
|
-
*
|
|
8
|
-
* final Check: 2026-03-07
|
|
9
|
-
*/
|
|
10
|
-
(() => {
|
|
11
|
-
try {
|
|
12
|
-
const inner = document.querySelector('iframe');
|
|
13
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
14
|
-
if (!doc) return 'no doc';
|
|
15
|
-
|
|
16
|
-
const buttons = Array.from(doc.querySelectorAll('button'))
|
|
17
|
-
.filter(b => b.offsetWidth > 0 && b.offsetHeight > 0);
|
|
18
|
-
|
|
19
|
-
// ─── 1step: data-testid based ───
|
|
20
|
-
for (const btn of buttons) {
|
|
21
|
-
const testId = (btn.getAttribute('data-testid') || '').toLowerCase();
|
|
22
|
-
if (testId.includes('new-task') || testId.includes('new-chat') || testId.includes('new_task')) {
|
|
23
|
-
btn.click();
|
|
24
|
-
return 'clicked (testid)';
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ─── 2step: Based on aria-label ───
|
|
29
|
-
for (const btn of buttons) {
|
|
30
|
-
const ariaLabel = (btn.getAttribute('aria-label') || '').toLowerCase();
|
|
31
|
-
if (ariaLabel.includes('new task') || ariaLabel.includes('new chat')
|
|
32
|
-
|| ariaLabel.includes('plus') || ariaLabel === 'new') {
|
|
33
|
-
btn.click();
|
|
34
|
-
return 'clicked (aria)';
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ─── 3step: text matching ───
|
|
39
|
-
for (const btn of buttons) {
|
|
40
|
-
const text = (btn.textContent || '').trim();
|
|
41
|
-
if (text === '+' || text.includes('New Task') || text.includes('New Chat')) {
|
|
42
|
-
btn.click();
|
|
43
|
-
return 'clicked (text)';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ─── Step 4: SVG plus icon button ───
|
|
48
|
-
for (const btn of buttons) {
|
|
49
|
-
const svg = btn.querySelector('svg');
|
|
50
|
-
if (!svg) continue;
|
|
51
|
-
const path = svg.querySelector('path');
|
|
52
|
-
if (path) {
|
|
53
|
-
const d = path.getAttribute('d') || '';
|
|
54
|
-
// Common SVG plus icon path pattern
|
|
55
|
-
if (d.includes('M12') && (d.includes('H5') || d.includes('h') || d.includes('v'))) {
|
|
56
|
-
// Icon-only button with no other button text
|
|
57
|
-
const text = (btn.textContent || '').trim();
|
|
58
|
-
if (text.length < 3) {
|
|
59
|
-
btn.click();
|
|
60
|
-
return 'clicked (svg)';
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ─── Step 5: Welcome screen detect (already New session) ───
|
|
67
|
-
const bodyText = (doc.body.textContent || '').toLowerCase();
|
|
68
|
-
if (bodyText.includes('what can i do for you') || bodyText.includes('start a new task') || bodyText.includes('type your task')) {
|
|
69
|
-
return 'clicked (already new)';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ─── Step 6: History view detect → return to welcome by clicking Done ───
|
|
73
|
-
if (bodyText.includes('history') && bodyText.includes('done')) {
|
|
74
|
-
for (const btn of buttons) {
|
|
75
|
-
const text = (btn.textContent || '').trim();
|
|
76
|
-
if (text === 'Done') {
|
|
77
|
-
btn.click();
|
|
78
|
-
return 'clicked (history done)';
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return 'no button found';
|
|
84
|
-
} catch (e) { return 'error: ' + e.message; }
|
|
85
|
-
})()
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline v1 — open_panel
|
|
3
|
-
*
|
|
4
|
-
* Check panel status and attempt to open.
|
|
5
|
-
*
|
|
6
|
-
* VS Code API access is limited from iframe context,
|
|
7
|
-
* When panel is hidden 'panel_hidden' Return status.
|
|
8
|
-
* → daemon AgentStreamManager or
|
|
9
|
-
* agent_stream_focus must be opened via message.
|
|
10
|
-
*
|
|
11
|
-
* Return: 'visible' | 'panel_hidden'
|
|
12
|
-
* final Check: 2026-03-07
|
|
13
|
-
*/
|
|
14
|
-
(() => {
|
|
15
|
-
try {
|
|
16
|
-
const inner = document.querySelector('iframe');
|
|
17
|
-
const doc = inner?.contentDocument || inner?.contentWindow?.document;
|
|
18
|
-
if (!doc) return 'panel_hidden';
|
|
19
|
-
|
|
20
|
-
const root = doc.getElementById('root');
|
|
21
|
-
if (root && root.offsetHeight > 0) return 'visible';
|
|
22
|
-
|
|
23
|
-
return 'panel_hidden';
|
|
24
|
-
} catch (e) { return 'error: ' + e.message; }
|
|
25
|
-
})()
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cline v1 — read_chat (v2 — Fiber based Determine role)
|
|
3
|
-
*
|
|
4
|
-
* structure (Cline 3.x — saoudrizwan.claude-dev):
|
|
5
|
-
* 1. outer webview iframe → inner contentDocument
|
|
6
|
-
* 2. data-testid="virtuoso-item-list" (React Virtuoso) — active message blocks
|
|
7
|
-
* 3. React Fiber → extract message type directly from data array
|
|
8
|
-
* - type: "say", say: "user_feedback" → user
|
|
9
|
-
* - type: "say", say: "text" → assistant
|
|
10
|
-
* - type: "say", say: "checkpoint_created" → system (skip)
|
|
11
|
-
* - type: "ask", ask: "followup" → assistant (question)
|
|
12
|
-
* - type: "ask", ask: "tool" → assistant (tool approval wait)
|
|
13
|
-
* 4. Extract content from DOM textContent + sanitize
|
|
14
|
-
*
|
|
15
|
-
* final Check: 2026-03-07
|
|
16
|
-
*/
|
|
17
|
-
(() => {
|
|
18
|
-
try {
|
|
19
|
-
const inner = document.querySelector('iframe');
|
|
20
|
-
if (!inner) return JSON.stringify({ error: 'no inner iframe' });
|
|
21
|
-
const doc = inner.contentDocument || inner.contentWindow?.document;
|
|
22
|
-
if (!doc) return JSON.stringify({ error: 'cannot access contentDocument' });
|
|
23
|
-
|
|
24
|
-
const root = doc.getElementById('root');
|
|
25
|
-
if (!root) return JSON.stringify({ error: 'no root element' });
|
|
26
|
-
|
|
27
|
-
const isVisible = root.offsetHeight > 0;
|
|
28
|
-
|
|
29
|
-
// ─── 1. Extract data array from Fiber ───
|
|
30
|
-
const virtuosoList = doc.querySelector('[data-testid="virtuoso-item-list"]');
|
|
31
|
-
let fiberData = null;
|
|
32
|
-
|
|
33
|
-
if (virtuosoList && virtuosoList.children.length > 0) {
|
|
34
|
-
const firstItem = virtuosoList.children[0];
|
|
35
|
-
const fiberKey = Object.keys(firstItem).find(k =>
|
|
36
|
-
k.startsWith('__reactFiber') || k.startsWith('__reactInternalInstance')
|
|
37
|
-
);
|
|
38
|
-
if (fiberKey) {
|
|
39
|
-
let fiber = firstItem[fiberKey];
|
|
40
|
-
for (let d = 0; d < 25 && fiber; d++) {
|
|
41
|
-
const props = fiber.memoizedProps || fiber.pendingProps;
|
|
42
|
-
if (props && props.data && Array.isArray(props.data) && props.data.length > 0) {
|
|
43
|
-
fiberData = props.data;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
fiber = fiber.return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// ─── 2. Message parsing ───
|
|
52
|
-
const messages = [];
|
|
53
|
-
|
|
54
|
-
if (fiberData) {
|
|
55
|
-
// ★ Fiber based: most accurate Determine role
|
|
56
|
-
for (let i = 0; i < fiberData.length; i++) {
|
|
57
|
-
const item = fiberData[i];
|
|
58
|
-
if (!item || typeof item !== 'object') continue;
|
|
59
|
-
|
|
60
|
-
const msgType = item.type; // "say" or "ask"
|
|
61
|
-
const saySub = item.say; // "user_feedback", "text", "checkpoint_created", etc.
|
|
62
|
-
const askSub = item.ask; // "followup", "tool", "command", etc.
|
|
63
|
-
const text = item.text || '';
|
|
64
|
-
|
|
65
|
-
// Skip system events
|
|
66
|
-
if (saySub === 'checkpoint_created') continue;
|
|
67
|
-
if (saySub === 'api_req_started' || saySub === 'api_req_finished') continue;
|
|
68
|
-
if (saySub === 'shell_integration_warning') continue;
|
|
69
|
-
|
|
70
|
-
// Determine role
|
|
71
|
-
let role = 'assistant';
|
|
72
|
-
if (saySub === 'user_feedback') role = 'user';
|
|
73
|
-
if (saySub === 'user_feedback_diff') role = 'user';
|
|
74
|
-
|
|
75
|
-
// Extract content
|
|
76
|
-
let content = '';
|
|
77
|
-
if (text) {
|
|
78
|
-
// ask.followup text may be JSON
|
|
79
|
-
if (askSub === 'followup' && text.startsWith('{')) {
|
|
80
|
-
try {
|
|
81
|
-
const parsed = JSON.parse(text);
|
|
82
|
-
content = parsed.question || parsed.text || text;
|
|
83
|
-
} catch { content = text; }
|
|
84
|
-
} else {
|
|
85
|
-
content = text;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// DOM text fallback (when Fiber text is empty)
|
|
90
|
-
if (!content && virtuosoList && virtuosoList.children[i]) {
|
|
91
|
-
content = (virtuosoList.children[i].textContent || '').trim();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Skip too short or empty content
|
|
95
|
-
if (!content || content.length < 2) continue;
|
|
96
|
-
|
|
97
|
-
// Clean noise
|
|
98
|
-
content = content
|
|
99
|
-
.replace(/CheckpointCompareRestore(Save)?/gi, '')
|
|
100
|
-
.replace(/^\s*API Request.*$/gm, '')
|
|
101
|
-
.replace(/^\s*Cost:.*$/gm, '')
|
|
102
|
-
.replace(/\s{3,}/g, '\n')
|
|
103
|
-
.trim();
|
|
104
|
-
|
|
105
|
-
if (content.length < 2) continue;
|
|
106
|
-
|
|
107
|
-
// Preserve code blocks (extract structure from DOM)
|
|
108
|
-
if (virtuosoList.children[i]) {
|
|
109
|
-
const domItem = virtuosoList.children[i];
|
|
110
|
-
const preBlocks = domItem.querySelectorAll('pre');
|
|
111
|
-
if (preBlocks.length > 0 && role === 'assistant') {
|
|
112
|
-
let structured = '';
|
|
113
|
-
const walk = (node) => {
|
|
114
|
-
if (node.nodeType === 3) {
|
|
115
|
-
structured += node.textContent;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (node.nodeType !== 1) return;
|
|
119
|
-
const el = node;
|
|
120
|
-
if (el.tagName === 'PRE') {
|
|
121
|
-
const codeEl = el.querySelector('code');
|
|
122
|
-
const lang = codeEl ? (codeEl.className.match(/language-(\w+)/)?.[1] || '') : '';
|
|
123
|
-
const BLOCK_TAGS_C = new Set(['DIV', 'P', 'BR', 'LI', 'TR']);
|
|
124
|
-
const extractCode = (n) => {
|
|
125
|
-
if (n.nodeType === 3) return n.textContent || '';
|
|
126
|
-
if (n.nodeType !== 1) return '';
|
|
127
|
-
if (n.tagName === 'BR') return '\n';
|
|
128
|
-
const ps = [];
|
|
129
|
-
for (const c of n.childNodes) {
|
|
130
|
-
const ib = c.nodeType === 1 && BLOCK_TAGS_C.has(c.tagName);
|
|
131
|
-
const tx = extractCode(c);
|
|
132
|
-
if (tx) { if (ib && ps.length > 0) ps.push('\n'); ps.push(tx); if (ib) ps.push('\n'); }
|
|
133
|
-
}
|
|
134
|
-
return ps.join('').replace(/\n{2,}/g, '\n');
|
|
135
|
-
};
|
|
136
|
-
const code = extractCode(codeEl || el);
|
|
137
|
-
structured += '\n```' + lang + '\n' + code.trim() + '\n```\n';
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
for (const child of el.childNodes) walk(child);
|
|
141
|
-
};
|
|
142
|
-
walk(domItem);
|
|
143
|
-
const cleaned = structured.replace(/CheckpointCompareRestore(Save)?/gi, '').trim();
|
|
144
|
-
if (cleaned.length > content.length * 0.5) {
|
|
145
|
-
content = cleaned;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Length limit
|
|
151
|
-
if (content.length > 2000) content = content.substring(0, 2000) + '…';
|
|
152
|
-
|
|
153
|
-
messages.push({
|
|
154
|
-
role,
|
|
155
|
-
content,
|
|
156
|
-
timestamp: item.ts || (Date.now() - (fiberData.length - i) * 1000),
|
|
157
|
-
// Debug: Message subtype
|
|
158
|
-
_type: msgType,
|
|
159
|
-
_sub: saySub || askSub,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
} else if (virtuosoList && virtuosoList.children.length > 0) {
|
|
163
|
-
// Fallback: DOM based parsing (Fiber on access failure)
|
|
164
|
-
for (let i = 0; i < virtuosoList.children.length; i++) {
|
|
165
|
-
const item = virtuosoList.children[i];
|
|
166
|
-
const rawText = (item.textContent || '').trim();
|
|
167
|
-
if (!rawText || rawText.length < 2) continue;
|
|
168
|
-
if (/^Checkpoint(Compare|Restore|Save)/i.test(rawText)) continue;
|
|
169
|
-
if (/^(Thinking\.\.\.|Loading\.\.\.)$/i.test(rawText)) continue;
|
|
170
|
-
|
|
171
|
-
let role = 'assistant';
|
|
172
|
-
let content = rawText
|
|
173
|
-
.replace(/CheckpointCompareRestore(Save)?/gi, '')
|
|
174
|
-
.replace(/\s{3,}/g, '\n')
|
|
175
|
-
.trim();
|
|
176
|
-
if (content.length < 2) continue;
|
|
177
|
-
if (content.length > 2000) content = content.substring(0, 2000) + '…';
|
|
178
|
-
|
|
179
|
-
messages.push({ role, content, timestamp: Date.now() - (virtuosoList.children.length - i) * 1000 });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// ─── 3. Input field ───
|
|
184
|
-
let inputContent = '';
|
|
185
|
-
const chatInput = doc.querySelector('[data-testid="chat-input"]');
|
|
186
|
-
if (chatInput) {
|
|
187
|
-
inputContent = chatInput.value || chatInput.textContent || '';
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// ─── 4. Status determination ───
|
|
191
|
-
let status = 'idle';
|
|
192
|
-
const buttons = Array.from(doc.querySelectorAll('button'))
|
|
193
|
-
.filter(b => b.offsetWidth > 0);
|
|
194
|
-
const buttonTexts = buttons.map(b => (b.textContent || '').trim().toLowerCase());
|
|
195
|
-
|
|
196
|
-
if (buttonTexts.includes('cancel')) status = 'generating';
|
|
197
|
-
|
|
198
|
-
// Fiber datafrom last type=ask Check
|
|
199
|
-
if (fiberData && fiberData.length > 0) {
|
|
200
|
-
const last = fiberData[fiberData.length - 1];
|
|
201
|
-
if (last.type === 'ask') {
|
|
202
|
-
if (last.ask === 'followup') status = 'waiting_approval';
|
|
203
|
-
if (last.ask === 'tool' || last.ask === 'command') status = 'waiting_approval';
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// button based complement
|
|
208
|
-
const approvalPatterns = /^(proceed|approve|allow|accept|save|run command|yes|confirm)/i;
|
|
209
|
-
if (buttonTexts.some(b => approvalPatterns.test(b))) status = 'waiting_approval';
|
|
210
|
-
|
|
211
|
-
if (!isVisible && messages.length === 0) status = 'panel_hidden';
|
|
212
|
-
|
|
213
|
-
// ─── 5. model/mode ───
|
|
214
|
-
let model = '';
|
|
215
|
-
const modeSwitch = doc.querySelector('[data-testid="mode-switch"]');
|
|
216
|
-
if (modeSwitch) model = (modeSwitch.textContent || '').trim();
|
|
217
|
-
if (!model) {
|
|
218
|
-
const modelSel = doc.querySelector('[data-testid*="model"], [aria-label*="model" i]');
|
|
219
|
-
if (modelSel) model = (modelSel.textContent || '').trim();
|
|
220
|
-
}
|
|
221
|
-
const mode = modeSwitch ? (modeSwitch.textContent || '').trim() : '';
|
|
222
|
-
|
|
223
|
-
// ─── 6. Approval modal ───
|
|
224
|
-
let activeModal = null;
|
|
225
|
-
if (status === 'waiting_approval') {
|
|
226
|
-
const approvalBtns = buttons
|
|
227
|
-
.map(b => (b.textContent || '').trim())
|
|
228
|
-
.filter(t => t && t.length > 0 && t.length < 40 &&
|
|
229
|
-
/proceed|approve|allow|accept|run|yes|reject|deny|cancel|no|skip|save|confirm/i.test(t));
|
|
230
|
-
|
|
231
|
-
let modalMessage = 'Cline wants to perform an action';
|
|
232
|
-
if (fiberData && fiberData.length > 0) {
|
|
233
|
-
const last = fiberData[fiberData.length - 1];
|
|
234
|
-
if (last.ask === 'followup' && last.text) {
|
|
235
|
-
try {
|
|
236
|
-
const parsed = JSON.parse(last.text);
|
|
237
|
-
modalMessage = parsed.question || last.text.substring(0, 200);
|
|
238
|
-
} catch { modalMessage = last.text.substring(0, 200); }
|
|
239
|
-
} else if (last.ask === 'tool' || last.ask === 'command') {
|
|
240
|
-
modalMessage = `Cline wants to use ${last.ask}`;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (approvalBtns.length > 0) {
|
|
245
|
-
activeModal = { message: modalMessage, buttons: [...new Set(approvalBtns)] };
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// ─── 7. Token/Cost ───
|
|
250
|
-
let tokenInfo = '';
|
|
251
|
-
const costEl = doc.querySelector('[data-testid*="cost"], [data-testid*="token"]');
|
|
252
|
-
if (costEl) tokenInfo = (costEl.textContent || '').trim();
|
|
253
|
-
|
|
254
|
-
return JSON.stringify({
|
|
255
|
-
agentType: 'cline',
|
|
256
|
-
agentName: 'Cline',
|
|
257
|
-
extensionId: 'saoudrizwan.claude-dev',
|
|
258
|
-
status,
|
|
259
|
-
isVisible,
|
|
260
|
-
messages: messages.slice(-30),
|
|
261
|
-
inputContent,
|
|
262
|
-
model,
|
|
263
|
-
mode,
|
|
264
|
-
tokenInfo,
|
|
265
|
-
activeModal,
|
|
266
|
-
});
|
|
267
|
-
} catch (e) {
|
|
268
|
-
return JSON.stringify({ error: e.message || String(e) });
|
|
269
|
-
}
|
|
270
|
-
})()
|