@code-yeongyu/senpi 2026.7.31 → 2026.8.3-3

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 (1411) hide show
  1. package/CHANGELOG.md +311 -0
  2. package/README.md +10 -0
  3. package/dist/cli/args.d.ts +2 -0
  4. package/dist/cli/args.d.ts.map +1 -1
  5. package/dist/cli/args.js +28 -0
  6. package/dist/cli/args.js.map +1 -1
  7. package/dist/cli/credential-print.d.ts +23 -0
  8. package/dist/cli/credential-print.d.ts.map +1 -0
  9. package/dist/cli/credential-print.js +116 -0
  10. package/dist/cli/credential-print.js.map +1 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.d.ts.map +1 -0
  13. package/dist/client/index.js +3 -0
  14. package/dist/client/index.js.map +1 -0
  15. package/dist/client/remote-session.d.ts +53 -0
  16. package/dist/client/remote-session.d.ts.map +1 -0
  17. package/dist/client/remote-session.js +340 -0
  18. package/dist/client/remote-session.js.map +1 -0
  19. package/dist/client/transcript.d.ts +12 -0
  20. package/dist/client/transcript.d.ts.map +1 -0
  21. package/dist/client/transcript.js +98 -0
  22. package/dist/client/transcript.js.map +1 -0
  23. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  24. package/dist/core/agent-session-runtime.js +3 -0
  25. package/dist/core/agent-session-runtime.js.map +1 -1
  26. package/dist/core/agent-session.d.ts +89 -14
  27. package/dist/core/agent-session.d.ts.map +1 -1
  28. package/dist/core/agent-session.js +554 -90
  29. package/dist/core/agent-session.js.map +1 -1
  30. package/dist/core/auth-storage.d.ts +5 -0
  31. package/dist/core/auth-storage.d.ts.map +1 -1
  32. package/dist/core/auth-storage.js +72 -11
  33. package/dist/core/auth-storage.js.map +1 -1
  34. package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
  35. package/dist/core/dynamic-prompt/build.js +4 -0
  36. package/dist/core/dynamic-prompt/build.js.map +1 -1
  37. package/dist/core/dynamic-prompt/verification.d.ts +2 -2
  38. package/dist/core/dynamic-prompt/verification.d.ts.map +1 -1
  39. package/dist/core/dynamic-prompt/verification.js +2 -2
  40. package/dist/core/dynamic-prompt/verification.js.map +1 -1
  41. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.d.ts +2 -2
  42. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.js +25 -25
  44. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.js.map +1 -1
  45. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.js.map +1 -1
  47. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.d.ts +1 -1
  48. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.d.ts.map +1 -1
  49. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.js +2 -2
  50. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.js.map +1 -1
  51. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.d.ts +9 -9
  52. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.d.ts.map +1 -1
  53. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.js +2 -2
  54. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.js.map +1 -1
  55. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.d.ts +1 -1
  56. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.js +3 -3
  58. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.js.map +1 -1
  59. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.d.ts +21 -0
  60. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.d.ts.map +1 -0
  61. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.js +30 -0
  62. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.js.map +1 -0
  63. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/auth-lane.d.ts +8 -4
  64. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -0
  65. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/auth-lane.js +34 -25
  66. package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -0
  67. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts +17 -0
  68. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts.map +1 -0
  69. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js +56 -0
  70. package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js.map +1 -0
  71. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.d.ts.map +1 -1
  72. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.js.map +1 -1
  73. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.d.ts.map +1 -1
  74. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.js.map +1 -1
  75. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.d.ts +1 -1
  76. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.d.ts.map +1 -1
  77. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.js +1 -1
  78. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.js.map +1 -1
  79. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.d.ts.map +1 -1
  80. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.js.map +1 -1
  81. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.d.ts.map +1 -1
  82. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.js +1 -1
  83. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.js.map +1 -1
  84. package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts +14 -0
  85. package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +1 -0
  86. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/guidance.js +37 -1
  87. package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +1 -0
  88. package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts +4 -0
  89. package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts.map +1 -0
  90. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/index.js +12 -10
  91. package/dist/core/extensions/builtin/claude-sdk-oauth/index.js.map +1 -0
  92. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.d.ts +3 -3
  93. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.d.ts.map +1 -1
  94. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.js +2 -2
  95. package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -0
  96. package/dist/core/extensions/builtin/claude-sdk-oauth/options.d.ts +18 -0
  97. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/options.d.ts.map +1 -1
  98. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/options.js +70 -10
  99. package/dist/core/extensions/builtin/claude-sdk-oauth/options.js.map +1 -0
  100. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.d.ts.map +1 -1
  101. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.js +32 -19
  102. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -0
  103. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/sdk-boundary.d.ts +2 -0
  104. package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts.map +1 -0
  105. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/sdk-boundary.js.map +1 -1
  106. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +32 -0
  107. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -0
  108. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +43 -0
  109. package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -0
  110. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts +18 -0
  111. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +1 -0
  112. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js +46 -0
  113. package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +1 -0
  114. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +81 -0
  115. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -0
  116. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +127 -0
  117. package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -0
  118. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts +10 -0
  119. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts.map +1 -0
  120. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js +34 -0
  121. package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js.map +1 -0
  122. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +56 -0
  123. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -0
  124. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +174 -0
  125. package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -0
  126. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts +24 -0
  127. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts.map +1 -0
  128. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js +34 -0
  129. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js.map +1 -0
  130. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +34 -0
  131. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -0
  132. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +85 -0
  133. package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -0
  134. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts +19 -0
  135. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -0
  136. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +176 -0
  137. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -0
  138. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.d.ts +18 -0
  139. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.d.ts.map +1 -0
  140. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.js +33 -0
  141. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.js.map +1 -0
  142. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts +3 -0
  143. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -0
  144. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +76 -0
  145. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -0
  146. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +87 -0
  147. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -0
  148. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +259 -0
  149. package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -0
  150. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts +19 -0
  151. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +1 -0
  152. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +192 -0
  153. package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -0
  154. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts +20 -0
  155. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -0
  156. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +132 -0
  157. package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -0
  158. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts +14 -0
  159. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts.map +1 -0
  160. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js +42 -0
  161. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js.map +1 -0
  162. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts +32 -0
  163. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts.map +1 -0
  164. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js +8 -0
  165. package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js.map +1 -0
  166. package/dist/core/extensions/builtin/claude-sdk-oauth/settings.d.ts +28 -0
  167. package/dist/core/extensions/builtin/claude-sdk-oauth/settings.d.ts.map +1 -0
  168. package/dist/core/extensions/builtin/claude-sdk-oauth/settings.js +107 -0
  169. package/dist/core/extensions/builtin/claude-sdk-oauth/settings.js.map +1 -0
  170. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts +16 -0
  171. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts.map +1 -0
  172. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js +92 -0
  173. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js.map +1 -0
  174. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts +2 -0
  175. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +1 -0
  176. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js +10 -0
  177. package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +1 -0
  178. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.d.ts.map +1 -1
  179. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.js.map +1 -1
  180. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream.d.ts +1 -1
  181. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -0
  182. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +208 -0
  183. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -0
  184. package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.d.ts +3 -0
  185. package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.d.ts.map +1 -0
  186. package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.js +25 -0
  187. package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.js.map +1 -0
  188. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.d.ts +1 -1
  189. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.d.ts.map +1 -1
  190. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.js +2 -2
  191. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.js.map +1 -1
  192. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tools.d.ts +1 -0
  193. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -0
  194. package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tools.js +1 -0
  195. package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -0
  196. package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts +18 -1
  197. package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts.map +1 -1
  198. package/dist/core/extensions/builtin/compaction/checkpoint-state.js +32 -0
  199. package/dist/core/extensions/builtin/compaction/checkpoint-state.js.map +1 -1
  200. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +18 -0
  201. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -0
  202. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +73 -0
  203. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -0
  204. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts +21 -0
  205. package/dist/core/extensions/builtin/compaction/idle-retry.d.ts.map +1 -0
  206. package/dist/core/extensions/builtin/compaction/idle-retry.js +24 -0
  207. package/dist/core/extensions/builtin/compaction/idle-retry.js.map +1 -0
  208. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  209. package/dist/core/extensions/builtin/compaction/index.js +119 -15
  210. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  211. package/dist/core/extensions/builtin/compaction/lane-policy.d.ts +71 -0
  212. package/dist/core/extensions/builtin/compaction/lane-policy.d.ts.map +1 -0
  213. package/dist/core/extensions/builtin/compaction/lane-policy.js +94 -0
  214. package/dist/core/extensions/builtin/compaction/lane-policy.js.map +1 -0
  215. package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
  216. package/dist/core/extensions/builtin/compaction/log.js +1 -0
  217. package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
  218. package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts +59 -0
  219. package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts.map +1 -0
  220. package/dist/core/extensions/builtin/compaction/overflow-retry.js +155 -0
  221. package/dist/core/extensions/builtin/compaction/overflow-retry.js.map +1 -0
  222. package/dist/core/extensions/builtin/compaction/speculative.d.ts +4 -1
  223. package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
  224. package/dist/core/extensions/builtin/compaction/speculative.js +39 -115
  225. package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
  226. package/dist/core/extensions/builtin/compaction/task-intent.d.ts +2 -6
  227. package/dist/core/extensions/builtin/compaction/task-intent.d.ts.map +1 -1
  228. package/dist/core/extensions/builtin/compaction/task-intent.js +10 -9
  229. package/dist/core/extensions/builtin/compaction/task-intent.js.map +1 -1
  230. package/dist/core/extensions/builtin/compaction/transient-failure.d.ts.map +1 -1
  231. package/dist/core/extensions/builtin/compaction/transient-failure.js +3 -0
  232. package/dist/core/extensions/builtin/compaction/transient-failure.js.map +1 -1
  233. package/dist/core/extensions/builtin/goal/continuation-recovery.d.ts +6 -0
  234. package/dist/core/extensions/builtin/goal/continuation-recovery.d.ts.map +1 -0
  235. package/dist/core/extensions/builtin/goal/continuation-recovery.js +20 -0
  236. package/dist/core/extensions/builtin/goal/continuation-recovery.js.map +1 -0
  237. package/dist/core/extensions/builtin/goal/continuation.d.ts +1 -2
  238. package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
  239. package/dist/core/extensions/builtin/goal/continuation.js +1 -6
  240. package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
  241. package/dist/core/extensions/builtin/goal/direct-input-lifecycle.d.ts +19 -0
  242. package/dist/core/extensions/builtin/goal/direct-input-lifecycle.d.ts.map +1 -0
  243. package/dist/core/extensions/builtin/goal/direct-input-lifecycle.js +48 -0
  244. package/dist/core/extensions/builtin/goal/direct-input-lifecycle.js.map +1 -0
  245. package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
  246. package/dist/core/extensions/builtin/goal/index.js +30 -15
  247. package/dist/core/extensions/builtin/goal/index.js.map +1 -1
  248. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
  249. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +12 -10
  250. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
  251. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts +7 -2
  252. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  253. package/dist/core/extensions/builtin/goal/monitor-continuation.js +96 -11
  254. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  255. package/dist/core/extensions/builtin/goal/persistence.d.ts +16 -0
  256. package/dist/core/extensions/builtin/goal/persistence.d.ts.map +1 -1
  257. package/dist/core/extensions/builtin/goal/persistence.js +185 -11
  258. package/dist/core/extensions/builtin/goal/persistence.js.map +1 -1
  259. package/dist/core/extensions/builtin/goal/ui.d.ts +1 -0
  260. package/dist/core/extensions/builtin/goal/ui.d.ts.map +1 -1
  261. package/dist/core/extensions/builtin/goal/ui.js +11 -2
  262. package/dist/core/extensions/builtin/goal/ui.js.map +1 -1
  263. package/dist/core/extensions/builtin/goal/wait-progress.d.ts +11 -0
  264. package/dist/core/extensions/builtin/goal/wait-progress.d.ts.map +1 -0
  265. package/dist/core/extensions/builtin/goal/wait-progress.js +30 -0
  266. package/dist/core/extensions/builtin/goal/wait-progress.js.map +1 -0
  267. package/dist/core/extensions/builtin/goal/wait-ticker.d.ts +38 -0
  268. package/dist/core/extensions/builtin/goal/wait-ticker.d.ts.map +1 -0
  269. package/dist/core/extensions/builtin/goal/wait-ticker.js +71 -0
  270. package/dist/core/extensions/builtin/goal/wait-ticker.js.map +1 -0
  271. package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts +1 -0
  272. package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts.map +1 -1
  273. package/dist/core/extensions/builtin/gpt-apply-patch/apply.js +13 -1
  274. package/dist/core/extensions/builtin/gpt-apply-patch/apply.js.map +1 -1
  275. package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -1
  276. package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +15 -0
  277. package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
  278. package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts +1 -1
  279. package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -1
  280. package/dist/core/extensions/builtin/gpt-apply-patch/index.js +1 -1
  281. package/dist/core/extensions/builtin/gpt-apply-patch/index.js.map +1 -1
  282. package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts +1 -0
  283. package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -1
  284. package/dist/core/extensions/builtin/gpt-apply-patch/tool.js +53 -8
  285. package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
  286. package/dist/core/extensions/builtin/index.d.ts.map +1 -1
  287. package/dist/core/extensions/builtin/index.js +5 -2
  288. package/dist/core/extensions/builtin/index.js.map +1 -1
  289. package/dist/core/extensions/builtin/loop-guard/detectors.d.ts +31 -0
  290. package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -0
  291. package/dist/core/extensions/builtin/loop-guard/detectors.js +152 -0
  292. package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -0
  293. package/dist/core/extensions/builtin/loop-guard/index.d.ts +3 -0
  294. package/dist/core/extensions/builtin/loop-guard/index.d.ts.map +1 -0
  295. package/dist/core/extensions/builtin/loop-guard/index.js +31 -0
  296. package/dist/core/extensions/builtin/loop-guard/index.js.map +1 -0
  297. package/dist/core/extensions/builtin/loop-guard/notice.d.ts +5 -0
  298. package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -0
  299. package/dist/core/extensions/builtin/loop-guard/notice.js +42 -0
  300. package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -0
  301. package/dist/core/extensions/builtin/loop-guard/policy.d.ts +30 -0
  302. package/dist/core/extensions/builtin/loop-guard/policy.d.ts.map +1 -0
  303. package/dist/core/extensions/builtin/loop-guard/policy.js +30 -0
  304. package/dist/core/extensions/builtin/loop-guard/policy.js.map +1 -0
  305. package/dist/core/extensions/builtin/loop-guard/renderer.d.ts +4 -0
  306. package/dist/core/extensions/builtin/loop-guard/renderer.d.ts.map +1 -0
  307. package/dist/core/extensions/builtin/loop-guard/renderer.js +50 -0
  308. package/dist/core/extensions/builtin/loop-guard/renderer.js.map +1 -0
  309. package/dist/core/extensions/builtin/loop-guard/similarity.d.ts +13 -0
  310. package/dist/core/extensions/builtin/loop-guard/similarity.d.ts.map +1 -0
  311. package/dist/core/extensions/builtin/loop-guard/similarity.js +51 -0
  312. package/dist/core/extensions/builtin/loop-guard/similarity.js.map +1 -0
  313. package/dist/core/extensions/builtin/loop-guard/tracker.d.ts +13 -0
  314. package/dist/core/extensions/builtin/loop-guard/tracker.d.ts.map +1 -0
  315. package/dist/core/extensions/builtin/loop-guard/tracker.js +39 -0
  316. package/dist/core/extensions/builtin/loop-guard/tracker.js.map +1 -0
  317. package/dist/core/extensions/builtin/mcp/health.d.ts.map +1 -1
  318. package/dist/core/extensions/builtin/mcp/health.js +2 -1
  319. package/dist/core/extensions/builtin/mcp/health.js.map +1 -1
  320. package/dist/core/extensions/builtin/monitor-state-event.d.ts +10 -0
  321. package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
  322. package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
  323. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.d.ts +3 -0
  324. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.d.ts.map +1 -0
  325. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.js +10 -0
  326. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.js.map +1 -0
  327. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.d.ts +3 -0
  328. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.d.ts.map +1 -0
  329. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.js +10 -0
  330. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.js.map +1 -0
  331. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.d.ts +3 -0
  332. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.d.ts.map +1 -0
  333. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.js +11 -0
  334. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.js.map +1 -0
  335. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.d.ts +13 -0
  336. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.d.ts.map +1 -0
  337. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.js +60 -0
  338. package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.js.map +1 -0
  339. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -1
  340. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  341. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +5 -3
  342. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  343. package/dist/core/extensions/builtin/prompt-preset/index.d.ts.map +1 -1
  344. package/dist/core/extensions/builtin/prompt-preset/index.js +8 -4
  345. package/dist/core/extensions/builtin/prompt-preset/index.js.map +1 -1
  346. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  347. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +8 -1
  348. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  349. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  350. package/dist/core/extensions/builtin/prompt-preset/presets.js +42 -0
  351. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  352. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
  353. package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
  354. package/dist/core/extensions/builtin/prompt-preset/settings.js +3 -0
  355. package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
  356. package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
  357. package/dist/core/extensions/builtin/recommended-models/index.js +2 -1
  358. package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
  359. package/dist/core/extensions/builtin/rules/config.d.ts +3 -0
  360. package/dist/core/extensions/builtin/rules/config.d.ts.map +1 -0
  361. package/dist/core/extensions/builtin/rules/config.js +24 -0
  362. package/dist/core/extensions/builtin/rules/config.js.map +1 -0
  363. package/dist/core/extensions/builtin/rules/index.d.ts.map +1 -1
  364. package/dist/core/extensions/builtin/rules/index.js +9 -6
  365. package/dist/core/extensions/builtin/rules/index.js.map +1 -1
  366. package/dist/core/extensions/builtin/rules/rules/constants.d.ts +11 -0
  367. package/dist/core/extensions/builtin/rules/rules/constants.d.ts.map +1 -1
  368. package/dist/core/extensions/builtin/rules/rules/constants.js +11 -0
  369. package/dist/core/extensions/builtin/rules/rules/constants.js.map +1 -1
  370. package/dist/core/extensions/builtin/rules/rules/formatter.d.ts.map +1 -1
  371. package/dist/core/extensions/builtin/rules/rules/formatter.js +33 -3
  372. package/dist/core/extensions/builtin/rules/rules/formatter.js.map +1 -1
  373. package/dist/core/extensions/builtin/rules/rules/types.d.ts +1 -1
  374. package/dist/core/extensions/builtin/rules/rules/types.js.map +1 -1
  375. package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
  376. package/dist/core/extensions/builtin/service-tier.js +25 -24
  377. package/dist/core/extensions/builtin/service-tier.js.map +1 -1
  378. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  379. package/dist/core/extensions/builtin/terminal/extension.js +21 -7
  380. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  381. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  382. package/dist/core/extensions/builtin/terminal/monitor-notify.js +42 -5
  383. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  384. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +2 -0
  385. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  386. package/dist/core/extensions/builtin/terminal/monitor-registry.js +2 -0
  387. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  388. package/dist/core/extensions/builtin/terminal/monitor-status-ticker.d.ts +37 -0
  389. package/dist/core/extensions/builtin/terminal/monitor-status-ticker.d.ts.map +1 -0
  390. package/dist/core/extensions/builtin/terminal/monitor-status-ticker.js +61 -0
  391. package/dist/core/extensions/builtin/terminal/monitor-status-ticker.js.map +1 -0
  392. package/dist/core/extensions/builtin/terminal/monitor-status.d.ts +9 -1
  393. package/dist/core/extensions/builtin/terminal/monitor-status.d.ts.map +1 -1
  394. package/dist/core/extensions/builtin/terminal/monitor-status.js +35 -2
  395. package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
  396. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +1 -1
  397. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  398. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  399. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  400. package/dist/core/extensions/builtin/terminal/tools/monitor.js +2 -1
  401. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  402. package/dist/core/extensions/builtin/todotools/commands.d.ts +2 -2
  403. package/dist/core/extensions/builtin/todotools/commands.d.ts.map +1 -1
  404. package/dist/core/extensions/builtin/todotools/commands.js.map +1 -1
  405. package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
  406. package/dist/core/extensions/builtin/todotools/index.js +6 -3
  407. package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
  408. package/dist/core/extensions/builtin/todotools/state.d.ts +1 -1
  409. package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
  410. package/dist/core/extensions/builtin/todotools/state.js +1 -1
  411. package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
  412. package/dist/core/extensions/builtin/todotools/todo-widget-component.d.ts +19 -0
  413. package/dist/core/extensions/builtin/todotools/todo-widget-component.d.ts.map +1 -0
  414. package/dist/core/extensions/builtin/todotools/todo-widget-component.js +78 -0
  415. package/dist/core/extensions/builtin/todotools/todo-widget-component.js.map +1 -0
  416. package/dist/core/extensions/builtin/todotools/todo-widget.d.ts +13 -1
  417. package/dist/core/extensions/builtin/todotools/todo-widget.d.ts.map +1 -1
  418. package/dist/core/extensions/builtin/todotools/todo-widget.js +32 -14
  419. package/dist/core/extensions/builtin/todotools/todo-widget.js.map +1 -1
  420. package/dist/core/extensions/builtin/todotools/tools/todo.d.ts +2 -2
  421. package/dist/core/extensions/builtin/todotools/tools/todo.d.ts.map +1 -1
  422. package/dist/core/extensions/builtin/todotools/tools/todo.js +1 -1
  423. package/dist/core/extensions/builtin/todotools/tools/todo.js.map +1 -1
  424. package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -1
  425. package/dist/core/extensions/builtin/tool-pair-guard/index.js +1 -1
  426. package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -1
  427. package/dist/core/extensions/builtin/tps.d.ts.map +1 -1
  428. package/dist/core/extensions/builtin/tps.js +5 -2
  429. package/dist/core/extensions/builtin/tps.js.map +1 -1
  430. package/dist/core/extensions/builtin/ttsr/builtin-rules.d.ts +4 -0
  431. package/dist/core/extensions/builtin/ttsr/builtin-rules.d.ts.map +1 -0
  432. package/dist/core/extensions/builtin/ttsr/builtin-rules.js +20 -0
  433. package/dist/core/extensions/builtin/ttsr/builtin-rules.js.map +1 -0
  434. package/dist/core/extensions/builtin/ttsr/commands.js +9 -1
  435. package/dist/core/extensions/builtin/ttsr/commands.js.map +1 -1
  436. package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
  437. package/dist/core/extensions/builtin/ttsr/index.js +4 -3
  438. package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
  439. package/dist/core/extensions/builtin/ttsr/manager.js +1 -1
  440. package/dist/core/extensions/builtin/ttsr/manager.js.map +1 -1
  441. package/dist/core/extensions/builtin/websearch/websearch/config.d.ts.map +1 -1
  442. package/dist/core/extensions/builtin/websearch/websearch/config.js +1 -0
  443. package/dist/core/extensions/builtin/websearch/websearch/config.js.map +1 -1
  444. package/dist/core/extensions/builtin/websearch/websearch/native.d.ts.map +1 -1
  445. package/dist/core/extensions/builtin/websearch/websearch/native.js +16 -5
  446. package/dist/core/extensions/builtin/websearch/websearch/native.js.map +1 -1
  447. package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.d.ts.map +1 -1
  448. package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.js +1 -0
  449. package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.js.map +1 -1
  450. package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.d.ts +4 -1
  451. package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.d.ts.map +1 -1
  452. package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.js +44 -37
  453. package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.js.map +1 -1
  454. package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.d.ts +3 -0
  455. package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.d.ts.map +1 -0
  456. package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.js +12 -0
  457. package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.js.map +1 -0
  458. package/dist/core/extensions/builtin/websearch/websearch/providers.d.ts.map +1 -1
  459. package/dist/core/extensions/builtin/websearch/websearch/providers.js +2 -0
  460. package/dist/core/extensions/builtin/websearch/websearch/providers.js.map +1 -1
  461. package/dist/core/extensions/builtin/websearch/websearch/renderers.d.ts.map +1 -1
  462. package/dist/core/extensions/builtin/websearch/websearch/renderers.js +3 -3
  463. package/dist/core/extensions/builtin/websearch/websearch/renderers.js.map +1 -1
  464. package/dist/core/extensions/builtin/websearch/websearch/search.d.ts.map +1 -1
  465. package/dist/core/extensions/builtin/websearch/websearch/search.js +1 -3
  466. package/dist/core/extensions/builtin/websearch/websearch/search.js.map +1 -1
  467. package/dist/core/extensions/builtin/websearch/websearch/tool.js +2 -2
  468. package/dist/core/extensions/builtin/websearch/websearch/tool.js.map +1 -1
  469. package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +1 -1
  470. package/dist/core/extensions/builtin/websearch/websearch/types.d.ts.map +1 -1
  471. package/dist/core/extensions/builtin/websearch/websearch/types.js.map +1 -1
  472. package/dist/core/extensions/index.d.ts +1 -1
  473. package/dist/core/extensions/index.d.ts.map +1 -1
  474. package/dist/core/extensions/index.js.map +1 -1
  475. package/dist/core/extensions/loader.d.ts.map +1 -1
  476. package/dist/core/extensions/loader.js +19 -18
  477. package/dist/core/extensions/loader.js.map +1 -1
  478. package/dist/core/extensions/runner.d.ts +5 -2
  479. package/dist/core/extensions/runner.d.ts.map +1 -1
  480. package/dist/core/extensions/runner.js +21 -1
  481. package/dist/core/extensions/runner.js.map +1 -1
  482. package/dist/core/extensions/types.d.ts +38 -2
  483. package/dist/core/extensions/types.d.ts.map +1 -1
  484. package/dist/core/extensions/types.js.map +1 -1
  485. package/dist/core/footer-data-provider.d.ts +10 -0
  486. package/dist/core/footer-data-provider.d.ts.map +1 -1
  487. package/dist/core/footer-data-provider.js +1 -1
  488. package/dist/core/footer-data-provider.js.map +1 -1
  489. package/dist/core/keybindings.d.ts +24 -0
  490. package/dist/core/keybindings.d.ts.map +1 -1
  491. package/dist/core/model-registry.d.ts +2 -1
  492. package/dist/core/model-registry.d.ts.map +1 -1
  493. package/dist/core/model-registry.js +3 -0
  494. package/dist/core/model-registry.js.map +1 -1
  495. package/dist/core/model-resolver.d.ts.map +1 -1
  496. package/dist/core/model-resolver.js +3 -2
  497. package/dist/core/model-resolver.js.map +1 -1
  498. package/dist/core/model-runtime.d.ts +2 -0
  499. package/dist/core/model-runtime.d.ts.map +1 -1
  500. package/dist/core/model-runtime.js +2 -2
  501. package/dist/core/model-runtime.js.map +1 -1
  502. package/dist/core/package-manager.d.ts +0 -1
  503. package/dist/core/package-manager.d.ts.map +1 -1
  504. package/dist/core/package-manager.js +18 -34
  505. package/dist/core/package-manager.js.map +1 -1
  506. package/dist/core/pi-manifest.d.ts +9 -0
  507. package/dist/core/pi-manifest.d.ts.map +1 -0
  508. package/dist/core/pi-manifest.js +25 -0
  509. package/dist/core/pi-manifest.js.map +1 -0
  510. package/dist/core/provider-composer.d.ts.map +1 -1
  511. package/dist/core/provider-composer.js +8 -3
  512. package/dist/core/provider-composer.js.map +1 -1
  513. package/dist/core/provider-display-names.d.ts.map +1 -1
  514. package/dist/core/provider-display-names.js +1 -0
  515. package/dist/core/provider-display-names.js.map +1 -1
  516. package/dist/core/resource-loader.d.ts +15 -0
  517. package/dist/core/resource-loader.d.ts.map +1 -1
  518. package/dist/core/resource-loader.js +55 -6
  519. package/dist/core/resource-loader.js.map +1 -1
  520. package/dist/core/retry-fallback/hint-policy.d.ts +29 -0
  521. package/dist/core/retry-fallback/hint-policy.d.ts.map +1 -0
  522. package/dist/core/retry-fallback/hint-policy.js +54 -0
  523. package/dist/core/retry-fallback/hint-policy.js.map +1 -0
  524. package/dist/core/retry-fallback/probe-scheduler.d.ts +60 -0
  525. package/dist/core/retry-fallback/probe-scheduler.d.ts.map +1 -0
  526. package/dist/core/retry-fallback/probe-scheduler.js +206 -0
  527. package/dist/core/retry-fallback/probe-scheduler.js.map +1 -0
  528. package/dist/core/retry-fallback/settings.d.ts +9 -0
  529. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  530. package/dist/core/retry-fallback/settings.js +14 -0
  531. package/dist/core/retry-fallback/settings.js.map +1 -1
  532. package/dist/core/session-log.js +1 -1
  533. package/dist/core/session-log.js.map +1 -1
  534. package/dist/core/settings-manager.d.ts +10 -1
  535. package/dist/core/settings-manager.d.ts.map +1 -1
  536. package/dist/core/settings-manager.js +21 -1
  537. package/dist/core/settings-manager.js.map +1 -1
  538. package/dist/core/thinking-levels.d.ts +5 -0
  539. package/dist/core/thinking-levels.d.ts.map +1 -1
  540. package/dist/core/thinking-levels.js +9 -39
  541. package/dist/core/thinking-levels.js.map +1 -1
  542. package/dist/extensions/llama/provider.js +1 -1
  543. package/dist/extensions/llama/provider.js.map +1 -1
  544. package/dist/index.d.ts +2 -2
  545. package/dist/index.d.ts.map +1 -1
  546. package/dist/index.js.map +1 -1
  547. package/dist/main.d.ts.map +1 -1
  548. package/dist/main.js +44 -0
  549. package/dist/main.js.map +1 -1
  550. package/dist/modes/app-server/server/account.d.ts +1 -1
  551. package/dist/modes/app-server/server/account.js +1 -1
  552. package/dist/modes/app-server/server/account.js.map +1 -1
  553. package/dist/modes/app-server/server/server-core.js +1 -1
  554. package/dist/modes/app-server/server/server-core.js.map +1 -1
  555. package/dist/modes/interactive/compaction-queue-transfer.d.ts +2 -0
  556. package/dist/modes/interactive/compaction-queue-transfer.d.ts.map +1 -1
  557. package/dist/modes/interactive/compaction-queue-transfer.js.map +1 -1
  558. package/dist/modes/interactive/components/assistant-message.d.ts +5 -2
  559. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  560. package/dist/modes/interactive/components/assistant-message.js +16 -4
  561. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  562. package/dist/modes/interactive/components/continuity-notice.d.ts +21 -0
  563. package/dist/modes/interactive/components/continuity-notice.d.ts.map +1 -0
  564. package/dist/modes/interactive/components/continuity-notice.js +58 -0
  565. package/dist/modes/interactive/components/continuity-notice.js.map +1 -0
  566. package/dist/modes/interactive/components/custom-editor.d.ts +5 -0
  567. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  568. package/dist/modes/interactive/components/custom-editor.js +22 -1
  569. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  570. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  571. package/dist/modes/interactive/components/footer.js +9 -5
  572. package/dist/modes/interactive/components/footer.js.map +1 -1
  573. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  574. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  575. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  576. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  577. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  578. package/dist/modes/interactive/components/model-selector.js +4 -1
  579. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  580. package/dist/modes/interactive/components/settings-selector.d.ts +6 -2
  581. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  582. package/dist/modes/interactive/components/settings-selector.js +20 -0
  583. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  584. package/dist/modes/interactive/components/user-message.d.ts +3 -1
  585. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  586. package/dist/modes/interactive/components/user-message.js +8 -2
  587. package/dist/modes/interactive/components/user-message.js.map +1 -1
  588. package/dist/modes/interactive/help-content.d.ts.map +1 -1
  589. package/dist/modes/interactive/help-content.js +1 -0
  590. package/dist/modes/interactive/help-content.js.map +1 -1
  591. package/dist/modes/interactive/interactive-mode.d.ts +21 -0
  592. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  593. package/dist/modes/interactive/interactive-mode.js +189 -62
  594. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  595. package/dist/modes/interactive/risky-main-model-warning.d.ts +1 -1
  596. package/dist/modes/interactive/risky-main-model-warning.d.ts.map +1 -1
  597. package/dist/modes/interactive/risky-main-model-warning.js +1 -1
  598. package/dist/modes/interactive/risky-main-model-warning.js.map +1 -1
  599. package/dist/modes/interactive/theme/dark.json +1 -0
  600. package/dist/modes/interactive/theme/grok-day.json +1 -0
  601. package/dist/modes/interactive/theme/grok-night.json +1 -0
  602. package/dist/modes/interactive/theme/light.json +1 -0
  603. package/dist/modes/interactive/theme/theme-schema.json +5 -1
  604. package/dist/modes/interactive/theme/theme.d.ts +2 -2
  605. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  606. package/dist/modes/interactive/theme/theme.js +13 -3
  607. package/dist/modes/interactive/theme/theme.js.map +1 -1
  608. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  609. package/dist/modes/rpc/connection-handler.js +16 -3
  610. package/dist/modes/rpc/connection-handler.js.map +1 -1
  611. package/dist/utils/clipboard.d.ts +1 -1
  612. package/dist/utils/clipboard.d.ts.map +1 -1
  613. package/dist/utils/clipboard.js +22 -2
  614. package/dist/utils/clipboard.js.map +1 -1
  615. package/docs/AGENTS.md +1 -6
  616. package/docs/custom-provider.md +10 -3
  617. package/docs/development.md +1 -2
  618. package/docs/extensions.md +34 -1
  619. package/docs/keybindings.md +13 -0
  620. package/docs/mcp.md +63 -4
  621. package/docs/models.md +1 -0
  622. package/docs/providers.md +60 -5
  623. package/docs/release-guide.md +7 -5
  624. package/docs/session-format.md +2 -0
  625. package/docs/settings.md +3 -1
  626. package/docs/skills.md +29 -0
  627. package/docs/themes.md +5 -3
  628. package/docs/usage.md +5 -0
  629. package/examples/extensions/custom-compaction.ts +1 -2
  630. package/examples/extensions/custom-provider-anthropic/index.ts +8 -2
  631. package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
  632. package/examples/extensions/handoff.ts +2 -3
  633. package/examples/extensions/overlay-test.ts +1 -1
  634. package/examples/extensions/qna.ts +2 -2
  635. package/examples/rpc-extension-ui.ts +11 -2
  636. package/examples/sdk/02-custom-model.ts +1 -2
  637. package/examples/sdk/12-full-control.ts +2 -0
  638. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +69 -0
  639. package/node_modules/@code-yeongyu/senpi-codemode/README.md +6 -3
  640. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  641. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status-ticker.ts +79 -0
  642. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status.ts +36 -3
  643. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +26 -12
  644. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +146 -0
  645. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +21 -119
  646. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +157 -0
  647. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +62 -208
  648. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-notification.ts +98 -0
  649. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-snapshot.ts +81 -0
  650. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-state.ts +24 -0
  651. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-eval-result.ts +140 -0
  652. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-notification-queue.ts +53 -0
  653. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-request.ts +45 -0
  654. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +45 -0
  655. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +20 -342
  656. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  657. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -0
  658. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  659. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +14 -3
  660. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  661. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +156 -67
  662. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  663. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts +3 -0
  664. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts.map +1 -0
  665. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js +70 -0
  666. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js.map +1 -0
  667. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +4 -0
  668. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
  669. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +22 -0
  670. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
  671. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts +13 -0
  672. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts.map +1 -0
  673. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js +304 -0
  674. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js.map +1 -0
  675. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts +17 -0
  676. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts.map +1 -0
  677. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js +60 -0
  678. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js.map +1 -0
  679. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts +6 -0
  680. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts.map +1 -0
  681. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js +107 -0
  682. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js.map +1 -0
  683. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts +28 -0
  684. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts.map +1 -0
  685. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js +61 -0
  686. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js.map +1 -0
  687. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts +8 -0
  688. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts.map +1 -0
  689. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js +22 -0
  690. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js.map +1 -0
  691. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +6 -10
  692. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
  693. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +154 -77
  694. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
  695. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +49 -23
  696. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
  697. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
  698. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +6 -6
  699. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  700. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +6 -6
  701. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  702. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
  703. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  704. package/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
  705. package/node_modules/@earendil-works/pi-ai/README.md +5 -2
  706. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  707. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +56 -25
  708. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  709. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts +3 -0
  710. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts.map +1 -0
  711. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js +134 -0
  712. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js.map +1 -0
  713. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  714. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +7 -3
  715. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  716. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  717. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +64 -4
  718. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  719. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  720. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +12 -2
  721. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  722. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
  723. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +13 -6
  724. package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
  725. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  726. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
  727. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  728. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  729. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +19 -10
  730. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  731. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.d.ts +24 -0
  732. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.d.ts.map +1 -0
  733. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.js +70 -0
  734. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.js.map +1 -0
  735. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +2 -16
  736. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  737. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +94 -105
  738. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  739. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  740. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +20 -11
  741. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  742. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts +1 -0
  743. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts.map +1 -1
  744. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js +7 -0
  745. package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js.map +1 -1
  746. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  747. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -1
  748. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  749. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  750. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +9 -5
  751. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  752. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +3 -2
  753. package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
  754. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
  755. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  756. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
  757. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
  758. package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
  759. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +3 -1
  760. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -1
  761. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +81 -26
  762. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -1
  763. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -0
  764. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  765. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +16 -8
  766. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  767. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  768. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
  769. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  770. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  771. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  772. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  773. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  774. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +2 -1
  775. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
  776. package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
  777. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +14 -0
  778. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  779. package/node_modules/@earendil-works/pi-ai/dist/models.js +96 -20
  780. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  781. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +2 -1
  782. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  783. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +3 -1
  784. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  785. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  786. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  787. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  788. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  789. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  790. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  791. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  792. package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  793. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  794. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  795. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  796. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  797. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  798. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  799. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  800. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  801. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  802. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  803. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  804. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  805. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +4 -1
  806. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  807. package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.d.ts +9 -0
  808. package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.d.ts.map +1 -0
  809. package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.js +142 -0
  810. package/node_modules/@earendil-works/pi-ai/dist/providers/ollama.js.map +1 -0
  811. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +1 -1
  812. package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
  813. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +19 -2
  814. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  815. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  816. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -1
  817. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +23 -4
  818. package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -1
  819. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  820. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +10 -1
  821. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  822. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +3 -0
  823. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
  824. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +13 -12
  825. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
  826. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts +24 -0
  827. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts.map +1 -0
  828. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js +233 -0
  829. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js.map +1 -0
  830. package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.d.ts +3 -0
  831. package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.d.ts.map +1 -0
  832. package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.js +36 -0
  833. package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.js.map +1 -0
  834. package/node_modules/@earendil-works/pi-ai/package.json +10 -6
  835. package/node_modules/@earendil-works/pi-pty/package.json +2 -2
  836. package/node_modules/@earendil-works/pi-tui/README.md +77 -14
  837. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts +83 -0
  838. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts.map +1 -0
  839. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js +687 -0
  840. package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js.map +1 -0
  841. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts +5 -0
  842. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts.map +1 -0
  843. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js +5 -0
  844. package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js.map +1 -0
  845. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts +13 -0
  846. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts.map +1 -0
  847. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js +36 -0
  848. package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js.map +1 -0
  849. package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
  850. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +5 -1
  851. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  852. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +7 -0
  853. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts.map +1 -0
  854. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js +43 -0
  855. package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js.map +1 -0
  856. package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
  857. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +4 -4
  858. package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
  859. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +2 -0
  860. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  861. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +3 -2
  862. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  863. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +51 -0
  864. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -0
  865. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +163 -0
  866. package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -0
  867. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  868. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +3 -6
  869. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  870. package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +32 -0
  871. package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts.map +1 -0
  872. package/node_modules/@earendil-works/pi-tui/dist/components/stack.js +109 -0
  873. package/node_modules/@earendil-works/pi-tui/dist/components/stack.js.map +1 -0
  874. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +8 -0
  875. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts.map +1 -0
  876. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js +21 -0
  877. package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js.map +1 -0
  878. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +10 -4
  879. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  880. package/node_modules/@earendil-works/pi-tui/dist/index.js +10 -4
  881. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  882. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +30 -0
  883. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  884. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +18 -0
  885. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  886. package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +40 -0
  887. package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts.map +1 -0
  888. package/node_modules/@earendil-works/pi-tui/dist/layout-node.js +6 -0
  889. package/node_modules/@earendil-works/pi-tui/dist/layout-node.js.map +1 -0
  890. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +40 -0
  891. package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -0
  892. package/node_modules/@earendil-works/pi-tui/dist/layout.js +315 -0
  893. package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -0
  894. package/node_modules/@earendil-works/pi-tui/dist/mux.js +1 -1
  895. package/node_modules/@earendil-works/pi-tui/dist/mux.js.map +1 -1
  896. package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.d.ts.map +1 -1
  897. package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js +36 -8
  898. package/node_modules/@earendil-works/pi-tui/dist/slash-command-autocomplete.js.map +1 -1
  899. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +10 -0
  900. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  901. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +61 -3
  902. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  903. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts +1 -0
  904. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts.map +1 -1
  905. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js +12 -2
  906. package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js.map +1 -1
  907. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +39 -16
  908. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  909. package/node_modules/@earendil-works/pi-tui/dist/tui.js +138 -54
  910. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  911. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +10 -0
  912. package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
  913. package/node_modules/@earendil-works/pi-tui/dist/utils.js +95 -4
  914. package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
  915. package/node_modules/@earendil-works/pi-tui/package.json +2 -2
  916. package/node_modules/typebox/build/compile/validator.d.mts +3 -11
  917. package/node_modules/typebox/build/compile/validator.mjs +6 -36
  918. package/node_modules/typebox/build/error/errors.d.mts +1 -7
  919. package/node_modules/typebox/build/format/_idna.mjs +36 -6
  920. package/node_modules/typebox/build/format/_puny.mjs +4 -1
  921. package/node_modules/typebox/build/format/uuid.d.mts +2 -2
  922. package/node_modules/typebox/build/format/uuid.mjs +3 -3
  923. package/node_modules/typebox/build/guard/emit.d.mts +0 -4
  924. package/node_modules/typebox/build/guard/emit.mjs +0 -8
  925. package/node_modules/typebox/build/guard/guard.d.mts +5 -9
  926. package/node_modules/typebox/build/guard/guard.mjs +10 -15
  927. package/node_modules/typebox/build/guard/string.mjs +16 -4
  928. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  929. package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
  930. package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
  931. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  932. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  933. package/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
  934. package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
  935. package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
  936. package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
  937. package/node_modules/typebox/build/schema/types/index.mjs +0 -1
  938. package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
  939. package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
  940. package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
  941. package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
  942. package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
  943. package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
  944. package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
  945. package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
  946. package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
  947. package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
  948. package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
  949. package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
  950. package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
  951. package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
  952. package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
  953. package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
  954. package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
  955. package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
  956. package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
  957. package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
  958. package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
  959. package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
  960. package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
  961. package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
  962. package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
  963. package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
  964. package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
  965. package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
  966. package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
  967. package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
  968. package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
  969. package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
  970. package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
  971. package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
  972. package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
  973. package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
  974. package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
  975. package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
  976. package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
  977. package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
  978. package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
  979. package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
  980. package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
  981. package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
  982. package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
  983. package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
  984. package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
  985. package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
  986. package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
  987. package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
  988. package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
  989. package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
  990. package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
  991. package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
  992. package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
  993. package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
  994. package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
  995. package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
  996. package/node_modules/typebox/build/type/action/index.d.mts +7 -4
  997. package/node_modules/typebox/build/type/action/index.mjs +7 -4
  998. package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
  999. package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
  1000. package/node_modules/typebox/build/type/action/module.d.mts +8 -7
  1001. package/node_modules/typebox/build/type/action/module.mjs +7 -6
  1002. package/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
  1003. package/node_modules/typebox/build/type/action/with.d.mts +11 -0
  1004. package/node_modules/typebox/build/type/action/with.mjs +11 -0
  1005. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
  1006. package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
  1007. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
  1008. package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
  1009. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
  1010. package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
  1011. package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
  1012. package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
  1013. package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
  1014. package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
  1015. package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
  1016. package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
  1017. package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
  1018. package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
  1019. package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
  1020. package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
  1021. package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
  1022. package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
  1023. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
  1024. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
  1025. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
  1026. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
  1027. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
  1028. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
  1029. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
  1030. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
  1031. package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
  1032. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
  1033. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
  1034. package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
  1035. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
  1036. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
  1037. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
  1038. package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
  1039. package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
  1040. package/node_modules/typebox/build/type/engine/index.mjs +2 -2
  1041. package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
  1042. package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
  1043. package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
  1044. package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
  1045. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
  1046. package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
  1047. package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
  1048. package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
  1049. package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
  1050. package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
  1051. package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
  1052. package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
  1053. package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
  1054. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
  1055. package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
  1056. package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
  1057. package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
  1058. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
  1059. package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
  1060. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
  1061. package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
  1062. package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
  1063. package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
  1064. package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
  1065. package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
  1066. package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
  1067. package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
  1068. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  1069. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
  1070. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
  1071. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
  1072. package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
  1073. package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
  1074. package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
  1075. package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
  1076. package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
  1077. package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
  1078. package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
  1079. package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
  1080. package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
  1081. package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
  1082. package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
  1083. package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
  1084. package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
  1085. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
  1086. package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
  1087. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
  1088. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
  1089. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
  1090. package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
  1091. package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
  1092. package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
  1093. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
  1094. package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
  1095. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
  1096. package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
  1097. package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
  1098. package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
  1099. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
  1100. package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
  1101. package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
  1102. package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
  1103. package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
  1104. package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
  1105. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
  1106. package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
  1107. package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
  1108. package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
  1109. package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
  1110. package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
  1111. package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
  1112. package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
  1113. package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
  1114. package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
  1115. package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
  1116. package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
  1117. package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
  1118. package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
  1119. package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
  1120. package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
  1121. package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
  1122. package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
  1123. package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
  1124. package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
  1125. package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
  1126. package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
  1127. package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
  1128. package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
  1129. package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
  1130. package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
  1131. package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
  1132. package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
  1133. package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
  1134. package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
  1135. package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
  1136. package/node_modules/typebox/build/type/extends/object.mjs +25 -3
  1137. package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
  1138. package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
  1139. package/node_modules/typebox/build/type/extends/record.mjs +23 -0
  1140. package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
  1141. package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
  1142. package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
  1143. package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
  1144. package/node_modules/typebox/build/type/extends/union.mjs +2 -2
  1145. package/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
  1146. package/node_modules/typebox/build/type/script/mapping.mjs +95 -92
  1147. package/node_modules/typebox/build/type/script/parser.d.mts +42 -40
  1148. package/node_modules/typebox/build/type/script/parser.mjs +23 -22
  1149. package/node_modules/typebox/build/type/script/script.d.mts +3 -4
  1150. package/node_modules/typebox/build/type/script/script.mjs +3 -2
  1151. package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
  1152. package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
  1153. package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
  1154. package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
  1155. package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
  1156. package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
  1157. package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
  1158. package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
  1159. package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
  1160. package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
  1161. package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
  1162. package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
  1163. package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
  1164. package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
  1165. package/node_modules/typebox/build/type/types/call.d.mts +3 -3
  1166. package/node_modules/typebox/build/type/types/call.mjs +3 -2
  1167. package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
  1168. package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
  1169. package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
  1170. package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
  1171. package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
  1172. package/node_modules/typebox/build/type/types/enum.mjs +5 -0
  1173. package/node_modules/typebox/build/type/types/index.d.mts +1 -4
  1174. package/node_modules/typebox/build/type/types/index.mjs +1 -4
  1175. package/node_modules/typebox/build/type/types/number.d.mts +1 -1
  1176. package/node_modules/typebox/build/type/types/number.mjs +1 -1
  1177. package/node_modules/typebox/build/type/types/record.d.mts +13 -7
  1178. package/node_modules/typebox/build/type/types/record.mjs +15 -9
  1179. package/node_modules/typebox/build/type/types/static.d.mts +2 -5
  1180. package/node_modules/typebox/build/typebox.d.mts +3 -7
  1181. package/node_modules/typebox/build/typebox.mjs +3 -7
  1182. package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
  1183. package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
  1184. package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
  1185. package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
  1186. package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
  1187. package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
  1188. package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
  1189. package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
  1190. package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
  1191. package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
  1192. package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
  1193. package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
  1194. package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
  1195. package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
  1196. package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
  1197. package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
  1198. package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
  1199. package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
  1200. package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
  1201. package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
  1202. package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
  1203. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  1204. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  1205. package/node_modules/typebox/build/value/index.d.mts +0 -1
  1206. package/node_modules/typebox/build/value/index.mjs +0 -1
  1207. package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
  1208. package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
  1209. package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
  1210. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
  1211. package/node_modules/typebox/build/value/value.d.mts +0 -1
  1212. package/node_modules/typebox/build/value/value.mjs +0 -1
  1213. package/node_modules/typebox/package.json +33 -33
  1214. package/node_modules/typebox/readme.md +117 -103
  1215. package/package.json +16 -11
  1216. package/vendor/pi-client/client.d.ts +25 -0
  1217. package/vendor/pi-client/client.d.ts.map +1 -0
  1218. package/vendor/pi-client/client.js +386 -0
  1219. package/vendor/pi-client/client.js.map +1 -0
  1220. package/vendor/pi-client/connection.d.ts +25 -0
  1221. package/vendor/pi-client/connection.d.ts.map +1 -0
  1222. package/vendor/pi-client/connection.js +204 -0
  1223. package/vendor/pi-client/connection.js.map +1 -0
  1224. package/vendor/pi-client/errors.d.ts +23 -0
  1225. package/vendor/pi-client/errors.d.ts.map +1 -0
  1226. package/vendor/pi-client/errors.js +42 -0
  1227. package/vendor/pi-client/errors.js.map +1 -0
  1228. package/vendor/pi-client/index.d.ts +6 -0
  1229. package/vendor/pi-client/index.d.ts.map +1 -0
  1230. package/vendor/pi-client/index.js +3 -0
  1231. package/vendor/pi-client/index.js.map +1 -0
  1232. package/vendor/pi-client/promise.d.ts +8 -0
  1233. package/vendor/pi-client/promise.d.ts.map +1 -0
  1234. package/vendor/pi-client/promise.js +11 -0
  1235. package/vendor/pi-client/promise.js.map +1 -0
  1236. package/vendor/pi-client/session-handle.d.ts +54 -0
  1237. package/vendor/pi-client/session-handle.d.ts.map +1 -0
  1238. package/vendor/pi-client/session-handle.js +50 -0
  1239. package/vendor/pi-client/session-handle.js.map +1 -0
  1240. package/vendor/pi-client/state.d.ts +22 -0
  1241. package/vendor/pi-client/state.d.ts.map +1 -0
  1242. package/vendor/pi-client/state.js +149 -0
  1243. package/vendor/pi-client/state.js.map +1 -0
  1244. package/vendor/pi-client/transport.d.ts +17 -0
  1245. package/vendor/pi-client/transport.d.ts.map +1 -0
  1246. package/vendor/pi-client/transport.js +2 -0
  1247. package/vendor/pi-client/transport.js.map +1 -0
  1248. package/vendor/pi-client/types.d.ts +23 -0
  1249. package/vendor/pi-client/types.d.ts.map +1 -0
  1250. package/vendor/pi-client/types.js +2 -0
  1251. package/vendor/pi-client/types.js.map +1 -0
  1252. package/vendor/pi-client/unix.d.ts +8 -0
  1253. package/vendor/pi-client/unix.d.ts.map +1 -0
  1254. package/vendor/pi-client/unix.js +151 -0
  1255. package/vendor/pi-client/unix.js.map +1 -0
  1256. package/vendor/pi-protocol/cbor/decoder.d.ts +4 -0
  1257. package/vendor/pi-protocol/cbor/decoder.d.ts.map +1 -0
  1258. package/vendor/pi-protocol/cbor/decoder.js +163 -0
  1259. package/vendor/pi-protocol/cbor/decoder.js.map +1 -0
  1260. package/vendor/pi-protocol/cbor/encoder.d.ts +4 -0
  1261. package/vendor/pi-protocol/cbor/encoder.d.ts.map +1 -0
  1262. package/vendor/pi-protocol/cbor/encoder.js +199 -0
  1263. package/vendor/pi-protocol/cbor/encoder.js.map +1 -0
  1264. package/vendor/pi-protocol/cbor/index.d.ts +4 -0
  1265. package/vendor/pi-protocol/cbor/index.d.ts.map +1 -0
  1266. package/vendor/pi-protocol/cbor/index.js +4 -0
  1267. package/vendor/pi-protocol/cbor/index.js.map +1 -0
  1268. package/vendor/pi-protocol/cbor/options.d.ts +26 -0
  1269. package/vendor/pi-protocol/cbor/options.d.ts.map +1 -0
  1270. package/vendor/pi-protocol/cbor/options.js +29 -0
  1271. package/vendor/pi-protocol/cbor/options.js.map +1 -0
  1272. package/vendor/pi-protocol/codec.d.ts +29 -0
  1273. package/vendor/pi-protocol/codec.d.ts.map +1 -0
  1274. package/vendor/pi-protocol/codec.js +140 -0
  1275. package/vendor/pi-protocol/codec.js.map +1 -0
  1276. package/vendor/pi-protocol/framing.d.ts +29 -0
  1277. package/vendor/pi-protocol/framing.d.ts.map +1 -0
  1278. package/vendor/pi-protocol/framing.js +152 -0
  1279. package/vendor/pi-protocol/framing.js.map +1 -0
  1280. package/vendor/pi-protocol/index.d.ts +5 -0
  1281. package/vendor/pi-protocol/index.d.ts.map +1 -0
  1282. package/vendor/pi-protocol/index.js +5 -0
  1283. package/vendor/pi-protocol/index.js.map +1 -0
  1284. package/vendor/pi-protocol/schemas.d.ts +13818 -0
  1285. package/vendor/pi-protocol/schemas.d.ts.map +1 -0
  1286. package/vendor/pi-protocol/schemas.js +382 -0
  1287. package/vendor/pi-protocol/schemas.js.map +1 -0
  1288. package/dist/core/extensions/builtin/claude-agent-sdk/auth-lane.d.ts.map +0 -1
  1289. package/dist/core/extensions/builtin/claude-agent-sdk/auth-lane.js.map +0 -1
  1290. package/dist/core/extensions/builtin/claude-agent-sdk/guidance.d.ts +0 -6
  1291. package/dist/core/extensions/builtin/claude-agent-sdk/guidance.d.ts.map +0 -1
  1292. package/dist/core/extensions/builtin/claude-agent-sdk/guidance.js.map +0 -1
  1293. package/dist/core/extensions/builtin/claude-agent-sdk/index.d.ts +0 -4
  1294. package/dist/core/extensions/builtin/claude-agent-sdk/index.d.ts.map +0 -1
  1295. package/dist/core/extensions/builtin/claude-agent-sdk/index.js.map +0 -1
  1296. package/dist/core/extensions/builtin/claude-agent-sdk/oauth-login.js.map +0 -1
  1297. package/dist/core/extensions/builtin/claude-agent-sdk/options.d.ts +0 -16
  1298. package/dist/core/extensions/builtin/claude-agent-sdk/options.js.map +0 -1
  1299. package/dist/core/extensions/builtin/claude-agent-sdk/prompt-bridge.js.map +0 -1
  1300. package/dist/core/extensions/builtin/claude-agent-sdk/sdk-boundary.d.ts.map +0 -1
  1301. package/dist/core/extensions/builtin/claude-agent-sdk/settings.d.ts +0 -15
  1302. package/dist/core/extensions/builtin/claude-agent-sdk/settings.d.ts.map +0 -1
  1303. package/dist/core/extensions/builtin/claude-agent-sdk/settings.js +0 -41
  1304. package/dist/core/extensions/builtin/claude-agent-sdk/settings.js.map +0 -1
  1305. package/dist/core/extensions/builtin/claude-agent-sdk/stream.d.ts.map +0 -1
  1306. package/dist/core/extensions/builtin/claude-agent-sdk/stream.js +0 -229
  1307. package/dist/core/extensions/builtin/claude-agent-sdk/stream.js.map +0 -1
  1308. package/dist/core/extensions/builtin/claude-agent-sdk/tools.d.ts.map +0 -1
  1309. package/dist/core/extensions/builtin/claude-agent-sdk/tools.js.map +0 -1
  1310. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts +0 -3
  1311. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts.map +0 -1
  1312. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js +0 -75
  1313. package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js.map +0 -1
  1314. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +0 -26
  1315. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +0 -1
  1316. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -100
  1317. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +0 -1
  1318. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +0 -42
  1319. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +0 -1
  1320. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -286
  1321. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +0 -1
  1322. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +0 -18
  1323. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +0 -1
  1324. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -44
  1325. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +0 -1
  1326. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +0 -33
  1327. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +0 -1
  1328. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -163
  1329. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +0 -1
  1330. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +0 -11
  1331. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +0 -1
  1332. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -39
  1333. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +0 -1
  1334. package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
  1335. package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
  1336. package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
  1337. package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
  1338. package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
  1339. package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
  1340. package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
  1341. package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
  1342. package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
  1343. package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
  1344. package/node_modules/typebox/build/type/action/options.d.mts +0 -11
  1345. package/node_modules/typebox/build/type/action/options.mjs +0 -11
  1346. package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
  1347. package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
  1348. package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
  1349. package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
  1350. package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
  1351. package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
  1352. package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
  1353. package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
  1354. package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
  1355. package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
  1356. package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
  1357. package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
  1358. package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
  1359. package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
  1360. package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
  1361. package/node_modules/typebox/build/type/types/base.d.mts +0 -50
  1362. package/node_modules/typebox/build/type/types/base.mjs +0 -84
  1363. package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
  1364. package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
  1365. package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
  1366. package/node_modules/typebox/build/type/types/promise.mjs +0 -29
  1367. package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
  1368. package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
  1369. package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
  1370. package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
  1371. package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
  1372. package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
  1373. package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
  1374. package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
  1375. package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
  1376. package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
  1377. package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
  1378. package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
  1379. package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
  1380. package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
  1381. package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
  1382. package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
  1383. package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
  1384. package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
  1385. package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
  1386. package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
  1387. package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
  1388. package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
  1389. package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
  1390. package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
  1391. package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
  1392. package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
  1393. package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
  1394. package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
  1395. package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
  1396. package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
  1397. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.d.ts +0 -0
  1398. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.js +0 -0
  1399. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.d.ts +0 -0
  1400. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.js +0 -0
  1401. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.d.ts +0 -0
  1402. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.js +0 -0
  1403. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.d.ts +0 -0
  1404. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.js +0 -0
  1405. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.d.ts +0 -0
  1406. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.d.ts +0 -0
  1407. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/sdk-boundary.js +0 -0
  1408. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.d.ts +0 -0
  1409. /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.js +0 -0
  1410. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
  1411. /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
