@code-yeongyu/senpi 2026.8.30 → 2026.9.2

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 (373) hide show
  1. package/CHANGELOG.md +174 -2
  2. package/README.md +3 -0
  3. package/dist/core/agent-session.d.ts +28 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +161 -14
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/compaction/compaction-execution.d.ts +14 -0
  8. package/dist/core/compaction/compaction-execution.d.ts.map +1 -0
  9. package/dist/core/compaction/compaction-execution.js +121 -0
  10. package/dist/core/compaction/compaction-execution.js.map +1 -0
  11. package/dist/core/compaction/compaction-settings.d.ts +17 -0
  12. package/dist/core/compaction/compaction-settings.d.ts.map +1 -0
  13. package/dist/core/compaction/compaction-settings.js +17 -0
  14. package/dist/core/compaction/compaction-settings.js.map +1 -0
  15. package/dist/core/compaction/compaction.d.ts +13 -26
  16. package/dist/core/compaction/compaction.d.ts.map +1 -1
  17. package/dist/core/compaction/compaction.js +7 -136
  18. package/dist/core/compaction/compaction.js.map +1 -1
  19. package/dist/core/compaction/ideal-compaction-settings.d.ts +9 -0
  20. package/dist/core/compaction/ideal-compaction-settings.d.ts.map +1 -0
  21. package/dist/core/compaction/ideal-compaction-settings.js +7 -0
  22. package/dist/core/compaction/ideal-compaction-settings.js.map +1 -0
  23. package/dist/core/compaction-settings-access.d.ts +19 -0
  24. package/dist/core/compaction-settings-access.d.ts.map +1 -0
  25. package/dist/core/compaction-settings-access.js +10 -0
  26. package/dist/core/compaction-settings-access.js.map +1 -0
  27. package/dist/core/compaction-settings-resolver.d.ts +22 -0
  28. package/dist/core/compaction-settings-resolver.d.ts.map +1 -0
  29. package/dist/core/compaction-settings-resolver.js +46 -0
  30. package/dist/core/compaction-settings-resolver.js.map +1 -0
  31. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +9 -1
  32. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
  33. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +10 -3
  34. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
  35. package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts +24 -0
  36. package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts.map +1 -0
  37. package/dist/core/extensions/builtin/compaction/context-pipeline.js +43 -0
  38. package/dist/core/extensions/builtin/compaction/context-pipeline.js.map +1 -0
  39. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +1 -1
  40. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +8 -2
  42. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
  43. package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts +17 -0
  44. package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts.map +1 -0
  45. package/dist/core/extensions/builtin/compaction/emergency-prune.js +64 -0
  46. package/dist/core/extensions/builtin/compaction/emergency-prune.js.map +1 -0
  47. package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts +27 -0
  48. package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts.map +1 -0
  49. package/dist/core/extensions/builtin/compaction/extension-wiring.js +84 -0
  50. package/dist/core/extensions/builtin/compaction/extension-wiring.js.map +1 -0
  51. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts +1 -1
  52. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts.map +1 -1
  53. package/dist/core/extensions/builtin/compaction/idle-retry.js +1 -1
  54. package/dist/core/extensions/builtin/compaction/idle-retry.js.map +1 -1
  55. package/dist/core/extensions/builtin/compaction/idle.d.ts +1 -0
  56. package/dist/core/extensions/builtin/compaction/idle.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/compaction/idle.js +13 -2
  58. package/dist/core/extensions/builtin/compaction/idle.js.map +1 -1
  59. package/dist/core/extensions/builtin/compaction/index.d.ts +1 -1
  60. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  61. package/dist/core/extensions/builtin/compaction/index.js +152 -154
  62. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  63. package/dist/core/extensions/builtin/compaction/log.d.ts +1 -1
  64. package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
  65. package/dist/core/extensions/builtin/compaction/log.js +2 -0
  66. package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
  67. package/dist/core/extensions/builtin/compaction/model-selection.d.ts +14 -0
  68. package/dist/core/extensions/builtin/compaction/model-selection.d.ts.map +1 -0
  69. package/dist/core/extensions/builtin/compaction/model-selection.js +37 -0
  70. package/dist/core/extensions/builtin/compaction/model-selection.js.map +1 -0
  71. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts +30 -0
  72. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts.map +1 -0
  73. package/dist/core/extensions/builtin/compaction/model-usability-budget.js +74 -0
  74. package/dist/core/extensions/builtin/compaction/model-usability-budget.js.map +1 -0
  75. package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts +9 -0
  76. package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts.map +1 -0
  77. package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js +2 -0
  78. package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js.map +1 -0
  79. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +3 -6
  80. package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
  81. package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
  82. package/dist/core/extensions/builtin/compaction/orchestration.d.ts +46 -0
  83. package/dist/core/extensions/builtin/compaction/orchestration.d.ts.map +1 -0
  84. package/dist/core/extensions/builtin/compaction/orchestration.js +103 -0
  85. package/dist/core/extensions/builtin/compaction/orchestration.js.map +1 -0
  86. package/dist/core/extensions/builtin/compaction/policy.d.ts +12 -2
  87. package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -1
  88. package/dist/core/extensions/builtin/compaction/policy.js +52 -26
  89. package/dist/core/extensions/builtin/compaction/policy.js.map +1 -1
  90. package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts +8 -0
  91. package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts.map +1 -0
  92. package/dist/core/extensions/builtin/compaction/speculation-lead.js +17 -0
  93. package/dist/core/extensions/builtin/compaction/speculation-lead.js.map +1 -0
  94. package/dist/core/extensions/builtin/compaction/speculative-job.d.ts +22 -0
  95. package/dist/core/extensions/builtin/compaction/speculative-job.d.ts.map +1 -0
  96. package/dist/core/extensions/builtin/compaction/speculative-job.js +16 -0
  97. package/dist/core/extensions/builtin/compaction/speculative-job.js.map +1 -0
  98. package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts +23 -0
  99. package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts.map +1 -0
  100. package/dist/core/extensions/builtin/compaction/speculative-summary.js +132 -0
  101. package/dist/core/extensions/builtin/compaction/speculative-summary.js.map +1 -0
  102. package/dist/core/extensions/builtin/compaction/speculative.d.ts +8 -13
  103. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  104. package/dist/core/extensions/builtin/compaction/speculative.js +21 -197
  105. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  106. package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts +24 -0
  107. package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts.map +1 -0
  108. package/dist/core/extensions/builtin/compaction/token-budget-reminder.js +25 -0
  109. package/dist/core/extensions/builtin/compaction/token-budget-reminder.js.map +1 -0
  110. package/dist/core/extensions/builtin/compaction/tool-admission.d.ts +27 -0
  111. package/dist/core/extensions/builtin/compaction/tool-admission.d.ts.map +1 -0
  112. package/dist/core/extensions/builtin/compaction/tool-admission.js +56 -0
  113. package/dist/core/extensions/builtin/compaction/tool-admission.js.map +1 -0
  114. package/dist/core/extensions/builtin/hooks/trust-state-json.d.ts +5 -0
  115. package/dist/core/extensions/builtin/hooks/trust-state-json.d.ts.map +1 -0
  116. package/dist/core/extensions/builtin/hooks/trust-state-json.js +76 -0
  117. package/dist/core/extensions/builtin/hooks/trust-state-json.js.map +1 -0
  118. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts +7 -1
  119. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
  120. package/dist/core/extensions/builtin/hooks/trust-storage.js +60 -8
  121. package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
  122. package/dist/core/extensions/builtin/hooks/trust.d.ts +1 -2
  123. package/dist/core/extensions/builtin/hooks/trust.d.ts.map +1 -1
  124. package/dist/core/extensions/builtin/hooks/trust.js +1 -72
  125. package/dist/core/extensions/builtin/hooks/trust.js.map +1 -1
  126. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts +3 -0
  127. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts.map +1 -0
  128. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +108 -0
  129. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js.map +1 -0
  130. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  131. package/dist/core/extensions/builtin/prompt-preset/presets.js +11 -0
  132. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  133. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
  134. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  135. package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
  136. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  137. package/dist/core/extensions/builtin/recommended-models/index.d.ts +1 -1
  138. package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
  139. package/dist/core/extensions/builtin/recommended-models/index.js +1 -1
  140. package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
  141. package/dist/core/extensions/builtin/terminal/runtime-session.d.ts +11 -0
  142. package/dist/core/extensions/builtin/terminal/runtime-session.d.ts.map +1 -1
  143. package/dist/core/extensions/builtin/terminal/runtime-session.js +18 -2
  144. package/dist/core/extensions/builtin/terminal/runtime-session.js.map +1 -1
  145. package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
  146. package/dist/core/extensions/builtin/ttsr/index.js +4 -0
  147. package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
  148. package/dist/core/extensions/builtin/ttsr/manager.d.ts +2 -0
  149. package/dist/core/extensions/builtin/ttsr/manager.d.ts.map +1 -1
  150. package/dist/core/extensions/builtin/ttsr/manager.js +28 -1
  151. package/dist/core/extensions/builtin/ttsr/manager.js.map +1 -1
  152. package/dist/core/extensions/runner.d.ts +5 -0
  153. package/dist/core/extensions/runner.d.ts.map +1 -1
  154. package/dist/core/extensions/runner.js +7 -0
  155. package/dist/core/extensions/runner.js.map +1 -1
  156. package/dist/core/retry-fallback/controller.d.ts +14 -0
  157. package/dist/core/retry-fallback/controller.d.ts.map +1 -1
  158. package/dist/core/retry-fallback/controller.js +33 -3
  159. package/dist/core/retry-fallback/controller.js.map +1 -1
  160. package/dist/core/retry-fallback/log.js +1 -1
  161. package/dist/core/retry-fallback/log.js.map +1 -1
  162. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  163. package/dist/core/retry-fallback/settings.js +1 -0
  164. package/dist/core/retry-fallback/settings.js.map +1 -1
  165. package/dist/core/sdk.d.ts.map +1 -1
  166. package/dist/core/sdk.js +5 -0
  167. package/dist/core/sdk.js.map +1 -1
  168. package/dist/core/session-activity.d.ts +47 -0
  169. package/dist/core/session-activity.d.ts.map +1 -0
  170. package/dist/core/session-activity.js +58 -0
  171. package/dist/core/session-activity.js.map +1 -0
  172. package/dist/core/session-manager.d.ts +8 -12
  173. package/dist/core/session-manager.d.ts.map +1 -1
  174. package/dist/core/session-manager.js +118 -7
  175. package/dist/core/session-manager.js.map +1 -1
  176. package/dist/core/session-resident-store.d.ts +8 -1
  177. package/dist/core/session-resident-store.d.ts.map +1 -1
  178. package/dist/core/session-resident-store.js +12 -5
  179. package/dist/core/session-resident-store.js.map +1 -1
  180. package/dist/core/settings-manager.d.ts +8 -85
  181. package/dist/core/settings-manager.d.ts.map +1 -1
  182. package/dist/core/settings-manager.js +9 -17
  183. package/dist/core/settings-manager.js.map +1 -1
  184. package/dist/core/settings-public-types.d.ts +11 -0
  185. package/dist/core/settings-public-types.d.ts.map +1 -0
  186. package/dist/core/settings-public-types.js +2 -0
  187. package/dist/core/settings-public-types.js.map +1 -0
  188. package/dist/core/settings-shapes.d.ts +36 -0
  189. package/dist/core/settings-shapes.d.ts.map +1 -0
  190. package/dist/core/settings-shapes.js +2 -0
  191. package/dist/core/settings-shapes.js.map +1 -0
  192. package/dist/core/shared-host-policy.d.ts +6 -0
  193. package/dist/core/shared-host-policy.d.ts.map +1 -0
  194. package/dist/core/shared-host-policy.js +7 -0
  195. package/dist/core/shared-host-policy.js.map +1 -0
  196. package/dist/core/terminal-settings.d.ts +22 -0
  197. package/dist/core/terminal-settings.d.ts.map +1 -0
  198. package/dist/core/terminal-settings.js +2 -0
  199. package/dist/core/terminal-settings.js.map +1 -0
  200. package/dist/index.d.ts +1 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +1 -1
  203. package/dist/index.js.map +1 -1
  204. package/dist/main.d.ts +4 -4
  205. package/dist/main.d.ts.map +1 -1
  206. package/dist/main.js +27 -11
  207. package/dist/main.js.map +1 -1
  208. package/dist/modes/app-server/daemon/process.d.ts +13 -2
  209. package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
  210. package/dist/modes/app-server/daemon/process.js +58 -12
  211. package/dist/modes/app-server/daemon/process.js.map +1 -1
  212. package/dist/modes/app-server/daemon.js +65 -7
  213. package/dist/modes/app-server/daemon.js.map +1 -1
  214. package/dist/modes/index.d.ts +1 -1
  215. package/dist/modes/index.d.ts.map +1 -1
  216. package/dist/modes/index.js +1 -1
  217. package/dist/modes/index.js.map +1 -1
  218. package/dist/modes/interactive/interactive-host-runtime.d.ts +84 -1
  219. package/dist/modes/interactive/interactive-host-runtime.d.ts.map +1 -1
  220. package/dist/modes/interactive/interactive-host-runtime.js +435 -112
  221. package/dist/modes/interactive/interactive-host-runtime.js.map +1 -1
  222. package/dist/modes/interactive/interactive-mode.d.ts +11 -1
  223. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  224. package/dist/modes/interactive/interactive-mode.js +59 -6
  225. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  226. package/dist/modes/interactive/tips/catalog/ethos-tips.js +1 -1
  227. package/dist/modes/interactive/tips/catalog/ethos-tips.js.map +1 -1
  228. package/dist/modes/rpc/connection-handler.d.ts +12 -5
  229. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  230. package/dist/modes/rpc/connection-handler.js +180 -25
  231. package/dist/modes/rpc/connection-handler.js.map +1 -1
  232. package/dist/modes/rpc/custom-capability.d.ts +2 -0
  233. package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
  234. package/dist/modes/rpc/custom-capability.js +2 -0
  235. package/dist/modes/rpc/custom-capability.js.map +1 -1
  236. package/dist/modes/rpc/host-ensure.d.ts +17 -0
  237. package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
  238. package/dist/modes/rpc/host-ensure.js +150 -23
  239. package/dist/modes/rpc/host-ensure.js.map +1 -1
  240. package/dist/modes/rpc/host-lifecycle.d.ts +54 -0
  241. package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
  242. package/dist/modes/rpc/host-lifecycle.js +259 -69
  243. package/dist/modes/rpc/host-lifecycle.js.map +1 -1
  244. package/dist/modes/rpc/host-watchdog.d.ts +2 -2
  245. package/dist/modes/rpc/host-watchdog.d.ts.map +1 -1
  246. package/dist/modes/rpc/host-watchdog.js +89 -21
  247. package/dist/modes/rpc/host-watchdog.js.map +1 -1
  248. package/dist/modes/rpc/multi-session-host.d.ts +38 -0
  249. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
  250. package/dist/modes/rpc/multi-session-host.js +149 -61
  251. package/dist/modes/rpc/multi-session-host.js.map +1 -1
  252. package/dist/modes/rpc/ownership-safe-lock.d.ts +14 -0
  253. package/dist/modes/rpc/ownership-safe-lock.d.ts.map +1 -0
  254. package/dist/modes/rpc/ownership-safe-lock.js +87 -0
  255. package/dist/modes/rpc/ownership-safe-lock.js.map +1 -0
  256. package/dist/modes/rpc/rpc-client.d.ts +13 -2
  257. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  258. package/dist/modes/rpc/rpc-client.js +46 -12
  259. package/dist/modes/rpc/rpc-client.js.map +1 -1
  260. package/dist/modes/rpc/rpc-types.d.ts +21 -3
  261. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  262. package/dist/modes/rpc/rpc-types.js +1 -0
  263. package/dist/modes/rpc/rpc-types.js.map +1 -1
  264. package/dist/modes/rpc/session-binding.d.ts +2 -1
  265. package/dist/modes/rpc/session-binding.d.ts.map +1 -1
  266. package/dist/modes/rpc/session-binding.js +1 -0
  267. package/dist/modes/rpc/session-binding.js.map +1 -1
  268. package/dist/modes/rpc/session-command-router.d.ts +54 -1
  269. package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
  270. package/dist/modes/rpc/session-command-router.js +180 -3
  271. package/dist/modes/rpc/session-command-router.js.map +1 -1
  272. package/dist/modes/rpc/session-event-writer.d.ts +18 -0
  273. package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
  274. package/dist/modes/rpc/session-event-writer.js +88 -8
  275. package/dist/modes/rpc/session-event-writer.js.map +1 -1
  276. package/dist/modes/rpc/session-registry.d.ts +11 -1
  277. package/dist/modes/rpc/session-registry.d.ts.map +1 -1
  278. package/dist/modes/rpc/session-registry.js +25 -0
  279. package/dist/modes/rpc/session-registry.js.map +1 -1
  280. package/dist/modes/rpc/socket-transport.d.ts +13 -0
  281. package/dist/modes/rpc/socket-transport.d.ts.map +1 -0
  282. package/dist/modes/rpc/socket-transport.js +92 -0
  283. package/dist/modes/rpc/socket-transport.js.map +1 -0
  284. package/dist/modes/rpc/widget-line-renderer.d.ts +17 -0
  285. package/dist/modes/rpc/widget-line-renderer.d.ts.map +1 -0
  286. package/dist/modes/rpc/widget-line-renderer.js +73 -0
  287. package/dist/modes/rpc/widget-line-renderer.js.map +1 -0
  288. package/dist/utils/fs-watch.d.ts.map +1 -1
  289. package/dist/utils/fs-watch.js +11 -2
  290. package/dist/utils/fs-watch.js.map +1 -1
  291. package/docs/app-server.md +2 -2
  292. package/docs/containerization.md +2 -2
  293. package/docs/development.md +7 -7
  294. package/docs/extensions.md +5 -5
  295. package/docs/grok-neo.md +1 -1
  296. package/docs/index.md +1 -1
  297. package/docs/packages.md +2 -2
  298. package/docs/quickstart.md +4 -4
  299. package/docs/release-guide.md +21 -21
  300. package/docs/rpc.md +83 -6
  301. package/docs/sdk.md +1 -1
  302. package/docs/settings.md +4 -4
  303. package/docs/skills.md +2 -2
  304. package/docs/terminal-tools.md +1 -1
  305. package/docs/termux.md +1 -1
  306. package/docs/tui.md +1 -1
  307. package/examples/AGENTS.md +1 -1
  308. package/examples/sdk/README.md +1 -1
  309. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +52 -0
  310. package/node_modules/@code-yeongyu/senpi-codemode/README.md +2 -2
  311. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  312. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/skill-contribution.ts +71 -0
  313. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +3 -1
  314. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/SKILL.md +44 -0
  315. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/breaking-changes.md +75 -0
  316. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/build.md +114 -0
  317. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/dev-tooling.md +34 -0
  318. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/http-networking.md +113 -0
  319. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/install.md +93 -0
  320. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/node-compat-platforms.md +36 -0
  321. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/performance.md +33 -0
  322. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/runtime-apis.md +156 -0
  323. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/security.md +52 -0
  324. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/test.md +103 -0
  325. package/node_modules/@earendil-works/pi-agent-core/README.md +3 -0
  326. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  327. package/node_modules/@earendil-works/pi-ai/README.md +6 -3
  328. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  329. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +24 -7
  330. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  331. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +7 -0
  332. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
  333. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +316 -2
  334. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
  335. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.d.ts +4 -0
  336. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.d.ts.map +1 -1
  337. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.js +23 -0
  338. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.js.map +1 -1
  339. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +24 -0
  340. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  341. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +20 -2
  342. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  343. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  344. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  345. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  346. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  347. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  348. package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
  349. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  350. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  351. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  352. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  353. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  354. package/node_modules/@earendil-works/pi-pty/dist/screen-operations.d.ts +42 -0
  355. package/node_modules/@earendil-works/pi-pty/dist/screen-operations.d.ts.map +1 -0
  356. package/node_modules/@earendil-works/pi-pty/dist/screen-operations.js +34 -0
  357. package/node_modules/@earendil-works/pi-pty/dist/screen-operations.js.map +1 -0
  358. package/node_modules/@earendil-works/pi-pty/dist/screen-text.d.ts +8 -0
  359. package/node_modules/@earendil-works/pi-pty/dist/screen-text.d.ts.map +1 -0
  360. package/node_modules/@earendil-works/pi-pty/dist/screen-text.js +51 -0
  361. package/node_modules/@earendil-works/pi-pty/dist/screen-text.js.map +1 -0
  362. package/node_modules/@earendil-works/pi-pty/dist/screen.d.ts +45 -0
  363. package/node_modules/@earendil-works/pi-pty/dist/screen.d.ts.map +1 -1
  364. package/node_modules/@earendil-works/pi-pty/dist/screen.js +178 -55
  365. package/node_modules/@earendil-works/pi-pty/dist/screen.js.map +1 -1
  366. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  367. package/node_modules/@earendil-works/pi-telemetry/README.md +6 -3
  368. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  369. package/node_modules/@earendil-works/pi-tui/README.md +5 -4
  370. package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +2 -2
  371. package/node_modules/@earendil-works/pi-tui/native/win32/README.md +2 -2
  372. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  373. package/package.json +7 -7
