@blxzer/pactile 0.6.0-beta.2 → 0.6.0-beta.4

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 (703) hide show
  1. package/README.md +93 -84
  2. package/README.zh-CN.md +90 -81
  3. package/dist/bin/compat-warning.d.ts +2 -0
  4. package/dist/bin/compat-warning.d.ts.map +1 -0
  5. package/dist/bin/compat-warning.js +8 -0
  6. package/dist/bin/compat-warning.js.map +1 -0
  7. package/dist/bin/cstl.d.ts +3 -0
  8. package/dist/bin/cstl.d.ts.map +1 -0
  9. package/{bin → dist/bin}/cstl.js +2 -3
  10. package/dist/bin/cstl.js.map +1 -0
  11. package/dist/bin/pactile.d.ts +3 -0
  12. package/dist/bin/pactile.d.ts.map +1 -0
  13. package/dist/bin/pactile.js +4 -0
  14. package/dist/bin/pactile.js.map +1 -0
  15. package/dist/cli/index.d.ts.map +1 -1
  16. package/dist/cli/index.js +77 -17
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/commands/capability.d.ts +3 -0
  19. package/dist/commands/capability.d.ts.map +1 -0
  20. package/dist/commands/capability.js +129 -0
  21. package/dist/commands/capability.js.map +1 -0
  22. package/dist/commands/codex.d.ts.map +1 -1
  23. package/dist/commands/codex.js +54 -6
  24. package/dist/commands/codex.js.map +1 -1
  25. package/dist/commands/context.d.ts +2 -0
  26. package/dist/commands/context.d.ts.map +1 -1
  27. package/dist/commands/context.js +367 -41
  28. package/dist/commands/context.js.map +1 -1
  29. package/dist/commands/detach.d.ts.map +1 -1
  30. package/dist/commands/detach.js +5 -4
  31. package/dist/commands/detach.js.map +1 -1
  32. package/dist/commands/init.d.ts.map +1 -1
  33. package/dist/commands/init.js +615 -259
  34. package/dist/commands/init.js.map +1 -1
  35. package/dist/commands/legacy-task.d.ts +3 -0
  36. package/dist/commands/legacy-task.d.ts.map +1 -0
  37. package/dist/commands/legacy-task.js +295 -0
  38. package/dist/commands/legacy-task.js.map +1 -0
  39. package/dist/commands/pi.d.ts +3 -2
  40. package/dist/commands/pi.d.ts.map +1 -1
  41. package/dist/commands/pi.js +333 -10
  42. package/dist/commands/pi.js.map +1 -1
  43. package/dist/commands/session.d.ts.map +1 -1
  44. package/dist/commands/session.js +148 -24
  45. package/dist/commands/session.js.map +1 -1
  46. package/dist/commands/task-schedule.d.ts +17 -0
  47. package/dist/commands/task-schedule.d.ts.map +1 -0
  48. package/dist/commands/task-schedule.js +395 -0
  49. package/dist/commands/task-schedule.js.map +1 -0
  50. package/dist/commands/task-verify-plan.d.ts +3 -0
  51. package/dist/commands/task-verify-plan.d.ts.map +1 -0
  52. package/dist/commands/task-verify-plan.js +503 -0
  53. package/dist/commands/task-verify-plan.js.map +1 -0
  54. package/dist/commands/task-worktree-close.d.ts +4 -0
  55. package/dist/commands/task-worktree-close.d.ts.map +1 -0
  56. package/dist/commands/task-worktree-close.js +81 -0
  57. package/dist/commands/task-worktree-close.js.map +1 -0
  58. package/dist/commands/task.d.ts +3 -0
  59. package/dist/commands/task.d.ts.map +1 -1
  60. package/dist/commands/task.js +1373 -184
  61. package/dist/commands/task.js.map +1 -1
  62. package/dist/commands/tile-selection.d.ts +3 -0
  63. package/dist/commands/tile-selection.d.ts.map +1 -0
  64. package/dist/commands/tile-selection.js +174 -0
  65. package/dist/commands/tile-selection.js.map +1 -0
  66. package/dist/commands/update.d.ts +1 -1
  67. package/dist/commands/update.d.ts.map +1 -1
  68. package/dist/commands/update.js +80 -55
  69. package/dist/commands/update.js.map +1 -1
  70. package/dist/commands/worktree.d.ts +4 -0
  71. package/dist/commands/worktree.d.ts.map +1 -0
  72. package/dist/commands/worktree.js +198 -0
  73. package/dist/commands/worktree.js.map +1 -0
  74. package/dist/configurators/shared.js +1 -1
  75. package/dist/configurators/shared.js.map +1 -1
  76. package/dist/core/compat/environment.d.ts +0 -1
  77. package/dist/core/compat/environment.d.ts.map +1 -1
  78. package/dist/core/compat/environment.js +1 -9
  79. package/dist/core/compat/environment.js.map +1 -1
  80. package/dist/core/pactile/bounded-capabilities.d.ts +127 -0
  81. package/dist/core/pactile/bounded-capabilities.d.ts.map +1 -0
  82. package/dist/core/pactile/bounded-capabilities.js +188 -0
  83. package/dist/core/pactile/bounded-capabilities.js.map +1 -0
  84. package/dist/core/pactile/index.d.ts +1 -0
  85. package/dist/core/pactile/index.d.ts.map +1 -1
  86. package/dist/core/pactile/index.js +1 -0
  87. package/dist/core/pactile/index.js.map +1 -1
  88. package/dist/core/task/index.d.ts +4 -2
  89. package/dist/core/task/index.d.ts.map +1 -1
  90. package/dist/core/task/index.js +2 -1
  91. package/dist/core/task/index.js.map +1 -1
  92. package/dist/core/task/kernel-cli.d.ts +14 -1
  93. package/dist/core/task/kernel-cli.d.ts.map +1 -1
  94. package/dist/core/task/kernel-cli.js +128 -0
  95. package/dist/core/task/kernel-cli.js.map +1 -1
  96. package/dist/core/task/kernel-contract.d.ts +6 -3
  97. package/dist/core/task/kernel-contract.d.ts.map +1 -1
  98. package/dist/core/task/kernel-contract.js +71 -23
  99. package/dist/core/task/kernel-contract.js.map +1 -1
  100. package/dist/core/task/kernel-store.d.ts +6 -0
  101. package/dist/core/task/kernel-store.d.ts.map +1 -1
  102. package/dist/core/task/kernel-store.js +54 -2
  103. package/dist/core/task/kernel-store.js.map +1 -1
  104. package/dist/core/task/legacy-task-migration-reader.d.ts +137 -0
  105. package/dist/core/task/legacy-task-migration-reader.d.ts.map +1 -0
  106. package/dist/core/task/legacy-task-migration-reader.js +512 -0
  107. package/dist/core/task/legacy-task-migration-reader.js.map +1 -0
  108. package/dist/core/task/legacy-task-migration.d.ts +105 -0
  109. package/dist/core/task/legacy-task-migration.d.ts.map +1 -0
  110. package/dist/core/task/legacy-task-migration.js +562 -0
  111. package/dist/core/task/legacy-task-migration.js.map +1 -0
  112. package/dist/core/task/legacy-task-overlay-durable-io.d.ts +18 -0
  113. package/dist/core/task/legacy-task-overlay-durable-io.d.ts.map +1 -0
  114. package/dist/core/task/legacy-task-overlay-durable-io.js +66 -0
  115. package/dist/core/task/legacy-task-overlay-durable-io.js.map +1 -0
  116. package/dist/core/task/legacy-task-reconciliation-reader.d.ts +26 -0
  117. package/dist/core/task/legacy-task-reconciliation-reader.d.ts.map +1 -0
  118. package/dist/core/task/legacy-task-reconciliation-reader.js +324 -0
  119. package/dist/core/task/legacy-task-reconciliation-reader.js.map +1 -0
  120. package/dist/core/task/legacy-task-v2-import.d.ts +67 -0
  121. package/dist/core/task/legacy-task-v2-import.d.ts.map +1 -0
  122. package/dist/core/task/legacy-task-v2-import.js +1046 -0
  123. package/dist/core/task/legacy-task-v2-import.js.map +1 -0
  124. package/dist/core/task/project-file-observer.d.ts +46 -0
  125. package/dist/core/task/project-file-observer.d.ts.map +1 -0
  126. package/dist/core/task/project-file-observer.js +618 -0
  127. package/dist/core/task/project-file-observer.js.map +1 -0
  128. package/dist/core/task/start-authority.d.ts +14 -0
  129. package/dist/core/task/start-authority.d.ts.map +1 -0
  130. package/dist/core/task/start-authority.js +146 -0
  131. package/dist/core/task/start-authority.js.map +1 -0
  132. package/dist/core/task/strategy.d.ts +24 -0
  133. package/dist/core/task/strategy.d.ts.map +1 -0
  134. package/dist/core/task/strategy.js +136 -0
  135. package/dist/core/task/strategy.js.map +1 -0
  136. package/dist/core/task/task-candidate-observer.d.ts +111 -0
  137. package/dist/core/task/task-candidate-observer.d.ts.map +1 -0
  138. package/dist/core/task/task-candidate-observer.js +762 -0
  139. package/dist/core/task/task-candidate-observer.js.map +1 -0
  140. package/dist/core/task/task-kernel-close.d.ts +5 -0
  141. package/dist/core/task/task-kernel-close.d.ts.map +1 -0
  142. package/dist/core/task/task-kernel-close.js +367 -0
  143. package/dist/core/task/task-kernel-close.js.map +1 -0
  144. package/dist/core/task/task-kernel-dependencies.d.ts +3 -0
  145. package/dist/core/task/task-kernel-dependencies.d.ts.map +1 -0
  146. package/dist/core/task/task-kernel-dependencies.js +24 -0
  147. package/dist/core/task/task-kernel-dependencies.js.map +1 -0
  148. package/dist/core/task/task-kernel-host.d.ts +5 -0
  149. package/dist/core/task/task-kernel-host.d.ts.map +1 -0
  150. package/dist/core/task/task-kernel-host.js +136 -0
  151. package/dist/core/task/task-kernel-host.js.map +1 -0
  152. package/dist/core/task/task-kernel-paths.d.ts +19 -0
  153. package/dist/core/task/task-kernel-paths.d.ts.map +1 -0
  154. package/dist/core/task/task-kernel-paths.js +237 -0
  155. package/dist/core/task/task-kernel-paths.js.map +1 -0
  156. package/dist/core/task/task-kernel-reviews.d.ts +3 -0
  157. package/dist/core/task/task-kernel-reviews.d.ts.map +1 -0
  158. package/dist/core/task/task-kernel-reviews.js +100 -0
  159. package/dist/core/task/task-kernel-reviews.js.map +1 -0
  160. package/dist/core/task/task-kernel-runs.d.ts +5 -0
  161. package/dist/core/task/task-kernel-runs.d.ts.map +1 -0
  162. package/dist/core/task/task-kernel-runs.js +196 -0
  163. package/dist/core/task/task-kernel-runs.js.map +1 -0
  164. package/dist/core/task/task-kernel-schema.d.ts +29 -0
  165. package/dist/core/task/task-kernel-schema.d.ts.map +1 -0
  166. package/dist/core/task/task-kernel-schema.js +1169 -0
  167. package/dist/core/task/task-kernel-schema.js.map +1 -0
  168. package/dist/core/task/task-kernel-store-v2.d.ts +33 -0
  169. package/dist/core/task/task-kernel-store-v2.d.ts.map +1 -0
  170. package/dist/core/task/task-kernel-store-v2.js +574 -0
  171. package/dist/core/task/task-kernel-store-v2.js.map +1 -0
  172. package/dist/core/task/task-kernel-types.d.ts +585 -0
  173. package/dist/core/task/task-kernel-types.d.ts.map +1 -0
  174. package/dist/core/task/task-kernel-types.js +31 -0
  175. package/dist/core/task/task-kernel-types.js.map +1 -0
  176. package/dist/core/task/task-kernel-workspaces.d.ts +10 -0
  177. package/dist/core/task/task-kernel-workspaces.d.ts.map +1 -0
  178. package/dist/core/task/task-kernel-workspaces.js +250 -0
  179. package/dist/core/task/task-kernel-workspaces.js.map +1 -0
  180. package/dist/core/task/task-kernel-write-set.d.ts +3 -0
  181. package/dist/core/task/task-kernel-write-set.d.ts.map +1 -0
  182. package/dist/core/task/task-kernel-write-set.js +12 -0
  183. package/dist/core/task/task-kernel-write-set.js.map +1 -0
  184. package/dist/core/task/task-kernel.d.ts +19 -0
  185. package/dist/core/task/task-kernel.d.ts.map +1 -0
  186. package/dist/core/task/task-kernel.js +17 -0
  187. package/dist/core/task/task-kernel.js.map +1 -0
  188. package/dist/core/task/task-pull-request-observer.d.ts +25 -0
  189. package/dist/core/task/task-pull-request-observer.d.ts.map +1 -0
  190. package/dist/core/task/task-pull-request-observer.js +187 -0
  191. package/dist/core/task/task-pull-request-observer.js.map +1 -0
  192. package/dist/core/task/task-review-evidence.d.ts +27 -0
  193. package/dist/core/task/task-review-evidence.d.ts.map +1 -0
  194. package/dist/core/task/task-review-evidence.js +383 -0
  195. package/dist/core/task/task-review-evidence.js.map +1 -0
  196. package/dist/migrations/index.d.ts +1 -1
  197. package/dist/migrations/index.d.ts.map +1 -1
  198. package/dist/migrations/index.js +5 -3
  199. package/dist/migrations/index.js.map +1 -1
  200. package/dist/migrations/manifests/0.6.0-beta.3.json +9 -0
  201. package/dist/migrations/manifests/0.6.0-beta.4.json +9 -0
  202. package/dist/pactile/artifacts/documents.d.ts +72 -0
  203. package/dist/pactile/artifacts/documents.d.ts.map +1 -0
  204. package/dist/pactile/artifacts/documents.js +406 -0
  205. package/dist/pactile/artifacts/documents.js.map +1 -0
  206. package/dist/pactile/artifacts/index.d.ts +6 -0
  207. package/dist/pactile/artifacts/index.d.ts.map +1 -0
  208. package/dist/pactile/artifacts/index.js +6 -0
  209. package/dist/pactile/artifacts/index.js.map +1 -0
  210. package/dist/pactile/artifacts/projection.d.ts +50 -0
  211. package/dist/pactile/artifacts/projection.d.ts.map +1 -0
  212. package/dist/pactile/artifacts/projection.js +139 -0
  213. package/dist/pactile/artifacts/projection.js.map +1 -0
  214. package/dist/pactile/artifacts/reader.d.ts +20 -0
  215. package/dist/pactile/artifacts/reader.d.ts.map +1 -0
  216. package/dist/pactile/artifacts/reader.js +559 -0
  217. package/dist/pactile/artifacts/reader.js.map +1 -0
  218. package/dist/pactile/artifacts/schema.d.ts +4 -0
  219. package/dist/pactile/artifacts/schema.d.ts.map +1 -0
  220. package/dist/pactile/artifacts/schema.js +217 -0
  221. package/dist/pactile/artifacts/schema.js.map +1 -0
  222. package/dist/pactile/artifacts/types.d.ts +66 -0
  223. package/dist/pactile/artifacts/types.d.ts.map +1 -0
  224. package/dist/pactile/artifacts/types.js +45 -0
  225. package/dist/pactile/artifacts/types.js.map +1 -0
  226. package/dist/pactile/capabilities/claim.d.ts +3 -0
  227. package/dist/pactile/capabilities/claim.d.ts.map +1 -0
  228. package/dist/pactile/capabilities/claim.js +97 -0
  229. package/dist/pactile/capabilities/claim.js.map +1 -0
  230. package/dist/pactile/capabilities/command.d.ts +6 -0
  231. package/dist/pactile/capabilities/command.d.ts.map +1 -0
  232. package/dist/pactile/capabilities/command.js +253 -0
  233. package/dist/pactile/capabilities/command.js.map +1 -0
  234. package/dist/pactile/capabilities/discover.d.ts +6 -0
  235. package/dist/pactile/capabilities/discover.d.ts.map +1 -0
  236. package/dist/pactile/capabilities/discover.js +48 -0
  237. package/dist/pactile/capabilities/discover.js.map +1 -0
  238. package/dist/pactile/capabilities/node.d.ts +15 -0
  239. package/dist/pactile/capabilities/node.d.ts.map +1 -0
  240. package/dist/pactile/capabilities/node.js +292 -0
  241. package/dist/pactile/capabilities/node.js.map +1 -0
  242. package/dist/pactile/capabilities/read.d.ts +6 -0
  243. package/dist/pactile/capabilities/read.d.ts.map +1 -0
  244. package/dist/pactile/capabilities/read.js +100 -0
  245. package/dist/pactile/capabilities/read.js.map +1 -0
  246. package/dist/pactile/capabilities/receipts.d.ts +17 -0
  247. package/dist/pactile/capabilities/receipts.d.ts.map +1 -0
  248. package/dist/pactile/capabilities/receipts.js +90 -0
  249. package/dist/pactile/capabilities/receipts.js.map +1 -0
  250. package/dist/pactile/capabilities/search.d.ts +6 -0
  251. package/dist/pactile/capabilities/search.d.ts.map +1 -0
  252. package/dist/pactile/capabilities/search.js +181 -0
  253. package/dist/pactile/capabilities/search.js.map +1 -0
  254. package/dist/pactile/capabilities/shared.d.ts +29 -0
  255. package/dist/pactile/capabilities/shared.d.ts.map +1 -0
  256. package/dist/pactile/capabilities/shared.js +134 -0
  257. package/dist/pactile/capabilities/shared.js.map +1 -0
  258. package/dist/pactile/capabilities/workspace.d.ts +19 -0
  259. package/dist/pactile/capabilities/workspace.d.ts.map +1 -0
  260. package/dist/pactile/capabilities/workspace.js +273 -0
  261. package/dist/pactile/capabilities/workspace.js.map +1 -0
  262. package/dist/pactile/codex/bridge.d.ts +105 -2
  263. package/dist/pactile/codex/bridge.d.ts.map +1 -1
  264. package/dist/pactile/codex/bridge.js +1266 -92
  265. package/dist/pactile/codex/bridge.js.map +1 -1
  266. package/dist/pactile/codex/dispatch-stop-proof.d.ts +43 -0
  267. package/dist/pactile/codex/dispatch-stop-proof.d.ts.map +1 -0
  268. package/dist/pactile/codex/dispatch-stop-proof.js +177 -0
  269. package/dist/pactile/codex/dispatch-stop-proof.js.map +1 -0
  270. package/dist/pactile/codex/host-stop.d.ts +47 -0
  271. package/dist/pactile/codex/host-stop.d.ts.map +1 -0
  272. package/dist/pactile/codex/host-stop.js +344 -0
  273. package/dist/pactile/codex/host-stop.js.map +1 -0
  274. package/dist/pactile/coordination/index.d.ts +4 -0
  275. package/dist/pactile/coordination/index.d.ts.map +1 -0
  276. package/dist/pactile/coordination/index.js +4 -0
  277. package/dist/pactile/coordination/index.js.map +1 -0
  278. package/dist/pactile/coordination/journal.d.ts +10 -0
  279. package/dist/pactile/coordination/journal.d.ts.map +1 -0
  280. package/dist/pactile/coordination/journal.js +255 -0
  281. package/dist/pactile/coordination/journal.js.map +1 -0
  282. package/dist/pactile/coordination/kernel-resume.d.ts +8 -0
  283. package/dist/pactile/coordination/kernel-resume.d.ts.map +1 -0
  284. package/dist/pactile/coordination/kernel-resume.js +87 -0
  285. package/dist/pactile/coordination/kernel-resume.js.map +1 -0
  286. package/dist/pactile/coordination/model.d.ts +553 -0
  287. package/dist/pactile/coordination/model.d.ts.map +1 -0
  288. package/dist/pactile/coordination/model.js +239 -0
  289. package/dist/pactile/coordination/model.js.map +1 -0
  290. package/dist/pactile/coordination/state.d.ts +46 -0
  291. package/dist/pactile/coordination/state.d.ts.map +1 -0
  292. package/dist/pactile/coordination/state.js +301 -0
  293. package/dist/pactile/coordination/state.js.map +1 -0
  294. package/dist/pactile/coordination/store.d.ts +94 -0
  295. package/dist/pactile/coordination/store.d.ts.map +1 -0
  296. package/dist/pactile/coordination/store.js +396 -0
  297. package/dist/pactile/coordination/store.js.map +1 -0
  298. package/dist/pactile/index.d.ts +7 -1
  299. package/dist/pactile/index.d.ts.map +1 -1
  300. package/dist/pactile/index.js +7 -1
  301. package/dist/pactile/index.js.map +1 -1
  302. package/dist/pactile/jev/contracts.d.ts +104 -0
  303. package/dist/pactile/jev/contracts.d.ts.map +1 -0
  304. package/dist/pactile/jev/contracts.js +53 -0
  305. package/dist/pactile/jev/contracts.js.map +1 -0
  306. package/dist/pactile/jev/decision.d.ts +58 -0
  307. package/dist/pactile/jev/decision.d.ts.map +1 -0
  308. package/dist/pactile/jev/decision.js +149 -0
  309. package/dist/pactile/jev/decision.js.map +1 -0
  310. package/dist/pactile/jev/http.d.ts +25 -0
  311. package/dist/pactile/jev/http.d.ts.map +1 -0
  312. package/dist/pactile/jev/http.js +234 -0
  313. package/dist/pactile/jev/http.js.map +1 -0
  314. package/dist/pactile/jev/index.d.ts +8 -0
  315. package/dist/pactile/jev/index.d.ts.map +1 -0
  316. package/dist/pactile/jev/index.js +4 -0
  317. package/dist/pactile/jev/index.js.map +1 -0
  318. package/dist/pactile/jev/outbound.d.ts +15 -0
  319. package/dist/pactile/jev/outbound.d.ts.map +1 -0
  320. package/dist/pactile/jev/outbound.js +264 -0
  321. package/dist/pactile/jev/outbound.js.map +1 -0
  322. package/dist/pactile/jev/project-policy.d.ts +10 -0
  323. package/dist/pactile/jev/project-policy.d.ts.map +1 -0
  324. package/dist/pactile/jev/project-policy.js +53 -0
  325. package/dist/pactile/jev/project-policy.js.map +1 -0
  326. package/dist/pactile/jev/response.d.ts +17 -0
  327. package/dist/pactile/jev/response.d.ts.map +1 -0
  328. package/dist/pactile/jev/response.js +280 -0
  329. package/dist/pactile/jev/response.js.map +1 -0
  330. package/dist/pactile/jev/scheduler-advice.d.ts +92 -0
  331. package/dist/pactile/jev/scheduler-advice.d.ts.map +1 -0
  332. package/dist/pactile/jev/scheduler-advice.js +323 -0
  333. package/dist/pactile/jev/scheduler-advice.js.map +1 -0
  334. package/dist/pactile/jev/transport.d.ts +6 -0
  335. package/dist/pactile/jev/transport.d.ts.map +1 -0
  336. package/dist/pactile/jev/transport.js +87 -0
  337. package/dist/pactile/jev/transport.js.map +1 -0
  338. package/dist/pactile/lifecycle/deferred-live.d.ts +17 -0
  339. package/dist/pactile/lifecycle/deferred-live.d.ts.map +1 -0
  340. package/dist/pactile/lifecycle/deferred-live.js +173 -0
  341. package/dist/pactile/lifecycle/deferred-live.js.map +1 -0
  342. package/dist/pactile/lifecycle/legacy-import.d.ts +1 -1
  343. package/dist/pactile/lifecycle/legacy-import.js +3 -3
  344. package/dist/pactile/lifecycle/legacy-import.js.map +1 -1
  345. package/dist/pactile/lifecycle/project-files.d.ts.map +1 -1
  346. package/dist/pactile/lifecycle/project-files.js +1 -0
  347. package/dist/pactile/lifecycle/project-files.js.map +1 -1
  348. package/dist/pactile/migration/legacy-task-batch-generation.d.ts +23 -0
  349. package/dist/pactile/migration/legacy-task-batch-generation.d.ts.map +1 -0
  350. package/dist/pactile/migration/legacy-task-batch-generation.js +102 -0
  351. package/dist/pactile/migration/legacy-task-batch-generation.js.map +1 -0
  352. package/dist/pactile/migration/legacy-task-batch-io.d.ts +9 -0
  353. package/dist/pactile/migration/legacy-task-batch-io.d.ts.map +1 -0
  354. package/dist/pactile/migration/legacy-task-batch-io.js +208 -0
  355. package/dist/pactile/migration/legacy-task-batch-io.js.map +1 -0
  356. package/dist/pactile/migration/legacy-task-batch-journal.d.ts +6 -0
  357. package/dist/pactile/migration/legacy-task-batch-journal.d.ts.map +1 -0
  358. package/dist/pactile/migration/legacy-task-batch-journal.js +121 -0
  359. package/dist/pactile/migration/legacy-task-batch-journal.js.map +1 -0
  360. package/dist/pactile/migration/legacy-task-batch-orchestrator.d.ts +18 -0
  361. package/dist/pactile/migration/legacy-task-batch-orchestrator.d.ts.map +1 -0
  362. package/dist/pactile/migration/legacy-task-batch-orchestrator.js +634 -0
  363. package/dist/pactile/migration/legacy-task-batch-orchestrator.js.map +1 -0
  364. package/dist/pactile/migration/legacy-task-batch-source.d.ts +8 -0
  365. package/dist/pactile/migration/legacy-task-batch-source.d.ts.map +1 -0
  366. package/dist/pactile/migration/legacy-task-batch-source.js +158 -0
  367. package/dist/pactile/migration/legacy-task-batch-source.js.map +1 -0
  368. package/dist/pactile/migration/legacy-task-batch-types.d.ts +127 -0
  369. package/dist/pactile/migration/legacy-task-batch-types.d.ts.map +1 -0
  370. package/dist/pactile/migration/legacy-task-batch-types.js +127 -0
  371. package/dist/pactile/migration/legacy-task-batch-types.js.map +1 -0
  372. package/dist/pactile/migration/legacy-task-batch.d.ts +3 -0
  373. package/dist/pactile/migration/legacy-task-batch.d.ts.map +1 -0
  374. package/dist/pactile/migration/legacy-task-batch.js +2 -0
  375. package/dist/pactile/migration/legacy-task-batch.js.map +1 -0
  376. package/dist/pactile/migration/legacy-task-held-source-reader.d.ts +27 -0
  377. package/dist/pactile/migration/legacy-task-held-source-reader.d.ts.map +1 -0
  378. package/dist/pactile/migration/legacy-task-held-source-reader.js +261 -0
  379. package/dist/pactile/migration/legacy-task-held-source-reader.js.map +1 -0
  380. package/dist/pactile/migration/legacy-task-reconciliation.d.ts +46 -0
  381. package/dist/pactile/migration/legacy-task-reconciliation.d.ts.map +1 -0
  382. package/dist/pactile/migration/legacy-task-reconciliation.js +589 -0
  383. package/dist/pactile/migration/legacy-task-reconciliation.js.map +1 -0
  384. package/dist/pactile/migration/legacy-task-update.d.ts +19 -0
  385. package/dist/pactile/migration/legacy-task-update.d.ts.map +1 -0
  386. package/dist/pactile/migration/legacy-task-update.js +164 -0
  387. package/dist/pactile/migration/legacy-task-update.js.map +1 -0
  388. package/dist/pactile/parallel/batch.d.ts +21 -2
  389. package/dist/pactile/parallel/batch.d.ts.map +1 -1
  390. package/dist/pactile/parallel/batch.js +271 -50
  391. package/dist/pactile/parallel/batch.js.map +1 -1
  392. package/dist/pactile/parallel/policy.d.ts +1 -1
  393. package/dist/pactile/parallel/policy.d.ts.map +1 -1
  394. package/dist/pactile/parallel/policy.js +130 -102
  395. package/dist/pactile/parallel/policy.js.map +1 -1
  396. package/dist/pactile/pi/bridge.d.ts +139 -2
  397. package/dist/pactile/pi/bridge.d.ts.map +1 -1
  398. package/dist/pactile/pi/bridge.js +1317 -106
  399. package/dist/pactile/pi/bridge.js.map +1 -1
  400. package/dist/pactile/pi/rpc.d.ts +23 -4
  401. package/dist/pactile/pi/rpc.d.ts.map +1 -1
  402. package/dist/pactile/pi/rpc.js +243 -42
  403. package/dist/pactile/pi/rpc.js.map +1 -1
  404. package/dist/pactile/pi/v2-dispatch.d.ts +113 -0
  405. package/dist/pactile/pi/v2-dispatch.d.ts.map +1 -0
  406. package/dist/pactile/pi/v2-dispatch.js +919 -0
  407. package/dist/pactile/pi/v2-dispatch.js.map +1 -0
  408. package/dist/pactile/projection/planner.js +1 -1
  409. package/dist/pactile/projection/planner.js.map +1 -1
  410. package/dist/pactile/registry.d.ts +63 -1
  411. package/dist/pactile/registry.d.ts.map +1 -1
  412. package/dist/pactile/registry.js +633 -4
  413. package/dist/pactile/registry.js.map +1 -1
  414. package/dist/pactile/retrieval/index.d.ts +1 -0
  415. package/dist/pactile/retrieval/index.d.ts.map +1 -1
  416. package/dist/pactile/retrieval/index.js +1 -0
  417. package/dist/pactile/retrieval/index.js.map +1 -1
  418. package/dist/pactile/retrieval/jev-planning.d.ts +28 -0
  419. package/dist/pactile/retrieval/jev-planning.d.ts.map +1 -0
  420. package/dist/pactile/retrieval/jev-planning.js +96 -0
  421. package/dist/pactile/retrieval/jev-planning.js.map +1 -0
  422. package/dist/pactile/review/contract.d.ts +232 -0
  423. package/dist/pactile/review/contract.d.ts.map +1 -0
  424. package/dist/pactile/review/contract.js +695 -0
  425. package/dist/pactile/review/contract.js.map +1 -0
  426. package/dist/pactile/review/escalation-artifacts.d.ts +41 -0
  427. package/dist/pactile/review/escalation-artifacts.d.ts.map +1 -0
  428. package/dist/pactile/review/escalation-artifacts.js +415 -0
  429. package/dist/pactile/review/escalation-artifacts.js.map +1 -0
  430. package/dist/pactile/review/escalation-contract.d.ts +115 -0
  431. package/dist/pactile/review/escalation-contract.d.ts.map +1 -0
  432. package/dist/pactile/review/escalation-contract.js +151 -0
  433. package/dist/pactile/review/escalation-contract.js.map +1 -0
  434. package/dist/pactile/review/escalation-finalize.d.ts +14 -0
  435. package/dist/pactile/review/escalation-finalize.d.ts.map +1 -0
  436. package/dist/pactile/review/escalation-finalize.js +319 -0
  437. package/dist/pactile/review/escalation-finalize.js.map +1 -0
  438. package/dist/pactile/review/escalation-reply.d.ts +10 -0
  439. package/dist/pactile/review/escalation-reply.d.ts.map +1 -0
  440. package/dist/pactile/review/escalation-reply.js +61 -0
  441. package/dist/pactile/review/escalation-reply.js.map +1 -0
  442. package/dist/pactile/review/escalation-transport.d.ts +32 -0
  443. package/dist/pactile/review/escalation-transport.d.ts.map +1 -0
  444. package/dist/pactile/review/escalation-transport.js +216 -0
  445. package/dist/pactile/review/escalation-transport.js.map +1 -0
  446. package/dist/pactile/review/escalation.d.ts +7 -0
  447. package/dist/pactile/review/escalation.d.ts.map +1 -0
  448. package/dist/pactile/review/escalation.js +6 -0
  449. package/dist/pactile/review/escalation.js.map +1 -0
  450. package/dist/pactile/review/evidence.d.ts +25 -0
  451. package/dist/pactile/review/evidence.d.ts.map +1 -0
  452. package/dist/pactile/review/evidence.js +58 -0
  453. package/dist/pactile/review/evidence.js.map +1 -0
  454. package/dist/pactile/review/jev-escalation-advice.d.ts +77 -0
  455. package/dist/pactile/review/jev-escalation-advice.d.ts.map +1 -0
  456. package/dist/pactile/review/jev-escalation-advice.js +358 -0
  457. package/dist/pactile/review/jev-escalation-advice.js.map +1 -0
  458. package/dist/pactile/scheduler/index.d.ts +6 -0
  459. package/dist/pactile/scheduler/index.d.ts.map +1 -0
  460. package/dist/pactile/scheduler/index.js +5 -0
  461. package/dist/pactile/scheduler/index.js.map +1 -0
  462. package/dist/pactile/scheduler/project-lease-store.d.ts +35 -0
  463. package/dist/pactile/scheduler/project-lease-store.d.ts.map +1 -0
  464. package/dist/pactile/scheduler/project-lease-store.js +189 -0
  465. package/dist/pactile/scheduler/project-lease-store.js.map +1 -0
  466. package/dist/pactile/scheduler/scheduler.d.ts +91 -0
  467. package/dist/pactile/scheduler/scheduler.d.ts.map +1 -0
  468. package/dist/pactile/scheduler/scheduler.js +589 -0
  469. package/dist/pactile/scheduler/scheduler.js.map +1 -0
  470. package/dist/pactile/scheduler/task-kernel-admission.d.ts +173 -0
  471. package/dist/pactile/scheduler/task-kernel-admission.d.ts.map +1 -0
  472. package/dist/pactile/scheduler/task-kernel-admission.js +1560 -0
  473. package/dist/pactile/scheduler/task-kernel-admission.js.map +1 -0
  474. package/dist/pactile/scheduler/task-kernel-wave-dispatch.d.ts +184 -0
  475. package/dist/pactile/scheduler/task-kernel-wave-dispatch.d.ts.map +1 -0
  476. package/dist/pactile/scheduler/task-kernel-wave-dispatch.js +952 -0
  477. package/dist/pactile/scheduler/task-kernel-wave-dispatch.js.map +1 -0
  478. package/dist/pactile/scheduler/task-map-scheduler.d.ts +116 -0
  479. package/dist/pactile/scheduler/task-map-scheduler.d.ts.map +1 -0
  480. package/dist/pactile/scheduler/task-map-scheduler.js +1448 -0
  481. package/dist/pactile/scheduler/task-map-scheduler.js.map +1 -0
  482. package/dist/pactile/scheduler/task-run-dispatch-state.d.ts +7 -0
  483. package/dist/pactile/scheduler/task-run-dispatch-state.d.ts.map +1 -0
  484. package/dist/pactile/scheduler/task-run-dispatch-state.js +69 -0
  485. package/dist/pactile/scheduler/task-run-dispatch-state.js.map +1 -0
  486. package/dist/pactile/task/authorization.d.ts +3 -0
  487. package/dist/pactile/task/authorization.d.ts.map +1 -0
  488. package/dist/pactile/task/authorization.js +43 -0
  489. package/dist/pactile/task/authorization.js.map +1 -0
  490. package/dist/pactile/task/creation.d.ts +22 -0
  491. package/dist/pactile/task/creation.d.ts.map +1 -0
  492. package/dist/pactile/task/creation.js +95 -0
  493. package/dist/pactile/task/creation.js.map +1 -0
  494. package/dist/pactile/task/guards.d.ts +1 -4
  495. package/dist/pactile/task/guards.d.ts.map +1 -1
  496. package/dist/pactile/task/guards.js +5 -57
  497. package/dist/pactile/task/guards.js.map +1 -1
  498. package/dist/pactile/task/session-jev-receipt.d.ts +58 -0
  499. package/dist/pactile/task/session-jev-receipt.d.ts.map +1 -0
  500. package/dist/pactile/task/session-jev-receipt.js +375 -0
  501. package/dist/pactile/task/session-jev-receipt.js.map +1 -0
  502. package/dist/pactile/task/session-jev.d.ts +7 -0
  503. package/dist/pactile/task/session-jev.d.ts.map +1 -0
  504. package/dist/pactile/task/session-jev.js +217 -0
  505. package/dist/pactile/task/session-jev.js.map +1 -0
  506. package/dist/pactile/task/session-pack.d.ts.map +1 -1
  507. package/dist/pactile/task/session-pack.js +155 -16
  508. package/dist/pactile/task/session-pack.js.map +1 -1
  509. package/dist/pactile/task/session-retrieval-jev-receipt.d.ts +49 -0
  510. package/dist/pactile/task/session-retrieval-jev-receipt.d.ts.map +1 -0
  511. package/dist/pactile/task/session-retrieval-jev-receipt.js +97 -0
  512. package/dist/pactile/task/session-retrieval-jev-receipt.js.map +1 -0
  513. package/dist/pactile/task/session-retrieval-jev.d.ts +8 -0
  514. package/dist/pactile/task/session-retrieval-jev.d.ts.map +1 -0
  515. package/dist/pactile/task/session-retrieval-jev.js +352 -0
  516. package/dist/pactile/task/session-retrieval-jev.js.map +1 -0
  517. package/dist/pactile/task/strategy.d.ts +1 -23
  518. package/dist/pactile/task/strategy.d.ts.map +1 -1
  519. package/dist/pactile/task/strategy.js +2 -135
  520. package/dist/pactile/task/strategy.js.map +1 -1
  521. package/dist/pactile/tiles/jev-selection.d.ts +44 -0
  522. package/dist/pactile/tiles/jev-selection.d.ts.map +1 -0
  523. package/dist/pactile/tiles/jev-selection.js +210 -0
  524. package/dist/pactile/tiles/jev-selection.js.map +1 -0
  525. package/dist/pactile/tiles/safe-yaml.d.ts +5 -1
  526. package/dist/pactile/tiles/safe-yaml.d.ts.map +1 -1
  527. package/dist/pactile/tiles/safe-yaml.js +8 -8
  528. package/dist/pactile/tiles/safe-yaml.js.map +1 -1
  529. package/dist/pactile/tiles/selection-receipts.d.ts +71 -0
  530. package/dist/pactile/tiles/selection-receipts.d.ts.map +1 -0
  531. package/dist/pactile/tiles/selection-receipts.js +319 -0
  532. package/dist/pactile/tiles/selection-receipts.js.map +1 -0
  533. package/dist/pactile/tiles/selection.d.ts +185 -0
  534. package/dist/pactile/tiles/selection.d.ts.map +1 -0
  535. package/dist/pactile/tiles/selection.js +985 -0
  536. package/dist/pactile/tiles/selection.js.map +1 -0
  537. package/dist/pactile/verification/git-observer.d.ts +3 -0
  538. package/dist/pactile/verification/git-observer.d.ts.map +1 -0
  539. package/dist/pactile/verification/git-observer.js +3 -0
  540. package/dist/pactile/verification/git-observer.js.map +1 -0
  541. package/dist/pactile/verification/index.d.ts +11 -0
  542. package/dist/pactile/verification/index.d.ts.map +1 -0
  543. package/dist/pactile/verification/index.js +6 -0
  544. package/dist/pactile/verification/index.js.map +1 -0
  545. package/dist/pactile/verification/jev-advice.d.ts +78 -0
  546. package/dist/pactile/verification/jev-advice.d.ts.map +1 -0
  547. package/dist/pactile/verification/jev-advice.js +397 -0
  548. package/dist/pactile/verification/jev-advice.js.map +1 -0
  549. package/dist/pactile/verification/planner.d.ts +15 -0
  550. package/dist/pactile/verification/planner.d.ts.map +1 -0
  551. package/dist/pactile/verification/planner.js +412 -0
  552. package/dist/pactile/verification/planner.js.map +1 -0
  553. package/dist/pactile/verification/receipt.d.ts +101 -0
  554. package/dist/pactile/verification/receipt.d.ts.map +1 -0
  555. package/dist/pactile/verification/receipt.js +400 -0
  556. package/dist/pactile/verification/receipt.js.map +1 -0
  557. package/dist/pactile/verification/types.d.ts +72 -0
  558. package/dist/pactile/verification/types.d.ts.map +1 -0
  559. package/dist/pactile/verification/types.js +21 -0
  560. package/dist/pactile/verification/types.js.map +1 -0
  561. package/dist/pactile/worktree/git-probe.d.ts +32 -0
  562. package/dist/pactile/worktree/git-probe.d.ts.map +1 -0
  563. package/dist/pactile/worktree/git-probe.js +336 -0
  564. package/dist/pactile/worktree/git-probe.js.map +1 -0
  565. package/dist/pactile/worktree/git-removal.d.ts +3 -0
  566. package/dist/pactile/worktree/git-removal.d.ts.map +1 -0
  567. package/dist/pactile/worktree/git-removal.js +11 -0
  568. package/dist/pactile/worktree/git-removal.js.map +1 -0
  569. package/dist/pactile/worktree/index.d.ts +2 -0
  570. package/dist/pactile/worktree/index.d.ts.map +1 -0
  571. package/dist/pactile/worktree/index.js +2 -0
  572. package/dist/pactile/worktree/index.js.map +1 -0
  573. package/dist/pactile/worktree/integration-evidence.d.ts +80 -0
  574. package/dist/pactile/worktree/integration-evidence.d.ts.map +1 -0
  575. package/dist/pactile/worktree/integration-evidence.js +166 -0
  576. package/dist/pactile/worktree/integration-evidence.js.map +1 -0
  577. package/dist/pactile/worktree/manager-core.d.ts +50 -0
  578. package/dist/pactile/worktree/manager-core.d.ts.map +1 -0
  579. package/dist/pactile/worktree/manager-core.js +359 -0
  580. package/dist/pactile/worktree/manager-core.js.map +1 -0
  581. package/dist/pactile/worktree/manager-provenance.d.ts +32 -0
  582. package/dist/pactile/worktree/manager-provenance.d.ts.map +1 -0
  583. package/dist/pactile/worktree/manager-provenance.js +409 -0
  584. package/dist/pactile/worktree/manager-provenance.js.map +1 -0
  585. package/dist/pactile/worktree/manager-types.d.ts +84 -0
  586. package/dist/pactile/worktree/manager-types.d.ts.map +1 -0
  587. package/dist/pactile/worktree/manager-types.js +11 -0
  588. package/dist/pactile/worktree/manager-types.js.map +1 -0
  589. package/dist/pactile/worktree/manager.d.ts +10 -0
  590. package/dist/pactile/worktree/manager.d.ts.map +1 -0
  591. package/dist/pactile/worktree/manager.js +6 -0
  592. package/dist/pactile/worktree/manager.js.map +1 -0
  593. package/dist/pactile/worktree/run-workspace-cleanup.d.ts +10 -0
  594. package/dist/pactile/worktree/run-workspace-cleanup.d.ts.map +1 -0
  595. package/dist/pactile/worktree/run-workspace-cleanup.js +695 -0
  596. package/dist/pactile/worktree/run-workspace-cleanup.js.map +1 -0
  597. package/dist/pactile/worktree/run-workspace-lifecycle.d.ts +65 -0
  598. package/dist/pactile/worktree/run-workspace-lifecycle.d.ts.map +1 -0
  599. package/dist/pactile/worktree/run-workspace-lifecycle.js +276 -0
  600. package/dist/pactile/worktree/run-workspace-lifecycle.js.map +1 -0
  601. package/dist/templates/common/bundled-skills/pactile-meta/references/customize-local/change-hooks.md +1 -1
  602. package/dist/templates/common/bundled-skills/pactile-meta/references/local-architecture/generated-files.md +1 -1
  603. package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/hooks-and-settings.md +1 -1
  604. package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/overview.md +1 -1
  605. package/dist/templates/common/bundled-skills/pactile-meta/references/platform-files/platform-map.md +1 -1
  606. package/dist/templates/common/bundled-skills/smart-search-cli/SKILL.md +2 -0
  607. package/dist/templates/common/skills/brainstorm.md +19 -13
  608. package/dist/templates/markdown/agents.md +2 -2
  609. package/dist/templates/markdown/framework/execution-strategy.md.txt +1 -1
  610. package/dist/templates/markdown/framework/index.md.txt +1 -1
  611. package/dist/templates/markdown/framework/parallel-first-execution.md.txt +17 -105
  612. package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +3 -3
  613. package/dist/templates/markdown/framework/release-boundary.md.txt +9 -10
  614. package/dist/templates/markdown/framework/retrieval-daily-guide.md.txt +1 -1
  615. package/dist/templates/pactile/CONTEXT.md +48 -36
  616. package/dist/templates/pactile/modules/approval-personal/contract.md +12 -24
  617. package/dist/templates/pactile/modules/close-basic/contract.md +15 -18
  618. package/dist/templates/pactile/modules/debug-recovery/contract.md +4 -4
  619. package/dist/templates/pactile/modules/define-basic/contract.md +15 -19
  620. package/dist/templates/pactile/modules/define-extended/contract.md +3 -3
  621. package/dist/templates/pactile/modules/execute-agent/contract.md +11 -19
  622. package/dist/templates/pactile/modules/intake-basic/contract.md +16 -13
  623. package/dist/templates/pactile/modules/verify-basic/contract.md +11 -20
  624. package/dist/templates/pactile/tasks/templates/release-execution/design.md +5 -5
  625. package/dist/templates/pactile/tasks/templates/release-readiness/design.md +6 -6
  626. package/dist/templates/pactile/tasks/templates/release-readiness/handoff-template.md +8 -2
  627. package/dist/templates/pactile/workflow.md +37 -41
  628. package/dist/templates/template-utils.d.ts +1 -2
  629. package/dist/templates/template-utils.d.ts.map +1 -1
  630. package/dist/templates/template-utils.js +2 -13
  631. package/dist/templates/template-utils.js.map +1 -1
  632. package/dist/types/ai-tools.d.ts +1 -1
  633. package/dist/types/ai-tools.js +1 -1
  634. package/dist/utils/manifest-prune.js +1 -1
  635. package/dist/utils/manifest-prune.js.map +1 -1
  636. package/dist/utils/p36-upgrade.d.ts +2 -2
  637. package/dist/utils/p36-upgrade.d.ts.map +1 -1
  638. package/dist/utils/p36-upgrade.js +2 -10
  639. package/dist/utils/p36-upgrade.js.map +1 -1
  640. package/dist/utils/post-update-smoke.js +1 -1
  641. package/dist/utils/post-update-smoke.js.map +1 -1
  642. package/dist/utils/readiness.d.ts +2 -2
  643. package/dist/utils/readiness.js +2 -2
  644. package/dist/utils/uninstall-scrubbers.js +1 -1
  645. package/dist/utils/workflow-dir.d.ts +1 -1
  646. package/dist/utils/workflow-dir.d.ts.map +1 -1
  647. package/dist/utils/workflow-dir.js +1 -1
  648. package/dist/utils/workflow-dir.js.map +1 -1
  649. package/package.json +42 -37
  650. package/CHANGELOG.md +0 -651
  651. package/bin/compat-warning.js +0 -11
  652. package/bin/pactile.js +0 -3
  653. package/bin/smart-search.js +0 -38
  654. package/dist/migrations/manifests/0.1.0.json +0 -9
  655. package/dist/migrations/manifests/0.1.1.json +0 -9
  656. package/dist/migrations/manifests/0.1.2.json +0 -9
  657. package/dist/migrations/manifests/0.1.3.json +0 -9
  658. package/dist/migrations/manifests/0.1.4.json +0 -9
  659. package/dist/migrations/manifests/0.2.1.json +0 -9
  660. package/dist/migrations/manifests/0.2.10.json +0 -374
  661. package/dist/migrations/manifests/0.2.2.json +0 -9
  662. package/dist/migrations/manifests/0.2.3.json +0 -9
  663. package/dist/migrations/manifests/0.2.4.json +0 -9
  664. package/dist/migrations/manifests/0.2.5.json +0 -9
  665. package/dist/migrations/manifests/0.2.6.json +0 -9
  666. package/dist/migrations/manifests/0.2.7.json +0 -9
  667. package/dist/migrations/manifests/0.2.8.json +0 -9
  668. package/dist/migrations/manifests/0.2.9.json +0 -9
  669. package/dist/migrations/manifests/0.3.0.json +0 -89
  670. package/dist/migrations/manifests/0.3.1.json +0 -32
  671. package/dist/migrations/manifests/0.3.2.json +0 -16
  672. package/dist/migrations/manifests/0.3.3.json +0 -9
  673. package/dist/migrations/manifests/0.3.4.json +0 -9
  674. package/dist/migrations/manifests/0.3.5.json +0 -9
  675. package/dist/migrations/manifests/0.3.6.json +0 -9
  676. package/dist/migrations/manifests/0.4.0.json +0 -9
  677. package/dist/migrations/manifests/0.4.1.json +0 -9
  678. package/dist/migrations/manifests/0.4.2.json +0 -9
  679. package/dist/migrations/manifests/0.4.3.json +0 -9
  680. package/dist/migrations/manifests/0.5.0-beta.0.json +0 -9
  681. package/dist/migrations/manifests/0.5.0-beta.1.json +0 -9
  682. package/dist/migrations/manifests/0.5.0-beta.2.json +0 -9
  683. package/dist/migrations/manifests/0.5.0-beta.3.json +0 -9
  684. package/dist/migrations/manifests/0.5.0-beta.4.json +0 -9
  685. package/dist/migrations/manifests/0.5.0-beta.5.json +0 -9
  686. package/dist/migrations/manifests/0.5.0.json +0 -9
  687. package/dist/pactile/compat/retired-alternate-client.d.ts +0 -42
  688. package/dist/pactile/compat/retired-alternate-client.d.ts.map +0 -1
  689. package/dist/pactile/compat/retired-alternate-client.js +0 -153
  690. package/dist/pactile/compat/retired-alternate-client.js.map +0 -1
  691. package/dist/pactile/compat/update-residue.d.ts +0 -4
  692. package/dist/pactile/compat/update-residue.d.ts.map +0 -1
  693. package/dist/pactile/compat/update-residue.js +0 -55
  694. package/dist/pactile/compat/update-residue.js.map +0 -1
  695. package/dist/utils/cursor-retrieval-env.d.ts +0 -17
  696. package/dist/utils/cursor-retrieval-env.d.ts.map +0 -1
  697. package/dist/utils/cursor-retrieval-env.js +0 -19
  698. package/dist/utils/cursor-retrieval-env.js.map +0 -1
  699. package/dist/utils/proxy.d.ts +0 -25
  700. package/dist/utils/proxy.d.ts.map +0 -1
  701. package/dist/utils/proxy.js +0 -60
  702. package/dist/utils/proxy.js.map +0 -1
  703. package/scripts/postinstall.js +0 -6
