@code-yeongyu/senpi 2026.7.10 → 2026.7.13

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 (547) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +4 -2
  3. package/dist/core/agent-session.d.ts +9 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +56 -15
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/extensions/builtin/bash-timeout/timeout.js +2 -2
  8. package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
  9. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  10. package/dist/core/extensions/builtin/compaction/index.js +10 -1
  11. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  12. package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
  13. package/dist/core/extensions/builtin/goal/store.js +88 -3
  14. package/dist/core/extensions/builtin/goal/store.js.map +1 -1
  15. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +3 -0
  16. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -0
  17. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +134 -0
  18. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -0
  19. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  20. package/dist/core/extensions/builtin/prompt-preset/presets.js +6 -0
  21. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  22. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
  23. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  24. package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
  25. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  26. package/dist/core/extensions/builtin/terminal/notify.d.ts +3 -3
  27. package/dist/core/extensions/builtin/terminal/notify.d.ts.map +1 -1
  28. package/dist/core/extensions/builtin/terminal/notify.js +7 -4
  29. package/dist/core/extensions/builtin/terminal/notify.js.map +1 -1
  30. package/dist/core/extensions/builtin/terminal/runtime-session.d.ts +5 -3
  31. package/dist/core/extensions/builtin/terminal/runtime-session.d.ts.map +1 -1
  32. package/dist/core/extensions/builtin/terminal/runtime-session.js +32 -16
  33. package/dist/core/extensions/builtin/terminal/runtime-session.js.map +1 -1
  34. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts +1 -1
  35. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
  36. package/dist/core/extensions/builtin/terminal/tools/bash-output.js +10 -4
  37. package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
  38. package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts.map +1 -1
  39. package/dist/core/extensions/builtin/todotools/tools/todowrite.js +5 -8
  40. package/dist/core/extensions/builtin/todotools/tools/todowrite.js.map +1 -1
  41. package/dist/core/extensions/runner.d.ts +1 -0
  42. package/dist/core/extensions/runner.d.ts.map +1 -1
  43. package/dist/core/extensions/runner.js +5 -0
  44. package/dist/core/extensions/runner.js.map +1 -1
  45. package/dist/core/extensions/types.d.ts +5 -8
  46. package/dist/core/extensions/types.d.ts.map +1 -1
  47. package/dist/core/extensions/types.js.map +1 -1
  48. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  49. package/dist/core/extensions/wrapper.js +22 -3
  50. package/dist/core/extensions/wrapper.js.map +1 -1
  51. package/dist/core/keybindings.d.ts +8 -3
  52. package/dist/core/keybindings.d.ts.map +1 -1
  53. package/dist/core/keybindings.js +7 -3
  54. package/dist/core/keybindings.js.map +1 -1
  55. package/dist/core/model-registry.d.ts +1 -6
  56. package/dist/core/model-registry.d.ts.map +1 -1
  57. package/dist/core/model-registry.js +19 -6
  58. package/dist/core/model-registry.js.map +1 -1
  59. package/dist/core/resource-loader.d.ts +1 -0
  60. package/dist/core/resource-loader.d.ts.map +1 -1
  61. package/dist/core/resource-loader.js +20 -2
  62. package/dist/core/resource-loader.js.map +1 -1
  63. package/dist/core/settings-manager.d.ts +4 -3
  64. package/dist/core/settings-manager.d.ts.map +1 -1
  65. package/dist/core/settings-manager.js +2 -1
  66. package/dist/core/settings-manager.js.map +1 -1
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +1 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/modes/interactive/compaction-queue-transfer.d.ts +22 -0
  72. package/dist/modes/interactive/compaction-queue-transfer.d.ts.map +1 -0
  73. package/dist/modes/interactive/compaction-queue-transfer.js +82 -0
  74. package/dist/modes/interactive/compaction-queue-transfer.js.map +1 -0
  75. package/dist/modes/interactive/components/custom-editor.js +1 -1
  76. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  77. package/dist/modes/interactive/components/login-dialog.d.ts +4 -0
  78. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  79. package/dist/modes/interactive/components/login-dialog.js +9 -2
  80. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  81. package/dist/modes/interactive/components/settings-selector.js +1 -1
  82. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  83. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  84. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  85. package/dist/modes/interactive/components/tool-execution-fallback.d.ts +6 -0
  86. package/dist/modes/interactive/components/tool-execution-fallback.d.ts.map +1 -0
  87. package/dist/modes/interactive/components/tool-execution-fallback.js +40 -0
  88. package/dist/modes/interactive/components/tool-execution-fallback.js.map +1 -0
  89. package/dist/modes/interactive/components/tool-execution-images.d.ts +23 -0
  90. package/dist/modes/interactive/components/tool-execution-images.d.ts.map +1 -0
  91. package/dist/modes/interactive/components/tool-execution-images.js +104 -0
  92. package/dist/modes/interactive/components/tool-execution-images.js.map +1 -0
  93. package/dist/modes/interactive/components/tool-execution-renderer.d.ts +28 -0
  94. package/dist/modes/interactive/components/tool-execution-renderer.d.ts.map +1 -0
  95. package/dist/modes/interactive/components/tool-execution-renderer.js +135 -0
  96. package/dist/modes/interactive/components/tool-execution-renderer.js.map +1 -0
  97. package/dist/modes/interactive/components/tool-execution-types.d.ts +23 -0
  98. package/dist/modes/interactive/components/tool-execution-types.d.ts.map +1 -0
  99. package/dist/modes/interactive/components/tool-execution-types.js +2 -0
  100. package/dist/modes/interactive/components/tool-execution-types.js.map +1 -0
  101. package/dist/modes/interactive/components/tool-execution.d.ts +13 -39
  102. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/tool-execution.js +51 -294
  104. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  105. package/dist/modes/interactive/components/tool-renderer-boundary.d.ts +17 -0
  106. package/dist/modes/interactive/components/tool-renderer-boundary.d.ts.map +1 -0
  107. package/dist/modes/interactive/components/tool-renderer-boundary.js +75 -0
  108. package/dist/modes/interactive/components/tool-renderer-boundary.js.map +1 -0
  109. package/dist/modes/interactive/components/tree-selector.d.ts +5 -0
  110. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  111. package/dist/modes/interactive/components/tree-selector.js +50 -17
  112. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  113. package/dist/modes/interactive/interactive-mode.d.ts +5 -2
  114. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  115. package/dist/modes/interactive/interactive-mode.js +127 -109
  116. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  117. package/dist/modes/interactive/theme/dark.json +1 -0
  118. package/dist/modes/interactive/theme/light.json +1 -0
  119. package/dist/modes/interactive/theme/theme-schema.json +6 -2
  120. package/dist/modes/interactive/theme/theme.d.ts +3 -2
  121. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  122. package/dist/modes/interactive/theme/theme.js +11 -4
  123. package/dist/modes/interactive/theme/theme.js.map +1 -1
  124. package/dist/utils/clipboard-native.d.ts +1 -0
  125. package/dist/utils/clipboard-native.d.ts.map +1 -1
  126. package/dist/utils/clipboard-native.js.map +1 -1
  127. package/dist/utils/clipboard.d.ts +2 -0
  128. package/dist/utils/clipboard.d.ts.map +1 -1
  129. package/dist/utils/clipboard.js +13 -0
  130. package/dist/utils/clipboard.js.map +1 -1
  131. package/docs/custom-provider.md +4 -3
  132. package/docs/extensions.md +140 -1
  133. package/docs/keybindings.md +1 -0
  134. package/docs/models.md +45 -4
  135. package/docs/providers.md +3 -0
  136. package/docs/quickstart.md +1 -1
  137. package/docs/rpc.md +2 -2
  138. package/docs/sdk.md +1 -1
  139. package/docs/settings.md +3 -3
  140. package/docs/themes.md +5 -3
  141. package/docs/tui.md +1 -1
  142. package/docs/usage.md +2 -1
  143. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  144. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  145. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  146. package/examples/extensions/gondolin/package-lock.json +2 -2
  147. package/examples/extensions/gondolin/package.json +1 -1
  148. package/examples/extensions/sandbox/package-lock.json +2 -2
  149. package/examples/extensions/sandbox/package.json +1 -1
  150. package/examples/extensions/with-deps/package-lock.json +2 -2
  151. package/examples/extensions/with-deps/package.json +1 -1
  152. package/node_modules/@babel/helper-string-parser/LICENSE +22 -0
  153. package/node_modules/@babel/helper-string-parser/README.md +19 -0
  154. package/node_modules/@babel/helper-string-parser/lib/index.js +295 -0
  155. package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -0
  156. package/node_modules/@babel/helper-string-parser/package.json +31 -0
  157. package/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
  158. package/node_modules/@babel/helper-validator-identifier/README.md +19 -0
  159. package/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
  160. package/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
  161. package/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
  162. package/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
  163. package/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
  164. package/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
  165. package/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  166. package/node_modules/@babel/parser/LICENSE +19 -0
  167. package/node_modules/@babel/parser/README.md +19 -0
  168. package/node_modules/@babel/parser/bin/babel-parser.js +15 -0
  169. package/node_modules/@babel/parser/lib/index.js +14599 -0
  170. package/node_modules/@babel/parser/lib/index.js.map +1 -0
  171. package/node_modules/@babel/parser/package.json +50 -0
  172. package/node_modules/@babel/parser/typings/babel-parser.d.ts +262 -0
  173. package/node_modules/@babel/types/LICENSE +22 -0
  174. package/node_modules/@babel/types/README.md +19 -0
  175. package/node_modules/@babel/types/lib/asserts/assertNode.js +16 -0
  176. package/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -0
  177. package/node_modules/@babel/types/lib/asserts/generated/index.js +1251 -0
  178. package/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -0
  179. package/node_modules/@babel/types/lib/ast-types/generated/index.js +3 -0
  180. package/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -0
  181. package/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +18 -0
  182. package/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -0
  183. package/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +31 -0
  184. package/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -0
  185. package/node_modules/@babel/types/lib/builders/generated/index.js +29 -0
  186. package/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -0
  187. package/node_modules/@babel/types/lib/builders/generated/lowercase.js +2902 -0
  188. package/node_modules/@babel/types/lib/builders/generated/lowercase.js.map +1 -0
  189. package/node_modules/@babel/types/lib/builders/generated/uppercase.js +272 -0
  190. package/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -0
  191. package/node_modules/@babel/types/lib/builders/productions.js +12 -0
  192. package/node_modules/@babel/types/lib/builders/productions.js.map +1 -0
  193. package/node_modules/@babel/types/lib/builders/react/buildChildren.js +24 -0
  194. package/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -0
  195. package/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +22 -0
  196. package/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -0
  197. package/node_modules/@babel/types/lib/builders/validateNode.js +21 -0
  198. package/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -0
  199. package/node_modules/@babel/types/lib/clone/clone.js +12 -0
  200. package/node_modules/@babel/types/lib/clone/clone.js.map +1 -0
  201. package/node_modules/@babel/types/lib/clone/cloneDeep.js +12 -0
  202. package/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -0
  203. package/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +12 -0
  204. package/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -0
  205. package/node_modules/@babel/types/lib/clone/cloneNode.js +107 -0
  206. package/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -0
  207. package/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +12 -0
  208. package/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -0
  209. package/node_modules/@babel/types/lib/comments/addComment.js +15 -0
  210. package/node_modules/@babel/types/lib/comments/addComment.js.map +1 -0
  211. package/node_modules/@babel/types/lib/comments/addComments.js +22 -0
  212. package/node_modules/@babel/types/lib/comments/addComments.js.map +1 -0
  213. package/node_modules/@babel/types/lib/comments/inheritInnerComments.js +12 -0
  214. package/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -0
  215. package/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +12 -0
  216. package/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -0
  217. package/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +12 -0
  218. package/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -0
  219. package/node_modules/@babel/types/lib/comments/inheritsComments.js +17 -0
  220. package/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -0
  221. package/node_modules/@babel/types/lib/comments/removeComments.js +15 -0
  222. package/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -0
  223. package/node_modules/@babel/types/lib/constants/generated/index.js +60 -0
  224. package/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -0
  225. package/node_modules/@babel/types/lib/constants/index.js +31 -0
  226. package/node_modules/@babel/types/lib/constants/index.js.map +1 -0
  227. package/node_modules/@babel/types/lib/converters/ensureBlock.js +14 -0
  228. package/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -0
  229. package/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +65 -0
  230. package/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -0
  231. package/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +14 -0
  232. package/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -0
  233. package/node_modules/@babel/types/lib/converters/toBlock.js +29 -0
  234. package/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -0
  235. package/node_modules/@babel/types/lib/converters/toComputedKey.js +14 -0
  236. package/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -0
  237. package/node_modules/@babel/types/lib/converters/toExpression.js +28 -0
  238. package/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -0
  239. package/node_modules/@babel/types/lib/converters/toIdentifier.js +25 -0
  240. package/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -0
  241. package/node_modules/@babel/types/lib/converters/toKeyAlias.js +38 -0
  242. package/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -0
  243. package/node_modules/@babel/types/lib/converters/toSequenceExpression.js +19 -0
  244. package/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -0
  245. package/node_modules/@babel/types/lib/converters/toStatement.js +39 -0
  246. package/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -0
  247. package/node_modules/@babel/types/lib/converters/valueToNode.js +89 -0
  248. package/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -0
  249. package/node_modules/@babel/types/lib/definitions/core.js +1725 -0
  250. package/node_modules/@babel/types/lib/definitions/core.js.map +1 -0
  251. package/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +11 -0
  252. package/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +1 -0
  253. package/node_modules/@babel/types/lib/definitions/experimental.js +124 -0
  254. package/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -0
  255. package/node_modules/@babel/types/lib/definitions/flow.js +495 -0
  256. package/node_modules/@babel/types/lib/definitions/flow.js.map +1 -0
  257. package/node_modules/@babel/types/lib/definitions/index.js +106 -0
  258. package/node_modules/@babel/types/lib/definitions/index.js.map +1 -0
  259. package/node_modules/@babel/types/lib/definitions/jsx.js +157 -0
  260. package/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -0
  261. package/node_modules/@babel/types/lib/definitions/misc.js +31 -0
  262. package/node_modules/@babel/types/lib/definitions/misc.js.map +1 -0
  263. package/node_modules/@babel/types/lib/definitions/placeholders.js +27 -0
  264. package/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -0
  265. package/node_modules/@babel/types/lib/definitions/typescript.js +528 -0
  266. package/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -0
  267. package/node_modules/@babel/types/lib/definitions/utils.js +296 -0
  268. package/node_modules/@babel/types/lib/definitions/utils.js.map +1 -0
  269. package/node_modules/@babel/types/lib/index-legacy.d.ts +2797 -0
  270. package/node_modules/@babel/types/lib/index.d.ts +3617 -0
  271. package/node_modules/@babel/types/lib/index.js +582 -0
  272. package/node_modules/@babel/types/lib/index.js.flow +2650 -0
  273. package/node_modules/@babel/types/lib/index.js.map +1 -0
  274. package/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +15 -0
  275. package/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -0
  276. package/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +65 -0
  277. package/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -0
  278. package/node_modules/@babel/types/lib/modifications/inherits.js +28 -0
  279. package/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -0
  280. package/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +17 -0
  281. package/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -0
  282. package/node_modules/@babel/types/lib/modifications/removeProperties.js +24 -0
  283. package/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -0
  284. package/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +14 -0
  285. package/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -0
  286. package/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +66 -0
  287. package/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -0
  288. package/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js +48 -0
  289. package/node_modules/@babel/types/lib/retrievers/getAssignmentIdentifiers.js.map +1 -0
  290. package/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +102 -0
  291. package/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -0
  292. package/node_modules/@babel/types/lib/retrievers/getFunctionName.js +63 -0
  293. package/node_modules/@babel/types/lib/retrievers/getFunctionName.js.map +1 -0
  294. package/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +13 -0
  295. package/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -0
  296. package/node_modules/@babel/types/lib/traverse/traverse.js +50 -0
  297. package/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -0
  298. package/node_modules/@babel/types/lib/traverse/traverseFast.js +40 -0
  299. package/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -0
  300. package/node_modules/@babel/types/lib/utils/deprecationWarning.js +44 -0
  301. package/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +1 -0
  302. package/node_modules/@babel/types/lib/utils/inherit.js +13 -0
  303. package/node_modules/@babel/types/lib/utils/inherit.js.map +1 -0
  304. package/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +40 -0
  305. package/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -0
  306. package/node_modules/@babel/types/lib/utils/shallowEqual.js +17 -0
  307. package/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -0
  308. package/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +13 -0
  309. package/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -0
  310. package/node_modules/@babel/types/lib/validators/generated/index.js +2797 -0
  311. package/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -0
  312. package/node_modules/@babel/types/lib/validators/is.js +27 -0
  313. package/node_modules/@babel/types/lib/validators/is.js.map +1 -0
  314. package/node_modules/@babel/types/lib/validators/isBinding.js +27 -0
  315. package/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -0
  316. package/node_modules/@babel/types/lib/validators/isBlockScoped.js +13 -0
  317. package/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -0
  318. package/node_modules/@babel/types/lib/validators/isImmutable.js +21 -0
  319. package/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -0
  320. package/node_modules/@babel/types/lib/validators/isLet.js +13 -0
  321. package/node_modules/@babel/types/lib/validators/isLet.js.map +1 -0
  322. package/node_modules/@babel/types/lib/validators/isNode.js +12 -0
  323. package/node_modules/@babel/types/lib/validators/isNode.js.map +1 -0
  324. package/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +57 -0
  325. package/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -0
  326. package/node_modules/@babel/types/lib/validators/isPlaceholderType.js +15 -0
  327. package/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -0
  328. package/node_modules/@babel/types/lib/validators/isReferenced.js +96 -0
  329. package/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -0
  330. package/node_modules/@babel/types/lib/validators/isScope.js +18 -0
  331. package/node_modules/@babel/types/lib/validators/isScope.js.map +1 -0
  332. package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +14 -0
  333. package/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -0
  334. package/node_modules/@babel/types/lib/validators/isType.js +17 -0
  335. package/node_modules/@babel/types/lib/validators/isType.js.map +1 -0
  336. package/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +13 -0
  337. package/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -0
  338. package/node_modules/@babel/types/lib/validators/isValidIdentifier.js +18 -0
  339. package/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -0
  340. package/node_modules/@babel/types/lib/validators/isVar.js +15 -0
  341. package/node_modules/@babel/types/lib/validators/isVar.js.map +1 -0
  342. package/node_modules/@babel/types/lib/validators/matchesPattern.js +44 -0
  343. package/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -0
  344. package/node_modules/@babel/types/lib/validators/react/isCompatTag.js +11 -0
  345. package/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -0
  346. package/node_modules/@babel/types/lib/validators/react/isReactComponent.js +11 -0
  347. package/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -0
  348. package/node_modules/@babel/types/lib/validators/validate.js +42 -0
  349. package/node_modules/@babel/types/lib/validators/validate.js.map +1 -0
  350. package/node_modules/@babel/types/package.json +39 -0
  351. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +13 -2
  352. package/node_modules/@code-yeongyu/senpi-codemode/README.md +128 -78
  353. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -3
  354. package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/protocol.ts +22 -9
  355. package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/reserved.ts +9 -0
  356. package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/agent-bridge.ts +197 -0
  357. package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/output-bridge.ts +96 -0
  358. package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/schema-injection.ts +3 -0
  359. package/node_modules/@code-yeongyu/senpi-codemode/src/completion/handler.ts +95 -26
  360. package/node_modules/@code-yeongyu/senpi-codemode/src/completion/tool-bridge.ts +14 -2
  361. package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +96 -8
  362. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +92 -10
  363. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +187 -27
  364. package/node_modules/@code-yeongyu/senpi-codemode/src/interpreters/detect.ts +1 -1
  365. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/prelude.jl +252 -48
  366. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/runner.jl +263 -83
  367. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +198 -149
  368. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/inline-worker-entry.js +23 -0
  369. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/inline-worker.ts +4 -175
  370. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-contract.ts +38 -0
  371. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/local-module-loader.ts +108 -0
  372. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +8 -6
  373. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/rewrite-imports.ts +164 -0
  374. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/run-queue.ts +82 -0
  375. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-core.js +13 -4
  376. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-host.ts +117 -0
  377. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +307 -41
  378. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel-contract.ts +32 -0
  379. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel.ts +232 -199
  380. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +792 -79
  381. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/process.ts +119 -0
  382. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/transport.ts +237 -0
  383. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/prelude.rb +234 -21
  384. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/runner.rb +154 -51
  385. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-contract.ts +22 -0
  386. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-kernel.ts +214 -189
  387. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-process.ts +174 -0
  388. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-queue.ts +101 -0
  389. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-run.ts +98 -0
  390. package/node_modules/@code-yeongyu/senpi-codemode/src/output/output-meta.ts +89 -0
  391. package/node_modules/@code-yeongyu/senpi-codemode/src/output/streaming-output.ts +296 -0
  392. package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +107 -30
  393. package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/bridge-timeout.ts +2 -0
  394. package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/idle-timeout.ts +8 -19
  395. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +267 -0
  396. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +226 -211
  397. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/image.ts +274 -0
  398. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/json-tree.ts +247 -0
  399. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +828 -35
  400. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/status-events.ts +12 -0
  401. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +30 -1
  402. package/node_modules/@earendil-works/pi-agent-core/README.md +1 -1
  403. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +2 -0
  404. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  405. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +4 -3
  406. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  407. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  408. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  409. package/node_modules/@earendil-works/pi-ai/README.md +4 -2
  410. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  411. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +89 -40
  412. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  413. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +1 -1
  414. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  415. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  416. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  417. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +7 -7
  418. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  419. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +1 -1
  420. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  421. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +10 -3
  422. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  423. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +1 -1
  424. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  425. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -1
  426. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  427. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +3 -1
  428. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  429. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +35 -4
  430. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  431. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +1 -1
  432. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  433. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -3
  434. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  435. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
  436. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +8 -3
  437. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
  438. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts.map +1 -1
  439. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +4 -3
  440. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
  441. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
  442. package/node_modules/@earendil-works/pi-ai/dist/compat.js +2 -1
  443. package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
  444. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  445. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +483 -61
  446. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  447. package/node_modules/@earendil-works/pi-ai/dist/models.js +13 -4
  448. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  449. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
  450. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +5 -1
  451. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
  452. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +62 -5
  453. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts.map +1 -1
  454. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +32 -20
  455. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js.map +1 -1
  456. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +11 -1
  457. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts.map +1 -1
  458. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +6 -4
  459. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js.map +1 -1
  460. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +7 -8
  461. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts.map +1 -1
  462. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +20 -21
  463. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js.map +1 -1
  464. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +11 -1
  465. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts.map +1 -1
  466. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +6 -4
  467. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js.map +1 -1
  468. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.d.ts.map +1 -1
  469. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js +9 -6
  470. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-auth.js.map +1 -1
  471. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts +2 -2
  472. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.d.ts.map +1 -1
  473. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +2 -2
  474. package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js.map +1 -1
  475. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +2 -2
  476. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts.map +1 -1
  477. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +2 -2
  478. package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js.map +1 -1
  479. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +100 -2
  480. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts.map +1 -1
  481. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +64 -5
  482. package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js.map +1 -1
  483. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +56 -0
  484. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts.map +1 -1
  485. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +20 -9
  486. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js.map +1 -1
  487. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +77 -8
  488. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts.map +1 -1
  489. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +37 -24
  490. package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js.map +1 -1
  491. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +3 -3
  492. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts.map +1 -1
  493. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +3 -3
  494. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js.map +1 -1
  495. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +80 -4
  496. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts.map +1 -1
  497. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +64 -8
  498. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js.map +1 -1
  499. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +25 -22
  500. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts.map +1 -1
  501. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +68 -83
  502. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js.map +1 -1
  503. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +45 -1
  504. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts.map +1 -1
  505. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +49 -13
  506. package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js.map +1 -1
  507. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +1 -1
  508. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts.map +1 -1
  509. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +1 -1
  510. package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js.map +1 -1
  511. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +1 -1
  512. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts.map +1 -1
  513. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +1 -1
  514. package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js.map +1 -1
  515. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +30 -7
  516. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  517. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  518. package/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.d.ts +9 -0
  519. package/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.d.ts.map +1 -0
  520. package/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +36 -0
  521. package/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js.map +1 -0
  522. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts +3 -3
  523. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts.map +1 -1
  524. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +35 -14
  525. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
  526. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  527. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  528. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  529. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +2 -1
  530. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  531. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +2 -1
  532. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  533. package/node_modules/@earendil-works/pi-tui/dist/index.js +2 -1
  534. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  535. package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +1 -1
  536. package/node_modules/@earendil-works/pi-tui/dist/keys.js +6 -5
  537. package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +1 -1
  538. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -1
  539. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  540. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -9
  541. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  542. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts +4 -0
  543. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts.map +1 -0
  544. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js +18 -0
  545. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js.map +1 -0
  546. package/node_modules/@earendil-works/pi-tui/package.json +2 -2
  547. package/package.json +6 -6
