@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,762 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { captureProjectFileBaseline, hasGitMetadataAtProjectRoot, isExcludedProjectPath, observeProjectFileCandidate, PROJECT_FILE_CANDIDATE_ENTRY_REF, verifyProjectFileCandidateObservation, } from "./project-file-observer.js";
6
+ export const GIT_CANDIDATE_OBSERVER_VERSION = "git-working-tree-v1";
7
+ export const VERIFICATION_CANDIDATE_ENTRY_REF = "pactile:verification:git-working-tree-v1";
8
+ export const RUN_CANDIDATE_ENTRY_REFS = [
9
+ VERIFICATION_CANDIDATE_ENTRY_REF,
10
+ PROJECT_FILE_CANDIDATE_ENTRY_REF,
11
+ ];
12
+ const MAX_GIT_OUTPUT_BYTES = 16 * 1024 * 1024;
13
+ const MAX_CHANGED_PATHS = 1_000;
14
+ const MAX_CURRENT_FILE_BYTES = 8 * 1024 * 1024;
15
+ const MAX_TOTAL_CURRENT_BYTES = 32 * 1024 * 1024;
16
+ const UNTRUSTED_GIT_ENVIRONMENT = new Set([
17
+ "GIT_DIR",
18
+ "GIT_WORK_TREE",
19
+ "GIT_INDEX_FILE",
20
+ "GIT_COMMON_DIR",
21
+ "GIT_OBJECT_DIRECTORY",
22
+ "GIT_ALTERNATE_OBJECT_DIRECTORIES",
23
+ "GIT_PREFIX",
24
+ "GIT_CEILING_DIRECTORIES",
25
+ "GIT_DISCOVERY_ACROSS_FILESYSTEM",
26
+ ]);
27
+ export class GitCandidateObservationError extends Error {
28
+ code;
29
+ constructor(code, message) {
30
+ super(message);
31
+ this.name = "GitCandidateObservationError";
32
+ this.code = code;
33
+ }
34
+ }
35
+ function sha256(bytes) {
36
+ return createHash("sha256").update(bytes).digest("hex");
37
+ }
38
+ function stableObjectFingerprint(value) {
39
+ return sha256(JSON.stringify(value));
40
+ }
41
+ function runGitResult(repositoryRoot, args, acceptedStatuses = [0]) {
42
+ const inheritedEnvironment = Object.fromEntries(Object.entries(process.env).filter(([key]) => !UNTRUSTED_GIT_ENVIRONMENT.has(key)));
43
+ const environment = {
44
+ ...inheritedEnvironment,
45
+ GIT_OPTIONAL_LOCKS: "0",
46
+ GIT_TERMINAL_PROMPT: "0",
47
+ };
48
+ const result = spawnSync("git", ["--no-optional-locks", "-c", "core.fsmonitor=false", ...args], {
49
+ cwd: repositoryRoot,
50
+ env: environment,
51
+ encoding: "buffer",
52
+ windowsHide: true,
53
+ maxBuffer: MAX_GIT_OUTPUT_BYTES,
54
+ stdio: "pipe",
55
+ });
56
+ if (result.error !== undefined) {
57
+ if (result.error.code === "ENOBUFS") {
58
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Git output exceeded the ${MAX_GIT_OUTPUT_BYTES}-byte observation limit.`);
59
+ }
60
+ throw new GitCandidateObservationError("git-command-failed", `Git ${args[0] ?? "command"} could not be started.`);
61
+ }
62
+ if (result.status === null || !acceptedStatuses.includes(result.status)) {
63
+ throw new GitCandidateObservationError("git-command-failed", `Git ${args[0] ?? "command"} exited with status ${String(result.status)}.`);
64
+ }
65
+ return { status: result.status, stdout: result.stdout ?? Buffer.alloc(0) };
66
+ }
67
+ function runGit(repositoryRoot, args, acceptedStatuses = [0]) {
68
+ return runGitResult(repositoryRoot, args, acceptedStatuses).stdout;
69
+ }
70
+ function decodeGitText(bytes, label) {
71
+ const value = bytes.toString("utf8").replace(/[\r\n]+$/, "");
72
+ if (!value ||
73
+ !Buffer.from(value, "utf8").equals(bytes.subarray(0, Buffer.byteLength(value)))) {
74
+ throw new GitCandidateObservationError("git-command-failed", `Git returned invalid ${label}.`);
75
+ }
76
+ return value;
77
+ }
78
+ function decodeNulPaths(bytes, label) {
79
+ const paths = [];
80
+ let start = 0;
81
+ while (start < bytes.length) {
82
+ const end = bytes.indexOf(0, start);
83
+ if (end < 0) {
84
+ throw new GitCandidateObservationError("git-command-failed", `Git returned malformed ${label}.`);
85
+ }
86
+ const encoded = bytes.subarray(start, end);
87
+ if (encoded.length > 0) {
88
+ const value = encoded.toString("utf8");
89
+ if (!Buffer.from(value, "utf8").equals(encoded)) {
90
+ throw new GitCandidateObservationError("git-command-failed", `Git returned a ${label} path that is not valid UTF-8.`);
91
+ }
92
+ paths.push(normalizeRepositoryPath(value, label));
93
+ if (paths.length > MAX_CHANGED_PATHS) {
94
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Changed path count exceeded the ${MAX_CHANGED_PATHS}-path observation limit.`);
95
+ }
96
+ }
97
+ start = end + 1;
98
+ }
99
+ return [...new Set(paths)].sort();
100
+ }
101
+ function normalizeRepositoryPath(value, label) {
102
+ if (typeof value !== "string" || value.length === 0 || value.includes("\0")) {
103
+ throw new GitCandidateObservationError("invalid-write-set", `${label} must be a non-empty relative path.`);
104
+ }
105
+ const normalized = value.replace(/\\/g, "/");
106
+ if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized)) {
107
+ throw new GitCandidateObservationError("invalid-write-set", `${label} must be repository-relative.`);
108
+ }
109
+ const segments = normalized.split("/");
110
+ if (segments.some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
111
+ throw new GitCandidateObservationError("invalid-write-set", `${label} contains an unsafe path segment.`);
112
+ }
113
+ return segments.join("/");
114
+ }
115
+ function normalizeWriteSet(input) {
116
+ if (!input ||
117
+ !Array.isArray(input.exactPaths) ||
118
+ !Array.isArray(input.directoryPrefixes)) {
119
+ throw new GitCandidateObservationError("invalid-write-set", "Write set must contain exactPaths and directoryPrefixes arrays.");
120
+ }
121
+ const exactPaths = input.exactPaths.map((entry) => normalizeRepositoryPath(entry, "write-set file"));
122
+ const directoryPrefixes = input.directoryPrefixes.map((entry) => normalizeRepositoryPath(entry, "write-set directory"));
123
+ if (new Set([...exactPaths, ...directoryPrefixes]).size !==
124
+ exactPaths.length + directoryPrefixes.length) {
125
+ throw new GitCandidateObservationError("invalid-write-set", "Write-set paths must be unique across files and directories.");
126
+ }
127
+ if (exactPaths.length + directoryPrefixes.length > MAX_CHANGED_PATHS) {
128
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Run write set exceeded the ${MAX_CHANGED_PATHS}-path observation limit.`);
129
+ }
130
+ return {
131
+ exactPaths: [...exactPaths].sort(),
132
+ directoryPrefixes: [...directoryPrefixes].sort(),
133
+ };
134
+ }
135
+ function pathIsAllowed(repositoryPath, writeSet) {
136
+ return (writeSet.exactPaths.includes(repositoryPath) ||
137
+ writeSet.directoryPrefixes.some((directory) => repositoryPath.startsWith(`${directory}/`)));
138
+ }
139
+ function collectGitState(repositoryRoot, expectedBaseSha) {
140
+ const head = decodeGitText(runGit(repositoryRoot, ["rev-parse", "--verify", "HEAD^{commit}"]), "HEAD").toLowerCase();
141
+ if (!/^[a-f0-9]{40}([a-f0-9]{24})?$/.test(head)) {
142
+ throw new GitCandidateObservationError("git-command-failed", "Git HEAD is not a supported commit SHA.");
143
+ }
144
+ const branchBytes = runGit(repositoryRoot, ["symbolic-ref", "--short", "-q", "HEAD"], [0, 1]);
145
+ const branch = branchBytes.length === 0 ? null : decodeGitText(branchBytes, "branch");
146
+ const stagedPaths = decodeNulPaths(runGit(repositoryRoot, [
147
+ "diff",
148
+ "--cached",
149
+ "--name-only",
150
+ "--no-renames",
151
+ "-z",
152
+ "--",
153
+ ]), "staged paths");
154
+ const unstagedPaths = decodeNulPaths(runGit(repositoryRoot, ["diff", "--name-only", "--no-renames", "-z", "--"]), "unstaged paths");
155
+ const untrackedPaths = decodeNulPaths(runGit(repositoryRoot, [
156
+ "ls-files",
157
+ "--others",
158
+ "--exclude-standard",
159
+ "-z",
160
+ ]), "untracked paths");
161
+ const conflictPaths = decodeNulPaths(runGit(repositoryRoot, [
162
+ "diff",
163
+ "--name-only",
164
+ "--diff-filter=U",
165
+ "--no-renames",
166
+ "-z",
167
+ "--",
168
+ ]), "conflict paths");
169
+ const committedPaths = expectedBaseSha === null
170
+ ? []
171
+ : decodeNulPaths(runGit(repositoryRoot, [
172
+ "diff",
173
+ "--name-only",
174
+ "--no-renames",
175
+ "-z",
176
+ expectedBaseSha,
177
+ head,
178
+ "--",
179
+ ]), "committed paths");
180
+ const indexDiffSha256 = sha256(runGit(repositoryRoot, [
181
+ "diff",
182
+ "--cached",
183
+ "--raw",
184
+ "--no-renames",
185
+ "--no-ext-diff",
186
+ "--no-textconv",
187
+ "-z",
188
+ "--",
189
+ ]));
190
+ const worktreeDiffSha256 = sha256(runGit(repositoryRoot, [
191
+ "diff",
192
+ "--raw",
193
+ "--no-renames",
194
+ "--no-ext-diff",
195
+ "--no-textconv",
196
+ "-z",
197
+ "--",
198
+ ]));
199
+ const statusSha256 = sha256(runGit(repositoryRoot, [
200
+ "status",
201
+ "--porcelain=v2",
202
+ "-z",
203
+ "--untracked-files=all",
204
+ ]));
205
+ const state = {
206
+ head,
207
+ branch,
208
+ stagedPaths,
209
+ unstagedPaths,
210
+ untrackedPaths,
211
+ conflictPaths,
212
+ committedPaths,
213
+ indexDiffSha256,
214
+ worktreeDiffSha256,
215
+ statusSha256,
216
+ };
217
+ return { ...state, stateSha256: stableObjectFingerprint(state) };
218
+ }
219
+ function isWithin(parent, candidate) {
220
+ const relative = path.relative(parent, candidate);
221
+ return (relative === "" ||
222
+ (!relative.startsWith(`..${path.sep}`) &&
223
+ relative !== ".." &&
224
+ !path.isAbsolute(relative)));
225
+ }
226
+ function samePhysicalDirectory(left, right) {
227
+ if (left === right)
228
+ return true;
229
+ try {
230
+ const a = fs.statSync(left, { bigint: true });
231
+ const b = fs.statSync(right, { bigint: true });
232
+ return (a.isDirectory() &&
233
+ b.isDirectory() &&
234
+ a.ino !== 0n &&
235
+ a.dev === b.dev &&
236
+ a.ino === b.ino);
237
+ }
238
+ catch {
239
+ return false;
240
+ }
241
+ }
242
+ function realRepositoryRoot(repositoryRoot) {
243
+ let requestedRoot;
244
+ try {
245
+ requestedRoot = fs.realpathSync(path.resolve(repositoryRoot));
246
+ }
247
+ catch {
248
+ throw new GitCandidateObservationError("invalid-root", "Repository root does not exist or cannot be resolved.");
249
+ }
250
+ const gitRoot = decodeGitText(runGit(requestedRoot, ["rev-parse", "--show-toplevel"]), "repository root");
251
+ let resolvedGitRoot;
252
+ try {
253
+ resolvedGitRoot = fs.realpathSync(gitRoot);
254
+ }
255
+ catch {
256
+ throw new GitCandidateObservationError("invalid-root", "Git repository root cannot be resolved.");
257
+ }
258
+ // Git for Windows can expand an 8.3 temp path while Node preserves its short
259
+ // spelling. Require directory identity so the alias is accepted without
260
+ // accepting a nested directory or a different repository.
261
+ if (!samePhysicalDirectory(requestedRoot, resolvedGitRoot)) {
262
+ throw new GitCandidateObservationError("invalid-root", "Repository root must be the Git top-level directory.");
263
+ }
264
+ return resolvedGitRoot;
265
+ }
266
+ /** Capture a stable current HEAD/branch baseline for a standalone Run. */
267
+ export function observeGitRepositoryBaseline(repositoryRoot) {
268
+ const root = realRepositoryRoot(repositoryRoot);
269
+ const read = () => {
270
+ const headSha = decodeGitText(runGit(root, ["rev-parse", "--verify", "HEAD^{commit}"]), "HEAD").toLowerCase();
271
+ if (!/^[a-f0-9]{40}([a-f0-9]{24})?$/.test(headSha)) {
272
+ throw new GitCandidateObservationError("git-command-failed", "Git HEAD is not a supported commit SHA.");
273
+ }
274
+ const branchBytes = runGit(root, ["symbolic-ref", "--short", "-q", "HEAD"], [0, 1]);
275
+ return {
276
+ headSha,
277
+ branch: branchBytes.length === 0 ? null : decodeGitText(branchBytes, "branch"),
278
+ };
279
+ };
280
+ const first = read();
281
+ const second = read();
282
+ if (first.headSha !== second.headSha || first.branch !== second.branch) {
283
+ throw new GitCandidateObservationError("current-file-unreadable", "Git HEAD or branch changed while capturing the Run baseline; retry with a stable repository.");
284
+ }
285
+ return first;
286
+ }
287
+ /** Select a Git commit baseline or bounded regular-file baseline for a standalone Run. */
288
+ export function observeTaskRunRepositoryBaseline(repositoryRoot, writeSetSnapshot) {
289
+ if (hasGitMetadataAtProjectRoot(repositoryRoot)) {
290
+ const baseline = observeGitRepositoryBaseline(repositoryRoot);
291
+ return {
292
+ candidateBaseSha: baseline.headSha,
293
+ candidateBaseBranch: baseline.branch,
294
+ candidateFileBaseline: null,
295
+ };
296
+ }
297
+ const candidateFileBaseline = captureProjectFileBaseline(repositoryRoot, writeSetSnapshot);
298
+ return {
299
+ candidateBaseSha: null,
300
+ candidateBaseBranch: null,
301
+ candidateFileBaseline,
302
+ };
303
+ }
304
+ function readCurrentFile(repositoryRoot, repositoryPath, budget) {
305
+ const absolutePath = path.join(repositoryRoot, ...repositoryPath.split("/"));
306
+ let before;
307
+ try {
308
+ before = fs.lstatSync(absolutePath);
309
+ }
310
+ catch (error) {
311
+ if (error.code === "ENOENT") {
312
+ return {
313
+ path: repositoryPath,
314
+ kind: "missing",
315
+ sizeBytes: 0,
316
+ sha256: null,
317
+ };
318
+ }
319
+ throw new GitCandidateObservationError("current-file-unreadable", `Cannot inspect changed path ${repositoryPath}.`);
320
+ }
321
+ const parentPath = path.dirname(absolutePath);
322
+ let resolvedParent;
323
+ try {
324
+ resolvedParent = fs.realpathSync(parentPath);
325
+ }
326
+ catch {
327
+ throw new GitCandidateObservationError("current-file-unreadable", `Cannot resolve the parent of changed path ${repositoryPath}.`);
328
+ }
329
+ if (!isWithin(repositoryRoot, resolvedParent)) {
330
+ throw new GitCandidateObservationError("current-file-unreadable", `Changed path ${repositoryPath} resolves outside the Git repository.`);
331
+ }
332
+ if (before.isDirectory()) {
333
+ return {
334
+ path: repositoryPath,
335
+ kind: "directory",
336
+ sizeBytes: 0,
337
+ sha256: null,
338
+ };
339
+ }
340
+ let bytes;
341
+ let kind;
342
+ if (before.isSymbolicLink()) {
343
+ kind = "symlink";
344
+ try {
345
+ bytes = Buffer.from(fs.readlinkSync(absolutePath), "utf8");
346
+ }
347
+ catch {
348
+ throw new GitCandidateObservationError("current-file-unreadable", `Cannot read symlink ${repositoryPath}.`);
349
+ }
350
+ }
351
+ else if (before.isFile()) {
352
+ kind = "regular-file";
353
+ let resolvedFile;
354
+ try {
355
+ resolvedFile = fs.realpathSync(absolutePath);
356
+ }
357
+ catch {
358
+ throw new GitCandidateObservationError("current-file-unreadable", `Cannot resolve changed file ${repositoryPath}.`);
359
+ }
360
+ if (!isWithin(repositoryRoot, resolvedFile)) {
361
+ throw new GitCandidateObservationError("current-file-unreadable", `Changed file ${repositoryPath} resolves outside the Git repository.`);
362
+ }
363
+ if (before.size > MAX_CURRENT_FILE_BYTES ||
364
+ budget.totalBytes + before.size > MAX_TOTAL_CURRENT_BYTES) {
365
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Current bytes exceeded the ${MAX_CURRENT_FILE_BYTES}-byte per-file or ${MAX_TOTAL_CURRENT_BYTES}-byte total limit.`);
366
+ }
367
+ try {
368
+ bytes = fs.readFileSync(absolutePath);
369
+ }
370
+ catch {
371
+ throw new GitCandidateObservationError("current-file-unreadable", `Cannot read changed file ${repositoryPath}.`);
372
+ }
373
+ }
374
+ else {
375
+ throw new GitCandidateObservationError("current-file-unreadable", `Changed path ${repositoryPath} is not a regular file, symlink, or directory.`);
376
+ }
377
+ const after = fs.lstatSync(absolutePath);
378
+ if (before.dev !== after.dev ||
379
+ before.ino !== after.ino ||
380
+ before.mode !== after.mode ||
381
+ before.size !== after.size ||
382
+ before.mtimeMs !== after.mtimeMs ||
383
+ before.ctimeMs !== after.ctimeMs) {
384
+ throw new GitCandidateObservationError("current-file-unreadable", `Changed path ${repositoryPath} changed during observation.`);
385
+ }
386
+ if (kind === "regular-file" && bytes.length > MAX_CURRENT_FILE_BYTES) {
387
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Current file ${repositoryPath} exceeded the per-file byte limit.`);
388
+ }
389
+ if (budget.totalBytes + bytes.length > MAX_TOTAL_CURRENT_BYTES) {
390
+ throw new GitCandidateObservationError("observation-limit-exceeded", "Current files exceeded the total byte limit.");
391
+ }
392
+ budget.totalBytes += bytes.length;
393
+ return {
394
+ path: repositoryPath,
395
+ kind,
396
+ sizeBytes: bytes.length,
397
+ sha256: sha256(bytes),
398
+ };
399
+ }
400
+ function isWriteSetPath(repositoryPath, writeSet) {
401
+ return pathIsAllowed(repositoryPath, writeSet);
402
+ }
403
+ function stableSnapshotFingerprint(input) {
404
+ return stableObjectFingerprint({
405
+ source: GIT_CANDIDATE_OBSERVER_VERSION,
406
+ ...input,
407
+ });
408
+ }
409
+ /** Read a bounded Git candidate snapshot without changing the repository. */
410
+ export function observeGitCandidate(input) {
411
+ const repositoryRoot = realRepositoryRoot(input.repositoryRoot);
412
+ const allowedWriteSet = normalizeWriteSet(input.allowedWriteSet);
413
+ const expectedBaseSha = input.expectedBaseSha ?? null;
414
+ const expectedBranch = input.expectedBranch ?? null;
415
+ const expectedBranchBound = input.expectedBranch !== undefined;
416
+ if (expectedBranch !== null &&
417
+ (expectedBranch.trim().length === 0 ||
418
+ expectedBranch !== expectedBranch.trim())) {
419
+ throw new GitCandidateObservationError("invalid-write-set", "Expected branch must be a non-empty trimmed string.");
420
+ }
421
+ if (expectedBaseSha !== null &&
422
+ (expectedBaseSha.trim().length === 0 ||
423
+ expectedBaseSha !== expectedBaseSha.trim())) {
424
+ throw new GitCandidateObservationError("invalid-write-set", "Expected base SHA must be a non-empty trimmed string.");
425
+ }
426
+ if (expectedBaseSha !== null &&
427
+ !/^[a-f0-9]{40}([a-f0-9]{24})?$/i.test(expectedBaseSha)) {
428
+ throw new GitCandidateObservationError("invalid-write-set", "Expected base SHA must be a full Git commit identifier.");
429
+ }
430
+ const normalizedExpectedBaseSha = expectedBaseSha?.toLowerCase() ?? null;
431
+ const initial = collectGitState(repositoryRoot, normalizedExpectedBaseSha);
432
+ const repositoryIdentitySha256 = sha256(process.platform === "win32"
433
+ ? repositoryRoot.toLowerCase()
434
+ : repositoryRoot);
435
+ const affectedPaths = [
436
+ ...new Set([
437
+ ...initial.stagedPaths,
438
+ ...initial.unstagedPaths,
439
+ ...initial.untrackedPaths,
440
+ ...initial.conflictPaths,
441
+ ...initial.committedPaths,
442
+ ]),
443
+ ].sort();
444
+ if (affectedPaths.length > MAX_CHANGED_PATHS) {
445
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Affected path count exceeded the ${MAX_CHANGED_PATHS}-path limit.`);
446
+ }
447
+ const inScopePaths = affectedPaths.filter((entry) => isWriteSetPath(entry, allowedWriteSet));
448
+ const outOfScopePaths = affectedPaths.filter((entry) => !isWriteSetPath(entry, allowedWriteSet));
449
+ const observationPaths = [
450
+ ...new Set([...inScopePaths, ...allowedWriteSet.exactPaths]),
451
+ ].sort();
452
+ const currentFiles = [];
453
+ const budget = { totalBytes: 0 };
454
+ for (const repositoryPath of observationPaths) {
455
+ currentFiles.push(readCurrentFile(repositoryRoot, repositoryPath, budget));
456
+ }
457
+ const currentAfterRead = currentFiles.map((entry) => readCurrentFile(repositoryRoot, entry.path, { totalBytes: 0 }));
458
+ const after = collectGitState(repositoryRoot, normalizedExpectedBaseSha);
459
+ if (initial.stateSha256 !== after.stateSha256 ||
460
+ stableObjectFingerprint(currentFiles) !==
461
+ stableObjectFingerprint(currentAfterRead)) {
462
+ throw new GitCandidateObservationError("current-file-unreadable", "Git or allowed file state changed during candidate observation; retry with a stable worktree.");
463
+ }
464
+ const workspaceMismatch = expectedBranchBound && expectedBranch !== initial.branch;
465
+ const scopeStatus = initial.conflictPaths.length > 0
466
+ ? "conflicted"
467
+ : workspaceMismatch
468
+ ? "workspace-mismatch"
469
+ : outOfScopePaths.length > 0
470
+ ? "out-of-scope"
471
+ : "within-write-set";
472
+ const fingerprintInput = {
473
+ repositoryIdentitySha256,
474
+ expectedBaseSha: expectedBaseSha?.toLowerCase() ?? null,
475
+ expectedBranch,
476
+ expectedBranchBound,
477
+ head: initial.head,
478
+ branch: initial.branch,
479
+ allowedWriteSet,
480
+ stagedPaths: initial.stagedPaths,
481
+ unstagedPaths: initial.unstagedPaths,
482
+ untrackedPaths: initial.untrackedPaths,
483
+ conflictPaths: initial.conflictPaths,
484
+ committedPaths: initial.committedPaths,
485
+ affectedPaths,
486
+ inScopePaths,
487
+ outOfScopePaths,
488
+ currentFiles,
489
+ indexDiffSha256: initial.indexDiffSha256,
490
+ worktreeDiffSha256: initial.worktreeDiffSha256,
491
+ statusSha256: initial.statusSha256,
492
+ scopeStatus,
493
+ };
494
+ return {
495
+ schemaVersion: 1,
496
+ source: GIT_CANDIDATE_OBSERVER_VERSION,
497
+ repositoryRoot,
498
+ observedAt: new Date().toISOString(),
499
+ ...fingerprintInput,
500
+ fingerprint: stableSnapshotFingerprint(fingerprintInput),
501
+ };
502
+ }
503
+ /** Detect edits to a serialized observation before using it as candidate evidence. */
504
+ export function verifyGitCandidateObservation(observation) {
505
+ try {
506
+ const { repositoryIdentitySha256, expectedBaseSha, expectedBranch, expectedBranchBound, head, branch, allowedWriteSet, stagedPaths, unstagedPaths, untrackedPaths, conflictPaths, committedPaths, affectedPaths, inScopePaths, outOfScopePaths, currentFiles, indexDiffSha256, worktreeDiffSha256, statusSha256, scopeStatus, } = observation;
507
+ return (observation.schemaVersion === 1 &&
508
+ observation.source === GIT_CANDIDATE_OBSERVER_VERSION &&
509
+ stableSnapshotFingerprint({
510
+ repositoryIdentitySha256,
511
+ expectedBaseSha,
512
+ expectedBranch,
513
+ expectedBranchBound,
514
+ head,
515
+ branch,
516
+ allowedWriteSet,
517
+ stagedPaths,
518
+ unstagedPaths,
519
+ untrackedPaths,
520
+ conflictPaths,
521
+ committedPaths,
522
+ affectedPaths,
523
+ inScopePaths,
524
+ outOfScopePaths,
525
+ currentFiles,
526
+ indexDiffSha256,
527
+ worktreeDiffSha256,
528
+ statusSha256,
529
+ scopeStatus,
530
+ }) === observation.fingerprint);
531
+ }
532
+ catch {
533
+ return false;
534
+ }
535
+ }
536
+ function writeSetFromTaskPaths(paths) {
537
+ const exactPaths = [];
538
+ const directoryPrefixes = [];
539
+ for (const entry of paths) {
540
+ if (typeof entry !== "string") {
541
+ throw new GitCandidateObservationError("invalid-write-set", "P35 Run write-set entries must be strings.");
542
+ }
543
+ if (entry.endsWith("/") || entry.endsWith("\\")) {
544
+ directoryPrefixes.push(normalizeRepositoryPath(entry.replace(/[\\/]$/, ""), "Run write-set directory"));
545
+ }
546
+ else {
547
+ exactPaths.push(normalizeRepositoryPath(entry, "Run write-set file"));
548
+ }
549
+ }
550
+ return normalizeWriteSet({ exactPaths, directoryPrefixes });
551
+ }
552
+ function sameWriteSet(left, right) {
553
+ const keys = (writeSet) => [...new Set([...writeSet.exactPaths, ...writeSet.directoryPrefixes])]
554
+ .map((entry) => process.platform === "win32" ? entry.toLowerCase() : entry)
555
+ .sort();
556
+ return stableObjectFingerprint(keys(left)) === stableObjectFingerprint(keys(right));
557
+ }
558
+ function sameResolvedPath(left, right) {
559
+ let leftReal;
560
+ let rightReal;
561
+ try {
562
+ leftReal = fs.realpathSync(path.resolve(left));
563
+ rightReal = fs.realpathSync(path.resolve(right));
564
+ }
565
+ catch {
566
+ return false;
567
+ }
568
+ return (path.relative(leftReal, rightReal) === "" &&
569
+ path.relative(rightReal, leftReal) === "");
570
+ }
571
+ /** Adapt the frozen P35 Run write-set/workspace fields to the read-only observer. */
572
+ export function observeTaskRunCandidate(input) {
573
+ const run = input.run;
574
+ if (run.workspace !== null && run.workspace.ownerRunId !== run.id) {
575
+ throw new GitCandidateObservationError("workspace-root-mismatch", "P35 Run workspace owner does not match the selected Run.");
576
+ }
577
+ if (run.workspace?.reclamationState === "reclaimed" ||
578
+ run.workspace?.reclamationState === "failed") {
579
+ throw new GitCandidateObservationError("workspace-root-mismatch", `P35 Run workspace is ${run.workspace.reclamationState}; candidate bytes cannot be re-observed.`);
580
+ }
581
+ const runWriteSet = writeSetFromTaskPaths(run.writeSetSnapshot);
582
+ const workspaceWriteSet = run.workspace === null
583
+ ? null
584
+ : writeSetFromTaskPaths(run.workspace.writeSet);
585
+ if (workspaceWriteSet !== null &&
586
+ !sameWriteSet(runWriteSet, workspaceWriteSet)) {
587
+ throw new GitCandidateObservationError("write-set-mismatch", "P35 Run writeSetSnapshot and workspace.writeSet disagree.");
588
+ }
589
+ const workspaceRoot = run.workspace?.canonicalPath;
590
+ if (workspaceRoot &&
591
+ input.repositoryRoot &&
592
+ !sameResolvedPath(workspaceRoot, input.repositoryRoot)) {
593
+ throw new GitCandidateObservationError("workspace-root-mismatch", "Explicit repository root does not match the P35 Run workspace.");
594
+ }
595
+ const repositoryRoot = workspaceRoot ?? input.repositoryRoot;
596
+ if (!repositoryRoot) {
597
+ throw new GitCandidateObservationError("invalid-root", "A repository root is required for a Run without a workspace binding.");
598
+ }
599
+ const candidateFileBaseline = run.candidateFileBaseline ?? null;
600
+ if (candidateFileBaseline !== null) {
601
+ if (run.workspace !== null ||
602
+ (run.candidateBaseSha ?? null) !== null ||
603
+ (run.candidateBaseBranch ?? null) !== null) {
604
+ throw new GitCandidateObservationError("candidate-not-eligible", "Non-Git file baseline cannot be combined with a Git or managed-worktree baseline.");
605
+ }
606
+ return observeProjectFileCandidate({
607
+ root: repositoryRoot,
608
+ baseline: candidateFileBaseline,
609
+ writeSetSnapshot: run.writeSetSnapshot,
610
+ });
611
+ }
612
+ const expectedBaseSha = run.candidateBaseSha ?? run.workspace?.baseSha ?? null;
613
+ if (expectedBaseSha === null) {
614
+ throw new GitCandidateObservationError("candidate-not-eligible", "P35 Run has no Core-observed Git base SHA; committed candidate scope cannot be verified.");
615
+ }
616
+ return observeGitCandidate({
617
+ repositoryRoot,
618
+ allowedWriteSet: runWriteSet,
619
+ expectedBaseSha,
620
+ expectedBranch: run.workspace?.branch ?? run.candidateBaseBranch ?? null,
621
+ });
622
+ }
623
+ /** Check whether a repository-relative delivery path is inside the Run write set. */
624
+ export function isTaskRunPathInWriteSet(run, repositoryPath) {
625
+ const writeSet = writeSetFromTaskPaths(run.writeSetSnapshot);
626
+ if (run.workspace !== null) {
627
+ if (run.workspace.ownerRunId !== run.id)
628
+ return false;
629
+ const workspaceWriteSet = writeSetFromTaskPaths(run.workspace.writeSet);
630
+ if (!sameWriteSet(writeSet, workspaceWriteSet))
631
+ return false;
632
+ }
633
+ const normalizedPath = normalizeRepositoryPath(repositoryPath, "delivery file");
634
+ if (run.candidateFileBaseline && isExcludedProjectPath(normalizedPath)) {
635
+ return false;
636
+ }
637
+ return pathIsAllowed(normalizedPath, writeSet);
638
+ }
639
+ /** Hash a current regular file while rejecting symlinks, escapes, and concurrent writes. */
640
+ export function fingerprintCurrentRepositoryFile(repositoryRoot, repositoryPath) {
641
+ const root = realRepositoryRoot(repositoryRoot);
642
+ const filePath = normalizeRepositoryPath(repositoryPath, "delivery file");
643
+ const first = readCurrentFile(root, filePath, { totalBytes: 0 });
644
+ if (first.kind !== "regular-file" || first.sha256 === null) {
645
+ throw new GitCandidateObservationError("current-file-unreadable", `Delivery path ${filePath} must be a regular file inside the repository.`);
646
+ }
647
+ const second = readCurrentFile(root, filePath, { totalBytes: 0 });
648
+ if (second.kind !== "regular-file" ||
649
+ second.sizeBytes !== first.sizeBytes ||
650
+ second.sha256 !== first.sha256) {
651
+ throw new GitCandidateObservationError("current-file-unreadable", `Delivery file ${filePath} changed during observation.`);
652
+ }
653
+ return first;
654
+ }
655
+ function requireCommitSha(value, field) {
656
+ if (!/^[a-f0-9]{40}([a-f0-9]{24})?$/i.test(value)) {
657
+ throw new GitCandidateObservationError("git-command-failed", `${field} must be a full Git commit identifier.`);
658
+ }
659
+ return value.toLowerCase();
660
+ }
661
+ /** Resolve a local branch name to its current commit without updating refs. */
662
+ export function resolveGitLocalBranchSha(repositoryRoot, branch) {
663
+ if (typeof branch !== "string" ||
664
+ branch.length === 0 ||
665
+ branch !== branch.trim() ||
666
+ branch.startsWith("-") ||
667
+ branch.includes("..") ||
668
+ branch.includes("@{") ||
669
+ branch.includes("\\")) {
670
+ throw new GitCandidateObservationError("git-command-failed", "Target must be a local branch name.");
671
+ }
672
+ const root = realRepositoryRoot(repositoryRoot);
673
+ const ref = `refs/heads/${branch}`;
674
+ runGit(root, ["check-ref-format", ref]);
675
+ return requireCommitSha(decodeGitText(runGit(root, ["rev-parse", "--verify", `${ref}^{commit}`]), "target branch SHA"), "Target branch SHA");
676
+ }
677
+ /** Read a configured remote URL without printing it or updating repository state. */
678
+ export function readGitRemoteUrl(repositoryRoot, remoteName = "origin") {
679
+ if (!/^[A-Za-z0-9._-]+$/.test(remoteName) || remoteName.startsWith("-")) {
680
+ throw new GitCandidateObservationError("git-command-failed", "Git remote name is invalid.");
681
+ }
682
+ const root = realRepositoryRoot(repositoryRoot);
683
+ return decodeGitText(runGit(root, ["remote", "get-url", remoteName]), "remote URL");
684
+ }
685
+ /** Read only the commit graph; no fetch, checkout, or ref update is performed. */
686
+ export function isGitCommitAncestor(repositoryRoot, ancestorSha, descendantSha) {
687
+ const ancestor = requireCommitSha(ancestorSha, "Ancestor SHA");
688
+ const descendant = requireCommitSha(descendantSha, "Descendant SHA");
689
+ const root = realRepositoryRoot(repositoryRoot);
690
+ const result = runGitResult(root, ["merge-base", "--is-ancestor", ancestor, descendant], [0, 1]);
691
+ return result.status === 0;
692
+ }
693
+ /** Hash a regular file from a commit tree without writing or emitting its bytes. */
694
+ export function fingerprintGitTreeFile(repositoryRoot, commitSha, repositoryPath) {
695
+ const root = realRepositoryRoot(repositoryRoot);
696
+ const commit = requireCommitSha(commitSha, "File tree commit SHA");
697
+ const filePath = normalizeRepositoryPath(repositoryPath, "delivery file");
698
+ const treeOutput = runGit(root, [
699
+ "ls-tree",
700
+ "-z",
701
+ commit,
702
+ "--",
703
+ `:(literal)${filePath}`,
704
+ ]);
705
+ const entries = treeOutput.toString("utf8").split("\0").filter(Boolean);
706
+ const matching = entries.filter((entry) => {
707
+ const tab = entry.indexOf("\t");
708
+ return tab >= 0 && entry.slice(tab + 1) === filePath;
709
+ });
710
+ if (matching.length === 0)
711
+ return null;
712
+ if (matching.length !== 1) {
713
+ throw new GitCandidateObservationError("git-command-failed", `Git returned an ambiguous tree entry for ${filePath}.`);
714
+ }
715
+ const [metadata, entryPath] = matching[0]?.split("\t", 2) ?? [];
716
+ const [mode, type, objectSha] = (metadata ?? "").split(" ");
717
+ if (entryPath !== filePath ||
718
+ type !== "blob" ||
719
+ !/^[a-f0-9]{40}([a-f0-9]{24})?$/i.test(objectSha ?? "")) {
720
+ throw new GitCandidateObservationError("current-file-unreadable", `Delivery path ${filePath} is not a regular Git file.`);
721
+ }
722
+ if (mode !== "100644" && mode !== "100755") {
723
+ throw new GitCandidateObservationError("current-file-unreadable", `Delivery path ${filePath} has unsupported Git mode ${mode ?? "unknown"}.`);
724
+ }
725
+ const bytes = runGit(root, ["cat-file", "blob", objectSha]);
726
+ if (bytes.length > MAX_CURRENT_FILE_BYTES) {
727
+ throw new GitCandidateObservationError("observation-limit-exceeded", `Delivery file ${filePath} exceeded the ${MAX_CURRENT_FILE_BYTES}-byte limit.`);
728
+ }
729
+ return {
730
+ commitSha: commit,
731
+ path: filePath,
732
+ mode,
733
+ sizeBytes: bytes.length,
734
+ sha256: sha256(bytes),
735
+ };
736
+ }
737
+ /** Add this entry to P35 `candidateEntries` before `run-result` freezes the Run candidate. */
738
+ export function createTaskCandidateEntry(observation) {
739
+ const isGit = observation.source === GIT_CANDIDATE_OBSERVER_VERSION;
740
+ const intact = isGit
741
+ ? verifyGitCandidateObservation(observation)
742
+ : verifyProjectFileCandidateObservation(observation);
743
+ if (!intact) {
744
+ throw new GitCandidateObservationError("candidate-not-eligible", "Candidate observation fingerprint does not match its contents.");
745
+ }
746
+ if (observation.scopeStatus !== "within-write-set") {
747
+ throw new GitCandidateObservationError("candidate-not-eligible", `Candidate observation is ${observation.scopeStatus}; it cannot be attached to a P35 candidate snapshot.`);
748
+ }
749
+ return {
750
+ ref: taskCandidateObservationEntryRef(observation),
751
+ fingerprint: observation.fingerprint,
752
+ };
753
+ }
754
+ export function taskCandidateObservationEntryRef(observation) {
755
+ return observation.source === GIT_CANDIDATE_OBSERVER_VERSION
756
+ ? VERIFICATION_CANDIDATE_ENTRY_REF
757
+ : PROJECT_FILE_CANDIDATE_ENTRY_REF;
758
+ }
759
+ export function isRunCandidateObservationEntry(ref) {
760
+ return RUN_CANDIDATE_ENTRY_REFS.includes(ref);
761
+ }
762
+ //# sourceMappingURL=task-candidate-observer.js.map