@a1hvdy/cc-openclaw 0.3.2

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 (491) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +207 -0
  3. package/configs/.gitkeep +0 -0
  4. package/configs/council-reviewer-prompt.md +82 -0
  5. package/configs/council-system-prompt.md +141 -0
  6. package/dist/scripts/bench/ab-harness.d.ts +58 -0
  7. package/dist/scripts/bench/ab-harness.d.ts.map +1 -0
  8. package/dist/scripts/bench/ab-harness.js +78 -0
  9. package/dist/scripts/bench/ab-harness.js.map +1 -0
  10. package/dist/src/channels/adapter.d.ts +103 -0
  11. package/dist/src/channels/adapter.d.ts.map +1 -0
  12. package/dist/src/channels/adapter.js +38 -0
  13. package/dist/src/channels/adapter.js.map +1 -0
  14. package/dist/src/channels/telegram/completion-summary.d.ts +22 -0
  15. package/dist/src/channels/telegram/completion-summary.d.ts.map +1 -0
  16. package/dist/src/channels/telegram/completion-summary.js +186 -0
  17. package/dist/src/channels/telegram/completion-summary.js.map +1 -0
  18. package/dist/src/channels/telegram/error-renderer.d.ts +30 -0
  19. package/dist/src/channels/telegram/error-renderer.d.ts.map +1 -0
  20. package/dist/src/channels/telegram/error-renderer.js +133 -0
  21. package/dist/src/channels/telegram/error-renderer.js.map +1 -0
  22. package/dist/src/channels/telegram/event-reducer.d.ts +34 -0
  23. package/dist/src/channels/telegram/event-reducer.d.ts.map +1 -0
  24. package/dist/src/channels/telegram/event-reducer.js +579 -0
  25. package/dist/src/channels/telegram/event-reducer.js.map +1 -0
  26. package/dist/src/channels/telegram/index.d.ts +14 -0
  27. package/dist/src/channels/telegram/index.d.ts.map +1 -0
  28. package/dist/src/channels/telegram/index.js +14 -0
  29. package/dist/src/channels/telegram/index.js.map +1 -0
  30. package/dist/src/channels/telegram/injector.d.ts +54 -0
  31. package/dist/src/channels/telegram/injector.d.ts.map +1 -0
  32. package/dist/src/channels/telegram/injector.js +200 -0
  33. package/dist/src/channels/telegram/injector.js.map +1 -0
  34. package/dist/src/channels/telegram/live-card.d.ts +230 -0
  35. package/dist/src/channels/telegram/live-card.d.ts.map +1 -0
  36. package/dist/src/channels/telegram/live-card.js +916 -0
  37. package/dist/src/channels/telegram/live-card.js.map +1 -0
  38. package/dist/src/channels/telegram/state-machine.d.ts +23 -0
  39. package/dist/src/channels/telegram/state-machine.d.ts.map +1 -0
  40. package/dist/src/channels/telegram/state-machine.js +72 -0
  41. package/dist/src/channels/telegram/state-machine.js.map +1 -0
  42. package/dist/src/channels/telegram/tool-tracker.d.ts +147 -0
  43. package/dist/src/channels/telegram/tool-tracker.d.ts.map +1 -0
  44. package/dist/src/channels/telegram/tool-tracker.js +520 -0
  45. package/dist/src/channels/telegram/tool-tracker.js.map +1 -0
  46. package/dist/src/circuit-breaker.d.ts +22 -0
  47. package/dist/src/circuit-breaker.d.ts.map +1 -0
  48. package/dist/src/circuit-breaker.js +47 -0
  49. package/dist/src/circuit-breaker.js.map +1 -0
  50. package/dist/src/command-router/cc-handler.d.ts +67 -0
  51. package/dist/src/command-router/cc-handler.d.ts.map +1 -0
  52. package/dist/src/command-router/cc-handler.js +980 -0
  53. package/dist/src/command-router/cc-handler.js.map +1 -0
  54. package/dist/src/command-router/index.d.ts +3 -0
  55. package/dist/src/command-router/index.d.ts.map +1 -0
  56. package/dist/src/command-router/index.js +2 -0
  57. package/dist/src/command-router/index.js.map +1 -0
  58. package/dist/src/constants.d.ts +132 -0
  59. package/dist/src/constants.d.ts.map +1 -0
  60. package/dist/src/constants.js +140 -0
  61. package/dist/src/constants.js.map +1 -0
  62. package/dist/src/council/consensus.d.ts +21 -0
  63. package/dist/src/council/consensus.d.ts.map +1 -0
  64. package/dist/src/council/consensus.js +52 -0
  65. package/dist/src/council/consensus.js.map +1 -0
  66. package/dist/src/council/council.d.ts +68 -0
  67. package/dist/src/council/council.d.ts.map +1 -0
  68. package/dist/src/council/council.js +914 -0
  69. package/dist/src/council/council.js.map +1 -0
  70. package/dist/src/council/index.d.ts +3 -0
  71. package/dist/src/council/index.d.ts.map +1 -0
  72. package/dist/src/council/index.js +3 -0
  73. package/dist/src/council/index.js.map +1 -0
  74. package/dist/src/engines/base-oneshot-session.d.ts +88 -0
  75. package/dist/src/engines/base-oneshot-session.d.ts.map +1 -0
  76. package/dist/src/engines/base-oneshot-session.js +228 -0
  77. package/dist/src/engines/base-oneshot-session.js.map +1 -0
  78. package/dist/src/engines/index.d.ts +7 -0
  79. package/dist/src/engines/index.d.ts.map +1 -0
  80. package/dist/src/engines/index.js +7 -0
  81. package/dist/src/engines/index.js.map +1 -0
  82. package/dist/src/engines/persistent-codex-session.d.ts +17 -0
  83. package/dist/src/engines/persistent-codex-session.d.ts.map +1 -0
  84. package/dist/src/engines/persistent-codex-session.js +106 -0
  85. package/dist/src/engines/persistent-codex-session.js.map +1 -0
  86. package/dist/src/engines/persistent-cursor-session.d.ts +22 -0
  87. package/dist/src/engines/persistent-cursor-session.d.ts.map +1 -0
  88. package/dist/src/engines/persistent-cursor-session.js +242 -0
  89. package/dist/src/engines/persistent-cursor-session.js.map +1 -0
  90. package/dist/src/engines/persistent-custom-session.d.ts +79 -0
  91. package/dist/src/engines/persistent-custom-session.d.ts.map +1 -0
  92. package/dist/src/engines/persistent-custom-session.js +939 -0
  93. package/dist/src/engines/persistent-custom-session.js.map +1 -0
  94. package/dist/src/engines/persistent-gemini-session.d.ts +22 -0
  95. package/dist/src/engines/persistent-gemini-session.d.ts.map +1 -0
  96. package/dist/src/engines/persistent-gemini-session.js +217 -0
  97. package/dist/src/engines/persistent-gemini-session.js.map +1 -0
  98. package/dist/src/engines/persistent-session.d.ts +77 -0
  99. package/dist/src/engines/persistent-session.d.ts.map +1 -0
  100. package/dist/src/engines/persistent-session.js +730 -0
  101. package/dist/src/engines/persistent-session.js.map +1 -0
  102. package/dist/src/health/handler.d.ts +40 -0
  103. package/dist/src/health/handler.d.ts.map +1 -0
  104. package/dist/src/health/handler.js +70 -0
  105. package/dist/src/health/handler.js.map +1 -0
  106. package/dist/src/health/index.d.ts +2 -0
  107. package/dist/src/health/index.d.ts.map +1 -0
  108. package/dist/src/health/index.js +2 -0
  109. package/dist/src/health/index.js.map +1 -0
  110. package/dist/src/index.d.ts +49 -0
  111. package/dist/src/index.d.ts.map +1 -0
  112. package/dist/src/index.js +84 -0
  113. package/dist/src/index.js.map +1 -0
  114. package/dist/src/lib/auto-recovery.d.ts +45 -0
  115. package/dist/src/lib/auto-recovery.d.ts.map +1 -0
  116. package/dist/src/lib/auto-recovery.js +217 -0
  117. package/dist/src/lib/auto-recovery.js.map +1 -0
  118. package/dist/src/lib/cache-parity.d.ts +39 -0
  119. package/dist/src/lib/cache-parity.d.ts.map +1 -0
  120. package/dist/src/lib/cache-parity.js +92 -0
  121. package/dist/src/lib/cache-parity.js.map +1 -0
  122. package/dist/src/lib/circuit-breaker.d.ts +22 -0
  123. package/dist/src/lib/circuit-breaker.d.ts.map +1 -0
  124. package/dist/src/lib/circuit-breaker.js +47 -0
  125. package/dist/src/lib/circuit-breaker.js.map +1 -0
  126. package/dist/src/lib/config.d.ts +74 -0
  127. package/dist/src/lib/config.d.ts.map +1 -0
  128. package/dist/src/lib/config.js +244 -0
  129. package/dist/src/lib/config.js.map +1 -0
  130. package/dist/src/lib/drift-detector.d.ts +47 -0
  131. package/dist/src/lib/drift-detector.d.ts.map +1 -0
  132. package/dist/src/lib/drift-detector.js +192 -0
  133. package/dist/src/lib/drift-detector.js.map +1 -0
  134. package/dist/src/lib/error-formatter.d.ts +78 -0
  135. package/dist/src/lib/error-formatter.d.ts.map +1 -0
  136. package/dist/src/lib/error-formatter.js +149 -0
  137. package/dist/src/lib/error-formatter.js.map +1 -0
  138. package/dist/src/lib/heartbeat-workaround.d.ts +45 -0
  139. package/dist/src/lib/heartbeat-workaround.d.ts.map +1 -0
  140. package/dist/src/lib/heartbeat-workaround.js +61 -0
  141. package/dist/src/lib/heartbeat-workaround.js.map +1 -0
  142. package/dist/src/lib/index.d.ts +8 -0
  143. package/dist/src/lib/index.d.ts.map +1 -0
  144. package/dist/src/lib/index.js +8 -0
  145. package/dist/src/lib/index.js.map +1 -0
  146. package/dist/src/lib/register-guard.d.ts +49 -0
  147. package/dist/src/lib/register-guard.d.ts.map +1 -0
  148. package/dist/src/lib/register-guard.js +73 -0
  149. package/dist/src/lib/register-guard.js.map +1 -0
  150. package/dist/src/lib/route-flag.d.ts +50 -0
  151. package/dist/src/lib/route-flag.d.ts.map +1 -0
  152. package/dist/src/lib/route-flag.js +52 -0
  153. package/dist/src/lib/route-flag.js.map +1 -0
  154. package/dist/src/lib/sysprompt-strip.d.ts +54 -0
  155. package/dist/src/lib/sysprompt-strip.d.ts.map +1 -0
  156. package/dist/src/lib/sysprompt-strip.js +75 -0
  157. package/dist/src/lib/sysprompt-strip.js.map +1 -0
  158. package/dist/src/lib/telemetry.d.ts +39 -0
  159. package/dist/src/lib/telemetry.d.ts.map +1 -0
  160. package/dist/src/lib/telemetry.js +73 -0
  161. package/dist/src/lib/telemetry.js.map +1 -0
  162. package/dist/src/lib/test-mode.d.ts +27 -0
  163. package/dist/src/lib/test-mode.d.ts.map +1 -0
  164. package/dist/src/lib/test-mode.js +38 -0
  165. package/dist/src/lib/test-mode.js.map +1 -0
  166. package/dist/src/lib/vendor-paths.d.ts +15 -0
  167. package/dist/src/lib/vendor-paths.d.ts.map +1 -0
  168. package/dist/src/lib/vendor-paths.js +32 -0
  169. package/dist/src/lib/vendor-paths.js.map +1 -0
  170. package/dist/src/logger.d.ts +17 -0
  171. package/dist/src/logger.d.ts.map +1 -0
  172. package/dist/src/logger.js +46 -0
  173. package/dist/src/logger.js.map +1 -0
  174. package/dist/src/mcp/bridge.d.ts +22 -0
  175. package/dist/src/mcp/bridge.d.ts.map +1 -0
  176. package/dist/src/mcp/bridge.js +78 -0
  177. package/dist/src/mcp/bridge.js.map +1 -0
  178. package/dist/src/mcp/index.d.ts +3 -0
  179. package/dist/src/mcp/index.d.ts.map +1 -0
  180. package/dist/src/mcp/index.js +2 -0
  181. package/dist/src/mcp/index.js.map +1 -0
  182. package/dist/src/models.d.ts +70 -0
  183. package/dist/src/models.d.ts.map +1 -0
  184. package/dist/src/models.js +289 -0
  185. package/dist/src/models.js.map +1 -0
  186. package/dist/src/openai-compat/cli-stream-parser.d.ts +135 -0
  187. package/dist/src/openai-compat/cli-stream-parser.d.ts.map +1 -0
  188. package/dist/src/openai-compat/cli-stream-parser.js +195 -0
  189. package/dist/src/openai-compat/cli-stream-parser.js.map +1 -0
  190. package/dist/src/openai-compat/index.d.ts +2 -0
  191. package/dist/src/openai-compat/index.d.ts.map +1 -0
  192. package/dist/src/openai-compat/index.js +2 -0
  193. package/dist/src/openai-compat/index.js.map +1 -0
  194. package/dist/src/openai-compat/openai-compat.d.ts +281 -0
  195. package/dist/src/openai-compat/openai-compat.d.ts.map +1 -0
  196. package/dist/src/openai-compat/openai-compat.js +939 -0
  197. package/dist/src/openai-compat/openai-compat.js.map +1 -0
  198. package/dist/src/openai-compat/skill-resolver.d.ts +36 -0
  199. package/dist/src/openai-compat/skill-resolver.d.ts.map +1 -0
  200. package/dist/src/openai-compat/skill-resolver.js +134 -0
  201. package/dist/src/openai-compat/skill-resolver.js.map +1 -0
  202. package/dist/src/openai-compat/sse-translator.d.ts +32 -0
  203. package/dist/src/openai-compat/sse-translator.d.ts.map +1 -0
  204. package/dist/src/openai-compat/sse-translator.js +155 -0
  205. package/dist/src/openai-compat/sse-translator.js.map +1 -0
  206. package/dist/src/proxy/anthropic-adapter.d.ts +137 -0
  207. package/dist/src/proxy/anthropic-adapter.d.ts.map +1 -0
  208. package/dist/src/proxy/anthropic-adapter.js +392 -0
  209. package/dist/src/proxy/anthropic-adapter.js.map +1 -0
  210. package/dist/src/proxy/handler.d.ts +40 -0
  211. package/dist/src/proxy/handler.d.ts.map +1 -0
  212. package/dist/src/proxy/handler.js +378 -0
  213. package/dist/src/proxy/handler.js.map +1 -0
  214. package/dist/src/proxy/index.d.ts +5 -0
  215. package/dist/src/proxy/index.d.ts.map +1 -0
  216. package/dist/src/proxy/index.js +5 -0
  217. package/dist/src/proxy/index.js.map +1 -0
  218. package/dist/src/proxy/schema-cleaner.d.ts +12 -0
  219. package/dist/src/proxy/schema-cleaner.d.ts.map +1 -0
  220. package/dist/src/proxy/schema-cleaner.js +34 -0
  221. package/dist/src/proxy/schema-cleaner.js.map +1 -0
  222. package/dist/src/proxy/thought-cache.d.ts +20 -0
  223. package/dist/src/proxy/thought-cache.d.ts.map +1 -0
  224. package/dist/src/proxy/thought-cache.js +53 -0
  225. package/dist/src/proxy/thought-cache.js.map +1 -0
  226. package/dist/src/session/embedded-server.d.ts +26 -0
  227. package/dist/src/session/embedded-server.d.ts.map +1 -0
  228. package/dist/src/session/embedded-server.js +367 -0
  229. package/dist/src/session/embedded-server.js.map +1 -0
  230. package/dist/src/session/inbox-manager.d.ts +39 -0
  231. package/dist/src/session/inbox-manager.d.ts.map +1 -0
  232. package/dist/src/session/inbox-manager.js +111 -0
  233. package/dist/src/session/inbox-manager.js.map +1 -0
  234. package/dist/src/session/index.d.ts +4 -0
  235. package/dist/src/session/index.d.ts.map +1 -0
  236. package/dist/src/session/index.js +4 -0
  237. package/dist/src/session/index.js.map +1 -0
  238. package/dist/src/session/session-manager.d.ts +212 -0
  239. package/dist/src/session/session-manager.d.ts.map +1 -0
  240. package/dist/src/session/session-manager.js +1351 -0
  241. package/dist/src/session/session-manager.js.map +1 -0
  242. package/dist/src/session-bootstrap/cwd-patch.d.ts +51 -0
  243. package/dist/src/session-bootstrap/cwd-patch.d.ts.map +1 -0
  244. package/dist/src/session-bootstrap/cwd-patch.js +955 -0
  245. package/dist/src/session-bootstrap/cwd-patch.js.map +1 -0
  246. package/dist/src/session-bootstrap/index.d.ts +4 -0
  247. package/dist/src/session-bootstrap/index.d.ts.map +1 -0
  248. package/dist/src/session-bootstrap/index.js +4 -0
  249. package/dist/src/session-bootstrap/index.js.map +1 -0
  250. package/dist/src/session-bootstrap/sysprompt-strip.d.ts +26 -0
  251. package/dist/src/session-bootstrap/sysprompt-strip.d.ts.map +1 -0
  252. package/dist/src/session-bootstrap/sysprompt-strip.js +57 -0
  253. package/dist/src/session-bootstrap/sysprompt-strip.js.map +1 -0
  254. package/dist/src/session-bootstrap/think-conflict-resolver.d.ts +33 -0
  255. package/dist/src/session-bootstrap/think-conflict-resolver.d.ts.map +1 -0
  256. package/dist/src/session-bootstrap/think-conflict-resolver.js +234 -0
  257. package/dist/src/session-bootstrap/think-conflict-resolver.js.map +1 -0
  258. package/dist/src/types.d.ts +489 -0
  259. package/dist/src/types.d.ts.map +1 -0
  260. package/dist/src/types.js +8 -0
  261. package/dist/src/types.js.map +1 -0
  262. package/dist/src/validation.d.ts +32 -0
  263. package/dist/src/validation.d.ts.map +1 -0
  264. package/dist/src/validation.js +104 -0
  265. package/dist/src/validation.js.map +1 -0
  266. package/dist/tests/_helpers/subprocess-mock.d.ts +35 -0
  267. package/dist/tests/_helpers/subprocess-mock.d.ts.map +1 -0
  268. package/dist/tests/_helpers/subprocess-mock.js +136 -0
  269. package/dist/tests/_helpers/subprocess-mock.js.map +1 -0
  270. package/dist/tests/auto-recovery.test.d.ts +2 -0
  271. package/dist/tests/auto-recovery.test.d.ts.map +1 -0
  272. package/dist/tests/auto-recovery.test.js +189 -0
  273. package/dist/tests/auto-recovery.test.js.map +1 -0
  274. package/dist/tests/bench-harness.test.d.ts +2 -0
  275. package/dist/tests/bench-harness.test.d.ts.map +1 -0
  276. package/dist/tests/bench-harness.test.js +21 -0
  277. package/dist/tests/bench-harness.test.js.map +1 -0
  278. package/dist/tests/cache-parity.test.d.ts +2 -0
  279. package/dist/tests/cache-parity.test.d.ts.map +1 -0
  280. package/dist/tests/cache-parity.test.js +401 -0
  281. package/dist/tests/cache-parity.test.js.map +1 -0
  282. package/dist/tests/command-router.test.d.ts +2 -0
  283. package/dist/tests/command-router.test.d.ts.map +1 -0
  284. package/dist/tests/command-router.test.js +60 -0
  285. package/dist/tests/command-router.test.js.map +1 -0
  286. package/dist/tests/council.test.d.ts +2 -0
  287. package/dist/tests/council.test.d.ts.map +1 -0
  288. package/dist/tests/council.test.js +20 -0
  289. package/dist/tests/council.test.js.map +1 -0
  290. package/dist/tests/drift-detector.test.d.ts +2 -0
  291. package/dist/tests/drift-detector.test.d.ts.map +1 -0
  292. package/dist/tests/drift-detector.test.js +268 -0
  293. package/dist/tests/drift-detector.test.js.map +1 -0
  294. package/dist/tests/eager-bootstrap-gating.test.d.ts +9 -0
  295. package/dist/tests/eager-bootstrap-gating.test.d.ts.map +1 -0
  296. package/dist/tests/eager-bootstrap-gating.test.js +97 -0
  297. package/dist/tests/eager-bootstrap-gating.test.js.map +1 -0
  298. package/dist/tests/engines.test.d.ts +2 -0
  299. package/dist/tests/engines.test.d.ts.map +1 -0
  300. package/dist/tests/engines.test.js +8 -0
  301. package/dist/tests/engines.test.js.map +1 -0
  302. package/dist/tests/error-formatter.test.d.ts +2 -0
  303. package/dist/tests/error-formatter.test.d.ts.map +1 -0
  304. package/dist/tests/error-formatter.test.js +220 -0
  305. package/dist/tests/error-formatter.test.js.map +1 -0
  306. package/dist/tests/health.test.d.ts +2 -0
  307. package/dist/tests/health.test.d.ts.map +1 -0
  308. package/dist/tests/health.test.js +110 -0
  309. package/dist/tests/health.test.js.map +1 -0
  310. package/dist/tests/heartbeat-workaround.test.d.ts +2 -0
  311. package/dist/tests/heartbeat-workaround.test.d.ts.map +1 -0
  312. package/dist/tests/heartbeat-workaround.test.js +90 -0
  313. package/dist/tests/heartbeat-workaround.test.js.map +1 -0
  314. package/dist/tests/index.test.d.ts +2 -0
  315. package/dist/tests/index.test.d.ts.map +1 -0
  316. package/dist/tests/index.test.js +7 -0
  317. package/dist/tests/index.test.js.map +1 -0
  318. package/dist/tests/lib-sysprompt-strip.test.d.ts +2 -0
  319. package/dist/tests/lib-sysprompt-strip.test.d.ts.map +1 -0
  320. package/dist/tests/lib-sysprompt-strip.test.js +145 -0
  321. package/dist/tests/lib-sysprompt-strip.test.js.map +1 -0
  322. package/dist/tests/listener-activation.test.d.ts +2 -0
  323. package/dist/tests/listener-activation.test.d.ts.map +1 -0
  324. package/dist/tests/listener-activation.test.js +87 -0
  325. package/dist/tests/listener-activation.test.js.map +1 -0
  326. package/dist/tests/mcp-bridge.test.d.ts +2 -0
  327. package/dist/tests/mcp-bridge.test.d.ts.map +1 -0
  328. package/dist/tests/mcp-bridge.test.js +137 -0
  329. package/dist/tests/mcp-bridge.test.js.map +1 -0
  330. package/dist/tests/openai-compat.test.d.ts +2 -0
  331. package/dist/tests/openai-compat.test.d.ts.map +1 -0
  332. package/dist/tests/openai-compat.test.js +8 -0
  333. package/dist/tests/openai-compat.test.js.map +1 -0
  334. package/dist/tests/proxy-heartbeat-integration.test.d.ts +15 -0
  335. package/dist/tests/proxy-heartbeat-integration.test.d.ts.map +1 -0
  336. package/dist/tests/proxy-heartbeat-integration.test.js +122 -0
  337. package/dist/tests/proxy-heartbeat-integration.test.js.map +1 -0
  338. package/dist/tests/proxy.test.d.ts +2 -0
  339. package/dist/tests/proxy.test.d.ts.map +1 -0
  340. package/dist/tests/proxy.test.js +8 -0
  341. package/dist/tests/proxy.test.js.map +1 -0
  342. package/dist/tests/register-guard-stacking.test.d.ts +2 -0
  343. package/dist/tests/register-guard-stacking.test.d.ts.map +1 -0
  344. package/dist/tests/register-guard-stacking.test.js +61 -0
  345. package/dist/tests/register-guard-stacking.test.js.map +1 -0
  346. package/dist/tests/register-guard.test.d.ts +2 -0
  347. package/dist/tests/register-guard.test.d.ts.map +1 -0
  348. package/dist/tests/register-guard.test.js +129 -0
  349. package/dist/tests/register-guard.test.js.map +1 -0
  350. package/dist/tests/route-flag-rollback.test.d.ts +2 -0
  351. package/dist/tests/route-flag-rollback.test.d.ts.map +1 -0
  352. package/dist/tests/route-flag-rollback.test.js +70 -0
  353. package/dist/tests/route-flag-rollback.test.js.map +1 -0
  354. package/dist/tests/route-flag.test.d.ts +2 -0
  355. package/dist/tests/route-flag.test.d.ts.map +1 -0
  356. package/dist/tests/route-flag.test.js +101 -0
  357. package/dist/tests/route-flag.test.js.map +1 -0
  358. package/dist/tests/session-bootstrap.test.d.ts +2 -0
  359. package/dist/tests/session-bootstrap.test.d.ts.map +1 -0
  360. package/dist/tests/session-bootstrap.test.js +183 -0
  361. package/dist/tests/session-bootstrap.test.js.map +1 -0
  362. package/dist/tests/session.test.d.ts +2 -0
  363. package/dist/tests/session.test.d.ts.map +1 -0
  364. package/dist/tests/session.test.js +17 -0
  365. package/dist/tests/session.test.js.map +1 -0
  366. package/dist/tests/state-machine.test.d.ts +2 -0
  367. package/dist/tests/state-machine.test.d.ts.map +1 -0
  368. package/dist/tests/state-machine.test.js +133 -0
  369. package/dist/tests/state-machine.test.js.map +1 -0
  370. package/dist/tests/streaming/cli-stream-parser.test.d.ts +2 -0
  371. package/dist/tests/streaming/cli-stream-parser.test.d.ts.map +1 -0
  372. package/dist/tests/streaming/cli-stream-parser.test.js +233 -0
  373. package/dist/tests/streaming/cli-stream-parser.test.js.map +1 -0
  374. package/dist/tests/streaming/feature-flag.test.d.ts +14 -0
  375. package/dist/tests/streaming/feature-flag.test.d.ts.map +1 -0
  376. package/dist/tests/streaming/feature-flag.test.js +163 -0
  377. package/dist/tests/streaming/feature-flag.test.js.map +1 -0
  378. package/dist/tests/streaming/no-tools-prompt.test.d.ts +17 -0
  379. package/dist/tests/streaming/no-tools-prompt.test.d.ts.map +1 -0
  380. package/dist/tests/streaming/no-tools-prompt.test.js +229 -0
  381. package/dist/tests/streaming/no-tools-prompt.test.js.map +1 -0
  382. package/dist/tests/streaming/skill-plus-tools.test.d.ts +14 -0
  383. package/dist/tests/streaming/skill-plus-tools.test.d.ts.map +1 -0
  384. package/dist/tests/streaming/skill-plus-tools.test.js +234 -0
  385. package/dist/tests/streaming/skill-plus-tools.test.js.map +1 -0
  386. package/dist/tests/streaming/sse-translator.test.d.ts +2 -0
  387. package/dist/tests/streaming/sse-translator.test.d.ts.map +1 -0
  388. package/dist/tests/streaming/sse-translator.test.js +227 -0
  389. package/dist/tests/streaming/sse-translator.test.js.map +1 -0
  390. package/dist/tests/streaming/tool-result-roundtrip.test.d.ts +11 -0
  391. package/dist/tests/streaming/tool-result-roundtrip.test.d.ts.map +1 -0
  392. package/dist/tests/streaming/tool-result-roundtrip.test.js +215 -0
  393. package/dist/tests/streaming/tool-result-roundtrip.test.js.map +1 -0
  394. package/dist/tests/streaming/tool-use-translation.test.d.ts +10 -0
  395. package/dist/tests/streaming/tool-use-translation.test.d.ts.map +1 -0
  396. package/dist/tests/streaming/tool-use-translation.test.js +251 -0
  397. package/dist/tests/streaming/tool-use-translation.test.js.map +1 -0
  398. package/dist/tests/telegram-bridge.test.d.ts +2 -0
  399. package/dist/tests/telegram-bridge.test.d.ts.map +1 -0
  400. package/dist/tests/telegram-bridge.test.js +17 -0
  401. package/dist/tests/telegram-bridge.test.js.map +1 -0
  402. package/dist/tests/telegram-injector.test.d.ts +2 -0
  403. package/dist/tests/telegram-injector.test.d.ts.map +1 -0
  404. package/dist/tests/telegram-injector.test.js +74 -0
  405. package/dist/tests/telegram-injector.test.js.map +1 -0
  406. package/dist/tests/telemetry.test.d.ts +2 -0
  407. package/dist/tests/telemetry.test.d.ts.map +1 -0
  408. package/dist/tests/telemetry.test.js +405 -0
  409. package/dist/tests/telemetry.test.js.map +1 -0
  410. package/dist/tests/test-mode.test.d.ts +2 -0
  411. package/dist/tests/test-mode.test.d.ts.map +1 -0
  412. package/dist/tests/test-mode.test.js +39 -0
  413. package/dist/tests/test-mode.test.js.map +1 -0
  414. package/mcp-config.template.json +13 -0
  415. package/mcp-tools.json +1 -0
  416. package/openclaw-mcp-bridge.cjs +152 -0
  417. package/openclaw.plugin.json +30 -0
  418. package/package.json +45 -0
  419. package/skills/.gitkeep +0 -0
  420. package/stubs/commands-status-deps.runtime.js +10 -0
  421. package/stubs/status.runtime.js +149 -0
  422. package/vendor/base-oneshot-session.d.ts +87 -0
  423. package/vendor/base-oneshot-session.js +227 -0
  424. package/vendor/base-oneshot-session.js.map +1 -0
  425. package/vendor/circuit-breaker.d.ts +21 -0
  426. package/vendor/circuit-breaker.js +47 -0
  427. package/vendor/circuit-breaker.js.map +1 -0
  428. package/vendor/consensus.d.ts +20 -0
  429. package/vendor/consensus.js +52 -0
  430. package/vendor/consensus.js.map +1 -0
  431. package/vendor/constants.d.ts +130 -0
  432. package/vendor/constants.js +139 -0
  433. package/vendor/constants.js.map +1 -0
  434. package/vendor/council.d.ts +67 -0
  435. package/vendor/council.js +913 -0
  436. package/vendor/council.js.map +1 -0
  437. package/vendor/embedded-server.d.ts +25 -0
  438. package/vendor/embedded-server.js +360 -0
  439. package/vendor/embedded-server.js.map +1 -0
  440. package/vendor/inbox-manager.d.ts +38 -0
  441. package/vendor/inbox-manager.js +111 -0
  442. package/vendor/inbox-manager.js.map +1 -0
  443. package/vendor/index.d.ts +63 -0
  444. package/vendor/index.js +705 -0
  445. package/vendor/index.js.map +1 -0
  446. package/vendor/logger.d.ts +16 -0
  447. package/vendor/logger.js +44 -0
  448. package/vendor/logger.js.map +1 -0
  449. package/vendor/models.d.ts +69 -0
  450. package/vendor/models.js +289 -0
  451. package/vendor/models.js.map +1 -0
  452. package/vendor/openai-compat.d.ts +197 -0
  453. package/vendor/openai-compat.js +721 -0
  454. package/vendor/openai-compat.js.map +1 -0
  455. package/vendor/persistent-codex-session.d.ts +16 -0
  456. package/vendor/persistent-codex-session.js +105 -0
  457. package/vendor/persistent-codex-session.js.map +1 -0
  458. package/vendor/persistent-cursor-session.d.ts +21 -0
  459. package/vendor/persistent-cursor-session.js +241 -0
  460. package/vendor/persistent-cursor-session.js.map +1 -0
  461. package/vendor/persistent-custom-session.d.ts +78 -0
  462. package/vendor/persistent-custom-session.js +937 -0
  463. package/vendor/persistent-custom-session.js.map +1 -0
  464. package/vendor/persistent-gemini-session.d.ts +21 -0
  465. package/vendor/persistent-gemini-session.js +216 -0
  466. package/vendor/persistent-gemini-session.js.map +1 -0
  467. package/vendor/persistent-session.d.ts +74 -0
  468. package/vendor/persistent-session.js +684 -0
  469. package/vendor/persistent-session.js.map +1 -0
  470. package/vendor/proxy/anthropic-adapter.d.ts +136 -0
  471. package/vendor/proxy/anthropic-adapter.js +392 -0
  472. package/vendor/proxy/anthropic-adapter.js.map +1 -0
  473. package/vendor/proxy/handler.d.ts +39 -0
  474. package/vendor/proxy/handler.js +323 -0
  475. package/vendor/proxy/handler.js.map +1 -0
  476. package/vendor/proxy/schema-cleaner.d.ts +11 -0
  477. package/vendor/proxy/schema-cleaner.js +34 -0
  478. package/vendor/proxy/schema-cleaner.js.map +1 -0
  479. package/vendor/proxy/thought-cache.d.ts +19 -0
  480. package/vendor/proxy/thought-cache.js +53 -0
  481. package/vendor/proxy/thought-cache.js.map +1 -0
  482. package/vendor/session-manager.d.ts +211 -0
  483. package/vendor/session-manager.js +1345 -0
  484. package/vendor/session-manager.js.map +1 -0
  485. package/vendor/skill-resolver.js +107 -0
  486. package/vendor/types.d.ts +466 -0
  487. package/vendor/types.js +8 -0
  488. package/vendor/types.js.map +1 -0
  489. package/vendor/validation.d.ts +31 -0
  490. package/vendor/validation.js +104 -0
  491. package/vendor/validation.js.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 enderfga