@@ -0,0 +1,3 @@
1
+ import type { PiRulesConfig } from "./rules/types.ts";
2
+ export declare function configFromEnvironment(env?: NodeJS.ProcessEnv): PiRulesConfig;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/rules/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,aAAa,CAOzF"}
@@ -0,0 +1,24 @@
1
+ import { defaultConfig } from "./rules/engine.js";
2
+ const TRUTHY_VALUES = new Set(["1", "true", "yes", "on"]);
3
+ export function configFromEnvironment(env = process.env) {
4
+ const config = defaultConfig();
5
+ const disabled = readEnv(env, "PI_RULES_DISABLED");
6
+ config.disabled = disabled !== undefined && TRUTHY_VALUES.has(disabled.trim().toLowerCase());
7
+ config.maxRuleChars = parsePositiveInteger(readEnv(env, "PI_RULES_MAX_RULE_CHARS")) ?? config.maxRuleChars;
8
+ config.maxResultChars = parsePositiveInteger(readEnv(env, "PI_RULES_MAX_RESULT_CHARS")) ?? config.maxResultChars;
9
+ return config;
10
+ }
11
+ function readEnv(env, name) {
12
+ const value = env[name];
13
+ return typeof value === "string" && value.trim().length > 0 ? value : undefined;
14
+ }
15
+ function parsePositiveInteger(value) {
16
+ if (value === undefined)
17
+ return undefined;
18
+ const normalized = value.trim();
19
+ if (!/^\d+$/.test(normalized))
20
+ return undefined;
21
+ const parsed = Number(normalized);
22
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;
23
+ }
24
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/rules/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAE1D,MAAM,UAAU,qBAAqB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACzE,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;IACnD,MAAM,CAAC,QAAQ,GAAG,QAAQ,KAAK,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7F,MAAM,CAAC,YAAY,GAAG,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAAC,IAAI,MAAM,CAAC,YAAY,CAAC;IAC3G,MAAM,CAAC,cAAc,GAAG,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC,IAAI,MAAM,CAAC,cAAc,CAAC;IACjH,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,GAAsB,EAAE,IAAY;IACpD,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAyB;IACtD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC","sourcesContent":["import { defaultConfig } from \"./rules/engine.ts\";\nimport type { PiRulesConfig } from \"./rules/types.ts\";\n\nconst TRUTHY_VALUES = new Set([\"1\", \"true\", \"yes\", \"on\"]);\n\nexport function configFromEnvironment(env: NodeJS.ProcessEnv = process.env): PiRulesConfig {\n\tconst config = defaultConfig();\n\tconst disabled = readEnv(env, \"PI_RULES_DISABLED\");\n\tconfig.disabled = disabled !== undefined && TRUTHY_VALUES.has(disabled.trim().toLowerCase());\n\tconfig.maxRuleChars = parsePositiveInteger(readEnv(env, \"PI_RULES_MAX_RULE_CHARS\")) ?? config.maxRuleChars;\n\tconfig.maxResultChars = parsePositiveInteger(readEnv(env, \"PI_RULES_MAX_RESULT_CHARS\")) ?? config.maxResultChars;\n\treturn config;\n}\n\nfunction readEnv(env: NodeJS.ProcessEnv, name: string): string | undefined {\n\tconst value = env[name];\n\treturn typeof value === \"string\" && value.trim().length > 0 ? value : undefined;\n}\n\nfunction parsePositiveInteger(value: string | undefined): number | undefined {\n\tif (value === undefined) return undefined;\n\tconst normalized = value.trim();\n\tif (!/^\\d+$/.test(normalized)) return undefined;\n\tconst parsed = Number(normalized);\n\treturn Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/rules/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAanD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAkI/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/rules/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAcnD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAmI/D"}
@@ -1,7 +1,8 @@
1
1
  import { readFileSync, realpathSync } from "node:fs";
