dal-code 1.0.56 → 1.0.57

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 (276) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/bun/register-bedrock.js +1 -0
  3. package/dist/bundle/chunks/{anthropic-messages-HHQLDDZH.js → anthropic-messages-ASQGS6BL.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-S7VKEJTH.js → azure-openai-responses-ZSCUJBSU.js} +1 -1
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  6. package/dist/bundle/chunks/{chunk-BCFLC6CK.js → chunk-2E7RGBKM.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-Z64M4Q7A.js → chunk-34D4KVPX.js} +1 -1
  8. package/dist/bundle/chunks/chunk-6PQZ4KMC.js +17 -0
  9. package/dist/bundle/chunks/chunk-6SPX3U36.js +1 -0
  10. package/dist/bundle/chunks/{chunk-UULAEZ3H.js → chunk-F577XLVZ.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-RX6CC5RH.js → chunk-FSX34SAZ.js} +443 -472
  12. package/dist/bundle/chunks/chunk-G5AMLGXC.js +1 -0
  13. package/dist/bundle/chunks/{chunk-F37JXTCY.js → chunk-GPI2GHBH.js} +1 -1
  14. package/dist/bundle/chunks/chunk-HF334NQU.js +21 -0
  15. package/dist/bundle/chunks/{chunk-3HGUIN22.js → chunk-IRSW3MVW.js} +2 -2
  16. package/dist/bundle/chunks/chunk-JPBJUBY4.js +17 -0
  17. package/dist/bundle/chunks/chunk-JPCWLZUZ.js +30 -0
  18. package/dist/bundle/chunks/chunk-JUUJCOIR.js +7 -0
  19. package/dist/bundle/chunks/{chunk-3XMZ5UC3.js → chunk-KP7CMLOT.js} +1 -1
  20. package/dist/bundle/chunks/chunk-LZTZWS3N.js +9 -0
  21. package/dist/bundle/chunks/{chunk-PH42AQ66.js → chunk-MAJODFX6.js} +1 -1
  22. package/dist/bundle/chunks/chunk-NJDCSLWK.js +1 -0
  23. package/dist/bundle/chunks/{chunk-P4IBZA6D.js → chunk-O3XFDBJ3.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-BIY5HTFI.js → chunk-PD6QS7YD.js} +1 -1
  25. package/dist/bundle/chunks/{chunk-ZR6PGIL7.js → chunk-S7K3JBWA.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-VGMP27KM.js → chunk-TNSXMGQB.js} +1 -1
  27. package/dist/bundle/chunks/chunk-XIJS4F22.js +14 -0
  28. package/dist/bundle/chunks/{chunk-QCT6OHUR.js → chunk-YTDTROS5.js} +1 -1
  29. package/dist/bundle/chunks/{cli-NGGC23SK.js → cli-IDAZVEZ2.js} +1 -1
  30. package/dist/bundle/chunks/{cli-TVPE43YN.js → cli-NP7QEFQE.js} +1 -1
  31. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-RK2YCJXC.js → cloudflare-workers-ai-system-one-WLKVTF6I.js} +1 -1
  32. package/dist/bundle/chunks/{execute-MGTKJB44.js → execute-VXSJSHXH.js} +2 -2
  33. package/dist/bundle/chunks/{google-generative-ai-ZPA4VBXP.js → google-generative-ai-3HIBMVL4.js} +1 -1
  34. package/dist/bundle/chunks/{google-vertex-IWHW2RX7.js → google-vertex-7PIUZFM3.js} +1 -1
  35. package/dist/bundle/chunks/{llama-cpp-classify-FXJM52Q3.js → llama-cpp-classify-5OLOZHKT.js} +1 -1
  36. package/dist/bundle/chunks/{mcp-RLFUDVHN.js → mcp-GHYUCPI4.js} +1 -1
  37. package/dist/bundle/chunks/{mistral-conversations-JXVPTO5Y.js → mistral-conversations-6Y33SI3U.js} +1 -1
  38. package/dist/bundle/chunks/{office-RTREQQ7W.js → office-2JSKOL7V.js} +1 -1
  39. package/dist/bundle/chunks/{openai-codex-responses-EYW27UUE.js → openai-codex-responses-BYGMMTPH.js} +1 -1
  40. package/dist/bundle/chunks/{openai-completions-ROBKXDOC.js → openai-completions-UWYQMOLR.js} +1 -1
  41. package/dist/bundle/chunks/{openai-decisions-4T5LPJRA.js → openai-decisions-I5J7OD62.js} +1 -1
  42. package/dist/bundle/chunks/{openai-responses-ZVFZ75QW.js → openai-responses-LWVKQGLT.js} +1 -1
  43. package/dist/bundle/chunks/{openrouter-images-6VJYTLAX.js → openrouter-images-BDUFN6XX.js} +1 -1
  44. package/dist/bundle/chunks/{pi-messages-Y6HBOGKH.js → pi-messages-64FHWMQR.js} +1 -1
  45. package/dist/bundle/chunks/{review-USSKCVWP.js → review-OQEOVDLP.js} +2 -2
  46. package/dist/bundle/chunks/{router-4JLK3BTT.js → router-3UQE4LBN.js} +1 -1
  47. package/dist/bundle/chunks/runtime-E7KOB62K.js +1 -0
  48. package/dist/bundle/chunks/sdk-5V64WBOZ.js +1 -0
  49. package/dist/bundle/chunks/{sync-UCHKAOUU.js → sync-INSWGFSB.js} +3 -3
  50. package/dist/bundle/chunks/{typesafe-system-one-XPDE7VYD.js → typesafe-system-one-7QFJ5JNW.js} +1 -1
  51. package/dist/bundle/chunks/usage-MG7QDPG2.js +1 -0
  52. package/dist/bundle/chunks/virtual-modules-73ZLFCNE.js +1 -0
  53. package/dist/bundle/cli-runtime.js +1 -1
  54. package/dist/bundle/index.js +1 -1
  55. package/dist/bundle/rpc-entry.js +1 -1
  56. package/dist/cli/experimental/auth.js +1 -0
  57. package/dist/cli/experimental/cli.js +1 -0
  58. package/dist/cli/experimental/command-options.js +1 -0
  59. package/dist/cli/experimental/command.js +1 -0
  60. package/dist/cli/experimental/commands/client.js +1 -0
  61. package/dist/cli/experimental/commands/pi.js +1 -0
  62. package/dist/cli/experimental/commands/server.js +1 -0
  63. package/dist/cli/experimental/transport-address.js +1 -0
  64. package/dist/client/index.js +1 -0
  65. package/dist/client/remote-session.js +1 -0
  66. package/dist/client/transcript.js +1 -0
  67. package/dist/core/provider-attribution.js +1 -0
  68. package/dist/modes/interactive/components/daxnuts.js +1 -0
  69. package/dist/modes/interactive/theme/theme-json.js +12 -0
  70. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  71. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  72. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  73. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  74. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  75. package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
  76. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  77. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  78. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  79. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  80. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  81. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  82. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  83. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  84. package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
  85. package/dist/node_modules/@dalcode/dal-learn/src/store.js +3 -3
  86. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  87. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
  88. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  89. package/dist/node_modules/@dalcode/dal-pi-kit/dist/agent-dir.js +1 -0
  90. package/dist/node_modules/@dalcode/dal-pi-kit/dist/index.js +1 -1
  91. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  92. package/dist/node_modules/@dalcode/dal-pi-kit/src/agent-dir.js +1 -0
  93. package/dist/node_modules/@dalcode/dal-pi-kit/src/index.js +1 -1
  94. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  95. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  96. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  97. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  98. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  99. package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
  100. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  101. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  102. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  103. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  104. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  105. package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
  106. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
  107. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  108. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  109. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  110. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  111. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  112. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  113. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +1 -0
  114. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +37 -0
  115. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +104 -0
  116. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +16 -0
  117. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +1 -0
  118. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +1 -0
  119. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +10 -0
  120. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +1 -0
  121. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +1 -0
  122. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +1 -0
  123. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +1 -0
  124. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +1 -0
  125. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +17 -0
  126. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bash.js +1 -0
  127. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bounded.js +1 -0
  128. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/chord.js +1 -0
  129. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/context.js +1 -0
  130. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/harness.js +1 -0
  131. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/hooks.js +1 -0
  132. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/index.js +1 -0
  133. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/jsonl.js +4 -0
  134. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/collapse.js +3 -0
  135. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/entries.js +1 -0
  136. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/frames.js +1 -0
  137. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/generation.js +1 -0
  138. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/job.js +1 -0
  139. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/plugin.js +1 -0
  140. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/post-tools.js +1 -0
  141. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/task-api.js +1 -0
  142. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/tool.js +3 -0
  143. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/membrane.js +1 -0
  144. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/memory.js +1 -0
  145. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/scheduler.js +1 -0
  146. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/session.js +1 -0
  147. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/system.js +8 -0
  148. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/types.js +1 -0
  149. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/view.js +1 -0
  150. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +5 -0
  151. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +1 -0
  152. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +1 -0
  153. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +1 -0
  154. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +1 -0
  155. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +1 -0
  156. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +1 -0
  157. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +1 -0
  158. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +1 -0
  159. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +1 -0
  160. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +1 -0
  161. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +1 -0
  162. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +1 -0
  163. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +1 -0
  164. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +1 -0
  165. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +1 -0
  166. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +1 -0
  167. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +1 -0
  168. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +1 -0
  169. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +1 -0
  170. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +1 -0
  171. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +1 -0
  172. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +1 -0
  173. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +1 -0
  174. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +1 -0
  175. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +1 -0
  176. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +1 -0
  177. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +1 -0
  178. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +1 -0
  179. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +1 -0
  180. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +1 -0
  181. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +1 -0
  182. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +1 -0
  183. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +1 -0
  184. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +3 -0
  185. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +1 -0
  186. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +1 -0
  187. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +8 -0
  188. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +1 -0
  189. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +1 -0
  190. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +5 -0
  191. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +1 -0
  192. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +1 -0
  193. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +1 -0
  194. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +1 -0
  195. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +1 -0
  196. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +1 -0
  197. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +1 -0
  198. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +1 -0
  199. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +1 -0
  200. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +1 -0
  201. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +1 -0
  202. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +1 -0
  203. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +1 -0
  204. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +1 -0
  205. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +1 -0
  206. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +1 -0
  207. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +1 -0
  208. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +1 -0
  209. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js +0 -0
  210. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +1 -0
  211. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +1 -0
  212. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +10 -0
  213. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +2 -0
  214. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +1 -0
  215. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +12 -0
  216. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +16 -0
  217. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +1 -0
  218. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +1 -0
  219. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +1 -0
  220. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +1 -0
  221. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +1 -0
  222. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +14 -0
  223. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +0 -0
  224. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -0
  225. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +1 -0
  226. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +1 -0
  227. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +5 -0
  228. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +1 -0
  229. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +5 -0
  230. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +1 -0
  231. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +1 -0
  232. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +0 -0
  233. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +1 -0
  234. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  235. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +1 -0
  236. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +74 -0
  237. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
  238. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +1 -0
  239. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +1 -0
  240. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -0
  241. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +1 -0
  242. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  243. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  244. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +1 -0
  245. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +1 -0
  246. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +1 -0
  247. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +1 -0
  248. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +1 -0
  249. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
  250. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
  251. package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
  252. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  253. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  254. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  255. package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
  256. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  257. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  258. package/dist/server/create-harness.js +1 -0
  259. package/dist/utils/clipboard-native.js +1 -0
  260. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  261. package/examples/extensions/gondolin/package-lock.json +2 -2
  262. package/examples/extensions/gondolin/package.json +1 -1
  263. package/examples/extensions/with-deps/package-lock.json +2 -2
  264. package/examples/extensions/with-deps/package.json +1 -1
  265. package/npm-shrinkwrap.json +2 -2
  266. package/package.json +1 -1
  267. package/dist/bundle/chunks/chunk-3YGHTGYM.js +0 -7
  268. package/dist/bundle/chunks/chunk-MKMLENQD.js +0 -17
  269. package/dist/bundle/chunks/chunk-SE42OS3U.js +0 -21
  270. package/dist/bundle/chunks/chunk-T3TEURLR.js +0 -30
  271. package/dist/bundle/chunks/chunk-XTN2LDU3.js +0 -9
  272. package/dist/bundle/chunks/runtime-G7F6UQLA.js +0 -1
  273. package/dist/bundle/chunks/sdk-CEIRR6KD.js +0 -1
  274. package/dist/bundle/chunks/usage-3ACOJWR3.js +0 -1
  275. package/dist/bundle/chunks/virtual-modules-P4JE2EA6.js +0 -1
  276. /package/dist/bundle/chunks/{chunk-SZZVJTVX.js → chunk-MZ7O6YLD.js} +0 -0
