@bastani/atomic 0.9.89 → 0.9.90

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 (868) hide show
  1. package/CHANGELOG.md +220 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +25 -0
  3. package/dist/builtin/intercom/README.md +3 -1
  4. package/dist/builtin/intercom/broker/broker.ts +35 -10
  5. package/dist/builtin/intercom/broker/client.ts +42 -1
  6. package/dist/builtin/intercom/index.bundle.mjs +400 -67
  7. package/dist/builtin/intercom/package.json +1 -1
  8. package/dist/builtin/intercom/skills/intercom/SKILL.md +24 -5
  9. package/dist/builtin/intercom/types.ts +5 -0
  10. package/dist/builtin/mcp/package.json +1 -1
  11. package/dist/builtin/subagents/CHANGELOG.md +53 -0
  12. package/dist/builtin/subagents/README.md +18 -20
  13. package/dist/builtin/subagents/agents/worker.md +1 -1
  14. package/dist/builtin/subagents/package.json +1 -1
  15. package/dist/builtin/subagents/skills/feedback/SKILL.md +2 -2
  16. package/dist/builtin/subagents/skills/qlty/SKILL.md +2 -2
  17. package/dist/builtin/subagents/skills/qlty/references/commands.md +45 -12
  18. package/dist/builtin/subagents/skills/qlty/references/quickstart.md +102 -21
  19. package/dist/builtin/subagents/skills/subagent/SKILL.md +18 -17
  20. package/dist/builtin/subagents/skills/tdd/LICENSE.txt +50 -0
  21. package/dist/builtin/subagents/skills/tdd/SKILL.md +10 -0
  22. package/dist/builtin/subagents/skills/tdd/tests.md +16 -0
  23. package/dist/builtin/subagents/skills/tmux/LICENSE.txt +24 -0
  24. package/dist/builtin/subagents/skills/tmux/SKILL.md +20 -1
  25. package/dist/builtin/subagents/skills/tmux/scripts/find-sessions.sh +19 -10
  26. package/dist/builtin/subagents/skills/tmux/scripts/wait-for-text.sh +231 -19
  27. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1911 -845
  28. package/dist/builtin/web-access/CHANGELOG.md +12 -0
  29. package/dist/builtin/web-access/index.bundle.mjs +158 -34
  30. package/dist/builtin/web-access/package.json +1 -1
  31. package/dist/builtin/workflows/CHANGELOG.md +68 -0
  32. package/dist/builtin/workflows/builtin/{chunk-tjk7jp9a.js → chunk-akmcsx14.js} +1 -1
  33. package/dist/builtin/workflows/builtin/{chunk-913nwrzq.js → chunk-erpybg3c.js} +109 -30
  34. package/dist/builtin/workflows/builtin/{chunk-e07n7en6.js → chunk-wpgpr31s.js} +1 -1
  35. package/dist/builtin/workflows/builtin/goal.js +2 -2
  36. package/dist/builtin/workflows/builtin/index.js +3 -3
  37. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  38. package/dist/builtin/workflows/package.json +1 -1
  39. package/dist/builtin/workflows/skills/bro/SKILL.md +1 -1
  40. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_2.md +19 -19
  41. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_haiku_5_5.md +2 -2
  42. package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5_5.md +3 -3
  43. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6.md +2 -2
  44. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_sol.md +2 -2
  45. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_1_terra.md +3 -3
  46. package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_2.md +3 -2
  47. package/dist/builtin/workflows/skills/show-me/SKILL.md +2 -2
  48. package/dist/builtin/workflows/skills/skill-creator/scripts/run_eval.py +29 -24
  49. package/dist/builtin/workflows/skills/teach/SKILL.md +8 -8
  50. package/dist/builtin/workflows/skills/unslop/SKILL.md +29 -51
  51. package/dist/builtin/workflows/src/durable/journal/internal.d.ts +10 -5
  52. package/dist/builtin/workflows/src/durable/journal/sharded-run-journal.d.ts +6 -3
  53. package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +25 -3
  54. package/dist/builtin/workflows/src/extension/index.bundle.mjs +4444 -1356
  55. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +2544 -568
  56. package/dist/builtin/workflows/src/index.js +2467 -549
  57. package/dist/builtin/workflows/src/local-worker-entry.mjs +2544 -568
  58. package/dist/cli/storage-command.d.ts +6 -0
  59. package/dist/cli/storage-command.d.ts.map +1 -1
  60. package/dist/cli/storage-command.js +11 -0
  61. package/dist/cli/storage-command.js.map +1 -1
  62. package/dist/cli/storage-search-database.d.ts +18 -0
  63. package/dist/cli/storage-search-database.d.ts.map +1 -0
  64. package/dist/cli/storage-search-database.js +90 -0
  65. package/dist/cli/storage-search-database.js.map +1 -0
  66. package/dist/cli/storage-search-session.d.ts +5 -0
  67. package/dist/cli/storage-search-session.d.ts.map +1 -0
  68. package/dist/cli/storage-search-session.js +133 -0
  69. package/dist/cli/storage-search-session.js.map +1 -0
  70. package/dist/core/agent-session-accessors.d.ts.map +1 -1
  71. package/dist/core/agent-session-accessors.js +107 -1
  72. package/dist/core/agent-session-accessors.js.map +1 -1
  73. package/dist/core/agent-session-bash.d.ts.map +1 -1
  74. package/dist/core/agent-session-bash.js +2 -0
  75. package/dist/core/agent-session-bash.js.map +1 -1
  76. package/dist/core/agent-session-boundaries.d.ts +2 -0
  77. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  78. package/dist/core/agent-session-boundaries.js +9 -4
  79. package/dist/core/agent-session-boundaries.js.map +1 -1
  80. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  81. package/dist/core/agent-session-custom-message-commit.js +2 -1
  82. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  83. package/dist/core/agent-session-detached-tools.d.ts +3 -2
  84. package/dist/core/agent-session-detached-tools.d.ts.map +1 -1
  85. package/dist/core/agent-session-detached-tools.js +156 -41
  86. package/dist/core/agent-session-detached-tools.js.map +1 -1
  87. package/dist/core/agent-session-events.d.ts +2 -1
  88. package/dist/core/agent-session-events.d.ts.map +1 -1
  89. package/dist/core/agent-session-events.js +59 -23
  90. package/dist/core/agent-session-events.js.map +1 -1
  91. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  92. package/dist/core/agent-session-extension-bindings.js +53 -4
  93. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  94. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  95. package/dist/core/agent-session-message-queue.js +2 -1
  96. package/dist/core/agent-session-message-queue.js.map +1 -1
  97. package/dist/core/agent-session-methods.d.ts +23 -3
  98. package/dist/core/agent-session-methods.d.ts.map +1 -1
  99. package/dist/core/agent-session-methods.js.map +1 -1
  100. package/dist/core/agent-session-models.d.ts.map +1 -1
  101. package/dist/core/agent-session-models.js +2 -0
  102. package/dist/core/agent-session-models.js.map +1 -1
  103. package/dist/core/agent-session-prompt.d.ts +1 -1
  104. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  105. package/dist/core/agent-session-prompt.js +14 -3
  106. package/dist/core/agent-session-prompt.js.map +1 -1
  107. package/dist/core/agent-session-queue-pause.d.ts +2 -1
  108. package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
  109. package/dist/core/agent-session-queue-pause.js +8 -4
  110. package/dist/core/agent-session-queue-pause.js.map +1 -1
  111. package/dist/core/agent-session-retry.d.ts +7 -3
  112. package/dist/core/agent-session-retry.d.ts.map +1 -1
  113. package/dist/core/agent-session-retry.js +113 -112
  114. package/dist/core/agent-session-retry.js.map +1 -1
  115. package/dist/core/agent-session-runtime.d.ts +15 -0
  116. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  117. package/dist/core/agent-session-runtime.js +26 -0
  118. package/dist/core/agent-session-runtime.js.map +1 -1
  119. package/dist/core/agent-session-services.d.ts +5 -2
  120. package/dist/core/agent-session-services.d.ts.map +1 -1
  121. package/dist/core/agent-session-services.js +6 -6
  122. package/dist/core/agent-session-services.js.map +1 -1
  123. package/dist/core/agent-session-tasks.js.map +1 -1
  124. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  125. package/dist/core/agent-session-tool-registry.js +4 -2
  126. package/dist/core/agent-session-tool-registry.js.map +1 -1
  127. package/dist/core/agent-session-types.d.ts +19 -1
  128. package/dist/core/agent-session-types.d.ts.map +1 -1
  129. package/dist/core/agent-session-types.js.map +1 -1
  130. package/dist/core/agent-session.d.ts +11 -0
  131. package/dist/core/agent-session.d.ts.map +1 -1
  132. package/dist/core/agent-session.js +8 -0
  133. package/dist/core/agent-session.js.map +1 -1
  134. package/dist/core/anthropic-thinking-guard.d.ts +16 -1
  135. package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
  136. package/dist/core/anthropic-thinking-guard.js +124 -7
  137. package/dist/core/anthropic-thinking-guard.js.map +1 -1
  138. package/dist/core/auth-storage.d.ts +3 -0
  139. package/dist/core/auth-storage.d.ts.map +1 -1
  140. package/dist/core/auth-storage.js +10 -0
  141. package/dist/core/auth-storage.js.map +1 -1
  142. package/dist/core/detached-tool-output.d.ts +4 -0
  143. package/dist/core/detached-tool-output.d.ts.map +1 -0
  144. package/dist/core/detached-tool-output.js +48 -0
  145. package/dist/core/detached-tool-output.js.map +1 -0
  146. package/dist/core/event-loop-monitor.d.ts +4 -1
  147. package/dist/core/event-loop-monitor.d.ts.map +1 -1
  148. package/dist/core/event-loop-monitor.js +84 -159
  149. package/dist/core/event-loop-monitor.js.map +1 -1
  150. package/dist/core/export-html/index.d.ts.map +1 -1
  151. package/dist/core/export-html/index.js +26 -4
  152. package/dist/core/export-html/index.js.map +1 -1
  153. package/dist/core/export-html/saved-agent-cards.d.ts +15 -0
  154. package/dist/core/export-html/saved-agent-cards.d.ts.map +1 -0
  155. package/dist/core/export-html/saved-agent-cards.js +255 -0
  156. package/dist/core/export-html/saved-agent-cards.js.map +1 -0
  157. package/dist/core/export-html/saved-agent-viewer.js +101 -0
  158. package/dist/core/extensions/builtin-subagent-record-writer.d.ts +11 -0
  159. package/dist/core/extensions/builtin-subagent-record-writer.d.ts.map +1 -0
  160. package/dist/core/extensions/builtin-subagent-record-writer.js +33 -0
  161. package/dist/core/extensions/builtin-subagent-record-writer.js.map +1 -0
  162. package/dist/core/extensions/loader-api.d.ts +1 -1
  163. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  164. package/dist/core/extensions/loader-api.js +9 -2
  165. package/dist/core/extensions/loader-api.js.map +1 -1
  166. package/dist/core/extensions/loader-bindings.d.ts +7 -0
  167. package/dist/core/extensions/loader-bindings.d.ts.map +1 -1
  168. package/dist/core/extensions/loader-bindings.js +42 -1
  169. package/dist/core/extensions/loader-bindings.js.map +1 -1
  170. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  171. package/dist/core/extensions/loader-core.js +33 -12
  172. package/dist/core/extensions/loader-core.js.map +1 -1
  173. package/dist/core/extensions/runner-events.d.ts +2 -0
  174. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  175. package/dist/core/extensions/runner-events.js +17 -7
  176. package/dist/core/extensions/runner-events.js.map +1 -1
  177. package/dist/core/extensions/runner.d.ts +6 -2
  178. package/dist/core/extensions/runner.d.ts.map +1 -1
  179. package/dist/core/extensions/runner.js +5 -2
  180. package/dist/core/extensions/runner.js.map +1 -1
  181. package/dist/core/extensions/ui-types.d.ts +4 -0
  182. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  183. package/dist/core/extensions/ui-types.js.map +1 -1
  184. package/dist/core/extensions/workflow-run-control-hub.d.ts +2 -2
  185. package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
  186. package/dist/core/extensions/workflow-run-control-hub.js +2 -2
  187. package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
  188. package/dist/core/extensions/workflow-run-control.d.ts +10 -3
  189. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  190. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  191. package/dist/core/first-prompt-model.d.ts +22 -0
  192. package/dist/core/first-prompt-model.d.ts.map +1 -0
  193. package/dist/core/first-prompt-model.js +84 -0
  194. package/dist/core/first-prompt-model.js.map +1 -0
  195. package/dist/core/footer-data-provider.d.ts.map +1 -1
  196. package/dist/core/footer-data-provider.js +11 -7
  197. package/dist/core/footer-data-provider.js.map +1 -1
  198. package/dist/core/fork-replay-pair.d.ts +22 -0
  199. package/dist/core/fork-replay-pair.d.ts.map +1 -0
  200. package/dist/core/fork-replay-pair.js +174 -0
  201. package/dist/core/fork-replay-pair.js.map +1 -0
  202. package/dist/core/fork-replay-wire.d.ts +11 -0
  203. package/dist/core/fork-replay-wire.d.ts.map +1 -0
  204. package/dist/core/fork-replay-wire.js +116 -0
  205. package/dist/core/fork-replay-wire.js.map +1 -0
  206. package/dist/core/messages.d.ts +2 -0
  207. package/dist/core/messages.d.ts.map +1 -1
  208. package/dist/core/messages.js +8 -4
  209. package/dist/core/messages.js.map +1 -1
  210. package/dist/core/model-runtime.d.ts +10 -1
  211. package/dist/core/model-runtime.d.ts.map +1 -1
  212. package/dist/core/model-runtime.js +76 -11
  213. package/dist/core/model-runtime.js.map +1 -1
  214. package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
  215. package/dist/core/package-manager-auto-resources.js +3 -2
  216. package/dist/core/package-manager-auto-resources.js.map +1 -1
  217. package/dist/core/package-manager-resource-files.js +7 -8
  218. package/dist/core/package-manager-resource-files.js.map +1 -1
  219. package/dist/core/project-trust-state.d.ts +90 -0
  220. package/dist/core/project-trust-state.d.ts.map +1 -0
  221. package/dist/core/project-trust-state.js +65 -0
  222. package/dist/core/project-trust-state.js.map +1 -0
  223. package/dist/core/provider-rate-limits.d.ts +6 -0
  224. package/dist/core/provider-rate-limits.d.ts.map +1 -1
  225. package/dist/core/provider-rate-limits.js +43 -0
  226. package/dist/core/provider-rate-limits.js.map +1 -1
  227. package/dist/core/provider-request-admission.d.ts.map +1 -1
  228. package/dist/core/provider-request-admission.js +10 -1
  229. package/dist/core/provider-request-admission.js.map +1 -1
  230. package/dist/core/remote-catalog-provider.d.ts +6 -1
  231. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  232. package/dist/core/remote-catalog-provider.js +22 -1
  233. package/dist/core/remote-catalog-provider.js.map +1 -1
  234. package/dist/core/resolve-config-value.d.ts.map +1 -1
  235. package/dist/core/resolve-config-value.js +5 -2
  236. package/dist/core/resolve-config-value.js.map +1 -1
  237. package/dist/core/resource-loader-core.d.ts.map +1 -1
  238. package/dist/core/resource-loader-core.js +3 -0
  239. package/dist/core/resource-loader-core.js.map +1 -1
  240. package/dist/core/resource-loader-extensions.d.ts +2 -2
  241. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  242. package/dist/core/resource-loader-extensions.js +6 -4
  243. package/dist/core/resource-loader-extensions.js.map +1 -1
  244. package/dist/core/resource-loader-package-resources.d.ts +1 -0
  245. package/dist/core/resource-loader-package-resources.d.ts.map +1 -1
  246. package/dist/core/resource-loader-package-resources.js +2 -1
  247. package/dist/core/resource-loader-package-resources.js.map +1 -1
  248. package/dist/core/resource-loader-reload.d.ts +1 -1
  249. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  250. package/dist/core/resource-loader-reload.js +3 -2
  251. package/dist/core/resource-loader-reload.js.map +1 -1
  252. package/dist/core/resource-loader-types.d.ts +2 -0
  253. package/dist/core/resource-loader-types.d.ts.map +1 -1
  254. package/dist/core/resource-loader-types.js.map +1 -1
  255. package/dist/core/resume/blueprint/actions.d.ts.map +1 -1
  256. package/dist/core/resume/blueprint/actions.js +15 -15
  257. package/dist/core/resume/blueprint/actions.js.map +1 -1
  258. package/dist/core/resume/blueprint/process.d.ts +6 -1
  259. package/dist/core/resume/blueprint/process.d.ts.map +1 -1
  260. package/dist/core/resume/blueprint/process.js +132 -21
  261. package/dist/core/resume/blueprint/process.js.map +1 -1
  262. package/dist/core/runtime-credentials.d.ts +5 -0
  263. package/dist/core/runtime-credentials.d.ts.map +1 -1
  264. package/dist/core/runtime-credentials.js +34 -0
  265. package/dist/core/runtime-credentials.js.map +1 -1
  266. package/dist/core/sdk-types.d.ts +2 -0
  267. package/dist/core/sdk-types.d.ts.map +1 -1
  268. package/dist/core/sdk-types.js.map +1 -1
  269. package/dist/core/sdk.d.ts +1 -1
  270. package/dist/core/sdk.d.ts.map +1 -1
  271. package/dist/core/sdk.js +187 -32
  272. package/dist/core/sdk.js.map +1 -1
  273. package/dist/core/session-account-model.d.ts +15 -0
  274. package/dist/core/session-account-model.d.ts.map +1 -0
  275. package/dist/core/session-account-model.js +105 -0
  276. package/dist/core/session-account-model.js.map +1 -0
  277. package/dist/core/session-lifecycle-scope.d.ts +5 -0
  278. package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
  279. package/dist/core/session-lifecycle-scope.js.map +1 -1
  280. package/dist/core/session-manager-core.d.ts +21 -2
  281. package/dist/core/session-manager-core.d.ts.map +1 -1
  282. package/dist/core/session-manager-core.js +64 -8
  283. package/dist/core/session-manager-core.js.map +1 -1
  284. package/dist/core/session-manager-history.d.ts +3 -1
  285. package/dist/core/session-manager-history.d.ts.map +1 -1
  286. package/dist/core/session-manager-history.js +19 -5
  287. package/dist/core/session-manager-history.js.map +1 -1
  288. package/dist/core/session-manager-types.d.ts +2 -0
  289. package/dist/core/session-manager-types.d.ts.map +1 -1
  290. package/dist/core/session-manager-types.js.map +1 -1
  291. package/dist/core/session-retry-status.d.ts +22 -0
  292. package/dist/core/session-retry-status.d.ts.map +1 -0
  293. package/dist/core/session-retry-status.js +25 -0
  294. package/dist/core/session-retry-status.js.map +1 -0
  295. package/dist/core/session-worktree-snapshots.d.ts +4 -2
  296. package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
  297. package/dist/core/session-worktree-snapshots.js +8 -4
  298. package/dist/core/session-worktree-snapshots.js.map +1 -1
  299. package/dist/core/settings-manager-core.d.ts +4 -0
  300. package/dist/core/settings-manager-core.d.ts.map +1 -1
  301. package/dist/core/settings-manager-core.js +73 -1
  302. package/dist/core/settings-manager-core.js.map +1 -1
  303. package/dist/core/settings-schema.js +1 -1
  304. package/dist/core/settings-schema.js.map +1 -1
  305. package/dist/core/slash-commands.d.ts +2 -2
  306. package/dist/core/slash-commands.d.ts.map +1 -1
  307. package/dist/core/slash-commands.js +15 -4
  308. package/dist/core/slash-commands.js.map +1 -1
  309. package/dist/core/storage/database.d.ts +14 -2
  310. package/dist/core/storage/database.d.ts.map +1 -1
  311. package/dist/core/storage/database.js.map +1 -1
  312. package/dist/core/storage/dialect.d.ts +13 -0
  313. package/dist/core/storage/dialect.d.ts.map +1 -1
  314. package/dist/core/storage/dialect.js +9 -1
  315. package/dist/core/storage/dialect.js.map +1 -1
  316. package/dist/core/storage/errors.d.ts +23 -1
  317. package/dist/core/storage/errors.d.ts.map +1 -1
  318. package/dist/core/storage/errors.js +28 -5
  319. package/dist/core/storage/errors.js.map +1 -1
  320. package/dist/core/storage/journal-transfer.d.ts.map +1 -1
  321. package/dist/core/storage/journal-transfer.js +90 -5
  322. package/dist/core/storage/journal-transfer.js.map +1 -1
  323. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  324. package/dist/core/storage/node-sqlite.js +61 -1
  325. package/dist/core/storage/node-sqlite.js.map +1 -1
  326. package/dist/core/storage/session/chunked-resume-projection.d.ts +4 -0
  327. package/dist/core/storage/session/chunked-resume-projection.d.ts.map +1 -0
  328. package/dist/core/storage/session/chunked-resume-projection.js +369 -0
  329. package/dist/core/storage/session/chunked-resume-projection.js.map +1 -0
  330. package/dist/core/storage/session/legacy-session-store.d.ts +5 -0
  331. package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -1
  332. package/dist/core/storage/session/legacy-session-store.js +10 -2
  333. package/dist/core/storage/session/legacy-session-store.js.map +1 -1
  334. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
  335. package/dist/core/storage/session/memory-session-store.js +6 -1
  336. package/dist/core/storage/session/memory-session-store.js.map +1 -1
  337. package/dist/core/storage/session/snapshot-generation.d.ts +8 -0
  338. package/dist/core/storage/session/snapshot-generation.d.ts.map +1 -0
  339. package/dist/core/storage/session/snapshot-generation.js +17 -0
  340. package/dist/core/storage/session/snapshot-generation.js.map +1 -0
  341. package/dist/core/storage/session/sql-session-store.d.ts +12 -0
  342. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
  343. package/dist/core/storage/session/sql-session-store.js +243 -46
  344. package/dist/core/storage/session/sql-session-store.js.map +1 -1
  345. package/dist/core/storage/sqlite-facade.d.ts +17 -2
  346. package/dist/core/storage/sqlite-facade.d.ts.map +1 -1
  347. package/dist/core/storage/sqlite-facade.js +17 -1
  348. package/dist/core/storage/sqlite-facade.js.map +1 -1
  349. package/dist/core/tasks/agent-adapter.d.ts +13 -2
  350. package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
  351. package/dist/core/tasks/agent-adapter.js +25 -8
  352. package/dist/core/tasks/agent-adapter.js.map +1 -1
  353. package/dist/core/tasks/agent-panel-rules.d.ts +77 -0
  354. package/dist/core/tasks/agent-panel-rules.d.ts.map +1 -0
  355. package/dist/core/tasks/agent-panel-rules.js +88 -0
  356. package/dist/core/tasks/agent-panel-rules.js.map +1 -0
  357. package/dist/core/tasks/agent-panel-source.d.ts +19 -0
  358. package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
  359. package/dist/core/tasks/agent-panel-source.js +50 -9
  360. package/dist/core/tasks/agent-panel-source.js.map +1 -1
  361. package/dist/core/tasks/command-output.d.ts +17 -2
  362. package/dist/core/tasks/command-output.d.ts.map +1 -1
  363. package/dist/core/tasks/command-output.js +59 -3
  364. package/dist/core/tasks/command-output.js.map +1 -1
  365. package/dist/core/tasks/completion-message.d.ts +8 -3
  366. package/dist/core/tasks/completion-message.d.ts.map +1 -1
  367. package/dist/core/tasks/completion-message.js +14 -10
  368. package/dist/core/tasks/completion-message.js.map +1 -1
  369. package/dist/core/tasks/completion.d.ts +14 -4
  370. package/dist/core/tasks/completion.d.ts.map +1 -1
  371. package/dist/core/tasks/completion.js +58 -17
  372. package/dist/core/tasks/completion.js.map +1 -1
  373. package/dist/core/tasks/contracts.d.ts +10 -1
  374. package/dist/core/tasks/contracts.d.ts.map +1 -1
  375. package/dist/core/tasks/contracts.js +3 -1
  376. package/dist/core/tasks/contracts.js.map +1 -1
  377. package/dist/core/tasks/heartbeat.js +2 -1
  378. package/dist/core/tasks/heartbeat.js.map +1 -1
  379. package/dist/core/tasks/live-elapsed.d.ts +16 -1
  380. package/dist/core/tasks/live-elapsed.d.ts.map +1 -1
  381. package/dist/core/tasks/live-elapsed.js +43 -4
  382. package/dist/core/tasks/live-elapsed.js.map +1 -1
  383. package/dist/core/tasks/owner-store.d.ts +8 -0
  384. package/dist/core/tasks/owner-store.d.ts.map +1 -1
  385. package/dist/core/tasks/owner-store.js +34 -4
  386. package/dist/core/tasks/owner-store.js.map +1 -1
  387. package/dist/core/tasks/session-scope.d.ts +7 -0
  388. package/dist/core/tasks/session-scope.d.ts.map +1 -1
  389. package/dist/core/tasks/session-scope.js +15 -9
  390. package/dist/core/tasks/session-scope.js.map +1 -1
  391. package/dist/core/tasks/supervisor.d.ts +7 -3
  392. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  393. package/dist/core/tasks/supervisor.js +92 -17
  394. package/dist/core/tasks/supervisor.js.map +1 -1
  395. package/dist/core/tasks/task-archive-snapshot.d.ts +7 -0
  396. package/dist/core/tasks/task-archive-snapshot.d.ts.map +1 -0
  397. package/dist/core/tasks/task-archive-snapshot.js +33 -0
  398. package/dist/core/tasks/task-archive-snapshot.js.map +1 -0
  399. package/dist/core/tasks/task-resumer.d.ts +5 -3
  400. package/dist/core/tasks/task-resumer.d.ts.map +1 -1
  401. package/dist/core/tasks/task-resumer.js +37 -13
  402. package/dist/core/tasks/task-resumer.js.map +1 -1
  403. package/dist/core/tasks/task-view-source.d.ts +25 -3
  404. package/dist/core/tasks/task-view-source.d.ts.map +1 -1
  405. package/dist/core/tasks/task-view-source.js +144 -44
  406. package/dist/core/tasks/task-view-source.js.map +1 -1
  407. package/dist/core/tasks/transcript.d.ts +3 -1
  408. package/dist/core/tasks/transcript.d.ts.map +1 -1
  409. package/dist/core/tasks/transcript.js +27 -0
  410. package/dist/core/tasks/transcript.js.map +1 -1
  411. package/dist/core/tools/ask-user-question/view/dialog-builder.d.ts.map +1 -1
  412. package/dist/core/tools/ask-user-question/view/dialog-builder.js +2 -1
  413. package/dist/core/tools/ask-user-question/view/dialog-builder.js.map +1 -1
  414. package/dist/core/tools/bash.d.ts.map +1 -1
  415. package/dist/core/tools/bash.js +2 -1
  416. package/dist/core/tools/bash.js.map +1 -1
  417. package/dist/core/tools/history-protocol.d.ts.map +1 -1
  418. package/dist/core/tools/history-protocol.js +130 -29
  419. package/dist/core/tools/history-protocol.js.map +1 -1
  420. package/dist/core/tools/history-search-position.d.ts +30 -0
  421. package/dist/core/tools/history-search-position.d.ts.map +1 -0
  422. package/dist/core/tools/history-search-position.js +161 -0
  423. package/dist/core/tools/history-search-position.js.map +1 -0
  424. package/dist/core/tools/history-search-wire.d.ts +25 -0
  425. package/dist/core/tools/history-search-wire.d.ts.map +1 -0
  426. package/dist/core/tools/history-search-wire.js +210 -0
  427. package/dist/core/tools/history-search-wire.js.map +1 -0
  428. package/dist/core/tools/resource-selectors.d.ts +7 -1
  429. package/dist/core/tools/resource-selectors.d.ts.map +1 -1
  430. package/dist/core/tools/resource-selectors.js +18 -11
  431. package/dist/core/tools/resource-selectors.js.map +1 -1
  432. package/dist/core/tools/search.d.ts.map +1 -1
  433. package/dist/core/tools/search.js +24 -3
  434. package/dist/core/tools/search.js.map +1 -1
  435. package/dist/core/tools/sqlite-selector-connection.d.ts +3 -0
  436. package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
  437. package/dist/core/tools/sqlite-selector-connection.js +4 -0
  438. package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
  439. package/dist/core/tools/tool-abort-grace.d.ts +13 -0
  440. package/dist/core/tools/tool-abort-grace.d.ts.map +1 -0
  441. package/dist/core/tools/tool-abort-grace.js +72 -0
  442. package/dist/core/tools/tool-abort-grace.js.map +1 -0
  443. package/dist/core/tools/tool-concurrency.d.ts +5 -1
  444. package/dist/core/tools/tool-concurrency.d.ts.map +1 -1
  445. package/dist/core/tools/tool-concurrency.js +36 -6
  446. package/dist/core/tools/tool-concurrency.js.map +1 -1
  447. package/dist/core/workflow-resume.d.ts +1 -1
  448. package/dist/core/workflow-resume.d.ts.map +1 -1
  449. package/dist/core/workflow-resume.js +13 -3
  450. package/dist/core/workflow-resume.js.map +1 -1
  451. package/dist/core/workflow-summary-lifecycle.d.ts.map +1 -1
  452. package/dist/core/workflow-summary-lifecycle.js +8 -2
  453. package/dist/core/workflow-summary-lifecycle.js.map +1 -1
  454. package/dist/core/workspace/errors.d.ts +5 -2
  455. package/dist/core/workspace/errors.d.ts.map +1 -1
  456. package/dist/core/workspace/errors.js +59 -5
  457. package/dist/core/workspace/errors.js.map +1 -1
  458. package/dist/core/worktree-snapshot/blob-store.d.ts +138 -17
  459. package/dist/core/worktree-snapshot/blob-store.d.ts.map +1 -1
  460. package/dist/core/worktree-snapshot/blob-store.js +788 -82
  461. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  462. package/dist/core/worktree-snapshot/garbage.d.ts +17 -2
  463. package/dist/core/worktree-snapshot/garbage.d.ts.map +1 -1
  464. package/dist/core/worktree-snapshot/garbage.js +20 -4
  465. package/dist/core/worktree-snapshot/garbage.js.map +1 -1
  466. package/dist/core/worktree-snapshot/index.d.ts +1 -1
  467. package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
  468. package/dist/core/worktree-snapshot/index.js +1 -1
  469. package/dist/core/worktree-snapshot/index.js.map +1 -1
  470. package/dist/core/worktree-snapshot/pool.d.ts.map +1 -1
  471. package/dist/core/worktree-snapshot/pool.js +38 -6
  472. package/dist/core/worktree-snapshot/pool.js.map +1 -1
  473. package/dist/core/worktree-snapshot/shared-clock.d.ts +3 -1
  474. package/dist/core/worktree-snapshot/shared-clock.d.ts.map +1 -1
  475. package/dist/core/worktree-snapshot/shared-clock.js +116 -26
  476. package/dist/core/worktree-snapshot/shared-clock.js.map +1 -1
  477. package/dist/core/worktree-snapshot/types.d.ts +4 -1
  478. package/dist/core/worktree-snapshot/types.d.ts.map +1 -1
  479. package/dist/core/worktree-snapshot/types.js.map +1 -1
  480. package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
  481. package/dist/extensions/llama/huggingface-ui.js +2 -2
  482. package/dist/extensions/llama/huggingface-ui.js.map +1 -1
  483. package/dist/extensions/llama/index.d.ts +2 -0
  484. package/dist/extensions/llama/index.d.ts.map +1 -1
  485. package/dist/extensions/llama/index.js +19 -2
  486. package/dist/extensions/llama/index.js.map +1 -1
  487. package/dist/index.d.ts +9 -6
  488. package/dist/index.d.ts.map +1 -1
  489. package/dist/index.js +8 -4
  490. package/dist/index.js.map +1 -1
  491. package/dist/main.d.ts.map +1 -1
  492. package/dist/main.js +74 -15
  493. package/dist/main.js.map +1 -1
  494. package/dist/modes/interactive/components/agent-panel.d.ts +22 -6
  495. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  496. package/dist/modes/interactive/components/agent-panel.js +80 -23
  497. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  498. package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
  499. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  500. package/dist/modes/interactive/components/assistant-message.js +11 -0
  501. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  502. package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
  503. package/dist/modes/interactive/components/atomic-working-status.js +10 -3
  504. package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
  505. package/dist/modes/interactive/components/bash-execution.d.ts +3 -2
  506. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  507. package/dist/modes/interactive/components/bash-execution.js +7 -7
  508. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  509. package/dist/modes/interactive/components/branch-summary-message.d.ts +6 -0
  510. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  511. package/dist/modes/interactive/components/branch-summary-message.js +12 -7
  512. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  513. package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
  514. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  515. package/dist/modes/interactive/components/chat-message-renderer.js +24 -3
  516. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  517. package/dist/modes/interactive/components/chat-session-host-actions.d.ts +1 -1
  518. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  519. package/dist/modes/interactive/components/chat-session-host-actions.js +16 -10
  520. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  521. package/dist/modes/interactive/components/chat-session-host-events.d.ts +10 -0
  522. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  523. package/dist/modes/interactive/components/chat-session-host-events.js +76 -31
  524. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  525. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +17 -5
  526. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  527. package/dist/modes/interactive/components/chat-session-host-rendering.js +79 -24
  528. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  529. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  530. package/dist/modes/interactive/components/chat-session-host-runtime.js +5 -4
  531. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  532. package/dist/modes/interactive/components/chat-session-host-state.d.ts +16 -1
  533. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  534. package/dist/modes/interactive/components/chat-session-host-state.js +22 -0
  535. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  536. package/dist/modes/interactive/components/chat-session-host-types.d.ts +8 -2
  537. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
  538. package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
  539. package/dist/modes/interactive/components/chat-session-host-utils.d.ts +1 -0
  540. package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
  541. package/dist/modes/interactive/components/chat-session-host-utils.js +2 -1
  542. package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -1
  543. package/dist/modes/interactive/components/chat-session-host.d.ts +35 -9
  544. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  545. package/dist/modes/interactive/components/chat-session-host.js +129 -35
  546. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  547. package/dist/modes/interactive/components/chat-transcript.d.ts +13 -2
  548. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  549. package/dist/modes/interactive/components/chat-transcript.js +24 -4
  550. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  551. package/dist/modes/interactive/components/compaction-boundary-message.d.ts +6 -0
  552. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  553. package/dist/modes/interactive/components/compaction-boundary-message.js +12 -7
  554. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  555. package/dist/modes/interactive/components/composer-rule.d.ts +0 -2
  556. package/dist/modes/interactive/components/composer-rule.d.ts.map +1 -1
  557. package/dist/modes/interactive/components/composer-rule.js +4 -6
  558. package/dist/modes/interactive/components/composer-rule.js.map +1 -1
  559. package/dist/modes/interactive/components/countdown-timer.d.ts +5 -9
  560. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  561. package/dist/modes/interactive/components/countdown-timer.js +32 -23
  562. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  563. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  564. package/dist/modes/interactive/components/custom-editor.js +4 -3
  565. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  566. package/dist/modes/interactive/components/custom-entry.d.ts +6 -0
  567. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  568. package/dist/modes/interactive/components/custom-entry.js +15 -0
  569. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  570. package/dist/modes/interactive/components/custom-message.d.ts +7 -3
  571. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  572. package/dist/modes/interactive/components/custom-message.js +17 -15
  573. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  574. package/dist/modes/interactive/components/footer.d.ts +10 -3
  575. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  576. package/dist/modes/interactive/components/footer.js +37 -45
  577. package/dist/modes/interactive/components/footer.js.map +1 -1
  578. package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -1
  579. package/dist/modes/interactive/components/heartbeat-block.js +3 -1
  580. package/dist/modes/interactive/components/heartbeat-block.js.map +1 -1
  581. package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -1
  582. package/dist/modes/interactive/components/host-input-form.js +3 -3
  583. package/dist/modes/interactive/components/host-input-form.js.map +1 -1
  584. package/dist/modes/interactive/components/index.d.ts +1 -1
  585. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  586. package/dist/modes/interactive/components/index.js.map +1 -1
  587. package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
  588. package/dist/modes/interactive/components/input-label.js +4 -5
  589. package/dist/modes/interactive/components/input-label.js.map +1 -1
  590. package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
  591. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  592. package/dist/modes/interactive/components/keybinding-hints.js +27 -6
  593. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  594. package/dist/modes/interactive/components/main-composer-keys.d.ts +17 -2
  595. package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
  596. package/dist/modes/interactive/components/main-composer-keys.js +44 -27
  597. package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
  598. package/dist/modes/interactive/components/model-selector.d.ts +6 -1
  599. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  600. package/dist/modes/interactive/components/model-selector.js +13 -7
  601. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  602. package/dist/modes/interactive/components/nav-keys.d.ts +7 -2
  603. package/dist/modes/interactive/components/nav-keys.d.ts.map +1 -1
  604. package/dist/modes/interactive/components/nav-keys.js +51 -17
  605. package/dist/modes/interactive/components/nav-keys.js.map +1 -1
  606. package/dist/modes/interactive/components/notice-line.d.ts +8 -0
  607. package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
  608. package/dist/modes/interactive/components/notice-line.js +6 -1
  609. package/dist/modes/interactive/components/notice-line.js.map +1 -1
  610. package/dist/modes/interactive/components/selector.d.ts +3 -0
  611. package/dist/modes/interactive/components/selector.d.ts.map +1 -1
  612. package/dist/modes/interactive/components/selector.js +30 -7
  613. package/dist/modes/interactive/components/selector.js.map +1 -1
  614. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
  615. package/dist/modes/interactive/components/session-selector-list.js +11 -11
  616. package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
  617. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  618. package/dist/modes/interactive/components/session-selector.js +2 -2
  619. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  620. package/dist/modes/interactive/components/settings-picker.d.ts +5 -0
  621. package/dist/modes/interactive/components/settings-picker.d.ts.map +1 -1
  622. package/dist/modes/interactive/components/settings-picker.js +36 -2
  623. package/dist/modes/interactive/components/settings-picker.js.map +1 -1
  624. package/dist/modes/interactive/components/settings-selector-submenus.d.ts +10 -0
  625. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
  626. package/dist/modes/interactive/components/settings-selector-submenus.js +89 -19
  627. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
  628. package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -0
  629. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  630. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  631. package/dist/modes/interactive/components/settings-selector.d.ts +7 -0
  632. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  633. package/dist/modes/interactive/components/settings-selector.js +12 -0
  634. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  635. package/dist/modes/interactive/components/skill-invocation-message.d.ts +6 -0
  636. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  637. package/dist/modes/interactive/components/skill-invocation-message.js +12 -7
  638. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  639. package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
  640. package/dist/modes/interactive/components/task-board.js +9 -2
  641. package/dist/modes/interactive/components/task-board.js.map +1 -1
  642. package/dist/modes/interactive/components/task-completion-message.d.ts +10 -3
  643. package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
  644. package/dist/modes/interactive/components/task-completion-message.js +173 -19
  645. package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
  646. package/dist/modes/interactive/components/task-inspector.d.ts +1 -1
  647. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  648. package/dist/modes/interactive/components/task-inspector.js +28 -19
  649. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  650. package/dist/modes/interactive/components/task-list.d.ts +7 -3
  651. package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
  652. package/dist/modes/interactive/components/task-list.js +60 -33
  653. package/dist/modes/interactive/components/task-list.js.map +1 -1
  654. package/dist/modes/interactive/components/task-row.d.ts +7 -0
  655. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  656. package/dist/modes/interactive/components/task-row.js +25 -11
  657. package/dist/modes/interactive/components/task-row.js.map +1 -1
  658. package/dist/modes/interactive/components/task-transcript-notices.d.ts +16 -0
  659. package/dist/modes/interactive/components/task-transcript-notices.d.ts.map +1 -0
  660. package/dist/modes/interactive/components/task-transcript-notices.js +74 -0
  661. package/dist/modes/interactive/components/task-transcript-notices.js.map +1 -0
  662. package/dist/modes/interactive/components/task-transcript-page.d.ts +11 -6
  663. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  664. package/dist/modes/interactive/components/task-transcript-page.js +48 -21
  665. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  666. package/dist/modes/interactive/components/tool-block-families.d.ts.map +1 -1
  667. package/dist/modes/interactive/components/tool-block-families.js +2 -1
  668. package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
  669. package/dist/modes/interactive/components/tool-execution.d.ts +3 -2
  670. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  671. package/dist/modes/interactive/components/tool-execution.js +23 -9
  672. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  673. package/dist/modes/interactive/components/transcript-block-clicks.d.ts +54 -14
  674. package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
  675. package/dist/modes/interactive/components/transcript-block-clicks.js +151 -16
  676. package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
  677. package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -1
  678. package/dist/modes/interactive/components/tree-selector-help.js +25 -30
  679. package/dist/modes/interactive/components/tree-selector-help.js.map +1 -1
  680. package/dist/modes/interactive/components/tree-selector-list.d.ts +4 -0
  681. package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -1
  682. package/dist/modes/interactive/components/tree-selector-list.js +21 -21
  683. package/dist/modes/interactive/components/tree-selector-list.js.map +1 -1
  684. package/dist/modes/interactive/components/working-run-meter.d.ts +31 -2
  685. package/dist/modes/interactive/components/working-run-meter.d.ts.map +1 -1
  686. package/dist/modes/interactive/components/working-run-meter.js +81 -10
  687. package/dist/modes/interactive/components/working-run-meter.js.map +1 -1
  688. package/dist/modes/interactive/interactive-agent-events.js +67 -14
  689. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  690. package/dist/modes/interactive/interactive-autocomplete.js +2 -2
  691. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  692. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  693. package/dist/modes/interactive/interactive-deferred-startup.js +10 -4
  694. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  695. package/dist/modes/interactive/interactive-editor-actions.js +4 -1
  696. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  697. package/dist/modes/interactive/interactive-extension-custom-ui.js +13 -3
  698. package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
  699. package/dist/modes/interactive/interactive-extension-runtime.js +4 -2
  700. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  701. package/dist/modes/interactive/interactive-extension-widgets.js +6 -8
  702. package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -1
  703. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  704. package/dist/modes/interactive/interactive-input-handling.js +43 -3
  705. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  706. package/dist/modes/interactive/interactive-mode-base.d.ts +7 -0
  707. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  708. package/dist/modes/interactive/interactive-mode-base.js +9 -2
  709. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  710. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -1
  711. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  712. package/dist/modes/interactive/interactive-mode-deps.js +1 -1
  713. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  714. package/dist/modes/interactive/interactive-mode-helpers.d.ts +5 -0
  715. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  716. package/dist/modes/interactive/interactive-mode-helpers.js +9 -0
  717. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  718. package/dist/modes/interactive/interactive-mode-surface.d.ts +10 -2
  719. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  720. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  721. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  722. package/dist/modes/interactive/interactive-model-routing.js +63 -21
  723. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  724. package/dist/modes/interactive/interactive-prompt-turn.js +1 -1
  725. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  726. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  727. package/dist/modes/interactive/interactive-render-chat.js +71 -10
  728. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  729. package/dist/modes/interactive/interactive-resource-rendering.js +9 -18
  730. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
  731. package/dist/modes/interactive/interactive-selectors.js +106 -57
  732. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  733. package/dist/modes/interactive/interactive-session-routing.js +10 -5
  734. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  735. package/dist/modes/interactive/interactive-session-runtime.d.ts +3 -0
  736. package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
  737. package/dist/modes/interactive/interactive-session-runtime.js +11 -0
  738. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  739. package/dist/modes/interactive/interactive-slash-commands.js +3 -0
  740. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  741. package/dist/modes/interactive/interactive-startup-chat-container.d.ts +5 -1
  742. package/dist/modes/interactive/interactive-startup-chat-container.d.ts.map +1 -1
  743. package/dist/modes/interactive/interactive-startup-chat-container.js +8 -3
  744. package/dist/modes/interactive/interactive-startup-chat-container.js.map +1 -1
  745. package/dist/modes/interactive/interactive-startup-trust.d.ts +2 -0
  746. package/dist/modes/interactive/interactive-startup-trust.d.ts.map +1 -1
  747. package/dist/modes/interactive/interactive-startup-trust.js +21 -0
  748. package/dist/modes/interactive/interactive-startup-trust.js.map +1 -1
  749. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  750. package/dist/modes/interactive/interactive-startup.js +39 -17
  751. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  752. package/dist/modes/interactive/interactive-task-projection.d.ts.map +1 -1
  753. package/dist/modes/interactive/interactive-task-projection.js +11 -1
  754. package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
  755. package/dist/modes/interactive/resume-catalog.d.ts.map +1 -1
  756. package/dist/modes/interactive/resume-catalog.js +1 -0
  757. package/dist/modes/interactive/resume-catalog.js.map +1 -1
  758. package/dist/modes/interactive/theme/theme-controller.d.ts +6 -1
  759. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  760. package/dist/modes/interactive/theme/theme-controller.js +19 -1
  761. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  762. package/dist/modes/interactive-engine/engine-child-liveness.d.ts +2 -0
  763. package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -1
  764. package/dist/modes/interactive-engine/engine-child-liveness.js +2 -0
  765. package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -1
  766. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  767. package/dist/modes/interactive-engine/engine-custom-ui.js +54 -4
  768. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  769. package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -1
  770. package/dist/modes/interactive-engine/engine-render-service.js +21 -2
  771. package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
  772. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +4 -2
  773. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  774. package/dist/modes/interactive-engine/extension-ui-bridge.js +4 -0
  775. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  776. package/dist/modes/interactive-engine/isolated-runtime.d.ts +39 -3
  777. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  778. package/dist/modes/interactive-engine/isolated-runtime.js +219 -29
  779. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  780. package/dist/modes/interactive-engine/protocol.d.ts +33 -1
  781. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  782. package/dist/modes/interactive-engine/protocol.js +40 -2
  783. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  784. package/dist/modes/interactive-engine/remote-command-catalog.d.ts +2 -2
  785. package/dist/modes/interactive-engine/remote-command-catalog.d.ts.map +1 -1
  786. package/dist/modes/interactive-engine/remote-command-catalog.js +7 -3
  787. package/dist/modes/interactive-engine/remote-command-catalog.js.map +1 -1
  788. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  789. package/dist/modes/interactive-engine/remote-component.js +31 -5
  790. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  791. package/dist/modes/interactive-engine/remote-renderer.d.ts +20 -12
  792. package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
  793. package/dist/modes/interactive-engine/remote-renderer.js +100 -34
  794. package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
  795. package/dist/modes/print-mode.d.ts.map +1 -1
  796. package/dist/modes/print-mode.js +4 -1
  797. package/dist/modes/print-mode.js.map +1 -1
  798. package/dist/modes/rpc/agent-panel-bridge.d.ts +7 -0
  799. package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
  800. package/dist/modes/rpc/agent-panel-bridge.js +119 -114
  801. package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
  802. package/dist/modes/rpc/rpc-client-process.d.ts +2 -1
  803. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  804. package/dist/modes/rpc/rpc-client-process.js +2 -1
  805. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  806. package/dist/modes/rpc/rpc-client.d.ts +8 -0
  807. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  808. package/dist/modes/rpc/rpc-client.js +5 -1
  809. package/dist/modes/rpc/rpc-client.js.map +1 -1
  810. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  811. package/dist/modes/rpc/rpc-command-handler.js +19 -2
  812. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  813. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  814. package/dist/modes/rpc/rpc-mode.js +4 -2
  815. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  816. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  817. package/dist/modes/rpc/rpc-session-binding.js +7 -0
  818. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  819. package/dist/modes/rpc/rpc-types.d.ts +13 -1
  820. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  821. package/dist/modes/rpc/rpc-types.js.map +1 -1
  822. package/dist/utils/interactive-engine-bootstrap.d.ts +3 -0
  823. package/dist/utils/interactive-engine-bootstrap.d.ts.map +1 -1
  824. package/dist/utils/interactive-engine-bootstrap.js +25 -0
  825. package/dist/utils/interactive-engine-bootstrap.js.map +1 -1
  826. package/dist/utils/interactive-engine-env.d.ts +3 -0
  827. package/dist/utils/interactive-engine-env.d.ts.map +1 -1
  828. package/dist/utils/interactive-engine-env.js +1 -0
  829. package/dist/utils/interactive-engine-env.js.map +1 -1
  830. package/dist/utils/shell.d.ts +2 -0
  831. package/dist/utils/shell.d.ts.map +1 -1
  832. package/dist/utils/shell.js +3 -3
  833. package/dist/utils/shell.js.map +1 -1
  834. package/docs/background-tasks.md +32 -37
  835. package/docs/compaction.md +2 -2
  836. package/docs/computer-use.md +2 -0
  837. package/docs/development.md +11 -1
  838. package/docs/environment-variables.md +2 -0
  839. package/docs/extensions/api-reference.md +7 -3
  840. package/docs/extensions/authoring.md +3 -1
  841. package/docs/extensions/events.md +3 -1
  842. package/docs/extensions/ui.md +2 -0
  843. package/docs/guides/resume-on-any-machine.md +3 -1
  844. package/docs/intercom/reference.md +1 -1
  845. package/docs/intercom.md +3 -3
  846. package/docs/keybindings.md +6 -2
  847. package/docs/libraries/tui.md +4 -0
  848. package/docs/providers.md +1 -1
  849. package/docs/rpc/protocol.md +6 -4
  850. package/docs/sdk/reference.md +10 -4
  851. package/docs/sdk.md +5 -2
  852. package/docs/security.md +5 -1
  853. package/docs/session-format.md +1 -1
  854. package/docs/sessions.md +16 -0
  855. package/docs/settings.md +2 -2
  856. package/docs/skills.md +3 -3
  857. package/docs/storage.md +25 -4
  858. package/docs/subagents.md +42 -45
  859. package/docs/tui.md +1 -1
  860. package/docs/usage.md +3 -1
  861. package/docs/workflows/api-reference.md +3 -1
  862. package/docs/workflows/authoring.md +1 -1
  863. package/docs/workflows/operations.md +21 -14
  864. package/docs/workflows.md +1 -1
  865. package/docs/worktree-snapshots.md +10 -8
  866. package/npm-shrinkwrap.json +71 -49
  867. package/package.json +9 -8
  868. package/schemas/settings.schema.json +1 -1
