@code-yeongyu/senpi 2026.8.11 → 2026.8.12

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 (482) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/dist/brand-dir-migration.d.ts +28 -0
  3. package/dist/brand-dir-migration.d.ts.map +1 -0
  4. package/dist/brand-dir-migration.js +77 -0
  5. package/dist/brand-dir-migration.js.map +1 -0
  6. package/dist/cli/grok-neo-gate.d.ts +0 -8
  7. package/dist/cli/grok-neo-gate.d.ts.map +1 -1
  8. package/dist/cli/grok-neo-gate.js +4 -2
  9. package/dist/cli/grok-neo-gate.js.map +1 -1
  10. package/dist/cli-main.d.ts +1 -1
  11. package/dist/cli-main.d.ts.map +1 -1
  12. package/dist/cli-main.js +4 -0
  13. package/dist/cli-main.js.map +1 -1
  14. package/dist/cli.d.ts +1 -1
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +3 -2
  17. package/dist/cli.js.map +1 -1
  18. package/dist/config.d.ts +27 -1
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/config.js +41 -9
  21. package/dist/config.js.map +1 -1
  22. package/dist/core/agent-session.d.ts +8 -2
  23. package/dist/core/agent-session.d.ts.map +1 -1
  24. package/dist/core/agent-session.js +73 -11
  25. package/dist/core/agent-session.js.map +1 -1
  26. package/dist/core/brand.d.ts +79 -0
  27. package/dist/core/brand.d.ts.map +1 -0
  28. package/dist/core/brand.js +141 -0
  29. package/dist/core/brand.js.map +1 -0
  30. package/dist/core/dynamic-prompt/identity.d.ts.map +1 -1
  31. package/dist/core/dynamic-prompt/identity.js +2 -1
  32. package/dist/core/dynamic-prompt/identity.js.map +1 -1
  33. package/dist/core/event-bus.d.ts +5 -0
  34. package/dist/core/event-bus.d.ts.map +1 -1
  35. package/dist/core/event-bus.js +1 -0
  36. package/dist/core/event-bus.js.map +1 -1
  37. package/dist/core/experimental.d.ts.map +1 -1
  38. package/dist/core/experimental.js +2 -1
  39. package/dist/core/experimental.js.map +1 -1
  40. package/dist/core/extensions/builtin/btw/index.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/btw/index.js +7 -2
  42. package/dist/core/extensions/builtin/btw/index.js.map +1 -1
  43. package/dist/core/extensions/builtin/btw/side-query.d.ts +2 -0
  44. package/dist/core/extensions/builtin/btw/side-query.d.ts.map +1 -1
  45. package/dist/core/extensions/builtin/btw/side-query.js +39 -2
  46. package/dist/core/extensions/builtin/btw/side-query.js.map +1 -1
  47. package/dist/core/extensions/builtin/claude-sdk-oauth/availability.d.ts +2 -0
  48. package/dist/core/extensions/builtin/claude-sdk-oauth/availability.d.ts.map +1 -0
  49. package/dist/core/extensions/builtin/claude-sdk-oauth/availability.js +24 -0
  50. package/dist/core/extensions/builtin/claude-sdk-oauth/availability.js.map +1 -0
  51. package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts +4 -0
  52. package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts.map +1 -1
  53. package/dist/core/extensions/builtin/claude-sdk-oauth/index.js +5 -2
  54. package/dist/core/extensions/builtin/claude-sdk-oauth/index.js.map +1 -1
  55. package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts +6 -1
  56. package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js +16 -0
  58. package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -1
  59. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +1 -1
  60. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js +10 -1
  61. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +1 -1
  62. package/dist/core/extensions/builtin/compaction/index.d.ts +1 -0
  63. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  64. package/dist/core/extensions/builtin/compaction/index.js +1 -1
  65. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  66. package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
  67. package/dist/core/extensions/builtin/compaction/log.js +2 -1
  68. package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
  69. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.d.ts.map +1 -1
  70. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.js +4 -4
  71. package/dist/core/extensions/builtin/config-reload/generated-shim-filter.js.map +1 -1
  72. package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
  73. package/dist/core/extensions/builtin/goal/index.js +5 -0
  74. package/dist/core/extensions/builtin/goal/index.js.map +1 -1
  75. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts +2 -2
  76. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
  77. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +3 -3
  78. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
  79. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  80. package/dist/core/extensions/builtin/goal/monitor-continuation.js +6 -0
  81. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  82. package/dist/core/extensions/builtin/goal/store.d.ts +3 -2
  83. package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
  84. package/dist/core/extensions/builtin/goal/store.js +128 -101
  85. package/dist/core/extensions/builtin/goal/store.js.map +1 -1
  86. package/dist/core/extensions/builtin/goal/transitions.js +2 -1
  87. package/dist/core/extensions/builtin/goal/transitions.js.map +1 -1
  88. package/dist/core/extensions/builtin/help/index.d.ts.map +1 -1
  89. package/dist/core/extensions/builtin/help/index.js +3 -2
  90. package/dist/core/extensions/builtin/help/index.js.map +1 -1
  91. package/dist/core/extensions/builtin/imagegen/auth.d.ts +45 -0
  92. package/dist/core/extensions/builtin/imagegen/auth.d.ts.map +1 -0
  93. package/dist/core/extensions/builtin/imagegen/auth.js +137 -0
  94. package/dist/core/extensions/builtin/imagegen/auth.js.map +1 -0
  95. package/dist/core/extensions/builtin/imagegen/index.d.ts +5 -0
  96. package/dist/core/extensions/builtin/imagegen/index.d.ts.map +1 -0
  97. package/dist/core/extensions/builtin/imagegen/index.js +46 -0
  98. package/dist/core/extensions/builtin/imagegen/index.js.map +1 -0
  99. package/dist/core/extensions/builtin/imagegen/paths.d.ts +26 -0
  100. package/dist/core/extensions/builtin/imagegen/paths.d.ts.map +1 -0
  101. package/dist/core/extensions/builtin/imagegen/paths.js +52 -0
  102. package/dist/core/extensions/builtin/imagegen/paths.js.map +1 -0
  103. package/dist/core/extensions/builtin/imagegen/skill/SKILL.md +67 -0
  104. package/dist/core/extensions/builtin/imagegen/state.d.ts +26 -0
  105. package/dist/core/extensions/builtin/imagegen/state.d.ts.map +1 -0
  106. package/dist/core/extensions/builtin/imagegen/state.js +35 -0
  107. package/dist/core/extensions/builtin/imagegen/state.js.map +1 -0
  108. package/dist/core/extensions/builtin/imagegen/tool.d.ts +31 -0
  109. package/dist/core/extensions/builtin/imagegen/tool.d.ts.map +1 -0
  110. package/dist/core/extensions/builtin/imagegen/tool.js +174 -0
  111. package/dist/core/extensions/builtin/imagegen/tool.js.map +1 -0
  112. package/dist/core/extensions/builtin/index.d.ts.map +1 -1
  113. package/dist/core/extensions/builtin/index.js +9 -1
  114. package/dist/core/extensions/builtin/index.js.map +1 -1
  115. package/dist/core/extensions/builtin/mcp/control-inventory.d.ts +14 -0
  116. package/dist/core/extensions/builtin/mcp/control-inventory.d.ts.map +1 -0
  117. package/dist/core/extensions/builtin/mcp/control-inventory.js +22 -0
  118. package/dist/core/extensions/builtin/mcp/control-inventory.js.map +1 -0
  119. package/dist/core/extensions/builtin/mcp/expose/native-search.d.ts +2 -44
  120. package/dist/core/extensions/builtin/mcp/expose/native-search.d.ts.map +1 -1
  121. package/dist/core/extensions/builtin/mcp/expose/native-search.js +3 -97
  122. package/dist/core/extensions/builtin/mcp/expose/native-search.js.map +1 -1
  123. package/dist/core/extensions/builtin/mcp/expose/proxy.d.ts.map +1 -1
  124. package/dist/core/extensions/builtin/mcp/expose/proxy.js +15 -4
  125. package/dist/core/extensions/builtin/mcp/expose/proxy.js.map +1 -1
  126. package/dist/core/extensions/builtin/mcp/expose/session.d.ts +2 -1
  127. package/dist/core/extensions/builtin/mcp/expose/session.d.ts.map +1 -1
  128. package/dist/core/extensions/builtin/mcp/expose/session.js +2 -2
  129. package/dist/core/extensions/builtin/mcp/expose/session.js.map +1 -1
  130. package/dist/core/extensions/builtin/mcp/expose/tier-b.d.ts +13 -11
  131. package/dist/core/extensions/builtin/mcp/expose/tier-b.d.ts.map +1 -1
  132. package/dist/core/extensions/builtin/mcp/expose/tier-b.js +58 -59
  133. package/dist/core/extensions/builtin/mcp/expose/tier-b.js.map +1 -1
  134. package/dist/core/extensions/builtin/mcp/index.d.ts.map +1 -1
  135. package/dist/core/extensions/builtin/mcp/index.js +28 -36
  136. package/dist/core/extensions/builtin/mcp/index.js.map +1 -1
  137. package/dist/core/extensions/builtin/mcp/service-register.d.ts +2 -1
  138. package/dist/core/extensions/builtin/mcp/service-register.d.ts.map +1 -1
  139. package/dist/core/extensions/builtin/mcp/service-register.js +2 -2
  140. package/dist/core/extensions/builtin/mcp/service-register.js.map +1 -1
  141. package/dist/core/extensions/builtin/mcp/service-types.d.ts +4 -0
  142. package/dist/core/extensions/builtin/mcp/service-types.d.ts.map +1 -1
  143. package/dist/core/extensions/builtin/mcp/service-types.js.map +1 -1
  144. package/dist/core/extensions/builtin/mcp/service.d.ts +6 -11
  145. package/dist/core/extensions/builtin/mcp/service.d.ts.map +1 -1
  146. package/dist/core/extensions/builtin/mcp/service.js +79 -41
  147. package/dist/core/extensions/builtin/mcp/service.js.map +1 -1
  148. package/dist/core/extensions/builtin/mcp/wrap.d.ts +2 -0
  149. package/dist/core/extensions/builtin/mcp/wrap.d.ts.map +1 -1
  150. package/dist/core/extensions/builtin/mcp/wrap.js +3 -0
  151. package/dist/core/extensions/builtin/mcp/wrap.js.map +1 -1
  152. package/dist/core/extensions/builtin/openai-image-gen/externalize.d.ts +27 -0
  153. package/dist/core/extensions/builtin/openai-image-gen/externalize.d.ts.map +1 -0
  154. package/dist/core/extensions/builtin/openai-image-gen/externalize.js +133 -0
  155. package/dist/core/extensions/builtin/openai-image-gen/externalize.js.map +1 -0
  156. package/dist/core/extensions/builtin/openai-image-gen/gate.d.ts +21 -0
  157. package/dist/core/extensions/builtin/openai-image-gen/gate.d.ts.map +1 -0
  158. package/dist/core/extensions/builtin/openai-image-gen/gate.js +63 -0
  159. package/dist/core/extensions/builtin/openai-image-gen/gate.js.map +1 -0
  160. package/dist/core/extensions/builtin/openai-image-gen/index.d.ts +14 -0
  161. package/dist/core/extensions/builtin/openai-image-gen/index.d.ts.map +1 -0
  162. package/dist/core/extensions/builtin/openai-image-gen/index.js +77 -0
  163. package/dist/core/extensions/builtin/openai-image-gen/index.js.map +1 -0
  164. package/dist/core/extensions/builtin/openai-image-gen/inject.d.ts +15 -0
  165. package/dist/core/extensions/builtin/openai-image-gen/inject.d.ts.map +1 -0
  166. package/dist/core/extensions/builtin/openai-image-gen/inject.js +42 -0
  167. package/dist/core/extensions/builtin/openai-image-gen/inject.js.map +1 -0
  168. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
  169. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +2 -1
  170. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
  171. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
  172. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +2 -1
  173. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
  174. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.d.ts.map +1 -1
  175. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +2 -1
  176. package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -1
  177. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  178. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +2 -1
  179. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  180. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.d.ts.map +1 -1
  181. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js +6 -5
  182. package/dist/core/extensions/builtin/prompt-preset/grok-4.5.js.map +1 -1
  183. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  184. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +2 -1
  185. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  186. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  187. package/dist/core/extensions/builtin/terminal/monitor-notify.js +8 -1
  188. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  189. package/dist/core/extensions/builtin/terminal/notify.d.ts +3 -1
  190. package/dist/core/extensions/builtin/terminal/notify.d.ts.map +1 -1
  191. package/dist/core/extensions/builtin/terminal/notify.js +4 -1
  192. package/dist/core/extensions/builtin/terminal/notify.js.map +1 -1
  193. package/dist/core/extensions/builtin/tool-search/engine/bm25.d.ts +22 -0
  194. package/dist/core/extensions/builtin/tool-search/engine/bm25.d.ts.map +1 -0
  195. package/dist/core/extensions/builtin/{mcp/expose → tool-search/engine}/bm25.js +16 -31
  196. package/dist/core/extensions/builtin/tool-search/engine/bm25.js.map +1 -0
  197. package/dist/core/extensions/builtin/tool-search/engine/document.d.ts +14 -0
  198. package/dist/core/extensions/builtin/tool-search/engine/document.d.ts.map +1 -0
  199. package/dist/core/extensions/builtin/tool-search/engine/document.js +2 -0
  200. package/dist/core/extensions/builtin/tool-search/engine/document.js.map +1 -0
  201. package/dist/core/extensions/builtin/tool-search/engine/marker.d.ts +55 -0
  202. package/dist/core/extensions/builtin/tool-search/engine/marker.d.ts.map +1 -0
  203. package/dist/core/extensions/builtin/tool-search/engine/marker.js +189 -0
  204. package/dist/core/extensions/builtin/tool-search/engine/marker.js.map +1 -0
  205. package/dist/core/extensions/builtin/tool-search/index.d.ts +7 -0
  206. package/dist/core/extensions/builtin/tool-search/index.d.ts.map +1 -0
  207. package/dist/core/extensions/builtin/tool-search/index.js +71 -0
  208. package/dist/core/extensions/builtin/tool-search/index.js.map +1 -0
  209. package/dist/core/extensions/builtin/tool-search/native-search.d.ts +52 -0
  210. package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -0
  211. package/dist/core/extensions/builtin/tool-search/native-search.js +116 -0
  212. package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -0
  213. package/dist/core/extensions/builtin/tool-search/service.d.ts +38 -0
  214. package/dist/core/extensions/builtin/tool-search/service.d.ts.map +1 -0
  215. package/dist/core/extensions/builtin/tool-search/service.js +200 -0
  216. package/dist/core/extensions/builtin/tool-search/service.js.map +1 -0
  217. package/dist/core/extensions/builtin/tool-search/tool.d.ts +21 -0
  218. package/dist/core/extensions/builtin/tool-search/tool.d.ts.map +1 -0
  219. package/dist/core/extensions/builtin/tool-search/tool.js +95 -0
  220. package/dist/core/extensions/builtin/tool-search/tool.js.map +1 -0
  221. package/dist/core/extensions/index.d.ts +1 -1
  222. package/dist/core/extensions/index.d.ts.map +1 -1
  223. package/dist/core/extensions/index.js.map +1 -1
  224. package/dist/core/extensions/loader.d.ts.map +1 -1
  225. package/dist/core/extensions/loader.js +31 -1
  226. package/dist/core/extensions/loader.js.map +1 -1
  227. package/dist/core/extensions/runner.d.ts +5 -1
  228. package/dist/core/extensions/runner.d.ts.map +1 -1
  229. package/dist/core/extensions/runner.js +28 -1
  230. package/dist/core/extensions/runner.js.map +1 -1
  231. package/dist/core/extensions/types.d.ts +61 -4
  232. package/dist/core/extensions/types.d.ts.map +1 -1
  233. package/dist/core/extensions/types.js +11 -0
  234. package/dist/core/extensions/types.js.map +1 -1
  235. package/dist/core/generated-shim-banner.d.ts +15 -0
  236. package/dist/core/generated-shim-banner.d.ts.map +1 -0
  237. package/dist/core/generated-shim-banner.js +26 -0
  238. package/dist/core/generated-shim-banner.js.map +1 -0
  239. package/dist/core/model-runtime.d.ts.map +1 -1
  240. package/dist/core/model-runtime.js +7 -3
  241. package/dist/core/model-runtime.js.map +1 -1
  242. package/dist/core/package-manager.d.ts.map +1 -1
  243. package/dist/core/package-manager.js +2 -1
  244. package/dist/core/package-manager.js.map +1 -1
  245. package/dist/core/provider-composer.d.ts +10 -1
  246. package/dist/core/provider-composer.d.ts.map +1 -1
  247. package/dist/core/provider-composer.js +9 -0
  248. package/dist/core/provider-composer.js.map +1 -1
  249. package/dist/core/resource-loader.d.ts.map +1 -1
  250. package/dist/core/resource-loader.js +21 -10
  251. package/dist/core/resource-loader.js.map +1 -1
  252. package/dist/core/session-log.d.ts.map +1 -1
  253. package/dist/core/session-log.js +4 -2
  254. package/dist/core/session-log.js.map +1 -1
  255. package/dist/core/settings-manager.d.ts.map +1 -1
  256. package/dist/core/settings-manager.js +3 -2
  257. package/dist/core/settings-manager.js.map +1 -1
  258. package/dist/core/telemetry.d.ts.map +1 -1
  259. package/dist/core/telemetry.js +2 -1
  260. package/dist/core/telemetry.js.map +1 -1
  261. package/dist/core/timings.d.ts +0 -4
  262. package/dist/core/timings.d.ts.map +1 -1
  263. package/dist/core/timings.js +2 -1
  264. package/dist/core/timings.js.map +1 -1
  265. package/dist/index.d.ts +2 -2
  266. package/dist/index.d.ts.map +1 -1
  267. package/dist/index.js.map +1 -1
  268. package/dist/inspector-policy.d.ts.map +1 -1
  269. package/dist/inspector-policy.js +2 -1
  270. package/dist/inspector-policy.js.map +1 -1
  271. package/dist/main.d.ts.map +1 -1
  272. package/dist/main.js +5 -4
  273. package/dist/main.js.map +1 -1
  274. package/dist/migrations.d.ts.map +1 -1
  275. package/dist/migrations.js +4 -0
  276. package/dist/migrations.js.map +1 -1
  277. package/dist/modes/index.d.ts +2 -2
  278. package/dist/modes/index.d.ts.map +1 -1
  279. package/dist/modes/index.js +1 -1
  280. package/dist/modes/index.js.map +1 -1
  281. package/dist/modes/interactive/external-editor.d.ts +2 -0
  282. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  283. package/dist/modes/interactive/external-editor.js +10 -4
  284. package/dist/modes/interactive/external-editor.js.map +1 -1
  285. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  286. package/dist/modes/interactive/interactive-mode.js +6 -5
  287. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  288. package/dist/modes/interactive/tips/catalog/cli-tips.d.ts.map +1 -1
  289. package/dist/modes/interactive/tips/catalog/cli-tips.js +2 -1
  290. package/dist/modes/interactive/tips/catalog/cli-tips.js.map +1 -1
  291. package/dist/modes/interactive/tips/catalog/ethos-tips.d.ts.map +1 -1
  292. package/dist/modes/interactive/tips/catalog/ethos-tips.js +4 -3
  293. package/dist/modes/interactive/tips/catalog/ethos-tips.js.map +1 -1
  294. package/dist/modes/interactive/tips/catalog/model-tips.d.ts.map +1 -1
  295. package/dist/modes/interactive/tips/catalog/model-tips.js +2 -1
  296. package/dist/modes/interactive/tips/catalog/model-tips.js.map +1 -1
  297. package/dist/modes/interactive/tips/catalog/session-tips.d.ts.map +1 -1
  298. package/dist/modes/interactive/tips/catalog/session-tips.js +2 -1
  299. package/dist/modes/interactive/tips/catalog/session-tips.js.map +1 -1
  300. package/dist/modes/interactive/tips/catalog/settings-tips.d.ts.map +1 -1
  301. package/dist/modes/interactive/tips/catalog/settings-tips.js +3 -2
  302. package/dist/modes/interactive/tips/catalog/settings-tips.js.map +1 -1
  303. package/dist/modes/interactive/tips/catalog/workspace-tips.d.ts.map +1 -1
  304. package/dist/modes/interactive/tips/catalog/workspace-tips.js +4 -3
  305. package/dist/modes/interactive/tips/catalog/workspace-tips.js.map +1 -1
  306. package/dist/modes/provider-native-rendering.d.ts.map +1 -1
  307. package/dist/modes/provider-native-rendering.js +33 -0
  308. package/dist/modes/provider-native-rendering.js.map +1 -1
  309. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  310. package/dist/modes/rpc/connection-handler.js +148 -5
  311. package/dist/modes/rpc/connection-handler.js.map +1 -1
  312. package/dist/modes/rpc/custom-capability.d.ts +1 -0
  313. package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
  314. package/dist/modes/rpc/custom-capability.js +1 -0
  315. package/dist/modes/rpc/custom-capability.js.map +1 -1
  316. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
  317. package/dist/modes/rpc/multi-session-host.js +4 -1
  318. package/dist/modes/rpc/multi-session-host.js.map +1 -1
  319. package/dist/modes/rpc/rpc-client.d.ts +5 -2
  320. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  321. package/dist/modes/rpc/rpc-client.js +10 -1
  322. package/dist/modes/rpc/rpc-client.js.map +1 -1
  323. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  324. package/dist/modes/rpc/rpc-mode.js +2 -1
  325. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  326. package/dist/modes/rpc/rpc-types.d.ts +47 -0
  327. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  328. package/dist/modes/rpc/rpc-types.js.map +1 -1
  329. package/dist/modes/rpc/session-binding.d.ts +2 -1
  330. package/dist/modes/rpc/session-binding.d.ts.map +1 -1
  331. package/dist/modes/rpc/session-binding.js +3 -2
  332. package/dist/modes/rpc/session-binding.js.map +1 -1
  333. package/dist/modes/rpc/session-command-router.d.ts +2 -1
  334. package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
  335. package/dist/modes/rpc/session-command-router.js +3 -2
  336. package/dist/modes/rpc/session-command-router.js.map +1 -1
  337. package/dist/nearest-parent-config.d.ts +6 -1
  338. package/dist/nearest-parent-config.d.ts.map +1 -1
  339. package/dist/nearest-parent-config.js +18 -2
  340. package/dist/nearest-parent-config.js.map +1 -1
  341. package/dist/package-manager-cli.d.ts.map +1 -1
  342. package/dist/package-manager-cli.js +13 -1
  343. package/dist/package-manager-cli.js.map +1 -1
  344. package/dist/rpc-entry.js +2 -0
  345. package/dist/rpc-entry.js.map +1 -1
  346. package/dist/self-update-bootstrap.d.ts.map +1 -1
  347. package/dist/self-update-bootstrap.js +6 -0
  348. package/dist/self-update-bootstrap.js.map +1 -1
  349. package/dist/senpi +3 -2
  350. package/dist/utils/pi-user-agent.d.ts +1 -1
  351. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  352. package/dist/utils/pi-user-agent.js +4 -3
  353. package/dist/utils/pi-user-agent.js.map +1 -1
  354. package/dist/utils/tools-manager.d.ts.map +1 -1
  355. package/dist/utils/tools-manager.js +2 -1
  356. package/dist/utils/tools-manager.js.map +1 -1
  357. package/dist/utils/version-check.d.ts +3 -0
  358. package/dist/utils/version-check.d.ts.map +1 -1
  359. package/dist/utils/version-check.js +37 -6
  360. package/dist/utils/version-check.js.map +1 -1
  361. package/dist/valid-cwd.d.ts +2 -0
  362. package/dist/valid-cwd.d.ts.map +1 -0
  363. package/dist/valid-cwd.js +14 -0
  364. package/dist/valid-cwd.js.map +1 -0
  365. package/docs/environment-variables.md +8 -1
  366. package/docs/extensions.md +93 -13
  367. package/docs/mcp.md +2 -0
  368. package/docs/providers.md +2 -2
  369. package/docs/rpc.md +126 -0
  370. package/docs/skills.md +8 -0
  371. package/examples/extensions/searchable-tools.ts +49 -0
  372. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +77 -0
  373. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  374. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/kernel.ts +14 -1
  375. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/kernel.ts +14 -1
  376. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/runtime-asset.ts +31 -0
  377. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  378. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +5 -1
  379. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  380. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +4 -1
  381. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  382. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +2 -0
  383. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  384. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +9 -0
  385. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  386. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  387. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  388. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +2 -2
  389. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  390. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  391. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +4 -2
  392. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  393. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  394. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +7 -3
  395. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  396. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.d.ts +8 -0
  397. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.d.ts.map +1 -0
  398. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.js +222 -0
  399. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.js.map +1 -0
  400. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.lazy.d.ts +3 -0
  401. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.lazy.d.ts.map +1 -0
  402. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.lazy.js +10 -0
  403. package/node_modules/@earendil-works/pi-ai/dist/api/openai-images.lazy.js.map +1 -0
  404. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  405. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +113 -4
  406. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  407. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  408. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +1 -0
  409. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  410. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts +5 -0
  411. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.d.ts.map +1 -1
  412. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +2 -1
  413. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
  414. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.d.ts.map +1 -1
  415. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js +2 -1
  416. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openai-codex.js.map +1 -1
  417. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +10 -0
  418. package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
  419. package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
  420. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +47 -0
  421. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  422. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +47 -0
  423. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  424. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  425. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  426. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  427. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  428. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  429. package/node_modules/@earendil-works/pi-ai/dist/models.js +36 -13
  430. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  431. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +2 -0
  432. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
  433. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
  434. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  435. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -1
  436. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  437. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  438. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  439. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  440. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  441. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  442. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  443. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  444. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  445. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +1 -0
  446. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts.map +1 -1
  447. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js +18 -0
  448. package/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.js.map +1 -1
  449. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-images.d.ts +3 -0
  450. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-images.d.ts.map +1 -0
  451. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-images.js +16 -0
  452. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-images.js.map +1 -0
  453. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
  454. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  455. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  456. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +1 -1
  457. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  458. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  459. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +7 -0
  460. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  461. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.d.ts +14 -0
  462. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.d.ts.map +1 -0
  463. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.js +24 -0
  464. package/node_modules/@earendil-works/pi-ai/dist/wire-identity.js.map +1 -0
  465. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  466. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.d.ts.map +1 -1
  467. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.js +11 -3
  468. package/node_modules/@earendil-works/pi-pty/dist/pipe-fallback.js.map +1 -1
  469. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  470. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  471. package/package.json +9 -9
  472. package/dist/core/extensions/builtin/mcp/expose/bm25.d.ts +0 -30
  473. package/dist/core/extensions/builtin/mcp/expose/bm25.d.ts.map +0 -1
  474. package/dist/core/extensions/builtin/mcp/expose/bm25.js.map +0 -1
  475. package/dist/core/extensions/builtin/mcp/expose/lazy-activate.d.ts +0 -15
  476. package/dist/core/extensions/builtin/mcp/expose/lazy-activate.d.ts.map +0 -1
  477. package/dist/core/extensions/builtin/mcp/expose/lazy-activate.js +0 -33
  478. package/dist/core/extensions/builtin/mcp/expose/lazy-activate.js.map +0 -1
  479. package/dist/core/extensions/builtin/mcp/expose/tool-search.d.ts +0 -43
  480. package/dist/core/extensions/builtin/mcp/expose/tool-search.d.ts.map +0 -1
  481. package/dist/core/extensions/builtin/mcp/expose/tool-search.js +0 -125
  482. package/dist/core/extensions/builtin/mcp/expose/tool-search.js.map +0 -1
