savant-code 0.0.19 → 0.0.20

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 (1591) hide show
  1. package/README.md +381 -550
  2. package/{cli/release/index.js → index.js} +0 -0
  3. package/package.json +44 -71
  4. package/.agents/skills/coding-csharp/SKILL.md +0 -82
  5. package/.agents/skills/coding-go/SKILL.md +0 -76
  6. package/.agents/skills/coding-java/SKILL.md +0 -79
  7. package/.agents/skills/coding-python/SKILL.md +0 -87
  8. package/.agents/skills/coding-rust/SKILL.md +0 -83
  9. package/.agents/skills/coding-typescript/SKILL.md +0 -90
  10. package/.agents/skills/release-workflow/SKILL.md +0 -69
  11. package/.bun-version +0 -1
  12. package/.commandcode/settings.json +0 -11
  13. package/.commandcode/taste/workflow/taste.md +0 -6
  14. package/.env.example +0 -95
  15. package/.gitattributes +0 -43
  16. package/.githooks/pre-push +0 -35
  17. package/.github/workflows/build-release-binaries.yml +0 -163
  18. package/.markdownlint.json +0 -42
  19. package/.markdownlintignore +0 -21
  20. package/.prettierignore +0 -9
  21. package/.prettierrc +0 -23
  22. package/.savantignore +0 -3
  23. package/AGENTS.md +0 -97
  24. package/ARCHITECTURE.md +0 -241
  25. package/CHANGELOG.md +0 -2631
  26. package/CONTRIBUTING.md +0 -88
  27. package/ECHO-freebuff.md +0 -22
  28. package/ECHO.md +0 -722
  29. package/FREEREADME.md +0 -35
  30. package/LEARNINGS.md +0 -345
  31. package/NOTICE +0 -15
  32. package/README.zh-CN.md +0 -479
  33. package/SECURITY.md +0 -8
  34. package/VERSION +0 -1
  35. package/WINDOWS.md +0 -238
  36. package/agents/README.md +0 -41
  37. package/agents/base-chat.ts +0 -44
  38. package/agents/basher.ts +0 -107
  39. package/agents/browser-use/browser-use.test.ts +0 -211
  40. package/agents/browser-use/browser-use.ts +0 -259
  41. package/agents/constants.ts +0 -1
  42. package/agents/context-pruner.ts +0 -1076
  43. package/agents/detective/detective.ts +0 -168
  44. package/agents/editor/best-of-n/best-of-n-selector2.ts +0 -148
  45. package/agents/editor/best-of-n/editor-implementor-gpt-5.ts +0 -7
  46. package/agents/editor/best-of-n/editor-implementor-opus.ts +0 -7
  47. package/agents/editor/best-of-n/editor-implementor.ts +0 -196
  48. package/agents/editor/best-of-n/editor-multi-prompt.ts +0 -265
  49. package/agents/file-explorer/directory-lister.ts +0 -92
  50. package/agents/file-explorer/glob-matcher.ts +0 -96
  51. package/agents/forge/forge.ts +0 -146
  52. package/agents/librarian/librarian.test.ts +0 -289
  53. package/agents/librarian/librarian.ts +0 -158
  54. package/agents/package.json +0 -11
  55. package/agents/recorder/recorder.ts +0 -104
  56. package/agents/researcher/researcher-docs.ts +0 -32
  57. package/agents/researcher/researcher-web.ts +0 -40
  58. package/agents/savant/savant-analyze.ts +0 -11
  59. package/agents/savant/savant-free-deepseek-flash.ts +0 -13
  60. package/agents/savant/savant-free-deepseek.ts +0 -13
  61. package/agents/savant/savant-free-evals.ts +0 -9
  62. package/agents/savant/savant-free-glm.ts +0 -13
  63. package/agents/savant/savant-free-kimi.ts +0 -13
  64. package/agents/savant/savant-free-mimo-pro.ts +0 -13
  65. package/agents/savant/savant-free-mimo.ts +0 -13
  66. package/agents/savant/savant-free-minimax-m3.ts +0 -13
  67. package/agents/savant/savant-free.ts +0 -9
  68. package/agents/savant/savant-scaffold.ts +0 -15
  69. package/agents/savant/savant.ts +0 -706
  70. package/agents/scout/scout.ts +0 -305
  71. package/agents/scribe/scribe.ts +0 -54
  72. package/agents/thinker/thinker-gemini.ts +0 -26
  73. package/agents/thinker/thinker-gpt.ts +0 -21
  74. package/agents/thinker/thinker-with-files-gemini.ts +0 -66
  75. package/agents/thinker/thinker.ts +0 -99
  76. package/agents/tmux-cli.ts +0 -724
  77. package/agents/tsconfig.json +0 -12
  78. package/agents/types/agent-definition.ts +0 -1
  79. package/agents/types/secret-agent-definition.ts +0 -103
  80. package/agents/types/tools.ts +0 -465
  81. package/agents/types/util-types.ts +0 -167
  82. package/agents/verifier/verifier.ts +0 -80
  83. package/art/savant-redesign.md +0 -7
  84. package/art/savant-text-graf.md +0 -5
  85. package/art/savant_ascii.md +0 -88
  86. package/assets/banner.png +0 -0
  87. package/bun.lock +0 -1979
  88. package/bunfig.toml +0 -7
  89. package/cli/README.md +0 -111
  90. package/cli/bunfig.toml +0 -2
  91. package/cli/cli_exit +0 -1
  92. package/cli/package.json +0 -66
  93. package/cli/release/README.md +0 -348
  94. package/cli/release/package.json +0 -56
  95. package/cli/release-core/README.md +0 -20
  96. package/cli/release-core/package.json +0 -4
  97. package/cli/release-core/prepare-package.js +0 -31
  98. package/cli/release-staging/README.md +0 -70
  99. package/cli/release-staging/index.js +0 -42
  100. package/cli/release-staging/package.json +0 -43
  101. package/cli/scripts/build-binary.ts +0 -469
  102. package/cli/scripts/clean.ts +0 -16
  103. package/cli/scripts/prebuild-agents.ts +0 -250
  104. package/cli/scripts/release.ts +0 -103
  105. package/cli/scripts/smoke-binary.ts +0 -280
  106. package/cli/scripts/test-sdk-file-hooks.sh +0 -87
  107. package/cli/scripts/validate-cli-with-tmux.sh +0 -43
  108. package/cli/src/__tests__/README.md +0 -256
  109. package/cli/src/__tests__/bash-mode.test.ts +0 -442
  110. package/cli/src/__tests__/cli-args.test.ts +0 -241
  111. package/cli/src/__tests__/e2e/first-time-login.test.ts +0 -173
  112. package/cli/src/__tests__/e2e/logout-relogin-flow.test.ts +0 -110
  113. package/cli/src/__tests__/e2e/returning-user-auth.test.ts +0 -111
  114. package/cli/src/__tests__/e2e-cli.test.ts +0 -185
  115. package/cli/src/__tests__/helpers/mock-api-client.ts +0 -64
  116. package/cli/src/__tests__/helpers/terminal-watchdog-fixture.ts +0 -50
  117. package/cli/src/__tests__/home-directory-detection.test.ts +0 -213
  118. package/cli/src/__tests__/integration/agent-toolnames-validation.test.ts +0 -63
  119. package/cli/src/__tests__/integration/api-integration.test.ts +0 -289
  120. package/cli/src/__tests__/integration/credentials-storage.test.ts +0 -453
  121. package/cli/src/__tests__/integration/local-agents.test.ts +0 -1187
  122. package/cli/src/__tests__/integration/login-flow-instrumentation.test.ts +0 -146
  123. package/cli/src/__tests__/integration/login-polling-working.test.ts +0 -287
  124. package/cli/src/__tests__/integration/usage-refresh-on-completion.test.ts +0 -177
  125. package/cli/src/__tests__/integration-tmux.test.ts +0 -186
  126. package/cli/src/__tests__/mocks/hover-toggle-controller.ts +0 -71
  127. package/cli/src/__tests__/path-completion.test.ts +0 -243
  128. package/cli/src/__tests__/project-files-chat-id.test.ts +0 -34
  129. package/cli/src/__tests__/release/proxy-http-get.test.ts +0 -670
  130. package/cli/src/__tests__/release/wrapper-safety.test.ts +0 -177
  131. package/cli/src/__tests__/rerender-perf.integration.test.ts +0 -283
  132. package/cli/src/__tests__/terminal-reset-sequences.test.ts +0 -36
  133. package/cli/src/__tests__/terminal-watchdog.test.ts +0 -114
  134. package/cli/src/__tests__/test-utils.ts +0 -266
  135. package/cli/src/__tests__/tmux-poc.ts +0 -150
  136. package/cli/src/__tests__/unit/agent-mode-toggle.test.ts +0 -138
  137. package/cli/src/__tests__/unit/copy-button.test.tsx +0 -188
  138. package/cli/src/__tests__/unit/create-run-config.test.ts +0 -77
  139. package/cli/src/__tests__/unit/publish-confirmation.test.ts +0 -70
  140. package/cli/src/__tests__/unit/segmented-control.test.ts +0 -167
  141. package/cli/src/__tests__/utils/env.test.ts +0 -210
  142. package/cli/src/__tests__/utils/project-picker.test.ts +0 -39
  143. package/cli/src/agents/bundled-agents.generated.d.ts +0 -14
  144. package/cli/src/agents/bundled-agents.generated.ts +0 -1962
  145. package/cli/src/app.tsx +0 -383
  146. package/cli/src/chat.tsx +0 -2008
  147. package/cli/src/cli-args.ts +0 -183
  148. package/cli/src/commands/__tests__/bash-command.test.ts +0 -449
  149. package/cli/src/commands/__tests__/command-args.test.ts +0 -325
  150. package/cli/src/commands/__tests__/copy-conversation.test.ts +0 -240
  151. package/cli/src/commands/__tests__/dev-command.test.ts +0 -128
  152. package/cli/src/commands/__tests__/diagnostics-command.test.ts +0 -35
  153. package/cli/src/commands/__tests__/image.test.ts +0 -99
  154. package/cli/src/commands/__tests__/init.test.ts +0 -479
  155. package/cli/src/commands/__tests__/loop-command.test.ts +0 -89
  156. package/cli/src/commands/__tests__/new-command-rotates-chat.test.ts +0 -87
  157. package/cli/src/commands/__tests__/permissions-command.test.ts +0 -93
  158. package/cli/src/commands/__tests__/process-diagnostics.test.ts +0 -54
  159. package/cli/src/commands/__tests__/prompt-builders.test.ts +0 -69
  160. package/cli/src/commands/__tests__/registry-gating.test.ts +0 -125
  161. package/cli/src/commands/__tests__/rewind-command.test.ts +0 -227
  162. package/cli/src/commands/__tests__/router-connect-chatgpt.test.ts +0 -72
  163. package/cli/src/commands/__tests__/router-input.test.ts +0 -302
  164. package/cli/src/commands/__tests__/router-provider-setup.test.ts +0 -180
  165. package/cli/src/commands/__tests__/savant-free-command-aliases.test.ts +0 -56
  166. package/cli/src/commands/ads.ts +0 -45
  167. package/cli/src/commands/command-registry.ts +0 -1112
  168. package/cli/src/commands/copy-conversation.ts +0 -386
  169. package/cli/src/commands/goal.ts +0 -87
  170. package/cli/src/commands/health-command.ts +0 -61
  171. package/cli/src/commands/help.ts +0 -13
  172. package/cli/src/commands/image.ts +0 -20
  173. package/cli/src/commands/init.ts +0 -121
  174. package/cli/src/commands/loop.ts +0 -182
  175. package/cli/src/commands/process-diagnostics.ts +0 -120
  176. package/cli/src/commands/prompt-builders.ts +0 -140
  177. package/cli/src/commands/publish.ts +0 -261
  178. package/cli/src/commands/rewind.ts +0 -130
  179. package/cli/src/commands/router-utils.ts +0 -80
  180. package/cli/src/commands/router.ts +0 -589
  181. package/cli/src/commands/telemetry.ts +0 -68
  182. package/cli/src/commands/usage.ts +0 -26
  183. package/cli/src/components/__tests__/ad-banner.test.tsx +0 -84
  184. package/cli/src/components/__tests__/block-helpers.test.tsx +0 -139
  185. package/cli/src/components/__tests__/clickable.test.tsx +0 -39
  186. package/cli/src/components/__tests__/grid-layout.integration.test.tsx +0 -365
  187. package/cli/src/components/__tests__/grid-layout.test.tsx +0 -1033
  188. package/cli/src/components/__tests__/markdown-content.test.tsx +0 -163
  189. package/cli/src/components/__tests__/message-block.completion.test.tsx +0 -104
  190. package/cli/src/components/__tests__/message-block.streaming.test.tsx +0 -78
  191. package/cli/src/components/__tests__/message-with-agents.test.tsx +0 -571
  192. package/cli/src/components/__tests__/multiline-input.test.tsx +0 -1129
  193. package/cli/src/components/__tests__/selectable-list.test.ts +0 -232
  194. package/cli/src/components/__tests__/shimmer-text.test.tsx +0 -32
  195. package/cli/src/components/__tests__/status-indicator.test.tsx +0 -184
  196. package/cli/src/components/__tests__/user-error-banner.test.tsx +0 -100
  197. package/cli/src/components/ad-banner.tsx +0 -351
  198. package/cli/src/components/agent-checklist.tsx +0 -385
  199. package/cli/src/components/agent-mode-toggle.tsx +0 -294
  200. package/cli/src/components/ask-user/__tests__/multiple-choice-form.test.ts +0 -432
  201. package/cli/src/components/ask-user/__tests__/validation.test.ts +0 -213
  202. package/cli/src/components/ask-user/components/accordion-question.tsx +0 -153
  203. package/cli/src/components/ask-user/components/custom-answer-input.tsx +0 -66
  204. package/cli/src/components/ask-user/components/options-list.tsx +0 -139
  205. package/cli/src/components/ask-user/components/question-header.tsx +0 -80
  206. package/cli/src/components/ask-user/components/question-option.tsx +0 -94
  207. package/cli/src/components/ask-user/constants.ts +0 -35
  208. package/cli/src/components/ask-user/index.tsx +0 -660
  209. package/cli/src/components/ask-user/utils/validation.ts +0 -85
  210. package/cli/src/components/attachment-card.tsx +0 -67
  211. package/cli/src/components/blocks/agent-block-grid.tsx +0 -58
  212. package/cli/src/components/blocks/agent-branch-item.tsx +0 -230
  213. package/cli/src/components/blocks/agent-branch-wrapper.tsx +0 -524
  214. package/cli/src/components/blocks/agent-list-branch.tsx +0 -77
  215. package/cli/src/components/blocks/ask-user-branch.tsx +0 -98
  216. package/cli/src/components/blocks/block-helpers.tsx +0 -257
  217. package/cli/src/components/blocks/blocks-renderer.tsx +0 -296
  218. package/cli/src/components/blocks/content-with-markdown.tsx +0 -34
  219. package/cli/src/components/blocks/copy-button.tsx +0 -106
  220. package/cli/src/components/blocks/copyable-block.tsx +0 -47
  221. package/cli/src/components/blocks/image-block.tsx +0 -128
  222. package/cli/src/components/blocks/implementor-row.tsx +0 -453
  223. package/cli/src/components/blocks/markdown-content.tsx +0 -360
  224. package/cli/src/components/blocks/markdown-renderables.tsx +0 -347
  225. package/cli/src/components/blocks/single-block.tsx +0 -210
  226. package/cli/src/components/blocks/thinking-block.tsx +0 -77
  227. package/cli/src/components/blocks/tool-block-group.tsx +0 -72
  228. package/cli/src/components/blocks/tool-branch.tsx +0 -196
  229. package/cli/src/components/blocks/user-content-copy.tsx +0 -171
  230. package/cli/src/components/bottom-banner.tsx +0 -145
  231. package/cli/src/components/build-mode-buttons.tsx +0 -110
  232. package/cli/src/components/button.tsx +0 -75
  233. package/cli/src/components/chat-header.tsx +0 -11
  234. package/cli/src/components/chat-history-screen.tsx +0 -417
  235. package/cli/src/components/chat-input-bar.tsx +0 -535
  236. package/cli/src/components/chatgpt-connect-banner.tsx +0 -234
  237. package/cli/src/components/clickable.tsx +0 -149
  238. package/cli/src/components/collapse-button.tsx +0 -36
  239. package/cli/src/components/command-palette.tsx +0 -166
  240. package/cli/src/components/copy-button.tsx +0 -219
  241. package/cli/src/components/dialog.tsx +0 -111
  242. package/cli/src/components/elapsed-timer.tsx +0 -56
  243. package/cli/src/components/error-boundary.tsx +0 -63
  244. package/cli/src/components/feedback-container.tsx +0 -206
  245. package/cli/src/components/feedback-icon-button.tsx +0 -89
  246. package/cli/src/components/feedback-input-mode.tsx +0 -352
  247. package/cli/src/components/file-attachment-card.tsx +0 -89
  248. package/cli/src/components/grid-layout.tsx +0 -83
  249. package/cli/src/components/help-banner.tsx +0 -136
  250. package/cli/src/components/highlighted-text.tsx +0 -52
  251. package/cli/src/components/image-card.tsx +0 -167
  252. package/cli/src/components/image-thumbnail.tsx +0 -112
  253. package/cli/src/components/input-cursor.tsx +0 -77
  254. package/cli/src/components/input-mode-banner.tsx +0 -70
  255. package/cli/src/components/load-previous-button.tsx +0 -48
  256. package/cli/src/components/login-modal.tsx +0 -450
  257. package/cli/src/components/message-block.tsx +0 -337
  258. package/cli/src/components/message-footer.tsx +0 -269
  259. package/cli/src/components/message-with-agents.tsx +0 -594
  260. package/cli/src/components/mode-divider.tsx +0 -43
  261. package/cli/src/components/model-picker.tsx +0 -371
  262. package/cli/src/components/multiline-input.tsx +0 -1276
  263. package/cli/src/components/out-of-credits-banner.tsx +0 -155
  264. package/cli/src/components/pending-attachments-banner.tsx +0 -125
  265. package/cli/src/components/pending-bash-message.tsx +0 -57
  266. package/cli/src/components/progress-bar.tsx +0 -81
  267. package/cli/src/components/project-picker-screen.tsx +0 -469
  268. package/cli/src/components/provider-picker.tsx +0 -139
  269. package/cli/src/components/publish-confirmation.tsx +0 -514
  270. package/cli/src/components/publish-container.tsx +0 -737
  271. package/cli/src/components/raised-pill.tsx +0 -89
  272. package/cli/src/components/renderers/plan-box.tsx +0 -70
  273. package/cli/src/components/review-screen.tsx +0 -114
  274. package/cli/src/components/rewind-picker.tsx +0 -276
  275. package/cli/src/components/right-sidebar.tsx +0 -296
  276. package/cli/src/components/savant-free-active-session-summary.tsx +0 -63
  277. package/cli/src/components/savant-free-landing-screen.tsx +0 -756
  278. package/cli/src/components/savant-free-model-selector.tsx +0 -815
  279. package/cli/src/components/savant-free-referral-banner.tsx +0 -423
  280. package/cli/src/components/savant-free-superseded-screen.tsx +0 -62
  281. package/cli/src/components/savant-ui/animation/pulse.tsx +0 -26
  282. package/cli/src/components/savant-ui/animation/typewriter.tsx +0 -40
  283. package/cli/src/components/savant-ui/branding.tsx +0 -59
  284. package/cli/src/components/savant-ui/data-display/badge.tsx +0 -52
  285. package/cli/src/components/savant-ui/data-display/code-block.tsx +0 -55
  286. package/cli/src/components/savant-ui/data-display/key-value.tsx +0 -34
  287. package/cli/src/components/savant-ui/data-display/sparkline.tsx +0 -42
  288. package/cli/src/components/savant-ui/data-display/timeline.tsx +0 -44
  289. package/cli/src/components/savant-ui/data-display/tree-view.tsx +0 -55
  290. package/cli/src/components/savant-ui/echo/__tests__/sidebar-collapse.test.tsx +0 -90
  291. package/cli/src/components/savant-ui/echo/agent-stack.tsx +0 -72
  292. package/cli/src/components/savant-ui/echo/agent-status.tsx +0 -66
  293. package/cli/src/components/savant-ui/echo/fid-card.tsx +0 -89
  294. package/cli/src/components/savant-ui/echo/fid-list.tsx +0 -68
  295. package/cli/src/components/savant-ui/echo/loop-status-panel.tsx +0 -64
  296. package/cli/src/components/savant-ui/echo/perfection-loop.tsx +0 -118
  297. package/cli/src/components/savant-ui/echo/phase-indicator.tsx +0 -68
  298. package/cli/src/components/savant-ui/echo/phase-info.ts +0 -72
  299. package/cli/src/components/savant-ui/echo/token-meter.tsx +0 -39
  300. package/cli/src/components/savant-ui/feedback/alert.tsx +0 -45
  301. package/cli/src/components/savant-ui/feedback/cost-tracker.tsx +0 -54
  302. package/cli/src/components/savant-ui/feedback/progress-bar.tsx +0 -71
  303. package/cli/src/components/savant-ui/feedback/spinner.tsx +0 -40
  304. package/cli/src/components/savant-ui/icon-theme-keys.ts +0 -67
  305. package/cli/src/components/savant-ui/icon.tsx +0 -53
  306. package/cli/src/components/savant-ui/index.ts +0 -75
  307. package/cli/src/components/savant-ui/input/select.tsx +0 -26
  308. package/cli/src/components/savant-ui/input/toggle.tsx +0 -28
  309. package/cli/src/components/savant-ui/layout/grid.tsx +0 -52
  310. package/cli/src/components/savant-ui/layout/header.tsx +0 -28
  311. package/cli/src/components/savant-ui/navigation/stepper.tsx +0 -41
  312. package/cli/src/components/savant-ui/primitives/key-hint.tsx +0 -45
  313. package/cli/src/components/savant-ui/primitives/key-value-row.tsx +0 -41
  314. package/cli/src/components/savant-ui/primitives/panel.tsx +0 -42
  315. package/cli/src/components/savant-ui/primitives/separator.tsx +0 -34
  316. package/cli/src/components/savant-ui/primitives/sidebar-section.tsx +0 -64
  317. package/cli/src/components/savant-ui/primitives/spacer.tsx +0 -13
  318. package/cli/src/components/savant-ui/primitives/stack.tsx +0 -35
  319. package/cli/src/components/savant-ui/theme.ts +0 -45
  320. package/cli/src/components/scroll-to-bottom-button.tsx +0 -34
  321. package/cli/src/components/segmented-control.tsx +0 -199
  322. package/cli/src/components/selectable-list.tsx +0 -249
  323. package/cli/src/components/selected-chips.tsx +0 -86
  324. package/cli/src/components/separator.tsx +0 -40
  325. package/cli/src/components/session-ended-banner.tsx +0 -183
  326. package/cli/src/components/shimmer-text.tsx +0 -254
  327. package/cli/src/components/status-bar.tsx +0 -279
  328. package/cli/src/components/subscription-limit-banner.tsx +0 -269
  329. package/cli/src/components/suggested-prompts.tsx +0 -184
  330. package/cli/src/components/suggestion-menu.tsx +0 -219
  331. package/cli/src/components/terminal-command-display.tsx +0 -152
  332. package/cli/src/components/terminal-link.tsx +0 -97
  333. package/cli/src/components/text-attachment-card.tsx +0 -77
  334. package/cli/src/components/thinking.tsx +0 -108
  335. package/cli/src/components/toast.tsx +0 -109
  336. package/cli/src/components/tools/__tests__/apply-patch.test.tsx +0 -97
  337. package/cli/src/components/tools/__tests__/code-search.test.tsx +0 -45
  338. package/cli/src/components/tools/__tests__/gravity-index.test.ts +0 -76
  339. package/cli/src/components/tools/__tests__/render-ui.test.tsx +0 -556
  340. package/cli/src/components/tools/__tests__/run-terminal-command.test.ts +0 -274
  341. package/cli/src/components/tools/__tests__/tool-call-item.test.tsx +0 -73
  342. package/cli/src/components/tools/apply-patch.tsx +0 -101
  343. package/cli/src/components/tools/code-search.tsx +0 -50
  344. package/cli/src/components/tools/composio.tsx +0 -140
  345. package/cli/src/components/tools/diff-viewer.tsx +0 -21
  346. package/cli/src/components/tools/glob.tsx +0 -66
  347. package/cli/src/components/tools/gravity-index.tsx +0 -80
  348. package/cli/src/components/tools/list-directory.tsx +0 -66
  349. package/cli/src/components/tools/read-docs.tsx +0 -36
  350. package/cli/src/components/tools/read-files.tsx +0 -97
  351. package/cli/src/components/tools/read-subtree.tsx +0 -40
  352. package/cli/src/components/tools/read-url.tsx +0 -32
  353. package/cli/src/components/tools/registry.ts +0 -131
  354. package/cli/src/components/tools/render-ui.tsx +0 -466
  355. package/cli/src/components/tools/run-terminal-command.tsx +0 -86
  356. package/cli/src/components/tools/skill.tsx +0 -26
  357. package/cli/src/components/tools/str-replace.tsx +0 -77
  358. package/cli/src/components/tools/suggest-followups.tsx +0 -373
  359. package/cli/src/components/tools/task-completed.tsx +0 -16
  360. package/cli/src/components/tools/tool-call-item.tsx +0 -163
  361. package/cli/src/components/tools/types.ts +0 -100
  362. package/cli/src/components/tools/web-search.tsx +0 -32
  363. package/cli/src/components/tools/write-file.tsx +0 -20
  364. package/cli/src/components/tools/write-todos.tsx +0 -105
  365. package/cli/src/components/top-banner.tsx +0 -187
  366. package/cli/src/components/usage-banner.tsx +0 -296
  367. package/cli/src/components/user-error-banner.tsx +0 -54
  368. package/cli/src/components/validation-error-popover.tsx +0 -191
  369. package/cli/src/data/slash-commands.ts +0 -306
  370. package/cli/src/hooks/__tests__/holds-live-savant-free-slot.test.ts +0 -49
  371. package/cli/src/hooks/__tests__/run-outcome.test.ts +0 -178
  372. package/cli/src/hooks/__tests__/session-fetch-signal.test.ts +0 -45
  373. package/cli/src/hooks/__tests__/use-activity-query.test.ts +0 -810
  374. package/cli/src/hooks/__tests__/use-ask-user-bridge.test.ts +0 -175
  375. package/cli/src/hooks/__tests__/use-auth-query.test.ts +0 -21
  376. package/cli/src/hooks/__tests__/use-chat-messages-collapse.test.ts +0 -96
  377. package/cli/src/hooks/__tests__/use-connection-status.test.ts +0 -112
  378. package/cli/src/hooks/__tests__/use-directory-browser.test.ts +0 -215
  379. package/cli/src/hooks/__tests__/use-gravity-ad.test.ts +0 -73
  380. package/cli/src/hooks/__tests__/use-grid-layout.test.ts +0 -346
  381. package/cli/src/hooks/__tests__/use-input-history.test.ts +0 -704
  382. package/cli/src/hooks/__tests__/use-loop-scheduler.test.ts +0 -247
  383. package/cli/src/hooks/__tests__/use-path-tab-completion.test.ts +0 -324
  384. package/cli/src/hooks/__tests__/use-queue-controls.test.ts +0 -68
  385. package/cli/src/hooks/__tests__/use-searchable-list.test.ts +0 -364
  386. package/cli/src/hooks/__tests__/use-send-message-timer.test.ts +0 -146
  387. package/cli/src/hooks/__tests__/use-suggestion-engine-mention.test.ts +0 -364
  388. package/cli/src/hooks/__tests__/use-suggestion-engine.test.ts +0 -485
  389. package/cli/src/hooks/__tests__/use-terminal-focus.test.ts +0 -66
  390. package/cli/src/hooks/__tests__/use-terminal-layout.test.ts +0 -675
  391. package/cli/src/hooks/__tests__/use-timeout.test.ts +0 -330
  392. package/cli/src/hooks/__tests__/use-usage-query.test.ts +0 -526
  393. package/cli/src/hooks/__tests__/use-user-details-query.test.ts +0 -225
  394. package/cli/src/hooks/helpers/__tests__/send-message.test.ts +0 -1851
  395. package/cli/src/hooks/helpers/send-message.ts +0 -553
  396. package/cli/src/hooks/run-outcome.ts +0 -64
  397. package/cli/src/hooks/stream-state.ts +0 -106
  398. package/cli/src/hooks/use-activity-query.ts +0 -696
  399. package/cli/src/hooks/use-agent-validation.ts +0 -80
  400. package/cli/src/hooks/use-ask-user-bridge.ts +0 -102
  401. package/cli/src/hooks/use-auth-query.ts +0 -261
  402. package/cli/src/hooks/use-auth-state.ts +0 -155
  403. package/cli/src/hooks/use-chat-input.ts +0 -87
  404. package/cli/src/hooks/use-chat-keyboard.ts +0 -325
  405. package/cli/src/hooks/use-chat-messages.ts +0 -273
  406. package/cli/src/hooks/use-chat-state.ts +0 -219
  407. package/cli/src/hooks/use-chat-streaming.ts +0 -270
  408. package/cli/src/hooks/use-chat-ui.ts +0 -136
  409. package/cli/src/hooks/use-clipboard.ts +0 -154
  410. package/cli/src/hooks/use-connection-status.ts +0 -156
  411. package/cli/src/hooks/use-directory-browser.ts +0 -88
  412. package/cli/src/hooks/use-elapsed-time.ts +0 -116
  413. package/cli/src/hooks/use-event.ts +0 -36
  414. package/cli/src/hooks/use-exit-handler.ts +0 -108
  415. package/cli/src/hooks/use-fetch-login-url.ts +0 -65
  416. package/cli/src/hooks/use-fids.ts +0 -48
  417. package/cli/src/hooks/use-fingerprint.ts +0 -64
  418. package/cli/src/hooks/use-gravity-ad.ts +0 -688
  419. package/cli/src/hooks/use-grid-layout.ts +0 -78
  420. package/cli/src/hooks/use-input-history.ts +0 -173
  421. package/cli/src/hooks/use-login-keyboard-handlers.ts +0 -74
  422. package/cli/src/hooks/use-login-polling.ts +0 -120
  423. package/cli/src/hooks/use-logo.tsx +0 -178
  424. package/cli/src/hooks/use-loop-scheduler.ts +0 -481
  425. package/cli/src/hooks/use-message-queue.ts +0 -301
  426. package/cli/src/hooks/use-now.ts +0 -20
  427. package/cli/src/hooks/use-path-tab-completion.ts +0 -88
  428. package/cli/src/hooks/use-publish-mutation.ts +0 -60
  429. package/cli/src/hooks/use-queue-controls.ts +0 -70
  430. package/cli/src/hooks/use-queue-ui.ts +0 -55
  431. package/cli/src/hooks/use-savant-free-ctrl-c-exit.ts +0 -23
  432. package/cli/src/hooks/use-savant-free-session-progress.ts +0 -34
  433. package/cli/src/hooks/use-savant-free-session.ts +0 -679
  434. package/cli/src/hooks/use-savant-free-streak-query.ts +0 -72
  435. package/cli/src/hooks/use-scaffold-confirm.ts +0 -62
  436. package/cli/src/hooks/use-scaffold-revert-subscriber.ts +0 -66
  437. package/cli/src/hooks/use-scroll-management.ts +0 -182
  438. package/cli/src/hooks/use-searchable-list.ts +0 -99
  439. package/cli/src/hooks/use-send-message.ts +0 -1038
  440. package/cli/src/hooks/use-sheen-animation.tsx +0 -88
  441. package/cli/src/hooks/use-subscription-query.ts +0 -106
  442. package/cli/src/hooks/use-suggestion-engine.ts +0 -793
  443. package/cli/src/hooks/use-terminal-breakpoints.ts +0 -77
  444. package/cli/src/hooks/use-terminal-dimensions.ts +0 -50
  445. package/cli/src/hooks/use-terminal-focus.ts +0 -146
  446. package/cli/src/hooks/use-terminal-layout.ts +0 -189
  447. package/cli/src/hooks/use-theme.tsx +0 -140
  448. package/cli/src/hooks/use-timeout.ts +0 -88
  449. package/cli/src/hooks/use-toast.ts +0 -114
  450. package/cli/src/hooks/use-update-preference.ts +0 -77
  451. package/cli/src/hooks/use-usage-monitor.ts +0 -59
  452. package/cli/src/hooks/use-usage-query.ts +0 -138
  453. package/cli/src/hooks/use-user-details-query.ts +0 -104
  454. package/cli/src/hooks/use-why-did-you-update.ts +0 -178
  455. package/cli/src/index.tsx +0 -484
  456. package/cli/src/init/__tests__/init-direnv.test.ts +0 -597
  457. package/cli/src/init/init-app.ts +0 -54
  458. package/cli/src/init/init-direnv.ts +0 -133
  459. package/cli/src/login/constants.ts +0 -71
  460. package/cli/src/login/login-flow.ts +0 -224
  461. package/cli/src/login/plain-login.ts +0 -107
  462. package/cli/src/login/utils.ts +0 -183
  463. package/cli/src/native/ripgrep.ts +0 -82
  464. package/cli/src/polyfills/bun-strip-ansi.ts +0 -12
  465. package/cli/src/pre-init/load-dev-env.ts +0 -98
  466. package/cli/src/pre-init/tree-sitter-wasm.ts +0 -98
  467. package/cli/src/project-files.ts +0 -102
  468. package/cli/src/state/__tests__/chat-store-focus.test.ts +0 -22
  469. package/cli/src/state/__tests__/feedback-store.test.ts +0 -260
  470. package/cli/src/state/chat-history-store.ts +0 -27
  471. package/cli/src/state/chat-store.ts +0 -791
  472. package/cli/src/state/feedback-store.ts +0 -162
  473. package/cli/src/state/gateway-catalog-store.ts +0 -45
  474. package/cli/src/state/login-store.ts +0 -150
  475. package/cli/src/state/message-block-store.ts +0 -143
  476. package/cli/src/state/model-picker-store.ts +0 -67
  477. package/cli/src/state/provider-picker-store.ts +0 -53
  478. package/cli/src/state/publish-store.ts +0 -141
  479. package/cli/src/state/review-store.ts +0 -24
  480. package/cli/src/state/rewind-picker-store.ts +0 -74
  481. package/cli/src/state/savant-free-model-store.ts +0 -59
  482. package/cli/src/state/savant-free-session-store.ts +0 -32
  483. package/cli/src/test-setup.ts +0 -20
  484. package/cli/src/testing/env.ts +0 -46
  485. package/cli/src/types/chat-state.ts +0 -15
  486. package/cli/src/types/chat.ts +0 -242
  487. package/cli/src/types/contracts/send-message.ts +0 -16
  488. package/cli/src/types/env.ts +0 -107
  489. package/cli/src/types/function-params.ts +0 -35
  490. package/cli/src/types/opentui-augmentation.d.ts +0 -11
  491. package/cli/src/types/react19-compat.d.ts +0 -19
  492. package/cli/src/types/savant-free-session.ts +0 -17
  493. package/cli/src/types/store.ts +0 -112
  494. package/cli/src/types/theme-system.ts +0 -194
  495. package/cli/src/types/utils.ts +0 -3
  496. package/cli/src/utils/__tests__/activity-tracker.test.ts +0 -440
  497. package/cli/src/utils/__tests__/agent-display.test.ts +0 -139
  498. package/cli/src/utils/__tests__/analytics-client.test.ts +0 -311
  499. package/cli/src/utils/__tests__/anonymous-id.test.ts +0 -74
  500. package/cli/src/utils/__tests__/arrays.test.ts +0 -264
  501. package/cli/src/utils/__tests__/bash-context-processor.test.ts +0 -38
  502. package/cli/src/utils/__tests__/block-processor.test.ts +0 -690
  503. package/cli/src/utils/__tests__/chat-history.test.ts +0 -247
  504. package/cli/src/utils/__tests__/chat-input-key-intercept.test.ts +0 -40
  505. package/cli/src/utils/__tests__/chat-layout.test.ts +0 -32
  506. package/cli/src/utils/__tests__/chat-meta.test.ts +0 -160
  507. package/cli/src/utils/__tests__/chatgpt-oauth.test.ts +0 -50
  508. package/cli/src/utils/__tests__/clipboard.test.ts +0 -998
  509. package/cli/src/utils/__tests__/code-search-summary.test.ts +0 -84
  510. package/cli/src/utils/__tests__/collapse-helpers.test.ts +0 -1272
  511. package/cli/src/utils/__tests__/error-handling.test.ts +0 -611
  512. package/cli/src/utils/__tests__/feedback-helpers.test.ts +0 -452
  513. package/cli/src/utils/__tests__/feedback-submission.test.ts +0 -26
  514. package/cli/src/utils/__tests__/fetch-usage.test.ts +0 -355
  515. package/cli/src/utils/__tests__/fingerprint.test.ts +0 -147
  516. package/cli/src/utils/__tests__/format-elapsed-time.test.ts +0 -103
  517. package/cli/src/utils/__tests__/format-timeout.test.ts +0 -87
  518. package/cli/src/utils/__tests__/image-dimensions.test.ts +0 -243
  519. package/cli/src/utils/__tests__/image-processor.test.ts +0 -250
  520. package/cli/src/utils/__tests__/implementor-helpers.test.ts +0 -1457
  521. package/cli/src/utils/__tests__/keyboard-actions.test.ts +0 -686
  522. package/cli/src/utils/__tests__/layout-helpers.test.ts +0 -36
  523. package/cli/src/utils/__tests__/lazy-response-ads.test.ts +0 -167
  524. package/cli/src/utils/__tests__/logger-sanitize-secrets.test.ts +0 -80
  525. package/cli/src/utils/__tests__/markdown-renderer.test.tsx +0 -518
  526. package/cli/src/utils/__tests__/markdown-streaming.test.ts +0 -64
  527. package/cli/src/utils/__tests__/message-block-helpers.test.ts +0 -1197
  528. package/cli/src/utils/__tests__/message-updater.test.ts +0 -659
  529. package/cli/src/utils/__tests__/ollama-onboarding.test.ts +0 -239
  530. package/cli/src/utils/__tests__/openrouter-models.test.ts +0 -295
  531. package/cli/src/utils/__tests__/osc-timeout-scenarios.test.ts +0 -172
  532. package/cli/src/utils/__tests__/pending-attachments.test.ts +0 -278
  533. package/cli/src/utils/__tests__/provider-setup.test.ts +0 -183
  534. package/cli/src/utils/__tests__/run-state-storage.test.ts +0 -741
  535. package/cli/src/utils/__tests__/savant-code-api.test.ts +0 -634
  536. package/cli/src/utils/__tests__/savant-free-instance-owner.test.ts +0 -69
  537. package/cli/src/utils/__tests__/savant-free-model-navigation.test.ts +0 -104
  538. package/cli/src/utils/__tests__/savant-free-premium-reset.test.ts +0 -81
  539. package/cli/src/utils/__tests__/savant-free-referral-cache.test.ts +0 -67
  540. package/cli/src/utils/__tests__/savant-free-session-display.test.ts +0 -23
  541. package/cli/src/utils/__tests__/savant-free-streak-line.test.ts +0 -76
  542. package/cli/src/utils/__tests__/sdk-event-handlers.test.ts +0 -615
  543. package/cli/src/utils/__tests__/send-message-helpers.test.ts +0 -1875
  544. package/cli/src/utils/__tests__/send-message-timer.test.ts +0 -68
  545. package/cli/src/utils/__tests__/settings.test.ts +0 -138
  546. package/cli/src/utils/__tests__/strings.test.ts +0 -210
  547. package/cli/src/utils/__tests__/syntax-theme.test.ts +0 -91
  548. package/cli/src/utils/__tests__/terminal-color-detection.test.ts +0 -425
  549. package/cli/src/utils/__tests__/terminal-enter-detection.test.ts +0 -77
  550. package/cli/src/utils/__tests__/text-layout.test.ts +0 -82
  551. package/cli/src/utils/__tests__/think-tag-parser.test.ts +0 -159
  552. package/cli/src/utils/__tests__/trace-writer.test.ts +0 -193
  553. package/cli/src/utils/__tests__/trim-chat-logs.test.ts +0 -79
  554. package/cli/src/utils/__tests__/usage-banner-state.test.ts +0 -298
  555. package/cli/src/utils/__tests__/validation-error-formatting.test.ts +0 -126
  556. package/cli/src/utils/__tests__/write-file-atomic.test.ts +0 -130
  557. package/cli/src/utils/active-run.ts +0 -22
  558. package/cli/src/utils/activity-tracker.ts +0 -66
  559. package/cli/src/utils/agent-display.ts +0 -87
  560. package/cli/src/utils/agent-helpers.ts +0 -47
  561. package/cli/src/utils/ai-message-id.ts +0 -12
  562. package/cli/src/utils/analytics.ts +0 -407
  563. package/cli/src/utils/anonymous-id.ts +0 -87
  564. package/cli/src/utils/arrays.ts +0 -117
  565. package/cli/src/utils/auth.ts +0 -258
  566. package/cli/src/utils/bash-context-processor.ts +0 -47
  567. package/cli/src/utils/bash-messages.ts +0 -108
  568. package/cli/src/utils/block-margins.ts +0 -35
  569. package/cli/src/utils/block-operations.ts +0 -548
  570. package/cli/src/utils/block-processor.ts +0 -212
  571. package/cli/src/utils/chat-history.ts +0 -265
  572. package/cli/src/utils/chat-input-key-intercept.ts +0 -52
  573. package/cli/src/utils/chat-layout.ts +0 -44
  574. package/cli/src/utils/chat-meta.ts +0 -101
  575. package/cli/src/utils/chat-scroll-accel.ts +0 -151
  576. package/cli/src/utils/chatgpt-oauth.ts +0 -350
  577. package/cli/src/utils/clipboard-image.ts +0 -610
  578. package/cli/src/utils/clipboard.ts +0 -307
  579. package/cli/src/utils/code-search-summary.ts +0 -69
  580. package/cli/src/utils/collapse-helpers.ts +0 -265
  581. package/cli/src/utils/config-dir.ts +0 -30
  582. package/cli/src/utils/constants.ts +0 -159
  583. package/cli/src/utils/create-event-handler-state.ts +0 -79
  584. package/cli/src/utils/create-run-config.ts +0 -160
  585. package/cli/src/utils/db-storage.ts +0 -254
  586. package/cli/src/utils/detect-shell.ts +0 -112
  587. package/cli/src/utils/directory-browser.ts +0 -74
  588. package/cli/src/utils/engagement.ts +0 -55
  589. package/cli/src/utils/env.ts +0 -109
  590. package/cli/src/utils/error-handling.ts +0 -246
  591. package/cli/src/utils/error-messages.ts +0 -84
  592. package/cli/src/utils/feedback-helpers.ts +0 -115
  593. package/cli/src/utils/feedback-submission.ts +0 -24
  594. package/cli/src/utils/fetch-usage.ts +0 -75
  595. package/cli/src/utils/fid-loader.ts +0 -135
  596. package/cli/src/utils/fingerprint.ts +0 -263
  597. package/cli/src/utils/finish-logic.ts +0 -154
  598. package/cli/src/utils/format-elapsed-time.ts +0 -33
  599. package/cli/src/utils/format-session-units.ts +0 -6
  600. package/cli/src/utils/format-timeout.ts +0 -28
  601. package/cli/src/utils/format-validation-errors-for-message.ts +0 -85
  602. package/cli/src/utils/git.ts +0 -17
  603. package/cli/src/utils/glyphs.ts +0 -188
  604. package/cli/src/utils/helpers.ts +0 -47
  605. package/cli/src/utils/image-display.ts +0 -73
  606. package/cli/src/utils/image-handler.ts +0 -336
  607. package/cli/src/utils/image-processor.ts +0 -133
  608. package/cli/src/utils/image-thumbnail.ts +0 -83
  609. package/cli/src/utils/implementor-helpers.ts +0 -817
  610. package/cli/src/utils/input-modes.ts +0 -196
  611. package/cli/src/utils/keyboard-actions.ts +0 -394
  612. package/cli/src/utils/keypad-keys.ts +0 -47
  613. package/cli/src/utils/layout-helpers.ts +0 -36
  614. package/cli/src/utils/lazy-response-ads.ts +0 -1
  615. package/cli/src/utils/loading-phrases.ts +0 -68
  616. package/cli/src/utils/local-agent-registry.ts +0 -611
  617. package/cli/src/utils/log-shipper.ts +0 -116
  618. package/cli/src/utils/logger.ts +0 -435
  619. package/cli/src/utils/markdown-renderer.tsx +0 -1315
  620. package/cli/src/utils/math.ts +0 -3
  621. package/cli/src/utils/message-block-helpers.ts +0 -667
  622. package/cli/src/utils/message-history.ts +0 -153
  623. package/cli/src/utils/message-tree-utils.ts +0 -67
  624. package/cli/src/utils/message-updater.ts +0 -279
  625. package/cli/src/utils/ollama-onboarding.ts +0 -215
  626. package/cli/src/utils/open-file.ts +0 -144
  627. package/cli/src/utils/open-url.ts +0 -63
  628. package/cli/src/utils/openrouter-models.ts +0 -945
  629. package/cli/src/utils/path-completion.ts +0 -111
  630. package/cli/src/utils/path-helpers.ts +0 -38
  631. package/cli/src/utils/pending-attachments.ts +0 -363
  632. package/cli/src/utils/post-processing.ts +0 -99
  633. package/cli/src/utils/project-picker.ts +0 -12
  634. package/cli/src/utils/provider-setup.ts +0 -259
  635. package/cli/src/utils/recent-projects.ts +0 -156
  636. package/cli/src/utils/renderer-cleanup.ts +0 -142
  637. package/cli/src/utils/response-ad-positions.ts +0 -1
  638. package/cli/src/utils/rewind.ts +0 -175
  639. package/cli/src/utils/run-state-storage.ts +0 -480
  640. package/cli/src/utils/savant-code-api.ts +0 -686
  641. package/cli/src/utils/savant-code-client.ts +0 -217
  642. package/cli/src/utils/savant-free-agent-selection.ts +0 -12
  643. package/cli/src/utils/savant-free-exit.ts +0 -24
  644. package/cli/src/utils/savant-free-instance-owner.ts +0 -66
  645. package/cli/src/utils/savant-free-model-navigation.ts +0 -46
  646. package/cli/src/utils/savant-free-premium-reset.ts +0 -52
  647. package/cli/src/utils/savant-free-referral-cache.ts +0 -35
  648. package/cli/src/utils/savant-free-session-display.ts +0 -21
  649. package/cli/src/utils/savant-free-streak-line.ts +0 -67
  650. package/cli/src/utils/sdk-event-handlers.ts +0 -587
  651. package/cli/src/utils/send-message-helpers.ts +0 -199
  652. package/cli/src/utils/send-message-timer.ts +0 -110
  653. package/cli/src/utils/settings.ts +0 -388
  654. package/cli/src/utils/skill-registry.ts +0 -100
  655. package/cli/src/utils/spawn-agent-matcher.ts +0 -56
  656. package/cli/src/utils/status-indicator-state.ts +0 -100
  657. package/cli/src/utils/stream-chunk-processor.ts +0 -65
  658. package/cli/src/utils/strings.ts +0 -272
  659. package/cli/src/utils/subscription.ts +0 -31
  660. package/cli/src/utils/syntax-highlighter.tsx +0 -19
  661. package/cli/src/utils/syntax-theme.ts +0 -131
  662. package/cli/src/utils/terminal-color-detection.ts +0 -472
  663. package/cli/src/utils/terminal-enter-detection.ts +0 -63
  664. package/cli/src/utils/terminal-images.ts +0 -223
  665. package/cli/src/utils/terminal-reset-sequences.ts +0 -33
  666. package/cli/src/utils/terminal-title.ts +0 -113
  667. package/cli/src/utils/terminal-watchdog.ts +0 -246
  668. package/cli/src/utils/text-layout.ts +0 -153
  669. package/cli/src/utils/theme-config.ts +0 -143
  670. package/cli/src/utils/theme-system.ts +0 -1265
  671. package/cli/src/utils/think-tag-parser.ts +0 -105
  672. package/cli/src/utils/trace-writer.ts +0 -147
  673. package/cli/src/utils/ui-constants.ts +0 -69
  674. package/cli/src/utils/usage-banner-state.ts +0 -146
  675. package/cli/src/utils/validation-error-formatting.ts +0 -92
  676. package/cli/src/utils/validation-error-helpers.ts +0 -19
  677. package/cli/src/utils/version.ts +0 -23
  678. package/cli/src/utils/word-wrap-utils.ts +0 -53
  679. package/cli/src/utils/write-file-atomic.ts +0 -82
  680. package/cli/src/utils/yield-to-event-loop.ts +0 -9
  681. package/cli/tsconfig.json +0 -26
  682. package/coding-standards/csharp.md +0 -77
  683. package/coding-standards/go.md +0 -71
  684. package/coding-standards/java.md +0 -74
  685. package/coding-standards/python.md +0 -82
  686. package/coding-standards/rust.md +0 -78
  687. package/coding-standards/typescript.md +0 -85
  688. package/coding-standards/x402.md +0 -227
  689. package/common/README.md +0 -41
  690. package/common/common_exit +0 -1
  691. package/common/package.json +0 -45
  692. package/common/src/__tests__/agent-validation.test.ts +0 -861
  693. package/common/src/__tests__/agents.test.ts +0 -16
  694. package/common/src/__tests__/dynamic-agent-template-schema.test.ts +0 -420
  695. package/common/src/__tests__/env-ci.test.ts +0 -167
  696. package/common/src/__tests__/env-process.test.ts +0 -145
  697. package/common/src/__tests__/free-agents.test.ts +0 -269
  698. package/common/src/__tests__/handlesteps-parsing.test.ts +0 -247
  699. package/common/src/__tests__/model-config.test.ts +0 -41
  700. package/common/src/__tests__/project-file-tree.test.ts +0 -82
  701. package/common/src/__tests__/response-ad-positions.test.ts +0 -78
  702. package/common/src/__tests__/savant-free-models.test.ts +0 -460
  703. package/common/src/__tests__/savant-free-referral-tiers.test.ts +0 -122
  704. package/common/src/__tests__/user-state.test.ts +0 -30
  705. package/common/src/actions.ts +0 -215
  706. package/common/src/analytics-core.ts +0 -73
  707. package/common/src/analytics.ts +0 -96
  708. package/common/src/api-keys/constants.ts +0 -26
  709. package/common/src/browser-actions.ts +0 -414
  710. package/common/src/constants/agents.ts +0 -250
  711. package/common/src/constants/analytics-events.ts +0 -318
  712. package/common/src/constants/anthropic.ts +0 -72
  713. package/common/src/constants/byok.ts +0 -2
  714. package/common/src/constants/chatgpt-oauth.ts +0 -85
  715. package/common/src/constants/composio.ts +0 -34
  716. package/common/src/constants/feedback.ts +0 -18
  717. package/common/src/constants/free-agents.ts +0 -347
  718. package/common/src/constants/gemini.ts +0 -6
  719. package/common/src/constants/grant-priorities.ts +0 -13
  720. package/common/src/constants/hosts.ts +0 -6
  721. package/common/src/constants/images.ts +0 -53
  722. package/common/src/constants/index.ts +0 -8
  723. package/common/src/constants/knowledge.ts +0 -46
  724. package/common/src/constants/limits.ts +0 -23
  725. package/common/src/constants/model-config.ts +0 -469
  726. package/common/src/constants/paths.ts +0 -69
  727. package/common/src/constants/savant-code-config.ts +0 -12
  728. package/common/src/constants/savant-free-gemini-thinker.ts +0 -30
  729. package/common/src/constants/savant-free-models.ts +0 -855
  730. package/common/src/constants/savant-free-referral-tiers.ts +0 -169
  731. package/common/src/constants/skills.ts +0 -60
  732. package/common/src/constants/subscription-plans.ts +0 -54
  733. package/common/src/constants/ui.ts +0 -25
  734. package/common/src/env-ci.ts +0 -36
  735. package/common/src/env-process.ts +0 -95
  736. package/common/src/env-schema.ts +0 -42
  737. package/common/src/env.ts +0 -69
  738. package/common/src/mcp/client.ts +0 -308
  739. package/common/src/old-constants.ts +0 -10
  740. package/common/src/project-file-tree.ts +0 -361
  741. package/common/src/reddit-capi.ts +0 -175
  742. package/common/src/schemas/feedback.ts +0 -57
  743. package/common/src/schemas/logs.ts +0 -66
  744. package/common/src/templates/agent-validation.ts +0 -436
  745. package/common/src/templates/initial-agents-dir/LICENSE +0 -202
  746. package/common/src/templates/initial-agents-dir/README.md +0 -314
  747. package/common/src/templates/initial-agents-dir/examples/01-basic-diff-reviewer.ts +0 -17
  748. package/common/src/templates/initial-agents-dir/examples/02-intermediate-git-committer.ts +0 -78
  749. package/common/src/templates/initial-agents-dir/examples/03-advanced-file-explorer.ts +0 -76
  750. package/common/src/templates/initial-agents-dir/my-custom-agent.ts +0 -40
  751. package/common/src/templates/initial-agents-dir/package.json +0 -6
  752. package/common/src/templates/initial-agents-dir/skills/README.md +0 -66
  753. package/common/src/templates/initial-agents-dir/skills/example-skill/SKILL.md +0 -29
  754. package/common/src/templates/initial-agents-dir/types/agent-definition.ts +0 -484
  755. package/common/src/templates/initial-agents-dir/types/tools.ts +0 -452
  756. package/common/src/templates/initial-agents-dir/types/util-types.ts +0 -167
  757. package/common/src/testing/TESTING_PATTERNS.md +0 -353
  758. package/common/src/testing/errors.ts +0 -33
  759. package/common/src/testing/fixtures/agent-runtime.ts +0 -325
  760. package/common/src/testing/impl/agent-runtime.ts +0 -6
  761. package/common/src/testing/index.ts +0 -84
  762. package/common/src/testing/mock-modules.ts +0 -54
  763. package/common/src/testing/mock-types.ts +0 -123
  764. package/common/src/testing/mocks/analytics.ts +0 -262
  765. package/common/src/testing/mocks/child-process.ts +0 -93
  766. package/common/src/testing/mocks/crypto.ts +0 -218
  767. package/common/src/testing/mocks/database.ts +0 -337
  768. package/common/src/testing/mocks/filesystem.ts +0 -166
  769. package/common/src/testing/mocks/index.ts +0 -83
  770. package/common/src/testing/mocks/logger.ts +0 -136
  771. package/common/src/testing/mocks/stream.ts +0 -314
  772. package/common/src/testing/mocks/timers.ts +0 -132
  773. package/common/src/testing/mocks/tree-sitter.ts +0 -127
  774. package/common/src/testing/setup.ts +0 -282
  775. package/common/src/testing-env-ci.ts +0 -15
  776. package/common/src/testing-env-process.ts +0 -78
  777. package/common/src/tools/__tests__/compile-tool-definitions.test.ts +0 -34
  778. package/common/src/tools/__tests__/thought-session.test.ts +0 -256
  779. package/common/src/tools/compile-tool-definitions.ts +0 -194
  780. package/common/src/tools/constants.ts +0 -132
  781. package/common/src/tools/list.ts +0 -193
  782. package/common/src/tools/params/__tests__/coerce-to-array.test.ts +0 -237
  783. package/common/src/tools/params/__tests__/sequential-thinking-coercion.test.ts +0 -98
  784. package/common/src/tools/params/tool/add-message.ts +0 -36
  785. package/common/src/tools/params/tool/add-subgoal.ts +0 -57
  786. package/common/src/tools/params/tool/apply-patch.ts +0 -110
  787. package/common/src/tools/params/tool/ask-user.ts +0 -181
  788. package/common/src/tools/params/tool/browser-logs.ts +0 -85
  789. package/common/src/tools/params/tool/code-search.ts +0 -144
  790. package/common/src/tools/params/tool/composio.ts +0 -131
  791. package/common/src/tools/params/tool/create-plan.ts +0 -80
  792. package/common/src/tools/params/tool/end-turn.ts +0 -54
  793. package/common/src/tools/params/tool/find-files.ts +0 -60
  794. package/common/src/tools/params/tool/glob.ts +0 -74
  795. package/common/src/tools/params/tool/gravity-index.ts +0 -92
  796. package/common/src/tools/params/tool/list-directory.ts +0 -58
  797. package/common/src/tools/params/tool/lookup-agent-info.ts +0 -37
  798. package/common/src/tools/params/tool/propose-str-replace.ts +0 -103
  799. package/common/src/tools/params/tool/propose-write-file.ts +0 -71
  800. package/common/src/tools/params/tool/read-docs.ts +0 -85
  801. package/common/src/tools/params/tool/read-files.ts +0 -61
  802. package/common/src/tools/params/tool/read-subtree.ts +0 -83
  803. package/common/src/tools/params/tool/read-url.ts +0 -81
  804. package/common/src/tools/params/tool/render-ui.ts +0 -203
  805. package/common/src/tools/params/tool/run-file-change-hooks.ts +0 -57
  806. package/common/src/tools/params/tool/run-readonly-command.ts +0 -76
  807. package/common/src/tools/params/tool/run-terminal-command.ts +0 -185
  808. package/common/src/tools/params/tool/sequential-thinking.ts +0 -110
  809. package/common/src/tools/params/tool/set-messages.ts +0 -42
  810. package/common/src/tools/params/tool/set-output.ts +0 -62
  811. package/common/src/tools/params/tool/set-scaffold-complete.ts +0 -51
  812. package/common/src/tools/params/tool/skill.ts +0 -56
  813. package/common/src/tools/params/tool/spawn-agent-inline.ts +0 -57
  814. package/common/src/tools/params/tool/spawn-agents.ts +0 -154
  815. package/common/src/tools/params/tool/str-replace.ts +0 -107
  816. package/common/src/tools/params/tool/suggest-followups.ts +0 -94
  817. package/common/src/tools/params/tool/task-completed.ts +0 -58
  818. package/common/src/tools/params/tool/think-deeply.ts +0 -53
  819. package/common/src/tools/params/tool/transition-phase.ts +0 -57
  820. package/common/src/tools/params/tool/update-subgoal.ts +0 -89
  821. package/common/src/tools/params/tool/web-search.ts +0 -73
  822. package/common/src/tools/params/tool/write-file.ts +0 -71
  823. package/common/src/tools/params/tool/write-todos.ts +0 -67
  824. package/common/src/tools/params/utils.ts +0 -152
  825. package/common/src/tools/safety-registry.ts +0 -274
  826. package/common/src/tools/safety.ts +0 -42
  827. package/common/src/tools/sequential-thinking.ts +0 -340
  828. package/common/src/tools/utils.ts +0 -25
  829. package/common/src/types/__tests__/dynamic-agent-template.test.ts +0 -20
  830. package/common/src/types/agent-template.ts +0 -223
  831. package/common/src/types/api/agents/publish.ts +0 -63
  832. package/common/src/types/contracts/agent-runtime.ts +0 -84
  833. package/common/src/types/contracts/analytics.ts +0 -12
  834. package/common/src/types/contracts/bigquery.ts +0 -55
  835. package/common/src/types/contracts/billing.ts +0 -46
  836. package/common/src/types/contracts/client.ts +0 -52
  837. package/common/src/types/contracts/database.ts +0 -104
  838. package/common/src/types/contracts/env.ts +0 -203
  839. package/common/src/types/contracts/llm.ts +0 -183
  840. package/common/src/types/contracts/logger.ts +0 -29
  841. package/common/src/types/contracts/logs.ts +0 -34
  842. package/common/src/types/contracts/trace.ts +0 -21
  843. package/common/src/types/dynamic-agent-template.ts +0 -290
  844. package/common/src/types/filesystem.ts +0 -10
  845. package/common/src/types/function-params.ts +0 -35
  846. package/common/src/types/grant.ts +0 -20
  847. package/common/src/types/gravity-index.ts +0 -170
  848. package/common/src/types/json.ts +0 -26
  849. package/common/src/types/mcp.ts +0 -26
  850. package/common/src/types/messages/content-part.ts +0 -59
  851. package/common/src/types/messages/data-content.ts +0 -14
  852. package/common/src/types/messages/provider-metadata.ts +0 -10
  853. package/common/src/types/messages/savant-code-message.ts +0 -55
  854. package/common/src/types/organization.ts +0 -118
  855. package/common/src/types/print-mode.ts +0 -167
  856. package/common/src/types/publisher.ts +0 -67
  857. package/common/src/types/savant-free-session.ts +0 -295
  858. package/common/src/types/savant-free-streak.ts +0 -6
  859. package/common/src/types/session-state.ts +0 -237
  860. package/common/src/types/skill.ts +0 -56
  861. package/common/src/types/source.ts +0 -11
  862. package/common/src/types/spawn.ts +0 -13
  863. package/common/src/types/subscription.ts +0 -68
  864. package/common/src/types/usage.ts +0 -16
  865. package/common/src/types/util.ts +0 -3
  866. package/common/src/util/__tests__/analytics-dispatcher.test.ts +0 -145
  867. package/common/src/util/__tests__/analytics-log.test.ts +0 -110
  868. package/common/src/util/__tests__/analytics-sampling.test.ts +0 -131
  869. package/common/src/util/__tests__/axiom-only-log.test.ts +0 -64
  870. package/common/src/util/__tests__/engagement-tracker.test.ts +0 -115
  871. package/common/src/util/__tests__/error-abort.test.ts +0 -822
  872. package/common/src/util/__tests__/error-api-details.test.ts +0 -190
  873. package/common/src/util/__tests__/format-code-search.test.ts +0 -60
  874. package/common/src/util/__tests__/log-mirror.test.ts +0 -31
  875. package/common/src/util/__tests__/messages.test.ts +0 -1118
  876. package/common/src/util/__tests__/partial-json-delta.test.ts +0 -505
  877. package/common/src/util/__tests__/paths.test.ts +0 -289
  878. package/common/src/util/__tests__/promise.test.ts +0 -334
  879. package/common/src/util/__tests__/protocol-config.test.ts +0 -119
  880. package/common/src/util/__tests__/rate-limit.test.ts +0 -28
  881. package/common/src/util/__tests__/reddit-savant-free-retention.test.ts +0 -120
  882. package/common/src/util/__tests__/savant-free-streak.test.ts +0 -142
  883. package/common/src/util/__tests__/saxy.test.ts +0 -1008
  884. package/common/src/util/__tests__/string.test.ts +0 -238
  885. package/common/src/util/__tests__/zoned-time.test.ts +0 -88
  886. package/common/src/util/agent-file-utils.ts +0 -110
  887. package/common/src/util/agent-id-parsing.ts +0 -147
  888. package/common/src/util/agent-name-normalization.ts +0 -39
  889. package/common/src/util/analytics-dispatcher.ts +0 -81
  890. package/common/src/util/analytics-log.ts +0 -84
  891. package/common/src/util/analytics-sampling.ts +0 -225
  892. package/common/src/util/array.ts +0 -63
  893. package/common/src/util/axiom-only-log.ts +0 -79
  894. package/common/src/util/cache-debug.ts +0 -191
  895. package/common/src/util/credentials.ts +0 -12
  896. package/common/src/util/currency.ts +0 -25
  897. package/common/src/util/dates.ts +0 -81
  898. package/common/src/util/engagement-tracker.ts +0 -133
  899. package/common/src/util/error.ts +0 -580
  900. package/common/src/util/file.ts +0 -363
  901. package/common/src/util/format-code-search.ts +0 -115
  902. package/common/src/util/lazy-response-ads.ts +0 -93
  903. package/common/src/util/log-data.ts +0 -57
  904. package/common/src/util/log-mirror.ts +0 -34
  905. package/common/src/util/lru-cache.ts +0 -67
  906. package/common/src/util/messages.ts +0 -600
  907. package/common/src/util/model-utils.ts +0 -25
  908. package/common/src/util/object.ts +0 -137
  909. package/common/src/util/param-helpers.ts +0 -49
  910. package/common/src/util/partial-json-delta.ts +0 -100
  911. package/common/src/util/paths.ts +0 -194
  912. package/common/src/util/promise.ts +0 -87
  913. package/common/src/util/protocol-config.ts +0 -141
  914. package/common/src/util/random.ts +0 -15
  915. package/common/src/util/rate-limit.ts +0 -56
  916. package/common/src/util/reddit-capi-events.ts +0 -40
  917. package/common/src/util/reddit-savant-free-retention.ts +0 -69
  918. package/common/src/util/response-ad-positions.ts +0 -54
  919. package/common/src/util/savant-free-privacy.ts +0 -78
  920. package/common/src/util/savant-free-streak.ts +0 -153
  921. package/common/src/util/saxy.ts +0 -739
  922. package/common/src/util/skills.ts +0 -32
  923. package/common/src/util/stop-sequence.ts +0 -60
  924. package/common/src/util/string.ts +0 -419
  925. package/common/src/util/system-info.ts +0 -51
  926. package/common/src/util/type-narrowing.ts +0 -125
  927. package/common/src/util/xml.ts +0 -17
  928. package/common/src/util/zod-schema.ts +0 -80
  929. package/common/src/util/zoned-time.ts +0 -136
  930. package/common/src/utils/ask-user-bridge.ts +0 -47
  931. package/common/tsconfig.json +0 -8
  932. package/database.db +0 -0
  933. package/dev/LEARNINGS.md +0 -309
  934. package/dev/fids/.gitkeep +0 -0
  935. package/dev/fids/archive/.gitkeep +0 -0
  936. package/dev/fids/archive/FID-2026-0802-008-sdk-package-audit-client-run-run-state.md +0 -238
  937. package/dev/fids/archive/FID-2026-0803-001-echo-enforcement-layer-drift.md +0 -404
  938. package/dev/fids/archive/FID-2026-0803-002-llm-providers-database-audit.md +0 -348
  939. package/dev/fids/archive/FID-2026-0803-003-sdk-impl-common-util-audit.md +0 -277
  940. package/dev/fids/archive/FID-2026-0803-004-checkpoint-rewind.md +0 -181
  941. package/dev/fids/archive/FID-2026-0803-005-quality-scan-hygiene-fixes.md +0 -265
  942. package/dev/fids/archive/FID-2026-0803-006-code-map-audit-hygiene.md +0 -243
  943. package/dev/fids/archive/FID-2026-0803-007-evals-benchmark-audit-hygiene.md +0 -296
  944. package/dev/fids/archive/FID-2026-0803-009-echo-enforcement-doc-drift.md +0 -112
  945. package/dev/fids/archive/FID-2026-0803-010-database-llm-providers-low-fixes.md +0 -255
  946. package/dev/fids/archive/FID-2026-0803-011-build-artifact-hygiene.md +0 -169
  947. package/dev/fids/archive/FID-2026-0803-012-release-readiness-audit.md +0 -162
  948. package/dev/fids/archive/FID-2026-0803-013-agent-roster-over-reporting.md +0 -146
  949. package/dev/fids/archive/FID-2026-0803-014-freebuff-to-savant-rebrand-sweep.md +0 -185
  950. package/dev/nova/reports/2026-08-02-top-25-ai-inference-providers-competitive-intel.md +0 -213
  951. package/dev/nova/specs/echo-v0.1.2-freebuff.md +0 -391
  952. package/dev/nova/specs/goal-loop-feature-spec.md +0 -245
  953. package/dev/nova/specs/launch-strategy-research-prompt.md +0 -88
  954. package/dev/releases/README.md +0 -50
  955. package/dev/scratchpad/.gitkeep +0 -0
  956. package/dev/session-summaries/.gitkeep +0 -0
  957. package/dev/session-summaries/2026-07-16-1255.md +0 -128
  958. package/dev/session-summaries/2026-07-17-1000.md +0 -64
  959. package/dev/session-summaries/2026-07-19-eslint-zero-tolerance-cleanup.md +0 -145
  960. package/dev/session-summaries/2026-07-19-fid-026-debugging-and-rename.md +0 -79
  961. package/dev/session-summaries/2026-07-19-fid-026-phase-b-rebrand.md +0 -76
  962. package/dev/session-summaries/2026-07-19-fid-027-clean-break.md +0 -47
  963. package/dev/session-summaries/2026-07-19-pre-push-house-cleaning.md +0 -100
  964. package/dev/session-summaries/2026-07-19-v0.0.2-release-session.md +0 -229
  965. package/dev/session-summaries/2026-07-20-1805-fid-loop-closure.md +0 -95
  966. package/dev/session-summaries/2026-07-22-1800.md +0 -52
  967. package/dev/session-summaries/2026-07-23-fsm-optimization.md +0 -88
  968. package/dev/session-summaries/2026-07-25-0000.md +0 -80
  969. package/dev/session-summaries/2026-07-25-1200-context-compaction.md +0 -154
  970. package/dev/session-summaries/2026-07-25-1600-layer4-reactive-compact.md +0 -96
  971. package/dev/session-summaries/2026-07-25-1700-dev-folder-audit.md +0 -161
  972. package/dev/session-summaries/2026-07-25-2000-benchmark-v2-filters.md +0 -147
  973. package/dev/session-summaries/2026-07-25-2000.md +0 -77
  974. package/dev/session-summaries/2026-07-27-0000.md +0 -63
  975. package/dev/session-summaries/2026-07-28-history-capture-handoff.md +0 -206
  976. package/dev/session-summaries/2026-07-31-freebuff-echo-compliance-remediation.md +0 -156
  977. package/dev/session-summaries/2026-07-31-pre-launch-optimization-execution.md +0 -46
  978. package/dev/session-summaries/2026-0721-1800.md +0 -44
  979. package/dev/session-summaries/2026-08-01-sidebar-folded-startup.md +0 -159
  980. package/dev/session-summaries/2026-08-02-0.0.15-release-closeout.md +0 -32
  981. package/dev/session-summaries/2026-08-02-repository-hygiene.md +0 -51
  982. package/dev/session-summaries/2026-08-03-agent-roster-fix-and-ready-check-closeout.md +0 -73
  983. package/dev/session-summaries/2026-08-03-build-artifact-hygiene-closeout.md +0 -40
  984. package/dev/session-summaries/2026-08-03-code-map-audit-closeout.md +0 -44
  985. package/dev/session-summaries/2026-08-03-database-llm-providers-low-fixes-closeout.md +0 -47
  986. package/dev/session-summaries/2026-08-03-echo-enforcement-doc-drift-closeout.md +0 -43
  987. package/dev/session-summaries/2026-08-03-evals-benchmark-audit-closeout.md +0 -50
  988. package/dev/session-summaries/2026-08-03-quality-scan-hygiene-fixes-closeout.md +0 -57
  989. package/dev/session-summaries/2026-08-03-quality-session-checkpoint-rewind-closeout.md +0 -56
  990. package/dev/session-summaries/2026-08-03-release-readiness-audit-closeout.md +0 -60
  991. package/dev/test-prompts/archive/0.0.2-final-pass.md +0 -209
  992. package/dev/test-prompts/archive/agent-capabilities-full-test.md +0 -361
  993. package/dev/test-prompts/archive/agent-capabilities-test.md +0 -471
  994. package/dev/test-prompts/archive/comprehensive-az-system-test-v1.md +0 -441
  995. package/dev/test-prompts/archive/comprehensive-az-system-test-v2-report.md +0 -377
  996. package/dev/test-prompts/archive/comprehensive-az-system-test-v2.md +0 -544
  997. package/dev/test-prompts/archive/comprehensive-az-system-test.md +0 -396
  998. package/dev/test-prompts/archive/comprehensive-az-test-final.md +0 -900
  999. package/dev/test-prompts/archive/comprehensive-az-test-v11.md +0 -141
  1000. package/dev/test-prompts/archive/comprehensive-az-test-v12.md +0 -29
  1001. package/dev/test-prompts/archive/comprehensive-az-test-v6.md +0 -631
  1002. package/dev/test-prompts/archive/comprehensive-az-test-v7.md +0 -625
  1003. package/dev/test-prompts/archive/fid-007-ability-confirmation.md +0 -248
  1004. package/dev/test-prompts/archive/fid-2026-0801-006-thinker-tool-call-boundary.md +0 -86
  1005. package/dev/test-prompts/archive/fid-2026-0801-007-child-tool-set-fallback-cli.md +0 -101
  1006. package/dev/test-prompts/archive/fid-2026-0801-008-provider-tool-call-accumulation-cli.md +0 -111
  1007. package/dev/test-prompts/archive/fid-2026-0801-012-thinker-state-output-cli.md +0 -134
  1008. package/dev/test-prompts/archive/gemini-deep-research-sidebar-highlight.md +0 -598
  1009. package/dev/test-prompts/archive/goal-loop-cli-test.md +0 -142
  1010. package/dev/test-prompts/archive/rebrand-qa.md +0 -258
  1011. package/dev/test-prompts/archive/release-az-test-fid-085.md +0 -306
  1012. package/dev/test-prompts/archive/release-az-test-fid-087.md +0 -219
  1013. package/dev/test-prompts/archive/release-az-test-fid-2026-0726-001.md +0 -270
  1014. package/dev/test-prompts/archive/release-az-test-fid-2026-0728-008.md +0 -213
  1015. package/dev/test-prompts/archive/release-az-test-fid-2026-0728-launch-tracks.md +0 -253
  1016. package/dev/test-prompts/archive/release-az-test-fid-2026-0731-pre-launch.md +0 -102
  1017. package/docs/AI Coding Agents Market Research.md +0 -516
  1018. package/docs/Agent Harness Feature Pairing Research.md +0 -166
  1019. package/docs/CLI Agent Inference Backend Research.md +0 -446
  1020. package/docs/Codebuff Rebranding And Migration Plan.md +0 -418
  1021. package/docs/ECHO-EVOLUTION-ARCH.md +0 -77
  1022. package/docs/Harness Engineering for Coding Agents Research.md +0 -196
  1023. package/docs/Launch Plan Review and Optimization.md +0 -178
  1024. package/docs/OpenTUI Sidebar Bug Fix.md +0 -245
  1025. package/docs/SAVANT-VERSIONING.md +0 -31
  1026. package/docs/Savant Code Launch Strategy.md +0 -270
  1027. package/docs/Savant-Code Business And Backend Research.md +0 -222
  1028. package/docs/agents-and-tools.md +0 -217
  1029. package/docs/cloudflare-llms-full.md +0 -9623
  1030. package/docs/design/OpenTUI Terminal Visualization Guide.md +0 -471
  1031. package/docs/design/database-architecture.md +0 -217
  1032. package/docs/design/deep-research-report.md +0 -295
  1033. package/docs/design/thinker-sequentialthinking-regression-diagnostic.md +0 -366
  1034. package/docs/discord-server-design.md +0 -167
  1035. package/docs/gravity-integration-starter.md +0 -202
  1036. package/docs/launch/hn-first-comment.md +0 -44
  1037. package/docs/launch/hn-post.md +0 -35
  1038. package/docs/launch/incident-response.md +0 -88
  1039. package/docs/launch/landing/index.html +0 -233
  1040. package/docs/launch/mastodon-thread.md +0 -52
  1041. package/docs/launch/newsletter-pitch.md +0 -49
  1042. package/docs/launch/twitter-thread.md +0 -62
  1043. package/docs/privacy.md +0 -186
  1044. package/docs/reports/Savant-Code Benchmark Specification.md +0 -206
  1045. package/docs/reports/Thinker Agent Architecture Research.md +0 -284
  1046. package/docs/reports/adoptable-features-2026-07-25.md +0 -604
  1047. package/docs/reports/adoptable-features-master.md +0 -480
  1048. package/docs/reports/codebuff-discord-feedback.md +0 -43
  1049. package/docs/reports/feature-parity-report.md +0 -810
  1050. package/docs/reports/repos/AionUi.md +0 -75
  1051. package/docs/reports/repos/OpenHands.md +0 -76
  1052. package/docs/reports/repos/SWE-agent.md +0 -82
  1053. package/docs/reports/repos/agno.md +0 -89
  1054. package/docs/reports/repos/aider.md +0 -74
  1055. package/docs/reports/repos/cline.md +0 -83
  1056. package/docs/reports/repos/codex.md +0 -83
  1057. package/docs/reports/repos/gemini-cli.md +0 -92
  1058. package/docs/reports/repos/goose.md +0 -65
  1059. package/docs/reports/repos/gpt-pilot.md +0 -52
  1060. package/docs/reports/repos/hermes-agent.md +0 -101
  1061. package/docs/reports/repos/kilocode.md +0 -79
  1062. package/docs/reports/repos/openclaude.md +0 -99
  1063. package/docs/reports/repos/openclaw.md +0 -100
  1064. package/docs/reports/repos/opencode-dev.md +0 -78
  1065. package/docs/reports/repos/zero.md +0 -123
  1066. package/docs/reports/savant-code-benchmark-v2-2026-08-03.md +0 -76
  1067. package/docs/savant-code-modes.md +0 -338
  1068. package/docs/testing.md +0 -51
  1069. package/docs/visual-mockup-neon-slate.txt +0 -41
  1070. package/eslint.config.js +0 -211
  1071. package/evals/README.md +0 -45
  1072. package/evals/benchmark/README.md +0 -449
  1073. package/evals/benchmark/agent-runner.ts +0 -217
  1074. package/evals/benchmark/analyze-task-scores.ts +0 -496
  1075. package/evals/benchmark/eval-codebuff-hard.json +0 -3343
  1076. package/evals/benchmark/eval-codebuff.json +0 -3193
  1077. package/evals/benchmark/eval-codebuff2.json +0 -2494
  1078. package/evals/benchmark/eval-manifold-hard.json +0 -2525
  1079. package/evals/benchmark/eval-manifold.json +0 -1675
  1080. package/evals/benchmark/eval-manifold2.json +0 -1945
  1081. package/evals/benchmark/eval-plane-hard.json +0 -4372
  1082. package/evals/benchmark/eval-plane.json +0 -2028
  1083. package/evals/benchmark/eval-plane2.json +0 -3517
  1084. package/evals/benchmark/eval-saleor-hard.json +0 -6081
  1085. package/evals/benchmark/eval-saleor.json +0 -1829
  1086. package/evals/benchmark/eval-saleor2.json +0 -3273
  1087. package/evals/benchmark/eval-task-generator.ts +0 -158
  1088. package/evals/benchmark/filter-supplemental-files.ts +0 -225
  1089. package/evals/benchmark/format-output.ts +0 -215
  1090. package/evals/benchmark/gen-evals.ts +0 -294
  1091. package/evals/benchmark/gen-repo-eval.ts +0 -71
  1092. package/evals/benchmark/judge.ts +0 -308
  1093. package/evals/benchmark/lessons-extractor.ts +0 -247
  1094. package/evals/benchmark/main-hard-tasks.ts +0 -49
  1095. package/evals/benchmark/main-single-eval.ts +0 -23
  1096. package/evals/benchmark/main.ts +0 -29
  1097. package/evals/benchmark/meta-analyzer.ts +0 -329
  1098. package/evals/benchmark/pick-commits.ts +0 -627
  1099. package/evals/benchmark/run-benchmark.ts +0 -657
  1100. package/evals/benchmark/runners/claude.ts +0 -176
  1101. package/evals/benchmark/runners/codex.ts +0 -143
  1102. package/evals/benchmark/runners/index.ts +0 -4
  1103. package/evals/benchmark/runners/opencode.ts +0 -253
  1104. package/evals/benchmark/runners/runner.ts +0 -13
  1105. package/evals/benchmark/runners/savant.ts +0 -148
  1106. package/evals/benchmark/setup-test-repo.ts +0 -314
  1107. package/evals/benchmark/trace-analyzer.ts +0 -257
  1108. package/evals/benchmark/trace-utils.ts +0 -80
  1109. package/evals/benchmark/types.ts +0 -83
  1110. package/evals/bunfig.toml +0 -4
  1111. package/evals/logger.ts +0 -87
  1112. package/evals/package.json +0 -31
  1113. package/evals/subagents/test-repo-utils.ts +0 -131
  1114. package/evals/tsconfig.json +0 -13
  1115. package/evals/v2/README.md +0 -149
  1116. package/evals/v2/reports/report.json +0 -261
  1117. package/evals/v2/reports/report.md +0 -15
  1118. package/evals/v2/schema/task.schema.json +0 -172
  1119. package/evals/v2/src/cli.ts +0 -216
  1120. package/evals/v2/src/golden.ts +0 -73
  1121. package/evals/v2/src/harness.ts +0 -293
  1122. package/evals/v2/src/metrics.ts +0 -326
  1123. package/evals/v2/src/registry.ts +0 -179
  1124. package/evals/v2/src/reports.ts +0 -126
  1125. package/evals/v2/src/runner.ts +0 -143
  1126. package/evals/v2/src/runners/savant.ts +0 -105
  1127. package/evals/v2/src/sandbox.ts +0 -42
  1128. package/evals/v2/src/sandboxes/docker.ts +0 -49
  1129. package/evals/v2/src/sandboxes/tempdir.ts +0 -120
  1130. package/evals/v2/src/schema.ts +0 -83
  1131. package/evals/v2/src/trace.ts +0 -186
  1132. package/evals/v2/src/verify.ts +0 -199
  1133. package/evals/v2/tasks/error_recovery/env-fault/calculator.js +0 -11
  1134. package/evals/v2/tasks/error_recovery/env-fault/calculator.test.js +0 -15
  1135. package/evals/v2/tasks/error_recovery/env-fault/golden.patch +0 -15
  1136. package/evals/v2/tasks/error_recovery/env-fault/task.yaml +0 -20
  1137. package/evals/v2/tasks/multi_agent_orchestration/options-contract/app.js +0 -5
  1138. package/evals/v2/tasks/multi_agent_orchestration/options-contract/app.test.js +0 -7
  1139. package/evals/v2/tasks/multi_agent_orchestration/options-contract/golden.patch +0 -19
  1140. package/evals/v2/tasks/multi_agent_orchestration/options-contract/greet.js +0 -3
  1141. package/evals/v2/tasks/multi_agent_orchestration/options-contract/orchestration.test.js +0 -30
  1142. package/evals/v2/tasks/multi_agent_orchestration/options-contract/task.yaml +0 -29
  1143. package/evals/v2/tasks/pure_coding/add-fix/add.js +0 -3
  1144. package/evals/v2/tasks/pure_coding/add-fix/add.test.js +0 -11
  1145. package/evals/v2/tasks/pure_coding/add-fix/golden.patch +0 -7
  1146. package/evals/v2/tasks/pure_coding/add-fix/task.yaml +0 -20
  1147. package/evals/v2/tasks/pure_coding/rename-greet/app.js +0 -5
  1148. package/evals/v2/tasks/pure_coding/rename-greet/app.test.js +0 -32
  1149. package/evals/v2/tasks/pure_coding/rename-greet/golden.patch +0 -19
  1150. package/evals/v2/tasks/pure_coding/rename-greet/greet.js +0 -5
  1151. package/evals/v2/tasks/pure_coding/rename-greet/task.yaml +0 -21
  1152. package/evals/v2/tests/golden.test.ts +0 -104
  1153. package/evals/v2/tests/harness.test.ts +0 -204
  1154. package/evals/v2/tests/metrics.test.ts +0 -353
  1155. package/evals/v2/tests/registry.test.ts +0 -210
  1156. package/evals/v2/tests/reports.test.ts +0 -218
  1157. package/evals/v2/tests/savant-runner.test.ts +0 -218
  1158. package/evals/v2/tests/schema.test.ts +0 -127
  1159. package/evals/v2/tests/tempdir-sandbox.test.ts +0 -49
  1160. package/evals/v2/tests/trace.test.ts +0 -76
  1161. package/evals/v2/tests/verify.test.ts +0 -224
  1162. package/license +0 -202
  1163. package/packages/agent-runtime/README.md +0 -46
  1164. package/packages/agent-runtime/agent_exit +0 -1
  1165. package/packages/agent-runtime/bunfig.toml +0 -2
  1166. package/packages/agent-runtime/package.json +0 -34
  1167. package/packages/agent-runtime/src/__tests__/apply-patch-tool.test.ts +0 -202
  1168. package/packages/agent-runtime/src/__tests__/cost-aggregation.test.ts +0 -397
  1169. package/packages/agent-runtime/src/__tests__/generate-diffs-prompt.test.ts +0 -107
  1170. package/packages/agent-runtime/src/__tests__/get-file-reading-updates.test.ts +0 -59
  1171. package/packages/agent-runtime/src/__tests__/gravity-index-tool.test.ts +0 -501
  1172. package/packages/agent-runtime/src/__tests__/loop-agent-steps.test.ts +0 -1512
  1173. package/packages/agent-runtime/src/__tests__/main-prompt.test.ts +0 -452
  1174. package/packages/agent-runtime/src/__tests__/n-parameter.test.ts +0 -984
  1175. package/packages/agent-runtime/src/__tests__/process-file-block.test.ts +0 -196
  1176. package/packages/agent-runtime/src/__tests__/process-str-replace.test.ts +0 -512
  1177. package/packages/agent-runtime/src/__tests__/programmatic-tool-authorization.test.ts +0 -219
  1178. package/packages/agent-runtime/src/__tests__/prompt-caching-subagents.test.ts +0 -749
  1179. package/packages/agent-runtime/src/__tests__/prompts-schema-handling.test.ts +0 -454
  1180. package/packages/agent-runtime/src/__tests__/propose-tools.test.ts +0 -824
  1181. package/packages/agent-runtime/src/__tests__/read-docs-tool.test.ts +0 -394
  1182. package/packages/agent-runtime/src/__tests__/run-agent-step-prefill.test.ts +0 -161
  1183. package/packages/agent-runtime/src/__tests__/run-agent-step-tools.test.ts +0 -612
  1184. package/packages/agent-runtime/src/__tests__/run-programmatic-step.test.ts +0 -1743
  1185. package/packages/agent-runtime/src/__tests__/sandbox-generator.test.ts +0 -154
  1186. package/packages/agent-runtime/src/__tests__/spawn-agents-image-content.test.ts +0 -354
  1187. package/packages/agent-runtime/src/__tests__/spawn-agents-message-history.test.ts +0 -280
  1188. package/packages/agent-runtime/src/__tests__/spawn-agents-permissions.test.ts +0 -664
  1189. package/packages/agent-runtime/src/__tests__/stream-parser-abort.test.ts +0 -250
  1190. package/packages/agent-runtime/src/__tests__/stream-parser-reasoning.test.ts +0 -194
  1191. package/packages/agent-runtime/src/__tests__/subagent-streaming.test.ts +0 -230
  1192. package/packages/agent-runtime/src/__tests__/test-utils.ts +0 -96
  1193. package/packages/agent-runtime/src/__tests__/thinker-convergence-gate.test.ts +0 -242
  1194. package/packages/agent-runtime/src/__tests__/to-token-count-input-schema.test.ts +0 -81
  1195. package/packages/agent-runtime/src/__tests__/tool-executor-sandbox.test.ts +0 -167
  1196. package/packages/agent-runtime/src/__tests__/tool-stream-parser.test.ts +0 -682
  1197. package/packages/agent-runtime/src/__tests__/tool-validation-error.test.ts +0 -1380
  1198. package/packages/agent-runtime/src/__tests__/web-search-tool.test.ts +0 -402
  1199. package/packages/agent-runtime/src/__tests__/xml-tool-result-ordering.test.ts +0 -264
  1200. package/packages/agent-runtime/src/constants.ts +0 -12
  1201. package/packages/agent-runtime/src/context-compactor.ts +0 -425
  1202. package/packages/agent-runtime/src/find-files/__tests__/request-files-prompt.test.ts +0 -190
  1203. package/packages/agent-runtime/src/find-files/custom-file-picker-config.ts +0 -61
  1204. package/packages/agent-runtime/src/find-files/request-files-prompt.ts +0 -462
  1205. package/packages/agent-runtime/src/generate-diffs-prompt.ts +0 -38
  1206. package/packages/agent-runtime/src/get-file-reading-updates.ts +0 -27
  1207. package/packages/agent-runtime/src/llm-api/__tests__/gemini-with-fallbacks.test.ts +0 -267
  1208. package/packages/agent-runtime/src/llm-api/__tests__/serper-api.test.ts +0 -297
  1209. package/packages/agent-runtime/src/llm-api/claude.ts +0 -7
  1210. package/packages/agent-runtime/src/llm-api/context7-api.ts +0 -290
  1211. package/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.ts +0 -104
  1212. package/packages/agent-runtime/src/llm-api/savant-code-web-api.ts +0 -370
  1213. package/packages/agent-runtime/src/llm-api/serper-api.ts +0 -193
  1214. package/packages/agent-runtime/src/main-prompt.ts +0 -251
  1215. package/packages/agent-runtime/src/mcp-constants.ts +0 -12
  1216. package/packages/agent-runtime/src/mcp.ts +0 -83
  1217. package/packages/agent-runtime/src/process-file-block.ts +0 -118
  1218. package/packages/agent-runtime/src/process-str-replace.ts +0 -213
  1219. package/packages/agent-runtime/src/prompt-agent-stream.ts +0 -119
  1220. package/packages/agent-runtime/src/run-agent-step.ts +0 -1632
  1221. package/packages/agent-runtime/src/run-programmatic-step.ts +0 -633
  1222. package/packages/agent-runtime/src/system-prompt/prompts.ts +0 -215
  1223. package/packages/agent-runtime/src/system-prompt/search-system-prompt.ts +0 -89
  1224. package/packages/agent-runtime/src/system-prompt/truncate-file-tree.ts +0 -414
  1225. package/packages/agent-runtime/src/templates/README.md +0 -160
  1226. package/packages/agent-runtime/src/templates/__tests__/agent-registry.test.ts +0 -489
  1227. package/packages/agent-runtime/src/templates/__tests__/strings.test.ts +0 -465
  1228. package/packages/agent-runtime/src/templates/agent-registry.ts +0 -122
  1229. package/packages/agent-runtime/src/templates/prompts.ts +0 -189
  1230. package/packages/agent-runtime/src/templates/strings.ts +0 -292
  1231. package/packages/agent-runtime/src/templates/types.ts +0 -61
  1232. package/packages/agent-runtime/src/tool-stream-parser.ts +0 -260
  1233. package/packages/agent-runtime/src/tools/filter-tool-set.ts +0 -18
  1234. package/packages/agent-runtime/src/tools/handlers/__tests__/glob.test.ts +0 -331
  1235. package/packages/agent-runtime/src/tools/handlers/__tests__/read-subtree.test.ts +0 -346
  1236. package/packages/agent-runtime/src/tools/handlers/__tests__/run-readonly-command.test.ts +0 -284
  1237. package/packages/agent-runtime/src/tools/handlers/handler-function-type.ts +0 -77
  1238. package/packages/agent-runtime/src/tools/handlers/list.ts +0 -105
  1239. package/packages/agent-runtime/src/tools/handlers/tool/__tests__/checkpoint-store.test.ts +0 -394
  1240. package/packages/agent-runtime/src/tools/handlers/tool/__tests__/skill.test.ts +0 -98
  1241. package/packages/agent-runtime/src/tools/handlers/tool/__tests__/write-file.test.ts +0 -24
  1242. package/packages/agent-runtime/src/tools/handlers/tool/add-message.ts +0 -37
  1243. package/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.ts +0 -30
  1244. package/packages/agent-runtime/src/tools/handlers/tool/apply-patch.ts +0 -120
  1245. package/packages/agent-runtime/src/tools/handlers/tool/ask-user.ts +0 -25
  1246. package/packages/agent-runtime/src/tools/handlers/tool/browser-logs.ts +0 -21
  1247. package/packages/agent-runtime/src/tools/handlers/tool/checkpoint-store.ts +0 -378
  1248. package/packages/agent-runtime/src/tools/handlers/tool/code-search.ts +0 -21
  1249. package/packages/agent-runtime/src/tools/handlers/tool/composio.ts +0 -52
  1250. package/packages/agent-runtime/src/tools/handlers/tool/create-plan.ts +0 -63
  1251. package/packages/agent-runtime/src/tools/handlers/tool/end-turn.ts +0 -15
  1252. package/packages/agent-runtime/src/tools/handlers/tool/find-files.ts +0 -161
  1253. package/packages/agent-runtime/src/tools/handlers/tool/glob.ts +0 -22
  1254. package/packages/agent-runtime/src/tools/handlers/tool/gravity-index.ts +0 -230
  1255. package/packages/agent-runtime/src/tools/handlers/tool/list-directory.ts +0 -22
  1256. package/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.ts +0 -105
  1257. package/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.ts +0 -111
  1258. package/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.ts +0 -89
  1259. package/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.ts +0 -64
  1260. package/packages/agent-runtime/src/tools/handlers/tool/read-docs.ts +0 -160
  1261. package/packages/agent-runtime/src/tools/handlers/tool/read-files.ts +0 -43
  1262. package/packages/agent-runtime/src/tools/handlers/tool/read-subtree.ts +0 -198
  1263. package/packages/agent-runtime/src/tools/handlers/tool/read-url.ts +0 -21
  1264. package/packages/agent-runtime/src/tools/handlers/tool/render-ui.ts +0 -15
  1265. package/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.ts +0 -20
  1266. package/packages/agent-runtime/src/tools/handlers/tool/run-readonly-command.ts +0 -215
  1267. package/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.ts +0 -33
  1268. package/packages/agent-runtime/src/tools/handlers/tool/sequential-thinking.ts +0 -53
  1269. package/packages/agent-runtime/src/tools/handlers/tool/set-messages.ts +0 -19
  1270. package/packages/agent-runtime/src/tools/handlers/tool/set-output.ts +0 -104
  1271. package/packages/agent-runtime/src/tools/handlers/tool/set-scaffold-complete.ts +0 -32
  1272. package/packages/agent-runtime/src/tools/handlers/tool/skill.ts +0 -146
  1273. package/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.ts +0 -149
  1274. package/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.ts +0 -436
  1275. package/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.ts +0 -286
  1276. package/packages/agent-runtime/src/tools/handlers/tool/str-replace.ts +0 -135
  1277. package/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.ts +0 -20
  1278. package/packages/agent-runtime/src/tools/handlers/tool/task-completed.ts +0 -15
  1279. package/packages/agent-runtime/src/tools/handlers/tool/think-deeply.ts +0 -25
  1280. package/packages/agent-runtime/src/tools/handlers/tool/transition-phase.ts +0 -160
  1281. package/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.ts +0 -48
  1282. package/packages/agent-runtime/src/tools/handlers/tool/web-search.ts +0 -151
  1283. package/packages/agent-runtime/src/tools/handlers/tool/write-file.ts +0 -281
  1284. package/packages/agent-runtime/src/tools/handlers/tool/write-todos.ts +0 -19
  1285. package/packages/agent-runtime/src/tools/prompts.ts +0 -233
  1286. package/packages/agent-runtime/src/tools/sandbox/__tests__/engine.test.ts +0 -169
  1287. package/packages/agent-runtime/src/tools/sandbox/__tests__/shell-denylist.test.ts +0 -104
  1288. package/packages/agent-runtime/src/tools/sandbox/engine.ts +0 -109
  1289. package/packages/agent-runtime/src/tools/sandbox/index.ts +0 -14
  1290. package/packages/agent-runtime/src/tools/sandbox/shell-denylist.ts +0 -119
  1291. package/packages/agent-runtime/src/tools/stream-parser.ts +0 -407
  1292. package/packages/agent-runtime/src/tools/thinker-convergence-gate.ts +0 -162
  1293. package/packages/agent-runtime/src/tools/thought-session-store.ts +0 -43
  1294. package/packages/agent-runtime/src/tools/tool-executor.ts +0 -1098
  1295. package/packages/agent-runtime/src/util/__tests__/messages.test.ts +0 -995
  1296. package/packages/agent-runtime/src/util/__tests__/parse-tool-calls-from-text.test.ts +0 -363
  1297. package/packages/agent-runtime/src/util/__tests__/simplify-tool-results.test.ts +0 -382
  1298. package/packages/agent-runtime/src/util/__tests__/stream-xml-parser.test.ts +0 -285
  1299. package/packages/agent-runtime/src/util/__tests__/think-tags.test.ts +0 -49
  1300. package/packages/agent-runtime/src/util/__tests__/token-counter.test.ts +0 -121
  1301. package/packages/agent-runtime/src/util/activity-tracking.ts +0 -252
  1302. package/packages/agent-runtime/src/util/agent-output.ts +0 -102
  1303. package/packages/agent-runtime/src/util/cache-debug.ts +0 -330
  1304. package/packages/agent-runtime/src/util/format-value.ts +0 -16
  1305. package/packages/agent-runtime/src/util/messages.ts +0 -461
  1306. package/packages/agent-runtime/src/util/parse-tool-calls-from-text.ts +0 -122
  1307. package/packages/agent-runtime/src/util/render-read-files-result.ts +0 -18
  1308. package/packages/agent-runtime/src/util/simplify-tool-results.ts +0 -61
  1309. package/packages/agent-runtime/src/util/stream-xml-parser.ts +0 -259
  1310. package/packages/agent-runtime/src/util/think-tags.ts +0 -33
  1311. package/packages/agent-runtime/src/util/token-counter.ts +0 -136
  1312. package/packages/agent-runtime/tsconfig.json +0 -8
  1313. package/packages/code-map/README.md +0 -43
  1314. package/packages/code-map/__tests__/integration.test.ts +0 -278
  1315. package/packages/code-map/__tests__/languages.test.ts +0 -240
  1316. package/packages/code-map/__tests__/parse.test.ts +0 -640
  1317. package/packages/code-map/__tests__/test-langs/test.c +0 -42
  1318. package/packages/code-map/__tests__/test-langs/test.cpp +0 -34
  1319. package/packages/code-map/__tests__/test-langs/test.cs +0 -34
  1320. package/packages/code-map/__tests__/test-langs/test.go +0 -27
  1321. package/packages/code-map/__tests__/test-langs/test.java +0 -31
  1322. package/packages/code-map/__tests__/test-langs/test.js +0 -50
  1323. package/packages/code-map/__tests__/test-langs/test.php +0 -34
  1324. package/packages/code-map/__tests__/test-langs/test.py +0 -25
  1325. package/packages/code-map/__tests__/test-langs/test.rb +0 -28
  1326. package/packages/code-map/__tests__/test-langs/test.rs +0 -28
  1327. package/packages/code-map/__tests__/test-langs/test.ts +0 -31
  1328. package/packages/code-map/package.json +0 -33
  1329. package/packages/code-map/src/index.ts +0 -4
  1330. package/packages/code-map/src/init-node.ts +0 -185
  1331. package/packages/code-map/src/languages.ts +0 -344
  1332. package/packages/code-map/src/parse.ts +0 -410
  1333. package/packages/code-map/src/tree-sitter-queries/readme.md +0 -24
  1334. package/packages/code-map/src/tree-sitter-queries/tree-sitter-c-tags.scm +0 -16
  1335. package/packages/code-map/src/tree-sitter-queries/tree-sitter-c_sharp-tags.scm +0 -23
  1336. package/packages/code-map/src/tree-sitter-queries/tree-sitter-cpp-tags.scm +0 -29
  1337. package/packages/code-map/src/tree-sitter-queries/tree-sitter-go-tags.scm +0 -26
  1338. package/packages/code-map/src/tree-sitter-queries/tree-sitter-java-tags.scm +0 -19
  1339. package/packages/code-map/src/tree-sitter-queries/tree-sitter-javascript-tags.scm +0 -16
  1340. package/packages/code-map/src/tree-sitter-queries/tree-sitter-php-tags.scm +0 -23
  1341. package/packages/code-map/src/tree-sitter-queries/tree-sitter-python-tags.scm +0 -12
  1342. package/packages/code-map/src/tree-sitter-queries/tree-sitter-ruby-tags.scm +0 -58
  1343. package/packages/code-map/src/tree-sitter-queries/tree-sitter-rust-tags.scm +0 -26
  1344. package/packages/code-map/src/tree-sitter-queries/tree-sitter-typescript-tags.scm +0 -22
  1345. package/packages/code-map/src/types.ts +0 -11
  1346. package/packages/code-map/src/utils.ts +0 -12
  1347. package/packages/code-map/tsconfig.json +0 -10
  1348. package/packages/database/README.md +0 -43
  1349. package/packages/database/package.json +0 -28
  1350. package/packages/database/src/__tests__/service.test.ts +0 -167
  1351. package/packages/database/src/index.ts +0 -146
  1352. package/packages/database/src/service.ts +0 -342
  1353. package/packages/database/tsconfig.json +0 -9
  1354. package/packages/llm-providers/README.md +0 -42
  1355. package/packages/llm-providers/package.json +0 -42
  1356. package/packages/llm-providers/src/ollama/__tests__/detect.test.ts +0 -59
  1357. package/packages/llm-providers/src/ollama/detect.ts +0 -113
  1358. package/packages/llm-providers/src/ollama/index.ts +0 -2
  1359. package/packages/llm-providers/src/openai-compatible/chat/convert-to-openai-compatible-chat-messages.test.ts +0 -855
  1360. package/packages/llm-providers/src/openai-compatible/chat/convert-to-openai-compatible-chat-messages.ts +0 -177
  1361. package/packages/llm-providers/src/openai-compatible/chat/get-response-metadata.ts +0 -15
  1362. package/packages/llm-providers/src/openai-compatible/chat/map-openai-compatible-finish-reason.ts +0 -19
  1363. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-api-types.ts +0 -60
  1364. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-language-model.test.ts +0 -549
  1365. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-language-model.ts +0 -474
  1366. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-options.ts +0 -25
  1367. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-metadata-extractor.ts +0 -49
  1368. package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-prepare-tools.ts +0 -162
  1369. package/packages/llm-providers/src/openai-compatible/chat/stream-transform.test.ts +0 -106
  1370. package/packages/llm-providers/src/openai-compatible/chat/stream-transform.ts +0 -585
  1371. package/packages/llm-providers/src/openai-compatible/completion/convert-to-openai-compatible-completion-prompt.ts +0 -98
  1372. package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-language-model.test.ts +0 -173
  1373. package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-language-model.ts +0 -414
  1374. package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-options.ts +0 -33
  1375. package/packages/llm-providers/src/openai-compatible/embedding/openai-compatible-embedding-model.ts +0 -143
  1376. package/packages/llm-providers/src/openai-compatible/embedding/openai-compatible-embedding-options.ts +0 -21
  1377. package/packages/llm-providers/src/openai-compatible/image/openai-compatible-image-model.ts +0 -129
  1378. package/packages/llm-providers/src/openai-compatible/image/openai-compatible-image-settings.ts +0 -1
  1379. package/packages/llm-providers/src/openai-compatible/index.ts +0 -27
  1380. package/packages/llm-providers/src/openai-compatible/openai-compatible-error.ts +0 -34
  1381. package/packages/llm-providers/src/openai-compatible/openai-compatible-provider.ts +0 -174
  1382. package/packages/llm-providers/src/openai-compatible/version.ts +0 -5
  1383. package/packages/llm-providers/tsconfig.json +0 -9
  1384. package/protocol.config.yaml +0 -113
  1385. package/savant-free/README.md +0 -73
  1386. package/savant-free/SPEC.md +0 -385
  1387. package/savant-free/cli/build.ts +0 -49
  1388. package/savant-free/cli/release/README.md +0 -55
  1389. package/savant-free/cli/release/index.js +0 -37
  1390. package/savant-free/cli/release/package.json +0 -43
  1391. package/savant-free/cli/release.ts +0 -128
  1392. package/savant-free/cli/smoke-test.test.ts +0 -257
  1393. package/savant-free/e2e/README.md +0 -173
  1394. package/savant-free/e2e/agent/savant-free-tester.ts +0 -52
  1395. package/savant-free/e2e/tests/ads-behavior.e2e.test.ts +0 -51
  1396. package/savant-free/e2e/tests/agent-startup.e2e.test.ts +0 -61
  1397. package/savant-free/e2e/tests/code-edit.e2e.test.ts +0 -78
  1398. package/savant-free/e2e/tests/help-command.e2e.test.ts +0 -97
  1399. package/savant-free/e2e/tests/knowledge-file.e2e.test.ts +0 -66
  1400. package/savant-free/e2e/tests/slash-commands.e2e.test.ts +0 -119
  1401. package/savant-free/e2e/tests/startup.e2e.test.ts +0 -56
  1402. package/savant-free/e2e/tests/terminal-command.e2e.test.ts +0 -71
  1403. package/savant-free/e2e/tests/version.e2e.test.ts +0 -50
  1404. package/savant-free/e2e/utils/binary-helpers.ts +0 -24
  1405. package/savant-free/e2e/utils/index.ts +0 -17
  1406. package/savant-free/e2e/utils/savant-free-session.ts +0 -229
  1407. package/savant-free/e2e/utils/tmux-custom-tools.ts +0 -156
  1408. package/savant-free/e2e/utils/tmux-helpers.ts +0 -79
  1409. package/savant-free/package.json +0 -20
  1410. package/scripts/eslint-rules/__fixtures__/debug-ast.mjs +0 -20
  1411. package/scripts/eslint-rules/__fixtures__/probe.mjs +0 -41
  1412. package/scripts/eslint-rules/__fixtures__/probe2.mjs +0 -43
  1413. package/scripts/eslint-rules/__fixtures__/rule-test.mjs +0 -44
  1414. package/scripts/eslint-rules/__fixtures__/rule-test2.mjs +0 -27
  1415. package/scripts/eslint-rules/__fixtures__/unknown-bad.ts +0 -21
  1416. package/scripts/eslint-rules/__fixtures__/unknown-good.ts +0 -35
  1417. package/scripts/eslint-rules/no-unknown-in-signatures.js +0 -141
  1418. package/scripts/release.py +0 -360
  1419. package/scripts/run-az-test.sh +0 -1150
  1420. package/scripts/sync-agents.py +0 -337
  1421. package/scripts/tmux/README.md +0 -359
  1422. package/scripts/tmux/package.json +0 -9
  1423. package/scripts/tmux/tmux-capture.sh +0 -231
  1424. package/scripts/tmux/tmux-cli.sh +0 -160
  1425. package/scripts/tmux/tmux-env.sh +0 -34
  1426. package/scripts/tmux/tmux-send.sh +0 -339
  1427. package/scripts/tmux/tmux-start.sh +0 -264
  1428. package/scripts/tmux/tmux-stop.sh +0 -157
  1429. package/scripts/tmux/tmux-viewer/README.md +0 -254
  1430. package/scripts/tmux/tmux-viewer/components/session-viewer.tsx +0 -556
  1431. package/scripts/tmux/tmux-viewer/components/theme.ts +0 -54
  1432. package/scripts/tmux/tmux-viewer/gif-encoder-2.d.ts +0 -28
  1433. package/scripts/tmux/tmux-viewer/gif-exporter.ts +0 -278
  1434. package/scripts/tmux/tmux-viewer/index.tsx +0 -237
  1435. package/scripts/tmux/tmux-viewer/package.json +0 -9
  1436. package/scripts/tmux/tmux-viewer/session-loader.ts +0 -234
  1437. package/scripts/tmux/tmux-viewer/tsconfig.json +0 -9
  1438. package/scripts/tmux/tmux-viewer/types.ts +0 -76
  1439. package/sdk/CHANGELOG.md +0 -126
  1440. package/sdk/PUBLISHING.md +0 -55
  1441. package/sdk/README.md +0 -334
  1442. package/sdk/bunfig.toml +0 -6
  1443. package/sdk/e2e/README.md +0 -158
  1444. package/sdk/e2e/custom-agents/api-integration-agent.e2e.test.ts +0 -145
  1445. package/sdk/e2e/custom-agents/apply-patch-tool.e2e.test.ts +0 -62
  1446. package/sdk/e2e/custom-agents/database-query-agent.e2e.test.ts +0 -135
  1447. package/sdk/e2e/custom-agents/weather-agent.e2e.test.ts +0 -120
  1448. package/sdk/e2e/examples/code-explainer.example.ts +0 -62
  1449. package/sdk/e2e/examples/code-reviewer.example.ts +0 -52
  1450. package/sdk/e2e/examples/commit-message-generator.example.ts +0 -61
  1451. package/sdk/e2e/examples/sdk-lint.example.ts +0 -65
  1452. package/sdk/e2e/examples/sdk-refactor.example.ts +0 -63
  1453. package/sdk/e2e/examples/sdk-test-gen.example.ts +0 -62
  1454. package/sdk/e2e/features/knowledge-files.e2e.test.ts +0 -82
  1455. package/sdk/e2e/features/max-agent-steps.e2e.test.ts +0 -65
  1456. package/sdk/e2e/features/project-files.e2e.test.ts +0 -80
  1457. package/sdk/e2e/integration/connection-check.integration.test.ts +0 -33
  1458. package/sdk/e2e/integration/event-ordering.integration.test.ts +0 -186
  1459. package/sdk/e2e/integration/event-types.integration.test.ts +0 -183
  1460. package/sdk/e2e/integration/stream-chunks.integration.test.ts +0 -191
  1461. package/sdk/e2e/streaming/concurrent-streams.e2e.test.ts +0 -164
  1462. package/sdk/e2e/streaming/subagent-streaming.e2e.test.ts +0 -158
  1463. package/sdk/e2e/utils/__tests__/event-collector.test.ts +0 -297
  1464. package/sdk/e2e/utils/e2e-mocks.ts +0 -458
  1465. package/sdk/e2e/utils/event-collector.ts +0 -145
  1466. package/sdk/e2e/utils/get-api-key.ts +0 -76
  1467. package/sdk/e2e/utils/index.ts +0 -3
  1468. package/sdk/e2e/utils/test-fixtures.ts +0 -196
  1469. package/sdk/e2e/workflows/error-recovery.e2e.test.ts +0 -112
  1470. package/sdk/e2e/workflows/multi-turn-conversation.e2e.test.ts +0 -132
  1471. package/sdk/examples/readme-example-1.ts +0 -34
  1472. package/sdk/examples/readme-example-2.ts +0 -76
  1473. package/sdk/package.json +0 -82
  1474. package/sdk/scripts/build.ts +0 -349
  1475. package/sdk/scripts/fetch-ripgrep.ts +0 -172
  1476. package/sdk/scripts/publish.ts +0 -51
  1477. package/sdk/scripts/release.js +0 -100
  1478. package/sdk/scripts/verify.ts +0 -204
  1479. package/sdk/sdk_exit +0 -1
  1480. package/sdk/smoke-test-dist.ts +0 -248
  1481. package/sdk/src/__tests__/apply-overrides-resume.test.ts +0 -83
  1482. package/sdk/src/__tests__/apply-patch.test.ts +0 -438
  1483. package/sdk/src/__tests__/build-file-tree.test.ts +0 -31
  1484. package/sdk/src/__tests__/change-file.test.ts +0 -212
  1485. package/sdk/src/__tests__/client.test.ts +0 -142
  1486. package/sdk/src/__tests__/clone-session-state.test.ts +0 -158
  1487. package/sdk/src/__tests__/code-search.test.ts +0 -896
  1488. package/sdk/src/__tests__/composio.test.ts +0 -86
  1489. package/sdk/src/__tests__/credentials.test.ts +0 -344
  1490. package/sdk/src/__tests__/database.test.ts +0 -153
  1491. package/sdk/src/__tests__/env.test.ts +0 -137
  1492. package/sdk/src/__tests__/error-utils.test.ts +0 -253
  1493. package/sdk/src/__tests__/fixtures/windows-stubborn-grandchild.ts +0 -26
  1494. package/sdk/src/__tests__/initial-session-state.test.ts +0 -447
  1495. package/sdk/src/__tests__/knowledge-file-selection.test.ts +0 -335
  1496. package/sdk/src/__tests__/load-agents.test.ts +0 -935
  1497. package/sdk/src/__tests__/load-mcp-config.test.ts +0 -285
  1498. package/sdk/src/__tests__/load-skills.test.ts +0 -325
  1499. package/sdk/src/__tests__/model-provider.test.ts +0 -44
  1500. package/sdk/src/__tests__/path-utils.test.ts +0 -66
  1501. package/sdk/src/__tests__/read-files.test.ts +0 -573
  1502. package/sdk/src/__tests__/read-url.test.ts +0 -371
  1503. package/sdk/src/__tests__/researcher-web.integration.test.ts +0 -130
  1504. package/sdk/src/__tests__/run-cancellation.test.ts +0 -1321
  1505. package/sdk/src/__tests__/run-error-preserves-history.test.ts +0 -335
  1506. package/sdk/src/__tests__/run-event-dispatch.test.ts +0 -80
  1507. package/sdk/src/__tests__/run-file-filter.test.ts +0 -530
  1508. package/sdk/src/__tests__/run-handle-event.test.ts +0 -142
  1509. package/sdk/src/__tests__/run-mcp-tool-filter.test.ts +0 -124
  1510. package/sdk/src/__tests__/run-state-child-process.test.ts +0 -72
  1511. package/sdk/src/__tests__/run-terminal-command.test.ts +0 -236
  1512. package/sdk/src/__tests__/run.integration.test.ts +0 -170
  1513. package/sdk/src/__tests__/user-knowledge-files.test.ts +0 -361
  1514. package/sdk/src/__tests__/validate-agents.test.ts +0 -943
  1515. package/sdk/src/agents/load-agents.ts +0 -339
  1516. package/sdk/src/agents/load-mcp-config.ts +0 -275
  1517. package/sdk/src/client.ts +0 -87
  1518. package/sdk/src/composio.ts +0 -78
  1519. package/sdk/src/constants.ts +0 -29
  1520. package/sdk/src/credentials.ts +0 -303
  1521. package/sdk/src/custom-tool.ts +0 -66
  1522. package/sdk/src/env.ts +0 -116
  1523. package/sdk/src/error-utils.ts +0 -127
  1524. package/sdk/src/impl/__tests__/llm-chatgpt-oauth-policy.test.ts +0 -67
  1525. package/sdk/src/impl/__tests__/llm-native-tool-call.test.ts +0 -38
  1526. package/sdk/src/impl/__tests__/llm-stream-yielded-content.test.ts +0 -118
  1527. package/sdk/src/impl/__tests__/model-provider-free-mode.test.ts +0 -166
  1528. package/sdk/src/impl/__tests__/prompt-result.test.ts +0 -210
  1529. package/sdk/src/impl/__tests__/provider-options-metadata.test.ts +0 -67
  1530. package/sdk/src/impl/agent-runtime.ts +0 -159
  1531. package/sdk/src/impl/chatgpt-backend-fetch.ts +0 -588
  1532. package/sdk/src/impl/database.ts +0 -516
  1533. package/sdk/src/impl/llm.ts +0 -852
  1534. package/sdk/src/impl/model-provider.ts +0 -638
  1535. package/sdk/src/impl/openrouter-key-resolver.ts +0 -78
  1536. package/sdk/src/index.ts +0 -133
  1537. package/sdk/src/native/ripgrep.ts +0 -141
  1538. package/sdk/src/retry-config.ts +0 -51
  1539. package/sdk/src/run-state.ts +0 -897
  1540. package/sdk/src/run.ts +0 -1222
  1541. package/sdk/src/skills/load-skills.ts +0 -253
  1542. package/sdk/src/testing/env.ts +0 -19
  1543. package/sdk/src/tools/apply-patch.ts +0 -690
  1544. package/sdk/src/tools/change-file.ts +0 -155
  1545. package/sdk/src/tools/code-search.ts +0 -547
  1546. package/sdk/src/tools/glob.ts +0 -58
  1547. package/sdk/src/tools/index.ts +0 -19
  1548. package/sdk/src/tools/list-directory.ts +0 -52
  1549. package/sdk/src/tools/path-utils.ts +0 -101
  1550. package/sdk/src/tools/read-files.ts +0 -110
  1551. package/sdk/src/tools/read-url.ts +0 -469
  1552. package/sdk/src/tools/run-file-change-hooks.ts +0 -22
  1553. package/sdk/src/tools/run-terminal-command.ts +0 -483
  1554. package/sdk/src/tools/ssrf.ts +0 -120
  1555. package/sdk/src/types/env.ts +0 -40
  1556. package/sdk/src/utils/logger.ts +0 -15
  1557. package/sdk/src/validate-agents.ts +0 -157
  1558. package/sdk/test/cjs-compatibility/package-lock.json +0 -423
  1559. package/sdk/test/cjs-compatibility/package.json +0 -21
  1560. package/sdk/test/cjs-compatibility/test-imports.js +0 -77
  1561. package/sdk/test/cjs-compatibility/test-types.ts +0 -54
  1562. package/sdk/test/cjs-compatibility/tsconfig.json +0 -17
  1563. package/sdk/test/esm-compatibility/package-lock.json +0 -423
  1564. package/sdk/test/esm-compatibility/package.json +0 -21
  1565. package/sdk/test/esm-compatibility/test-imports.js +0 -83
  1566. package/sdk/test/esm-compatibility/test-types.ts +0 -59
  1567. package/sdk/test/esm-compatibility/tsconfig.json +0 -17
  1568. package/sdk/test/ripgrep-bundling/package-lock.json +0 -423
  1569. package/sdk/test/ripgrep-bundling/package.json +0 -21
  1570. package/sdk/test/ripgrep-bundling/test-ripgrep-types.ts +0 -132
  1571. package/sdk/test/ripgrep-bundling/test-ripgrep.js +0 -257
  1572. package/sdk/test/ripgrep-bundling/tsconfig.json +0 -15
  1573. package/sdk/test/setup-env.ts +0 -54
  1574. package/sdk/test/test-sdk.ts +0 -25
  1575. package/sdk/test/tree-sitter-queries/package-lock.json +0 -47
  1576. package/sdk/test/tree-sitter-queries/package.json +0 -12
  1577. package/sdk/test/tree-sitter-queries/test-query-files.js +0 -256
  1578. package/sdk/tsconfig.build.json +0 -32
  1579. package/sdk/tsconfig.json +0 -27
  1580. package/sdk/vendor/ripgrep/arm64-darwin/rg +0 -0
  1581. package/sdk/vendor/ripgrep/arm64-linux/rg +0 -0
  1582. package/sdk/vendor/ripgrep/x64-darwin/rg +0 -0
  1583. package/sdk/vendor/ripgrep/x64-linux/rg +0 -0
  1584. package/sdk/vendor/ripgrep/x64-win32/rg.exe +0 -0
  1585. package/templates/FID-TEMPLATE.md +0 -125
  1586. package/templates/README-TEMPLATE.md +0 -87
  1587. package/templates/SESSION-SUMMARY.md +0 -135
  1588. package/tsconfig.base.json +0 -18
  1589. package/tsconfig.json +0 -27
  1590. /package/{cli/release-core/http.js → http.js} +0 -0
  1591. /package/{cli/release-core/launcher.js → launcher.js} +0 -0
