@cjhyy/code-shell 0.2.0 → 0.5.0-rc.1

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 (432) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +35 -2
  3. package/dist/cli.js +2 -0
  4. package/dist/index.d.ts +1 -67
  5. package/dist/index.js +1 -1
  6. package/package.json +25 -71
  7. package/dist/agent/coordinator.d.ts +0 -49
  8. package/dist/anthropic-OVRWAZRD.js +0 -1
  9. package/dist/arena/arena.d.ts +0 -43
  10. package/dist/arena/context/context-tools.d.ts +0 -16
  11. package/dist/arena/detect-mode.d.ts +0 -20
  12. package/dist/arena/digest-builder.d.ts +0 -25
  13. package/dist/arena/index.d.ts +0 -29
  14. package/dist/arena/index.js +0 -1
  15. package/dist/arena/iterate/convergence.d.ts +0 -25
  16. package/dist/arena/iterate/formats/index.d.ts +0 -22
  17. package/dist/arena/iterate/index.d.ts +0 -11
  18. package/dist/arena/iterate/iterative-arena.d.ts +0 -23
  19. package/dist/arena/iterate/parse.d.ts +0 -42
  20. package/dist/arena/iterate/phases/argue.d.ts +0 -22
  21. package/dist/arena/iterate/phases/revise.d.ts +0 -16
  22. package/dist/arena/iterate/phases/tournament.d.ts +0 -34
  23. package/dist/arena/iterate/tools/web-tools.d.ts +0 -13
  24. package/dist/arena/iterate/types.d.ts +0 -152
  25. package/dist/arena/ledger.d.ts +0 -47
  26. package/dist/arena/lenses/architecture.d.ts +0 -5
  27. package/dist/arena/lenses/engineering.d.ts +0 -5
  28. package/dist/arena/lenses/general.d.ts +0 -5
  29. package/dist/arena/lenses/index.d.ts +0 -16
  30. package/dist/arena/lenses/product.d.ts +0 -5
  31. package/dist/arena/model-presets.d.ts +0 -23
  32. package/dist/arena/phases/adjudication.d.ts +0 -24
  33. package/dist/arena/phases/build-consensus.d.ts +0 -29
  34. package/dist/arena/phases/claim-registry.d.ts +0 -26
  35. package/dist/arena/phases/cross-review.d.ts +0 -45
  36. package/dist/arena/phases/debate-rounds.d.ts +0 -27
  37. package/dist/arena/phases/participant-research.d.ts +0 -38
  38. package/dist/arena/phases/planning-detail-expansion.d.ts +0 -38
  39. package/dist/arena/planner.d.ts +0 -27
  40. package/dist/arena/providers/docs.d.ts +0 -6
  41. package/dist/arena/providers/git.d.ts +0 -8
  42. package/dist/arena/providers/index.d.ts +0 -32
  43. package/dist/arena/providers/none.d.ts +0 -7
  44. package/dist/arena/providers/repo.d.ts +0 -6
  45. package/dist/arena/render/session.d.ts +0 -17
  46. package/dist/arena/render/terminal.d.ts +0 -33
  47. package/dist/arena/strategies/discussion.d.ts +0 -25
  48. package/dist/arena/strategies/index.d.ts +0 -15
  49. package/dist/arena/strategies/language-wrapper.d.ts +0 -17
  50. package/dist/arena/strategies/lens-wrapper.d.ts +0 -16
  51. package/dist/arena/strategies/planning.d.ts +0 -30
  52. package/dist/arena/strategies/review.d.ts +0 -26
  53. package/dist/arena/strategies/utils.d.ts +0 -39
  54. package/dist/arena/tools/selector.d.ts +0 -17
  55. package/dist/arena/transitions.d.ts +0 -48
  56. package/dist/arena/types.d.ts +0 -508
  57. package/dist/arena-64T2EQD4.js +0 -3
  58. package/dist/bootstrap/setup.d.ts +0 -14
  59. package/dist/bootstrap/state.d.ts +0 -160
  60. package/dist/bwrap-PVZMLHZR.js +0 -2
  61. package/dist/chunk-2EUIMKJA.js +0 -1
  62. package/dist/chunk-2GJ7H5NC.js +0 -641
  63. package/dist/chunk-2OD6VR4N.js +0 -2
  64. package/dist/chunk-3QP5BQ3L.js +0 -1
  65. package/dist/chunk-A4M2Y42L.js +0 -2
  66. package/dist/chunk-DEYFK6FP.js +0 -1
  67. package/dist/chunk-DTPABBSV.js +0 -2
  68. package/dist/chunk-EU3J7TBP.js +0 -1
  69. package/dist/chunk-FU7AHZNN.js +0 -1
  70. package/dist/chunk-L7B2ORID.js +0 -4
  71. package/dist/chunk-M7VU4YVY.js +0 -49
  72. package/dist/chunk-MGP35GKD.js +0 -254
  73. package/dist/chunk-MLCTC53I.js +0 -1
  74. package/dist/chunk-O5HFCH2U.js +0 -1
  75. package/dist/chunk-P6JSTIFM.js +0 -1
  76. package/dist/chunk-Q3RSX66I.js +0 -1
  77. package/dist/chunk-QTWU7UNA.js +0 -5
  78. package/dist/chunk-RERBX75D.js +0 -251
  79. package/dist/chunk-SNFAPSLA.js +0 -1
  80. package/dist/chunk-T222K6IV.js +0 -18
  81. package/dist/chunk-TKJA6W36.js +0 -3
  82. package/dist/chunk-VKKU4LOM.js +0 -3
  83. package/dist/chunk-WI6FSWGU.js +0 -1
  84. package/dist/chunk-XXCZE2U2.js +0 -2
  85. package/dist/chunk-ZSAONDT6.js +0 -2
  86. package/dist/cli/commands/arena.d.ts +0 -29
  87. package/dist/cli/commands/builtin/advanced-commands.d.ts +0 -5
  88. package/dist/cli/commands/builtin/core-commands.d.ts +0 -5
  89. package/dist/cli/commands/builtin/export-md.d.ts +0 -19
  90. package/dist/cli/commands/builtin/extra-commands.d.ts +0 -6
  91. package/dist/cli/commands/builtin/git-commands.d.ts +0 -5
  92. package/dist/cli/commands/builtin/init/detect.d.ts +0 -25
  93. package/dist/cli/commands/builtin/init/index.d.ts +0 -19
  94. package/dist/cli/commands/builtin/more-commands.d.ts +0 -5
  95. package/dist/cli/commands/builtin/permissions-command.d.ts +0 -5
  96. package/dist/cli/commands/builtin/utility-commands.d.ts +0 -5
  97. package/dist/cli/commands/registry.d.ts +0 -72
  98. package/dist/cli/commands/repl.d.ts +0 -21
  99. package/dist/cli/commands/run.d.ts +0 -21
  100. package/dist/cli/commands/runs.d.ts +0 -14
  101. package/dist/cli/cost-tracker.d.ts +0 -63
  102. package/dist/cli/exit.d.ts +0 -12
  103. package/dist/cli/input/ndjson-reader.d.ts +0 -31
  104. package/dist/cli/input-compiler.d.ts +0 -5
  105. package/dist/cli/main.d.ts +0 -5
  106. package/dist/cli/main.js +0 -399
  107. package/dist/cli/migrate-models.d.ts +0 -45
  108. package/dist/cli/onboarding.d.ts +0 -189
  109. package/dist/cli/output/renderer.d.ts +0 -28
  110. package/dist/cli/output/terminal-ui.d.ts +0 -50
  111. package/dist/cli/updater.d.ts +0 -65
  112. package/dist/client-base-F5FCRSB3.js +0 -1
  113. package/dist/compaction-L3Y6NG4N.js +0 -1
  114. package/dist/context/compaction.d.ts +0 -116
  115. package/dist/context/manager.d.ts +0 -145
  116. package/dist/context/token-counter.d.ts +0 -27
  117. package/dist/context/tool-result-storage.d.ts +0 -96
  118. package/dist/cron/scheduler.d.ts +0 -34
  119. package/dist/data/openrouter-models.d.ts +0 -35
  120. package/dist/data/openrouter-sync.d.ts +0 -16
  121. package/dist/data/static-catalogs.d.ts +0 -25
  122. package/dist/devtools-SGDUOOM4.js +0 -1
  123. package/dist/engine/cost-store.d.ts +0 -22
  124. package/dist/engine/engine.d.ts +0 -207
  125. package/dist/engine/model-facade.d.ts +0 -24
  126. package/dist/engine/query.d.ts +0 -50
  127. package/dist/engine/streaming-tool-queue.d.ts +0 -34
  128. package/dist/engine/token-budget.d.ts +0 -22
  129. package/dist/engine/tool-summary.d.ts +0 -13
  130. package/dist/engine/turn-loop.d.ts +0 -97
  131. package/dist/engine/turn-state.d.ts +0 -20
  132. package/dist/exceptions.d.ts +0 -44
  133. package/dist/export-md-U72T7NW7.js +0 -22
  134. package/dist/file-history-7FQFEQOL.js +0 -1
  135. package/dist/git/utils.d.ts +0 -35
  136. package/dist/git/worktree.d.ts +0 -36
  137. package/dist/hooks/events.d.ts +0 -35
  138. package/dist/hooks/registry.d.ts +0 -15
  139. package/dist/llm/capabilities/index.d.ts +0 -20
  140. package/dist/llm/capabilities/rules.d.ts +0 -26
  141. package/dist/llm/capabilities/types.d.ts +0 -108
  142. package/dist/llm/client-base.d.ts +0 -29
  143. package/dist/llm/client-factory.d.ts +0 -10
  144. package/dist/llm/model-cache.d.ts +0 -21
  145. package/dist/llm/model-fetcher.d.ts +0 -29
  146. package/dist/llm/model-pool.d.ts +0 -84
  147. package/dist/llm/provider-catalog.d.ts +0 -32
  148. package/dist/llm/provider-kinds.d.ts +0 -21
  149. package/dist/llm/providers/anthropic.d.ts +0 -19
  150. package/dist/llm/providers/openai.d.ts +0 -41
  151. package/dist/llm/token-counter.d.ts +0 -17
  152. package/dist/llm/types.d.ts +0 -37
  153. package/dist/logging/logger.d.ts +0 -88
  154. package/dist/logging/session-recorder.d.ts +0 -90
  155. package/dist/lsp/client.d.ts +0 -41
  156. package/dist/lsp/manager.d.ts +0 -40
  157. package/dist/lsp/servers.d.ts +0 -16
  158. package/dist/manager-J6FXEUEK.js +0 -1
  159. package/dist/mcp-manager-27EVBKRT.js +0 -1
  160. package/dist/memory-BNI4WEWL.js +0 -1
  161. package/dist/model-cache-HEDXI7UJ.js +0 -1
  162. package/dist/model-fetcher-X5W5EASG.js +0 -1
  163. package/dist/native-ts/yoga-layout/enums.d.ts +0 -117
  164. package/dist/native-ts/yoga-layout/index.d.ts +0 -270
  165. package/dist/off-7SDVMMXW.js +0 -1
  166. package/dist/openai-3QEADSYL.js +0 -1
  167. package/dist/openrouter-models-GZVCRWD2.js +0 -1
  168. package/dist/openrouter-sync-WG4AG5NC.js +0 -1
  169. package/dist/plugins/loader.d.ts +0 -72
  170. package/dist/plugins/types.d.ts +0 -4
  171. package/dist/preset/index.d.ts +0 -60
  172. package/dist/product/define.d.ts +0 -60
  173. package/dist/product/index.d.ts +0 -5
  174. package/dist/product/index.js +0 -1
  175. package/dist/product/types.d.ts +0 -111
  176. package/dist/prompt/composer.d.ts +0 -42
  177. package/dist/prompt/instruction-scanner.d.ts +0 -54
  178. package/dist/prompt/section-cache.d.ts +0 -15
  179. package/dist/prompt/section-loader.d.ts +0 -26
  180. package/dist/protocol/client.d.ts +0 -64
  181. package/dist/protocol/index.d.ts +0 -4
  182. package/dist/protocol/server.d.ts +0 -51
  183. package/dist/protocol/transport.d.ts +0 -36
  184. package/dist/protocol/types.d.ts +0 -192
  185. package/dist/react-compiler-runtime-shim.d.ts +0 -1
  186. package/dist/remote/bridge.d.ts +0 -37
  187. package/dist/render/Ansi.d.ts +0 -10
  188. package/dist/render/bidi.d.ts +0 -15
  189. package/dist/render/clearTerminal.d.ts +0 -13
  190. package/dist/render/colorize.d.ts +0 -16
  191. package/dist/render/components/AlternateScreen.d.ts +0 -21
  192. package/dist/render/components/App.d.ts +0 -70
  193. package/dist/render/components/AppContext.d.ts +0 -11
  194. package/dist/render/components/Box.d.ts +0 -49
  195. package/dist/render/components/Button.d.ts +0 -36
  196. package/dist/render/components/ClockContext.d.ts +0 -9
  197. package/dist/render/components/CursorDeclarationContext.d.ts +0 -22
  198. package/dist/render/components/ErrorOverview.d.ts +0 -5
  199. package/dist/render/components/Link.d.ts +0 -7
  200. package/dist/render/components/Newline.d.ts +0 -12
  201. package/dist/render/components/NoSelect.d.ts +0 -19
  202. package/dist/render/components/RawAnsi.d.ts +0 -16
  203. package/dist/render/components/ScrollBox.d.ts +0 -78
  204. package/dist/render/components/Spacer.d.ts +0 -5
  205. package/dist/render/components/StdinContext.d.ts +0 -27
  206. package/dist/render/components/TerminalFocusContext.d.ts +0 -10
  207. package/dist/render/components/TerminalSizeContext.d.ts +0 -5
  208. package/dist/render/components/Text.d.ts +0 -55
  209. package/dist/render/constants.d.ts +0 -1
  210. package/dist/render/cursor.d.ts +0 -8
  211. package/dist/render/devtools.d.ts +0 -5
  212. package/dist/render/dom.d.ts +0 -76
  213. package/dist/render/events/click-event.d.ts +0 -31
  214. package/dist/render/events/dispatcher.d.ts +0 -40
  215. package/dist/render/events/emitter.d.ts +0 -5
  216. package/dist/render/events/event-handlers.d.ts +0 -46
  217. package/dist/render/events/event.d.ts +0 -5
  218. package/dist/render/events/focus-event.d.ts +0 -13
  219. package/dist/render/events/input-event.d.ts +0 -30
  220. package/dist/render/events/keyboard-event.d.ts +0 -19
  221. package/dist/render/events/paste-event.d.ts +0 -8
  222. package/dist/render/events/resize-event.d.ts +0 -9
  223. package/dist/render/events/terminal-event.d.ts +0 -54
  224. package/dist/render/events/terminal-focus-event.d.ts +0 -13
  225. package/dist/render/focus.d.ts +0 -43
  226. package/dist/render/frame.d.ts +0 -94
  227. package/dist/render/get-max-width.d.ts +0 -17
  228. package/dist/render/hit-test.d.ts +0 -33
  229. package/dist/render/hooks/use-animation-frame.d.ts +0 -26
  230. package/dist/render/hooks/use-app.d.ts +0 -5
  231. package/dist/render/hooks/use-declared-cursor.d.ts +0 -26
  232. package/dist/render/hooks/use-input.d.ts +0 -37
  233. package/dist/render/hooks/use-interval.d.ts +0 -18
  234. package/dist/render/hooks/use-search-highlight.d.ts +0 -30
  235. package/dist/render/hooks/use-selection.d.ts +0 -39
  236. package/dist/render/hooks/use-stdin.d.ts +0 -5
  237. package/dist/render/hooks/use-tab-status.d.ts +0 -13
  238. package/dist/render/hooks/use-terminal-focus.d.ts +0 -10
  239. package/dist/render/hooks/use-terminal-title.d.ts +0 -12
  240. package/dist/render/hooks/use-terminal-viewport.d.ts +0 -29
  241. package/dist/render/index.d.ts +0 -20
  242. package/dist/render/ink.d.ts +0 -369
  243. package/dist/render/instances.d.ts +0 -3
  244. package/dist/render/layout/engine.d.ts +0 -2
  245. package/dist/render/layout/geometry.d.ts +0 -30
  246. package/dist/render/layout/node.d.ts +0 -125
  247. package/dist/render/layout/yoga.d.ts +0 -56
  248. package/dist/render/line-width-cache.d.ts +0 -1
  249. package/dist/render/log-update.d.ts +0 -17
  250. package/dist/render/measure-element.d.ts +0 -16
  251. package/dist/render/measure-text.d.ts +0 -6
  252. package/dist/render/node-cache.d.ts +0 -20
  253. package/dist/render/optimizer.d.ts +0 -15
  254. package/dist/render/output.d.ts +0 -119
  255. package/dist/render/parse-keypress.d.ts +0 -111
  256. package/dist/render/reconciler.d.ts +0 -11
  257. package/dist/render/render-border.d.ts +0 -24
  258. package/dist/render/render-node-to-output.d.ts +0 -45
  259. package/dist/render/render-to-screen.d.ts +0 -46
  260. package/dist/render/renderer.d.ts +0 -14
  261. package/dist/render/root.d.ts +0 -74
  262. package/dist/render/screen.d.ts +0 -269
  263. package/dist/render/searchHighlight.d.ts +0 -20
  264. package/dist/render/selection.d.ts +0 -229
  265. package/dist/render/squash-text-nodes.d.ts +0 -22
  266. package/dist/render/stringWidth.d.ts +0 -1
  267. package/dist/render/styles.d.ts +0 -306
  268. package/dist/render/supports-hyperlinks.d.ts +0 -13
  269. package/dist/render/tabstops.d.ts +0 -1
  270. package/dist/render/terminal-focus-state.d.ts +0 -6
  271. package/dist/render/terminal-querier.d.ts +0 -129
  272. package/dist/render/terminal.d.ts +0 -46
  273. package/dist/render/termio/ansi.d.ts +0 -65
  274. package/dist/render/termio/csi.d.ts +0 -165
  275. package/dist/render/termio/dec.d.ts +0 -37
  276. package/dist/render/termio/esc.d.ts +0 -12
  277. package/dist/render/termio/osc.d.ts +0 -173
  278. package/dist/render/termio/parser.d.ts +0 -35
  279. package/dist/render/termio/sgr.d.ts +0 -8
  280. package/dist/render/termio/tokenize.d.ts +0 -45
  281. package/dist/render/termio/types.d.ts +0 -190
  282. package/dist/render/termio.d.ts +0 -24
  283. package/dist/render/useTerminalNotification.d.ts +0 -28
  284. package/dist/render/warn.d.ts +0 -1
  285. package/dist/render/widest-line.d.ts +0 -1
  286. package/dist/render/wrap-text.d.ts +0 -2
  287. package/dist/render/wrapAnsi.d.ts +0 -7
  288. package/dist/run/ArtifactTracker.d.ts +0 -38
  289. package/dist/run/CheckpointWriter.d.ts +0 -53
  290. package/dist/run/EngineRunner.d.ts +0 -72
  291. package/dist/run/Evaluator.d.ts +0 -56
  292. package/dist/run/FileRunStore.d.ts +0 -39
  293. package/dist/run/Heartbeat.d.ts +0 -54
  294. package/dist/run/RunApprovalBackend.d.ts +0 -53
  295. package/dist/run/RunLock.d.ts +0 -40
  296. package/dist/run/RunManager.d.ts +0 -82
  297. package/dist/run/RunQueue.d.ts +0 -27
  298. package/dist/run/RunStore.d.ts +0 -25
  299. package/dist/run/factory.d.ts +0 -63
  300. package/dist/run/index.d.ts +0 -17
  301. package/dist/run/index.js +0 -1
  302. package/dist/run/types.d.ts +0 -136
  303. package/dist/seatbelt-L54CNI2Y.js +0 -37
  304. package/dist/services/analytics.d.ts +0 -29
  305. package/dist/services/auto-dream.d.ts +0 -35
  306. package/dist/services/diagnostics.d.ts +0 -41
  307. package/dist/services/extract-memories.d.ts +0 -27
  308. package/dist/services/index.d.ts +0 -10
  309. package/dist/services/notifier.d.ts +0 -25
  310. package/dist/services/oauth.d.ts +0 -27
  311. package/dist/services/session-memory.d.ts +0 -37
  312. package/dist/session/file-history.d.ts +0 -41
  313. package/dist/session/memory.d.ts +0 -65
  314. package/dist/session/session-manager.d.ts +0 -28
  315. package/dist/session/transcript.d.ts +0 -39
  316. package/dist/session-manager-AGWS5SMJ.js +0 -1
  317. package/dist/settings/manager.d.ts +0 -36
  318. package/dist/settings/schema.d.ts +0 -1036
  319. package/dist/skills/index.d.ts +0 -7
  320. package/dist/skills/matcher.d.ts +0 -21
  321. package/dist/skills/scanner.d.ts +0 -30
  322. package/dist/tool-summary-V2B3MD5N.js +0 -2
  323. package/dist/tool-system/builtin/agent-registry.d.ts +0 -36
  324. package/dist/tool-system/builtin/agent.d.ts +0 -16
  325. package/dist/tool-system/builtin/apply-patch/applier.d.ts +0 -26
  326. package/dist/tool-system/builtin/apply-patch/index.d.ts +0 -19
  327. package/dist/tool-system/builtin/apply-patch/parser.d.ts +0 -17
  328. package/dist/tool-system/builtin/apply-patch/seek-sequence.d.ts +0 -18
  329. package/dist/tool-system/builtin/apply-patch/types.d.ts +0 -49
  330. package/dist/tool-system/builtin/arena.d.ts +0 -31
  331. package/dist/tool-system/builtin/ask-user.d.ts +0 -20
  332. package/dist/tool-system/builtin/bash.d.ts +0 -12
  333. package/dist/tool-system/builtin/brief.d.ts +0 -6
  334. package/dist/tool-system/builtin/config.d.ts +0 -6
  335. package/dist/tool-system/builtin/cron.d.ts +0 -10
  336. package/dist/tool-system/builtin/edit.d.ts +0 -6
  337. package/dist/tool-system/builtin/file-cache.d.ts +0 -11
  338. package/dist/tool-system/builtin/glob.d.ts +0 -6
  339. package/dist/tool-system/builtin/grep.d.ts +0 -6
  340. package/dist/tool-system/builtin/index.d.ts +0 -20
  341. package/dist/tool-system/builtin/lsp.d.ts +0 -6
  342. package/dist/tool-system/builtin/mcp-tools.d.ts +0 -10
  343. package/dist/tool-system/builtin/notebook-edit.d.ts +0 -6
  344. package/dist/tool-system/builtin/plan.d.ts +0 -18
  345. package/dist/tool-system/builtin/powershell.d.ts +0 -6
  346. package/dist/tool-system/builtin/read.d.ts +0 -6
  347. package/dist/tool-system/builtin/remote-trigger.d.ts +0 -6
  348. package/dist/tool-system/builtin/repl.d.ts +0 -6
  349. package/dist/tool-system/builtin/send-message.d.ts +0 -6
  350. package/dist/tool-system/builtin/skill.d.ts +0 -6
  351. package/dist/tool-system/builtin/sleep.d.ts +0 -6
  352. package/dist/tool-system/builtin/task.d.ts +0 -51
  353. package/dist/tool-system/builtin/tool-search.d.ts +0 -11
  354. package/dist/tool-system/builtin/web-fetch.d.ts +0 -6
  355. package/dist/tool-system/builtin/web-search.d.ts +0 -6
  356. package/dist/tool-system/builtin/worktree.d.ts +0 -10
  357. package/dist/tool-system/builtin/write.d.ts +0 -6
  358. package/dist/tool-system/context.d.ts +0 -110
  359. package/dist/tool-system/executor.d.ts +0 -49
  360. package/dist/tool-system/investigation-guard.d.ts +0 -46
  361. package/dist/tool-system/mcp-manager.d.ts +0 -50
  362. package/dist/tool-system/permission.d.ts +0 -104
  363. package/dist/tool-system/registry.d.ts +0 -32
  364. package/dist/tool-system/sandbox/bwrap.d.ts +0 -13
  365. package/dist/tool-system/sandbox/index.d.ts +0 -78
  366. package/dist/tool-system/sandbox/off.d.ts +0 -2
  367. package/dist/tool-system/sandbox/seatbelt.d.ts +0 -18
  368. package/dist/tool-system/task-guard.d.ts +0 -30
  369. package/dist/tool-system/validation.d.ts +0 -5
  370. package/dist/types.d.ts +0 -321
  371. package/dist/ui/App.d.ts +0 -14
  372. package/dist/ui/components/AgentBlock.d.ts +0 -32
  373. package/dist/ui/components/AskUserPrompt.d.ts +0 -14
  374. package/dist/ui/components/BabyHand.d.ts +0 -1
  375. package/dist/ui/components/Banner.d.ts +0 -8
  376. package/dist/ui/components/CodeBlock.d.ts +0 -7
  377. package/dist/ui/components/CommandInput.d.ts +0 -13
  378. package/dist/ui/components/ContextUsageBar.d.ts +0 -7
  379. package/dist/ui/components/DiffLine.d.ts +0 -33
  380. package/dist/ui/components/DiffView.d.ts +0 -6
  381. package/dist/ui/components/DogLogo.d.ts +0 -1
  382. package/dist/ui/components/FullscreenLayout.d.ts +0 -51
  383. package/dist/ui/components/KunHead.d.ts +0 -1
  384. package/dist/ui/components/KunLogo.d.ts +0 -1
  385. package/dist/ui/components/MessageContent.d.ts +0 -26
  386. package/dist/ui/components/ModelManager.d.ts +0 -68
  387. package/dist/ui/components/ModelSelector.d.ts +0 -10
  388. package/dist/ui/components/OnboardingPrompt.d.ts +0 -16
  389. package/dist/ui/components/PermissionDialog.d.ts +0 -8
  390. package/dist/ui/components/PermissionPrompt.d.ts +0 -11
  391. package/dist/ui/components/ProviderModelFlow.d.ts +0 -58
  392. package/dist/ui/components/ScrollView.d.ts +0 -34
  393. package/dist/ui/components/SessionPicker.d.ts +0 -16
  394. package/dist/ui/components/Spinner.d.ts +0 -8
  395. package/dist/ui/components/SpinnerWithVerb.d.ts +0 -18
  396. package/dist/ui/components/StatusLine.d.ts +0 -28
  397. package/dist/ui/components/StructuredDiff.d.ts +0 -8
  398. package/dist/ui/components/TaskList.d.ts +0 -6
  399. package/dist/ui/components/TextInput.d.ts +0 -9
  400. package/dist/ui/components/ThemedBox.d.ts +0 -19
  401. package/dist/ui/components/ThemedText.d.ts +0 -26
  402. package/dist/ui/components/ToolCall.d.ts +0 -28
  403. package/dist/ui/components/UpdateBanner.d.ts +0 -1
  404. package/dist/ui/components/VirtualMessageList.d.ts +0 -24
  405. package/dist/ui/components/WelcomeTips.d.ts +0 -5
  406. package/dist/ui/hooks/useCostSummary.d.ts +0 -1
  407. package/dist/ui/index.d.ts +0 -12
  408. package/dist/ui/input-history.d.ts +0 -61
  409. package/dist/ui/onboarding-runner.d.ts +0 -2
  410. package/dist/ui/store.d.ts +0 -83
  411. package/dist/ui/terminal-renderer.d.ts +0 -45
  412. package/dist/ui/theme.d.ts +0 -36
  413. package/dist/ui/vim-mode.d.ts +0 -25
  414. package/dist/updater-OCNU2K2Z.js +0 -1
  415. package/dist/utils/debug.d.ts +0 -41
  416. package/dist/utils/earlyInput.d.ts +0 -43
  417. package/dist/utils/env.d.ts +0 -24
  418. package/dist/utils/envUtils.d.ts +0 -51
  419. package/dist/utils/execFileNoThrow.d.ts +0 -39
  420. package/dist/utils/format.d.ts +0 -44
  421. package/dist/utils/fullscreen.d.ts +0 -47
  422. package/dist/utils/intl.d.ts +0 -22
  423. package/dist/utils/lockfile.d.ts +0 -15
  424. package/dist/utils/semver.d.ts +0 -6
  425. package/dist/utils/sliceAnsi.d.ts +0 -12
  426. package/dist/utils/systemTheme.d.ts +0 -40
  427. package/dist/utils/task-sanitizer.d.ts +0 -6
  428. package/dist/utils/theme.d.ts +0 -91
  429. package/dist/utils/toolDisplay.d.ts +0 -31
  430. package/dist/utils/truncate.d.ts +0 -40
  431. package/dist/voice/index.d.ts +0 -35
  432. package/skills-builtin/codeshell-help.md +0 -135