@@ -9,9 +9,22 @@
9
9
  */
10
10
  import { randomBytes } from "node:crypto";
11
11
  import * as fs from "node:fs";
12
- import { open, readdir, stat, unlink } from "node:fs/promises";
13
- import { dirname, join } from "node:path";
12
+ import { readdir, stat, unlink } from "node:fs/promises";
13
+ import { dirname, join, toNamespacedPath } from "node:path";
14
14
  import lockfile, {} from "proper-lockfile";
15
+ // A cold lock must not resolve the optional package. A loaded package can disappear when its host unloads it.
16
+ const loadedKey = Symbol.for("@bastani/atomic/windows-temporary@4");
17
+ export function windowsTemporaryFiles() {
18
+ if (process.platform !== "win32")
19
+ return undefined;
20
+ const host = process;
21
+ try {
22
+ return loadedKey in host ? host[loadedKey]?.deref() : undefined;
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ }
15
28
  const PROBE_NAME = /^\.clock-[0-9a-f]{16}\.probe$/;
16
29
  /**
17
30
  * How old, by the filesystem's clock, a probe file is when its process no longer has a use for it: one lives for a
@@ -21,21 +34,70 @@ export const LEFTOVER_PROBE_AGE_MS = 10 * 60_000;
21
34
  /** When each directory's leftover probes were last removed by this process, by this process's clock. */
22
35
  const sweptAt = new Map();
23
36
  /** Removes the probes in `directory` older than {@link LEFTOVER_PROBE_AGE_MS}, at most once per that age. */
24
- async function removeLeftoverProbes(directory, offset) {
37
+ async function removeLeftoverProbes(directory, offset, clock) {
25
38
  const last = sweptAt.get(directory);
26
39
  if (last !== undefined && Date.now() - last < LEFTOVER_PROBE_AGE_MS)
27
40
  return;
28
41
  sweptAt.set(directory, Date.now());
29
- const now = Date.now() + offset;
42
+ const now = clock() + offset;
30
43
  for (const name of await readdir(directory).catch(() => [])) {
31
44
  if (!PROBE_NAME.test(name))
32
45
  continue;
33
46
  const probe = join(directory, name);
34
47
  const age = await stat(probe).then((stats) => now - stats.mtimeMs, () => 0);
35
- if (age > LEFTOVER_PROBE_AGE_MS)
36
- await unlink(probe).catch(() => { });
48
+ if (age > LEFTOVER_PROBE_AGE_MS) {
49
+ // Only ask for deletion access to an old file. On Windows recheck its age on the handle we remove.
50
+ const sweep = windowsTemporaryFiles()?.removeWindowsFileOlderThan(toNamespacedPath(probe), now - LEFTOVER_PROBE_AGE_MS);
51
+ await (sweep ?? unlink(probe)).catch(() => { });
52
+ }
37
53
  }
38
54
  }
55
+ function probePath(directory) {
56
+ // Probe names must not consume a UUID from the caller's record sequence.
57
+ return join(directory, `.clock-${randomBytes(8).toString("hex")}.probe`);
58
+ }
59
+ function elapsedClock() {
60
+ return performance.now();
61
+ }
62
+ /** A cold reading needs only a descriptor, not a FileHandle or an optional native operation. */
63
+ function ordinaryReading(directory, fallback, retry = true) {
64
+ const probe = probePath(directory);
65
+ // Ordinary lock offsets keep the wall-clock midpoint. A late open or stat callback is not the
66
+ // instant of creation, and a host's elapsed clock may stop while a renewing owner sleeps.
67
+ const wallOffset = fallback === undefined;
68
+ const clock = wallOffset ? Date.now : elapsedClock;
69
+ const before = wallOffset ? clock() : 0;
70
+ return new Promise((resolve, reject) => {
71
+ const opened = (error, fd) => {
72
+ if (error)
73
+ return resolve(retry && error.code === "EEXIST" ? ordinaryReading(directory, fallback, false) : (fallback ?? 0));
74
+ const finish = (offset) => fs.unlink(probe, () => {
75
+ if (offset === undefined)
76
+ return resolve(fallback ?? 0);
77
+ removeLeftoverProbes(directory, offset, clock).then(() => {
78
+ resolve(wallOffset ? offset : clock() + offset);
79
+ }, reject);
80
+ });
81
+ fs.close(fd, (error) => {
82
+ if (error)
83
+ return finish();
84
+ fs.stat(probe, (error, stats) => {
85
+ if (error)
86
+ return finish();
87
+ const sampled = clock();
88
+ finish(stats.mtimeMs - (wallOffset ? (before + sampled) / 2 : sampled));
89
+ });
90
+ });
91
+ };
92
+ try {
93
+ fs.open(probe, "wx", opened);
94
+ }
95
+ catch {
96
+ // The callback API throws before submission for invalid paths, including an embedded NUL.
97
+ resolve(fallback ?? 0);
98
+ }
99
+ });
100
+ }
39
101
  /**
40
102
  * How far the clock of the filesystem holding `directory` runs ahead of this process's clock, in milliseconds: the
41
103
  * mtime the filesystem stamps on a file created in `directory` now, less this process's time now. The probe file,
@@ -43,28 +105,56 @@ async function removeLeftoverProbes(directory, offset) {
43
105
  * Probes a process left when it stopped mid-probe are removed once they are {@link LEFTOVER_PROBE_AGE_MS} old by the
44
106
  * filesystem's clock.
45
107
  */
46
- export async function sharedClockOffset(directory) {
47
- // Random bytes, not a UUID: the probe's name never takes a UUID the caller's own records draw.
48
- const probe = join(directory, `.clock-${randomBytes(8).toString("hex")}.probe`);
49
- let offset = 0;
50
- try {
108
+ export function sharedClockOffset(directory) {
109
+ return sampleClock(directory);
110
+ }
111
+ /** The shared filesystem's time. Windows advances a measured stamp through cleanup, never through a queued create. */
112
+ export function sharedClockNow(directory) {
113
+ const local = Date.now();
114
+ // Preserve the ordinary estimate, including the entry-time fallback when the probe fails.
115
+ if (process.platform !== "win32")
116
+ return ordinaryReading(directory).then((offset) => local + offset);
117
+ return sampleClock(directory, local);
118
+ }
119
+ function sampleClock(directory, fallback) {
120
+ const binding = windowsTemporaryFiles();
121
+ if (!binding)
122
+ return ordinaryReading(directory, fallback);
123
+ return windowsReading(directory, binding, fallback);
124
+ }
125
+ async function windowsReading(directory, binding, fallback) {
126
+ const clock = binding.windowsClockTick;
127
+ for (let attempt = 0; attempt < 2; attempt++) {
128
+ const probe = probePath(directory);
129
+ let reading;
130
+ let offset;
131
+ let wallOffset;
51
132
  const before = Date.now();
52
- await (await open(probe, "w")).close();
53
- const { mtimeMs } = await stat(probe);
54
- offset = mtimeMs - (before + Date.now()) / 2;
55
- }
56
- catch {
57
- return 0;
133
+ try {
134
+ // Runtime fs.open namespaces Windows paths before passing them to libuv (e.g. a literal trailing dot).
135
+ reading = await binding.readWindowsClockProbe(toNamespacedPath(probe));
136
+ // No native create was attempted if this host did not export its file operations.
137
+ if (!reading)
138
+ return ordinaryReading(directory, fallback, attempt === 0);
139
+ // Both ends use the worker's monotonic clock, so a pause before native entry never ages the file.
140
+ offset = reading.mtimeMs - reading.sampledAtMs;
141
+ // A relative offset keeps the ordinary wall-clock midpoint, measured before cleanup: a civil clock
142
+ // step during cleanup must not move the lock timestamp it converts.
143
+ wallOffset = reading.mtimeMs - (before + Date.now()) / 2;
144
+ }
145
+ catch (error) {
146
+ if (error.message === "EEXIST")
147
+ continue;
148
+ break;
149
+ }
150
+ finally {
151
+ if (reading?.pending)
152
+ await reading.pending.close().catch(() => { });
153
+ }
154
+ await removeLeftoverProbes(directory, offset, clock);
155
+ return fallback === undefined ? wallOffset : clock() + offset;
58
156
  }
59
- finally {
60
- await unlink(probe).catch(() => { });
61
- }
62
- await removeLeftoverProbes(directory, offset);
63
- return offset;
64
- }
65
- /** The time now by the clock of the filesystem holding `directory`, which every host sharing it reads alike. */
66
- export async function sharedClockNow(directory) {
67
- return Date.now() + (await sharedClockOffset(directory));
157
+ return fallback ?? 0;
68
158
  }
69
159
  /**
70
160
  * How each lock file's mtime, in the filesystem's clock, reads in this process's clock, by lock file: the same mtime
@@ -1 +1 @@
1
- {"version":3,"file":"shared-clock.js","sourceRoot":"","sources":["../../../src/core/worktree-snapshot/shared-clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,QAAQ,EAAE,EAAoB,MAAM,iBAAiB,CAAC;AAE7D,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MA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AO,QAAQ,CAAC,KAAK,CAAC,CAAC;YAClC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBAClC,IAAI,CAAC,SAAS;oBAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;gBAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAiB,EAAE,QAAuD;IAC9F,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAE5F;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAoB;IAC5D,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["/**\n * One clock for files several hosts share (#5050). A lease or lock is judged stale by how long ago its holder last\n * refreshed it, and its holder and a reader may run on different hosts whose clocks disagree. Comparing the mtime one\n * host's clock stamped with another host's clock lets a live holder on a host whose clock lags lose its slot, and a\n * crashed holder whose clock runs ahead keep it for as long as the skew. Here both sides go by the clock of the\n * filesystem holding the file instead: how far it runs from this process's clock is measured by writing a probe file\n * next to the file, whose mtime the filesystem stamps, so holders stamp refresh times in the filesystem's clock and\n * readers measure ages in it.\n */\nimport { randomBytes } from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport { open, readdir, stat, unlink } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport lockfile, { type LockOptions } from \"proper-lockfile\";\n\nconst PROBE_NAME = /^\\.clock-[0-9a-f]{16}\\.probe$/;\n\n/**\n * How old, by the filesystem's clock, a probe file is when its process no longer has a use for it: one lives for a\n * create and a stat, so one this old was left by a process that stopped between creating and removing it.\n */\nexport const LEFTOVER_PROBE_AGE_MS = 10 * 60_000;\n\n/** When each directory's leftover probes were last removed by this process, by this process's clock. */\nconst sweptAt = new Map<string, number>();\n\n/** Removes the probes in `directory` older than {@link LEFTOVER_PROBE_AGE_MS}, at most once per that age. */\nasync function removeLeftoverProbes(directory: string, offset: number): Promise<void> {\n\tconst last = sweptAt.get(directory);\n\tif (last !== undefined && Date.now() - last < LEFTOVER_PROBE_AGE_MS) return;\n\tsweptAt.set(directory, Date.now());\n\tconst now = Date.now() + offset;\n\tfor (const name of await readdir(directory).catch(() => [] as string[])) {\n\t\tif (!PROBE_NAME.test(name)) continue;\n\t\tconst probe = join(directory, name);\n\t\tconst age = await stat(probe).then(\n\t\t\t(stats) => now - stats.mtimeMs,\n\t\t\t() => 0,\n\t\t);\n\t\tif (age > LEFTOVER_PROBE_AGE_MS) await unlink(probe).catch(() => {});\n\t}\n}\n\n/**\n * How far the clock of the filesystem holding `directory` runs ahead of this process's clock, in milliseconds: the\n * mtime the filesystem stamps on a file created in `directory` now, less this process's time now. The probe file,\n * `.clock-<random hex>.probe`, is removed at once. 0, this process's own clock, when no file can be created there.\n * Probes a process left when it stopped mid-probe are removed once they are {@link LEFTOVER_PROBE_AGE_MS} old by the\n * filesystem's clock.\n */\nexport async function sharedClockOffset(directory: string): Promise<number> {\n\t// Random bytes, not a UUID: the probe's name never takes a UUID the caller's own records draw.\n\tconst probe = join(directory, `.clock-${randomBytes(8).toString(\"hex\")}.probe`);\n\tlet offset = 0;\n\ttry {\n\t\tconst before = Date.now();\n\t\tawait (await open(probe, \"w\")).close();\n\t\tconst { mtimeMs } = await stat(probe);\n\t\toffset = mtimeMs - (before + Date.now()) / 2;\n\t} catch {\n\t\treturn 0;\n\t} finally {\n\t\tawait unlink(probe).catch(() => {});\n\t}\n\tawait removeLeftoverProbes(directory, offset);\n\treturn offset;\n}\n\n/** The time now by the clock of the filesystem holding `directory`, which every host sharing it reads alike. */\nexport async function sharedClockNow(directory: string): Promise<number> {\n\treturn Date.now() + (await sharedClockOffset(directory));\n}\n\n/**\n * How each lock file's mtime, in the filesystem's clock, reads in this process's clock, by lock file: the same mtime\n * always reads the same, so a holder finds the mtime it stamped unchanged, though the offset is measured anew each\n * time. A lock's reading is dropped when the lock is removed.\n */\nconst readings = new Map<string, { shared: number; local: number }>();\n\nfunction remember(path: string, shared: number, local: number): void {\n\treadings.set(path, { shared, local });\n}\n\nfunction sharedStat(path: fs.PathLike, callback: (error: NodeJS.ErrnoException | null, stats?: fs.Stats) => void) {\n\tconst file = String(path);\n\tsharedClockOffset(dirname(file)).then((offset) =>\n\t\tfs.stat(file, (error, stats) => {\n\t\t\tif (error) return callback(error);\n\t\t\tconst shared = stats.mtime.getTime();\n\t\t\tconst reading = readings.get(file);\n\t\t\tconst local = reading?.shared === shared ? reading.local : shared - offset;\n\t\t\tremember(file, shared, local);\n\t\t\tcallback(null, Object.assign(Object.create(Object.getPrototypeOf(stats)), stats, { mtime: new Date(local) }));\n\t\t}),\n\t);\n}\n\nfunction sharedUtimes(\n\tpath: fs.PathLike,\n\tatime: fs.TimeLike,\n\tmtime: fs.TimeLike,\n\tcallback: (error: NodeJS.ErrnoException | null) => void,\n) {\n\tconst file = String(path);\n\tconst local = new Date(mtime).getTime();\n\tsharedClockOffset(dirname(file)).then((offset) => {\n\t\tconst shared = new Date(local + offset);\n\t\tfs.utimes(file, atime, shared, (error) => {\n\t\t\tif (error) return callback(error);\n\t\t\tfs.stat(file, (statError, stats) => {\n\t\t\t\tif (!statError) remember(file, stats.mtime.getTime(), local);\n\t\t\t\tcallback(null);\n\t\t\t});\n\t\t});\n\t});\n}\n\nfunction sharedRmdir(path: fs.PathLike, callback: (error: NodeJS.ErrnoException | null) => void) {\n\treadings.delete(String(path));\n\tfs.rmdir(path, callback);\n}\n\n/**\n * The file system proper-lockfile works through: a lock's mtime is stamped and read in the filesystem's clock, while\n * proper-lockfile compares it with this process's clock, so a lock refreshed on a host whose clock is off by minutes\n * or days still reads as refreshed when it was (#5050).\n */\nconst sharedClockFs = { ...fs, stat: sharedStat, utimes: sharedUtimes, rmdir: sharedRmdir };\n\n/**\n * Takes a proper-lockfile lock of `path` whose staleness every host sharing it judges by the clock of the filesystem\n * holding it (#5050): a holder on a host whose clock lags keeps its lock, and one whose clock runs ahead loses it once\n * it stopped refreshing it for the stale time.\n */\nexport function lockShared(path: string, options: LockOptions): Promise<() => Promise<void>> {\n\treturn lockfile.lock(path, { ...options, fs: sharedClockFs });\n}\n"]}
1
+ {"version":3,"file":"shared-clock.js","sourceRoot":"","sources":["../../../src/core/worktree-snapshot/shared-clock.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,QAAQ,EAAE,EAAoB,MAAM,iBAAiB,CAAC;AAE7D,8GAA8G;AAC9G,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AACpE,MAAM,UAAU,qBAAqB;IACpC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,SAAS,CAAC;IACnD,MAAM,IAAI,GAAG,OAAoE,CAAC;IAClF,IAAI,CAAC;QACJ,OAAO,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC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AAI,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBAClC,IAAI,CAAC,SAAS;oBAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAAC;gBAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAiB,EAAE,QAAuD;IAC9F,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAE5F;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,OAAoB;IAC5D,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["/**\n * One clock for files several hosts share (#5050). A lease or lock is judged stale by how long ago its holder last\n * refreshed it, and its holder and a reader may run on different hosts whose clocks disagree. Comparing the mtime one\n * host's clock stamped with another host's clock lets a live holder on a host whose clock lags lose its slot, and a\n * crashed holder whose clock runs ahead keep it for as long as the skew. Here both sides go by the clock of the\n * filesystem holding the file instead: how far it runs from this process's clock is measured by writing a probe file\n * next to the file, whose mtime the filesystem stamps, so holders stamp refresh times in the filesystem's clock and\n * readers measure ages in it.\n */\nimport { randomBytes } from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport { readdir, stat, unlink } from \"node:fs/promises\";\nimport { dirname, join, toNamespacedPath } from \"node:path\";\nimport type * as native from \"@bastani/atomic-natives\";\nimport lockfile, { type LockOptions } from \"proper-lockfile\";\n\n// A cold lock must not resolve the optional package. A loaded package can disappear when its host unloads it.\nconst loadedKey = Symbol.for(\"@bastani/atomic/windows-temporary@4\");\nexport function windowsTemporaryFiles(): typeof native | undefined {\n\tif (process.platform !== \"win32\") return undefined;\n\tconst host = process as NodeJS.Process & { [loadedKey]?: WeakRef<typeof native> };\n\ttry {\n\t\treturn loadedKey in host ? host[loadedKey]?.deref() : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nconst PROBE_NAME = /^\\.clock-[0-9a-f]{16}\\.probe$/;\n\n/**\n * How old, by the filesystem's clock, a probe file is when its process no longer has a use for it: one lives for a\n * create and a stat, so one this old was left by a process that stopped between creating and removing it.\n */\nexport const LEFTOVER_PROBE_AGE_MS = 10 * 60_000;\n\n/** When each directory's leftover probes were last removed by this process, by this process's clock. */\nconst sweptAt = new Map<string, number>();\n\n/** Removes the probes in `directory` older than {@link LEFTOVER_PROBE_AGE_MS}, at most once per that age. */\nasync function removeLeftoverProbes(directory: string, offset: number, clock: () => number): Promise<void> {\n\tconst last = sweptAt.get(directory);\n\tif (last !== undefined && Date.now() - last < LEFTOVER_PROBE_AGE_MS) return;\n\tsweptAt.set(directory, Date.now());\n\tconst now = clock() + offset;\n\tfor (const name of await readdir(directory).catch(() => [] as string[])) {\n\t\tif (!PROBE_NAME.test(name)) continue;\n\t\tconst probe = join(directory, name);\n\t\tconst age = await stat(probe).then(\n\t\t\t(stats) => now - stats.mtimeMs,\n\t\t\t() => 0,\n\t\t);\n\t\tif (age > LEFTOVER_PROBE_AGE_MS) {\n\t\t\t// Only ask for deletion access to an old file. On Windows recheck its age on the handle we remove.\n\t\t\tconst sweep = windowsTemporaryFiles()?.removeWindowsFileOlderThan(\n\t\t\t\ttoNamespacedPath(probe),\n\t\t\t\tnow - LEFTOVER_PROBE_AGE_MS,\n\t\t\t);\n\t\t\tawait (sweep ?? unlink(probe)).catch(() => {});\n\t\t}\n\t}\n}\n\nfunction probePath(directory: string): string {\n\t// Probe names must not consume a UUID from the caller's record sequence.\n\treturn join(directory, `.clock-${randomBytes(8).toString(\"hex\")}.probe`);\n}\n\nfunction elapsedClock(): number {\n\treturn performance.now();\n}\n\n/** A cold reading needs only a descriptor, not a FileHandle or an optional native operation. */\nfunction ordinaryReading(directory: string, fallback?: number, retry = true): Promise<number> {\n\tconst probe = probePath(directory);\n\t// Ordinary lock offsets keep the wall-clock midpoint. A late open or stat callback is not the\n\t// instant of creation, and a host's elapsed clock may stop while a renewing owner sleeps.\n\tconst wallOffset = fallback === undefined;\n\tconst clock = wallOffset ? Date.now : elapsedClock;\n\tconst before = wallOffset ? clock() : 0;\n\treturn new Promise((resolve, reject) => {\n\t\tconst opened = (error: NodeJS.ErrnoException | null, fd: number) => {\n\t\t\tif (error)\n\t\t\t\treturn resolve(\n\t\t\t\t\tretry && error.code === \"EEXIST\" ? ordinaryReading(directory, fallback, false) : (fallback ?? 0),\n\t\t\t\t);\n\t\t\tconst finish = (offset?: number) =>\n\t\t\t\tfs.unlink(probe, () => {\n\t\t\t\t\tif (offset === undefined) return resolve(fallback ?? 0);\n\t\t\t\t\tremoveLeftoverProbes(directory, offset, clock).then(() => {\n\t\t\t\t\t\tresolve(wallOffset ? offset : clock() + offset);\n\t\t\t\t\t}, reject);\n\t\t\t\t});\n\t\t\tfs.close(fd, (error) => {\n\t\t\t\tif (error) return finish();\n\t\t\t\tfs.stat(probe, (error, stats) => {\n\t\t\t\t\tif (error) return finish();\n\t\t\t\t\tconst sampled = clock();\n\t\t\t\t\tfinish(stats.mtimeMs - (wallOffset ? (before + sampled) / 2 : sampled));\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\ttry {\n\t\t\tfs.open(probe, \"wx\", opened);\n\t\t} catch {\n\t\t\t// The callback API throws before submission for invalid paths, including an embedded NUL.\n\t\t\tresolve(fallback ?? 0);\n\t\t}\n\t});\n}\n\n/**\n * How far the clock of the filesystem holding `directory` runs ahead of this process's clock, in milliseconds: the\n * mtime the filesystem stamps on a file created in `directory` now, less this process's time now. The probe file,\n * `.clock-<random hex>.probe`, is removed at once. 0, this process's own clock, when no file can be created there.\n * Probes a process left when it stopped mid-probe are removed once they are {@link LEFTOVER_PROBE_AGE_MS} old by the\n * filesystem's clock.\n */\nexport function sharedClockOffset(directory: string): Promise<number> {\n\treturn sampleClock(directory);\n}\n\n/** The shared filesystem's time. Windows advances a measured stamp through cleanup, never through a queued create. */\nexport function sharedClockNow(directory: string): Promise<number> {\n\tconst local = Date.now();\n\t// Preserve the ordinary estimate, including the entry-time fallback when the probe fails.\n\tif (process.platform !== \"win32\") return ordinaryReading(directory).then((offset) => local + offset);\n\treturn sampleClock(directory, local);\n}\n\nfunction sampleClock(directory: string, fallback?: number): Promise<number> {\n\tconst binding = windowsTemporaryFiles();\n\tif (!binding) return ordinaryReading(directory, fallback);\n\treturn windowsReading(directory, binding, fallback);\n}\n\nasync function windowsReading(directory: string, binding: typeof native, fallback?: number): Promise<number> {\n\tconst clock = binding.windowsClockTick;\n\tfor (let attempt = 0; attempt < 2; attempt++) {\n\t\tconst probe = probePath(directory);\n\t\tlet reading: native.WindowsClockReading | null | undefined;\n\t\tlet offset: number;\n\t\tlet wallOffset: number;\n\t\tconst before = Date.now();\n\t\ttry {\n\t\t\t// Runtime fs.open namespaces Windows paths before passing them to libuv (e.g. a literal trailing dot).\n\t\t\treading = await binding.readWindowsClockProbe(toNamespacedPath(probe));\n\t\t\t// No native create was attempted if this host did not export its file operations.\n\t\t\tif (!reading) return ordinaryReading(directory, fallback, attempt === 0);\n\t\t\t// Both ends use the worker's monotonic clock, so a pause before native entry never ages the file.\n\t\t\toffset = reading.mtimeMs - reading.sampledAtMs;\n\t\t\t// A relative offset keeps the ordinary wall-clock midpoint, measured before cleanup: a civil clock\n\t\t\t// step during cleanup must not move the lock timestamp it converts.\n\t\t\twallOffset = reading.mtimeMs - (before + Date.now()) / 2;\n\t\t} catch (error) {\n\t\t\tif ((error as Error).message === \"EEXIST\") continue;\n\t\t\tbreak;\n\t\t} finally {\n\t\t\tif (reading?.pending) await reading.pending.close().catch(() => {});\n\t\t}\n\t\tawait removeLeftoverProbes(directory, offset, clock);\n\t\treturn fallback === undefined ? wallOffset : clock() + offset;\n\t}\n\treturn fallback ?? 0;\n}\n\n/**\n * How each lock file's mtime, in the filesystem's clock, reads in this process's clock, by lock file: the same mtime\n * always reads the same, so a holder finds the mtime it stamped unchanged, though the offset is measured anew each\n * time. A lock's reading is dropped when the lock is removed.\n */\nconst readings = new Map<string, { shared: number; local: number }>();\n\nfunction remember(path: string, shared: number, local: number): void {\n\treadings.set(path, { shared, local });\n}\n\nfunction sharedStat(path: fs.PathLike, callback: (error: NodeJS.ErrnoException | null, stats?: fs.Stats) => void) {\n\tconst file = String(path);\n\tsharedClockOffset(dirname(file)).then((offset) =>\n\t\tfs.stat(file, (error, stats) => {\n\t\t\tif (error) return callback(error);\n\t\t\tconst shared = stats.mtime.getTime();\n\t\t\tconst reading = readings.get(file);\n\t\t\tconst local = reading?.shared === shared ? reading.local : shared - offset;\n\t\t\tremember(file, shared, local);\n\t\t\tcallback(null, Object.assign(Object.create(Object.getPrototypeOf(stats)), stats, { mtime: new Date(local) }));\n\t\t}),\n\t);\n}\n\nfunction sharedUtimes(\n\tpath: fs.PathLike,\n\tatime: fs.TimeLike,\n\tmtime: fs.TimeLike,\n\tcallback: (error: NodeJS.ErrnoException | null) => void,\n) {\n\tconst file = String(path);\n\tconst local = new Date(mtime).getTime();\n\tsharedClockOffset(dirname(file)).then((offset) => {\n\t\tconst shared = new Date(local + offset);\n\t\tfs.utimes(file, atime, shared, (error) => {\n\t\t\tif (error) return callback(error);\n\t\t\tfs.stat(file, (statError, stats) => {\n\t\t\t\tif (!statError) remember(file, stats.mtime.getTime(), local);\n\t\t\t\tcallback(null);\n\t\t\t});\n\t\t});\n\t});\n}\n\nfunction sharedRmdir(path: fs.PathLike, callback: (error: NodeJS.ErrnoException | null) => void) {\n\treadings.delete(String(path));\n\tfs.rmdir(path, callback);\n}\n\n/**\n * The file system proper-lockfile works through: a lock's mtime is stamped and read in the filesystem's clock, while\n * proper-lockfile compares it with this process's clock, so a lock refreshed on a host whose clock is off by minutes\n * or days still reads as refreshed when it was (#5050).\n */\nconst sharedClockFs = { ...fs, stat: sharedStat, utimes: sharedUtimes, rmdir: sharedRmdir };\n\n/**\n * Takes a proper-lockfile lock of `path` whose staleness every host sharing it judges by the clock of the filesystem\n * holding it (#5050): a holder on a host whose clock lags keeps its lock, and one whose clock runs ahead loses it once\n * it stopped refreshing it for the stale time.\n */\nexport function lockShared(path: string, options: LockOptions): Promise<() => Promise<void>> {\n\treturn lockfile.lock(path, { ...options, fs: sharedClockFs });\n}\n"]}
@@ -20,7 +20,10 @@ export interface WorktreeSnapshotSettings {
20
20
  readonly maxSnapshotBytes: number;
21
21
  /** Record a full delta against `head` after this many incremental snapshots. Default 10. */
22
22
  readonly fullEvery: number;
23
- /** Delete unreferenced snapshot blobs automatically when a session closes or a root workflow run finishes. Default true. */
23
+ /**
24
+ * Delete unreferenced snapshot blobs automatically, in the background of an interactive session, after a session
25
+ * closes, and when a root workflow run finishes. Default true.
26
+ */
24
27
  readonly autoCollect: boolean;
25
28
  /** Shortest time between two automatic collections of one database, in seconds, on the database's clock. Default 3600. */
26
29
  readonly collectIntervalSeconds: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/worktree-snapshot/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,qHAAqH;AACrH,MAAM,WAAW,wBAAwB;IACxC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,0FAA0F;I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M,CAAC;IACzB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,uHAAuH;AACvH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iHAAiH;IACjH,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/worktree-snapshot/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The portable identity of a workspace: the remotes that hold its history, the commit it is based on, the Git tree of\n * its content, and a fingerprint of its dependency inputs. Schedulers and workspace providers consume this shape.\n */\nexport interface WorkspaceBinding {\n\tremotes: string[];\n\thead: string;\n\ttree: string;\n\tenvHash: string;\n}\n\n/** Snapshot capture settings, from `snapshots.*` in settings.json, `createAgentSession`, or workflow run options. */\nexport interface WorktreeSnapshotSettings {\n\t/** Record snapshots at all. Default true. */\n\treadonly enabled: boolean;\n\t/** Capture untracked files that no ignore rule or deny pattern excludes. Default true. */\n\treadonly includeUntracked: boolean;\n\t/** Largest single file captured, in bytes. Default 5 MiB. */\n\treadonly maxFileBytes: number;\n\t/** Largest total of captured file content, patch chain and unpushed-commit bundle, in bytes. Default 50 MiB. */\n\treadonly maxSnapshotBytes: number;\n\t/** Record a full delta against `head` after this many incremental snapshots. Default 10. */\n\treadonly fullEvery: number;\n\t/** Delete unreferenced snapshot blobs automatically when a session closes or a root workflow run finishes. Default true. */\n\treadonly autoCollect: boolean;\n\t/** Shortest time between two automatic collections of one database, in seconds, on the database's clock. Default 3600. */\n\treadonly collectIntervalSeconds: number;\n\t/** Blobs stored or re-stored less than this many seconds ago are never collected. 0 turns the protection off. Default 3600. */\n\treadonly graceSeconds: number;\n}\n\n/**\n * Why a path was left out. `nested-repository` is an untracked repository inside the checkout (`path` ends in `/`);\n * `submodule-changes`, `unpushed-submodule-commit` and `submodule-unchecked` name a submodule whose uncommitted\n * changes, local commit, or state (when checking it failed or took too long) a snapshot does not record.\n */\nexport type WorktreeSnapshotPathOmissionReason =\n\t| \"denied\"\n\t| \"snapshot-ignore\"\n\t| \"untracked-excluded\"\n\t| \"nested-repository\"\n\t| \"submodule-changes\"\n\t| \"unpushed-submodule-commit\"\n\t| \"submodule-unchecked\";\nexport type WorktreeSnapshotSizeOmissionReason = \"over-file-cap\" | \"over-snapshot-cap\";\n\n/** Content a snapshot left out, and why. */\nexport type WorktreeSnapshotOmission =\n\t| { readonly reason: WorktreeSnapshotPathOmissionReason; readonly path: string }\n\t| { readonly reason: WorktreeSnapshotSizeOmissionReason; readonly path: string; readonly bytes: number }\n\t| {\n\t\t\treadonly reason: \"unpushed-history-denied\";\n\t\t\treadonly commits: readonly string[];\n\t\t\treadonly paths: readonly string[];\n\t }\n\t| { readonly reason: \"bundle-over-cap\"; readonly commits: readonly string[]; readonly bytes: number };\n\nexport type WorktreeSnapshotOmissionReason = WorktreeSnapshotOmission[\"reason\"];\n\n/** One step of a patch chain: applying `patch` (a blob hash, or null for no change) produces `tree`. */\nexport interface WorktreeSnapshotChainLink {\n\treadonly tree: string;\n\treadonly patch: string | null;\n\treadonly bytes: number;\n}\n\n/** Conversion settings on the recording machine that can make a worktree's files differ from Git's stored content. */\nexport interface WorktreeSnapshotFilters {\n\treadonly autocrlf: string | null;\n\treadonly eol: string | null;\n\t/** Filter drivers that the repository's `.gitattributes` files name, such as `lfs`. */\n\treadonly drivers: readonly string[];\n}\n\nexport interface WorktreeSnapshotBundle {\n\t/** Blob hash of a `git bundle` holding the commits reachable from `head` and from no remote-tracking ref. */\n\treadonly blob: string;\n\treadonly bytes: number;\n\treadonly commits: readonly string[];\n}\n\n/** The recorded state of one repository checkout. Every field is JSON. Blob hashes refer to a {@link SnapshotBlobStore}. */\nexport interface WorktreeSnapshot {\n\treadonly version: 1;\n\t/** Content-derived identity: equal ids mean equal reconstruction inputs. */\n\treadonly id: string;\n\t/** Absolute checkout root on the recording machine. Informational. */\n\treadonly root: string;\n\treadonly remotes: readonly string[];\n\t/** Current branch, or null when detached. */\n\treadonly branch: string | null;\n\treadonly head: string;\n\t/** Commit object for the full working tree, parented on `head`. Local to the recording machine. */\n\treadonly snapshot: string;\n\treadonly tree: string;\n\treadonly envHash: string;\n\t/** The newest link: a full delta against `head`, or an incremental one against the previous snapshot. */\n\treadonly delta: { readonly base: \"head\" | string; readonly patch: string | null; readonly bytes: number };\n\t/** Links from the latest full delta to this snapshot, in application order. Never longer than `fullEvery`. */\n\treadonly chain: readonly WorktreeSnapshotChainLink[];\n\treadonly bundle: WorktreeSnapshotBundle | null;\n\treadonly omitted: readonly WorktreeSnapshotOmission[];\n\treadonly filters: WorktreeSnapshotFilters | null;\n\treadonly capturedAt: string;\n}\n\nexport interface SnapshotBlob {\n\t/** Lowercase hex SHA-256 of `data`. */\n\treadonly hash: string;\n\treadonly data: Uint8Array;\n}\n\n/** Content-addressed storage for snapshot patches and bundles, kept in the same storage as sessions or journals. */\nexport interface SnapshotBlobStore {\n\t/** Stores each blob once. Re-storing protects it from collection, refreshing a known age or preserving an unknown one. */\n\tputBlobs(blobs: readonly SnapshotBlob[]): Promise<void>;\n\tgetBlob(hash: string): Promise<Uint8Array | undefined>;\n\t/**\n\t * Protects each stored hash as storing it again would, without its bytes: known ages restart, unknown ages remain\n\t * protected until collection stamps them. Resolves false when any is missing. Capture calls it before reusing an\n\t * earlier snapshot's blobs, so collection keeps them until the new\n\t * snapshot that references them is published.\n\t */\n\trefreshBlobs(hashes: readonly string[]): Promise<boolean>;\n\t/** Every stored hash. */\n\tlistBlobHashes(): Promise<readonly string[]>;\n}\n\n/** Restore-time notices that never block a verified restore. */\nexport type WorktreeRestoreWarning =\n\t| { readonly code: \"omitted-content\"; readonly omitted: readonly WorktreeSnapshotOmission[] }\n\t| { readonly code: \"filters\"; readonly filters: WorktreeSnapshotFilters }\n\t| { readonly code: \"lfs-objects-unavailable\"; readonly paths: readonly string[] }\n\t| {\n\t\t\treadonly code: \"stale-restore-retained\";\n\t\t\treadonly path: string;\n\t\t\t/** What was left: a staging or nested worktree, a crash record file, or the crash-record directory itself. */\n\t\t\treadonly kind: \"worktree\" | \"record\" | \"records-directory\";\n\t };\n\n/** Which commit a restore that could not reach a snapshot's recorded `HEAD` checked out instead. */\nexport type WorktreeDegradedRestoreBasis = \"pushed-base\" | \"earlier-snapshot\" | \"branch-tip\";\n\n/**\n * What a restore that could not reproduce its snapshot exactly restored instead (#4733): the recorded `HEAD` with the\n * change sets of the patch chain that could be applied (`partial-changes`), or the closest commit it could fetch, with\n * none of the snapshot's changes (`closest-commit`).\n */\nexport interface WorktreeDegradedRestore {\n\treadonly stage: \"partial-changes\" | \"closest-commit\";\n\t/** The commit the worktree has checked out. */\n\treadonly head: string;\n\t/** The Git tree of the worktree's content when it was restored. */\n\treadonly tree: string;\n\t/** With `closest-commit`, where `head` came from. */\n\treadonly basis?: WorktreeDegradedRestoreBasis;\n\t/** Indexes of the patch chain's change sets that are not in the worktree. */\n\treadonly missingLinks: readonly number[];\n\t/** Paths those change sets touch, where their content was available to list them. */\n\treadonly missingPaths: readonly string[];\n\t/** Recorded commits that are not in the worktree. */\n\treadonly missingCommits: readonly string[];\n\t/** The code of the restore error that kept the exact state from being restored, and its reason when it has one. */\n\treadonly cause: string;\n\treadonly causeReason?: string;\n\t/** What to do to get the rest: the restore error's hint. */\n\treadonly hint: string;\n}\n\n/** A checkout restored on this host in place of one recorded elsewhere: work under `from` now happens under `to`. */\nexport interface WorktreeRootMapping {\n\treadonly from: string;\n\treadonly to: string;\n\treadonly snapshotId: string;\n\treadonly tree: string;\n\treadonly restoredAt: string;\n\t/** Present when `to` holds less than the snapshot: what it holds and what is missing (#4733). */\n\treadonly degraded?: WorktreeDegradedRestore;\n\t/**\n\t * Present when this restore of the snapshot followed a partial restore of it that the session worked in (#4922): that\n\t * work, and whether this restore put it on top of the snapshot.\n\t */\n\treadonly degradedWork?: WorktreeDegradedWork;\n}\n\n/**\n * The work a session did in a partly restored worktree, from what the partial restore put there to its latest snapshot\n * there, as a later full restore of the snapshot found it (#4922).\n */\nexport interface WorktreeDegradedWork {\n\t/** The latest snapshot of the partly restored worktree. */\n\treadonly snapshotId: string;\n\t/** The partly restored worktree, on the machine where the work was done. */\n\treadonly root: string;\n\t/**\n\t * `applied`: the work is in the restored worktree, on top of the snapshot. `kept`: it does not apply on top of the\n\t * snapshot, and the commit `commit` (ref `ref`) of the restored worktree's repository holds it, as changes from the\n\t * tree `base`. `unavailable`: it could not be read on this machine, for `reason`.\n\t */\n\treadonly outcome: \"applied\" | \"kept\" | \"unavailable\";\n\t/** The files the work changed, where they could be listed. */\n\treadonly paths: readonly string[];\n\treadonly base?: string;\n\treadonly commit?: string;\n\treadonly ref?: string;\n\treadonly reason?: string;\n}\n\n/** Paths under `from`, a working directory the session left, continue under `to`, where it went on instead (#5379). */\nexport interface PathContinuation {\n\treadonly from: string;\n\treadonly to: string;\n}\n\n/**\n * A checkout a resume continued without (#4733): nothing of its snapshot could be restored on this host, so the\n * session went on in `continuedIn`, as it was.\n */\nexport interface WorktreeUnrestored {\n\treadonly snapshotId: string;\n\treadonly continuedIn: string;\n\t/** Whether `continuedIn` is the session's recorded working directory, or the directory the resume started in. */\n\treadonly place: \"recorded\" | \"launch\";\n\t/**\n\t * For the checkout the session worked in, when it continued in the directory the resume started in instead: the\n\t * working directory in this checkout that it left. The session's file tools follow paths under it to `continuedIn`.\n\t */\n\treadonly from?: string;\n\treadonly cause: string;\n\treadonly causeReason?: string;\n\treadonly detail: string;\n\treadonly hint: string;\n\treadonly at: string;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/worktree-snapshot/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The portable identity of a workspace: the remotes that hold its history, the commit it is based on, the Git tree of\n * its content, and a fingerprint of its dependency inputs. Schedulers and workspace providers consume this shape.\n */\nexport interface WorkspaceBinding {\n\tremotes: string[];\n\thead: string;\n\ttree: string;\n\tenvHash: string;\n}\n\n/** Snapshot capture settings, from `snapshots.*` in settings.json, `createAgentSession`, or workflow run options. */\nexport interface WorktreeSnapshotSettings {\n\t/** Record snapshots at all. Default true. */\n\treadonly enabled: boolean;\n\t/** Capture untracked files that no ignore rule or deny pattern excludes. Default true. */\n\treadonly includeUntracked: boolean;\n\t/** Largest single file captured, in bytes. Default 5 MiB. */\n\treadonly maxFileBytes: number;\n\t/** Largest total of captured file content, patch chain and unpushed-commit bundle, in bytes. Default 50 MiB. */\n\treadonly maxSnapshotBytes: number;\n\t/** Record a full delta against `head` after this many incremental snapshots. Default 10. */\n\treadonly fullEvery: number;\n\t/**\n\t * Delete unreferenced snapshot blobs automatically, in the background of an interactive session, after a session\n\t * closes, and when a root workflow run finishes. Default true.\n\t */\n\treadonly autoCollect: boolean;\n\t/** Shortest time between two automatic collections of one database, in seconds, on the database's clock. Default 3600. */\n\treadonly collectIntervalSeconds: number;\n\t/** Blobs stored or re-stored less than this many seconds ago are never collected. 0 turns the protection off. Default 3600. */\n\treadonly graceSeconds: number;\n}\n\n/**\n * Why a path was left out. `nested-repository` is an untracked repository inside the checkout (`path` ends in `/`);\n * `submodule-changes`, `unpushed-submodule-commit` and `submodule-unchecked` name a submodule whose uncommitted\n * changes, local commit, or state (when checking it failed or took too long) a snapshot does not record.\n */\nexport type WorktreeSnapshotPathOmissionReason =\n\t| \"denied\"\n\t| \"snapshot-ignore\"\n\t| \"untracked-excluded\"\n\t| \"nested-repository\"\n\t| \"submodule-changes\"\n\t| \"unpushed-submodule-commit\"\n\t| \"submodule-unchecked\";\nexport type WorktreeSnapshotSizeOmissionReason = \"over-file-cap\" | \"over-snapshot-cap\";\n\n/** Content a snapshot left out, and why. */\nexport type WorktreeSnapshotOmission =\n\t| { readonly reason: WorktreeSnapshotPathOmissionReason; readonly path: string }\n\t| { readonly reason: WorktreeSnapshotSizeOmissionReason; readonly path: string; readonly bytes: number }\n\t| {\n\t\t\treadonly reason: \"unpushed-history-denied\";\n\t\t\treadonly commits: readonly string[];\n\t\t\treadonly paths: readonly string[];\n\t }\n\t| { readonly reason: \"bundle-over-cap\"; readonly commits: readonly string[]; readonly bytes: number };\n\nexport type WorktreeSnapshotOmissionReason = WorktreeSnapshotOmission[\"reason\"];\n\n/** One step of a patch chain: applying `patch` (a blob hash, or null for no change) produces `tree`. */\nexport interface WorktreeSnapshotChainLink {\n\treadonly tree: string;\n\treadonly patch: string | null;\n\treadonly bytes: number;\n}\n\n/** Conversion settings on the recording machine that can make a worktree's files differ from Git's stored content. */\nexport interface WorktreeSnapshotFilters {\n\treadonly autocrlf: string | null;\n\treadonly eol: string | null;\n\t/** Filter drivers that the repository's `.gitattributes` files name, such as `lfs`. */\n\treadonly drivers: readonly string[];\n}\n\nexport interface WorktreeSnapshotBundle {\n\t/** Blob hash of a `git bundle` holding the commits reachable from `head` and from no remote-tracking ref. */\n\treadonly blob: string;\n\treadonly bytes: number;\n\treadonly commits: readonly string[];\n}\n\n/** The recorded state of one repository checkout. Every field is JSON. Blob hashes refer to a {@link SnapshotBlobStore}. */\nexport interface WorktreeSnapshot {\n\treadonly version: 1;\n\t/** Content-derived identity: equal ids mean equal reconstruction inputs. */\n\treadonly id: string;\n\t/** Absolute checkout root on the recording machine. Informational. */\n\treadonly root: string;\n\treadonly remotes: readonly string[];\n\t/** Current branch, or null when detached. */\n\treadonly branch: string | null;\n\treadonly head: string;\n\t/** Commit object for the full working tree, parented on `head`. Local to the recording machine. */\n\treadonly snapshot: string;\n\treadonly tree: string;\n\treadonly envHash: string;\n\t/** The newest link: a full delta against `head`, or an incremental one against the previous snapshot. */\n\treadonly delta: { readonly base: \"head\" | string; readonly patch: string | null; readonly bytes: number };\n\t/** Links from the latest full delta to this snapshot, in application order. Never longer than `fullEvery`. */\n\treadonly chain: readonly WorktreeSnapshotChainLink[];\n\treadonly bundle: WorktreeSnapshotBundle | null;\n\treadonly omitted: readonly WorktreeSnapshotOmission[];\n\treadonly filters: WorktreeSnapshotFilters | null;\n\treadonly capturedAt: string;\n}\n\nexport interface SnapshotBlob {\n\t/** Lowercase hex SHA-256 of `data`. */\n\treadonly hash: string;\n\treadonly data: Uint8Array;\n}\n\n/** Content-addressed storage for snapshot patches and bundles, kept in the same storage as sessions or journals. */\nexport interface SnapshotBlobStore {\n\t/** Stores each blob once. Re-storing protects it from collection, refreshing a known age or preserving an unknown one. */\n\tputBlobs(blobs: readonly SnapshotBlob[]): Promise<void>;\n\tgetBlob(hash: string): Promise<Uint8Array | undefined>;\n\t/**\n\t * Protects each stored hash as storing it again would, without its bytes: known ages restart, unknown ages remain\n\t * protected until collection stamps them. Resolves false when any is missing. Capture calls it before reusing an\n\t * earlier snapshot's blobs, so collection keeps them until the new\n\t * snapshot that references them is published.\n\t */\n\trefreshBlobs(hashes: readonly string[]): Promise<boolean>;\n\t/** Every stored hash. */\n\tlistBlobHashes(): Promise<readonly string[]>;\n}\n\n/** Restore-time notices that never block a verified restore. */\nexport type WorktreeRestoreWarning =\n\t| { readonly code: \"omitted-content\"; readonly omitted: readonly WorktreeSnapshotOmission[] }\n\t| { readonly code: \"filters\"; readonly filters: WorktreeSnapshotFilters }\n\t| { readonly code: \"lfs-objects-unavailable\"; readonly paths: readonly string[] }\n\t| {\n\t\t\treadonly code: \"stale-restore-retained\";\n\t\t\treadonly path: string;\n\t\t\t/** What was left: a staging or nested worktree, a crash record file, or the crash-record directory itself. */\n\t\t\treadonly kind: \"worktree\" | \"record\" | \"records-directory\";\n\t };\n\n/** Which commit a restore that could not reach a snapshot's recorded `HEAD` checked out instead. */\nexport type WorktreeDegradedRestoreBasis = \"pushed-base\" | \"earlier-snapshot\" | \"branch-tip\";\n\n/**\n * What a restore that could not reproduce its snapshot exactly restored instead (#4733): the recorded `HEAD` with the\n * change sets of the patch chain that could be applied (`partial-changes`), or the closest commit it could fetch, with\n * none of the snapshot's changes (`closest-commit`).\n */\nexport interface WorktreeDegradedRestore {\n\treadonly stage: \"partial-changes\" | \"closest-commit\";\n\t/** The commit the worktree has checked out. */\n\treadonly head: string;\n\t/** The Git tree of the worktree's content when it was restored. */\n\treadonly tree: string;\n\t/** With `closest-commit`, where `head` came from. */\n\treadonly basis?: WorktreeDegradedRestoreBasis;\n\t/** Indexes of the patch chain's change sets that are not in the worktree. */\n\treadonly missingLinks: readonly number[];\n\t/** Paths those change sets touch, where their content was available to list them. */\n\treadonly missingPaths: readonly string[];\n\t/** Recorded commits that are not in the worktree. */\n\treadonly missingCommits: readonly string[];\n\t/** The code of the restore error that kept the exact state from being restored, and its reason when it has one. */\n\treadonly cause: string;\n\treadonly causeReason?: string;\n\t/** What to do to get the rest: the restore error's hint. */\n\treadonly hint: string;\n}\n\n/** A checkout restored on this host in place of one recorded elsewhere: work under `from` now happens under `to`. */\nexport interface WorktreeRootMapping {\n\treadonly from: string;\n\treadonly to: string;\n\treadonly snapshotId: string;\n\treadonly tree: string;\n\treadonly restoredAt: string;\n\t/** Present when `to` holds less than the snapshot: what it holds and what is missing (#4733). */\n\treadonly degraded?: WorktreeDegradedRestore;\n\t/**\n\t * Present when this restore of the snapshot followed a partial restore of it that the session worked in (#4922): that\n\t * work, and whether this restore put it on top of the snapshot.\n\t */\n\treadonly degradedWork?: WorktreeDegradedWork;\n}\n\n/**\n * The work a session did in a partly restored worktree, from what the partial restore put there to its latest snapshot\n * there, as a later full restore of the snapshot found it (#4922).\n */\nexport interface WorktreeDegradedWork {\n\t/** The latest snapshot of the partly restored worktree. */\n\treadonly snapshotId: string;\n\t/** The partly restored worktree, on the machine where the work was done. */\n\treadonly root: string;\n\t/**\n\t * `applied`: the work is in the restored worktree, on top of the snapshot. `kept`: it does not apply on top of the\n\t * snapshot, and the commit `commit` (ref `ref`) of the restored worktree's repository holds it, as changes from the\n\t * tree `base`. `unavailable`: it could not be read on this machine, for `reason`.\n\t */\n\treadonly outcome: \"applied\" | \"kept\" | \"unavailable\";\n\t/** The files the work changed, where they could be listed. */\n\treadonly paths: readonly string[];\n\treadonly base?: string;\n\treadonly commit?: string;\n\treadonly ref?: string;\n\treadonly reason?: string;\n}\n\n/** Paths under `from`, a working directory the session left, continue under `to`, where it went on instead (#5379). */\nexport interface PathContinuation {\n\treadonly from: string;\n\treadonly to: string;\n}\n\n/**\n * A checkout a resume continued without (#4733): nothing of its snapshot could be restored on this host, so the\n * session went on in `continuedIn`, as it was.\n */\nexport interface WorktreeUnrestored {\n\treadonly snapshotId: string;\n\treadonly continuedIn: string;\n\t/** Whether `continuedIn` is the session's recorded working directory, or the directory the resume started in. */\n\treadonly place: \"recorded\" | \"launch\";\n\t/**\n\t * For the checkout the session worked in, when it continued in the directory the resume started in instead: the\n\t * working directory in this checkout that it left. The session's file tools follow paths under it to `continuedIn`.\n\t */\n\treadonly from?: string;\n\treadonly cause: string;\n\treadonly causeReason?: string;\n\treadonly detail: string;\n\treadonly hint: string;\n\treadonly at: string;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"huggingface-ui.d.ts","sourceRoot":"","sources":["../../../src/extensions/llama/huggingface-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,KAAK,SAAS,EAMd,KAAK,GAAG,EACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,E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ACjD,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,QAAQ,CAA4C;IAC5D,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IAEzB,YACC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,kBAAkB,EAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,EAC3E,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,EACtC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,EAyBlD;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAGzB;IAED,OAAO,CAAC,aAAa;IAuCrB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,cAAc;YAqBR,SAAS;IAuBvB,OAAO,CAAC,KAAK;IAQb,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgDjC;CACD"}
@@ -1,5 +1,5 @@
1
1
  import { Container, fuzzyFilter, getSelectPageIndex, Input, Spacer, Text, } from "@bastani/atomic-tui";
2
- import { navActionText, renderNavHintLine } from "../../modes/interactive/components/nav-keys.js";
2
+ import { navActionText, navFirstKeyText, renderNavHintLine, } from "../../modes/interactive/components/nav-keys.js";
3
3
  function compactCount(value) {
4
4
  if (value >= 1_000_000)
5
5
  return `${(value / 1_000_000).toFixed(value >= 10_000_000 ? 0 : 1)}M`;
@@ -113,7 +113,7 @@ export class HuggingFaceSearch extends Container {
113
113
  }
114
114
  entries.push({ keys: "type", label: "to search" });
115
115
  entries.push({
116
- keys: navActionText(this.keybindings, "tui.select.cancel").split("/")[0] || "esc",
116
+ keys: navFirstKeyText(this.keybindings, "tui.select.cancel") || "esc",
117
117
  label: "back",
118
118
  });
119
119
  return entries;
@@ -1 +1 @@
1
- {"version":3,"file":"huggingface-ui.js","sourceRoot":"","sources":["../../../src/extensions/llama/huggingface-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,WAAW,EACX,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,IAAI,GAEJ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAe,aAAa,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAI/G,SAAS,YAAY,CAAC,KAAa;IAClC,IAAI,KAAK,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9F,IAAI,KAAK,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACnF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IACtC,qBAAqB,GAAY,IAAI,CAAC;IAC9B,GAAG,CAAM;IACT,KAAK,CAAQ;IACb,WAAW,CAAqB;IAChC,MAAM,CAAsE;IAC5E,KAAK,CAAkC;IACvC,aAAa,CAAsC;IACnD,KAAK,CAAQ;IACb,gBAAgB,GAAG,IAAI,SAAS,EAAE,CAAC;IAC5C,OAAO,GAAuB,EAA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AAE,CAAC;YACnF,IAAI,QAAQ;gBAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC;YACzD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tContainer,\n\ttype Focusable,\n\tfuzzyFilter,\n\tgetSelectPageIndex,\n\tInput,\n\tSpacer,\n\tText,\n\ttype TUI,\n} from \"@bastani/atomic-tui\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport { type NavKey, navActionText, renderNavHintLine } from \"../../modes/interactive/components/nav-keys.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.js\";\nimport type { HuggingFaceModel } from \"./huggingface.js\";\n\nfunction compactCount(value: number): string {\n\tif (value >= 1_000_000) return `${(value / 1_000_000).toFixed(value >= 10_000_000 ? 0 : 1)}M`;\n\tif (value >= 1_000) return `${(value / 1_000).toFixed(value >= 100_000 ? 0 : 1)}k`;\n\treturn String(value);\n}\n\nconst SEARCH_MAX_VISIBLE = 10;\n\nexport class HuggingFaceSearch extends Container implements Focusable {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate readonly tui: TUI;\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly search: (query: string, signal: AbortSignal) => Promise<HuggingFaceModel[]>;\n\tprivate readonly cache: Map<string, HuggingFaceModel[]>;\n\tprivate readonly onSelectModel: (model: string | undefined) => void;\n\tprivate readonly input: Input;\n\tprivate readonly resultsContainer = new Container();\n\tprivate results: HuggingFaceModel[] = [];\n\tprivate filteredResults: HuggingFaceModel[] = [];\n\tprivate selectedIndex = 0;\n\t// Whether the user moved the selection since the query last changed.\n\tprivate selectionTouched = false;\n\tprivate query = \"\";\n\tprivate status = \"Type at least 2 characters\";\n\tprivate debounce: ReturnType<typeof setTimeout> | undefined;\n\tprivate request: AbortController | undefined;\n\tprivate closed = false;\n\tprivate _focused = false;\n\n\tconstructor(\n\t\ttui: TUI,\n\t\ttheme: Theme,\n\t\tkeybindings: KeybindingsManager,\n\t\tsearch: (query: string, signal: AbortSignal) => Promise<HuggingFaceModel[]>,\n\t\tcache: Map<string, HuggingFaceModel[]>,\n\t\tonSelectModel: (model: string | undefined) => void,\n\t) {\n\t\tsuper();\n\t\tthis.tui = tui;\n\t\tthis.theme = theme;\n\t\tthis.keybindings = keybindings;\n\t\tthis.search = search;\n\t\tthis.cache = cache;\n\t\tthis.onSelectModel = onSelectModel;\n\t\tthis.input = new Input({\n\t\t\tprompt: \"⌕ \",\n\t\t\tplaceholder: \"Model name or owner/repository[:quant]\",\n\t\t\tplaceholderStyle: (text) => theme.fg(\"dim\", text),\n\t\t});\n\t\tthis.addChild(this.input);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(this.resultsContainer);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild({\n\t\t\trender: (width: number) => [\n\t\t\t\trenderNavHintLine(this.hintEntries(), width, this.hintStyle(), this.keybindings, 1),\n\t\t\t],\n\t\t\tinvalidate: () => {},\n\t\t});\n\t\tthis.updateResults();\n\t}\n\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.input.focused = value;\n\t}\n\n\tprivate updateResults(): void {\n\t\tthis.resultsContainer.clear();\n\t\tconst start = Math.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\tthis.selectedIndex - Math.floor(SEARCH_MAX_VISIBLE / 2),\n\t\t\t\tthis.filteredResults.length - SEARCH_MAX_VISIBLE,\n\t\t\t),\n\t\t);\n\t\tconst end = Math.min(start + SEARCH_MAX_VISIBLE, this.filteredResults.length);\n\t\tfor (let index = start; index < end; index++) {\n\t\t\tconst model = this.filteredResults[index];\n\t\t\tif (!model) continue;\n\t\t\tconst prefix = index === this.selectedIndex ? \"❯ \" : \" \";\n\t\t\tconst details = `${compactCount(model.downloads)} downloads`;\n\t\t\tthis.resultsContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\tindex === this.selectedIndex\n\t\t\t\t\t\t? this.theme.fg(\"accent\", `${prefix}${model.id} ${details}`)\n\t\t\t\t\t\t: `${prefix}${model.id}${this.theme.fg(\"muted\", ` ${details}`)}`,\n\t\t\t\t\t0,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tconst above = start;\n\t\tconst below = this.filteredResults.length - end;\n\t\tif (above > 0 || below > 0) {\n\t\t\tconst parts = [above > 0 ? `↑ ${above} more` : \"\", below > 0 ? `↓ ${below} more` : \"\"].filter(Boolean);\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${parts.join(\" · \")}`), 0, 0));\n\t\t}\n\t\tif (this.filteredResults.length === 0) {\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${this.status}`), 0, 0));\n\t\t} else if (this.status === \"Searching Hugging Face…\") {\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${this.status}`), 0, 0));\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\tprivate hintStyle() {\n\t\treturn {\n\t\t\tdim: (text: string) => this.theme.fg(\"dim\", text),\n\t\t\ttext: (text: string) => this.theme.fg(\"text\", text),\n\t\t\tmuted: (text: string) => this.theme.fg(\"muted\", text),\n\t\t\tborder: (text: string) => this.theme.fg(\"borderMuted\", text),\n\t\t\tbold: (text: string) => this.theme.bold(text),\n\t\t};\n\t}\n\n\tprivate exactQuery(): string | undefined {\n\t\treturn /^[^/\\s]+\\/[^:\\s]+(?::[^\\s:]+)?$/u.test(this.query) ? this.query : undefined;\n\t}\n\n\tprivate hintEntries(): NavKey[] {\n\t\tconst entries: NavKey[] = [];\n\t\tif (this.filteredResults.length > 1) {\n\t\t\tconst up = navActionText(this.keybindings, \"tui.select.up\");\n\t\t\tconst down = navActionText(this.keybindings, \"tui.select.down\");\n\t\t\tentries.push({ keys: up === \"↑\" && down === \"↓\" ? \"↑↓\" : `${up}/${down}`, label: \"select\" });\n\t\t}\n\t\tif (this.exactQuery() !== undefined || this.filteredResults[this.selectedIndex] !== undefined) {\n\t\t\tentries.push({ action: \"tui.select.confirm\", label: \"download\" });\n\t\t}\n\t\tentries.push({ keys: \"type\", label: \"to search\" });\n\t\tentries.push({\n\t\t\tkeys: navActionText(this.keybindings, \"tui.select.cancel\").split(\"/\")[0] || \"esc\",\n\t\t\tlabel: \"back\",\n\t\t});\n\t\treturn entries;\n\t}\n\n\tprivate filterResults(preferredId?: string): void {\n\t\tif (this.query) {\n\t\t\tconst matches = new Set(fuzzyFilter(this.results, this.query, (model) => model.id).map((model) => model.id));\n\t\t\tthis.filteredResults = this.results.filter((model) => matches.has(model.id));\n\t\t} else {\n\t\t\tthis.filteredResults = this.results;\n\t\t}\n\t\tconst preferredIndex = preferredId ? this.filteredResults.findIndex((model) => model.id === preferredId) : -1;\n\t\tif (preferredIndex >= 0) this.selectedIndex = preferredIndex;\n\t\telse this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredResults.length - 1));\n\t\tthis.updateResults();\n\t}\n\n\tprivate scheduleSearch(): void {\n\t\tif (this.debounce) clearTimeout(this.debounce);\n\t\tthis.request?.abort();\n\t\tthis.request = undefined;\n\t\tif (this.query.length < 2) {\n\t\t\tthis.status = \"Type at least 2 characters\";\n\t\t\tthis.filterResults();\n\t\t\treturn;\n\t\t}\n\t\tconst cached = this.cache.get(this.query.toLowerCase());\n\t\tif (cached) {\n\t\t\tthis.results = cached;\n\t\t\tthis.status = cached.length === 0 ? \"No GGUF models found\" : \"\";\n\t\t\tthis.filterResults();\n\t\t\treturn;\n\t\t}\n\t\tthis.status = \"Searching Hugging Face…\";\n\t\tthis.filterResults();\n\t\tthis.debounce = setTimeout(() => void this.runSearch(this.query), 500);\n\t}\n\n\tprivate async runSearch(query: string): Promise<void> {\n\t\tconst request = new AbortController();\n\t\tthis.request = request;\n\t\ttry {\n\t\t\tconst results = await this.search(query, request.signal);\n\t\t\tthis.cache.set(query.toLowerCase(), results);\n\t\t\tif (this.closed || request.signal.aborted || this.query !== query) return;\n\t\t\t// Keep the row the user browsed to while the search was in flight; otherwise show the best match.\n\t\t\tconst selectedId = this.selectionTouched ? this.filteredResults[this.selectedIndex]?.id : undefined;\n\t\t\tthis.results = results;\n\t\t\tthis.selectedIndex = 0;\n\t\t\tthis.status = results.length === 0 ? \"No GGUF models found\" : \"\";\n\t\t\tthis.filterResults(selectedId);\n\t\t} catch (error) {\n\t\t\tif (this.closed || request.signal.aborted || this.query !== query) return;\n\t\t\tthis.results = [];\n\t\t\tthis.status = error instanceof Error ? error.message : String(error);\n\t\t\tthis.filterResults();\n\t\t} finally {\n\t\t\tif (this.request === request) this.request = undefined;\n\t\t}\n\t}\n\n\tprivate close(model: string | undefined): void {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\tif (this.debounce) clearTimeout(this.debounce);\n\t\tthis.request?.abort();\n\t\tthis.onSelectModel(model);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tif (this.keybindings.matches(data, \"tui.select.up\")) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = this.selectedIndex === 0 ? this.filteredResults.length - 1 : this.selectedIndex - 1;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.down\")) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = this.selectedIndex === this.filteredResults.length - 1 ? 0 : this.selectedIndex + 1;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tconst pageIndex = getSelectPageIndex(\n\t\t\tthis.keybindings,\n\t\t\tdata,\n\t\t\tthis.selectedIndex,\n\t\t\tthis.filteredResults.length,\n\t\t\tSEARCH_MAX_VISIBLE,\n\t\t);\n\t\tif (pageIndex !== undefined) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = pageIndex;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.exactQuery() ?? this.filteredResults[this.selectedIndex]?.id;\n\t\t\tif (selected) this.close(selected);\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.close(undefined);\n\t\t\treturn true;\n\t\t}\n\t\tthis.input.handleInput(data);\n\t\tconst query = this.input.getValue().trim();\n\t\tif (query === this.query) return true;\n\t\tthis.query = query;\n\t\tthis.selectionTouched = false;\n\t\tthis.scheduleSearch();\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"huggingface-ui.js","sourceRoot":"","sources":["../../../src/extensions/llama/huggingface-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,WAAW,EACX,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,IAAI,GAEJ,MA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C;QAC3C,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["import {\n\tContainer,\n\ttype Focusable,\n\tfuzzyFilter,\n\tgetSelectPageIndex,\n\tInput,\n\tSpacer,\n\tText,\n\ttype TUI,\n} from \"@bastani/atomic-tui\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport {\n\ttype NavKey,\n\tnavActionText,\n\tnavFirstKeyText,\n\trenderNavHintLine,\n} from \"../../modes/interactive/components/nav-keys.ts\";\nimport type { Theme } from \"../../modes/interactive/theme/theme.js\";\nimport type { HuggingFaceModel } from \"./huggingface.js\";\n\nfunction compactCount(value: number): string {\n\tif (value >= 1_000_000) return `${(value / 1_000_000).toFixed(value >= 10_000_000 ? 0 : 1)}M`;\n\tif (value >= 1_000) return `${(value / 1_000).toFixed(value >= 100_000 ? 0 : 1)}k`;\n\treturn String(value);\n}\n\nconst SEARCH_MAX_VISIBLE = 10;\n\nexport class HuggingFaceSearch extends Container implements Focusable {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate readonly tui: TUI;\n\tprivate readonly theme: Theme;\n\tprivate readonly keybindings: KeybindingsManager;\n\tprivate readonly search: (query: string, signal: AbortSignal) => Promise<HuggingFaceModel[]>;\n\tprivate readonly cache: Map<string, HuggingFaceModel[]>;\n\tprivate readonly onSelectModel: (model: string | undefined) => void;\n\tprivate readonly input: Input;\n\tprivate readonly resultsContainer = new Container();\n\tprivate results: HuggingFaceModel[] = [];\n\tprivate filteredResults: HuggingFaceModel[] = [];\n\tprivate selectedIndex = 0;\n\t// Whether the user moved the selection since the query last changed.\n\tprivate selectionTouched = false;\n\tprivate query = \"\";\n\tprivate status = \"Type at least 2 characters\";\n\tprivate debounce: ReturnType<typeof setTimeout> | undefined;\n\tprivate request: AbortController | undefined;\n\tprivate closed = false;\n\tprivate _focused = false;\n\n\tconstructor(\n\t\ttui: TUI,\n\t\ttheme: Theme,\n\t\tkeybindings: KeybindingsManager,\n\t\tsearch: (query: string, signal: AbortSignal) => Promise<HuggingFaceModel[]>,\n\t\tcache: Map<string, HuggingFaceModel[]>,\n\t\tonSelectModel: (model: string | undefined) => void,\n\t) {\n\t\tsuper();\n\t\tthis.tui = tui;\n\t\tthis.theme = theme;\n\t\tthis.keybindings = keybindings;\n\t\tthis.search = search;\n\t\tthis.cache = cache;\n\t\tthis.onSelectModel = onSelectModel;\n\t\tthis.input = new Input({\n\t\t\tprompt: \"⌕ \",\n\t\t\tplaceholder: \"Model name or owner/repository[:quant]\",\n\t\t\tplaceholderStyle: (text) => theme.fg(\"dim\", text),\n\t\t});\n\t\tthis.addChild(this.input);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild(this.resultsContainer);\n\t\tthis.addChild(new Spacer(1));\n\t\tthis.addChild({\n\t\t\trender: (width: number) => [\n\t\t\t\trenderNavHintLine(this.hintEntries(), width, this.hintStyle(), this.keybindings, 1),\n\t\t\t],\n\t\t\tinvalidate: () => {},\n\t\t});\n\t\tthis.updateResults();\n\t}\n\n\tget focused(): boolean {\n\t\treturn this._focused;\n\t}\n\n\tset focused(value: boolean) {\n\t\tthis._focused = value;\n\t\tthis.input.focused = value;\n\t}\n\n\tprivate updateResults(): void {\n\t\tthis.resultsContainer.clear();\n\t\tconst start = Math.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\tthis.selectedIndex - Math.floor(SEARCH_MAX_VISIBLE / 2),\n\t\t\t\tthis.filteredResults.length - SEARCH_MAX_VISIBLE,\n\t\t\t),\n\t\t);\n\t\tconst end = Math.min(start + SEARCH_MAX_VISIBLE, this.filteredResults.length);\n\t\tfor (let index = start; index < end; index++) {\n\t\t\tconst model = this.filteredResults[index];\n\t\t\tif (!model) continue;\n\t\t\tconst prefix = index === this.selectedIndex ? \"❯ \" : \" \";\n\t\t\tconst details = `${compactCount(model.downloads)} downloads`;\n\t\t\tthis.resultsContainer.addChild(\n\t\t\t\tnew Text(\n\t\t\t\t\tindex === this.selectedIndex\n\t\t\t\t\t\t? this.theme.fg(\"accent\", `${prefix}${model.id} ${details}`)\n\t\t\t\t\t\t: `${prefix}${model.id}${this.theme.fg(\"muted\", ` ${details}`)}`,\n\t\t\t\t\t0,\n\t\t\t\t\t0,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tconst above = start;\n\t\tconst below = this.filteredResults.length - end;\n\t\tif (above > 0 || below > 0) {\n\t\t\tconst parts = [above > 0 ? `↑ ${above} more` : \"\", below > 0 ? `↓ ${below} more` : \"\"].filter(Boolean);\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${parts.join(\" · \")}`), 0, 0));\n\t\t}\n\t\tif (this.filteredResults.length === 0) {\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${this.status}`), 0, 0));\n\t\t} else if (this.status === \"Searching Hugging Face…\") {\n\t\t\tthis.resultsContainer.addChild(new Text(this.theme.fg(\"dim\", ` ${this.status}`), 0, 0));\n\t\t}\n\t\tthis.tui.requestRender();\n\t}\n\n\tprivate hintStyle() {\n\t\treturn {\n\t\t\tdim: (text: string) => this.theme.fg(\"dim\", text),\n\t\t\ttext: (text: string) => this.theme.fg(\"text\", text),\n\t\t\tmuted: (text: string) => this.theme.fg(\"muted\", text),\n\t\t\tborder: (text: string) => this.theme.fg(\"borderMuted\", text),\n\t\t\tbold: (text: string) => this.theme.bold(text),\n\t\t};\n\t}\n\n\tprivate exactQuery(): string | undefined {\n\t\treturn /^[^/\\s]+\\/[^:\\s]+(?::[^\\s:]+)?$/u.test(this.query) ? this.query : undefined;\n\t}\n\n\tprivate hintEntries(): NavKey[] {\n\t\tconst entries: NavKey[] = [];\n\t\tif (this.filteredResults.length > 1) {\n\t\t\tconst up = navActionText(this.keybindings, \"tui.select.up\");\n\t\t\tconst down = navActionText(this.keybindings, \"tui.select.down\");\n\t\t\tentries.push({ keys: up === \"↑\" && down === \"↓\" ? \"↑↓\" : `${up}/${down}`, label: \"select\" });\n\t\t}\n\t\tif (this.exactQuery() !== undefined || this.filteredResults[this.selectedIndex] !== undefined) {\n\t\t\tentries.push({ action: \"tui.select.confirm\", label: \"download\" });\n\t\t}\n\t\tentries.push({ keys: \"type\", label: \"to search\" });\n\t\tentries.push({\n\t\t\tkeys: navFirstKeyText(this.keybindings, \"tui.select.cancel\") || \"esc\",\n\t\t\tlabel: \"back\",\n\t\t});\n\t\treturn entries;\n\t}\n\n\tprivate filterResults(preferredId?: string): void {\n\t\tif (this.query) {\n\t\t\tconst matches = new Set(fuzzyFilter(this.results, this.query, (model) => model.id).map((model) => model.id));\n\t\t\tthis.filteredResults = this.results.filter((model) => matches.has(model.id));\n\t\t} else {\n\t\t\tthis.filteredResults = this.results;\n\t\t}\n\t\tconst preferredIndex = preferredId ? this.filteredResults.findIndex((model) => model.id === preferredId) : -1;\n\t\tif (preferredIndex >= 0) this.selectedIndex = preferredIndex;\n\t\telse this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredResults.length - 1));\n\t\tthis.updateResults();\n\t}\n\n\tprivate scheduleSearch(): void {\n\t\tif (this.debounce) clearTimeout(this.debounce);\n\t\tthis.request?.abort();\n\t\tthis.request = undefined;\n\t\tif (this.query.length < 2) {\n\t\t\tthis.status = \"Type at least 2 characters\";\n\t\t\tthis.filterResults();\n\t\t\treturn;\n\t\t}\n\t\tconst cached = this.cache.get(this.query.toLowerCase());\n\t\tif (cached) {\n\t\t\tthis.results = cached;\n\t\t\tthis.status = cached.length === 0 ? \"No GGUF models found\" : \"\";\n\t\t\tthis.filterResults();\n\t\t\treturn;\n\t\t}\n\t\tthis.status = \"Searching Hugging Face…\";\n\t\tthis.filterResults();\n\t\tthis.debounce = setTimeout(() => void this.runSearch(this.query), 500);\n\t}\n\n\tprivate async runSearch(query: string): Promise<void> {\n\t\tconst request = new AbortController();\n\t\tthis.request = request;\n\t\ttry {\n\t\t\tconst results = await this.search(query, request.signal);\n\t\t\tthis.cache.set(query.toLowerCase(), results);\n\t\t\tif (this.closed || request.signal.aborted || this.query !== query) return;\n\t\t\t// Keep the row the user browsed to while the search was in flight; otherwise show the best match.\n\t\t\tconst selectedId = this.selectionTouched ? this.filteredResults[this.selectedIndex]?.id : undefined;\n\t\t\tthis.results = results;\n\t\t\tthis.selectedIndex = 0;\n\t\t\tthis.status = results.length === 0 ? \"No GGUF models found\" : \"\";\n\t\t\tthis.filterResults(selectedId);\n\t\t} catch (error) {\n\t\t\tif (this.closed || request.signal.aborted || this.query !== query) return;\n\t\t\tthis.results = [];\n\t\t\tthis.status = error instanceof Error ? error.message : String(error);\n\t\t\tthis.filterResults();\n\t\t} finally {\n\t\t\tif (this.request === request) this.request = undefined;\n\t\t}\n\t}\n\n\tprivate close(model: string | undefined): void {\n\t\tif (this.closed) return;\n\t\tthis.closed = true;\n\t\tif (this.debounce) clearTimeout(this.debounce);\n\t\tthis.request?.abort();\n\t\tthis.onSelectModel(model);\n\t}\n\n\thandleInput(data: string): boolean {\n\t\tif (this.keybindings.matches(data, \"tui.select.up\")) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = this.selectedIndex === 0 ? this.filteredResults.length - 1 : this.selectedIndex - 1;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.down\")) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = this.selectedIndex === this.filteredResults.length - 1 ? 0 : this.selectedIndex + 1;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tconst pageIndex = getSelectPageIndex(\n\t\t\tthis.keybindings,\n\t\t\tdata,\n\t\t\tthis.selectedIndex,\n\t\t\tthis.filteredResults.length,\n\t\t\tSEARCH_MAX_VISIBLE,\n\t\t);\n\t\tif (pageIndex !== undefined) {\n\t\t\tif (this.filteredResults.length > 0) {\n\t\t\t\tthis.selectedIndex = pageIndex;\n\t\t\t\tthis.selectionTouched = true;\n\t\t\t\tthis.updateResults();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.confirm\")) {\n\t\t\tconst selected = this.exactQuery() ?? this.filteredResults[this.selectedIndex]?.id;\n\t\t\tif (selected) this.close(selected);\n\t\t\treturn true;\n\t\t}\n\t\tif (this.keybindings.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.close(undefined);\n\t\t\treturn true;\n\t\t}\n\t\tthis.input.handleInput(data);\n\t\tconst query = this.input.getValue().trim();\n\t\tif (query === this.query) return true;\n\t\tthis.query = query;\n\t\tthis.selectionTouched = false;\n\t\tthis.scheduleSearch();\n\t\treturn true;\n\t}\n}\n"]}
@@ -1,3 +1,5 @@
1
1
  import type { ExtensionAPI } from "../../core/extensions/types.ts";
2
2
  export default function llamaExtension(pi: ExtensionAPI): void;
3
+ /** The CLI is finishing its own deferred load after quit; its SDK registration may already be closed. */
4
+ export declare function finishLlamaAfterQuit(pi: ExtensionAPI): void;
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/llama/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,gCAAgC,CAAC;AA4C5F,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA4L7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/llama/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,gCAAgC,CAAC;AA4C5F,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAI7D;AAED,yGAAyG;AACzG,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAW3D"}
@@ -36,6 +36,23 @@ async function configuredClient(ctx) {
36
36
  export default function llamaExtension(pi) {
37
37
  const provider = createLlamaProvider();
38
38
  pi.registerProvider(provider.provider);
39
+ pi.registerCommand("llama", llamaCommand(provider));
40
+ }
41
+ /** The CLI is finishing its own deferred load after quit; its SDK registration may already be closed. */
42
+ export function finishLlamaAfterQuit(pi) {
43
+ const provider = createLlamaProvider();
44
+ const registration = pi.registerProvider(provider.provider);
45
+ try {
46
+ pi.registerCommand("llama", llamaCommand(provider));
47
+ }
48
+ catch (error) {
49
+ // The closed SDK facade also rejected the preceding registration. Keep the command's diagnostic
50
+ // without leaving a second, unhandled rejection behind it.
51
+ void registration.catch(() => { });
52
+ throw error;
53
+ }
54
+ }
55
+ function llamaCommand(provider) {
39
56
  const syncCatalog = async (ctx, client, catalog) => {
40
57
  const signal = AbortSignal.timeout(15_000);
41
58
  const current = catalog ?? (await client.list({ signal }));
@@ -161,7 +178,7 @@ export default function llamaExtension(pi) {
161
178
  await syncCatalog(ctx, client, result.value);
162
179
  ctx.ui.notify(`Downloaded ${model}`);
163
180
  };
164
- pi.registerCommand("llama", {
181
+ return {
165
182
  description: "Manage llama.cpp router models",
166
183
  handler: async (_args, ctx) => {
167
184
  if (ctx.mode !== "tui") {
@@ -215,6 +232,6 @@ export default function llamaExtension(pi) {
215
232
  }
216
233
  });
217
234
  },
218
- });
235
+ };
219
236
  }
220
237
  //# sourceMappingURL=index.js.map