looply-cli 0.0.0-stage → 0.2.0

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 (785) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -3
  3. package/dist/.src-hash +1 -0
  4. package/dist/acceptance-observe.d.ts +108 -0
  5. package/dist/acceptance-observe.d.ts.map +1 -0
  6. package/dist/acceptance-observe.js +152 -0
  7. package/dist/acceptance-observe.js.map +1 -0
  8. package/dist/agent-cmd.d.ts +131 -0
  9. package/dist/agent-cmd.d.ts.map +1 -0
  10. package/dist/agent-cmd.js +154 -0
  11. package/dist/agent-cmd.js.map +1 -0
  12. package/dist/agent-contained.d.ts +114 -0
  13. package/dist/agent-contained.d.ts.map +1 -0
  14. package/dist/agent-contained.js +292 -0
  15. package/dist/agent-contained.js.map +1 -0
  16. package/dist/agent-driver.d.ts +130 -0
  17. package/dist/agent-driver.d.ts.map +1 -0
  18. package/dist/agent-driver.js +170 -0
  19. package/dist/agent-driver.js.map +1 -0
  20. package/dist/agent-envelope.d.ts +94 -0
  21. package/dist/agent-envelope.d.ts.map +1 -0
  22. package/dist/agent-envelope.js +214 -0
  23. package/dist/agent-envelope.js.map +1 -0
  24. package/dist/agent-exec.d.ts +182 -0
  25. package/dist/agent-exec.d.ts.map +1 -0
  26. package/dist/agent-exec.js +125 -0
  27. package/dist/agent-exec.js.map +1 -0
  28. package/dist/agent-runtime.d.ts +23 -0
  29. package/dist/agent-runtime.d.ts.map +1 -0
  30. package/dist/agent-runtime.js +143 -0
  31. package/dist/agent-runtime.js.map +1 -0
  32. package/dist/approval-gate-read.d.ts +66 -0
  33. package/dist/approval-gate-read.d.ts.map +1 -0
  34. package/dist/approval-gate-read.js +138 -0
  35. package/dist/approval-gate-read.js.map +1 -0
  36. package/dist/approval-resolution.d.ts +87 -0
  37. package/dist/approval-resolution.d.ts.map +1 -0
  38. package/dist/approval-resolution.js +100 -0
  39. package/dist/approval-resolution.js.map +1 -0
  40. package/dist/approval-resumes.d.ts +102 -0
  41. package/dist/approval-resumes.d.ts.map +1 -0
  42. package/dist/approval-resumes.js +167 -0
  43. package/dist/approval-resumes.js.map +1 -0
  44. package/dist/ask-brain.d.ts +167 -0
  45. package/dist/ask-brain.d.ts.map +1 -0
  46. package/dist/ask-brain.js +355 -0
  47. package/dist/ask-brain.js.map +1 -0
  48. package/dist/autonomy-authority.d.ts +80 -0
  49. package/dist/autonomy-authority.d.ts.map +1 -0
  50. package/dist/autonomy-authority.js +82 -0
  51. package/dist/autonomy-authority.js.map +1 -0
  52. package/dist/autonomy-controller.d.ts +321 -0
  53. package/dist/autonomy-controller.d.ts.map +1 -0
  54. package/dist/autonomy-controller.js +517 -0
  55. package/dist/autonomy-controller.js.map +1 -0
  56. package/dist/autonomy-store.d.ts +327 -0
  57. package/dist/autonomy-store.d.ts.map +1 -0
  58. package/dist/autonomy-store.js +581 -0
  59. package/dist/autonomy-store.js.map +1 -0
  60. package/dist/autonomy-tick.d.ts +257 -0
  61. package/dist/autonomy-tick.d.ts.map +1 -0
  62. package/dist/autonomy-tick.js +616 -0
  63. package/dist/autonomy-tick.js.map +1 -0
  64. package/dist/bin.d.ts +3 -0
  65. package/dist/bin.d.ts.map +1 -0
  66. package/dist/bin.js +2719 -0
  67. package/dist/bin.js.map +1 -0
  68. package/dist/brain-advice.d.ts +21 -0
  69. package/dist/brain-advice.d.ts.map +1 -0
  70. package/dist/brain-advice.js +51 -0
  71. package/dist/brain-advice.js.map +1 -0
  72. package/dist/candidate-replay-runtime.d.ts +125 -0
  73. package/dist/candidate-replay-runtime.d.ts.map +1 -0
  74. package/dist/candidate-replay-runtime.js +188 -0
  75. package/dist/candidate-replay-runtime.js.map +1 -0
  76. package/dist/checkout-carry.d.ts +76 -0
  77. package/dist/checkout-carry.d.ts.map +1 -0
  78. package/dist/checkout-carry.js +125 -0
  79. package/dist/checkout-carry.js.map +1 -0
  80. package/dist/citation-readers.d.ts +26 -0
  81. package/dist/citation-readers.d.ts.map +1 -0
  82. package/dist/citation-readers.js +102 -0
  83. package/dist/citation-readers.js.map +1 -0
  84. package/dist/command-receipts.d.ts +79 -0
  85. package/dist/command-receipts.d.ts.map +1 -0
  86. package/dist/command-receipts.js +143 -0
  87. package/dist/command-receipts.js.map +1 -0
  88. package/dist/command-runner.d.ts +32 -0
  89. package/dist/command-runner.d.ts.map +1 -0
  90. package/dist/command-runner.js +108 -0
  91. package/dist/command-runner.js.map +1 -0
  92. package/dist/compatible-sets.d.ts +67 -0
  93. package/dist/compatible-sets.d.ts.map +1 -0
  94. package/dist/compatible-sets.js +81 -0
  95. package/dist/compatible-sets.js.map +1 -0
  96. package/dist/compile-check.d.ts +31 -0
  97. package/dist/compile-check.d.ts.map +1 -0
  98. package/dist/compile-check.js +34 -0
  99. package/dist/compile-check.js.map +1 -0
  100. package/dist/compile-store.d.ts +16 -0
  101. package/dist/compile-store.d.ts.map +1 -0
  102. package/dist/compile-store.js +21 -0
  103. package/dist/compile-store.js.map +1 -0
  104. package/dist/completion.d.ts +106 -0
  105. package/dist/completion.d.ts.map +1 -0
  106. package/dist/completion.js +131 -0
  107. package/dist/completion.js.map +1 -0
  108. package/dist/config.d.ts +549 -0
  109. package/dist/config.d.ts.map +1 -0
  110. package/dist/config.js +763 -0
  111. package/dist/config.js.map +1 -0
  112. package/dist/control-file.d.ts +142 -0
  113. package/dist/control-file.d.ts.map +1 -0
  114. package/dist/control-file.js +144 -0
  115. package/dist/control-file.js.map +1 -0
  116. package/dist/coordinator-state.d.ts +131 -0
  117. package/dist/coordinator-state.d.ts.map +1 -0
  118. package/dist/coordinator-state.js +380 -0
  119. package/dist/coordinator-state.js.map +1 -0
  120. package/dist/coordinator.d.ts +95 -0
  121. package/dist/coordinator.d.ts.map +1 -0
  122. package/dist/coordinator.js +97 -0
  123. package/dist/coordinator.js.map +1 -0
  124. package/dist/cursor-store.d.ts +53 -0
  125. package/dist/cursor-store.d.ts.map +1 -0
  126. package/dist/cursor-store.js +98 -0
  127. package/dist/cursor-store.js.map +1 -0
  128. package/dist/daemon-cmd.d.ts +239 -0
  129. package/dist/daemon-cmd.d.ts.map +1 -0
  130. package/dist/daemon-cmd.js +1751 -0
  131. package/dist/daemon-cmd.js.map +1 -0
  132. package/dist/daemon-lock.d.ts +140 -0
  133. package/dist/daemon-lock.d.ts.map +1 -0
  134. package/dist/daemon-lock.js +352 -0
  135. package/dist/daemon-lock.js.map +1 -0
  136. package/dist/daemon-recovery.d.ts +78 -0
  137. package/dist/daemon-recovery.d.ts.map +1 -0
  138. package/dist/daemon-recovery.js +161 -0
  139. package/dist/daemon-recovery.js.map +1 -0
  140. package/dist/daemon.d.ts +368 -0
  141. package/dist/daemon.d.ts.map +1 -0
  142. package/dist/daemon.js +601 -0
  143. package/dist/daemon.js.map +1 -0
  144. package/dist/declared-response-shape.d.ts +93 -0
  145. package/dist/declared-response-shape.d.ts.map +1 -0
  146. package/dist/declared-response-shape.js +200 -0
  147. package/dist/declared-response-shape.js.map +1 -0
  148. package/dist/declared-surfaces.d.ts +16 -0
  149. package/dist/declared-surfaces.d.ts.map +1 -0
  150. package/dist/declared-surfaces.js +19 -0
  151. package/dist/declared-surfaces.js.map +1 -0
  152. package/dist/depends-review.d.ts +113 -0
  153. package/dist/depends-review.d.ts.map +1 -0
  154. package/dist/depends-review.js +110 -0
  155. package/dist/depends-review.js.map +1 -0
  156. package/dist/doctor.d.ts +91 -0
  157. package/dist/doctor.d.ts.map +1 -0
  158. package/dist/doctor.js +71 -0
  159. package/dist/doctor.js.map +1 -0
  160. package/dist/edge-approval.d.ts +105 -0
  161. package/dist/edge-approval.d.ts.map +1 -0
  162. package/dist/edge-approval.js +100 -0
  163. package/dist/edge-approval.js.map +1 -0
  164. package/dist/evidence-cache.d.ts +45 -0
  165. package/dist/evidence-cache.d.ts.map +1 -0
  166. package/dist/evidence-cache.js +90 -0
  167. package/dist/evidence-cache.js.map +1 -0
  168. package/dist/evidence-cmd.d.ts +133 -0
  169. package/dist/evidence-cmd.d.ts.map +1 -0
  170. package/dist/evidence-cmd.js +347 -0
  171. package/dist/evidence-cmd.js.map +1 -0
  172. package/dist/evidence-facts.d.ts +40 -0
  173. package/dist/evidence-facts.d.ts.map +1 -0
  174. package/dist/evidence-facts.js +114 -0
  175. package/dist/evidence-facts.js.map +1 -0
  176. package/dist/exclusive-lock.d.ts +52 -0
  177. package/dist/exclusive-lock.d.ts.map +1 -0
  178. package/dist/exclusive-lock.js +150 -0
  179. package/dist/exclusive-lock.js.map +1 -0
  180. package/dist/exec-domains.d.ts +140 -0
  181. package/dist/exec-domains.d.ts.map +1 -0
  182. package/dist/exec-domains.js +287 -0
  183. package/dist/exec-domains.js.map +1 -0
  184. package/dist/exemption-store.d.ts +197 -0
  185. package/dist/exemption-store.d.ts.map +1 -0
  186. package/dist/exemption-store.js +266 -0
  187. package/dist/exemption-store.js.map +1 -0
  188. package/dist/explicit-start-gate.d.ts +96 -0
  189. package/dist/explicit-start-gate.d.ts.map +1 -0
  190. package/dist/explicit-start-gate.js +103 -0
  191. package/dist/explicit-start-gate.js.map +1 -0
  192. package/dist/fs-trouble.d.ts +70 -0
  193. package/dist/fs-trouble.d.ts.map +1 -0
  194. package/dist/fs-trouble.js +98 -0
  195. package/dist/fs-trouble.js.map +1 -0
  196. package/dist/gate.d.ts +278 -0
  197. package/dist/gate.d.ts.map +1 -0
  198. package/dist/gate.js +278 -0
  199. package/dist/gate.js.map +1 -0
  200. package/dist/git-driver.d.ts +519 -0
  201. package/dist/git-driver.d.ts.map +1 -0
  202. package/dist/git-driver.js +900 -0
  203. package/dist/git-driver.js.map +1 -0
  204. package/dist/git-push-executor.d.ts +41 -0
  205. package/dist/git-push-executor.d.ts.map +1 -0
  206. package/dist/git-push-executor.js +142 -0
  207. package/dist/git-push-executor.js.map +1 -0
  208. package/dist/glob.d.ts +26 -0
  209. package/dist/glob.d.ts.map +1 -0
  210. package/dist/glob.js +93 -0
  211. package/dist/glob.js.map +1 -0
  212. package/dist/goal-adaptive.d.ts +295 -0
  213. package/dist/goal-adaptive.d.ts.map +1 -0
  214. package/dist/goal-adaptive.js +393 -0
  215. package/dist/goal-adaptive.js.map +1 -0
  216. package/dist/goal-compile.d.ts +342 -0
  217. package/dist/goal-compile.d.ts.map +1 -0
  218. package/dist/goal-compile.js +444 -0
  219. package/dist/goal-compile.js.map +1 -0
  220. package/dist/goal-depends-executor.d.ts +55 -0
  221. package/dist/goal-depends-executor.d.ts.map +1 -0
  222. package/dist/goal-depends-executor.js +202 -0
  223. package/dist/goal-depends-executor.js.map +1 -0
  224. package/dist/goal-execution-evidence.d.ts +135 -0
  225. package/dist/goal-execution-evidence.d.ts.map +1 -0
  226. package/dist/goal-execution-evidence.js +159 -0
  227. package/dist/goal-execution-evidence.js.map +1 -0
  228. package/dist/goal-gap.d.ts +140 -0
  229. package/dist/goal-gap.d.ts.map +1 -0
  230. package/dist/goal-gap.js +197 -0
  231. package/dist/goal-gap.js.map +1 -0
  232. package/dist/goal-met-target.d.ts +98 -0
  233. package/dist/goal-met-target.d.ts.map +1 -0
  234. package/dist/goal-met-target.js +92 -0
  235. package/dist/goal-met-target.js.map +1 -0
  236. package/dist/goal-ownership.d.ts +416 -0
  237. package/dist/goal-ownership.d.ts.map +1 -0
  238. package/dist/goal-ownership.js +576 -0
  239. package/dist/goal-ownership.js.map +1 -0
  240. package/dist/goal-runs.d.ts +82 -0
  241. package/dist/goal-runs.d.ts.map +1 -0
  242. package/dist/goal-runs.js +120 -0
  243. package/dist/goal-runs.js.map +1 -0
  244. package/dist/goal-store.d.ts +146 -0
  245. package/dist/goal-store.d.ts.map +1 -0
  246. package/dist/goal-store.js +294 -0
  247. package/dist/goal-store.js.map +1 -0
  248. package/dist/goal-view.d.ts +156 -0
  249. package/dist/goal-view.d.ts.map +1 -0
  250. package/dist/goal-view.js +499 -0
  251. package/dist/goal-view.js.map +1 -0
  252. package/dist/governed-approvals.d.ts +152 -0
  253. package/dist/governed-approvals.d.ts.map +1 -0
  254. package/dist/governed-approvals.js +246 -0
  255. package/dist/governed-approvals.js.map +1 -0
  256. package/dist/governed-broker.d.ts +169 -0
  257. package/dist/governed-broker.d.ts.map +1 -0
  258. package/dist/governed-broker.js +196 -0
  259. package/dist/governed-broker.js.map +1 -0
  260. package/dist/governed-run.d.ts +220 -0
  261. package/dist/governed-run.d.ts.map +1 -0
  262. package/dist/governed-run.js +406 -0
  263. package/dist/governed-run.js.map +1 -0
  264. package/dist/grant-reconcile.d.ts +63 -0
  265. package/dist/grant-reconcile.d.ts.map +1 -0
  266. package/dist/grant-reconcile.js +121 -0
  267. package/dist/grant-reconcile.js.map +1 -0
  268. package/dist/index-for-head.d.ts +56 -0
  269. package/dist/index-for-head.d.ts.map +1 -0
  270. package/dist/index-for-head.js +103 -0
  271. package/dist/index-for-head.js.map +1 -0
  272. package/dist/index.d.ts +39 -0
  273. package/dist/index.d.ts.map +1 -0
  274. package/dist/index.js +55 -0
  275. package/dist/index.js.map +1 -0
  276. package/dist/init-detect.d.ts +39 -0
  277. package/dist/init-detect.d.ts.map +1 -0
  278. package/dist/init-detect.js +188 -0
  279. package/dist/init-detect.js.map +1 -0
  280. package/dist/integration-deps.d.ts +62 -0
  281. package/dist/integration-deps.d.ts.map +1 -0
  282. package/dist/integration-deps.js +251 -0
  283. package/dist/integration-deps.js.map +1 -0
  284. package/dist/integration-runtime.d.ts +458 -0
  285. package/dist/integration-runtime.d.ts.map +1 -0
  286. package/dist/integration-runtime.js +681 -0
  287. package/dist/integration-runtime.js.map +1 -0
  288. package/dist/integration.d.ts +45 -0
  289. package/dist/integration.d.ts.map +1 -0
  290. package/dist/integration.js +87 -0
  291. package/dist/integration.js.map +1 -0
  292. package/dist/integrator.d.ts +84 -0
  293. package/dist/integrator.d.ts.map +1 -0
  294. package/dist/integrator.js +193 -0
  295. package/dist/integrator.js.map +1 -0
  296. package/dist/lane-claims.d.ts +174 -0
  297. package/dist/lane-claims.d.ts.map +1 -0
  298. package/dist/lane-claims.js +218 -0
  299. package/dist/lane-claims.js.map +1 -0
  300. package/dist/lane-coverage.d.ts +87 -0
  301. package/dist/lane-coverage.d.ts.map +1 -0
  302. package/dist/lane-coverage.js +129 -0
  303. package/dist/lane-coverage.js.map +1 -0
  304. package/dist/ledger-replay.d.ts +115 -0
  305. package/dist/ledger-replay.d.ts.map +1 -0
  306. package/dist/ledger-replay.js +155 -0
  307. package/dist/ledger-replay.js.map +1 -0
  308. package/dist/ledger-store.d.ts +68 -0
  309. package/dist/ledger-store.d.ts.map +1 -0
  310. package/dist/ledger-store.js +111 -0
  311. package/dist/ledger-store.js.map +1 -0
  312. package/dist/loop-safety-observer.d.ts +132 -0
  313. package/dist/loop-safety-observer.d.ts.map +1 -0
  314. package/dist/loop-safety-observer.js +76 -0
  315. package/dist/loop-safety-observer.js.map +1 -0
  316. package/dist/loop-safety-store.d.ts +339 -0
  317. package/dist/loop-safety-store.d.ts.map +1 -0
  318. package/dist/loop-safety-store.js +800 -0
  319. package/dist/loop-safety-store.js.map +1 -0
  320. package/dist/machine-store.d.ts +54 -0
  321. package/dist/machine-store.d.ts.map +1 -0
  322. package/dist/machine-store.js +149 -0
  323. package/dist/machine-store.js.map +1 -0
  324. package/dist/mcp-main.d.ts +2 -0
  325. package/dist/mcp-main.d.ts.map +1 -0
  326. package/dist/mcp-main.js +116 -0
  327. package/dist/mcp-main.js.map +1 -0
  328. package/dist/mcp-server.d.ts +72 -0
  329. package/dist/mcp-server.d.ts.map +1 -0
  330. package/dist/mcp-server.js +259 -0
  331. package/dist/mcp-server.js.map +1 -0
  332. package/dist/model-routing.d.ts +75 -0
  333. package/dist/model-routing.d.ts.map +1 -0
  334. package/dist/model-routing.js +108 -0
  335. package/dist/model-routing.js.map +1 -0
  336. package/dist/model-transport.d.ts +188 -0
  337. package/dist/model-transport.d.ts.map +1 -0
  338. package/dist/model-transport.js +625 -0
  339. package/dist/model-transport.js.map +1 -0
  340. package/dist/notify-cadence.d.ts +55 -0
  341. package/dist/notify-cadence.d.ts.map +1 -0
  342. package/dist/notify-cadence.js +68 -0
  343. package/dist/notify-cadence.js.map +1 -0
  344. package/dist/notify-channel.d.ts +69 -0
  345. package/dist/notify-channel.d.ts.map +1 -0
  346. package/dist/notify-channel.js +151 -0
  347. package/dist/notify-channel.js.map +1 -0
  348. package/dist/notify.d.ts +71 -0
  349. package/dist/notify.d.ts.map +1 -0
  350. package/dist/notify.js +125 -0
  351. package/dist/notify.js.map +1 -0
  352. package/dist/observation-inventory.d.ts +65 -0
  353. package/dist/observation-inventory.d.ts.map +1 -0
  354. package/dist/observation-inventory.js +139 -0
  355. package/dist/observation-inventory.js.map +1 -0
  356. package/dist/owned-children.d.ts +45 -0
  357. package/dist/owned-children.d.ts.map +1 -0
  358. package/dist/owned-children.js +64 -0
  359. package/dist/owned-children.js.map +1 -0
  360. package/dist/packet-for-goal.d.ts +19 -0
  361. package/dist/packet-for-goal.d.ts.map +1 -0
  362. package/dist/packet-for-goal.js +32 -0
  363. package/dist/packet-for-goal.js.map +1 -0
  364. package/dist/pair-cmd.d.ts +85 -0
  365. package/dist/pair-cmd.d.ts.map +1 -0
  366. package/dist/pair-cmd.js +205 -0
  367. package/dist/pair-cmd.js.map +1 -0
  368. package/dist/partial-asker.d.ts +96 -0
  369. package/dist/partial-asker.d.ts.map +1 -0
  370. package/dist/partial-asker.js +117 -0
  371. package/dist/partial-asker.js.map +1 -0
  372. package/dist/pdf-text-lines.d.ts +17 -0
  373. package/dist/pdf-text-lines.d.ts.map +1 -0
  374. package/dist/pdf-text-lines.js +70 -0
  375. package/dist/pdf-text-lines.js.map +1 -0
  376. package/dist/pdf-text-worker.d.ts +2 -0
  377. package/dist/pdf-text-worker.d.ts.map +1 -0
  378. package/dist/pdf-text-worker.js +81 -0
  379. package/dist/pdf-text-worker.js.map +1 -0
  380. package/dist/pdf-text.d.ts +56 -0
  381. package/dist/pdf-text.d.ts.map +1 -0
  382. package/dist/pdf-text.js +64 -0
  383. package/dist/pdf-text.js.map +1 -0
  384. package/dist/pending-action.d.ts +154 -0
  385. package/dist/pending-action.d.ts.map +1 -0
  386. package/dist/pending-action.js +148 -0
  387. package/dist/pending-action.js.map +1 -0
  388. package/dist/preemptor.d.ts +40 -0
  389. package/dist/preemptor.d.ts.map +1 -0
  390. package/dist/preemptor.js +49 -0
  391. package/dist/preemptor.js.map +1 -0
  392. package/dist/programme-mode.d.ts +29 -0
  393. package/dist/programme-mode.d.ts.map +1 -0
  394. package/dist/programme-mode.js +50 -0
  395. package/dist/programme-mode.js.map +1 -0
  396. package/dist/progress-view.d.ts +14 -0
  397. package/dist/progress-view.d.ts.map +1 -0
  398. package/dist/progress-view.js +114 -0
  399. package/dist/progress-view.js.map +1 -0
  400. package/dist/project-graph-builder.d.ts +81 -0
  401. package/dist/project-graph-builder.d.ts.map +1 -0
  402. package/dist/project-graph-builder.js +246 -0
  403. package/dist/project-graph-builder.js.map +1 -0
  404. package/dist/project-graph-runtime.d.ts +86 -0
  405. package/dist/project-graph-runtime.d.ts.map +1 -0
  406. package/dist/project-graph-runtime.js +112 -0
  407. package/dist/project-graph-runtime.js.map +1 -0
  408. package/dist/project-index-builder.d.ts +96 -0
  409. package/dist/project-index-builder.d.ts.map +1 -0
  410. package/dist/project-index-builder.js +298 -0
  411. package/dist/project-index-builder.js.map +1 -0
  412. package/dist/project-index-facts.d.ts +51 -0
  413. package/dist/project-index-facts.d.ts.map +1 -0
  414. package/dist/project-index-facts.js +117 -0
  415. package/dist/project-index-facts.js.map +1 -0
  416. package/dist/project-index-store.d.ts +97 -0
  417. package/dist/project-index-store.d.ts.map +1 -0
  418. package/dist/project-index-store.js +140 -0
  419. package/dist/project-index-store.js.map +1 -0
  420. package/dist/project-memory-store.d.ts +127 -0
  421. package/dist/project-memory-store.d.ts.map +1 -0
  422. package/dist/project-memory-store.js +302 -0
  423. package/dist/project-memory-store.js.map +1 -0
  424. package/dist/proposal-store.d.ts +14 -0
  425. package/dist/proposal-store.d.ts.map +1 -0
  426. package/dist/proposal-store.js +19 -0
  427. package/dist/proposal-store.js.map +1 -0
  428. package/dist/prover.d.ts +80 -0
  429. package/dist/prover.d.ts.map +1 -0
  430. package/dist/prover.js +137 -0
  431. package/dist/prover.js.map +1 -0
  432. package/dist/provider-identity-store.d.ts +34 -0
  433. package/dist/provider-identity-store.d.ts.map +1 -0
  434. package/dist/provider-identity-store.js +72 -0
  435. package/dist/provider-identity-store.js.map +1 -0
  436. package/dist/provider-identity.d.ts +104 -0
  437. package/dist/provider-identity.d.ts.map +1 -0
  438. package/dist/provider-identity.js +167 -0
  439. package/dist/provider-identity.js.map +1 -0
  440. package/dist/provider-limit.d.ts +79 -0
  441. package/dist/provider-limit.d.ts.map +1 -0
  442. package/dist/provider-limit.js +148 -0
  443. package/dist/provider-limit.js.map +1 -0
  444. package/dist/provider-preflight.d.ts +171 -0
  445. package/dist/provider-preflight.d.ts.map +1 -0
  446. package/dist/provider-preflight.js +395 -0
  447. package/dist/provider-preflight.js.map +1 -0
  448. package/dist/provider-state.d.ts +120 -0
  449. package/dist/provider-state.d.ts.map +1 -0
  450. package/dist/provider-state.js +182 -0
  451. package/dist/provider-state.js.map +1 -0
  452. package/dist/providers.d.ts +132 -0
  453. package/dist/providers.d.ts.map +1 -0
  454. package/dist/providers.js +161 -0
  455. package/dist/providers.js.map +1 -0
  456. package/dist/publication-recorder.d.ts +117 -0
  457. package/dist/publication-recorder.d.ts.map +1 -0
  458. package/dist/publication-recorder.js +124 -0
  459. package/dist/publication-recorder.js.map +1 -0
  460. package/dist/pursuit-delivery.d.ts +24 -0
  461. package/dist/pursuit-delivery.d.ts.map +1 -0
  462. package/dist/pursuit-delivery.js +38 -0
  463. package/dist/pursuit-delivery.js.map +1 -0
  464. package/dist/queue-store.d.ts +132 -0
  465. package/dist/queue-store.d.ts.map +1 -0
  466. package/dist/queue-store.js +185 -0
  467. package/dist/queue-store.js.map +1 -0
  468. package/dist/queue-summary.d.ts +14 -0
  469. package/dist/queue-summary.d.ts.map +1 -0
  470. package/dist/queue-summary.js +82 -0
  471. package/dist/queue-summary.js.map +1 -0
  472. package/dist/queue-view.d.ts +20 -0
  473. package/dist/queue-view.d.ts.map +1 -0
  474. package/dist/queue-view.js +163 -0
  475. package/dist/queue-view.js.map +1 -0
  476. package/dist/queue-write-lease.d.ts +106 -0
  477. package/dist/queue-write-lease.d.ts.map +1 -0
  478. package/dist/queue-write-lease.js +282 -0
  479. package/dist/queue-write-lease.js.map +1 -0
  480. package/dist/rails-home.d.ts +162 -0
  481. package/dist/rails-home.d.ts.map +1 -0
  482. package/dist/rails-home.js +452 -0
  483. package/dist/rails-home.js.map +1 -0
  484. package/dist/rails-migrations.d.ts +75 -0
  485. package/dist/rails-migrations.d.ts.map +1 -0
  486. package/dist/rails-migrations.js +199 -0
  487. package/dist/rails-migrations.js.map +1 -0
  488. package/dist/rails-stores.d.ts +49 -0
  489. package/dist/rails-stores.d.ts.map +1 -0
  490. package/dist/rails-stores.js +100 -0
  491. package/dist/rails-stores.js.map +1 -0
  492. package/dist/reaper.d.ts +69 -0
  493. package/dist/reaper.d.ts.map +1 -0
  494. package/dist/reaper.js +152 -0
  495. package/dist/reaper.js.map +1 -0
  496. package/dist/record-store.d.ts +36 -0
  497. package/dist/record-store.d.ts.map +1 -0
  498. package/dist/record-store.js +78 -0
  499. package/dist/record-store.js.map +1 -0
  500. package/dist/recovery-io.d.ts +50 -0
  501. package/dist/recovery-io.d.ts.map +1 -0
  502. package/dist/recovery-io.js +122 -0
  503. package/dist/recovery-io.js.map +1 -0
  504. package/dist/recovery.d.ts +146 -0
  505. package/dist/recovery.d.ts.map +1 -0
  506. package/dist/recovery.js +110 -0
  507. package/dist/recovery.js.map +1 -0
  508. package/dist/redraw.d.ts +34 -0
  509. package/dist/redraw.d.ts.map +1 -0
  510. package/dist/redraw.js +62 -0
  511. package/dist/redraw.js.map +1 -0
  512. package/dist/rejected-evidence.d.ts +255 -0
  513. package/dist/rejected-evidence.d.ts.map +1 -0
  514. package/dist/rejected-evidence.js +324 -0
  515. package/dist/rejected-evidence.js.map +1 -0
  516. package/dist/report-cmd.d.ts +32 -0
  517. package/dist/report-cmd.d.ts.map +1 -0
  518. package/dist/report-cmd.js +201 -0
  519. package/dist/report-cmd.js.map +1 -0
  520. package/dist/repos-cmd.d.ts +80 -0
  521. package/dist/repos-cmd.d.ts.map +1 -0
  522. package/dist/repos-cmd.js +240 -0
  523. package/dist/repos-cmd.js.map +1 -0
  524. package/dist/request-body-shape.d.ts +93 -0
  525. package/dist/request-body-shape.d.ts.map +1 -0
  526. package/dist/request-body-shape.js +407 -0
  527. package/dist/request-body-shape.js.map +1 -0
  528. package/dist/requirement-claims.d.ts +89 -0
  529. package/dist/requirement-claims.d.ts.map +1 -0
  530. package/dist/requirement-claims.js +92 -0
  531. package/dist/requirement-claims.js.map +1 -0
  532. package/dist/retention-apply-runtime.d.ts +105 -0
  533. package/dist/retention-apply-runtime.d.ts.map +1 -0
  534. package/dist/retention-apply-runtime.js +269 -0
  535. package/dist/retention-apply-runtime.js.map +1 -0
  536. package/dist/reverify.d.ts +41 -0
  537. package/dist/reverify.d.ts.map +1 -0
  538. package/dist/reverify.js +69 -0
  539. package/dist/reverify.js.map +1 -0
  540. package/dist/round-records.d.ts +65 -0
  541. package/dist/round-records.d.ts.map +1 -0
  542. package/dist/round-records.js +61 -0
  543. package/dist/round-records.js.map +1 -0
  544. package/dist/round-runner.d.ts +924 -0
  545. package/dist/round-runner.d.ts.map +1 -0
  546. package/dist/round-runner.js +1693 -0
  547. package/dist/round-runner.js.map +1 -0
  548. package/dist/run-approval.d.ts +180 -0
  549. package/dist/run-approval.d.ts.map +1 -0
  550. package/dist/run-approval.js +199 -0
  551. package/dist/run-approval.js.map +1 -0
  552. package/dist/run-cmd.d.ts +359 -0
  553. package/dist/run-cmd.d.ts.map +1 -0
  554. package/dist/run-cmd.js +4418 -0
  555. package/dist/run-cmd.js.map +1 -0
  556. package/dist/run-delivery.d.ts +71 -0
  557. package/dist/run-delivery.d.ts.map +1 -0
  558. package/dist/run-delivery.js +104 -0
  559. package/dist/run-delivery.js.map +1 -0
  560. package/dist/run-ended.d.ts +75 -0
  561. package/dist/run-ended.d.ts.map +1 -0
  562. package/dist/run-ended.js +27 -0
  563. package/dist/run-ended.js.map +1 -0
  564. package/dist/run-ending-locator.d.ts +125 -0
  565. package/dist/run-ending-locator.d.ts.map +1 -0
  566. package/dist/run-ending-locator.js +133 -0
  567. package/dist/run-ending-locator.js.map +1 -0
  568. package/dist/run-launcher.d.ts +459 -0
  569. package/dist/run-launcher.d.ts.map +1 -0
  570. package/dist/run-launcher.js +652 -0
  571. package/dist/run-launcher.js.map +1 -0
  572. package/dist/run-lease.d.ts +208 -0
  573. package/dist/run-lease.d.ts.map +1 -0
  574. package/dist/run-lease.js +301 -0
  575. package/dist/run-lease.js.map +1 -0
  576. package/dist/run-refusal-marks.d.ts +189 -0
  577. package/dist/run-refusal-marks.d.ts.map +1 -0
  578. package/dist/run-refusal-marks.js +249 -0
  579. package/dist/run-refusal-marks.js.map +1 -0
  580. package/dist/run-start-marks.d.ts +153 -0
  581. package/dist/run-start-marks.d.ts.map +1 -0
  582. package/dist/run-start-marks.js +269 -0
  583. package/dist/run-start-marks.js.map +1 -0
  584. package/dist/scan-cmd.d.ts +14 -0
  585. package/dist/scan-cmd.d.ts.map +1 -0
  586. package/dist/scan-cmd.js +270 -0
  587. package/dist/scan-cmd.js.map +1 -0
  588. package/dist/scan-events.d.ts +50 -0
  589. package/dist/scan-events.d.ts.map +1 -0
  590. package/dist/scan-events.js +91 -0
  591. package/dist/scan-events.js.map +1 -0
  592. package/dist/scan.d.ts +191 -0
  593. package/dist/scan.d.ts.map +1 -0
  594. package/dist/scan.js +417 -0
  595. package/dist/scan.js.map +1 -0
  596. package/dist/scope-rule.d.ts +148 -0
  597. package/dist/scope-rule.d.ts.map +1 -0
  598. package/dist/scope-rule.js +121 -0
  599. package/dist/scope-rule.js.map +1 -0
  600. package/dist/self-repo-id.d.ts +18 -0
  601. package/dist/self-repo-id.d.ts.map +1 -0
  602. package/dist/self-repo-id.js +70 -0
  603. package/dist/self-repo-id.js.map +1 -0
  604. package/dist/server-client.d.ts +766 -0
  605. package/dist/server-client.d.ts.map +1 -0
  606. package/dist/server-client.js +475 -0
  607. package/dist/server-client.js.map +1 -0
  608. package/dist/session-adapter-runtime.d.ts +195 -0
  609. package/dist/session-adapter-runtime.d.ts.map +1 -0
  610. package/dist/session-adapter-runtime.js +373 -0
  611. package/dist/session-adapter-runtime.js.map +1 -0
  612. package/dist/session-checkpoint-runtime.d.ts +62 -0
  613. package/dist/session-checkpoint-runtime.d.ts.map +1 -0
  614. package/dist/session-checkpoint-runtime.js +268 -0
  615. package/dist/session-checkpoint-runtime.js.map +1 -0
  616. package/dist/session-control-transport.d.ts +106 -0
  617. package/dist/session-control-transport.d.ts.map +1 -0
  618. package/dist/session-control-transport.js +232 -0
  619. package/dist/session-control-transport.js.map +1 -0
  620. package/dist/session-observation-store.d.ts +98 -0
  621. package/dist/session-observation-store.d.ts.map +1 -0
  622. package/dist/session-observation-store.js +155 -0
  623. package/dist/session-observation-store.js.map +1 -0
  624. package/dist/session-observe-runtime.d.ts +123 -0
  625. package/dist/session-observe-runtime.d.ts.map +1 -0
  626. package/dist/session-observe-runtime.js +317 -0
  627. package/dist/session-observe-runtime.js.map +1 -0
  628. package/dist/session-store.d.ts +98 -0
  629. package/dist/session-store.d.ts.map +1 -0
  630. package/dist/session-store.js +116 -0
  631. package/dist/session-store.js.map +1 -0
  632. package/dist/sessions-cmd.d.ts +202 -0
  633. package/dist/sessions-cmd.d.ts.map +1 -0
  634. package/dist/sessions-cmd.js +609 -0
  635. package/dist/sessions-cmd.js.map +1 -0
  636. package/dist/settings-overlay.d.ts +53 -0
  637. package/dist/settings-overlay.d.ts.map +1 -0
  638. package/dist/settings-overlay.js +175 -0
  639. package/dist/settings-overlay.js.map +1 -0
  640. package/dist/setup-prompt.d.ts +34 -0
  641. package/dist/setup-prompt.d.ts.map +1 -0
  642. package/dist/setup-prompt.js +92 -0
  643. package/dist/setup-prompt.js.map +1 -0
  644. package/dist/setup.d.ts +103 -0
  645. package/dist/setup.d.ts.map +1 -0
  646. package/dist/setup.js +283 -0
  647. package/dist/setup.js.map +1 -0
  648. package/dist/shared-grants.d.ts +164 -0
  649. package/dist/shared-grants.d.ts.map +1 -0
  650. package/dist/shared-grants.js +242 -0
  651. package/dist/shared-grants.js.map +1 -0
  652. package/dist/signals.d.ts +55 -0
  653. package/dist/signals.d.ts.map +1 -0
  654. package/dist/signals.js +85 -0
  655. package/dist/signals.js.map +1 -0
  656. package/dist/source-cmd.d.ts +201 -0
  657. package/dist/source-cmd.d.ts.map +1 -0
  658. package/dist/source-cmd.js +684 -0
  659. package/dist/source-cmd.js.map +1 -0
  660. package/dist/source-verdict.d.ts +99 -0
  661. package/dist/source-verdict.d.ts.map +1 -0
  662. package/dist/source-verdict.js +182 -0
  663. package/dist/source-verdict.js.map +1 -0
  664. package/dist/spend-ledger.d.ts +350 -0
  665. package/dist/spend-ledger.d.ts.map +1 -0
  666. package/dist/spend-ledger.js +546 -0
  667. package/dist/spend-ledger.js.map +1 -0
  668. package/dist/stale-run-sweep.d.ts +79 -0
  669. package/dist/stale-run-sweep.d.ts.map +1 -0
  670. package/dist/stale-run-sweep.js +116 -0
  671. package/dist/stale-run-sweep.js.map +1 -0
  672. package/dist/start-attempts.d.ts +385 -0
  673. package/dist/start-attempts.d.ts.map +1 -0
  674. package/dist/start-attempts.js +613 -0
  675. package/dist/start-attempts.js.map +1 -0
  676. package/dist/status-cmd.d.ts +28 -0
  677. package/dist/status-cmd.d.ts.map +1 -0
  678. package/dist/status-cmd.js +116 -0
  679. package/dist/status-cmd.js.map +1 -0
  680. package/dist/stop-follow-up.d.ts +107 -0
  681. package/dist/stop-follow-up.d.ts.map +1 -0
  682. package/dist/stop-follow-up.js +172 -0
  683. package/dist/stop-follow-up.js.map +1 -0
  684. package/dist/surface-lease.d.ts +118 -0
  685. package/dist/surface-lease.d.ts.map +1 -0
  686. package/dist/surface-lease.js +485 -0
  687. package/dist/surface-lease.js.map +1 -0
  688. package/dist/sync.d.ts +54 -0
  689. package/dist/sync.d.ts.map +1 -0
  690. package/dist/sync.js +93 -0
  691. package/dist/sync.js.map +1 -0
  692. package/dist/syncing-ledger.d.ts +45 -0
  693. package/dist/syncing-ledger.d.ts.map +1 -0
  694. package/dist/syncing-ledger.js +53 -0
  695. package/dist/syncing-ledger.js.map +1 -0
  696. package/dist/temp-fixtures.d.ts +68 -0
  697. package/dist/temp-fixtures.d.ts.map +1 -0
  698. package/dist/temp-fixtures.js +38 -0
  699. package/dist/temp-fixtures.js.map +1 -0
  700. package/dist/token-window.d.ts +84 -0
  701. package/dist/token-window.d.ts.map +1 -0
  702. package/dist/token-window.js +143 -0
  703. package/dist/token-window.js.map +1 -0
  704. package/dist/tool-bridge.d.ts +177 -0
  705. package/dist/tool-bridge.d.ts.map +1 -0
  706. package/dist/tool-bridge.js +329 -0
  707. package/dist/tool-bridge.js.map +1 -0
  708. package/dist/tool-call-record.d.ts +197 -0
  709. package/dist/tool-call-record.d.ts.map +1 -0
  710. package/dist/tool-call-record.js +276 -0
  711. package/dist/tool-call-record.js.map +1 -0
  712. package/dist/tool-protocol.d.ts +135 -0
  713. package/dist/tool-protocol.d.ts.map +1 -0
  714. package/dist/tool-protocol.js +104 -0
  715. package/dist/tool-protocol.js.map +1 -0
  716. package/dist/tool-worker.d.ts +3 -0
  717. package/dist/tool-worker.d.ts.map +1 -0
  718. package/dist/tool-worker.js +478 -0
  719. package/dist/tool-worker.js.map +1 -0
  720. package/dist/toolchain-mirror.d.ts +86 -0
  721. package/dist/toolchain-mirror.d.ts.map +1 -0
  722. package/dist/toolchain-mirror.js +307 -0
  723. package/dist/toolchain-mirror.js.map +1 -0
  724. package/dist/trusted-git.d.ts +243 -0
  725. package/dist/trusted-git.d.ts.map +1 -0
  726. package/dist/trusted-git.js +920 -0
  727. package/dist/trusted-git.js.map +1 -0
  728. package/dist/ui.d.ts +76 -0
  729. package/dist/ui.d.ts.map +1 -0
  730. package/dist/ui.js +118 -0
  731. package/dist/ui.js.map +1 -0
  732. package/dist/untrusted-exec.d.ts +275 -0
  733. package/dist/untrusted-exec.d.ts.map +1 -0
  734. package/dist/untrusted-exec.js +479 -0
  735. package/dist/untrusted-exec.js.map +1 -0
  736. package/dist/untrusted-gate.d.ts +73 -0
  737. package/dist/untrusted-gate.d.ts.map +1 -0
  738. package/dist/untrusted-gate.js +226 -0
  739. package/dist/untrusted-gate.js.map +1 -0
  740. package/dist/uploader.d.ts +153 -0
  741. package/dist/uploader.d.ts.map +1 -0
  742. package/dist/uploader.js +204 -0
  743. package/dist/uploader.js.map +1 -0
  744. package/dist/verifier.d.ts +66 -0
  745. package/dist/verifier.d.ts.map +1 -0
  746. package/dist/verifier.js +170 -0
  747. package/dist/verifier.js.map +1 -0
  748. package/dist/verify-apply.d.ts +26 -0
  749. package/dist/verify-apply.d.ts.map +1 -0
  750. package/dist/verify-apply.js +36 -0
  751. package/dist/verify-apply.js.map +1 -0
  752. package/dist/verify-cmd.d.ts +44 -0
  753. package/dist/verify-cmd.d.ts.map +1 -0
  754. package/dist/verify-cmd.js +125 -0
  755. package/dist/verify-cmd.js.map +1 -0
  756. package/dist/verify-pass.d.ts +73 -0
  757. package/dist/verify-pass.d.ts.map +1 -0
  758. package/dist/verify-pass.js +103 -0
  759. package/dist/verify-pass.js.map +1 -0
  760. package/dist/welcome.d.ts +43 -0
  761. package/dist/welcome.d.ts.map +1 -0
  762. package/dist/welcome.js +116 -0
  763. package/dist/welcome.js.map +1 -0
  764. package/dist/workspace-provisioner.d.ts +65 -0
  765. package/dist/workspace-provisioner.d.ts.map +1 -0
  766. package/dist/workspace-provisioner.js +66 -0
  767. package/dist/workspace-provisioner.js.map +1 -0
  768. package/dist/workspace-quarantine.d.ts +64 -0
  769. package/dist/workspace-quarantine.d.ts.map +1 -0
  770. package/dist/workspace-quarantine.js +156 -0
  771. package/dist/workspace-quarantine.js.map +1 -0
  772. package/dist/workspace-residue-sweep.d.ts +113 -0
  773. package/dist/workspace-residue-sweep.d.ts.map +1 -0
  774. package/dist/workspace-residue-sweep.js +158 -0
  775. package/dist/workspace-residue-sweep.js.map +1 -0
  776. package/dist/workspace.d.ts +639 -0
  777. package/dist/workspace.d.ts.map +1 -0
  778. package/dist/workspace.js +2026 -0
  779. package/dist/workspace.js.map +1 -0
  780. package/package.json +54 -6
  781. package/win/CredProbe.cs +64 -0
  782. package/win/FakeClaude.cs +56 -0
  783. package/win/HandleProbe.cs +116 -0
  784. package/win/TokenProbe.cs +53 -0
  785. package/win/appcontainer.ps1 +500 -0
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RECORD_LIMITS = exports.NO_RECORD = exports.nodeRecordFs = exports.CAPPED_BECAUSE = exports.MAX_FIELD_CHARS = exports.TOOL_CALL_CAP_BYTES = exports.TOOL_CALL_FILE = void 0;
4
+ exports.identityOf = identityOf;
5
+ exports.answerOf = answerOf;
6
+ exports.entryFor = entryFor;
7
+ exports.makeToolCallRecorder = makeToolCallRecorder;
8
+ exports.summariseToolCalls = summariseToolCalls;
9
+ const node_fs_1 = require("node:fs");
10
+ const node_path_1 = require("node:path");
11
+ const tool_protocol_1 = require("./tool-protocol");
12
+ /**
13
+ * WHAT THE BRIDGE ACTUALLY SERVED.
14
+ *
15
+ * 🔴 A MODEL-QUOTED TOOL ERROR COULD NOT BE MATCHED TO ANYTHING. The round's
16
+ * note carries the model's sentence about a tool that failed, and nothing
17
+ * carried the other half — so the one question worth asking, *did the bridge
18
+ * serve what the model says it served*, could not be answered at all, and any
19
+ * argument about it was two people reading the same quote. The capability
20
+ * audit's G-05.
21
+ *
22
+ * ⚠️ THE BRIDGE KEEPS THIS, NOT THE WORKER, and that is the load-bearing
23
+ * choice. `makeToolBridge.call()` is the single funnel: every request arrives
24
+ * there and every response leaves there, INCLUDING every refusal — a role that
25
+ * may not call the tool, an exhausted invocation budget, a request whose shape
26
+ * is wrong, a toolchain that is not there, a worker that did not answer. None
27
+ * of those ever reaches the worker. They are also a large share of what a model
28
+ * quotes, so a record kept on the far side would be missing the cases it exists
29
+ * for.
30
+ *
31
+ * ⚠️ WHAT THE MODEL ASKED FOR IS KEPT; WHAT IT WAS GIVEN, OR ASKED TO WRITE, IS
32
+ * COUNTED AND NEVER COPIED. No `contents`, no `oldText`/`newText`, and none of
33
+ * the response text. Their sizes are already computed for the invocation budget
34
+ * and those numbers go in instead. A project-relative path and a search pattern
35
+ * are what the model chose rather than what the project holds — and this file
36
+ * sits inside the very checkout whose files it would otherwise be copying, so
37
+ * they add nothing a reader of that directory does not already have.
38
+ *
39
+ * ⚠️ THE RUN ID IS THE SWITCH. A record of what a run was served belongs to a
40
+ * run; `scan` and `verify` carry no run id and write nothing, byte for byte as
41
+ * before this existed. It is not a config setting because it could not be one:
42
+ * `LOOPLY_`-prefixed variables are stripped from the provider's environment and
43
+ * this process is spawned BY the provider, which is why the daemon's home is
44
+ * told on argv rather than inherited. And a record that answers a question
45
+ * raised after the fact is worth nothing if it was switched off when the
46
+ * surprise happened, which is G-05 restated.
47
+ */
48
+ /** Beside `events.jsonl` and `run-starts.jsonl`, in the run's own state directory. */
49
+ exports.TOOL_CALL_FILE = 'tool-calls.jsonl';
50
+ /**
51
+ * How large the record may grow in one checkout.
52
+ *
53
+ * A cap rather than a rotation: rewriting an append-only log is how a
54
+ * neighbour's record gets lost, and this file's whole value is that what it
55
+ * says happened, happened. Two megabytes is thousands of calls — far more than
56
+ * the 300 one invocation may make — and it is the file, not the night, that is
57
+ * bounded.
58
+ */
59
+ exports.TOOL_CALL_CAP_BYTES = 2 * 1024 * 1024;
60
+ /** Longest model-chosen string kept on an entry. A pattern is identity, not content. */
61
+ exports.MAX_FIELD_CHARS = 512;
62
+ exports.CAPPED_BECAUSE = `this record reached its cap of ${exports.TOOL_CALL_CAP_BYTES} bytes — tool calls after this line are not recorded here`;
63
+ function clip(v) {
64
+ if (typeof v !== 'string' || v.length === 0)
65
+ return undefined;
66
+ return v.length <= exports.MAX_FIELD_CHARS ? v : `${v.slice(0, exports.MAX_FIELD_CHARS)}…`;
67
+ }
68
+ /**
69
+ * The request's identity, and nothing it carries.
70
+ *
71
+ * Read as `unknown` rather than as a typed request on purpose: this is called
72
+ * on the refusal paths too, where the request failed its shape check and may be
73
+ * any shape at all. A record that threw on a malformed request would be missing
74
+ * exactly the entries a person came looking for.
75
+ */
76
+ function identityOf(raw) {
77
+ if (raw === null || typeof raw !== 'object')
78
+ return {};
79
+ const r = raw;
80
+ const path = clip(r['path']);
81
+ const pattern = clip(r['pattern']);
82
+ const under = clip(r['under']);
83
+ return {
84
+ ...(path === undefined ? {} : { path }),
85
+ ...(pattern === undefined ? {} : { pattern }),
86
+ ...(under === undefined ? {} : { under }),
87
+ };
88
+ }
89
+ /** What an answer cost, never what it contained. */
90
+ function answerOf(res) {
91
+ if (res.ok) {
92
+ const bytes = res.bytes ?? Buffer.byteLength(res.text, 'utf8');
93
+ return { bytes, ...(res.truncated === true ? { truncated: true } : {}) };
94
+ }
95
+ return { code: res.code, because: clip(res.because) ?? '' };
96
+ }
97
+ function entryFor(raw, res, meta) {
98
+ return {
99
+ at: meta.at,
100
+ runId: meta.runId,
101
+ role: meta.role,
102
+ tool: res.tool,
103
+ ok: res.ok,
104
+ ms: meta.ms,
105
+ ...identityOf(raw),
106
+ ...answerOf(res),
107
+ };
108
+ }
109
+ exports.nodeRecordFs = {
110
+ size(path) {
111
+ try {
112
+ return (0, node_fs_1.statSync)(path).size;
113
+ }
114
+ catch {
115
+ return null;
116
+ }
117
+ },
118
+ append(path, line) {
119
+ (0, node_fs_1.appendFileSync)(path, line, 'utf8');
120
+ },
121
+ mkdir(dir) {
122
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
123
+ },
124
+ };
125
+ /** A recorder that keeps nothing — what a bridge with no run id gets. */
126
+ exports.NO_RECORD = { record: () => undefined, total: () => undefined };
127
+ /**
128
+ * The recorder for one bridge, which is one provider invocation.
129
+ *
130
+ * ⚠️ IT SWALLOWS ITS OWN FAILURES, deliberately and to the end. A full disk, a
131
+ * read-only checkout or a path that vanished must cost the round nothing: the
132
+ * tool call has already been served and its answer is already on its way back
133
+ * to the model. Losing a line of the record is a smaller harm than turning a
134
+ * working round into a failed one to complain about bookkeeping.
135
+ */
136
+ function makeToolCallRecorder(stateDir, meta, deps = {}) {
137
+ const fs = deps.fs ?? exports.nodeRecordFs;
138
+ const now = deps.now ?? Date.now;
139
+ const path = (0, node_path_1.join)(stateDir, exports.TOOL_CALL_FILE);
140
+ let closed = false;
141
+ let wrote = false;
142
+ const write = (body) => {
143
+ try {
144
+ fs.mkdir(stateDir);
145
+ // LED BY A NEWLINE, for the reason `RunStartMarks` wrote down: a torn
146
+ // write must cost one record rather than two.
147
+ fs.append(path, `\n${JSON.stringify(body)}\n`);
148
+ return true;
149
+ }
150
+ catch {
151
+ return false;
152
+ }
153
+ };
154
+ return {
155
+ record(raw, res, ms) {
156
+ if (closed)
157
+ return;
158
+ const size = fs.size(path) ?? 0;
159
+ if (size >= exports.TOOL_CALL_CAP_BYTES) {
160
+ /**
161
+ * Already full when this invocation arrived. Nothing is written — not
162
+ * even a notice — because the closing line already standing in the file
163
+ * says the record is closed, and one such line per invocation for the
164
+ * rest of a night would be the unbounded growth the cap exists to stop.
165
+ */
166
+ closed = true;
167
+ return;
168
+ }
169
+ const entry = entryFor(raw, res, {
170
+ runId: meta.runId,
171
+ role: meta.role,
172
+ at: new Date(now()).toISOString(),
173
+ ms,
174
+ });
175
+ if (!write(entry))
176
+ return;
177
+ wrote = true;
178
+ // Crossing the cap makes this the last entry, and it is followed by the
179
+ // one line that says so. Checked AFTER the write so the entry that
180
+ // crossed it is kept rather than discarded — it is as much a fact as the
181
+ // ones before it.
182
+ if ((fs.size(path) ?? 0) >= exports.TOOL_CALL_CAP_BYTES) {
183
+ write({ at: new Date(now()).toISOString(), capped: true, because: exports.CAPPED_BECAUSE });
184
+ closed = true;
185
+ }
186
+ },
187
+ total(spent) {
188
+ // Only for an invocation that actually recorded something. A totals line
189
+ // for an invocation whose entries are not in the file would describe
190
+ // calls a reader cannot find, and a closed record stays closed.
191
+ if (closed || !wrote)
192
+ return;
193
+ write({
194
+ at: new Date(now()).toISOString(),
195
+ runId: meta.runId,
196
+ role: meta.role,
197
+ invocation: true,
198
+ calls: spent.calls,
199
+ bytesRead: spent.bytesRead,
200
+ bytesWritten: spent.bytesWritten,
201
+ });
202
+ },
203
+ };
204
+ }
205
+ function summariseToolCalls(text) {
206
+ if (text === null)
207
+ return null;
208
+ let calls = 0;
209
+ let refused = 0;
210
+ let badLines = 0;
211
+ let capped = false;
212
+ let lastRefusal = null;
213
+ // Plain counters rather than a nullable object built up in place: the total
214
+ // is a fact about the whole file and is assembled once, at the end, where
215
+ // "no invocation said anything" can be told from "they summed to zero".
216
+ let invocations = 0;
217
+ let servedCalls = 0;
218
+ let bytesRead = 0;
219
+ let bytesWritten = 0;
220
+ for (const line of text.split('\n')) {
221
+ const t = line.trim();
222
+ if (t.length === 0)
223
+ continue;
224
+ let v;
225
+ try {
226
+ v = JSON.parse(t);
227
+ }
228
+ catch {
229
+ badLines += 1;
230
+ continue;
231
+ }
232
+ if (v === null || typeof v !== 'object') {
233
+ badLines += 1;
234
+ continue;
235
+ }
236
+ const e = v;
237
+ if (e['capped'] === true) {
238
+ capped = true;
239
+ continue;
240
+ }
241
+ if (e['invocation'] === true) {
242
+ const n = (k) => (typeof e[k] === 'number' && Number.isFinite(e[k]) ? e[k] : 0);
243
+ invocations += 1;
244
+ servedCalls += n('calls');
245
+ bytesRead += n('bytesRead');
246
+ bytesWritten += n('bytesWritten');
247
+ continue;
248
+ }
249
+ if (typeof e['tool'] !== 'string' || typeof e['ok'] !== 'boolean') {
250
+ badLines += 1;
251
+ continue;
252
+ }
253
+ calls += 1;
254
+ if (e['ok'] === false) {
255
+ refused += 1;
256
+ lastRefusal = {
257
+ tool: e['tool'],
258
+ code: typeof e['code'] === 'string' ? e['code'] : 'unknown',
259
+ because: typeof e['because'] === 'string' ? e['because'] : '',
260
+ };
261
+ }
262
+ }
263
+ if (calls === 0 && badLines === 0 && !capped && invocations === 0)
264
+ return null;
265
+ return {
266
+ calls,
267
+ refused,
268
+ badLines,
269
+ capped,
270
+ lastRefusal,
271
+ served: invocations === 0 ? null : { invocations, calls: servedCalls, bytesRead, bytesWritten },
272
+ };
273
+ }
274
+ /** Kept beside the cap so a reader can see the two numbers agree. */
275
+ exports.RECORD_LIMITS = { capBytes: exports.TOOL_CALL_CAP_BYTES, fieldChars: exports.MAX_FIELD_CHARS, readBytes: tool_protocol_1.LIMITS.readBytes };
276
+ //# sourceMappingURL=tool-call-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-call-record.js","sourceRoot":"","sources":["../src/tool-call-record.ts"],"names":[],"mappings":";;;AAkHA,gCAWC;AAGD,4BAMC;AAED,4BAeC;AA0DD,oDAsEC;AA4BD,gDAgEC;AAnXD,qCAA8D;AAC9D,yCAAiC;AACjC,mDAAiH;AAEjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,sFAAsF;AACzE,QAAA,cAAc,GAAG,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,wFAAwF;AAC3E,QAAA,eAAe,GAAG,GAAG,CAAC;AA0CtB,QAAA,cAAc,GACzB,kCAAkC,2BAAmB,2DAA2D,CAAC;AAEnH,SAAS,IAAI,CAAC,CAAU;IACtB,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,OAAO,CAAC,CAAC,MAAM,IAAI,uBAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAe,CAAC,GAAG,CAAC;AAC7E,CAA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D,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,CAAC;YACb,WAAW,GAAG;gBACZ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,IAAI,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC3D,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;aAC9D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,WAAW,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/E,OAAO;QACL,KAAK;QACL,OAAO;QACP,QAAQ;QACR,MAAM;QACN,WAAW;QACX,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE;KAChG,CAAC;AACJ,CAAC;AAED,qEAAqE;AACxD,QAAA,aAAa,GAAG,EAAE,QAAQ,EAAE,2BAAmB,EAAE,UAAU,EAAE,uBAAe,EAAE,SAAS,EAAE,sBAAM,CAAC,SAAS,EAAE,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * WHAT THE MODEL MAY ASK FOR, AND WHAT IT GETS BACK.
3
+ *
4
+ * The provider transport runs OUTSIDE the container — it has to, because the
5
+ * packaged provider spawns children with piped stdio and an AppContainer cannot
6
+ * create the named pipes that requires. So the process holding the model is no
7
+ * longer the untrusted executor, and the boundary moves:
8
+ *
9
+ * the model has no host tools at all; every capability it can call is one of
10
+ * these, implemented by Looply, and performed inside the container.
11
+ *
12
+ * That is the whole point of this file. It is a data contract, not a
13
+ * capability: nothing here executes anything, and a request that arrives
14
+ * malformed or hostile is a value to reject rather than a path to follow.
15
+ *
16
+ * NOTHING HERE RUNS A COMMAND. There is deliberately no shell, no exec, no
17
+ * "run", no git and no fetch. Project code is executed in exactly one place —
18
+ * the gate — under Looply's own orchestration, never at the model's request.
19
+ */
20
+ /** The tools a model may call. Adding one is a security decision. */
21
+ export declare const TOOL_NAMES: readonly ["read", "glob", "grep", "edit", "write"];
22
+ export type ToolName = (typeof TOOL_NAMES)[number];
23
+ /**
24
+ * Bounds on a single call.
25
+ *
26
+ * A tool result becomes model context, and an unbounded one is both a way to
27
+ * exhaust this machine's memory and a way to spend the round's budget in one
28
+ * call. These are ceilings, not promises: a worker may return less.
29
+ */
30
+ export declare const LIMITS: {
31
+ /** A file the model reads. Larger files come back truncated, and say so. */
32
+ readonly readBytes: number;
33
+ /** Lines returned from one read. */
34
+ readonly readLines: 4000;
35
+ /** Paths from one glob. */
36
+ readonly globPaths: 1000;
37
+ /** Matching lines from one grep. */
38
+ readonly grepMatches: 200;
39
+ /** Bytes of one written or edited file. */
40
+ readonly writeBytes: number;
41
+ /** Files walked before a glob or grep gives up and says it was truncated. */
42
+ readonly walkFiles: 20000;
43
+ };
44
+ /**
45
+ * Bounds across ONE provider invocation.
46
+ *
47
+ * The model may call tools many times inside a single session — that is the
48
+ * point of the design, and it is also a loop nobody is watching. These are the
49
+ * inner safety budget. They are deliberately NOT the Goal or autonomy budgets,
50
+ * which count provider invocations and belong to Phase 6.
51
+ */
52
+ export declare const INVOCATION_BUDGET: {
53
+ readonly calls: 300;
54
+ readonly bytesRead: number;
55
+ readonly bytesWritten: number;
56
+ };
57
+ export interface ReadRequest {
58
+ tool: 'read';
59
+ /** Project-relative. Absolute, UNC, device and escaping paths are refused. */
60
+ path: string;
61
+ /** 1-based, inclusive. Omitted means from the start. */
62
+ fromLine?: number;
63
+ /** 1-based, inclusive. Omitted means to the end, subject to the limits. */
64
+ toLine?: number;
65
+ }
66
+ export interface GlobRequest {
67
+ tool: 'glob';
68
+ /** A `*`/`**`/`?` pattern, matched against project-relative paths. */
69
+ pattern: string;
70
+ /** Project-relative subdirectory to search under. */
71
+ under?: string;
72
+ }
73
+ export interface GrepRequest {
74
+ tool: 'grep';
75
+ /** A JavaScript regular expression source. */
76
+ pattern: string;
77
+ /** Restrict to paths matching this glob. */
78
+ include?: string;
79
+ under?: string;
80
+ ignoreCase?: boolean;
81
+ }
82
+ export interface EditRequest {
83
+ tool: 'edit';
84
+ path: string;
85
+ /**
86
+ * The text as the model believes it currently is.
87
+ *
88
+ * An edit that carries its expectation can be applied at most once: replaying
89
+ * it finds the text already gone and fails, which is what makes a retried
90
+ * turn safe. A fuzzy match would silently do something else.
91
+ */
92
+ oldText: string;
93
+ newText: string;
94
+ /** How many occurrences the model expects. Defaults to exactly one. */
95
+ expected?: number;
96
+ }
97
+ export interface WriteRequest {
98
+ tool: 'write';
99
+ path: string;
100
+ contents: string;
101
+ /** `create` refuses to clobber; `overwrite` requires the file to exist. */
102
+ intent: 'create' | 'overwrite';
103
+ }
104
+ export type ToolRequest = ReadRequest | GlobRequest | GrepRequest | EditRequest | WriteRequest;
105
+ /**
106
+ * The answer to one call.
107
+ *
108
+ * A refusal is a VALUE, not an exception: the model is expected to be told "no"
109
+ * and to carry on, and a transport-level error would end the session instead.
110
+ */
111
+ export type ToolResponse = {
112
+ ok: true;
113
+ tool: ToolName;
114
+ text: string;
115
+ truncated?: boolean;
116
+ bytes?: number;
117
+ } | {
118
+ ok: false;
119
+ tool: ToolName | 'unknown';
120
+ because: string;
121
+ code: ToolErrorCode;
122
+ };
123
+ export type ToolErrorCode = 'bad_request' | 'path_not_allowed' | 'not_found' | 'denied' | 'not_text' | 'precondition_failed' | 'too_large' | 'budget_exhausted' | 'worker_failed';
124
+ /**
125
+ * A first, LEXICAL check on a model-supplied path.
126
+ *
127
+ * Deliberately not the boundary. It runs in trusted code, so a bug here is a
128
+ * bug in the trusted process, and the whole architecture is arranged so that
129
+ * such a bug is survivable: the worker resolves the physical path and the
130
+ * container refuses what it was never granted. This exists to turn obvious
131
+ * nonsense into a clean structured refusal instead of a container denial that
132
+ * reads like a crash.
133
+ */
134
+ export declare function pathTrouble(p: string): string | null;
135
+ //# sourceMappingURL=tool-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-protocol.d.ts","sourceRoot":"","sources":["../src/tool-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qEAAqE;AACrE,eAAO,MAAM,UAAU,oDAAqD,CAAC;AAC7E,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;IACjB,4EAA4E;;IAE5E,oCAAoC;;IAEpC,2BAA2B;;IAE3B,oCAAoC;;IAEpC,2CAA2C;;IAE3C,6EAA6E;;CAErE,CAAC;AAEX;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;CAIpB,CAAC;AAEX,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CA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AT IT GETS BACK.
4
+ *
5
+ * The provider transport runs OUTSIDE the container — it has to, because the
6
+ * packaged provider spawns children with piped stdio and an AppContainer cannot
7
+ * create the named pipes that requires. So the process holding the model is no
8
+ * longer the untrusted executor, and the boundary moves:
9
+ *
10
+ * the model has no host tools at all; every capability it can call is one of
11
+ * these, implemented by Looply, and performed inside the container.
12
+ *
13
+ * That is the whole point of this file. It is a data contract, not a
14
+ * capability: nothing here executes anything, and a request that arrives
15
+ * malformed or hostile is a value to reject rather than a path to follow.
16
+ *
17
+ * NOTHING HERE RUNS A COMMAND. There is deliberately no shell, no exec, no
18
+ * "run", no git and no fetch. Project code is executed in exactly one place —
19
+ * the gate — under Looply's own orchestration, never at the model's request.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.INVOCATION_BUDGET = exports.LIMITS = exports.TOOL_NAMES = void 0;
23
+ exports.pathTrouble = pathTrouble;
24
+ /** The tools a model may call. Adding one is a security decision. */
25
+ exports.TOOL_NAMES = ['read', 'glob', 'grep', 'edit', 'write'];
26
+ /**
27
+ * Bounds on a single call.
28
+ *
29
+ * A tool result becomes model context, and an unbounded one is both a way to
30
+ * exhaust this machine's memory and a way to spend the round's budget in one
31
+ * call. These are ceilings, not promises: a worker may return less.
32
+ */
33
+ exports.LIMITS = {
34
+ /** A file the model reads. Larger files come back truncated, and say so. */
35
+ readBytes: 256 * 1024,
36
+ /** Lines returned from one read. */
37
+ readLines: 4000,
38
+ /** Paths from one glob. */
39
+ globPaths: 1000,
40
+ /** Matching lines from one grep. */
41
+ grepMatches: 200,
42
+ /** Bytes of one written or edited file. */
43
+ writeBytes: 1024 * 1024,
44
+ /** Files walked before a glob or grep gives up and says it was truncated. */
45
+ walkFiles: 20_000,
46
+ };
47
+ /**
48
+ * Bounds across ONE provider invocation.
49
+ *
50
+ * The model may call tools many times inside a single session — that is the
51
+ * point of the design, and it is also a loop nobody is watching. These are the
52
+ * inner safety budget. They are deliberately NOT the Goal or autonomy budgets,
53
+ * which count provider invocations and belong to Phase 6.
54
+ */
55
+ exports.INVOCATION_BUDGET = {
56
+ calls: 300,
57
+ bytesRead: 16 * 1024 * 1024,
58
+ bytesWritten: 8 * 1024 * 1024,
59
+ };
60
+ /**
61
+ * A first, LEXICAL check on a model-supplied path.
62
+ *
63
+ * Deliberately not the boundary. It runs in trusted code, so a bug here is a
64
+ * bug in the trusted process, and the whole architecture is arranged so that
65
+ * such a bug is survivable: the worker resolves the physical path and the
66
+ * container refuses what it was never granted. This exists to turn obvious
67
+ * nonsense into a clean structured refusal instead of a container denial that
68
+ * reads like a crash.
69
+ */
70
+ function pathTrouble(p) {
71
+ // Separators are built from char codes on purpose. An escaped backslash in
72
+ // this file has been collapsed by tooling more than once, and a path check
73
+ // that silently stops matching is the worst possible thing to get wrong.
74
+ const BS = String.fromCharCode(92);
75
+ const SL = String.fromCharCode(47);
76
+ const NUL = String.fromCharCode(0);
77
+ if (typeof p !== 'string' || p.length === 0)
78
+ return 'a path is required';
79
+ if (p.length > 1024)
80
+ return 'that path is too long';
81
+ if (p.indexOf(NUL) >= 0)
82
+ return 'a path may not contain a null byte';
83
+ // Drive-qualified, UNC and device paths all name somewhere that is not the
84
+ // project, and the project root is Looply's to decide, not the model's.
85
+ if (/^[A-Za-z]:/.test(p))
86
+ return 'paths are project-relative, not drive-qualified';
87
+ if (p.startsWith(BS + BS) || p.startsWith(SL + SL)) {
88
+ return 'a UNC path is not a project path';
89
+ }
90
+ if (p.startsWith(BS + '?' + BS) || p.startsWith(BS + '.' + BS)) {
91
+ return 'a device path is not a project path';
92
+ }
93
+ if (p.startsWith(SL) || p.startsWith(BS))
94
+ return 'paths are project-relative';
95
+ const parts = p.split(BS).join(SL).split(SL);
96
+ // `..` at any depth, however it is spelled.
97
+ if (parts.some((s) => s === '..'))
98
+ return 'a path may not leave the project';
99
+ // An alternate data stream is a second file hiding behind the same name.
100
+ if (parts.some((s) => s.includes(':')))
101
+ return 'a path may not name a stream';
102
+ return null;
103
+ }
104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CAAC;IACpD,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,oCAAoC,CAAC;IACrE,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,iDAAiD,CAAC;IACnF,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;QACnD,OAAO,kCAAkC,CAAC;IAC5C,CAAC;IACD,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;QAC/D,OAAO,qCAAqC,CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;QAAE,OAAO,4BAA4B,CAAC;IAC9E,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7C,4CAA4C;IAC5C,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;QAAE,OAAO,kCAAkC,CAAC;IAC7E,yEAAyE;IACzE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAE,OAAO,8BAA8B,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolRequest, ToolResponse } from './tool-protocol';
2
+ export declare function handle(root: string, req: ToolRequest): ToolResponse;
3
+ //# sourceMappingURL=tool-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-worker.d.ts","sourceRoot":"","sources":["../src/tool-worker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA6RjE,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,YAAY,CA+JnE"}