@@ -1,3 +1,3 @@
1
- var E=Object.defineProperty;var n=(r,e)=>E(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";const X=w(import.meta.url);import{DEFAULT_CONFIG as v,DEFAULT_ROLE_MODELS as k,resolveRoles as x}from"./chunk-UULAEZ3H.js";import"./chunk-XTN2LDU3.js";import"./chunk-RX6CC5RH.js";import"./chunk-T3TEURLR.js";import"./chunk-3HGUIN22.js";import"./chunk-3YGHTGYM.js";import"./chunk-MKMLENQD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-SZZVJTVX.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-BIY5HTFI.js";import"./chunk-4LDEEFCY.js";import"./chunk-F37JXTCY.js";import"./chunk-JXWJOIH4.js";var y=/\s*\([^)]*upstream id\)\s*$/i,b=/\bexp\b|\(exp\)|experimental/i,d=/-\d{6,8}$/,f=/\bv(\d+(?:\.\d+)*)\b/i;function T(r){return(r.name??r.id).replace(y,"").trim().toLowerCase()}n(T,"canonicalName");function _(r){let e=f.exec(r);return e?e[1].split(".").map(Number):void 0}n(_,"versionOf");function I(r,e){for(let i=0;i<Math.max(r.length,e.length);i++){let s=(r[i]??0)-(e[i]??0);if(s!==0)return s}return 0}n(I,"compareVersions");var N=[{model:/^deepseek-v4-pro(?:-ga-\d{6,8})?$/,by:"deepseek-flash"}];function R(r){let e=new Set(r.map(t=>t.id)),i=r.filter(t=>!b.test(t.name??"")&&!b.test(t.id)&&!N.some(o=>o.model.test(t.id)&&e.has(o.by))),s=new Map;for(let t of i){let o=T(t),a=s.get(o);(!a||d.test(a.id)&&!d.test(t.id)||d.test(a.id)===d.test(t.id)&&t.id.length<a.id.length)&&s.set(o,t)}let p=new Map,m=[];for(let[t,o]of s){let a=_(t);if(!a){m.push(o);continue}let u=`${t.replace(f,"").replace(/\s+/g," ").trim()}@${o.costPerMtok}`,h=p.get(u);(!h||I(a,h.version)>0)&&p.set(u,{model:o,version:a})}let c=new Set([...m,...[...p.values()].map(t=>t.model)]);return i.filter(t=>c.has(t))}n(R,"curatePool");var S=/全部(?:都)?(?:做|完成|弄|搞|处理|修)|都(?:要)?(?:做好|做完|完成|修好|搞定)|每一(?:项|个|条)都|逐条做完|一次(?:性)?(?:做|搞)完|\ball of (?:them|it|these)\b|\beverything\b|\beach of (?:them|these)\b/i,L=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function D(r){let e=r.trim(),i=e.split(`
1
+ var E=Object.defineProperty;var n=(r,e)=>E(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";const X=w(import.meta.url);import{DEFAULT_CONFIG as v,DEFAULT_ROLE_MODELS as k,resolveRoles as x}from"./chunk-F577XLVZ.js";import"./chunk-LZTZWS3N.js";import"./chunk-FSX34SAZ.js";import"./chunk-JPCWLZUZ.js";import"./chunk-JPBJUBY4.js";import"./chunk-XIJS4F22.js";import"./chunk-IRSW3MVW.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-6PQZ4KMC.js";import"./chunk-6SPX3U36.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-MZ7O6YLD.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-PD6QS7YD.js";import"./chunk-4LDEEFCY.js";import"./chunk-GPI2GHBH.js";import"./chunk-JXWJOIH4.js";var y=/\s*\([^)]*upstream id\)\s*$/i,b=/\bexp\b|\(exp\)|experimental/i,d=/-\d{6,8}$/,f=/\bv(\d+(?:\.\d+)*)\b/i;function T(r){return(r.name??r.id).replace(y,"").trim().toLowerCase()}n(T,"canonicalName");function _(r){let e=f.exec(r);return e?e[1].split(".").map(Number):void 0}n(_,"versionOf");function I(r,e){for(let i=0;i<Math.max(r.length,e.length);i++){let s=(r[i]??0)-(e[i]??0);if(s!==0)return s}return 0}n(I,"compareVersions");var N=[{model:/^deepseek-v4-pro(?:-ga-\d{6,8})?$/,by:"deepseek-flash"}];function R(r){let e=new Set(r.map(t=>t.id)),i=r.filter(t=>!b.test(t.name??"")&&!b.test(t.id)&&!N.some(o=>o.model.test(t.id)&&e.has(o.by))),s=new Map;for(let t of i){let o=T(t),a=s.get(o);(!a||d.test(a.id)&&!d.test(t.id)||d.test(a.id)===d.test(t.id)&&t.id.length<a.id.length)&&s.set(o,t)}let p=new Map,m=[];for(let[t,o]of s){let a=_(t);if(!a){m.push(o);continue}let u=`${t.replace(f,"").replace(/\s+/g," ").trim()}@${o.costPerMtok}`,h=p.get(u);(!h||I(a,h.version)>0)&&p.set(u,{model:o,version:a})}let c=new Set([...m,...[...p.values()].map(t=>t.model)]);return i.filter(t=>c.has(t))}n(R,"curatePool");var S=/全部(?:都)?(?:做|完成|弄|搞|处理|修)|都(?:要)?(?:做好|做完|完成|修好|搞定)|每一(?:项|个|条)都|逐条做完|一次(?:性)?(?:做|搞)完|\ball of (?:them|it|these)\b|\beverything\b|\beach of (?:them|these)\b/i,L=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function D(r){let e=r.trim(),i=e.split(`
2
2
  `).filter(s=>L.test(s)).length;return i>=4||e.length>=1500?!0:S.test(e)&&(i>=2||e.length>=300)}n(D,"looksComplex");var M=/(?:实现|添加|增加|新增|加上|修复|修改|改成|改为|重构|迁移|替换|重命名|删除|拆分|合并|优化|编写|写一?个|写出|生成|创建|做一?[个份套]|整理成|补充|补上|测试|支持)|\b(?:add|implement|fix|change|refactor|migrate|replace|rename|remove|delete|split|merge|optimi[sz]e|write|create|generate|build|make|convert|support|test|update)\b/gi,O=/[??]\s*$|^(?:为什么|怎么|如何|什么|哪|是否|有没有|能不能|请问|解释|说明|介绍)|^(?:why|how|what|which|where|when|explain|describe)\b/i,A=/^\s*(?:\(?\d{1,2}[.、))]|[-*•]\s)/;function C(r){let e=r.trim();if(!e)return!1;let i=new Set((e.match(M)??[]).map(s=>s.toLowerCase()));return i.size===0||O.test(e)&&i.size===1&&e.length<300?!1:D(e)||e.split(`
3
3
  `).filter(s=>A.test(s)).length>=2||e.length>=600?!0:i.size>=3&&e.length>=120}n(C,"needsPlanning");var P=/先(?:做|出|给|写|列)?(?:个|一个|一份)?(?:规划|计划|方案|设计)|(?:规划|计划|设计)一下(?:再|然后)|先想清楚(?:再|然后)|\bplan (?:it |this |the change |the work )?(?:first|before)\b|\b(?:make|write|draft|propose) a plan\b|\bwork out the design\b|\bdesign (?:it |this )?before\b/i,q=/(?:做|制作|生成|写|出一份|出个|创建|整理成|准备|起草|导出|帮我弄|改成|美化|排版)|\b(?:make|create|generate|build|write|prepare|draft|produce|put together|export)\b/i,U=/(?:PPT|幻灯片|演示文稿|课件|汇报材料|简历|报告|周报|月报|调研|方案书|白皮书|Word\s*文档|docx|Excel|xlsx|电子表格|表格|图表|可视化|仪表盘)|\b(?:pptx?|slides?|slide deck|deck|presentation|resume|cv|report|white ?paper|docx|word document|excel|xlsx|spreadsheet|workbook|chart|dashboard)\b/i,$=/(?:架构|系统设计|技术方案|设计(?:一个|一套|方案)|数据模型设计|接口设计)|\b(?:architecture|architect|system design|design (?:a|an|the) (?:system|api|schema|module|architecture))\b/i,F=/(?:多个文件|多文件|跨文件|跨模块|所有(?:模块|文件|调用)|整个(?:项目|仓库|代码库)|全(?:仓库|项目)|几个模块|重构|迁移)|\b(?:across (?:the )?(?:codebase|code base|repo|repository|project|modules|files)|multi-?file|every (?:caller|call site|module)|all (?:callers|call sites|modules)|codebase-wide|refactor|migrate|migration|everywhere)\b/i,V=/(?:规范|规格|按(?:照)?文档|严格按|边界(?:情况|条件)|所有(?:错误|异常)情况|每一种(?:错误|情况))|\b(?:spec(?:ification)?|exactly|edge cases?|every error case|error cases|corner cases?|the rules below)\b/i,z=/[??]\s*$|^(?:为什么|怎么|如何|什么|哪|是否|有没有|能不能|请问|解释|说明|介绍|总结|概括|看看|读一下)|^(?:why|how|what|which|where|when|who|explain|describe|summari[sz]e|tell me)\b/i,G=/(?:实现|添加|增加|新增|加上|修复|修改|改成|改为|重构|迁移|替换|重命名|删除|拆分|合并|优化|编写|写一?个|生成|创建|补充|补上|支持|修好|修一下|改一下)|\b(?:add|implement|fix|change|refactor|migrate|replace|rename|remove|delete|split|merge|optimi[sz]e|write|create|generate|build|make|convert|support|update|rewrite)\b/i,g=800;function l(r,e){let i=r.exec(e);return i?i[0].trim():void 0}n(l,"firstMatch");var B=/\.(?:m?[jt]sx?|py|go|rs|java|kt|rb|php|c|cc|cpp|h|cs|swift|vue|sql|sh)\b|\b(?:src|tests?|lib|pkg|cmd)\/|\b(?:npm|pnpm|yarn) (?:run |test)|\bunittest\b|\bpytest\b|\bgo test\b|\bcargo\b|\bregression tests?\b|单测|测试用例/i;function H(r){let e=r.trim();if(!e)return{route:"direct",kind:"empty",reasons:[]};let i=l(P,e);if(i)return{route:"split",kind:"plan-requested",reasons:[i]};let s=l(G,e),p=l(q,e),m=l(U,e),c=z.test(e);if(m&&p&&!(c&&!s)&&!B.test(e))return{route:"split",kind:"deliverable",reasons:[p,m]};if(!s)return{route:"direct",kind:c?"question":"small-change",reasons:[]};let t=l($,e);if(t)return{route:"split",kind:"design",reasons:[t]};let o=l(F,e);if(o)return{route:"direct",kind:"multi-file",reasons:[o]};let a=l(V,e);return a?{route:"direct",kind:"spec",reasons:[a]}:e.length>=g||C(e)?{route:"direct",kind:"multi-step",reasons:[e.length>=g?`${e.length} chars`:"several steps"]}:{route:"direct",kind:c?"question":"small-change",reasons:[s]}}n(H,"classifyTask");export{v as DEFAULT_CONFIG,k as DEFAULT_ROLE_MODELS,H as classifyTask,R as curatePool,x as resolveRoles};
@@ -0,0 +1 @@
1
+ import{createRequire as r}from"node:module";const u=r(import.meta.url);import{McpOAuthAuthorizationRequiredError as e,McpOAuthCredentialStore as t,McpServerConnection as o,McpServerLog as i,McpSignInCancelledError as p,createDefaultTransport as m,createMcpAuthProvider as c,signInMcpServer as n}from"./chunk-O3XFDBJ3.js";import"./chunk-6PQZ4KMC.js";import"./chunk-6SPX3U36.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-MZ7O6YLD.js";import"./chunk-JXWJOIH4.js";export{e as McpOAuthAuthorizationRequiredError,t as McpOAuthCredentialStore,o as McpServerConnection,i as McpServerLog,p as McpSignInCancelledError,m as createDefaultTransport,c as createMcpAuthProvider,n as signInMcpServer};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var t=(r,o)=>m(r,"name",{value:o,configurable:!0});import{createRequire as p}from"node:module";const Z=p(import.meta.url);import{BUILTIN_AGENT_DESCRIPTIONS as i,READ_ONLY_TOOL_NAMES as a}from"./chunk-34D4KVPX.js";import"./chunk-F577XLVZ.js";import{DAL_HOOK_ENTRY_TYPE as n,dalHookActivity as s,isDalHookActivity as l,runDalHookEvent as E,runNotificationHooks as _,runUserPromptSubmitHooks as N}from"./chunk-LZTZWS3N.js";import{BUNDLED_EXTENSION_PACKAGES as O,DAL_TOOL_NAMES as A,DefaultPackageManager as S,HOST_CAPABILITIES_ENV as T,HOST_TOKEN_ENV as I,HOST_TOKEN_HEADER as c,HOST_URL_ENV as u,RpcClient as D,RpcCommandError as R,SettingsManager as L,buildProjectMap as d,formatProjectMapPrompt as P,listBundledExtensions as H,listToolCatalog as f,loadProjectContextFiles as C,loadSkills as g,parseFrontmatter as k,toolDisplayLabel as M}from"./chunk-FSX34SAZ.js";import{SessionManager as v,getDefaultSessionDirs as B,parseSessionEntries as w}from"./chunk-JPCWLZUZ.js";import{ModelRuntime as y,PROJECT_HOOKS_FILE_ENV as F,loadDalHooks as K,projectHooksFileFromEnv as V}from"./chunk-JPBJUBY4.js";import"./chunk-XIJS4F22.js";import"./chunk-IRSW3MVW.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-6PQZ4KMC.js";import"./chunk-6SPX3U36.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as b,SHARED_SKILL_CONFIG_DIRS as x,VERSION as Y,getAgentDir as j,getExamplesPath as G}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{getLanguage as U,translate as e}from"./chunk-MZ7O6YLD.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-PD6QS7YD.js";import"./chunk-4LDEEFCY.js";import"./chunk-GPI2GHBH.js";import"./chunk-JXWJOIH4.js";var q=/(?<![\w@./\\~-])(?:pi|Pi)(?![\w/-]|\.\w)/g;function h(r){return r.replace(q,"DAL")}t(h,"brandText");var J="terminal",X=1;function z(r=U()){let o=[...a];return[{name:"scout",description:e(i.scout,r),tools:o,readOnly:!0},{name:"worker",description:e(i.worker,r),readOnly:!1},{name:"reviewer",description:e(i.reviewer,r),tools:o,readOnly:!0}]}t(z,"listBuiltinSubagents");export{O as BUNDLED_EXTENSION_PACKAGES,b as CONFIG_DIR_NAME,n as DAL_HOOK_ENTRY_TYPE,A as DAL_TOOL_NAMES,S as DefaultPackageManager,T as HOST_CAPABILITIES_ENV,I as HOST_TOKEN_ENV,c as HOST_TOKEN_HEADER,u as HOST_URL_ENV,y as ModelRuntime,F as PROJECT_HOOKS_FILE_ENV,D as RpcClient,R as RpcCommandError,x as SHARED_SKILL_CONFIG_DIRS,v as SessionManager,L as SettingsManager,J as TERMINAL_CAPABILITY,X as TERMINAL_CAPABILITY_VERSION,Y as VERSION,h as brandText,d as buildProjectMap,s as dalHookActivity,P as formatProjectMapPrompt,j as getAgentDir,B as getDefaultSessionDirs,G as getExamplesPath,l as isDalHookActivity,z as listBuiltinSubagents,H as listBundledExtensions,f as listToolCatalog,K as loadDalHooks,C as loadProjectContextFiles,g as loadSkills,k as parseFrontmatter,w as parseSessionEntries,V as projectHooksFileFromEnv,E as runDalHookEvent,_ as runNotificationHooks,N as runUserPromptSubmitHooks,M as toolDisplayLabel};
@@ -1,8 +1,8 @@
1
- var pt=Object.defineProperty;var a=(e,t)=>pt(e,"name",{value:t,configurable:!0});import{createRequire as mt}from"node:module";const Ts=mt(import.meta.url);import"./chunk-XTN2LDU3.js";import{getDefaultSessionDir as ht}from"./chunk-RX6CC5RH.js";import"./chunk-T3TEURLR.js";import"./chunk-3HGUIN22.js";import"./chunk-3YGHTGYM.js";import"./chunk-MKMLENQD.js";import"./chunk-SE42OS3U.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{DATA_FORMAT_KEY as yt,declaredDataFormat as ee,reportNewerDataFormat as xe,t as z,withFileLockSync as te,writeFileAtomicSync as B}from"./chunk-SZZVJTVX.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-BIY5HTFI.js";import"./chunk-4LDEEFCY.js";import"./chunk-F37JXTCY.js";import"./chunk-JXWJOIH4.js";import{existsSync as gt,readFileSync as bt}from"node:fs";import{join as St}from"node:path";import{createHash as Et,randomBytes as wt}from"node:crypto";import{existsSync as _e,mkdirSync as ne,readdirSync as At,readFileSync as je,rmSync as vt,statSync as kt}from"node:fs";import{join as R}from"node:path";import{join as xt}from"node:path";import{homedir as _t}from"node:os";var jt=[[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,"<private-key>"],[/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <secret>"],[/\beyJ[A-Za-z0-9._-]{16,}/g,"<secret>"],[/\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{8,}/g,"<secret>"],[/\bglpat-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bAKIA[0-9A-Z]{12,}/g,"<secret>"],[/\bxox[abposr]-[A-Za-z0-9-]{8,}/g,"<secret>"],[/\bnpm_[A-Za-z0-9]{20,}/g,"<secret>"],[/\b([A-Za-z0-9_.-]*(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|auth|cookie|session)[A-Za-z0-9_.-]*)(["']?\s*[:=]\s*["']?)([^\s"',;]{4,})/gi,"$1$2<secret>"],[/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,"$1<secret>@"],[/[A-Za-z0-9+/_-]{40,}={0,2}/g,"<opaque>"]];function U(e){let t=e;for(let[i,s]of jt)t=t.replace(i,s);let n=_t();return n&&n.length>1&&(t=t.split(n).join("~")),t=t.replace(/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/g,"~"),t}a(U,"redact");var Nt=[{reason:"weakens_safety",pattern:/\b(?:skip|bypass|disable|ignore|override|turn off|circumvent)\b[^\n]{0,40}\b(?:approvals?|permissions?|sandbox(?:es)?|safety|guards?|confirmations?|hooks?|polic(?:y|ies)|protections?)\b/i},{reason:"weakens_safety",pattern:/(?:跳过|绕过|关闭|禁用|忽略|无视)[^。\n]{0,12}(?:审批|权限|确认|沙箱|安全|保护|钩子|拦截)/u},{reason:"weakens_safety",pattern:/(?:不要|不必|无需)(?![^。\n]{0,6}未经)[^。\n]{0,6}(?:审批|确认|沙箱)/u},{reason:"weakens_safety",pattern:/\b(?:skip|disable)\b[^\n]{0,20}\btests?\b|--no-verify\b/i},{reason:"weakens_safety",pattern:/--dangerously|\byolo\b|bypassPermissions|\bsudo\b|chmod\s+777|rm\s+-rf\s+[/~]/i},{reason:"exfiltrates",pattern:/\b(?:curl|wget|scp|rsync|nc|upload|send|post|exfiltrate|share)\b[^\n]{0,60}\b(?:tokens?|keys?|secrets?|passwords?|credentials?|cookies?|env|\.ssh|sessions?)\b/i},{reason:"exfiltrates",pattern:/(?:上传|发送|发到|外发|分享|传到)[^。\n]{0,20}(?:密钥|令牌|密码|凭据|凭证|cookie|环境变量|私钥)/iu},{reason:"installs",pattern:/\b(?:npm|pnpm|bun)\s+(?:i|install|add)\b[^\n]*?(?:\s-g\b|--global\b)|\byarn\s+global\s+add\b/i},{reason:"installs",pattern:/\b(?:brew|apt(?:-get)?|yum|dnf|pacman|apk|choco|winget|scoop|snap|cargo|gem|pipx)\s+(?:install|add)\b|\bgo\s+install\b|\buv\s+tool\s+install\b/i},{reason:"installs",pattern:/\b(?:npm\s+(?:i|install)|pnpm\s+(?:add|i|install)|yarn\s+add|bun\s+add)\s+(?!(?:in|at|from|first|before|after|then|and|again|once|for|inside|to|with|when|so|instead|works|fails|succeeds)\b)[@a-z][\w@./-]*/i},{reason:"installs",pattern:/\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\binstall(?:er)?\s+script\b/i},{reason:"installs",pattern:/\b(?:npx|npm\s+exec)\b[^\n`]*?\s(?:-y|--yes)\b|\bnpx\s+(?:-\S+\s+)*@?[a-z][\w./-]*@[\w.^~*-]+|\b(?:pnpm|yarn)\s+dlx\b|\bbunx\b|\buvx\b|\bpipx\s+run\b/i},{reason:"installs",pattern:/全局安装|从[^。\n]{1,30}下载|下载(?:并|后)?(?:运行|执行|安装)/u},{reason:"concrete_value",pattern:/\bhttps?:\/\/|\bwww\./i},{reason:"concrete_value",pattern:/<(?:secret|opaque|private-key)>/},{reason:"concrete_value",pattern:/[A-Za-z0-9+/=_-]{40,}/},{reason:"concrete_value",pattern:/\b\d{1,3}(?:\.\d{1,3}){3}\b/},{reason:"concrete_value",pattern:/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/},{reason:"concrete_value",pattern:/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/}];function It(e){let t=[e.content,e.rootCause??"",e.note??""].join(`
1
+ var pt=Object.defineProperty;var a=(e,t)=>pt(e,"name",{value:t,configurable:!0});import{createRequire as mt}from"node:module";const Ts=mt(import.meta.url);import{getDefaultSessionDir as ht}from"./chunk-JPCWLZUZ.js";import"./chunk-XIJS4F22.js";import"./chunk-NJDCSLWK.js";import"./chunk-6SPX3U36.js";import"./chunk-G5AMLGXC.js";import"./chunk-R47JBGS3.js";import{DATA_FORMAT_KEY as yt,declaredDataFormat as ee,reportNewerDataFormat as xe,t as z,withFileLockSync as te,writeFileAtomicSync as B}from"./chunk-MZ7O6YLD.js";import"./chunk-IEBK4HQA.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-PD6QS7YD.js";import"./chunk-4LDEEFCY.js";import"./chunk-GPI2GHBH.js";import"./chunk-JXWJOIH4.js";import{existsSync as gt,readFileSync as bt}from"node:fs";import{join as St}from"node:path";import{createHash as Et,randomBytes as wt}from"node:crypto";import{existsSync as _e,mkdirSync as ne,readdirSync as At,readFileSync as je,rmSync as vt,statSync as kt}from"node:fs";import{join as R}from"node:path";import{join as xt}from"node:path";import{homedir as _t}from"node:os";var jt=[[/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,"<private-key>"],[/\b(?:sk|pk|rk)-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi,"Bearer <secret>"],[/\beyJ[A-Za-z0-9._-]{16,}/g,"<secret>"],[/\b(?:ghp|gho|ghu|ghs|ghr|github_pat)_[A-Za-z0-9_]{8,}/g,"<secret>"],[/\bglpat-[A-Za-z0-9_-]{8,}/g,"<secret>"],[/\bAKIA[0-9A-Z]{12,}/g,"<secret>"],[/\bxox[abposr]-[A-Za-z0-9-]{8,}/g,"<secret>"],[/\bnpm_[A-Za-z0-9]{20,}/g,"<secret>"],[/\b([A-Za-z0-9_.-]*(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|auth|cookie|session)[A-Za-z0-9_.-]*)(["']?\s*[:=]\s*["']?)([^\s"',;]{4,})/gi,"$1$2<secret>"],[/(\b[a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/gi,"$1<secret>@"],[/[A-Za-z0-9+/_-]{40,}={0,2}/g,"<opaque>"]];function U(e){let t=e;for(let[i,s]of jt)t=t.replace(i,s);let n=_t();return n&&n.length>1&&(t=t.split(n).join("~")),t=t.replace(/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/g,"~"),t}a(U,"redact");var Nt=[{reason:"weakens_safety",pattern:/\b(?:skip|bypass|disable|ignore|override|turn off|circumvent)\b[^\n]{0,40}\b(?:approvals?|permissions?|sandbox(?:es)?|safety|guards?|confirmations?|hooks?|polic(?:y|ies)|protections?)\b/i},{reason:"weakens_safety",pattern:/(?:跳过|绕过|关闭|禁用|忽略|无视)[^。\n]{0,12}(?:审批|权限|确认|沙箱|安全|保护|钩子|拦截)/u},{reason:"weakens_safety",pattern:/(?:不要|不必|无需)(?![^。\n]{0,6}未经)[^。\n]{0,6}(?:审批|确认|沙箱)/u},{reason:"weakens_safety",pattern:/\b(?:skip|disable)\b[^\n]{0,20}\btests?\b|--no-verify\b/i},{reason:"weakens_safety",pattern:/--dangerously|\byolo\b|bypassPermissions|\bsudo\b|chmod\s+777|rm\s+-rf\s+[/~]/i},{reason:"exfiltrates",pattern:/\b(?:curl|wget|scp|rsync|nc|upload|send|post|exfiltrate|share)\b[^\n]{0,60}\b(?:tokens?|keys?|secrets?|passwords?|credentials?|cookies?|env|\.ssh|sessions?)\b/i},{reason:"exfiltrates",pattern:/(?:上传|发送|发到|外发|分享|传到)[^。\n]{0,20}(?:密钥|令牌|密码|凭据|凭证|cookie|环境变量|私钥)/iu},{reason:"installs",pattern:/\b(?:npm|pnpm|bun)\s+(?:i|install|add)\b[^\n]*?(?:\s-g\b|--global\b)|\byarn\s+global\s+add\b/i},{reason:"installs",pattern:/\b(?:brew|apt(?:-get)?|yum|dnf|pacman|apk|choco|winget|scoop|snap|cargo|gem|pipx)\s+(?:install|add)\b|\bgo\s+install\b|\buv\s+tool\s+install\b/i},{reason:"installs",pattern:/\b(?:npm\s+(?:i|install)|pnpm\s+(?:add|i|install)|yarn\s+add|bun\s+add)\s+(?!(?:in|at|from|first|before|after|then|and|again|once|for|inside|to|with|when|so|instead|works|fails|succeeds)\b)[@a-z][\w@./-]*/i},{reason:"installs",pattern:/\|\s*(?:sudo\s+)?(?:ba|z)?sh\b|\binstall(?:er)?\s+script\b/i},{reason:"installs",pattern:/\b(?:npx|npm\s+exec)\b[^\n`]*?\s(?:-y|--yes)\b|\bnpx\s+(?:-\S+\s+)*@?[a-z][\w./-]*@[\w.^~*-]+|\b(?:pnpm|yarn)\s+dlx\b|\bbunx\b|\buvx\b|\bpipx\s+run\b/i},{reason:"installs",pattern:/全局安装|从[^。\n]{1,30}下载|下载(?:并|后)?(?:运行|执行|安装)/u},{reason:"concrete_value",pattern:/\bhttps?:\/\/|\bwww\./i},{reason:"concrete_value",pattern:/<(?:secret|opaque|private-key)>/},{reason:"concrete_value",pattern:/[A-Za-z0-9+/=_-]{40,}/},{reason:"concrete_value",pattern:/\b\d{1,3}(?:\.\d{1,3}){3}\b/},{reason:"concrete_value",pattern:/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/},{reason:"concrete_value",pattern:/(?:\/Users\/|\/home\/|[A-Za-z]:\\Users\\)[^\s/\\]+/}];function It(e){let t=[e.content,e.rootCause??"",e.note??""].join(`
2
2
  `);for(let{reason:i,pattern:s}of Nt)if(s.test(t))return i;let n=e.content.trim().length;if(n<6||n>320)return"length"}a(It,"rejectLesson");var Ot=[{category:"deletion",pattern:/\b(?:rm|rmdir|del|unlink|truncate|shred)\b|\bdelet(?:e|es|ed|ing)\b|\bremov(?:e|es|ed|ing)\b|\bdrop\s+(?:table|database|schema)\b|\bgit\s+(?:clean|reset\s+--hard|push\s+[^\n]*--force|branch\s+-D)\b|\bwip(?:e|ing)\b|\bpurge\b|删除|删掉|清空|清除|覆盖(?!率)|重置/iu},{category:"permissions",pattern:/\b(?:chmod|chown|sudo|setfacl|icacls)\b|\bpermissions?\b|\bapprov(?:al|e)s?\b|\bsandbox\b|\bguard\b|\bescalat\w*|权限|审批|放行|沙箱|提权/iu},{category:"credentials",pattern:/\b(?:tokens?|secrets?|passwords?|passwd|credentials?|api[\s_-]?keys?|private\s+keys?|ssh\s+keys?|auth(?:\.json)?|login|cookies?|\.env)\b|凭据|凭证|密钥|密码|令牌|登录|私钥/iu},{category:"network",pattern:/\b(?:curl|wget|http|https|proxy|download|upload|dns|ssh|scp|rsync|webhook)\b|联网|下载|上传|代理|外网/iu},{category:"publishing",pattern:/\b(?:publish|release|deploy|push|git\s+tag|merge\s+to\s+main)\b|发布|发版|上线|部署|推送|合并到主/iu}],se=String.raw`(?:package\.json|package-lock\.json|lock\s?files?|pnpm-lock|yarn\.lock|requirements[\w.-]*\.txt|pyproject\.toml|Cargo\.toml|go\.mod|\.github\/workflows[\w./-]*|CI\s+config(?:uration)?)`,Ne=/\b(?:npm|pnpm|yarn|bun)[ \t]+(?:i|install|add)[ \t]+(?:-{1,2}[\w-]+[ \t]+)*[@a-z][\w@./-]*|\bpip3?[ \t]+install[ \t]+(?!-r\b)[a-z]|--save-dev\b|\binstall(?:ing)?\s+(?:the\s+|a\s+|an\s+|it\s+)?(?:missing\s+)?(?:tool|package|module|librar\w*|runner|linter|dependenc\w*)|as\s+a\s+dev-?dependency|(?:安装|装上|装一下|补装)\s*(?:缺少的|缺失的)?\s*(?:工具|依赖|包|插件|运行器)|装依赖/iu,Tt=new RegExp(String.raw`\b(?:fix|edit|change|modify|update|rewrite|patch|add\b[^.;\n]{0,40}?\bto)\b[^.;\n]{0,40}?${se}|\b(?:fix|edit|change|modify|update|rewrite|patch)\b[^.;\n]{0,12}?\b(?:the\s+)?(?:npm\s+|test\s+|lint\s+|build\s+)?scripts?\b|(?:改|修改|改写|修复)[^。;;\n]{0,6}?(?:测试|npm|lint|构建)?\s*脚本|${se}[^.;\n]{0,20}?\b(?:should|must)\s+be\s+(?:changed|edited|updated|fixed)|(?:改|修改|编辑|调整|修复|补上|加到|写进)[^。;;\n]{0,12}?${se}`,"iu"),Ie=/\b(?:before|instead\s+of|rather\s+than|don'?t|do\s+not|never|avoid|without)\b[^.;\n]{0,24}$|(?:不要|别|不许|先别|而不是|避免|不用)[^。;;\n]{0,8}$/iu;function Rt(e){if(Ne.test(e)){let n=e.search(Ne);if(!Ie.test(e.slice(Math.max(0,n-30),n)))return!0}let t=Tt.exec(e);return!!(t&&!Ie.test(e.slice(Math.max(0,t.index-30),t.index)))}a(Rt,"prescribesDependencyChange");function $t(e){let t=Ot.filter(({pattern:n})=>Lt(e,n)).map(({category:n})=>n);return Rt(e)?[...t,"dependencies"]:t}a($t,"riskOf");var Ct=/[。;;,,!?!?\n]|\.(?=\s|$)/u,Ft=/\b(?:don'?t|do\s+not|never|avoid|stop|instead\s+of|rather\s+than|refuse|no\s+longer)\b|不要|不得|不能|不应|不该|(?<![区分类级识特个差告])别(?![的处人名])|切勿|勿|禁止|避免|停止|不再|而不是|而非|拒绝|不可|严禁|防止/iu,Dt=/^\s*(?:当|如果|若|假如|一旦|万一|when\b|if\b|once\b|whenever\b)/iu,Oe=/就|则|便|\bthen\b/iu,Mt=/(?:时|之后|以后|的时候)\s*$/u;function qt(e){return Dt.test(e)?Oe.test(e)?[e]:[]:Mt.test(e)&&!Oe.test(e)?[]:[e]}a(qt,"prescriptiveParts");function Lt(e,t){let n=new RegExp(t.source,t.flags.includes("g")?t.flags:`${t.flags}g`);for(let i of e.split(Ct))for(let s of qt(i))for(let r of s.matchAll(n))if(!Ft.test(s.slice(0,r.index)))return!0;return!1}a(Lt,"prescribedIn");var zt=[["typecheck",/\btsc\b(?!.*--build)|\bmypy\b|\bpyright\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:typecheck|type-check|check-types)\b/],["test",/\b(?:vitest|jest|mocha|ava|pytest|tox|rspec|phpunit)\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?test\b|\bnode\s+--test\b|\b(?:go|cargo|dotnet|mix|deno)\s+test\b|\bmake\s+test\b|\bgradlew?\s+test\b|\bmvn\s+test\b/],["lint",/\b(?:eslint|biome|ruff|flake8|pylint|golangci-lint|clippy|prettier\s+--check)\b|\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?(?:lint|check)\b/],["build",/\b(?:npm|pnpm|yarn|bun)\s+(?:run\s+)?build\b|\b(?:cargo|go|dotnet|swift)\s+build\b|\bmake\b(?!\s+test)|\bgradlew?\s+(?:build|assemble)\b|\bmvn\s+(?:package|install)\b|\btsc\s+--build\b|\bvite\s+build\b|\bwebpack\b/],["install",/^(?:npm\s+(?:ci|install|i)|pnpm\s+(?:install|i)|yarn(?:\s+install)?|bun\s+install|pip3?\s+install\s+(?:-r|-e|\.)|poetry\s+install|uv\s+sync|bundle\s+install|composer\s+install|go\s+mod\s+download)(?:\s|$)/]],Bt=/^(?:tail|head|grep|egrep|fgrep|cat|less|more|tee|wc|sort|uniq|cut|column|sed|awk|nl)\b/,Ut=/^(?:head|grep|egrep|fgrep|cut|sed|awk)\b/,Pt=/^(?:echo|printf|cat|ls|pwd|true|false|:|#|sed|awk|grep|rg|head|tail|wc|find|git\s+(?:diff|status|log|show|stash|add)|set|export|printenv|which|whereis|type|command\s+-v|test\s|\[|stat|file|(?:node|npm|pnpm|yarn|bun|npx)\s+(?:-v|--version)|(?:npm|pnpm|yarn)\s+(?:ls|list|view|info|bin|root|config|why))(?:\b|(?=\s|$))/;function Jt(e){let t=e.replace(/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n[ \t]*\2[ \t]*(?=\n|$)/g,"<<$2$3").replace(/\s*\d*>&\d+/g,""),n=[],i=[],s="",r,o=a(()=>{i.push(s.trim()),s=""},"endStage"),c=a(()=>{o();let f=i.filter(Boolean);f.length&&n.push(f),i=[]},"endStatement");for(let f=0;f<t.length;f++){let y=t[f];if(r){if(y==="\\"&&r==='"'){s+=y+(t[f+1]??""),f++;continue}y===r&&(r=void 0),s+=y;continue}y==="'"||y==='"'?(r=y,s+=y):y==="\\"?(s+=y+(t[f+1]??""),f++):y===";"||y===`
3
3
  `?c():(y==="&"||y==="|")&&t[f+1]===y?(c(),f++):y==="&"?c():y==="|"?o():s+=y}return c(),n}a(Jt,"splitStatements");function Ht(e){let t=[],n=!1;for(let i of Jt(e)){let s=[...i],r=!1;for(;s.length>1&&Bt.test(s.at(-1));)Ut.test(s.at(-1))&&(r=!0),s.pop();let o=s.join(" | ").replace(/\s+/g," ");/^cd\s/.test(o)?t.push(o):!Pt.test(o)&&ie(o)&&(t.push(o),r&&(n=!0))}for(;t.length&&/^cd\s/.test(t.at(-1));)t.pop();return{statements:t,selected:n}}a(Ht,"checkParts");function ie(e){for(let[t,n]of zt)if(n.test(e))return t}a(ie,"intentOf");var Te=120,Re=/^(?:at\s|\S+\s\(\S+:\d+:\d+\)$|(?:file:\/\/)?\S+\.(?:[cm]?[jt]sx?|py|go|rs|rb|java|kt|php)(?::\d+){1,2}$|.*\bnode:internal\/|Node\.js v\d)/,$e=/^(?:>?\s*\d+\s*\|.*|[\s|]*\^+[\s^~]*|(?:if|else|for|while|switch|const|let|var|return|function|class|import|export|async|await|def|try|catch)\b.*|\}.*)$|\bthrow new\b|=>|[;{]$/,Ce=/^(?:(?:duration_ms|type|location|failureType|code|stack|operator|expected|actual|generatedMessage|name):|\.{3}$|-{3}$|TAP version|Subtest:|1\.\.\d+$|(?:tests|suites|pass|fail|cancelled|skipped|todo|duration_ms)\s+\d|Command exited with code)/,Kt=/^(?:E\s+)?(?:Uncaught\s+)?(?:[A-Z][\w.]*(?:Error|Exception)|Error|error(?: TS\d+|\[E\d+\])?)(?:\s*\[[\w-]+\])?:\s*\S|\berror TS\d+:\s*\S/,Gt=/^(?:expected\b.*\b(?:received|to (?:be|equal)|but got)\b|(?:Expected|Received)(?: value)?:\s*\S|.+\s!==?\s.+)/i,Zt=/^(?:FAIL(?:ED)?\b|not ok \d+|[✖×✗]\s|--- FAIL:?)/,Wt=/not found|no such|cannot|can't|unable|error|fail|missing|denied|unknown|invalid|找不到|不存在|失败|错误/i;function Yt(e){let t=e.trim().replace(/^#\s?/,"").trim();return t!==""&&(Re.test(t)||$e.test(t)||Ce.test(t))}a(Yt,"isUntellingReason");function Xt(e){let t=e.findIndex(s=>Gt.test(s));if(t<0)return;let n=e[t],i=/^Expected(?: value)?:/i.test(n)?e.slice(t+1,t+4).find(s=>/^Received(?: value)?:/i.test(s)):void 0;return i?`${n}, ${i}`:n}a(Xt,"comparison");function Vt(e){let t=U(e).replace(/\s+/g," ").trim();return t.length>Te?`${t.slice(0,Te-1)}\u2026`:t}a(Vt,"clipReason");function Qt(e){let t=[];for(let n=0;n<e.length;n++){let i=/^error:\s*(.*)$/.exec(e[n]);if(!i)continue;let s=i[1].replace(/^'(.*)'$/,"$1").replace(/^"(.*)"$/,"$1");if(/^\|-?$/.test(s)){let o=[];for(let c=n+1;c<e.length&&o.length<2&&!/^[a-z_]+:\s/i.test(e[c]);c++)o.push(e[c]);s=o.join(" ")}if(!s||s==="test failed")continue;let r="";for(let o=n+1;o<Math.min(e.length,n+12)&&!/^(?:\.{3}|not ok|ok)\b/.test(e[o]);o++){let c=/^name:\s*'?([\w.]+)'?$/.exec(e[o]);if(c){r=c[1];break}}t.push(r&&!s.startsWith(r)?`${r}: ${s}`:s)}return t}a(Qt,"tapErrors");function en(e){let t=e.split(/\r?\n/).map(s=>s.trim().replace(/^#\s?/,"").trim()).filter(Boolean),n=t.filter(s=>!Re.test(s)&&!$e.test(s)&&!Ce.test(s)),i=Qt(t)[0]??n.find(s=>Kt.test(s))??Xt(n)??n.find(s=>Zt.test(s))??n.find(s=>Wt.test(s))??"";return Vt(i)}a(en,"failureReason");function Fe(e){let t="",n=[];for(let i of Ht(e).statements){let s=/^cd\s+("[^"]+"|'[^']+'|\S+)$/.exec(i);if(s){let o=s[1].replace(/^["']|["']$/g,"");t=t&&!o.startsWith("/")?`${t}/${o}`:o;continue}let r=i.replace(/\s+/g," ").trim();n.some(o=>o.dir===t&&o.check===r)||n.push({dir:t,check:r,...ie(r)?{intent:ie(r)}:{}})}return n}a(Fe,"segmentsOf");function tn(e,t){return e===t||` ${e} `.includes(` ${t} `)||` ${t} `.includes(` ${e} `)}a(tn,"overlaps");function nn(e,t){let n=Fe(e),i=Fe(t),s=a((d,p)=>d.dir===p.dir&&d.check===p.check,"same"),r=n.filter(d=>!i.some(p=>s(d,p)));if(r.length===0)return;let o=new Set(r.map(d=>d.intent)),c=i.filter(d=>!n.some(p=>s(d,p))||o.has(d.intent)),f=r.filter(d=>c.some(p=>p.intent===d.intent));if(f.length===0||c.length===0||[...f,...c].some(d=>/^(?:\/|~|\$)/.test(d.dir))||f.some(d=>c.some(p=>p.dir===d.dir&&tn(d.check,p.check))))return;let y=a(d=>{let p=d[0].dir;if(d.some(l=>l.dir!==p))return;let u=d.map(l=>l.check).join(" && ");return p?`cd ${p} && ${u}`:u},"joined"),b=y(f),m=y(c);if(!(!b||!m||b===m))return{bad:b,good:m}}a(nn,"fixCommands");var sn=/command not found|: not found|is not (?:set|defined)|Missing script|Cannot find (?:module|package)|ERR_MODULE_NOT_FOUND|ENOENT|No such file|unknown (?:option|command|script|flag)|not recognized as|No test files|No tests found|permission denied|EACCES|找不到|未设置|不存在|未找到/i,rn=/AssertionError|^\s*(?:Expected|Received)(?: value)?:|\bexpected\b.*\b(?:received|to (?:be|equal)|but got)\b|\s!==?\s|^not ok \d+|^#\s*fail\s+[1-9]|^\s*\d+ (?:failing|failed)\b|Tests?:\s+\d+ failed|\berror TS\d+:|\d+ problems? \(\d+ errors?/im;function an(e){return rn.test(e)&&!sn.test(e)}a(an,"codeFailed");import{mkdirSync as on,readFileSync as un}from"node:fs";import{dirname as cn}from"node:path";var re=1;function De(e){let t;try{t=un(e,"utf8")}catch{return}try{let n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}catch{return}}a(De,"readRaw");function ln(e,t){let n=De(e),i=n!==void 0&&ee(n)>re;return i&&xe(e),{value:t(n),readOnly:i}}a(ln,"readDoc");function dn(e,t,n){return on(cn(e),{recursive:!0,mode:448}),te(e,()=>{let i=De(e);if(i!==void 0&&ee(i)>re){xe(e);return}let s=n(t(i));if(s===void 0)return;let r={...i??{},...s,[yt]:re};return B(e,`${JSON.stringify(r,null," ")}
4
- `,{mode:384}),s})}a(dn,"updateDoc");function w(e,t){return typeof e=="string"?e.trim().slice(0,t):""}a(w,"str");function D(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):0}a(D,"num");function ae(e,t,n){return Array.isArray(e)?e.filter(i=>typeof i=="string"&&i.length>0).map(i=>i.slice(0,n)).slice(-t):[]}a(ae,"strList");function oe(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}a(oe,"records");var bi=10080*60*1e3,fn=["harmful","ineffective","unused","user","malformed"],pn=6,mn=12,hn=20,yn=["candidate","active","awaiting_user","retired","undone","expired"],gn=["failure_then_fix","user_correction","repeated_detour","guard_denial","success_workflow","imported"],bn=["helpful","harmful","neutral"],Sn=["deletion","permissions","credentials","network","publishing","dependencies"];function Me(e){return xt(e,"lessons.json")}a(Me,"lessonsPath");function En(e){let t=w(e.id,16),n=w(e.content,400);if(!/^[lu]-\d{4,6}$/.test(t)||!n)return;let i=yn.includes(e.status)?e.status:"candidate",s=e.fix,r=e.proof,o=e.origin;return{...e,id:t,scope:e.scope==="user"?"user":"project",section:w(e.section,40)||"general",content:n,rootCause:w(e.rootCause,400),...w(e.signature,300)?{signature:w(e.signature,300)}:{},...s&&typeof s.good=="string"?{fix:{intent:w(s.intent,20),bad:w(s.bad,200),good:w(s.good,200)}}:{},status:i,risk:ae(e.risk,5,20).filter(c=>Sn.includes(c)),sessions:ae(e.sessions,mn,80),evidence:oe(e.evidence).map(c=>({sessionId:w(c.sessionId,80),at:w(c.at,32),signal:gn.includes(c.signal)?c.signal:"user_correction",note:w(c.note,300)})).slice(-pn),...r&&typeof r.at=="string"?{proof:{kind:r.kind==="outcome"?"outcome":"test",at:w(r.at,32),sessionId:w(r.sessionId,80),note:w(r.note,300)}}:{},helpful:D(e.helpful),harmful:D(e.harmful),...D(e.neutral)>0?{neutral:D(e.neutral)}:{},...D(e.injections)>0?{injections:D(e.injections)}:{},...w(e.lastInjectedAt,32)?{lastInjectedAt:w(e.lastInjectedAt,32)}:{},feedback:oe(e.feedback).filter(c=>bn.includes(c.tag)).map(c=>({sessionId:w(c.sessionId,80),tag:c.tag,at:w(c.at,32),why:w(c.why,200)})).slice(-hn),created:w(e.created,32),updated:w(e.updated,32),...w(e.activatedAt,32)?{activatedAt:w(e.activatedAt,32)}:{},...["sessions","proof","user","import","trial"].includes(e.activatedBy)?{activatedBy:e.activatedBy}:{},...w(e.lastHelpfulAt,32)?{lastHelpfulAt:w(e.lastHelpfulAt,32)}:{},...w(e.retiredAt,32)?{retiredAt:w(e.retiredAt,32)}:{},...fn.includes(e.retiredReason)?{retiredReason:e.retiredReason}:{},...o&&o.kind==="desktop"?{origin:{kind:"desktop",projectId:w(o.projectId,32),ruleId:w(o.ruleId,16)}}:{}}}a(En,"parseLesson");var Z=a(e=>e.replace(/\s+/g," ").trim(),"fold");function wn(e){if(!e.fix||!e.signature?.startsWith("fix:")||e.activatedBy==="user"||e.activatedBy==="import")return!1;let t=nn(e.fix.bad,e.fix.good);return!t||Z(t.bad)!==Z(e.fix.bad)||Z(t.good)!==Z(e.fix.good)||Yt(e.rootCause)||e.rootCause.trim()&&!en(e.rootCause)||an(e.rootCause)?!0:It({content:e.content})!==void 0}a(wn,"isMalformed");var An=["candidate","active","awaiting_user"];function vn(e){return!An.includes(e.status)||!wn(e)?e:{...e,status:"retired",retiredAt:e.updated||e.created,retiredReason:"malformed"}}a(vn,"retireMalformed");function kn(e){if(e.activatedBy==="user"||e.activatedBy==="import")return e;let t=$t(e.fix?`${e.fix.good}
5
- ${e.rootCause??""}`:e.content);return t.length===e.risk.length&&t.every(n=>e.risk.includes(n))?e:t.some(n=>!e.risk.includes(n))&&e.status==="active"?{...e,risk:t,status:"awaiting_user"}:t.length===0&&e.status==="awaiting_user"?{...e,risk:t,status:"candidate"}:{...e,risk:t}}a(kn,"recheckRisk");function qe(e){let t=oe(e?.lessons).map(En).filter(r=>r!==void 0).map(vn).map(kn),n=t.reduce((r,o)=>Math.max(r,Number(o.id.slice(2))),0),i={},s=e?.imported;if(s&&typeof s=="object"&&!Array.isArray(s))for(let[r,o]of Object.entries(s))i[r]=ae(o,1e3,16);return{nextId:Math.max(D(e?.nextId),n+1,1),lessons:t,imported:i}}a(qe,"parseLessonsDoc");function Le(e){return ln(Me(e),qe).value}a(Le,"readLessons");function ze(e,t){return dn(Me(e),qe,t)}a(ze,"updateLessons");var Si=new Set("the and for with this that these those from into when then than before after instead only each every use used using run runs running ran make makes made keep edit edits editing file files project projects here there what which while where your you our are was were has have had not but all any its one two fails fail failed failing passes pass passed should must can will just also more most first last same src lib test tests js mjs cjs ts tsx jsx json md py go rs txt yaml yml".split(" ")),Ei=new Set("\u672C\u9879 \u9879\u76EE \u76EE\u91CC \u6539\u7528 \u4F1A\u5931 \u5931\u8D25 \u4F7F\u7528 \u65F6\u5019 \u4E4B\u524D \u4E4B\u540E \u6587\u4EF6 \u8FD0\u884C \u4E00\u4E0B \u8FD9\u4E2A \u90A3\u4E2A \u53EF\u4EE5 \u9700\u8981 \u4E0D\u8981 \u5982\u679C \u7136\u540E \u73B0\u5728 \u5DF2\u7ECF \u6211\u4EEC \u4F60\u7684 \u4E00\u4E2A \u4EC0\u4E48 \u600E\u4E48 \u4E3A\u4EC0\u4E48 \u5E2E\u6211 \u770B\u770B \u95EE\u9898 \u4EE3\u7801".split(" ")),xn=256*1024,Be=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ue=1,N=class extends Error{static{a(this,"SyncHttpError")}status;constructor(e){super(`dal sync request failed (${e})`),this.status=e}},ue=a(e=>R(e,"skills"),"skillsDir"),Pe=a(e=>R(e,"learned","user"),"userLessonsDir"),ce=a(e=>R(e,"sync","state.json"),"statePath");function le(e){return Array.isArray(e)?`[${e.map(le).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>`${JSON.stringify(t)}:${le(n)}`).join(",")}}`:JSON.stringify(e)}a(le,"stable");function W(e){return Et("sha256").update(le(e)).digest("hex")}a(W,"contentHash");function de(e){return typeof e=="string"?U(e):Array.isArray(e)?e.map(de):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,de(n)])):e}a(de,"redactDeep");var Je=["section","content","rootCause","signature","fix","status","risk","helpful","harmful","neutral","injections","lastInjectedAt","created","updated","activatedAt","activatedBy","lastHelpfulAt","retiredAt","retiredReason"],_n=["helpful","harmful","neutral","injections"],jn=["lastInjectedAt","lastHelpfulAt"];function Nn(e,t){let n={...t};for(let i of _n){let s=e[i]??0,r=typeof t[i]=="number"?t[i]:0;s>r&&(n[i]=s)}for(let i of jn){let s=e[i],r=typeof t[i]=="string"?t[i]:void 0;s&&(!r||Date.parse(s)>Date.parse(r))&&(n[i]=s)}return n}a(Nn,"mergeLesson");function In(e){let t={};for(let n of Je)e[n]!==void 0&&(t[n]=e[n]);return de(t)}a(In,"lessonContent");function On(e){let t=ue(e);if(!_e(t))return[];let n=[];for(let i of At(t)){if(!Be.test(i)||i.length>64)continue;let s=R(t,i,"SKILL.md"),r,o;try{let f=kt(s);if(!f.isFile())continue;r=je(s,"utf8"),o=f.mtimeMs}catch{continue}let c={name:i,body:U(r)};n.push({id:`skill.${i}`,kind:"skill",content:c,hash:W(c),updatedAt:o})}return n}a(On,"readSkills");function Tn(e){let t=Pe(e);return _e(R(t,"lessons.json"))?(Le(t).lessons.some(n=>n.scope==="user"&&!n.syncId)&&ze(t,n=>({...n,lessons:n.lessons.map(i=>i.scope==="user"&&!i.syncId?{...i,syncId:Rn()}:i)})),Le(t).lessons.filter(n=>n.scope==="user"&&typeof n.syncId=="string").map(n=>{let i=In(n);return{id:`lesson.${n.syncId}`,kind:"lesson",content:i,hash:W(i),updatedAt:Date.parse(n.updated)||0}})):[]}a(Tn,"readLessonItems");function Rn(){return wt(8).toString("hex")}a(Rn,"newSyncId");function He(e){return[...On(e),...Tn(e)]}a(He,"readLocalItems");function $n(e,t,n,i=()=>!1){if(t.startsWith("skill.")){let f=t.slice(6);if(!Be.test(f)||typeof n.body!="string")return;ne(R(ue(e),f),{recursive:!0}),B(R(ue(e),f,"SKILL.md"),n.body);return}if(!t.startsWith("lesson."))return;let s=t.slice(7),r={};for(let f of Je)n[f]!==void 0&&(r[f]=n[f]);let o=r.content;if(typeof o!="string"||!o)return;let c=Pe(e);ne(c,{recursive:!0,mode:448}),ze(c,f=>{let y=f.lessons,b=y.find(p=>p.syncId===s)??y.find(p=>p.scope==="user"&&(!p.syncId||i(p.syncId))&&p.content===r.content);if(b)return{...f,lessons:y.map(p=>p===b?{...p,...Nn(p,r),syncId:s}:p)};let m=new Date().toISOString(),d={id:`u-${String(f.nextId).padStart(4,"0")}`,scope:"user",section:"general",rootCause:"",status:"candidate",risk:[],sessions:[],evidence:[],helpful:0,harmful:0,feedback:[],created:m,updated:m,...r,content:o,syncId:s};return{...f,nextId:f.nextId+1,lessons:[...y,d]}})}a($n,"applyRemoteItem");function fe(e){try{let t=JSON.parse(je(ce(e),"utf8"));if(t.formatVersion!==Ue||typeof t.account!="string")return;let n=t.items&&typeof t.items=="object"?t.items:{};return{account:t.account,items:n,lastRun:typeof t.lastRun=="string"?t.lastRun:void 0,lastError:typeof t.lastError=="string"?t.lastError:void 0,lastErrorStatus:typeof t.lastErrorStatus=="number"?t.lastErrorStatus:void 0}}catch{return}}a(fe,"readState");function Ke(e,t){let n=ce(e);ne(R(e,"sync"),{recursive:!0,mode:448}),te(n,()=>B(n,`${JSON.stringify({formatVersion:Ue,...t},null," ")}
4
+ `,{mode:384}),s})}a(dn,"updateDoc");function w(e,t){return typeof e=="string"?e.trim().slice(0,t):""}a(w,"str");function D(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):0}a(D,"num");function ae(e,t,n){return Array.isArray(e)?e.filter(i=>typeof i=="string"&&i.length>0).map(i=>i.slice(0,n)).slice(-t):[]}a(ae,"strList");function oe(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}a(oe,"records");var li=10080*60*1e3,fn=["harmful","ineffective","unused","user","malformed"],pn=6,mn=12,hn=20,yn=["candidate","active","awaiting_user","retired","undone","expired"],gn=["failure_then_fix","user_correction","repeated_detour","guard_denial","success_workflow","imported"],bn=["helpful","harmful","neutral"],Sn=["deletion","permissions","credentials","network","publishing","dependencies"];function Me(e){return xt(e,"lessons.json")}a(Me,"lessonsPath");function En(e){let t=w(e.id,16),n=w(e.content,400);if(!/^[lu]-\d{4,6}$/.test(t)||!n)return;let i=yn.includes(e.status)?e.status:"candidate",s=e.fix,r=e.proof,o=e.origin;return{...e,id:t,scope:e.scope==="user"?"user":"project",section:w(e.section,40)||"general",content:n,rootCause:w(e.rootCause,400),...w(e.signature,300)?{signature:w(e.signature,300)}:{},...s&&typeof s.good=="string"?{fix:{intent:w(s.intent,20),bad:w(s.bad,200),good:w(s.good,200)}}:{},status:i,risk:ae(e.risk,5,20).filter(c=>Sn.includes(c)),sessions:ae(e.sessions,mn,80),evidence:oe(e.evidence).map(c=>({sessionId:w(c.sessionId,80),at:w(c.at,32),signal:gn.includes(c.signal)?c.signal:"user_correction",note:w(c.note,300)})).slice(-pn),...r&&typeof r.at=="string"?{proof:{kind:r.kind==="outcome"?"outcome":"test",at:w(r.at,32),sessionId:w(r.sessionId,80),note:w(r.note,300)}}:{},helpful:D(e.helpful),harmful:D(e.harmful),...D(e.neutral)>0?{neutral:D(e.neutral)}:{},...D(e.injections)>0?{injections:D(e.injections)}:{},...w(e.lastInjectedAt,32)?{lastInjectedAt:w(e.lastInjectedAt,32)}:{},feedback:oe(e.feedback).filter(c=>bn.includes(c.tag)).map(c=>({sessionId:w(c.sessionId,80),tag:c.tag,at:w(c.at,32),why:w(c.why,200)})).slice(-hn),created:w(e.created,32),updated:w(e.updated,32),...w(e.activatedAt,32)?{activatedAt:w(e.activatedAt,32)}:{},...["sessions","proof","user","import","trial"].includes(e.activatedBy)?{activatedBy:e.activatedBy}:{},...w(e.lastHelpfulAt,32)?{lastHelpfulAt:w(e.lastHelpfulAt,32)}:{},...w(e.retiredAt,32)?{retiredAt:w(e.retiredAt,32)}:{},...fn.includes(e.retiredReason)?{retiredReason:e.retiredReason}:{},...o&&o.kind==="desktop"?{origin:{kind:"desktop",projectId:w(o.projectId,32),ruleId:w(o.ruleId,16)}}:{}}}a(En,"parseLesson");var Z=a(e=>e.replace(/\s+/g," ").trim(),"fold");function wn(e){if(!e.fix||!e.signature?.startsWith("fix:")||e.activatedBy==="user"||e.activatedBy==="import")return!1;let t=nn(e.fix.bad,e.fix.good);return!t||Z(t.bad)!==Z(e.fix.bad)||Z(t.good)!==Z(e.fix.good)||Yt(e.rootCause)||e.rootCause.trim()&&!en(e.rootCause)||an(e.rootCause)?!0:It({content:e.content})!==void 0}a(wn,"isMalformed");var An=["candidate","active","awaiting_user"];function vn(e){return!An.includes(e.status)||!wn(e)?e:{...e,status:"retired",retiredAt:e.updated||e.created,retiredReason:"malformed"}}a(vn,"retireMalformed");function kn(e){if(e.activatedBy==="user"||e.activatedBy==="import")return e;let t=$t(e.fix?`${e.fix.good}
5
+ ${e.rootCause??""}`:e.content);return t.length===e.risk.length&&t.every(n=>e.risk.includes(n))?e:t.some(n=>!e.risk.includes(n))&&e.status==="active"?{...e,risk:t,status:"awaiting_user"}:t.length===0&&e.status==="awaiting_user"?{...e,risk:t,status:"candidate"}:{...e,risk:t}}a(kn,"recheckRisk");function qe(e){let t=oe(e?.lessons).map(En).filter(r=>r!==void 0).map(vn).map(kn),n=t.reduce((r,o)=>Math.max(r,Number(o.id.slice(2))),0),i={},s=e?.imported;if(s&&typeof s=="object"&&!Array.isArray(s))for(let[r,o]of Object.entries(s))i[r]=ae(o,1e3,16);return{nextId:Math.max(D(e?.nextId),n+1,1),lessons:t,imported:i}}a(qe,"parseLessonsDoc");function Le(e){return ln(Me(e),qe).value}a(Le,"readLessons");function ze(e,t){return dn(Me(e),qe,t)}a(ze,"updateLessons");var di=new Set("the and for with this that these those from into when then than before after instead only each every use used using run runs running ran make makes made keep edit edits editing file files project projects here there what which while where your you our are was were has have had not but all any its one two fails fail failed failing passes pass passed should must can will just also more most first last same src lib test tests js mjs cjs ts tsx jsx json md py go rs txt yaml yml".split(" ")),fi=new Set("\u672C\u9879 \u9879\u76EE \u76EE\u91CC \u6539\u7528 \u4F1A\u5931 \u5931\u8D25 \u4F7F\u7528 \u65F6\u5019 \u4E4B\u524D \u4E4B\u540E \u6587\u4EF6 \u8FD0\u884C \u4E00\u4E0B \u8FD9\u4E2A \u90A3\u4E2A \u53EF\u4EE5 \u9700\u8981 \u4E0D\u8981 \u5982\u679C \u7136\u540E \u73B0\u5728 \u5DF2\u7ECF \u6211\u4EEC \u4F60\u7684 \u4E00\u4E2A \u4EC0\u4E48 \u600E\u4E48 \u4E3A\u4EC0\u4E48 \u5E2E\u6211 \u770B\u770B \u95EE\u9898 \u4EE3\u7801".split(" ")),xn=256*1024,Be=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Ue=1,N=class extends Error{static{a(this,"SyncHttpError")}status;constructor(e){super(`dal sync request failed (${e})`),this.status=e}},ue=a(e=>R(e,"skills"),"skillsDir"),Pe=a(e=>R(e,"learned","user"),"userLessonsDir"),ce=a(e=>R(e,"sync","state.json"),"statePath");function le(e){return Array.isArray(e)?`[${e.map(le).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>`${JSON.stringify(t)}:${le(n)}`).join(",")}}`:JSON.stringify(e)}a(le,"stable");function W(e){return Et("sha256").update(le(e)).digest("hex")}a(W,"contentHash");function de(e){return typeof e=="string"?U(e):Array.isArray(e)?e.map(de):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,de(n)])):e}a(de,"redactDeep");var Je=["section","content","rootCause","signature","fix","status","risk","helpful","harmful","neutral","injections","lastInjectedAt","created","updated","activatedAt","activatedBy","lastHelpfulAt","retiredAt","retiredReason"],_n=["helpful","harmful","neutral","injections"],jn=["lastInjectedAt","lastHelpfulAt"];function Nn(e,t){let n={...t};for(let i of _n){let s=e[i]??0,r=typeof t[i]=="number"?t[i]:0;s>r&&(n[i]=s)}for(let i of jn){let s=e[i],r=typeof t[i]=="string"?t[i]:void 0;s&&(!r||Date.parse(s)>Date.parse(r))&&(n[i]=s)}return n}a(Nn,"mergeLesson");function In(e){let t={};for(let n of Je)e[n]!==void 0&&(t[n]=e[n]);return de(t)}a(In,"lessonContent");function On(e){let t=ue(e);if(!_e(t))return[];let n=[];for(let i of At(t)){if(!Be.test(i)||i.length>64)continue;let s=R(t,i,"SKILL.md"),r,o;try{let f=kt(s);if(!f.isFile())continue;r=je(s,"utf8"),o=f.mtimeMs}catch{continue}let c={name:i,body:U(r)};n.push({id:`skill.${i}`,kind:"skill",content:c,hash:W(c),updatedAt:o})}return n}a(On,"readSkills");function Tn(e){let t=Pe(e);return _e(R(t,"lessons.json"))?(Le(t).lessons.some(n=>n.scope==="user"&&!n.syncId)&&ze(t,n=>({...n,lessons:n.lessons.map(i=>i.scope==="user"&&!i.syncId?{...i,syncId:Rn()}:i)})),Le(t).lessons.filter(n=>n.scope==="user"&&typeof n.syncId=="string").map(n=>{let i=In(n);return{id:`lesson.${n.syncId}`,kind:"lesson",content:i,hash:W(i),updatedAt:Date.parse(n.updated)||0}})):[]}a(Tn,"readLessonItems");function Rn(){return wt(8).toString("hex")}a(Rn,"newSyncId");function He(e){return[...On(e),...Tn(e)]}a(He,"readLocalItems");function $n(e,t,n,i=()=>!1){if(t.startsWith("skill.")){let f=t.slice(6);if(!Be.test(f)||typeof n.body!="string")return;ne(R(ue(e),f),{recursive:!0}),B(R(ue(e),f,"SKILL.md"),n.body);return}if(!t.startsWith("lesson."))return;let s=t.slice(7),r={};for(let f of Je)n[f]!==void 0&&(r[f]=n[f]);let o=r.content;if(typeof o!="string"||!o)return;let c=Pe(e);ne(c,{recursive:!0,mode:448}),ze(c,f=>{let y=f.lessons,b=y.find(p=>p.syncId===s)??y.find(p=>p.scope==="user"&&(!p.syncId||i(p.syncId))&&p.content===r.content);if(b)return{...f,lessons:y.map(p=>p===b?{...p,...Nn(p,r),syncId:s}:p)};let m=new Date().toISOString(),d={id:`u-${String(f.nextId).padStart(4,"0")}`,scope:"user",section:"general",rootCause:"",status:"candidate",risk:[],sessions:[],evidence:[],helpful:0,harmful:0,feedback:[],created:m,updated:m,...r,content:o,syncId:s};return{...f,nextId:f.nextId+1,lessons:[...y,d]}})}a($n,"applyRemoteItem");function fe(e){try{let t=JSON.parse(je(ce(e),"utf8"));if(t.formatVersion!==Ue||typeof t.account!="string")return;let n=t.items&&typeof t.items=="object"?t.items:{};return{account:t.account,items:n,lastRun:typeof t.lastRun=="string"?t.lastRun:void 0,lastError:typeof t.lastError=="string"?t.lastError:void 0,lastErrorStatus:typeof t.lastErrorStatus=="number"?t.lastErrorStatus:void 0}}catch{return}}a(fe,"readState");function Ke(e,t){let n=ce(e);ne(R(e,"sync"),{recursive:!0,mode:448}),te(n,()=>B(n,`${JSON.stringify({formatVersion:Ue,...t},null," ")}
6
6
  `,{mode:384}))}a(Ke,"writeState");function Cn(e){vt(ce(e),{force:!0})}a(Cn,"clearState");async function Fn(e,t,n){let i=fe(e),s={account:t,items:i?.account===t?{...i.items}:{}},r={uploaded:0,downloaded:0,deletedRemote:0,conflicts:0,refused:[]},o=a(()=>Ke(e,{...s,lastRun:new Date().toISOString()}),"save"),c=new Map((await n.manifest()).map(u=>[u.id,u])),f=new Map(He(e).map(u=>[u.id,u])),y=a(u=>{let l=`lesson.${u}`;return!s.items[l]&&!c.has(l)},"neverSynced"),b=new Set,m=a((u,l)=>{$n(e,u,l.content,y),s.items[u]={version:l.version,hash:W(l.content)},b.add(u),r.downloaded++},"apply"),d=a(async u=>{let l=await n.get(u);return l?(m(u,l),!0):!1},"download"),p=a(async(u,l)=>{let g=s.items[u.id];if(g?.refused===u.hash)return;if(Buffer.byteLength(JSON.stringify(u.content))>xn){s.items[u.id]={version:g?.version??0,hash:g?.hash??"",refused:u.hash},r.refused.push(u.id);return}let E=await n.put(u.id,u.kind,l,u.content);E.status==="written"?(s.items[u.id]={version:E.version,hash:u.hash},r.uploaded++):E.status==="conflict"?r.conflicts++:(s.items[u.id]={version:g?.version??0,hash:g?.hash??"",refused:u.hash},r.refused.push(u.id))},"upload");for(let u of c.values()){let l=s.items[u.id]?.remoteDeleted?void 0:s.items[u.id],g=f.get(u.id);if(!g){if(l&&l.version===u.version){await n.remove(u.id)&&r.deletedRemote++,delete s.items[u.id];continue}await d(u.id);continue}if(l&&l.version===u.version)continue;if(l&&g.hash===l.hash){await d(u.id);continue}let E=await n.get(u.id);if(!E)continue;let A=W(E.content);if(A===g.hash){s.items[u.id]={version:E.version,hash:A};continue}r.conflicts++,Date.parse(u.updatedAt)>g.updatedAt?m(u.id,E):await p(g,E.version)}f=new Map(He(e).map(u=>[u.id,u]));for(let u of b){let l=f.get(u);l&&s.items[u]&&(s.items[u].hash=l.hash)}for(let u of f.values()){let l=s.items[u.id],g=c.get(u.id);if(g){l&&l.version===g.version&&u.hash!==l.hash&&await p(u,g.version);continue}if(l&&u.hash===l.hash){!l.remoteDeleted&&l.version>0&&(s.items[u.id]={...l,remoteDeleted:!0});continue}await p(u,0)}for(let u of Object.keys(s.items))!f.has(u)&&!c.has(u)&&delete s.items[u];return o(),r}a(Fn,"runSync");function Dn(e){let t=`${e.apiBase.replace(/\/+$/,"")}/portal/dal-sync`,n=e.fetch??fetch;async function i(m,d,p,u){let l=await e.token();if(!l)throw new N(401);let g=await n(`${t}${d}`,{method:m,headers:{Authorization:`Bearer ${l}`,Accept:"application/json",...p===void 0?{}:{"Content-Type":"application/json"}},body:p===void 0?void 0:JSON.stringify(p),signal:AbortSignal.timeout(u??e.timeoutMs??2e4)}),E=await g.json().catch(()=>null);return{status:g.status,data:E}}a(i,"call");let s=a(m=>m&&typeof m=="object"&&!Array.isArray(m)?m:{},"record"),r=a(m=>`/items/${encodeURIComponent(m)}`,"item"),o=a(m=>Number(m)||0,"num2"),c=a(m=>typeof m=="string"&&m?m:null,"strOrNull"),f=a(m=>{let d=s(m);if(typeof d.id=="string")return{id:d.id,generation:o(d.generation),nextSeq:o(d.nextSeq),title:c(d.title),projectKey:c(d.projectKey),projectName:c(d.projectName),cwd:c(d.cwd),device:c(d.device),entries:o(d.entries),createdAt:c(d.createdAt),modifiedAt:c(d.modifiedAt)}},"toSession"),y=a(m=>`/sessions/${encodeURIComponent(m)}`,"session"),b=12e4;return{sessions:{async list(m,d=200){let p=new URLSearchParams({limit:String(d)});m&&p.set("project",m);let{status:u,data:l}=await i("GET",`/sessions?${p}`);if(u!==200)throw new N(u);let g=s(l).sessions;return(Array.isArray(g)?g:[]).flatMap(E=>f(E)??[])},async putMeta(m,d,p){let{status:u,data:l}=await i("PUT",y(m),{...d,device:e.device.slice(0,64),...p?.create===!1?{create:!1}:{}});if(u===404)return{status:"missing"};if(u===200){let g=f(l);if(g)return{status:"ok",session:g}}if(u===409)return{status:"conflict",generation:o(s(l).generation),nextSeq:o(s(l).nextSeq)};if(u===413)return{status:"quota"};if(u===400)return{status:"refused",reason:String(s(l).error??u)};throw new N(u)},async append(m,d){let{status:p,data:u}=await i("POST",`${y(m)}/chunks`,d,b),l=s(u);if(p===200)return{status:"ok",nextSeq:o(l.nextSeq)};if(p===409)return{status:"conflict",generation:o(l.generation),nextSeq:o(l.nextSeq)};if(p===404)return{status:"missing"};if(p===413&&l.error==="account_quota_exceeded")return{status:"quota"};if(p===413||p===400)return{status:"refused",reason:String(l.error??p)};throw new N(p)},async chunks(m,d,p){let u=new URLSearchParams({generation:String(d),after:String(p)}),{status:l,data:g}=await i("GET",`${y(m)}/chunks?${u}`,void 0,b),E=s(g);if(l===200){let A=Array.isArray(E.chunks)?E.chunks:[];return{status:"ok",generation:o(E.generation),nextSeq:o(E.nextSeq),more:E.more===!0,chunks:A.flatMap(h=>{let S=s(h);return typeof S.data=="string"?[{seq:o(S.seq),data:S.data}]:[]})}}if(l===409)return{status:"conflict",generation:o(E.generation),nextSeq:o(E.nextSeq)};if(l===404)return{status:"missing"};throw new N(l)},async remove(m){let{status:d}=await i("DELETE",y(m));if(d===200)return!0;if(d===404)return!1;throw new N(d)}},async manifest(){let{status:m,data:d}=await i("GET","/manifest");if(m!==200)throw new N(m);let p=s(d).items;return(Array.isArray(p)?p:[]).flatMap(u=>{let l=s(u);return typeof l.id!="string"||l.kind!=="skill"&&l.kind!=="lesson"?[]:[{id:l.id,kind:l.kind,version:Number(l.version)||0,updatedAt:typeof l.updatedAt=="string"?l.updatedAt:new Date(0).toISOString()}]})},async get(m){let{status:d,data:p}=await i("GET",r(m));if(d===404)return;if(d!==200)throw new N(d);let u=s(p);return{version:Number(u.version)||0,content:s(u.content)}},async put(m,d,p,u){let{status:l,data:g}=await i("PUT",r(m),{kind:d,baseVersion:p,content:u,device:e.device.slice(0,64)});if(l===200)return{status:"written",version:Number(s(g).version)||0};if(l===409)return{status:"conflict"};if(l===413||l===422||l===400)return{status:"refused",reason:String(s(g).error??l)};throw new N(l)},async remove(m){let{status:d}=await i("DELETE",r(m));if(d===200)return!0;if(d===404)return!1;throw new N(d)},async removeAll(){let{status:m,data:d}=await i("DELETE","");if(m!==200)throw new N(m);return Number(s(d).removed)||0}}}a(Dn,"createHttpRemote");import{execFileSync as Mn}from"node:child_process";import{createHash as Ge}from"node:crypto";import{appendFileSync as qn,closeSync as Ln,existsSync as Ze,mkdirSync as J,openSync as zn,readdirSync as We,readFileSync as Ye,readSync as Bn,rmSync as pe,statSync as M,utimesSync as Un}from"node:fs";import{homedir as me}from"node:os";import{basename as Pn,isAbsolute as Jn,join as $,relative as Hn,resolve as he}from"node:path";import{gunzipSync as Kn,gzipSync as Gn}from"node:zlib";var Xe=2*1024*1024,Ve=3*1024*1024,Zn=2e5,Wn=2e4,Yn={uploadBytes:48*1024*1024,downloadBytes:64*1024*1024,ms:9e4},Xn=50,Vn=1440*60*1e3,Qn=2160*60*60*1e3,Qe=1,es=4096,ts=600*1e3,et=/^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/,ns=["/tmp/","/private/tmp/","/var/folders/","/private/var/folders/"],ye=a(e=>$(e,"sync","sessions.json"),"sessionsStatePath");function H(e){try{let t=JSON.parse(Ye(ye(e),"utf8"));return t.formatVersion!==Qe||typeof t.account!="string"?void 0:{account:t.account,sessions:t.sessions&&typeof t.sessions=="object"?t.sessions:{},projects:t.projects&&typeof t.projects=="object"?t.projects:{},lastRun:typeof t.lastRun=="string"?t.lastRun:void 0,quotaExceeded:t.quotaExceeded===!0,noticeShownAt:typeof t.noticeShownAt=="string"?t.noticeShownAt:void 0}}catch{return}}a(H,"readSessionsState");function Y(e,t){J($(e,"sync"),{recursive:!0,mode:448}),B(ye(e),`${JSON.stringify({formatVersion:Qe,...t})}
