claws-code 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.
Files changed (180) hide show
  1. package/.claude/commands/claws-auto.md +90 -0
  2. package/.claude/commands/claws-bin.md +28 -0
  3. package/.claude/commands/claws-cleanup.md +28 -0
  4. package/.claude/commands/claws-do.md +82 -0
  5. package/.claude/commands/claws-fix.md +40 -0
  6. package/.claude/commands/claws-goal.md +111 -0
  7. package/.claude/commands/claws-help.md +54 -0
  8. package/.claude/commands/claws-plan.md +103 -0
  9. package/.claude/commands/claws-report.md +29 -0
  10. package/.claude/commands/claws-status.md +37 -0
  11. package/.claude/commands/claws-update.md +32 -0
  12. package/.claude/commands/claws.md +64 -0
  13. package/.claude/rules/claws-default-behavior.md +76 -0
  14. package/.claude/settings.json +112 -0
  15. package/.claude/settings.local.json +19 -0
  16. package/.claude/skills/claws-auto-engine/SKILL.md +97 -0
  17. package/.claude/skills/claws-goal-tracker/SKILL.md +106 -0
  18. package/.claude/skills/claws-prompt-templates/SKILL.md +203 -0
  19. package/.claude/skills/claws-wave-lead/SKILL.md +126 -0
  20. package/.claude/skills/claws-wave-subworker/SKILL.md +60 -0
  21. package/CHANGELOG.md +1949 -0
  22. package/LICENSE +21 -0
  23. package/README.md +420 -0
  24. package/bin/cli.js +84 -0
  25. package/cli.js +223 -0
  26. package/docs/ARCHITECTURE.md +511 -0
  27. package/docs/event-protocol.md +588 -0
  28. package/docs/features.md +562 -0
  29. package/docs/guide.md +891 -0
  30. package/docs/index.html +716 -0
  31. package/docs/protocol.md +323 -0
  32. package/extension/.vscodeignore +15 -0
  33. package/extension/CHANGELOG.md +1906 -0
  34. package/extension/LICENSE +21 -0
  35. package/extension/README.md +137 -0
  36. package/extension/docs/features.md +424 -0
  37. package/extension/docs/protocol.md +197 -0
  38. package/extension/esbuild.mjs +25 -0
  39. package/extension/icon.png +0 -0
  40. package/extension/native/.metadata.json +10 -0
  41. package/extension/native/node-pty/LICENSE +69 -0
  42. package/extension/native/node-pty/README.md +165 -0
  43. package/extension/native/node-pty/lib/conpty_console_list_agent.js +16 -0
  44. package/extension/native/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  45. package/extension/native/node-pty/lib/eventEmitter2.js +47 -0
  46. package/extension/native/node-pty/lib/eventEmitter2.js.map +1 -0
  47. package/extension/native/node-pty/lib/index.js +52 -0
  48. package/extension/native/node-pty/lib/index.js.map +1 -0
  49. package/extension/native/node-pty/lib/interfaces.js +7 -0
  50. package/extension/native/node-pty/lib/interfaces.js.map +1 -0
  51. package/extension/native/node-pty/lib/shared/conout.js +11 -0
  52. package/extension/native/node-pty/lib/shared/conout.js.map +1 -0
  53. package/extension/native/node-pty/lib/terminal.js +190 -0
  54. package/extension/native/node-pty/lib/terminal.js.map +1 -0
  55. package/extension/native/node-pty/lib/types.js +7 -0
  56. package/extension/native/node-pty/lib/types.js.map +1 -0
  57. package/extension/native/node-pty/lib/unixTerminal.js +346 -0
  58. package/extension/native/node-pty/lib/unixTerminal.js.map +1 -0
  59. package/extension/native/node-pty/lib/utils.js +39 -0
  60. package/extension/native/node-pty/lib/utils.js.map +1 -0
  61. package/extension/native/node-pty/lib/windowsConoutConnection.js +125 -0
  62. package/extension/native/node-pty/lib/windowsConoutConnection.js.map +1 -0
  63. package/extension/native/node-pty/lib/windowsPtyAgent.js +320 -0
  64. package/extension/native/node-pty/lib/windowsPtyAgent.js.map +1 -0
  65. package/extension/native/node-pty/lib/windowsTerminal.js +199 -0
  66. package/extension/native/node-pty/lib/windowsTerminal.js.map +1 -0
  67. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  68. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  69. package/extension/native/node-pty/package.json +64 -0
  70. package/extension/native/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  71. package/extension/native/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  72. package/extension/native/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  73. package/extension/native/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  74. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  75. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  76. package/extension/native/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  77. package/extension/native/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  78. package/extension/native/node-pty/prebuilds/win32-arm64/pty.node +0 -0
  79. package/extension/native/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  80. package/extension/native/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
  81. package/extension/native/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  82. package/extension/native/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  83. package/extension/native/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  84. package/extension/native/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  85. package/extension/native/node-pty/prebuilds/win32-x64/pty.node +0 -0
  86. package/extension/native/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  87. package/extension/native/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  88. package/extension/package-lock.json +605 -0
  89. package/extension/package.json +343 -0
  90. package/extension/scripts/bundle-native.mjs +104 -0
  91. package/extension/scripts/deploy-dev.mjs +60 -0
  92. package/extension/src/ansi-strip.ts +52 -0
  93. package/extension/src/backends/vscode/claws-pty.ts +483 -0
  94. package/extension/src/backends/vscode/status-bar.ts +99 -0
  95. package/extension/src/backends/vscode/vscode-backend.ts +282 -0
  96. package/extension/src/capture-store.ts +125 -0
  97. package/extension/src/event-log.ts +629 -0
  98. package/extension/src/event-schemas.ts +478 -0
  99. package/extension/src/extension.js +492 -0
  100. package/extension/src/extension.ts +873 -0
  101. package/extension/src/lifecycle-engine.ts +60 -0
  102. package/extension/src/lifecycle-rules.ts +171 -0
  103. package/extension/src/lifecycle-store.ts +506 -0
  104. package/extension/src/peer-registry.ts +176 -0
  105. package/extension/src/pipeline-registry.ts +82 -0
  106. package/extension/src/platform.ts +64 -0
  107. package/extension/src/protocol.ts +532 -0
  108. package/extension/src/server-config.ts +98 -0
  109. package/extension/src/server.ts +2210 -0
  110. package/extension/src/task-registry.ts +51 -0
  111. package/extension/src/terminal-backend.ts +211 -0
  112. package/extension/src/terminal-manager.ts +395 -0
  113. package/extension/src/topic-registry.ts +70 -0
  114. package/extension/src/topic-utils.ts +46 -0
  115. package/extension/src/transport.ts +45 -0
  116. package/extension/src/uninstall-cleanup.ts +232 -0
  117. package/extension/src/wave-registry.ts +314 -0
  118. package/extension/src/websocket-transport.ts +153 -0
  119. package/extension/tsconfig.json +23 -0
  120. package/lib/capabilities.js +145 -0
  121. package/lib/dry-run.js +43 -0
  122. package/lib/install.js +1018 -0
  123. package/lib/mcp-setup.js +92 -0
  124. package/lib/platform.js +240 -0
  125. package/lib/preflight.js +152 -0
  126. package/lib/shell-hook.js +343 -0
  127. package/lib/uninstall.js +162 -0
  128. package/lib/verify.js +166 -0
  129. package/mcp_server.js +3529 -0
  130. package/package.json +48 -0
  131. package/rules/claws-default-behavior.md +72 -0
  132. package/scripts/_helpers/atomic-file.mjs +137 -0
  133. package/scripts/_helpers/fix-repair.js +64 -0
  134. package/scripts/_helpers/json-safe.mjs +218 -0
  135. package/scripts/bump-version.sh +84 -0
  136. package/scripts/codegen/gen-docs.mjs +61 -0
  137. package/scripts/codegen/gen-json-schema.mjs +62 -0
  138. package/scripts/codegen/gen-mcp-tools.mjs +358 -0
  139. package/scripts/codegen/gen-types.mjs +172 -0
  140. package/scripts/codegen/index.mjs +42 -0
  141. package/scripts/dev-hooks/check-extension-dirs.js +77 -0
  142. package/scripts/dev-hooks/check-open-claws-terminals.js +70 -0
  143. package/scripts/dev-hooks/check-stale-main.js +55 -0
  144. package/scripts/dev-hooks/check-tag-pushed.js +51 -0
  145. package/scripts/dev-hooks/check-tag-vs-main.js +56 -0
  146. package/scripts/dev-vsix-install.sh +60 -0
  147. package/scripts/fix.sh +702 -0
  148. package/scripts/gen-client-types.mjs +81 -0
  149. package/scripts/git-hooks/pre-commit +31 -0
  150. package/scripts/hooks/lifecycle-state.js +61 -0
  151. package/scripts/hooks/package.json +4 -0
  152. package/scripts/hooks/post-tool-use-claws.js +292 -0
  153. package/scripts/hooks/pre-bash-no-verify-block.js +72 -0
  154. package/scripts/hooks/pre-tool-use-claws.js +206 -0
  155. package/scripts/hooks/session-start-claws.js +97 -0
  156. package/scripts/hooks/stop-claws.js +88 -0
  157. package/scripts/inject-claude-md.js +205 -0
  158. package/scripts/inject-dev-hooks.js +96 -0
  159. package/scripts/inject-global-claude-md.js +140 -0
  160. package/scripts/inject-settings-hooks.js +370 -0
  161. package/scripts/install.ps1 +146 -0
  162. package/scripts/install.sh +1729 -0
  163. package/scripts/monitor-arm-watch.js +155 -0
  164. package/scripts/rebuild-node-pty.sh +245 -0
  165. package/scripts/report.sh +232 -0
  166. package/scripts/shell-hook.fish +164 -0
  167. package/scripts/shell-hook.ps1 +33 -0
  168. package/scripts/shell-hook.sh +232 -0
  169. package/scripts/stream-events.js +399 -0
  170. package/scripts/terminal-wrapper.sh +36 -0
  171. package/scripts/test-enforcement.sh +132 -0
  172. package/scripts/test-install.sh +174 -0
  173. package/scripts/test-installer-parity.sh +135 -0
  174. package/scripts/test-template-enforcement.sh +76 -0
  175. package/scripts/uninstall.sh +143 -0
  176. package/scripts/update.sh +337 -0
  177. package/scripts/verify-release.sh +323 -0
  178. package/scripts/verify-wrapped.sh +194 -0
  179. package/templates/CLAUDE.global.md +135 -0
  180. package/templates/CLAUDE.project.md +37 -0