@@ -1,77 +1,870 @@
1
- import type { AgentToolResult, ToolDefinition, ToolRenderResultOptions } from "@code-yeongyu/senpi";
2
- import type { createEvalInputSchema, EvalToolDetails, EvalToolInput } from "./types.ts";
1
+ // allow: SIZE_OK one eval render pipeline avoids the runtime/render TDZ that motivated this module boundary.
2
+ import {
3
+ type AgentToolResult,
4
+ highlightCode,
5
+ sanitizeTerminalLabel,
6
+ type Theme,
7
+ type ThemeColor,
8
+ type ToolDefinition,
9
+ type ToolRenderResultOptions,
10
+ truncateToVisualLines,
11
+ } from "@code-yeongyu/senpi";
12
+ import { formatTruncationWarning, stripOutputNotice, type TruncationMeta } from "../output/output-meta.ts";
13
+ import {
14
+ JSON_TREE_MAX_DEPTH_COLLAPSED,
15
+ JSON_TREE_MAX_DEPTH_EXPANDED,
16
+ JSON_TREE_MAX_LINES_COLLAPSED,
17
+ JSON_TREE_MAX_LINES_EXPANDED,
18
+ JSON_TREE_SCALAR_LEN_COLLAPSED,
19
+ JSON_TREE_SCALAR_LEN_EXPANDED,
20
+ renderJsonTreeLines,
21
+ } from "./json-tree.ts";
22
+ import type {
23
+ EvalCellResult,
24
+ EvalInputSchema,
25
+ EvalLanguage,
26
+ EvalStatusEvent,
27
+ EvalToolDetails,
28
+ EvalToolInput,
29
+ } from "./types.ts";
3
30
 