4
+ Copyright (c) 2026 A1xAI / @a1cy
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,207 @@
1
+ # cc-openclaw
2
+
3
+ A1xAI's Claude Code → OpenAI-compatible HTTP bridge plugin for [OpenClaw](https://openclaw.com).
4
+
5
+ Routes `claude` CLI subprocess sessions through an OpenAI-compatible API at
6
+ `http://127.0.0.1:18796`, enabling OpenClaw to use Claude Code as the inference
7
+ backend for Telegram bots, MCP tooling, and multi-laptop session sync.
8
+
9
+ ## Quick start (one command)
10
+
11
+ ```bash
12
+ bash <(curl -fsSL https://raw.githubusercontent.com/A1cy/cc-openclaw/main/scripts/bootstrap.sh)
13
+ ```
14
+
15
+ The bootstrap script handles: prereq detection, openclaw binary install/upgrade,
16
+ cc-openclaw clone+build+plugin-install, env file configuration, interactive
17
+ prompt for required secrets (Anthropic key, optional Telegram bot tokens),
18
+ OpenRouter pricing-cache patch, `openclaw doctor --fix`, gateway restart, and
19
+ smoke probes. Idempotent — safe to re-run.
20
+
21
+ ## Prerequisites
22
+
23
+ - Node.js ≥ 22
24
+ - Anthropic API key
25
+ - (Optional) Telegram bot token(s) from [@BotFather](https://t.me/BotFather)
26
+ - Linux/WSL2/macOS (tested on WSL2 Ubuntu 24)
27
+
28
+ ## Manual install
29
+
30
+ If you'd rather not run the bootstrap script:
31
+
32
+ ```bash
33
+ # 1. OpenClaw binary
34
+ npm install -g openclaw@beta
35
+
36
+ # 2. Plugin install via openclaw CLI
37
+ openclaw plugins install --dangerously-force-unsafe-install --force \
38
+ github:A1cy/cc-openclaw
39
+
40
+ # 3. Required env vars in BOTH ~/.openclaw/.env AND ~/.openclaw/gateway.systemd.env
41
+ cat >> ~/.openclaw/.env <<EOF
42
+ ANTHROPIC_API_KEY=sk-ant-...
43
+ OPENCLAW_CC_OPENCLAW_LISTENERS=1
44
+ OPENCLAW_CC_OPENCLAW_ACTIVE=1
45
+ CC_OPENCLAW_ALLOW_BUILTINS=1
46
+ CC_OPENCLAW_TOOL_STREAM=1
47
+ UX_BRIDGE_ALL_SESSIONS=true
48
+ OPENCLAW_CACHE_PARITY=1
49
+ OPENCLAW_AGGRESSIVE_STRIP=1
50
+ EOF
51
+ cp ~/.openclaw/.env ~/.openclaw/gateway.systemd.env # both files must mirror
52
+
53
+ # 4. Telegram bot tokens go in openclaw.json (see Configuration below)
54
+
55
+ # 5. Apply OpenRouter patch + run doctor
56
+ bash ~/dev/cc-openclaw/scripts/patch-openrouter.sh
57
+ openclaw doctor --fix
58
+
59
+ # 6. Restart gateway
60
+ pm2 restart openclaw-gateway --update-env
61
+ ```
62
+
63
+ ## Configuration
64
+
65
+ ### Required env vars (in BOTH `.env` and `gateway.systemd.env`)
66
+
67
+ | Variable | Purpose |
68
+ |---|---|
69
+ | `ANTHROPIC_API_KEY` | Claude API authentication |
70
+ | `OPENCLAW_CC_OPENCLAW_LISTENERS=1` | Activate plugin event listeners |
71
+ | `OPENCLAW_CC_OPENCLAW_ACTIVE=1` | Set cc-openclaw as primary engine |
72
+ | `CC_OPENCLAW_ALLOW_BUILTINS=1` | Enable Claude Code built-in tools (WebFetch, WebSearch) |
73
+ | `CC_OPENCLAW_TOOL_STREAM=1` | Real-time tool-call streaming (v0.3.0+) |
74
+ | `UX_BRIDGE_ALL_SESSIONS=true` | Live cards for every Telegram session |
75
+ | `OPENCLAW_CACHE_PARITY=1` | Track-B prompt cache parity |
76
+ | `OPENCLAW_AGGRESSIVE_STRIP=1` | Strip openclaw sysprompt artifacts |
77
+
78
+ Both files must mirror — pm2 reads `gateway.systemd.env`, savvyflow reads `.env`.
79
+
80
+ ### Telegram bot tokens
81
+
82
+ Tokens live in `~/.openclaw/openclaw.json` under `channels.telegram.accounts[]`:
83
+
84
+ ```json
85
+ {
86
+ "channels": {
87
+ "telegram": {
88
+ "accounts": [
89
+ { "id": "savvy-home", "botToken": "1234:ABC...", "label": "SavvyHomeBot" },
90
+ { "id": "savvy-work", "botToken": "5678:XYZ...", "label": "SavvyWorkBot" }
91
+ ]
92
+ }
93
+ }
94
+ }
95
+ ```
96
+
97
+ The `bootstrap.sh` script writes these atomically via `jq` if you provide tokens
98
+ during the interactive prompt. To add later, edit the JSON manually or use
99
+ `openclaw config set`.
100
+
101
+ ## Verification
102
+
103
+ After install:
104
+
105
+ ```bash
106
+ # Health probes
107
+ curl -s http://127.0.0.1:18790/health # OpenClaw gateway
108
+ curl -s http://127.0.0.1:18796/health # cc-openclaw embedded server
109
+
110
+ # Plugin loaded?
111
+ pm2 logs openclaw-gateway --lines 30 --nostream | grep cc-openclaw
112
+ # Expect: "cc-openclaw/index" register-guard.fire entries
113
+ ```
114
+
115
+ In Telegram:
116
+ - `/new` → ONE greeting (not doubled)
117
+ - `/cc what time is it?` → live card, tool runs, summary lands
118
+ - `/status` → model field shows `cc-openclaw/...` (NOT `claude-local`, NOT `gpt-5.4`)
119
+ - `/search anthropic` → web search runs (confirms `CC_OPENCLAW_ALLOW_BUILTINS=1`)
120
+
121
+ ## Troubleshooting
122
+
123
+ ### "/status shows claude-local"
124
+
125
+ The route flag default. Means `OPENCLAW_CC_OPENCLAW_ACTIVE=1` isn't in the
126
+ gateway's env. Verify with:
127
+
128
+ ```bash
129
+ pm2 env openclaw-gateway | grep OPENCLAW_CC_OPENCLAW
130
+ ```
131
+
132
+ If missing: ensure it's in BOTH `~/.openclaw/.env` AND `~/.openclaw/gateway.systemd.env`,
133
+ then `pm2 restart openclaw-gateway --update-env`.
134
+
135
+ ### "Gateway falls back to gpt-5.4"
136
+
137
+ Means cc-openclaw's `:18796` server is unreachable. Check:
138
+
139
+ ```bash
140
+ curl -s http://127.0.0.1:18796/health
141
+ ss -tln | grep 18796
142
+ ```
143
+
144
+ If port 18796 isn't listening, the cwd-patch eager-server start failed — check
145
+ `pm2 logs openclaw-gateway --lines 50` for cc-openclaw errors.
146
+
147
+ ### "ENOENT: stubs/commands-status-deps.runtime.js"
148
+
149
+ Pre-0.3.1 bug. Update to ≥0.3.1 — the stub-path resolution was fixed to use
150
+ marker-based walk-up instead of `dirname(import.meta.url)`. Re-run `bootstrap.sh`
151
+ or:
152
+
153
+ ```bash
154
+ cd ~/dev/cc-openclaw && git pull && npm run build
155
+ bash ~/.openclaw/scripts/sync-cc-openclaw.sh
156
+ ```
157
+
158
+ ### After upgrading openclaw binary
159
+
160
+ The OpenRouter pricing-cache patch must be re-applied (npm install wipes it):
161
+
162
+ ```bash
163
+ bash ~/dev/cc-openclaw/scripts/patch-openrouter.sh
164
+ pm2 restart openclaw-gateway --update-env
165
+ ```
166
+
167
+ ## Architecture
168
+
169
+ ```
170
+ ┌─ Telegram ──────────────────────────┐
171
+ │ Bot messages │
172
+ └──────────┬───────────────────────────┘
173
+ │ openclaw-gateway :18790
174
+
175
+ ┌─ OpenClaw Gateway ──────────────────┐
176
+ │ - Routing / fallbacks │
177
+ │ - Telegram channel adapter │
178
+ │ - cc-openclaw plugin loaded │
179
+ └──────────┬───────────────────────────┘
180
+ │ HTTP /v1/chat/completions
181
+
182
+ ┌─ cc-openclaw embedded server :18796 ┐
183
+ │ - SessionManager (per-chat) │
184
+ │ - SSE translator │
185
+ │ - claude CLI subprocess pool │
186
+ └──────────┬───────────────────────────┘
187
+ │ stdin/stdout NDJSON
188
+
189
+ ┌─ claude CLI subprocess ─────────────┐
190
+ │ - Anthropic Messages API │
191
+ │ - tool_use blocks │
192
+ └──────────────────────────────────────┘
193
+ ```
194
+
195
+ When the cc-openclaw chain fails (network, API quota, bug), OpenClaw falls
196
+ through `agents.list[main].model.fallbacks` — typically ending at
197
+ `openai-codex/gpt-5.4` as a last-resort liveness fallback.
198
+
199
+ ## Internal docs
200
+
201
+ - Project orchestration: `~/.openclaw/workspace/orchestration/projects/cc-openclaw/`
202
+ - Phase 4 PRP: `~/.openclaw/workspace/orchestration/projects/cc-openclaw-phase4/PRP_v1.md`
203
+ - Cross-laptop handoff: `~/.openclaw/handoff/`
204
+
205
+ ## License
206
+
207
+ MIT © A1xAI / Abdulhadi Alturafi (@A1cy)
File without changes
@@ -0,0 +1,82 @@
1
+ # Council Reviewer Prompt
2
+
3
+ You are the **final gatekeeper** for council output. Your job is NOT to rubber-stamp the council's self-assessment. Council members review each other, but they are biased toward approval. **You must independently verify code quality.**
4
+
5
+ ## Critical Mindset
6
+
7
+ - **Do NOT trust plan.md checkboxes.** Council members mark their own work as done. Verify independently.
8
+ - **Do NOT trust reviews/ approvals.** Council members rubber-stamp each other. Read the actual code.
9
+ - **Your job is to find problems**, not to confirm everything is fine.
10
+ - **Think like a senior engineer doing a PR review**, not an auditor checking boxes.
11
+
12
+ ## Review Workflow
13
+
14
+ ### 1. Understand Context
15
+
16
+ Read `plan.md` to understand the INTENT, but do NOT use it as your acceptance criteria. You will form your own opinion.
17
+
18
+ ### 2. Identify ALL Changed Files
19
+
20
+ ```bash
21
+ git diff --stat --numstat HEAD~N HEAD
22
+ ```
23
+
24
+ You need to know exactly what the council produced.
25
+
26
+ ### 3. Deep Code Review (read every changed file)
27
+
28
+ For EACH file in the diff stat:
29
+
30
+ 1. **Read the full file content** — not just the diff
31
+ 2. Check for:
32
+ - **Redundant/duplicate files** — multiple versions of the same thing
33
+ - **Broken imports** — imports of modules that don't exist
34
+ - **Pollution of existing files** — modifications to files they shouldn't have touched
35
+ - **Copy-paste bloat** — massive copied files instead of extending originals
36
+ - **Hardcoded paths, debug prints, TODO comments left behind**
37
+ - **Redundant scripts** — multiple scripts doing the same thing
38
+ - **Dead code** — functions defined but never called
39
+ - **Incorrect architecture decisions**
40
+
41
+ 3. **Cross-reference with the codebase**: verify imports resolve, check argument names match configs
42
+
43
+ ### 4. Verify Functionality
44
+
45
+ - Try to import/compile the modules
46
+ - Dry-run scripts if possible
47
+ - Check for: missing features, syntax errors, broken logic, incomplete tasks
48
+
49
+ ### 5. Write Your Assessment
50
+
51
+ 1. **File inventory**: every file the council produced, with status (keep / needs rework / delete / redundant)
52
+ 2. **Architecture issues**: is the overall design sound?
53
+ 3. **Integration quality**: does it integrate cleanly with the existing codebase?
54
+ 4. **What's missing**: features promised in plan.md but not implemented
55
+ 5. **What's broken**: code that would fail at runtime
56
+ 6. **Recommendation**: accept / accept with conditions / reject
57
+
58
+ ## Anti-Patterns to Catch
59
+
60
+ | Anti-Pattern | How to Detect |
61
+ | -------------------- | ------------------------------------------------------------- |
62
+ | Checkbox fraud | `[x]` in plan.md but feature doesn't exist in code |
63
+ | Rubber-stamp reviews | reviews/ all say APPROVE but code has obvious bugs |
64
+ | File duplication | Two files with similar names doing the same thing |
65
+ | Base file pollution | Diff shows council-added imports/code that shouldn't be there |
66
+ | Copy-paste monster | 1000+ line file that's 90% copied from another file |
67
+ | Phantom architecture | plan.md describes N features but only N-1 implemented |
68
+ | Untested "validated" | Commit says "validated" but no evidence of execution |
69
+
70
+ ## Decision Criteria
71
+
72
+ ### Accept
73
+
74
+ All features work, code is clean, main branch compiles/runs, cross-reviews are legitimate. **This should be rare.**
75
+
76
+ ### Accept with Conditions (most common)
77
+
78
+ Code works but needs cleanup. Provide a specific cleanup list: which files to delete (redundant), which to rewrite (broken/bloated), which to keep as-is.
79
+
80
+ ### Reject
81
+
82
+ Fundamentally broken or wrong approach. Do NOT delete anything. Write a new plan.md with specific actionable tasks for the council to fix.
@@ -0,0 +1,141 @@
1
+ # System Prompt
2
+
3
+ You are a fully autonomous **expert software engineer Agent**, codename **{{emoji}} {{name}}**.
4
+ You and other Agents form a "Council" whose goal is to deliver requirements to the `main` branch with high quality (local merge only — **never push**).
5
+
6
+ **Your role**: {{persona}}
7
+
8
+ # Working Environment (Multi-Worktree)
9
+
10
+ * **Physical isolation**: Your independent directory is `{{workDir}}`.
11
+ * **Branch convention**: Your personal branch is `council/{{name}}`, target branch is `main`.
12
+ * **Other members' branches**: {{otherBranches}}
13
+
14
+ # Core Collaboration Charter (The Charter)
15
+
16
+ ### 0. Must Use Tools to Execute (CRITICAL: ACTION NOT ROLEPLAY)
17
+ You are an executor with a real local environment, **absolutely not engaging in pure text roleplay**.
18
+ - **No Hallucination**: Never fabricate completed work, test results, or `Git Commit Hashes` in your responses.
19
+ - **Mandatory Tool Invocation**: All code writing, branch creation, file reading, test execution, code merging, etc. **must and can only** be done by invoking the tools you are given (e.g., running bash commands, editing files, etc.).
20
+ - **Truthful Reporting**: Your `Report` must be 100% based on real terminal output from tools you **just successfully ran**. If you didn't invoke `git log`, you cannot write Git status in your report!
21
+
22
+ ### 1. Blueprint First (Bootstrap & Plan) — Two-Phase Protocol
23
+
24
+ **`plan.md` is your sole source of truth for action and must be under Git version control.**
25
+
26
+ #### Round 1: Planning Round (all members work independently in parallel)
27
+
28
+ Round 1 is a **pure planning round**. All members create their plan.md **in parallel**.
29
+
30
+ * **Your task**: Quickly check `git log --oneline -5` and the file list within your workspace (only `{{workDir}}`), then create `plan.md` based on the task description and merge it into `main`.
31
+ * **Empty project = no research needed**: If the project is empty (only has initial commit), don't waste time exploring — just write the plan based on task requirements. The task description itself is your input.
32
+ * **Conflict handling**: Because of parallel execution, you may encounter plan.md just merged by other members — this is normal, just merge your changes.
33
+ * **No business code in Round 1**, only planning.
34
+ * **Round 1 should be completed within 2-3 minutes** — don't do anything extra.
35
+
36
+ #### Round 2 onwards: Execution Rounds
37
+
38
+ After plan.md has been reviewed by all members, execute according to plan starting from Round 2.
39
+
40
+ * **Content requirements**: `plan.md` must include:
41
+ - Task checklist (with checkboxes)
42
+ - Phase breakdown (Draft → Review → Finalize)
43
+ - Dependencies between Agents
44
+ - Claim status for each task: `[Claimed: Name]` or `[Done: Name]`
45
+ * **Dynamic updates**: Each round, you must update `plan.md`: check off completed tasks (using `[x]`), or adjust subsequent plans based on actual progress. plan.md updates should be committed with the code — don't just update the plan without code changes to mask lack of progress.
46
+ * **Claim protocol**: Before claiming a task, pull the latest `main` and confirm the task hasn't been claimed by others. After claiming, immediately commit the plan.md update to main to avoid duplicate claims.
47
+ Claim format: `[Claimed: council/{{name}}]`, mark as `[Done: council/{{name}}]` when finished.
48
+ Tasks claimed by other branches in plan.md **do not belong to you — do not execute them**.
49
+
50
+ ### 2. Parallel Coordination
51
+
52
+ You are **executing simultaneously in parallel**. Each round, all Agents start working at the same time.
53
+
54
+ 1. **Before starting**, pull the latest state from `main` (all Agents' output from the previous round)
55
+ 2. Read `plan.md` to understand current progress and pending items
56
+ 3. Select an unclaimed task, mark it `[Claimed: {{name}}]` and commit to main ASAP
57
+ 4. Execute the task, mark `[Done: {{name}}]` when finished
58
+
59
+ **Because of parallel execution, plan.md claim conflicts may occur — when you discover a conflict, abandon that task and choose another unclaimed one.**
60
+ **Do not duplicate work already completed by others.** Look carefully before acting.
61
+
62
+ ### 3. Truth in Git
63
+
64
+ Do not rely on conversation history. **History gets stale, but Git state is always real-time.**
65
+
66
+ * After starting, check current git state (`git status`, `git log --oneline -5`).
67
+ * If a remote exists, you may `git fetch --all`; **if there's no remote (new project), skip fetch — this is normal.**
68
+ * Only when your branch hash is ahead of `main` is there code to merge. If hashes match, you're idle — go claim a new task from `plan.md`.
69
+
70
+ ### 4. Integration Is Completion (Merge to Main, No Push)
71
+
72
+ **Threshold for voting `[CONSENSUS: YES]`:**
73
+
74
+ 1. Your code has been successfully **locally merged** into the `main` branch.
75
+ 2. You have successfully run validation commands (e.g., compile, test) on the `main` branch.
76
+ 3. `plan.md` has been updated to ensure all Agents see the latest progress in the next round.
77
+
78
+ **Never `git push`.** This project may not have a remote, and even if it does, pushing is decided by humans after review. All work is done locally only.
79
+
80
+ ### 5. Cross-Review
81
+
82
+ When `plan.md` enters the Review phase:
83
+
84
+ * **Review others' work, not just your own output.** Switch to the `main` branch and read code/docs submitted by other Agents.
85
+ * **Structured feedback**: Write review comments to a separate file `reviews/{{name}}-on-<target>.md` — do not mix them into your own feedback file.
86
+ * **Review criteria**: Give a clear `[APPROVE]` or `[REQUEST_CHANGES]` with specific reasons.
87
+ * **Merge threshold**: At least 2/3 of Agents must give `[APPROVE]` for content to pass.
88
+
89
+ ### 6. Autonomous Conflict Resolution
90
+
91
+ * When encountering merge conflicts or dirty working directory, **never stop working**.
92
+ * You must directly edit the file, manually remove conflict markers and integrate the logic.
93
+ * For conflicts involving `plan.md`, use the latest version on `main` as the base and merge your changes.
94
+
95
+ ### 7. Action Over Words
96
+
97
+ * Never ask "may I begin."
98
+ * As long as `plan.md` has pending items, you must produce code or documentation changes.
99
+ * If you truly have nothing to do in this round (all tasks claimed or blocked), clearly state the reason and vote `[CONSENSUS: NO]`.
100
+
101
+ ### 8. Efficient Tool Use
102
+
103
+ * **Minimum necessary principle**: Only read files you need, don't scan the entire directory tree. One `ls` is enough — don't repeatedly glob.
104
+ * **Read before guessing**: Unsure about a file's contents? Read it first, then modify.
105
+ * **Empty projects need no research**: If `git log` shows only an initial commit, it's an empty project — just start working.
106
+
107
+ # Standard Workflow
108
+
109
+ 1. **Perceive**: Check git state, `git fetch` if remote exists; switch to main and pull latest commits; check if `plan.md` exists.
110
+ 2. **Plan/Sync**:
111
+ * If no `plan.md`: create it and merge into `main`.
112
+ * If `plan.md` exists: read it, understand overall progress, claim an unclaimed task.
113
+ 3. **Execute**: Develop atomically on your personal branch `council/{{name}}`.
114
+ 4. **Integrate**: Switch to `main` → merge your personal branch → **resolve conflicts manually**.
115
+ 5. **Verify**: Run tests/compilation on `main` to confirm successful integration. **Do not push.**
116
+
117
+ # Commit Message Convention
118
+
119
+ Use structured commit messages so other Agents can quickly understand what you did:
120
+
121
+ ```
122
+ council(<phase>): <agent-name> - <brief description>
123
+ ```
124
+
125
+ Examples:
126
+ - `council(draft): {{name}} - create plan.md with task breakdown`
127
+ - `council(review): {{name}} - approve Engineer's implementation`
128
+ - `council(finalize): {{name}} - synthesize final design doc`
129
+
130
+ # Report Format (Mandatory)
131
+
132
+ ```markdown
133
+ ## Council Execution Report ({{name}})
134
+ - **Git Status**: (latest commit hash on main branch)
135
+ - **Plan Changes**: (what parts of plan.md did you update?)
136
+ - **Integration Result**: (was code merged to main? test results?)
137
+ - **Review**: (whose output did you review? what's the conclusion?)
138
+ - **Baton Pass**: (which item in plan.md should the next round prioritize?)
139
+
140
+ [CONSENSUS: YES] or [CONSENSUS: NO]
141
+ ```
@@ -0,0 +1,58 @@
1
+ /**
2
+ * cc-openclaw vs claude-local A/B benchmark harness.
3
+ *
4
+ * SCAFFOLD STAGE — actual Anthropic CLI subprocess invocation is deferred
5
+ * to P5 (when A1 is using the plugin daily and comparison data is naturally
6
+ * collected from real workloads).
7
+ *
8
+ * Bench corpus per PRP "Performance Benchmark Spec":
9
+ * - 100 cold-start sessions (sysprompt size at start)
10
+ * - 100 warm-turn continuations
11
+ * - 50 sessions with 5+ tool calls each
12
+ * - 50 sessions with 10-turn dialogues
13
+ * - 20 sessions with MCP tool invocations
14
+ *
15
+ * Metrics captured per run:
16
+ * - Cold-turn sysprompt token count (input)
17
+ * - Time-to-first-token (latency)
18
+ * - Total session token cost (input + output)
19
+ * - Memory delta during session (RSS sample)
20
+ * - Listener event counts (zero-stacking proof — already verified by
21
+ * register-guard-stacking.test.ts)
22
+ *
23
+ * Output: ~/.openclaw/workspace/memory/cc-openclaw-bench.jsonl
24
+ *
25
+ * Invocation:
26
+ * tsx scripts/bench/ab-harness.ts --engine cc-openclaw --corpus cold-start --count 100
27
+ * tsx scripts/bench/ab-harness.ts --engine claude-local --corpus cold-start --count 100
28
+ *
29
+ * Then compare via:
30
+ * tsx scripts/bench/ab-compare.ts (separate script, not yet authored)
31
+ */
32
+ export declare const BENCH_PATH: string;
33
+ export type Engine = 'cc-openclaw' | 'claude-local';
34
+ export type CorpusName = 'cold-start' | 'warm-turn' | 'tool-heavy' | 'long-dialogue' | 'mcp-heavy';
35
+ export interface BenchEvent {
36
+ ts: string;
37
+ engine: Engine;
38
+ corpus: CorpusName;
39
+ runIdx: number;
40
+ coldTurnInputTokens?: number;
41
+ ttftMs?: number;
42
+ totalInputTokens?: number;
43
+ totalOutputTokens?: number;
44
+ rssDeltaBytes?: number;
45
+ listenerEventCount?: number;
46
+ errors?: string[];
47
+ }
48
+ export declare function writeBenchEvent(event: Omit<BenchEvent, 'ts'>): void;
49
+ /** TODO(P5): drive an actual session via the chosen engine + record metrics. */
50
+ export declare function runSingle(_engine: Engine, _corpus: CorpusName, _runIdx: number): Promise<BenchEvent>;
51
+ /** Parse argv minimally — full CLI in P5. */
52
+ export interface CliArgs {
53
+ engine: Engine;
54
+ corpus: CorpusName;
55
+ count: number;
56
+ }
57
+ export declare function parseArgs(argv: readonly string[]): CliArgs | null;
58
+ //# sourceMappingURL=ab-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ab-harness.d.ts","sourceRoot":"","sources":["../../../scripts/bench/ab-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAMH,eAAO,MAAM,UAAU,QAAiF,CAAC;AAEzG,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,WAAW,CAAC;AAEnG,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAOD,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,IAAI,CAGnE;AAED,gFAAgF;AAChF,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAM1G;AAED,6CAA6C;AAC7C,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,GAAG,IAAI,CAcjE"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * cc-openclaw vs claude-local A/B benchmark harness.
3
+ *
4
+ * SCAFFOLD STAGE — actual Anthropic CLI subprocess invocation is deferred
5
+ * to P5 (when A1 is using the plugin daily and comparison data is naturally
6
+ * collected from real workloads).
7
+ *
8
+ * Bench corpus per PRP "Performance Benchmark Spec":
9
+ * - 100 cold-start sessions (sysprompt size at start)
10
+ * - 100 warm-turn continuations
11
+ * - 50 sessions with 5+ tool calls each
12
+ * - 50 sessions with 10-turn dialogues
13
+ * - 20 sessions with MCP tool invocations
14
+ *
15
+ * Metrics captured per run:
16
+ * - Cold-turn sysprompt token count (input)
17
+ * - Time-to-first-token (latency)
18
+ * - Total session token cost (input + output)
19
+ * - Memory delta during session (RSS sample)
20
+ * - Listener event counts (zero-stacking proof — already verified by
21
+ * register-guard-stacking.test.ts)
22
+ *
23
+ * Output: ~/.openclaw/workspace/memory/cc-openclaw-bench.jsonl
24
+ *
25
+ * Invocation:
26
+ * tsx scripts/bench/ab-harness.ts --engine cc-openclaw --corpus cold-start --count 100
27
+ * tsx scripts/bench/ab-harness.ts --engine claude-local --corpus cold-start --count 100
28
+ *
29
+ * Then compare via:
30
+ * tsx scripts/bench/ab-compare.ts (separate script, not yet authored)
31
+ */
32
+ import { appendFileSync, mkdirSync, existsSync } from 'node:fs';
33
+ import { join, dirname } from 'node:path';
34
+ import { homedir } from 'node:os';
35
+ export const BENCH_PATH = join(homedir(), '.openclaw', 'workspace', 'memory', 'cc-openclaw-bench.jsonl');
36
+ function ensureDir(filePath) {
37
+ const dir = dirname(filePath);
38
+ if (!existsSync(dir))
39
+ mkdirSync(dir, { recursive: true });
40
+ }
41
+ export function writeBenchEvent(event) {
42
+ ensureDir(BENCH_PATH);
43
+ appendFileSync(BENCH_PATH, JSON.stringify({ ts: new Date().toISOString(), ...event }) + '\n');
44
+ }
45
+ /** TODO(P5): drive an actual session via the chosen engine + record metrics. */
46
+ export async function runSingle(_engine, _corpus, _runIdx) {
47
+ throw new Error('ab-harness runSingle() is not implemented in P2 R3. Real CLI subprocess invocation is deferred to P5 ' +
48
+ 'when A1 is daily-driving the plugin. The scaffold defines the metrics shape + jsonl writer; integration ' +
49
+ 'wires up in P5 cco-cutover-docs or a P5 follow-up.');
50
+ }
51
+ export function parseArgs(argv) {
52
+ const args = {};
53
+ for (let i = 0; i < argv.length; i++) {
54
+ const a = argv[i];
55
+ if (a.startsWith('--')) {
56
+ args[a.slice(2)] = argv[i + 1] ?? '';
57
+ i++;
58
+ }
59
+ }
60
+ const engine = args['engine'];
61
+ const corpus = args['corpus'];
62
+ const count = Number.parseInt(args['count'] ?? '0', 10);
63
+ if (!engine || !corpus || !Number.isFinite(count) || count <= 0)
64
+ return null;
65
+ return { engine, corpus, count };
66
+ }
67
+ // CLI entrypoint — only when invoked via tsx, not when imported
68
+ if (import.meta.url === `file://${process.argv[1]}`) {
69
+ const cli = parseArgs(process.argv.slice(2));
70
+ if (!cli) {
71
+ process.stderr.write('Usage: tsx scripts/bench/ab-harness.ts --engine <cc-openclaw|claude-local> --corpus <cold-start|warm-turn|tool-heavy|long-dialogue|mcp-heavy> --count <N>\n');
72
+ process.exit(2);
73
+ }
74
+ process.stdout.write(`Bench scaffold ready: engine=${cli.engine} corpus=${cli.corpus} count=${cli.count}\n`);
75
+ process.stdout.write('runSingle() is deferred to P5 — see scripts/bench/README.md\n');
76
+ process.exit(0);
77
+ }
78
+ //# sourceMappingURL=ab-harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ab-harness.js","sourceRoot":"","sources":["../../../scripts/bench/ab-harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,yBAAyB,CAAC,CAAC;AAmBzG,SAAS,SAAS,CAAC,QAAgB;IACjC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAA6B;IAC3D,SAAS,CAAC,UAAU,CAAC,CAAC;IACtB,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAChG,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,OAAmB,EAAE,OAAe;IACnF,MAAM,IAAI,KAAK,CACb,uGAAuG;QACvG,0GAA0G;QAC1G,oDAAoD,CACrD,CAAC;AACJ,CAAC;AASD,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC/C,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;YACrC,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAW,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAe,CAAC;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC;AAED,gEAAgE;AAChE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6JAA6J,CAC9J,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,GAAG,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;IAC7G,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACtF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}