package/CHANGELOG.md CHANGED
@@ -8,6 +8,189 @@ breaking.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ### Added
12
+
13
+ #### Reusable sub-agent roles (`.code-shell/agents`)
14
+
15
+ - The `Agent` tool now accepts an optional `agent_type` parameter. When set, it
16
+ loads a reusable role definition from `<cwd>/.code-shell/agents/<name>.md`
17
+ (YAML frontmatter + body), supplying the sub-agent's model, tool allowlist,
18
+ turn cap, and system prompt. Omitting `agent_type` preserves the existing
19
+ ephemeral behavior — fully backward compatible.
20
+ - Per-role **model routing** via `ModelPool` keys (unknown key → soft fallback
21
+ to the parent model), per-role **tool allowlists**, and per-role **turn caps**.
22
+ - Background sub-agents are now capped at `MAX_BACKGROUND_AGENTS` (default 6);
23
+ synchronous sub-agents have a wall-clock timeout (default 5 minutes).
24
+ - Sub-agent spawns emit `subagent_start` / `subagent_finish` / `subagent_error`
25
+ lifecycle events through the existing `notification` hook.
26
+ - Ships sample roles under `examples/agents/`: `researcher` and `explorer`
27
+ (read-only), `planner` (read-only planning), and `general-purpose` (full
28
+ tools). Their `model` is left unset so they reuse the parent model — set
29
+ `model:` in the frontmatter to route a role to a specific pool key.
30
+
31
+ ## [0.5.0-rc.0] - 2026-05-23
32
+
33
+ > ⚠️ Breaking. The repo is now a monorepo with three published packages.
34
+ > The single-package install path still works (`@cjhyy/code-shell` re-exports
35
+ > everything from core), but direct deep imports into `src/...` are gone.
36
+ > Migrate to the public package APIs before upgrading.
37
+
38
+ ### Changed
39
+
40
+ #### Monorepo split — three packages
41
+
42
+ The codebase was split into a Bun workspace with three publishable packages
43
+ plus one private Electron POC:
44
+
45
+ - **`@cjhyy/code-shell-core`** — the engine. Engine, AgentServer, hooks,
46
+ tool system, LLM clients, session, protocol types, presets. Zero UI
47
+ dependencies. Headless and embeddable in any host (TUI, Electron main,
48
+ server). No React, no Ink, no chalk.
49
+ - **`@cjhyy/code-shell-tui`** — the terminal client. Owns the React/Ink
50
+ render layer, the `code-shell` CLI bin, themes, key bindings, all
51
+ terminal-only utilities. Imports core; nothing else imports it.
52
+ - **`@cjhyy/code-shell`** (meta) — thin re-export shim. `import { Engine }
53
+ from "@cjhyy/code-shell"` still works for SDK users; the `code-shell`
54
+ bin loads the TUI CLI. Ships three files total: `index.js`, `index.d.ts`,
55
+ `cli.js`.
56
+ - **`@cjhyy/code-shell-desktop`** (private) — Electron POC. Currently a
57
+ build-pipeline skeleton (main + preload + renderer + esbuild/vite
58
+ orchestration). Not published.
59
+
60
+ Existing users on `@cjhyy/code-shell` see no API change; deep-import users
61
+ (`@cjhyy/code-shell/src/...`) must migrate to the public surface.
62
+
63
+ #### Core decoupled from chalk
64
+
65
+ `@cjhyy/code-shell-core` no longer depends on `chalk`. ~70 chalk call sites
66
+ across cost-tracker, arena render, theme, and CLI-shared modules were
67
+ replaced with an injected `Colorizer` interface. Hosts pass a colorizer
68
+ implementation (TUI uses chalk; Electron / headless use `NOOP_COLORIZER`).
69
+ This removes core's last terminal-formatting dependency and lets non-TTY
70
+ hosts render the same data structures with their own styling.
71
+
72
+ ### Added
73
+
74
+ - ESLint architectural guards: renderer cannot import core directly;
75
+ no-engine-bypass check enforced.
76
+ - `scripts/build-meta.ts` — produces the meta package's three-file dist.
77
+ - `packages/desktop/scripts/{dev,build}.ts` — three-process orchestrator
78
+ (vite renderer + esbuild main + esbuild preload).
79
+
80
+ ### Removed
81
+
82
+ - `chalk` dependency from `@cjhyy/code-shell-core`.
83
+ - All deep-import paths under `src/...`. Use `@cjhyy/code-shell-core`'s
84
+ public surface (`@cjhyy/code-shell` for SDK users).
85
+
86
+ ## [0.3.0] - 2026-05-20
87
+
88
+ ### Added
89
+
90
+ #### Hook system — Claude Code parity
91
+
92
+ The HookRegistry skeleton that landed earlier now has actual emit points,
93
+ result consumption, and two new ways for users to register handlers.
94
+ After this release, every event Claude Code exposes has a codeshell
95
+ equivalent that is actually emitted, handler return values are fully
96
+ consumed, and users can wire shell-command hooks via `settings.json` or
97
+ plugin `hooks.json` files.
98
+
99
+ - **New lifecycle emits.** `on_session_start`, `on_session_end`,
100
+ `user_prompt_submit`, `post_compact`, `on_permission_check`,
101
+ `notification`. The first three carry `messages`, `decision`, and
102
+ the new mutation fields into the conversation as a single
103
+ `<system-reminder>` block.
104
+ - **Decision semantics complete.** `pre_tool_use` handlers can now
105
+ return `decision: "allow"` to skip the PermissionClassifier entirely,
106
+ or `decision: "ask"` to route through ApprovalBackend with the
107
+ handler's messages threaded into the prompt description.
108
+ - **HookResult mutations.** New fields `updatedInput` (rewrite tool
109
+ args, re-validated against the schema), `additionalContext` (append
110
+ text to a successful tool's output), and `updatedPrompt` (replace the
111
+ user's prompt text on `user_prompt_submit`). Registry aggregation is
112
+ last-write-wins for input/prompt, newline-joined for additionalContext.
113
+ - **`settings.json` shell hooks.** New `hooks: [{event, command,
114
+ matcher?, timeout_ms?, cwd?}]` schema. Engine spawns the command per
115
+ emit with the CC wire protocol — stdin is the HookContext JSON,
116
+ stdout is a HookResult JSON, exit 2 = deny with stderr surfaced to
117
+ the model. `CODESHELL_HOOK_EVENT` / `CODESHELL_HOOK_CWD` env vars
118
+ are passed to the child; default 60s timeout with SIGTERM → SIGKILL
119
+ cleanup.
120
+ - **CC plugin `hooks.json` auto-load.** `loadPluginHooks` scans every
121
+ installed plugin's `hooks/hooks.json` and registers the
122
+ command-type entries. PascalCase event names (SessionStart,
123
+ UserPromptSubmit, PreToolUse, …) are mapped to codeshell's
124
+ snake_case. SubagentStop is dropped (codeshell doesn't surface that
125
+ event). `pluginCommandHook` normalizes the three known plugin
126
+ stdout shapes (`hookSpecificOutput.additionalContext`,
127
+ `additional_context`, `additionalContext`) into HookResult.messages.
128
+ - **`varRewrite` at install time.** Plugin trees materialized through
129
+ `installPlugin` get `${CLAUDE_PLUGIN_ROOT}` rewritten to
130
+ `${CODESHELL_PLUGIN_ROOT}` across every text file, so CC-authored
131
+ plugin scripts that branch on host detection pick the codeshell
132
+ path. `InstallResult.varRewrite` reports counts and `/plugin
133
+ install` prints a `rewrote: N file(s)` line so the modification is
134
+ visible.
135
+ - **`ToolContext.hooks`.** Tools that need to emit lifecycle events
136
+ (currently `notification` on background sub-agent terminal states)
137
+ reach the registry without going through Engine.
138
+ - **User guide.** `docs/hooks.md` documents the full event surface,
139
+ HookResult fields, shell protocol, priority chain, and CC migration
140
+ notes.
141
+
142
+ #### Arena
143
+
144
+ - `/arena-status` now reads `settings.arena.participants` and uses it
145
+ when present, mirroring how the actual Arena execution path already
146
+ resolves participants. Fixes a divergence where the diagnostic
147
+ preview showed the auto-derived pool while real runs used the
148
+ curated list.
149
+
150
+ ### Changed
151
+
152
+ - **`isSubAgent` auto-merged into hook ctx.data.** All Engine-side
153
+ emits go through `Engine.emitHook` / `TurnLoop.emitHook`, which
154
+ injects `isSubAgent` (and `sessionId` for turn-loop) into
155
+ `ctx.data` so handlers can skip noisy injections for spawned
156
+ children with one consistent check.
157
+ - **`PermissionClassifier.handleAsk(toolName, args, reason?)`.** Third
158
+ arg is appended to the approval description so users see why a hook
159
+ asked for confirmation.
160
+ - **`hooks/events.ts` comment block** rewritten to reflect the
161
+ actual emit surface and the reserved-vs-emitted split.
162
+ - **`pluginCommandHook` child env strips `CLAUDE_PLUGIN_ROOT`.** A
163
+ CC-authored script that branches on `[ -n "$CLAUDE_PLUGIN_ROOT" ]`
164
+ now reliably picks the codeshell branch, regardless of whether the
165
+ parent shell happened to have that var set.
166
+
167
+ ### Removed
168
+
169
+ - **In-tree superpowers injector** (`src/hooks/builtin/`). The CC
170
+ plugin `hooks.json` path is now authoritative: the superpowers
171
+ plugin's own `hooks/hooks.json` drives `SessionStart` injection of
172
+ the `using-superpowers` SKILL.md body. `preset.strictSkills` and the
173
+ `CODESHELL_STRICT_SKILLS` env switch are gone — toggle by uninstalling
174
+ the plugin or editing its `hooks.json`.
175
+
176
+ ### Fixed
177
+
178
+ - **`agent-dock` test alignment.** The "blank-line between rows"
179
+ assertion was failing since the marginTop=1 was removed in favor of
180
+ a compact list; surviving invariants (both rows render, startedAt
181
+ order preserved) are kept.
182
+ - **Intentional unicode regex literals.** `INVISIBLE_CHARS` and
183
+ `FULLWIDTH_SPACE` in `api-key-sanitize.ts` deliberately contain
184
+ zero-width / CJK characters; ESLint flagged them as
185
+ `no-irregular-whitespace` errors. Annotated with inline disables.
186
+
187
+ ## [0.2.0] - 2026-05-15
188
+
189
+ Capability layer + per-(provider, model) request-shape adapter. No
190
+ public API changes; meaningful enough architectural increment to
191
+ warrant a minor bump. (CHANGELOG was not maintained for this release;
192
+ see git log between v0.1.6 and v0.2.0 for the detailed change set.)
193
+
11
194
  ## [0.1.6] - 2026-05-13
12
195
 
13
196
  ### Added
package/README.md CHANGED
@@ -108,6 +108,31 @@ Supported `agent` settings:
108
108
  - `customSystemPrompt`
109
109
  - `appendSystemPrompt`
110
110
 
111
+ ### Fullscreen Mode
112
+
113
+ Codeshell defaults to **fullscreen** (alt-screen + ScrollBox). This is the
114
+ mode where window resize repaints cleanly — flow mode can show duplicate
115
+ content in the terminal's scrollback after a resize because the terminal
116
+ pushes the old viewport up before codeshell can erase it.
117
+
118
+ Opt out of fullscreen at startup with `CODESHELL_FULLSCREEN=0|false|off`,
119
+ or toggle at runtime with `/fullscreen off`. Flow mode lets the transcript
120
+ flow into the terminal's native scrollback (useful if you prefer keeping
121
+ shell history above codeshell visible).
122
+
123
+ ### Stream Idle Watchdog (opt-in)
124
+
125
+ When `CODESHELL_ENABLE_STREAM_WATCHDOG=1`, the openai provider aborts any LLM
126
+ stream that has gone `CODESHELL_STREAM_IDLE_TIMEOUT_MS` ms (default `90000`)
127
+ without receiving a chunk. The engine then retries via the existing
128
+ `withRetry` policy, capped by `CODESHELL_STREAM_WATCHDOG_RETRIES` (default
129
+ `2`) attempts with exponential backoff.
130
+
131
+ This bounds upstream hangs at ~90 s instead of indefinitely. User-initiated
132
+ aborts (Esc / Ctrl+C) are never retried.
133
+
134
+ Disabled by default — set the flag explicitly to opt in.
135
+
111
136
  ## Built-in presets