@@ -0,0 +1,253 @@
1
+ import { spawn } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import fsp from "node:fs/promises";
4
+ import { StringDecoder } from "node:string_decoder";
5
+ import path from "node:path";
6
+ import { CapabilityNodeError, isInside, jsonBytes, operationDataBudget, sameFileIdentity, stopReason, stopResult, truncateUtf8, } from "./shared.js";
7
+ import { realDirectory } from "./workspace.js";
8
+ function fitRunOutput(data, maxOutputBytes) {
9
+ let stdout = data.stdout;
10
+ let stderr = data.stderr;
11
+ for (let attempt = 0; attempt < 64; attempt += 1) {
12
+ const wasReduced = stdout !== data.stdout || stderr !== data.stderr;
13
+ const candidate = {
14
+ ...data,
15
+ stdout,
16
+ stderr,
17
+ truncated: data.truncated || wasReduced,
18
+ };
19
+ if (jsonBytes(candidate) <= maxOutputBytes)
20
+ return candidate;
21
+ if (Buffer.byteLength(stdout, "utf8") >= Buffer.byteLength(stderr, "utf8")) {
22
+ stdout = truncateUtf8(stdout, Math.floor(Buffer.byteLength(stdout, "utf8") * 0.75));
23
+ }
24
+ else {
25
+ stderr = truncateUtf8(stderr, Math.floor(Buffer.byteLength(stderr, "utf8") * 0.75));
26
+ }
27
+ }
28
+ return { ...data, stdout: "", stderr: "", truncated: true };
29
+ }
30
+ async function executableSearchPath(root) {
31
+ const result = [];
32
+ const seen = new Set();
33
+ for (const entry of (process.env.PATH ?? "").split(path.delimiter)) {
34
+ if (!entry || !path.isAbsolute(entry))
35
+ continue;
36
+ const candidate = path.resolve(entry);
37
+ if (isInside(root, candidate))
38
+ continue;
39
+ try {
40
+ const resolved = await fsp.realpath(candidate);
41
+ if (!isInside(root, resolved) && !seen.has(resolved)) {
42
+ result.push(resolved);
43
+ seen.add(resolved);
44
+ }
45
+ }
46
+ catch {
47
+ // An unusable PATH entry cannot provide an approved executable.
48
+ }
49
+ }
50
+ return result;
51
+ }
52
+ async function resolveAllowedExecutable(root, commandId) {
53
+ const searchPath = await executableSearchPath(root);
54
+ if (/^node(?:\.exe)?$/iu.test(commandId)) {
55
+ const executable = await fsp.realpath(process.execPath);
56
+ if (!isInside(root, executable)) {
57
+ return { executable, path: searchPath.join(path.delimiter) };
58
+ }
59
+ }
60
+ const name = process.platform === "win32" && !/\.exe$/iu.test(commandId)
61
+ ? `${commandId}.exe`
62
+ : commandId;
63
+ if (process.platform === "win32" && !/\.exe$/iu.test(name)) {
64
+ throw new CapabilityNodeError("ADAPTER_UNAVAILABLE", "The approved command is unavailable.");
65
+ }
66
+ for (const directory of searchPath) {
67
+ const candidate = path.join(directory, name);
68
+ try {
69
+ const resolved = await fsp.realpath(candidate);
70
+ const stat = await fsp.stat(resolved);
71
+ if (!stat.isFile() || isInside(root, resolved))
72
+ continue;
73
+ if (process.platform !== "win32" &&
74
+ !(await fsp.access(resolved, fs.constants.X_OK).then(() => true, () => false))) {
75
+ continue;
76
+ }
77
+ return { executable: resolved, path: searchPath.join(path.delimiter) };
78
+ }
79
+ catch {
80
+ // Continue with the next trusted, absolute PATH directory.
81
+ }
82
+ }
83
+ throw new CapabilityNodeError("ADAPTER_UNAVAILABLE", "The approved command is unavailable.");
84
+ }
85
+ async function terminateProcessTree(child) {
86
+ if (!child.pid)
87
+ return;
88
+ if (process.platform === "win32") {
89
+ const systemRoot = process.env.SystemRoot;
90
+ const taskkill = systemRoot
91
+ ? path.join(systemRoot, "System32", "taskkill.exe")
92
+ : null;
93
+ if (taskkill && fs.existsSync(taskkill)) {
94
+ await new Promise((resolve) => {
95
+ const killer = spawn(taskkill, ["/PID", String(child.pid), "/T", "/F"], {
96
+ shell: false,
97
+ windowsHide: true,
98
+ stdio: "ignore",
99
+ });
100
+ killer.once("error", () => resolve());
101
+ killer.once("close", () => resolve());
102
+ });
103
+ }
104
+ if (child.exitCode === null && child.signalCode === null)
105
+ child.kill();
106
+ return;
107
+ }
108
+ try {
109
+ process.kill(-child.pid, "SIGTERM");
110
+ }
111
+ catch {
112
+ child.kill("SIGTERM");
113
+ }
114
+ await new Promise((resolve) => setTimeout(resolve, 250));
115
+ try {
116
+ process.kill(-child.pid, "SIGKILL");
117
+ }
118
+ catch {
119
+ child.kill("SIGKILL");
120
+ }
121
+ }
122
+ export async function runCommand(root, request, signal) {
123
+ const stopped = stopReason(signal);
124
+ if (stopped)
125
+ return stopResult(stopped, null);
126
+ const cwd = await realDirectory(root, request.cwd);
127
+ const cwdStat = await fsp.stat(cwd);
128
+ const beforeResolveStop = stopReason(signal);
129
+ if (beforeResolveStop)
130
+ return stopResult(beforeResolveStop, null);
131
+ const rawLimit = operationDataBudget(request);
132
+ const outDecoder = new StringDecoder("utf8");
133
+ const errDecoder = new StringDecoder("utf8");
134
+ let stdout = "";
135
+ let stderr = "";
136
+ let bytesCaptured = 0;
137
+ let truncated = false;
138
+ let exitCode = null;
139
+ let exitSignal = null;
140
+ const args = [...request.args];
141
+ const { executable, path: safePath } = await resolveAllowedExecutable(root, request.command);
142
+ const beforeSpawnStop = stopReason(signal);
143
+ if (beforeSpawnStop)
144
+ return stopResult(beforeSpawnStop, null);
145
+ // Executable resolution awaits filesystem work. Recheck the directory just
146
+ // before spawn so a replaced workspace path cannot redirect the command.
147
+ const spawnCwd = await realDirectory(root, request.cwd);
148
+ const spawnCwdStat = await fsp.stat(spawnCwd);
149
+ if (spawnCwd !== cwd || !sameFileIdentity(cwdStat, spawnCwdStat)) {
150
+ throw new CapabilityNodeError("OUT_OF_SCOPE", "The command working directory changed before launch.");
151
+ }
152
+ const atSpawnStop = stopReason(signal);
153
+ if (atSpawnStop)
154
+ return stopResult(atSpawnStop, null);
155
+ const child = spawn(executable, args, {
156
+ cwd: spawnCwd,
157
+ env: {
158
+ PATH: safePath,
159
+ ...(process.env.SystemRoot ? { SystemRoot: process.env.SystemRoot } : {}),
160
+ ...(process.env.TMP ? { TMP: process.env.TMP } : {}),
161
+ ...(process.env.TEMP ? { TEMP: process.env.TEMP } : {}),
162
+ },
163
+ shell: false,
164
+ windowsHide: true,
165
+ ...(process.platform !== "win32" ? { detached: true } : {}),
166
+ stdio: ["ignore", "pipe", "pipe"],
167
+ });
168
+ let termination = null;
169
+ const terminate = () => {
170
+ termination ??= terminateProcessTree(child);
171
+ };
172
+ const onAbort = () => terminate();
173
+ signal.addEventListener("abort", onAbort, { once: true });
174
+ if (signal.aborted)
175
+ terminate();
176
+ const capture = (chunk, stream) => {
177
+ const available = Math.max(0, rawLimit - bytesCaptured);
178
+ const accepted = chunk.subarray(0, available);
179
+ bytesCaptured += accepted.length;
180
+ if (stream === "stdout")
181
+ stdout += outDecoder.write(accepted);
182
+ else
183
+ stderr += errDecoder.write(accepted);
184
+ if (accepted.length < chunk.length) {
185
+ truncated = true;
186
+ terminate();
187
+ }
188
+ };
189
+ child.stdout.on("data", (chunk) => capture(chunk, "stdout"));
190
+ child.stderr.on("data", (chunk) => capture(chunk, "stderr"));
191
+ let launchError;
192
+ child.once("error", (error) => {
193
+ launchError = error;
194
+ });
195
+ await new Promise((resolve) => {
196
+ child.once("close", (code, closeSignal) => {
197
+ exitCode = code;
198
+ exitSignal = closeSignal;
199
+ resolve();
200
+ });
201
+ });
202
+ if (termination)
203
+ await termination;
204
+ signal.removeEventListener("abort", onAbort);
205
+ stdout += outDecoder.end();
206
+ stderr += errDecoder.end();
207
+ if (launchError) {
208
+ const code = launchError && typeof launchError === "object" && "code" in launchError
209
+ ? String(launchError.code)
210
+ : "";
211
+ if (code === "ENOENT")
212
+ throw new CapabilityNodeError("ADAPTER_UNAVAILABLE", "The approved command is unavailable.");
213
+ if (code === "EACCES" || code === "EPERM")
214
+ throw new CapabilityNodeError("PERMISSION_DENIED", "The approved command could not be launched.");
215
+ throw new CapabilityNodeError("EXECUTION_FAILED", "The approved command could not be launched.");
216
+ }
217
+ const completed = fitRunOutput({
218
+ command: request.command,
219
+ exitCode,
220
+ signal: exitSignal,
221
+ stdout,
222
+ stderr,
223
+ bytesCaptured,
224
+ truncated,
225
+ }, operationDataBudget(request));
226
+ const stop = stopReason(signal);
227
+ if (stop)
228
+ return stopResult(stop, completed);
229
+ if (truncated || completed.truncated) {
230
+ return {
231
+ data: completed,
232
+ outcome: "partial",
233
+ partial: true,
234
+ error: {
235
+ code: "OUTPUT_LIMIT",
236
+ message: "The command output reached its byte limit.",
237
+ },
238
+ };
239
+ }
240
+ if (exitCode !== 0) {
241
+ return {
242
+ data: completed,
243
+ outcome: "failed",
244
+ partial: false,
245
+ error: {
246
+ code: "EXECUTION_FAILED",
247
+ message: "The command exited with a non-zero status.",
248
+ },
249
+ };
250
+ }
251
+ return { data: completed, outcome: "complete", partial: false, error: null };
252
+ }
253
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/pactile/capabilities/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,kBAAkB,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AAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,4CAA4C;aACtD;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { BoundedCapabilityRequestV1 } from "../../core/index.js";
2
+ import { type OperationResult } from "./shared.js";
3
+ export declare function discover(root: string, request: Extract<BoundedCapabilityRequestV1, {
4
+ operation: "discover";
5
+ }>, signal: AbortSignal, excludedPaths: readonly string[]): Promise<OperationResult>;
6
+ //# sourceMappingURL=discover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../../src/pactile/capabilities/discover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAGrB,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,CAAC,0BAA0B,EAAE;IAAE,SAAS,EAAE,UAAU,CAAA;CAAE,CAAC,EACvE,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,OAAO,CAAC,eAAe,CAAC,CA0D1B"}
@@ -0,0 +1,48 @@
1
+ import { jsonBytes, operationDataBudget, stopResult, } from "./shared.js";
2
+ import { collectFiles } from "./workspace.js";
3
+ export async function discover(root, request, signal, excludedPaths) {
4
+ const scan = await collectFiles(root, request.directory, request.limits, signal, request.limits.maxFilesScanned + 1, excludedPaths);
5
+ const stopped = scan.stopped;
6
+ if (stopped) {
7
+ const data = scan.files.length
8
+ ? { files: scan.files, entriesScanned: scan.entriesScanned }
9
+ : null;
10
+ return stopResult(stopped, data);
11
+ }
12
+ const orderedFiles = [...scan.files].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
13
+ const pageFiles = orderedFiles.slice(request.offset, request.offset + request.limits.maxResults);
14
+ const hasMore = !scan.partial && request.offset + pageFiles.length < orderedFiles.length;
15
+ const files = [];
16
+ let outputLimited = false;
17
+ const dataBudget = operationDataBudget(request);
18
+ for (const file of pageFiles) {
19
+ const candidate = {
20
+ files: [...files, file],
21
+ entriesScanned: scan.entriesScanned,
22
+ };
23
+ if (jsonBytes(candidate) > dataBudget) {
24
+ outputLimited = true;
25
+ break;
26
+ }
27
+ files.push(file);
28
+ }
29
+ const partial = scan.partial || outputLimited || pageFiles.length > files.length || hasMore;
30
+ const data = {
31
+ files,
32
+ entriesScanned: scan.entriesScanned,
33
+ };
34
+ const error = outputLimited
35
+ ? {
36
+ code: "OUTPUT_LIMIT",
37
+ message: "The response reached its output-byte limit.",
38
+ }
39
+ : scan.error;
40
+ return {
41
+ data,
42
+ outcome: partial ? "partial" : files.length === 0 ? "empty" : "complete",
43
+ partial,
44
+ error,
45
+ nextPage: hasMore && !outputLimited ? request.offset + files.length : null,
46
+ };
47
+ }
48
+ //# sourceMappingURL=discover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover.js","sourceRoot":"","sources":["../../../src/pactile/capabilities/discover.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,UAAU,GAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,IAAY,EACZ,OAAuE,EACvE,MAAmB,EACnB,aAAgC;IAEhC,MAAM,IAAI,GAAG,MAAM,YAAY,CAC7B,IAAI,EACJ,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,MAAM,EACd,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,CAAC,EAClC,aAAa,CACd,CAAC;IACF,M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AAI,CAAC;YACrB,MAAM;QACR,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GACX,IAAI,CAAC,OAAO,IAAI,aAAa,IAAI,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC;IAC9E,MAAM,IAAI,GAA6B;QACrC,KAAK;QACL,cAAc,EAAE,IAAI,CAAC,cAAc;KACpC,CAAC;IACF,MAAM,KAAK,GAAG,aAAa;QACzB,CAAC,CAAC;YACE,IAAI,EAAE,cAAuB;YAC7B,OAAO,EAAE,6CAA6C;SACvD;QACH,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACf,OAAO;QACL,IAAI;QACJ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU;QACxE,OAAO;QACP,KAAK;QACL,QAAQ,EAAE,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;KAC3E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type BoundedCapabilityPolicyV1, type BoundedCapabilityRequestV1, type BoundedCapabilityResultV1 } from "../../core/index.js";
2
+ export interface ExecuteBoundedCapabilityOptionsV1 {
3
+ readonly root: string;
4
+ readonly policy: BoundedCapabilityPolicyV1;
5
+ readonly signal?: AbortSignal;
6
+ readonly adapterId?: string;
7
+ /** Additional workspace-relative control files omitted from discover/search. */
8
+ readonly excludedPaths?: readonly string[];
9
+ }
10
+ /** Execute a validated, workspace-relative request with the built-in Node adapter. */
11
+ export declare function executeNodeCapabilityRequestV1(input: unknown, options: ExecuteBoundedCapabilityOptionsV1): Promise<BoundedCapabilityResultV1>;
12
+ export declare function createDefaultCapabilityPolicyV1(allowedCommands?: readonly string[]): BoundedCapabilityPolicyV1;
13
+ export declare function defaultCapabilityLimitsV1(): BoundedCapabilityRequestV1["limits"];
14
+ export declare function createCapabilityRequestIdV1(): string;
15
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/pactile/capabilities/node.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,yBAAyB,EAE9B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AA8F7B,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,sFAAsF;AACtF,wBAAsB,8BAA8B,CAClD,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,yBAAyB,CAAC,CA8BpC;AA2OD,wBAAgB,+BAA+B,CAC7C,eAAe,GAAE,SAAS,MAAM,EAAO,GACtC,yBAAyB,CAK3B;AAED,wBAAgB,yBAAyB,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAShF;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD"}
@@ -0,0 +1,292 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import fsp from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { authorizeBoundedCapabilityRequestV1, BoundedCapabilityRequestValidationError, fingerprintPactileContractV1, parseBoundedCapabilityRequestV1, } from "../../core/index.js";
5
+ import { CapabilityNodeError, RECEIPT_ROOT, jsonBytes, mapFilesystemError, stopReason, stopResult, } from "./shared.js";
6
+ import { runCommand } from "./command.js";
7
+ import { discover } from "./discover.js";
8
+ import { readFileCapability } from "./read.js";
9
+ import { search } from "./search.js";
10
+ import { claimRequestId } from "./claim.js";
11
+ import { ensureReceiptDirectory, writeReceipt, } from "./receipts.js";
12
+ function publicFailure(error) {
13
+ if (error instanceof CapabilityNodeError) {
14
+ return { code: error.code, message: error.message };
15
+ }
16
+ return {
17
+ code: "EXECUTION_FAILED",
18
+ message: "The capability operation failed.",
19
+ };
20
+ }
21
+ function failureResult(error) {
22
+ const failure = publicFailure(error);
23
+ return {
24
+ data: null,
25
+ outcome: failure.code === "OUT_OF_SCOPE"
26
+ ? "out_of_scope"
27
+ : failure.code === "TIMEOUT"
28
+ ? "timed_out"
29
+ : failure.code === "CANCELLED"
30
+ ? "cancelled"
31
+ : "failed",
32
+ partial: false,
33
+ error: failure,
34
+ };
35
+ }
36
+ function resultEntries(data) {
37
+ if (!data)
38
+ return 0;
39
+ if ("files" in data)
40
+ return data.files.length;
41
+ if ("matches" in data)
42
+ return data.matches.length;
43
+ return 1;
44
+ }
45
+ function makeResult(request, operation, receipt) {
46
+ const fallbackError = operation.error ?? null;
47
+ const outcome = operation.outcome ?? (operation.data ? "complete" : "empty");
48
+ return {
49
+ schemaVersion: 1,
50
+ requestId: request.requestId,
51
+ operation: request.operation,
52
+ outcome,
53
+ partial: operation.partial ?? outcome === "partial",
54
+ nextPage: operation.nextPage ?? null,
55
+ data: operation.data,
56
+ error: fallbackError,
57
+ receipt,
58
+ };
59
+ }
60
+ function requestIdConflict(request) {
61
+ return makeResult(request, {
62
+ data: null,
63
+ outcome: "failed",
64
+ partial: false,
65
+ error: {
66
+ code: "REQUEST_ID_REUSED",
67
+ message: "This request id is in progress or has already been used.",
68
+ },
69
+ }, null);
70
+ }
71
+ /** Execute a validated, workspace-relative request with the built-in Node adapter. */
72
+ export async function executeNodeCapabilityRequestV1(input, options) {
73
+ const parsed = parseBoundedCapabilityRequestV1(input);
74
+ if (!parsed.success) {
75
+ throw new BoundedCapabilityRequestValidationError(parsed.issues);
76
+ }
77
+ const request = parsed.data;
78
+ const startedAt = new Date();
79
+ const started = performance.now();
80
+ const controller = new AbortController();
81
+ const abortFromCaller = () => controller.abort("CANCELLED");
82
+ if (options.signal?.aborted)
83
+ abortFromCaller();
84
+ else
85
+ options.signal?.addEventListener("abort", abortFromCaller, { once: true });
86
+ const timer = setTimeout(() => controller.abort("TIMEOUT"), request.limits.timeoutMs);
87
+ try {
88
+ return await executeClaimedRequestV1(request, parsed.fingerprint, options, controller.signal, startedAt, started);
89
+ }
90
+ finally {
91
+ clearTimeout(timer);
92
+ options.signal?.removeEventListener("abort", abortFromCaller);
93
+ }
94
+ }
95
+ async function executeClaimedRequestV1(request, requestFingerprint, options, signal, startedAt, started) {
96
+ let root;
97
+ try {
98
+ root = await fsp.realpath(path.resolve(options.root));
99
+ }
100
+ catch (error) {
101
+ const stopped = stopReason(signal);
102
+ return makeResult(request, stopped
103
+ ? stopResult(stopped, null)
104
+ : failureResult(mapFilesystemError(error)), null);
105
+ }
106
+ const beforeClaimStop = stopReason(signal);
107
+ if (beforeClaimStop)
108
+ return makeResult(request, stopResult(beforeClaimStop, null), null);
109
+ // Establish the receipt boundary and claim this id before any capability can
110
+ // run. A pre-existing symlinked receipt directory must never permit an
111
+ // operation to execute before we discover that the audit write is unsafe.
112
+ let receiptDirectory;
113
+ try {
114
+ receiptDirectory = await ensureReceiptDirectory(root);
115
+ }
116
+ catch (error) {
117
+ const stopped = stopReason(signal);
118
+ return makeResult(request, stopped ? stopResult(stopped, null) : failureResult(error), null);
119
+ }
120
+ const afterReceiptPreflightStop = stopReason(signal);
121
+ if (afterReceiptPreflightStop)
122
+ return makeResult(request, stopResult(afterReceiptPreflightStop, null), null);
123
+ let receiptClaim;
124
+ try {
125
+ receiptClaim = await claimRequestId(root, receiptDirectory, request.requestId, signal);
126
+ }
127
+ catch (error) {
128
+ const stopped = stopReason(signal);
129
+ if (stopped &&
130
+ !(error instanceof CapabilityNodeError &&
131
+ error.code === "REQUEST_CLAIM_RETAINED"))
132
+ return makeResult(request, stopResult(stopped, null), null);
133
+ if (error instanceof CapabilityNodeError &&
134
+ error.code === "REQUEST_ID_REUSED") {
135
+ return requestIdConflict(request);
136
+ }
137
+ if (error &&
138
+ typeof error === "object" &&
139
+ "code" in error &&
140
+ error.code === "EEXIST") {
141
+ return requestIdConflict(request);
142
+ }
143
+ if (error instanceof CapabilityNodeError &&
144
+ (error.code === "REQUEST_CLAIM_RETAINED" ||
145
+ error.code === "REQUEST_CLAIM_LIMIT")) {
146
+ return makeResult(request, {
147
+ data: null,
148
+ outcome: "failed",
149
+ partial: false,
150
+ error: { code: error.code, message: error.message },
151
+ }, null);
152
+ }
153
+ const failure = error instanceof CapabilityNodeError ? error : mapFilesystemError(error);
154
+ return makeResult(request, failureResult(failure), null);
155
+ }
156
+ let operation;
157
+ const decision = authorizeBoundedCapabilityRequestV1(request, options.policy);
158
+ const beforeOperationStop = stopReason(signal);
159
+ if (beforeOperationStop) {
160
+ operation = stopResult(beforeOperationStop, null);
161
+ }
162
+ else if (!decision.allowed) {
163
+ operation = {
164
+ data: null,
165
+ outcome: "out_of_scope",
166
+ partial: false,
167
+ error: {
168
+ code: "OUT_OF_SCOPE",
169
+ message: decision.message ?? "The request is outside the caller policy.",
170
+ },
171
+ };
172
+ }
173
+ else {
174
+ try {
175
+ const stopped = stopReason(signal);
176
+ if (stopped) {
177
+ operation = stopResult(stopped, null);
178
+ }
179
+ else {
180
+ switch (request.operation) {
181
+ case "discover":
182
+ operation = await discover(root, request, signal, options.excludedPaths ?? []);
183
+ break;
184
+ case "read":
185
+ operation = await readFileCapability(root, request, signal);
186
+ break;
187
+ case "search":
188
+ operation = await search(root, request, signal, options.excludedPaths ?? []);
189
+ break;
190
+ case "run":
191
+ operation = await runCommand(root, request, signal);
192
+ break;
193
+ }
194
+ }
195
+ }
196
+ catch (error) {
197
+ operation = failureResult(error);
198
+ }
199
+ }
200
+ const afterOperationStop = stopReason(signal);
201
+ if (decision.allowed &&
202
+ afterOperationStop &&
203
+ operation.outcome !== "timed_out" &&
204
+ operation.outcome !== "cancelled")
205
+ operation = stopResult(afterOperationStop, operation.data);
206
+ const completedAt = new Date();
207
+ const dataBytes = operation.data === null ? 0 : jsonBytes(operation.data);
208
+ const receiptRef = path.posix.join(RECEIPT_ROOT, `${request.requestId}.json`);
209
+ const receipt = {
210
+ schemaVersion: 1,
211
+ requestId: request.requestId,
212
+ operation: request.operation,
213
+ adapterId: options.adapterId &&
214
+ /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/u.test(options.adapterId)
215
+ ? options.adapterId
216
+ : "node",
217
+ requestFingerprint,
218
+ resultFingerprint: operation.data === null
219
+ ? null
220
+ : fingerprintPactileContractV1(operation.data),
221
+ outcome: operation.outcome ?? (operation.data ? "complete" : "empty"),
222
+ errorCode: operation.error?.code ?? null,
223
+ entriesReturned: resultEntries(operation.data),
224
+ bytesReturned: dataBytes,
225
+ startedAt: startedAt.toISOString(),
226
+ completedAt: completedAt.toISOString(),
227
+ durationMs: Math.max(0, Math.round(performance.now() - started)),
228
+ receiptRef,
229
+ };
230
+ let boundedReceipt = receipt;
231
+ let result = makeResult(request, operation, boundedReceipt);
232
+ if (jsonBytes(result) + 1 > request.limits.maxOutputBytes) {
233
+ operation = {
234
+ data: null,
235
+ outcome: "partial",
236
+ partial: true,
237
+ nextPage: null,
238
+ error: {
239
+ code: "OUTPUT_LIMIT",
240
+ message: "The complete response reached its output-byte limit.",
241
+ },
242
+ };
243
+ boundedReceipt = {
244
+ ...receipt,
245
+ resultFingerprint: null,
246
+ outcome: "partial",
247
+ errorCode: "OUTPUT_LIMIT",
248
+ entriesReturned: 0,
249
+ bytesReturned: 0,
250
+ };
251
+ result = makeResult(request, operation, boundedReceipt);
252
+ }
253
+ if (jsonBytes(result) + 1 > request.limits.maxOutputBytes) {
254
+ await receiptClaim.handle.close();
255
+ throw new CapabilityNodeError("OUTPUT_LIMIT", "The request output budget is too small for its bounded receipt envelope.");
256
+ }
257
+ try {
258
+ await writeReceipt(root, receiptDirectory, receiptClaim, boundedReceipt);
259
+ }
260
+ catch {
261
+ return makeResult(request, {
262
+ data: null,
263
+ outcome: "failed",
264
+ partial: false,
265
+ error: {
266
+ code: "RECEIPT_UNAVAILABLE",
267
+ message: "The operation may have run, but its receipt could not be persisted. Do not retry automatically.",
268
+ },
269
+ }, null);
270
+ }
271
+ return result;
272
+ }
273
+ export function createDefaultCapabilityPolicyV1(allowedCommands = []) {
274
+ return {
275
+ allowedOperations: ["discover", "read", "search", "run"],
276
+ allowedCommands: [...new Set(allowedCommands)],
277
+ };
278
+ }
279
+ export function defaultCapabilityLimitsV1() {
280
+ return {
281
+ timeoutMs: 30_000,
282
+ maxOutputBytes: 128 * 1024,
283
+ maxFilesScanned: 1_000,
284
+ maxResults: 100,
285
+ maxFileBytes: 256 * 1024,
286
+ maxBytesRead: 2 * 1024 * 1024,
287
+ };
288
+ }
289
+ export function createCapabilityRequestIdV1() {
290
+ return randomUUID();
291
+ }
292
+ //# sourceMappingURL=node.js.map