2
2
  import { isAbsolute, relative } from "node:path";
3
3
  import { registerSlashCommands } from "./commands.js";
4
- import { createEngine, defaultConfig } from "./rules/engine.js";
4
+ import { configFromEnvironment } from "./config.js";
5
+ import { createEngine } from "./rules/engine.js";
5
6
  import { findRuleCandidates } from "./rules/finder.js";
6
7
  import { findProjectRoot } from "./rules/project-root.js";
7
8
  import { extractToolPaths } from "./rules/tool-paths.js";
@@ -17,7 +18,8 @@ export default function piRulesExtension(pi) {
17
18
  default: "both",
18
19
  description: "Rule injection mode: static, dynamic, both, or off.",
19
20
  });
20
- const config = defaultConfig();
21
+ const config = configFromEnvironment();
22
+ const envDisabled = config.disabled;
21
23
  const engine = createEngine(config, {
22
24
  findCandidates: findRuleCandidates,
23
25
  readFile: (path) => {
@@ -36,7 +38,7 @@ export default function piRulesExtension(pi) {
36
38
  const disabled = pi.getFlag("pi-rules-disabled");
37
39
  const mode = pi.getFlag("pi-rules-mode");
38
40
  if (typeof disabled === "boolean") {
39
- engine.config.disabled = disabled;
41
+ engine.config.disabled = disabled || envDisabled;
40
42
  }
41
43
  if (typeof mode === "string" && isPiRulesMode(mode)) {
42
44
  engine.config.mode = mode;
@@ -71,9 +73,10 @@ export default function piRulesExtension(pi) {
71
73
  engine.markStaticInjected(rule);
72
74
  }
73
75
  }
74
- const rules = loaded.rules.filter((rule) => !nativeContextPaths.has(rule.path) &&
75
- !nativeContextPaths.has(rule.realPath) &&
76
- !engine.isStaticInjected(rule));
76
+ // Deliberately NOT gated on isStaticInjected: the host re-emits this from the BASE prompt
77
+ // every user prompt, so a prior turn's mark would drop the block from turn 2 onward. The
78
+ // marks below serve only the dynamic tool_result path.
79
+ const rules = loaded.rules.filter((rule) => !nativeContextPaths.has(rule.path) && !nativeContextPaths.has(rule.realPath));
77
80
  if (rules.length === 0) {
78
81
  return undefined;
79
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,O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C,GAAW,EAAE,QAAgB;IACjD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC","sourcesContent":["import { readFileSync, realpathSync } from \"node:fs\";\nimport { isAbsolute, relative } from \"node:path\";\n\nimport type { ExtensionAPI } from \"../../types.ts\";\n\nimport { registerSlashCommands } from \"./commands.ts\";\nimport { createEngine, defaultConfig } from \"./rules/engine.ts\";\nimport { findRuleCandidates } from \"./rules/finder.ts\";\nimport { findProjectRoot } from \"./rules/project-root.ts\";\nimport { extractToolPaths } from \"./rules/tool-paths.ts\";\nimport type { PiRulesConfig } from \"./rules/types.ts\";\n\ntype PiRulesMode = PiRulesConfig[\"mode\"];\n\nconst MODE_VALUES = new Set<string>([\"static\", \"dynamic\", \"both\", \"off\"]);\n\nexport default function piRulesExtension(pi: ExtensionAPI): void {\n\tpi.registerFlag(\"pi-rules-disabled\", {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable pi-rules hooks.\",\n\t});\n\tpi.registerFlag(\"pi-rules-mode\", {\n\t\ttype: \"string\",\n\t\tdefault: \"both\",\n\t\tdescription: \"Rule injection mode: static, dynamic, both, or off.\",\n\t});\n\tconst config = defaultConfig();\n\tconst engine = createEngine(config, {\n\t\tfindCandidates: findRuleCandidates,\n\t\treadFile: (path) => {\n\t\t\ttry {\n\t\t\t\treturn readFileSync(path, \"utf-8\");\n\t\t\t} catch {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t\tfindProjectRoot,\n\t\textractToolPaths,\n\t});\n\tregisterSlashCommands(pi, engine);\n\n\tfunction syncConfigFromFlags(): void {\n\t\tconst disabled = pi.getFlag(\"pi-rules-disabled\");\n\t\tconst mode = pi.getFlag(\"pi-rules-mode\");\n\n\t\tif (typeof disabled === \"boolean\") {\n\t\t\tengine.config.disabled = disabled;\n\t\t}\n\t\tif (typeof mode === \"string\" && isPiRulesMode(mode)) {\n\t\t\tengine.config.mode = mode;\n\t\t}\n\t}\n\n\tpi.on(\"session_start\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tengine.resetSession(ctx.cwd);\n\t\tpi.appendEntry(\"pi-rules.scan\", { cwd: ctx.cwd, reason: event.reason });\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"session_compact\", async (event, ctx) => {\n\t\t// Rejected compactions do not mutate session state; do not reset rules.\n\t\tif (!event.accepted) return undefined;\n\t\tengine.resetSession(ctx.cwd);\n\t\tpi.appendEntry(\"pi-rules.scan\", { cwd: ctx.cwd, reason: \"compact\" });\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"before_agent_start\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled || engine.config.mode === \"off\" || engine.config.mode === \"dynamic\") {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst loaded = engine.loadStaticRules(ctx.cwd);\n\t\tconst nativeContextPaths = new Set(\n\t\t\tevent.systemPromptOptions.contextFiles?.flatMap((contextFile) => pathKeys(contextFile.path)) ?? [],\n\t\t);\n\t\tfor (const rule of loaded.rules) {\n\t\t\tif (nativeContextPaths.has(rule.path) || nativeContextPaths.has(rule.realPath)) {\n\t\t\t\tengine.markStaticInjected(rule);\n\t\t\t}\n\t\t}\n\t\tconst rules = loaded.rules.filter(\n\t\t\t(rule) =>\n\t\t\t\t!nativeContextPaths.has(rule.path) &&\n\t\t\t\t!nativeContextPaths.has(rule.realPath) &&\n\t\t\t\t!engine.isStaticInjected(rule),\n\t\t);\n\n\t\tif (rules.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst block = engine.formatStatic(rules);\n\t\tfor (const rule of rules) {\n\t\t\tengine.markStaticInjected(rule);\n\t\t}\n\n\t\treturn { systemPrompt: event.systemPrompt + block };\n\t});\n\n\tpi.on(\"tool_result\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled || engine.config.mode === \"off\" || engine.config.mode === \"static\" || event.isError) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst targetPaths = extractToolPaths(event, ctx.cwd);\n\t\tconst firstTargetPath = targetPaths[0];\n\t\tif (firstTargetPath === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst fingerprints = engine.fingerprintDynamicTargets(ctx.cwd, targetPaths);\n\t\tconst pendingFingerprints = fingerprints.filter((target) => !engine.isDynamicTargetFingerprintCurrent(target));\n\t\tif (pendingFingerprints.length === 0) {\n\t\t\tengine.commitDynamicTargetFingerprints(fingerprints);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst loaded = engine.loadDynamicRules(\n\t\t\tctx.cwd,\n\t\t\tpendingFingerprints.map((target) => target.targetPath),\n\t\t);\n\t\tengine.commitDynamicTargetFingerprints(fingerprints);\n\t\tconst rules = loaded.rules.filter(\n\t\t\t(rule) => !engine.isStaticInjected(rule) && !engine.isDynamicInjected(firstTargetPath, rule),\n\t\t);\n\t\tif (rules.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstPendingTarget = pendingFingerprints[0]?.targetPath ?? firstTargetPath;\n\t\tconst block = engine.formatDynamic(rules, displayPath(ctx.cwd, firstPendingTarget));\n\t\tfor (const rule of rules) {\n\t\t\tengine.markDynamicInjected(firstTargetPath, rule);\n\t\t}\n\n\t\treturn { content: [...event.content, { type: \"text\", text: block }] };\n\t});\n}\n\nfunction isPiRulesMode(value: string): value is PiRulesMode {\n\treturn MODE_VALUES.has(value);\n}\n\nfunction pathKeys(filePath: string): string[] {\n\ttry {\n\t\treturn [filePath, realpathSync.native(filePath)];\n\t} catch {\n\t\treturn [filePath];\n\t}\n}\n\nfunction displayPath(cwd: string, filePath: string): string {\n\treturn isAbsolute(filePath) ? relative(cwd, filePath) : filePath;\n}\n"]}
1
+ {"version":3,"file":"index.js","sour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AAC,QAAgB;IACjC,IAAI,CAAC;QACJ,OAAO,CAAC,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnB,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,QAAgB;IACjD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC","sourcesContent":["import { readFileSync, realpathSync } from \"node:fs\";\nimport { isAbsolute, relative } from \"node:path\";\n\nimport type { ExtensionAPI } from \"../../types.ts\";\n\nimport { registerSlashCommands } from \"./commands.ts\";\nimport { configFromEnvironment } from \"./config.ts\";\nimport { createEngine } from \"./rules/engine.ts\";\nimport { findRuleCandidates } from \"./rules/finder.ts\";\nimport { findProjectRoot } from \"./rules/project-root.ts\";\nimport { extractToolPaths } from \"./rules/tool-paths.ts\";\nimport type { PiRulesConfig } from \"./rules/types.ts\";\n\ntype PiRulesMode = PiRulesConfig[\"mode\"];\n\nconst MODE_VALUES = new Set<string>([\"static\", \"dynamic\", \"both\", \"off\"]);\n\nexport default function piRulesExtension(pi: ExtensionAPI): void {\n\tpi.registerFlag(\"pi-rules-disabled\", {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable pi-rules hooks.\",\n\t});\n\tpi.registerFlag(\"pi-rules-mode\", {\n\t\ttype: \"string\",\n\t\tdefault: \"both\",\n\t\tdescription: \"Rule injection mode: static, dynamic, both, or off.\",\n\t});\n\tconst config = configFromEnvironment();\n\tconst envDisabled = config.disabled;\n\tconst engine = createEngine(config, {\n\t\tfindCandidates: findRuleCandidates,\n\t\treadFile: (path) => {\n\t\t\ttry {\n\t\t\t\treturn readFileSync(path, \"utf-8\");\n\t\t\t} catch {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t},\n\t\tfindProjectRoot,\n\t\textractToolPaths,\n\t});\n\tregisterSlashCommands(pi, engine);\n\n\tfunction syncConfigFromFlags(): void {\n\t\tconst disabled = pi.getFlag(\"pi-rules-disabled\");\n\t\tconst mode = pi.getFlag(\"pi-rules-mode\");\n\n\t\tif (typeof disabled === \"boolean\") {\n\t\t\tengine.config.disabled = disabled || envDisabled;\n\t\t}\n\t\tif (typeof mode === \"string\" && isPiRulesMode(mode)) {\n\t\t\tengine.config.mode = mode;\n\t\t}\n\t}\n\n\tpi.on(\"session_start\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tengine.resetSession(ctx.cwd);\n\t\tpi.appendEntry(\"pi-rules.scan\", { cwd: ctx.cwd, reason: event.reason });\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"session_compact\", async (event, ctx) => {\n\t\t// Rejected compactions do not mutate session state; do not reset rules.\n\t\tif (!event.accepted) return undefined;\n\t\tengine.resetSession(ctx.cwd);\n\t\tpi.appendEntry(\"pi-rules.scan\", { cwd: ctx.cwd, reason: \"compact\" });\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"before_agent_start\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled || engine.config.mode === \"off\" || engine.config.mode === \"dynamic\") {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst loaded = engine.loadStaticRules(ctx.cwd);\n\t\tconst nativeContextPaths = new Set(\n\t\t\tevent.systemPromptOptions.contextFiles?.flatMap((contextFile) => pathKeys(contextFile.path)) ?? [],\n\t\t);\n\t\tfor (const rule of loaded.rules) {\n\t\t\tif (nativeContextPaths.has(rule.path) || nativeContextPaths.has(rule.realPath)) {\n\t\t\t\tengine.markStaticInjected(rule);\n\t\t\t}\n\t\t}\n\t\t// Deliberately NOT gated on isStaticInjected: the host re-emits this from the BASE prompt\n\t\t// every user prompt, so a prior turn's mark would drop the block from turn 2 onward. The\n\t\t// marks below serve only the dynamic tool_result path.\n\t\tconst rules = loaded.rules.filter(\n\t\t\t(rule) => !nativeContextPaths.has(rule.path) && !nativeContextPaths.has(rule.realPath),\n\t\t);\n\n\t\tif (rules.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst block = engine.formatStatic(rules);\n\t\tfor (const rule of rules) {\n\t\t\tengine.markStaticInjected(rule);\n\t\t}\n\n\t\treturn { systemPrompt: event.systemPrompt + block };\n\t});\n\n\tpi.on(\"tool_result\", async (event, ctx) => {\n\t\tsyncConfigFromFlags();\n\t\tif (engine.config.disabled || engine.config.mode === \"off\" || engine.config.mode === \"static\" || event.isError) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst targetPaths = extractToolPaths(event, ctx.cwd);\n\t\tconst firstTargetPath = targetPaths[0];\n\t\tif (firstTargetPath === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst fingerprints = engine.fingerprintDynamicTargets(ctx.cwd, targetPaths);\n\t\tconst pendingFingerprints = fingerprints.filter((target) => !engine.isDynamicTargetFingerprintCurrent(target));\n\t\tif (pendingFingerprints.length === 0) {\n\t\t\tengine.commitDynamicTargetFingerprints(fingerprints);\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst loaded = engine.loadDynamicRules(\n\t\t\tctx.cwd,\n\t\t\tpendingFingerprints.map((target) => target.targetPath),\n\t\t);\n\t\tengine.commitDynamicTargetFingerprints(fingerprints);\n\t\tconst rules = loaded.rules.filter(\n\t\t\t(rule) => !engine.isStaticInjected(rule) && !engine.isDynamicInjected(firstTargetPath, rule),\n\t\t);\n\t\tif (rules.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst firstPendingTarget = pendingFingerprints[0]?.targetPath ?? firstTargetPath;\n\t\tconst block = engine.formatDynamic(rules, displayPath(ctx.cwd, firstPendingTarget));\n\t\tfor (const rule of rules) {\n\t\t\tengine.markDynamicInjected(firstTargetPath, rule);\n\t\t}\n\n\t\treturn { content: [...event.content, { type: \"text\", text: block }] };\n\t});\n}\n\nfunction isPiRulesMode(value: string): value is PiRulesMode {\n\treturn MODE_VALUES.has(value);\n}\n\nfunction pathKeys(filePath: string): string[] {\n\ttry {\n\t\treturn [filePath, realpathSync.native(filePath)];\n\t} catch {\n\t\treturn [filePath];\n\t}\n}\n\nfunction displayPath(cwd: string, filePath: string): string {\n\treturn isAbsolute(filePath) ? relative(cwd, filePath) : filePath;\n}\n"]}
@@ -50,6 +50,17 @@ export declare const TRUNCATION_NOTICE = "\n\n[Rule truncated. Read full rule: {
50
50
  */
51
51
  export declare const TRACKED_BUILTIN_TOOLS: readonly string[];
52
52
  export declare const TRACKED_BUILTIN_TOOL_SET: ReadonlySet<string>;
53
+ /** Addressed to the model; never used to locate the block. */
54
+ export declare const PROJECT_RULES_START_MARKER = "<project_rules>";
55
+ export declare const PROJECT_RULES_END_MARKER = "</project_rules>";
56
+ export declare const PROJECT_RULES_HEADING = "## Project Instructions";
57
+ /**
58
+ * How provider lanes that rebuild the system prompt (see the Claude SDK OAuth builtin) locate the
59
+ * block. The semantic markers cannot: prompt content this builtin does not own - context files
60
+ * before it, extensions appending after it - may legitimately contain them and be extracted instead.
61
+ */
62
+ export declare const PROJECT_RULES_REGION_START_MARKER = "<!--senpi:project-rules:1:start-->";
63
+ export declare const PROJECT_RULES_REGION_END_MARKER = "<!--senpi:project-rules:1:end-->";
53
64
  /**
54
65
  * Directories excluded by the recursive scanner regardless of glob settings.
55
66
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAQ5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAA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AEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAuD,CAAC;AAE5G;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAwD,CAAC;AAE7G;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAAoB,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,UAAU,EAAE,MAAM,CAc1D,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,iBAAiB,iDAAiD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAA8B,CAAC;AAClF,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAAkC,CAAC;AAE5F,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAC5D,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,uCAAuC,CAAC;AACtF,eAAO,MAAM,+BAA+B,qCAAqC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAQlD,CAAC"}
@@ -81,6 +81,17 @@ export const TRUNCATION_NOTICE = "\n\n[Rule truncated. Read full rule: {path}]";
81
81
  */
82
82
  export const TRACKED_BUILTIN_TOOLS = ["read", "edit", "write"];
83
83
  export const TRACKED_BUILTIN_TOOL_SET = new Set(TRACKED_BUILTIN_TOOLS);
84
+ /** Addressed to the model; never used to locate the block. */
85
+ export const PROJECT_RULES_START_MARKER = "<project_rules>";
86
+ export const PROJECT_RULES_END_MARKER = "</project_rules>";
87
+ export const PROJECT_RULES_HEADING = "## Project Instructions";
88
+ /**
89
+ * How provider lanes that rebuild the system prompt (see the Claude SDK OAuth builtin) locate the
90
+ * block. The semantic markers cannot: prompt content this builtin does not own - context files
91
+ * before it, extensions appending after it - may legitimately contain them and be extracted instead.
92
+ */
93
+ export const PROJECT_RULES_REGION_START_MARKER = "<!--senpi:project-rules:1:start-->";
94
+ export const PROJECT_RULES_REGION_END_MARKER = "<!--senpi:project-rules:1:end-->";
84
95
  /**
85
96
  * Directories excluded by the recursive scanner regardless of glob settings.
86
97
  */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAsB;IACjD,MAAM;IACN,qBAAqB;IACrB,cAAc;IACd,gBAAgB;IAChB,YAAY;IACZ,QAAQ;IACR,OAAO;CACP,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC7E,CAAC,MAAM,EAAE,OAAO,CAAC;IACjB,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACtD,iCAAiC;IACjC,WAAW;IACX,WAAW;IACX,YAAY;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,CAAC,YAAY,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAC;AAE5G;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,CAAC,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;AAE7G;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoC,IAAI,GAAG,CAAC;IACvE,CAAC,YAAY,EAAE,CAAC,CAAC;IACjB,CAAC,eAAe,EAAE,CAAC,CAAC;IACpB,CAAC,eAAe,EAAE,CAAC,CAAC;IACpB,CAAC,sBAAsB,EAAE,CAAC,CAAC;IAC3B,CAAC,iCAAiC,EAAE,CAAC,CAAC;IACtC,CAAC,WAAW,EAAE,CAAC,CAAC;IAChB,CAAC,WAAW,EAAE,CAAC,CAAC;IAChB,CAAC,YAAY,EAAE,CAAC,CAAC;IACjB,CAAC,cAAc,EAAE,GAAG,CAAC;IACrB,CAAC,mBAAmB,EAAE,GAAG,CAAC;IAC1B,CAAC,iBAAiB,EAAE,GAAG,CAAC;IACxB,CAAC,8BAA8B,EAAE,GAAG,CAAC;IACrC,CAAC,qBAAqB,EAAE,GAAG,CAAC;CAC5B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAwB,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACvD,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;CACV,CAAC","sourcesContent":["import type { RuleSource } from \"./types.ts\";\n\n/**\n * Project root marker files / directories used by `findProjectRoot`.\n * Walks UP from cwd until any of these is found in the directory.\n */\nexport const PROJECT_MARKERS: readonly string[] = [\n\t\".git\",\n\t\"pnpm-workspace.yaml\",\n\t\"package.json\",\n\t\"pyproject.toml\",\n\t\"Cargo.toml\",\n\t\"go.mod\",\n\t\".venv\",\n];\n\n/**\n * Project rule subdirectories. First tuple element is the parent dir under\n * the project root, second is the subdir scanned recursively.\n */\nexport const PROJECT_RULE_SUBDIRS: ReadonlyArray<readonly [string, string]> = [\n\t[\".omo\", \"rules\"],\n\t[\".claude\", \"rules\"],\n\t[\".cursor\", \"rules\"],\n\t[\".github\", \"instructions\"],\n];\n\n/**\n * Single-file project rules (always apply, frontmatter optional).\n */\nexport const PROJECT_SINGLE_FILES: readonly string[] = [\n\t\".github/copilot-instructions.md\",\n\t\"AGENTS.md\",\n\t\"CLAUDE.md\",\n\t\"CONTEXT.md\",\n];\n\n/**\n * User-home rule directories.\n */\nexport const USER_HOME_RULE_SUBDIRS: readonly string[] = [\".omo/rules\", \".opencode/rules\", \".claude/rules\"];\n\n/**\n * User-home single-file rules. The first one to exist wins per \"first-match\" semantics.\n */\nexport const USER_HOME_SINGLE_FILES: readonly string[] = [\".config/opencode/AGENTS.md\", \".claude/CLAUDE.md\"];\n\n/**\n * File extensions accepted as rule files in scanned directories.\n */\nexport const RULE_FILE_EXTENSIONS: readonly string[] = [\".md\", \".mdc\"];\n\n/**\n * Per-rule source priority for deterministic ordering. Lower = earlier.\n */\nexport const SOURCE_PRIORITY: ReadonlyMap<RuleSource, number> = new Map([\n\t[\".omo/rules\", 0],\n\t[\".claude/rules\", 1],\n\t[\".cursor/rules\", 2],\n\t[\".github/instructions\", 3],\n\t[\".github/copilot-instructions.md\", 4],\n\t[\"AGENTS.md\", 5],\n\t[\"CLAUDE.md\", 6],\n\t[\"CONTEXT.md\", 7],\n\t[\"~/.omo/rules\", 100],\n\t[\"~/.opencode/rules\", 101],\n\t[\"~/.claude/rules\", 102],\n\t[\"~/.config/opencode/AGENTS.md\", 103],\n\t[\"~/.claude/CLAUDE.md\", 104],\n]);\n\n/**\n * Distance value assigned to global / user-home rules.\n */\nexport const GLOBAL_DISTANCE = 9999;\n\n/**\n * Per-rule body character cap (default).\n */\nexport const DEFAULT_MAX_RULE_CHARS = 12000;\n\n/**\n * Total injected chars per tool result (default).\n */\nexport const DEFAULT_MAX_RESULT_CHARS = 40000;\n\n/**\n * Truncation marker template. `{path}` is replaced with the relative path.\n */\nexport const TRUNCATION_NOTICE = \"\\n\\n[Rule truncated. Read full rule: {path}]\";\n\n/**\n * Built-in tool names whose results trigger dynamic rule injection.\n */\nexport const TRACKED_BUILTIN_TOOLS: readonly string[] = [\"read\", \"edit\", \"write\"];\nexport const TRACKED_BUILTIN_TOOL_SET: ReadonlySet<string> = new Set(TRACKED_BUILTIN_TOOLS);\n\n/**\n * Directories excluded by the recursive scanner regardless of glob settings.\n */\nexport const SCANNER_EXCLUDED_DIRS: readonly string[] = [\n\t\"node_modules\",\n\t\".git\",\n\t\"dist\",\n\t\"build\",\n\t\".turbo\",\n\t\".next\",\n\t\"coverage\",\n];\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAsB;IACjD,MAAM;IACN,qBAAqB;IACrB,cAAc;IACd,gBAAgB;IAChB,YAAY;IACZ,QAAQ;IACR,OAAO;CACP,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6C;IAC7E,CAAC,MAAM,EAAE,OAAO,CAAC;IACjB,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACtD,iCAAiC;IACjC,WAAW;IACX,WAAW;IACX,YAAY;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM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AAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAE5F,8DAA8D;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAC5D,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,oCAAoC,CAAC;AACtF,MAAM,CAAC,MAAM,+BAA+B,GAAG,kCAAkC,CAAC;AAElF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACvD,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;CACV,CAAC","sourcesContent":["import type { RuleSource } from \"./types.ts\";\n\n/**\n * Project root marker files / directories used by `findProjectRoot`.\n * Walks UP from cwd until any of these is found in the directory.\n */\nexport const PROJECT_MARKERS: readonly string[] = [\n\t\".git\",\n\t\"pnpm-workspace.yaml\",\n\t\"package.json\",\n\t\"pyproject.toml\",\n\t\"Cargo.toml\",\n\t\"go.mod\",\n\t\".venv\",\n];\n\n/**\n * Project rule subdirectories. First tuple element is the parent dir under\n * the project root, second is the subdir scanned recursively.\n */\nexport const PROJECT_RULE_SUBDIRS: ReadonlyArray<readonly [string, string]> = [\n\t[\".omo\", \"rules\"],\n\t[\".claude\", \"rules\"],\n\t[\".cursor\", \"rules\"],\n\t[\".github\", \"instructions\"],\n];\n\n/**\n * Single-file project rules (always apply, frontmatter optional).\n */\nexport const PROJECT_SINGLE_FILES: readonly string[] = [\n\t\".github/copilot-instructions.md\",\n\t\"AGENTS.md\",\n\t\"CLAUDE.md\",\n\t\"CONTEXT.md\",\n];\n\n/**\n * User-home rule directories.\n */\nexport const USER_HOME_RULE_SUBDIRS: readonly string[] = [\".omo/rules\", \".opencode/rules\", \".claude/rules\"];\n\n/**\n * User-home single-file rules. The first one to exist wins per \"first-match\" semantics.\n */\nexport const USER_HOME_SINGLE_FILES: readonly string[] = [\".config/opencode/AGENTS.md\", \".claude/CLAUDE.md\"];\n\n/**\n * File extensions accepted as rule files in scanned directories.\n */\nexport const RULE_FILE_EXTENSIONS: readonly string[] = [\".md\", \".mdc\"];\n\n/**\n * Per-rule source priority for deterministic ordering. Lower = earlier.\n */\nexport const SOURCE_PRIORITY: ReadonlyMap<RuleSource, number> = new Map([\n\t[\".omo/rules\", 0],\n\t[\".claude/rules\", 1],\n\t[\".cursor/rules\", 2],\n\t[\".github/instructions\", 3],\n\t[\".github/copilot-instructions.md\", 4],\n\t[\"AGENTS.md\", 5],\n\t[\"CLAUDE.md\", 6],\n\t[\"CONTEXT.md\", 7],\n\t[\"~/.omo/rules\", 100],\n\t[\"~/.opencode/rules\", 101],\n\t[\"~/.claude/rules\", 102],\n\t[\"~/.config/opencode/AGENTS.md\", 103],\n\t[\"~/.claude/CLAUDE.md\", 104],\n]);\n\n/**\n * Distance value assigned to global / user-home rules.\n */\nexport const GLOBAL_DISTANCE = 9999;\n\n/**\n * Per-rule body character cap (default).\n */\nexport const DEFAULT_MAX_RULE_CHARS = 12000;\n\n/**\n * Total injected chars per tool result (default).\n */\nexport const DEFAULT_MAX_RESULT_CHARS = 40000;\n\n/**\n * Truncation marker template. `{path}` is replaced with the relative path.\n */\nexport const TRUNCATION_NOTICE = \"\\n\\n[Rule truncated. Read full rule: {path}]\";\n\n/**\n * Built-in tool names whose results trigger dynamic rule injection.\n */\nexport const TRACKED_BUILTIN_TOOLS: readonly string[] = [\"read\", \"edit\", \"write\"];\nexport const TRACKED_BUILTIN_TOOL_SET: ReadonlySet<string> = new Set(TRACKED_BUILTIN_TOOLS);\n\n/** Addressed to the model; never used to locate the block. */\nexport const PROJECT_RULES_START_MARKER = \"<project_rules>\";\nexport const PROJECT_RULES_END_MARKER = \"</project_rules>\";\nexport const PROJECT_RULES_HEADING = \"## Project Instructions\";\n\n/**\n * How provider lanes that rebuild the system prompt (see the Claude SDK OAuth builtin) locate the\n * block. The semantic markers cannot: prompt content this builtin does not own - context files\n * before it, extensions appending after it - may legitimately contain them and be extracted instead.\n */\nexport const PROJECT_RULES_REGION_START_MARKER = \"<!--senpi:project-rules:1:start-->\";\nexport const PROJECT_RULES_REGION_END_MARKER = \"<!--senpi:project-rules:1:end-->\";\n\n/**\n * Directories excluded by the recursive scanner regardless of glob settings.\n */\nexport const SCANNER_EXCLUDED_DIRS: readonly string[] = [\n\t\"node_modules\",\n\t\".git\",\n\t\"dist\",\n\t\"build\",\n\t\".turbo\",\n\t\".next\",\n\t\"coverage\",\n];\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/formatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACvB;AAyCD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAMlG;AAED,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,GACpB,MAAM,CAQR"}
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/formatter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACvB;AA2DD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,CAYlG;AAcD,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,GACpB,MAAM,CAaR"}
@@ -1,7 +1,22 @@
1
+ import { PROJECT_RULES_END_MARKER, PROJECT_RULES_HEADING, PROJECT_RULES_REGION_END_MARKER, PROJECT_RULES_REGION_START_MARKER, PROJECT_RULES_START_MARKER, } from "./constants.js";
1
2
  import { truncateBudget, truncateRule } from "./truncator.js";
2
3
  function formatRule(rule) {
3
4
  return `Instructions from: ${rule.path}\n${rule.body}`;
4
5
  }
6
+ function formatWithinResultBudget(rules, options, render) {
7
+ let bodyBudget = options.maxResultChars;
8
+ while (bodyBudget > 0) {
9
+ const truncatedRules = truncateRules(rules, { ...options, maxResultChars: bodyBudget });
10
+ if (truncatedRules.length === 0)
11
+ return "";
12
+ const block = render(truncatedRules);
13
+ const overflow = block.length - options.maxResultChars;
14
+ if (overflow <= 0)
15
+ return block;
16
+ bodyBudget = Math.max(0, bodyBudget - overflow);
17
+ }
18
+ return "";
19
+ }
5
20
  function truncateRules(rules, options) {
6
21
  const perRuleTruncated = rules.map((rule) => ({
7
22
  path: rule.path,
@@ -31,14 +46,29 @@ export function formatStaticBlock(rules, options) {
31
46
  if (rules.length === 0) {
32
47
  return "";
33
48
  }
34
- return `\n\n## Project Instructions\n${truncateRules(rules, options).map(formatRule).join("\n\n")}`;
49
+ return formatWithinResultBudget(rules, options, (truncatedRules) => {
50
+ const body = neutralizeEnvelopeMarkers(`${PROJECT_RULES_HEADING}\n${truncatedRules.map(formatRule).join("\n\n")}`);
51
+ const envelope = `${PROJECT_RULES_START_MARKER}\n${body}\n${PROJECT_RULES_END_MARKER}`;
52
+ return `\n\n${PROJECT_RULES_REGION_START_MARKER}\n${envelope}\n${PROJECT_RULES_REGION_END_MARKER}`;
53
+ });
54
+ }
55
+ /**
56
+ * A raw region sentinel inside a rule would terminate extraction early and drop every rule after it;
57
+ * a raw semantic marker would instead corrupt the envelope structure the model reads.
58
+ */
59
+ function neutralizeEnvelopeMarkers(text) {
60
+ return text
61
+ .replaceAll(PROJECT_RULES_REGION_START_MARKER, "&lt;!--senpi:project-rules:1:start--&gt;")
62
+ .replaceAll(PROJECT_RULES_REGION_END_MARKER, "&lt;!--senpi:project-rules:1:end--&gt;")
63
+ .replaceAll(PROJECT_RULES_START_MARKER, "&lt;project_rules&gt;")
64
+ .replaceAll(PROJECT_RULES_END_MARKER, "&lt;/project_rules&gt;");
35
65
  }
36
66
  export function formatDynamicBlock(rules, targetRelativePath, options) {
37
67
  if (rules.length === 0) {
38
68
  return "";
39
69
  }
40
- return `\n\nAdditional project instructions matched for ${targetRelativePath}:\n\n${truncateRules(rules, options)
70
+ return formatWithinResultBudget(rules, options, (truncatedRules) => `\n\nAdditional project instructions matched for ${targetRelativePath}:\n\n${truncatedRules
41
71
  .map(formatRule)
42
- .join("\n\n")}`;
72
+ .join("\n\n")}`);
43
73
  }
44
74
  //# sourceMappingURL=formatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAc9D,SAAS,UAAU,CAAC,IAAmB;IACtC,OAAO,sBAAsB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,aAAa,CAAC,KAAgC,EAAE,OAAsB;IAC9E,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,YAAY,EAAE,YAAY,EAAE,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tB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,mDAAmD,kBAAkB,QAAQ,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC;SAC/G,GAAG,CAAC,UAAU,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AAClB,CAAC","sourcesContent":["import { truncateBudget, truncateRule } from \"./truncator.ts\";\nimport type { LoadedRule } from \"./types.ts\";\n\nexport interface FormatOptions {\n\tmaxRuleChars: number;\n\tmaxResultChars: number;\n}\n\ntype TruncatedRule = {\n\tpath: string;\n\trelativePath: string;\n\tbody: string;\n};\n\nfunction formatRule(rule: TruncatedRule): string {\n\treturn `Instructions from: ${rule.path}\\n${rule.body}`;\n}\n\nfunction truncateRules(rules: ReadonlyArray<LoadedRule>, options: FormatOptions): TruncatedRule[] {\n\tconst perRuleTruncated = rules.map((rule) => ({\n\t\tpath: rule.path,\n\t\trelativePath: rule.relativePath,\n\t\tbody: truncateRule(rule.body, { maxChars: options.maxRuleChars, relativePath: rule.relativePath }).body,\n\t}));\n\tconst budgetedRules = truncateBudget({\n\t\trules: perRuleTruncated.map((rule) => ({ body: rule.body, relativePath: rule.relativePath })),\n\t\tmaxResultChars: options.maxResultChars,\n\t});\n\tconst truncatedRules: TruncatedRule[] = [];\n\n\tfor (let index = 0; index < budgetedRules.length; index += 1) {\n\t\tconst sourceRule = perRuleTruncated[index];\n\t\tconst budgetedRule = budgetedRules[index];\n\t\tif (sourceRule === undefined || budgetedRule === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttruncatedRules.push({\n\t\t\tpath: sourceRule.path,\n\t\t\trelativePath: budgetedRule.relativePath,\n\t\t\tbody: budgetedRule.body,\n\t\t});\n\t}\n\n\treturn truncatedRules;\n}\n\nexport function formatStaticBlock(rules: ReadonlyArray<LoadedRule>, options: FormatOptions): string {\n\tif (rules.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn `\\n\\n## Project Instructions\\n${truncateRules(rules, options).map(formatRule).join(\"\\n\\n\")}`;\n}\n\nexport function formatDynamicBlock(\n\trules: ReadonlyArray<LoadedRule>,\n\ttargetRelativePath: string,\n\toptions: FormatOptions,\n): string {\n\tif (rules.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn `\\n\\nAdditional project instructions matched for ${targetRelativePath}:\\n\\n${truncateRules(rules, options)\n\t\t.map(formatRule)\n\t\t.join(\"\\n\\n\")}`;\n}\n"]}
1
+ {"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAc9D,SAAS,UAAU,CAAC,IAAmB;IACtC,OAAO,sBAAsB,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,wBAAwB,CAChC,KAAgC,EAChC,OAAsB,EACtB,MAAgE;IAEhE,IAAI,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IACxC,OAAO,UAAU,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC;QACxF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAE3C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;QACvD,IAAI,QAAQ,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAChC,UAAU,GAAG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CAAC","sourcesContent":["import {\n\tPROJECT_RULES_END_MARKER,\n\tPROJECT_RULES_HEADING,\n\tPROJECT_RULES_REGION_END_MARKER,\n\tPROJECT_RULES_REGION_START_MARKER,\n\tPROJECT_RULES_START_MARKER,\n} from \"./constants.ts\";\nimport { truncateBudget, truncateRule } from \"./truncator.ts\";\nimport type { LoadedRule } from \"./types.ts\";\n\nexport interface FormatOptions {\n\tmaxRuleChars: number;\n\tmaxResultChars: number;\n}\n\ntype TruncatedRule = {\n\tpath: string;\n\trelativePath: string;\n\tbody: string;\n};\n\nfunction formatRule(rule: TruncatedRule): string {\n\treturn `Instructions from: ${rule.path}\\n${rule.body}`;\n}\n\nfunction formatWithinResultBudget(\n\trules: ReadonlyArray<LoadedRule>,\n\toptions: FormatOptions,\n\trender: (truncatedRules: ReadonlyArray<TruncatedRule>) => string,\n): string {\n\tlet bodyBudget = options.maxResultChars;\n\twhile (bodyBudget > 0) {\n\t\tconst truncatedRules = truncateRules(rules, { ...options, maxResultChars: bodyBudget });\n\t\tif (truncatedRules.length === 0) return \"\";\n\n\t\tconst block = render(truncatedRules);\n\t\tconst overflow = block.length - options.maxResultChars;\n\t\tif (overflow <= 0) return block;\n\t\tbodyBudget = Math.max(0, bodyBudget - overflow);\n\t}\n\treturn \"\";\n}\n\nfunction truncateRules(rules: ReadonlyArray<LoadedRule>, options: FormatOptions): TruncatedRule[] {\n\tconst perRuleTruncated = rules.map((rule) => ({\n\t\tpath: rule.path,\n\t\trelativePath: rule.relativePath,\n\t\tbody: truncateRule(rule.body, { maxChars: options.maxRuleChars, relativePath: rule.relativePath }).body,\n\t}));\n\tconst budgetedRules = truncateBudget({\n\t\trules: perRuleTruncated.map((rule) => ({ body: rule.body, relativePath: rule.relativePath })),\n\t\tmaxResultChars: options.maxResultChars,\n\t});\n\tconst truncatedRules: TruncatedRule[] = [];\n\n\tfor (let index = 0; index < budgetedRules.length; index += 1) {\n\t\tconst sourceRule = perRuleTruncated[index];\n\t\tconst budgetedRule = budgetedRules[index];\n\t\tif (sourceRule === undefined || budgetedRule === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\ttruncatedRules.push({\n\t\t\tpath: sourceRule.path,\n\t\t\trelativePath: budgetedRule.relativePath,\n\t\t\tbody: budgetedRule.body,\n\t\t});\n\t}\n\n\treturn truncatedRules;\n}\n\nexport function formatStaticBlock(rules: ReadonlyArray<LoadedRule>, options: FormatOptions): string {\n\tif (rules.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn formatWithinResultBudget(rules, options, (truncatedRules) => {\n\t\tconst body = neutralizeEnvelopeMarkers(\n\t\t\t`${PROJECT_RULES_HEADING}\\n${truncatedRules.map(formatRule).join(\"\\n\\n\")}`,\n\t\t);\n\t\tconst envelope = `${PROJECT_RULES_START_MARKER}\\n${body}\\n${PROJECT_RULES_END_MARKER}`;\n\t\treturn `\\n\\n${PROJECT_RULES_REGION_START_MARKER}\\n${envelope}\\n${PROJECT_RULES_REGION_END_MARKER}`;\n\t});\n}\n\n/**\n * A raw region sentinel inside a rule would terminate extraction early and drop every rule after it;\n * a raw semantic marker would instead corrupt the envelope structure the model reads.\n */\nfunction neutralizeEnvelopeMarkers(text: string): string {\n\treturn text\n\t\t.replaceAll(PROJECT_RULES_REGION_START_MARKER, \"&lt;!--senpi:project-rules:1:start--&gt;\")\n\t\t.replaceAll(PROJECT_RULES_REGION_END_MARKER, \"&lt;!--senpi:project-rules:1:end--&gt;\")\n\t\t.replaceAll(PROJECT_RULES_START_MARKER, \"&lt;project_rules&gt;\")\n\t\t.replaceAll(PROJECT_RULES_END_MARKER, \"&lt;/project_rules&gt;\");\n}\n\nexport function formatDynamicBlock(\n\trules: ReadonlyArray<LoadedRule>,\n\ttargetRelativePath: string,\n\toptions: FormatOptions,\n): string {\n\tif (rules.length === 0) {\n\t\treturn \"\";\n\t}\n\n\treturn formatWithinResultBudget(\n\t\trules,\n\t\toptions,\n\t\t(truncatedRules) =>\n\t\t\t`\\n\\nAdditional project instructions matched for ${targetRelativePath}:\\n\\n${truncatedRules\n\t\t\t\t.map(formatRule)\n\t\t\t\t.join(\"\\n\\n\")}`,\n\t);\n}\n"]}
@@ -90,7 +90,7 @@ export interface TruncationResult {
90
90
  originalLength: number;
91
91
  }
92
92
  /**
93
- * Configuration knobs resolved from env vars and package.json.
93
+ * Configuration knobs resolved from environment variables.
94
94
  */
95
95
  export interface PiRulesConfig {
96
96
  disabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Public types for pi-rules.\n *\n * These types are stable contracts between modules. The frontmatter type\n * mirrors omo's `RuleMetadata` plus Claude (`paths`) and Copilot (`applyTo`)\n * aliases that are normalized into `globs` internally.\n */\n\n/**\n * YAML frontmatter parsed from a rule markdown file.\n * `paths` (Claude alias) and `applyTo` (Copilot alias) are normalized into\n * `globs` by the parser before any matcher sees this struct.\n */\nexport interface RuleFrontmatter {\n\tdescription?: string;\n\tglobs?: string | string[];\n\tpaths?: string | string[];\n\tapplyTo?: string | string[];\n\talwaysApply?: boolean;\n}\n\n/**\n * Result of parsing a rule markdown file.\n * `body` excludes the frontmatter delimiters and the YAML payload.\n */\nexport interface ParsedRule {\n\tfrontmatter: RuleFrontmatter;\n\tbody: string;\n\t/**\n\t * Diagnostic message if frontmatter parsing failed but the body was salvaged.\n\t * Empty when parsing succeeded.\n\t */\n\tdiagnostic?: string;\n}\n\n/**\n * A discovered rule file candidate before parsing/matching.\n *\n * `path` is the absolute path as discovered (possibly via symlink).\n * `realPath` is the canonical resolved path used for dedup.\n * `source` identifies which discovery source produced this candidate.\n */\nexport interface RuleCandidate {\n\tpath: string;\n\trealPath: string;\n\tsource: RuleSource;\n\t/**\n\t * Distance from the target file directory to the directory containing this rule.\n\t * 0 = same directory, 9999 = global/user-home rule.\n\t */\n\tdistance: number;\n\tisGlobal: boolean;\n\t/**\n\t * True when this candidate is a SINGLE-FILE rule like AGENTS.md or\n\t * `.github/copilot-instructions.md` (frontmatter optional, applies always).\n\t */\n\tisSingleFile: boolean;\n\t/**\n\t * Path relative to project root, POSIX-normalized. Used for matcher and display.\n\t * Empty string for user-home global rules.\n\t */\n\trelativePath: string;\n}\n\n/**\n * A fully-loaded rule ready for injection.\n */\nexport interface LoadedRule extends RuleCandidate {\n\tfrontmatter: RuleFrontmatter;\n\tbody: string;\n\tcontentHash: string;\n\tmatchReason: MatchReason;\n}\n\n/**\n * Source identifier for rule files. Used for deterministic ordering and display.\n */\nexport type RuleSource =\n\t| \".omo/rules\"\n\t| \".claude/rules\"\n\t| \".cursor/rules\"\n\t| \".github/instructions\"\n\t| \".github/copilot-instructions.md\"\n\t| \"AGENTS.md\"\n\t| \"CLAUDE.md\"\n\t| \"CONTEXT.md\"\n\t| \"~/.omo/rules\"\n\t| \"~/.opencode/rules\"\n\t| \"~/.claude/rules\"\n\t| \"~/.config/opencode/AGENTS.md\"\n\t| \"~/.claude/CLAUDE.md\";\n\n/**\n * Why a candidate matched the target file. Surfaced in the injection block so\n * the model can attribute its behavior to a specific rule.\n */\nexport type MatchReason = \"alwaysApply\" | \"single-file\" | { kind: \"glob\"; pattern: string } | { kind: \"no-match\" };\n\n/**\n * Truncation result.\n */\nexport interface TruncationResult {\n\tbody: string;\n\ttruncated: boolean;\n\toriginalLength: number;\n}\n\n/**\n * Configuration knobs resolved from env vars and package.json.\n */\nexport interface PiRulesConfig {\n\tdisabled: boolean;\n\tmode: \"static\" | \"dynamic\" | \"both\" | \"off\";\n\tmaxRuleChars: number;\n\tmaxResultChars: number;\n\tenabledSources: RuleSource[] | \"auto\";\n}\n\n/**\n * Per-session in-memory dedup state.\n *\n * `staticDedup` keys are `{cwd}::{rulePath}::{contentHash}` strings.\n * `dynamicDedup` stores `{targetPath}::{rulePath}::{contentHash}` strings grouped by target file.\n * `dynamicTargetFingerprints` maps a target file cache key to a digest of its\n * discovered rule candidates + file stats; loadDynamicRules short-circuits\n * targets whose fingerprint has not changed since the previous load.\n */\nexport interface SessionState {\n\tcwd: string | undefined;\n\tstaticDedup: Set<string>;\n\tdynamicDedup: Map<string, Set<string>>;\n\tdynamicTargetFingerprints: Map<string, string>;\n\tloadedRules: LoadedRule[];\n\tdiagnostics: RuleDiagnostic[];\n}\n\nexport interface RuleDiagnostic {\n\tseverity: \"warning\" | \"error\";\n\tsource: string;\n\tmessage: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/rules/rules/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Public types for pi-rules.\n *\n * These types are stable contracts between modules. The frontmatter type\n * mirrors omo's `RuleMetadata` plus Claude (`paths`) and Copilot (`applyTo`)\n * aliases that are normalized into `globs` internally.\n */\n\n/**\n * YAML frontmatter parsed from a rule markdown file.\n * `paths` (Claude alias) and `applyTo` (Copilot alias) are normalized into\n * `globs` by the parser before any matcher sees this struct.\n */\nexport interface RuleFrontmatter {\n\tdescription?: string;\n\tglobs?: string | string[];\n\tpaths?: string | string[];\n\tapplyTo?: string | string[];\n\talwaysApply?: boolean;\n}\n\n/**\n * Result of parsing a rule markdown file.\n * `body` excludes the frontmatter delimiters and the YAML payload.\n */\nexport interface ParsedRule {\n\tfrontmatter: RuleFrontmatter;\n\tbody: string;\n\t/**\n\t * Diagnostic message if frontmatter parsing failed but the body was salvaged.\n\t * Empty when parsing succeeded.\n\t */\n\tdiagnostic?: string;\n}\n\n/**\n * A discovered rule file candidate before parsing/matching.\n *\n * `path` is the absolute path as discovered (possibly via symlink).\n * `realPath` is the canonical resolved path used for dedup.\n * `source` identifies which discovery source produced this candidate.\n */\nexport interface RuleCandidate {\n\tpath: string;\n\trealPath: string;\n\tsource: RuleSource;\n\t/**\n\t * Distance from the target file directory to the directory containing this rule.\n\t * 0 = same directory, 9999 = global/user-home rule.\n\t */\n\tdistance: number;\n\tisGlobal: boolean;\n\t/**\n\t * True when this candidate is a SINGLE-FILE rule like AGENTS.md or\n\t * `.github/copilot-instructions.md` (frontmatter optional, applies always).\n\t */\n\tisSingleFile: boolean;\n\t/**\n\t * Path relative to project root, POSIX-normalized. Used for matcher and display.\n\t * Empty string for user-home global rules.\n\t */\n\trelativePath: string;\n}\n\n/**\n * A fully-loaded rule ready for injection.\n */\nexport interface LoadedRule extends RuleCandidate {\n\tfrontmatter: RuleFrontmatter;\n\tbody: string;\n\tcontentHash: string;\n\tmatchReason: MatchReason;\n}\n\n/**\n * Source identifier for rule files. Used for deterministic ordering and display.\n */\nexport type RuleSource =\n\t| \".omo/rules\"\n\t| \".claude/rules\"\n\t| \".cursor/rules\"\n\t| \".github/instructions\"\n\t| \".github/copilot-instructions.md\"\n\t| \"AGENTS.md\"\n\t| \"CLAUDE.md\"\n\t| \"CONTEXT.md\"\n\t| \"~/.omo/rules\"\n\t| \"~/.opencode/rules\"\n\t| \"~/.claude/rules\"\n\t| \"~/.config/opencode/AGENTS.md\"\n\t| \"~/.claude/CLAUDE.md\";\n\n/**\n * Why a candidate matched the target file. Surfaced in the injection block so\n * the model can attribute its behavior to a specific rule.\n */\nexport type MatchReason = \"alwaysApply\" | \"single-file\" | { kind: \"glob\"; pattern: string } | { kind: \"no-match\" };\n\n/**\n * Truncation result.\n */\nexport interface TruncationResult {\n\tbody: string;\n\ttruncated: boolean;\n\toriginalLength: number;\n}\n\n/**\n * Configuration knobs resolved from environment variables.\n */\nexport interface PiRulesConfig {\n\tdisabled: boolean;\n\tmode: \"static\" | \"dynamic\" | \"both\" | \"off\";\n\tmaxRuleChars: number;\n\tmaxResultChars: number;\n\tenabledSources: RuleSource[] | \"auto\";\n}\n\n/**\n * Per-session in-memory dedup state.\n *\n * `staticDedup` keys are `{cwd}::{rulePath}::{contentHash}` strings.\n * `dynamicDedup` stores `{targetPath}::{rulePath}::{contentHash}` strings grouped by target file.\n * `dynamicTargetFingerprints` maps a target file cache key to a digest of its\n * discovered rule candidates + file stats; loadDynamicRules short-circuits\n * targets whose fingerprint has not changed since the previous load.\n */\nexport interface SessionState {\n\tcwd: string | undefined;\n\tstaticDedup: Set<string>;\n\tdynamicDedup: Map<string, Set<string>>;\n\tdynamicTargetFingerprints: Map<string, string>;\n\tloadedRules: LoadedRule[];\n\tdiagnostics: RuleDiagnostic[];\n}\n\nexport interface RuleDiagnostic {\n\tseverity: \"warning\" | \"error\";\n\tsource: string;\n\tmessage: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"service-tier.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/service-tier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAS,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,YAAY,EAAE,WAAW,EAAE,CAAC;AAiC5B,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAalH;AAkCD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAiDnE"}
1
+ {"version":3,"file":"service-tier.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/service-tier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAS,MAAM,uBAAuB,CAAC;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,YAAY,EAAE,WAAW,EAAE,CAAC;AAa5B,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAalH;AAkCD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAqEnE"}
@@ -1,26 +1,7 @@
1
1
  import { SettingsManager } from "../../settings-manager.js";
2
- const OPENAI_CODEX_PROVIDER = "openai-codex";
3
2
  const OPENAI_CODEX_RESPONSES_API = "openai-codex-responses";
4
3
  const FAST_MODEL_SUFFIX = "-fast";
5
- /**
6
- * `/fast` is registered only for `openai-codex`, but the catalog generator emits
7
- * `-fast` priority variants only for the direct `openai` provider, so no Codex
8
- * model ever has a target and the command could only report "not supported".
9
- *
10
- * That gap is intentional rather than an oversight in the generator: measured
11
- * against `chatgpt.com/backend-api/codex/responses` with a live ChatGPT Pro
12
- * subscription, `service_tier: "priority"` returns HTTP 200 but the response
13
- * echoes `"auto"`, while `"auto"`/`"flex"`/`"scale"` are rejected with HTTP 400
14
- * `Unsupported service_tier`. Priority processing is an API-billing feature, so
15
- * a subscription request is served at normal tier no matter what is sent — and
16
- * `getServiceTierCostMultiplier()` would still bill it at up to 2.5x.
17
- *
18
- * So the honest answer is that fast mode is unavailable here, not that the
19
- * model does not support it.
20
- */
21
- const FAST_UNAVAILABLE_ON_SUBSCRIPTION = "Fast mode (priority tier) is not available on a ChatGPT subscription: chatgpt.com accepts " +
22
- "service_tier=priority but serves the request at normal tier. Priority processing requires " +
23
- "API-key billing on the `openai` provider.";
4
+ const PRIORITY_TIER = "priority";
24
5
  const SERVICE_TIER_APIS = new Set(["openai-responses", OPENAI_CODEX_RESPONSES_API]);
25
6
  function isRecord(value) {
26
7
  return typeof value === "object" && value !== null;
@@ -63,11 +44,27 @@ function findFastModel(modelRegistry, baseModel) {
63
44
  }
64
45
  export default function serviceTierExtension(pi) {
65
46
  let settingsServiceTier;
47
+ /**
48
+ * Session-level fast mode for Codex models that have no `-fast` catalog sibling.
49
+ *
50
+ * The catalog generator emits `-fast` priority variants only for the direct
51
+ * `openai` provider, so `openai-codex` models never have a switch target. The
52
+ * ChatGPT backend still offers the tier to subscriptions:
53
+ * `chatgpt.com/backend-api/codex/models` advertises a `priority` service tier
54
+ * labelled "Fast" ("1.5x speed, increased usage")
55
+ * for gpt-5.4/5.5/5.6-*, and the first-party Codex CLI sends
56
+ * `service_tier: "priority"` on subscription OAuth. The response echo is not a
57
+ * confirmation channel — it reads `auto`/`default` whether or not a tier was
58
+ * sent — so this toggle drives the request field directly. See issue #545.
59
+ */
60
+ let sessionFastMode = false;
66
61
  pi.on("session_start", async (_event, ctx) => {
67
62
  const settingsManager = SettingsManager.create(ctx.cwd);
68
63
  settingsServiceTier = settingsManager.getOpenAIServiceTier();
64
+ sessionFastMode = false;
65
+ pi.setSessionFastMode(false);
69
66
  const model = ctx.model;
70
- if (model?.provider !== OPENAI_CODEX_PROVIDER) {
67
+ if (model?.api !== OPENAI_CODEX_RESPONSES_API) {
71
68
  return;
72
69
  }
73
70
  const baseModel = findBaseModel(ctx.modelRegistry, model);
@@ -79,14 +76,16 @@ export default function serviceTierExtension(pi) {
79
76
  description: "Toggle OpenAI Codex fast mode for this session",
80
77
  handler: async (_args, ctx) => {
81
78
  const model = ctx.model;
82
- if (model?.provider !== OPENAI_CODEX_PROVIDER) {
79
+ if (model?.api !== OPENAI_CODEX_RESPONSES_API) {
83
80
  ctx.ui.notify("Fast mode is only available for OpenAI Codex models.", "warning");
84
81
  return;
85
82
  }
86
83
  const baseModel = findBaseModel(ctx.modelRegistry, model);
87
84
  const targetModel = baseModel ?? findFastModel(ctx.modelRegistry, model);
88
85
  if (!targetModel) {
89
- ctx.ui.notify(FAST_UNAVAILABLE_ON_SUBSCRIPTION, "warning");
86
+ sessionFastMode = !sessionFastMode;
87
+ pi.setSessionFastMode(sessionFastMode);
88
+ ctx.ui.notify(`Fast mode ${sessionFastMode ? "enabled" : "disabled"}: ${model.id}`, "info");
90
89
  return;
91
90
  }
92
91
  if (!(await pi.setSessionModel(targetModel))) {
@@ -98,7 +97,9 @@ export default function serviceTierExtension(pi) {
98
97
  },
99
98
  });
100
99
  pi.on("before_provider_request", (event, ctx) => {
101
- const effectiveServiceTier = ctx.model?.api === OPENAI_CODEX_RESPONSES_API ? ctx.serviceTier : (ctx.serviceTier ?? settingsServiceTier);
100
+ const effectiveServiceTier = ctx.model?.api === OPENAI_CODEX_RESPONSES_API
101
+ ? (ctx.serviceTier ?? (sessionFastMode ? PRIORITY_TIER : undefined))
102
+ : (ctx.serviceTier ?? settingsServiceTier);
102
103
  return addServiceTierToPayload(ctx.model?.api, event.payload, effectiveServiceTier);
103
104
  });
104
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"service-tier.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/service-tier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAC7C,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAC5D,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,gCAAgC,GACrC,4FAA4F;IAC5F,4FAA4F;IAC5F,2CAA2C,CAAC;AAC7C,MAAM,iBAAiB,GAAqB,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAEtG,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAAoB,EAAE,OAAgB,EAAE,WAAyB;IACxG,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACzD,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QAC9D,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,OAAO;QACN,GAAG,OAAO;QACV,YAAY,EAAE,WAAW;KACzB,CAAC;AACH,CAA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,WAAW,GAAG,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YACzE,IAAI,CAAC,WAAW,EAAE,CAAC;gBAClB,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,gCAAgC,EAAE,SAAS,CAAC,CAAC;gBAC3D,OAAO;YACR,CAAC;YAED,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;gBAC9C,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,uBAAuB,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;gBACzF,OAAO;YACR,CAAC;YAED,MAAM,OAAO,GAAG,SAAS,KAAK,SAAS,CAAC;YACxC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC3F,CAAC;KACD,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/C,MAAM,oBAAoB,GACzB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,0BAA0B,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC;QAC5G,OAAO,uBAAuB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ModelRegistry } from \"../../model-registry.ts\";\nimport { SettingsManager } from \"../../settings-manager.ts\";\nimport type { ExtensionAPI, ServiceTier } from \"../types.ts\";\n\nexport type { ServiceTier };\n\ntype ProviderPayload = Record<string, unknown>;\n\nconst OPENAI_CODEX_PROVIDER = \"openai-codex\";\nconst OPENAI_CODEX_RESPONSES_API = \"openai-codex-responses\";\nconst FAST_MODEL_SUFFIX = \"-fast\";\n/**\n * `/fast` is registered only for `openai-codex`, but the catalog generator emits\n * `-fast` priority variants only for the direct `openai` provider, so no Codex\n * model ever has a target and the command could only report \"not supported\".\n *\n * That gap is intentional rather than an oversight in the generator: measured\n * against `chatgpt.com/backend-api/codex/responses` with a live ChatGPT Pro\n * subscription, `service_tier: \"priority\"` returns HTTP 200 but the response\n * echoes `\"auto\"`, while `\"auto\"`/`\"flex\"`/`\"scale\"` are rejected with HTTP 400\n * `Unsupported service_tier`. Priority processing is an API-billing feature, so\n * a subscription request is served at normal tier no matter what is sent — and\n * `getServiceTierCostMultiplier()` would still bill it at up to 2.5x.\n *\n * So the honest answer is that fast mode is unavailable here, not that the\n * model does not support it.\n */\nconst FAST_UNAVAILABLE_ON_SUBSCRIPTION =\n\t\"Fast mode (priority tier) is not available on a ChatGPT subscription: chatgpt.com accepts \" +\n\t\"service_tier=priority but serves the request at normal tier. Priority processing requires \" +\n\t\"API-key billing on the `openai` provider.\";\nconst SERVICE_TIER_APIS: ReadonlySet<Api> = new Set([\"openai-responses\", OPENAI_CODEX_RESPONSES_API]);\n\nfunction isRecord(value: unknown): value is ProviderPayload {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nexport function addServiceTierToPayload(api: Api | undefined, payload: unknown, serviceTier?: ServiceTier): unknown {\n\tif (!api || !SERVICE_TIER_APIS.has(api) || !serviceTier) {\n\t\treturn payload;\n\t}\n\n\tif (!isRecord(payload) || payload.service_tier !== undefined) {\n\t\treturn payload;\n\t}\n\n\treturn {\n\t\t...payload,\n\t\tservice_tier: serviceTier,\n\t};\n}\n\nfunction getRequestModelId(modelRegistry: ModelRegistry, model: Model<Api>): string {\n\treturn modelRegistry.getUpstreamModelId(model) ?? model.id;\n}\n\nfunction isCompatibleFastVariant(modelRegistry: ModelRegistry, baseModel: Model<Api>, fastModel: Model<Api>): boolean {\n\treturn (\n\t\tfastModel.provider === baseModel.provider &&\n\t\tfastModel.api === baseModel.api &&\n\t\tmodelRegistry.getServiceTier(fastModel) === \"priority\" &&\n\t\tgetRequestModelId(modelRegistry, fastModel) === getRequestModelId(modelRegistry, baseModel)\n\t);\n}\n\nfunction findBaseModel(modelRegistry: ModelRegistry, fastModel: Model<Api>): Model<Api> | undefined {\n\tif (!fastModel.id.endsWith(FAST_MODEL_SUFFIX)) {\n\t\treturn undefined;\n\t}\n\n\tconst baseModelId = fastModel.id.slice(0, -FAST_MODEL_SUFFIX.length);\n\tconst baseModel = modelRegistry.find(fastModel.provider, baseModelId);\n\treturn baseModel && isCompatibleFastVariant(modelRegistry, baseModel, fastModel) ? baseModel : undefined;\n}\n\nfunction findFastModel(modelRegistry: ModelRegistry, baseModel: Model<Api>): Model<Api> | undefined {\n\tif (baseModel.id.endsWith(FAST_MODEL_SUFFIX)) {\n\t\treturn undefined;\n\t}\n\n\tconst fastModel = modelRegistry.find(baseModel.provider, `${baseModel.id}${FAST_MODEL_SUFFIX}`);\n\treturn fastModel && isCompatibleFastVariant(modelRegistry, baseModel, fastModel) ? fastModel : undefined;\n}\n\nexport default function serviceTierExtension(pi: ExtensionAPI): void {\n\tlet settingsServiceTier: ServiceTier | undefined;\n\n\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\tconst settingsManager = SettingsManager.create(ctx.cwd);\n\t\tsettingsServiceTier = settingsManager.getOpenAIServiceTier();\n\n\t\tconst model = ctx.model;\n\t\tif (model?.provider !== OPENAI_CODEX_PROVIDER) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst baseModel = findBaseModel(ctx.modelRegistry, model);\n\t\tif (baseModel) {\n\t\t\tawait pi.setSessionModel(baseModel);\n\t\t}\n\t});\n\n\tpi.registerCommand(\"fast\", {\n\t\tdescription: \"Toggle OpenAI Codex fast mode for this session\",\n\t\thandler: async (_args, ctx) => {\n\t\t\tconst model = ctx.model;\n\t\t\tif (model?.provider !== OPENAI_CODEX_PROVIDER) {\n\t\t\t\tctx.ui.notify(\"Fast mode is only available for OpenAI Codex models.\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst baseModel = findBaseModel(ctx.modelRegistry, model);\n\t\t\tconst targetModel = baseModel ?? findFastModel(ctx.modelRegistry, model);\n\t\t\tif (!targetModel) {\n\t\t\t\tctx.ui.notify(FAST_UNAVAILABLE_ON_SUBSCRIPTION, \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!(await pi.setSessionModel(targetModel))) {\n\t\t\t\tctx.ui.notify(`Could not switch to ${targetModel.provider}/${targetModel.id}.`, \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst enabled = baseModel === undefined;\n\t\t\tctx.ui.notify(`Fast mode ${enabled ? \"enabled\" : \"disabled\"}: ${targetModel.id}`, \"info\");\n\t\t},\n\t});\n\n\tpi.on(\"before_provider_request\", (event, ctx) => {\n\t\tconst effectiveServiceTier =\n\t\t\tctx.model?.api === OPENAI_CODEX_RESPONSES_API ? ctx.serviceTier : (ctx.serviceTier ?? settingsServiceTier);\n\t\treturn addServiceTierToPayload(ctx.model?.api, event.payload, effectiveServiceTier);\n\t});\n}\n"]}
1
+ {"version":3,"file":"service-tier.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/service-tier.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAC5D,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,MAAM,aAAa,GAAgB,UAAU,CAAC;AAC9C,MAAM,iBAAiB,GAAqB,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAEtG,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,K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AO,GAAG,SAAS,KAAK,SAAS,CAAC;YACxC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC3F,CAAC;KACD,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC/C,MAAM,oBAAoB,GACzB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,0BAA0B;YAC5C,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,IAAI,mBAAmB,CAAC,CAAC;QAC7C,OAAO,uBAAuB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Api, Model } from \"@earendil-works/pi-ai\";\nimport type { ModelRegistry } from \"../../model-registry.ts\";\nimport { SettingsManager } from \"../../settings-manager.ts\";\nimport type { ExtensionAPI, ServiceTier } from \"../types.ts\";\n\nexport type { ServiceTier };\n\ntype ProviderPayload = Record<string, unknown>;\n\nconst OPENAI_CODEX_RESPONSES_API = \"openai-codex-responses\";\nconst FAST_MODEL_SUFFIX = \"-fast\";\nconst PRIORITY_TIER: ServiceTier = \"priority\";\nconst SERVICE_TIER_APIS: ReadonlySet<Api> = new Set([\"openai-responses\", OPENAI_CODEX_RESPONSES_API]);\n\nfunction isRecord(value: unknown): value is ProviderPayload {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nexport function addServiceTierToPayload(api: Api | undefined, payload: unknown, serviceTier?: ServiceTier): unknown {\n\tif (!api || !SERVICE_TIER_APIS.has(api) || !serviceTier) {\n\t\treturn payload;\n\t}\n\n\tif (!isRecord(payload) || payload.service_tier !== undefined) {\n\t\treturn payload;\n\t}\n\n\treturn {\n\t\t...payload,\n\t\tservice_tier: serviceTier,\n\t};\n}\n\nfunction getRequestModelId(modelRegistry: ModelRegistry, model: Model<Api>): string {\n\treturn modelRegistry.getUpstreamModelId(model) ?? model.id;\n}\n\nfunction isCompatibleFastVariant(modelRegistry: ModelRegistry, baseModel: Model<Api>, fastModel: Model<Api>): boolean {\n\treturn (\n\t\tfastModel.provider === baseModel.provider &&\n\t\tfastModel.api === baseModel.api &&\n\t\tmodelRegistry.getServiceTier(fastModel) === \"priority\" &&\n\t\tgetRequestModelId(modelRegistry, fastModel) === getRequestModelId(modelRegistry, baseModel)\n\t);\n}\n\nfunction findBaseModel(modelRegistry: ModelRegistry, fastModel: Model<Api>): Model<Api> | undefined {\n\tif (!fastModel.id.endsWith(FAST_MODEL_SUFFIX)) {\n\t\treturn undefined;\n\t}\n\n\tconst baseModelId = fastModel.id.slice(0, -FAST_MODEL_SUFFIX.length);\n\tconst baseModel = modelRegistry.find(fastModel.provider, baseModelId);\n\treturn baseModel && isCompatibleFastVariant(modelRegistry, baseModel, fastModel) ? baseModel : undefined;\n}\n\nfunction findFastModel(modelRegistry: ModelRegistry, baseModel: Model<Api>): Model<Api> | undefined {\n\tif (baseModel.id.endsWith(FAST_MODEL_SUFFIX)) {\n\t\treturn undefined;\n\t}\n\n\tconst fastModel = modelRegistry.find(baseModel.provider, `${baseModel.id}${FAST_MODEL_SUFFIX}`);\n\treturn fastModel && isCompatibleFastVariant(modelRegistry, baseModel, fastModel) ? fastModel : undefined;\n}\n\nexport default function serviceTierExtension(pi: ExtensionAPI): void {\n\tlet settingsServiceTier: ServiceTier | undefined;\n\t/**\n\t * Session-level fast mode for Codex models that have no `-fast` catalog sibling.\n\t *\n\t * The catalog generator emits `-fast` priority variants only for the direct\n\t * `openai` provider, so `openai-codex` models never have a switch target. The\n\t * ChatGPT backend still offers the tier to subscriptions:\n\t * `chatgpt.com/backend-api/codex/models` advertises a `priority` service tier\n\t * labelled \"Fast\" (\"1.5x speed, increased usage\")\n\t * for gpt-5.4/5.5/5.6-*, and the first-party Codex CLI sends\n\t * `service_tier: \"priority\"` on subscription OAuth. The response echo is not a\n\t * confirmation channel — it reads `auto`/`default` whether or not a tier was\n\t * sent — so this toggle drives the request field directly. See issue #545.\n\t */\n\tlet sessionFastMode = false;\n\n\tpi.on(\"session_start\", async (_event, ctx) => {\n\t\tconst settingsManager = SettingsManager.create(ctx.cwd);\n\t\tsettingsServiceTier = settingsManager.getOpenAIServiceTier();\n\t\tsessionFastMode = false;\n\t\tpi.setSessionFastMode(false);\n\n\t\tconst model = ctx.model;\n\t\tif (model?.api !== OPENAI_CODEX_RESPONSES_API) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst baseModel = findBaseModel(ctx.modelRegistry, model);\n\t\tif (baseModel) {\n\t\t\tawait pi.setSessionModel(baseModel);\n\t\t}\n\t});\n\n\tpi.registerCommand(\"fast\", {\n\t\tdescription: \"Toggle OpenAI Codex fast mode for this session\",\n\t\thandler: async (_args, ctx) => {\n\t\t\tconst model = ctx.model;\n\t\t\tif (model?.api !== OPENAI_CODEX_RESPONSES_API) {\n\t\t\t\tctx.ui.notify(\"Fast mode is only available for OpenAI Codex models.\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst baseModel = findBaseModel(ctx.modelRegistry, model);\n\t\t\tconst targetModel = baseModel ?? findFastModel(ctx.modelRegistry, model);\n\t\t\tif (!targetModel) {\n\t\t\t\tsessionFastMode = !sessionFastMode;\n\t\t\t\tpi.setSessionFastMode(sessionFastMode);\n\t\t\t\tctx.ui.notify(`Fast mode ${sessionFastMode ? \"enabled\" : \"disabled\"}: ${model.id}`, \"info\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!(await pi.setSessionModel(targetModel))) {\n\t\t\t\tctx.ui.notify(`Could not switch to ${targetModel.provider}/${targetModel.id}.`, \"error\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst enabled = baseModel === undefined;\n\t\t\tctx.ui.notify(`Fast mode ${enabled ? \"enabled\" : \"disabled\"}: ${targetModel.id}`, \"info\");\n\t\t},\n\t});\n\n\tpi.on(\"before_provider_request\", (event, ctx) => {\n\t\tconst effectiveServiceTier =\n\t\t\tctx.model?.api === OPENAI_CODEX_RESPONSES_API\n\t\t\t\t? (ctx.serviceTier ?? (sessionFastMode ? PRIORITY_TIER : undefined))\n\t\t\t\t: (ctx.serviceTier ?? settingsServiceTier);\n\t\treturn addServiceTierToPayload(ctx.model?.api, event.payload, effectiveServiceTier);\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AA4IrE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA0FhE;eAEc,yBAAyB"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AA+IrE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAsGhE;eAEc,yBAAyB"}
@@ -3,7 +3,8 @@ import { SettingsManager } from "../../../settings-manager.js";
3
3
  import { isAnthropicBashEnabled } from "../anthropic-bash/index.js";
4
4
  import { TERMINAL_MONITOR_STATE_EVENT } from "../monitor-state-event.js";
5
5
  import { MonitorNotifier } from "./monitor-notify.js";
6
- import { formatMonitorStatus, MONITOR_STATUS_KEY } from "./monitor-status.js";
6
+ import { MONITOR_STATUS_KEY } from "./monitor-status.js";
7
+ import { MonitorStatusTicker } from "./monitor-status-ticker.js";
7
8
  import { TerminalNotifier } from "./notify.js";
8
9
  import { TERMINAL_PROMPT_SECTION } from "./prompt.js";
9
10
  import { claimParkedBundle, parkBundle, TerminalSessionBundle, teardownParkedBundle, } from "./session-bundle.js";
@@ -30,12 +31,16 @@ function bundleSinks(pi, state) {
30
31
  return {
31
32
  onMonitorEvent: (event) => state.monitorNotifier?.notifyEvent(event),
32
33
  onMonitorState: (snapshot) => {
33
- const ctx = state.ctx;
34
- const status = formatMonitorStatus(snapshot);
35
- ctx?.ui.setStatus(MONITOR_STATUS_KEY, status === undefined || ctx.mode !== "tui"
36
- ? status
37
- : ctx.ui.theme.bg("selectedBg", ctx.ui.theme.fg("text", status)));
38
- pi.events?.emit(TERMINAL_MONITOR_STATE_EVENT, { activeCount: snapshot.length });
34
+ state.statusTicker.sync(snapshot);
35
+ pi.events?.emit(TERMINAL_MONITOR_STATE_EVENT, {
36
+ activeCount: snapshot.length,
37
+ monitors: snapshot.map((entry) => ({
38
+ id: entry.id,
39
+ description: entry.description,
40
+ paused: entry.paused,
41
+ startedAtMs: entry.startedAtMs,
42
+ })),
43
+ });
39
44
  },
40
45
  onBackgroundExit: (id, runtime) => state.notifier?.notifyCompletion(id, runtime),
41
46
  };
@@ -119,6 +124,14 @@ export function registerTerminalExtension(pi) {
119
124
  settings: TERMINAL_SETTINGS_DEFAULTS,
120
125
  notifier: null,
121
126
  monitorNotifier: null,
127
+ statusTicker: new MonitorStatusTicker({
128
+ render: (status) => {
129
+ const ctx = state.ctx;
130
+ ctx?.ui.setStatus(MONITOR_STATUS_KEY, status === undefined || ctx.mode !== "tui"
131
+ ? status
132
+ : ctx.ui.theme.bg("selectedBg", ctx.ui.theme.fg("text", status)));
133
+ },
134
+ }),
122
135
  ctx: undefined,
123
136
  shellPath: undefined,
124
137
  steppedAside: false,
@@ -187,6 +200,7 @@ export function registerTerminalExtension(pi) {
187
200
  state.monitorNotifier?.dispose();
188
201
  state.monitorNotifier = null;
189
202
  state.notifier = null;
203
+ state.statusTicker.stop();
190
204
  const sessionKey = sessionKeyOf(ctx) ?? sessionKeyOf(state.ctx);
191
205
  if (event.reason === "reload" && state.bundle && sessionKey !== undefined) {
192
206
  // Keep state.bundle referenced: exit listeners captured by this instance's tool