112
137
 
113
138
  | Preset | Purpose | Extra tools |
@@ -148,21 +173,29 @@ Design principles:
148
173
 
149
174
  ## Further Reading
150
175
 
176
+ - [CodeShell architecture documentation set](docs/architecture/README.md)
177
+ - [CodeShell architecture diagrams](docs/architecture/10-architecture-diagrams.md)
178
+ - [TUI Render 能力规划](docs/architecture/11-render-tui-capability-plan.md)
179
+ - [mac 端可视化客户端调研](docs/architecture/12-mac-visual-client-research.md)
151
180
  - [CodeShell 当前架构与定位说明](docs/codeshell-repo-architecture.md)
152
181
 
153
182
  ## Project structure
154
183
 
155
184
  ```text
156
185
  src/
157
- ├── cli/ # CLI entrypoints and terminal UI
186
+ ├── cli/ # CLI entrypoints, commands, onboarding, and output modes
158
187
  ├── context/ # Context compaction and window management
159
188
  ├── engine/ # Turn loop orchestration
160
189
  ├── hooks/ # Hook chain
161
190
  ├── llm/ # Model providers
162
191
  ├── preset/ # Built-in agent presets
163
192
  ├── prompt/ # Prompt composition
193
+ ├── protocol/ # Agent client/server protocol
194
+ ├── render/ # Custom Ink-like terminal renderer
195
+ ├── run/ # Managed run lifecycle
164
196
  ├── session/ # Session persistence and memory
165
- ├── tool/ # Tool registry, execution, permissions, MCP
197
+ ├── tool-system/ # Tool registry, execution, permissions, MCP
198
+ ├── ui/ # Terminal UI components
166
199
  └── index.ts # Public API exports
167
200
  ```