@@ -0,0 +1,343 @@
1
+ {
2
+ "name": "claws",
3
+ "displayName": "Claws: Programmable Terminal Bridge",
4
+ "description": "Turn every VS Code terminal into a programmable endpoint. List, create, send, execute, read, and close terminals from any external process via a local socket.",
5
+ "version": "0.8.0",
6
+ "publisher": "neunaha",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/neunaha/claws"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/neunaha/claws/issues"
14
+ },
15
+ "homepage": "https://github.com/neunaha/claws#readme",
16
+ "icon": "icon.png",
17
+ "engines": {
18
+ "vscode": "^1.93.0"
19
+ },
20
+ "galleryBanner": {
21
+ "color": "#111318",
22
+ "theme": "dark"
23
+ },
24
+ "categories": [
25
+ "Other",
26
+ "AI",
27
+ "Machine Learning"
28
+ ],
29
+ "keywords": [
30
+ "terminal",
31
+ "automation",
32
+ "orchestration",
33
+ "ai",
34
+ "pair-programming",
35
+ "remote-control",
36
+ "bridge",
37
+ "socket",
38
+ "claude-code",
39
+ "mcp",
40
+ "wave-army",
41
+ "workers"
42
+ ],
43
+ "main": "./dist/extension.js",
44
+ "activationEvents": [
45
+ "onStartupFinished",
46
+ "onCommand:claws.healthCheck",
47
+ "onCommand:claws.showLog",
48
+ "onCommand:claws.status",
49
+ "onCommand:claws.statusBar",
50
+ "onCommand:claws.listTerminals",
51
+ "onCommand:claws.rebuildPty",
52
+ "onCommand:claws.uninstallCleanup"
53
+ ],
54
+ "scripts": {
55
+ "schemas": "node ../scripts/codegen/index.mjs",
56
+ "compile": "npm run schemas && tsc --noEmit && node esbuild.mjs",
57
+ "build": "npm run schemas && node esbuild.mjs --production && node scripts/bundle-native.mjs",
58
+ "bundle-native": "node scripts/bundle-native.mjs",
59
+ "watch": "node esbuild.mjs --watch",
60
+ "deploy:dev": "npm run build && node scripts/deploy-dev.mjs",
61
+ "install:vsix": "bash ../scripts/dev-vsix-install.sh",
62
+ "typecheck": "tsc --noEmit",
63
+ "test:smoke": "node test/smoke.test.js",
64
+ "test:native": "node test/native-bundle.test.js",
65
+ "test:config": "node test/config-reload.test.js",
66
+ "test:capture-store": "node test/capture-store-trim.test.js",
67
+ "test:oversized": "node test/oversized-line.test.js",
68
+ "test:pty-lifecycle": "node test/pty-lifecycle.test.js",
69
+ "test:profile": "node test/profile-provider.test.js",
70
+ "test:multiconn": "node test/multi-connection.test.js",
71
+ "test:v2-hello": "node test/claws-v2-hello.test.js",
72
+ "test:v2-pubsub": "node test/claws-v2-pubsub.test.js",
73
+ "test:v2-tasks": "node test/claws-v2-tasks.test.js",
74
+ "test:v2-correlation-events": "node test/claws-v2-correlation-events.test.js",
75
+ "test:lifecycle-store": "node test/lifecycle-store.test.js",
76
+ "test:lifecycle-server": "node test/lifecycle-server.test.js",
77
+ "test:schemas": "node test/event-schemas.test.js",
78
+ "test:topic-registry": "node test/topic-registry.test.js",
79
+ "test:server-validation": "node test/server-validation.test.js",
80
+ "test:mcp-codegen": "node test/mcp-tools-codegen.test.js",
81
+ "test:sdk": "node test/sdk-cli.test.js",
82
+ "test:reverse-channel": "node test/reverse-channel.test.js",
83
+ "test:event-log": "node test/event-log.test.js",
84
+ "test:mcp-publish-flow": "node test/mcp-publish-flow.test.js",
85
+ "test:json-safe": "node test/json-safe.test.js",
86
+ "test:atomic-file": "node test/atomic-file.test.js",
87
+ "test:update-socket-probe": "node test/update-socket-probe.test.js",
88
+ "test:install-cleanup-race": "bash test/install-cleanup-race.test.sh",
89
+ "test:fix-rebuild-timeout": "bash test/fix-rebuild-timeout.test.sh",
90
+ "test:fix-editor-detect": "bash test/fix-editor-detect.test.sh",
91
+ "test:install-arch-verify": "bash test/install-arch-verify.test.sh",
92
+ "test:update-step6-editor": "bash test/update-step6-editor.test.sh",
93
+ "test:sdk-socket-timeout": "node test/sdk-socket-timeout.test.js",
94
+ "test:install-awk-anchor": "bash test/install-awk-anchor.test.sh",
95
+ "test:install-mcp-merge": "bash test/install-mcp-merge.test.sh",
96
+ "test:install-hooks-atomic": "bash test/install-hooks-atomic.test.sh",
97
+ "test:install-awk-empty": "bash test/install-awk-empty.test.sh",
98
+ "test:inject-claude-md-atomic": "node test/inject-claude-md-atomic.test.js",
99
+ "test:hooks-lifecycle-state-atomic": "node test/hooks-lifecycle-state-atomic.test.js",
100
+ "test:uninstall-cleanup-atomic": "node test/uninstall-cleanup-atomic.test.js",
101
+ "test:install-error-path": "bash test/install-error-path.test.sh",
102
+ "test:bundle-native-copy-atomic": "node test/bundle-native-copy-atomic.test.js",
103
+ "test:inject-settings-safe-merge": "node test/inject-settings-safe-merge.test.js",
104
+ "test:hook-misfire-log": "node test/hook-misfire-log.test.js",
105
+ "test:hook-cmd-explicit-if": "node test/hook-cmd-explicit-if.test.js",
106
+ "test:hook-stdin-safety": "node test/hook-stdin-safety.test.js",
107
+ "test:inject-settings-dedup": "node test/inject-settings-dedup.test.js",
108
+ "test:hookCmd-canonical-fast-path": "node test/hookCmd-canonical-fast-path.test.js",
109
+ "test:hook-strict-deny-newline": "node test/hook-strict-deny-newline.test.js",
110
+ "test:hook-debug-visibility": "node test/hook-debug-visibility.test.js",
111
+ "test:pre-tool-use-sidecar-recognized": "node test/pre-tool-use-sidecar-recognized.test.js",
112
+ "test:update-step6-timeout": "bash test/update-step6-timeout.test.sh",
113
+ "test:update-step6-orphan": "bash test/update-step6-orphan.test.sh",
114
+ "test:update-claws-log": "bash test/update-claws-log.test.sh",
115
+ "test:update-probe-path-quoting": "bash test/update-probe-path-quoting.test.sh",
116
+ "test:update-git-pull-fail": "bash test/update-git-pull-fail.test.sh",
117
+ "test:update-atomic-hooks": "bash test/update-atomic-hooks.test.sh",
118
+ "test:extension-rebuild-pty-timeout": "node test/extension-rebuild-pty-timeout.test.js",
119
+ "test:extension-plutil-timeout": "node test/extension-plutil-timeout.test.js",
120
+ "test:lifecycle-store-fsync": "node test/lifecycle-store-fsync.test.js",
121
+ "test:inject-settings-exclusive-lock": "node test/inject-settings-exclusive-lock.test.js",
122
+ "test:fix-mcp-handshake": "bash test/fix-mcp-handshake.test.sh",
123
+ "test:fix-mcp-repair": "bash test/fix-mcp-repair.test.sh",
124
+ "test:update-mcp-path-quoting": "bash test/update-mcp-path-quoting.test.sh",
125
+ "test:mcp-pconn-timeout": "node test/mcp-pconn-timeout.test.js",
126
+ "test:vehicle-state": "node test/claws-v2-vehicle-state.test.js",
127
+ "test:event-log-replay": "node test/claws-event-log-replay.test.js",
128
+ "test:event-log-retention": "node test/claws-event-log-retention.test.js",
129
+ "test:auth": "node test/claws-auth.test.js",
130
+ "test:ws-transport": "node test/claws-ws-transport.test.js",
131
+ "test:inject-dev-hooks": "node --test test/inject-dev-hooks.test.js",
132
+ "test:fix-malformed-settings": "bash test/fix-malformed-settings.test.sh",
133
+ "test:fix-multiple-ext-dirs": "bash test/fix-multiple-ext-dirs.test.sh",
134
+ "test:fix-claws-bin-integrity": "bash test/fix-claws-bin-integrity.test.sh",
135
+ "test:fix-shell-hook-sourcing": "bash test/fix-shell-hook-sourcing.test.sh",
136
+ "test:install-claws-bin-symlink-guard": "bash test/install-claws-bin-symlink-guard.test.sh",
137
+ "test:install-claws-dir-export": "bash test/install-claws-dir-export.test.sh",
138
+ "test:fix-mcp-recovery": "bash test/fix-mcp-recovery.test.sh",
139
+ "test:fix-pipe-mode-probe": "bash test/fix-pipe-mode-probe.test.sh",
140
+ "test:install-p3-hygiene": "bash test/install-p3-hygiene.test.sh",
141
+ "test:install-vsix-extraction-poll": "bash test/install-vsix-extraction-poll.test.sh",
142
+ "test:update-dry-run": "bash test/update-dry-run.test.sh",
143
+ "test:dev-hooks-path-canonical": "bash test/dev-hooks-path-canonical.test.sh",
144
+ "test:worker-fixes-v079": "node test/worker-fixes-v079.test.js",
145
+ "test:version-drift": "node test/version-drift.test.js",
146
+ "test:ondidclose-publish": "node test/onDidCloseTerminal-publish.test.js",
147
+ "test:terminal-manager": "node test/terminal-manager.test.js",
148
+ "test:worker-boot-paste-collapse": "node test/worker-boot-paste-collapse.test.js",
149
+ "test:install-sweep": "bash test/install-sweep.test.sh",
150
+ "test:monitor-rearm": "node test/monitor-rearm.test.js",
151
+ "test:monitor-arm-watch": "node test/monitor-arm-watch.test.js",
152
+ "test:monitor-corr-arm": "node test/monitor-corr-arm.test.js",
153
+ "test:terminal-alive": "node test/claws-terminal-alive.test.js",
154
+ "test:pty-windows-shell": "node test/pty-windows-shell.test.js",
155
+ "test:named-pipe-server": "node test/named-pipe-server.test.js",
156
+ "test:conpty-marker-scan": "node test/conpty-marker-scan.test.js",
157
+ "test:claws-windows-paths": "node test/claws-windows-paths.test.js",
158
+ "test:paste-gate": "node test/paste-gate.test.js",
159
+ "test:mac-event-driven-boot": "node test/mac-event-driven-boot.test.js",
160
+ "test": "npm run typecheck && npm run build && npm run test:smoke && npm run test:native && npm run test:config && npm run test:capture-store && npm run test:oversized && npm run test:pty-lifecycle && npm run test:profile && npm run test:multiconn && npm run test:v2-hello && npm run test:v2-pubsub && npm run test:v2-tasks && npm run test:v2-correlation-events && npm run test:lifecycle-store && npm run test:lifecycle-server && npm run test:schemas && npm run test:topic-registry && npm run test:server-validation && npm run test:mcp-codegen && npm run test:sdk && npm run test:reverse-channel && npm run test:event-log && npm run test:mcp-publish-flow && npm run test:json-safe && npm run test:atomic-file && npm run test:update-socket-probe && npm run test:install-cleanup-race && npm run test:fix-rebuild-timeout && npm run test:fix-editor-detect && npm run test:install-arch-verify && npm run test:update-step6-editor && npm run test:sdk-socket-timeout && npm run test:install-awk-anchor && npm run test:install-mcp-merge && npm run test:install-hooks-atomic && npm run test:install-awk-empty && npm run test:inject-claude-md-atomic && npm run test:hooks-lifecycle-state-atomic && npm run test:uninstall-cleanup-atomic && npm run test:install-error-path && npm run test:bundle-native-copy-atomic && npm run test:inject-settings-safe-merge && npm run test:hook-misfire-log && npm run test:hook-cmd-explicit-if && npm run test:hook-stdin-safety && npm run test:inject-settings-dedup && npm run test:hookCmd-canonical-fast-path && npm run test:hook-strict-deny-newline && npm run test:hook-debug-visibility && npm run test:update-step6-timeout && npm run test:update-step6-orphan && npm run test:update-claws-log && npm run test:update-probe-path-quoting && npm run test:update-git-pull-fail && npm run test:update-atomic-hooks && npm run test:extension-rebuild-pty-timeout && npm run test:extension-plutil-timeout && npm run test:lifecycle-store-fsync && npm run test:inject-settings-exclusive-lock && npm run test:fix-mcp-handshake && npm run test:fix-mcp-repair && npm run test:update-mcp-path-quoting && npm run test:mcp-pconn-timeout && npm run test:vehicle-state && npm run test:event-log-replay && npm run test:event-log-retention && npm run test:auth && npm run test:ws-transport && npm run test:inject-dev-hooks && npm run test:fix-malformed-settings && npm run test:fix-multiple-ext-dirs && npm run test:fix-claws-bin-integrity && npm run test:fix-shell-hook-sourcing && npm run test:install-claws-bin-symlink-guard && npm run test:install-claws-dir-export && npm run test:fix-mcp-recovery && npm run test:fix-pipe-mode-probe && npm run test:install-p3-hygiene && npm run test:install-vsix-extraction-poll && npm run test:update-dry-run && npm run test:dev-hooks-path-canonical && npm run test:worker-fixes-v079 && npm run test:version-drift && npm run test:pre-tool-use-sidecar-recognized && npm run test:ondidclose-publish && npm run test:terminal-manager && npm run test:worker-boot-paste-collapse && npm run test:install-sweep && npm run test:monitor-rearm && npm run test:monitor-arm-watch && npm run test:monitor-corr-arm && npm run test:terminal-alive && npm run test:pty-windows-shell && npm run test:named-pipe-server && npm run test:conpty-marker-scan && npm run test:claws-windows-paths && npm run test:paste-gate && npm run test:mac-event-driven-boot"
161
+ },
162
+ "devDependencies": {
163
+ "@types/node": "^20.11.0",
164
+ "@types/vscode": "^1.93.0",
165
+ "@types/ws": "^8.5.0",
166
+ "esbuild": "^0.24.0",
167
+ "typescript": "^5.4.0",
168
+ "zod": "^3.25.76",
169
+ "zod-to-json-schema": "^3.25.2"
170
+ },
171
+ "optionalDependencies": {
172
+ "@types/ws": "^8.18.1",
173
+ "node-pty": "^1.1.0",
174
+ "ws": "^8.20.0"
175
+ },
176
+ "contributes": {
177
+ "commands": [
178
+ {
179
+ "command": "claws.status",
180
+ "title": "Show Status",
181
+ "category": "Claws"
182
+ },
183
+ {
184
+ "command": "claws.statusBar",
185
+ "title": "Refresh Status Bar",
186
+ "category": "Claws"
187
+ },
188
+ {
189
+ "command": "claws.listTerminals",
190
+ "title": "List Terminals",
191
+ "category": "Claws"
192
+ },
193
+ {
194
+ "command": "claws.healthCheck",
195
+ "title": "Health Check",
196
+ "category": "Claws"
197
+ },
198
+ {
199
+ "command": "claws.showLog",
200
+ "title": "Show Log",
201
+ "category": "Claws"
202
+ },
203
+ {
204
+ "command": "claws.rebuildPty",
205
+ "title": "Rebuild Native PTY",
206
+ "category": "Claws"
207
+ },
208
+ {
209
+ "command": "claws.uninstallCleanup",
210
+ "title": "Uninstall Cleanup (remove Claws files from workspaces)",
211
+ "category": "Claws"
212
+ }
213
+ ],
214
+ "keybindings": [
215
+ {
216
+ "command": "claws.healthCheck",
217
+ "key": "ctrl+alt+c h",
218
+ "mac": "cmd+alt+c h",
219
+ "when": "editorTextFocus || !editorTextFocus"
220
+ },
221
+ {
222
+ "command": "claws.showLog",
223
+ "key": "ctrl+alt+c l",
224
+ "mac": "cmd+alt+c l",
225
+ "when": "editorTextFocus || !editorTextFocus"
226
+ },
227
+ {
228
+ "command": "claws.status",
229
+ "key": "ctrl+alt+c s",
230
+ "mac": "cmd+alt+c s",
231
+ "when": "editorTextFocus || !editorTextFocus"
232
+ }
233
+ ],
234
+ "terminal": {
235
+ "profiles": [
236
+ {
237
+ "id": "claws.wrappedTerminal",
238
+ "title": "Claws Wrapped Terminal",
239
+ "icon": "terminal-bash"
240
+ }
241
+ ]
242
+ },
243
+ "configuration": {
244
+ "title": "Claws",
245
+ "properties": {
246
+ "claws.socketPath": {
247
+ "type": "string",
248
+ "default": ".claws/claws.sock",
249
+ "description": "Relative path (from workspace root) for the Unix socket. Default: .claws/claws.sock"
250
+ },
251
+ "claws.logDirectory": {
252
+ "type": "string",
253
+ "default": ".claws/terminals",
254
+ "description": "Relative path for wrapped terminal pty logs. Default: .claws/terminals"
255
+ },
256
+ "claws.defaultWrapped": {
257
+ "type": "boolean",
258
+ "default": false,
259
+ "description": "Create all new terminals as wrapped (with pty logging) by default."
260
+ },
261
+ "claws.maxOutputBytes": {
262
+ "type": "number",
263
+ "default": 262144,
264
+ "description": "Maximum bytes of output buffered per command event (256KB default)."
265
+ },
266
+ "claws.maxHistory": {
267
+ "type": "number",
268
+ "default": 500,
269
+ "description": "Maximum command events retained in the ring buffer."
270
+ },
271
+ "claws.maxCaptureBytes": {
272
+ "type": "number",
273
+ "default": 1048576,
274
+ "description": "Maximum per-terminal output captured in the in-memory ring buffer for wrapped Pseudoterminal terminals (1 MB default)."
275
+ },
276
+ "claws.execTimeoutMs": {
277
+ "type": "number",
278
+ "default": 180000,
279
+ "description": "Default timeout for an `exec` command before the server rejects with timeout (milliseconds, 180s default). Individual requests may override via `timeoutMs` in the request payload."
280
+ },
281
+ "claws.pollLimit": {
282
+ "type": "number",
283
+ "default": 100,
284
+ "description": "Maximum number of history events returned by a single `poll` request. Responses exceeding this are truncated to the most-recent `limit` entries and include `truncated: true`."
285
+ },
286
+ "claws.enableWebSocket": {
287
+ "type": "boolean",
288
+ "default": false,
289
+ "description": "[Planned] Enable WebSocket server for cross-device access."
290
+ },
291
+ "claws.webSocketPort": {
292
+ "type": "number",
293
+ "default": 9876,
294
+ "description": "[Planned] Port for the WebSocket server."
295
+ },
296
+ "claws.strictEventValidation": {
297
+ "type": "boolean",
298
+ "default": false,
299
+ "description": "When true, the server rejects publish requests that fail envelope or payload schema validation. When false (default), validation failures emit system.malformed.received but the event is still fanned out."
300
+ },
301
+ "claws.heartbeatIntervalMs": {
302
+ "type": "number",
303
+ "default": 60000,
304
+ "minimum": 0,
305
+ "description": "Milliseconds between automatic system.heartbeat events emitted by the server. Set to 0 to disable. Default: 60000 ms (1 minute)."
306
+ },
307
+ "claws.auth.enabled": {
308
+ "type": "boolean",
309
+ "default": false,
310
+ "description": "[L18 AUTH] When true, hello requests must include a valid HMAC-SHA256 token. Requires claws.auth.tokenPath to be set."
311
+ },
312
+ "claws.auth.tokenPath": {
313
+ "type": "string",
314
+ "default": ".claws/auth.token",
315
+ "description": "[L18 AUTH] Path to the shared secret file used for HMAC-SHA256 token validation. Relative paths are resolved from the workspace root."
316
+ },
317
+ "claws.webSocket.enabled": {
318
+ "type": "boolean",
319
+ "default": false,
320
+ "description": "[L19 TRANSPORT-X] When true, a WebSocket server is started alongside the Unix socket transport. Requires the 'ws' npm package to be installed."
321
+ },
322
+ "claws.webSocket.port": {
323
+ "type": "number",
324
+ "default": 5678,
325
+ "minimum": 1024,
326
+ "maximum": 65535,
327
+ "description": "[L19 TRANSPORT-X] TCP port for the WebSocket server. Default: 5678."
328
+ },
329
+ "claws.webSocket.certPath": {
330
+ "type": "string",
331
+ "default": "",
332
+ "description": "[L19 TRANSPORT-X] Absolute path to TLS certificate file. When set (with keyPath), the server uses wss:// instead of ws://."
333
+ },
334
+ "claws.webSocket.keyPath": {
335
+ "type": "string",
336
+ "default": "",
337
+ "description": "[L19 TRANSPORT-X] Absolute path to TLS private key file. When set (with certPath), the server uses wss:// instead of ws://."
338
+ }
339
+ }
340
+ }
341
+ },
342
+ "private": false
343
+ }
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ // bundle-native.mjs — Harvest node-pty npm prebuilds into native/ for VSIX bundling.
3
+ // Copies node_modules/node-pty/prebuilds/<plat>/ → native/node-pty/prebuilds/<plat>/
4
+ // for each target platform, filtering .pdb files (Windows debug symbols, ~28 MB each).
5
+ // Also copies lib/, package.json, LICENSE, README.md from the node-pty install.
6
+ // Uses atomic staging (M-40) to prevent a kill-window leaving native/ empty.
7
+ //
8
+ // CLI flags:
9
+ // --strict exit non-zero on any warning (e.g. missing platform dir)
10
+
11
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, readdirSync, rmSync, renameSync, chmodSync } from 'node:fs';
12
+ import { dirname, join, resolve } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = dirname(__filename);
17
+ const EXT_ROOT = resolve(__dirname, '..');
18
+ const STRICT = process.argv.includes('--strict');
19
+
20
+ const NODE_PTY_SRC = join(EXT_ROOT, 'node_modules', 'node-pty');
21
+ const NATIVE_ROOT = join(EXT_ROOT, 'native');
22
+ const NATIVE_DEST = join(NATIVE_ROOT, 'node-pty');
23
+ const METADATA_PATH = join(NATIVE_ROOT, '.metadata.json');
24
+ const PLATFORMS = ['darwin-arm64', 'darwin-x64', 'win32-x64', 'win32-arm64'];
25
+
26
+ function log(msg) { process.stdout.write(`[bundle-native] ${msg}\n`); }
27
+ function warn(msg) { process.stderr.write(`[bundle-native] WARNING: ${msg}\n`); }
28
+ function fail(msg) { process.stderr.write(`[bundle-native] ERROR: ${msg}\n`); process.exit(1); }
29
+
30
+ function copyTree(src, dest) {
31
+ mkdirSync(dest, { recursive: true });
32
+ for (const entry of readdirSync(src, { withFileTypes: true })) {
33
+ const n = entry.name;
34
+ if (n.endsWith('.pdb') || n.endsWith('.d.ts') || n.endsWith('.test.js') || n.endsWith('.test.js.map')) continue;
35
+ const s = join(src, n), d = join(dest, n);
36
+ if (entry.isDirectory()) copyTree(s, d);
37
+ else copyFileSync(s, d);
38
+ }
39
+ }
40
+
41
+ function setupStagingDir() {
42
+ const staging = NATIVE_DEST + '.claws-new';
43
+ if (existsSync(staging)) rmSync(staging, { recursive: true, force: true });
44
+ mkdirSync(staging, { recursive: true });
45
+ return staging;
46
+ }
47
+
48
+ function main() {
49
+ log(`extension root: ${EXT_ROOT}`);
50
+ if (!existsSync(NODE_PTY_SRC)) fail(`node-pty not installed at ${NODE_PTY_SRC}. Run npm install.`);
51
+
52
+ const pkg = JSON.parse(readFileSync(join(NODE_PTY_SRC, 'package.json'), 'utf8'));
53
+ const nodePtyVersion = pkg.version;
54
+ log(`bundling node-pty@${nodePtyVersion}`);
55
+
56
+ const staging = setupStagingDir();
57
+ const platformsCopied = [];
58
+
59
+ // Copy prebuilds for each target platform, skipping .pdb files
60
+ for (const plat of PLATFORMS) {
61
+ const src = join(NODE_PTY_SRC, 'prebuilds', plat);
62
+ if (!existsSync(src)) {
63
+ warn(`prebuilds/${plat}/ not found in node-pty — skipping`);
64
+ if (STRICT) { rmSync(staging, { recursive: true, force: true }); process.exit(1); }
65
+ continue;
66
+ }
67
+ copyTree(src, join(staging, 'prebuilds', plat));
68
+ platformsCopied.push(plat);
69
+ log(` copied prebuilds/${plat}/`);
70
+ // Preserve executable bit on spawn-helper (darwin/linux only; win32 has no spawn-helper).
71
+ // node-pty uses posix_spawnp to exec spawn-helper; mode 0644 → posix_spawnp EACCES →
72
+ // every wrapped terminal falls back to pipe-mode. Guard with existsSync so win32
73
+ // prebuilds (which have no spawn-helper) never trip a spurious ENOENT.
74
+ const spawnHelperDest = join(staging, 'prebuilds', plat, 'spawn-helper');
75
+ if (existsSync(spawnHelperDest)) {
76
+ chmodSync(spawnHelperDest, 0o755);
77
+ log(` chmod +x ${plat}/spawn-helper`);
78
+ }
79
+ }
80
+
81
+ // Copy JS runtime (lib/) and metadata files
82
+ copyTree(join(NODE_PTY_SRC, 'lib'), join(staging, 'lib'));
83
+ for (const f of ['package.json', 'LICENSE', 'README.md']) {
84
+ const s = join(NODE_PTY_SRC, f);
85
+ if (existsSync(s)) copyFileSync(s, join(staging, f));
86
+ }
87
+
88
+ // M-40 atomic swap: staging → NATIVE_DEST via rename(2)
89
+ const oldDest = NATIVE_DEST + '.claws-old';
90
+ if (existsSync(NATIVE_DEST)) renameSync(NATIVE_DEST, oldDest);
91
+ renameSync(staging, NATIVE_DEST);
92
+ if (existsSync(oldDest)) { try { rmSync(oldDest, { recursive: true, force: true }); } catch { /* best-effort */ } }
93
+
94
+ // Write metadata for diagnostic visibility
95
+ writeFileSync(METADATA_PATH, JSON.stringify({
96
+ node_pty_version: nodePtyVersion,
97
+ copied_at: new Date().toISOString(),
98
+ platforms_included: platformsCopied,
99
+ }, null, 2) + '\n', 'utf8');
100
+ log(`wrote native/.metadata.json (${platformsCopied.length} platforms: ${platformsCopied.join(', ')})`);
101
+ log('[bundle-native] done.');
102
+ }
103
+
104
+ if (process.argv[1] === fileURLToPath(import.meta.url)) main();
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ // Deploys the freshly built extension into VS Code's installed-extensions
3
+ // directory so a window reload picks up local changes. Without this step
4
+ // `npm run build` only writes to ./dist — VS Code keeps loading whatever
5
+ // version was last installed via VSIX or the marketplace.
6
+ //
7
+ // Finds every `~/.vscode/extensions/<publisher>.<name>-*` directory matching
8
+ // the package.json publisher+name, copies dist/extension.js, and rsyncs the
9
+ // native/ bundle. Reports what was updated.
10
+
11
+ import { readFileSync, statSync, readdirSync, copyFileSync, mkdirSync, existsSync } from 'fs';
12
+ import { spawnSync } from 'child_process';
13
+ import { homedir } from 'os';
14
+ import { dirname, join } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+
17
+ const __dirname = dirname(fileURLToPath(import.meta.url));
18
+ const extRoot = join(__dirname, '..');
19
+ const pkg = JSON.parse(readFileSync(join(extRoot, 'package.json'), 'utf8'));
20
+ const slug = `${pkg.publisher}.${pkg.name}`;
21
+ const extensionsDir = join(homedir(), '.vscode', 'extensions');
22
+
23
+ const candidates = readdirSync(extensionsDir, { withFileTypes: true })
24
+ .filter((e) => e.isDirectory() && e.name.startsWith(slug + '-'))
25
+ .map((e) => join(extensionsDir, e.name));
26
+
27
+ if (candidates.length === 0) {
28
+ console.error(`[deploy-dev] no installed extension matching ${slug}-* in ${extensionsDir}`);
29
+ console.error(`[deploy-dev] install once with: code --install-extension <path-to.vsix>`);
30
+ process.exit(1);
31
+ }
32
+
33
+ const distSrc = join(extRoot, 'dist', 'extension.js');
34
+ const nativeSrc = join(extRoot, 'native');
35
+ try { statSync(distSrc); } catch { console.error(`[deploy-dev] missing ${distSrc} — run npm run build first`); process.exit(1); }
36
+
37
+ const pkgJsonSrc = join(extRoot, 'package.json');
38
+
39
+ let deployed = 0;
40
+ for (const target of candidates) {
41
+ const distDst = join(target, 'dist');
42
+ mkdirSync(distDst, { recursive: true });
43
+ copyFileSync(distSrc, join(distDst, 'extension.js'));
44
+ // Sync package.json so VS Code's UI shows the current version label.
45
+ // VS Code reads `version` from each installed-extension dir's package.json;
46
+ // without this copy, the panel keeps showing whatever version was first installed.
47
+ // See `.local/issues/10-deploy-dev-missing-package-json.md`.
48
+ copyFileSync(pkgJsonSrc, join(target, 'package.json'));
49
+ const r = spawnSync('rsync', ['-a', '--delete', nativeSrc + '/', join(target, 'native') + '/'], { stdio: 'inherit' });
50
+ if (r.status !== 0) { console.error(`[deploy-dev] rsync failed for ${target}`); process.exit(r.status ?? 1); }
51
+ // Copy display artifacts so VS Code Extensions panel shows title, icon, and changelog.
52
+ for (const artifact of ['README.md', 'CHANGELOG.md', 'icon.png']) {
53
+ const src = join(extRoot, artifact);
54
+ if (existsSync(src)) copyFileSync(src, join(target, artifact));
55
+ }
56
+ console.log(`[deploy-dev] updated ${target} (version ${pkg.version})`);
57
+ deployed++;
58
+ }
59
+
60
+ console.log(`[deploy-dev] ${deployed} install${deployed === 1 ? '' : 's'} updated. Reload VS Code: Cmd+Shift+P → Developer: Reload Window`);
@@ -0,0 +1,52 @@
1
+ // Strip ANSI escape sequences and most other control bytes from a pty log so
2
+ // it can be rendered as plain text. Handles the real-world sequences we see
3
+ // from wrapped terminals (shells, vim, claude, ink-based TUIs, etc):
4
+ //
5
+ // - CSI (Control Sequence Introducer): ESC [ ... final
6
+ // Covers simple `\x1b[0m`, parameterized `\x1b[?25h`, `\x1b[38;5;123m`,
7
+ // `\x1b[1;31;48;2;255;100;100m`, etc. Parameter bytes 0x30–0x3F,
8
+ // intermediate bytes 0x20–0x2F, final byte 0x40–0x7E.
9
+ //
10
+ // - OSC (Operating System Command): ESC ] ... terminator
11
+ // Used for terminal titles, hyperlinks, and iTerm proprietary sequences.
12
+ // Terminator is either BEL (\x07) or ST (ESC \\).
13
+ //
14
+ // - DCS (Device Control String): ESC P ... ST
15
+ // Used by sixel graphics, termcap queries, etc.
16
+ //
17
+ // - APC / PM / SOS: ESC _ / ESC ^ / ESC X — same terminator as DCS.
18
+ //
19
+ // - Single-char ESC sequences: ESC ( B, ESC ) 0, ESC =, ESC >, ESC M …
20
+ // Mostly charset selection and cursor save/restore.
21
+ //
22
+ // After removing escape sequences we also strip stray C0/C1 control bytes
23
+ // (with \t, \n, \r spared — they are meaningful plaintext).
24
+
25
+ const CSI_PATTERN = /\x1b\[[\x30-\x3f]*[\x20-\x2f]*[\x40-\x7e]/g;
26
+
27
+ // OSC: ESC ] ... (BEL | ESC \). Use a non-greedy match so consecutive
28
+ // sequences don't collapse into one. `[\s\S]` because OSC strings can
29
+ // technically contain newlines (e.g. tmux pass-through).
30
+ const OSC_PATTERN = /\x1b\][\s\S]*?(?:\x07|\x1b\\)/g;
31
+
32
+ // DCS / SOS / PM / APC: ESC [P^_X] ... ESC \\.
33
+ const DCS_PATTERN = /\x1b[P^_X][\s\S]*?\x1b\\/g;
34
+
35
+ // Single-char ESC followed by a final byte from 0x20–0x7E (non-CSI/OSC/DCS).
36
+ // Examples: `\x1b(B` (G0 = ASCII), `\x1b=` (keypad), `\x1bM` (reverse index).
37
+ // Must come AFTER CSI/OSC/DCS so we don't eat their introducers.
38
+ const SINGLE_ESC_PATTERN = /\x1b[\x20-\x2f]*[\x30-\x7e]/g;
39
+
40
+ // Bare ESC (no follow-on byte, e.g. ESC at end of stream) + C0 controls
41
+ // except tab/newline/carriage-return, plus DEL.
42
+ const CTRL_PATTERN = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g;
43
+
44
+ export function stripAnsi(text: string): string {
45
+ if (!text) return text;
46
+ return text
47
+ .replace(OSC_PATTERN, '')
48
+ .replace(DCS_PATTERN, '')
49
+ .replace(CSI_PATTERN, '')
50
+ .replace(SINGLE_ESC_PATTERN, '')
51
+ .replace(CTRL_PATTERN, '');
52
+ }