dal-code 1.0.57 → 1.0.59

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 (275) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bundle/chunks/{anthropic-messages-ASQGS6BL.js → anthropic-messages-HVFHIIGX.js} +1 -1
  3. package/dist/bundle/chunks/{azure-openai-responses-ZSCUJBSU.js → azure-openai-responses-RMWKIGFW.js} +1 -1
  4. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  5. package/dist/bundle/chunks/{chunk-6SPX3U36.js → chunk-4BOWD7PQ.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-F577XLVZ.js → chunk-4PBY6OYS.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-S7K3JBWA.js → chunk-BBNE2TWS.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-6PQZ4KMC.js → chunk-C5ELI234.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-GPI2GHBH.js → chunk-F52JQCLE.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-MAJODFX6.js → chunk-GZJEAFRS.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-2E7RGBKM.js → chunk-IKSSB5ZJ.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-34D4KVPX.js → chunk-IONGABQF.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-JPCWLZUZ.js → chunk-J6H2LYOZ.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-TNSXMGQB.js → chunk-KQRRELCF.js} +1 -1
  15. package/dist/bundle/chunks/chunk-KT7CXVDN.js +17 -0
  16. package/dist/bundle/chunks/{chunk-YTDTROS5.js → chunk-MPLE6M5C.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-O3XFDBJ3.js → chunk-PMFHJN7I.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-MZ7O6YLD.js → chunk-QU2VEHMW.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-KP7CMLOT.js → chunk-TPOKZ2EU.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-PD6QS7YD.js → chunk-VDPDHGGJ.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-LZTZWS3N.js → chunk-WLQ33LIH.js} +1 -1
  22. package/dist/bundle/chunks/{chunk-FSX34SAZ.js → chunk-X63WCLSX.js} +6 -6
  23. package/dist/bundle/chunks/{chunk-IRSW3MVW.js → chunk-XQF5XDEM.js} +2 -2
  24. package/dist/bundle/chunks/{chunk-XIJS4F22.js → chunk-YOQ3KBG5.js} +1 -1
  25. package/dist/bundle/chunks/{cli-IDAZVEZ2.js → cli-BFWJUYZ5.js} +1 -1
  26. package/dist/bundle/chunks/{cli-NP7QEFQE.js → cli-NQ7B7BGV.js} +1 -1
  27. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-WLKVTF6I.js → cloudflare-workers-ai-system-one-RXFI2EBV.js} +1 -1
  28. package/dist/bundle/chunks/{execute-VXSJSHXH.js → execute-NJRE4WBO.js} +1 -1
  29. package/dist/bundle/chunks/{google-generative-ai-3HIBMVL4.js → google-generative-ai-5F5544G4.js} +1 -1
  30. package/dist/bundle/chunks/{google-vertex-7PIUZFM3.js → google-vertex-4PSVELDG.js} +1 -1
  31. package/dist/bundle/chunks/{llama-cpp-classify-5OLOZHKT.js → llama-cpp-classify-IPNT4VOW.js} +1 -1
  32. package/dist/bundle/chunks/{mcp-GHYUCPI4.js → mcp-F3BQ6MQW.js} +1 -1
  33. package/dist/bundle/chunks/{mistral-conversations-6Y33SI3U.js → mistral-conversations-RSYLYGE4.js} +1 -1
  34. package/dist/bundle/chunks/{office-2JSKOL7V.js → office-UBOUFRAU.js} +1 -1
  35. package/dist/bundle/chunks/{openai-codex-responses-BYGMMTPH.js → openai-codex-responses-OKPZLYIS.js} +1 -1
  36. package/dist/bundle/chunks/{openai-completions-UWYQMOLR.js → openai-completions-BFCQZRZ2.js} +1 -1
  37. package/dist/bundle/chunks/{openai-decisions-I5J7OD62.js → openai-decisions-RJ4MH5XI.js} +1 -1
  38. package/dist/bundle/chunks/{openai-responses-LWVKQGLT.js → openai-responses-PT5MXG3Q.js} +1 -1
  39. package/dist/bundle/chunks/{openrouter-images-BDUFN6XX.js → openrouter-images-ICCH2YHW.js} +1 -1
  40. package/dist/bundle/chunks/{pi-messages-64FHWMQR.js → pi-messages-Z2XWHIYT.js} +1 -1
  41. package/dist/bundle/chunks/{review-OQEOVDLP.js → review-WTYIVWYR.js} +1 -1
  42. package/dist/bundle/chunks/{router-3UQE4LBN.js → router-V3EIAYOF.js} +1 -1
  43. package/dist/bundle/chunks/{runtime-E7KOB62K.js → runtime-FNCZJKOC.js} +1 -1
  44. package/dist/bundle/chunks/{sdk-5V64WBOZ.js → sdk-32L63XRF.js} +1 -1
  45. package/dist/bundle/chunks/sync-Z5USQ7AN.js +21 -0
  46. package/dist/bundle/chunks/{typesafe-system-one-7QFJ5JNW.js → typesafe-system-one-6UYWINOZ.js} +1 -1
  47. package/dist/bundle/chunks/{usage-MG7QDPG2.js → usage-JODQIC2H.js} +1 -1
  48. package/dist/bundle/chunks/{virtual-modules-73ZLFCNE.js → virtual-modules-ERCLFZEY.js} +1 -1
  49. package/dist/bundle/cli-runtime.js +1 -1
  50. package/dist/bundle/index.js +1 -1
  51. package/dist/bundle/rpc-entry.js +1 -1
  52. package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
  53. package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
  54. package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
  55. package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
  56. package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
  57. package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
  58. package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
  59. package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
  60. package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
  61. package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
  62. package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
  63. package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
  64. package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
  65. package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-learn/src/engine.js +3 -3
  67. package/dist/node_modules/@dalcode/dal-learn/src/index.js +11 -11
  68. package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +4 -4
  69. package/dist/node_modules/@dalcode/dal-learn/src/project-map.js +2 -2
  70. package/dist/node_modules/@dalcode/dal-learn/src/signals.js +6 -6
  71. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  72. package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
  73. package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
  74. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +1 -1
  75. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  76. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +1 -1
  77. package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
  78. package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
  79. package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
  80. package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
  81. package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
  82. package/dist/node_modules/@dalcode/dal-router/package.json +6 -6
  83. package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
  84. package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
  85. package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
  86. package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
  87. package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
  88. package/dist/node_modules/@dalcode/dal-sync/package.json +4 -4
  89. package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -4
  90. package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
  91. package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
  92. package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
  93. package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
  94. package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
  95. package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
  96. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  97. package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
  98. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  99. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  100. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  101. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  102. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  103. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  104. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  105. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  106. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  107. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  108. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
  109. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
  110. package/dist/node_modules/@earendil-works/pi-ai/package.json +3 -3
  111. package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
  112. package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  113. package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
  114. package/dist/node_modules/@earendil-works/pi-schema/package.json +1 -1
  115. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  116. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  117. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  118. package/examples/extensions/gondolin/package-lock.json +2 -2
  119. package/examples/extensions/gondolin/package.json +1 -1
  120. package/examples/extensions/with-deps/package-lock.json +2 -2
  121. package/examples/extensions/with-deps/package.json +1 -1
  122. package/npm-shrinkwrap.json +2 -2
  123. package/package.json +1 -1
  124. package/dist/bun/register-bedrock.js +0 -1
  125. package/dist/bundle/chunks/chunk-JPBJUBY4.js +0 -17
  126. package/dist/bundle/chunks/sync-INSWGFSB.js +0 -21
  127. package/dist/cli/experimental/auth.js +0 -1
  128. package/dist/cli/experimental/cli.js +0 -1
  129. package/dist/cli/experimental/command-options.js +0 -1
  130. package/dist/cli/experimental/command.js +0 -1
  131. package/dist/cli/experimental/commands/client.js +0 -1
  132. package/dist/cli/experimental/commands/pi.js +0 -1
  133. package/dist/cli/experimental/commands/server.js +0 -1
  134. package/dist/cli/experimental/transport-address.js +0 -1
  135. package/dist/client/index.js +0 -1
  136. package/dist/client/remote-session.js +0 -1
  137. package/dist/client/transcript.js +0 -1
  138. package/dist/core/provider-attribution.js +0 -1
  139. package/dist/modes/interactive/components/daxnuts.js +0 -1
  140. package/dist/modes/interactive/theme/theme-json.js +0 -12
  141. package/dist/modes/interactive/theme/theme-schema.json +0 -356
  142. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +0 -1
  143. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +0 -37
  144. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +0 -104
  145. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +0 -16
  146. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +0 -1
  147. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +0 -1
  148. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +0 -10
  149. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +0 -1
  150. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +0 -1
  151. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +0 -1
  152. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +0 -1
  153. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +0 -1
  154. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +0 -17
  155. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bash.js +0 -1
  156. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bounded.js +0 -1
  157. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/chord.js +0 -1
  158. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/context.js +0 -1
  159. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/harness.js +0 -1
  160. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/hooks.js +0 -1
  161. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/index.js +0 -1
  162. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/jsonl.js +0 -4
  163. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/collapse.js +0 -3
  164. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/entries.js +0 -1
  165. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/frames.js +0 -1
  166. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/generation.js +0 -1
  167. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/job.js +0 -1
  168. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/plugin.js +0 -1
  169. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/post-tools.js +0 -1
  170. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/task-api.js +0 -1
  171. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/tool.js +0 -3
  172. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/membrane.js +0 -1
  173. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/memory.js +0 -1
  174. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/scheduler.js +0 -1
  175. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/session.js +0 -1
  176. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/system.js +0 -8
  177. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/types.js +0 -1
  178. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/view.js +0 -1
  179. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +0 -5
  180. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -1
  181. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +0 -1
  182. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +0 -1
  183. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +0 -1
  184. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +0 -1
  185. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +0 -1
  186. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +0 -1
  187. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +0 -1
  188. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +0 -1
  189. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +0 -1
  190. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +0 -1
  191. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +0 -1
  192. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +0 -1
  193. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +0 -1
  194. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +0 -1
  195. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +0 -1
  196. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +0 -1
  197. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +0 -1
  198. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +0 -1
  199. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +0 -1
  200. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +0 -1
  201. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +0 -1
  202. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +0 -1
  203. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +0 -1
  204. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +0 -1
  205. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +0 -1
  206. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +0 -1
  207. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +0 -1
  208. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +0 -1
  209. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +0 -1
  210. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -1
  211. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +0 -1
  212. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +0 -1
  213. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +0 -3
  214. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +0 -1
  215. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +0 -1
  216. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +0 -8
  217. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +0 -1
  218. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -1
  219. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -5
  220. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -1
  221. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -1
  222. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -1
  223. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +0 -1
  224. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +0 -1
  225. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -1
  226. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +0 -1
  227. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -1
  228. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +0 -1
  229. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +0 -1
  230. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +0 -1
  231. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +0 -1
  232. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +0 -1
  233. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -1
  234. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +0 -1
  235. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +0 -1
  236. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +0 -1
  237. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +0 -1
  238. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js +0 -0
  239. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +0 -1
  240. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +0 -1
  241. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +0 -10
  242. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +0 -2
  243. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +0 -1
  244. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +0 -12
  245. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +0 -16
  246. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +0 -1
  247. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +0 -1
  248. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +0 -1
  249. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +0 -1
  250. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +0 -1
  251. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +0 -14
  252. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +0 -0
  253. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +0 -1
  254. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +0 -1
  255. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +0 -1
  256. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +0 -5
  257. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +0 -1
  258. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +0 -5
  259. package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +0 -1
  260. package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +0 -1
  261. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +0 -0
  262. package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -1
  263. package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -1
  264. package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +0 -74
  265. package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +0 -1
  266. package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +0 -1
  267. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +0 -1
  268. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +0 -1
  269. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +0 -1
  270. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +0 -1
  271. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +0 -1
  272. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +0 -1
  273. package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.js +0 -1
  274. package/dist/server/create-harness.js +0 -1
  275. package/dist/utils/clipboard-native.js +0 -1
