@ebowwa/coder 0.2.1 → 0.7.64

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 (401) hide show
  1. package/README.md +31 -32
  2. package/dist/core/__tests__/permissions.test.d.ts +12 -0
  3. package/dist/core/__tests__/permissions.test.d.ts.map +1 -0
  4. package/dist/core/__tests__/permissions.test.js +851 -0
  5. package/dist/core/agent-loop/__tests__/compaction.test.d.ts +5 -0
  6. package/dist/core/agent-loop/__tests__/compaction.test.d.ts.map +1 -0
  7. package/dist/core/agent-loop/__tests__/compaction.test.js +209 -0
  8. package/dist/core/agent-loop/__tests__/formatters.test.d.ts +5 -0
  9. package/dist/core/agent-loop/__tests__/formatters.test.d.ts.map +1 -0
  10. package/dist/core/agent-loop/__tests__/formatters.test.js +195 -0
  11. package/dist/core/agent-loop/__tests__/index.test.d.ts +5 -0
  12. package/dist/core/agent-loop/__tests__/index.test.d.ts.map +1 -0
  13. package/dist/core/agent-loop/__tests__/index.test.js +121 -0
  14. package/dist/core/agent-loop/__tests__/loop-state.test.d.ts +5 -0
  15. package/dist/core/agent-loop/__tests__/loop-state.test.d.ts.map +1 -0
  16. package/dist/core/agent-loop/__tests__/loop-state.test.js +340 -0
  17. package/dist/core/agent-loop/__tests__/message-builder.test.d.ts +5 -0
  18. package/dist/core/agent-loop/__tests__/message-builder.test.d.ts.map +1 -0
  19. package/dist/core/agent-loop/__tests__/message-builder.test.js +178 -0
  20. package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts +5 -0
  21. package/dist/core/agent-loop/__tests__/tool-executor.test.d.ts.map +1 -0
  22. package/dist/core/agent-loop/__tests__/tool-executor.test.js +331 -0
  23. package/dist/core/agent-loop/compaction.d.ts +39 -0
  24. package/dist/core/agent-loop/compaction.d.ts.map +1 -0
  25. package/dist/core/agent-loop/compaction.js +51 -0
  26. package/dist/core/agent-loop/formatters.d.ts +21 -0
  27. package/dist/core/agent-loop/formatters.d.ts.map +1 -0
  28. package/dist/core/agent-loop/formatters.js +42 -0
  29. package/dist/core/agent-loop/index.d.ts +25 -0
  30. package/dist/core/agent-loop/index.d.ts.map +1 -0
  31. package/dist/core/agent-loop/index.js +83 -0
  32. package/dist/core/agent-loop/loop-state.d.ts +74 -0
  33. package/dist/core/agent-loop/loop-state.d.ts.map +1 -0
  34. package/dist/core/agent-loop/loop-state.js +147 -0
  35. package/dist/core/agent-loop/message-builder.d.ts +13 -0
  36. package/dist/core/agent-loop/message-builder.d.ts.map +1 -0
  37. package/dist/core/agent-loop/message-builder.js +49 -0
  38. package/dist/core/agent-loop/tool-executor.d.ts +23 -0
  39. package/dist/core/agent-loop/tool-executor.d.ts.map +1 -0
  40. package/dist/core/agent-loop/tool-executor.js +152 -0
  41. package/dist/core/agent-loop/turn-executor.d.ts +57 -0
  42. package/dist/core/agent-loop/turn-executor.d.ts.map +1 -0
  43. package/dist/core/agent-loop/turn-executor.js +124 -0
  44. package/dist/core/agent-loop/types.d.ts +141 -0
  45. package/dist/core/agent-loop/types.d.ts.map +1 -0
  46. package/dist/core/agent-loop/types.js +4 -0
  47. package/dist/core/agent-loop.d.ts +17 -0
  48. package/dist/core/agent-loop.d.ts.map +1 -0
  49. package/dist/core/agent-loop.js +16 -0
  50. package/dist/core/api-client-impl.d.ts +62 -0
  51. package/dist/core/api-client-impl.d.ts.map +1 -0
  52. package/dist/core/api-client-impl.js +479 -0
  53. package/dist/core/api-client.d.ts +6 -0
  54. package/dist/core/api-client.d.ts.map +1 -0
  55. package/dist/core/api-client.js +5 -0
  56. package/dist/core/checkpoints.d.ts +128 -0
  57. package/dist/core/checkpoints.d.ts.map +1 -0
  58. package/dist/core/checkpoints.js +438 -0
  59. package/dist/core/claude-md.d.ts +71 -0
  60. package/dist/core/claude-md.d.ts.map +1 -0
  61. package/dist/core/claude-md.js +198 -0
  62. package/dist/core/cognitive-security/hooks.d.ts +138 -0
  63. package/dist/core/cognitive-security/hooks.d.ts.map +1 -0
  64. package/dist/core/cognitive-security/hooks.js +389 -0
  65. package/dist/core/cognitive-security/index.d.ts +751 -0
  66. package/dist/core/cognitive-security/index.d.ts.map +1 -0
  67. package/dist/core/cognitive-security/index.js +1123 -0
  68. package/dist/core/cognitive-security/middleware.d.ts +136 -0
  69. package/dist/core/cognitive-security/middleware.d.ts.map +1 -0
  70. package/dist/core/cognitive-security/middleware.js +376 -0
  71. package/dist/core/config-loader.d.ts +127 -0
  72. package/dist/core/config-loader.d.ts.map +1 -0
  73. package/dist/core/config-loader.js +219 -0
  74. package/dist/core/context-compaction.d.ts +87 -0
  75. package/dist/core/context-compaction.d.ts.map +1 -0
  76. package/dist/core/context-compaction.js +428 -0
  77. package/dist/core/git-status.d.ts +25 -0
  78. package/dist/core/git-status.d.ts.map +1 -0
  79. package/dist/core/git-status.js +204 -0
  80. package/dist/core/image.d.ts +69 -0
  81. package/dist/core/image.d.ts.map +1 -0
  82. package/dist/core/image.js +290 -0
  83. package/dist/core/image.test.d.ts +2 -0
  84. package/dist/core/image.test.d.ts.map +1 -0
  85. package/dist/core/image.test.js +149 -0
  86. package/dist/core/models.d.ts +123 -0
  87. package/dist/core/models.d.ts.map +1 -0
  88. package/dist/core/models.js +325 -0
  89. package/dist/core/permissions.d.ts +81 -0
  90. package/dist/core/permissions.d.ts.map +1 -0
  91. package/dist/core/permissions.js +327 -0
  92. package/dist/core/retry.d.ts +25 -0
  93. package/dist/core/retry.d.ts.map +1 -0
  94. package/dist/core/retry.js +121 -0
  95. package/dist/core/session-store.d.ts +9 -0
  96. package/dist/core/session-store.d.ts.map +1 -0
  97. package/dist/core/session-store.js +10 -0
  98. package/dist/core/sessions/export.d.ts +47 -0
  99. package/dist/core/sessions/export.d.ts.map +1 -0
  100. package/dist/core/sessions/export.js +256 -0
  101. package/dist/core/sessions/index.d.ts +132 -0
  102. package/dist/core/sessions/index.d.ts.map +1 -0
  103. package/dist/core/sessions/index.js +442 -0
  104. package/dist/core/sessions/metadata.d.ts +77 -0
  105. package/dist/core/sessions/metadata.d.ts.map +1 -0
  106. package/dist/core/sessions/metadata.js +233 -0
  107. package/dist/core/sessions/persistence.d.ts +72 -0
  108. package/dist/core/sessions/persistence.d.ts.map +1 -0
  109. package/dist/core/sessions/persistence.js +201 -0
  110. package/dist/core/sessions/types.d.ts +110 -0
  111. package/dist/core/sessions/types.d.ts.map +1 -0
  112. package/dist/core/sessions/types.js +4 -0
  113. package/dist/core/stream-highlighter.d.ts +18 -0
  114. package/dist/core/stream-highlighter.d.ts.map +1 -0
  115. package/dist/core/stream-highlighter.js +916 -0
  116. package/dist/core/system-reminders.d.ts +89 -0
  117. package/dist/core/system-reminders.d.ts.map +1 -0
  118. package/dist/core/system-reminders.js +285 -0
  119. package/dist/ecosystem/hooks/__tests__/index.test.d.ts +5 -0
  120. package/dist/ecosystem/hooks/__tests__/index.test.d.ts.map +1 -0
  121. package/dist/ecosystem/hooks/__tests__/index.test.js +458 -0
  122. package/dist/ecosystem/hooks/index.d.ts +59 -0
  123. package/dist/ecosystem/hooks/index.d.ts.map +1 -0
  124. package/dist/ecosystem/hooks/index.js +294 -0
  125. package/dist/ecosystem/hooks/prompt-evaluator.d.ts +32 -0
  126. package/dist/ecosystem/hooks/prompt-evaluator.d.ts.map +1 -0
  127. package/dist/ecosystem/hooks/prompt-evaluator.js +229 -0
  128. package/dist/ecosystem/skills/index.d.ts +55 -0
  129. package/dist/ecosystem/skills/index.d.ts.map +1 -0
  130. package/dist/ecosystem/skills/index.js +258 -0
  131. package/dist/ecosystem/tools/__tests__/index.test.d.ts +7 -0
  132. package/dist/ecosystem/tools/__tests__/index.test.d.ts.map +1 -0
  133. package/dist/ecosystem/tools/__tests__/index.test.js +856 -0
  134. package/dist/ecosystem/tools/index.d.ts +24 -0
  135. package/dist/ecosystem/tools/index.d.ts.map +1 -0
  136. package/dist/ecosystem/tools/index.js +1709 -0
  137. package/dist/index.d.ts +24 -0
  138. package/dist/index.d.ts.map +1 -0
  139. package/dist/index.js +32 -2
  140. package/dist/interfaces/mcp/client.d.ts +40 -0
  141. package/dist/interfaces/mcp/client.d.ts.map +1 -0
  142. package/dist/interfaces/mcp/client.js +309 -0
  143. package/dist/interfaces/ui/index.d.ts +36 -0
  144. package/dist/interfaces/ui/index.d.ts.map +1 -0
  145. package/dist/interfaces/ui/index.js +61 -0
  146. package/dist/interfaces/ui/spinner.d.ts +140 -0
  147. package/dist/interfaces/ui/spinner.d.ts.map +1 -0
  148. package/dist/interfaces/ui/spinner.js +342 -0
  149. package/dist/interfaces/ui/terminal/cli/index.d.ts +12 -0
  150. package/dist/interfaces/ui/terminal/cli/index.d.ts.map +1 -0
  151. package/dist/interfaces/ui/terminal/cli/index.js +167 -0
  152. package/dist/interfaces/ui/terminal/shared/args.d.ts +39 -0
  153. package/dist/interfaces/ui/terminal/shared/args.d.ts.map +1 -0
  154. package/dist/interfaces/ui/terminal/shared/args.js +176 -0
  155. package/dist/interfaces/ui/terminal/shared/index.d.ts +11 -0
  156. package/dist/interfaces/ui/terminal/shared/index.d.ts.map +1 -0
  157. package/dist/interfaces/ui/terminal/shared/index.js +16 -0
  158. package/dist/interfaces/ui/terminal/shared/loading-state.d.ts +124 -0
  159. package/dist/interfaces/ui/terminal/shared/loading-state.d.ts.map +1 -0
  160. package/dist/interfaces/ui/terminal/shared/loading-state.js +246 -0
  161. package/dist/interfaces/ui/terminal/shared/query.d.ts +22 -0
  162. package/dist/interfaces/ui/terminal/shared/query.d.ts.map +1 -0
  163. package/dist/interfaces/ui/terminal/shared/query.js +100 -0
  164. package/dist/interfaces/ui/terminal/shared/setup.d.ts +33 -0
  165. package/dist/interfaces/ui/terminal/shared/setup.d.ts.map +1 -0
  166. package/dist/interfaces/ui/terminal/shared/setup.js +226 -0
  167. package/dist/interfaces/ui/terminal/shared/status-line.d.ts +117 -0
  168. package/dist/interfaces/ui/terminal/shared/status-line.d.ts.map +1 -0
  169. package/dist/interfaces/ui/terminal/shared/status-line.js +267 -0
  170. package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts +38 -0
  171. package/dist/interfaces/ui/terminal/shared/system-prompt.d.ts.map +1 -0
  172. package/dist/interfaces/ui/terminal/shared/system-prompt.js +102 -0
  173. package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts +39 -0
  174. package/dist/interfaces/ui/terminal/tui/HelpPanel.d.ts.map +1 -0
  175. package/dist/interfaces/ui/terminal/tui/HelpPanel.js +215 -0
  176. package/dist/interfaces/ui/terminal/tui/InputContext.d.ts +91 -0
  177. package/dist/interfaces/ui/terminal/tui/InputContext.d.ts.map +1 -0
  178. package/dist/interfaces/ui/terminal/tui/InputContext.js +154 -0
  179. package/dist/interfaces/ui/terminal/tui/InputField.d.ts +18 -0
  180. package/dist/interfaces/ui/terminal/tui/InputField.d.ts.map +1 -0
  181. package/dist/interfaces/ui/terminal/tui/InputField.js +41 -0
  182. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts +16 -0
  183. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.d.ts.map +1 -0
  184. package/dist/interfaces/ui/terminal/tui/InteractiveTUI.js +451 -0
  185. package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts +10 -0
  186. package/dist/interfaces/ui/terminal/tui/MessageArea.d.ts.map +1 -0
  187. package/dist/interfaces/ui/terminal/tui/MessageArea.js +91 -0
  188. package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts +48 -0
  189. package/dist/interfaces/ui/terminal/tui/MessageStore.d.ts.map +1 -0
  190. package/dist/interfaces/ui/terminal/tui/MessageStore.js +151 -0
  191. package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts +9 -0
  192. package/dist/interfaces/ui/terminal/tui/StatusBar.d.ts.map +1 -0
  193. package/dist/interfaces/ui/terminal/tui/StatusBar.js +36 -0
  194. package/dist/interfaces/ui/terminal/tui/commands.d.ts +21 -0
  195. package/dist/interfaces/ui/terminal/tui/commands.d.ts.map +1 -0
  196. package/dist/interfaces/ui/terminal/tui/commands.js +359 -0
  197. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts +115 -0
  198. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.d.ts.map +1 -0
  199. package/dist/interfaces/ui/terminal/tui/components/InteractiveElements.js +306 -0
  200. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts +92 -0
  201. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.d.ts.map +1 -0
  202. package/dist/interfaces/ui/terminal/tui/components/MultilineInput.js +399 -0
  203. package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts +59 -0
  204. package/dist/interfaces/ui/terminal/tui/components/PaneManager.d.ts.map +1 -0
  205. package/dist/interfaces/ui/terminal/tui/components/PaneManager.js +139 -0
  206. package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts +68 -0
  207. package/dist/interfaces/ui/terminal/tui/components/Sidebar.d.ts.map +1 -0
  208. package/dist/interfaces/ui/terminal/tui/components/Sidebar.js +340 -0
  209. package/dist/interfaces/ui/terminal/tui/components/index.d.ts +23 -0
  210. package/dist/interfaces/ui/terminal/tui/components/index.d.ts.map +1 -0
  211. package/dist/interfaces/ui/terminal/tui/components/index.js +51 -0
  212. package/dist/interfaces/ui/terminal/tui/console.d.ts +20 -0
  213. package/dist/interfaces/ui/terminal/tui/console.d.ts.map +1 -0
  214. package/dist/interfaces/ui/terminal/tui/console.js +46 -0
  215. package/dist/interfaces/ui/terminal/tui/index.d.ts +20 -0
  216. package/dist/interfaces/ui/terminal/tui/index.d.ts.map +1 -0
  217. package/dist/interfaces/ui/terminal/tui/index.js +28 -0
  218. package/dist/interfaces/ui/terminal/tui/run.d.ts +13 -0
  219. package/dist/interfaces/ui/terminal/tui/run.d.ts.map +1 -0
  220. package/dist/interfaces/ui/terminal/tui/run.js +31 -0
  221. package/dist/interfaces/ui/terminal/tui/spinner.d.ts +44 -0
  222. package/dist/interfaces/ui/terminal/tui/spinner.d.ts.map +1 -0
  223. package/dist/interfaces/ui/terminal/tui/spinner.js +59 -0
  224. package/dist/interfaces/ui/terminal/tui/tui-app.d.ts +39 -0
  225. package/dist/interfaces/ui/terminal/tui/tui-app.d.ts.map +1 -0
  226. package/dist/interfaces/ui/terminal/tui/tui-app.js +198 -0
  227. package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts +167 -0
  228. package/dist/interfaces/ui/terminal/tui/tui-footer.d.ts.map +1 -0
  229. package/dist/interfaces/ui/terminal/tui/tui-footer.js +330 -0
  230. package/dist/interfaces/ui/terminal/tui/types.d.ts +165 -0
  231. package/dist/interfaces/ui/terminal/tui/types.d.ts.map +1 -0
  232. package/dist/interfaces/ui/terminal/tui/types.js +5 -0
  233. package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts +23 -0
  234. package/dist/interfaces/ui/terminal/tui/useInputHandler.d.ts.map +1 -0
  235. package/dist/interfaces/ui/terminal/tui/useInputHandler.js +72 -0
  236. package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts +90 -0
  237. package/dist/interfaces/ui/terminal/tui/useNativeInput.d.ts.map +1 -0
  238. package/dist/interfaces/ui/terminal/tui/useNativeInput.js +188 -0
  239. package/dist/native/index.d.ts +480 -0
  240. package/dist/native/index.d.ts.map +1 -0
  241. package/dist/native/index.js +1625 -0
  242. package/dist/teammates/index.d.ts +161 -0
  243. package/dist/teammates/index.d.ts.map +1 -0
  244. package/dist/teammates/index.js +827 -0
  245. package/dist/types/index.d.ts +482 -0
  246. package/dist/types/index.d.ts.map +1 -0
  247. package/dist/types/index.js +52 -0
  248. package/native/README.md +5 -5
  249. package/native/index.darwin-arm64.node +0 -0
  250. package/native/index.node +0 -0
  251. package/native/package.json +4 -4
  252. package/package.json +33 -16
  253. package/packages/src/core/__tests__/permissions.test.ts +1091 -0
  254. package/packages/src/core/agent-loop/__tests__/compaction.test.ts +280 -0
  255. package/packages/src/core/agent-loop/__tests__/formatters.test.ts +234 -0
  256. package/packages/src/core/agent-loop/__tests__/index.test.ts +162 -0
  257. package/packages/src/core/agent-loop/__tests__/loop-state.test.ts +413 -0
  258. package/packages/src/core/agent-loop/__tests__/message-builder.test.ts +229 -0
  259. package/packages/src/core/agent-loop/__tests__/tool-executor.test.ts +457 -0
  260. package/packages/src/core/agent-loop/compaction.ts +88 -0
  261. package/packages/src/core/agent-loop/formatters.ts +50 -0
  262. package/packages/src/core/agent-loop/index.ts +135 -0
  263. package/packages/src/core/agent-loop/loop-state.ts +187 -0
  264. package/packages/src/core/agent-loop/message-builder.ts +62 -0
  265. package/packages/src/core/agent-loop/tool-executor.ts +211 -0
  266. package/packages/src/core/agent-loop/turn-executor.ts +222 -0
  267. package/packages/src/core/agent-loop/types.ts +148 -0
  268. package/packages/src/core/agent-loop.ts +18 -0
  269. package/packages/src/core/api-client-impl.ts +619 -0
  270. package/packages/src/core/api-client.ts +6 -0
  271. package/packages/src/core/checkpoints.ts +606 -0
  272. package/packages/src/core/claude-md.ts +272 -0
  273. package/packages/src/core/cognitive-security/hooks.ts +590 -0
  274. package/packages/src/core/cognitive-security/index.ts +2041 -0
  275. package/packages/src/core/cognitive-security/middleware.ts +536 -0
  276. package/packages/src/core/config-loader.ts +324 -0
  277. package/packages/src/core/context-compaction.ts +578 -0
  278. package/packages/src/core/git-status.ts +262 -0
  279. package/packages/src/core/image.test.ts +180 -0
  280. package/packages/src/core/image.ts +350 -0
  281. package/packages/src/core/lmdb.db +0 -0
  282. package/packages/src/core/lmdb.db-lock +0 -0
  283. package/packages/src/core/models.ts +430 -0
  284. package/packages/src/core/normalizers/todo +4 -0
  285. package/packages/src/core/permissions.ts +431 -0
  286. package/packages/src/core/retry.ts +170 -0
  287. package/packages/src/core/session-store.ts +36 -0
  288. package/packages/src/core/sessions/export.ts +329 -0
  289. package/packages/src/core/sessions/index.ts +587 -0
  290. package/packages/src/core/sessions/metadata.ts +309 -0
  291. package/packages/src/core/sessions/persistence.ts +244 -0
  292. package/packages/src/core/sessions/types.ts +169 -0
  293. package/packages/src/core/stream-highlighter.ts +1123 -0
  294. package/packages/src/core/system-reminders.ts +402 -0
  295. package/packages/src/core/todo +8 -0
  296. package/packages/src/ecosystem/hooks/__tests__/index.test.ts +561 -0
  297. package/packages/src/ecosystem/hooks/index.ts +341 -0
  298. package/packages/src/ecosystem/hooks/prompt-evaluator.ts +300 -0
  299. package/packages/src/ecosystem/skills/index.ts +295 -0
  300. package/packages/src/ecosystem/tools/__tests__/index.test.ts +1335 -0
  301. package/packages/src/ecosystem/tools/index.ts +1877 -0
  302. package/packages/src/index.ts +120 -0
  303. package/packages/src/interfaces/mcp/client.ts +389 -0
  304. package/packages/src/interfaces/ui/Screenshot 2026-03-02 at 9.23.10/342/200/257PM.png +0 -0
  305. package/packages/src/interfaces/ui/Screenshot 2026-03-03 at 10.55.11/342/200/257AM.png +0 -0
  306. package/packages/src/interfaces/ui/index.ts +161 -0
  307. package/packages/src/interfaces/ui/lmdb.db +0 -0
  308. package/packages/src/interfaces/ui/lmdb.db-lock +0 -0
  309. package/packages/src/interfaces/ui/spinner.ts +451 -0
  310. package/packages/src/interfaces/ui/terminal/cli/index.ts +228 -0
  311. package/packages/src/interfaces/ui/terminal/lmdb.db +0 -0
  312. package/packages/src/interfaces/ui/terminal/lmdb.db-lock +0 -0
  313. package/packages/src/interfaces/ui/terminal/shared/args.ts +222 -0
  314. package/packages/src/interfaces/ui/terminal/shared/index.ts +71 -0
  315. package/packages/src/interfaces/ui/terminal/shared/loading-state.ts +322 -0
  316. package/packages/src/interfaces/ui/terminal/shared/query.ts +146 -0
  317. package/packages/src/interfaces/ui/terminal/shared/setup.ts +295 -0
  318. package/packages/src/interfaces/ui/terminal/shared/status-line.ts +358 -0
  319. package/packages/src/interfaces/ui/terminal/shared/system-prompt.ts +146 -0
  320. package/packages/src/interfaces/ui/terminal/tui/HelpPanel.tsx +262 -0
  321. package/packages/src/interfaces/ui/terminal/tui/InputContext.tsx +232 -0
  322. package/packages/src/interfaces/ui/terminal/tui/InputField.tsx +62 -0
  323. package/packages/src/interfaces/ui/terminal/tui/InteractiveTUI.tsx +537 -0
  324. package/packages/src/interfaces/ui/terminal/tui/MessageArea.tsx +107 -0
  325. package/packages/src/interfaces/ui/terminal/tui/MessageStore.tsx +240 -0
  326. package/packages/src/interfaces/ui/terminal/tui/StatusBar.tsx +54 -0
  327. package/packages/src/interfaces/ui/terminal/tui/commands.ts +438 -0
  328. package/packages/src/interfaces/ui/terminal/tui/components/InteractiveElements.tsx +584 -0
  329. package/packages/src/interfaces/ui/terminal/tui/components/MultilineInput.tsx +614 -0
  330. package/packages/src/interfaces/ui/terminal/tui/components/PaneManager.tsx +333 -0
  331. package/packages/src/interfaces/ui/terminal/tui/components/Sidebar.tsx +604 -0
  332. package/packages/src/interfaces/ui/terminal/tui/components/index.ts +118 -0
  333. package/packages/src/interfaces/ui/terminal/tui/console.ts +49 -0
  334. package/packages/src/interfaces/ui/terminal/tui/index.ts +90 -0
  335. package/packages/src/interfaces/ui/terminal/tui/run.tsx +42 -0
  336. package/packages/src/interfaces/ui/terminal/tui/spinner.ts +69 -0
  337. package/packages/src/interfaces/ui/terminal/tui/tui-app.tsx +390 -0
  338. package/packages/src/interfaces/ui/terminal/tui/tui-footer.ts +422 -0
  339. package/packages/src/interfaces/ui/terminal/tui/types.ts +186 -0
  340. package/packages/src/interfaces/ui/terminal/tui/useInputHandler.ts +104 -0
  341. package/packages/src/interfaces/ui/terminal/tui/useNativeInput.ts +239 -0
  342. package/packages/src/lmdb.db +0 -0
  343. package/packages/src/lmdb.db-lock +0 -0
  344. package/packages/src/native/index.ts +2345 -0
  345. package/packages/src/teammates/index.ts +982 -0
  346. package/packages/src/types/index.ts +722 -0
  347. package/dist/cli.js +0 -148
  348. package/dist/index-0pkak453.js +0 -136
  349. package/dist/index-0qd0x8b4.js +0 -110
  350. package/dist/index-0x3kprq6.js +0 -240
  351. package/dist/index-1eawy937.js +0 -308
  352. package/dist/index-24m2aygy.js +0 -240
  353. package/dist/index-29xcjnne.js +0 -280
  354. package/dist/index-2avyytn5.js +0 -349
  355. package/dist/index-4ms367ey.js +0 -136
  356. package/dist/index-4w2t3b0m.js +0 -240
  357. package/dist/index-4xfgd8nz.js +0 -261
  358. package/dist/index-5acjp9gc.js +0 -157
  359. package/dist/index-5s15hr56.js +0 -136
  360. package/dist/index-6e4wf341.js +0 -349
  361. package/dist/index-6fvnkedw.js +0 -240
  362. package/dist/index-6rqpmd4g.js +0 -128
  363. package/dist/index-77ckwnbm.js +0 -280
  364. package/dist/index-9knxy49k.js +0 -128
  365. package/dist/index-9zrnw4zx.js +0 -128
  366. package/dist/index-bk21w99v.js +0 -280
  367. package/dist/index-c41n76fv.js +0 -240
  368. package/dist/index-cb4ppjdt.js +0 -255
  369. package/dist/index-cfb2edt6.js +0 -240
  370. package/dist/index-cmfa38hh.js +0 -308
  371. package/dist/index-datjz8q1.js +0 -257
  372. package/dist/index-eadf4wvn.js +0 -240
  373. package/dist/index-em5k0m3z.js +0 -345
  374. package/dist/index-gh8r333a.js +0 -110
  375. package/dist/index-gkx6k2tr.js +0 -261
  376. package/dist/index-h5cabfks.js +0 -155
  377. package/dist/index-hcrpwyy3.js +0 -261
  378. package/dist/index-hk7fwwa8.js +0 -257
  379. package/dist/index-jb8cw7f8.js +0 -136
  380. package/dist/index-kbyw4th1.js +0 -347
  381. package/dist/index-kgj5gqnm.js +0 -345
  382. package/dist/index-mdf6xp1z.js +0 -255
  383. package/dist/index-mrhv8kvc.js +0 -280
  384. package/dist/index-mt4743dd.js +0 -161
  385. package/dist/index-qnwsg97q.js +0 -240
  386. package/dist/index-qwdy6x44.js +0 -261
  387. package/dist/index-rmj77261.js +0 -157
  388. package/dist/index-sbbw1a61.js +0 -349
  389. package/dist/index-svy5bcpn.js +0 -345
  390. package/dist/index-tvmy7tm9.js +0 -261
  391. package/dist/index-tzz4vzkj.js +0 -312
  392. package/dist/index-vz80zmhe.js +0 -110
  393. package/dist/index-wed2fk67.js +0 -240
  394. package/dist/index-wksgzz8e.js +0 -280
  395. package/dist/index-wn2m4wma.js +0 -240
  396. package/dist/index-xha05vjc.js +0 -257
  397. package/dist/index-yc6eh8p8.js +0 -136
  398. package/dist/index-ycjxx9ft.js +0 -240
  399. package/dist/index-z0gzd0fc.js +0 -110
  400. package/dist/index-z8cwtf8j.js +0 -240
  401. package/dist/index-zy5mtt00.js +0 -128