@@ -24,6 +24,7 @@
24
24
  // buildTestDisciplineSection(), the rendered tool section, the grep/glob
25
25
  // search line, workstationDialect "claude"; dynamic pieces (context files,
26
26
  // skills, date, cwd) still come from buildDynamicSystemPrompt.
27
+ import { APP_NAME } from "../../../../config.js";
27
28
  import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
28
29
  import { getToolsPromptDisplay } from "../../../dynamic-prompt/tool-categorization.js";
29
30
  import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
@@ -35,7 +36,7 @@ function buildSearchLine(context) {
35
36
  return `\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\n`;
36
37
  }
37
38
  function buildClaudeOpus5Core(context) {
38
- return `You are senpi, a coding agent. Your work should be indistinguishable from a careful senior engineer's.
39
+ return `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.
39
40
 
40
41
  ## Intent Gate
41
42
 
@@ -1 +1 @@
1
- {"version":3,"file":"claude-opus-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-5.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,iEAAiE;AACjE,6EAA6E;AAC7E,4EAA4E;AAC5E,uEAAuE;AACvE,+EAA+E;AAC/E,2EAA2E;AAC3E,gEAAgE;AAChE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,iEAAiE;AACjE,yDAAyD;AACzD,yEAAyE;AACzE,2EAA2E;AAC3E,+DAA+D;AAG/D,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,SAAS,eAAe,CAAC,OAAiC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAiC;IAC9D,OAAO;;;;;;;;;EASN,eAAe,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,0BAA0B,EAAE;;;;EAI5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;2JAiBsI,CAAC;AAC5J,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAwC;IAC9E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,UAAU,EAAE,oBAAoB;QAChC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Opus 5 full-core system prompt.\n//\n// 2026-07-24: converted from the thin-tuningSection shape to a full core\n// rewrite via the `corePrompt` override, by explicit fork direction (\"the\n// whole new prompt, not just appending\") and matching the dieted\n// claude-fable-5.ts. The earlier rationale (\"performs well out of the box on\n// Opus 4.8 prompts\") argued the shared core was sufficient, not that it was\n// minimal: stacking the Opus 5 tuning on the full shared core restated\n// checkpoint/stop/verification rules the core already carried, and Anthropic's\n// Claude 5 guidance says instruction following is strong enough that brief\n// rules steer behavior enumerated lists were needed for before.\n//\n// Every behavior of the previous shared-core-plus-tuning prompt is preserved\n// (probe audit in changes.md, 2026-07-24 entry); each Opus 5 guide behavior\n// is merged where it binds tightest: the binding stop contract in the intent\n// gate, scope discipline beside intent routing, bounded single-pass\n// verification in the verification section, delegation caps in Working the\n// Task, narration cadence / correction filter / document calibration in\n// Style, auto-compaction continuation at the end. Deliberately NOT carried\n// (unchanged from the tuning-era preset): 4.7/4.8 scope literalism and the\n// house-style counter (documented inversions/undocumented for Opus 5), and no\n// added re-check instructions (the guide says they compound into\n// over-verification). Shared pieces stay single-sourced:\n// buildTestDisciplineSection(), the rendered tool section, the grep/glob\n// search line, workstationDialect \"claude\"; dynamic pieces (context files,\n// skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeOpus5Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line keeps your reading transparent; only the user's explicit request commits you to implementation. Before naming the stop condition, think hard about what the goal actually is - the end state the user can observe, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured - no new verification - deliver the final message, and stop. Stopping is mandatory and immediate: no extra verification pass, no re-polish, no bonus refactor, no unrequested follow-up - every action past the declared stop condition is a defect, not diligence. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally, at exactly the asked scope - the smallest path that fully satisfies an open-ended goal; name an ambiguity and resolve it from context when possible.\n\nDeliver the task at the scope asked. Make routine judgment calls yourself, and check in only when different readings of the request would lead to materially different work. If the request seems mistaken or a better approach exists, say so in a sentence and continue as asked rather than quietly narrowing, widening, or transforming the work. Finish the whole task, and stop short of actions clearly beyond it.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan; queued steering messages outrank earlier intent. Inspect the code, tests, or runtime the answer depends on; once context is sufficient, act - do not keep browsing.\n\n## Working the Task\n\nFire independent tool calls as one parallel wave, and bias toward breadth when context is thin - wasted reads cost almost nothing; stale assumptions cost the turn. Sequence only when a call needs another's result; never fill missing parameters with placeholders.\n\nMemory of file contents is unreliable - read before claiming, re-read before editing. Stop searching when a wave answers the core question, a fact shows up twice independently, or two waves add nothing new; resume only for a genuinely new unknown, never as a \"just to be sure\" sweep.\n\nDelegate only sizeable, genuinely independent tracks of work, and only when a delegation tool is available. Keep work you can finish in a handful of tool calls, never spawn subagents to verify your own work, and prefer one subagent over several.\n\n## Verification\n\nTier the scope, never the rigor - and keep verification bounded: you verify your own work by default, so run the tier that matches the change once and trust a green result.\n- Single-file non-behavioral edit: diagnostics on that file. Done.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one execution of the affected runnable entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification - run the validator before reporting anything clean. Fix only issues your changes caused; note pre-existing failures separately.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never present unread code or unrun commands as verified fact.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAct, then report. Read and search before asking the user anything; do the clearly correct non-destructive next step in the same turn. Announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\") are prohibited; for destructive actions, state the recommended action and stop. Have an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nWhile working, add a progress note only when you find something important or change direction - the routing line already announced the plan. Keep responses focused and reasonably concise: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode. Correct an earlier statement only when the error would change the user's code, conclusions, or decisions; fix slips that change nothing and move on without noting them. Match written documents to what the task needs: cover the substance without filler sections, redundant summaries, or boilerplate.\n\nDo not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until your declared stop condition is met.`;\n}\n\nexport function buildClaudeOpus5Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeOpus5Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
1
+ {"version":3,"file":"claude-opus-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-5.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,iEAAiE;AACjE,6EAA6E;AAC7E,4EAA4E;AAC5E,uEAAuE;AACvE,+EAA+E;AAC/E,2EAA2E;AAC3E,gEAAgE;AAChE,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,oEAAoE;AACpE,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,iEAAiE;AACjE,yDAAyD;AACzD,yEAAyE;AACzE,2EAA2E;AAC3E,+DAA+D;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,SAAS,eAAe,CAAC,OAAiC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAiC;IAC9D,OAAO,WAAW,QAAQ;;;;;;;;;EASzB,eAAe,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,0BAA0B,EAAE;;;;EAI5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;2JAiBsI,CAAC;AAC5J,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAwC;IAC9E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,UAAU,EAAE,oBAAoB;QAChC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Opus 5 full-core system prompt.\n//\n// 2026-07-24: converted from the thin-tuningSection shape to a full core\n// rewrite via the `corePrompt` override, by explicit fork direction (\"the\n// whole new prompt, not just appending\") and matching the dieted\n// claude-fable-5.ts. The earlier rationale (\"performs well out of the box on\n// Opus 4.8 prompts\") argued the shared core was sufficient, not that it was\n// minimal: stacking the Opus 5 tuning on the full shared core restated\n// checkpoint/stop/verification rules the core already carried, and Anthropic's\n// Claude 5 guidance says instruction following is strong enough that brief\n// rules steer behavior enumerated lists were needed for before.\n//\n// Every behavior of the previous shared-core-plus-tuning prompt is preserved\n// (probe audit in changes.md, 2026-07-24 entry); each Opus 5 guide behavior\n// is merged where it binds tightest: the binding stop contract in the intent\n// gate, scope discipline beside intent routing, bounded single-pass\n// verification in the verification section, delegation caps in Working the\n// Task, narration cadence / correction filter / document calibration in\n// Style, auto-compaction continuation at the end. Deliberately NOT carried\n// (unchanged from the tuning-era preset): 4.7/4.8 scope literalism and the\n// house-style counter (documented inversions/undocumented for Opus 5), and no\n// added re-check instructions (the guide says they compound into\n// over-verification). Shared pieces stay single-sourced:\n// buildTestDisciplineSection(), the rendered tool section, the grep/glob\n// search line, workstationDialect \"claude\"; dynamic pieces (context files,\n// skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeOpus5Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line keeps your reading transparent; only the user's explicit request commits you to implementation. Before naming the stop condition, think hard about what the goal actually is - the end state the user can observe, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured - no new verification - deliver the final message, and stop. Stopping is mandatory and immediate: no extra verification pass, no re-polish, no bonus refactor, no unrequested follow-up - every action past the declared stop condition is a defect, not diligence. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally, at exactly the asked scope - the smallest path that fully satisfies an open-ended goal; name an ambiguity and resolve it from context when possible.\n\nDeliver the task at the scope asked. Make routine judgment calls yourself, and check in only when different readings of the request would lead to materially different work. If the request seems mistaken or a better approach exists, say so in a sentence and continue as asked rather than quietly narrowing, widening, or transforming the work. Finish the whole task, and stop short of actions clearly beyond it.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan; queued steering messages outrank earlier intent. Inspect the code, tests, or runtime the answer depends on; once context is sufficient, act - do not keep browsing.\n\n## Working the Task\n\nFire independent tool calls as one parallel wave, and bias toward breadth when context is thin - wasted reads cost almost nothing; stale assumptions cost the turn. Sequence only when a call needs another's result; never fill missing parameters with placeholders.\n\nMemory of file contents is unreliable - read before claiming, re-read before editing. Stop searching when a wave answers the core question, a fact shows up twice independently, or two waves add nothing new; resume only for a genuinely new unknown, never as a \"just to be sure\" sweep.\n\nDelegate only sizeable, genuinely independent tracks of work, and only when a delegation tool is available. Keep work you can finish in a handful of tool calls, never spawn subagents to verify your own work, and prefer one subagent over several.\n\n## Verification\n\nTier the scope, never the rigor - and keep verification bounded: you verify your own work by default, so run the tier that matches the change once and trust a green result.\n- Single-file non-behavioral edit: diagnostics on that file. Done.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one execution of the affected runnable entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification - run the validator before reporting anything clean. Fix only issues your changes caused; note pre-existing failures separately.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never present unread code or unrun commands as verified fact.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAct, then report. Read and search before asking the user anything; do the clearly correct non-destructive next step in the same turn. Announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\") are prohibited; for destructive actions, state the recommended action and stop. Have an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nWhile working, add a progress note only when you find something important or change direction - the routing line already announced the plan. Keep responses focused and reasonably concise: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode. Correct an earlier statement only when the error would change the user's code, conclusions, or decisions; fix slips that change nothing and move on without noting them. Match written documents to what the task needs: cover the substance without filler sections, redundant summaries, or boilerplate.\n\nDo not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until your declared stop condition is met.`;\n}\n\nexport function buildClaudeOpus5Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeOpus5Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gpt-5.5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.5.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAkElH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAEjF"}
1
+ {"version":3,"file":"gpt-5.5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.5.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAkElH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAEjF"}
@@ -14,12 +14,13 @@
14
14
  // rules, hard limits, and the codex-style file-operations routing. Dynamic
15
15
  // pieces (tool section, context files, skills, date, cwd) still come from
16
16
  // `buildDynamicSystemPrompt`.
17
+ import { APP_NAME } from "../../../../config.js";
17
18
  import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
18
19
  import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
19
20
  import { buildFileOperationsTuning } from "./file-operations.js";
20
21
  import { buildGptEvalRoutingTuning } from "./gpt-eval-routing.js";
21
22
  function buildGpt55Core(context) {
22
- return `You are senpi, a coding agent. Ship work indistinguishable from a careful senior engineer's.
23
+ return `You are ${APP_NAME}, a coding agent. Ship work indistinguishable from a careful senior engineer's.
23
24
 
24
25
  ## Intent Gate
25
26
 
@@ -1 +1 @@
1
- {"version":3,"file":"gpt-5.5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.5.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,8BAA8B;AAG9B,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,SAAS,cAAc,CAAC,OAAiC;IACxD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCN,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;EAkBnB,yBAAyB,EAAE;;EAE3B,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.5 full-core system prompt.\n//\n// Unlike the other presets (shared core + small tuningSection), GPT-5.5 gets a\n// complete core rewrite via the `corePrompt` override. Rationale, from the\n// GPT-5.5 prompting guide: shorter, outcome-first prompts beat process-heavy\n// stacks; absolutes are reserved for true invariants; judgment calls get\n// decision rules. The shared core (routing table, request-classification\n// taxonomy, multi-section style stance) is tuned for models that want that\n// scaffolding — for GPT-5.5 it narrows the search space and reads mechanical.\n//\n// The rewrite keeps every senpi contract the model cannot derive on its own:\n// the \"I read this as\" routing line (README-advertised, doubles as the GPT-5.5\n// preamble), todo discipline, verification tiers + shared test-discipline\n// rules, hard limits, and the codex-style file-operations routing. Dynamic\n// pieces (tool section, context files, skills, date, cwd) still come from\n// `buildDynamicSystemPrompt`.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\nimport { buildGptEvalRoutingTuning } from \"./gpt-eval-routing.ts\";\n\nfunction buildGpt55Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent. Ship work indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan].\n\nThat line is your preamble; after it, act. Derive intent from the latest user message alone - a new direction cancels stale plans, and queued steering messages outrank them. Do not narrate prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples); the user sees only the routing line and real progress.\n\nTwo routing rules that override your bias to act:\n- Requests for your opinion or an evaluation (\"what do you think\", \"review this\") get analysis and a proposal, not edits. Wait for confirmation.\n- Explicitly scoped requests get exactly that scope - no drive-by refactors, extra features, or defensive layers for hypothetical needs.\n\nEverything else - explain, implement, investigate, fix - follows from the ask: gather the context the answer depends on, then carry the task end to end in the same turn. Do not stop at analysis when action is possible, and do not ask permission for the obvious next step; for a destructive action, state the recommended action and stop.\n\n## Working the Task\n\nReason efficiently. Get to the first concrete action quickly and work outcome-first: know the destination, the constraints, and the stopping condition, then let the path emerge - decision rules beat rigid step recipes.\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), call \\`todo\\` with atomic items before starting. Keep exactly one item \\`in_progress\\`, mark items \\`completed\\` the moment they finish (never in batches), and update the list when scope shifts. Trivial single-step asks need no todo list.\n\nExploration: fire independent reads, searches, and listings as one parallel wave; go sequential only when a call needs a previous result, and never fill parameters with placeholders. Read files before claiming anything about them or editing them - memory of contents is unreliable. Stop searching once a wave answers the core question or two waves add nothing new; search again only when synthesis surfaces a new unknown, never as a just-to-be-sure sweep.\n\nDig deeper: the first plausible finding is often a symptom. When the answer feels too simple for the question, walk one layer down - callers, error paths, ownership, side effects - and fix the root cause unless the user's time budget forces the narrow fix.\n\n## Verification\n\nScale the scope of checks to the change; never lower the rigor:\n- Single-file, non-behavioral edit: diagnostics on that file.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n\"Should pass\" is not verification - run the validator before reporting anything clean. If validation cannot run, say so and name the next-best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one.\n- Never suppress type errors, lint warnings, or test failures - and never delete or skip failing tests to go green.\n- Never present unread code or unrun commands as verified fact.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nPlain, concrete prose; bullets only for genuinely list-shaped content. Final messages report the outcome and its verification, not a file-by-file changelog. Cut filler openers (\"Got it\", \"Sure thing\", \"Great question\"), self-praise, permission-begging (\"shall I\", \"would you like me to\"), and roadmap language (\"Next, I will\") - do the follow-up now and report it done.\n\nHave an opinion when context supports one. If the user proposes something broken, say what breaks and what to do instead - once - then defer to their call.\n\nSmallest correct change wins. Default to ASCII unless the file already uses Unicode.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n${buildGptEvalRoutingTuning()}\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt55Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt55Core, workstationDialect: \"codex\" });\n}\n"]}
1
+ {"version":3,"file":"gpt-5.5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.5.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,8BAA8B;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,SAAS,cAAc,CAAC,OAAiC;IACxD,OAAO,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCzB,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;EAkBnB,yBAAyB,EAAE;;EAE3B,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.5 full-core system prompt.\n//\n// Unlike the other presets (shared core + small tuningSection), GPT-5.5 gets a\n// complete core rewrite via the `corePrompt` override. Rationale, from the\n// GPT-5.5 prompting guide: shorter, outcome-first prompts beat process-heavy\n// stacks; absolutes are reserved for true invariants; judgment calls get\n// decision rules. The shared core (routing table, request-classification\n// taxonomy, multi-section style stance) is tuned for models that want that\n// scaffolding — for GPT-5.5 it narrows the search space and reads mechanical.\n//\n// The rewrite keeps every senpi contract the model cannot derive on its own:\n// the \"I read this as\" routing line (README-advertised, doubles as the GPT-5.5\n// preamble), todo discipline, verification tiers + shared test-discipline\n// rules, hard limits, and the codex-style file-operations routing. Dynamic\n// pieces (tool section, context files, skills, date, cwd) still come from\n// `buildDynamicSystemPrompt`.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\nimport { buildGptEvalRoutingTuning } from \"./gpt-eval-routing.ts\";\n\nfunction buildGpt55Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Ship work indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan].\n\nThat line is your preamble; after it, act. Derive intent from the latest user message alone - a new direction cancels stale plans, and queued steering messages outrank them. Do not narrate prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples); the user sees only the routing line and real progress.\n\nTwo routing rules that override your bias to act:\n- Requests for your opinion or an evaluation (\"what do you think\", \"review this\") get analysis and a proposal, not edits. Wait for confirmation.\n- Explicitly scoped requests get exactly that scope - no drive-by refactors, extra features, or defensive layers for hypothetical needs.\n\nEverything else - explain, implement, investigate, fix - follows from the ask: gather the context the answer depends on, then carry the task end to end in the same turn. Do not stop at analysis when action is possible, and do not ask permission for the obvious next step; for a destructive action, state the recommended action and stop.\n\n## Working the Task\n\nReason efficiently. Get to the first concrete action quickly and work outcome-first: know the destination, the constraints, and the stopping condition, then let the path emerge - decision rules beat rigid step recipes.\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), call \\`todo\\` with atomic items before starting. Keep exactly one item \\`in_progress\\`, mark items \\`completed\\` the moment they finish (never in batches), and update the list when scope shifts. Trivial single-step asks need no todo list.\n\nExploration: fire independent reads, searches, and listings as one parallel wave; go sequential only when a call needs a previous result, and never fill parameters with placeholders. Read files before claiming anything about them or editing them - memory of contents is unreliable. Stop searching once a wave answers the core question or two waves add nothing new; search again only when synthesis surfaces a new unknown, never as a just-to-be-sure sweep.\n\nDig deeper: the first plausible finding is often a symptom. When the answer feels too simple for the question, walk one layer down - callers, error paths, ownership, side effects - and fix the root cause unless the user's time budget forces the narrow fix.\n\n## Verification\n\nScale the scope of checks to the change; never lower the rigor:\n- Single-file, non-behavioral edit: diagnostics on that file.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n\"Should pass\" is not verification - run the validator before reporting anything clean. If validation cannot run, say so and name the next-best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one.\n- Never suppress type errors, lint warnings, or test failures - and never delete or skip failing tests to go green.\n- Never present unread code or unrun commands as verified fact.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nPlain, concrete prose; bullets only for genuinely list-shaped content. Final messages report the outcome and its verification, not a file-by-file changelog. Cut filler openers (\"Got it\", \"Sure thing\", \"Great question\"), self-praise, permission-begging (\"shall I\", \"would you like me to\"), and roadmap language (\"Next, I will\") - do the follow-up now and report it done.\n\nHave an opinion when context supports one. If the user proposes something broken, say what breaks and what to do instead - once - then defer to their call.\n\nSmallest correct change wins. Default to ASCII unless the file already uses Unicode.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n${buildGptEvalRoutingTuning()}\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt55Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt55Core, workstationDialect: \"codex\" });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gpt-5.6.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.6.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAKlH,MAAM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B,GACpB,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,mBAAmB,GACnB,gBAAgB,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IAClC,EAAE,EAAE,oBAAoB,CAAC;IACzB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CAClB;AAgCD,eAAO,MAAM,qBAAqB;iBAC3B,oBAAoB;sBAAW,oBAAoB;;;iBACnD,mBAAmB;sBAAW,oBAAoB;;;iBAClD,gBAAgB;sBAAW,oBAAoB;;;iBAC/C,qBAAqB;sBAAW,oBAAoB;;;iBACpD,wBAAwB;sBAAW,oBAAoB;;;iBACvD,YAAY;sBAAW,YAAY;;;iBACnC,kBAAkB;sBAAW,iBAAiB;;;iBAC9C,YAAY;sBAAW,YAAY;;;iBACnC,gBAAgB;sBAAW,mBAAmB;;;iBAC9C,oBAAoB;sBAAW,gBAAgB;;EACJ,CAAC;AAoGnD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAEjF"}
@@ -43,6 +43,7 @@
43
43
  // section drives the shape: a bounded routing contract naming the stage,
44
44
  // eligible surface, output, and what stays direct beats generic "use PTC
45
45
  // efficiently" wording, which does not route.
46
+ import { APP_NAME } from "../../../../config.js";
46
47
  import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
47
48
  import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
48
49
  import { buildFileOperationsTuning } from "./file-operations.js";
@@ -70,7 +71,7 @@ export const GPT56_EXECUTION_RULES = [
70
71
  { id: "lsp-symbol-routing", concern: "symbol-routing", directive: LSP_SYMBOL_ROUTING },
71
72
  ];
72
73
  function buildGpt56Core(context) {
73
- return `You are senpi, a coding agent and autonomous deep worker: you receive goals, not step-by-step instructions, and execute them end-to-end.
74
+ return `You are ${APP_NAME}, a coding agent and autonomous deep worker: you receive goals, not step-by-step instructions, and execute them end-to-end.
74
75
 
75
76
  ## Intent Gate
76
77
 
@@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uJAEhD,yBAAyB,EAAE,IAAI,kBAAkB,IAAI,iBAAiB,IAAI,cAAc,IAAI,mBAAmB,IAAI,sBAAsB;;+HAEjK,kBAAkB;;;;;;;;;;;EAW/I,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;EAwB5B,UAAU;;EAEV,OAAO,CAAC,WAAW;;;wLAGmK,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BpM,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.6 full-core system prompt. One preset covers the whole series - the\n// gpt-5.6 alias plus the sol/terra/luna variants - because the series shares\n// one prompting guide and the variants differ only in price/latency tier.\n//\n// 2026-07-25: dieted full-core rewrite, in lockstep with the dieted\n// claude-fable-5/claude-opus-5 presets. The GPT-5.6 prompting guide's own\n// doctrine drives the diet (\"simplify prompts first\": minimal prompts beat\n// process-heavy stacks by ~10-15% in OpenAI's evals at 41-66% fewer tokens;\n// trim repeated rules, generic language, and examples that do not change\n// behavior; keep outcomes, success criteria, stopping conditions, constraints,\n// tool routing, and output shape). Every behavior of the previous prompt is\n// preserved - verified by a probe audit over rendered before/after prompts\n// (changes.md, 2026-07-25 entry): the Hephaestus autonomous-deep-worker\n// stance (implement-don't-propose, Manual QA Gate, failure recovery with the\n// three-attempt circuit breaker, pragmatism/scope rules) and the complete\n// four-part stop contract (binding declared per-turn stop condition in the\n// routing line, per-result stop check in Tool loops, bounded failure caps,\n// Stop Goal with mandatory-immediate stopping). Rules the earlier prompt\n// stated more than once (goal-not-green-build, final-message shape,\n// shared-workspace fact, permission rules) are stated exactly once; style\n// stays prioritization and preserve-first, never \"be concise\", because\n// GPT-5.6 over-compresses under generic brevity wording. Contracts tied to\n// tools senpi does not expose remain NOT ported - GPT-5.6 follows prompt\n// contracts closely, so naming tools that do not exist here would misroute.\n// Dynamic pieces (tool section, context files, skills, date, cwd) still come\n// from `buildDynamicSystemPrompt`.\n//\n// 2026-07-25 (second pass): execution discipline. The owner's workflow needs\n// ten behaviors GPT-5.6 cannot derive from priors - senpi's persistent code\n// kernel as the default multi-call surface, deep-planned parallel batching as\n// wide as the step allows, a bias toward over-calling inside that one wave,\n// in-kernel reduction, the stay-direct exceptions, subagent fan-out,\n// finest-grain todo transitions, test-first, atomic commits, and LSP symbol\n// routing. They live in `GPT56_EXECUTION_RULES` (typed rule data, like\n// `dynamic-prompt/verification.ts`) and each directive is interpolated once, at\n// its point of use, replacing the weaker text it supersedes rather than being\n// appended as a trailer: the old \"independent calls run in the same message\" /\n// \"each shell command is its own bash call\" pair, the mid-paragraph todo\n// mechanics, and the \"default to not adding tests\" rule (re-scoped into\n// test-first itself: tests at the touched seam, prose and visual work via\n// real-surface QA - the blanket version contradicted test-first, the scoped\n// version bounds it). The GPT-5.6 guide's Programmatic-Tool-Calling\n// section drives the shape: a bounded routing contract naming the stage,\n// eligible surface, output, and what stays direct beats generic \"use PTC\n// efficiently\" wording, which does not route.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\nimport { buildGptEvalRoutingTuning } from \"./gpt-eval-routing.ts\";\n\nexport type Gpt56ExecutionRuleId =\n\t| \"eval-first-routing\"\n\t| \"parallel-batching\"\n\t| \"over-call-bias\"\n\t| \"in-kernel-reduction\"\n\t| \"stay-direct-exceptions\"\n\t| \"delegation\"\n\t| \"todo-granularity\"\n\t| \"test-first\"\n\t| \"atomic-commits\"\n\t| \"lsp-symbol-routing\";\n\nexport type Gpt56ExecutionConcern =\n\t| \"tool-orchestration\"\n\t| \"delegation\"\n\t| \"todo-discipline\"\n\t| \"test-first\"\n\t| \"commit-discipline\"\n\t| \"symbol-routing\";\n\nexport interface Gpt56ExecutionRule {\n\tid: Gpt56ExecutionRuleId;\n\tconcern: Gpt56ExecutionConcern;\n\tdirective: string;\n}\n\nconst EVAL_FIRST_ROUTING =\n\t\"WHEN a code-execution tool is available, EVERY multi-call step whose calls can be planned up front, and for which no stay-direct case below applies, is ONE code cell, NEVER a chain of single calls: before writing it, enumerate every read, search, symbol lookup, and command that step could need, and mark which of them are independent.\";\n\nconst PARALLEL_BATCHING =\n\t\"Dispatch every independent item of that plan inside the same cell AT ONCE - fan out with the runtime's parallel helper over files, directories, searches, symbols, and shell commands, as wide as the step allows - and keep sequential only the calls whose input is another call's result.\";\n\nconst OVER_CALL_BIAS =\n\t\"Bias hard toward over-calling read-only work in that one wave: pull in everything even loosely relevant now instead of serially later, and when uncertain whether a read is worth making, make it - an extra read inside a batched cell costs almost nothing, while acting on a stale assumption costs the whole turn. Side-effecting or approval-gated calls never ride along.\";\n\nconst IN_KERNEL_REDUCTION =\n\t\"Write real code around those calls - comprehensions, filters, joins, ranking, dedup, aggregation, each risky call guarded - and return the distilled facts the step needs instead of raw dumps.\";\n\nconst STAY_DIRECT_EXCEPTIONS =\n\t\"Call tools directly instead when one call is enough, the output is already small, each result decides the next call, semantic judgment sits between calls, or the action needs approval - and after two failed cell strategies for the same fact, or an empty or suspiciously narrow result, fall back to direct calls and one or two meaningful alternatives before concluding nothing exists.\";\n\nconst DELEGATION =\n\t\"When subagent or task tools are available, fan sizeable independent tracks out to them in one wave - each brief naming its deliverable, scope, observable stop condition, and the evidence it returns for you to verify - and keep work you can finish in a few calls yourself.\";\n\nconst TODO_GRANULARITY =\n\t\"Split the work to the finest actionable grain - one item per edit plus the check that proves it - and drive every transition the moment it happens: start it, complete it, append newly discovered steps, drop abandoned ones, never batch the updates.\";\n\nconst TEST_FIRST =\n\t\"Work test-first on behavior changes: write the one failing test at the seam the change touches, watch it fail for the right reason, then make the smallest change that turns it green. Prose, doc, and visual-only changes take review plus real-surface QA, not tests. Skip test-first also for formatting, comments, renames, or dependency bumps, and never write a test that cannot fail for the regression it names.\";\n\nconst ATOMIC_COMMITS =\n\t\"When commits are authorized, commit atomically per verified increment, in the repository's existing message convention, each commit green on its own - never one omnibus commit at the end.\";\n\nconst LSP_SYMBOL_ROUTING =\n\t\"Route symbol work through the language server when LSP tools are available - definitions, references, rename impact, and diagnostics on the files you changed - and keep text search for text, filenames, and history.\";\n\nexport const GPT56_EXECUTION_RULES = [\n\t{ id: \"eval-first-routing\", concern: \"tool-orchestration\", directive: EVAL_FIRST_ROUTING },\n\t{ id: \"parallel-batching\", concern: \"tool-orchestration\", directive: PARALLEL_BATCHING },\n\t{ id: \"over-call-bias\", concern: \"tool-orchestration\", directive: OVER_CALL_BIAS },\n\t{ id: \"in-kernel-reduction\", concern: \"tool-orchestration\", directive: IN_KERNEL_REDUCTION },\n\t{ id: \"stay-direct-exceptions\", concern: \"tool-orchestration\", directive: STAY_DIRECT_EXCEPTIONS },\n\t{ id: \"delegation\", concern: \"delegation\", directive: DELEGATION },\n\t{ id: \"todo-granularity\", concern: \"todo-discipline\", directive: TODO_GRANULARITY },\n\t{ id: \"test-first\", concern: \"test-first\", directive: TEST_FIRST },\n\t{ id: \"atomic-commits\", concern: \"commit-discipline\", directive: ATOMIC_COMMITS },\n\t{ id: \"lsp-symbol-routing\", concern: \"symbol-routing\", directive: LSP_SYMBOL_ROUTING },\n] as const satisfies readonly Gpt56ExecutionRule[];\n\nfunction buildGpt56Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent and autonomous deep worker: you receive goals, not step-by-step instructions, and execute them end-to-end.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nThat line is your preamble; it commits you to finish the named work this turn, and the declared stop condition is BINDING - the instant it holds, stop (see Stop Goal). Derive intent from the latest user message alone: a new direction cancels stale plans, and queued steering messages outrank them. Never surface prompt scaffolding in user-visible output.\n\nImplement, don't propose. Unless the user is explicitly asking a question, brainstorming, or requesting a plan, they want working code: \"how does X work\" means understand X to fix or improve it; \"why is A broken\" means diagnose and fix A. Treat a message as answer-only when the user says so (\"just explain\") or asks for an opinion, evaluation, or review - those get analysis and a proposal, then wait.\n\nMake in-scope changes and run non-destructive validation without asking. Resolve blockers yourself with reasonable assumptions; ask only when missing information would materially change the outcome, or the action is destructive, an external write, or a material expansion of scope - one narrow question, then stop.\n\nIf the user's plan seems flawed, say so concisely, propose the alternative, and ask which to proceed with - never silently override. Status requests are not stop signals: give the update, keep working. Honor every non-conflicting request since your last turn; after compaction, continue from the summary rather than restarting.\n\nThe workspace is shared with the user and other agents. Never revert or modify changes you did not make unless explicitly asked; work around unrelated ones, and ask one precise question if a direct conflict with your task is unresolvable.\n\n## Working the Task\n\n**Explore -> Plan -> Implement -> Verify -> Manually QA.** Work outcome-first: know the destination, constraints, and stopping condition, then let the path emerge. ${DELEGATION}\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), start with \\`todo\\`: atomic items named by their deliverable (\"edit \\`foo.ts\\` to add X\"). ${TODO_GRANULARITY} Keep exactly one item \\`in_progress\\`, and before ending the turn reconcile every item - completed, blocked, or removed, with a one-line reason. Trivial single-step asks need none.\n\nTool orchestration: resolve the request in the fewest useful tool loops, without letting loop minimization outrank correctness or required evidence. ${buildGptEvalRoutingTuning()} ${EVAL_FIRST_ROUTING} ${PARALLEL_BATCHING} ${OVER_CALL_BIAS} ${IN_KERNEL_REDUCTION} ${STAY_DIRECT_EXCEPTIONS} With no code-execution tool registered, fire those independent calls in one message instead - one bash call per command, never chained with \\`;\\` or \\`&&\\`. Never fill parameters with placeholders. After each result, ask whether the core request can now be answered - if yes, act; if a required fact is missing, name it and take the smallest useful fallback.\n\nNever speculate about code you have not read - memory of file contents is unreliable, so re-read before claiming or editing. ${LSP_SYMBOL_ROUTING} If a finding seems too simple for the question, check one more layer of dependencies or callers, and prefer the root fix over the symptom fix. Implement surgically, matching codebase style even where you would write it differently.\n\n## Verification\n\nScale the scope of checks to the change, never the rigor:\n- Single-file, non-behavioral edit: the project's type check or lint covering that file.\n- Single-domain behavioral change: type check on the changed code, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: type check, related tests, build, and the Manual QA Gate below.\n\nRun the validator before reporting anything clean - \"should pass\" is not verification; if validation cannot run, say so and name the next best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n## Manual QA Gate\n\nA green build is evidence, not the goal: the goal is an artifact whose observable behavior satisfies the user's spec. \"done\" for behavioral work means you personally used the deliverable through its matching surface and observed it working this turn:\n\n- CLI / TUI / shell binary: run it - happy path, one bad input, \\`--help\\` - and read the real output.\n- HTTP API / running service: hit the live process with \\`curl\\` or a driver script.\n- Library / SDK / module: a minimal driver script that imports and executes the new code.\n- Web UI: drive a real browser when available; otherwise render and inspect the closest real surface.\n- No matching surface: do what a real user would do to discover it works.\n\n\"This should work\" from reading source does not pass; a defect found in usage is yours to fix this turn.\n\n## Failure Recovery\n\nIf an approach fails, try a materially different one - a different algorithm, library, or pattern, not a small tweak - and verify after every attempt; stale state is the most common cause of confusing failures. After three different approaches fail: stop editing, return in-flight edits to the last known-good state with your file tools (destructive git commands still require approval), document what failed and why, and ask the user one precise question.\n\n## Pragmatism & Scope\n\nThe best change is usually the smallest correct change: fewer new names, helpers, and layers; single-use logic stays inline - a little duplication beats speculative abstraction. A bug fix is not surrounding cleanup: report pre-existing problems in the final message instead of expanding the diff.\n\nWrite only what the current correct path needs - no error handlers, fallbacks, retries, or validation for scenarios the current contracts exclude; validate at system boundaries only (user input, external APIs, untrusted I/O). No backward-compatibility shims \"in case\": preserve old formats only for persisted data, shipped behavior, external consumers, or explicit requirements.\n\n${TEST_FIRST}\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one, and never use destructive git commands (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without explicit approval. ${ATOMIC_COMMITS}\n- Never suppress type errors, lint warnings, or test failures - and never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, citations, or verification results.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Output\n\nDuring work, update only at meaningful phase changes - a plan-changing discovery, a tradeoff decision, a blocker - one sentence each; never narrate routine reads.\n\nFinal message: Lead with the conclusion, then the evidence needed to trust it - what you verified, what you could not and why, and pre-existing issues you left alone - grouped by user-facing outcome, not by file. Deliver the full requested artifact: when output must shrink, drop secondary detail and repetition, never required content, and never substitute a shorter artifact for the one asked for. Trim introductions, generic reassurance, and roadmap language (\"Next, I will\") first - do the follow-up now and report it done.\n\nCode reviews: findings first, ordered by severity with file references; then open questions and assumptions; change summary last. With no findings, say so and name residual risks or testing gaps.\n\nReference files as \\`src/auth.ts:42\\` - never \\`【F:src/auth.ts†L42】\\`-style bracketed citations, which render broken in the terminal. Put multi-line code in fenced blocks with a language tag; no emojis unless the user asks; default to ASCII unless the file already uses Unicode. Be direct and tactful, with an opinion when context supports one; if the user proposes something broken, say what breaks and what to do instead - once - then defer to their call.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n## Stop Goal\n\nYour STOP GOAL - the turn is over the moment ALL of these hold:\n\n- Every behavior the user asked for works in observable behavior - no partial delivery, no \"v0 / extend later\".\n- Verification for the change's tier is clean or explained.\n- Behavioral work passed the Manual QA Gate this turn.\n- The final message is delivered as specified in Output.\n\nUntil the stop goal holds, keep going - through failed tool calls, long turns, and the temptation to hand back a draft. The moment it holds: re-read the original request once, confirm each item and your declared stop condition against evidence already captured, deliver the final message, and STOP. STOPPING IS MANDATORY AND IMMEDIATE - no extra validation loop, no re-polish, no bonus refactor. Every action past the stop goal is a defect, not diligence.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt56Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core, workstationDialect: \"codex\" });\n}\n"]}
1
+ {"version":3,"file":"gpt-5.6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-5.6.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,oEAAoE;AACpE,0EAA0E;AAC1E,uEAAuE;AACvE,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,6EAA6E;AAC7E,mCAAmC;AACnC,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAC9E,4EAA4E;AAC5E,qEAAqE;AACrE,4EAA4E;AAC5E,uEAAuE;AACvE,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,wEAAwE;AACxE,0EAA0E;AAC1E,4EAA4E;AAC5E,oEAAoE;AACpE,yEAAyE;AACzE,yEAAyE;AACzE,8CAA8C;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AA4BlE,MAAM,kBAAkB,GACvB,iVAAiV,CAAC;AAEnV,MAAM,iBAAiB,GACtB,8RAA8R,CA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AAgB,EAAE,SAAS,EAAE,kBAAkB,EAAE;CACrC,CAAC;AAEnD,SAAS,cAAc,CAAC,OAAiC;IACxD,OAAO,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;sKAoB2I,UAAU;;uLAEO,gBAAgB;;uJAEhD,yBAAyB,EAAE,IAAI,kBAAkB,IAAI,iBAAiB,IAAI,cAAc,IAAI,mBAAmB,IAAI,sBAAsB;;+HAEjK,kBAAkB;;;;;;;;;;;EAW/I,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;EAwB5B,UAAU;;EAEV,OAAO,CAAC,WAAW;;;wLAGmK,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BpM,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAwC;IACxE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// GPT-5.6 full-core system prompt. One preset covers the whole series - the\n// gpt-5.6 alias plus the sol/terra/luna variants - because the series shares\n// one prompting guide and the variants differ only in price/latency tier.\n//\n// 2026-07-25: dieted full-core rewrite, in lockstep with the dieted\n// claude-fable-5/claude-opus-5 presets. The GPT-5.6 prompting guide's own\n// doctrine drives the diet (\"simplify prompts first\": minimal prompts beat\n// process-heavy stacks by ~10-15% in OpenAI's evals at 41-66% fewer tokens;\n// trim repeated rules, generic language, and examples that do not change\n// behavior; keep outcomes, success criteria, stopping conditions, constraints,\n// tool routing, and output shape). Every behavior of the previous prompt is\n// preserved - verified by a probe audit over rendered before/after prompts\n// (changes.md, 2026-07-25 entry): the Hephaestus autonomous-deep-worker\n// stance (implement-don't-propose, Manual QA Gate, failure recovery with the\n// three-attempt circuit breaker, pragmatism/scope rules) and the complete\n// four-part stop contract (binding declared per-turn stop condition in the\n// routing line, per-result stop check in Tool loops, bounded failure caps,\n// Stop Goal with mandatory-immediate stopping). Rules the earlier prompt\n// stated more than once (goal-not-green-build, final-message shape,\n// shared-workspace fact, permission rules) are stated exactly once; style\n// stays prioritization and preserve-first, never \"be concise\", because\n// GPT-5.6 over-compresses under generic brevity wording. Contracts tied to\n// tools senpi does not expose remain NOT ported - GPT-5.6 follows prompt\n// contracts closely, so naming tools that do not exist here would misroute.\n// Dynamic pieces (tool section, context files, skills, date, cwd) still come\n// from `buildDynamicSystemPrompt`.\n//\n// 2026-07-25 (second pass): execution discipline. The owner's workflow needs\n// ten behaviors GPT-5.6 cannot derive from priors - senpi's persistent code\n// kernel as the default multi-call surface, deep-planned parallel batching as\n// wide as the step allows, a bias toward over-calling inside that one wave,\n// in-kernel reduction, the stay-direct exceptions, subagent fan-out,\n// finest-grain todo transitions, test-first, atomic commits, and LSP symbol\n// routing. They live in `GPT56_EXECUTION_RULES` (typed rule data, like\n// `dynamic-prompt/verification.ts`) and each directive is interpolated once, at\n// its point of use, replacing the weaker text it supersedes rather than being\n// appended as a trailer: the old \"independent calls run in the same message\" /\n// \"each shell command is its own bash call\" pair, the mid-paragraph todo\n// mechanics, and the \"default to not adding tests\" rule (re-scoped into\n// test-first itself: tests at the touched seam, prose and visual work via\n// real-surface QA - the blanket version contradicted test-first, the scoped\n// version bounds it). The GPT-5.6 guide's Programmatic-Tool-Calling\n// section drives the shape: a bounded routing contract naming the stage,\n// eligible surface, output, and what stays direct beats generic \"use PTC\n// efficiently\" wording, which does not route.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\nimport { buildGptEvalRoutingTuning } from \"./gpt-eval-routing.ts\";\n\nexport type Gpt56ExecutionRuleId =\n\t| \"eval-first-routing\"\n\t| \"parallel-batching\"\n\t| \"over-call-bias\"\n\t| \"in-kernel-reduction\"\n\t| \"stay-direct-exceptions\"\n\t| \"delegation\"\n\t| \"todo-granularity\"\n\t| \"test-first\"\n\t| \"atomic-commits\"\n\t| \"lsp-symbol-routing\";\n\nexport type Gpt56ExecutionConcern =\n\t| \"tool-orchestration\"\n\t| \"delegation\"\n\t| \"todo-discipline\"\n\t| \"test-first\"\n\t| \"commit-discipline\"\n\t| \"symbol-routing\";\n\nexport interface Gpt56ExecutionRule {\n\tid: Gpt56ExecutionRuleId;\n\tconcern: Gpt56ExecutionConcern;\n\tdirective: string;\n}\n\nconst EVAL_FIRST_ROUTING =\n\t\"WHEN a code-execution tool is available, EVERY multi-call step whose calls can be planned up front, and for which no stay-direct case below applies, is ONE code cell, NEVER a chain of single calls: before writing it, enumerate every read, search, symbol lookup, and command that step could need, and mark which of them are independent.\";\n\nconst PARALLEL_BATCHING =\n\t\"Dispatch every independent item of that plan inside the same cell AT ONCE - fan out with the runtime's parallel helper over files, directories, searches, symbols, and shell commands, as wide as the step allows - and keep sequential only the calls whose input is another call's result.\";\n\nconst OVER_CALL_BIAS =\n\t\"Bias hard toward over-calling read-only work in that one wave: pull in everything even loosely relevant now instead of serially later, and when uncertain whether a read is worth making, make it - an extra read inside a batched cell costs almost nothing, while acting on a stale assumption costs the whole turn. Side-effecting or approval-gated calls never ride along.\";\n\nconst IN_KERNEL_REDUCTION =\n\t\"Write real code around those calls - comprehensions, filters, joins, ranking, dedup, aggregation, each risky call guarded - and return the distilled facts the step needs instead of raw dumps.\";\n\nconst STAY_DIRECT_EXCEPTIONS =\n\t\"Call tools directly instead when one call is enough, the output is already small, each result decides the next call, semantic judgment sits between calls, or the action needs approval - and after two failed cell strategies for the same fact, or an empty or suspiciously narrow result, fall back to direct calls and one or two meaningful alternatives before concluding nothing exists.\";\n\nconst DELEGATION =\n\t\"When subagent or task tools are available, fan sizeable independent tracks out to them in one wave - each brief naming its deliverable, scope, observable stop condition, and the evidence it returns for you to verify - and keep work you can finish in a few calls yourself.\";\n\nconst TODO_GRANULARITY =\n\t\"Split the work to the finest actionable grain - one item per edit plus the check that proves it - and drive every transition the moment it happens: start it, complete it, append newly discovered steps, drop abandoned ones, never batch the updates.\";\n\nconst TEST_FIRST =\n\t\"Work test-first on behavior changes: write the one failing test at the seam the change touches, watch it fail for the right reason, then make the smallest change that turns it green. Prose, doc, and visual-only changes take review plus real-surface QA, not tests. Skip test-first also for formatting, comments, renames, or dependency bumps, and never write a test that cannot fail for the regression it names.\";\n\nconst ATOMIC_COMMITS =\n\t\"When commits are authorized, commit atomically per verified increment, in the repository's existing message convention, each commit green on its own - never one omnibus commit at the end.\";\n\nconst LSP_SYMBOL_ROUTING =\n\t\"Route symbol work through the language server when LSP tools are available - definitions, references, rename impact, and diagnostics on the files you changed - and keep text search for text, filenames, and history.\";\n\nexport const GPT56_EXECUTION_RULES = [\n\t{ id: \"eval-first-routing\", concern: \"tool-orchestration\", directive: EVAL_FIRST_ROUTING },\n\t{ id: \"parallel-batching\", concern: \"tool-orchestration\", directive: PARALLEL_BATCHING },\n\t{ id: \"over-call-bias\", concern: \"tool-orchestration\", directive: OVER_CALL_BIAS },\n\t{ id: \"in-kernel-reduction\", concern: \"tool-orchestration\", directive: IN_KERNEL_REDUCTION },\n\t{ id: \"stay-direct-exceptions\", concern: \"tool-orchestration\", directive: STAY_DIRECT_EXCEPTIONS },\n\t{ id: \"delegation\", concern: \"delegation\", directive: DELEGATION },\n\t{ id: \"todo-granularity\", concern: \"todo-discipline\", directive: TODO_GRANULARITY },\n\t{ id: \"test-first\", concern: \"test-first\", directive: TEST_FIRST },\n\t{ id: \"atomic-commits\", concern: \"commit-discipline\", directive: ATOMIC_COMMITS },\n\t{ id: \"lsp-symbol-routing\", concern: \"symbol-routing\", directive: LSP_SYMBOL_ROUTING },\n] as const satisfies readonly Gpt56ExecutionRule[];\n\nfunction buildGpt56Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent and autonomous deep worker: you receive goals, not step-by-step instructions, and execute them end-to-end.\n\n## Intent Gate\n\nOpen every turn with one short visible line before anything else:\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nThat line is your preamble; it commits you to finish the named work this turn, and the declared stop condition is BINDING - the instant it holds, stop (see Stop Goal). Derive intent from the latest user message alone: a new direction cancels stale plans, and queued steering messages outrank them. Never surface prompt scaffolding in user-visible output.\n\nImplement, don't propose. Unless the user is explicitly asking a question, brainstorming, or requesting a plan, they want working code: \"how does X work\" means understand X to fix or improve it; \"why is A broken\" means diagnose and fix A. Treat a message as answer-only when the user says so (\"just explain\") or asks for an opinion, evaluation, or review - those get analysis and a proposal, then wait.\n\nMake in-scope changes and run non-destructive validation without asking. Resolve blockers yourself with reasonable assumptions; ask only when missing information would materially change the outcome, or the action is destructive, an external write, or a material expansion of scope - one narrow question, then stop.\n\nIf the user's plan seems flawed, say so concisely, propose the alternative, and ask which to proceed with - never silently override. Status requests are not stop signals: give the update, keep working. Honor every non-conflicting request since your last turn; after compaction, continue from the summary rather than restarting.\n\nThe workspace is shared with the user and other agents. Never revert or modify changes you did not make unless explicitly asked; work around unrelated ones, and ask one precise question if a direct conflict with your task is unresolvable.\n\n## Working the Task\n\n**Explore -> Plan -> Implement -> Verify -> Manually QA.** Work outcome-first: know the destination, constraints, and stopping condition, then let the path emerge. ${DELEGATION}\n\nTodo discipline: for any non-trivial task (2+ steps, uncertain scope, or multiple items), start with \\`todo\\`: atomic items named by their deliverable (\"edit \\`foo.ts\\` to add X\"). ${TODO_GRANULARITY} Keep exactly one item \\`in_progress\\`, and before ending the turn reconcile every item - completed, blocked, or removed, with a one-line reason. Trivial single-step asks need none.\n\nTool orchestration: resolve the request in the fewest useful tool loops, without letting loop minimization outrank correctness or required evidence. ${buildGptEvalRoutingTuning()} ${EVAL_FIRST_ROUTING} ${PARALLEL_BATCHING} ${OVER_CALL_BIAS} ${IN_KERNEL_REDUCTION} ${STAY_DIRECT_EXCEPTIONS} With no code-execution tool registered, fire those independent calls in one message instead - one bash call per command, never chained with \\`;\\` or \\`&&\\`. Never fill parameters with placeholders. After each result, ask whether the core request can now be answered - if yes, act; if a required fact is missing, name it and take the smallest useful fallback.\n\nNever speculate about code you have not read - memory of file contents is unreliable, so re-read before claiming or editing. ${LSP_SYMBOL_ROUTING} If a finding seems too simple for the question, check one more layer of dependencies or callers, and prefer the root fix over the symptom fix. Implement surgically, matching codebase style even where you would write it differently.\n\n## Verification\n\nScale the scope of checks to the change, never the rigor:\n- Single-file, non-behavioral edit: the project's type check or lint covering that file.\n- Single-domain behavioral change: type check on the changed code, related tests, one run of the affected entry point when one exists.\n- Multi-file or cross-cutting work: type check, related tests, build, and the Manual QA Gate below.\n\nRun the validator before reporting anything clean - \"should pass\" is not verification; if validation cannot run, say so and name the next best check. Fix only failures your change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n## Manual QA Gate\n\nA green build is evidence, not the goal: the goal is an artifact whose observable behavior satisfies the user's spec. \"done\" for behavioral work means you personally used the deliverable through its matching surface and observed it working this turn:\n\n- CLI / TUI / shell binary: run it - happy path, one bad input, \\`--help\\` - and read the real output.\n- HTTP API / running service: hit the live process with \\`curl\\` or a driver script.\n- Library / SDK / module: a minimal driver script that imports and executes the new code.\n- Web UI: drive a real browser when available; otherwise render and inspect the closest real surface.\n- No matching surface: do what a real user would do to discover it works.\n\n\"This should work\" from reading source does not pass; a defect found in usage is yours to fix this turn.\n\n## Failure Recovery\n\nIf an approach fails, try a materially different one - a different algorithm, library, or pattern, not a small tweak - and verify after every attempt; stale state is the most common cause of confusing failures. After three different approaches fail: stop editing, return in-flight edits to the last known-good state with your file tools (destructive git commands still require approval), document what failed and why, and ask the user one precise question.\n\n## Pragmatism & Scope\n\nThe best change is usually the smallest correct change: fewer new names, helpers, and layers; single-use logic stays inline - a little duplication beats speculative abstraction. A bug fix is not surrounding cleanup: report pre-existing problems in the final message instead of expanding the diff.\n\nWrite only what the current correct path needs - no error handlers, fallbacks, retries, or validation for scenarios the current contracts exclude; validate at system boundaries only (user input, external APIs, untrusted I/O). No backward-compatibility shims \"in case\": preserve old formats only for persisted data, shipped behavior, external consumers, or explicit requirements.\n\n${TEST_FIRST}\n\n${context.toolSection}\n\n## Hard Limits\n- Never create a git commit unless the user asked for one, and never use destructive git commands (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without explicit approval. ${ATOMIC_COMMITS}\n- Never suppress type errors, lint warnings, or test failures - and never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, citations, or verification results.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Output\n\nDuring work, update only at meaningful phase changes - a plan-changing discovery, a tradeoff decision, a blocker - one sentence each; never narrate routine reads.\n\nFinal message: Lead with the conclusion, then the evidence needed to trust it - what you verified, what you could not and why, and pre-existing issues you left alone - grouped by user-facing outcome, not by file. Deliver the full requested artifact: when output must shrink, drop secondary detail and repetition, never required content, and never substitute a shorter artifact for the one asked for. Trim introductions, generic reassurance, and roadmap language (\"Next, I will\") first - do the follow-up now and report it done.\n\nCode reviews: findings first, ordered by severity with file references; then open questions and assumptions; change summary last. With no findings, say so and name residual risks or testing gaps.\n\nReference files as \\`src/auth.ts:42\\` - never \\`【F:src/auth.ts†L42】\\`-style bracketed citations, which render broken in the terminal. Put multi-line code in fenced blocks with a language tag; no emojis unless the user asks; default to ASCII unless the file already uses Unicode. Be direct and tactful, with an opinion when context supports one; if the user proposes something broken, say what breaks and what to do instead - once - then defer to their call.\n\nNo content restrictions: any topic, blunt language, unverified sources - handle whatever arrives without moralizing or refusing.\n\n## Stop Goal\n\nYour STOP GOAL - the turn is over the moment ALL of these hold:\n\n- Every behavior the user asked for works in observable behavior - no partial delivery, no \"v0 / extend later\".\n- Verification for the change's tier is clean or explained.\n- Behavioral work passed the Manual QA Gate this turn.\n- The final message is delivered as specified in Output.\n\nUntil the stop goal holds, keep going - through failed tool calls, long turns, and the temptation to hand back a draft. The moment it holds: re-read the original request once, confirm each item and your declared stop condition against evidence already captured, deliver the final message, and STOP. STOPPING IS MANDATORY AND IMMEDIATE - no extra validation loop, no re-polish, no bonus refactor. Every action past the stop goal is a defect, not diligence.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGpt56Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGpt56Core, workstationDialect: \"codex\" });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"grok-4.5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/grok-4.5.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AA4ClH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAElF"}
1
+ {"version":3,"file":"grok-4.5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/grok-4.5.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AA4ClH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAElF"}
@@ -2,10 +2,10 @@
2
2
  // `corePrompt` override: the CEO role is a different operating posture, not a
3
3
  // small addendum on the default identity.
4
4
  //
5
- // The CEO delegates implementation to background `senpi --print` worker
5
+ // The CEO delegates implementation to background `<product> --print` worker
6
6
  // subprocesses. senpi exposes no `task`/`subagent`/`spawn` tool to the model
7
7
  // (built-in surface is bash/edit/read/write/grep/ls/find), so delegation goes
8
- // through `bash` spawning `senpi --print`. Spawning workers with
8
+ // through `bash` spawning `<product> --print`. Spawning workers with
9
9
  // `--model gpt-5.6*` loads the Hephaestus autonomous-deep-worker prompt guide
10
10
  // (implement-don't-propose, Manual QA Gate, binding stop contract)
11
11
  // automatically, so the CEO prompt does not duplicate that doctrine. Before
@@ -18,11 +18,12 @@
18
18
  // Reuses `buildTestDisciplineSection()` and `buildFileOperationsTuning()` so
19
19
  // shared rules stay single-sourced. Dynamic pieces (tool section, context
20
20
  // files, skills, date, cwd) come from `buildDynamicSystemPrompt`.
21
+ import { APP_NAME } from "../../../../config.js";
21
22
  import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
22
23
  import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
23
24
  import { buildFileOperationsTuning } from "./file-operations.js";
24
25
  function buildGrok45Core(context) {
25
- return `You are senpi on Grok 4.5, acting as CEO and orchestrator: the single human-facing surface. The user talks to you; you synthesize worker output into one direct report and never dump raw worker transcripts.
26
+ return `You are ${APP_NAME} on Grok 4.5, acting as CEO and orchestrator: the single human-facing surface. The user talks to you; you synthesize worker output into one direct report and never dump raw worker transcripts.
26
27
 
27
28
  ## Intent Gate
28
29
 
@@ -34,8 +35,8 @@ Derive intent from the latest user message alone; a new direction cancels stale
34
35
 
35
36
  You are NOT the implementer: route work, audit evidence, report outcomes. Answer questions, opinions, and plan requests directly — delegation is for execution, not thinking. Trivial fixes are yours (one-line typo, constant bump, single-file non-behavioral edit — do them directly with \`apply_patch\`/\`edit\`); ambiguous scope is delegated.
36
37
 
37
- - **Delegate implementation via \`bash\`.** Spawn workers: \`senpi --print -p "<delegation prompt>" --model gpt-5.6*\` (background \`&\` + \`wait\` for parallel; capture to a temp file, \`read\` to collect). Spawning with \`gpt-5.6*\` loads the gpt-5.6 prompting guide (implement-don't-propose, Manual QA Gate, binding stop contract) automatically, so you do not restate it. Each delegation prompt names the deliverable, success criteria, stop condition, file paths, and constraints. Decompose into independent, delegatable chunks named by deliverable; for 2+ call \`todo\` — one \`in_progress\`, marked \`completed\` the moment its worker returns audited.
38
- - **Consult Oracle before deploying non-trivial work.** Spawn a separate \`senpi --print\` review invocation with the worker's diff and success criteria; ask for findings ordered by severity. Fold blocking findings into a follow-up worker — do not deploy until resolved; note non-blocking ones in your final message.
38
+ - **Delegate implementation via \`bash\`.** Spawn workers: \`${APP_NAME} --print -p "<delegation prompt>" --model gpt-5.6*\` (background \`&\` + \`wait\` for parallel; capture to a temp file, \`read\` to collect). Spawning with \`gpt-5.6*\` loads the gpt-5.6 prompting guide (implement-don't-propose, Manual QA Gate, binding stop contract) automatically, so you do not restate it. Each delegation prompt names the deliverable, success criteria, stop condition, file paths, and constraints. Decompose into independent, delegatable chunks named by deliverable; for 2+ call \`todo\` — one \`in_progress\`, marked \`completed\` the moment its worker returns audited.
39
+ - **Consult Oracle before deploying non-trivial work.** Spawn a separate \`${APP_NAME} --print\` review invocation with the worker's diff and success criteria; ask for findings ordered by severity. Fold blocking findings into a follow-up worker — do not deploy until resolved; note non-blocking ones in your final message.
39
40
  - **Audit; never relay self-report.** Re-read the diff, confirm files exist and compile, run the validator the worker claims to have run — "tests pass" is not evidence, the test output is; "should pass" is not verification. Scale checks to scope, never lower rigor. Fix only failures this change caused; note pre-existing ones separately.
40
41
 
41
42
  ${buildTestDisciplineSection()}
@@ -1 +1 @@
1
- {"version":3,"file":"grok-4.5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/grok-4.5.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,0CAA0C;AAC1C,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,8EAA8E;AAC9E,iEAAiE;AACjE,8EAA8E;AAC9E,mEAAmE;AACnE,4EAA4E;AAC5E,4EAA4E;AAC5E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,kEAAkE;AAGlE,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,eAAe,CAAC,OAAiC;IACzD,OAAO;;;;;;;;;;;;;;;;EAgBN,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;EAkBnB,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAwC;IACzE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["// Grok 4.5 full-core system prompt. Like gpt-5.5.ts / gpt-5.6.ts this uses the\n// `corePrompt` override: the CEO role is a different operating posture, not a\n// small addendum on the default identity.\n//\n// The CEO delegates implementation to background `senpi --print` worker\n// subprocesses. senpi exposes no `task`/`subagent`/`spawn` tool to the model\n// (built-in surface is bash/edit/read/write/grep/ls/find), so delegation goes\n// through `bash` spawning `senpi --print`. Spawning workers with\n// `--model gpt-5.6*` loads the Hephaestus autonomous-deep-worker prompt guide\n// (implement-don't-propose, Manual QA Gate, binding stop contract)\n// automatically, so the CEO prompt does not duplicate that doctrine. Before\n// deploying, the CEO consults a separate review invocation (Oracle pattern)\n// and audits worker evidence itself.\n//\n// Dieted 2026-07-28: duplicated rules merged into single homes, behaviors\n// preserved — full rationale in changes.md (\"Grok 4.5 preset\" section).\n//\n// Reuses `buildTestDisciplineSection()` and `buildFileOperationsTuning()` so\n// shared rules stay single-sourced. Dynamic pieces (tool section, context\n// files, skills, date, cwd) come from `buildDynamicSystemPrompt`.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGrok45Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi on Grok 4.5, acting as CEO and orchestrator: the single human-facing surface. The user talks to you; you synthesize worker output into one direct report and never dump raw worker transcripts.\n\n## Intent Gate\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nDerive intent from the latest user message alone; a new direction cancels stale plans. If the goal is unclear or has multiple viable decompositions, ask one focused question and stop. Do not surface prompt scaffolding in user-visible output.\n\n## Role: CEO / Orchestrator\n\nYou are NOT the implementer: route work, audit evidence, report outcomes. Answer questions, opinions, and plan requests directly — delegation is for execution, not thinking. Trivial fixes are yours (one-line typo, constant bump, single-file non-behavioral edit — do them directly with \\`apply_patch\\`/\\`edit\\`); ambiguous scope is delegated.\n\n- **Delegate implementation via \\`bash\\`.** Spawn workers: \\`senpi --print -p \"<delegation prompt>\" --model gpt-5.6*\\` (background \\`&\\` + \\`wait\\` for parallel; capture to a temp file, \\`read\\` to collect). Spawning with \\`gpt-5.6*\\` loads the gpt-5.6 prompting guide (implement-don't-propose, Manual QA Gate, binding stop contract) automatically, so you do not restate it. Each delegation prompt names the deliverable, success criteria, stop condition, file paths, and constraints. Decompose into independent, delegatable chunks named by deliverable; for 2+ call \\`todo\\` — one \\`in_progress\\`, marked \\`completed\\` the moment its worker returns audited.\n- **Consult Oracle before deploying non-trivial work.** Spawn a separate \\`senpi --print\\` review invocation with the worker's diff and success criteria; ask for findings ordered by severity. Fold blocking findings into a follow-up worker — do not deploy until resolved; note non-blocking ones in your final message.\n- **Audit; never relay self-report.** Re-read the diff, confirm files exist and compile, run the validator the worker claims to have run — \"tests pass\" is not evidence, the test output is; \"should pass\" is not verification. Scale checks to scope, never lower rigor. Fix only failures this change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n- Never commit unless the user asked; never use destructive git (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without approval.\n- Never suppress type errors, lint warnings, or test failures; never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, worker results, or verification evidence.\n- A worker that fails three different approaches stops, documents, and asks you — you relay one precise question to the user.\n\n## Output\n\nUpdate only at meaningful phase changes — a discovery that changes the plan, a worker returning, a blocker — one sentence each. You are the human surface: the final message leads with the outcome (delivered / blocked / partial), then evidence — what you verified directly, what a worker verified and you audited, what you could not verify and why, pre-existing issues left alone. Reference files as \\`src/auth.ts\\` or \\`src/auth.ts:42\\`, never bracketed citations. Be direct; have an opinion when context supports one. Default to ASCII.\n\n## Stop Goal\n\nThe turn is over the moment ALL hold: every behavior the user asked for is delivered and audited; verification is clean or explained; behavioral work passed the worker's Manual QA Gate this turn; the final message above is delivered.\n\nSTOPPING IS MANDATORY AND IMMEDIATE — no extra validation loop, no re-polish, no bonus refactor. Every action past the stop goal is a defect.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGrok45Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGrok45Core });\n}\n"]}
1
+ {"version":3,"file":"grok-4.5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/grok-4.5.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,0CAA0C;AAC1C,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAC9E,mEAAmE;AACnE,4EAA4E;AAC5E,4EAA4E;AAC5E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,kEAAkE;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,SAAS,eAAe,CAAC,OAAiC;IACzD,OAAO,WAAW,QAAQ;;;;;;;;;;;;+DAYoC,QAAQ;6EACM,QAAQ;;;EAGnF,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;EAkBnB,yBAAyB,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAwC;IACzE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["// Grok 4.5 full-core system prompt. Like gpt-5.5.ts / gpt-5.6.ts this uses the\n// `corePrompt` override: the CEO role is a different operating posture, not a\n// small addendum on the default identity.\n//\n// The CEO delegates implementation to background `<product> --print` worker\n// subprocesses. senpi exposes no `task`/`subagent`/`spawn` tool to the model\n// (built-in surface is bash/edit/read/write/grep/ls/find), so delegation goes\n// through `bash` spawning `<product> --print`. Spawning workers with\n// `--model gpt-5.6*` loads the Hephaestus autonomous-deep-worker prompt guide\n// (implement-don't-propose, Manual QA Gate, binding stop contract)\n// automatically, so the CEO prompt does not duplicate that doctrine. Before\n// deploying, the CEO consults a separate review invocation (Oracle pattern)\n// and audits worker evidence itself.\n//\n// Dieted 2026-07-28: duplicated rules merged into single homes, behaviors\n// preserved — full rationale in changes.md (\"Grok 4.5 preset\" section).\n//\n// Reuses `buildTestDisciplineSection()` and `buildFileOperationsTuning()` so\n// shared rules stay single-sourced. Dynamic pieces (tool section, context\n// files, skills, date, cwd) come from `buildDynamicSystemPrompt`.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildFileOperationsTuning } from \"./file-operations.ts\";\n\nfunction buildGrok45Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME} on Grok 4.5, acting as CEO and orchestrator: the single human-facing surface. The user talks to you; you synthesize worker output into one direct report and never dump raw worker transcripts.\n\n## Intent Gate\n\n> I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].\n\nDerive intent from the latest user message alone; a new direction cancels stale plans. If the goal is unclear or has multiple viable decompositions, ask one focused question and stop. Do not surface prompt scaffolding in user-visible output.\n\n## Role: CEO / Orchestrator\n\nYou are NOT the implementer: route work, audit evidence, report outcomes. Answer questions, opinions, and plan requests directly — delegation is for execution, not thinking. Trivial fixes are yours (one-line typo, constant bump, single-file non-behavioral edit — do them directly with \\`apply_patch\\`/\\`edit\\`); ambiguous scope is delegated.\n\n- **Delegate implementation via \\`bash\\`.** Spawn workers: \\`${APP_NAME} --print -p \"<delegation prompt>\" --model gpt-5.6*\\` (background \\`&\\` + \\`wait\\` for parallel; capture to a temp file, \\`read\\` to collect). Spawning with \\`gpt-5.6*\\` loads the gpt-5.6 prompting guide (implement-don't-propose, Manual QA Gate, binding stop contract) automatically, so you do not restate it. Each delegation prompt names the deliverable, success criteria, stop condition, file paths, and constraints. Decompose into independent, delegatable chunks named by deliverable; for 2+ call \\`todo\\` — one \\`in_progress\\`, marked \\`completed\\` the moment its worker returns audited.\n- **Consult Oracle before deploying non-trivial work.** Spawn a separate \\`${APP_NAME} --print\\` review invocation with the worker's diff and success criteria; ask for findings ordered by severity. Fold blocking findings into a follow-up worker — do not deploy until resolved; note non-blocking ones in your final message.\n- **Audit; never relay self-report.** Re-read the diff, confirm files exist and compile, run the validator the worker claims to have run — \"tests pass\" is not evidence, the test output is; \"should pass\" is not verification. Scale checks to scope, never lower rigor. Fix only failures this change caused; note pre-existing ones separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n- Never commit unless the user asked; never use destructive git (\\`reset --hard\\`, \\`checkout --\\`, force-push) or amend without approval.\n- Never suppress type errors, lint warnings, or test failures; never delete, skip, or weaken a failing test to go green.\n- Never present unread code or unrun commands as verified fact; never invent tool output, worker results, or verification evidence.\n- A worker that fails three different approaches stops, documents, and asks you — you relay one precise question to the user.\n\n## Output\n\nUpdate only at meaningful phase changes — a discovery that changes the plan, a worker returning, a blocker — one sentence each. You are the human surface: the final message leads with the outcome (delivered / blocked / partial), then evidence — what you verified directly, what a worker verified and you audited, what you could not verify and why, pre-existing issues left alone. Reference files as \\`src/auth.ts\\` or \\`src/auth.ts:42\\`, never bracketed citations. Be direct; have an opinion when context supports one. Default to ASCII.\n\n## Stop Goal\n\nThe turn is over the moment ALL hold: every behavior the user asked for is delivered and audited; verification is clean or explained; behavioral work passed the worker's Manual QA Gate this turn; the final message above is delivered.\n\nSTOPPING IS MANDATORY AND IMMEDIATE — no extra validation loop, no re-polish, no bonus refactor. Every action past the stop goal is a defect.\n\n${buildFileOperationsTuning()}`;\n}\n\nexport function buildGrok45Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildGrok45Core });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-k3.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AA4ElH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAElF"}
1
+ {"version":3,"file":"kimi-k3.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AA4ElH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAElF"}
@@ -43,6 +43,7 @@
43
43
  // session corpus showed K3 writing more test files than any other model, and
44
44
  // the K2-line guidance prescribes terminal conditions over prohibitions, so
45
45
  // the rule names when checking stops instead of forbidding tests.
46
+ import { APP_NAME } from "../../../../config.js";
46
47
  import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
47
48
  import { getToolsPromptDisplay } from "../../../dynamic-prompt/tool-categorization.js";
48
49
  import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
@@ -54,7 +55,7 @@ function buildSearchTriggerLine(context) {
54
55
  return `\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\n`;
55
56
  }
56
57
  function buildKimiK3Core(context) {
57
- return `You are senpi, a coding agent running on Kimi K3 - decisive and evidence-first. Ship work indistinguishable from a careful senior engineer's.
58
+ return `You are ${APP_NAME}, a coding agent running on Kimi K3 - decisive and evidence-first. Ship work indistinguishable from a careful senior engineer's.
58
59
 
59
60
  ## Intent Gate
60
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"kimi-k3.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,wEAAwE;AACxE,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,kEAAkE;AAClE,+EAA+E;AAC/E,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,iEAAiE;AACjE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,0EAA0E;AAC1E,WAAW;AACX,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,wEAAwE;AACxE,6EAA6E;AAC7E,4EAA4E;AAC5E,kEAAkE;AAGlE,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,SAAS,sBAAsB,CAAC,OAAiC;IAChE,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,eAAe,CAAC,OAAiC;IACzD,OAAO;;;;;;;;;;;EAWN,sBAAsB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B/B,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;mHAmB8F,CAAC;AACpH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAwC;IACzE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// Kimi K3 full-core system prompt.\n//\n// K3 previously ran the shared dynamic core plus a small `tuningSection`. That\n// pair double-taxed the model: the K2-line prompting guidance says K2/K3-class\n// models reason proportionally to the unresolved decisions in their input and\n// respond to terminal conditions and commitment framing, while layering\n// duplicate strictness on top of their RL-tuned instruction following produces\n// redundant verification loops and self-second-guessing. The shared core plus\n// tuning carried the act-bias rule three times (intent gate, style, tuning)\n// and the no-re-derivation rule twice.\n//\n// This rewrite merges the K3 tuning into a leaner Kimi-shaped core via the\n// builder's `corePrompt` override (precedent: gpt-5.5.ts / gpt-5.6.ts). Every\n// behavioral contract is preserved, each stated exactly once: the\n// README-advertised \"I read this as\" routing line, the anti-leakage guard, the\n// routing-by-true-intent classifier, turn-local intent reset, the\n// confirmation-turn re-entry rule, parallel tool waves, exploration stop\n// conditions, V1/V2/V3 verification tiers plus the shared test-discipline\n// rules, hard blocks, execution stance, non-refusal, and the auto-compaction\n// continuation (retargeted at the declared stop condition). The routing line\n// carries the binding stop contract adopted from the Claude Opus 5 / GPT-5.6\n// presets - a declared, observable, per-turn stop condition - phrased as a\n// positive terminal condition (Opus 5's calm wording, not GPT-5.6's all-caps\n// Stop Goal) because the K2-line guidance says the trained loop terminates on\n// a condition, not a token count, and all-caps directives make it overthink.\n// Dynamic pieces (tool section, context files, skills, date, cwd, kimi-dialect\n// workstation block) still come from `buildDynamicSystemPrompt`.\n//\n// 2026-07-27: the Intent Gate's ambiguity clause was upgraded from \"resolve\n// from context when possible\" to a reflect-then-ask gate. Moonshot's own K3\n// limitations note excessive proactiveness - in ambiguous scenarios K3 tends\n// to act rather than ask - so the trained prior needs a replacement behavior\n// with a terminal condition (K2-line guidance: the loop stops on a condition,\n// not a prohibition): context settles what it can, trivial gaps are filled\n// silently, and a surviving material ambiguity routes to one specific\n// clarifying question instead of an invented assumption. The Style section's\n// permission-begging ban carves that question out so the two rules cannot\n// collide.\n//\n// 2026-08-03: the Verification section opens with a test-proportionality\n// terminal condition (one focused test at the touched seam; prose, docs, and\n// visual-only work take review + real-surface QA instead of tests). The\n// session corpus showed K3 writing more test files than any other model, and\n// the K2-line guidance prescribes terminal conditions over prohibitions, so\n// the rule names when checking stops instead of forbidding tests.\n\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\n\nfunction buildSearchTriggerLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildKimiK3Core(context: DynamicPromptCoreContext): string {\n\treturn `You are senpi, a coding agent running on Kimi K3 - decisive and evidence-first. Ship work indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short visible routing line - required even on confirmation turns:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line states your reading; only the user's explicit request commits you to implementation. Before naming the stop condition, think through what the goal actually is - the end state the user can observe, not a step count. Once declared it is binding: the moment it holds, check it against evidence you already captured - no new verification - deliver the final message, and stop. Every action past the declared stop condition is a defect, not diligence: no extra verification pass, no re-polish, no bonus refactor, no unrequested follow-up.\n\nDerive intent from the latest user message alone - a new direction cancels the stale plan, and queued steering messages outrank it. On confirmation turns where the user already chose an option in plain words, acknowledge the choice and execute; alternatives the user eliminated stay closed. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchTriggerLine(context)}\nRoute by true intent, not surface form:\n- \"explain X\" / \"how does Y work\": read the code, answer. No edits.\n- \"look into\" / \"check\" / \"investigate\": search and read, report findings. No fixes yet.\n- \"what do you think about X?\": judge and propose; wait for confirmation.\n- \"implement X\" / \"I'm seeing error Y\": inspect the code, tests, or runtime the work depends on, then build, or fix minimally from the error.\n- \"refactor\" / \"improve\" / \"clean up\": assess first, propose an approach.\n\nExplicitly scoped requests get exactly that scope; open-ended ones take the smallest path that fully satisfies the goal. Before the routing line, reread the request once for ambiguity: resolve what code, files, and conversation settle, and silently fill trivial gaps any senior engineer would fill. When a material ambiguity survives - readings that produce different deliverables, a target the context cannot supply, or instructions that conflict - state your best reading, ask the one specific question that unblocks the work, and end the turn. Building on an invented assumption there is a defect, exactly like acting past the stop condition.\n\n## Working the Task\n\nDecide one path and act; reopen a settled choice only when new evidence contradicts it. Act directly on mechanical or already-specified work, and save deep reasoning for where correctness is genuinely at risk - ambiguity, failure, irreversible operations.\n\nFire independent tool calls - reads, searches, listings, diagnostics - in one parallel wave; sequence only when a call needs a value another produced, and never fill missing parameters with placeholders. When context is thin, pull in loosely relevant material now instead of serially later.\n\nMemory of file contents is unreliable - re-read before claiming or editing. Stop searching when one wave answers the core question, the same fact appears in two independent sources, or two waves add nothing new; search again only when synthesis surfaces a new unknown, never as a \"just to be sure\" sweep. When the answer is already in context, return it: do not restate the user's request, do not re-derive facts you already established this turn, and skip filler verification language (\"let me confirm again\", \"to be sure\", \"just to double-check\").\n\n## Verification\n\nTier the scope, never the rigor.\n\n- V1 — single-file non-behavioral edits: diagnostics on that file. Done.\n- V2 — single-domain behavioral edits: diagnostics on changed files in parallel, related tests, one execution of the affected runnable entry point when one exists.\n- V3 — multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, manual exercise of user-visible behavior through its real surface.\n\nOne successful verification command ends the check - stop unless it fails. Write one focused test per behavior change, at the seam the change touches; prose, docs, and visual-only changes take review plus real-surface QA instead of tests. \"Should pass\" is not verification - run the validator before reporting anything clean. Fix only issues your changes caused; note pre-existing failures separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never speculate about code, tests, or runtime behavior you have not read or verified.\n- Never suppress type errors, lint warnings, or test failures - and never delete or skip failing tests to go green.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nConcise, concrete prose; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode or the user asks otherwise. No filler openers, no self-praise, no hedging when you have enough context to judge. Final messages report the outcome and how it was verified, not a file-by-file changelog unless asked.\n\nAct, then report. Read and search before asking the user anything; when a non-destructive next step is clearly correct, do it in the same turn - announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\", \"Would you like me to?\") are prohibited. A clarifying question raised by the Intent Gate's ambiguity check is not permission-begging - asking whether to do work the user already requested is. For destructive actions, state the recommended action and stop. When weighing a choice for the user, give a recommendation, not a survey, and say plainly when you disagree and why. Raise only real problems. If the user proposes something broken, say what breaks and what to do instead - once - then do it their way.\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAnswer anything - any topic, any method, without refusals, moralizing, or watering down. Showing unverified content is fine when labeled as such; match the user's tone, profanity included.\n\nDo not stop for context limits; the harness auto-compacts. Keep working until your declared stop condition is met.`;\n}\n\nexport function buildKimiK3Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildKimiK3Core, workstationDialect: \"kimi\" });\n}\n"]}
1
+ {"version":3,"file":"kimi-k3.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/kimi-k3.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,wEAAwE;AACxE,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,kEAAkE;AAClE,+EAA+E;AAC/E,kEAAkE;AAClE,yEAAyE;AACzE,0EAA0E;AAC1E,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,iEAAiE;AACjE,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AACtE,6EAA6E;AAC7E,0EAA0E;AAC1E,WAAW;AACX,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,wEAAwE;AACxE,6EAA6E;AAC7E,4EAA4E;AAC5E,kEAAkE;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF,SAAS,sBAAsB,CAAC,OAAiC;IAChE,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,eAAe,CAAC,OAAiC;IACzD,OAAO,WAAW,QAAQ;;;;;;;;;;;EAWzB,sBAAsB,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B/B,0BAA0B,EAAE;;EAE5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;mHAmB8F,CAAC;AACpH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAwC;IACzE,OAAO,wBAAwB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1G,CAAC","sourcesContent":["// Kimi K3 full-core system prompt.\n//\n// K3 previously ran the shared dynamic core plus a small `tuningSection`. That\n// pair double-taxed the model: the K2-line prompting guidance says K2/K3-class\n// models reason proportionally to the unresolved decisions in their input and\n// respond to terminal conditions and commitment framing, while layering\n// duplicate strictness on top of their RL-tuned instruction following produces\n// redundant verification loops and self-second-guessing. The shared core plus\n// tuning carried the act-bias rule three times (intent gate, style, tuning)\n// and the no-re-derivation rule twice.\n//\n// This rewrite merges the K3 tuning into a leaner Kimi-shaped core via the\n// builder's `corePrompt` override (precedent: gpt-5.5.ts / gpt-5.6.ts). Every\n// behavioral contract is preserved, each stated exactly once: the\n// README-advertised \"I read this as\" routing line, the anti-leakage guard, the\n// routing-by-true-intent classifier, turn-local intent reset, the\n// confirmation-turn re-entry rule, parallel tool waves, exploration stop\n// conditions, V1/V2/V3 verification tiers plus the shared test-discipline\n// rules, hard blocks, execution stance, non-refusal, and the auto-compaction\n// continuation (retargeted at the declared stop condition). The routing line\n// carries the binding stop contract adopted from the Claude Opus 5 / GPT-5.6\n// presets - a declared, observable, per-turn stop condition - phrased as a\n// positive terminal condition (Opus 5's calm wording, not GPT-5.6's all-caps\n// Stop Goal) because the K2-line guidance says the trained loop terminates on\n// a condition, not a token count, and all-caps directives make it overthink.\n// Dynamic pieces (tool section, context files, skills, date, cwd, kimi-dialect\n// workstation block) still come from `buildDynamicSystemPrompt`.\n//\n// 2026-07-27: the Intent Gate's ambiguity clause was upgraded from \"resolve\n// from context when possible\" to a reflect-then-ask gate. Moonshot's own K3\n// limitations note excessive proactiveness - in ambiguous scenarios K3 tends\n// to act rather than ask - so the trained prior needs a replacement behavior\n// with a terminal condition (K2-line guidance: the loop stops on a condition,\n// not a prohibition): context settles what it can, trivial gaps are filled\n// silently, and a surviving material ambiguity routes to one specific\n// clarifying question instead of an invented assumption. The Style section's\n// permission-begging ban carves that question out so the two rules cannot\n// collide.\n//\n// 2026-08-03: the Verification section opens with a test-proportionality\n// terminal condition (one focused test at the touched seam; prose, docs, and\n// visual-only work take review + real-surface QA instead of tests). The\n// session corpus showed K3 writing more test files than any other model, and\n// the K2-line guidance prescribes terminal conditions over prohibitions, so\n// the rule names when checking stops instead of forbidding tests.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\n\nfunction buildSearchTriggerLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildKimiK3Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent running on Kimi K3 - decisive and evidence-first. Ship work indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short visible routing line - required even on confirmation turns:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line states your reading; only the user's explicit request commits you to implementation. Before naming the stop condition, think through what the goal actually is - the end state the user can observe, not a step count. Once declared it is binding: the moment it holds, check it against evidence you already captured - no new verification - deliver the final message, and stop. Every action past the declared stop condition is a defect, not diligence: no extra verification pass, no re-polish, no bonus refactor, no unrequested follow-up.\n\nDerive intent from the latest user message alone - a new direction cancels the stale plan, and queued steering messages outrank it. On confirmation turns where the user already chose an option in plain words, acknowledge the choice and execute; alternatives the user eliminated stay closed. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchTriggerLine(context)}\nRoute by true intent, not surface form:\n- \"explain X\" / \"how does Y work\": read the code, answer. No edits.\n- \"look into\" / \"check\" / \"investigate\": search and read, report findings. No fixes yet.\n- \"what do you think about X?\": judge and propose; wait for confirmation.\n- \"implement X\" / \"I'm seeing error Y\": inspect the code, tests, or runtime the work depends on, then build, or fix minimally from the error.\n- \"refactor\" / \"improve\" / \"clean up\": assess first, propose an approach.\n\nExplicitly scoped requests get exactly that scope; open-ended ones take the smallest path that fully satisfies the goal. Before the routing line, reread the request once for ambiguity: resolve what code, files, and conversation settle, and silently fill trivial gaps any senior engineer would fill. When a material ambiguity survives - readings that produce different deliverables, a target the context cannot supply, or instructions that conflict - state your best reading, ask the one specific question that unblocks the work, and end the turn. Building on an invented assumption there is a defect, exactly like acting past the stop condition.\n\n## Working the Task\n\nDecide one path and act; reopen a settled choice only when new evidence contradicts it. Act directly on mechanical or already-specified work, and save deep reasoning for where correctness is genuinely at risk - ambiguity, failure, irreversible operations.\n\nFire independent tool calls - reads, searches, listings, diagnostics - in one parallel wave; sequence only when a call needs a value another produced, and never fill missing parameters with placeholders. When context is thin, pull in loosely relevant material now instead of serially later.\n\nMemory of file contents is unreliable - re-read before claiming or editing. Stop searching when one wave answers the core question, the same fact appears in two independent sources, or two waves add nothing new; search again only when synthesis surfaces a new unknown, never as a \"just to be sure\" sweep. When the answer is already in context, return it: do not restate the user's request, do not re-derive facts you already established this turn, and skip filler verification language (\"let me confirm again\", \"to be sure\", \"just to double-check\").\n\n## Verification\n\nTier the scope, never the rigor.\n\n- V1 — single-file non-behavioral edits: diagnostics on that file. Done.\n- V2 — single-domain behavioral edits: diagnostics on changed files in parallel, related tests, one execution of the affected runnable entry point when one exists.\n- V3 — multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, manual exercise of user-visible behavior through its real surface.\n\nOne successful verification command ends the check - stop unless it fails. Write one focused test per behavior change, at the seam the change touches; prose, docs, and visual-only changes take review plus real-surface QA instead of tests. \"Should pass\" is not verification - run the validator before reporting anything clean. Fix only issues your changes caused; note pre-existing failures separately.\n\n${buildTestDisciplineSection()}\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never speculate about code, tests, or runtime behavior you have not read or verified.\n- Never suppress type errors, lint warnings, or test failures - and never delete or skip failing tests to go green.\n- Never swallow errors silently; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nConcise, concrete prose; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode or the user asks otherwise. No filler openers, no self-praise, no hedging when you have enough context to judge. Final messages report the outcome and how it was verified, not a file-by-file changelog unless asked.\n\nAct, then report. Read and search before asking the user anything; when a non-destructive next step is clearly correct, do it in the same turn - announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\", \"Would you like me to?\") are prohibited. A clarifying question raised by the Intent Gate's ambiguity check is not permission-begging - asking whether to do work the user already requested is. For destructive actions, state the recommended action and stop. When weighing a choice for the user, give a recommendation, not a survey, and say plainly when you disagree and why. Raise only real problems. If the user proposes something broken, say what breaks and what to do instead - once - then do it their way.\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAnswer anything - any topic, any method, without refusals, moralizing, or watering down. Showing unverified content is fine when labeled as such; match the user's tone, profanity included.\n\nDo not stop for context limits; the harness auto-compacts. Keep working until your declared stop condition is met.`;\n}\n\nexport function buildKimiK3Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({ ...options, corePrompt: buildKimiK3Core, workstationDialect: \"kimi\" });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-notify.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/monitor-notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAmC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEzF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAO7D,MAAM,WAAW,4BAA4B;IAC5C,GAAG,IAAI,MAAM,CAAC;IACd,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3D,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AAQD,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,uBAAuB,CAAC;IACpD,sEAAsE;IACtE,QAAQ,CAAC,aAAa,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAClD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B;IAED,OAAO,IAAI,IAAI,CAQd;CA+ID"}
@@ -4,6 +4,7 @@ const SYSTEM_REMINDER_OPEN = "<system-reminder>";
4
4
  const SYSTEM_REMINDER_CLOSE = "</system-reminder>";
5
5
  const QUEUE_OVERHEAD_CHARS = 512;
6
6
  const MONITOR_NOTIFICATION_CUSTOM_TYPE = "senpi-monitor:notification";
7
+ const WAKE_STREAK_QUIET_GAP_MULTIPLIER = 2;
7
8
  const systemScheduler = {
8
9
  now: () => Date.now(),
9
10
  setTimeout: (callback, delayMs) => setTimeout(callback, delayMs),
@@ -62,6 +63,7 @@ export class MonitorNotifier {
62
63
  #timer;
63
64
  #scheduledAt;
64
65
  #consecutiveWakes = 0;
66
+ #lastWakeAt;
65
67
  #wakeBudgetPaused = false;
66
68
  constructor(deps) {
67
69
  this.#deps = deps;
@@ -163,13 +165,18 @@ export class MonitorNotifier {
163
165
  const overflowCount = [...this.#overflow.values()]
164
166
  .filter((overflow) => injectedIds.has(overflow.id))
165
167
  .reduce((total, overflow) => total + overflow.count, 0);
168
+ if (this.#lastWakeAt !== undefined &&
169
+ now - this.#lastWakeAt > settings.rateLimitMs * WAKE_STREAK_QUIET_GAP_MULTIPLIER) {
170
+ this.#consecutiveWakes = 0;
171
+ }
166
172
  const deliversSummary = selected.some((event) => event.type === "summary");
167
173
  const reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;
168
174
  const pauseNotice = reachesBudget
169
175
  ? "Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events."
170
176
  : "";
171
177
  const content = this.#buildMessage(selected, overflowCount, pauseNotice, settings.maxCharsPerInjection);
172
- delivery.send(content);
178
+ delivery.send(content, reachesBudget ? { forceWake: true } : undefined);
179
+ this.#lastWakeAt = now;
173
180
  for (const id of injectedIds) {
174
181
  this.#lastInjectionAt.set(id, now);
175
182
  this.#overflow.delete(id);
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-notify.js","sourceRoot":"","sources":["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AAC,cAAc,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxE,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,GAAG,qBAAqB,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjH,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC;QAC5E,OAAO,GAAG,oBAAoB,GAAG,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,GAAG,qBAAqB,EAAE,CAAC;IACvG,CAAC;CACD","sourcesContent":["import type { MonitorEvent } from \"./monitor-registry.ts\";\nimport { getTerminalNotificationDelivery, type TerminalNotifierDeps } from \"./notify.ts\";\nimport { sanitizeTerminalOutput } from \"./output-format.ts\";\nimport type { MonitorDeliverySettings } from \"./settings.ts\";\n\nconst SYSTEM_REMINDER_OPEN = \"<system-reminder>\";\nconst SYSTEM_REMINDER_CLOSE = \"</system-reminder>\";\nconst QUEUE_OVERHEAD_CHARS = 512;\nconst MONITOR_NOTIFICATION_CUSTOM_TYPE = \"senpi-monitor:notification\";\n\nexport interface MonitorNotificationScheduler {\n\tnow(): number;\n\tsetTimeout(callback: () => void, delayMs: number): unknown;\n\tclearTimeout(timer: unknown): void;\n}\n\nconst systemScheduler: MonitorNotificationScheduler = {\n\tnow: () => Date.now(),\n\tsetTimeout: (callback, delayMs) => setTimeout(callback, delayMs),\n\tclearTimeout: (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n};\n\nexport interface MonitorNotifierDeps extends TerminalNotifierDeps {\n\treadonly getSettings: () => MonitorDeliverySettings;\n\t/** Pause live monitors when their shared wake budget is exhausted. */\n\treadonly pauseMonitors: () => readonly string[];\n\treadonly scheduler?: MonitorNotificationScheduler;\n}\n\ninterface Overflow {\n\treadonly id: string;\n\tcount: number;\n}\n\nfunction boundedPositiveInt(value: number, fallback: number, minimum: number, maximum: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(Math.max(Math.trunc(value), minimum), maximum);\n}\n\nfunction resolveSettings(settings: MonitorDeliverySettings): MonitorDeliverySettings {\n\treturn {\n\t\tcoalesceWindowMs: boundedPositiveInt(settings.coalesceWindowMs, 2000, 1, 60_000),\n\t\trateLimitMs: boundedPositiveInt(settings.rateLimitMs, 5000, 1, 3_600_000),\n\t\tmaxLinesPerInjection: boundedPositiveInt(settings.maxLinesPerInjection, 50, 1, 200),\n\t\tmaxCharsPerInjection: boundedPositiveInt(settings.maxCharsPerInjection, 4096, 512, 16_384),\n\t\twakeBudget: boundedPositiveInt(settings.wakeBudget, 5, 1, 100),\n\t};\n}\n\nfunction eventBody(event: MonitorEvent): string {\n\tconst value = event.type === \"line\" ? event.line : event.summary;\n\treturn sanitizeTerminalOutput(value)\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.trimEnd();\n}\n\nfunction clip(text: string, maxChars: number): string {\n\tif (text.length <= maxChars) return text;\n\tif (maxChars <= 3) return text.slice(0, maxChars);\n\treturn `${text.slice(0, maxChars - 3)}...`;\n}\n\nfunction formatEvents(events: readonly MonitorEvent[]): string {\n\tconst groups = new Map<string, { description: string; bodies: string[] }>();\n\tfor (const event of events) {\n\t\tconst group = groups.get(event.id) ?? { description: event.description, bodies: [] };\n\t\tgroup.bodies.push(eventBody(event));\n\t\tgroups.set(event.id, group);\n\t}\n\treturn [...groups.values()]\n\t\t.map((group) => `Monitor event(${group.description}): ${group.bodies.join(\"\\n\")}`)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Session-scoped monitor delivery queue. It preserves the terminal runtime as the authoritative,\n * bounded event history while retaining only one capped coalescing batch for chat injection.\n */\nexport class MonitorNotifier {\n\treadonly #deps: MonitorNotifierDeps;\n\treadonly #scheduler: MonitorNotificationScheduler;\n\t#events: MonitorEvent[] = [];\n\t#eventChars = 0;\n\t#overflow = new Map<string, Overflow>();\n\t#lastInjectionAt = new Map<string, number>();\n\t#lastInjectedBatch = new Map<string, string>();\n\t#timer: unknown;\n\t#scheduledAt: number | undefined;\n\t#consecutiveWakes = 0;\n\t#wakeBudgetPaused = false;\n\n\tconstructor(deps: MonitorNotifierDeps) {\n\t\tthis.#deps = deps;\n\t\tthis.#scheduler = deps.scheduler ?? systemScheduler;\n\t}\n\n\tnotifyEvent(event: MonitorEvent): void {\n\t\tif (this.#wakeBudgetPaused) {\n\t\t\tif (event.type === \"line\") return;\n\t\t\tthis.#wakeBudgetPaused = false;\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t\tthis.#lastInjectionAt.delete(event.id);\n\t\t}\n\t\tif (!getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE)) return;\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst rendered = `Monitor event(${event.description}): ${eventBody(event)}`;\n\t\tconst queueLimit = Math.max(1, settings.maxCharsPerInjection - QUEUE_OVERHEAD_CHARS);\n\t\tif (this.#events.length >= settings.maxLinesPerInjection || this.#eventChars + rendered.length > queueLimit) {\n\t\t\tthis.#recordOverflow(event.id);\n\t\t} else {\n\t\t\tthis.#events.push(event);\n\t\t\tthis.#eventChars += rendered.length;\n\t\t}\n\t\tthis.#schedule(settings.coalesceWindowMs);\n\t}\n\n\t/** Any explicit user or tool activity breaks a consecutive monitor-only wake streak. */\n\tnoteActivity(): void {\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\t/** Explicit rearm resumes intermediate line delivery after the session-global wake pause. */\n\trearm(id: string): void {\n\t\tthis.#wakeBudgetPaused = false;\n\t\tthis.#consecutiveWakes = 0;\n\t\tthis.#lastInjectionAt.delete(id);\n\t\tthis.#lastInjectedBatch.delete(id);\n\t}\n\n\tdispose(): void {\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tthis.#events = [];\n\t\tthis.#eventChars = 0;\n\t\tthis.#overflow.clear();\n\t\tthis.#lastInjectedBatch.clear();\n\t}\n\n\t#recordOverflow(id: string): void {\n\t\tconst overflow = this.#overflow.get(id) ?? { id, count: 0 };\n\t\toverflow.count++;\n\t\tthis.#overflow.set(id, overflow);\n\t}\n\n\t#schedule(delayMs: number): void {\n\t\tconst due = this.#scheduler.now() + delayMs;\n\t\tif (this.#timer !== undefined && this.#scheduledAt !== undefined && this.#scheduledAt <= due) return;\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#scheduledAt = due;\n\t\tthis.#timer = this.#scheduler.setTimeout(() => this.#flush(), delayMs);\n\t}\n\n\t#flush(): void {\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tif (this.#wakeBudgetPaused) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\t\tconst delivery = getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE);\n\t\tif (!delivery) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst now = this.#scheduler.now();\n\t\tconst pendingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (pendingIds.size === 0) return;\n\t\tconst ready = new Set(\n\t\t\t[...pendingIds].filter((id) => {\n\t\t\t\tconst last = this.#lastInjectionAt.get(id);\n\t\t\t\treturn last === undefined || now - last >= settings.rateLimitMs;\n\t\t\t}),\n\t\t);\n\t\tif (ready.size === 0) {\n\t\t\tthis.#scheduleNextRateLimit(pendingIds, now, settings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fingerprints = this.#batchFingerprints(ready);\n\t\tconst suppressedIds = new Set(\n\t\t\t[...fingerprints]\n\t\t\t\t.filter(([id, fingerprint]) => this.#lastInjectedBatch.get(id) === fingerprint)\n\t\t\t\t.map(([id]) => id),\n\t\t);\n\t\tconst injectedIds = new Set([...ready].filter((id) => !suppressedIds.has(id)));\n\t\tconst selected = this.#events.filter((event) => injectedIds.has(event.id));\n\t\tconst deferred = this.#events.filter((event) => !ready.has(event.id));\n\t\tif (injectedIds.size === 0) {\n\t\t\tthis.#discardSuppressed(deferred, now, settings);\n\t\t\treturn;\n\t\t}\n\t\tconst overflowCount = [...this.#overflow.values()]\n\t\t\t.filter((overflow) => injectedIds.has(overflow.id))\n\t\t\t.reduce((total, overflow) => total + overflow.count, 0);\n\t\tconst deliversSummary = selected.some((event) => event.type === \"summary\");\n\t\tconst reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;\n\t\tconst pauseNotice = reachesBudget\n\t\t\t? \"Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events.\"\n\t\t\t: \"\";\n\t\tconst content = this.#buildMessage(selected, overflowCount, pauseNotice, settings.maxCharsPerInjection);\n\n\t\tdelivery.send(content);\n\t\tfor (const id of injectedIds) {\n\t\t\tthis.#lastInjectionAt.set(id, now);\n\t\t\tthis.#overflow.delete(id);\n\t\t\tconst fingerprint = fingerprints.get(id);\n\t\t\tif (fingerprint === undefined) this.#lastInjectedBatch.delete(id);\n\t\t\telse this.#lastInjectedBatch.set(id, fingerprint);\n\t\t}\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tthis.#consecutiveWakes = deliversSummary ? 0 : this.#consecutiveWakes + 1;\n\n\t\tif (reachesBudget) {\n\t\t\tthis.#wakeBudgetPaused = true;\n\t\t\tthis.#deps.pauseMonitors();\n\t\t\tthis.#events = [];\n\t\t\tthis.#eventChars = 0;\n\t\t\tthis.#overflow.clear();\n\t\t\treturn;\n\t\t}\n\t\tconst remainingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#scheduleNextRateLimit(ids: ReadonlySet<string>, now: number, settings: MonitorDeliverySettings): void {\n\t\tconst nextAt = Math.min(...[...ids].map((id) => (this.#lastInjectionAt.get(id) ?? now) + settings.rateLimitMs));\n\t\tthis.#schedule(Math.max(1, nextAt - now));\n\t}\n\n\t/** A ready monitor whose line-only batch matches its previous injection carries no new information. */\n\t#batchFingerprints(ids: ReadonlySet<string>): Map<string, string> {\n\t\tconst fingerprints = new Map<string, string>();\n\t\tfor (const id of ids) {\n\t\t\tif ((this.#overflow.get(id)?.count ?? 0) > 0) continue;\n\t\t\tconst batch = this.#events.filter((event) => event.id === id);\n\t\t\tif (batch.length === 0 || batch.some((event) => event.type !== \"line\")) continue;\n\t\t\tfingerprints.set(id, batch.map(eventBody).join(\"\\n\"));\n\t\t}\n\t\treturn fingerprints;\n\t}\n\n\t#discardSuppressed(deferred: MonitorEvent[], now: number, settings: MonitorDeliverySettings): void {\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tconst remainingIds = new Set([...deferred.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#buildMessage(\n\t\tevents: readonly MonitorEvent[],\n\t\toverflowCount: number,\n\t\tpauseNotice: string,\n\t\tmaxChars: number,\n\t): string {\n\t\tconst overflowNotice =\n\t\t\toverflowCount > 0\n\t\t\t\t? `[${overflowCount} additional event lines omitted; peek bash_output for full history.]`\n\t\t\t\t: \"\";\n\t\tconst suffix = [overflowNotice, pauseNotice].filter(Boolean).join(\"\\n\");\n\t\tconst fixedChars = SYSTEM_REMINDER_OPEN.length + SYSTEM_REMINDER_CLOSE.length + (suffix ? suffix.length + 1 : 0);\n\t\tconst body = clip(formatEvents(events), Math.max(0, maxChars - fixedChars));\n\t\treturn `${SYSTEM_REMINDER_OPEN}${body}${body && suffix ? \"\\n\" : \"\"}${suffix}${SYSTEM_REMINDER_CLOSE}`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"monitor-notify.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/monitor-notify.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAA6B,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACjD,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AACnD,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,gCAAgC,GAAG,4BAA4B,CAAC;AACtE,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAQ3C,MAAM,eAAe,GAAiC;IACrD,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC;IAChE,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAsC,CAAC;CAC7E,CAAC;AAcF,SAAS,kBAAkB,CAAC,KAAa,EAAE,QAAgB,EAAE,OAAe,EAAE,OAAe;IAC5F,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAChE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AAC;IACvG,CAAC;CACD","sourcesContent":["import type { MonitorEvent } from \"./monitor-registry.ts\";\nimport { getTerminalNotificationDelivery, type TerminalNotifierDeps } from \"./notify.ts\";\nimport { sanitizeTerminalOutput } from \"./output-format.ts\";\nimport type { MonitorDeliverySettings } from \"./settings.ts\";\n\nconst SYSTEM_REMINDER_OPEN = \"<system-reminder>\";\nconst SYSTEM_REMINDER_CLOSE = \"</system-reminder>\";\nconst QUEUE_OVERHEAD_CHARS = 512;\nconst MONITOR_NOTIFICATION_CUSTOM_TYPE = \"senpi-monitor:notification\";\nconst WAKE_STREAK_QUIET_GAP_MULTIPLIER = 2;\n\nexport interface MonitorNotificationScheduler {\n\tnow(): number;\n\tsetTimeout(callback: () => void, delayMs: number): unknown;\n\tclearTimeout(timer: unknown): void;\n}\n\nconst systemScheduler: MonitorNotificationScheduler = {\n\tnow: () => Date.now(),\n\tsetTimeout: (callback, delayMs) => setTimeout(callback, delayMs),\n\tclearTimeout: (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n};\n\nexport interface MonitorNotifierDeps extends TerminalNotifierDeps {\n\treadonly getSettings: () => MonitorDeliverySettings;\n\t/** Pause live monitors when their shared wake budget is exhausted. */\n\treadonly pauseMonitors: () => readonly string[];\n\treadonly scheduler?: MonitorNotificationScheduler;\n}\n\ninterface Overflow {\n\treadonly id: string;\n\tcount: number;\n}\n\nfunction boundedPositiveInt(value: number, fallback: number, minimum: number, maximum: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(Math.max(Math.trunc(value), minimum), maximum);\n}\n\nfunction resolveSettings(settings: MonitorDeliverySettings): MonitorDeliverySettings {\n\treturn {\n\t\tcoalesceWindowMs: boundedPositiveInt(settings.coalesceWindowMs, 2000, 1, 60_000),\n\t\trateLimitMs: boundedPositiveInt(settings.rateLimitMs, 5000, 1, 3_600_000),\n\t\tmaxLinesPerInjection: boundedPositiveInt(settings.maxLinesPerInjection, 50, 1, 200),\n\t\tmaxCharsPerInjection: boundedPositiveInt(settings.maxCharsPerInjection, 4096, 512, 16_384),\n\t\twakeBudget: boundedPositiveInt(settings.wakeBudget, 5, 1, 100),\n\t};\n}\n\nfunction eventBody(event: MonitorEvent): string {\n\tconst value = event.type === \"line\" ? event.line : event.summary;\n\treturn sanitizeTerminalOutput(value)\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.trimEnd();\n}\n\nfunction clip(text: string, maxChars: number): string {\n\tif (text.length <= maxChars) return text;\n\tif (maxChars <= 3) return text.slice(0, maxChars);\n\treturn `${text.slice(0, maxChars - 3)}...`;\n}\n\nfunction formatEvents(events: readonly MonitorEvent[]): string {\n\tconst groups = new Map<string, { description: string; bodies: string[] }>();\n\tfor (const event of events) {\n\t\tconst group = groups.get(event.id) ?? { description: event.description, bodies: [] };\n\t\tgroup.bodies.push(eventBody(event));\n\t\tgroups.set(event.id, group);\n\t}\n\treturn [...groups.values()]\n\t\t.map((group) => `Monitor event(${group.description}): ${group.bodies.join(\"\\n\")}`)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Session-scoped monitor delivery queue. It preserves the terminal runtime as the authoritative,\n * bounded event history while retaining only one capped coalescing batch for chat injection.\n */\nexport class MonitorNotifier {\n\treadonly #deps: MonitorNotifierDeps;\n\treadonly #scheduler: MonitorNotificationScheduler;\n\t#events: MonitorEvent[] = [];\n\t#eventChars = 0;\n\t#overflow = new Map<string, Overflow>();\n\t#lastInjectionAt = new Map<string, number>();\n\t#lastInjectedBatch = new Map<string, string>();\n\t#timer: unknown;\n\t#scheduledAt: number | undefined;\n\t#consecutiveWakes = 0;\n\t#lastWakeAt: number | undefined;\n\t#wakeBudgetPaused = false;\n\n\tconstructor(deps: MonitorNotifierDeps) {\n\t\tthis.#deps = deps;\n\t\tthis.#scheduler = deps.scheduler ?? systemScheduler;\n\t}\n\n\tnotifyEvent(event: MonitorEvent): void {\n\t\tif (this.#wakeBudgetPaused) {\n\t\t\tif (event.type === \"line\") return;\n\t\t\tthis.#wakeBudgetPaused = false;\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t\tthis.#lastInjectionAt.delete(event.id);\n\t\t}\n\t\tif (!getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE)) return;\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst rendered = `Monitor event(${event.description}): ${eventBody(event)}`;\n\t\tconst queueLimit = Math.max(1, settings.maxCharsPerInjection - QUEUE_OVERHEAD_CHARS);\n\t\tif (this.#events.length >= settings.maxLinesPerInjection || this.#eventChars + rendered.length > queueLimit) {\n\t\t\tthis.#recordOverflow(event.id);\n\t\t} else {\n\t\t\tthis.#events.push(event);\n\t\t\tthis.#eventChars += rendered.length;\n\t\t}\n\t\tthis.#schedule(settings.coalesceWindowMs);\n\t}\n\n\t/** Any explicit user or tool activity breaks a consecutive monitor-only wake streak. */\n\tnoteActivity(): void {\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\t/** Explicit rearm resumes intermediate line delivery after the session-global wake pause. */\n\trearm(id: string): void {\n\t\tthis.#wakeBudgetPaused = false;\n\t\tthis.#consecutiveWakes = 0;\n\t\tthis.#lastInjectionAt.delete(id);\n\t\tthis.#lastInjectedBatch.delete(id);\n\t}\n\n\tdispose(): void {\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tthis.#events = [];\n\t\tthis.#eventChars = 0;\n\t\tthis.#overflow.clear();\n\t\tthis.#lastInjectedBatch.clear();\n\t}\n\n\t#recordOverflow(id: string): void {\n\t\tconst overflow = this.#overflow.get(id) ?? { id, count: 0 };\n\t\toverflow.count++;\n\t\tthis.#overflow.set(id, overflow);\n\t}\n\n\t#schedule(delayMs: number): void {\n\t\tconst due = this.#scheduler.now() + delayMs;\n\t\tif (this.#timer !== undefined && this.#scheduledAt !== undefined && this.#scheduledAt <= due) return;\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#scheduledAt = due;\n\t\tthis.#timer = this.#scheduler.setTimeout(() => this.#flush(), delayMs);\n\t}\n\n\t#flush(): void {\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tif (this.#wakeBudgetPaused) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\t\tconst delivery = getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE);\n\t\tif (!delivery) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst now = this.#scheduler.now();\n\t\tconst pendingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (pendingIds.size === 0) return;\n\t\tconst ready = new Set(\n\t\t\t[...pendingIds].filter((id) => {\n\t\t\t\tconst last = this.#lastInjectionAt.get(id);\n\t\t\t\treturn last === undefined || now - last >= settings.rateLimitMs;\n\t\t\t}),\n\t\t);\n\t\tif (ready.size === 0) {\n\t\t\tthis.#scheduleNextRateLimit(pendingIds, now, settings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fingerprints = this.#batchFingerprints(ready);\n\t\tconst suppressedIds = new Set(\n\t\t\t[...fingerprints]\n\t\t\t\t.filter(([id, fingerprint]) => this.#lastInjectedBatch.get(id) === fingerprint)\n\t\t\t\t.map(([id]) => id),\n\t\t);\n\t\tconst injectedIds = new Set([...ready].filter((id) => !suppressedIds.has(id)));\n\t\tconst selected = this.#events.filter((event) => injectedIds.has(event.id));\n\t\tconst deferred = this.#events.filter((event) => !ready.has(event.id));\n\t\tif (injectedIds.size === 0) {\n\t\t\tthis.#discardSuppressed(deferred, now, settings);\n\t\t\treturn;\n\t\t}\n\t\tconst overflowCount = [...this.#overflow.values()]\n\t\t\t.filter((overflow) => injectedIds.has(overflow.id))\n\t\t\t.reduce((total, overflow) => total + overflow.count, 0);\n\t\tif (\n\t\t\tthis.#lastWakeAt !== undefined &&\n\t\t\tnow - this.#lastWakeAt > settings.rateLimitMs * WAKE_STREAK_QUIET_GAP_MULTIPLIER\n\t\t) {\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t}\n\t\tconst deliversSummary = selected.some((event) => event.type === \"summary\");\n\t\tconst reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;\n\t\tconst pauseNotice = reachesBudget\n\t\t\t? \"Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events.\"\n\t\t\t: \"\";\n\t\tconst content = this.#buildMessage(selected, overflowCount, pauseNotice, settings.maxCharsPerInjection);\n\n\t\tdelivery.send(content, reachesBudget ? { forceWake: true } : undefined);\n\t\tthis.#lastWakeAt = now;\n\t\tfor (const id of injectedIds) {\n\t\t\tthis.#lastInjectionAt.set(id, now);\n\t\t\tthis.#overflow.delete(id);\n\t\t\tconst fingerprint = fingerprints.get(id);\n\t\t\tif (fingerprint === undefined) this.#lastInjectedBatch.delete(id);\n\t\t\telse this.#lastInjectedBatch.set(id, fingerprint);\n\t\t}\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tthis.#consecutiveWakes = deliversSummary ? 0 : this.#consecutiveWakes + 1;\n\n\t\tif (reachesBudget) {\n\t\t\tthis.#wakeBudgetPaused = true;\n\t\t\tthis.#deps.pauseMonitors();\n\t\t\tthis.#events = [];\n\t\t\tthis.#eventChars = 0;\n\t\t\tthis.#overflow.clear();\n\t\t\treturn;\n\t\t}\n\t\tconst remainingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#scheduleNextRateLimit(ids: ReadonlySet<string>, now: number, settings: MonitorDeliverySettings): void {\n\t\tconst nextAt = Math.min(...[...ids].map((id) => (this.#lastInjectionAt.get(id) ?? now) + settings.rateLimitMs));\n\t\tthis.#schedule(Math.max(1, nextAt - now));\n\t}\n\n\t/** A ready monitor whose line-only batch matches its previous injection carries no new information. */\n\t#batchFingerprints(ids: ReadonlySet<string>): Map<string, string> {\n\t\tconst fingerprints = new Map<string, string>();\n\t\tfor (const id of ids) {\n\t\t\tif ((this.#overflow.get(id)?.count ?? 0) > 0) continue;\n\t\t\tconst batch = this.#events.filter((event) => event.id === id);\n\t\t\tif (batch.length === 0 || batch.some((event) => event.type !== \"line\")) continue;\n\t\t\tfingerprints.set(id, batch.map(eventBody).join(\"\\n\"));\n\t\t}\n\t\treturn fingerprints;\n\t}\n\n\t#discardSuppressed(deferred: MonitorEvent[], now: number, settings: MonitorDeliverySettings): void {\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tconst remainingIds = new Set([...deferred.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#buildMessage(\n\t\tevents: readonly MonitorEvent[],\n\t\toverflowCount: number,\n\t\tpauseNotice: string,\n\t\tmaxChars: number,\n\t): string {\n\t\tconst overflowNotice =\n\t\t\toverflowCount > 0\n\t\t\t\t? `[${overflowCount} additional event lines omitted; peek bash_output for full history.]`\n\t\t\t\t: \"\";\n\t\tconst suffix = [overflowNotice, pauseNotice].filter(Boolean).join(\"\\n\");\n\t\tconst fixedChars = SYSTEM_REMINDER_OPEN.length + SYSTEM_REMINDER_CLOSE.length + (suffix ? suffix.length + 1 : 0);\n\t\tconst body = clip(formatEvents(events), Math.max(0, maxChars - fixedChars));\n\t\treturn `${SYSTEM_REMINDER_OPEN}${body}${body && suffix ? \"\\n\" : \"\"}${suffix}${SYSTEM_REMINDER_CLOSE}`;\n\t}\n}\n"]}