4
- type EvalToolDefinition = ToolDefinition<ReturnType<typeof createEvalInputSchema>, EvalToolDetails>;
31
+ type EvalToolDefinition = ToolDefinition<EvalInputSchema, EvalToolDetails>;
5
32
  type RenderContext = Parameters<NonNullable<EvalToolDefinition["renderCall"]>>[2];
6
- type Component = ReturnType<NonNullable<EvalToolDefinition["renderCall"]>>;
33
+ type ResultRenderContext = Parameters<NonNullable<EvalToolDefinition["renderResult"]>>[3];
34
+ type CollapsibleKind = "code" | "output";
7
35
 
8
- class PlainTextComponent {
9
- #text = "";
36
+ export interface EvalRenderComponent {
37
+ render(width: number): string[];
38
+ invalidate(): void;
39
+ }
40
+ type ToolCallRow = {
41
+ readonly summary: string;
42
+ readonly error?: string;
43
+ readonly color: "success" | "error";
44
+ };
45
+ type RenderBlock =
46
+ | { readonly kind: "blank" }
47
+ | {
48
+ readonly kind: "text";
49
+ readonly text: string;
50
+ readonly maxVisualLines?: number;
51
+ readonly collapseKind?: CollapsibleKind;
52
+ readonly theme?: Theme;
53
+ }
54
+ | {
55
+ readonly kind: "toolCalls";
56
+ readonly calls: readonly ToolCallRow[];
57
+ readonly expanded: boolean;
58
+ readonly theme?: Theme;
59
+ }
60
+ | { readonly kind: "dynamic"; readonly render: (width: number) => readonly string[] };
61
+
62
+ const CODE_PREVIEW_LINES = 4;
63
+ const OUTPUT_PREVIEW_LINES = 8;
64
+ const STATUS_PREVIEW_COUNT = 3;
65
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] as const;
66
+ const TOOL_CALL_PREVIEW_COUNT = 5;
67
+ const TOOL_CALL_COLLAPSED_VISUAL_LINES = 4;
68
+ const TOOL_CALL_COLLAPSED_ERROR_CODE_POINTS = 512;
69
+ const TOOL_ERROR_OMISSION_MARKER = "[tool error omitted]";
10
70
 