7
7
  `,{mode:384})}a(Y,"writeSessionsState");function tt(e,t,n,i){let s=H(e),r=s?.account===t,o=r?s.sessions:{},c=o[n];o[n]={file:c?.file??"",generation:c?.generation??0,nextSeq:c?.nextSeq??0,offset:c?.offset??0,tail:c?.tail??"",size:c?.size??0,mtimeMs:c?.mtimeMs??0,remoteDeleted:!0,pendingDelete:i,deletedAt:new Date().toISOString()},Y(e,{account:t,sessions:o,projects:r?s.projects:{},noticeShownAt:s?.noticeShownAt,...r&&s.quotaExceeded?{quotaExceeded:!0}:{}})}a(tt,"markSessionDeleted");function ss(e){let t=H(e);pe(ye(e),{force:!0}),t?.noticeShownAt&&Y(e,{account:t.account,sessions:{},projects:{},noticeShownAt:t.noticeShownAt})}a(ss,"clearSessionsState");function is(e){let t=$(e,"sync","sessions.lock");J($(e,"sync"),{recursive:!0,mode:448});try{J(t)}catch{try{if(Date.now()-M(t).mtimeMs<ts)return;pe(t,{recursive:!0,force:!0}),J(t)}catch{return}}return()=>pe(t,{recursive:!0,force:!0})}a(is,"tryLock");function rs(e){let t=$(e,"sessions");if(!Ze(t))return[];let n=[];for(let i of We(t,{withFileTypes:!0})){if(!i.isDirectory())continue;let s;try{s=We($(t,i.name))}catch{continue}for(let r of s){if(!r.endsWith(".jsonl"))continue;let o=r.slice(r.indexOf("_")+1,-6);if(!et.test(o)||o.length>128)continue;let c=$(t,i.name,r);try{let f=M(c);f.isFile()&&f.size>0&&n.push({id:o,path:c,size:f.size,mtimeMs:f.mtimeMs})}catch{}}}return n.sort((i,s)=>s.mtimeMs-i.mtimeMs)}a(rs,"listLocalSessions");function P(e,t,n){let i=Math.max(0,n-t),s=Buffer.alloc(i);if(i===0)return s;let r=zn(e,"r");try{let o=0;for(;o<i;){let c=Bn(r,s,o,i-o,t+o);if(c===0)break;o+=c}return s.subarray(0,o)}finally{Ln(r)}}a(P,"readRange");function q(e,t){return Ge("sha256").update(P(e,Math.max(0,t-es),t)).digest("hex")}a(q,"tailHash");function as(e){let t=P(e,0,1048576).toString("utf8"),n=t.slice(0,t.indexOf(`