@@ -1,2 +1,2 @@
1
- var Z=Object.defineProperty;var l=(s,t)=>Z(s,"name",{value:t,configurable:!0});var ss=Object.defineProperty,m=l((s,t)=>ss(s,"name",{value:t,configurable:!0}),"d");import{createHash as ts}from"node:crypto";import{readFileSync as es,statSync as as}from"node:fs";import{isAbsolute as T,join as I,normalize as ns,relative as os,resolve as R,sep as is}from"node:path";import{normalizeCommand as M}from"./extract.js";import{isSensitivePath as L}from"./safety.js";import{isSearch as rs}from"./signals.js";import{estimateTokens as D,num as v,readDoc as cs,records as S,str as d,strList as H,updateDoc as ls}from"./store.js";const U=600,F=45,$=120,ps=864e5,fs=40,ms=40,ds=30,us=12,P=["test","build","lint","typecheck","install"];function x(s){return I(s,"map.json")}l(x,"D"),m(x,"mapPath");function w(s){const t={},a=s?.managerVotes;if(a&&typeof a=="object"&&!Array.isArray(a))for(const[e,p]of Object.entries(a))/^(?:npm|pnpm|yarn|bun)$/.test(e)&&(t[e]=v(p));return{commands:S(s?.commands).filter(e=>P.includes(e.kind)&&typeof e.command=="string").map(e=>({...e,kind:e.kind,dir:d(e.dir,200)||".",command:d(e.command,200),successes:v(e.successes),failures:v(e.failures),sessions:H(e.sessions,10,80),lastOkAt:d(e.lastOkAt,32),...d(e.lastFailAt,32)?{lastFailAt:d(e.lastFailAt,32)}:{},...d(e.manifestHash,16)?{manifestHash:d(e.manifestHash,16)}:{}})),managerVotes:t,locations:S(s?.locations).filter(e=>typeof e.query=="string"&&typeof e.path=="string").map(e=>({...e,query:d(e.query,120),path:d(e.path,300),sessions:H(e.sessions,10,80),searches:v(e.searches),lastAt:d(e.lastAt,32)})),hotFiles:S(s?.hotFiles).filter(e=>typeof e.path=="string").map(e=>({...e,path:d(e.path,300),sessions:H(e.sessions,10,80),lastAt:d(e.lastAt,32)})),pitfalls:S(s?.pitfalls).filter(e=>typeof e.bad=="string"&&typeof e.good=="string").map(e=>({...e,bad:d(e.bad,200),good:d(e.good,200),reason:d(e.reason,160),lastAt:d(e.lastAt,32)}))}}l(w,"V"),m(w,"parseMap");function Y(s){return cs(x(s),w).value}l(Y,"hs"),m(Y,"readMap");function q(s,t,a){const e=T(a)?a:R(t,a),p=os(s,ns(e));if(!(p.startsWith("..")||T(p)))return p.split(is).join("/")||"."}l(q,"$"),m(q,"projectRelative");function C(s,t){for(const a of["package.json","pyproject.toml","Cargo.toml","go.mod","Makefile","pom.xml","build.gradle"])try{return ts("sha256").update(es(I(s,t,a))).digest("hex").slice(0,16)}catch{}}l(C,"E"),m(C,"manifestHash");function z(s){return/^(npm|pnpm|yarn|bun|npx|pnpx|bunx)\b/.exec(s)?.[1]?.replace(/^npx$/,"npm").replace(/^pnpx$/,"pnpm").replace(/^bunx$/,"bun")}l(z,"os"),m(z,"managerOf");function E(s){const t=s.args.path??s.args.file_path??s.args.file;return typeof t=="string"&&t?t:void 0}l(E,"R"),m(E,"pathArg");function W(s){const t=s.args.pattern??s.args.query??s.args.glob;if(typeof t=="string"&&t.trim())return t.trim().slice(0,120);if(s.command){const a=/(?:rg|grep|ag|git\s+grep)\s+(?:-[\w-]+\s+)*(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(s.command),e=a?.[1]??a?.[2]??a?.[3];if(e)return e.slice(0,120);const p=/\bfind\b.*-i?name\s+(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(s.command),h=p?.[1]??p?.[2]??p?.[3];if(h)return h.slice(0,120)}}l(W,"rs"),m(W,"queryOf");function j(s,t){return s.includes(t)?s:[...s,t].slice(-10)}l(j,"_"),m(j,"addSession");function B(s,t){const a=new Date(t.now).toISOString(),e=s.commands.map(o=>({...o})),p={...s.managerVotes};for(const o of t.steps){if(!o.intent||!o.command)continue;const i=o.cdDir?R(t.cwd,o.cdDir):t.cwd,c=q(t.root,t.cwd,i);if(!c)continue;const n=M(o.command);if(!n||/<secret>|<opaque>/.test(n))continue;const r=e.find(y=>y.kind===o.intent&&y.dir===c&&y.command===n);if(o.isError){r&&(r.failures++,r.lastFailAt=a);continue}const f=C(t.root,c),u=z(n);u&&(p[u]=(p[u]??0)+1),r?(r.successes++,r.lastOkAt=a,r.sessions=j(r.sessions,t.sessionId),f!==void 0?r.manifestHash=f:delete r.manifestHash):e.push({kind:o.intent,dir:c,command:n,successes:1,failures:0,sessions:[t.sessionId],lastOkAt:a,...f!==void 0?{manifestHash:f}:{}})}const h=s.locations.map(o=>({...o})),k=[];for(const o of t.steps){if(rs(o)&&!o.isError){const f=W(o);f&&k.push({query:f,output:o.output});continue}if(o.name!=="read"||o.isError)continue;const i=E(o);if(!i||L(i))continue;const c=q(t.root,t.cwd,i);if(!c||c===".")continue;const n=c.split("/").at(-1)??c,r=k.filter(f=>f.output.includes(n)||f.output.includes(c));for(const f of r){const u=h.find(y=>y.query===f.query&&y.path===c);u?(u.searches++,u.sessions=j(u.sessions,t.sessionId),u.lastAt=a):h.push({query:f.query,path:c,sessions:[t.sessionId],searches:1,lastAt:a})}r.length>0&&(k.length=0)}const g=s.hotFiles.map(o=>({...o}));for(const o of t.steps){if(o.name!=="read"||o.isError)continue;const i=E(o);if(!i||L(i))continue;const c=q(t.root,t.cwd,i);if(!c||c===".")continue;const n=g.find(r=>r.path===c);n?(n.sessions=j(n.sessions,t.sessionId),n.lastAt=a):g.push({path:c,sessions:[t.sessionId],lastAt:a})}const A=s.pitfalls.map(o=>({...o}));for(const o of t.fixes){const i=M(o.bad),c=M(o.good),n=A.find(r=>r.bad===i&&r.good===c);n?n.lastAt=a:A.push({bad:i,good:c,reason:o.reason,lastAt:a})}return G({commands:e,managerVotes:p,locations:h,hotFiles:g,pitfalls:A},t.now)}l(B,"As"),m(B,"learnFromRun");function b(s,t){const a=Date.parse(s);return Number.isFinite(a)?(t-a)/ps:Number.POSITIVE_INFINITY}l(b,"y"),m(b,"age");function O(s,t){return(t.lastAt??t.lastOkAt??"").localeCompare(s.lastAt??s.lastOkAt??"")}l(O,"S"),m(O,"newestFirst");function G(s,t){return{commands:s.commands.filter(a=>b(a.lastOkAt,t)<=$).sort(O).slice(0,fs),managerVotes:s.managerVotes,locations:s.locations.filter(a=>b(a.lastAt,t)<=$).sort(O).slice(0,ms),hotFiles:s.hotFiles.filter(a=>b(a.lastAt,t)<=$).sort(O).slice(0,ds),pitfalls:s.pitfalls.filter(a=>b(a.lastAt,t)<=$).sort(O).slice(0,us)}}l(G,"as"),m(G,"prune");function K(s,t){return ls(x(s),w,t)}l(K,"bs"),m(K,"updateMap");function V(s,t,a){if(b(s.lastOkAt,a)>F)return"old";if(s.lastFailAt&&s.lastFailAt>s.lastOkAt)return"failed_since";if(s.manifestHash!==void 0){const e=C(t,s.dir);if(e===void 0)return"missing";if(e!==s.manifestHash)return"manifest_changed"}}l(V,"is"),m(V,"commandStaleness");function _(s,t){try{return as(I(s,t)),!0}catch{return!1}}l(_,"v"),m(_,"exists");function J(s,t,a){const e=[],p=[];for(const i of s.commands){const c=V(i,t,a);c?e.push({fact:`${i.kind} ${i.dir}: ${i.command}`,reason:c}):p.push(i)}const h=s.locations.filter(i=>i.sessions.length<2&&i.searches<2||b(i.lastAt,a)>F?!1:_(t,i.path)?!0:(e.push({fact:`${i.query} \u2192 ${i.path}`,reason:"missing"}),!1)),k=s.hotFiles.filter(i=>i.sessions.length>=3&&b(i.lastAt,a)<=F&&_(t,i.path)),g=Object.entries(s.managerVotes).sort((i,c)=>c[1]-i[1]),A=g.length>0&&g[0][1]>=2&&(g[1]?.[1]??0)*3<=g[0][1]?g[0][0]:void 0,o=s.pitfalls.filter(i=>b(i.lastAt,a)<=F);return{commands:p,...A?{manager:A}:{},locations:h,hotFiles:k,pitfalls:o,stale:e}}l(J,"ys"),m(J,"viewMap");const Q="Project facts DAL verified in earlier sessions (commands that passed, where things live). Use them instead of searching again; if one turns out wrong, check and say so.";function X(s,t=U){const a=[];s.manager&&a.push({header:"Package manager:",lines:[`- ${s.manager}`]});const e=[...s.commands].sort((n,r)=>P.indexOf(n.kind)-P.indexOf(r.kind)||n.dir.localeCompare(r.dir)||r.successes-n.successes),p=new Set,h=[];for(const n of e){const r=`${n.kind}:${n.dir}`;p.has(r)||(p.add(r),h.push(`- ${n.kind}${n.dir==="."?"":` (in ${n.dir})`}: \`${n.command}\``))}h.length>0&&a.push({header:"Commands that passed:",lines:h});const k=[...s.locations].sort((n,r)=>n.query.localeCompare(r.query)||n.path.localeCompare(r.path)).map(n=>`- "${n.query}" \u2192 ${n.path}`);k.length>0&&a.push({header:"Where things are:",lines:k});const g=[...s.hotFiles].sort((n,r)=>n.path.localeCompare(r.path)).map(n=>`- ${n.path}`);g.length>0&&a.push({header:"Files used most:",lines:g});const A=[...s.pitfalls].sort((n,r)=>n.bad.localeCompare(r.bad)).map(n=>`- \`${n.bad}\` fails${n.reason?` (${n.reason})`:""}; \`${n.good}\` works`);if(A.length>0&&a.push({header:"Pitfalls:",lines:A}),a.length===0)return{tokens:0,facts:0};const o=[Q];let i=D(Q),c=0;for(const n of a){const r=D(n.header)+1,f=[];let u=r;for(const y of n.lines){const N=D(y)+1;if(i+u+N>t)break;f.push(y),u+=N}f.length!==0&&(o.push(n.header,...f),i+=u,c+=f.length)}return c===0?{tokens:0,facts:0}:{text:o.join(`
2
- `),tokens:i,facts:c}}l(X,"Fs"),m(X,"renderMapSection");export{U as MAP_TOKEN_BUDGET,$ as PRUNE_DAYS,F as STALE_DAYS,V as commandStaleness,B as learnFromRun,x as mapPath,w as parseMap,Y as readMap,X as renderMapSection,K as updateMap,J as viewMap};
1
+ var ts=Object.defineProperty;var d=(s,t)=>ts(s,"name",{value:t,configurable:!0});var es=Object.defineProperty,f=d((s,t)=>es(s,"name",{value:t,configurable:!0}),"f");import{createHash as as}from"node:crypto";import{readFileSync as ns,statSync as os}from"node:fs";import{isAbsolute as L,join as C,normalize as is,relative as rs,resolve as U,sep as cs}from"node:path";import{normalizeCommand as D}from"./extract.js";import{isSensitivePath as Y}from"./safety.js";import{isSearch as ls,passedLast as ds,sameChecks as H}from"./signals.js";import{estimateTokens as P,num as S,readDoc as ps,records as q,str as u,strList as E,updateDoc as fs}from"./store.js";const z=600,O=45,w=120,ms=864e5,us=40,hs=40,gs=30,As=12,V=["test","build","lint","typecheck","install"];function j(s){return C(s,"map.json")}d(j,"w"),f(j,"mapPath");function M(s){const t={},a=s?.managerVotes;if(a&&typeof a=="object"&&!Array.isArray(a))for(const[e,p]of Object.entries(a))/^(?:npm|pnpm|yarn|bun)$/.test(e)&&(t[e]=S(p));return{commands:q(s?.commands).filter(e=>V.includes(e.kind)&&typeof e.command=="string").map(e=>({...e,kind:e.kind,dir:u(e.dir,200)||".",command:u(e.command,200),successes:S(e.successes),failures:S(e.failures),sessions:E(e.sessions,10,80),lastOkAt:u(e.lastOkAt,32),...u(e.lastFailAt,32)?{lastFailAt:u(e.lastFailAt,32)}:{},...u(e.manifestHash,16)?{manifestHash:u(e.manifestHash,16)}:{}})),managerVotes:t,locations:q(s?.locations).filter(e=>typeof e.query=="string"&&typeof e.path=="string").map(e=>({...e,query:u(e.query,120),path:u(e.path,300),sessions:E(e.sessions,10,80),searches:S(e.searches),lastAt:u(e.lastAt,32)})),hotFiles:q(s?.hotFiles).filter(e=>typeof e.path=="string").map(e=>({...e,path:u(e.path,300),sessions:E(e.sessions,10,80),lastAt:u(e.lastAt,32)})),pitfalls:q(s?.pitfalls).filter(e=>typeof e.bad=="string"&&typeof e.good=="string").map(e=>({...e,bad:u(e.bad,200),good:u(e.good,200),reason:u(e.reason,160),lastAt:u(e.lastAt,32)}))}}d(M,"E"),f(M,"parseMap");function W(s){return ps(j(s),M).value}d(W,"ys"),f(W,"readMap");function F(s,t,a){const e=L(a)?a:U(t,a),p=rs(s,is(e));if(!(p.startsWith("..")||L(p)))return p.split(cs).join("/")||"."}d(F,"P"),f(F,"projectRelative");function _(s,t){for(const a of["package.json","pyproject.toml","Cargo.toml","go.mod","Makefile","pom.xml","build.gradle"])try{return as("sha256").update(ns(C(s,t,a))).digest("hex").slice(0,16)}catch{}}d(_,"R"),f(_,"manifestHash");function B(s){return/^(npm|pnpm|yarn|bun|npx|pnpx|bunx)\b/.exec(s)?.[1]?.replace(/^npx$/,"npm").replace(/^pnpx$/,"pnpm").replace(/^bunx$/,"bun")}d(B,"is"),f(B,"managerOf");function N(s){const t=s.args.path??s.args.file_path??s.args.file;return typeof t=="string"&&t?t:void 0}d(N,"v"),f(N,"pathArg");function G(s){const t=s.args.pattern??s.args.query??s.args.glob;if(typeof t=="string"&&t.trim())return t.trim().slice(0,120);if(s.command){const a=/(?:rg|grep|ag|git\s+grep)\s+(?:-[\w-]+\s+)*(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(s.command),e=a?.[1]??a?.[2]??a?.[3];if(e)return e.slice(0,120);const p=/\bfind\b.*-i?name\s+(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(s.command),h=p?.[1]??p?.[2]??p?.[3];if(h)return h.slice(0,120)}}d(G,"cs"),f(G,"queryOf");function I(s,t){return s.includes(t)?s:[...s,t].slice(-10)}d(I,"H"),f(I,"addSession");function K(s,t){const a=new Date(t.now).toISOString(),e=s.commands.map(n=>({...n})),p={...s.managerVotes};for(const n of t.steps){if(!n.intent||!n.command)continue;const o=n.cdDir?U(t.cwd,n.cdDir):t.cwd,i=F(t.root,t.cwd,o);if(!i)continue;const l=D(n.command);if(!l||/<secret>|<opaque>/.test(l))continue;const c=e.find(v=>v.kind===n.intent&&v.dir===i&&H(v.command,l));if(n.isError){c&&(c.failures++,c.lastFailAt=a);continue}const m=_(t.root,i),A=B(l);A&&(p[A]=(p[A]??0)+1),c?(c.successes++,c.lastOkAt=a,c.sessions=I(c.sessions,t.sessionId),m!==void 0?c.manifestHash=m:delete c.manifestHash):e.push({kind:n.intent,dir:i,command:l,successes:1,failures:0,sessions:[t.sessionId],lastOkAt:a,...m!==void 0?{manifestHash:m}:{}})}const h=s.locations.map(n=>({...n})),k=[];for(const n of t.steps){if(ls(n)&&!n.isError){const m=G(n);m&&k.push({query:m,output:n.output});continue}if(n.name!=="read"||n.isError)continue;const o=N(n);if(!o||Y(o))continue;const i=F(t.root,t.cwd,o);if(!i||i===".")continue;const l=i.split("/").at(-1)??i,c=k.filter(m=>m.output.includes(l)||m.output.includes(i));for(const m of c){const A=h.find(v=>v.query===m.query&&v.path===i);A?(A.searches++,A.sessions=I(A.sessions,t.sessionId),A.lastAt=a):h.push({query:m.query,path:i,sessions:[t.sessionId],searches:1,lastAt:a})}c.length>0&&(k.length=0)}const g=s.hotFiles.map(n=>({...n}));for(const n of t.steps){if(n.name!=="read"||n.isError)continue;const o=N(n);if(!o||Y(o))continue;const i=F(t.root,t.cwd,o);if(!i||i===".")continue;const l=g.find(c=>c.path===i);l?(l.sessions=I(l.sessions,t.sessionId),l.lastAt=a):g.push({path:i,sessions:[t.sessionId],lastAt:a})}const y=F(t.root,t.cwd,t.cwd),$=s.pitfalls.map(n=>({...n}));for(const n of t.fixes){const o=D(n.bad),i=D(n.good),l=$.find(c=>(c.dir??".")===(y||".")&&H(c.bad,o)&&H(c.good,i));l?l.lastAt=a:$.push({bad:o,good:i,reason:n.reason,lastAt:a,...y?{dir:y}:{}})}const r=$.filter(n=>!y||(n.dir??".")!==y||!ds(t.steps,n.bad));return J({commands:e,managerVotes:p,locations:h,hotFiles:g,pitfalls:r},t.now)}d(K,"xs"),f(K,"learnFromRun");function b(s,t){const a=Date.parse(s);return Number.isFinite(a)?(t-a)/ms:Number.POSITIVE_INFINITY}d(b,"x"),f(b,"age");function x(s,t){return(t.lastAt??t.lastOkAt??"").localeCompare(s.lastAt??s.lastOkAt??"")}d(x,"C"),f(x,"newestFirst");function J(s,t){return{commands:s.commands.filter(a=>b(a.lastOkAt,t)<=w).sort(x).slice(0,us),managerVotes:s.managerVotes,locations:s.locations.filter(a=>b(a.lastAt,t)<=w).sort(x).slice(0,hs),hotFiles:s.hotFiles.filter(a=>b(a.lastAt,t)<=w).sort(x).slice(0,gs),pitfalls:s.pitfalls.filter(a=>b(a.lastAt,t)<=w).sort(x).slice(0,As)}}d(J,"ls"),f(J,"prune");function Q(s,t){return fs(j(s),M,t)}d(Q,"Fs"),f(Q,"updateMap");function T(s,t,a){if(b(s.lastOkAt,a)>O)return"old";if(s.lastFailAt&&s.lastFailAt>s.lastOkAt)return"failed_since";if(s.manifestHash!==void 0){const e=_(t,s.dir);if(e===void 0)return"missing";if(e!==s.manifestHash)return"manifest_changed"}}d(T,"ds"),f(T,"commandStaleness");function R(s,t){try{return os(C(s,t)),!0}catch{return!1}}d(R,"N"),f(R,"exists");function X(s,t,a){const e=[],p=[];for(const r of s.commands){const n=T(r,t,a);n?e.push({fact:`${r.kind} ${r.dir}: ${r.command}`,reason:n}):p.push(r)}const h=s.locations.filter(r=>r.sessions.length<2&&r.searches<2||b(r.lastAt,a)>O?!1:R(t,r.path)?!0:(e.push({fact:`${r.query} \u2192 ${r.path}`,reason:"missing"}),!1)),k=s.hotFiles.filter(r=>r.sessions.length>=3&&b(r.lastAt,a)<=O&&R(t,r.path)),g=Object.entries(s.managerVotes).sort((r,n)=>n[1]-r[1]),y=g.length>0&&g[0][1]>=2&&(g[1]?.[1]??0)*3<=g[0][1]?g[0][0]:void 0,$=s.pitfalls.filter(r=>b(r.lastAt,a)<=O);return{commands:p,...y?{manager:y}:{},locations:h,hotFiles:k,pitfalls:$,stale:e}}d(X,"ks"),f(X,"viewMap");const Z="Project facts DAL verified in earlier sessions (commands that passed, where things live). Use them instead of searching again; if one turns out wrong, check and say so.";function ss(s,t=z){const a=[];s.manager&&a.push({header:"Package manager:",lines:[`- ${s.manager}`]});const e=[...s.commands].sort((o,i)=>V.indexOf(o.kind)-V.indexOf(i.kind)||o.dir.localeCompare(i.dir)||i.successes-o.successes),p=new Set,h=[];for(const o of e){const i=`${o.kind}:${o.dir}`;p.has(i)||(p.add(i),h.push(`- ${o.kind}${o.dir==="."?"":` (in ${o.dir})`}: \`${o.command}\``))}h.length>0&&a.push({header:"Commands that passed:",lines:h});const k=[...s.locations].sort((o,i)=>o.query.localeCompare(i.query)||o.path.localeCompare(i.path)).map(o=>`- "${o.query}" \u2192 ${o.path}`);k.length>0&&a.push({header:"Where things are:",lines:k});const g=[...s.hotFiles].sort((o,i)=>o.path.localeCompare(i.path)).map(o=>`- ${o.path}`);g.length>0&&a.push({header:"Files used most:",lines:g});const y=[...s.pitfalls].sort((o,i)=>o.bad.localeCompare(i.bad)).map(o=>`- \`${o.bad}\` fails${o.reason?` (${o.reason})`:""}; \`${o.good}\` works`);if(y.length>0&&a.push({header:"Pitfalls:",lines:y}),a.length===0)return{tokens:0,facts:0};const $=[Z];let r=P(Z),n=0;for(const o of a){const i=P(o.header)+1,l=[];let c=i;for(const m of o.lines){const A=P(m)+1;if(r+c+A>t)break;l.push(m),c+=A}l.length!==0&&($.push(o.header,...l),r+=c,n+=l.length)}return n===0?{tokens:0,facts:0}:{text:$.join(`
2
+ `),tokens:r,facts:n}}d(ss,"Ms"),f(ss,"renderMapSection");export{z as MAP_TOKEN_BUDGET,w as PRUNE_DAYS,O as STALE_DAYS,T as commandStaleness,K as learnFromRun,j as mapPath,M as parseMap,F as projectRelative,W as readMap,ss as renderMapSection,Q as updateMap,X as viewMap};
@@ -1,6 +1,6 @@
1
- var ue=Object.defineProperty;var c=(e,t)=>ue(e,"name",{value:t,configurable:!0});var pe=Object.defineProperty,a=c((e,t)=>pe(e,"name",{value:t,configurable:!0}),"a");import{isSensitivePath as fe,redact as b}from"./safety.js";const me=new Set(["bash","powershell","shell"]),be=4e3;function y(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&t.type==="text").map(t=>t.text).join(`
2
- `):""}c(y,"k"),a(y,"textOf");function C(e){let t=e.trim(),n;for(;;){const o=/^cd\s+("[^"]+"|'[^']+'|[^\s;&|]+)\s*(?:&&|;)\s*/.exec(t);if(o){const i=o[1].replace(/^["']|["']$/g,"");n=n&&!i.startsWith("/")?`${n}/${i}`:i,t=t.slice(o[0].length);continue}const s=/^(?:[A-Z_][A-Z0-9_]*=(?:"[^"]*"|'[^']*'|\S*)\s+)+/.exec(t);if(s){t=t.slice(s[0].length);continue}break}return{command:t,...n?{cdDir:n}:{}}}c(C,"U"),a(C,"splitCommand");const Z=[["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|$)/]],ge=[/^# fail [1-9]/m,/^npm (?:ERR!|error) (?:code ELIFECYCLE|Lifecycle script|Test failed)/m,/^\s*Tests:\s+\d+ failed/m,/^\s*Test Files\s+\d+ failed/m,/^=+ .*\b\d+ (?:failed|errors?)\b.* =+$/m,/^\s+\d+ failing$/m,/^(?:FAIL|--- FAIL:?)\s/m,/test result: FAILED/,/^make(?:\[\d+\])?: \*\*\* .*Error \d+/m,/\berror TS\d+:/,/^Found \d+ errors? in \d+ files?/m,/^not ok \d+\b(?![^\n]*#\s*(?:TODO|SKIP)\b)/m],he=[/^# fail 0\b/m,/^\s*Tests:\s+(?:\d+ (?:skipped|todo), )*\d+ passed/m,/^\s*Test Files\s+\d+ passed/m,/^=+ .*\b\d+ passed\b.* =+$/m,/^\s+\d+ passing\b/m,/^ok\s+\S+\s+[\d.]+s$/m,/test result: ok\b/,/^Found 0 errors\b/m],ke=/^(?:tail|head|grep|egrep|fgrep|cat|less|more|tee|wc|sort|uniq|cut|column|sed|awk|nl)\b/,ye=/^(?:head|grep|egrep|fgrep|cut|sed|awk)\b/,$e=/^(?: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 G(e){const t=e.replace(/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n[ \t]*\2[ \t]*(?=\n|$)/g,"<<$2$3").replace(/\s*\d*>&\d+/g,""),n=[];let o=[],s="",i;const r=a(()=>{o.push(s.trim()),s=""},"endStage"),l=a(()=>{r();const d=o.filter(Boolean);d.length&&n.push(d),o=[]},"endStatement");for(let d=0;d<t.length;d++){const u=t[d];if(i){if(u==="\\"&&i==='"'){s+=u+(t[d+1]??""),d++;continue}u===i&&(i=void 0),s+=u;continue}u==="'"||u==='"'?(i=u,s+=u):u==="\\"?(s+=u+(t[d+1]??""),d++):u===";"||u===`
3
- `?l():(u==="&"||u==="|")&&t[d+1]===u?(l(),d++):u==="&"?l():u==="|"?r():s+=u}return l(),n}c(G,"H"),a(G,"splitStatements");function $(e){const t=[];let n=!1;for(const o of G(e)){const s=[...o];let i=!1;for(;s.length>1&&ke.test(s.at(-1));)ye.test(s.at(-1))&&(i=!0),s.pop();const r=s.join(" | ").replace(/\s+/g," ");/^cd\s/.test(r)?t.push(r):!$e.test(r)&&v(r)&&(t.push(r),i&&(n=!0))}for(;t.length&&/^cd\s/.test(t.at(-1));)t.pop();return{statements:t,selected:n}}c($,"E"),a($,"checkParts");function w(e){const{statements:t}=$(e);return t.length?t.join(" && "):void 0}c(w,"$"),a(w,"checkCommand");function j(e){return he.some(t=>t.test(e))}c(j,"W"),a(j,"reportsPass");function J(e){return w(e)??e.replace(/\s+/g," ").trim()}c(J,"$t"),a(J,"bareCommand");function R(e){return ge.some(t=>t.test(e))}c(R,"X"),a(R,"reportsFailure");function v(e){for(const[t,n]of Z)if(n.test(e))return t}c(v,"x"),a(v,"intentOf");function A(e){const t=w(e)?.split(" && ").filter(n=>!/^cd\s/.test(n))??[];for(const[n,o]of Z)if(t.some(s=>o.test(s)))return n}c(A,"Y"),a(A,"commandIntent");function O(e){const t=new Map;for(const o of e)if(o?.role==="toolResult"&&typeof o.toolCallId=="string"){const s=y(o.content);t.set(o.toolCallId,{isError:o.isError===!0,output:s.slice(0,be),failing:R(s),passing:j(s)})}const n=[];for(const o of e)if(!(o?.role!=="assistant"||!Array.isArray(o.content)))for(const s of o.content){if(s?.type!=="toolCall"||typeof s.name!="string")continue;const i=typeof s.id=="string"?s.id:"",r=s.arguments&&typeof s.arguments=="object"?s.arguments:{},l=t.get(i);if(!l)continue;const d={id:i,name:s.name,args:r,isError:l.isError,output:l.output};if(me.has(s.name)&&typeof r.command=="string"){const u=C(r.command);d.command=u.command,u.cdDir&&(d.cdDir=u.cdDir);const m=A(u.command);m&&(d.intent=m),m&&re.has(m)&&!d.isError&&l.failing?(d.isError=!0,d.swallowedFailure=!0):m&&!d.isError&&!l.passing&&$(u.command).selected&&(d.unverifiedPass=!0)}n.push(d)}return n}c(O,"Z"),a(O,"toolSteps");const K=120,X=/^(?: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)/,H=/^(?:>?\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|=>|[;{]$/,Y=/^(?:(?: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)/,we=/^(?:E\s+)?(?:Uncaught\s+)?(?:[A-Z][\w.]*(?:Error|Exception)|Error|error(?: TS\d+|\[E\d+\])?)(?:\s*\[[\w-]+\])?:\s*\S|\berror TS\d+:\s*\S/,ve=/^(?:expected\b.*\b(?:received|to (?:be|equal)|but got)\b|(?:Expected|Received)(?: value)?:\s*\S|.+\s!==?\s.+)/i,Ee=/^(?:FAIL(?:ED)?\b|not ok \d+|[✖×✗]\s|--- FAIL:?)/,Se=/not found|no such|cannot|can't|unable|error|fail|missing|denied|unknown|invalid|找不到|不存在|失败|错误/i;function Q(e){const t=e.trim().replace(/^#\s?/,"").trim();return t!==""&&(X.test(t)||H.test(t)||Y.test(t))}c(Q,"Rt"),a(Q,"isUntellingReason");function V(e){const t=e.findIndex(s=>ve.test(s));if(t<0)return;const n=e[t],o=/^Expected(?: value)?:/i.test(n)?e.slice(t+1,t+4).find(s=>/^Received(?: value)?:/i.test(s)):void 0;return o?`${n}, ${o}`:n}c(V,"et"),a(V,"comparison");function ee(e){const t=b(e).replace(/\s+/g," ").trim();return t.length>K?`${t.slice(0,K-1)}\u2026`:t}c(ee,"nt"),a(ee,"clipReason");function te(e){const t=[];for(let n=0;n<e.length;n++){const o=/^error:\s*(.*)$/.exec(e[n]);if(!o)continue;let s=o[1].replace(/^'(.*)'$/,"$1").replace(/^"(.*)"$/,"$1");if(/^\|-?$/.test(s)){const r=[];for(let l=n+1;l<e.length&&r.length<2&&!/^[a-z_]+:\s/i.test(e[l]);l++)r.push(e[l]);s=r.join(" ")}if(!s||s==="test failed")continue;let i="";for(let r=n+1;r<Math.min(e.length,n+12)&&!/^(?:\.{3}|not ok|ok)\b/.test(e[r]);r++){const l=/^name:\s*'?([\w.]+)'?$/.exec(e[r]);if(l){i=l[1];break}}t.push(i&&!s.startsWith(i)?`${i}: ${s}`:s)}return t}c(te,"st"),a(te,"tapErrors");function T(e){const t=e.split(/\r?\n/).map(s=>s.trim().replace(/^#\s?/,"").trim()).filter(Boolean),n=t.filter(s=>!X.test(s)&&!H.test(s)&&!Y.test(s)),o=te(t)[0]??n.find(s=>we.test(s))??V(n)??n.find(s=>Ee.test(s))??n.find(s=>Se.test(s))??"";return ee(o)}c(T,"ot"),a(T,"failureReason");function h(e){let t="";const n=[];for(const o of $(e).statements){const s=/^cd\s+("[^"]+"|'[^']+'|\S+)$/.exec(o);if(s){const r=s[1].replace(/^["']|["']$/g,"");t=t&&!r.startsWith("/")?`${t}/${r}`:r;continue}const i=o.replace(/\s+/g," ").trim();n.some(r=>r.dir===t&&r.check===i)||n.push({dir:t,check:i,...v(i)?{intent:v(i)}:{}})}return n}c(h,"h"),a(h,"segmentsOf");function se(e,t){return e===t||` ${e} `.includes(` ${t} `)||` ${t} `.includes(` ${e} `)}c(se,"rt"),a(se,"overlaps");function _(e,t){const n=h(e),o=h(t),s=a((p,f)=>p.dir===f.dir&&p.check===f.check,"same"),i=n.filter(p=>!o.some(f=>s(p,f)));if(i.length===0)return;const r=new Set(i.map(p=>p.intent)),l=o.filter(p=>!n.some(f=>s(p,f))||r.has(p.intent)),d=i.filter(p=>l.some(f=>f.intent===p.intent));if(d.length===0||l.length===0||[...d,...l].some(p=>/^(?:\/|~|\$)/.test(p.dir))||d.some(p=>l.some(f=>f.dir===p.dir&&se(p.check,f.check))))return;const u=a(p=>{const f=p[0].dir;if(p.some(x=>x.dir!==f))return;const W=p.map(x=>x.check).join(" && ");return f?`cd ${f} && ${W}`:W},"joined"),m=u(d),S=u(l);if(!(!m||!S||m===S))return{bad:m,good:S}}c(_,"it"),a(_,"fixCommands");function ne(e,t,n=!1){const o=h(e),s=h(t);if(s.length===0)return!1;const i=a((r,l)=>r.some(d=>d.dir===l.dir&&d.check===l.check),"has");return s.every(r=>i(o,r))&&(!n||o.every(r=>i(s,r)))}c(ne,"Ct"),a(ne,"runsChecks");function F(e){return e.cdDir?`cd ${e.cdDir} && ${e.command??""}`:e.command??""}c(F,"I"),a(F,"located");const xe=/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,Ce=/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 D(e){return Ce.test(e)&&!xe.test(e)}c(D,"lt"),a(D,"codeFailed");function I(e){const t=[],n=new Set;for(let o=0;o<e.length;o++){const s=e[o];if(!(!s.isError||!s.intent||!s.command||n.has(s.id))&&!D(s.output))for(let i=o+1;i<e.length;i++){const r=e[i];if(r.intent!==s.intent||!r.command||r.isError||r.unverifiedPass)continue;const l=_(F(s),F(r));if(!l)break;n.add(s.id),t.push({intent:s.intent,failed:s,fixed:r,...l,reason:T(s.output),proven:r.intent!=="install"});break}}return t}c(I,"dt"),a(I,"fixPairs");const je=/(?:^|[\s,.!?,。!?])(?:不对|不是这样|错了|搞错|弄错|别这样|不要这样|我说的是|我的意思是|应该是|你又|还是不行|还是错|并不是|别用|不要用|改用)|\b(?:that'?s (?:not|wrong)|not what I (?:asked|meant|said)|you (?:broke|missed|forgot)|wrong (?:file|approach|command)|I said|still (?:broken|failing|wrong)|don'?t use|use \S+ instead|try again)\b/iu;function P(e){return je.test(e)}c(P,"ft"),a(P,"isCorrection");const Re=/dal-guard|safety.?net|blocked by|was blocked|refused by|not allowed by|用户已拒绝|已拦截|拦截了|需要交互式审批|已被拦下|保护拒绝/i;function L(e){return e.isError&&Re.test(e.output)}c(L,"mt"),a(L,"isDenial");const Ae=new Set(["grep","find","ls","glob"]);function N(e){return Ae.has(e.name)?!0:!!e.command&&/^(?:rg|grep|ag|find|fd|ls|git\s+grep)\b/.test(e.command)}c(N,"bt"),a(N,"isSearch");function M(e){return`${e.name}:${JSON.stringify(e.args)}`}c(M,"_"),a(M,"callKey");function U(e){const t=new Map;for(const o of e)t.set(M(o),(t.get(M(o))??0)+1);if([...t.values()].some(o=>o>=3)||e.filter(o=>o.isError).length>=3)return!0;let n=0;for(const o of e)if(n=N(o)?n+1:0,n>=6)return!0;return!1}c(U,"ht"),a(U,"isDetour");function oe(e,t){const n=e,o=y(n.find(r=>r?.role==="user")?.content),s=n.filter(r=>r?.role==="assistant").map(r=>y(r.content)).filter(Boolean).join(`
4
- `),i=O(e);return{userPrompt:o,assistantText:s,steps:i,fixes:I(i),corrected:!!t?.trim()&&P(o),detour:U(i),denials:i.filter(L)}}c(oe,"vt"),a(oe,"analyzeRun");function q(e){return e.corrected||e.detour||e.denials.length>0}c(q,"yt"),a(q,"needsModel");const re=new Set(["test","build","lint","typecheck"]);function E(e){const t=e.findLast(n=>n.intent!==void 0&&re.has(n.intent));if(t)return t.isError?"failed":"passed"}c(E,"L"),a(E,"verifiedOutcome");function ie(e,t){return t.length>0&&E(e.steps)!==void 0}c(ie,"At"),a(ie,"needsReflection");const ae=25;function ce(e){return e.steps.length>=ae&&E(e.steps)==="passed"&&!q(e)}c(ce,"It"),a(ce,"longSuccess");const k={user:800,assistant:600,toolCall:300,toolOutput:400},z=12e3;function g(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t)}\u2026`:n}c(g,"b"),a(g,"clip");const Oe=/(?:^|\/)(?:package\.json|package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|requirements[^/]*\.txt|pyproject\.toml|poetry\.lock|Pipfile(?:\.lock)?|Cargo\.(?:toml|lock)|go\.(?:mod|sum)|Gemfile(?:\.lock)?|composer\.(?:json|lock)|\.gitlab-ci\.yml|\.github\/workflows\/[^/]+)$/,Te=/(?:^|[;&|]\s*)(?:npm\s+(?:i|install|add|uninstall|rm)\b(?=[^;&|]*\s[@a-z])|pnpm\s+(?:add|remove|i\s+\S|install\s+\S)|yarn\s+(?:add|remove)\b|bun\s+(?:add|remove)\b|pip3?\s+install\s+(?!-r\b|-e\b|\.)\S|poetry\s+add\b|cargo\s+add\b|go\s+get\b)/,_e=/(?:>>?|\btee\b|\bsed\s+-i\b|\bnpm\s+pkg\s+set\b)[^;&|]*(?:package\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|requirements[^/\s]*\.txt|pyproject\.toml|Cargo\.toml|go\.mod)/;function le(e){const t=new Set;for(const n of e){if(n.isError)continue;const o=B(n);o&&/^(?:edit|write|multiedit|apply_patch|str_replace)/i.test(n.name)&&Oe.test(o.replace(/\\/g,"/"))&&t.add(o.split(/[\\/]/).at(-1));const s=n.command??(typeof n.args.command=="string"?n.args.command:"");if(!s)continue;Te.test(s)&&t.add("dependencies");const i=_e.exec(s);i&&t.add(i[0].match(/[\w.-]+$/)?.[0]??"package.json")}return[...t]}c(le,"_t"),a(le,"protectedChanges");function B(e){const t=e.args.path??e.args.file_path??e.args.file;return typeof t=="string"?t:""}c(B,"N"),a(B,"pathArg");function de(e,t){const n=[];t&&n.push(`[previous answer] ${g(b(t),k.assistant)}`),n.push(`[user] ${g(b(e.userPrompt),k.user)}`);for(const s of e.steps){const i=s.command??JSON.stringify(s.args),r=fe(B(s))||(s.command?/\.env\b|auth\.json|id_rsa|\.pem\b/.test(s.command):!1);n.push(`[tool ${s.name}] ${g(b(i),k.toolCall)}`);const l=r?"(content of a sensitive file left out)":g(b(s.output),k.toolOutput);n.push(`[tool_output${s.isError?" \xB7 error":""}] ${l}`)}e.assistantText&&n.push(`[assistant] ${g(b(e.assistantText),k.assistant)}`);let o=n.join(`
5
- `);for(;o.length>z&&n.length>3;)n.splice(t?2:1,1),o=n.join(`
6
- `);return o.slice(0,z)}c(de,"Ot"),a(de,"buildExcerpt");export{ae as LONG_RUN_TOOL_CALLS,z as MAX_EXCERPT_CHARS,oe as analyzeRun,J as bareCommand,de as buildExcerpt,w as checkCommand,D as codeFailed,A as commandIntent,T as failureReason,_ as fixCommands,I as fixPairs,P as isCorrection,L as isDenial,U as isDetour,N as isSearch,Q as isUntellingReason,ce as longSuccess,q as needsModel,ie as needsReflection,le as protectedChanges,R as reportsFailure,j as reportsPass,ne as runsChecks,C as splitCommand,O as toolSteps,E as verifiedOutcome};
1
+ var At=Object.defineProperty;var l=(t,e)=>At(t,"name",{value:e,configurable:!0});var Ft=Object.defineProperty,i=l((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"a");import{isSensitivePath as _t,redact as b}from"./safety.js";const Pt=new Set(["bash","powershell","shell"]),It=4e3;function E(t){return typeof t=="string"?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&e.type==="text").map(e=>e.text).join(`
2
+ `):""}l(E,"$"),i(E,"textOf");function F(t){let e=t.trim(),n;for(;;){const o=/^cd\s+("[^"]+"|'[^']+'|[^\s;&|]+)\s*(?:&&|;)\s*/.exec(e);if(o){const r=o[1].replace(/^["']|["']$/g,"");n=n&&!r.startsWith("/")?`${n}/${r}`:r,e=e.slice(o[0].length);continue}const s=/^(?:[A-Z_][A-Z0-9_]*=(?:"[^"]*"|'[^']*'|\S*)\s+)+/.exec(e);if(s){e=e.slice(s[0].length);continue}break}return{command:e,...n?{cdDir:n}:{}}}l(F,"V"),i(F,"splitCommand");function y(t){const e=String.raw`(?:\s+(?:-{1,2}[\w-]+(?:=\S+|\s+[^\s-]\S*)?|workspace\s+\S+|workspaces(?:\s+foreach)?))*`;return[String.raw`\b(?:npm|pnpm|yarn|bun)${e}\s+(?:run\s+)?(?:${t})\b`,String.raw`\bturbo\s+(?:run\s+)?(?:[^\s-]\S*\s+)*?(?:${t})(?![\w-])`,String.raw`\bnx\s+(?:run\s+\S+:|(?:run-many|affected)\b.*?(?:-t|--targets?)(?:=|\s+)(?:\S*,)?)?(?:${t})(?![\w-])`].join("|")}l(y,"w"),i(y,"scriptPattern");const Q=[["typecheck",new RegExp(String.raw`\btsc\b(?!.*--build)|\bmypy\b|\bpyright\b|${y("typecheck|type-check|check-types")}`)],["test",new RegExp(String.raw`\b(?:vitest|jest|mocha|ava|pytest|tox|rspec|phpunit)\b|${y("test")}|\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",new RegExp(String.raw`\b(?:eslint|biome|ruff|flake8|pylint|golangci-lint|clippy|prettier\s+--check)\b|${y("lint|check")}`)],["build",new RegExp(String.raw`${y("build")}|\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|$)/]],Lt=[/^# fail [1-9]/m,/^npm (?:ERR!|error) (?:code ELIFECYCLE|Lifecycle script|Test failed)/m,/^\s*Tests:\s+\d+ failed/m,/^\s*Test Files\s+\d+ failed/m,/^=+ .*\b\d+ (?:failed|errors?)\b.* =+$/m,/^\s+\d+ failing$/m,/^(?:FAIL|--- FAIL:?)\s/m,/test result: FAILED/,/^make(?:\[\d+\])?: \*\*\* .*Error \d+/m,/\berror TS\d+:/,/^Found \d+ errors? in \d+ files?/m,/^not ok \d+\b(?![^\n]*#\s*(?:TODO|SKIP)\b)/m],Dt=[/^# fail 0\b/m,/^\s*Tests:\s+(?:\d+ (?:skipped|todo), )*\d+ passed/m,/^\s*Test Files\s+\d+ passed/m,/^=+ .*\b\d+ passed\b.* =+$/m,/^\s+\d+ passing\b/m,/^ok\s+\S+\s+[\d.]+s$/m,/test result: ok\b/,/^Found 0 errors\b/m],Nt=/^(?:tail|head|grep|egrep|fgrep|cat|less|more|tee|wc|sort|uniq|cut|column|sed|awk|nl)\b/,Wt=/^(?:head|grep|egrep|fgrep|cut|sed|awk)\b/,Mt=/^(?: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 V(t){const e=t.replace(/<<-?\s*(['"]?)(\w+)\1([^\n]*)\n[\s\S]*?\n[ \t]*\2[ \t]*(?=\n|$)/g,"<<$2$3").replace(/\s*\d*>&\d+/g,""),n=[];let o=[],s="",r;const a=i(()=>{o.push(s.trim()),s=""},"endStage"),c=i(()=>{a();const u=o.filter(Boolean);u.length&&n.push(u),o=[]},"endStatement");for(let u=0;u<e.length;u++){const d=e[u];if(r){if(d==="\\"&&r==='"'){s+=d+(e[u+1]??""),u++;continue}d===r&&(r=void 0),s+=d;continue}d==="'"||d==='"'?(r=d,s+=d):d==="\\"?(s+=d+(e[u+1]??""),u++):d===";"||d===`
3
+ `?c():(d==="&"||d==="|")&&e[u+1]===d?(c(),u++):d==="&"?c():d==="|"?a():s+=d}return c(),n}l(V,"nt"),i(V,"splitStatements");function j(t){const e=[];let n=!1;for(const o of V(t)){const s=[...o];let r=!1;for(;s.length>1&&Nt.test(s.at(-1));)Wt.test(s.at(-1))&&(r=!0),s.pop();const a=s.join(" | ").replace(/\s+/g," ");/^cd\s/.test(a)?e.push(a):!Mt.test(a)&&I(a)&&(e.push(a),r&&(n=!0))}for(;e.length&&/^cd\s/.test(e.at(-1));)e.pop();return{statements:e,selected:n}}l(j,"T"),i(j,"checkParts");function C(t){const{statements:e}=j(t);return e.length?e.join(" && "):void 0}l(C,"I"),i(C,"checkCommand");function _(t){return Dt.some(e=>e.test(t))}l(_,"st"),i(_,"reportsPass");function Y(t){return C(t)??t.replace(/\s+/g," ").trim()}l(Y,"zt"),i(Y,"bareCommand");function P(t){return Lt.some(e=>e.test(t))}l(P,"rt"),i(P,"reportsFailure");function I(t){for(const[e,n]of Q)if(n.test(t))return e}l(I,"_"),i(I,"intentOf");function L(t){const e=C(t)?.split(" && ").filter(n=>!/^cd\s/.test(n))??[];for(const[n,o]of Q)if(e.some(s=>o.test(s)))return n}l(L,"ot"),i(L,"commandIntent");function D(t){const e=new Map;for(const o of t)if(o?.role==="toolResult"&&typeof o.toolCallId=="string"){const s=E(o.content);e.set(o.toolCallId,{isError:o.isError===!0,output:s.slice(0,It),failing:P(s),passing:_(s)})}const n=[];for(const o of t)if(!(o?.role!=="assistant"||!Array.isArray(o.content)))for(const s of o.content){if(s?.type!=="toolCall"||typeof s.name!="string")continue;const r=typeof s.id=="string"?s.id:"",a=s.arguments&&typeof s.arguments=="object"?s.arguments:{},c=e.get(r);if(!c)continue;const u={id:r,name:s.name,args:a,isError:c.isError,output:c.output};if(Pt.has(s.name)&&typeof a.command=="string"){const d=F(a.command);u.command=d.command,d.cdDir&&(u.cdDir=d.cdDir);const p=L(d.command);p&&(u.intent=p),p&&St.has(p)&&!u.isError&&c.failing?(u.isError=!0,u.swallowedFailure=!0):p&&!u.isError&&!c.passing&&j(d.command).selected&&(u.unverifiedPass=!0)}n.push(u)}return n}l(D,"it"),i(D,"toolSteps");const tt=120,et=/^(?: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)/,st=/^(?:>?\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|=>|[;{]$/,nt=/^(?:(?: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)/,Ut=/^(?:E\s+)?(?:Uncaught\s+)?(?:[A-Z][\w.]*(?:Error|Exception)|Error|error(?: TS\d+|\[E\d+\])?)(?:\s*\[[\w-]+\])?:\s*\S|\berror TS\d+:\s*\S/,qt=/^(?: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:?)/,Bt=/not found|no such|cannot|can't|unable|error|fail|missing|denied|unknown|invalid|找不到|不存在|失败|错误/i;function rt(t){const e=t.trim().replace(/^#\s?/,"").trim();return e!==""&&(et.test(e)||st.test(e)||nt.test(e))}l(rt,"Vt"),i(rt,"isUntellingReason");function ot(t){const e=t.findIndex(s=>qt.test(s));if(e<0)return;const n=t[e],o=/^Expected(?: value)?:/i.test(n)?t.slice(e+1,e+4).find(s=>/^Received(?: value)?:/i.test(s)):void 0;return o?`${n}, ${o}`:n}l(ot,"ut"),i(ot,"comparison");function at(t){const e=b(t).replace(/\s+/g," ").trim();return e.length>tt?`${e.slice(0,tt-1)}\u2026`:e}l(at,"ft"),i(at,"clipReason");function it(t){const e=[];for(let n=0;n<t.length;n++){const o=/^error:\s*(.*)$/.exec(t[n]);if(!o)continue;let s=o[1].replace(/^'(.*)'$/,"$1").replace(/^"(.*)"$/,"$1");if(/^\|-?$/.test(s)){const a=[];for(let c=n+1;c<t.length&&a.length<2&&!/^[a-z_]+:\s/i.test(t[c]);c++)a.push(t[c]);s=a.join(" ")}if(!s||s==="test failed")continue;let r="";for(let a=n+1;a<Math.min(t.length,n+12)&&!/^(?:\.{3}|not ok|ok)\b/.test(t[a]);a++){const c=/^name:\s*'?([\w.]+)'?$/.exec(t[a]);if(c){r=c[1];break}}e.push(r&&!s.startsWith(r)?`${r}: ${s}`:s)}return e}l(it,"pt"),i(it,"tapErrors");function N(t){const e=t.split(/\r?\n/).map(s=>s.trim().replace(/^#\s?/,"").trim()).filter(Boolean),n=e.filter(s=>!et.test(s)&&!st.test(s)&&!nt.test(s)),o=it(e)[0]??n.find(s=>Ut.test(s))??ot(n)??n.find(s=>zt.test(s))??n.find(s=>Bt.test(s))??"";return at(o)}l(N,"gt"),i(N,"failureReason");const k=i(t=>t,"asIs"),R=i(t=>`dir:${t.replace(/^\.\//,"").replace(/\/+$/,"")||"."}`,"dirTarget"),ct={pnpm:[{names:["-F","--filter","--filter-prod"],value:!0,target:k},{names:["-r","--recursive"],value:!1,target:i(()=>"*","target")},{names:["-C","--dir"],value:!0,target:R},{names:["-w","--workspace-root"],value:!1,target:i(()=>"root","target")}],npm:[{names:["-w","--workspace"],value:!0,target:k},{names:["-ws","--workspaces"],value:!1,target:i(()=>"*","target")},{names:["--prefix"],value:!0,target:R}],yarn:[{names:["--cwd"],value:!0,target:R}],bun:[{names:["-F","--filter"],value:!0,target:k},{names:["--cwd"],value:!0,target:R}]};function h(t,e,n){const o=t[e];for(const s of n)for(const r of s.names){if(s.value&&o.startsWith(`${r}=`))return{target:s.target(o.slice(r.length+1)),next:e+1};if(o!==r)continue;if(!s.value)return{target:s.target(""),next:e+1};const a=t[e+1];return a===void 0?void 0:{target:s.target(a),next:e+2}}}l(h,"b"),i(h,"targetOption");const Zt=/^(?:add|audit|bin|cache|ci|config|create|dedupe|deploy|dlx|env|exec|fetch|help|i|import|info|init|install|link|list|ls|login|logout|outdated|pack|patch|prune|publish|rebuild|remove|rm|root|set|setup|store|unlink|up|update|upgrade|version|view|why|x)$/;function lt(t,e){if(t==="npm")return/^(?:test|t|tst)$/.test(e)?"test":void 0;if(t!=="bun")return Zt.test(e)?void 0:e}l(lt,"ht"),i(lt,"scriptOf");function ut(t){const e=t[0],n=ct[e],o=[],s=[];let r=1;for(;r<t.length;){const p=t[r],g=h(t,r,n);if(g)o.push(g.target),r=g.next;else if(e==="yarn"&&p==="workspace"&&t[r+1])o.push(t[r+1]),r+=2;else if(e==="yarn"&&p==="workspaces")for(o.push("*"),r+=t[r+1]==="foreach"?2:1;t[r]?.startsWith("-");)s.push(t[r++]);else if(p.startsWith("-"))s.push(p),r++;else break}const a=t[r];if(!a)return;const c=a==="run"||a==="run-script",u=c?t[r+1]:lt(e,a);if(c&&!u)return;r+=c?2:1;const d=[];for(;r<t.length;){const p=e==="npm"&&t[r]!=="--"?h(t,r,n):void 0;if(t[r]==="--"){d.push(...t.slice(r));break}p?(o.push(p.target),r=p.next):d.push(t[r++])}return{base:[...u?[e,...s,"run",u]:[e,...s,a],...d].join(" "),targets:o}}l(ut,"bt"),i(ut,"packageShape");function dt(t,e){const n=[{names:["-F","--filter"],value:!0,target:k}],o=[],s=[],r=[];for(let a=e[0]==="run"?1:0;a<e.length;){const c=h(e,a,n);c?(o.push(c.target),a=c.next):e[a].startsWith("-")||r.length>0?r.push(e[a++]):s.push(e[a++])}return{base:[...t,"turbo","run",...s.sort(),...r].join(" "),targets:o}}l(dt,"St"),i(dt,"turboShape");const Gt=/^(?:add|connect|daemon|exec|format(?::\w+)?|g|generate|graph|init|list|migrate|release|repair|report|reset|show|sync|view-logs|watch)$/;function pt(t,e){const[n,o]=e;if(!n||Gt.test(n))return;const s=[...t,"nx"];if(n==="run-many"||n==="affected"){const a=[],c=[],u=[],d=[{names:["-p","--projects"],value:!0,target:k},{names:["-t","--target","--targets"],value:!0,target:i(p=>`task:${p}`,"target")}];for(let p=1;p<e.length;){const g=h(e,p,d);if(!g){u.push(e[p++]);continue}const v=g.target.replace(/^task:/,"").split(",").filter(Boolean);(g.target.startsWith("task:")?c:a).push(...v),p=g.next}return{base:[...s,n,...c.sort(),...u].join(" "),targets:a}}if(n==="run"){const a=o?.indexOf(":")??-1;return!o||a<0?void 0:{base:[...s,"run",o.slice(a),...e.slice(2)].join(" "),targets:a>0?[o.slice(0,a)]:[]}}const r=o&&!o.startsWith("-")?o:void 0;return{base:[...s,"run",`:${n}`,...e.slice(r?2:1)].join(" "),targets:r?[r]:[]}}l(pt,"xt"),i(pt,"nxShape");function ft(t){const e=[{names:["-p","--package"],value:!0,target:k}],n=[],o=[];for(let s=0;s<t.length;){const r=h(t,s,e);r?(n.push(r.target),s=r.next):o.push(t[s++])}return{base:o.join(" "),targets:n}}l(ft,"wt"),i(ft,"cargoShape");const mt=new Set(["-bench","-benchtime","-count","-coverpkg","-coverprofile","-covermode","-cpu","-exec","-o","-p","-parallel","-shuffle","-tags","-timeout","-vet"]);function gt(t){const e=[{names:["-run","--run"],value:!0,target:i(s=>`run:${s}`,"target")},{names:["-skip","--skip"],value:!0,target:i(s=>`skip:${s}`,"target")}],n=[],o=[];for(let s=2;s<t.length;){const r=t[s],a=h(t,s,e);a?(n.push(a.target),s=a.next):r.startsWith("-")?(o.push(mt.has(r)&&t[s+1]?`${r}=${t[s+1]}`:r),s+=mt.has(r)&&t[s+1]?2:1):(n.push(r),s++)}return{base:[...t.slice(0,2),...o].join(" "),targets:n}}l(gt,"kt"),i(gt,"goShape");const Jt=new Set(["-c","-n","-o","-p","-W","--basetemp","--cov","--cov-report","--deselect","--durations","--ignore","--junitxml","--log-level","--maxfail","--rootdir","--tb"]);function ht(t,e){const n=[{names:["-k"],value:!0,target:i(r=>`k:${r}`,"target")},{names:["-m"],value:!0,target:i(r=>`m:${r}`,"target")}],o=[],s=[];for(let r=0;r<e.length;){const a=e[r],c=h(e,r,n);c?(o.push(c.target),r=c.next):Jt.has(a)&&e[r+1]?(s.push(`${a}=${e[r+1]}`),r+=2):a.startsWith("-")?(s.push(a),r++):(o.push(a.replace(/^\.\//,"")),r++)}return{base:[...t,...s.sort()].join(" "),targets:o}}l(ht,"vt"),i(ht,"pytestShape");function bt(t){const e=[];let n="",o,s=!1;for(const r of t)if(o)r===o?o=void 0:n+=r;else if(r==="'"||r==='"')o=r,s=!0;else if(/\s/.test(r))s&&e.push(n),n="",s=!1;else{if(/[|<>`$()]/.test(r))return;n+=r,s=!0}if(!o)return s&&e.push(n),e}l(bt,"$t"),i(bt,"words");function kt(t){const e=bt(t),n={base:t,targets:[]};if(!e?.length)return n;const o=e.findIndex(s=>/^(?:turbo|nx|pytest|py\.test)$/.test(s));if(o>=0&&o<=3){const s=e.slice(0,o),r=e.slice(o+1);return e[o]==="turbo"?dt(s,r):e[o]==="nx"?pt(s,r)??n:ht([...s,"pytest"],r)}return ct[e[0]]?ut(e)??n:e[0]==="cargo"?ft(e):e[0]==="go"&&/^(?:test|build|vet)$/.test(e[1]??"")?gt(e):n}l(kt,"Tt"),i(kt,"shapeOf");function $(t){let e="";const n=[];for(const o of j(t).statements){const s=/^cd\s+("[^"]+"|'[^']+'|\S+)$/.exec(o);if(s){const p=s[1].replace(/^["']|["']$/g,"");e=e&&!p.startsWith("/")?`${e}/${p}`:p;continue}const r=o.replace(/\s+/g," ").trim(),a=kt(r),c=[...new Set(a.targets)].sort(),u=c.length?`${a.base} \u27E8${c.join(" ")}\u27E9`:a.base;if(n.some(p=>p.dir===e&&p.key===u))continue;const d=I(r);n.push({dir:e,check:r,base:a.base,targets:c,key:u,...d?{intent:d}:{}})}return n}l($,"E"),i($,"segmentsOf");function wt(t,e){const n=i((o,s)=>o.every(r=>s.includes(r)),"nested");return t.base===e.base&&(n(t.targets,e.targets)||n(e.targets,t.targets))?!0:t.check===e.check||` ${t.check} `.includes(` ${e.check} `)||` ${e.check} `.includes(` ${t.check} `)}l(wt,"Ct"),i(wt,"overlaps");const vt=/^(?:\/|~|\$)/;function W(t,e){const n=$(t),o=$(e),s=i((f,m)=>f.dir===m.dir&&f.key===m.key,"same"),r=n.filter(f=>!o.some(m=>s(f,m)));if(r.length===0)return;const a=new Set(r.map(f=>f.intent)),c=o.filter(f=>!n.some(m=>s(f,m))||a.has(f.intent)),u=r.filter(f=>c.some(m=>m.intent===f.intent));if(u.length===0||c.length===0)return;const d=i(f=>vt.test(f.dir)||f.targets.some(m=>m.startsWith("dir:")&&vt.test(m.slice(4))),"elsewhere");if([...u,...c].some(d)||u.some(f=>c.some(m=>m.dir===f.dir&&wt(f,m))))return;const p=i(f=>{const m=f[0].dir;if(f.some(A=>A.dir!==m))return;const X=f.map(A=>A.check).join(" && ");return m?`cd ${m} && ${X}`:X},"joined"),g=p(u),v=p(c);if(!g||!v||g===v)return;const Tt=c.every(f=>u.some(m=>m.dir===f.dir&&m.base===f.base));return{bad:g,good:v,...Tt?{retargeted:!0}:{}}}l(W,"Rt"),i(W,"fixCommands");function x(t,e,n=!1){const o=$(t),s=$(e);if(s.length===0)return!1;const r=i((a,c)=>a.some(u=>u.dir===c.dir&&u.key===c.key),"has");return s.every(a=>r(o,a))&&(!n||o.every(a=>r(s,a)))}l(x,"C"),i(x,"runsChecks");function yt(t,e){return t===e||x(t,e,!0)}l(yt,"Zt"),i(yt,"sameChecks");function O(t){return t.cdDir?`cd ${t.cdDir} && ${t.command??""}`:t.command??""}l(O,"R"),i(O,"located");const Kt=/\|\||;|\n/;function $t(t,e){let n=!1;for(const o of t){if(!o.command)continue;const s=b(O(o));o.isError?x(s,e,!0)&&(n=!1):!o.unverifiedPass&&!Kt.test(o.command)&&x(s,e)&&(n=!0)}return n}l($t,"Jt"),i($t,"passedLast");const Ht=/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,Xt=/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 M(t){return Xt.test(t)&&!Ht.test(t)}l(M,"_t"),i(M,"codeFailed");const Qt=/No projects matched the filters|No (?:workspaces|packages?|projects?) (?:found|matched)|Unknown workspace|Couldn't find (?:a )?(?:workspace|package)|did not match any packages|package\(s\) .*not found|not found in (?:the )?workspace|matched no packages|no packages to test|cannot find package|file or directory not found|no tests ran|Cannot find (?:a )?project|Could not find project|No package found with name/i;function U(t){const e=[],n=new Set;for(let o=0;o<t.length;o++){const s=t[o];if(!(!s.isError||!s.intent||!s.command||n.has(s.id))&&!M(s.output))for(let r=o+1;r<t.length;r++){const a=t[r];if(a.intent!==s.intent||!a.command||a.isError||a.unverifiedPass)continue;const c=W(O(s),O(a));if(!c)break;if(!(c.retargeted&&!Qt.test(s.output))){n.add(s.id),e.push({intent:s.intent,failed:s,fixed:a,bad:c.bad,good:c.good,reason:N(s.output),proven:a.intent!=="install"});break}}}return e}l(U,"Nt"),i(U,"fixPairs");const Vt=/(?:^|[\s,.!?,。!?])(?:不对|不是这样|错了|搞错|弄错|别这样|不要这样|我说的是|我的意思是|应该是|你又|还是不行|还是错|并不是|别用|不要用|改用)|\b(?:that'?s (?:not|wrong)|not what I (?:asked|meant|said)|you (?:broke|missed|forgot)|wrong (?:file|approach|command)|I said|still (?:broken|failing|wrong)|don'?t use|use \S+ instead|try again)\b/iu;function q(t){return Vt.test(t)}l(q,"Ft"),i(q,"isCorrection");const Yt=/dal-guard|safety.?net|blocked by|was blocked|refused by|not allowed by|用户已拒绝|已拦截|拦截了|需要交互式审批|已被拦下|保护拒绝/i;function z(t){return t.isError&&Yt.test(t.output)}l(z,"Mt"),i(z,"isDenial");const te=new Set(["grep","find","ls","glob"]);function B(t){return te.has(t.name)?!0:!!t.command&&/^(?:rg|grep|ag|find|fd|ls|git\s+grep)\b/.test(t.command)}l(B,"Ut"),i(B,"isSearch");function Z(t){return`${t.name}:${JSON.stringify(t.args)}`}l(Z,"U"),i(Z,"callKey");function G(t){const e=new Map;for(const o of t)e.set(Z(o),(e.get(Z(o))??0)+1);if([...e.values()].some(o=>o>=3)||t.filter(o=>o.isError).length>=3)return!0;let n=0;for(const o of t)if(n=B(o)?n+1:0,n>=6)return!0;return!1}l(G,"Wt"),i(G,"isDetour");function xt(t,e){const n=t,o=E(n.find(a=>a?.role==="user")?.content),s=n.filter(a=>a?.role==="assistant").map(a=>E(a.content)).filter(Boolean).join(`
4
+ `),r=D(t);return{userPrompt:o,assistantText:s,steps:r,fixes:U(r),corrected:!!e?.trim()&&q(o),detour:G(r),denials:r.filter(z)}}l(xt,"Qt"),i(xt,"analyzeRun");function J(t){return t.corrected||t.detour||t.denials.length>0}l(J,"Gt"),i(J,"needsModel");const St=new Set(["test","build","lint","typecheck"]);function T(t){const e=t.findLast(n=>n.intent!==void 0&&St.has(n.intent));if(e)return e.isError?"failed":"passed"}l(T,"G"),i(T,"verifiedOutcome");function Et(t,e){return e.length>0&&T(t.steps)!==void 0}l(Et,"te"),i(Et,"needsReflection");const jt=25;function Ct(t){return t.steps.length>=jt&&T(t.steps)==="passed"&&!J(t)}l(Ct,"ee"),i(Ct,"longSuccess");const S={user:800,assistant:600,toolCall:300,toolOutput:400},K=12e3;function w(t,e){const n=t.replace(/\s+/g," ").trim();return n.length>e?`${n.slice(0,e)}\u2026`:n}l(w,"x"),i(w,"clip");const ee=/(?:^|\/)(?:package\.json|package-lock\.json|npm-shrinkwrap\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|requirements[^/]*\.txt|pyproject\.toml|poetry\.lock|Pipfile(?:\.lock)?|Cargo\.(?:toml|lock)|go\.(?:mod|sum)|Gemfile(?:\.lock)?|composer\.(?:json|lock)|\.gitlab-ci\.yml|\.github\/workflows\/[^/]+)$/,se=/(?:^|[;&|]\s*)(?:npm\s+(?:i|install|add|uninstall|rm)\b(?=[^;&|]*\s[@a-z])|pnpm\s+(?:add|remove|i\s+\S|install\s+\S)|yarn\s+(?:add|remove)\b|bun\s+(?:add|remove)\b|pip3?\s+install\s+(?!-r\b|-e\b|\.)\S|poetry\s+add\b|cargo\s+add\b|go\s+get\b)/,ne=/(?:>>?|\btee\b|\bsed\s+-i\b|\bnpm\s+pkg\s+set\b)[^;&|]*(?:package\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|requirements[^/\s]*\.txt|pyproject\.toml|Cargo\.toml|go\.mod)/;function Rt(t){const e=new Set;for(const n of t){if(n.isError)continue;const o=H(n);o&&/^(?:edit|write|multiedit|apply_patch|str_replace)/i.test(n.name)&&ee.test(o.replace(/\\/g,"/"))&&e.add(o.split(/[\\/]/).at(-1));const s=n.command??(typeof n.args.command=="string"?n.args.command:"");if(!s)continue;se.test(s)&&e.add("dependencies");const r=ne.exec(s);r&&e.add(r[0].match(/[\w.-]+$/)?.[0]??"package.json")}return[...e]}l(Rt,"ne"),i(Rt,"protectedChanges");function H(t){const e=t.args.path??t.args.file_path??t.args.file;return typeof e=="string"?e:""}l(H,"K"),i(H,"pathArg");function Ot(t,e){const n=[];e&&n.push(`[previous answer] ${w(b(e),S.assistant)}`),n.push(`[user] ${w(b(t.userPrompt),S.user)}`);for(const s of t.steps){const r=s.command??JSON.stringify(s.args),a=_t(H(s))||(s.command?/\.env\b|auth\.json|id_rsa|\.pem\b/.test(s.command):!1);n.push(`[tool ${s.name}] ${w(b(r),S.toolCall)}`);const c=a?"(content of a sensitive file left out)":w(b(s.output),S.toolOutput);n.push(`[tool_output${s.isError?" \xB7 error":""}] ${c}`)}t.assistantText&&n.push(`[assistant] ${w(b(t.assistantText),S.assistant)}`);let o=n.join(`
5
+ `);for(;o.length>K&&n.length>3;)n.splice(e?2:1,1),o=n.join(`
6
+ `);return o.slice(0,K)}l(Ot,"se"),i(Ot,"buildExcerpt");export{jt as LONG_RUN_TOOL_CALLS,K as MAX_EXCERPT_CHARS,xt as analyzeRun,Y as bareCommand,Ot as buildExcerpt,C as checkCommand,M as codeFailed,L as commandIntent,N as failureReason,W as fixCommands,U as fixPairs,q as isCorrection,z as isDenial,G as isDetour,B as isSearch,rt as isUntellingReason,Ct as longSuccess,J as needsModel,Et as needsReflection,$t as passedLast,Rt as protectedChanges,P as reportsFailure,_ as reportsPass,x as runsChecks,yt as sameChecks,F as splitCommand,D as toolSteps,T as verifiedOutcome};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-lsp",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -21,9 +21,9 @@
21
21
  ]
22
22
  },
23
23
  "dependencies": {
24
- "@dalcode/dal-bridge": "1.0.57",
25
- "@dalcode/dal-dap": "1.0.57",
26
- "@dalcode/dal-pi-kit": "1.0.57",
24
+ "@dalcode/dal-bridge": "1.0.59",
25
+ "@dalcode/dal-dap": "1.0.59",
26
+ "@dalcode/dal-pi-kit": "1.0.59",
27
27
  "cross-spawn": "7.0.6",
28
28
  "typebox": "1.3.7",
29
29
  "typescript": "5.9.3",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-mcp",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -29,11 +29,11 @@
29
29
  ]
30
30
  },
31
31
  "dependencies": {
32
- "@dalcode/dal-bridge": "1.0.57",
33
- "@dalcode/dal-guard": "1.0.57",
34
- "@dalcode/dal-pi-kit": "1.0.57",
35
- "@dalcode/deepailab": "1.0.57",
36
- "@earendil-works/pi-mcp": "1.0.57",
32
+ "@dalcode/dal-bridge": "1.0.59",
33
+ "@dalcode/dal-guard": "1.0.59",
34
+ "@dalcode/dal-pi-kit": "1.0.59",
35
+ "@dalcode/deepailab": "1.0.59",
36
+ "@earendil-works/pi-mcp": "1.0.59",
37
37
  "cross-spawn": "7.0.6"
38
38
  },
39
39
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dalcode/dal-office",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "dependencies": {
21
- "@dalcode/dal-pi-kit": "1.0.57",
21
+ "@dalcode/dal-pi-kit": "1.0.59",
22
22
  "docx": "9.7.1",
23
23
  "echarts": "6.1.0",
24
24
  "exceljs": "4.4.0",