@@ -0,0 +1,108 @@
1
+ // Claude Fable 5.1 full-core system prompt.
2
+ //
3
+ // Baseline is the dieted claude-fable-5.ts core: Anthropic's Fable 5.1
4
+ // prompting guide opens with "your existing Claude Fable 5 prompts should
5
+ // perform well on Claude Fable 5.1 without changes", so this preset is that
6
+ // core plus surgical deltas mapped 1:1 to the documented 5.1 behavior
7
+ // differences (prompting-claude-fable-5-1):
8
+ // - scope-is-the-deliverable paragraph in the intent gate ("Finish the whole
9
+ // task" block 2; block 1 was already distilled into the Style stance),
10
+ // - per-response batching framing ("Batch independent tool calls in agent
11
+ // loops": 5.1 can issue one call per turn in coding loops),
12
+ // - surgical-edit-over-rewrite line ("Prefer targeted edits over whole-file
13
+ // rewrites": 5.1 rewrites whole files more than Fable 5),
14
+ // - follow-up/test-scope sentences in Verification ("Keep changes and tests
15
+ // to what the task asks for"),
16
+ // - bidirectional formatting rule replacing the bullets-suppression wording
17
+ // ("Formatting in chat": 5.1 under-formats, anti-formatting rules written
18
+ // for older models suppress structure the content needs),
19
+ // - literal-phrase clause ("Writing density": mannered-prose short form),
20
+ // - progress-note encouragement replacing the shorthand permission ("Ask for
21
+ // user-facing progress updates": 5.1 narrates less by default).
22
+ // Deliberately omitted (entropy gate): the quoting-retrieved-sources example
23
+ // (document-summarization workload, not a coding agent core), the low-effort
24
+ // search nudge (effort is user-controlled and defaults high), and the
25
+ // compaction/long-output notes (harness-side, not system prompt). Shared
26
+ // pieces stay single-sourced: buildTestDisciplineSection(), the rendered tool
27
+ // section, the grep/glob search line, workstationDialect "claude"; dynamic
28
+ // pieces (context files, skills, date, cwd) still come from
29
+ // buildDynamicSystemPrompt.
30
+ import { APP_NAME } from "../../../../config.js";
31
+ import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
32
+ import { getToolsPromptDisplay } from "../../../dynamic-prompt/tool-categorization.js";
33
+ import { buildTestDisciplineSection } from "../../../dynamic-prompt/verification.js";
34
+ function buildSearchLine(context) {
35
+ const triggerTools = getToolsPromptDisplay(context.tools);
36
+ if (!triggerTools) {
37
+ return "";
38
+ }
39
+ 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`;
40
+ }
41
+ function buildClaudeFable51Core(context) {
42
+ return `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.
43
+
44
+ ## Intent Gate
45
+
46
+ Open every turn with one short routing line:
47
+
48
+ > I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].
49
+
50
+ The line keeps your reading transparent; only the user's explicit request commits you to implementation. Name the stop condition as an observable end state, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured, deliver the final message, and stop - anything past it (another verification pass, re-polish, a bonus refactor) is a defect, not diligence. Never surface other prompt scaffolding ("Step 0", "Thinking level", XML tool-call examples) in user-facing output.
51
+ ${buildSearchLine(context)}
52
+ Route by true intent, not surface form:
53
+ - Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.
54
+ - Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.
55
+ - 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.
56
+
57
+ Deliver the task at the scope asked - the scope is the deliverable: don't quietly narrow, widen, or swap it. Make routine judgment calls yourself; check in only when different readings 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. If part of the task turns out to be blocked, finish every other part in full and say exactly what you left out and why - scaling down is the user's call, not yours.
58
+
59
+ Derive 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.
60
+
61
+ ## Working the Task
62
+
63
+ Before each response, note what you still need; then request every item that doesn't depend on another's result in that one response - independent tool calls fire as one parallel wave, and breadth is cheap 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.
64
+
65
+ Memory of file contents is unreliable - read before claiming, re-read before editing. When changing a file, prefer a surgical edit over rewriting the whole file when the result would be identical; rewrite only when most of the file changes. 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.
66
+
67
+ When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. When weighing a choice, give a recommendation, not a survey.
68
+
69
+ ## Verification
70
+
71
+ Tier the scope, never the rigor:
72
+ - Single-file non-behavioral edit: diagnostics on that file. Done.
73
+ - Single-domain behavioral change: diagnostics on changed files, related tests, one execution of the affected runnable entry point when one exists.
74
+ - 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.
75
+
76
+ ${buildTestDisciplineSection()}
77
+
78
+ "Should pass" is not verification - run the validator. Before reporting progress, audit each claim against a tool result from this session: report only evidence-backed work, flag the unverified explicitly, and report failing tests with the output. Fix only issues your changes caused: a pre-existing bug or performance concern you notice goes in the summary as a follow-up, not in this change. Scratch checks verify and get discarded; commit tests only where the task asks for them or the repository already keeps tests for that kind of change, sized like the neighboring test files.
79
+
80
+ ${context.toolSection}
81
+
82
+ ## Hard Limits
83
+
84
+ - Never create a git commit unless the user explicitly requested it.
85
+ - Never present unread code or unrun commands as verified fact.
86
+ - Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.
87
+ - Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.
88
+
89
+ ## Style
90
+
91
+ Smallest 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.
92
+
93
+ Act, 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. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn rather than ending on a promise; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, question, or promise about work you have not done means do that work now, with tool calls.
94
+
95
+ Have an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. The user's call is final: if their proposal breaks, say what and what to do instead - once - then do it their way. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.
96
+
97
+ Be concise and concrete: no filler openers, no self-praise, no "it depends" hedging when you have context to judge; say what you mean - when a literal phrase is available, use it instead of metaphor or flourish. Use lists or headers when the content is genuinely multifaceted; keep to plain prose otherwise; ASCII unless the file already uses Unicode. Drop a brief progress note when you learn something important or change direction - long silent stretches leave the reader blind. The final summary is for a reader who did not see the work: lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next, not by compressing into fragments, arrow chains, or invented labels.
98
+
99
+ Do not stop, summarize, or suggest a new session on account of context limits. Continue the work until your declared stop condition holds.`;
100
+ }
101
+ export function buildClaudeFable51Prompt(options) {
102
+ return buildDynamicSystemPrompt({
103
+ ...options,
104
+ corePrompt: buildClaudeFable51Core,
105
+ workstationDialect: "claude",
106
+ });
107
+ }
108
+ //# sourceMappingURL=claude-fable-5-1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-fable-5-1.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset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,EAAE,sBAAsB;QAClC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Fable 5.1 full-core system prompt.\n//\n// Baseline is the dieted claude-fable-5.ts core: Anthropic's Fable 5.1\n// prompting guide opens with \"your existing Claude Fable 5 prompts should\n// perform well on Claude Fable 5.1 without changes\", so this preset is that\n// core plus surgical deltas mapped 1:1 to the documented 5.1 behavior\n// differences (prompting-claude-fable-5-1):\n// - scope-is-the-deliverable paragraph in the intent gate (\"Finish the whole\n// task\" block 2; block 1 was already distilled into the Style stance),\n// - per-response batching framing (\"Batch independent tool calls in agent\n// loops\": 5.1 can issue one call per turn in coding loops),\n// - surgical-edit-over-rewrite line (\"Prefer targeted edits over whole-file\n// rewrites\": 5.1 rewrites whole files more than Fable 5),\n// - follow-up/test-scope sentences in Verification (\"Keep changes and tests\n// to what the task asks for\"),\n// - bidirectional formatting rule replacing the bullets-suppression wording\n// (\"Formatting in chat\": 5.1 under-formats, anti-formatting rules written\n// for older models suppress structure the content needs),\n// - literal-phrase clause (\"Writing density\": mannered-prose short form),\n// - progress-note encouragement replacing the shorthand permission (\"Ask for\n// user-facing progress updates\": 5.1 narrates less by default).\n// Deliberately omitted (entropy gate): the quoting-retrieved-sources example\n// (document-summarization workload, not a coding agent core), the low-effort\n// search nudge (effort is user-controlled and defaults high), and the\n// compaction/long-output notes (harness-side, not system prompt). Shared\n// pieces stay single-sourced: buildTestDisciplineSection(), the rendered tool\n// section, the grep/glob search line, workstationDialect \"claude\"; dynamic\n// pieces (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 { 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 buildClaudeFable51Core(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. Name the stop condition as an observable end state, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured, deliver the final message, and stop - anything past it (another verification pass, re-polish, a bonus refactor) 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 - the scope is the deliverable: don't quietly narrow, widen, or swap it. Make routine judgment calls yourself; check in only when different readings 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. If part of the task turns out to be blocked, finish every other part in full and say exactly what you left out and why - scaling down is the user's call, not yours.\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\nBefore each response, note what you still need; then request every item that doesn't depend on another's result in that one response - independent tool calls fire as one parallel wave, and breadth is cheap 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. When changing a file, prefer a surgical edit over rewriting the whole file when the result would be identical; rewrite only when most of the file changes. 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\nWhen you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. When weighing a choice, give a recommendation, not a survey.\n\n## Verification\n\nTier the scope, never the rigor:\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 progress, audit each claim against a tool result from this session: report only evidence-backed work, flag the unverified explicitly, and report failing tests with the output. Fix only issues your changes caused: a pre-existing bug or performance concern you notice goes in the summary as a follow-up, not in this change. Scratch checks verify and get discarded; commit tests only where the task asks for them or the repository already keeps tests for that kind of change, sized like the neighboring test files.\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. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn rather than ending on a promise; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, question, or promise about work you have not done means do that work now, with tool calls.\n\nHave an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. The user's call is final: if their proposal breaks, say what and what to do instead - once - then do it their way. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nBe concise and concrete: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; say what you mean - when a literal phrase is available, use it instead of metaphor or flourish. Use lists or headers when the content is genuinely multifaceted; keep to plain prose otherwise; ASCII unless the file already uses Unicode. Drop a brief progress note when you learn something important or change direction - long silent stretches leave the reader blind. The final summary is for a reader who did not see the work: lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next, not by compressing into fragments, arrow chains, or invented labels.\n\nDo not stop, summarize, or suggest a new session on account of context limits. Continue the work until your declared stop condition holds.`;\n}\n\nexport function buildClaudeFable51Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeFable51Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAuBxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAqB,MAAM,eAAe,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,KAAK,kBAAkB,GAAG,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5D,KAAK,6BAA6B,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;IAC1E,IAAI,CAAC,EAA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AAG,SAAS,CA4DhC;AAgED,wBAAgB,aAAa,CAC5B,KAAK,EAAE,6BAA6B,EACpC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,+BAA+B,CAAC,GAChD,oBAAoB,GAAG,SAAS,CAMlC"}
@@ -1,4 +1,5 @@
1
1
  import { buildClaudeFable5Prompt } from "./claude-fable-5.js";