168
201
 
package/dist/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import "@cjhyy/code-shell-tui/cli";
package/dist/index.d.ts CHANGED
@@ -1,67 +1 @@
1
- /**
2
- * code-shell — general-purpose agent orchestration framework
3
- *
4
- * Public API exports.
5
- */
6
- export declare const VERSION = "0.2.0";
7
- export type { Message, ContentBlock, ToolDefinition, ToolCall, ToolResult, RegisteredTool, TranscriptEvent, TranscriptEventType, SessionState, TokenUsage, CompiledInput, PermissionDecision, PermissionMode, PermissionRule, TurnPhase, TurnResult, TerminalReason, StreamEvent, StreamCallback, LLMConfig, LLMResponse, Settings, MCPServerConfig, } from "./types.js";
8
- export { FrameworkError, LLMError, LLMRateLimitError, ContextLimitError, ToolError, ToolNotFoundError, ToolExecutionError, ToolTimeoutError, PermissionDeniedError, SessionError, TranscriptError, ConfigError, } from "./exceptions.js";
9
- export { Engine } from "./engine/engine.js";
10
- export type { EngineConfig, EngineHookConfig, EngineResult } from "./engine/engine.js";
11
- export type { CostStateStore, CostStateSnapshot } from "./engine/cost-store.js";
12
- export { LLMClientBase } from "./llm/client-base.js";
13
- export { createLLMClient, registerProvider } from "./llm/client-factory.js";
14
- export { AnthropicClient } from "./llm/providers/anthropic.js";
15
- export { OpenAIClient } from "./llm/providers/openai.js";
16
- export { ModelPool, type ModelEntry } from "./llm/model-pool.js";
17
- export { ToolRegistry } from "./tool-system/registry.js";
18
- export { ToolExecutor } from "./tool-system/executor.js";
19
- export { PermissionClassifier, HeadlessApprovalBackend, AutoApprovalBackend } from "./tool-system/permission.js";
20
- export type { ApprovalBackend } from "./tool-system/permission.js";
21
- export { BUILTIN_TOOLS } from "./tool-system/builtin/index.js";
22
- export { MCPManager } from "./tool-system/mcp-manager.js";
23
- export type { AskUserFn } from "./tool-system/builtin/ask-user.js";
24
- export { taskManager } from "./tool-system/builtin/task.js";
25
- export type { Task, TaskStatus } from "./tool-system/builtin/task.js";
26
- export { HookRegistry } from "./hooks/registry.js";
27
- export type { HookEventName, HookContext, HookResult } from "./hooks/events.js";
28
- export { Transcript } from "./session/transcript.js";
29
- export { SessionManager } from "./session/session-manager.js";
30
- export { FileHistory } from "./session/file-history.js";
31
- export { MemoryManager } from "./session/memory.js";
32
- export type { MemoryEntry } from "./session/memory.js";
33
- export type { FileSnapshot } from "./session/file-history.js";
34
- export { PromptComposer } from "./prompt/composer.js";
35
- export { SectionCache } from "./prompt/section-cache.js";
36
- export { scanInstructions, combineInstructions } from "./prompt/instruction-scanner.js";
37
- export { BUILTIN_AGENT_PRESETS, DEFAULT_AGENT_PRESET, DEFAULT_CLI_PRESET, resolveAgentPreset, resolveBuiltinToolNames, buildPresetSystemPrompt, registerPreset, listPresetNames, } from "./preset/index.js";
38
- export type { AgentPreset, AgentPresetName } from "./preset/index.js";
39
- export { loadSection, loadSections, availableSections, registerSection } from "./prompt/section-loader.js";
40
- export { ContextManager } from "./context/manager.js";
41
- export { estimateTokens, microcompact, windowCompact, truncateToolResult, buildSummarizationPrompt, applySummaryCompaction, COMPACTABLE_TOOL_NAMES, } from "./context/compaction.js";
42
- export type { MicrocompactOptions } from "./context/compaction.js";
43
- export type { SummarizeFn, CompactStrategy, OnCompactFn, ContextManagerConfig, } from "./context/manager.js";
44
- export { applyToolResultPersistence, createContentReplacementState, reconstructContentReplacementState, resolveToolResultsDir, isPersistedReplacement, DEFAULT_PERSIST_THRESHOLD, PER_MESSAGE_AGGREGATE_CAP, PREVIEW_SIZE, } from "./context/tool-result-storage.js";
45
- export type { ContentReplacementState } from "./context/tool-result-storage.js";
46
- export { scanSkills, matchSkillsByInput, matchSkillsByTool, buildSkillListing } from "./skills/index.js";
47
- export type { SkillDefinition, MatchResult } from "./skills/index.js";
48
- export { Arena } from "./arena/arena.js";
49
- export { MODEL_PRESETS, getMaxOutputTokens } from "./arena/model-presets.js";
50
- export type { ModelPreset } from "./arena/model-presets.js";
51
- export { detectArenaMode } from "./arena/detect-mode.js";
52
- export { getStrategy, getStrategyForPlan, ReviewStrategy, DiscussionStrategy, PlanningStrategy } from "./arena/strategies/index.js";
53
- export { planArena } from "./arena/planner.js";
54
- export { collectEvidence } from "./arena/providers/index.js";
55
- export { selectTools, hasTools } from "./arena/tools/selector.js";
56
- export { ArenaLedger } from "./arena/ledger.js";
57
- export { registerClaims, selectClaimsForReview } from "./arena/phases/claim-registry.js";
58
- export { buildDigest, formatDigest } from "./arena/digest-builder.js";
59
- export { transitionClaim, resolveClaimStatus, markUnderReview, applyReviewResult, markUnresolved, isTerminal, validTransitions } from "./arena/transitions.js";
60
- export type { ArenaConfig, ArenaMode, ArenaResultV2, ArenaStrategy, ArenaParticipant, ArenaBaseContext, ArenaFinding, FindingReview, ParticipantReport, ArenaConsensus, ArenaConsensusItem, ArenaRoadmapPhase, ArenaProgressEvent, ArenaPlan, ArenaLens, ArenaLensName, ArenaSourceKind, ArenaArtifact, ArenaQuickFact, FindingKind, PeerVerdict, ToolTrace, EvidencePacket, FindingEvidenceLink, ResearchDossier, ClaimStatus, ClaimRecord, ClaimChallenge, ClaimAdjudication, RequestedCheck, DebateRound, DebateTurn, TargetedCheckTask, SharedResearchLedger, RoundResearchDigest, ArenaExecutionLimits, } from "./arena/types.js";
61
- export { IterativeArena, defaultIterateConvergence, iterateDiffRatio, iterateCodeFormat, iterateDocumentFormat, getIterateFormat, } from "./arena/index.js";
62
- export type { IterateConfig, IterateResult, IterateSubject, IterateFormat, IterateProgressEvent, IterateFormatPack, Draft, DraftCandidate, Critique, CritiqueCategory, CritiqueEvidence, CritiqueSeverity, ConvergenceSignal, Round, AuthorRotation, StoppedReason, CheckpointFn, CheckpointContext, CheckpointAction, } from "./arena/index.js";
63
- export { RunManager, type RunManagerConfig, type RunStore, FileRunStore, RunQueue, EngineRunner, type EngineRunnerConfig, type RunExecutionHandle, type RunExecutor, type CustomToolEntry, RunApprovalBackend, createRunAskUserFn, type RunLifecycleHooks, CheckpointWriter, ArtifactTracker, RunLock, Heartbeat, NoopEvaluator, CompositeEvaluator, type Evaluator, type EvaluatorResult, type EvaluatorContext, type RunStatus, type RunSnapshot, type RunEvent, type RunCheckpoint, type RunApproval, type RunArtifactRef, type SubmitRunInput, type ResumeRunInput, type ListRunsQuery, type RunStreamEvent, type RunStreamCallback, type DetachFn, VALID_TRANSITIONS, createRunManager, type CreateRunManagerOptions, } from "./run/index.js";
64
- export { defineProduct, type ProductDefinition, type ProductPreset, type ProductAdapter, type ProductContract, type CustomTool, type ProductRuntimeOptions, type ProductInstance, } from "./product/index.js";
65
- export { logger } from "./logging/logger.js";
66
- export { SettingsManager } from "./settings/manager.js";
67
- export { SettingsSchema, validateSettings } from "./settings/schema.js";
1
+ export * from "@cjhyy/code-shell-core";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export{a as defineProduct}from'./chunk-Q3RSX66I.js';export{a as createRunManager}from'./chunk-EU3J7TBP.js';export{$ as ArtifactTracker,j as AutoApprovalBackend,J as BUILTIN_AGENT_PRESETS,e as BUILTIN_TOOLS,_ as CheckpointWriter,da as CompositeEvaluator,x as ContextManager,K as DEFAULT_AGENT_PRESET,L as DEFAULT_CLI_PRESET,p as DEFAULT_PERSIST_THRESHOLD,U as Engine,ea as EngineRunner,W as FileRunStore,i as HeadlessApprovalBackend,ba as Heartbeat,o as HookRegistry,ca as NoopEvaluator,q as PER_MESSAGE_AGGREGATE_CAP,r as PREVIEW_SIZE,n as PermissionClassifier,R as PromptComposer,Y as RunApprovalBackend,aa as RunLock,fa as RunManager,X as RunQueue,y as SectionCache,h as ToolExecutor,f as ToolRegistry,V as VALID_TRANSITIONS,v as applyToolResultPersistence,I as availableSections,P as buildPresetSystemPrompt,E as buildSkillListing,A as combineInstructions,s as createContentReplacementState,Z as createRunAskUserFn,w as isPersistedReplacement,N as listPresetNames,G as loadSection,H as loadSections,C as matchSkillsByInput,D as matchSkillsByTool,t as reconstructContentReplacementState,M as registerPreset,F as registerSection,O as resolveAgentPreset,Q as resolveBuiltinToolNames,u as resolveToolResultsDir,z as scanInstructions,B as scanSkills,c as taskManager}from'./chunk-MGP35GKD.js';export{a as ModelPool}from'./chunk-MLCTC53I.js';export{a as FileHistory}from'./chunk-WI6FSWGU.js';import'./chunk-P6JSTIFM.js';import'./chunk-SNFAPSLA.js';export{a as MCPManager}from'./chunk-L7B2ORID.js';import {p}from'./chunk-M7VU4YVY.js';export{e as COMPACTABLE_TOOL_NAMES,k as applySummaryCompaction,i as buildSummarizationPrompt,a as estimateTokens,f as microcompact,h as truncateToolResult,d as windowCompact}from'./chunk-M7VU4YVY.js';export{b as MemoryManager}from'./chunk-T222K6IV.js';export{b as SessionManager,a as Transcript}from'./chunk-QTWU7UNA.js';export{c as SettingsManager,a as SettingsSchema,b as validateSettings}from'./chunk-DTPABBSV.js';export{j as IterativeArena,f as defaultIterateConvergence,i as getIterateFormat,g as iterateCodeFormat,e as iterateDiffRatio,h as iterateDocumentFormat}from'./chunk-RERBX75D.js';export{J as Arena,I as ArenaLedger,e as DiscussionStrategy,Q as MODEL_PRESETS,f as PlanningStrategy,d as ReviewStrategy,z as applyReviewResult,u as buildDigest,n as collectEvidence,b as createLLMClient,v as formatDigest,R as getMaxOutputTokens,k as getStrategy,l as getStrategyForPlan,p as hasTools,B as isTerminal,y as markUnderReview,A as markUnresolved,m as planArena,s as registerClaims,a as registerProvider,x as resolveClaimStatus,t as selectClaimsForReview,o as selectTools,w as transitionClaim,C as validTransitions}from'./chunk-2GJ7H5NC.js';import'./chunk-A4M2Y42L.js';export{a as AnthropicClient}from'./chunk-DEYFK6FP.js';export{a as OpenAIClient}from'./chunk-VKKU4LOM.js';import'./chunk-O5HFCH2U.js';export{a as LLMClientBase}from'./chunk-2EUIMKJA.js';export{l as ConfigError,d as ContextLimitError,a as FrameworkError,b as LLMError,c as LLMRateLimitError,i as PermissionDeniedError,j as SessionError,e as ToolError,g as ToolExecutionError,f as ToolNotFoundError,h as ToolTimeoutError,k as TranscriptError}from'./chunk-FU7AHZNN.js';export{b as logger}from'./chunk-ZSAONDT6.js';import {h,a}from'./chunk-3QP5BQ3L.js';h();p();h();var vt={review:[{patterns:[/\breview\b/i,/\baudit\b/i,/\binspect\b/i,/\bcheck\b/i],weight:2},{patterns:[/\bcode\s*quality\b/i,/\bbug\b/i,/\bvulnerab/i,/\bsecur/i]},{patterns:[/\bpr\b/i,/\bpull\s*request\b/i,/\bdiff\b/i,/\bchanges?\b/i]},{patterns:[/\brefactor/i,/\bclean\s*up\b/i,/\bimprove\b/i]}],discussion:[{patterns:[/\bdiscuss\b/i,/\bdebate\b/i,/\bcompare\b/i],weight:2},{patterns:[/\bpros?\s*(and|&|\/)\s*cons?\b/i,/\btrade\s*-?\s*offs?\b/i]},{patterns:[/\bshould\s+we\b/i,/\bwhich\s+(is|approach|way)\b/i,/\bvs\.?\b/i]},{patterns:[/\bopinion\b/i,/\bthoughts?\b/i,/\badvice\b/i]}],planning:[{patterns:[/\bplan\b/i,/\bplanning\b/i,/\broadmap\b/i,/\bstrategy\b/i],weight:2},{patterns:[/\barchitect/i,/\bdesign\b/i,/\bproposal\b/i]},{patterns:[/\bimplement(ation)?\s+(plan|strategy|approach)\b/i],weight:2},{patterns:[/\bphase\b/i,/\bmilestone\b/i,/\btimeline\b/i,/\bprioritiz/i]},{patterns:[/\bbuild\b/i,/\bcreate\b/i,/\bsetup\b/i,/\bbootstrap\b/i]}]},kt=3,Mt=2;function Pt(m){let a={review:0,discussion:0,planning:0};for(let[n,i]of Object.entries(vt))for(let p of i){let u=p.weight??1;for(let d of p.patterns)d.test(m)&&(a[n]+=u);}let s=Object.entries(a).sort((n,i)=>i[1]-n[1]),[t,e]=s[0],[,l]=s[1],r=e-l;return e>=kt&&r>=Mt?{mode:t,confidence:"high",reason:`Topic strongly matches "${t}" (score: ${e}, lead: +${r})`}:e>0&&r>0?{mode:t,confidence:"low",reason:`Topic weakly matches "${t}" (score: ${e}, lead: +${r})`}:{mode:"review",confidence:"low",reason:"No strong mode signal detected, defaulting to review"}}a(Pt,"detectArenaMode");var wt="0.2.0";export{wt as VERSION,Pt as detectArenaMode};
1
+ export * from "@cjhyy/code-shell-core";
package/package.json CHANGED
@@ -1,33 +1,39 @@
1
1
  {
2
2
  "name": "@cjhyy/code-shell",
3
- "version": "0.2.0",
4
- "description": "Code Shell — general-purpose agent orchestration framework with a terminal coding preset",
3
+ "version": "0.5.0-rc.1",
4
+ "description": "Code Shell — meta package. Installs @cjhyy/code-shell-core and @cjhyy/code-shell-tui.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
7
  "types": "./dist/index.d.ts",
9
8
  "exports": {
10
9
  ".": {
11
10
  "types": "./dist/index.d.ts",
12
11
  "import": "./dist/index.js"
13
- },
14
- "./run": {
15
- "types": "./dist/run/index.d.ts",
16
- "import": "./dist/run/index.js"
17
- },
18
- "./arena": {
19
- "types": "./dist/arena/index.d.ts",
20
- "import": "./dist/arena/index.js"
21
- },
22
- "./product": {
23
- "types": "./dist/product/index.d.ts",
24
- "import": "./dist/product/index.js"
25
- },
26
- "./package.json": "./package.json"
12
+ }
27
13
  },