@@ -1,1743 +0,0 @@
1
- import * as analytics from '@savant-code/common/analytics'
2
- import { TEST_USER_ID } from '@savant-code/common/old-constants'
3
- import { emptyMcpServers } from '@savant-code/common/testing/fixtures/agent-runtime'
4
- import { TEST_AGENT_RUNTIME_IMPL } from '@savant-code/common/testing/impl/agent-runtime'
5
- import { getInitialSessionState } from '@savant-code/common/types/session-state'
6
- import {
7
- assistantMessage,
8
- jsonToolResult,
9
- userMessage,
10
- } from '@savant-code/common/util/messages'
11
- import {
12
- afterEach,
13
- beforeEach,
14
- describe,
15
- expect,
16
- it,
17
- mock,
18
- spyOn,
19
- } from 'bun:test'
20
- import { cloneDeep } from 'lodash'
21
-
22
- import {
23
- clearAgentGeneratorCache,
24
- runProgrammaticStep,
25
- } from '../run-programmatic-step'
26
- import { mockFileContext } from './test-utils'
27
- import * as toolExecutor from '../tools/tool-executor'
28
-
29
- import type { AgentTemplate, StepGenerator } from '../templates/types'
30
- import type { executeToolCall } from '../tools/tool-executor'
31
- import type { PublicAgentState } from '@savant-code/common/types/agent-template'
32
- import type {
33
- AgentRuntimeDeps,
34
- AgentRuntimeScopedDeps,
35
- } from '@savant-code/common/types/contracts/agent-runtime'
36
- import type { SendActionFn } from '@savant-code/common/types/contracts/client'
37
- import type { Logger } from '@savant-code/common/types/contracts/logger'
38
- import type { ParamsOf } from '@savant-code/common/types/function-params'
39
- import type { ToolResultOutput } from '@savant-code/common/types/messages/content-part'
40
- import type { ToolMessage } from '@savant-code/common/types/messages/savant-code-message'
41
- import type { AgentState } from '@savant-code/common/types/session-state'
42
-
43
- const logger: Logger = {
44
- debug: () => {},
45
- error: () => {},
46
- info: () => {},
47
- warn: () => {},
48
- }
49
-
50
- describe('runProgrammaticStep', () => {
51
- let mockTemplate: AgentTemplate
52
- let mockAgentState: AgentState
53
- let mockParams: ParamsOf<typeof runProgrammaticStep>
54
- let executeToolCallSpy: ReturnType<
55
- typeof spyOn<typeof toolExecutor, 'executeToolCall'>
56
- >
57
- let agentRuntimeImpl: AgentRuntimeDeps & AgentRuntimeScopedDeps
58
-
59
- beforeEach(() => {
60
- agentRuntimeImpl = {
61
- ...TEST_AGENT_RUNTIME_IMPL,
62
- addAgentStep: async () => 'test-agent-step-id',
63
-
64
- sendAction: () => {},
65
- }
66
-
67
- // Mock analytics
68
- spyOn(analytics, 'trackEvent').mockImplementation(() => {})
69
-
70
- // Mock executeToolCall
71
- executeToolCallSpy = spyOn(
72
- toolExecutor,
73
- 'executeToolCall',
74
- ).mockImplementation(async () => {})
75
-
76
- // Mock crypto.randomUUID
77
- spyOn(crypto, 'randomUUID').mockImplementation(
78
- () =>
79
- 'mock-uuid-0000-0000-0000-000000000000' as `${string}-${string}-${string}-${string}-${string}`,
80
- )
81
-
82
- // Create mock template
83
- mockTemplate = {
84
- id: 'test-agent',
85
- displayName: 'Test Agent',
86
- spawnerPrompt: 'Testing',
87
- model: 'claude-3-5-sonnet-20241022',
88
- inputSchema: {},
89
- outputMode: 'structured_output',
90
- includeMessageHistory: true,
91
- inheritParentSystemPrompt: false,
92
- mcpServers: emptyMcpServers,
93
- toolNames: ['read_files', 'write_file', 'end_turn'],
94
- spawnableAgents: [],
95
- systemPrompt: 'Test system prompt',
96
- instructionsPrompt: 'Test user prompt',
97
- stepPrompt: 'Test agent step prompt',
98
- handleSteps: undefined, // Will be set in individual tests
99
- } as AgentTemplate
100
-
101
- // Create mock agent state
102
- const sessionState = getInitialSessionState(mockFileContext)
103
- mockAgentState = {
104
- ...sessionState.mainAgentState,
105
- agentId: 'test-agent-id',
106
- runId:
107
- 'test-run-id' as `${string}-${string}-${string}-${string}-${string}`,
108
- messageHistory: [
109
- userMessage('Initial message'),
110
- assistantMessage('Initial response'),
111
- ],
112
- output: undefined,
113
- directCreditsUsed: 0,
114
- childRunIds: [],
115
- }
116
-
117
- // Create mock params
118
- mockParams = {
119
- ...agentRuntimeImpl,
120
- runId: 'test-run-id',
121
- ancestorRunIds: [],
122
- repoId: undefined,
123
- repoUrl: undefined,
124
- agentState: mockAgentState,
125
- template: mockTemplate,
126
- prompt: 'Test prompt',
127
- toolCallParams: { testParam: 'value' },
128
- userId: TEST_USER_ID,
129
- userInputId: 'test-user-input',
130
- clientSessionId: 'test-session',
131
- fingerprintId: 'test-fingerprint',
132
- onResponseChunk: () => {},
133
- onCostCalculated: async () => {},
134
- fileContext: mockFileContext,
135
- localAgentTemplates: {},
136
- system: 'Test system prompt',
137
- stepsComplete: false,
138
- stepNumber: 1,
139
- tools: {},
140
-
141
- logger,
142
- signal: new AbortController().signal,
143
- }
144
- })
145
-
146
- afterEach(() => {
147
- mock.restore()
148
- // Clear the generator cache between tests
149
- clearAgentGeneratorCache({ logger })
150
- })
151
-
152
- describe('generator lifecycle', () => {
153
- it('should create new generator when none exists', async () => {
154
- const mockGenerator = (function* () {
155
- yield { toolName: 'end_turn', input: {} }
156
- })() as StepGenerator
157
-
158
- mockTemplate.handleSteps = () => mockGenerator
159
-
160
- const result = await runProgrammaticStep(mockParams)
161
-
162
- expect(result.endTurn).toBe(true)
163
- expect(result.agentState).toBeDefined()
164
- })
165
-
166
- it('should not reuse existing generator for same agent', async () => {
167
- // Note: this behavior of creating a new generator after the first generator ended prevents memory leaks.
168
- let callCount = 0
169
- const createGenerator = () => {
170
- callCount++
171
- return (function* () {
172
- yield { toolName: 'end_turn', input: {} }
173
- })() as StepGenerator
174
- }
175
-
176
- mockTemplate.handleSteps = createGenerator
177
- // First call
178
- await runProgrammaticStep(mockParams)
179
- expect(callCount).toBe(1)
180
-
181
- // Second call with same agent ID should create a new generator
182
- await runProgrammaticStep(mockParams)
183
- expect(callCount).toBe(2) // Should create new generator
184
- })
185
-
186
- it('should handle STEP_ALL generator state', async () => {
187
- // First, set up a generator that will be marked as STEP_ALL
188
- const mockGenerator = (function* () {
189
- yield 'STEP_ALL'
190
- })() as StepGenerator
191
-
192
- mockTemplate.handleSteps = () => mockGenerator
193
-
194
- // First call to set STEP_ALL state
195
- const result1 = await runProgrammaticStep(mockParams)
196
- expect(result1.endTurn).toBe(false)
197
-
198
- // Second call should return early due to STEP_ALL state
199
- // Use the same agent state with the same runId
200
- const result2 = await runProgrammaticStep({
201
- ...mockParams,
202
- agentState: result1.agentState,
203
- })
204
- expect(result2.endTurn).toBe(false)
205
- expect(result2.agentState.agentId).toEqual(result1.agentState.agentId)
206
- })
207
-
208
- it('should throw error when template has no handleStep', async () => {
209
- mockTemplate.handleSteps = undefined
210
-
211
- await expect(runProgrammaticStep(mockParams)).rejects.toThrow(
212
- 'No step handler found for agent template test-agent',
213
- )
214
- })
215
-
216
- it('SEC1: prefers live handleStepsFn over stringified handleSteps (no eval)', async () => {
217
- // A string that would throw a ReferenceError if eval'd and stepped
218
- // (references an out-of-scope identifier). The live fn must be preferred
219
- // so the eval trust boundary is never crossed in-process.
220
- mockTemplate.handleSteps =
221
- 'function* () { yield { toolName: "end_turn", input: {} }; const x = someUndefinedBundlerHelper; }'
222
- mockTemplate.handleStepsFn = () =>
223
- (function* () {
224
- yield { toolName: 'end_turn', input: {} }
225
- })() as StepGenerator
226
-
227
- const result = await runProgrammaticStep(mockParams)
228
-
229
- expect(result.endTurn).toBe(true)
230
- expect(result.agentState.output?.error).toBeUndefined()
231
- })
232
- })
233
-
234
- describe('tool execution', () => {
235
- it('should not add tool call message for add_message tool', async () => {
236
- const mockGenerator = (function* () {
237
- yield {
238
- toolName: 'add_message',
239
- input: { role: 'user', content: 'Hello world' },
240
- includeToolCall: false,
241
- }
242
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
243
- yield { toolName: 'end_turn', input: {} }
244
- })() satisfies StepGenerator
245
-
246
- mockTemplate.handleSteps = () => mockGenerator
247
- mockTemplate.toolNames = ['add_message', 'read_files', 'end_turn']
248
-
249
- // Track chunks sent via sendSubagentChunk
250
- const sentChunks: string[] = []
251
- const sendActionMock = mock<SendActionFn>(({ action }) => {
252
- if (action.type === 'subagent-response-chunk') {
253
- sentChunks.push(action.chunk)
254
- }
255
- })
256
-
257
- const result = await runProgrammaticStep({
258
- ...mockParams,
259
- sendAction: sendActionMock,
260
- })
261
-
262
- // Verify add_message tool was executed
263
- expect(executeToolCallSpy).toHaveBeenCalledWith(
264
- expect.objectContaining({
265
- toolName: 'add_message',
266
- input: { role: 'user', content: 'Hello world' },
267
- }),
268
- )
269
-
270
- // Verify read_files tool was executed
271
- expect(executeToolCallSpy).toHaveBeenCalledWith(
272
- expect.objectContaining({
273
- toolName: 'read_files',
274
- input: { paths: ['test.txt'] },
275
- }),
276
- )
277
-
278
- // Check that no tool call chunk was sent for add_message
279
- const addMessageToolCallChunk = sentChunks.find(
280
- (chunk) =>
281
- typeof chunk === 'string' &&
282
- chunk.includes('add_message') &&
283
- chunk.includes('Hello world'),
284
- )
285
- expect(addMessageToolCallChunk).toBeUndefined()
286
-
287
- // Verify final message history doesn't contain add_message tool call
288
- const addMessageToolCallInHistory = result.agentState.messageHistory.find(
289
- (msg) =>
290
- msg.content[0].type === 'text' &&
291
- msg.content[0].text.includes('add_message') &&
292
- msg.content[0].text.includes('Hello world'),
293
- )
294
- expect(addMessageToolCallInHistory).toBeUndefined()
295
-
296
- expect(result.endTurn).toBe(true)
297
- })
298
- it('should execute single tool call', async () => {
299
- const mockGenerator = (function* () {
300
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
301
- yield { toolName: 'end_turn', input: {} }
302
- })() as StepGenerator
303
-
304
- mockTemplate.handleSteps = () => mockGenerator
305
-
306
- const result = await runProgrammaticStep(mockParams)
307
-
308
- expect(executeToolCallSpy).toHaveBeenCalledTimes(2)
309
- expect(executeToolCallSpy).toHaveBeenCalledWith(
310
- expect.objectContaining({
311
- toolName: 'read_files',
312
- input: expect.any(Object),
313
- agentTemplate: mockTemplate,
314
- fileContext: mockFileContext,
315
- }),
316
- )
317
- expect(result.endTurn).toBe(true)
318
- })
319
-
320
- it('should add find_files tool result to messageHistory', async () => {
321
- const mockGenerator = (function* () {
322
- yield { toolName: 'find_files', input: { query: 'authentication' } }
323
- })() as StepGenerator
324
-
325
- mockTemplate.handleSteps = () => mockGenerator
326
- mockTemplate.toolNames = ['find_files', 'end_turn']
327
-
328
- // Mock executeToolCall to simulate find_files tool result
329
- executeToolCallSpy.mockImplementation(
330
- async (
331
- options: ParamsOf<typeof executeToolCall>,
332
- ): ReturnType<typeof executeToolCall> => {
333
- if (options.toolName === 'find_files') {
334
- const toolResult: ToolMessage = {
335
- role: 'tool',
336
- toolName: 'find_files',
337
- toolCallId: 'find-files-call-id',
338
- content: jsonToolResult({
339
- files: [
340
- { path: 'src/auth.ts', relevance: 0.9 },
341
- { path: 'src/login.ts', relevance: 0.8 },
342
- ],
343
- }),
344
- }
345
- options.toolResults.push(toolResult)
346
-
347
- options.agentState.messageHistory.push(toolResult)
348
- }
349
- },
350
- )
351
-
352
- const result = await runProgrammaticStep(mockParams)
353
-
354
- expect(executeToolCallSpy).toHaveBeenCalledWith(
355
- expect.objectContaining({
356
- toolName: 'find_files',
357
- input: { query: 'authentication' },
358
- agentTemplate: mockTemplate,
359
- fileContext: mockFileContext,
360
- }),
361
- )
362
-
363
- // Verify tool result was added to messageHistory
364
- const toolMessages = result.agentState.messageHistory.filter(
365
- (msg) =>
366
- msg.role === 'tool' &&
367
- JSON.stringify(msg.content).includes('src/auth.ts'),
368
- )
369
- expect(toolMessages).toHaveLength(1)
370
- expect(JSON.stringify(toolMessages[0].content)).toContain('src/auth.ts')
371
- expect(JSON.stringify(toolMessages[0].content)).toContain('src/login.ts')
372
-
373
- expect(result.endTurn).toBe(true)
374
- })
375
-
376
- it('should execute multiple tool calls in sequence', async () => {
377
- const mockGenerator = (function* () {
378
- yield { toolName: 'read_files', input: { paths: ['file1.txt'] } }
379
- yield {
380
- toolName: 'write_file',
381
- input: { path: 'file2.txt', content: 'test' },
382
- }
383
- yield { toolName: 'end_turn', input: {} }
384
- })() as StepGenerator
385
-
386
- mockTemplate.handleSteps = () => mockGenerator
387
-
388
- const result = await runProgrammaticStep(mockParams)
389
-
390
- expect(executeToolCallSpy).toHaveBeenCalledTimes(3)
391
- expect(result.endTurn).toBe(true)
392
- })
393
-
394
- it('should comprehensively test STEP_ALL functionality with multiple tools and state management', async () => {
395
- // Track all tool results and state changes for verification
396
- const toolResultsReceived: ToolResultOutput[][] = []
397
- const stateSnapshots: PublicAgentState[] = []
398
- let stepCount = 0
399
-
400
- const mockGenerator = (function* () {
401
- stepCount++
402
-
403
- // Step 1: Read files and capture initial state
404
- const step1 = yield {
405
- toolName: 'read_files',
406
- input: { paths: ['src/auth.ts', 'src/config.ts'] },
407
- }
408
- toolResultsReceived.push(step1.toolResult)
409
- stateSnapshots.push({ ...step1.agentState })
410
-
411
- // Step 2: Search for patterns based on file content
412
- const step2 = yield {
413
- toolName: 'code_search',
414
- input: { pattern: 'authenticate', flags: '-i' },
415
- }
416
- toolResultsReceived.push(step2.toolResult)
417
- stateSnapshots.push({ ...step2.agentState })
418
-
419
- // Step 3: Create a plan based on findings
420
- const step3 = yield {
421
- toolName: 'create_plan',
422
- input: {
423
- path: 'analysis-plan.md',
424
- plan: 'Comprehensive analysis of authentication system',
425
- },
426
- }
427
- toolResultsReceived.push(step3.toolResult)
428
- stateSnapshots.push({ ...step3.agentState })
429
-
430
- // Step 4: Add subgoal for tracking
431
- const step4 = yield {
432
- toolName: 'add_subgoal',
433
- input: {
434
- id: 'auth-analysis',
435
- objective: 'Analyze authentication patterns',
436
- status: 'IN_PROGRESS',
437
- plan: 'Review auth files and create recommendations',
438
- },
439
- }
440
- toolResultsReceived.push(step4.toolResult)
441
- stateSnapshots.push({ ...step4.agentState })
442
-
443
- // Step 5: Write analysis file
444
- const step5 = yield {
445
- toolName: 'write_file',
446
- input: {
447
- path: 'auth-analysis.md',
448
- instructions: 'Create authentication analysis document',
449
- content: '# Authentication Analysis\n\nBased on code review...',
450
- },
451
- }
452
- toolResultsReceived.push(step5.toolResult)
453
- stateSnapshots.push({ ...step5.agentState })
454
-
455
- // Step 6: Update subgoal status
456
- const step6 = yield {
457
- toolName: 'update_subgoal',
458
- input: {
459
- id: 'auth-analysis',
460
- status: 'COMPLETE',
461
- log: 'Analysis completed successfully',
462
- },
463
- }
464
- toolResultsReceived.push(step6.toolResult)
465
- stateSnapshots.push({ ...step6.agentState })
466
-
467
- // Step 7: Set final output with comprehensive data
468
- const step7 = yield {
469
- toolName: 'set_output',
470
- input: {
471
- status: 'success',
472
- filesAnalyzed: ['src/auth.ts', 'src/config.ts'],
473
- patternsFound: 3,
474
- recommendations: ['Use stronger auth', 'Add 2FA'],
475
- completedAt: new Date().toISOString(),
476
- },
477
- }
478
- toolResultsReceived.push(step7.toolResult)
479
- stateSnapshots.push({ ...step7.agentState })
480
-
481
- // Step 8: Transition to STEP_ALL to continue processing
482
- yield 'STEP_ALL'
483
- })() as StepGenerator
484
-
485
- // Set up comprehensive tool names for this test
486
- mockTemplate.handleSteps = () => mockGenerator
487
- mockTemplate.toolNames = [
488
- 'read_files',
489
- 'code_search',
490
- 'create_plan',
491
- 'add_subgoal',
492
- 'write_file',
493
- 'update_subgoal',
494
- 'set_output',
495
- 'end_turn',
496
- ]
497
-
498
- // Mock executeToolCall to simulate realistic tool results and state updates
499
- executeToolCallSpy.mockImplementation(
500
- async (
501
- options: ParamsOf<typeof executeToolCall>,
502
- ): ReturnType<typeof executeToolCall> => {
503
- const { toolName, input, toolResults, agentState } = options
504
-
505
- let result: string
506
- switch (toolName) {
507
- case 'read_files':
508
- result = JSON.stringify({
509
- 'src/auth.ts':
510
- 'export function authenticate(user) { return true; }',
511
- 'src/config.ts': 'export const authConfig = { enabled: true };',
512
- })
513
- break
514
- case 'code_search':
515
- result =
516
- 'src/auth.ts:1:export function authenticate(user) {\nsrc/config.ts:1:authConfig'
517
- break
518
- case 'create_plan':
519
- result = 'Plan created successfully at analysis-plan.md'
520
- break
521
- case 'add_subgoal':
522
- result = 'Subgoal "auth-analysis" added successfully'
523
- // Update agent state to include subgoal in agentContext
524
- agentState.agentContext['auth-analysis'] = {
525
- objective: 'Analyze authentication patterns',
526
- status: 'IN_PROGRESS',
527
- plan: 'Review auth files and create recommendations',
528
- logs: [],
529
- }
530
- break
531
- case 'write_file':
532
- result = 'File written successfully: auth-analysis.md'
533
- break
534
- case 'update_subgoal':
535
- result = 'Subgoal "auth-analysis" updated successfully'
536
- // Update subgoal status in agent state
537
- if (agentState.agentContext['auth-analysis']) {
538
- agentState.agentContext['auth-analysis'].status = 'COMPLETE'
539
- agentState.agentContext['auth-analysis'].logs.push(
540
- 'Analysis completed successfully',
541
- )
542
- }
543
- break
544
- case 'set_output':
545
- result = 'Output set successfully'
546
- agentState.output = input
547
- break
548
- default:
549
- result = `${toolName} executed successfully`
550
- }
551
-
552
- const toolResult: ToolMessage = {
553
- role: 'tool',
554
- toolName,
555
- toolCallId: `${toolName}-call-id`,
556
- content: [
557
- {
558
- type: 'json',
559
- value: result,
560
- },
561
- ],
562
- }
563
- toolResults.push(toolResult)
564
-
565
- agentState.messageHistory.push(toolResult)
566
- },
567
- )
568
-
569
- // First call - should execute all tools and transition to STEP_ALL
570
- const result1 = await runProgrammaticStep(mockParams)
571
-
572
- // Verify all tools were executed
573
- expect(executeToolCallSpy).toHaveBeenCalledTimes(7) // 7 tools before STEP_ALL
574
- expect(result1.endTurn).toBe(false) // Should not end turn due to STEP_ALL
575
- expect(stepCount).toBe(1) // Generator should have run once
576
-
577
- // Verify tool execution order and arguments
578
- const toolCalls = executeToolCallSpy.mock.calls
579
- expect(toolCalls[0][0].toolName).toBe('read_files')
580
- expect(toolCalls[0][0].input.paths).toEqual([
581
- 'src/auth.ts',
582
- 'src/config.ts',
583
- ])
584
- expect(toolCalls[1][0].toolName).toBe('code_search')
585
- expect(toolCalls[1][0].input.pattern).toBe('authenticate')
586
- expect(toolCalls[2][0].toolName).toBe('create_plan')
587
- expect(toolCalls[3][0].toolName).toBe('add_subgoal')
588
- expect(toolCalls[4][0].toolName).toBe('write_file')
589
- expect(toolCalls[5][0].toolName).toBe('update_subgoal')
590
- expect(toolCalls[6][0].toolName).toBe('set_output')
591
-
592
- // Verify tool results were passed back to generator
593
- expect(toolResultsReceived).toHaveLength(7)
594
- expect(JSON.stringify(toolResultsReceived[0])).toContain('authenticate')
595
- expect(JSON.stringify(toolResultsReceived[3])).toContain('auth-analysis')
596
- expect(JSON.stringify(toolResultsReceived[6])).toContain(
597
- 'Output set successfully',
598
- )
599
-
600
- // Verify state management throughout execution
601
- expect(stateSnapshots).toHaveLength(7)
602
- expect(Object.keys(result1.agentState.agentContext)).toContain(
603
- 'auth-analysis',
604
- )
605
- expect(result1.agentState.agentContext['auth-analysis']?.status).toBe(
606
- 'COMPLETE',
607
- )
608
- expect(result1.agentState.output).toEqual({
609
- status: 'success',
610
- filesAnalyzed: ['src/auth.ts', 'src/config.ts'],
611
- patternsFound: 3,
612
- recommendations: ['Use stronger auth', 'Add 2FA'],
613
- completedAt: expect.any(String),
614
- })
615
-
616
- // Verify tool results were processed correctly
617
- expect(toolResultsReceived).toHaveLength(7)
618
- expect(toolResultsReceived.every((result) => result !== undefined)).toBe(
619
- true,
620
- )
621
-
622
- // Verify that executeToolCall was called with agentState.messageHistory
623
- expect(executeToolCallSpy).toHaveBeenCalledWith(
624
- expect.objectContaining({
625
- agentState: expect.objectContaining({
626
- messageHistory: expect.any(Array),
627
- }),
628
- }),
629
- )
630
-
631
- // Reset spy for second call
632
- executeToolCallSpy.mockClear()
633
-
634
- // Second call - should return early due to STEP_ALL state
635
- const result2 = await runProgrammaticStep({
636
- ...mockParams,
637
- // Use the updated agent state from first call
638
- agentState: result1.agentState,
639
- })
640
-
641
- // Verify STEP_ALL behavior
642
- expect(executeToolCallSpy).not.toHaveBeenCalled() // No tools should execute
643
- expect(result2.endTurn).toBe(false) // Should still not end turn
644
- expect(result2.agentState.agentId).toEqual(result1.agentState.agentId) // State should be similar
645
- expect(stepCount).toBe(1) // Generator should not have run again
646
-
647
- // Third call - verify STEP_ALL state persists
648
- const result3 = await runProgrammaticStep({
649
- ...mockParams,
650
- agentState: result2.agentState,
651
- })
652
-
653
- expect(executeToolCallSpy).not.toHaveBeenCalled()
654
- expect(result3.endTurn).toBe(false)
655
- expect(result3.agentState.agentId).toEqual(result1.agentState.agentId)
656
- expect(stepCount).toBe(1) // Generator should still not have run again
657
- })
658
-
659
- it('should pass tool results back to generator', async () => {
660
- const _toolResults: ToolMessage[] = []
661
- let receivedToolResult: ToolResultOutput[] | undefined
662
-
663
- const mockGenerator = (function* () {
664
- const input1 = yield {
665
- toolName: 'read_files',
666
- input: { paths: ['test.txt'] },
667
- }
668
- receivedToolResult = input1.toolResult
669
- yield { toolName: 'end_turn', input: {} }
670
- })() as StepGenerator
671
-
672
- mockTemplate.handleSteps = () => mockGenerator
673
-
674
- // Mock executeToolCall to add tool results
675
- executeToolCallSpy.mockImplementation(
676
- async (
677
- options: ParamsOf<typeof executeToolCall>,
678
- ): ReturnType<typeof executeToolCall> => {
679
- if (options.toolName === 'read_files') {
680
- options.toolResults.push({
681
- role: 'tool',
682
- toolName: 'read_files',
683
- toolCallId: 'test-id',
684
- content: [
685
- {
686
- type: 'json',
687
- value: 'file content',
688
- },
689
- ],
690
- } satisfies ToolMessage)
691
- }
692
- },
693
- )
694
-
695
- await runProgrammaticStep(mockParams)
696
-
697
- expect(receivedToolResult).toEqual([
698
- {
699
- type: 'json',
700
- value: 'file content',
701
- },
702
- ])
703
- })
704
- })
705
-
706
- describe('generator control flow', () => {
707
- it('should handle STEP value to break execution', async () => {
708
- const mockGenerator = (function* () {
709
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
710
- yield 'STEP'
711
- yield {
712
- toolName: 'write_file',
713
- input: { path: 'test.txt', content: 'test' },
714
- }
715
- })() as StepGenerator
716
-
717
- mockTemplate.handleSteps = () => mockGenerator
718
-
719
- const result = await runProgrammaticStep(mockParams)
720
-
721
- expect(executeToolCallSpy).toHaveBeenCalledTimes(1) // Only first tool call
722
- expect(result.endTurn).toBe(false)
723
- })
724
-
725
- it('should handle generator completion', async () => {
726
- const mockGenerator = (function* () {
727
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
728
- return // Generator completes
729
- })() as StepGenerator
730
-
731
- mockTemplate.handleSteps = () => mockGenerator
732
-
733
- const result = await runProgrammaticStep(mockParams)
734
-
735
- expect(result.endTurn).toBe(true)
736
- })
737
-
738
- it('should end turn when end_turn tool is called', async () => {
739
- const mockGenerator = (function* () {
740
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
741
- yield { toolName: 'end_turn', input: {} }
742
- yield {
743
- toolName: 'write_file',
744
- input: { path: 'test.txt', content: 'test' },
745
- } // Should not execute
746
- })() as StepGenerator
747
-
748
- mockTemplate.handleSteps = () => mockGenerator
749
-
750
- const result = await runProgrammaticStep(mockParams)
751
-
752
- expect(executeToolCallSpy).toHaveBeenCalledTimes(2) // read_files + end_turn
753
- expect(result.endTurn).toBe(true)
754
- })
755
- })
756
-
757
- describe('state management', () => {
758
- it('should preserve agent state changes', async () => {
759
- const mockGenerator = (function* () {
760
- yield {
761
- toolName: 'set_output',
762
- input: { status: 'complete' },
763
- }
764
- yield { toolName: 'end_turn', input: {} }
765
- })() as StepGenerator
766
-
767
- mockTemplate.handleSteps = () => mockGenerator
768
- mockTemplate.toolNames.push('set_output')
769
-
770
- // Mock executeToolCall to update state
771
- executeToolCallSpy.mockImplementation(
772
- async (
773
- options: ParamsOf<typeof executeToolCall>,
774
- ): ReturnType<typeof executeToolCall> => {
775
- if (options.toolName === 'set_output') {
776
- options.agentState.output = { status: 'complete' }
777
- }
778
- },
779
- )
780
-
781
- const result = await runProgrammaticStep(mockParams)
782
-
783
- expect(result.agentState.output).toEqual({ status: 'complete' })
784
- })
785
-
786
- it('should preserve message history', async () => {
787
- const mockGenerator = (function* () {
788
- yield { toolName: 'end_turn', input: {} }
789
- })() as StepGenerator
790
- const previousMessageHistory = cloneDeep(mockAgentState.messageHistory)
791
-
792
- mockTemplate.handleSteps = () => mockGenerator
793
-
794
- const result = await runProgrammaticStep(mockParams)
795
-
796
- // Verify previous messages are preserved
797
- expect(result.agentState.messageHistory.length).toBeGreaterThanOrEqual(
798
- previousMessageHistory.length,
799
- )
800
- // Check first messages match
801
- expect(result.agentState.messageHistory[0]).toEqual(
802
- previousMessageHistory[0],
803
- )
804
- expect(result.agentState.messageHistory[1]).toEqual(
805
- previousMessageHistory[1],
806
- )
807
- // Verify an assistant message was added (with native tools, this is a tool-call structure)
808
- const lastMessage =
809
- result.agentState.messageHistory[
810
- result.agentState.messageHistory.length - 1
811
- ]
812
- expect(lastMessage.role).toBe('assistant')
813
- // With native tools, the tool call is structured differently than the old XML format
814
- expect(lastMessage.content[0]).toMatchObject({
815
- type: 'tool-call',
816
- toolName: 'end_turn',
817
- })
818
- })
819
- })
820
-
821
- describe('error handling', () => {
822
- it('should handle generator errors gracefully', async () => {
823
- const mockGenerator = (function* () {
824
- throw new Error('Generator error')
825
- })() as StepGenerator
826
-
827
- mockTemplate.handleSteps = () => mockGenerator
828
-
829
- const responseChunks: unknown[] = []
830
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
831
-
832
- const result = await runProgrammaticStep(mockParams)
833
-
834
- expect(result.endTurn).toBe(true)
835
- expect(result.agentState.output?.error).toContain('Generator error')
836
- expect(
837
- responseChunks.some(
838
- (chunk) =>
839
- typeof chunk === 'string' && chunk.includes('Generator error'),
840
- ),
841
- ).toBe(true)
842
- })
843
-
844
- it('should handle tool execution errors', async () => {
845
- const mockGenerator = (function* () {
846
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
847
- yield { toolName: 'end_turn', input: {} }
848
- })() as StepGenerator
849
-
850
- mockTemplate.handleSteps = () => mockGenerator
851
- executeToolCallSpy.mockRejectedValue(new Error('Tool execution failed'))
852
-
853
- const responseChunks: unknown[] = []
854
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
855
-
856
- const result = await runProgrammaticStep(mockParams)
857
-
858
- expect(result.endTurn).toBe(true)
859
- expect(result.agentState.output?.error).toContain('Tool execution failed')
860
- })
861
-
862
- it('should handle non-Error exceptions', async () => {
863
- const mockGenerator = (function* () {
864
- throw 'String error'
865
- })() as StepGenerator
866
-
867
- mockTemplate.handleSteps = () => mockGenerator
868
-
869
- const result = await runProgrammaticStep(mockParams)
870
-
871
- expect(result.endTurn).toBe(true)
872
- expect(result.agentState.output?.error).toContain('Unknown error')
873
- })
874
- })
875
-
876
- describe('output schema validation', () => {
877
- it('should validate output against outputSchema when using setOutput', async () => {
878
- // Create template with outputSchema
879
- const schemaTemplate = {
880
- ...mockTemplate,
881
- outputMode: 'structured_output' as const,
882
- outputSchema: {
883
- type: 'object',
884
- properties: {
885
- message: { type: 'string' },
886
- status: { type: 'string', enum: ['success', 'error'] },
887
- count: { type: 'number' },
888
- },
889
- required: ['message', 'status'],
890
- },
891
- toolNames: ['set_output', 'end_turn'],
892
- }
893
-
894
- const mockGenerator = (function* () {
895
- yield {
896
- toolName: 'set_output',
897
- input: {
898
- message: 'Task completed successfully',
899
- status: 'success',
900
- count: 42,
901
- },
902
- }
903
- yield { toolName: 'end_turn', input: {} }
904
- })() as StepGenerator
905
-
906
- schemaTemplate.handleSteps = () => mockGenerator
907
-
908
- // Don't mock executeToolCall - let it use the real implementation
909
- executeToolCallSpy.mockRestore()
910
-
911
- const result = await runProgrammaticStep({
912
- ...mockParams,
913
- template: schemaTemplate as unknown as AgentTemplate,
914
- localAgentTemplates: {
915
- 'test-agent': schemaTemplate as unknown as AgentTemplate,
916
- },
917
- })
918
-
919
- expect(result.endTurn).toBe(true)
920
- expect(result.agentState.output).toEqual({
921
- message: 'Task completed successfully',
922
- status: 'success',
923
- count: 42,
924
- })
925
- })
926
-
927
- it('should handle invalid output that fails schema validation', async () => {
928
- // Create template with strict outputSchema
929
- const schemaTemplate = {
930
- ...mockTemplate,
931
- outputMode: 'structured_output' as const,
932
- outputSchema: {
933
- type: 'object',
934
- properties: {
935
- message: { type: 'string' },
936
- status: { type: 'string', enum: ['success', 'error'] },
937
- },
938
- required: ['message', 'status'],
939
- },
940
- toolNames: ['set_output', 'end_turn'],
941
- }
942
-
943
- const mockGenerator = (function* () {
944
- yield {
945
- toolName: 'set_output',
946
- input: {
947
- message: 'Task completed',
948
- status: 'invalid_status', // This should fail validation
949
- extraField: 'not allowed',
950
- },
951
- }
952
- yield { toolName: 'end_turn', input: {} }
953
- })() as StepGenerator
954
-
955
- schemaTemplate.handleSteps = () => mockGenerator
956
-
957
- // Don't mock executeToolCall - let it use the real implementation
958
- executeToolCallSpy.mockRestore()
959
-
960
- const responseChunks: unknown[] = []
961
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
962
-
963
- const result = await runProgrammaticStep({
964
- ...mockParams,
965
- template: schemaTemplate as unknown as AgentTemplate,
966
- localAgentTemplates: {
967
- 'test-agent': schemaTemplate as unknown as AgentTemplate,
968
- },
969
- })
970
-
971
- // Should end turn (validation may fail but execution continues)
972
- expect(result.endTurn).toBe(true)
973
- // Test passes if no exception is thrown during execution
974
- expect(result.agentState).toBeDefined()
975
- })
976
-
977
- it('should work with agents that have no outputSchema', async () => {
978
- const noSchemaTemplate = {
979
- ...mockTemplate,
980
- outputMode: 'last_message' as const,
981
- outputSchema: undefined,
982
- toolNames: ['set_output', 'end_turn'],
983
- }
984
-
985
- const mockGenerator = (function* () {
986
- yield {
987
- toolName: 'set_output',
988
- input: {
989
- anyField: 'any value',
990
- anotherField: 123,
991
- },
992
- }
993
- yield { toolName: 'end_turn', input: {} }
994
- })() as StepGenerator
995
-
996
- noSchemaTemplate.handleSteps = () => mockGenerator
997
-
998
- // Don't mock executeToolCall - let it use the real implementation
999
- executeToolCallSpy.mockRestore()
1000
-
1001
- const result = await runProgrammaticStep({
1002
- ...mockParams,
1003
- template: noSchemaTemplate,
1004
- localAgentTemplates: { 'test-agent': noSchemaTemplate },
1005
- })
1006
-
1007
- expect(result.endTurn).toBe(true)
1008
- expect(result.agentState.output).toEqual({
1009
- anyField: 'any value',
1010
- anotherField: 123,
1011
- })
1012
- })
1013
-
1014
- it('should work with outputMode structured_output but no outputSchema defined', async () => {
1015
- const schemaWithoutSchemaTemplate = {
1016
- ...mockTemplate,
1017
- outputMode: 'structured_output' as const,
1018
- outputSchema: undefined, // No schema defined
1019
- toolNames: ['set_output', 'end_turn'],
1020
- }
1021
-
1022
- const mockGenerator = (function* () {
1023
- yield {
1024
- toolName: 'set_output',
1025
- input: {
1026
- result: 'success',
1027
- data: { count: 5 },
1028
- },
1029
- }
1030
- yield { toolName: 'end_turn', input: {} }
1031
- })() as StepGenerator
1032
-
1033
- schemaWithoutSchemaTemplate.handleSteps = () => mockGenerator
1034
-
1035
- // Don't mock executeToolCall - let it use the real implementation
1036
- executeToolCallSpy.mockRestore()
1037
-
1038
- const result = await runProgrammaticStep({
1039
- ...mockParams,
1040
- template: schemaWithoutSchemaTemplate,
1041
- localAgentTemplates: { 'test-agent': schemaWithoutSchemaTemplate },
1042
- })
1043
-
1044
- expect(result.endTurn).toBe(true)
1045
- expect(result.agentState.output).toEqual({
1046
- result: 'success',
1047
- data: { count: 5 },
1048
- })
1049
- })
1050
- })
1051
-
1052
- describe('stepsComplete parameter', () => {
1053
- it('should pass stepsComplete=false by default', async () => {
1054
- let receivedStepsComplete: boolean | undefined
1055
-
1056
- const mockGenerator = (function* () {
1057
- const input = yield {
1058
- toolName: 'read_files',
1059
- input: { paths: ['test.txt'] },
1060
- }
1061
- receivedStepsComplete = input.stepsComplete
1062
- yield { toolName: 'end_turn', input: {} }
1063
- })() as StepGenerator
1064
-
1065
- mockTemplate.handleSteps = () => mockGenerator
1066
-
1067
- await runProgrammaticStep({
1068
- ...mockParams,
1069
- stepsComplete: false,
1070
- })
1071
-
1072
- expect(receivedStepsComplete).toBe(false)
1073
- })
1074
-
1075
- it('should pass stepsComplete=true when specified', async () => {
1076
- let receivedStepsComplete: boolean | undefined
1077
-
1078
- const mockGenerator = (function* () {
1079
- const input = yield {
1080
- toolName: 'read_files',
1081
- input: { paths: ['test.txt'] },
1082
- }
1083
- receivedStepsComplete = input.stepsComplete
1084
- yield { toolName: 'end_turn', input: {} }
1085
- })() as StepGenerator
1086
-
1087
- mockTemplate.handleSteps = () => mockGenerator
1088
-
1089
- await runProgrammaticStep({
1090
- ...mockParams,
1091
- stepsComplete: true,
1092
- })
1093
-
1094
- expect(receivedStepsComplete).toBe(true)
1095
- })
1096
-
1097
- it('should handle post-processing when stepsComplete=true', async () => {
1098
- const executionLog: string[] = []
1099
-
1100
- const mockGenerator = (function* () {
1101
- const step1 = yield {
1102
- toolName: 'read_files',
1103
- input: { paths: ['file1.txt'] },
1104
- }
1105
- executionLog.push(`step1: stepsComplete=${step1.stepsComplete}`)
1106
-
1107
- if (step1.stepsComplete) {
1108
- // Post-processing step
1109
- executionLog.push('performing post-processing')
1110
- yield {
1111
- toolName: 'set_output',
1112
- input: { message: 'Post-processing completed' },
1113
- }
1114
- }
1115
-
1116
- yield { toolName: 'end_turn', input: {} }
1117
- })() as StepGenerator
1118
-
1119
- mockTemplate.handleSteps = () => mockGenerator
1120
- mockTemplate.toolNames = ['read_files', 'set_output', 'end_turn']
1121
-
1122
- // Mock executeToolCall to update state for set_output
1123
- executeToolCallSpy.mockImplementation(
1124
- async (
1125
- options: ParamsOf<typeof executeToolCall>,
1126
- ): ReturnType<typeof executeToolCall> => {
1127
- if (options.toolName === 'set_output') {
1128
- options.agentState.output = options.input
1129
- }
1130
- },
1131
- )
1132
-
1133
- const result = await runProgrammaticStep({
1134
- ...mockParams,
1135
- stepsComplete: true,
1136
- })
1137
-
1138
- expect(executionLog).toEqual([
1139
- 'step1: stepsComplete=true',
1140
- 'performing post-processing',
1141
- ])
1142
- expect(result.agentState.output).toEqual({
1143
- message: 'Post-processing completed',
1144
- })
1145
- expect(executeToolCallSpy).toHaveBeenCalledTimes(3) // read_files + set_output + end_turn
1146
- })
1147
-
1148
- it('should clear STEP_ALL mode when stepsComplete=true', async () => {
1149
- // First, set up a generator that will be marked as STEP_ALL
1150
- let generatorCallCount = 0
1151
- const createGenerator = () => {
1152
- generatorCallCount++
1153
- if (generatorCallCount === 1) {
1154
- return (function* () {
1155
- yield 'STEP_ALL'
1156
- })() as StepGenerator
1157
- } else {
1158
- return (function* () {
1159
- yield {
1160
- toolName: 'set_output',
1161
- input: { status: 'finalized' },
1162
- }
1163
- yield { toolName: 'end_turn', input: {} }
1164
- })() as StepGenerator
1165
- }
1166
- }
1167
-
1168
- mockTemplate.handleSteps = createGenerator
1169
- mockTemplate.toolNames = ['set_output', 'end_turn']
1170
-
1171
- // First call to set STEP_ALL state
1172
- const result1 = await runProgrammaticStep({
1173
- ...mockParams,
1174
- stepsComplete: false,
1175
- })
1176
- expect(result1.endTurn).toBe(false)
1177
- expect(generatorCallCount).toBe(1)
1178
-
1179
- // Second call with stepsComplete=false should return early due to STEP_ALL
1180
- const result2 = await runProgrammaticStep({
1181
- ...mockParams,
1182
- agentState: result1.agentState,
1183
- stepsComplete: false,
1184
- })
1185
- expect(result2.endTurn).toBe(false)
1186
- expect(generatorCallCount).toBe(1) // Should not create new generator
1187
-
1188
- // Third call with stepsComplete=true should clear STEP_ALL and continue with existing generator
1189
- executeToolCallSpy.mockImplementation(
1190
- async (
1191
- options: ParamsOf<typeof executeToolCall>,
1192
- ): ReturnType<typeof executeToolCall> => {
1193
- if (options.toolName === 'set_output') {
1194
- options.agentState.output = options.input
1195
- }
1196
- },
1197
- )
1198
-
1199
- const result3 = await runProgrammaticStep({
1200
- ...mockParams,
1201
- agentState: result2.agentState,
1202
- stepsComplete: true,
1203
- })
1204
-
1205
- expect(result3.endTurn).toBe(true)
1206
- // The existing generator continues execution rather than creating a new one
1207
- expect(generatorCallCount).toBe(1)
1208
- })
1209
- })
1210
-
1211
- describe('continued stepping after completion', () => {
1212
- it('should allow agent to continue with STEP after initial completion', async () => {
1213
- const executionSteps: string[] = []
1214
-
1215
- const mockGenerator = (function* () {
1216
- executionSteps.push('initial execution')
1217
- const step1 = yield {
1218
- toolName: 'read_files',
1219
- input: { paths: ['config.txt'] },
1220
- }
1221
-
1222
- if (step1.stepsComplete) {
1223
- executionSteps.push('post-processing detected')
1224
- yield {
1225
- toolName: 'write_file',
1226
- input: {
1227
- path: 'summary.txt',
1228
- instructions: 'Create summary',
1229
- content: 'Processing completed',
1230
- },
1231
- }
1232
-
1233
- // Force agent to continue with another step
1234
- executionSteps.push('requesting continuation')
1235
- const step2 = yield 'STEP'
1236
- executionSteps.push(`step2: stepsComplete=${step2.stepsComplete}`)
1237
-
1238
- if (!step2.stepsComplete) {
1239
- yield {
1240
- toolName: 'set_output',
1241
- input: { message: 'Continued processing' },
1242
- }
1243
- }
1244
- }
1245
-
1246
- yield { toolName: 'end_turn', input: {} }
1247
- })() as StepGenerator
1248
-
1249
- mockTemplate.handleSteps = () => mockGenerator
1250
- mockTemplate.toolNames = [
1251
- 'read_files',
1252
- 'write_file',
1253
- 'set_output',
1254
- 'end_turn',
1255
- ]
1256
-
1257
- executeToolCallSpy.mockImplementation(
1258
- async (
1259
- options: ParamsOf<typeof executeToolCall>,
1260
- ): ReturnType<typeof executeToolCall> => {
1261
- if (options.toolName === 'set_output') {
1262
- options.agentState.output = options.input
1263
- }
1264
- },
1265
- )
1266
-
1267
- // First call with stepsComplete=true (post-processing mode)
1268
- const result = await runProgrammaticStep({
1269
- ...mockParams,
1270
- stepsComplete: true,
1271
- })
1272
-
1273
- expect(executionSteps).toEqual([
1274
- 'initial execution',
1275
- 'post-processing detected',
1276
- 'requesting continuation',
1277
- ])
1278
- expect(result.endTurn).toBe(false) // Should not end due to STEP
1279
- expect(executeToolCallSpy).toHaveBeenCalledTimes(2) // read_files + write_file
1280
-
1281
- const finalResult = await runProgrammaticStep({
1282
- ...mockParams,
1283
- stepsComplete: false,
1284
- })
1285
-
1286
- expect(executionSteps).toEqual([
1287
- 'initial execution',
1288
- 'post-processing detected',
1289
- 'requesting continuation',
1290
- 'step2: stepsComplete=false',
1291
- ])
1292
- expect(finalResult.endTurn).toBe(true) // Should end from end_turn
1293
- expect(executeToolCallSpy).toHaveBeenCalledTimes(4) // read_files + write_file + set_output + end_turn
1294
- })
1295
-
1296
- it('should allow agent to continue with STEP_ALL after initial completion', async () => {
1297
- const executionSteps: string[] = []
1298
-
1299
- const mockGenerator = (function* () {
1300
- executionSteps.push('initial execution')
1301
- const step1 = yield {
1302
- toolName: 'read_files',
1303
- input: { paths: ['data.txt'] },
1304
- }
1305
-
1306
- if (step1.stepsComplete) {
1307
- executionSteps.push('post-processing with STEP_ALL')
1308
- yield {
1309
- toolName: 'write_file',
1310
- input: {
1311
- path: 'processed.txt',
1312
- instructions: 'Create processed file',
1313
- content: 'Data processed',
1314
- },
1315
- }
1316
-
1317
- // Force agent to continue with STEP_ALL
1318
- yield 'STEP_ALL'
1319
- executionSteps.push('STEP_ALL requested')
1320
- }
1321
- })() as StepGenerator
1322
-
1323
- mockTemplate.handleSteps = () => mockGenerator
1324
- mockTemplate.toolNames = ['read_files', 'write_file', 'end_turn']
1325
-
1326
- // First call with stepsComplete=true
1327
- const result = await runProgrammaticStep({
1328
- ...mockParams,
1329
- stepsComplete: true,
1330
- })
1331
-
1332
- expect(executionSteps).toEqual([
1333
- 'initial execution',
1334
- 'post-processing with STEP_ALL',
1335
- ])
1336
- expect(result.endTurn).toBe(false) // Should not end due to STEP_ALL
1337
- expect(executeToolCallSpy).toHaveBeenCalledTimes(2) // read_files + write_file
1338
- })
1339
-
1340
- it('should handle complex post-processing workflow', async () => {
1341
- const workflowSteps: string[] = []
1342
- let stepCount = 0
1343
-
1344
- const mockGenerator = (function* () {
1345
- stepCount++
1346
- workflowSteps.push(`generator run ${stepCount}`)
1347
-
1348
- // Initial processing
1349
- const step1 = yield {
1350
- toolName: 'read_files',
1351
- input: { paths: ['input.txt'] },
1352
- }
1353
- workflowSteps.push(
1354
- `read completed, stepsComplete=${step1.stepsComplete}`,
1355
- )
1356
-
1357
- if (step1.stepsComplete) {
1358
- // Post-processing phase
1359
- workflowSteps.push('entering post-processing')
1360
-
1361
- // Analyze the input
1362
- yield {
1363
- toolName: 'code_search',
1364
- input: { pattern: 'TODO', flags: '-n' },
1365
- }
1366
-
1367
- // Create analysis report
1368
- yield {
1369
- toolName: 'write_file',
1370
- input: {
1371
- path: 'analysis.md',
1372
- instructions: 'Create analysis report',
1373
- content: '# Analysis Report\n\nTODO items found.',
1374
- },
1375
- }
1376
-
1377
- // Add subgoal for tracking
1378
- yield {
1379
- toolName: 'add_subgoal',
1380
- input: {
1381
- id: 'analysis-complete',
1382
- objective: 'Complete post-processing analysis',
1383
- status: 'COMPLETE',
1384
- },
1385
- }
1386
-
1387
- // Set final output
1388
- yield {
1389
- toolName: 'set_output',
1390
- input: {
1391
- phase: 'post-processing',
1392
- analysisCreated: true,
1393
- subgoalAdded: true,
1394
- },
1395
- }
1396
-
1397
- // Continue for more processing
1398
- const step2 = yield 'STEP'
1399
- workflowSteps.push(
1400
- `step after STEP: stepsComplete=${step2.stepsComplete}`,
1401
- )
1402
-
1403
- if (step2.stepsComplete) {
1404
- // Final cleanup
1405
- yield {
1406
- toolName: 'update_subgoal',
1407
- input: {
1408
- id: 'analysis-complete',
1409
- log: 'All post-processing completed',
1410
- },
1411
- }
1412
- }
1413
- } else {
1414
- // Normal processing
1415
- workflowSteps.push('normal processing mode')
1416
- yield {
1417
- toolName: 'set_output',
1418
- input: { phase: 'normal', message: 'Regular processing' },
1419
- }
1420
- }
1421
-
1422
- yield { toolName: 'end_turn', input: {} }
1423
- })() as StepGenerator
1424
-
1425
- mockTemplate.handleSteps = () => mockGenerator
1426
- mockTemplate.toolNames = [
1427
- 'read_files',
1428
- 'code_search',
1429
- 'write_file',
1430
- 'add_subgoal',
1431
- 'set_output',
1432
- 'update_subgoal',
1433
- 'end_turn',
1434
- ]
1435
-
1436
- executeToolCallSpy.mockImplementation(
1437
- async (
1438
- options: ParamsOf<typeof executeToolCall>,
1439
- ): ReturnType<typeof executeToolCall> => {
1440
- if (options.toolName === 'set_output') {
1441
- options.agentState.output = options.input
1442
- } else if (options.toolName === 'add_subgoal') {
1443
- options.agentState.agentContext[options.input.id as string] = {
1444
- ...options.input,
1445
- logs: [],
1446
- }
1447
- }
1448
- },
1449
- )
1450
-
1451
- // Call with stepsComplete=true to trigger post-processing
1452
- const result = await runProgrammaticStep({
1453
- ...mockParams,
1454
- stepsComplete: true,
1455
- })
1456
-
1457
- expect(workflowSteps).toEqual([
1458
- 'generator run 1',
1459
- 'read completed, stepsComplete=true',
1460
- 'entering post-processing',
1461
- ])
1462
-
1463
- expect(result.endTurn).toBe(false) // Should not end due to STEP
1464
- expect(result.agentState.output).toEqual({
1465
- phase: 'post-processing',
1466
- analysisCreated: true,
1467
- subgoalAdded: true,
1468
- })
1469
- expect(result.agentState.agentContext['analysis-complete']).toBeDefined()
1470
- expect(executeToolCallSpy).toHaveBeenCalledTimes(5) // read_files, code_search, write_file, add_subgoal, set_output
1471
- })
1472
- })
1473
-
1474
- describe('yield value validation', () => {
1475
- it('should reject invalid yield values', async () => {
1476
- const mockGenerator = (function* () {
1477
- yield { invalid: 'value' } as unknown
1478
- })() as StepGenerator
1479
-
1480
- mockTemplate.handleSteps = () => mockGenerator
1481
-
1482
- const responseChunks: unknown[] = []
1483
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
1484
-
1485
- const result = await runProgrammaticStep(mockParams)
1486
-
1487
- expect(result.endTurn).toBe(true)
1488
- expect(result.agentState.output?.error).toContain(
1489
- 'Invalid yield value from handleSteps',
1490
- )
1491
- })
1492
-
1493
- it('should reject yield values with wrong types', async () => {
1494
- const mockGenerator = (function* () {
1495
- yield { type: 'STEP_TEXT', text: 123 } as unknown // text should be string
1496
- })() as StepGenerator
1497
-
1498
- mockTemplate.handleSteps = () => mockGenerator
1499
-
1500
- const responseChunks: unknown[] = []
1501
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
1502
-
1503
- const result = await runProgrammaticStep(mockParams)
1504
-
1505
- expect(result.endTurn).toBe(true)
1506
- expect(result.agentState.output?.error).toContain(
1507
- 'Invalid yield value from handleSteps',
1508
- )
1509
- })
1510
-
1511
- it('should reject GENERATE_N with non-positive n', async () => {
1512
- const mockGenerator = (function* () {
1513
- yield { type: 'GENERATE_N', n: 0 } as unknown
1514
- })() as StepGenerator
1515
-
1516
- mockTemplate.handleSteps = () => mockGenerator
1517
-
1518
- const responseChunks: unknown[] = []
1519
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
1520
-
1521
- const result = await runProgrammaticStep(mockParams)
1522
-
1523
- expect(result.endTurn).toBe(true)
1524
- expect(result.agentState.output?.error).toContain(
1525
- 'Invalid yield value from handleSteps',
1526
- )
1527
- })
1528
-
1529
- it('should reject GENERATE_N with negative n', async () => {
1530
- const mockGenerator = (function* () {
1531
- yield { type: 'GENERATE_N', n: -5 } as unknown
1532
- })() as StepGenerator
1533
-
1534
- mockTemplate.handleSteps = () => mockGenerator
1535
-
1536
- const responseChunks: unknown[] = []
1537
- mockParams.onResponseChunk = (chunk) => responseChunks.push(chunk)
1538
-
1539
- const result = await runProgrammaticStep(mockParams)
1540
-
1541
- expect(result.endTurn).toBe(true)
1542
- expect(result.agentState.output?.error).toContain(
1543
- 'Invalid yield value from handleSteps',
1544
- )
1545
- })
1546
-
1547
- it('should accept valid STEP literal', async () => {
1548
- const mockGenerator = (function* () {
1549
- yield 'STEP'
1550
- })() as StepGenerator
1551
-
1552
- mockTemplate.handleSteps = () => mockGenerator
1553
-
1554
- const result = await runProgrammaticStep(mockParams)
1555
-
1556
- expect(result.endTurn).toBe(false)
1557
- expect(result.agentState.output?.error).toBeUndefined()
1558
- })
1559
-
1560
- it('should accept valid STEP_ALL literal', async () => {
1561
- const mockGenerator = (function* () {
1562
- yield 'STEP_ALL'
1563
- })() as StepGenerator
1564
-
1565
- mockTemplate.handleSteps = () => mockGenerator
1566
-
1567
- const result = await runProgrammaticStep(mockParams)
1568
-
1569
- expect(result.endTurn).toBe(false)
1570
- expect(result.agentState.output?.error).toBeUndefined()
1571
- })
1572
-
1573
- it('should accept valid STEP_TEXT object and continue to next step', async () => {
1574
- // STEP_TEXT continues to the next step of handleSteps (unlike STEP which breaks)
1575
- // So we need additional yields after STEP_TEXT to test the continuation
1576
- const mockGenerator = (function* () {
1577
- yield { type: 'STEP_TEXT', text: 'Custom response text' }
1578
- yield { toolName: 'end_turn', input: {} }
1579
- })() as StepGenerator
1580
-
1581
- mockTemplate.handleSteps = () => mockGenerator
1582
-
1583
- const result = await runProgrammaticStep(mockParams)
1584
-
1585
- // Should end turn because the generator continues after STEP_TEXT and reaches end_turn
1586
- expect(result.endTurn).toBe(true)
1587
- expect(result.agentState.output?.error).toBeUndefined()
1588
- })
1589
-
1590
- it('should accept valid GENERATE_N object', async () => {
1591
- const mockGenerator = (function* () {
1592
- yield { type: 'GENERATE_N', n: 3 }
1593
- })() as StepGenerator
1594
-
1595
- mockTemplate.handleSteps = () => mockGenerator
1596
-
1597
- const result = await runProgrammaticStep(mockParams)
1598
-
1599
- expect(result.endTurn).toBe(false)
1600
- expect(result.generateN).toBe(3)
1601
- expect(result.agentState.output?.error).toBeUndefined()
1602
- })
1603
-
1604
- it('should accept valid tool call object', async () => {
1605
- const mockGenerator = (function* () {
1606
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
1607
- yield { toolName: 'end_turn', input: {} }
1608
- })() as StepGenerator
1609
-
1610
- mockTemplate.handleSteps = () => mockGenerator
1611
-
1612
- const result = await runProgrammaticStep(mockParams)
1613
-
1614
- expect(result.endTurn).toBe(true)
1615
- expect(result.agentState.output?.error).toBeUndefined()
1616
- })
1617
-
1618
- it('should accept tool call with includeToolCall option', async () => {
1619
- const mockGenerator = (function* () {
1620
- yield {
1621
- toolName: 'read_files',
1622
- input: { paths: ['test.txt'] },
1623
- includeToolCall: false,
1624
- }
1625
- yield { toolName: 'end_turn', input: {} }
1626
- })() as StepGenerator
1627
-
1628
- mockTemplate.handleSteps = () => mockGenerator
1629
-
1630
- const result = await runProgrammaticStep(mockParams)
1631
-
1632
- expect(result.endTurn).toBe(true)
1633
- expect(result.agentState.output?.error).toBeUndefined()
1634
- })
1635
-
1636
- it('should reject random string values', async () => {
1637
- const mockGenerator = (function* () {
1638
- yield 'INVALID_STEP' as unknown
1639
- })() as StepGenerator
1640
-
1641
- mockTemplate.handleSteps = () => mockGenerator
1642
-
1643
- const result = await runProgrammaticStep(mockParams)
1644
-
1645
- expect(result.endTurn).toBe(true)
1646
- expect(result.agentState.output?.error).toContain(
1647
- 'Invalid yield value from handleSteps',
1648
- )
1649
- })
1650
-
1651
- it('should reject null yield values', async () => {
1652
- const mockGenerator = (function* () {
1653
- yield null as unknown
1654
- })() as StepGenerator
1655
-
1656
- mockTemplate.handleSteps = () => mockGenerator
1657
-
1658
- const result = await runProgrammaticStep(mockParams)
1659
-
1660
- expect(result.endTurn).toBe(true)
1661
- expect(result.agentState.output?.error).toContain(
1662
- 'Invalid yield value from handleSteps',
1663
- )
1664
- })
1665
-
1666
- it('should reject undefined yield values', async () => {
1667
- const mockGenerator = (function* () {
1668
- yield undefined as unknown
1669
- })() as StepGenerator
1670
-
1671
- mockTemplate.handleSteps = () => mockGenerator
1672
-
1673
- const result = await runProgrammaticStep(mockParams)
1674
-
1675
- expect(result.endTurn).toBe(true)
1676
- expect(result.agentState.output?.error).toContain(
1677
- 'Invalid yield value from handleSteps',
1678
- )
1679
- })
1680
-
1681
- it('should reject tool call without toolName', async () => {
1682
- const mockGenerator = (function* () {
1683
- yield { input: { paths: ['test.txt'] } } as unknown
1684
- })() as StepGenerator
1685
-
1686
- mockTemplate.handleSteps = () => mockGenerator
1687
-
1688
- const result = await runProgrammaticStep(mockParams)
1689
-
1690
- expect(result.endTurn).toBe(true)
1691
- expect(result.agentState.output?.error).toContain(
1692
- 'Invalid yield value from handleSteps',
1693
- )
1694
- })
1695
-
1696
- it('should reject tool call without input', async () => {
1697
- const mockGenerator = (function* () {
1698
- yield { toolName: 'read_files' } as unknown
1699
- })() as StepGenerator
1700
-
1701
- mockTemplate.handleSteps = () => mockGenerator
1702
-
1703
- const result = await runProgrammaticStep(mockParams)
1704
-
1705
- expect(result.endTurn).toBe(true)
1706
- expect(result.agentState.output?.error).toContain(
1707
- 'Invalid yield value from handleSteps',
1708
- )
1709
- })
1710
- })
1711
-
1712
- describe('logging and context', () => {
1713
- it('should log agent execution start', async () => {
1714
- const mockGenerator = (function* () {
1715
- yield { toolName: 'end_turn', input: {} }
1716
- })() as StepGenerator
1717
-
1718
- mockTemplate.handleSteps = () => mockGenerator
1719
-
1720
- await runProgrammaticStep(mockParams)
1721
-
1722
- // Logger is mocked, but we can verify the function completes without error
1723
- expect(true).toBe(true)
1724
- })
1725
-
1726
- it('should generate unique agent step ID', async () => {
1727
- const mockGenerator = (function* () {
1728
- yield { toolName: 'read_files', input: { paths: ['test.txt'] } }
1729
- yield { toolName: 'end_turn', input: {} }
1730
- })() as StepGenerator
1731
-
1732
- mockTemplate.handleSteps = () => mockGenerator
1733
-
1734
- await runProgrammaticStep(mockParams)
1735
-
1736
- expect(executeToolCallSpy).toHaveBeenCalledWith(
1737
- expect.objectContaining({
1738
- agentStepId: 'mock-uuid-0000-0000-0000-000000000000',
1739
- }),
1740
- )
1741
- })
1742
- })
1743
- })