11
- setText(text: string): void {
12
- this.#text = text;
71
+ class PlainTextComponent implements EvalRenderComponent {
72
+ #blocks: readonly RenderBlock[] = [];
73
+
74
+ setBlocks(blocks: readonly RenderBlock[]): void {
75
+ this.#blocks = blocks;
13
76
  }
14
77
 
15
- render(): string[] {
16
- return this.#text ? this.#text.split("\n") : [];
78
+ render(width: number): string[] {
79
+ const lines: string[] = [];
80
+ for (const block of this.#blocks) {
81
+ switch (block.kind) {
82
+ case "blank":
83
+ lines.push("");
84
+ break;
85
+ case "toolCalls":
86
+ appendLines(lines, renderToolCallBlock(block, width));
87
+ break;
88
+ case "text":
89
+ appendLines(lines, renderTextBlock(block, width));
90
+ break;
91
+ case "dynamic":
92
+ appendLines(lines, block.render(width));
93
+ break;
94
+ default:
95
+ assertNever(block);
96
+ }
97
+ }
98
+ return lines;
17
99
  }
18
100
 
19
101
  invalidate(): void {}
20
102
  }
21
103
 
22
- function componentFor(context: RenderContext): PlainTextComponent {
104
+ function componentFor(context: RenderContext | ResultRenderContext): PlainTextComponent {
23
105
  const existing = context.lastComponent;
24
106
  if (existing instanceof PlainTextComponent) return existing;
25
107
  return new PlainTextComponent();
26
108
  }
27
109
 
28
- function firstCodeLine(code: string | undefined): string {
29
- const line = code?.split(/\r?\n/, 1)[0]?.trim();
30
- return line && line.length > 0 ? line : "...";
110
+ function style(theme: Theme | undefined, color: ThemeColor, text: string): string {
111
+ return theme ? theme.fg(color, text) : text;
31
112
  }
32
113
 
33
- function textOutput(result: AgentToolResult<EvalToolDetails>, showImages: boolean): string {
114
+ function appendLines(target: string[], source: readonly string[]): void {
115
+ for (const line of source) target.push(line);
116
+ }
117
+
118
+ function codePointPrefix(text: string, maxCodePoints: number): string {
119
+ let end = 0;
120
+ for (let count = 0; count < maxCodePoints && end < text.length; count += 1) {
121
+ const firstCodeUnit = text.charCodeAt(end);
122
+ const secondCodeUnit = text.charCodeAt(end + 1);
123
+ const isSurrogatePair =
124
+ firstCodeUnit >= 0xd800 && firstCodeUnit <= 0xdbff && secondCodeUnit >= 0xdc00 && secondCodeUnit <= 0xdfff;
125
+ end += isSurrogatePair ? 2 : 1;
126
+ }
127
+ return text.slice(0, end);
128
+ }
129
+
130
+ function renderAllVisualLines(text: string, width: number): string[] {
131
+ return truncateToVisualLines(text, Number.POSITIVE_INFINITY, width).visualLines.map((line) => line.trimEnd());
132
+ }
133
+
134
+ function renderTextBlock(block: Extract<RenderBlock, { kind: "text" }>, width: number): string[] {
135
+ if (block.maxVisualLines === undefined) return renderAllVisualLines(block.text, width);
136
+ const result = truncateToVisualLines(block.text, block.maxVisualLines, width);
137
+ const visualLines = result.visualLines.map((line) => line.trimEnd());
138
+ if (result.skippedCount === 0 || block.collapseKind === undefined) return visualLines;
139
+ return [
140
+ ...renderAllVisualLines(
141
+ style(block.theme, "muted", `${result.skippedCount} earlier ${block.collapseKind} lines`),
142
+ width,
143
+ ),
144
+ ...visualLines,
145
+ ];
146
+ }
147
+
148
+ function renderToolCall(
149
+ call: ToolCallRow,
150
+ block: Extract<RenderBlock, { kind: "toolCalls" }>,
151
+ width: number,
152
+ ): string[] {
153
+ if (call.error === undefined) return renderAllVisualLines(style(block.theme, call.color, call.summary), width);
154
+ if (block.expanded)
155
+ return renderAllVisualLines(style(block.theme, call.color, `${call.summary} (${call.error})`), width);
156
+
157
+ const guardedError = codePointPrefix(call.error, TOOL_CALL_COLLAPSED_ERROR_CODE_POINTS);
158
+ const guardedLines = renderAllVisualLines(
159
+ style(block.theme, call.color, `${call.summary} (${guardedError})`),
160
+ width,
161
+ );
162
+ if (guardedError.length === call.error.length && guardedLines.length <= TOOL_CALL_COLLAPSED_VISUAL_LINES)
163
+ return guardedLines;
164
+
165
+ const summaryLines = renderAllVisualLines(style(block.theme, call.color, call.summary), width);
166
+ const errorLines = renderAllVisualLines(style(block.theme, call.color, ` (${guardedError})`), width);
167
+ const markerLines = renderAllVisualLines(style(block.theme, "muted", TOOL_ERROR_OMISSION_MARKER), width);
168
+ const lines: string[] = [];
169
+ const summaryBudget = Math.max(1, TOOL_CALL_COLLAPSED_VISUAL_LINES - markerLines.length);
170
+ appendLines(lines, summaryLines.slice(0, summaryBudget));
171
+ const errorBudget = Math.max(0, TOOL_CALL_COLLAPSED_VISUAL_LINES - lines.length - markerLines.length);
172
+ appendLines(lines, errorLines.slice(0, errorBudget));
173
+ appendLines(lines, markerLines.slice(0, TOOL_CALL_COLLAPSED_VISUAL_LINES - lines.length));
174
+ return lines;
175
+ }
176
+
177
+ function renderToolCallBlock(block: Extract<RenderBlock, { kind: "toolCalls" }>, width: number): string[] {
178
+ const retainedCalls = block.expanded ? block.calls : block.calls.slice(-TOOL_CALL_PREVIEW_COUNT);
179
+ const skippedCount = block.calls.length - retainedCalls.length;
180
+ const toolCallNoun = skippedCount === 1 ? "call" : "calls";
181
+ const lines =
182
+ block.expanded || skippedCount === 0
183
+ ? []
184
+ : renderAllVisualLines(style(block.theme, "muted", `${skippedCount} earlier tool ${toolCallNoun}`), width);
185
+ for (const call of retainedCalls) {
186
+ appendLines(lines, renderToolCall(call, block, width));
187
+ }
188
+ return lines;
189
+ }
190
+
191
+ type CellStatus = EvalCellResult["status"];
192
+ type AgentStatus = "pending" | "running" | "completed" | "failed" | "aborted";
193
+ type StatusPresentation = { readonly label: string; readonly icon: string; readonly color: ThemeColor };
194
+ type RenderEnvironment = {
195
+ readonly expanded: boolean;
196
+ readonly theme: Theme | undefined;
197
+ readonly spinnerFrame: number | undefined;
198
+ readonly width: number;
199
+ readonly meta: TruncationMeta | undefined;
200
+ };
201
+ type CellBadges = { readonly reset: boolean; readonly timeout: number | undefined };
202
+ type PrefixStyle = { readonly prefix: string; readonly continuation: string; readonly color: ThemeColor };
203
+ type DetailedRenderContext = {
204
+ readonly environment: RenderEnvironment;
205
+ readonly args: EvalToolInput;
206
+ readonly showImageFallback: boolean;
207
+ };
208
+
209
+ function assertNever(value: never): never {
210
+ throw new TypeError(`Unhandled eval render variant: ${String(value)}`);
211
+ }
212
+
213
+ function languageForHighlighter(language: EvalLanguage): "python" | "javascript" | "ruby" | "julia" {
214
+ switch (language) {
215
+ case "py":
216
+ return "python";
217
+ case "js":
218
+ return "javascript";
219
+ case "rb":
220
+ return "ruby";
221
+ case "jl":
222
+ return "julia";
223
+ default:
224
+ return assertNever(language);
225
+ }
226
+ }
227
+
228
+ function highlightedCode(code: string, language: EvalLanguage, theme: Theme | undefined): string {
229
+ const normalizedCode = code.trim().length > 0 ? code : "...";
230
+ const lines = highlightCode(normalizedCode, languageForHighlighter(language));
231
+ return (theme === undefined ? lines.map((line) => line.replace(/\u001b\[[0-9;]*m/gu, "")) : lines).join("\n");
232
+ }
233
+
234
+ function formatDuration(milliseconds: number): string {
235
+ const totalSeconds = Math.floor(Math.max(0, milliseconds) / 1_000);
236
+ if (totalSeconds < 1) return "<1s";
237
+ const seconds = totalSeconds % 60;
238
+ const totalMinutes = Math.floor(totalSeconds / 60);
239
+ if (totalMinutes < 1) return `${seconds}s`;
240
+ const minutes = totalMinutes % 60;
241
+ const hours = Math.floor(totalMinutes / 60);
242
+ if (hours < 1) return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
243
+ return minutes === 0 ? `${hours}h` : `${hours}h ${minutes}m`;
244
+ }
245
+
246
+ function spinner(frame: number | undefined): string {
247
+ return SPINNER_FRAMES.at((frame ?? 0) % SPINNER_FRAMES.length) ?? SPINNER_FRAMES[0];
248
+ }
249
+
250
+ function cellPresentation(status: CellStatus, spinnerFrame: number | undefined): StatusPresentation {
251
+ switch (status) {
252
+ case "pending":
253
+ return { label: "pending", icon: "○", color: "muted" };
254
+ case "running":
255
+ return { label: "running", icon: spinner(spinnerFrame), color: "warning" };
256
+ case "complete":
257
+ return { label: "done", icon: "✓", color: "success" };
258
+ case "error":
259
+ return { label: "error", icon: "✗", color: "error" };
260
+ default:
261
+ return assertNever(status);
262
+ }
263
+ }
264
+
265
+ function renderPrefixed(text: string, environment: RenderEnvironment, prefixStyle: PrefixStyle): string[] {
266
+ const bodyLines = renderAllVisualLines(text, Math.max(1, environment.width - prefixStyle.prefix.length));
267
+ if (bodyLines.length === 0) return [style(environment.theme, prefixStyle.color, prefixStyle.prefix.trimEnd())];
268
+ return bodyLines.map(
269
+ (line, index) =>
270
+ `${style(environment.theme, prefixStyle.color, index === 0 ? prefixStyle.prefix : prefixStyle.continuation)}${line}`,
271
+ );
272
+ }
273
+
274
+ function cellHeader(cell: EvalCellResult, environment: RenderEnvironment, badges: CellBadges): string {
275
+ const presentation = cellPresentation(cell.status, environment.spinnerFrame);
276
+ const title = cell.title === undefined ? "" : ` ${cell.title}`;
277
+ let header = `eval ${cell.language}${title} ${presentation.label} ${presentation.icon}`;
278
+ if (cell.durationMs !== undefined) header += ` · ${formatDuration(cell.durationMs)}`;
279
+ if (badges.reset) header += " · reset";
280
+ if (badges.timeout !== undefined) header += ` · timeout ${badges.timeout}s`;
281
+ return style(environment.theme, presentation.color, header);
282
+ }
283
+
284
+ function previewText(
285
+ text: string,
286
+ maxLines: number,
287
+ width: number,
288
+ ): { readonly lines: string[]; readonly skipped: number } {
289
+ const preview = truncateToVisualLines(text, maxLines, Math.max(1, width));
290
+ return { lines: preview.visualLines.map((line) => line.trimEnd()), skipped: preview.skippedCount };
291
+ }
292
+
293
+ function eventString(value: unknown): string | undefined {
294
+ return typeof value === "string" && value.length > 0 ? value : undefined;
295
+ }
296
+
297
+ function eventNumber(value: unknown): number {
298
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
299
+ }
300
+
301
+ function plural(count: number, singular: string, pluralNoun: string): string {
302
+ return `${count} ${count === 1 ? singular : pluralNoun}`;
303
+ }
304
+
305
+ function statusIcon(op: string): string {
306
+ if (op.startsWith("git_")) return "⌁";
307
+ switch (op) {
308
+ case "read":
309
+ case "write":
310
+ case "cat":
311
+ case "touch":
312
+ return "▣";
313
+ case "ls":
314
+ case "cd":
315
+ case "pwd":
316
+ case "mkdir":
317
+ return "▤";
318
+ case "run":
319
+ case "sh":
320
+ return "▶";
321
+ case "completion":
322
+ return "◇";
323
+ case "phase":
324
+ return "◆";
325
+ default:
326
+ return "•";
327
+ }
328
+ }
329
+
330
+ function formatStatusEvent(event: EvalStatusEvent, theme: Theme | undefined): string {
331
+ const op = event.op;
332
+ const icon = style(theme, "muted", statusIcon(op));
333
+ const error = eventString(event["error"]);
334
+ if (error !== undefined) return `${icon} ${style(theme, "warning", op)}: ${style(theme, "dim", error)}`;
335
+ const parts: string[] = [];
336
+ switch (op) {
337
+ case "read": {
338
+ parts.push(`${eventNumber(event["chars"] ?? event["bytes"])} chars`);
339
+ const path = eventString(event["path"]);
340
+ if (path !== undefined) parts.push(`from ${path}`);
341
+ break;
342
+ }
343
+ case "write": {
344
+ parts.push(`${eventNumber(event["chars"] ?? event["bytes"])} chars`);
345
+ const path = eventString(event["path"]);
346
+ if (path !== undefined) parts.push(`to ${path}`);
347
+ break;
348
+ }
349
+ case "cat":
350
+ parts.push(plural(eventNumber(event["files"]), "file", "files"));
351
+ parts.push(`${eventNumber(event["chars"])} chars`);
352
+ break;
353
+ case "ls":
354
+ parts.push(plural(eventNumber(event["count"]), "entry", "entries"));
355
+ break;
356
+ case "env": {
357
+ const action = eventString(event["action"]);
358
+ const key = eventString(event["key"]);
359
+ const value = eventString(event["value"]) ?? "";
360
+ if (action === "set" && key !== undefined) parts.push(`set ${key}=${value.slice(0, 30)}`);
361
+ else if (action === "get" && key !== undefined) parts.push(`${key}=${value.slice(0, 30)}`);
362
+ else parts.push(plural(eventNumber(event["count"]), "variable", "variables"));
363
+ break;
364
+ }
365
+ case "git_status": {
366
+ if (event["clean"] === true) parts.push("clean");
367
+ else {
368
+ const changes: string[] = [];
369
+ for (const key of ["staged", "modified", "untracked"] as const) {
370
+ const count = eventNumber(event[key]);
371
+ if (count > 0) changes.push(`${count} ${key}`);
372
+ }
373
+ parts.push(changes.join(", ") || "unknown");
374
+ }
375
+ const branch = eventString(event["branch"]);
376
+ if (branch !== undefined) parts.push(`on ${branch}`);
377
+ break;
378
+ }
379
+ case "git_diff":
380
+ parts.push(plural(eventNumber(event["lines"]), "line", "lines"));
381
+ if (event["staged"] === true) parts.push("staged");
382
+ break;
383
+ case "git_log":
384
+ parts.push(plural(eventNumber(event["commits"]), "commit", "commits"));
385
+ break;
386
+ case "run":
387
+ case "sh": {
388
+ const command = eventString(event["command"] ?? event["cmd"]);
389
+ if (command !== undefined) parts.push(command);
390
+ if (typeof event["exitCode"] === "number") parts.push(`exit ${event["exitCode"]}`);
391
+ break;
392
+ }
393
+ case "completion": {
394
+ const model = eventString(event["model"]);
395
+ const tier = eventString(event["tier"]);
396
+ if (model !== undefined) parts.push(model);
397
+ if (tier !== undefined && tier !== model) parts.push(tier);
398
+ parts.push(`${eventNumber(event["chars"])} chars`);
399
+ break;
400
+ }
401
+ case "log":
402
+ parts.push(eventString(event["message"]) ?? "");
403
+ break;
404
+ case "phase":
405
+ parts.push(eventString(event["title"]) ?? "");
406
+ break;
407
+ default: {
408
+ if (event["count"] !== undefined) parts.push(String(event["count"]));
409
+ const path = eventString(event["path"]);
410
+ if (path !== undefined) parts.push(path);
411
+ }
412
+ }
413
+ const description = parts.filter((part) => part.length > 0).join(" · ");
414
+ return `${icon} ${style(theme, "muted", op)}${description.length > 0 ? ` ${style(theme, "dim", description)}` : ""}`;
415
+ }
416
+
417
+ function renderStatusEvents(events: readonly EvalStatusEvent[], environment: RenderEnvironment): string[] {
418
+ const retained = environment.expanded ? events : events.slice(-STATUS_PREVIEW_COUNT);
419
+ const skipped = events.length - retained.length;
420
+ const lines: string[] = [];
421
+ if (skipped > 0) lines.push(style(environment.theme, "dim", `├ … ${skipped} earlier status events`));
422
+ for (const [index, event] of retained.entries()) {
423
+ const branch = index === retained.length - 1 ? "└" : "├";
424
+ lines.push(`${style(environment.theme, "dim", branch)} ${formatStatusEvent(event, environment.theme)}`);
425
+ }
426
+ return lines;
427
+ }
428
+
429
+ function agentStatus(value: unknown): AgentStatus {
430
+ switch (value) {
431
+ case "pending":
432
+ case "running":
433
+ case "completed":
434
+ case "failed":
435
+ case "aborted":
436
+ return value;
437
+ default:
438
+ return "running";
439
+ }
440
+ }
441
+
442
+ function coalesceAgentEvents(events: readonly EvalStatusEvent[]): EvalStatusEvent[] {
443
+ const rows: EvalStatusEvent[] = [];
444
+ const indexes = new Map<string, number>();
445
+ for (const event of events) {
446
+ const id = eventString(event["id"]);
447
+ if (id === undefined) {
448
+ rows.push(event);
449
+ continue;
450
+ }
451
+ const index = indexes.get(id);
452
+ if (index === undefined) {
453
+ indexes.set(id, rows.length);
454
+ rows.push(event);
455
+ } else rows[index] = event;
456
+ }
457
+ return rows;
458
+ }
459
+
460
+ function agentPresentation(status: AgentStatus, spinnerFrame: number | undefined): StatusPresentation {
461
+ switch (status) {
462
+ case "pending":
463
+ return { label: "pending", icon: "○", color: "muted" };
464
+ case "running":
465
+ return { label: "running", icon: spinner(spinnerFrame), color: "warning" };
466
+ case "completed":
467
+ return { label: "done", icon: "✓", color: "success" };
468
+ case "failed":
469
+ return { label: "failed", icon: "✗", color: "error" };
470
+ case "aborted":
471
+ return { label: "aborted", icon: "×", color: "error" };
472
+ default:
473
+ return assertNever(status);
474
+ }
475
+ }
476
+
477
+ function renderAgentProgressEvents(events: readonly EvalStatusEvent[], environment: RenderEnvironment): string[] {
478
+ const rows = coalesceAgentEvents(events);
479
+ const lines: string[] = [];
480
+ // Senpi Theme has no tree-token API; fixed ├/└/│ glyphs intentionally mirror omp.
481
+ for (const [index, event] of rows.entries()) {
482
+ const isLast = index === rows.length - 1;
483
+ const status = agentStatus(event["status"]);
484
+ const presentation = agentPresentation(status, environment.spinnerFrame);
485
+ const id = eventString(event["id"]) ?? "agent";
486
+ const styledId = environment.theme === undefined ? id : environment.theme.bold(id);
487
+ let body = `${style(environment.theme, presentation.color, presentation.icon)} ${styledId} ${presentation.label}`;
488
+ if (status === "completed" || status === "failed" || status === "aborted") {
489
+ const duration = eventNumber(event["durationMs"]);
490
+ if (duration > 0) body += ` · ${style(environment.theme, "dim", formatDuration(duration))}`;
491
+ }
492
+ const branch = isLast ? "└ " : "├ ";
493
+ const continuation = isLast ? " " : "│ ";
494
+ appendLines(
495
+ lines,
496
+ renderPrefixed(body, environment, { prefix: branch, continuation: continuation, color: "dim" }),
497
+ );
498
+ if (status !== "running") continue;
499
+ const currentTool = eventString(event["currentTool"]);
500
+ const lastIntent = eventString(event["lastIntent"]);
501
+ if (currentTool === undefined && lastIntent === undefined) continue;
502
+ const detail =
503
+ currentTool === undefined
504
+ ? (lastIntent ?? "")
505
+ : `${currentTool}${lastIntent === undefined ? "" : `: ${lastIntent}`}`;
506
+ appendLines(
507
+ lines,
508
+ renderPrefixed(detail, environment, {
509
+ prefix: `${continuation}└ `,
510
+ continuation: `${continuation} `,
511
+ color: "dim",
512
+ }),
513
+ );
514
+ }
515
+ return lines;
516
+ }
517
+
518
+ function renderCell(cell: EvalCellResult, environment: RenderEnvironment, badges: CellBadges): string[] {
519
+ const lines = renderPrefixed(cellHeader(cell, environment, badges), environment, {
520
+ prefix: "╭─ ",
521
+ continuation: "│ ",
522
+ color: "borderAccent",
523
+ });
524
+ const innerWidth = Math.max(1, environment.width - 2);
525
+ const codePreview = previewText(
526
+ highlightedCode(cell.code, cell.language, environment.theme),
527
+ environment.expanded ? Number.POSITIVE_INFINITY : CODE_PREVIEW_LINES,
528
+ innerWidth,
529
+ );
530
+ if (codePreview.skipped > 0) {
531
+ appendLines(
532
+ lines,
533
+ renderPrefixed(`${codePreview.skipped} earlier code lines`, environment, {
534
+ prefix: "│ ",
535
+ continuation: "│ ",
536
+ color: "muted",
537
+ }),
538
+ );
539
+ }
540
+ for (const line of codePreview.lines) {
541
+ appendLines(lines, renderPrefixed(line, environment, { prefix: "│ ", continuation: "│ ", color: "borderMuted" }));
542
+ }
543
+ const output = stripOutputNotice(cell.output, environment.meta).trimEnd();
544
+ if (output.length > 0) {
545
+ appendLines(lines, renderPrefixed("output", environment, { prefix: "├─ ", continuation: "│ ", color: "dim" }));
546
+ const outputColor: ThemeColor = cell.status === "error" ? "error" : "toolOutput";
547
+ const styledOutput = output
548
+ .split("\n")
549
+ .map((line) => style(environment.theme, outputColor, line))
550
+ .join("\n");
551
+ const outputPreview = previewText(
552
+ styledOutput,
553
+ environment.expanded ? Number.POSITIVE_INFINITY : OUTPUT_PREVIEW_LINES,
554
+ innerWidth,
555
+ );
556
+ if (outputPreview.skipped > 0) {
557
+ appendLines(
558
+ lines,
559
+ renderPrefixed(`${outputPreview.skipped} earlier output lines`, environment, {
560
+ prefix: "│ ",
561
+ continuation: "│ ",
562
+ color: "muted",
563
+ }),
564
+ );
565
+ }
566
+ for (const line of outputPreview.lines) {
567
+ appendLines(
568
+ lines,
569
+ renderPrefixed(line, environment, { prefix: "│ ", continuation: "│ ", color: "borderMuted" }),
570
+ );
571
+ }
572
+ }
573
+ const allEvents = cell.statusEvents ?? [];
574
+ const statusEvents = allEvents.filter((event) => event.op !== "agent");
575
+ if (statusEvents.length > 0) {
576
+ appendLines(lines, renderPrefixed("status", environment, { prefix: "├─ ", continuation: "│ ", color: "dim" }));
577
+ for (const line of renderStatusEvents(statusEvents, environment)) {
578
+ appendLines(
579
+ lines,
580
+ renderPrefixed(line, environment, { prefix: "│ ", continuation: "│ ", color: "borderMuted" }),
581
+ );
582
+ }
583
+ }
584
+ lines.push(style(environment.theme, "borderMuted", "╰─"));
585
+ const agentEvents = allEvents.filter((event) => event.op === "agent");
586
+ if (agentEvents.length > 0) appendLines(lines, renderAgentProgressEvents(agentEvents, environment));
587
+ return lines;
588
+ }
589
+
590
+ function renderJsonOutputs(values: readonly unknown[], environment: RenderEnvironment): string[] {
591
+ const lines: string[] = [];
592
+ const depth = environment.expanded ? JSON_TREE_MAX_DEPTH_EXPANDED : JSON_TREE_MAX_DEPTH_COLLAPSED;
593
+ const lineCap = environment.expanded ? JSON_TREE_MAX_LINES_EXPANDED : JSON_TREE_MAX_LINES_COLLAPSED;
594
+ const scalarLen = environment.expanded ? JSON_TREE_SCALAR_LEN_EXPANDED : JSON_TREE_SCALAR_LEN_COLLAPSED;
595
+ for (const [index, value] of values.entries()) {
596
+ appendLines(
597
+ lines,
598
+ renderAllVisualLines(style(environment.theme, "dim", `display[${index + 1}]`), environment.width),
599
+ );
600
+ const tree = renderJsonTreeLines(value, environment.theme, depth, lineCap, scalarLen);
601
+ for (const line of tree.lines) appendLines(lines, renderAllVisualLines(line, environment.width));
602
+ if (tree.truncated)
603
+ appendLines(lines, renderAllVisualLines(style(environment.theme, "dim", "…"), environment.width));
604
+ }
605
+ return lines;
606
+ }
607
+
608
+ function renderDetailedLines(
609
+ details: EvalToolDetails,
610
+ result: AgentToolResult<EvalToolDetails>,
611
+ context: DetailedRenderContext,
612
+ ): string[] {
613
+ const lines: string[] = [];
614
+ const cells = details.cells ?? [];
615
+ for (const [index, cell] of cells.entries()) {
616
+ const badges = {
617
+ reset: index === 0 && context.args.reset === true,
618
+ timeout: index === 0 ? context.args.timeout : undefined,
619
+ };
620
+ appendLines(lines, renderCell(cell, context.environment, badges));
621
+ if (index < cells.length - 1) lines.push("");
622
+ }
623
+ const jsonOutputs = details.jsonOutputs ?? [];
624
+ if (jsonOutputs.length > 0) {
625
+ if (lines.length > 0) lines.push("");
626
+ appendLines(lines, renderJsonOutputs(jsonOutputs, context.environment));
627
+ }
628
+ if (context.showImageFallback) {
629
+ for (const part of result.content) {
630
+ if (part.type !== "image") continue;
631
+ if (lines.length > 0) lines.push("");
632
+ appendLines(
633
+ lines,
634
+ renderAllVisualLines(`[image: ${sanitizeTerminalLabel(part.mimeType)}]`, context.environment.width),
635
+ );
636
+ }
637
+ }
638
+ if (details.phase !== undefined)
639
+ appendLines(
640
+ lines,
641
+ renderAllVisualLines(
642
+ style(context.environment.theme, "muted", `phase ${details.phase}`),
643
+ context.environment.width,
644
+ ),
645
+ );
646
+ if (details.notice !== undefined)
647
+ appendLines(
648
+ lines,
649
+ renderAllVisualLines(style(context.environment.theme, "dim", details.notice), context.environment.width),
650
+ );
651
+ const warning = formatTruncationWarning(details.meta) ?? (details.truncated ? "[eval output truncated]" : null);
652
+ if (warning !== null)
653
+ appendLines(
654
+ lines,
655
+ renderAllVisualLines(style(context.environment.theme, "warning", warning), context.environment.width),
656
+ );
657
+ return lines;
658
+ }
659
+
660
+ function textOutput(result: AgentToolResult<EvalToolDetails>, showImageFallback: boolean): string {
34
661
  const lines: string[] = [];
35
662
  for (const part of result.content) {
36
663
  if (part.type === "text") lines.push(part.text);
37
- else if (showImages && part.type === "image") lines.push(`[image: ${part.mimeType}]`);
664
+ else if (showImageFallback && part.type === "image") {
665
+ lines.push(`[image: ${sanitizeTerminalLabel(part.mimeType)}]`);
666
+ }
38
667
  }
39
668
  return lines.join("\n");
40
669
  }
41
670
 
42
- function toolCallLines(details: EvalToolDetails | undefined): string[] {
671
+ function toolCallRows(details: EvalToolDetails | undefined): ToolCallRow[] {
43
672
  if (!details?.toolCalls || details.toolCalls.length === 0) return [];
44
673
  return details.toolCalls.map((call) => {
45
674
  const status = call.ok ? "ok" : "error";
46
- return `- tool.${call.name}: ${status}${call.error ? ` (${call.error})` : ""}`;
675
+ const row = { summary: `- tool.${call.name}: ${status}`, color: call.ok ? "success" : "error" } as const;
676
+ return call.error === undefined ? row : { ...row, error: call.error };
47
677
  });
48
678
  }
49
679
 
50
- export function renderEvalCall(args: EvalToolInput, _theme: unknown, context: RenderContext): Component {
680
+ function resultStatus(
681
+ details: EvalToolDetails | undefined,
682
+ options: ToolRenderResultOptions,
683
+ hostIsError: boolean,
684
+ ): "running" | "done" | "error" {
685
+ if (details?.isError || hostIsError) return "error";
686
+ return options.isPartial ? "running" : "done";
687
+ }
688
+
689
+ function resultHeader(
690
+ details: EvalToolDetails | undefined,
691
+ status: "running" | "done" | "error",
692
+ theme: Theme | undefined,
693
+ ): string {
694
+ const title = details?.title === undefined ? "" : ` ${details.title}`;
695
+ let color: ThemeColor;
696
+ switch (status) {
697
+ case "running":
698
+ color = "warning";
699
+ break;
700
+ case "done":
701
+ color = "success";
702
+ break;
703
+ case "error":
704
+ color = "error";
705
+ break;
706
+ }
707
+ return style(theme, color, `eval ${details?.language ?? "?"}${title} ${status}`);
708
+ }
709
+
710
+ function resultMetadata(
711
+ details: EvalToolDetails | undefined,
712
+ options: ToolRenderResultOptions,
713
+ theme: Theme | undefined,
714
+ ): RenderBlock[] {
715
+ const metadata: string[] = [];
716
+ if (details?.phase) metadata.push(`phase ${details.phase}`);
717
+ if (!options.isPartial && details) metadata.push(`took ${details.durationMs}ms`);
718
+ if (metadata.length === 0) return [];
719
+ return [{ kind: "text", text: style(theme, "muted", metadata.join(" | ")) }];
720
+ }
721
+
722
+ export function renderEvalCall(
723
+ args: EvalToolInput,
724
+ theme: Theme | undefined,
725
+ context: RenderContext,
726
+ ): EvalRenderComponent {
51
727
  const component = componentFor(context);
52
- const title = args.title ? ` ${args.title}` : "";
53
- const reset = args.reset ? " reset" : "";
54
- const timeout = args.timeout ? ` timeout ${args.timeout}s` : "";
55
- component.setText(`eval ${args.language}${title}${reset}${timeout}\n${firstCodeLine(args.code)}`);
728
+ if (theme === undefined && context.spinnerFrame === undefined) {
729
+ const title = args.title === undefined ? "" : ` ${args.title}`;
730
+ const reset = args.reset === true ? " reset" : "";
731
+ const timeout = args.timeout === undefined ? "" : ` timeout ${args.timeout}s`;
732
+ component.setBlocks([
733
+ { kind: "text", text: style(theme, "toolTitle", `eval ${args.language}${title}${reset}${timeout}`) },
734
+ {
735
+ kind: "text",
736
+ text: style(theme, "mdCodeBlock", args.code.trim().length > 0 ? args.code : "..."),
737
+ maxVisualLines: context.expanded ? undefined : CODE_PREVIEW_LINES,
738
+ collapseKind: "code",
739
+ theme,
740
+ },
741
+ ]);
742
+ return component;
743
+ }
744
+ component.setBlocks([
745
+ {
746
+ kind: "dynamic",
747
+ render: (width) => {
748
+ const environment: RenderEnvironment = {
749
+ expanded: context.expanded,
750
+ theme,
751
+ spinnerFrame: context.spinnerFrame,
752
+ width,
753
+ meta: undefined,
754
+ };
755
+ const cell: EvalCellResult = {
756
+ index: 0,
757
+ ...(args.title === undefined ? {} : { title: args.title }),
758
+ code: args.code,
759
+ language: args.language,
760
+ output: "",
761
+ status: context.spinnerFrame === undefined ? "pending" : "running",
762
+ };
763
+ return renderCell(cell, environment, { reset: args.reset === true, timeout: args.timeout });
764
+ },
765
+ },
766
+ ]);
56
767
  return component;
57
768
  }
58
769
 
59
770
  export function renderEvalResult(
60
771
  result: AgentToolResult<EvalToolDetails>,
61
772
  options: ToolRenderResultOptions,
62
- _theme: unknown,
63
- context: Parameters<NonNullable<EvalToolDefinition["renderResult"]>>[3],
64
- ): Component {
773
+ theme: Theme | undefined,
774
+ context: ResultRenderContext,
775
+ ): EvalRenderComponent {
65
776
  const component = componentFor(context);
66
777
  const details = result.details;
67
- const status = details?.isError ? "error" : options.isPartial ? "running" : "done";
68
- const title = details?.title ? ` ${details.title}` : "";
69
- const lines = [`eval ${details?.language ?? "?"}${title} ${status}`];
70
- const output = textOutput(result, context.showImages).trimEnd();
71
- if (output) lines.push("", output);
72
- const calls = toolCallLines(details);
73
- if (calls.length > 0) lines.push("", ...calls);
74
- if (details?.truncated) lines.push("", "[output truncated]");
75
- component.setText(lines.join("\n"));
778
+ const expanded = options.expanded || context.expanded;
779
+ const imageProtocol = context.imageProtocol ?? null;
780
+ if (details?.cells !== undefined && details.cells.length > 0) {
781
+ const blocks: RenderBlock[] = [
782
+ {
783
+ kind: "dynamic",
784
+ render: (width) =>
785
+ renderDetailedLines(details, result, {
786
+ environment: {
787
+ expanded,
788
+ theme,
789
+ spinnerFrame: context.spinnerFrame,
790
+ width,
791
+ meta: details.meta,
792
+ },
793
+ args: context.args,
794
+ showImageFallback: context.showImages && imageProtocol === null,
795
+ }),
796
+ },
797
+ ];
798
+ const calls = toolCallRows(details);
799
+ if (calls.length > 0) blocks.push({ kind: "blank" }, { kind: "toolCalls", calls, expanded, theme });
800
+ component.setBlocks(blocks);
801
+ return component;
802
+ }
803
+ const status = resultStatus(details, options, context.isError);
804
+ const blocks: RenderBlock[] = [
805
+ { kind: "text", text: resultHeader(details, status, theme) },
806
+ ...resultMetadata(details, options, theme),
807
+ { kind: "blank" },
808
+ ];
809
+ const rawOutput = textOutput(result, context.showImages && imageProtocol === null);
810
+ const output = stripOutputNotice(rawOutput, details?.meta).trimEnd();
811
+ const hasRenderedImage =
812
+ context.showImages && imageProtocol !== null && result.content.some((part) => part.type === "image");
813
+ if (output.length > 0) {
814
+ blocks.push({
815
+ kind: "text",
816
+ text: style(theme, "toolOutput", output),
817
+ maxVisualLines: expanded ? undefined : OUTPUT_PREVIEW_LINES,
818
+ collapseKind: "output",
819
+ theme,
820
+ });
821
+ } else if (!hasRenderedImage) blocks.push({ kind: "text", text: style(theme, "muted", "(no output)") });
822
+ const statusEvents = details?.statusEvents ?? [];
823
+ const nonAgentEvents = statusEvents.filter((event) => event.op !== "agent");
824
+ const agentEvents = statusEvents.filter((event) => event.op === "agent");
825
+ if (nonAgentEvents.length > 0 || agentEvents.length > 0) {
826
+ blocks.push(
827
+ { kind: "blank" },
828
+ {
829
+ kind: "dynamic",
830
+ render: (width) => {
831
+ const environment: RenderEnvironment = {
832
+ expanded,
833
+ theme,
834
+ spinnerFrame: context.spinnerFrame,
835
+ width,
836
+ meta: details?.meta,
837
+ };
838
+ return [
839
+ ...renderStatusEvents(nonAgentEvents, environment),
840
+ ...renderAgentProgressEvents(agentEvents, environment),
841
+ ];
842
+ },
843
+ },
844
+ );
845
+ }
846
+ if ((details?.jsonOutputs?.length ?? 0) > 0) {
847
+ blocks.push(
848
+ { kind: "blank" },
849
+ {
850
+ kind: "dynamic",
851
+ render: (width) =>
852
+ renderJsonOutputs(details?.jsonOutputs ?? [], {
853
+ expanded,
854
+ theme,
855
+ spinnerFrame: context.spinnerFrame,
856
+ width,
857
+ meta: details?.meta,
858
+ }),
859
+ },
860
+ );
861
+ }
862
+ const calls = toolCallRows(details);
863
+ if (calls.length > 0) blocks.push({ kind: "blank" }, { kind: "toolCalls", calls, expanded, theme });
864
+ if (details?.notice !== undefined)
865
+ blocks.push({ kind: "blank" }, { kind: "text", text: style(theme, "dim", details.notice) });
866
+ const warning = formatTruncationWarning(details?.meta) ?? (details?.truncated ? "[eval output truncated]" : null);
867
+ if (warning !== null) blocks.push({ kind: "blank" }, { kind: "text", text: style(theme, "warning", warning) });
868
+ component.setBlocks(blocks);
76
869
  return component;
77
870
  }