28
14
  "bin": {
29
- "code-shell": "dist/cli/main.js"
15
+ "code-shell": "./dist/cli.js"
30
16
  },
17
+ "scripts": {
18
+ "preinstall": "node scripts/check-node.cjs",
19
+ "build": "bun run --filter '@cjhyy/code-shell-core' build && bun run --filter '@cjhyy/code-shell-tui' build && bun run scripts/build-meta.ts",
20
+ "dev": "CODE_SHELL_DEV=1 CODESHELL_UI_PERF=1 bun run packages/tui/src/cli/main.ts",
21
+ "dev:bigtranscript": "bun run scripts/render-bigtranscript-dev.ts",
22
+ "test": "bun test",
23
+ "test:watch": "bun test --watch",
24
+ "bench:render": "bun run bench/render-tail.bench.ts && bun run bench/render-streaming.bench.ts && bun run bench/render-spinner.bench.ts && bun run bench/render-wheel.bench.ts",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "eslint packages/",
27
+ "lint:engine-bypass": "bash scripts/check-no-engine-bypass.sh",
28
+ "format": "prettier --write 'packages/**/*.ts'"
29
+ },
30
+ "dependencies": {
31
+ "@cjhyy/code-shell-core": "0.5.0-rc.1",
32
+ "@cjhyy/code-shell-tui": "0.5.0-rc.1"
33
+ },
34
+ "workspaces": [
35
+ "packages/*"
36
+ ],
31
37
  "repository": {
32
38
  "type": "git",
33
39
  "url": "git+https://github.com/cjhyy/codeshell.git"
@@ -39,26 +45,12 @@
39
45
  "publishConfig": {
40
46
  "access": "public"
41
47
  },
42
- "scripts": {
43
- "preinstall": "node scripts/check-node.cjs",
44
- "build": "bun run sync-models && bun run tsup && bun run build:dts",
45
- "build:dts": "tsc --emitDeclarationOnly --declaration --outDir dist || true",
46
- "sync-models": "bun run scripts/sync-models.ts",
47
- "dev": "CODE_SHELL_DEV=1 bun run src/cli/main.ts",
48
- "test": "bun test",
49
- "test:watch": "bun test --watch",
50
- "lint": "eslint src/",
51
- "format": "prettier --write 'src/**/*.ts'",
52
- "typecheck": "bun run tsc --noEmit",
53
- "prepublishOnly": "bun run build"
54
- },
55
48
  "engines": {
56
49
  "node": ">=20.10"
57
50
  },
58
51
  "files": [
59
52
  "dist",
60
53
  "scripts/check-node.cjs",
61
- "skills-builtin",
62
54
  "README.md",
63
55
  "LICENSE",
64
56
  "CHANGELOG.md"
@@ -75,45 +67,6 @@
75
67
  ],
76
68
  "author": "maki maki",
77
69
  "license": "MIT",
78
- "dependencies": {
79
- "@alcalzone/ansi-tokenize": "^0.3.0",
80
- "@anthropic-ai/sdk": "^0.39.0",
81
- "@modelcontextprotocol/sdk": "^1.12.1",
82
- "asciichart": "^1.5.25",
83
- "auto-bind": "^5.0.1",
84
- "bidi-js": "^1.0.3",
85
- "chalk": "^5.4.1",
86
- "cli-boxes": "^4.0.1",
87
- "cli-highlight": "^2.1.11",
88
- "code-excerpt": "^4.0.0",
89
- "commander": "^13.1.0",
90
- "diff": "^8.0.4",
91
- "emoji-regex": "^10.6.0",
92
- "get-east-asian-width": "^1.5.0",
93
- "glob": "^11.0.0",
94
- "gpt-tokenizer": "^3.4.0",
95
- "indent-string": "^5.0.0",
96
- "lodash-es": "^4.17.23",
97
- "marked": "^17.0.5",
98
- "marked-terminal": "^7.3.0",
99
- "nanoid": "^5.1.2",
100
- "openai": "^4.82.0",
101
- "ora": "^9.3.0",
102
- "proper-lockfile": "^4.1.2",
103
- "react": "^19.2.4",
104
- "react-reconciler": "^0.33.0",
105
- "semver": "^7.7.4",
106
- "signal-exit": "^4.1.0",
107
- "stack-utils": "^2.0.6",
108
- "strip-ansi": "^7.2.0",
109
- "supports-hyperlinks": "^4.4.0",
110
- "type-fest": "^5.5.0",
111
- "usehooks-ts": "^3.1.1",
112
- "wrap-ansi": "^10.0.0",
113
- "yaml": "^2.7.0",
114
- "yoga-layout": "^3.2.1",
115
- "zod": "^3.24.2"
116
- },
117
70
  "devDependencies": {
118
71
  "@eslint/js": "^10.0.1",
119
72
  "@types/lodash": "^4.17.24",
@@ -121,6 +74,7 @@
121
74
  "@types/node": "^22.12.0",
122
75
  "@types/react": "^19.2.14",
123
76
  "@types/semver": "^7.7.1",
77
+ "bun-types": "^1.3.14",
124
78
  "eslint": "^9.19.0",
125
79
  "prettier": "^3.4.2",
126
80
  "tsup": "^8.3.6",
@@ -1,49 +0,0 @@
1
- /**
2
- * Agent coordinator — agent registry + message bus for multi-agent communication.
3
- */
4
- /** A registered named agent. */
5
- export interface AgentInfo {
6
- id: string;
7
- name: string;
8
- status: "running" | "completed" | "failed";
9
- description: string;
10
- startedAt: number;
11
- completedAt?: number;
12
- result?: string;
13
- }
14
- /** A message between agents. */
15
- export interface AgentMessage {
16
- from: string;
17
- to: string;
18
- content: string;
19
- timestamp: number;
20
- }
21
- /**
22
- * Singleton agent registry and message bus.
23
- */
24
- declare class AgentCoordinator {
25
- private agents;
26
- private inbox;
27
- /** Register a named agent. */
28
- register(id: string, name: string, description: string): void;
29
- /** Mark an agent as completed. */
30
- complete(name: string, result?: string): void;
31
- /** Mark an agent as failed. */
32
- fail(name: string): void;
33
- /** Get agent info by name. */
34
- get(name: string): AgentInfo | undefined;
35
- /** List all agents. */
36
- list(): AgentInfo[];
37
- /** List active (running) agents. */
38
- listActive(): AgentInfo[];
39
- /** Send a message to a named agent. */
40
- send(from: string, to: string, content: string): boolean;
41
- /** Read messages for a named agent (drains the inbox). */
42
- receive(name: string): AgentMessage[];
43
- /** Peek at messages without draining. */
44
- peek(name: string): AgentMessage[];
45
- /** Reset all state. */
46
- reset(): void;
47
- }
48
- export declare const agentCoordinator: AgentCoordinator;
49
- export {};
@@ -1 +0,0 @@
1
- export{a as AnthropicClient}from'./chunk-DEYFK6FP.js';import'./chunk-O5HFCH2U.js';import'./chunk-2EUIMKJA.js';import'./chunk-FU7AHZNN.js';import'./chunk-ZSAONDT6.js';import'./chunk-3QP5BQ3L.js';
@@ -1,43 +0,0 @@
1
- /**
2
- * Arena — multi-model collaborative analysis engine.
3
- *
4
- * Evidence-Driven Pipeline:
5
- * 0. Planner → understand what the user wants (mode, lenses, sources)
6
- * 1. EvidenceProviders → collect artifacts from selected sources
7
- * 2. Strategy + Lens → compose prompts (mode flow + perspective)
8
- * 3. ToolSelector → determine which tools participants can use
9
- * 4. ParticipantResearch → each model investigates independently (parallel)
10
- * 4b. ClaimRegistry → register findings as claims, populate ledger
11
- * 5. VerificationReview → claim-aware cross-review with evidence digests
12
- * 7. DebateRounds → contested claims enter structured debate
13
- * 8. Adjudication → moderator rules on contested claims
14
- * 6. ConsensusBuilder → claim-aware structured consensus
15
- */
16
- import type { ArenaConfig, ArenaResultV2 } from "./types.js";
17
- import type { PlannerFlags } from "./planner.js";
18
- export declare class Arena {
19
- private config;
20
- private strategy;
21
- private limits;
22
- constructor(config: ArenaConfig);
23
- /**
24
- * Run a full arena session.
25
- *
26
- * @param topic - User's topic/request (natural language)
27
- * @param flags - Optional explicit overrides (mode, base, head)
28
- */
29
- run(topic: string, flags?: PlannerFlags): Promise<ArenaResultV2>;
30
- /**
31
- * Planning path: merge-oriented review → roadmap consensus → detail expansion.
32
- *
33
- * Planning mode does NOT enter heavy debate/adjudication. Contested findings
34
- * are converted to open questions or dependency risks in the roadmap.
35
- */
36
- private runPlanningPath;
37
- /**
38
- * Review/Discussion path: verification review → debate → adjudication → consensus.
39
- *
40
- * This is the heavy trust loop for claim verification.
41
- */
42
- private runReviewDiscussionPath;
43
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Context tools — read-only tools that arena participants can use
3
- * to fetch additional source context during research.
4
- *
5
- * Security: All shell commands use execFileSync with argument arrays
6
- * to prevent command injection. File paths are validated against the
7
- * repository boundary to prevent path traversal.
8
- */
9
- import type { ToolDefinition, ToolCall } from "../../types.js";
10
- export declare const MAX_TOOL_RESULT = 15000;
11
- export declare const MAX_TOOL_ROUNDS = 3;
12
- export declare const CONTEXT_TOOLS: ToolDefinition[];
13
- /**
14
- * Execute a context tool call and return the result string.
15
- */
16
- export declare function executeContextTool(tc: ToolCall): string;
@@ -1,20 +0,0 @@
1
- /**
2
- * Arena mode auto-detection — infer review/discussion/planning from topic text.
3
- *
4
- * Heuristic-based: uses keyword matching with weighted scoring.
5
- * Falls back to "review" (safest default) when confidence is low.
6
- */
7
- import type { ArenaMode } from "./types.js";
8
- /** Result of heuristic mode detection */
9
- export interface ArenaModeDetection {
10
- mode: ArenaMode;
11
- confidence: "high" | "low";
12
- reason: string;
13
- }
14
- /**
15
- * Auto-detect arena mode from the topic string.
16
- *
17
- * Returns the detected mode, confidence level, and a human-readable reason.
18
- * When confidence is low, falls back to "review" (the safest default).
19
- */
20
- export declare function detectArenaMode(topic: string): ArenaModeDetection;
@@ -1,25 +0,0 @@
1
- /**
2
- * DigestBuilder — constructs RoundResearchDigest from the shared ledger.
3
- *
4
- * The digest is a filtered view injected into prompts to avoid
5
- * token explosion from the full ledger. Program-built, not model-built.
6
- */
7
- import type { ArenaLedger } from "./ledger.js";
8
- import type { RoundResearchDigest } from "./types.js";
9
- interface DigestOptions {
10
- /** Current round number */
11
- round: number;
12
- /** Claim IDs relevant to this round (e.g. contested claims in debate) */
13
- relevantClaimIds: string[];
14
- }
15
- /**
16
- * Build a digest from the shared ledger for a specific round.
17
- * Only includes data relevant to the specified claims.
18
- */
19
- export declare function buildDigest(ledger: ArenaLedger, options: DigestOptions): RoundResearchDigest;
20
- /**
21
- * Format a digest into a text block suitable for prompt injection.
22
- * All LLM-originated text is sanitized before inclusion.
23
- */
24
- export declare function formatDigest(digest: RoundResearchDigest): string;
25
- export {};