8
8
  `)>=0?t.indexOf(`
@@ -1 +1 @@
1
- var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-QCT6OHUR.js";import{isRecord as i}from"./chunk-BCFLC6CK.js";import"./chunk-ML5DIOWR.js";import"./chunk-ZR6PGIL7.js";import"./chunk-UTB4DTYQ.js";import"./chunk-BIY5HTFI.js";import"./chunk-4LDEEFCY.js";import"./chunk-F37JXTCY.js";import"./chunk-JXWJOIH4.js";var m={api:"typesafe-system-one",label:"System One API",detectCompat:r(e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},"detectCompat"),url:r(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:r((e,t)=>({model:e.id,...t}),"payload"),output:r(e=>{if(!i(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=r((e,t,o)=>s(m,e,t,o),"classify");export{n as classify};
1
+ var p=Object.defineProperty;var r=(e,t)=>p(e,"name",{value:t,configurable:!0});import{createRequire as a}from"node:module";const d=a(import.meta.url);import{classifySystemOne as s}from"./chunk-YTDTROS5.js";import{isRecord as i}from"./chunk-2E7RGBKM.js";import"./chunk-ML5DIOWR.js";import"./chunk-S7K3JBWA.js";import"./chunk-UTB4DTYQ.js";import"./chunk-PD6QS7YD.js";import"./chunk-4LDEEFCY.js";import"./chunk-GPI2GHBH.js";import"./chunk-JXWJOIH4.js";var m={api:"typesafe-system-one",label:"System One API",detectCompat:r(e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},"detectCompat"),url:r(e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),"url"),payload:r((e,t)=>({model:e.id,...t}),"payload"),output:r(e=>{if(!i(e))throw new Error("System One API returned an unexpected response");return e},"output")},n=r((e,t,o)=>s(m,e,t,o),"classify");export{n as classify};
@@ -0,0 +1 @@
1
+ var k=Object.defineProperty;var a=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as v}from"node:module";const pe=v(import.meta.url);import"./chunk-LZTZWS3N.js";import"./chunk-FSX34SAZ.js";import"./chunk-JPCWLZUZ.js";import"./chunk-JPBJUBY4.js";import"./chunk-XIJS4F22.js";import"./chunk-IRSW3MVW.js";import"./chunk-JUUJCOIR.js";import"./chunk-NJDCSLWK.js";import"./chunk-6PQZ4KMC.js";import"./chunk-6SPX3U36.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-F5SIUTR7.js";import"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import{getAgentDir as F}from"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import{declaredDataFormat as B,reportNewerDataFormat as C,t as U,writeFileAtomicSync as L}from"./chunk-MZ7O6YLD.js";import"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import"./chunk-723ZGEZ2.js";import"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import"./chunk-FFMDRXC4.js";import"./chunk-PD6QS7YD.js";import"./chunk-4LDEEFCY.js";import"./chunk-GPI2GHBH.js";import"./chunk-JXWJOIH4.js";import{readdir as W,readFile as I,stat as x}from"node:fs/promises";import{homedir as z}from"node:os";import{join as E}from"node:path";var P="sessions",V="usage-cache.json",w=1,T="dal-tool-repair",H=10,q=['"role":"assistant"','"type":"session"','"type":"usage"','"type":"compaction"','"type":"branch_summary"',`"customType":"${T}"`].flatMap(e=>[Buffer.from(e),Buffer.from(e.replace(":",": "))]),G=[Buffer.from('"role":"toolResult"'),Buffer.from('"role": "toolResult"')],J=[Buffer.from('"usage":{'),Buffer.from('"usage": {')],D=a((e,t)=>t.some(r=>e.includes(r)),"includesAny");function Y(e){let t=e.length>1024?e.subarray(0,1024):e;if(D(t,q))return!0;if(!D(t,G))return!1;let r=e.length>4096?e.subarray(e.length-4096):e;return D(r,J)}a(Y,"mightCarryUsage");var g=a(e=>typeof e=="number"&&Number.isFinite(e)?e:0,"finite");function A(e){if(!e||typeof e!="object")return;let t=e,r=t.cost,i={input:g(t.input),output:g(t.output),cacheRead:g(t.cacheRead),cacheWrite:g(t.cacheWrite),cost:typeof r=="number"?g(r):r&&typeof r=="object"?g(r.total):0};return i.cost===0&&i.input+i.output+i.cacheRead+i.cacheWrite===0?void 0:i}a(A,"amountOf");function S(...e){for(let t of e){let r=typeof t=="number"?t:Date.parse(String(t??""));if(Number.isFinite(r)&&r>0)return r}return 0}a(S,"timeOf");var j=a(e=>`${e.input}:${e.output}:${e.cacheRead}:${e.cacheWrite}`,"fingerprint");function K(e){let t={sessionId:"",cwd:"",records:[],toolRepairs:[]},r=a((n,d,o,f,s)=>{let p=n==="model"&&!s?`${d}:${f}:${j(o)}`:`${n}:${s}:${f}:${j(o)}`;t.records.push({source:n,label:d,timestamp:f,key:p,...o})},"add"),i=0;for(;i<e.length;){let n=e.indexOf(H,i);n===-1&&(n=e.length);let d=e.subarray(i,n);if(i=n+1,d.length===0||!Y(d))continue;let o;try{o=JSON.parse(d.toString("utf8"))}catch{continue}let f=typeof o.id=="string"?o.id:"";if(o.type==="session"){typeof o.id=="string"&&(t.sessionId=o.id),typeof o.cwd=="string"&&(t.cwd=o.cwd);continue}if(o.type==="usage"){let u=A(o.usage);u&&o.provider&&o.model&&r("model",`${o.provider}/${o.model}`,u,S(o.timestamp),f);continue}if(o.type==="custom"&&o.customType===T){let u=Array.isArray(o.data?.repairs)?o.data.repairs.length:0;u>0&&t.toolRepairs?.push({timestamp:S(o.timestamp),key:f,count:u});continue}if(o.type==="compaction"||o.type==="branch_summary"){let u=A(o.usage);u&&r("housekeeping","",u,S(o.timestamp),f);continue}let s=o.message;if(o.type!=="message"||!s)continue;let p=A(s.usage);if(!p)continue;let y=S(s.timestamp,o.timestamp);if(s.role==="assistant"&&s.provider&&s.model)r("model",`${s.provider}/${s.model}`,p,y,"");else if(s.role==="toolResult"){let u=s.toolName??"";r(u==="task"?"subagents":"tools",u,p,y,f)}}return t}a(K,"parseSessionBuffer");async function O(e,t=[]){let r;try{r=await W(e,{withFileTypes:!0})}catch{return t}for(let i of r){let n=E(e,i.name);i.isDirectory()?await O(n,t):i.isFile()&&i.name.endsWith(".jsonl")&&t.push(n)}return t}a(O,"sessionFiles");async function Q(e){try{let t=JSON.parse(await I(e,"utf8"));if(B(t)>w)return C(e),{doc:{formatVersion:w,files:{}},writable:!1};let r=t.files;if(r&&typeof r=="object")return{doc:{formatVersion:w,files:r},writable:!0}}catch{}return{doc:{formatVersion:w,files:{}},writable:!0}}a(Q,"readCache");async function X(e){let t=E(e,V),{doc:r,writable:i}=await Q(t),n={},d=!1,o=(await O(E(e,P))).sort(),f=[];for(let s of o){let p;try{p=await x(s)}catch{continue}let y=r.files[s];if(y&&y.size===p.size&&y.mtimeMs===p.mtimeMs&&y.parsed)n[s]=y;else{let u;try{u=await I(s)}catch{continue}n[s]={size:p.size,mtimeMs:p.mtimeMs,parsed:K(u)},d=!0}f.push(n[s].parsed)}if(Object.keys(r.files).length!==Object.keys(n).length&&(d=!0),i&&d)try{L(t,JSON.stringify({formatVersion:w,files:n}))}catch{}return f}a(X,"loadSessions");function Z(e){if(!e)return"?";let t=z(),r;e===t||e.startsWith(`${t}/`)?r=t:r=/^(\/Users\/[^/]+|\/home\/[^/]+)(?=\/|$)/.exec(e)?.[1];let i=(r===void 0?e:e.slice(r.length)).split(/[\\/]/).filter(Boolean).slice(0,2);return r===void 0?`/${i.join("/")}`:i.length>0?`~/${i.join("/")}`:"~"}a(Z,"projectLabel");function ee(e){let t=e.trim().toLowerCase();if(t==="")return{kind:"days",days:30,label:"30d"};if(t==="today")return{kind:"today",label:"today"};if(t==="all")return{kind:"all",label:"all"};let r=/^(\d{1,4})d$/.exec(t);if(r){let i=Number(r[1]);if(i>=1)return{kind:"days",days:i,label:`${i}d`}}}a(ee,"parseUsageRange");var _=a(()=>({input:0,output:0,cacheRead:0,cacheWrite:0,cost:0}),"empty");function M(e,t){e.input+=t.input,e.output+=t.output,e.cacheRead+=t.cacheRead,e.cacheWrite+=t.cacheWrite,e.cost+=t.cost}a(M,"addInto");function te(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}a(te,"startOfLocalDay");function re(e){let t=new Date(e),r=a(i=>String(i).padStart(2,"0"),"pad");return`${t.getFullYear()}-${r(t.getMonth()+1)}-${r(t.getDate())}`}a(re,"dayKey");function oe(e,t){if(e.kind==="all")return Number.NEGATIVE_INFINITY;let r=te(t);if(e.kind==="today")return r;let i=new Date(r);return i.setDate(i.getDate()-(e.days-1)),i.getTime()}a(oe,"rangeStart");function ie(e){return e.source==="model"?e.label:e.source}a(ie,"modelKey");var ae={subagents:"\u5B50\u52A9\u624B",tools:"\u5DE5\u5177",housekeeping:"\u4E0A\u4E0B\u6587\u6574\u7406"};function se(e,t,r){let i=oe(t,r),n=new Set,d=_(),o={day:new Map,model:new Map,project:new Map},f={day:new Map,model:new Map,project:new Map},s=new Set,p=a((l,c,m,$,R)=>{let h=o[l].get(c);h||(h={key:c,label:m,sessions:0,..._()},o[l].set(c,h)),M(h,R);let b=f[l].get(c);b||(b=new Set,f[l].set(c,b)),b.add($),h.sessions=b.size},"bump");for(let l of e){if(!l.sessionId)continue;let c=Z(l.cwd);for(let m of l.records){if(m.timestamp<i||m.timestamp>r||n.has(m.key))continue;n.add(m.key),M(d,m),s.add(l.sessionId);let $=ie(m),R=re(m.timestamp);p("day",R,R,l.sessionId,m),p("model",$,m.source==="model"?m.label:U(ae[m.source]),l.sessionId,m),p("project",c,c,l.sessionId,m)}}let y=0,u=new Set;for(let l of e)for(let c of l.toolRepairs??[])c.timestamp<i||c.timestamp>r||u.has(c.key)||(u.add(c.key),y+=c.count);let N=a((l,c)=>c.cost-l.cost||l.label.localeCompare(c.label),"byCost");return{range:t,sessions:s.size,total:d,byDay:[...o.day.values()].sort((l,c)=>c.key.localeCompare(l.key)),byModel:[...o.model.values()].sort(N),byProject:[...o.project.values()].sort(N),toolRepairs:y}}a(se,"buildReport");async function ne(e){let t=await X(e.agentDir??F());return se(t,e.range,e.now??Date.now())}a(ne,"collectUsage");async function le(e){let t=ee(e.range);if(!t)throw new Error(`Unknown usage range: ${String(e.range)}`);return ne({range:t,...e.agentDir?{agentDir:e.agentDir}:{}})}a(le,"collectUsage2");export{le as collectUsage};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});import{createRequire as u}from"node:module";const Tr=u(import.meta.url);import{dist_exports as o}from"./chunk-LZTZWS3N.js";import{DAL_ENGINE_PACKAGE_NAMES as n,dist_exports as p}from"./chunk-FSX34SAZ.js";import"./chunk-JPCWLZUZ.js";import{all_exports as l,anthropicMessagesApi as M,azureOpenAIResponsesApi as S,bedrockConverseStreamApi as v,compile_exports as m,complete as R,completeSimple as N,generateImages as O,generateImagesOpenRouter as P,getApiProvider as y,getApiProviders as h,getImageModel as x,getImageModels as f,getImageProviders as D,getImagesApiProvider as H,getModel as V,getModels as G,getProviders as L,googleGenerativeAIApi as k,googleVertexApi as w,mistralConversationsApi as b,openAICodexResponsesApi as U,openAICompletionsApi as z,openAIResponsesApi as K,piMessagesApi as W,registerApiProvider as B,registerBuiltInApiProviders as F,registerBuiltInImagesApiProviders as Y,registerFauxProvider as q,registerImagesApiProvider as J,resetApiProviders as X,setBedrockProviderLoader as j,setBedrockProviderModule as Z,stream as $,streamAnthropic as Q,streamAzureOpenAIResponses as ee,streamGoogle as te,streamGoogleVertex as re,streamMistral as se,streamOpenAICodexResponses as oe,streamOpenAICompletions as ie,streamOpenAIResponses as ae,streamSimple as ne,streamSimpleAnthropic as pe,streamSimpleAzureOpenAIResponses as le,streamSimpleGoogle as me,streamSimpleGoogleVertex as Ae,streamSimpleMistral as ge,streamSimpleOpenAICodexResponses as de,streamSimpleOpenAICompletions as Ie,streamSimpleOpenAIResponses as _e,unregisterApiProviders as Te,value_exports as A}from"./chunk-JPBJUBY4.js";import{CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY as Ce,CACHE_WARMING_MAX_AGE_MS as Ee,CACHE_WARMING_MAX_IDLE_AGE_MS as ce,CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS as ue,createFauxCore as Me,envApiKeyAuth as Se,evaluateCacheWarming as ve,fauxAssistantMessage as Re,fauxProvider as Ne,fauxText as Oe,fauxThinking as Pe,fauxToolCall as ye,getCacheWarmingDelayMs as he,getCacheWarmingRequestOptions as xe,getOverflowPatterns as fe,getPromptCacheTtlMs as De,isCacheWarmingReplayable as He,isContextOverflow as Ve,isRecoverableLength as Ge,lazyOAuth as Le,validateToolArguments as ke,validateToolCall as we}from"./chunk-XIJS4F22.js";import"./chunk-IRSW3MVW.js";import{build_exports as g,typebox_exports as d}from"./chunk-JUUJCOIR.js";import{DEFAULT_MAX_AGENT_RETRY_DELAY_MS as be,isAccountLimitAssistantError as Ue,isNetworkAssistantError as ze,isRetryableAssistantError as Ke,retryAssistantCall as We,retryDelayMs as Be}from"./chunk-NJDCSLWK.js";import"./chunk-6PQZ4KMC.js";import"./chunk-6SPX3U36.js";import"./chunk-HF334NQU.js";import"./chunk-G5AMLGXC.js";import"./chunk-F5SIUTR7.js";import{dist_exports as I}from"./chunk-AL3DFAIM.js";import"./chunk-6QGV3IWD.js";import"./chunk-R47JBGS3.js";import"./chunk-XJFQKN3N.js";import"./chunk-MZ7O6YLD.js";import{uuidv7 as Fe}from"./chunk-IEBK4HQA.js";import"./chunk-5AGIVGSV.js";import{ANTHROPIC_API_KEY_ENV as Ye,ANTHROPIC_AUTH_TOKEN_ENV as qe,ANTHROPIC_FEDERATION_RULE_ID_ENV as Je,ANTHROPIC_IDENTITY_TOKEN_FILE_ENV as Xe,ANTHROPIC_OAUTH_TOKEN_ENV as je,ANTHROPIC_ORGANIZATION_ID_ENV as Ze,ANTHROPIC_SERVICE_ACCOUNT_ID_ENV as $e,ANTHROPIC_WORKSPACE_ID_ENV as Qe,findEnvKeys as et,getEnvApiKey as tt,setEnvApiKeyPolicy as rt}from"./chunk-723ZGEZ2.js";import{cleanupSessionResources as st,registerSessionResourceCleanup as ot}from"./chunk-ZG74NES2.js";import"./chunk-TMTOQ7H7.js";import"./chunk-7DDKXS2Q.js";import{StreamingJsonParser as it,ToolCallArgumentsStream as at,parseJsonWithRepair as nt,parseStreamingJson as pt,parseToolCallArguments as lt,repairJson as mt}from"./chunk-FFMDRXC4.js";import{AI_TELEMETRY_SCHEMA as At,InMemoryCredentialStore as gt,InMemoryModelsStore as dt,ModelsError as It,calculateCost as _t,clampThinkingLevel as Tt,collapseSystemMessages as Ct,createInitialSystemMessage as Et,createModels as ct,createProvider as ut,declarationsEqual as Mt,defaultProviderAuthContext as St,getCurrentSystemMessage as vt,getCurrentSystemPrompt as Rt,getCurrentTools as Nt,getDeclaredTools as Ot,getInitialSystemMessage as Pt,getModelType as yt,getSupportedThinkingLevels as ht,getToolStateChanges as xt,hasApi as ft,hasNonAdditiveToolChanges as Dt,hasToolRedefinitions as Ht,isModelType as Vt,lazyApi as Gt,lazyStream as Lt,modelsAreEqual as kt,models_exports as _,normalizeContext as wt,resolveTranscript as bt,resolveTranscriptTools as Ut,setAmbientAuthPolicy as zt,toToolDeclaration as Kt,withoutInitialSystemMessage as Wt}from"./chunk-PD6QS7YD.js";import{AssistantMessageEventStream as Bt,EventStream as Ft,appendAssistantMessageDiagnostic as Yt,createAssistantMessageDiagnostic as qt,createAssistantMessageEventStream as Jt,extractDiagnosticError as Xt,firstTokenTimeoutMessage as jt,formatThrownValue as Zt,withFirstTokenTimeout as $t}from"./chunk-4LDEEFCY.js";import{PI_AI_VERSION as Qt,PI_ATTRIBUTION as er,contentText as tr,formatUserAgent as rr,getAttributionHeaders as sr,getClientVersion as or,getIdentityHeaders as ir,getOpenCodeSessionHeaders as ar,getSystemMessageText as nr,mergeClientIdentity as pr,renderSystemMessageUpdate as lr,withClientIdentity as mr}from"./chunk-GPI2GHBH.js";import{__export as Ar}from"./chunk-JXWJOIH4.js";var T={},s={};Ar(s,{AI_TELEMETRY_SCHEMA:e(()=>At,"AI_TELEMETRY_SCHEMA"),ANTHROPIC_API_KEY_ENV:e(()=>Ye,"ANTHROPIC_API_KEY_ENV"),ANTHROPIC_AUTH_TOKEN_ENV:e(()=>qe,"ANTHROPIC_AUTH_TOKEN_ENV"),ANTHROPIC_FEDERATION_RULE_ID_ENV:e(()=>Je,"ANTHROPIC_FEDERATION_RULE_ID_ENV"),ANTHROPIC_IDENTITY_TOKEN_FILE_ENV:e(()=>Xe,"ANTHROPIC_IDENTITY_TOKEN_FILE_ENV"),ANTHROPIC_OAUTH_TOKEN_ENV:e(()=>je,"ANTHROPIC_OAUTH_TOKEN_ENV"),ANTHROPIC_ORGANIZATION_ID_ENV:e(()=>Ze,"ANTHROPIC_ORGANIZATION_ID_ENV"),ANTHROPIC_SERVICE_ACCOUNT_ID_ENV:e(()=>$e,"ANTHROPIC_SERVICE_ACCOUNT_ID_ENV"),ANTHROPIC_WORKSPACE_ID_ENV:e(()=>Qe,"ANTHROPIC_WORKSPACE_ID_ENV"),AssistantMessageEventStream:e(()=>Bt,"AssistantMessageEventStream"),CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY:e(()=>Ce,"CACHE_WARMING_IDLE_CONTINUATION_PROBABILITY"),CACHE_WARMING_MAX_AGE_MS:e(()=>Ee,"CACHE_WARMING_MAX_AGE_MS"),CACHE_WARMING_MAX_IDLE_AGE_MS:e(()=>ce,"CACHE_WARMING_MAX_IDLE_AGE_MS"),CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS:e(()=>ue,"CACHE_WARMING_MINIMUM_EXPECTED_SAVINGS"),DEFAULT_MAX_AGENT_RETRY_DELAY_MS:e(()=>be,"DEFAULT_MAX_AGENT_RETRY_DELAY_MS"),EventStream:e(()=>Ft,"EventStream"),InMemoryCredentialStore:e(()=>gt,"InMemoryCredentialStore"),InMemoryModelsStore:e(()=>dt,"InMemoryModelsStore"),ModelsError:e(()=>It,"ModelsError"),PI_AI_VERSION:e(()=>Qt,"PI_AI_VERSION"),PI_ATTRIBUTION:e(()=>er,"PI_ATTRIBUTION"),StreamingJsonParser:e(()=>it,"StreamingJsonParser"),StringEnum:e(()=>gr,"StringEnum"),ToolCallArgumentsStream:e(()=>at,"ToolCallArgumentsStream"),Type:e(()=>d,"Type"),anthropicMessagesApi:e(()=>M,"anthropicMessagesApi"),appendAssistantMessageDiagnostic:e(()=>Yt,"appendAssistantMessageDiagnostic"),azureOpenAIResponsesApi:e(()=>S,"azureOpenAIResponsesApi"),bedrockConverseStreamApi:e(()=>v,"bedrockConverseStreamApi"),calculateCost:e(()=>_t,"calculateCost"),clampThinkingLevel:e(()=>Tt,"clampThinkingLevel"),cleanupSessionResources:e(()=>st,"cleanupSessionResources"),collapseSystemMessages:e(()=>Ct,"collapseSystemMessages"),complete:e(()=>R,"complete"),completeSimple:e(()=>N,"completeSimple"),contentText:e(()=>tr,"contentText"),createAssistantMessageDiagnostic:e(()=>qt,"createAssistantMessageDiagnostic"),createAssistantMessageEventStream:e(()=>Jt,"createAssistantMessageEventStream"),createFauxCore:e(()=>Me,"createFauxCore"),createInitialSystemMessage:e(()=>Et,"createInitialSystemMessage"),createModels:e(()=>ct,"createModels"),createProvider:e(()=>ut,"createProvider"),declarationsEqual:e(()=>Mt,"declarationsEqual"),defaultProviderAuthContext:e(()=>St,"defaultProviderAuthContext"),envApiKeyAuth:e(()=>Se,"envApiKeyAuth"),evaluateCacheWarming:e(()=>ve,"evaluateCacheWarming"),extractDiagnosticError:e(()=>Xt,"extractDiagnosticError"),fauxAssistantMessage:e(()=>Re,"fauxAssistantMessage"),fauxProvider:e(()=>Ne,"fauxProvider"),fauxText:e(()=>Oe,"fauxText"),fauxThinking:e(()=>Pe,"fauxThinking"),fauxToolCall:e(()=>ye,"fauxToolCall"),findEnvKeys:e(()=>et,"findEnvKeys"),firstTokenTimeoutMessage:e(()=>jt,"firstTokenTimeoutMessage"),formatThrownValue:e(()=>Zt,"formatThrownValue"),formatUserAgent:e(()=>rr,"formatUserAgent"),generateImages:e(()=>O,"generateImages"),generateImagesOpenRouter:e(()=>P,"generateImagesOpenRouter"),getApiProvider:e(()=>y,"getApiProvider"),getApiProviders:e(()=>h,"getApiProviders"),getAttributionHeaders:e(()=>sr,"getAttributionHeaders"),getCacheWarmingDelayMs:e(()=>he,"getCacheWarmingDelayMs"),getCacheWarmingRequestOptions:e(()=>xe,"getCacheWarmingRequestOptions"),getClientVersion:e(()=>or,"getClientVersion"),getCurrentSystemMessage:e(()=>vt,"getCurrentSystemMessage"),getCurrentSystemPrompt:e(()=>Rt,"getCurrentSystemPrompt"),getCurrentTools:e(()=>Nt,"getCurrentTools"),getDeclaredTools:e(()=>Ot,"getDeclaredTools"),getEnvApiKey:e(()=>tt,"getEnvApiKey"),getIdentityHeaders:e(()=>ir,"getIdentityHeaders"),getImageModel:e(()=>x,"getImageModel"),getImageModels:e(()=>f,"getImageModels"),getImageProviders:e(()=>D,"getImageProviders"),getImagesApiProvider:e(()=>H,"getImagesApiProvider"),getInitialSystemMessage:e(()=>Pt,"getInitialSystemMessage"),getModel:e(()=>V,"getModel"),getModelType:e(()=>yt,"getModelType"),getModels:e(()=>G,"getModels"),getOpenCodeSessionHeaders:e(()=>ar,"getOpenCodeSessionHeaders"),getOverflowPatterns:e(()=>fe,"getOverflowPatterns"),getPromptCacheTtlMs:e(()=>De,"getPromptCacheTtlMs"),getProviders:e(()=>L,"getProviders"),getSupportedThinkingLevels:e(()=>ht,"getSupportedThinkingLevels"),getSystemMessageText:e(()=>nr,"getSystemMessageText"),getToolStateChanges:e(()=>xt,"getToolStateChanges"),googleGenerativeAIApi:e(()=>k,"googleGenerativeAIApi"),googleVertexApi:e(()=>w,"googleVertexApi"),hasApi:e(()=>ft,"hasApi"),hasNonAdditiveToolChanges:e(()=>Dt,"hasNonAdditiveToolChanges"),hasToolRedefinitions:e(()=>Ht,"hasToolRedefinitions"),isAccountLimitAssistantError:e(()=>Ue,"isAccountLimitAssistantError"),isCacheWarmingReplayable:e(()=>He,"isCacheWarmingReplayable"),isContextOverflow:e(()=>Ve,"isContextOverflow"),isModelType:e(()=>Vt,"isModelType"),isNetworkAssistantError:e(()=>ze,"isNetworkAssistantError"),isRecoverableLength:e(()=>Ge,"isRecoverableLength"),isRetryableAssistantError:e(()=>Ke,"isRetryableAssistantError"),lazyApi:e(()=>Gt,"lazyApi"),lazyOAuth:e(()=>Le,"lazyOAuth"),lazyStream:e(()=>Lt,"lazyStream"),mergeClientIdentity:e(()=>pr,"mergeClientIdentity"),mistralConversationsApi:e(()=>b,"mistralConversationsApi"),modelsAreEqual:e(()=>kt,"modelsAreEqual"),normalizeContext:e(()=>wt,"normalizeContext"),openAICodexResponsesApi:e(()=>U,"openAICodexResponsesApi"),openAICompletionsApi:e(()=>z,"openAICompletionsApi"),openAIResponsesApi:e(()=>K,"openAIResponsesApi"),parseJsonWithRepair:e(()=>nt,"parseJsonWithRepair"),parseStreamingJson:e(()=>pt,"parseStreamingJson"),parseToolCallArguments:e(()=>lt,"parseToolCallArguments"),piMessagesApi:e(()=>W,"piMessagesApi"),registerApiProvider:e(()=>B,"registerApiProvider"),registerBuiltInApiProviders:e(()=>F,"registerBuiltInApiProviders"),registerBuiltInImagesApiProviders:e(()=>Y,"registerBuiltInImagesApiProviders"),registerFauxProvider:e(()=>q,"registerFauxProvider"),registerImagesApiProvider:e(()=>J,"registerImagesApiProvider"),registerSessionResourceCleanup:e(()=>ot,"registerSessionResourceCleanup"),renderSystemMessageUpdate:e(()=>lr,"renderSystemMessageUpdate"),repairJson:e(()=>mt,"repairJson"),resetApiProviders:e(()=>X,"resetApiProviders"),resolveTranscript:e(()=>bt,"resolveTranscript"),resolveTranscriptTools:e(()=>Ut,"resolveTranscriptTools"),retryAssistantCall:e(()=>We,"retryAssistantCall"),retryDelayMs:e(()=>Be,"retryDelayMs"),setAmbientAuthPolicy:e(()=>zt,"setAmbientAuthPolicy"),setBedrockProviderLoader:e(()=>j,"setBedrockProviderLoader"),setBedrockProviderModule:e(()=>Z,"setBedrockProviderModule"),setEnvApiKeyPolicy:e(()=>rt,"setEnvApiKeyPolicy"),stream:e(()=>$,"stream"),streamAnthropic:e(()=>Q,"streamAnthropic"),streamAzureOpenAIResponses:e(()=>ee,"streamAzureOpenAIResponses"),streamGoogle:e(()=>te,"streamGoogle"),streamGoogleVertex:e(()=>re,"streamGoogleVertex"),streamMistral:e(()=>se,"streamMistral"),streamOpenAICodexResponses:e(()=>oe,"streamOpenAICodexResponses"),streamOpenAICompletions:e(()=>ie,"streamOpenAICompletions"),streamOpenAIResponses:e(()=>ae,"streamOpenAIResponses"),streamSimple:e(()=>ne,"streamSimple"),streamSimpleAnthropic:e(()=>pe,"streamSimpleAnthropic"),streamSimpleAzureOpenAIResponses:e(()=>le,"streamSimpleAzureOpenAIResponses"),streamSimpleGoogle:e(()=>me,"streamSimpleGoogle"),streamSimpleGoogleVertex:e(()=>Ae,"streamSimpleGoogleVertex"),streamSimpleMistral:e(()=>ge,"streamSimpleMistral"),streamSimpleOpenAICodexResponses:e(()=>de,"streamSimpleOpenAICodexResponses"),streamSimpleOpenAICompletions:e(()=>Ie,"streamSimpleOpenAICompletions"),streamSimpleOpenAIResponses:e(()=>_e,"streamSimpleOpenAIResponses"),toToolDeclaration:e(()=>Kt,"toToolDeclaration"),unregisterApiProviders:e(()=>Te,"unregisterApiProviders"),uuidv7:e(()=>Fe,"uuidv7"),validateToolArguments:e(()=>ke,"validateToolArguments"),validateToolCall:e(()=>we,"validateToolCall"),withClientIdentity:e(()=>mr,"withClientIdentity"),withFirstTokenTimeout:e(()=>$t,"withFirstTokenTimeout"),withoutInitialSystemMessage:e(()=>Wt,"withoutInitialSystemMessage")});function gr(r,t){return d.Unsafe({type:"string",enum:r,...t?.description&&{description:t.description},...t?.default&&{default:t.default}})}e(gr,"StringEnum");var i={typebox:g,"typebox/compile":m,"typebox/value":A,"@sinclair/typebox":g,"@sinclair/typebox/compile":m,"@sinclair/typebox/value":A,"@earendil-works/pi-agent-core":p,"@earendil-works/pi-tui":I,"@earendil-works/pi-ai":s,"@earendil-works/pi-ai/compat":s,"@earendil-works/pi-ai/models":_,"@earendil-works/pi-ai/oauth":T,"@earendil-works/pi-ai/providers/all":l,"@earendil-works/pi-coding-agent":o,"@mariozechner/pi-agent-core":p,"@mariozechner/pi-tui":I,"@mariozechner/pi-ai":s,"@mariozechner/pi-ai/compat":s,"@mariozechner/pi-ai/models":_,"@mariozechner/pi-ai/oauth":T,"@mariozechner/pi-ai/providers/all":l,"@mariozechner/pi-coding-agent":o},dr={sdk:e(()=>import("./sdk-5V64WBOZ.js"),"sdk"),office:e(()=>import("./office-2JSKOL7V.js"),"office"),mcp:e(()=>import("./mcp-GHYUCPI4.js"),"mcp"),router:e(()=>import("./router-3UQE4LBN.js"),"router"),rewind:e(()=>import("./rewind-2OYLDDHH.js"),"rewind"),review:e(()=>import("./review-OQEOVDLP.js"),"review"),usage:e(()=>import("./usage-MG7QDPG2.js"),"usage"),sync:e(()=>import("./sync-INSWGFSB.js"),"sync")};for(let r of n)i[r]=o;for(let[r,t]of Object.entries(dr)){let a,C={enumerable:!0,get:e(()=>(a??=t(),a),"get")};for(let E of n)Object.defineProperty(i,`${E}/${r}`,C)}export{i as VIRTUAL_MODULES};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-RX6CC5RH.js";import"./chunks/chunk-T3TEURLR.js";import"./chunks/chunk-3HGUIN22.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-MKMLENQD.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as s}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SZZVJTVX.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-BIY5HTFI.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-F37JXTCY.js";import"./chunks/chunk-JXWJOIH4.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),m()}r(n,"setupCli"),n(),e(process.argv.slice(2));
2
+ var o=Object.defineProperty;var r=(i,t)=>o(i,"name",{value:t,configurable:!0});import{createRequire as p}from"node:module";const a=p(import.meta.url);import{configureHttpDispatcher as m,main as e}from"./chunks/chunk-FSX34SAZ.js";import"./chunks/chunk-JPCWLZUZ.js";import"./chunks/chunk-JPBJUBY4.js";import"./chunks/chunk-XIJS4F22.js";import"./chunks/chunk-IRSW3MVW.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import"./chunks/chunk-6PQZ4KMC.js";import"./chunks/chunk-6SPX3U36.js";import"./chunks/chunk-HF334NQU.js";import"./chunks/chunk-G5AMLGXC.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as s}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-MZ7O6YLD.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-PD6QS7YD.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-GPI2GHBH.js";import"./chunks/chunk-JXWJOIH4.js";function n(){process.title=s,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),m()}r(n,"setupCli"),n(),e(process.argv.slice(2));
@@ -1 +1 @@
1
- import{createRequire as e}from"node:module";const pn=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as n,ThemeSelectorComponent as i,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as c,dalHookActivity as m,dalHooksExtension as p,decideDalHooks as S,defaultWorkspaceLockDir as d,engineToolInput as E,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as D,readWorkspaceLock as R,releaseWorkspace as _,reportDalHookProblems as A,runDalCommandHook as h,runDalHookEvent as k,runDalHooks as P,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as H,runSessionStartHooks as I,runStopHooks as f,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-XTN2LDU3.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CURRENT_SESSION_VERSION as z,CompactionSummaryMessageComponent as X,CustomEditor as q,CustomMessageComponent as Y,DEFAULT_COMPACTION_SETTINGS as J,DefaultPackageManager as Q,DefaultResourceLoader as Z,DynamicBorder as $,ENGINE_MARKET_CACHE_FILE as ee,ExtensionEditorComponent as oe,ExtensionFatalError as te,ExtensionInputComponent as re,ExtensionRunner as ne,ExtensionSelectorComponent as ie,FooterComponent as ae,HOST_CAPABILITIES_ENV as se,HOST_TOKEN_ENV as le,HOST_TOKEN_HEADER as ce,HOST_URL_ENV as me,HostCallError as pe,HostCapabilities as Se,InteractiveMode as de,LoginDialogComponent as Ee,MARKET_SECTIONS as Te,MAX_BACKGROUND_PROCESSES as ue,ModelRegistry as ge,ModelSelectorComponent as Ce,OAuthSelectorComponent as De,PROTECTED_WRITE_NAMES as Re,REQUIRED_EXTENSION_FAILED as _e,RequiredExtensionError as Ae,RpcClient as he,RpcCommandError as ke,SANDBOX_ENV as Pe,SessionManager as Le,SessionSelectorComponent as Oe,SettingsManager as He,SettingsSelectorComponent as Ie,ShellSandbox as fe,SkillInvocationMessageComponent as Me,ThinkingSelectorComponent as Ne,ToolExecutionComponent as Fe,TreeSelectorComponent as ye,UserMessageComponent as xe,UserMessageSelectorComponent as ve,adaptPackage as Ue,adaptationState as be,agentLogPath as Be,appendAgentLog as we,applyCommunityEnv as Ke,buildContextEntries as We,buildProjectMap as je,buildRuleSet as Ve,buildSessionContext as Ge,buildSessionProjection as ze,calculateContextTokens as Xe,collectEntriesForBranchSummary as qe,communityEnv as Ye,compact as Je,convertToLlm as Qe,convertToPng as Ze,copyToClipboard as $e,createAgentSession as eo,createAgentSessionFromServices as oo,createAgentSessionRuntime as to,createAgentSessionServices as ro,createBashTool as no,createBashToolDefinition as io,createCodemodeExtension as ao,createCodingTools as so,createEditTool as lo,createEditToolDefinition as co,createEventBus as mo,createExtensionRuntime as po,createFindTool as So,createFindToolDefinition as Eo,createGrepTool as To,createGrepToolDefinition as uo,createLocalBashOperations as go,createLocalPowerShellOperations as Co,createLsTool as Do,createLsToolDefinition as Ro,createMcpExtension as _o,createPowerShellTool as Ao,createPowerShellToolDefinition as ho,createProcessToolDefinition as ko,createReadOnlyTools as Po,createReadTool as Lo,createReadToolDefinition as Oo,createSyntheticSourceInfo as Ho,createToolSearchExtension as Io,createWriteTool as fo,createWriteToolDefinition as Mo,defineTool as No,describeProjectFacts as Fo,detectProjectFacts as yo,detectSandboxAvailability as xo,detectSupportedImageMimeTypeFromFile as vo,discoverAndLoadExtensions as Uo,ensurePackageAdapted as bo,estimateTokens as Bo,evaluateToolPolicy as wo,expandTempDirVariable as Ko,fetchSignedMarket as Wo,findCutPoint as jo,findTurnStartIndex as Vo,formatDimensionNote as Go,formatProjectMapPrompt as zo,formatSkillsForPrompt as Xo,generateBranchSummary as qo,generateDiffString as Yo,generateSummary as Jo,generateSummaryWithUsage as Qo,generateUnifiedPatch as Zo,getDefaultSessionDir as $o,getDefaultSessionDirs as et,getHostCapabilities as ot,getLastAssistantUsage as tt,getLatestCompactionEntry as rt,getProcessShellSandbox as nt,getToolDenial as it,isAdaptablePackage as at,isBashToolResult as st,isEditToolResult as lt,isFatalExtensionError as ct,isFindToolResult as mt,isGrepToolResult as pt,isHostExtensionPath as St,isLsToolResult as dt,isPowerShellToolResult as Et,isReadOnlyBashCommand as Tt,isReadToolResult as ut,isToolCallEventType as gt,isWriteToolResult as Ct,loadMcpRuntime as Dt,loadProjectContextFiles as Rt,loadSkills as _t,loadSkillsFromDir as At,main as ht,markHostExtensionPaths as kt,marketCacheDir as Pt,matchPermissionRules as Lt,migrateSessionEntries as Ot,normalizeForFuzzyMatch as Ht,parseArgs as It,parseFrontmatter as ft,parseHostCapabilities as Mt,parsePermissionRule as Nt,parseSessionEntries as Ft,parseSkillBlock as yt,prepareBranchEntries as xt,projectPackageManager as vt,readAccessDenial as Ut,readAdaptation as bt,readSignedSection as Bt,registerPermissionAskHandler as wt,registerSandboxEscalationHandler as Kt,registerShellExecutionGuard as Wt,renderDiff as jt,resizeImage as Vt,resolveCliModel as Gt,resolveMarketEndpoint as zt,resolveModelScopeWithDiagnostics as Xt,resolveSandboxPolicy as qt,resolveToCwd as Yt,runPrintMode as Jt,runRpcMode as Qt,scanHardcodedPiPaths as Zt,serializeConversation as $t,sessionEntryToContextMessages as er,shellExecutionRefusal as or,shouldCompact as tr,simpleCommands as rr,stripFrontmatter as nr,systemTempDirs as ir,tryEnsurePackageAdapted as ar,unwrapCommand as sr,verifyAdaptation as lr,verifySignedSection as cr,withFileMutationQueue as mr,wrapRegisteredTool as pr,wrapRegisteredTools as Sr}from"./chunks/chunk-RX6CC5RH.js";import{CredentialSynchronizationError as dr,DALCODE_PROJECT_DIR_NAME as Er,DEFAULT_HOOK_TIMEOUT_SECONDS as Tr,ModelRuntime as ur,PROJECT_HOOKS_FILE_ENV as gr,ProjectTrustStore as Cr,TRUST_REQUIRING_PROJECT_HOOK_FILES as Dr,VIRTUAL_MODEL_STATE_ENTRY as Rr,dalHookSourceFiles as _r,deriveHookName as Ar,hasTrustRequiringProjectResources as hr,loadDalHooks as kr,openBrowser as Pr,projectFileDeclaresHooks as Lr,projectHooksFileFromEnv as Or}from"./chunks/chunk-T3TEURLR.js";import{formatReadLineRange as Hr,truncateToVisualLines as Ir}from"./chunks/chunk-3HGUIN22.js";import"./chunks/chunk-3YGHTGYM.js";import{readStoredCredential as fr}from"./chunks/chunk-MKMLENQD.js";import{DEFAULT_MAX_BYTES as Mr,DEFAULT_MAX_LINES as Nr,DEFAULT_SHELL_ENV_EXCLUDES as Fr,applyShellEnvironmentPolicy as yr,formatSize as xr,getPowerShellConfig as vr,getShellConfig as Ur,getShellEnv as br,isDalCodeCredentialName as Br,truncateHead as wr,truncateLine as Kr,truncateTail as Wr,withoutDalCodeCredentials as jr}from"./chunks/chunk-SE42OS3U.js";import{ArminComponent as Vr}from"./chunks/chunk-F5SIUTR7.js";import{Theme as Gr,getLanguageFromPath as zr,getMarkdownTheme as Xr,getSelectListTheme as qr,getSettingsListTheme as Yr,highlightCode as Jr,initTheme as Qr,keyHint as Zr,keyText as $r,rawKeyHint as en}from"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as on,SHARED_SKILL_CONFIG_DIRS as tn,VERSION as rn,getAgentDir as nn,getDocsPath as an,getExamplesPath as sn,getPackageDir as ln,getReadmePath as cn}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SZZVJTVX.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-BIY5HTFI.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-F37JXTCY.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,B as AgentSession,w as AgentSessionRuntime,Vr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,on as CONFIG_DIR_NAME,z as CURRENT_SESSION_VERSION,X as CompactionSummaryMessageComponent,dr as CredentialSynchronizationError,q as CustomEditor,Y as CustomMessageComponent,Er as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,J as DEFAULT_COMPACTION_SETTINGS,Tr as DEFAULT_HOOK_TIMEOUT_SECONDS,Mr as DEFAULT_MAX_BYTES,Nr as DEFAULT_MAX_LINES,Fr as DEFAULT_SHELL_ENV_EXCLUDES,Q as DefaultPackageManager,Z as DefaultResourceLoader,$ as DynamicBorder,ee as ENGINE_MARKET_CACHE_FILE,oe as ExtensionEditorComponent,te as ExtensionFatalError,re as ExtensionInputComponent,ne as ExtensionRunner,ie as ExtensionSelectorComponent,ae as FooterComponent,se as HOST_CAPABILITIES_ENV,le as HOST_TOKEN_ENV,ce as HOST_TOKEN_HEADER,me as HOST_URL_ENV,pe as HostCallError,Se as HostCapabilities,de as InteractiveMode,Ee as LoginDialogComponent,Te as MARKET_SECTIONS,ue as MAX_BACKGROUND_PROCESSES,ge as ModelRegistry,ur as ModelRuntime,Ce as ModelSelectorComponent,De as OAuthSelectorComponent,gr as PROJECT_HOOKS_FILE_ENV,Re as PROTECTED_WRITE_NAMES,Cr as ProjectTrustStore,_e as REQUIRED_EXTENSION_FAILED,Ae as RequiredExtensionError,he as RpcClient,ke as RpcCommandError,Pe as SANDBOX_ENV,tn as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,Le as SessionManager,Oe as SessionSelectorComponent,He as SettingsManager,Ie as SettingsSelectorComponent,fe as ShellSandbox,n as ShowImagesSelectorComponent,Me as SkillInvocationMessageComponent,Dr as TRUST_REQUIRING_PROJECT_HOOK_FILES,Gr as Theme,i as ThemeSelectorComponent,Ne as ThinkingSelectorComponent,Fe as ToolExecutionComponent,ye as TreeSelectorComponent,xe as UserMessageComponent,ve as UserMessageSelectorComponent,rn as VERSION,Rr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,Ue as adaptPackage,be as adaptationState,Be as agentLogPath,we as appendAgentLog,Ke as applyCommunityEnv,yr as applyShellEnvironmentPolicy,We as buildContextEntries,l as buildDalHookInput,je as buildProjectMap,Ve as buildRuleSet,Ge as buildSessionContext,ze as buildSessionProjection,Xe as calculateContextTokens,c as claimWorkspace,qe as collectEntriesForBranchSummary,Ye as communityEnv,Je as compact,Qe as convertToLlm,Ze as convertToPng,$e as copyToClipboard,eo as createAgentSession,oo as createAgentSessionFromServices,to as createAgentSessionRuntime,ro as createAgentSessionServices,no as createBashTool,io as createBashToolDefinition,ao as createCodemodeExtension,so as createCodingTools,lo as createEditTool,co as createEditToolDefinition,mo as createEventBus,po as createExtensionRuntime,So as createFindTool,Eo as createFindToolDefinition,To as createGrepTool,uo as createGrepToolDefinition,go as createLocalBashOperations,Co as createLocalPowerShellOperations,Do as createLsTool,Ro as createLsToolDefinition,_o as createMcpExtension,Ao as createPowerShellTool,ho as createPowerShellToolDefinition,ko as createProcessToolDefinition,Po as createReadOnlyTools,Lo as createReadTool,Oo as createReadToolDefinition,Ho as createSyntheticSourceInfo,Io as createToolSearchExtension,fo as createWriteTool,Mo as createWriteToolDefinition,m as dalHookActivity,_r as dalHookSourceFiles,p as dalHooksExtension,S as decideDalHooks,d as defaultWorkspaceLockDir,No as defineTool,Ar as deriveHookName,Fo as describeProjectFacts,yo as detectProjectFacts,xo as detectSandboxAvailability,vo as detectSupportedImageMimeTypeFromFile,Uo as discoverAndLoadExtensions,E as engineToolInput,bo as ensurePackageAdapted,Bo as estimateTokens,wo as evaluateToolPolicy,Ko as expandTempDirVariable,Wo as fetchSignedMarket,jo as findCutPoint,Vo as findTurnStartIndex,T as formatDalHookActivity,Go as formatDimensionNote,zo as formatProjectMapPrompt,Hr as formatReadLineRange,xr as formatSize,Xo as formatSkillsForPrompt,qo as generateBranchSummary,Yo as generateDiffString,Jo as generateSummary,Qo as generateSummaryWithUsage,Zo as generateUnifiedPatch,nn as getAgentDir,$o as getDefaultSessionDir,et as getDefaultSessionDirs,an as getDocsPath,sn as getExamplesPath,ot as getHostCapabilities,zr as getLanguageFromPath,tt as getLastAssistantUsage,rt as getLatestCompactionEntry,Xr as getMarkdownTheme,ln as getPackageDir,vr as getPowerShellConfig,nt as getProcessShellSandbox,cn as getReadmePath,qr as getSelectListTheme,Yr as getSettingsListTheme,Ur as getShellConfig,br as getShellEnv,it as getToolDenial,u as gitDirOf,hr as hasTrustRequiringProjectResources,Jr as highlightCode,g as hookToolInput,C as hookToolName,Qr as initTheme,at as isAdaptablePackage,st as isBashToolResult,Br as isDalCodeCredentialName,D as isDalHookActivity,lt as isEditToolResult,ct as isFatalExtensionError,mt as isFindToolResult,pt as isGrepToolResult,St as isHostExtensionPath,dt as isLsToolResult,Et as isPowerShellToolResult,Tt as isReadOnlyBashCommand,ut as isReadToolResult,gt as isToolCallEventType,Ct as isWriteToolResult,Zr as keyHint,$r as keyText,kr as loadDalHooks,Dt as loadMcpRuntime,Rt as loadProjectContextFiles,_t as loadSkills,At as loadSkillsFromDir,ht as main,kt as markHostExtensionPaths,Pt as marketCacheDir,Lt as matchPermissionRules,Ot as migrateSessionEntries,Ht as normalizeForFuzzyMatch,Pr as openBrowser,It as parseArgs,ft as parseFrontmatter,Mt as parseHostCapabilities,Nt as parsePermissionRule,Ft as parseSessionEntries,yt as parseSkillBlock,xt as prepareBranchEntries,Lr as projectFileDeclaresHooks,Or as projectHooksFileFromEnv,vt as projectPackageManager,en as rawKeyHint,Ut as readAccessDenial,bt as readAdaptation,Bt as readSignedSection,fr as readStoredCredential,R as readWorkspaceLock,wt as registerPermissionAskHandler,Kt as registerSandboxEscalationHandler,Wt as registerShellExecutionGuard,_ as releaseWorkspace,jt as renderDiff,A as reportDalHookProblems,Vt as resizeImage,Gt as resolveCliModel,zt as resolveMarketEndpoint,Xt as resolveModelScopeWithDiagnostics,qt as resolveSandboxPolicy,Yt as resolveToCwd,h as runDalCommandHook,k as runDalHookEvent,P as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,H as runPreToolUseHooks,Jt as runPrintMode,Qt as runRpcMode,I as runSessionStartHooks,f as runStopHooks,M as runUserPromptSubmitHooks,Zt as scanHardcodedPiPaths,N as selectDalHooks,$t as serializeConversation,er as sessionEntryToContextMessages,F as shellCommandDirectory,or as shellExecutionRefusal,tr as shouldCompact,rr as simpleCommands,nr as stripFrontmatter,ir as systemTempDirs,y as toolMatchNames,wr as truncateHead,Kr as truncateLine,Wr as truncateTail,Ir as truncateToVisualLines,ar as tryEnsurePackageAdapted,sr as unwrapCommand,lr as verifyAdaptation,cr as verifySignedSection,mr as withFileMutationQueue,jr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,pr as wrapRegisteredTool,Sr as wrapRegisteredTools};
1
+ import{createRequire as e}from"node:module";const ci=e(import.meta.url);import{DAL_HOOK_ENTRY_TYPE as o,DAL_HOOK_NOTIFICATION_CHANNEL as t,STALE_AFTER_MS as r,ShowImagesSelectorComponent as i,ThemeSelectorComponent as n,WORKSPACE_LOCK_DIR_NAME as a,WORKSPACE_LOCK_FILE as s,buildDalHookInput as l,claimWorkspace as m,dalHookActivity as c,dalHooksExtension as p,decideDalHooks as S,defaultWorkspaceLockDir as d,engineToolInput as E,formatDalHookActivity as T,gitDirOf as u,hookToolInput as g,hookToolName as C,isDalHookActivity as D,readWorkspaceLock as R,releaseWorkspace as _,reportDalHookProblems as A,runDalCommandHook as h,runDalHookEvent as k,runDalHooks as P,runNotificationHooks as L,runPostToolUseHooks as O,runPreToolUseHooks as f,runSessionStartHooks as H,runStopHooks as I,runUserPromptSubmitHooks as M,selectDalHooks as N,shellCommandDirectory as F,toolMatchNames as y,workspaceLockIsLive as x,workspaceLockPath as v,workspaceOwnerSessionId as U}from"./chunks/chunk-LZTZWS3N.js";import{ADAPTATION_FILE as b,AgentSession as B,AgentSessionRuntime as w,AssistantMessageComponent as K,BackgroundProcessManager as W,BashExecutionComponent as j,BorderedLoader as V,BranchSummaryMessageComponent as G,CompactionSummaryMessageComponent as z,CustomEditor as X,CustomMessageComponent as q,DEFAULT_COMPACTION_SETTINGS as Y,DefaultPackageManager as J,DefaultResourceLoader as Q,DynamicBorder as Z,ENGINE_MARKET_CACHE_FILE as $,ExtensionEditorComponent as ee,ExtensionFatalError as oe,ExtensionInputComponent as te,ExtensionRunner as re,ExtensionSelectorComponent as ie,FooterComponent as ne,HOST_CAPABILITIES_ENV as ae,HOST_TOKEN_ENV as se,HOST_TOKEN_HEADER as le,HOST_URL_ENV as me,HostCallError as ce,HostCapabilities as pe,InteractiveMode as Se,LoginDialogComponent as de,MARKET_SECTIONS as Ee,MAX_BACKGROUND_PROCESSES as Te,ModelRegistry as ue,ModelSelectorComponent as ge,OAuthSelectorComponent as Ce,PROTECTED_WRITE_NAMES as De,REQUIRED_EXTENSION_FAILED as Re,RequiredExtensionError as _e,RpcClient as Ae,RpcCommandError as he,SANDBOX_ENV as ke,SessionSelectorComponent as Pe,SettingsManager as Le,SettingsSelectorComponent as Oe,ShellSandbox as fe,SkillInvocationMessageComponent as He,ThinkingSelectorComponent as Ie,ToolExecutionComponent as Me,TreeSelectorComponent as Ne,UserMessageComponent as Fe,UserMessageSelectorComponent as ye,adaptPackage as xe,adaptationState as ve,agentLogPath as Ue,appendAgentLog as be,applyCommunityEnv as Be,buildProjectMap as we,buildRuleSet as Ke,calculateContextTokens as We,collectEntriesForBranchSummary as je,communityEnv as Ve,compact as Ge,convertToPng as ze,copyToClipboard as Xe,createAgentSession as qe,createAgentSessionFromServices as Ye,createAgentSessionRuntime as Je,createAgentSessionServices as Qe,createBashTool as Ze,createBashToolDefinition as $e,createCodemodeExtension as eo,createCodingTools as oo,createEditTool as to,createEditToolDefinition as ro,createEventBus as io,createExtensionRuntime as no,createFindTool as ao,createFindToolDefinition as so,createGrepTool as lo,createGrepToolDefinition as mo,createLocalBashOperations as co,createLocalPowerShellOperations as po,createLsTool as So,createLsToolDefinition as Eo,createMcpExtension as To,createPowerShellTool as uo,createPowerShellToolDefinition as go,createProcessToolDefinition as Co,createReadOnlyTools as Do,createReadTool as Ro,createReadToolDefinition as _o,createSyntheticSourceInfo as Ao,createToolSearchExtension as ho,createWriteTool as ko,createWriteToolDefinition as Po,defineTool as Lo,describeProjectFacts as Oo,detectProjectFacts as fo,detectSandboxAvailability as Ho,detectSupportedImageMimeTypeFromFile as Io,discoverAndLoadExtensions as Mo,ensurePackageAdapted as No,estimateTokens as Fo,evaluateToolPolicy as yo,expandTempDirVariable as xo,fetchSignedMarket as vo,findCutPoint as Uo,findTurnStartIndex as bo,formatDimensionNote as Bo,formatProjectMapPrompt as wo,formatSkillsForPrompt as Ko,generateBranchSummary as Wo,generateDiffString as jo,generateSummary as Vo,generateSummaryWithUsage as Go,generateUnifiedPatch as zo,getHostCapabilities as Xo,getLastAssistantUsage as qo,getProcessShellSandbox as Yo,getToolDenial as Jo,isAdaptablePackage as Qo,isBashToolResult as Zo,isEditToolResult as $o,isFatalExtensionError as et,isFindToolResult as ot,isGrepToolResult as tt,isHostExtensionPath as rt,isLsToolResult as it,isPowerShellToolResult as nt,isReadOnlyBashCommand as at,isReadToolResult as st,isToolCallEventType as lt,isWriteToolResult as mt,loadMcpRuntime as ct,loadProjectContextFiles as pt,loadSkills as St,loadSkillsFromDir as dt,main as Et,markHostExtensionPaths as Tt,marketCacheDir as ut,matchPermissionRules as gt,normalizeForFuzzyMatch as Ct,parseArgs as Dt,parseFrontmatter as Rt,parseHostCapabilities as _t,parsePermissionRule as At,parseSkillBlock as ht,prepareBranchEntries as kt,projectPackageManager as Pt,readAccessDenial as Lt,readAdaptation as Ot,readSignedSection as ft,registerPermissionAskHandler as Ht,registerSandboxEscalationHandler as It,registerShellExecutionGuard as Mt,renderDiff as Nt,resizeImage as Ft,resolveCliModel as yt,resolveMarketEndpoint as xt,resolveModelScopeWithDiagnostics as vt,resolveSandboxPolicy as Ut,resolveToCwd as bt,runPrintMode as Bt,runRpcMode as wt,scanHardcodedPiPaths as Kt,serializeConversation as Wt,shellExecutionRefusal as jt,shouldCompact as Vt,simpleCommands as Gt,stripFrontmatter as zt,systemTempDirs as Xt,tryEnsurePackageAdapted as qt,unwrapCommand as Yt,verifyAdaptation as Jt,verifySignedSection as Qt,withFileMutationQueue as Zt,wrapRegisteredTool as $t,wrapRegisteredTools as er}from"./chunks/chunk-FSX34SAZ.js";import{CURRENT_SESSION_VERSION as or,SessionManager as tr,buildContextEntries as rr,buildSessionContext as ir,buildSessionProjection as nr,convertToLlm as ar,getDefaultSessionDir as sr,getDefaultSessionDirs as lr,getLatestCompactionEntry as mr,migrateSessionEntries as cr,parseSessionEntries as pr,sessionEntryToContextMessages as Sr}from"./chunks/chunk-JPCWLZUZ.js";import{CredentialSynchronizationError as dr,DALCODE_PROJECT_DIR_NAME as Er,DEFAULT_HOOK_TIMEOUT_SECONDS as Tr,ModelRuntime as ur,PROJECT_HOOKS_FILE_ENV as gr,ProjectTrustStore as Cr,TRUST_REQUIRING_PROJECT_HOOK_FILES as Dr,VIRTUAL_MODEL_STATE_ENTRY as Rr,dalHookSourceFiles as _r,deriveHookName as Ar,hasTrustRequiringProjectResources as hr,loadDalHooks as kr,openBrowser as Pr,projectFileDeclaresHooks as Lr,projectHooksFileFromEnv as Or}from"./chunks/chunk-JPBJUBY4.js";import"./chunks/chunk-XIJS4F22.js";import{formatReadLineRange as fr,truncateToVisualLines as Hr}from"./chunks/chunk-IRSW3MVW.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import{readStoredCredential as Ir}from"./chunks/chunk-6PQZ4KMC.js";import"./chunks/chunk-6SPX3U36.js";import{DEFAULT_MAX_BYTES as Mr,DEFAULT_MAX_LINES as Nr,DEFAULT_SHELL_ENV_EXCLUDES as Fr,applyShellEnvironmentPolicy as yr,formatSize as xr,getPowerShellConfig as vr,getShellConfig as Ur,getShellEnv as br,isDalCodeCredentialName as Br,truncateHead as wr,truncateLine as Kr,truncateTail as Wr,withoutDalCodeCredentials as jr}from"./chunks/chunk-HF334NQU.js";import"./chunks/chunk-G5AMLGXC.js";import{ArminComponent as Vr}from"./chunks/chunk-F5SIUTR7.js";import{Theme as Gr,getLanguageFromPath as zr,getMarkdownTheme as Xr,getSelectListTheme as qr,getSettingsListTheme as Yr,highlightCode as Jr,initTheme as Qr,keyHint as Zr,keyText as $r,rawKeyHint as ei}from"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{CONFIG_DIR_NAME as oi,SHARED_SKILL_CONFIG_DIRS as ti,VERSION as ri,getAgentDir as ii,getDocsPath as ni,getExamplesPath as ai,getPackageDir as si,getReadmePath as li}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-MZ7O6YLD.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-PD6QS7YD.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-GPI2GHBH.js";import"./chunks/chunk-JXWJOIH4.js";export{b as ADAPTATION_FILE,B as AgentSession,w as AgentSessionRuntime,Vr as ArminComponent,K as AssistantMessageComponent,W as BackgroundProcessManager,j as BashExecutionComponent,V as BorderedLoader,G as BranchSummaryMessageComponent,oi as CONFIG_DIR_NAME,or as CURRENT_SESSION_VERSION,z as CompactionSummaryMessageComponent,dr as CredentialSynchronizationError,X as CustomEditor,q as CustomMessageComponent,Er as DALCODE_PROJECT_DIR_NAME,o as DAL_HOOK_ENTRY_TYPE,t as DAL_HOOK_NOTIFICATION_CHANNEL,Y as DEFAULT_COMPACTION_SETTINGS,Tr as DEFAULT_HOOK_TIMEOUT_SECONDS,Mr as DEFAULT_MAX_BYTES,Nr as DEFAULT_MAX_LINES,Fr as DEFAULT_SHELL_ENV_EXCLUDES,J as DefaultPackageManager,Q as DefaultResourceLoader,Z as DynamicBorder,$ as ENGINE_MARKET_CACHE_FILE,ee as ExtensionEditorComponent,oe as ExtensionFatalError,te as ExtensionInputComponent,re as ExtensionRunner,ie as ExtensionSelectorComponent,ne as FooterComponent,ae as HOST_CAPABILITIES_ENV,se as HOST_TOKEN_ENV,le as HOST_TOKEN_HEADER,me as HOST_URL_ENV,ce as HostCallError,pe as HostCapabilities,Se as InteractiveMode,de as LoginDialogComponent,Ee as MARKET_SECTIONS,Te as MAX_BACKGROUND_PROCESSES,ue as ModelRegistry,ur as ModelRuntime,ge as ModelSelectorComponent,Ce as OAuthSelectorComponent,gr as PROJECT_HOOKS_FILE_ENV,De as PROTECTED_WRITE_NAMES,Cr as ProjectTrustStore,Re as REQUIRED_EXTENSION_FAILED,_e as RequiredExtensionError,Ae as RpcClient,he as RpcCommandError,ke as SANDBOX_ENV,ti as SHARED_SKILL_CONFIG_DIRS,r as STALE_AFTER_MS,tr as SessionManager,Pe as SessionSelectorComponent,Le as SettingsManager,Oe as SettingsSelectorComponent,fe as ShellSandbox,i as ShowImagesSelectorComponent,He as SkillInvocationMessageComponent,Dr as TRUST_REQUIRING_PROJECT_HOOK_FILES,Gr as Theme,n as ThemeSelectorComponent,Ie as ThinkingSelectorComponent,Me as ToolExecutionComponent,Ne as TreeSelectorComponent,Fe as UserMessageComponent,ye as UserMessageSelectorComponent,ri as VERSION,Rr as VIRTUAL_MODEL_STATE_ENTRY,a as WORKSPACE_LOCK_DIR_NAME,s as WORKSPACE_LOCK_FILE,xe as adaptPackage,ve as adaptationState,Ue as agentLogPath,be as appendAgentLog,Be as applyCommunityEnv,yr as applyShellEnvironmentPolicy,rr as buildContextEntries,l as buildDalHookInput,we as buildProjectMap,Ke as buildRuleSet,ir as buildSessionContext,nr as buildSessionProjection,We as calculateContextTokens,m as claimWorkspace,je as collectEntriesForBranchSummary,Ve as communityEnv,Ge as compact,ar as convertToLlm,ze as convertToPng,Xe as copyToClipboard,qe as createAgentSession,Ye as createAgentSessionFromServices,Je as createAgentSessionRuntime,Qe as createAgentSessionServices,Ze as createBashTool,$e as createBashToolDefinition,eo as createCodemodeExtension,oo as createCodingTools,to as createEditTool,ro as createEditToolDefinition,io as createEventBus,no as createExtensionRuntime,ao as createFindTool,so as createFindToolDefinition,lo as createGrepTool,mo as createGrepToolDefinition,co as createLocalBashOperations,po as createLocalPowerShellOperations,So as createLsTool,Eo as createLsToolDefinition,To as createMcpExtension,uo as createPowerShellTool,go as createPowerShellToolDefinition,Co as createProcessToolDefinition,Do as createReadOnlyTools,Ro as createReadTool,_o as createReadToolDefinition,Ao as createSyntheticSourceInfo,ho as createToolSearchExtension,ko as createWriteTool,Po as createWriteToolDefinition,c as dalHookActivity,_r as dalHookSourceFiles,p as dalHooksExtension,S as decideDalHooks,d as defaultWorkspaceLockDir,Lo as defineTool,Ar as deriveHookName,Oo as describeProjectFacts,fo as detectProjectFacts,Ho as detectSandboxAvailability,Io as detectSupportedImageMimeTypeFromFile,Mo as discoverAndLoadExtensions,E as engineToolInput,No as ensurePackageAdapted,Fo as estimateTokens,yo as evaluateToolPolicy,xo as expandTempDirVariable,vo as fetchSignedMarket,Uo as findCutPoint,bo as findTurnStartIndex,T as formatDalHookActivity,Bo as formatDimensionNote,wo as formatProjectMapPrompt,fr as formatReadLineRange,xr as formatSize,Ko as formatSkillsForPrompt,Wo as generateBranchSummary,jo as generateDiffString,Vo as generateSummary,Go as generateSummaryWithUsage,zo as generateUnifiedPatch,ii as getAgentDir,sr as getDefaultSessionDir,lr as getDefaultSessionDirs,ni as getDocsPath,ai as getExamplesPath,Xo as getHostCapabilities,zr as getLanguageFromPath,qo as getLastAssistantUsage,mr as getLatestCompactionEntry,Xr as getMarkdownTheme,si as getPackageDir,vr as getPowerShellConfig,Yo as getProcessShellSandbox,li as getReadmePath,qr as getSelectListTheme,Yr as getSettingsListTheme,Ur as getShellConfig,br as getShellEnv,Jo as getToolDenial,u as gitDirOf,hr as hasTrustRequiringProjectResources,Jr as highlightCode,g as hookToolInput,C as hookToolName,Qr as initTheme,Qo as isAdaptablePackage,Zo as isBashToolResult,Br as isDalCodeCredentialName,D as isDalHookActivity,$o as isEditToolResult,et as isFatalExtensionError,ot as isFindToolResult,tt as isGrepToolResult,rt as isHostExtensionPath,it as isLsToolResult,nt as isPowerShellToolResult,at as isReadOnlyBashCommand,st as isReadToolResult,lt as isToolCallEventType,mt as isWriteToolResult,Zr as keyHint,$r as keyText,kr as loadDalHooks,ct as loadMcpRuntime,pt as loadProjectContextFiles,St as loadSkills,dt as loadSkillsFromDir,Et as main,Tt as markHostExtensionPaths,ut as marketCacheDir,gt as matchPermissionRules,cr as migrateSessionEntries,Ct as normalizeForFuzzyMatch,Pr as openBrowser,Dt as parseArgs,Rt as parseFrontmatter,_t as parseHostCapabilities,At as parsePermissionRule,pr as parseSessionEntries,ht as parseSkillBlock,kt as prepareBranchEntries,Lr as projectFileDeclaresHooks,Or as projectHooksFileFromEnv,Pt as projectPackageManager,ei as rawKeyHint,Lt as readAccessDenial,Ot as readAdaptation,ft as readSignedSection,Ir as readStoredCredential,R as readWorkspaceLock,Ht as registerPermissionAskHandler,It as registerSandboxEscalationHandler,Mt as registerShellExecutionGuard,_ as releaseWorkspace,Nt as renderDiff,A as reportDalHookProblems,Ft as resizeImage,yt as resolveCliModel,xt as resolveMarketEndpoint,vt as resolveModelScopeWithDiagnostics,Ut as resolveSandboxPolicy,bt as resolveToCwd,h as runDalCommandHook,k as runDalHookEvent,P as runDalHooks,L as runNotificationHooks,O as runPostToolUseHooks,f as runPreToolUseHooks,Bt as runPrintMode,wt as runRpcMode,H as runSessionStartHooks,I as runStopHooks,M as runUserPromptSubmitHooks,Kt as scanHardcodedPiPaths,N as selectDalHooks,Wt as serializeConversation,Sr as sessionEntryToContextMessages,F as shellCommandDirectory,jt as shellExecutionRefusal,Vt as shouldCompact,Gt as simpleCommands,zt as stripFrontmatter,Xt as systemTempDirs,y as toolMatchNames,wr as truncateHead,Kr as truncateLine,Wr as truncateTail,Hr as truncateToVisualLines,qt as tryEnsurePackageAdapted,Yt as unwrapCommand,Jt as verifyAdaptation,Qt as verifySignedSection,Zt as withFileMutationQueue,jr as withoutDalCodeCredentials,x as workspaceLockIsLive,v as workspaceLockPath,U as workspaceOwnerSessionId,$t as wrapRegisteredTool,er as wrapRegisteredTools};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-RX6CC5RH.js";import"./chunks/chunk-T3TEURLR.js";import"./chunks/chunk-3HGUIN22.js";import"./chunks/chunk-3YGHTGYM.js";import"./chunks/chunk-MKMLENQD.js";import"./chunks/chunk-SE42OS3U.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as p}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-SZZVJTVX.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-BIY5HTFI.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-F37JXTCY.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
2
+ import{createRequire as r}from"node:module";const m=r(import.meta.url);import{configureHttpDispatcher as i,main as o}from"./chunks/chunk-FSX34SAZ.js";import"./chunks/chunk-JPCWLZUZ.js";import"./chunks/chunk-JPBJUBY4.js";import"./chunks/chunk-XIJS4F22.js";import"./chunks/chunk-IRSW3MVW.js";import"./chunks/chunk-JUUJCOIR.js";import"./chunks/chunk-NJDCSLWK.js";import"./chunks/chunk-6PQZ4KMC.js";import"./chunks/chunk-6SPX3U36.js";import"./chunks/chunk-HF334NQU.js";import"./chunks/chunk-G5AMLGXC.js";import"./chunks/chunk-F5SIUTR7.js";import"./chunks/chunk-AL3DFAIM.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME as p}from"./chunks/chunk-R47JBGS3.js";import"./chunks/chunk-XJFQKN3N.js";import"./chunks/chunk-MZ7O6YLD.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-723ZGEZ2.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-PD6QS7YD.js";import"./chunks/chunk-4LDEEFCY.js";import"./chunks/chunk-GPI2GHBH.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${p}-rpc`,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),i(),o(["--mode","rpc",...process.argv.slice(2)]);
@@ -0,0 +1 @@
1
+ var n=Object.defineProperty;var u=(e,r)=>n(e,"name",{value:r,configurable:!0});function a(e){return e.authToken!==void 0&&e.authTokenFile!==void 0?{errors:["--auth-token and --auth-token-file are mutually exclusive"]}:e.authToken!==void 0?{auth:{type:"token",token:e.authToken},errors:[]}:e.authTokenFile!==void 0?{auth:{type:"file",path:e.authTokenFile},errors:[]}:{errors:[]}}u(a,"parseAuthInput");export{a as parseAuthInput};
@@ -0,0 +1 @@
1
+ import{clientCommand as m}from"./commands/client.js";import{piCommand as o}from"./commands/pi.js";import{serverCommand as r}from"./commands/server.js";const t=o.command(r).command(m);export{t as experimentalCli};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var o=(r,t)=>s(r,"name",{value:t,configurable:!0});import{parseArgs as p}from"../args.js";import{parseAuthInput as i}from"./auth.js";import{stringOption as n,valueOption as a}from"./command.js";import{parseTransportAddress as u}from"./transport-address.js";const d=n("--auth-token"),m=n("--auth-token-file");function k(r){return a(r,t=>{const e=u(t,r);return e.address?{ok:!0,value:e.address}:{ok:!1,error:e.error??`Invalid ${r} address "${t}"`}})}o(k,"transportOption");function x(r){return i({authToken:r.value(d),authTokenFile:r.value(m)})}o(x,"parseAuth");function O(r){const t=p([...r.remainingArgs]);return{options:t,errors:t.diagnostics.filter(e=>e.type==="error").map(e=>e.message)}}o(O,"parseLegacyOptions");function A(r,t){return t.remainingArgs.length===0?[]:[`The experimental ${r} command does not support existing CLI options yet`]}o(A,"unsupportedLegacyOptions");export{m as authTokenFileOption,d as authTokenOption,x as parseAuth,O as parseLegacyOptions,k as transportOption,A as unsupportedLegacyOptions};
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var i=(a,e)=>l(a,"name",{value:e,configurable:!0});function p(a,e){return{name:a,parse:e}}i(p,"valueOption");function g(a){return p(a,e=>({ok:!0,value:e}))}i(g,"stringOption");class w{static{i(this,"Command")}name;options=new Map;subcommands=new Map;builder;commandAction;constructor(e){this.name=e}option(e){if(this.options.has(e.name))throw new Error(`Option ${e.name} is already registered for ${this.name}`);return this.options.set(e.name,e),this}build(e){return this.builder=e,this}action(e){return this.commandAction=e,this}command(e){if(this.subcommands.has(e.name))throw new Error(`Command ${e.name} is already registered`);return this.subcommands.set(e.name,{parse:i(n=>e.parse(n),"parse"),execute:i((n,s)=>e.execute(n,s),"execute")}),this}parse(e){const n=this.select(e);return n?n.command.parse(n.argv):this.parseOwn(e)}async execute(e,n){const s=this.select(e);if(s)return s.command.execute(s.argv,n);const t=this.parseOwn(e);if(!t.ok)return t;if(!this.commandAction)throw new Error(`Command ${this.name} does not define an action`);return await this.commandAction(t.command,n),{ok:!0,command:t.command}}select(e){const n=e[0];if(n===void 0)return;const s=this.subcommands.get(n);return s?{command:s,argv:e.slice(1)}:void 0}parseOwn(e){if(!this.builder)throw new Error(`Command ${this.name} does not define a builder`);const n=this.parseOptions(e),s={remainingArgs:n.remainingArgs,value:i(r=>n.values.get(r.name)?.[0],"value"),values:i(r=>n.values.get(r.name)??[],"values")},t=this.builder(s),o=[...n.errors,...t.ok?[]:t.errors];if(o.length>0)return{ok:!1,errors:o};if(!t.ok)throw new Error(`Command ${this.name} failed without an error`);return{ok:!0,command:t.command}}parseOptions(e){const n={values:new Map,remainingArgs:[],errors:[]};for(let s=0;s<e.length;s++){const t=e[s];if(t==="--"){n.remainingArgs.push(...e.slice(s));break}const o=t.indexOf("="),r=o===-1?t:t.slice(0,o),h=this.options.get(r);if(!h){n.remainingArgs.push(...e.slice(s));break}let u=o===-1?void 0:t.slice(o+1);if(u===void 0){const d=e[s+1];d!==void 0&&!d.startsWith("-")&&(u=d,s++)}if(u===void 0||u===""){n.errors.push(`${r} requires a value`);continue}const c=n.values.get(r)??[];if(c.length>0){n.errors.push(`${r} may only be specified once`);continue}const m=h.parse(u);if(!m.ok){n.errors.push(m.error);continue}c.push(m.value),n.values.set(r,c)}return n}}export{w as Command,g as stringOption,p as valueOption};
@@ -0,0 +1 @@
1
+ import{Command as s}from"../command.js";import{authTokenFileOption as a,authTokenOption as p,parseAuth as m,parseLegacyOptions as u,transportOption as d,unsupportedLegacyOptions as l}from"../command-options.js";const r=d("--connect"),O=new s("client").option(r).option(p).option(a).build(o=>{const{auth:n,errors:c}=m(o),t=o.value(r),{errors:i}=u(o),e=[...c,...i,...l("client",o)];return e.length>0?{ok:!1,errors:e}:{ok:!0,command:{command:"client",...n===void 0?{}:{auth:n},...t===void 0?{}:{connect:t}}}}).action((o,n)=>n.runClient(o));export{O as clientCommand};
@@ -0,0 +1 @@
1
+ import{Command as p}from"../command.js";import{authTokenFileOption as c,authTokenOption as l,parseAuth as m,parseLegacyOptions as u,transportOption as d}from"../command-options.js";const i=d("--listen"),k=new p("pi").option(i).option(l).option(c).build(o=>{const{auth:n,errors:s}=m(o),r=o.values(i),{options:e,errors:a}=u(o),t=[...s,...a];return e.unknownFlags.has("connect")&&t.push("--connect is only valid for client mode"),t.length>0?{ok:!1,errors:t}:{ok:!0,command:{command:"pi",options:e,...n===void 0?{}:{auth:n},...r.length===0?{}:{listen:r}}}}).action((o,n)=>n.runPi(o));export{k as piCommand};
@@ -0,0 +1 @@
1
+ import{Command as a}from"../command.js";import{authTokenFileOption as p,authTokenOption as m,parseAuth as c,parseLegacyOptions as u,transportOption as l,unsupportedLegacyOptions as d}from"../command-options.js";const t=l("--listen"),O=new a("server").option(t).option(m).option(p).build(o=>{const{auth:r,errors:s}=c(o),e=o.values(t),{errors:i}=u(o),n=[...s,...i,...d("server",o)];return n.length>0?{ok:!1,errors:n}:{ok:!0,command:{command:"server",...r===void 0?{}:{auth:r},...e.length===0?{}:{listen:e}}}}).action((o,r)=>r.runServer(o));export{O as serverCommand};
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var n=(r,s)=>d(r,"name",{value:s,configurable:!0});import{posix as o}from"node:path";function u(r,s){let t;try{t=new URL(r)}catch{return{error:`Invalid ${s} address "${r}"`}}if(t.protocol!=="unix:")return{error:`Unsupported ${s} transport "${t.protocol}"`};if(t.hostname||t.port||t.username||t.password)return{error:"Unix transport address must not include an authority"};if(!r.startsWith("unix:///")||r.startsWith("unix:////")||r.includes("?")||r.includes("#")||t.href!==r)return{error:`Invalid ${s} address "${r}"`};let e;try{e=decodeURIComponent(t.pathname)}catch{return{error:`Invalid ${s} address "${r}"`}}return e.includes("\0")?{error:`Invalid ${s} address "${r}"`}:o.isAbsolute(e)?{address:{transport:"unix",path:e}}:{error:"Unix transport address requires an absolute path"}}n(u,"parseTransportAddress");export{u as parseTransportAddress};
@@ -0,0 +1 @@
1
+ import{RemoteSession as e}from"./remote-session.js";import{applyTranscriptProgress as s,applyTranscriptSnapshot as a,createTranscriptState as o,selectTranscript as c}from"./transcript.js";export{e as RemoteSession,s as applyTranscriptProgress,a as applyTranscriptSnapshot,o as createTranscriptState,c as selectTranscript};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var r=(a,s)=>p(a,"name",{value:s,configurable:!0});import{applyTranscriptProgress as u,applyTranscriptSnapshot as l,createTranscriptState as w,selectTranscript as f}from"./transcript.js";class c extends Error{static{r(this,"RemoteSessionDisposedError")}constructor(){super("Remote session is disposed"),this.name="RemoteSessionDisposedError"}}async function y(a){const t=(await Promise.allSettled(a)).flatMap(i=>i.status==="rejected"&&!(i.reason instanceof c)?[i.reason]:[]);if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Failed to dispose remote session")}r(y,"settleRemoteSessionDisposal");class o{static{r(this,"RemoteSession")}#e;#u;#s={status:"unbound"};#i;#t;#l;#w;#c=new Set;#f=new Set;#y=new Set;#d;#b=r(()=>{},"#resolveDisposeSignal");#C=new Promise(s=>{this.#b=s});constructor(s,t={}){this.#e=s,this.#u=t.onListenerError}get id(){return this.#i?.id}get state(){return{lifecycle:this.#s,snapshot:this.#t?.snapshot,transcript:this.#t?f(this.#t):[]}}get snapshot(){return this.#t?.snapshot}get phase(){return this.snapshot?.phase}get operation(){return this.#s.status==="busy"?this.#s.operation:void 0}get models(){return this.#e.snapshot?.models??[]}get sessions(){return this.#e.snapshot?.sessions??[]}get connectionState(){return this.#e.connectionState}get disposed(){return this.#s.status==="disposed"}subscribe(s){return this.#o(),this.#c.add(s),this.#A(s,this.state),()=>this.#c.delete(s)}onConnectionStateChange(s){return this.#o(),this.#e.onConnectionStateChange(s)}static async open(s,t,i={}){const e=new o(s,i);try{return await e.open(t),e}catch(n){throw await e.dispose(),n}}async open(s){this.#i?.id===s&&this.#s.status==="ready"||await this.#S("open",()=>this.#e.acquireSession(s,{mode:"exclusive"}))}static async create(s,t,i={}){const e=new o(s,i);try{return await e.create(t),e}catch(n){throw await e.dispose(),n}}async create(s){await this.#S("create",()=>this.#e.createSession(s))}async submit(s){const t=s.trim();if(!t)return;this.#a();const i=this.#r();if(this.phase!=="idle"&&this.phase!=="turn")throw new Error(`Session cannot accept input during ${this.phase??"unknown"} phase`);await this.#h("submit",()=>(this.phase==="idle"?i.prompt(t):i.steer(t)).then(()=>{}))}async abort(){const s=this.#s.status==="busy"&&this.#s.operation==="submit";s?this.#o():this.#a();const t=this.#r();this.phase==="idle"&&!s||await this.#h("abort",()=>t.abort().then(()=>{}),s)}async setModel(s){await this.#v("setModel","change model",()=>this.#r().setModel(s).then(()=>{}))}async setThinking(s){await this.#v("setThinking","change thinking level",()=>this.#r().setThinking(s).then(()=>{}))}async reconnect(){this.#a();const s=this.#r().id;await this.#h("reconnect",()=>this.#E(async()=>{await this.#e.reconnect();const t=await this.#e.acquireSession(s,{mode:"exclusive"});await this.#m(t),this.#$(t)}))}dispose(){if(this.#d)return this.#d;const s=this.#i;this.#s={status:"disposed"},this.#b(),this.#g(),this.#i=void 0,this.#t=void 0;const t=[...this.#f];return s&&t.push(s.dispose()),this.#d=y(t),this.#n(),this.#c.clear(),this.#d}[Symbol.asyncDispose](){return this.dispose()}async#S(s,t){if(this.#a(),this.#i&&this.phase!=="idle")throw new Error(`Cannot ${s} a session while session is ${this.phase??"unavailable"}`);await this.#h(s,()=>this.#E(()=>this.#D(s,t)))}async#E(s){const t=s();this.#f.add(t);try{await t}finally{this.#f.delete(t)}}async#D(s,t){const i=this.#i,e=await t();await this.#m(e);const n=e.snapshot;if(!n)throw await this.#p(e),new Error(`Session ${e.id} did not provide a snapshot`);if(i&&i.id!==e.id&&i.attached&&this.phase!=="idle")throw await this.#p(e),new Error(`Cannot ${s} a session while session is ${this.phase??"unavailable"}`);if(i&&i.id!==e.id&&i.attached)try{await i.detach()}catch(h){try{await this.#p(e)}catch(d){throw new AggregateError([h,d],"Failed to replace remote session attachment")}throw h}await this.#m(e),this.#$(e,n)}async#v(s,t,i){if(this.#a(),this.#r(),this.phase!=="idle")throw new Error(`Cannot ${t} while session is ${this.phase??"unavailable"}`);await this.#h(s,i)}async#h(s,t,i=!1){i?this.#o():this.#a();const e=this.#s,n={status:"busy",operation:s};this.#s=n,this.#y.add(n),this.#n();const h=t();try{await Promise.race([h,this.#C.then(()=>{throw new Error("Remote session is disposed")})])}finally{this.#y.delete(n),!this.disposed&&this.#s===n&&(this.#s=i&&this.#y.has(e)?e:this.#i?{status:"ready"}:{status:"unbound"},this.#n())}}#$(s,t){const i=t??s.snapshot;if(!i)throw new Error(`Session ${s.id} did not provide a snapshot`);this.#g(),this.#i=s,this.#t=w(i),this.#l=s.subscribe(e=>{this.#t&&(this.#t=l(this.#t,e),this.#n())}),this.#w=s.onEvent(e=>this.#R(e))}#R(s){if(s.type==="session_removed"){this.#g(),this.#i=void 0,this.#t=void 0,this.#s.status!=="busy"&&(this.#s={status:"unbound"}),this.#n();return}s.type!=="session_progress"||!this.#t||(this.#t=u(this.#t,s.progress),this.#n())}#n(){const s=this.state;for(const t of this.#c)this.#A(t,s)}#A(s,t){try{s(t)}catch(i){this.#T(i)}}#T(s){if(this.#u)try{this.#u(s instanceof Error?s:new Error(String(s)))}catch{}}#g(){this.#l?.(),this.#w?.(),this.#l=void 0,this.#w=void 0}#r(){if(!this.#i)throw new Error("No remote session is attached");return this.#i}#a(){if(this.#o(),this.#s.status==="busy")throw new Error(`Remote session is busy with ${this.#s.operation}`)}#o(){if(this.disposed)throw new Error("Remote session is disposed")}async#m(s){if(this.disposed)throw await this.#p(s),new c}async#p(s){await s.dispose()}}export{o as RemoteSession};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var o=(t,e)=>p(t,"name",{value:e,configurable:!0});function u(t){return t===null||typeof t=="boolean"||typeof t=="string"?!0:typeof t=="number"?Number.isFinite(t):Array.isArray(t)?t.every(u):typeof t!="object"||Object.getPrototypeOf(t)!==Object.prototype?!1:Object.values(t).every(u)}o(u,"isJsonValue");function y(t){try{const e=JSON.parse(t);if(u(e))return e}catch{}return t}o(y,"parsePartialToolInput");function a(t){return{snapshot:structuredClone(t),progressItems:new Map,progressOrder:[],toolCallBuffers:new Map}}o(a,"createTranscriptState");function g(t,e){return t.snapshot.id===e.id&&e.revision<t.snapshot.revision?t:a(e)}o(g,"applyTranscriptSnapshot");function C(t,e){if(e.type==="item_started"||e.type==="item_updated")return c(t,e.item);if(e.type==="item_finished"){const n=new Map(t.toolCallBuffers);for(const f of n.keys())f.startsWith(`${e.item.id}:`)&&n.delete(f);return c({...t,toolCallBuffers:n},e.item)}const i=t.progressItems.get(e.messageId)??t.snapshot.transcript.find(({id:n})=>n===e.messageId);if(!i||i.role!=="assistant")return t;let r=t.toolCallBuffers;const s=i.content.map((n,f)=>{if(f!==e.contentIndex)return structuredClone(n);if(e.kind==="text"&&n.type==="text")return{...n,text:n.text+e.delta};if(e.kind==="thinking"&&n.type==="thinking")return{...n,thinking:n.thinking+e.delta};if(e.kind==="toolCall"&&n.type==="toolCall"){const d=`${e.messageId}:${e.contentIndex}`,l=(t.toolCallBuffers.get(d)??(typeof n.input=="string"?n.input:""))+e.delta;return r=new Map(t.toolCallBuffers).set(d,l),{...n,input:y(l)}}return structuredClone(n)});return c({...t,toolCallBuffers:r},{...i,content:s})}o(C,"applyTranscriptProgress");function I(t){const e=t.snapshot.transcript.map(r=>t.progressItems.get(r.id)??r),i=new Set(e.map(r=>r.id));for(const r of t.progressOrder){if(i.has(r))continue;const s=t.progressItems.get(r);s&&(e.push(s),i.add(r))}for(const r of t.snapshot.queuedSteer)i.has(r.id)||(e.push(r),i.add(r.id));return e}o(I,"selectTranscript");function c(t,e){const i=new Map(t.progressItems),r=i.has(e.id)?t.progressOrder:[...t.progressOrder,e.id];return i.set(e.id,structuredClone(e)),{...t,progressItems:i,progressOrder:r}}o(c,"setProgressItem");export{C as applyTranscriptProgress,g as applyTranscriptSnapshot,a as createTranscriptState,I as selectTranscript};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var n=(e,r)=>c(e,"name",{value:r,configurable:!0});import{isInstallTelemetryEnabled as d}from"./telemetry.js";const s="openrouter.ai",f="integrate.api.nvidia.com",l="api.cloudflare.com",p="gateway.ai.cloudflare.com",O="opencode.ai";function t(e,r){try{return new URL(e).hostname===r}catch{return!1}}n(t,"matchesHost");function g(e){return e.provider==="openrouter"||e.baseUrl.includes(s)}n(g,"isOpenRouterModel");function b(e){return e.provider==="nvidia"||t(e.baseUrl,f)}n(b,"isNvidiaNimModel");function T(e){return e.provider==="cloudflare-workers-ai"||e.provider==="cloudflare-ai-gateway"||t(e.baseUrl,l)||t(e.baseUrl,p)}n(T,"isCloudflareModel");function v(e,r){if(d(r)){if(g(e))return{"HTTP-Referer":"https://deepailab.ai","X-OpenRouter-Title":"dal","X-OpenRouter-Categories":"cli-agent"};if(b(e))return{"X-BILLING-INVOKE-ORIGIN":"dal"};if(T(e))return{"User-Agent":"dal-coding-agent"}}}n(v,"getDefaultAttributionHeaders");function A(e,r){if(r&&!(e.provider!=="opencode"&&e.provider!=="opencode-go"&&!t(e.baseUrl,O)))return{"x-opencode-session":r,"x-opencode-client":"dal"}}n(A,"getSessionHeaders");function R(e,r,a,...u){const i={...A(e,a),...v(e,r)};for(const o of u)o&&Object.assign(i,o);return Object.keys(i).length>0?i:void 0}n(R,"mergeProviderAttributionHeaders");export{R as mergeProviderAttributionHeaders};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var i=(d,c)=>m(d,"name",{value:c,configurable:!0});import{theme as x}from"../theme/theme.js";const o="bbbab8b9b9b6b9b8b5bcbbb8b8b7b4b7b5b2b6b5b2b8b7b4b7b6b3b6b4b1bdbcb8bab8b6bbb8b5b8b5b1bbb8b4c2bebbc1bebac0bdbabfbcb9c1bebabfbebbc0bfbcc0bdbabbb8b5c1bfbcbfbcb8bbb9b6bfbcb8c2bfbcc1bfbcbfbbb8bdb9b6b8b7b5b9b8b5b8b8b5b5b5b2b6b5b2b8b7b4b9b8b5b9b8b5b6b5b3bab8b5bcbab7bbb9b6bbb8b5bfb9b5bdb2abbcb0a8beb2aabeb5afbfbab6bebab7c0bfbcbebdbabebbb8c0bdbabfbebbc2bebbbdbab7c3c0bdc3c0bdc1bebbc2bebabfbcb8bab9b6b7b6b3b2b1aeb6b5b2b5b4b1b5b4b2b6b5b2b7b6b4b9b8b6b7b6b3bbbab7b2afaba5988fb49e90b09481b79a88b39683b09583b7a395bfb6b0c0bdbabdbbb8bebcb9c1bfbcc0bebbbdbab7bebbb8c2bfbcc0bdbac0bcb9bdb9b6c0bcb8b5b4b2b4b3b0bab9b6b9b9b6b5b4b1b5b4b1b6b5b3b9b8b5b9b8b6b9b8b6b2aeaa968174a6836eaa856eab846eaf8973ac8973b08f79b18f7ab39786b7a89dbbb3aebfbab6c2c0bdbebcb9bfbdbac3c1bdc2bebbc0bcb9bdb9b6c1bdbabfbbb8b4b3b0b9b8b5b8b7b5b4b3b1b5b4b1b8b7b4b8b7b5bab9b6bbbab7b1afad8c7a719d735ca47860a87d65a98069ae8972ae8c75af8d77aa826ba98067aa8974b39e90b6a79dbbb2adc0bdbac1bfbdbfbbb8c1bdb9bebab6c0bdb9bfbbb8c1bdbab4b2b0b7b6b4b7b6b3b4b2b0bab9b7b6b5b2b6b5b2bab9b6bab9b6958c87977663aa836bac8772b08f7aad8c77b2917db0917db0907cac8971a77d64a87f67ac8972b29887b8a89dbfbab5bfbdbac1bebac0bcb9c0bcb9c0bcb9c1bebabebab7b8b7b4b7b6b4b5b4b1b5b4b2b7b6b3b5b4b2bab9b7bab9b6b4b1ada88f7fad8973ae8d78b19684b19685b29786b69a89b29582b1917daa856ea87e66a97e66ad866ea9826baf9280b8ada6bdbbb8bebab7bfbbb8c1bdbabfbbb8bcb8b4bcb8b5b6b4b2b7b5b3b6b5b2b8b7b4b3b2afb8b7b4b6b5b2b3b2b0b3a59aab856fad8d78b0917eb19886b49b8bb49a89b39785b0917eaf8f7cab866fa77d65a77a61a87d64a9816ab08f79b5a296c1bcb8c3bfbcc2bebbbebab7bfbbb7bdbab6c2bebab8b7b4b7b6b4b6b5b3b7b6b3b6b5b2b9b8b6b4b3b1b6b1acac8f7ca9826bae8f7aaf9583b49c8cb49c8bb79d8cb59987b19380ad8e79ae8c77af8e78ac8771a3775faa826bae8972b39888bbb6b2bebbb8bfbbb8bfbbb8c0bdb9bebbb7c0bdb9b6b5b2b9b8b5b4b3b1b8b7b5b4b3b0b7b6b4b6b5b3b1a7a0aa8772a77d65a88570b49887b19b8d9c887c907a6d987f71aa907faf917daf8e7aad8c78ac8b77a8836ca9836cac8770b49b8abdb6b2c0bcb9c0bdb9bfbbb8bebab7bfbcb9bebab7b9b8b6b5b4b2b9b8b5b8b7b5b8b7b4b7b6b4b5b4b2b3a9a2ad8973a1755da9856fb398858c776a65544b776358725d526e594d9c7f6eb1907ba68672ad8e7aab8771ac856db18f79b3a092beb9b5c1bdbabdb9b5bebab7bfbbb7bebab7bcb9b6b7b6b4b6b6b3b8b7b4b5b4b2b8b6b4b7b6b3b4b3b0b4aba4a6826ba3775fb08e79b19584a88e7daa8e7db29481ad8f7c997e6da38674ac8d79ac8e7aae917f9a7c6a896a599a7c6ab3a398c1bdbabdb9b6bcb8b5bebab6bebab7bdb9b5bdb9b6b5b4b1b7b5b3b5b4b2b7b6b3b7b6b4b3b3b0b3b2b0b4aca5a7846fa97f68ae8f7bae9383b59c8bb2937fae8e79ac8b76af927eaf927eb29683b39885b2988891786a72594c6e594d978d86bdbab7bab7b3c0bcb9c0bcb9bebab7bebbb7bdb9b6b3b2b0b4b3b0b5b4b2b4b4b1b4b3b1b4b3b1b4b3b0b6ada5aa8670a57a62ad8e7ab29b8cb69d8dab856fa9826aa88069ab8771af907db49987b19684b29886b59987b39480b09787b5a9a1bcb8b5bebab7bdb9b5bebab7bfbbb8bfbbb7bbb7b4b3b2afb8b7b5b8b7b5b3b2b0b5b4b2b6b5b3b6b4b1afa299a98975a9826baf907cb39988b49a89af8e7aac8973aa856eaf8c74b1917dae907dac907db39988b29785b49785b7a090b9aca3bfbab7bcb8b5bdb9b6bcb8b4bcb8b5bdb9b5bcb8b4b5b4b2b6b5b3b4b3b0b4b3b0b9b8b5b8b6b4908b88887467aa8f7ea78976ad8973b08b74b59885b69e8eb29888b1917cb1917db1937fae907cb19686b39a8ab29886b59b8ab8a192b6aaa3b7b2afbcb8b4bcb8b5bbb7b4c0bcb9bebab7c0bcb9b6b5b2b6b5b3b4b3b0bab9b7b7b6b4b1b0ae7b716ba083709b806f716158967764b08870b29481b69b8ab69f8fb39a89b69f90b49d8db39a89b29988b49c8cb6a090b8a496baa49593867f8f8986bfbbb7bdb9b5bcb7b4bab6b3b9b5b2bab6b2b4b3b1b3b3b0b6b5b3b8b7b5b4b2b0a7a5a38f837dae917ea084725a504c63544da28370b39784b59e8db2a093a698909b918b998e8790857e95877dad998bb39c8cb5a091b9a2938d827c95908dbebab6bbb7b3bdbab7bbb7b4bdb9b6bbb7b4b4b3b0b5b4b1b8b7b5b6b5b3b8b8b5b4b2af968f8ab29a8bab9485544b483a323073655d96887f70655f61595547403e453e3c453f3d57504f655e5b90847db39c8db7a090b6a09189807aaba6a3bdb9b6c0bcb9bebab7bcb7b4bebab7bbb7b4b3b2b0b6b5b3b2b1afb7b6b4b8b7b4b5b4b1aeaba8b5a89fac998d4d44412d25244d46444e4744322b293a3230423937433a37352d2a59504c534b48524a48988a81b59f8fb19c8d827974b2afacbdb9b5bcb8b4bdb9b5bcb8b5bdb9b6bab6b2b8b7b5b5b4b2b6b6b3b9b8b5b7b6b3b6b5b2b8b6b3b9b4b1b2a9a26c64612d25242d2625312a28352d2c453d3a78675c8d7a6ea09792aea6a0615854332b29524a479f8e82b09d90a49b96c1bdb9bebab7bfbbb8bbb8b4b9b5b1b8b4b0b9b4b0b7b6b4b8b7b5b8b7b4b6b5b3b8b6b3bab9b6b9b8b5b4b3b0b7b5b2a5a29f453d3b261e1d261f1e2e2625413936857268977865b19482b5a69caca5a07c7572453d3b746963a0948cc5bfbbc0bbb8beb9b6bbb7b3bbb6b3b7b3afb8b4b0b9b5b1b7b6b3b6b5b3b5b4b2b5b4b2b7b6b3b7b6b3b8b6b3b4b2afb7b6b3b3b1ae6d6765251f1e1e18172a22212d2523443b3971625ab19888b09482a89182877e792c25243e3634766d6abeb9b5bfbbb7bebab6bcb7b3bbb6b3b9b5b1b7b3afb8b4b0b4b3b0b5b4b1b5b4b1b4b3b1b5b4b2b8b6b4b5b3b0b9b6b4b5b4b1b6b4b27f79762a2322221c1b2d2524221b1a443e3c47413f6f676281766f867971675e5a3e37352a222166605dbab7b3bdb9b5beb9b5bcb7b3bcb7b3b9b4b0bab6b2bab6b2b5b3b0b6b4b2b3b2afb7b6b3b4b4b1b4b3b0b6b4b1b5b4b1b4b3b0b9b6b29a8c8252474230292828201f181212322c2c231e1d1c16162c26252923222d26252d2523332b2a8e8885bcb8b5bcb7b3bbb6b2bcb7b3b9b4b1b9b5b1b7b2afb7b2ae7a838e9b9b9caeadacb3b2b0b3b2afb7b7b4b6b5b3b6b6b3b7b6b3b9ada4a991808e7b6f50453f2b24231a14142923221f19181d17161f18182620201d17162a22215d5654b7b3b0bbb7b3bbb6b2b8b4b0bab5b1bbb6b2bab5b1b8b4b0bab6b22c496b4c5d735f68766e727a828285929090adaba8b7b2aeb6a59ab39682a28470a387748e76674e403a1a14141d1716181211221c1c1f1918221c1b2f2827342d2c8d8884bab6b3b9b5b2bab5b1bab5b1b9b4b0bab6b2b8b4b0b9b4b0b7b2ae325e8b365f8a3a5d833f5b7a545f70646469706b6aa08f84b08e78b18e769f7e689e7f6b9e816d907766584940362d2a1c1615201b1a1a1413201a1a251e1d393331a39e9bbab5b1bcb7b3bab6b2b8b3afb8b4b0b9b4b0b9b4b1bab5b2b5b0ac3d6c9843729d44719c426e98415f805a64716f6a699d8677b1927eb3947faa89749d7a649f7f6ba487749e837186716454463f2c25231e181837302e3a33317a7471beb9b6bcb8b4bbb6b2b6b2aebab5b1b9b5b1b8b3afbab6b2b6b1adb5aeaa4877a14c7aa44e7ba345719a3a5d80586b7f767475927b6eb1927faf8e79b08e78a78169a07861a17f6aa58570a688749b83738270666f66618a8480a49e99b7b2aebab6b2bcb8b4b9b5b1b7b2aebab5b1b9b4b0b6b1aeb6b1adb2aca8b2aca84876a04a78a2517fa74771973a5d80405c7a6161677c695fac8a75b08d77b4917aaf8971ad876fa5816aa6846ea78670a98a76ac9484ab9f96b2aca8bdb8b4bcb7b3bcb8b4bcb8b4b8b3afb7b2aeb9b4b0b8b3afb8b2aeb6afabb3aeaab2aeaa4878a14b7aa34c7ba44a759b3d63873b5f825b67766f5f569c7e6caf8c77b18f79b28f78b5927caf8e78a98872aa8a76a98a76ac917fada199b7b0acb9b3afbfb9b5c1bab6bdb6b2b8b3afbab5b1b9b4b0b6afabb7b1adb3ada9b3aeaab0aba8",n=32,l=32;function g(){const d=[];for(let c=0;c<l;c++){const e=[];for(let b=0;b<n;b++){const a=(c*n+b)*6,t=parseInt(o.slice(a,a+2),16),s=parseInt(o.slice(a+2,a+4),16),f=parseInt(o.slice(a+4,a+6),16);e.push([t,s,f])}d.push(e)}return d}i(g,"parseImage");function r(d,c,e,b=!1){return`\x1B[${b?48:38};2;${d};${c};${e}m`}i(r,"rgb");const u="\x1B[0m";function k(){const d=g(),c=[];for(let e=0;e<l;e+=2){let b="";for(let a=0;a<n;a++){const t=d[e][a],s=d[e+1]?.[a]??t;b+=`${r(s[0],s[1],s[2])}${r(t[0],t[1],t[2],!0)}\u2584`}b+=u,c.push(b)}return c}i(k,"buildImage");class I{static{i(this,"DaxnutsComponent")}ui;image;interval=null;tick=0;maxTicks=25;cachedLines=[];cachedWidth=0;cachedTick=-1;constructor(c){this.ui=c,this.image=k(),this.startAnimation()}invalidate(){this.cachedWidth=0}startAnimation(){this.interval=setInterval(()=>{this.tick++,this.tick>=this.maxTicks&&this.stopAnimation(),this.cachedWidth=0,this.ui.requestRender()},80)}stopAnimation(){this.interval&&(clearInterval(this.interval),this.interval=null)}render(c){if(c===this.cachedWidth&&this.cachedTick===this.tick)return this.cachedLines;const e=x,b=[],a=i(f=>{const h=f.replace(/\x1b\[[0-9;]*m/g,"").length,p=Math.max(0,Math.floor((c-h)/2));return" ".repeat(p)+f},"center");b.push("");const t=Math.min(this.image.length,Math.floor(this.tick/this.maxTicks*(this.image.length+3)));for(let f=0;f<this.image.length;f++)if(f<t)b.push(a(this.image[f]));else if(f===t){const h="\u2593".repeat(n);b.push(a(r(100,200,255)+h+u))}else b.push(a(" ".repeat(n)));b.push("");const s=Math.max(0,this.tick-this.maxTicks*.6);return s>0||this.tick>=this.maxTicks?(b.push(a(e.fg("accent","Free Kimi K2.5 via OpenCode Zen"))),b.push(a(e.fg("success",'"Powered by daxnuts"'))),b.push(a(e.fg("muted","\u2014 @thdxr")))):(b.push(""),b.push(""),b.push("")),b.push(""),s>2||this.tick>=this.maxTicks?(b.push(a(e.fg("dim","Try OpenCode"))),b.push(a(e.fg("mdLink","https://mistral.ai/news/mistral-vibe-2-0")))):(b.push(""),b.push("")),b.push(""),this.cachedLines=b,this.cachedWidth=c,this.cachedTick=this.tick,b}dispose(){this.stopAnimation()}}export{I as DaxnutsComponent};
@@ -0,0 +1,12 @@
1
+ var p=Object.defineProperty;var m=(i,n)=>p(i,"name",{value:n,configurable:!0});import{Type as t}from"typebox";import{Compile as f}from"typebox/compile";const e=t.Union([t.String(),t.Integer({minimum:0,maximum:255})]),x=t.Object({$schema:t.Optional(t.String()),name:t.String(),vars:t.Optional(t.Record(t.String(),e)),colors:t.Object({accent:e,border:e,borderAccent:e,borderMuted:e,success:e,error:e,warning:e,muted:e,dim:e,text:e,thinkingText:e,scrollbarTrack:t.Optional(e),scrollbarThumb:t.Optional(e),selectedBg:e,searchMatchBg:t.Optional(e),searchMatchText:t.Optional(e),userMessageBg:e,userMessageText:e,customMessageBg:e,customMessageText:e,customMessageLabel:e,toolPendingBg:e,toolSuccessBg:e,toolErrorBg:e,toolTitle:e,toolOutput:e,mdHeading:e,mdLink:e,mdLinkUrl:e,mdCode:e,mdCodeBlock:e,mdCodeBlockBorder:e,mdQuote:e,mdQuoteBorder:e,mdHr:e,mdListBullet:e,toolDiffAdded:e,toolDiffRemoved:e,toolDiffContext:e,syntaxComment:e,syntaxKeyword:e,syntaxFunction:e,syntaxVariable:e,syntaxString:e,syntaxNumber:e,syntaxType:e,syntaxOperator:e,syntaxPunctuation:e,thinkingOff:e,thinkingMinimal:e,thinkingLow:e,thinkingMedium:e,thinkingHigh:e,thinkingXhigh:e,thinkingMax:t.Optional(e),bashMode:e}),export:t.Optional(t.Object({pageBg:t.Optional(e),cardBg:t.Optional(e),infoBg:t.Optional(e)}))}),l=f(x);function b(i,n){if(!l.Check(n)){const d=Array.from(l.Errors(n)),a=new Set,c=[];for(const o of d){if(o.keyword==="required"&&o.instancePath==="/colors"){const g=o.params.requiredProperties;for(const u of g??[])a.add(u);continue}const h=o.instancePath||"/";c.push(` - ${h}: ${o.message}`)}let r=`Invalid theme "${i}":
2
+ `;throw a.size>0&&(r+=`
3
+ Missing required color tokens:
4
+ `,r+=Array.from(a).sort().map(o=>` - ${o}`).join(`
5
+ `),r+=`
6
+
7
+ Please add these colors to your theme's "colors" object.`,r+=`
8
+ See the built-in themes (dark.json, light.json) for reference values.`),c.length>0&&(r+=`
9
+
10
+ Other errors:
11
+ ${c.join(`
12
+ `)}`),new Error(r)}const s=n;if(s.name.includes("/"))throw new Error(`Invalid theme name "${s.name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);return s}m(b,"validateThemeJson");export{b as validateThemeJson};