2
+ import { buildClaudeFable51Prompt } from "./claude-fable-5-1.js";
2
3
  import { buildClaudeOpus45Prompt } from "./claude-opus-4-5.js";
3
4
  import { buildClaudeOpus46Prompt } from "./claude-opus-4-6.js";
4
5
  import { buildClaudeOpus47Prompt } from "./claude-opus-4-7.js";
@@ -112,6 +113,10 @@ function hasGrok46Signal(value) {
112
113
  function isGrok46Model(model) {
113
114
  return hasGrok46Signal(model.id) || (model.name !== undefined && hasGrok46Signal(model.name));
114
115
  }
116
+ function isClaudeFable51Model(modelId) {
117
+ const normalized = normalizeModelId(modelId);
118
+ return normalized.includes("fable-5-1") || normalized.includes("fable-5.1");
119
+ }
115
120
  function isClaudeFable5Model(modelId) {
116
121
  return normalizeModelId(modelId).includes("fable-5");
117
122
  }
@@ -155,6 +160,10 @@ export function resolvePresetName(model, settings) {
155
160
  if (isKimiK26Model(model)) {
156
161
  return "kimi-k2-6";
157
162
  }
163
+ // The dotted release must resolve before the generic fable-5 substring.
164
+ if (isClaudeFable51Model(model.id)) {
165
+ return "claude-fable-5-1";
166
+ }
158
167
  if (isClaudeFable5Model(model.id)) {
159
168
  return "claude-fable-5";
160
169
  }
@@ -223,6 +232,8 @@ function buildPreset(name, options) {
223
232
  return { name, prompt: buildKimiK27Prompt(options) };
224
233
  case "kimi-k2-6":
225
234
  return { name, prompt: buildKimiK26Prompt(options) };
235
+ case "claude-fable-5-1":
236
+ return { name, prompt: buildClaudeFable51Prompt(options) };
226
237
  case "claude-fable-5":
227
238
  return { name, prompt: buildClaudeFable5Prompt(options) };
228
239
  case "claude-opus-5":
@@ -1 +1 @@
1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O,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,KAAK,iBAAiB;YACrB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,UAAoD,EAAE;IAC3E,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildClaudeOpus5Prompt } from \"./claude-opus-5.ts\";\nimport { buildDeepseekV4FlashPrompt } from \"./deepseek-v4-flash.ts\";\nimport { buildDeepseekV4Flash0731Prompt } from \"./deepseek-v4-flash-0731.ts\";\nimport { buildDeepseekV4ProPrompt } from \"./deepseek-v4-pro.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGlm53Prompt } from \"./glm-5-3.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildGrok45Prompt } from \"./grok-4.5.ts\";\nimport { buildGrok46Prompt } from \"./grok-4.6.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { buildKimiK3Prompt } from \"./kimi-k3.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\nfunction hasKimiK27Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasKimiK3Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === \"k3\" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK3Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));\n}\n\n// DeepSeek V4 id shapes verified against the OpenRouter live API, models.dev,\n// and senpi's generated provider catalogs (2026-07-31): deepseek-v4-flash,\n// deepseek/deepseek-v4-flash-0731, deepseek-ai/DeepSeek-V4-Pro,\n// accounts/fireworks/models/deepseek-v4-flash, aihubmix's alicloud-deepseek-v4-*,\n// and trailing tags (:free, -free, :thinking, -nothinking, -cheaper, -lightning, -el).\nfunction hasDeepseekV4Flash0731Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash[._-]0731(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4Flash0731Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV4Flash0731Signal(model.id) || (model.name !== undefined && hasDeepseekV4Flash0731Signal(model.name))\n\t);\n}\n\nfunction hasDeepseekV4FlashSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4FlashSignal(model.id) || (model.name !== undefined && hasDeepseekV4FlashSignal(model.name));\n}\n\nfunction hasDeepseekV4ProSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]pro(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4ProModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4ProSignal(model.id) || (model.name !== undefined && hasDeepseekV4ProSignal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction hasGlm53Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)3(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm53Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm53Signal(model.id) || (model.name !== undefined && hasGlm53Signal(model.name));\n}\n\nfunction hasGrok45Signal(value: string): boolean {\n\t// Match any Grok 4.5 id shape: grok-4.5, grok4.5, grok45, grok-4p5, provider:model,\n\t// path/prefix ids, and trailing tags (:thinking, -latest). Keep 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?5(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok45Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok45Signal(model.id) || (model.name !== undefined && hasGrok45Signal(model.name));\n}\n\nfunction hasGrok46Signal(value: string): boolean {\n\t// Same id shapes as hasGrok45Signal with a 4.6 minor version. Keep 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok46Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok46Signal(model.id) || (model.name !== undefined && hasGrok46Signal(model.name));\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"fable-5\");\n}\n\nfunction isClaudeOpus5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"opus-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isKimiK3Model(model)) {\n\t\treturn \"kimi-k3\";\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\tif (isClaudeOpus5Model(model.id)) {\n\t\treturn \"claude-opus-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm53Model(model)) {\n\t\treturn \"glm-5.3\";\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\t// The dated snapshot must resolve before the generic flash alias.\n\tif (isDeepseekV4Flash0731Model(model)) {\n\t\treturn \"deepseek-v4-flash-0731\";\n\t}\n\tif (isDeepseekV4FlashModel(model)) {\n\t\treturn \"deepseek-v4-flash\";\n\t}\n\tif (isDeepseekV4ProModel(model)) {\n\t\treturn \"deepseek-v4-pro\";\n\t}\n\tif (isGrok46Model(model)) {\n\t\treturn \"grok-4.6\";\n\t}\n\tif (isGrok45Model(model)) {\n\t\treturn \"grok-4.5\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.3\":\n\t\t\treturn { name, prompt: buildGlm53Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"deepseek-v4-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV4FlashPrompt(options) };\n\t\tcase \"deepseek-v4-flash-0731\":\n\t\t\treturn { name, prompt: buildDeepseekV4Flash0731Prompt(options) };\n\t\tcase \"deepseek-v4-pro\":\n\t\t\treturn { name, prompt: buildDeepseekV4ProPrompt(options) };\n\t\tcase \"grok-4.6\":\n\t\t\treturn { name, prompt: buildGrok46Prompt(options) };\n\t\tcase \"grok-4.5\":\n\t\t\treturn { name, prompt: buildGrok45Prompt(options) };\n\t\tcase \"kimi-k3\":\n\t\t\treturn { name, prompt: buildKimiK3Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
1
+ {"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/presets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAA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AED,SAAS,YAAY,CAAC,UAAoD,EAAE;IAC3E,OAAO;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE;QACtB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;QAChD,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;QACxC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAC5B,KAAoC,EACpC,QAA8B,EAC9B,OAAkD;IAElD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { BuildDynamicSystemPromptOptions } from \"../../../dynamic-prompt/build.ts\";\nimport { buildClaudeFable5Prompt } from \"./claude-fable-5.ts\";\nimport { buildClaudeFable51Prompt } from \"./claude-fable-5-1.ts\";\nimport { buildClaudeOpus45Prompt } from \"./claude-opus-4-5.ts\";\nimport { buildClaudeOpus46Prompt } from \"./claude-opus-4-6.ts\";\nimport { buildClaudeOpus47Prompt } from \"./claude-opus-4-7.ts\";\nimport { buildClaudeOpus48Prompt } from \"./claude-opus-4-8.ts\";\nimport { buildClaudeOpus5Prompt } from \"./claude-opus-5.ts\";\nimport { buildDeepseekV4FlashPrompt } from \"./deepseek-v4-flash.ts\";\nimport { buildDeepseekV4Flash0731Prompt } from \"./deepseek-v4-flash-0731.ts\";\nimport { buildDeepseekV4ProPrompt } from \"./deepseek-v4-pro.ts\";\nimport { buildGlm52Prompt } from \"./glm-5-2.ts\";\nimport { buildGlm53Prompt } from \"./glm-5-3.ts\";\nimport { buildGpt52Prompt } from \"./gpt-5.2.ts\";\nimport { buildGpt53CodexPrompt } from \"./gpt-5.3-codex.ts\";\nimport { buildGpt54Prompt } from \"./gpt-5.4.ts\";\nimport { buildGpt55Prompt } from \"./gpt-5.5.ts\";\nimport { buildGpt56Prompt } from \"./gpt-5.6.ts\";\nimport { buildGpt5Prompt } from \"./gpt-5.ts\";\nimport { buildGrok45Prompt } from \"./grok-4.5.ts\";\nimport { buildGrok46Prompt } from \"./grok-4.6.ts\";\nimport { buildKimiK26Prompt } from \"./kimi-k2-6.ts\";\nimport { buildKimiK27Prompt } from \"./kimi-k2-7.ts\";\nimport { buildKimiK3Prompt } from \"./kimi-k3.ts\";\nimport { type PromptPresetName, type PromptPresetSettings, parsePromptPreset } from \"./settings.ts\";\n\nexport type { PromptPresetSettings } from \"./settings.ts\";\n\ntype ResolvedPresetName = Exclude<PromptPresetName, \"auto\">;\ntype ModelWithPromptPresetMetadata = Pick<Model<Api>, \"id\" | \"provider\"> & {\n\tname?: string;\n\tpromptPreset?: string;\n};\n\nexport interface ResolvedPromptPreset {\n\tname: ResolvedPresetName;\n\tprompt: string;\n}\n\nfunction normalizeModelId(modelId: string): string {\n\treturn modelId.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\ntype Gpt5Version = \"gpt-5.2\" | \"gpt-5.3-codex\" | \"gpt-5.4\" | \"gpt-5.5\" | \"gpt-5.6\";\n\nfunction extractGpt5Version(modelId: string): Gpt5Version | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"gpt-5.6\")) {\n\t\treturn \"gpt-5.6\";\n\t}\n\tif (normalized.includes(\"gpt-5.5\")) {\n\t\treturn \"gpt-5.5\";\n\t}\n\tif (normalized.includes(\"gpt-5.4\")) {\n\t\treturn \"gpt-5.4\";\n\t}\n\tif (normalized.includes(\"gpt-5.3\")) {\n\t\treturn \"gpt-5.3-codex\";\n\t}\n\tif (normalized.includes(\"gpt-5.2\")) {\n\t\treturn \"gpt-5.2\";\n\t}\n\treturn undefined;\n}\n\nfunction hasKimiK26Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK26Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK26Signal(model.id) || (model.name !== undefined && hasKimiK26Signal(model.name));\n}\n\nfunction hasKimiK27Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])kimi-k2(?:[._-]|p)7(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isKimiK27Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK27Signal(model.id) || (model.name !== undefined && hasKimiK27Signal(model.name));\n}\n\nfunction hasKimiK3Signal(value: string): boolean {\n\tconst normalized = normalizeModelId(value);\n\treturn normalized === \"k3\" || /(?:^|[/@._-])kimi-k3(?:$|[/@._:-])/.test(normalized);\n}\n\nfunction isKimiK3Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasKimiK3Signal(model.id) || (model.name !== undefined && hasKimiK3Signal(model.name));\n}\n\n// DeepSeek V4 id shapes verified against the OpenRouter live API, models.dev,\n// and senpi's generated provider catalogs (2026-07-31): deepseek-v4-flash,\n// deepseek/deepseek-v4-flash-0731, deepseek-ai/DeepSeek-V4-Pro,\n// accounts/fireworks/models/deepseek-v4-flash, aihubmix's alicloud-deepseek-v4-*,\n// and trailing tags (:free, -free, :thinking, -nothinking, -cheaper, -lightning, -el).\nfunction hasDeepseekV4Flash0731Signal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash[._-]0731(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4Flash0731Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn (\n\t\thasDeepseekV4Flash0731Signal(model.id) || (model.name !== undefined && hasDeepseekV4Flash0731Signal(model.name))\n\t);\n}\n\nfunction hasDeepseekV4FlashSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]flash(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4FlashModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4FlashSignal(model.id) || (model.name !== undefined && hasDeepseekV4FlashSignal(model.name));\n}\n\nfunction hasDeepseekV4ProSignal(value: string): boolean {\n\treturn /(?:^|[/@:._-])deepseek[._-]v4[._-]pro(?:$|[/@:._-])/.test(normalizeModelId(value));\n}\n\nfunction isDeepseekV4ProModel(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasDeepseekV4ProSignal(model.id) || (model.name !== undefined && hasDeepseekV4ProSignal(model.name));\n}\n\nfunction hasGlm52Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)2(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm52Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm52Signal(model.id) || (model.name !== undefined && hasGlm52Signal(model.name));\n}\n\nfunction hasGlm53Signal(value: string): boolean {\n\treturn /(?:^|[/@._-])glm(?:[._-]|p)5(?:[._-]|p)3(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGlm53Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGlm53Signal(model.id) || (model.name !== undefined && hasGlm53Signal(model.name));\n}\n\nfunction hasGrok45Signal(value: string): boolean {\n\t// Match any Grok 4.5 id shape: grok-4.5, grok4.5, grok45, grok-4p5, provider:model,\n\t// path/prefix ids, and trailing tags (:thinking, -latest). Keep 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?5(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok45Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok45Signal(model.id) || (model.name !== undefined && hasGrok45Signal(model.name));\n}\n\nfunction hasGrok46Signal(value: string): boolean {\n\t// Same id shapes as hasGrok45Signal with a 4.6 minor version. Keep 4.5 / 4.3 / 4.20 / 3 out.\n\treturn /(?:^|[/@:._-])grok(?:[._-]|p)?4(?:[._-]|p)?6(?:$|[/@._:-])/.test(normalizeModelId(value));\n}\n\nfunction isGrok46Model(model: ModelWithPromptPresetMetadata): boolean {\n\treturn hasGrok46Signal(model.id) || (model.name !== undefined && hasGrok46Signal(model.name));\n}\n\nfunction isClaudeFable51Model(modelId: string): boolean {\n\tconst normalized = normalizeModelId(modelId);\n\treturn normalized.includes(\"fable-5-1\") || normalized.includes(\"fable-5.1\");\n}\n\nfunction isClaudeFable5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"fable-5\");\n}\n\nfunction isClaudeOpus5Model(modelId: string): boolean {\n\treturn normalizeModelId(modelId).includes(\"opus-5\");\n}\n\ntype ClaudeOpusVersion = \"claude-opus-4-8\" | \"claude-opus-4-7\" | \"claude-opus-4-6\" | \"claude-opus-4-5\";\n\nfunction extractClaudeOpusVersion(modelId: string): ClaudeOpusVersion | undefined {\n\tconst normalized = normalizeModelId(modelId);\n\tif (normalized.includes(\"opus-4-8\")) {\n\t\treturn \"claude-opus-4-8\";\n\t}\n\tif (normalized.includes(\"opus-4-7\")) {\n\t\treturn \"claude-opus-4-7\";\n\t}\n\tif (normalized.includes(\"opus-4-6\")) {\n\t\treturn \"claude-opus-4-6\";\n\t}\n\tif (normalized.includes(\"opus-4-5\") || normalized.includes(\"opus-4.5\")) {\n\t\treturn \"claude-opus-4-5\";\n\t}\n\treturn undefined;\n}\n\nexport function resolvePresetName(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n): ResolvedPresetName | undefined {\n\tif (settings.promptPreset !== \"auto\") {\n\t\treturn settings.promptPreset;\n\t}\n\n\tconst modelPromptPreset = parsePromptPreset(model.promptPreset);\n\tif (modelPromptPreset && modelPromptPreset !== \"auto\") {\n\t\treturn modelPromptPreset;\n\t}\n\n\tconst gpt5Version = extractGpt5Version(model.id);\n\tif (gpt5Version) {\n\t\treturn gpt5Version;\n\t}\n\tif (isKimiK3Model(model)) {\n\t\treturn \"kimi-k3\";\n\t}\n\tif (isKimiK27Model(model)) {\n\t\treturn \"kimi-k2-7\";\n\t}\n\tif (isKimiK26Model(model)) {\n\t\treturn \"kimi-k2-6\";\n\t}\n\t// The dotted release must resolve before the generic fable-5 substring.\n\tif (isClaudeFable51Model(model.id)) {\n\t\treturn \"claude-fable-5-1\";\n\t}\n\tif (isClaudeFable5Model(model.id)) {\n\t\treturn \"claude-fable-5\";\n\t}\n\tif (isClaudeOpus5Model(model.id)) {\n\t\treturn \"claude-opus-5\";\n\t}\n\tconst claudeVersion = extractClaudeOpusVersion(model.id);\n\tif (claudeVersion) {\n\t\treturn claudeVersion;\n\t}\n\tif (isGlm53Model(model)) {\n\t\treturn \"glm-5.3\";\n\t}\n\tif (isGlm52Model(model)) {\n\t\treturn \"glm-5.2\";\n\t}\n\t// The dated snapshot must resolve before the generic flash alias.\n\tif (isDeepseekV4Flash0731Model(model)) {\n\t\treturn \"deepseek-v4-flash-0731\";\n\t}\n\tif (isDeepseekV4FlashModel(model)) {\n\t\treturn \"deepseek-v4-flash\";\n\t}\n\tif (isDeepseekV4ProModel(model)) {\n\t\treturn \"deepseek-v4-pro\";\n\t}\n\tif (isGrok46Model(model)) {\n\t\treturn \"grok-4.6\";\n\t}\n\tif (isGrok45Model(model)) {\n\t\treturn \"grok-4.5\";\n\t}\n\treturn undefined;\n}\n\nfunction buildPreset(name: ResolvedPresetName, options: BuildDynamicSystemPromptOptions): ResolvedPromptPreset {\n\tswitch (name) {\n\t\tcase \"gpt-5.6\":\n\t\t\treturn { name, prompt: buildGpt56Prompt(options) };\n\t\tcase \"gpt-5.5\":\n\t\t\treturn { name, prompt: buildGpt55Prompt(options) };\n\t\tcase \"gpt-5.4\":\n\t\t\treturn { name, prompt: buildGpt54Prompt(options) };\n\t\tcase \"gpt-5.3-codex\":\n\t\t\treturn { name, prompt: buildGpt53CodexPrompt(options) };\n\t\tcase \"gpt-5.2\":\n\t\t\treturn { name, prompt: buildGpt52Prompt(options) };\n\t\tcase \"gpt-5\":\n\t\t\treturn { name, prompt: buildGpt5Prompt(options) };\n\t\tcase \"glm-5.3\":\n\t\t\treturn { name, prompt: buildGlm53Prompt(options) };\n\t\tcase \"glm-5.2\":\n\t\t\treturn { name, prompt: buildGlm52Prompt(options) };\n\t\tcase \"deepseek-v4-flash\":\n\t\t\treturn { name, prompt: buildDeepseekV4FlashPrompt(options) };\n\t\tcase \"deepseek-v4-flash-0731\":\n\t\t\treturn { name, prompt: buildDeepseekV4Flash0731Prompt(options) };\n\t\tcase \"deepseek-v4-pro\":\n\t\t\treturn { name, prompt: buildDeepseekV4ProPrompt(options) };\n\t\tcase \"grok-4.6\":\n\t\t\treturn { name, prompt: buildGrok46Prompt(options) };\n\t\tcase \"grok-4.5\":\n\t\t\treturn { name, prompt: buildGrok45Prompt(options) };\n\t\tcase \"kimi-k3\":\n\t\t\treturn { name, prompt: buildKimiK3Prompt(options) };\n\t\tcase \"kimi-k2-7\":\n\t\t\treturn { name, prompt: buildKimiK27Prompt(options) };\n\t\tcase \"kimi-k2-6\":\n\t\t\treturn { name, prompt: buildKimiK26Prompt(options) };\n\t\tcase \"claude-fable-5-1\":\n\t\t\treturn { name, prompt: buildClaudeFable51Prompt(options) };\n\t\tcase \"claude-fable-5\":\n\t\t\treturn { name, prompt: buildClaudeFable5Prompt(options) };\n\t\tcase \"claude-opus-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus5Prompt(options) };\n\t\tcase \"claude-opus-4-8\":\n\t\t\treturn { name, prompt: buildClaudeOpus48Prompt(options) };\n\t\tcase \"claude-opus-4-7\":\n\t\t\treturn { name, prompt: buildClaudeOpus47Prompt(options) };\n\t\tcase \"claude-opus-4-6\":\n\t\t\treturn { name, prompt: buildClaudeOpus46Prompt(options) };\n\t\tcase \"claude-opus-4-5\":\n\t\t\treturn { name, prompt: buildClaudeOpus45Prompt(options) };\n\t}\n}\n\nfunction withDefaults(options: Partial<BuildDynamicSystemPromptOptions> = {}): BuildDynamicSystemPromptOptions {\n\treturn {\n\t\tcwd: options.cwd ?? \"\",\n\t\tselectedTools: options.selectedTools ?? [],\n\t\ttoolSnippets: options.toolSnippets ?? {},\n\t\tpromptGuidelines: options.promptGuidelines ?? [],\n\t\tcontextFiles: options.contextFiles ?? [],\n\t\tskills: options.skills ?? [],\n\t};\n}\n\nexport function resolvePreset(\n\tmodel: ModelWithPromptPresetMetadata,\n\tsettings: PromptPresetSettings,\n\toptions?: Partial<BuildDynamicSystemPromptOptions>,\n): ResolvedPromptPreset | undefined {\n\tconst name = resolvePresetName(model, settings);\n\tif (!name) {\n\t\treturn undefined;\n\t}\n\treturn buildPreset(name, withDefaults(options));\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { SettingsManager } from "../../../settings-manager.ts";
2
- export type PromptPresetName = "auto" | "claude-fable-5" | "claude-opus-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "deepseek-v4-flash" | "deepseek-v4-flash-0731" | "deepseek-v4-pro" | "glm-5.2" | "glm-5.3" | "grok-4.5" | "grok-4.6" | "kimi-k3" | "kimi-k2-7" | "kimi-k2-6" | "gpt-5" | "gpt-5.2" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.5" | "gpt-5.6";
2
+ export type PromptPresetName = "auto" | "claude-fable-5" | "claude-fable-5-1" | "claude-opus-5" | "claude-opus-4-8" | "claude-opus-4-7" | "claude-opus-4-6" | "claude-opus-4-5" | "deepseek-v4-flash" | "deepseek-v4-flash-0731" | "deepseek-v4-pro" | "glm-5.2" | "glm-5.3" | "grok-4.5" | "grok-4.6" | "kimi-k3" | "kimi-k2-7" | "kimi-k2-6" | "gpt-5" | "gpt-5.2" | "gpt-5.3-codex" | "gpt-5.4" | "gpt-5.5" | "gpt-5.6";
3
3
  export interface PromptPresetSettings {
4
4
  promptPreset: PromptPresetName;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,gBAAgB,GAChB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,iBAAiB,GACjB,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,GACX,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEb,MAAM,WAAW,oBAAoB;IACpC,YAAY,EAAE,gBAAgB,CAAC;CAC/B;AA8BD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAKzF;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAQ/F"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,iBAAiB,GACjB,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,WAAW,GACX,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEb,MAAM,WAAW,oBAAoB;IACpC,YAAY,EAAE,gBAAgB,CAAC;CAC/B;AA+BD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,SAAS,CAKzF;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAQ/F"}
@@ -1,6 +1,7 @@
1
1
  const VALID_PRESETS = new Set([
2
2
  "auto",
3
3
  "claude-fable-5",
4
+ "claude-fable-5-1",
4
5
  "claude-opus-5",
5
6
  "claude-opus-4-8",
6
7
  "claude-opus-4-7",
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAiCA,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAmB;IACpE,MAAM;IACN,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,wBAAwB;IACxB,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,WAAW;IACX,WAAW;IACX,OAAO;IACP,SAAS;IACT,eAAe;IACf,SAAS;IACT,SAAS;IACT,SAAS;CACT,CAAC,CAAC;AAEH,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IAC1D,IAAI,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,KAAyB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,eAAgC;IACxE,MAAM,cAAc,GAAG,eAAe,CAAC,iBAAiB,EAA8B,CAAC;IACvF,MAAM,eAAe,GAAG,eAAe,CAAC,kBAAkB,EAA8B,CAAC;IAEzF,OAAO;QACN,YAAY,EACX,iBAAiB,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,MAAM;KAC5G,CAAC;AACH,CAAC","sourcesContent":["import type { Settings, SettingsManager } from \"../../../settings-manager.ts\";\n\nexport type PromptPresetName =\n\t| \"auto\"\n\t| \"claude-fable-5\"\n\t| \"claude-opus-5\"\n\t| \"claude-opus-4-8\"\n\t| \"claude-opus-4-7\"\n\t| \"claude-opus-4-6\"\n\t| \"claude-opus-4-5\"\n\t| \"deepseek-v4-flash\"\n\t| \"deepseek-v4-flash-0731\"\n\t| \"deepseek-v4-pro\"\n\t| \"glm-5.2\"\n\t| \"glm-5.3\"\n\t| \"grok-4.5\"\n\t| \"grok-4.6\"\n\t| \"kimi-k3\"\n\t| \"kimi-k2-7\"\n\t| \"kimi-k2-6\"\n\t| \"gpt-5\"\n\t| \"gpt-5.2\"\n\t| \"gpt-5.3-codex\"\n\t| \"gpt-5.4\"\n\t| \"gpt-5.5\"\n\t| \"gpt-5.6\";\n\nexport interface PromptPresetSettings {\n\tpromptPreset: PromptPresetName;\n}\n\ntype SettingsWithPromptPreset = Settings & { promptPreset?: string };\n\nconst VALID_PRESETS: ReadonlySet<string> = new Set<PromptPresetName>([\n\t\"auto\",\n\t\"claude-fable-5\",\n\t\"claude-opus-5\",\n\t\"claude-opus-4-8\",\n\t\"claude-opus-4-7\",\n\t\"claude-opus-4-6\",\n\t\"claude-opus-4-5\",\n\t\"deepseek-v4-flash\",\n\t\"deepseek-v4-flash-0731\",\n\t\"deepseek-v4-pro\",\n\t\"glm-5.2\",\n\t\"glm-5.3\",\n\t\"grok-4.5\",\n\t\"grok-4.6\",\n\t\"kimi-k3\",\n\t\"kimi-k2-7\",\n\t\"kimi-k2-6\",\n\t\"gpt-5\",\n\t\"gpt-5.2\",\n\t\"gpt-5.3-codex\",\n\t\"gpt-5.4\",\n\t\"gpt-5.5\",\n\t\"gpt-5.6\",\n]);\n\nexport function parsePromptPreset(value: string | undefined): PromptPresetName | undefined {\n\tif (value && VALID_PRESETS.has(value)) {\n\t\treturn value as PromptPresetName;\n\t}\n\treturn undefined;\n}\n\nexport function loadPromptPresetSettings(settingsManager: SettingsManager): PromptPresetSettings {\n\tconst globalSettings = settingsManager.getGlobalSettings() as SettingsWithPromptPreset;\n\tconst projectSettings = settingsManager.getProjectSettings() as SettingsWithPromptPreset;\n\n\treturn {\n\t\tpromptPreset:\n\t\t\tparsePromptPreset(projectSettings.promptPreset) ?? parsePromptPreset(globalSettings.promptPreset) ?? \"auto\",\n\t};\n}\n"]}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/settings.ts"],"names":[],"mappings":"AAkCA,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAmB;IACpE,MAAM;IACN,gBAAgB;IAChB,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,wBAAwB;IACxB,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;IACT,WAAW;IACX,WAAW;IACX,OAAO;IACP,SAAS;IACT,eAAe;IACf,SAAS;IACT,SAAS;IACT,SAAS;CACT,CAAC,CAAC;AAEH,MAAM,UAAU,iBAAiB,CAAC,KAAyB;IAC1D,IAAI,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,KAAyB,CAAC;IAClC,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,eAAgC;IACxE,MAAM,cAAc,GAAG,eAAe,CAAC,iBAAiB,EAA8B,CAAC;IACvF,MAAM,eAAe,GAAG,eAAe,CAAC,kBAAkB,EAA8B,CAAC;IAEzF,OAAO;QACN,YAAY,EACX,iBAAiB,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,MAAM;KAC5G,CAAC;AACH,CAAC","sourcesContent":["import type { Settings, SettingsManager } from \"../../../settings-manager.ts\";\n\nexport type PromptPresetName =\n\t| \"auto\"\n\t| \"claude-fable-5\"\n\t| \"claude-fable-5-1\"\n\t| \"claude-opus-5\"\n\t| \"claude-opus-4-8\"\n\t| \"claude-opus-4-7\"\n\t| \"claude-opus-4-6\"\n\t| \"claude-opus-4-5\"\n\t| \"deepseek-v4-flash\"\n\t| \"deepseek-v4-flash-0731\"\n\t| \"deepseek-v4-pro\"\n\t| \"glm-5.2\"\n\t| \"glm-5.3\"\n\t| \"grok-4.5\"\n\t| \"grok-4.6\"\n\t| \"kimi-k3\"\n\t| \"kimi-k2-7\"\n\t| \"kimi-k2-6\"\n\t| \"gpt-5\"\n\t| \"gpt-5.2\"\n\t| \"gpt-5.3-codex\"\n\t| \"gpt-5.4\"\n\t| \"gpt-5.5\"\n\t| \"gpt-5.6\";\n\nexport interface PromptPresetSettings {\n\tpromptPreset: PromptPresetName;\n}\n\ntype SettingsWithPromptPreset = Settings & { promptPreset?: string };\n\nconst VALID_PRESETS: ReadonlySet<string> = new Set<PromptPresetName>([\n\t\"auto\",\n\t\"claude-fable-5\",\n\t\"claude-fable-5-1\",\n\t\"claude-opus-5\",\n\t\"claude-opus-4-8\",\n\t\"claude-opus-4-7\",\n\t\"claude-opus-4-6\",\n\t\"claude-opus-4-5\",\n\t\"deepseek-v4-flash\",\n\t\"deepseek-v4-flash-0731\",\n\t\"deepseek-v4-pro\",\n\t\"glm-5.2\",\n\t\"glm-5.3\",\n\t\"grok-4.5\",\n\t\"grok-4.6\",\n\t\"kimi-k3\",\n\t\"kimi-k2-7\",\n\t\"kimi-k2-6\",\n\t\"gpt-5\",\n\t\"gpt-5.2\",\n\t\"gpt-5.3-codex\",\n\t\"gpt-5.4\",\n\t\"gpt-5.5\",\n\t\"gpt-5.6\",\n]);\n\nexport function parsePromptPreset(value: string | undefined): PromptPresetName | undefined {\n\tif (value && VALID_PRESETS.has(value)) {\n\t\treturn value as PromptPresetName;\n\t}\n\treturn undefined;\n}\n\nexport function loadPromptPresetSettings(settingsManager: SettingsManager): PromptPresetSettings {\n\tconst globalSettings = settingsManager.getGlobalSettings() as SettingsWithPromptPreset;\n\tconst projectSettings = settingsManager.getProjectSettings() as SettingsWithPromptPreset;\n\n\treturn {\n\t\tpromptPreset:\n\t\t\tparsePromptPreset(projectSettings.promptPreset) ?? parsePromptPreset(globalSettings.promptPreset) ?? \"auto\",\n\t};\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { ExtensionAPI } from "../../types.ts";
2
- export declare const RECOMMENDED_DEFAULT_MODELS: readonly [readonly ["kimi-k3", "max"], readonly ["gpt-5.6-sol", "medium"], readonly ["claude-fable-5", "high"], readonly ["claude-opus-5", "xhigh"], readonly ["glm-5.2", "max"]];
2
+ export declare const RECOMMENDED_DEFAULT_MODELS: readonly [readonly ["kimi-k3", "max"], readonly ["gpt-5.6-sol", "medium"], readonly ["claude-fable-5-1", "high"], readonly ["claude-opus-5", "xhigh"], readonly ["glm-5.2", "max"]];
3
3
  export declare function canonicalModelId(modelId: string): string;
4
4
  export default function recommendedModelsExtension(pi: ExtensionAPI): void;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/recommended-models/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuC,MAAM,gBAAgB,CAAC;AAWxF,eAAO,MAAM,0BAA0B,mLAM6B,CAAC;AAWrE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAcxD;AAwCD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA6EzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/recommended-models/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuC,MAAM,gBAAgB,CAAC;AAWxF,eAAO,MAAM,0BAA0B,qLAM6B,CAAC;AAWrE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAcxD;AAwCD,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA6EzE"}
@@ -10,7 +10,7 @@ const MODEL_ID_SUFFIXES = ["-ultrafast", "-unlocked", "-256k", "-fast"];
10
10
  export const RECOMMENDED_DEFAULT_MODELS = [
11
11
  ["kimi-k3", "max"],
12
12
  ["gpt-5.6-sol", "medium"],
13
- ["claude-fable-5", "high"],
13
+ ["claude-fable-5-1", "high"],
14
14
  ["claude-opus-5", "xhigh"],
15
15
  ["glm-5.2", "max"],
16
16
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/recommended-models/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAC1C,yFAAyF;AACzF,qFAAqF;AACrF,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAA2D;IAChG,kBAAkB;IAClB,iBAAiB;CACjB,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAEjF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,CAAC,SAAS,EAAE,KAAK,CAAC;IAClB,CAAC,aAAa,EAAE,QAAQ,CAAC;IACzB,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC1B,CAAC,eAAe,EAAE,OAAO,CAAC;IAC1B,CAAC,SAAS,EAAE,KAAK,CAAC;CACiD,CAAC;AAIrE,MAAM,uBAAuB,GAAgC,0BAA0B,CAAC,GAAG,CAC1F,CAAC,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C;YAChB,OAAO;QACR,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE,CAAC;YAClD,mCAAmC,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport { SettingsManager } from \"../../../settings-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext, SessionStartEvent } from \"../../types.ts\";\n\nconst FLAG_NAME = \"no-recommended-models\";\n// Only implicit fallbacks auto-switch. A `settings` provenance means the user explicitly\n// configured a system default model, which must be respected rather than overridden.\nconst AUTO_SWITCH_PROVENANCE = new Set<NonNullable<SessionStartEvent[\"initialModelProvenance\"]>>([\n\t\"provider-default\",\n\t\"first-available\",\n]);\nconst MODEL_ID_SUFFIXES = [\"-ultrafast\", \"-unlocked\", \"-256k\", \"-fast\"] as const;\n\nexport const RECOMMENDED_DEFAULT_MODELS = [\n\t[\"kimi-k3\", \"max\"],\n\t[\"gpt-5.6-sol\", \"medium\"],\n\t[\"claude-fable-5\", \"high\"],\n\t[\"claude-opus-5\", \"xhigh\"],\n\t[\"glm-5.2\", \"max\"],\n] as const satisfies ReadonlyArray<readonly [string, ThinkingLevel]>;\n\ntype RecommendedModel = { modelId: string; thinkingLevel: ThinkingLevel };\n\nconst DEFAULT_RECOMMENDATIONS: readonly RecommendedModel[] = RECOMMENDED_DEFAULT_MODELS.map(\n\t([modelId, thinkingLevel]) => ({ modelId, thinkingLevel }),\n);\nconst DEFAULT_RECOMMENDATIONS_BY_MODEL_ID = new Map(\n\tDEFAULT_RECOMMENDATIONS.map((recommendation) => [recommendation.modelId, recommendation]),\n);\n\nexport function canonicalModelId(modelId: string): string {\n\tlet canonical = modelId.toLowerCase();\n\tlet strippedSuffix = true;\n\twhile (strippedSuffix) {\n\t\tstrippedSuffix = false;\n\t\tfor (const suffix of MODEL_ID_SUFFIXES) {\n\t\t\tif (canonical.endsWith(suffix)) {\n\t\t\t\tcanonical = canonical.slice(0, -suffix.length);\n\t\t\t\tstrippedSuffix = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn canonical === \"k3\" ? \"kimi-k3\" : canonical;\n}\n\nfunction recommendationsFor(configuredModelIds: string[] | undefined): readonly RecommendedModel[] {\n\tif (configuredModelIds === undefined) {\n\t\treturn DEFAULT_RECOMMENDATIONS;\n\t}\n\treturn configuredModelIds\n\t\t.map(canonicalModelId)\n\t\t.filter((modelId) => modelId.length > 0)\n\t\t.map(\n\t\t\t(modelId): RecommendedModel =>\n\t\t\t\tDEFAULT_RECOMMENDATIONS_BY_MODEL_ID.get(modelId) ?? { modelId, thinkingLevel: \"medium\" },\n\t\t);\n}\n\nfunction findAvailableRecommendation(\n\trecommendations: readonly RecommendedModel[],\n\tctx: ExtensionContext,\n): { recommendation: RecommendedModel; model: Model<Api> } | undefined {\n\tconst available = ctx.modelRegistry.getAvailable().filter((model) => ctx.modelRegistry.hasConfiguredAuth(model));\n\tfor (const recommendation of recommendations) {\n\t\tconst model = available.find((candidate) => canonicalModelId(candidate.id) === recommendation.modelId);\n\t\tif (model) {\n\t\t\treturn { recommendation, model };\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction isRecommended(model: Model<Api> | undefined, recommendations: readonly RecommendedModel[]): boolean {\n\treturn (\n\t\tmodel !== undefined &&\n\t\trecommendations.some((recommendation) => canonicalModelId(model.id) === recommendation.modelId)\n\t);\n}\n\nfunction nonRecommendedModelWarning(model: Model<Api> | undefined): string {\n\treturn `Non-recommended model '${model?.id ?? \"<none>\"}': odd behavior is the default state; a working session is the anomaly.`;\n}\n\nexport default function recommendedModelsExtension(pi: ExtensionAPI): void {\n\tpi.registerFlag(FLAG_NAME, {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable recommended model selection for this run.\",\n\t});\n\n\tlet initialized = false;\n\tlet disabled = false;\n\tlet disarmed = false;\n\tlet automaticSelection = false;\n\tlet warningShown = false;\n\tlet canAutoSwitch = false;\n\tlet recommendations: readonly RecommendedModel[] = DEFAULT_RECOMMENDATIONS;\n\n\tconst warnWhenNoRecommendationIsAvailable = (ctx: ExtensionContext): void => {\n\t\tif (warningShown || findAvailableRecommendation(recommendations, ctx)) {\n\t\t\treturn;\n\t\t}\n\t\twarningShown = true;\n\t\tctx.ui.notify(nonRecommendedModelWarning(ctx.model), \"warning\");\n\t};\n\n\tpi.on(\"session_start\", async (event, ctx) => {\n\t\tif (initialized) {\n\t\t\treturn;\n\t\t}\n\t\tinitialized = true;\n\n\t\tconst settingsManager = SettingsManager.create(ctx.cwd);\n\t\tdisabled = pi.getFlag(FLAG_NAME) === true || settingsManager.getWarnings().offRecommendedModel === true;\n\t\trecommendations = recommendationsFor(settingsManager.getRecommendedModels());\n\t\tcanAutoSwitch =\n\t\t\tctx.mode !== \"app-server\" &&\n\t\t\tevent.initialModelProvenance !== undefined &&\n\t\t\tAUTO_SWITCH_PROVENANCE.has(event.initialModelProvenance);\n\t\tif (disabled || !canAutoSwitch || isRecommended(ctx.model, recommendations)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst target = findAvailableRecommendation(recommendations, ctx);\n\t\tif (!target) {\n\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t\treturn;\n\t\t}\n\n\t\tconst persistAsDefault = ctx.mode === \"tui\";\n\t\tautomaticSelection = true;\n\t\ttry {\n\t\t\tconst switched = persistAsDefault ? await pi.setModel(target.model) : await pi.setSessionModel(target.model);\n\t\t\tif (!switched) {\n\t\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (persistAsDefault) {\n\t\t\t\tpi.setThinkingLevel(target.recommendation.thinkingLevel);\n\t\t\t} else {\n\t\t\t\tpi.setSessionThinkingLevel(target.recommendation.thinkingLevel);\n\t\t\t}\n\t\t\tctx.ui.notify(`Switched to recommended model '${target.model.id}'.`, \"info\");\n\t\t} finally {\n\t\t\tautomaticSelection = false;\n\t\t}\n\t});\n\n\tpi.on(\"model_select\", (event, ctx) => {\n\t\tif (!initialized || disabled || disarmed || automaticSelection || !canAutoSwitch) {\n\t\t\treturn;\n\t\t}\n\t\tif (event.source === \"set\" || event.source === \"cycle\") {\n\t\t\tdisarmed = true;\n\t\t\treturn;\n\t\t}\n\t\tif (!isRecommended(event.model, recommendations)) {\n\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t}\n\t});\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/recommended-models/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAC1C,yFAAyF;AACzF,qFAAqF;AACrF,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAA2D;IAChG,kBAAkB;IAClB,iBAAiB;CACjB,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAEjF,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,CAAC,SAAS,EAAE,KAAK,CAAC;IAClB,CAAC,aAAa,EAAE,QAAQ,CAAC;IACzB,CAAC,kBAAkB,EAAE,MAAM,CAAC;IAC5B,CAAC,eAAe,EAAE,OAAO,CAAC;IAC1B,CAAC,SAAS,EAAE,KAAK,CAAC;CACiD,CAAC;AAIrE,MAAM,uBAAuB,GAAgC,0BAA0B,CAAC,GAAG,CAC1F,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAC1D,CAAC;AACF,MAAM,mCAAmC,GAAG,IAAI,GAAG,CAClD,uBAAuB,CAAC,GAAG,CAAC,CAAC,cAAc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AAC","sourcesContent":["import type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport type { Api, Model } from \"@earendil-works/pi-ai\";\nimport { SettingsManager } from \"../../../settings-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext, SessionStartEvent } from \"../../types.ts\";\n\nconst FLAG_NAME = \"no-recommended-models\";\n// Only implicit fallbacks auto-switch. A `settings` provenance means the user explicitly\n// configured a system default model, which must be respected rather than overridden.\nconst AUTO_SWITCH_PROVENANCE = new Set<NonNullable<SessionStartEvent[\"initialModelProvenance\"]>>([\n\t\"provider-default\",\n\t\"first-available\",\n]);\nconst MODEL_ID_SUFFIXES = [\"-ultrafast\", \"-unlocked\", \"-256k\", \"-fast\"] as const;\n\nexport const RECOMMENDED_DEFAULT_MODELS = [\n\t[\"kimi-k3\", \"max\"],\n\t[\"gpt-5.6-sol\", \"medium\"],\n\t[\"claude-fable-5-1\", \"high\"],\n\t[\"claude-opus-5\", \"xhigh\"],\n\t[\"glm-5.2\", \"max\"],\n] as const satisfies ReadonlyArray<readonly [string, ThinkingLevel]>;\n\ntype RecommendedModel = { modelId: string; thinkingLevel: ThinkingLevel };\n\nconst DEFAULT_RECOMMENDATIONS: readonly RecommendedModel[] = RECOMMENDED_DEFAULT_MODELS.map(\n\t([modelId, thinkingLevel]) => ({ modelId, thinkingLevel }),\n);\nconst DEFAULT_RECOMMENDATIONS_BY_MODEL_ID = new Map(\n\tDEFAULT_RECOMMENDATIONS.map((recommendation) => [recommendation.modelId, recommendation]),\n);\n\nexport function canonicalModelId(modelId: string): string {\n\tlet canonical = modelId.toLowerCase();\n\tlet strippedSuffix = true;\n\twhile (strippedSuffix) {\n\t\tstrippedSuffix = false;\n\t\tfor (const suffix of MODEL_ID_SUFFIXES) {\n\t\t\tif (canonical.endsWith(suffix)) {\n\t\t\t\tcanonical = canonical.slice(0, -suffix.length);\n\t\t\t\tstrippedSuffix = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn canonical === \"k3\" ? \"kimi-k3\" : canonical;\n}\n\nfunction recommendationsFor(configuredModelIds: string[] | undefined): readonly RecommendedModel[] {\n\tif (configuredModelIds === undefined) {\n\t\treturn DEFAULT_RECOMMENDATIONS;\n\t}\n\treturn configuredModelIds\n\t\t.map(canonicalModelId)\n\t\t.filter((modelId) => modelId.length > 0)\n\t\t.map(\n\t\t\t(modelId): RecommendedModel =>\n\t\t\t\tDEFAULT_RECOMMENDATIONS_BY_MODEL_ID.get(modelId) ?? { modelId, thinkingLevel: \"medium\" },\n\t\t);\n}\n\nfunction findAvailableRecommendation(\n\trecommendations: readonly RecommendedModel[],\n\tctx: ExtensionContext,\n): { recommendation: RecommendedModel; model: Model<Api> } | undefined {\n\tconst available = ctx.modelRegistry.getAvailable().filter((model) => ctx.modelRegistry.hasConfiguredAuth(model));\n\tfor (const recommendation of recommendations) {\n\t\tconst model = available.find((candidate) => canonicalModelId(candidate.id) === recommendation.modelId);\n\t\tif (model) {\n\t\t\treturn { recommendation, model };\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction isRecommended(model: Model<Api> | undefined, recommendations: readonly RecommendedModel[]): boolean {\n\treturn (\n\t\tmodel !== undefined &&\n\t\trecommendations.some((recommendation) => canonicalModelId(model.id) === recommendation.modelId)\n\t);\n}\n\nfunction nonRecommendedModelWarning(model: Model<Api> | undefined): string {\n\treturn `Non-recommended model '${model?.id ?? \"<none>\"}': odd behavior is the default state; a working session is the anomaly.`;\n}\n\nexport default function recommendedModelsExtension(pi: ExtensionAPI): void {\n\tpi.registerFlag(FLAG_NAME, {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable recommended model selection for this run.\",\n\t});\n\n\tlet initialized = false;\n\tlet disabled = false;\n\tlet disarmed = false;\n\tlet automaticSelection = false;\n\tlet warningShown = false;\n\tlet canAutoSwitch = false;\n\tlet recommendations: readonly RecommendedModel[] = DEFAULT_RECOMMENDATIONS;\n\n\tconst warnWhenNoRecommendationIsAvailable = (ctx: ExtensionContext): void => {\n\t\tif (warningShown || findAvailableRecommendation(recommendations, ctx)) {\n\t\t\treturn;\n\t\t}\n\t\twarningShown = true;\n\t\tctx.ui.notify(nonRecommendedModelWarning(ctx.model), \"warning\");\n\t};\n\n\tpi.on(\"session_start\", async (event, ctx) => {\n\t\tif (initialized) {\n\t\t\treturn;\n\t\t}\n\t\tinitialized = true;\n\n\t\tconst settingsManager = SettingsManager.create(ctx.cwd);\n\t\tdisabled = pi.getFlag(FLAG_NAME) === true || settingsManager.getWarnings().offRecommendedModel === true;\n\t\trecommendations = recommendationsFor(settingsManager.getRecommendedModels());\n\t\tcanAutoSwitch =\n\t\t\tctx.mode !== \"app-server\" &&\n\t\t\tevent.initialModelProvenance !== undefined &&\n\t\t\tAUTO_SWITCH_PROVENANCE.has(event.initialModelProvenance);\n\t\tif (disabled || !canAutoSwitch || isRecommended(ctx.model, recommendations)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst target = findAvailableRecommendation(recommendations, ctx);\n\t\tif (!target) {\n\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t\treturn;\n\t\t}\n\n\t\tconst persistAsDefault = ctx.mode === \"tui\";\n\t\tautomaticSelection = true;\n\t\ttry {\n\t\t\tconst switched = persistAsDefault ? await pi.setModel(target.model) : await pi.setSessionModel(target.model);\n\t\t\tif (!switched) {\n\t\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (persistAsDefault) {\n\t\t\t\tpi.setThinkingLevel(target.recommendation.thinkingLevel);\n\t\t\t} else {\n\t\t\t\tpi.setSessionThinkingLevel(target.recommendation.thinkingLevel);\n\t\t\t}\n\t\t\tctx.ui.notify(`Switched to recommended model '${target.model.id}'.`, \"info\");\n\t\t} finally {\n\t\t\tautomaticSelection = false;\n\t\t}\n\t});\n\n\tpi.on(\"model_select\", (event, ctx) => {\n\t\tif (!initialized || disabled || disarmed || automaticSelection || !canAutoSwitch) {\n\t\t\treturn;\n\t\t}\n\t\tif (event.source === \"set\" || event.source === \"cycle\") {\n\t\t\tdisarmed = true;\n\t\t\treturn;\n\t\t}\n\t\tif (!isRecommended(event.model, recommendations)) {\n\t\t\twarnWhenNoRecommendationIsAvailable(ctx);\n\t\t}\n\t});\n}\n"]}
@@ -36,6 +36,17 @@ export declare class TerminalRuntimeSession {
36
36
  fullOutput(): string;
37
37
  snapshot(): TerminalScreenSnapshot;
38
38
  resizeScreen(cols: number, rows: number): void;
39
+ /**
40
+ * The screen is a best-effort projection; a rejected feed/resize must never
41
+ * become an unhandled rejection that kills the host process (#837), and
42
+ * `buffer` remains the source of truth for reads. The screen hands every
43
+ * caller coalesced into one queued operation the same memoized promise, so
44
+ * attach the rejection handler once per distinct promise - re-attaching per
45
+ * PTY chunk would grow promise reactions without bound while a replay is
46
+ * stalled behind a slow parser.
47
+ */
48
+ private lastScreenWrite;
49
+ private ownScreenWrite;
39
50
  dispose(): void;
40
51
  }
41
52
  //# sourceMappingURL=runtime-session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-session.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,sBAAsB,EAC3B,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,sBAAsB;IAClC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IACtE,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsC;IACtE,OAAO,CAAC,eAAe,CAA6B;gBAExC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB;IAsB5D,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,UAAU,IAAI,mBAAmB,GAAG,IAAI,CAE3C;IAED,kFAAkF;IAClF,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,MAAM;IAad,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAKvD,8EAA8E;IAC9E,SAAS,IAAI,SAAS;IAQtB,iFAAiF;IACjF,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,sBAAsB;IAIlC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9C,OAAO,IAAI,IAAI;CAMf"}
1
+ {"version":3,"file":"runtime-session.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,sBAAsB,EAC3B,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACrE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,qBAAa,sBAAsB;IAClC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IACtE,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsC;IACtE,OAAO,CAAC,eAAe,CAA6B;gBAExC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB;IAsB5D,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,UAAU,IAAI,mBAAmB,GAAG,IAAI,CAE3C;IAED,kFAAkF;IAClF,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,MAAM;IAad,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAKvD,8EAA8E;IAC9E,SAAS,IAAI,SAAS;IAQtB,iFAAiF;IACjF,UAAU,IAAI,MAAM;IAIpB,QAAQ,IAAI,sBAAsB;IAIlC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9C;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe,CAA8B;IAErD,OAAO,CAAC,cAAc;IAMtB,OAAO,IAAI,IAAI;CAMf"}
@@ -13,6 +13,16 @@ export class TerminalRuntimeSession {
13
13
  this.consumed = 0;
14
14
  this.outputListeners = new Set();
15
15
  this.unsubscribeData = null;
16
+ /**
17
+ * The screen is a best-effort projection; a rejected feed/resize must never
18
+ * become an unhandled rejection that kills the host process (#837), and
19
+ * `buffer` remains the source of truth for reads. The screen hands every
20
+ * caller coalesced into one queued operation the same memoized promise, so
21
+ * attach the rejection handler once per distinct promise - re-attaching per
22
+ * PTY chunk would grow promise reactions without bound while a replay is
23
+ * stalled behind a slow parser.
24
+ */
25
+ this.lastScreenWrite = null;
16
26
  this.command = command;
17
27
  this.screen = new TerminalScreen({
18
28
  cols: options.cols,
@@ -52,7 +62,7 @@ export class TerminalRuntimeSession {
52
62
  const text = this.decoder.decode(chunk, { stream: true });
53
63
  if (text.length === 0)
54
64
  return text;
55
- void this.screen.feed(text);
65
+ this.ownScreenWrite(this.screen.feed(text));
56
66
  this.buffer += text;
57
67
  if (this.buffer.length > MAX_SESSION_OUTPUT_CHARS) {
58
68
  const overflow = this.buffer.length - MAX_SESSION_OUTPUT_CHARS;
@@ -82,7 +92,13 @@ export class TerminalRuntimeSession {
82
92
  return this.screen.snapshot();
83
93
  }
84
94
  resizeScreen(cols, rows) {
85
- void this.screen.resize(cols, rows);
95
+ this.ownScreenWrite(this.screen.resize(cols, rows));
96
+ }
97
+ ownScreenWrite(written) {
98
+ if (written === this.lastScreenWrite)
99
+ return;
100
+ this.lastScreenWrite = written;
101
+ written.catch(() => { });
86
102
  }
87
103
  dispose() {
88
104
  this.unsubscribeData?.();
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-session.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EAEd,eAAe,GAGf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAW3E;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAWlC,YAAY,OAAe,EAAE,OAA+B;QAP3C,YAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,WAAM,GAAG,EAAE,CAAC;QACZ,iBAAY,GAAG,CAAC,CAAC;QACjB,aAAQ,GAAG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QAChC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;IACxC,CAAC;IAED,iFAAiF;IACjF,UAAU;QACT,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,YAAY,CAAC,IAAY,EAAE,IAAY;QACtC,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACN,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import {\n\tTerminalScreen,\n\ttype TerminalScreenSnapshot,\n\tTerminalSession,\n\ttype TerminalSessionExit,\n\ttype TerminalSessionOptions,\n} from \"@earendil-works/pi-pty\";\nimport { DEFAULT_SCROLLBACK, MAX_SESSION_OUTPUT_CHARS } from \"./shared.ts\";\n\nexport interface TerminalRuntimeOptions extends TerminalSessionOptions {\n\treadonly scrollback?: number;\n}\n\nexport interface DeltaRead {\n\treadonly text: string;\n\treadonly droppedChars: number;\n}\n\n/**\n * A live terminal session: a pi-pty {@link TerminalSession} plus an xterm screen model\n * and a bounded decoded-output buffer with a per-consumer read cursor. Reads are pure\n * non-blocking peeks; watchers subscribe through `onOutput` (the monitor path).\n */\nexport class TerminalRuntimeSession {\n\treadonly session: TerminalSession;\n\treadonly command: string;\n\tprivate readonly screen: TerminalScreen;\n\tprivate readonly decoder = new TextDecoder(\"utf-8\", { fatal: false });\n\tprivate buffer = \"\";\n\tprivate droppedChars = 0;\n\tprivate consumed = 0;\n\tprivate readonly outputListeners = new Set<(chunk: string) => void>();\n\tprivate unsubscribeData: (() => void) | null = null;\n\n\tconstructor(command: string, options: TerminalRuntimeOptions) {\n\t\tthis.command = command;\n\t\tthis.screen = new TerminalScreen({\n\t\t\tcols: options.cols,\n\t\t\trows: options.rows,\n\t\t\tscrollback: options.scrollback ?? DEFAULT_SCROLLBACK,\n\t\t});\n\t\tthis.session = new TerminalSession(options);\n\t\tthis.unsubscribeData = this.session.onData((chunk) => {\n\t\t\tconst text = this.ingest(chunk);\n\t\t\tif (text.length === 0) return;\n\t\t\tfor (const listener of this.outputListeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(text);\n\t\t\t\t} catch {\n\t\t\t\t\t// Output observers must not interfere with the session's ingest path.\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.session.start();\n\t}\n\n\tget backend(): string | null {\n\t\treturn this.session.backend;\n\t}\n\n\tget exited(): boolean {\n\t\treturn this.session.exited;\n\t}\n\n\tget exitResult(): TerminalSessionExit | null {\n\t\treturn this.session.exitResult;\n\t}\n\n\t/** Total decoded chars produced so far (including any dropped from the front). */\n\tget totalChars(): number {\n\t\treturn this.droppedChars + this.buffer.length;\n\t}\n\n\tprivate ingest(chunk: Uint8Array): string {\n\t\tconst text = this.decoder.decode(chunk, { stream: true });\n\t\tif (text.length === 0) return text;\n\t\tvoid this.screen.feed(text);\n\t\tthis.buffer += text;\n\t\tif (this.buffer.length > MAX_SESSION_OUTPUT_CHARS) {\n\t\t\tconst overflow = this.buffer.length - MAX_SESSION_OUTPUT_CHARS;\n\t\t\tthis.buffer = this.buffer.slice(overflow);\n\t\t\tthis.droppedChars += overflow;\n\t\t}\n\t\treturn text;\n\t}\n\n\t/** Subscribe to decoded output without affecting the read cursor. */\n\tonOutput(listener: (chunk: string) => void): () => void {\n\t\tthis.outputListeners.add(listener);\n\t\treturn () => this.outputListeners.delete(listener);\n\t}\n\n\t/** Return output produced since the last read and advance the read cursor. */\n\treadDelta(): DeltaRead {\n\t\tconst start = Math.max(this.consumed, this.droppedChars);\n\t\tconst dropped = Math.max(0, this.droppedChars - this.consumed);\n\t\tconst text = this.buffer.slice(start - this.droppedChars);\n\t\tthis.consumed = this.totalChars;\n\t\treturn { text, droppedChars: dropped };\n\t}\n\n\t/** Full retained decoded output (`view:\"log\"`), without advancing the cursor. */\n\tfullOutput(): string {\n\t\treturn this.buffer;\n\t}\n\n\tsnapshot(): TerminalScreenSnapshot {\n\t\treturn this.screen.snapshot();\n\t}\n\n\tresizeScreen(cols: number, rows: number): void {\n\t\tvoid this.screen.resize(cols, rows);\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeData?.();\n\t\tthis.unsubscribeData = null;\n\t\tthis.outputListeners.clear();\n\t\tthis.screen.dispose();\n\t}\n}\n"]}
1
+ {"version":3,"file":"runtime-session.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/runtime-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EAEd,eAAe,GAGf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAW3E;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAWlC,YAAY,OAAe,EAAE,OAA+B;QAP3C,YAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,WAAM,GAAG,EAAE,CAAC;QACZ,iBAAY,GAAG,CAAC,CAAC;QACjB,aAAQ,GAAG,CAAC,CAAC;QACJ,oBAAe,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC9D,oBAAe,GAAwB,IAAI,CAAC;QAkFpD;;;;;;;;WAQG;QACK,oBAAe,GAAyB,IAAI,CAAC;QAxFpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC;YAChC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,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AE,IAAY;QACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAaO,cAAc,CAAC,OAAsB;QAC5C,IAAI,OAAO,KAAK,IAAI,CAAC,eAAe;YAAE,OAAO;QAC7C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO;QACN,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["import {\n\tTerminalScreen,\n\ttype TerminalScreenSnapshot,\n\tTerminalSession,\n\ttype TerminalSessionExit,\n\ttype TerminalSessionOptions,\n} from \"@earendil-works/pi-pty\";\nimport { DEFAULT_SCROLLBACK, MAX_SESSION_OUTPUT_CHARS } from \"./shared.ts\";\n\nexport interface TerminalRuntimeOptions extends TerminalSessionOptions {\n\treadonly scrollback?: number;\n}\n\nexport interface DeltaRead {\n\treadonly text: string;\n\treadonly droppedChars: number;\n}\n\n/**\n * A live terminal session: a pi-pty {@link TerminalSession} plus an xterm screen model\n * and a bounded decoded-output buffer with a per-consumer read cursor. Reads are pure\n * non-blocking peeks; watchers subscribe through `onOutput` (the monitor path).\n */\nexport class TerminalRuntimeSession {\n\treadonly session: TerminalSession;\n\treadonly command: string;\n\tprivate readonly screen: TerminalScreen;\n\tprivate readonly decoder = new TextDecoder(\"utf-8\", { fatal: false });\n\tprivate buffer = \"\";\n\tprivate droppedChars = 0;\n\tprivate consumed = 0;\n\tprivate readonly outputListeners = new Set<(chunk: string) => void>();\n\tprivate unsubscribeData: (() => void) | null = null;\n\n\tconstructor(command: string, options: TerminalRuntimeOptions) {\n\t\tthis.command = command;\n\t\tthis.screen = new TerminalScreen({\n\t\t\tcols: options.cols,\n\t\t\trows: options.rows,\n\t\t\tscrollback: options.scrollback ?? DEFAULT_SCROLLBACK,\n\t\t});\n\t\tthis.session = new TerminalSession(options);\n\t\tthis.unsubscribeData = this.session.onData((chunk) => {\n\t\t\tconst text = this.ingest(chunk);\n\t\t\tif (text.length === 0) return;\n\t\t\tfor (const listener of this.outputListeners) {\n\t\t\t\ttry {\n\t\t\t\t\tlistener(text);\n\t\t\t\t} catch {\n\t\t\t\t\t// Output observers must not interfere with the session's ingest path.\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tthis.session.start();\n\t}\n\n\tget backend(): string | null {\n\t\treturn this.session.backend;\n\t}\n\n\tget exited(): boolean {\n\t\treturn this.session.exited;\n\t}\n\n\tget exitResult(): TerminalSessionExit | null {\n\t\treturn this.session.exitResult;\n\t}\n\n\t/** Total decoded chars produced so far (including any dropped from the front). */\n\tget totalChars(): number {\n\t\treturn this.droppedChars + this.buffer.length;\n\t}\n\n\tprivate ingest(chunk: Uint8Array): string {\n\t\tconst text = this.decoder.decode(chunk, { stream: true });\n\t\tif (text.length === 0) return text;\n\t\tthis.ownScreenWrite(this.screen.feed(text));\n\t\tthis.buffer += text;\n\t\tif (this.buffer.length > MAX_SESSION_OUTPUT_CHARS) {\n\t\t\tconst overflow = this.buffer.length - MAX_SESSION_OUTPUT_CHARS;\n\t\t\tthis.buffer = this.buffer.slice(overflow);\n\t\t\tthis.droppedChars += overflow;\n\t\t}\n\t\treturn text;\n\t}\n\n\t/** Subscribe to decoded output without affecting the read cursor. */\n\tonOutput(listener: (chunk: string) => void): () => void {\n\t\tthis.outputListeners.add(listener);\n\t\treturn () => this.outputListeners.delete(listener);\n\t}\n\n\t/** Return output produced since the last read and advance the read cursor. */\n\treadDelta(): DeltaRead {\n\t\tconst start = Math.max(this.consumed, this.droppedChars);\n\t\tconst dropped = Math.max(0, this.droppedChars - this.consumed);\n\t\tconst text = this.buffer.slice(start - this.droppedChars);\n\t\tthis.consumed = this.totalChars;\n\t\treturn { text, droppedChars: dropped };\n\t}\n\n\t/** Full retained decoded output (`view:\"log\"`), without advancing the cursor. */\n\tfullOutput(): string {\n\t\treturn this.buffer;\n\t}\n\n\tsnapshot(): TerminalScreenSnapshot {\n\t\treturn this.screen.snapshot();\n\t}\n\n\tresizeScreen(cols: number, rows: number): void {\n\t\tthis.ownScreenWrite(this.screen.resize(cols, rows));\n\t}\n\n\t/**\n\t * The screen is a best-effort projection; a rejected feed/resize must never\n\t * become an unhandled rejection that kills the host process (#837), and\n\t * `buffer` remains the source of truth for reads. The screen hands every\n\t * caller coalesced into one queued operation the same memoized promise, so\n\t * attach the rejection handler once per distinct promise - re-attaching per\n\t * PTY chunk would grow promise reactions without bound while a replay is\n\t * stalled behind a slow parser.\n\t */\n\tprivate lastScreenWrite: Promise<void> | null = null;\n\n\tprivate ownScreenWrite(written: Promise<void>): void {\n\t\tif (written === this.lastScreenWrite) return;\n\t\tthis.lastScreenWrite = written;\n\t\twritten.catch(() => {});\n\t}\n\n\tdispose(): void {\n\t\tthis.unsubscribeData?.();\n\t\tthis.unsubscribeData = null;\n\t\tthis.outputListeners.clear();\n\t\tthis.screen.dispose();\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,YAAY,EAAwC,MAAM,gBAAgB,CAAC;AAoDxG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA0N5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,YAAY,EAAwC,MAAM,gBAAgB,CAAC;AAoDxG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA8N5D"}
@@ -192,6 +192,10 @@ export default function ttsrExtension(pi) {
192
192
  }
193
193
  });
194
194
  pi.on("message_end", (event) => {
195
+ // A completed message ends its stream: nothing it buffered can match a
196
+ // later message's deltas, so drop the tail windows now instead of holding
197
+ // them until the next turn_start reset.
198
+ manager?.resetBuffers();
195
199
  if (genState.userCancelled)
196
200
  return undefined;
197
201
  if (event.message.role !== "assistant")