@@ -0,0 +1,402 @@
1
+ /**
2
+ * System Reminders - Context injection for agent loop
3
+ * Provides token warnings, cost tracking, tool summaries, and environment info
4
+ */
5
+
6
+ import type { ToolUseBlock, GitStatus, UsageMetrics } from "../types/index.js";
7
+
8
+ // ============================================
9
+ // TYPES
10
+ // ============================================
11
+
12
+ export interface TokenWarningOptions {
13
+ current: number;
14
+ max: number;
15
+ threshold?: number; // Percentage threshold for warning (default: 80%)
16
+ }
17
+
18
+ export interface CostUpdateOptions {
19
+ cost: number;
20
+ previousCost?: number;
21
+ currency?: string;
22
+ }
23
+
24
+ export interface ToolSummaryOptions {
25
+ tools: ToolUseBlock[];
26
+ maxDisplay?: number;
27
+ }
28
+
29
+ export interface EnvInfoOptions {
30
+ workingDirectory: string;
31
+ gitStatus?: GitStatus | null;
32
+ platform?: NodeJS.Platform;
33
+ shell?: string;
34
+ }
35
+
36
+ export interface SystemReminderConfig {
37
+ tokenWarningThreshold: number;
38
+ costUpdateInterval: number;
39
+ toolSummaryInterval: number;
40
+ envInfoOnStart: boolean;
41
+ }
42
+
43
+ // ============================================
44
+ // CONSTANTS
45
+ // ============================================
46
+
47
+ export const DEFAULT_REMINDER_CONFIG: SystemReminderConfig = {
48
+ tokenWarningThreshold: 0.8, // 80% of max tokens
49
+ costUpdateInterval: 5, // Every 5 turns
50
+ toolSummaryInterval: 3, // Every 3 turns
51
+ envInfoOnStart: true,
52
+ };
53
+
54
+ // Token limit thresholds
55
+ const TOKEN_THRESHOLDS = {
56
+ WARNING: 0.8, // 80% - warning
57
+ CRITICAL: 0.9, // 90% - critical
58
+ EMERGENCY: 0.95, // 95% - emergency
59
+ } as const;
60
+
61
+ // ============================================
62
+ // TOKEN WARNING BUILDER
63
+ // ============================================
64
+
65
+ /**
66
+ * Build a token usage warning message
67
+ * @param current - Current token count
68
+ * @param max - Maximum token limit
69
+ * @param threshold - Optional custom threshold percentage
70
+ * @returns Formatted warning string or empty string if under threshold
71
+ */
72
+ export function buildTokenWarning(options: TokenWarningOptions): string {
73
+ const { current, max, threshold = TOKEN_THRESHOLDS.WARNING } = options;
74
+
75
+ if (max <= 0) {
76
+ return "";
77
+ }
78
+
79
+ const percentage = current / max;
80
+
81
+ // Only warn if above threshold
82
+ if (percentage < threshold) {
83
+ return "";
84
+ }
85
+
86
+ const remaining = max - current;
87
+ const percentUsed = Math.round(percentage * 100);
88
+
89
+ let severity: "warning" | "critical" | "emergency";
90
+ let emoji: string;
91
+
92
+ if (percentage >= TOKEN_THRESHOLDS.EMERGENCY) {
93
+ severity = "emergency";
94
+ emoji = "🚨";
95
+ } else if (percentage >= TOKEN_THRESHOLDS.CRITICAL) {
96
+ severity = "critical";
97
+ emoji = "⚠️";
98
+ } else {
99
+ severity = "warning";
100
+ emoji = "⚡";
101
+ }
102
+
103
+ const lines: string[] = [
104
+ `${emoji} Token Usage ${severity.toUpperCase()}`,
105
+ "",
106
+ `Current: ${current.toLocaleString()} / ${max.toLocaleString()} tokens (${percentUsed}%)`,
107
+ `Remaining: ${remaining.toLocaleString()} tokens`,
108
+ ];
109
+
110
+ if (severity === "emergency") {
111
+ lines.push("");
112
+ lines.push("Consider summarizing or compacting the conversation to continue.");
113
+ } else if (severity === "critical") {
114
+ lines.push("");
115
+ lines.push("Approaching token limit. Consider wrapping up soon.");
116
+ }
117
+
118
+ return lines.join("\n");
119
+ }
120
+
121
+ // ============================================
122
+ // COST UPDATE BUILDER
123
+ // ============================================
124
+
125
+ /**
126
+ * Build a cost tracking update message
127
+ * @param cost - Current total cost in USD
128
+ * @param previousCost - Previous cost for delta calculation
129
+ * @param currency - Currency symbol (default: USD)
130
+ * @returns Formatted cost update string
131
+ */
132
+ export function buildCostUpdate(options: CostUpdateOptions): string {
133
+ const { cost, previousCost = 0, currency = "USD" } = options;
134
+
135
+ const currencySymbol = getCurrencySymbol(currency);
136
+ const formattedCost = formatCurrency(cost, currencySymbol);
137
+ const delta = cost - previousCost;
138
+ const formattedDelta = formatCurrency(Math.abs(delta), currencySymbol);
139
+
140
+ const lines: string[] = [
141
+ `💰 Cost Update`,
142
+ "",
143
+ `Total: ${formattedCost} ${currency}`,
144
+ ];
145
+
146
+ if (delta !== 0) {
147
+ const direction = delta > 0 ? "+" : "-";
148
+ lines.push(`This turn: ${direction}${formattedDelta} ${currency}`);
149
+ }
150
+
151
+ return lines.join("\n");
152
+ }
153
+
154
+ /**
155
+ * Format currency value with appropriate precision
156
+ */
157
+ function formatCurrency(value: number, symbol: string): string {
158
+ if (value < 0.01) {
159
+ return `${symbol}${value.toFixed(4)}`;
160
+ } else if (value < 1) {
161
+ return `${symbol}${value.toFixed(3)}`;
162
+ }
163
+ return `${symbol}${value.toFixed(2)}`;
164
+ }
165
+
166
+ /**
167
+ * Get currency symbol from currency code
168
+ */
169
+ function getCurrencySymbol(currency: string): string {
170
+ const symbols: Record<string, string> = {
171
+ USD: "$",
172
+ EUR: "€",
173
+ GBP: "£",
174
+ JPY: "¥",
175
+ };
176
+ return symbols[currency] || currency;
177
+ }
178
+
179
+ // ============================================
180
+ // TOOL SUMMARY BUILDER
181
+ // ============================================
182
+
183
+ /**
184
+ * Build a summary of tool usage
185
+ * @param tools - Array of tool use blocks
186
+ * @param maxDisplay - Maximum number of tools to display (default: 10)
187
+ * @returns Formatted tool summary string
188
+ */
189
+ export function buildToolSummary(options: ToolSummaryOptions): string {
190
+ const { tools, maxDisplay = 10 } = options;
191
+
192
+ if (tools.length === 0) {
193
+ return "No tools used this session.";
194
+ }
195
+
196
+ // Count tool usage
197
+ const toolCounts = new Map<string, number>();
198
+ for (const tool of tools) {
199
+ const count = toolCounts.get(tool.name) || 0;
200
+ toolCounts.set(tool.name, count + 1);
201
+ }
202
+
203
+ // Sort by usage count
204
+ const sortedTools = [...toolCounts.entries()].sort((a, b) => b[1] - a[1]);
205
+
206
+ const lines: string[] = [
207
+ `🔧 Tool Usage Summary (${tools.length} total calls)`,
208
+ "",
209
+ ];
210
+
211
+ const displayTools = sortedTools.slice(0, maxDisplay);
212
+ for (const [name, count] of displayTools) {
213
+ lines.push(` • ${name}: ${count} call${count === 1 ? "" : "s"}`);
214
+ }
215
+
216
+ if (sortedTools.length > maxDisplay) {
217
+ const remaining = sortedTools.length - maxDisplay;
218
+ lines.push(` ... and ${remaining} more tool${remaining === 1 ? "" : "s"}`);
219
+ }
220
+
221
+ return lines.join("\n");
222
+ }
223
+
224
+ // ============================================
225
+ // ENVIRONMENT INFO BUILDER
226
+ // ============================================
227
+
228
+ /**
229
+ * Build environment information message
230
+ * @param workingDirectory - Current working directory
231
+ * @param gitStatus - Optional git status information
232
+ * @param platform - Optional platform info
233
+ * @param shell - Optional shell info
234
+ * @returns Formatted environment info string
235
+ */
236
+ export function buildEnvInfo(options: EnvInfoOptions): string {
237
+ const {
238
+ workingDirectory,
239
+ gitStatus,
240
+ platform = process.platform,
241
+ shell = process.env.SHELL || "unknown",
242
+ } = options;
243
+
244
+ const lines: string[] = [
245
+ "📍 Environment Information",
246
+ "",
247
+ `Working Directory: ${workingDirectory}`,
248
+ `Platform: ${platform}`,
249
+ `Shell: ${shell}`,
250
+ ];
251
+
252
+ if (gitStatus) {
253
+ lines.push("");
254
+ lines.push("Git Status:");
255
+ lines.push(` Branch: ${gitStatus.branch}`);
256
+
257
+ if (gitStatus.ahead > 0 || gitStatus.behind > 0) {
258
+ lines.push(` Ahead: ${gitStatus.ahead}, Behind: ${gitStatus.behind}`);
259
+ }
260
+
261
+ const totalChanges =
262
+ gitStatus.staged.length +
263
+ gitStatus.unstaged.length +
264
+ gitStatus.untracked.length +
265
+ gitStatus.conflicted.length;
266
+
267
+ if (totalChanges > 0) {
268
+ lines.push(` Changes: ${totalChanges} file${totalChanges === 1 ? "" : "s"}`);
269
+
270
+ if (gitStatus.staged.length > 0) {
271
+ lines.push(` Staged: ${gitStatus.staged.length}`);
272
+ }
273
+ if (gitStatus.unstaged.length > 0) {
274
+ lines.push(` Unstaged: ${gitStatus.unstaged.length}`);
275
+ }
276
+ if (gitStatus.untracked.length > 0) {
277
+ lines.push(` Untracked: ${gitStatus.untracked.length}`);
278
+ }
279
+ if (gitStatus.conflicted.length > 0) {
280
+ lines.push(` Conflicted: ${gitStatus.conflicted.length}`);
281
+ }
282
+ } else {
283
+ lines.push(" Working tree clean");
284
+ }
285
+ }
286
+
287
+ return lines.join("\n");
288
+ }
289
+
290
+ // ============================================
291
+ // COMBINED REMINDER BUILDER
292
+ // ============================================
293
+
294
+ export interface CombinedReminderOptions {
295
+ usage: UsageMetrics;
296
+ maxTokens: number;
297
+ totalCost: number;
298
+ previousCost?: number;
299
+ toolsUsed: ToolUseBlock[];
300
+ workingDirectory: string;
301
+ gitStatus?: GitStatus | null;
302
+ turnNumber: number;
303
+ config?: Partial<SystemReminderConfig>;
304
+ }
305
+
306
+ /**
307
+ * Build a combined system reminder based on current state
308
+ * Intelligently includes relevant reminders based on thresholds and intervals
309
+ */
310
+ export function buildCombinedReminder(options: CombinedReminderOptions): string {
311
+ const {
312
+ usage,
313
+ maxTokens,
314
+ totalCost,
315
+ previousCost,
316
+ toolsUsed,
317
+ workingDirectory,
318
+ gitStatus,
319
+ turnNumber,
320
+ config: userConfig,
321
+ } = options;
322
+
323
+ const config = { ...DEFAULT_REMINDER_CONFIG, ...userConfig };
324
+ const reminders: string[] = [];
325
+
326
+ // Token warning (always check)
327
+ const currentTokens = usage.input_tokens + usage.output_tokens;
328
+ const tokenWarning = buildTokenWarning({
329
+ current: currentTokens,
330
+ max: maxTokens,
331
+ threshold: config.tokenWarningThreshold,
332
+ });
333
+ if (tokenWarning) {
334
+ reminders.push(tokenWarning);
335
+ }
336
+
337
+ // Cost update (on interval)
338
+ if (turnNumber % config.costUpdateInterval === 0) {
339
+ const costUpdate = buildCostUpdate({
340
+ cost: totalCost,
341
+ previousCost,
342
+ });
343
+ reminders.push(costUpdate);
344
+ }
345
+
346
+ // Tool summary (on interval)
347
+ if (turnNumber % config.toolSummaryInterval === 0 && toolsUsed.length > 0) {
348
+ const toolSummary = buildToolSummary({ tools: toolsUsed });
349
+ reminders.push(toolSummary);
350
+ }
351
+
352
+ // Environment info (first turn only)
353
+ if (turnNumber === 1 && config.envInfoOnStart) {
354
+ const envInfo = buildEnvInfo({
355
+ workingDirectory,
356
+ gitStatus,
357
+ });
358
+ reminders.push(envInfo);
359
+ }
360
+
361
+ if (reminders.length === 0) {
362
+ return "";
363
+ }
364
+
365
+ return ["---", "System Reminders:", "", ...reminders, "---"].join("\n");
366
+ }
367
+
368
+ // ============================================
369
+ // REMINDER INJECTOR
370
+ // ============================================
371
+
372
+ /**
373
+ * Inject system reminders into the conversation
374
+ * This should be called before sending messages to the API
375
+ */
376
+ export function injectSystemReminder(
377
+ messages: Array<{ role: string; content: unknown }>,
378
+ reminder: string
379
+ ): void {
380
+ if (!reminder || messages.length === 0) {
381
+ return;
382
+ }
383
+
384
+ // Find the last user message and append the reminder
385
+ for (let i = messages.length - 1; i >= 0; i--) {
386
+ const message = messages[i];
387
+ if (message && message.role === "user") {
388
+ // Append reminder to content
389
+ if (typeof message.content === "string") {
390
+ message.content = `${message.content}\n\n${reminder}`;
391
+ } else if (Array.isArray(message.content)) {
392
+ // Handle array content (tool results, etc.)
393
+ // Add as a new text block at the end
394
+ message.content.push({
395
+ type: "text",
396
+ text: `\n\n${reminder}`,
397
+ });
398
+ }
399
+ break;
400
+ }
401
+ }
402
+ }
@@ -0,0 +1,8 @@
1
+ mv:
2
+ - /Users/ebowwa/Desktop/codespaces/claude-code-remake/packages/src/core/config-loader.ts
3
+ - /Users/ebowwa/Desktop/codespaces/claude-code-remake/packages/src/core/claude-md.ts
4
+ - /Users/ebowwa/Desktop/codespaces/claude-code-remake/packages/src/core/permissions.ts
5
+ - /Users/ebowwa/Desktop/codespaces/claude-code-remake/packages/src/core/models.ts
6
+
7
+
8
+ to `/Users/ebowwa/Desktop/codespaces/claude-code-remake/packages/src/ecosystem`