@phyzess/pappra 0.1.0-beta.13 → 0.1.0-beta.18

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 (357) hide show
  1. package/README.md +134 -15
  2. package/assets/integrations/skills/pappra/SKILL.md +28 -7
  3. package/assets/integrations/skills/pappra/references/collaboration.md +633 -0
  4. package/assets/integrations/skills/pappra/references/environment.md +360 -0
  5. package/assets/integrations/skills/pappra/references/hosts.md +20 -0
  6. package/assets/integrations/skills/pappra/references/operations.md +36 -5
  7. package/dist/adapters/pi/recovery-extension.d.ts +65 -0
  8. package/dist/adapters/pi/recovery-extension.js +238 -0
  9. package/dist/adapters/pi/session-transition-extension.d.ts +30 -0
  10. package/dist/adapters/pi/session-transition-extension.js +265 -0
  11. package/dist/app/automatic-handoff-events.d.ts +26 -0
  12. package/dist/app/automatic-handoff-events.js +134 -0
  13. package/dist/app/bounded-file.d.ts +2 -0
  14. package/dist/app/bounded-file.js +2 -0
  15. package/dist/app/capability-evidence/claude.d.ts +37 -0
  16. package/dist/app/capability-evidence/claude.js +206 -0
  17. package/dist/app/capability-evidence/codex.d.ts +35 -0
  18. package/dist/app/capability-evidence/codex.js +193 -0
  19. package/dist/app/capability-evidence/index.d.ts +33 -0
  20. package/dist/app/capability-evidence/index.js +117 -0
  21. package/dist/app/capability-evidence/pi.d.ts +73 -0
  22. package/dist/app/capability-evidence/pi.js +669 -0
  23. package/dist/app/capability-evidence/shared.d.ts +69 -0
  24. package/dist/app/capability-evidence/shared.js +195 -0
  25. package/dist/app/collab-auto-handoff.d.ts +55 -0
  26. package/dist/app/collab-auto-handoff.js +384 -0
  27. package/dist/app/collab-bindings.d.ts +57 -0
  28. package/dist/app/collab-bindings.js +1006 -0
  29. package/dist/app/collab-bootstrap-transport.d.ts +163 -0
  30. package/dist/app/collab-bootstrap-transport.js +769 -0
  31. package/dist/app/collab-bootstrap.d.ts +137 -0
  32. package/dist/app/collab-bootstrap.js +3455 -0
  33. package/dist/app/collab-handoff.d.ts +12 -0
  34. package/dist/app/collab-handoff.js +511 -0
  35. package/dist/app/collab-messages.d.ts +2 -0
  36. package/dist/app/collab-messages.js +2 -0
  37. package/dist/app/collab-notify.d.ts +156 -0
  38. package/dist/app/collab-notify.js +1208 -0
  39. package/dist/app/collab-preflight.d.ts +34 -0
  40. package/dist/app/collab-preflight.js +96 -0
  41. package/dist/app/collab-recovery-executor.d.ts +161 -0
  42. package/dist/app/collab-recovery-executor.js +1153 -0
  43. package/dist/app/collab-recovery-projection.d.ts +103 -0
  44. package/dist/app/collab-recovery-projection.js +659 -0
  45. package/dist/app/collab-recovery.d.ts +25 -0
  46. package/dist/app/collab-recovery.js +429 -0
  47. package/dist/app/collab-resources.d.ts +16 -0
  48. package/dist/app/collab-resources.js +278 -0
  49. package/dist/app/collab-role-events.d.ts +22 -0
  50. package/dist/app/collab-role-events.js +329 -0
  51. package/dist/app/collab-role-orchestration.d.ts +53 -0
  52. package/dist/app/collab-role-orchestration.js +601 -0
  53. package/dist/app/collab-role-plan.d.ts +81 -0
  54. package/dist/app/collab-role-plan.js +504 -0
  55. package/dist/app/collab-role-repair.d.ts +109 -0
  56. package/dist/app/collab-role-repair.js +821 -0
  57. package/dist/app/collab-rollover.d.ts +263 -0
  58. package/dist/app/collab-rollover.js +1112 -0
  59. package/dist/app/collab-route.d.ts +64 -0
  60. package/dist/app/collab-route.js +240 -0
  61. package/dist/app/collab-session-transition.d.ts +221 -0
  62. package/dist/app/collab-session-transition.js +3334 -0
  63. package/dist/app/collab-state.d.ts +7 -0
  64. package/dist/app/collab-state.js +162 -0
  65. package/dist/app/collab-task-store.d.ts +22 -0
  66. package/dist/app/collab-task-store.js +204 -0
  67. package/dist/app/collab-work-execution.d.ts +127 -0
  68. package/dist/app/collab-work-execution.js +1027 -0
  69. package/dist/app/collab-work-plan.d.ts +87 -0
  70. package/dist/app/collab-work-plan.js +437 -0
  71. package/dist/app/collaboration.d.ts +8 -2
  72. package/dist/app/collaboration.js +101 -12
  73. package/dist/app/doctor.js +108 -5
  74. package/dist/app/host-mcp.js +34 -8
  75. package/dist/app/host-probe.js +4 -4
  76. package/dist/app/init.d.ts +58 -4
  77. package/dist/app/init.js +768 -155
  78. package/dist/app/managed-pi-bootstrap-admission.d.ts +14 -0
  79. package/dist/app/managed-pi-bootstrap-admission.js +104 -0
  80. package/dist/app/managed-pi-bootstrap-refresh.d.ts +10 -0
  81. package/dist/app/managed-pi-bootstrap-refresh.js +78 -0
  82. package/dist/app/managed-pi-delivery.d.ts +8 -0
  83. package/dist/app/managed-pi-delivery.js +110 -0
  84. package/dist/app/managed-pi-handoff-receiver.d.ts +15 -0
  85. package/dist/app/managed-pi-handoff-receiver.js +263 -0
  86. package/dist/app/managed-pi-handoff-reference.d.ts +3 -0
  87. package/dist/app/managed-pi-handoff-reference.js +60 -0
  88. package/dist/app/managed-pi-herdr.d.ts +21 -0
  89. package/dist/app/managed-pi-herdr.js +185 -0
  90. package/dist/app/managed-pi-initial-admission.d.ts +28 -0
  91. package/dist/app/managed-pi-initial-admission.js +416 -0
  92. package/dist/app/managed-pi-initial-launch.d.ts +5 -0
  93. package/dist/app/managed-pi-initial-launch.js +61 -0
  94. package/dist/app/managed-pi-native-observation.d.ts +36 -0
  95. package/dist/app/managed-pi-native-observation.js +191 -0
  96. package/dist/app/managed-pi-readiness.d.ts +29 -0
  97. package/dist/app/managed-pi-readiness.js +288 -0
  98. package/dist/app/managed-pi-repair-stop.d.ts +21 -0
  99. package/dist/app/managed-pi-repair-stop.js +371 -0
  100. package/dist/app/managed-pi-resume-admission.d.ts +32 -0
  101. package/dist/app/managed-pi-resume-admission.js +618 -0
  102. package/dist/app/managed-pi-retirement.d.ts +28 -0
  103. package/dist/app/managed-pi-retirement.js +112 -0
  104. package/dist/app/managed-pi-sdk-control.d.ts +7 -0
  105. package/dist/app/managed-pi-sdk-control.js +169 -0
  106. package/dist/app/managed-pi-sdk-runtime.d.ts +3 -0
  107. package/dist/app/managed-pi-sdk-runtime.js +483 -0
  108. package/dist/app/managed-pi-source-admission.d.ts +14 -0
  109. package/dist/app/managed-pi-source-admission.js +323 -0
  110. package/dist/app/managed-pi-transition-host.d.ts +36 -0
  111. package/dist/app/managed-pi-transition-host.js +292 -0
  112. package/dist/app/managed-pi.d.ts +54 -0
  113. package/dist/app/managed-pi.js +248 -0
  114. package/dist/app/shell-readiness.d.ts +66 -0
  115. package/dist/app/shell-readiness.js +368 -0
  116. package/dist/app/task-pin.d.ts +2 -23
  117. package/dist/app/task-pin.js +2 -113
  118. package/dist/cli/commands/collaboration-binding.d.ts +13 -0
  119. package/dist/cli/commands/collaboration-binding.js +118 -0
  120. package/dist/cli/commands/collaboration-bootstrap.d.ts +10 -0
  121. package/dist/cli/commands/collaboration-bootstrap.js +84 -0
  122. package/dist/cli/commands/collaboration-capabilities.d.ts +13 -0
  123. package/dist/cli/commands/collaboration-capabilities.js +127 -0
  124. package/dist/cli/commands/collaboration-handoff.d.ts +13 -0
  125. package/dist/cli/commands/collaboration-handoff.js +102 -0
  126. package/dist/cli/commands/collaboration-message.d.ts +17 -0
  127. package/dist/cli/commands/collaboration-message.js +177 -0
  128. package/dist/cli/commands/collaboration-plan.d.ts +8 -0
  129. package/dist/cli/commands/collaboration-plan.js +108 -0
  130. package/dist/cli/commands/collaboration-preflight.d.ts +10 -0
  131. package/dist/cli/commands/collaboration-preflight.js +167 -0
  132. package/dist/cli/commands/collaboration-recovery-run.d.ts +46 -0
  133. package/dist/cli/commands/collaboration-recovery-run.js +224 -0
  134. package/dist/cli/commands/collaboration-recovery.d.ts +11 -0
  135. package/dist/cli/commands/collaboration-recovery.js +104 -0
  136. package/dist/cli/commands/collaboration-resources.d.ts +11 -0
  137. package/dist/cli/commands/collaboration-resources.js +96 -0
  138. package/dist/cli/commands/collaboration-role-plan.d.ts +9 -0
  139. package/dist/cli/commands/collaboration-role-plan.js +69 -0
  140. package/dist/cli/commands/collaboration-role-run.d.ts +11 -0
  141. package/dist/cli/commands/collaboration-role-run.js +128 -0
  142. package/dist/cli/commands/collaboration-rollover.d.ts +10 -0
  143. package/dist/cli/commands/collaboration-rollover.js +103 -0
  144. package/dist/cli/commands/collaboration-state.d.ts +10 -0
  145. package/dist/cli/commands/collaboration-state.js +96 -0
  146. package/dist/cli/commands/collaboration-transition.d.ts +10 -0
  147. package/dist/cli/commands/collaboration-transition.js +75 -0
  148. package/dist/cli/commands/collaboration-work-run.d.ts +34 -0
  149. package/dist/cli/commands/collaboration-work-run.js +178 -0
  150. package/dist/cli/commands/collaboration.d.ts +4 -0
  151. package/dist/cli/commands/collaboration.js +39 -4
  152. package/dist/cli/commands/continuity.js +2 -6
  153. package/dist/cli/commands/docs.d.ts +2 -0
  154. package/dist/cli/commands/docs.js +89 -15
  155. package/dist/cli/commands/host.d.ts +7 -1
  156. package/dist/cli/commands/host.js +122 -7
  157. package/dist/cli/commands/init.d.ts +20 -3
  158. package/dist/cli/commands/init.js +897 -232
  159. package/dist/cli/commands/mcp.d.ts +1 -0
  160. package/dist/cli/commands/mcp.js +11 -5
  161. package/dist/cli/commands/repair.d.ts +12 -0
  162. package/dist/cli/commands/repair.js +41 -0
  163. package/dist/cli/commands/runtime.d.ts +1 -1
  164. package/dist/cli/commands/runtime.js +139 -38
  165. package/dist/cli/commands/session.d.ts +7 -0
  166. package/dist/cli/commands/session.js +82 -0
  167. package/dist/cli/commands/task.js +19 -5
  168. package/dist/cli/run.js +866 -24
  169. package/dist/code/identity.d.ts +7 -0
  170. package/dist/code/identity.js +7 -3
  171. package/dist/code/registration.js +7 -0
  172. package/dist/code/service.d.ts +9 -0
  173. package/dist/code/service.js +16 -3
  174. package/dist/code/text.js +19 -7
  175. package/dist/collab/admission.d.ts +91 -66
  176. package/dist/collab/admission.js +21 -6
  177. package/dist/collab/canonical.d.ts +1 -1
  178. package/dist/collab/canonical.js +44 -3
  179. package/dist/collab/envelope.d.ts +2 -2
  180. package/dist/collab/envelope.js +12 -12
  181. package/dist/collab/first-work.d.ts +3 -0
  182. package/dist/collab/first-work.js +15 -0
  183. package/dist/collab/handoff.d.ts +16 -0
  184. package/dist/collab/handoff.js +39 -5
  185. package/dist/collab/index.d.ts +97 -1
  186. package/dist/collab/index.js +9 -1
  187. package/dist/collab/messages.js +126 -3
  188. package/dist/collab/persisted-messages.d.ts +123 -0
  189. package/dist/collab/persisted-messages.js +496 -0
  190. package/dist/collab/preflight.d.ts +1 -1
  191. package/dist/collab/resources.d.ts +13 -3
  192. package/dist/collab/resources.js +37 -6
  193. package/dist/collab/rollover.d.ts +311 -0
  194. package/dist/collab/rollover.js +1024 -0
  195. package/dist/collab/store.d.ts +1 -0
  196. package/dist/collab/store.js +1 -4
  197. package/dist/collab/types.d.ts +2 -354
  198. package/dist/collab/validation.d.ts +2 -10
  199. package/dist/collab/validation.js +2 -303
  200. package/dist/collab/work-plan.d.ts +105 -0
  201. package/dist/collab/work-plan.js +843 -0
  202. package/dist/continuity/context.d.ts +11 -2
  203. package/dist/continuity/context.js +100 -13
  204. package/dist/continuity/handoff-bundle.d.ts +296 -0
  205. package/dist/continuity/handoff-bundle.js +477 -0
  206. package/dist/continuity/index.d.ts +2 -0
  207. package/dist/continuity/index.js +1 -0
  208. package/dist/continuity/paths.js +10 -2
  209. package/dist/continuity/service.js +91 -15
  210. package/dist/continuity/task-pin.d.ts +24 -0
  211. package/dist/continuity/task-pin.js +590 -0
  212. package/dist/doctor.d.ts +1 -0
  213. package/dist/doctor.js +6 -0
  214. package/dist/experimental/index.d.ts +13 -0
  215. package/dist/experimental/index.js +25 -0
  216. package/dist/experimental/pi.d.ts +4 -0
  217. package/dist/experimental/pi.js +12 -0
  218. package/dist/hosts/claude/native.js +1 -1
  219. package/dist/hosts/codex/native.js +1 -1
  220. package/dist/hosts/codex/protocol.js +1 -1
  221. package/dist/hosts/integration/bootstrap-config.d.ts +58 -0
  222. package/dist/hosts/integration/bootstrap-config.js +254 -0
  223. package/dist/hosts/integration/bundle-export.d.ts +44 -0
  224. package/dist/hosts/integration/bundle-export.js +366 -3
  225. package/dist/hosts/integration/bundle.js +3 -0
  226. package/dist/hosts/integration/hook.js +36 -9
  227. package/dist/hosts/integration/pappra-bootstrap-extension.mjs +80 -0
  228. package/dist/hosts/integration/pappra-extension-runtime.mjs +59 -24631
  229. package/dist/hosts/integration/pappra-hook.mjs +61 -24749
  230. package/dist/hosts/integration/pappra-recovery-extension.mjs +259 -0
  231. package/dist/hosts/integration/pappra-session-transition-extension.mjs +276 -0
  232. package/dist/hosts/integration/pi-bootstrap-extension.d.ts +36 -0
  233. package/dist/hosts/integration/pi-bootstrap-extension.js +101 -0
  234. package/dist/hosts/integration/pi-bootstrap-guard.d.ts +125 -0
  235. package/dist/hosts/integration/pi-bootstrap-guard.js +438 -0
  236. package/dist/hosts/integration/pi-bootstrap-runtime.d.ts +63 -0
  237. package/dist/hosts/integration/pi-bootstrap-runtime.js +223 -0
  238. package/dist/hosts/integration/pi-native-events.d.ts +112 -0
  239. package/dist/hosts/integration/pi-native-events.js +348 -0
  240. package/dist/hosts/integration/pi-rollover-extension.d.ts +166 -0
  241. package/dist/hosts/integration/pi-rollover-extension.js +431 -0
  242. package/dist/hosts/integration/recovery-config.d.ts +48 -0
  243. package/dist/hosts/integration/recovery-config.js +117 -0
  244. package/dist/hosts/integration/service.d.ts +6 -1
  245. package/dist/hosts/integration/service.js +485 -35
  246. package/dist/hosts/integration/support.d.ts +7 -0
  247. package/dist/hosts/integration/support.js +9 -1
  248. package/dist/hosts/integration/templates.d.ts +3 -0
  249. package/dist/hosts/integration/templates.js +26 -3
  250. package/dist/hosts/pi/managed-host-identity.d.ts +2 -0
  251. package/dist/hosts/pi/managed-host-identity.js +40 -0
  252. package/dist/hosts/pi/managed-provider-diagnostics.d.ts +6 -0
  253. package/dist/hosts/pi/managed-provider-diagnostics.js +184 -0
  254. package/dist/hosts/pi/managed-sdk-session.d.ts +335 -0
  255. package/dist/hosts/pi/managed-sdk-session.js +1639 -0
  256. package/dist/hosts/pi/managed-session-extension.d.ts +20 -0
  257. package/dist/hosts/pi/managed-session-extension.js +84 -0
  258. package/dist/hosts/pi/managed-session.d.ts +177 -0
  259. package/dist/hosts/pi/managed-session.js +1557 -0
  260. package/dist/hosts/pi/protocol.js +1 -1
  261. package/dist/hosts/pi/query-result.js +1 -1
  262. package/dist/hosts/pi/resume-capability.d.ts +41 -0
  263. package/dist/hosts/pi/resume-capability.js +33 -0
  264. package/dist/hosts/pi/rpc.d.ts +182 -134
  265. package/dist/hosts/pi/rpc.js +230 -37
  266. package/dist/hosts/pilot.d.ts +97 -74
  267. package/dist/hosts/pilot.js +5 -1
  268. package/dist/hosts/version.d.ts +3 -0
  269. package/dist/hosts/version.js +18 -0
  270. package/dist/index.d.ts +0 -1
  271. package/dist/index.js +0 -1
  272. package/dist/infra/bounded-file.d.ts +19 -0
  273. package/dist/infra/bounded-file.js +66 -0
  274. package/dist/infra/fs.js +10 -2
  275. package/dist/infra/git.d.ts +29 -0
  276. package/dist/infra/git.js +45 -9
  277. package/dist/infra/json-property.d.ts +2 -0
  278. package/dist/infra/json-property.js +69 -0
  279. package/dist/infra/json.d.ts +4 -0
  280. package/dist/infra/json.js +24 -0
  281. package/dist/infra/owned-process-group.js +1 -1
  282. package/dist/infra/private-lock.d.ts +16 -0
  283. package/dist/infra/private-lock.js +148 -0
  284. package/dist/infra/private-state.d.ts +7 -0
  285. package/dist/infra/private-state.js +146 -0
  286. package/dist/infra/process-identity.d.ts +12 -0
  287. package/dist/infra/process-identity.js +142 -0
  288. package/dist/infra/validation.d.ts +5 -0
  289. package/dist/infra/validation.js +15 -0
  290. package/dist/init.d.ts +1 -0
  291. package/dist/init.js +6 -0
  292. package/dist/install/apply.d.ts +9 -1
  293. package/dist/install/apply.js +176 -12
  294. package/dist/install/dependencies.d.ts +38 -0
  295. package/dist/install/dependencies.js +282 -0
  296. package/dist/install/ownership.js +30 -1
  297. package/dist/install/references.d.ts +31 -0
  298. package/dist/install/references.js +208 -0
  299. package/dist/install/repair.d.ts +37 -0
  300. package/dist/install/repair.js +798 -0
  301. package/dist/install/reset-local.d.ts +16 -0
  302. package/dist/install/reset-local.js +304 -0
  303. package/dist/install/rollback.d.ts +3 -0
  304. package/dist/install/rollback.js +9 -3
  305. package/dist/install/runtime.d.ts +10 -6
  306. package/dist/install/runtime.js +299 -59
  307. package/dist/install/source-fingerprint.d.ts +2 -0
  308. package/dist/install/source-fingerprint.js +103 -0
  309. package/dist/knowledge/catalog.d.ts +1 -0
  310. package/dist/knowledge/catalog.js +143 -10
  311. package/dist/knowledge/journal.js +17 -7
  312. package/dist/knowledge/paths.js +2 -1
  313. package/dist/knowledge/refs.js +4 -0
  314. package/dist/knowledge/register-batch.d.ts +4 -0
  315. package/dist/knowledge/register-batch.js +225 -0
  316. package/dist/knowledge/relocate.d.ts +5 -0
  317. package/dist/knowledge/relocate.js +92 -0
  318. package/dist/knowledge/scan.js +103 -47
  319. package/dist/knowledge/service.d.ts +3 -0
  320. package/dist/knowledge/service.js +33 -1
  321. package/dist/knowledge/write.d.ts +4 -1
  322. package/dist/knowledge/write.js +1 -1
  323. package/dist/mcp/server.d.ts +4 -2
  324. package/dist/mcp/server.js +87 -136
  325. package/dist/schemas/collaboration-state-validation.d.ts +6 -0
  326. package/dist/schemas/collaboration-state-validation.js +342 -0
  327. package/dist/schemas/collaboration-state.d.ts +436 -0
  328. package/dist/schemas/collaboration-state.js +1 -0
  329. package/dist/schemas/collaboration.d.ts +335 -0
  330. package/dist/schemas/collaboration.js +272 -0
  331. package/dist/schemas/continuity.d.ts +8 -0
  332. package/dist/schemas/continuity.js +13 -3
  333. package/dist/schemas/doctor.d.ts +1 -0
  334. package/dist/schemas/doctor.js +1 -0
  335. package/dist/schemas/document.d.ts +61 -0
  336. package/dist/schemas/document.js +9 -0
  337. package/dist/schemas/errors.d.ts +1 -0
  338. package/dist/schemas/errors.js +1 -0
  339. package/dist/schemas/host.d.ts +24 -0
  340. package/dist/schemas/host.js +19 -0
  341. package/dist/schemas/install.d.ts +8 -2
  342. package/dist/schemas/install.js +11 -1
  343. package/dist/schemas/managed-pi-execution.d.ts +16 -0
  344. package/dist/schemas/managed-pi-execution.js +2 -0
  345. package/dist/schemas/outcome.d.ts +9 -5
  346. package/dist/workspace/config-file.js +1 -3
  347. package/dist/workspace/documents.js +12 -2
  348. package/dist/workspace/repositories.d.ts +7 -0
  349. package/dist/workspace/repositories.js +14 -5
  350. package/package.json +35 -35
  351. package/skills/pappra/SKILL.md +28 -7
  352. package/skills/pappra/references/collaboration.md +633 -0
  353. package/skills/pappra/references/environment.md +360 -0
  354. package/skills/pappra/references/hosts.md +20 -0
  355. package/skills/pappra/references/operations.md +36 -5
  356. package/dist/app/collab-from.d.ts +0 -35
  357. package/dist/app/collab-from.js +0 -84
@@ -14,6 +14,7 @@ export declare const collaborationGoalSchema: z.ZodObject<{
14
14
  objective: z.ZodString;
15
15
  acceptance: z.ZodArray<z.ZodString>;
16
16
  prompt: z.ZodString;
17
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
17
18
  coordinator: z.ZodObject<{
18
19
  agent_id: z.ZodString;
19
20
  session_id: z.ZodString;
@@ -113,3 +114,337 @@ export declare const collaborationEventSchema: z.ZodObject<{
113
114
  data: z.ZodNullable<z.ZodUnknown>;
114
115
  }, z.core.$strict>;
115
116
  export type CollaborationEvent = z.infer<typeof collaborationEventSchema>;
117
+ /**
118
+ * Task-scoped resource request. Claims use the existing canonical resource
119
+ * kinds/semantics; release names one explicit claim and holder. Free-form
120
+ * request bodies are never echoed in diagnostics.
121
+ */
122
+ export declare const COLLAB_RESOURCE_REQUEST_SCHEMA = "pappra/collaboration-resource-request/1";
123
+ export declare const collaborationResourceRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
124
+ schema: z.ZodLiteral<"pappra/collaboration-resource-request/1">;
125
+ action: z.ZodLiteral<"claim">;
126
+ holder: z.ZodObject<{
127
+ agent_id: z.ZodString;
128
+ session_id: z.ZodString;
129
+ harness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ }, z.core.$strict>;
131
+ resources: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
132
+ path: z.ZodString;
133
+ scope: z.ZodOptional<z.ZodEnum<{
134
+ file: "file";
135
+ tree: "tree";
136
+ }>>;
137
+ label: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ kind: z.ZodEnum<{
140
+ "build-cache": "build-cache";
141
+ file: "file";
142
+ "git-common-dir": "git-common-dir";
143
+ "git-head": "git-head";
144
+ "git-index": "git-index";
145
+ path: "path";
146
+ }>;
147
+ path: z.ZodString;
148
+ scope: z.ZodOptional<z.ZodEnum<{
149
+ file: "file";
150
+ tree: "tree";
151
+ }>>;
152
+ label: z.ZodOptional<z.ZodString>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ kind: z.ZodLiteral<"port">;
155
+ port: z.ZodNumber;
156
+ label: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ kind: z.ZodEnum<{
159
+ opaque: "opaque";
160
+ process: "process";
161
+ }>;
162
+ value: z.ZodString;
163
+ label: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strict>]>>;
165
+ access: z.ZodEnum<{
166
+ read: "read";
167
+ write: "write";
168
+ }>;
169
+ include_shared_git: z.ZodOptional<z.ZodBoolean>;
170
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ subtask_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ attempt: z.ZodOptional<z.ZodNumber>;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ schema: z.ZodLiteral<"pappra/collaboration-resource-request/1">;
175
+ action: z.ZodLiteral<"release">;
176
+ holder: z.ZodObject<{
177
+ agent_id: z.ZodString;
178
+ session_id: z.ZodString;
179
+ harness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ }, z.core.$strict>;
181
+ claim_id: z.ZodString;
182
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ }, z.core.$strict>], "action">;
184
+ export type CollaborationResourceRequest = z.infer<typeof collaborationResourceRequestSchema>;
185
+ /**
186
+ * Recorded handoff requests. Action fields map directly to the existing
187
+ * handoff primitives; actor/owner_epoch are editable protocol inputs, not
188
+ * authentication. No clock or inline confirmation envelope is accepted.
189
+ */
190
+ export declare const COLLAB_HANDOFF_REQUEST_SCHEMA = "pappra/collaboration-handoff-request/1";
191
+ export declare const collaborationHandoffRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
192
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
193
+ actor: z.ZodString;
194
+ owner_epoch: z.ZodNumber;
195
+ expect_revision: z.ZodOptional<z.ZodNumber>;
196
+ action: z.ZodLiteral<"begin">;
197
+ handoff_id: z.ZodString;
198
+ kind: z.ZodEnum<{
199
+ coordinator: "coordinator";
200
+ writer: "writer";
201
+ }>;
202
+ from: z.ZodObject<{
203
+ agent_id: z.ZodString;
204
+ session_id: z.ZodString;
205
+ harness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ }, z.core.$strict>;
207
+ to: z.ZodObject<{
208
+ agent_id: z.ZodString;
209
+ session_id: z.ZodString;
210
+ harness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
+ }, z.core.$strict>;
212
+ resources: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ subtask_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ attempt: z.ZodOptional<z.ZodNumber>;
215
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
216
+ }, z.core.$strict>, z.ZodObject<{
217
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
218
+ actor: z.ZodString;
219
+ owner_epoch: z.ZodNumber;
220
+ expect_revision: z.ZodOptional<z.ZodNumber>;
221
+ action: z.ZodLiteral<"stopped">;
222
+ handoff_id: z.ZodString;
223
+ observation: z.ZodString;
224
+ evidence_ref: z.ZodString;
225
+ detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
+ }, z.core.$strict>, z.ZodObject<{
227
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
228
+ actor: z.ZodString;
229
+ owner_epoch: z.ZodNumber;
230
+ expect_revision: z.ZodOptional<z.ZodNumber>;
231
+ action: z.ZodLiteral<"rebind">;
232
+ handoff_id: z.ZodString;
233
+ to: z.ZodObject<{
234
+ agent_id: z.ZodString;
235
+ session_id: z.ZodString;
236
+ harness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
+ }, z.core.$strict>;
238
+ evidence_ref: z.ZodString;
239
+ }, z.core.$strict>, z.ZodObject<{
240
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
241
+ actor: z.ZodString;
242
+ owner_epoch: z.ZodNumber;
243
+ expect_revision: z.ZodOptional<z.ZodNumber>;
244
+ action: z.ZodLiteral<"transfer">;
245
+ handoff_id: z.ZodString;
246
+ partial_outputs: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
247
+ inflight: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
248
+ pending_approvals: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
249
+ }, z.core.$strict>, z.ZodObject<{
250
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
251
+ actor: z.ZodString;
252
+ owner_epoch: z.ZodNumber;
253
+ expect_revision: z.ZodOptional<z.ZodNumber>;
254
+ action: z.ZodLiteral<"confirm">;
255
+ handoff_id: z.ZodString;
256
+ confirmation_message_id: z.ZodString;
257
+ }, z.core.$strict>, z.ZodObject<{
258
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
259
+ actor: z.ZodString;
260
+ owner_epoch: z.ZodNumber;
261
+ expect_revision: z.ZodOptional<z.ZodNumber>;
262
+ action: z.ZodLiteral<"complete">;
263
+ handoff_id: z.ZodString;
264
+ }, z.core.$strict>, z.ZodObject<{
265
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
266
+ actor: z.ZodString;
267
+ owner_epoch: z.ZodNumber;
268
+ expect_revision: z.ZodOptional<z.ZodNumber>;
269
+ action: z.ZodLiteral<"abort">;
270
+ handoff_id: z.ZodString;
271
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
+ }, z.core.$strict>, z.ZodObject<{
273
+ schema: z.ZodLiteral<"pappra/collaboration-handoff-request/1">;
274
+ actor: z.ZodString;
275
+ owner_epoch: z.ZodNumber;
276
+ expect_revision: z.ZodOptional<z.ZodNumber>;
277
+ action: z.ZodLiteral<"release-dispatch">;
278
+ }, z.core.$strict>], "action">;
279
+ export type CollaborationHandoffRequest = z.infer<typeof collaborationHandoffRequestSchema>;
280
+ /**
281
+ * Explicit recovery requests: reconcile one uncertainty and optionally apply an
282
+ * existing state transition atomically, or break one task write lock after an
283
+ * operator stop assertion and an exact inspected fingerprint.
284
+ */
285
+ export declare const COLLAB_RECOVERY_REQUEST_SCHEMA = "pappra/collaboration-recovery-request/1";
286
+ export declare const collaborationRecoveryRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
287
+ schema: z.ZodLiteral<"pappra/collaboration-recovery-request/1">;
288
+ actor: z.ZodString;
289
+ owner_epoch: z.ZodNumber;
290
+ action: z.ZodLiteral<"reconcile">;
291
+ uncertainty_id: z.ZodString;
292
+ resolution: z.ZodString;
293
+ resolution_evidence: z.ZodString;
294
+ expect_revision: z.ZodOptional<z.ZodNumber>;
295
+ set_state: z.ZodOptional<z.ZodEnum<{
296
+ accepted: "accepted";
297
+ assigned: "assigned";
298
+ cancelled: "cancelled";
299
+ completed: "completed";
300
+ failed: "failed";
301
+ needs_input: "needs_input";
302
+ running: "running";
303
+ unknown: "unknown";
304
+ }>>;
305
+ }, z.core.$strict>, z.ZodObject<{
306
+ schema: z.ZodLiteral<"pappra/collaboration-recovery-request/1">;
307
+ actor: z.ZodString;
308
+ owner_epoch: z.ZodNumber;
309
+ action: z.ZodLiteral<"lock-break">;
310
+ reason: z.ZodString;
311
+ confirm_holder_stopped: z.ZodLiteral<true>;
312
+ expected_lock_fingerprint: z.ZodString;
313
+ }, z.core.$strict>], "action">;
314
+ export type CollaborationRecoveryRequest = z.infer<typeof collaborationRecoveryRequestSchema>;
315
+ /**
316
+ * Task-local routing metadata for explicit notification. A binding maps exact
317
+ * protocol participants to named Herdr agents; it grants no authority and is not
318
+ * proof that a native session exists.
319
+ */
320
+ export declare const COLLAB_BINDING_SCHEMA = "pappra/collab-binding/1";
321
+ export declare const COLLAB_DELIVERY_SCHEMA = "pappra/collab-delivery/1";
322
+ export declare const collabBindingParticipantSchema: z.ZodObject<{
323
+ agent_id: z.ZodString;
324
+ harness: z.ZodString;
325
+ cwd: z.ZodString;
326
+ herdr_agent: z.ZodString;
327
+ pane_id: z.ZodString;
328
+ native_session_id: z.ZodNullable<z.ZodString>;
329
+ }, z.core.$strict>;
330
+ export type CollabBindingParticipant = z.infer<typeof collabBindingParticipantSchema>;
331
+ export declare const collabBindingSchema: z.ZodObject<{
332
+ schema: z.ZodLiteral<"pappra/collab-binding/1">;
333
+ task_id: z.ZodString;
334
+ task_root: z.ZodString;
335
+ channel: z.ZodLiteral<"herdr">;
336
+ participants: z.ZodArray<z.ZodObject<{
337
+ agent_id: z.ZodString;
338
+ harness: z.ZodString;
339
+ cwd: z.ZodString;
340
+ herdr_agent: z.ZodString;
341
+ pane_id: z.ZodString;
342
+ native_session_id: z.ZodNullable<z.ZodString>;
343
+ }, z.core.$strict>>;
344
+ }, z.core.$strict>;
345
+ export type CollabBinding = z.infer<typeof collabBindingSchema>;
346
+ export declare const collabDeliveryStatusSchema: z.ZodEnum<{
347
+ blocked: "blocked";
348
+ failed: "failed";
349
+ refused: "refused";
350
+ submitted: "submitted";
351
+ submitting: "submitting";
352
+ unknown: "unknown";
353
+ }>;
354
+ export type CollabDeliveryStatus = z.infer<typeof collabDeliveryStatusSchema>;
355
+ export declare const collabDeliveryAttemptSchema: z.ZodObject<{
356
+ at: z.ZodString;
357
+ status: z.ZodEnum<{
358
+ blocked: "blocked";
359
+ failed: "failed";
360
+ refused: "refused";
361
+ submitted: "submitted";
362
+ submitting: "submitting";
363
+ unknown: "unknown";
364
+ }>;
365
+ detail: z.ZodNullable<z.ZodString>;
366
+ reservation_id: z.ZodOptional<z.ZodString>;
367
+ }, z.core.$strict>;
368
+ export type CollabDeliveryAttempt = z.infer<typeof collabDeliveryAttemptSchema>;
369
+ /**
370
+ * Optional caller-routing evidence. Selecting a pane (current or explicit) is
371
+ * routing, not sender authentication: process affiliation is not established.
372
+ */
373
+ export declare const collabDeliveryCallerSchema: z.ZodObject<{
374
+ source: z.ZodEnum<{
375
+ current: "current";
376
+ explicit: "explicit";
377
+ }>;
378
+ pane_id: z.ZodString;
379
+ harness: z.ZodNullable<z.ZodString>;
380
+ cwd: z.ZodNullable<z.ZodString>;
381
+ observed_at: z.ZodString;
382
+ native_session: z.ZodEnum<{
383
+ match: "match";
384
+ unknown: "unknown";
385
+ }>;
386
+ native_session_kind: z.ZodNullable<z.ZodString>;
387
+ process_affiliation: z.ZodLiteral<"not-established">;
388
+ }, z.core.$strict>;
389
+ export type CollabDeliveryCaller = z.infer<typeof collabDeliveryCallerSchema>;
390
+ export declare const collabDeliverySchema: z.ZodObject<{
391
+ schema: z.ZodLiteral<"pappra/collab-delivery/1">;
392
+ message_id: z.ZodString;
393
+ message_path: z.ZodString;
394
+ message_digest: z.ZodString;
395
+ task_id: z.ZodString;
396
+ task_root: z.ZodString;
397
+ recipient: z.ZodObject<{
398
+ agent_id: z.ZodString;
399
+ harness: z.ZodString;
400
+ }, z.core.$strict>;
401
+ target: z.ZodObject<{
402
+ herdr_agent: z.ZodString;
403
+ pane_id: z.ZodString;
404
+ native_session: z.ZodEnum<{
405
+ match: "match";
406
+ unknown: "unknown";
407
+ }>;
408
+ native_session_kind: z.ZodOptional<z.ZodNullable<z.ZodString>>;
409
+ }, z.core.$strict>;
410
+ caller: z.ZodOptional<z.ZodObject<{
411
+ source: z.ZodEnum<{
412
+ current: "current";
413
+ explicit: "explicit";
414
+ }>;
415
+ pane_id: z.ZodString;
416
+ harness: z.ZodNullable<z.ZodString>;
417
+ cwd: z.ZodNullable<z.ZodString>;
418
+ observed_at: z.ZodString;
419
+ native_session: z.ZodEnum<{
420
+ match: "match";
421
+ unknown: "unknown";
422
+ }>;
423
+ native_session_kind: z.ZodNullable<z.ZodString>;
424
+ process_affiliation: z.ZodLiteral<"not-established">;
425
+ }, z.core.$strict>>;
426
+ status: z.ZodEnum<{
427
+ blocked: "blocked";
428
+ failed: "failed";
429
+ refused: "refused";
430
+ submitted: "submitted";
431
+ submitting: "submitting";
432
+ unknown: "unknown";
433
+ }>;
434
+ attempts: z.ZodArray<z.ZodObject<{
435
+ at: z.ZodString;
436
+ status: z.ZodEnum<{
437
+ blocked: "blocked";
438
+ failed: "failed";
439
+ refused: "refused";
440
+ submitted: "submitted";
441
+ submitting: "submitting";
442
+ unknown: "unknown";
443
+ }>;
444
+ detail: z.ZodNullable<z.ZodString>;
445
+ reservation_id: z.ZodOptional<z.ZodString>;
446
+ }, z.core.$strict>>;
447
+ created_at: z.ZodString;
448
+ updated_at: z.ZodString;
449
+ }, z.core.$strict>;
450
+ export type CollabDelivery = z.infer<typeof collabDeliverySchema>;
@@ -29,6 +29,13 @@ const resource = z.strictObject({
29
29
  path: absolutePath,
30
30
  access: z.enum(['read', 'write']),
31
31
  });
32
+ const roles = z
33
+ .array(z.string().min(1).max(64))
34
+ .min(1)
35
+ .max(8)
36
+ .refine((entries) => new Set(entries).size === entries.length, {
37
+ message: 'roles must be unique',
38
+ });
32
39
  export const collaborationGoalSchema = z.strictObject({
33
40
  schema: z.literal('pappra/collaboration-goal/1'),
34
41
  task_id: taskId,
@@ -38,6 +45,7 @@ export const collaborationGoalSchema = z.strictObject({
38
45
  objective: z.string().min(1).max(4000),
39
46
  acceptance: z.array(z.string().min(1).max(1000)).min(1).max(32),
40
47
  prompt: z.string().min(1).max(20000),
48
+ roles: roles.default(['implementer']),
41
49
  coordinator: identity.extend({ owner_epoch: z.number().int().min(1) }),
42
50
  assignee: identity.extend({
43
51
  cwd: absolutePath,
@@ -104,3 +112,267 @@ export const collaborationEventSchema = z.strictObject({
104
112
  detail: z.string().max(4096).nullable(),
105
113
  data: z.unknown().nullable(),
106
114
  });
115
+ /**
116
+ * Task-scoped resource request. Claims use the existing canonical resource
117
+ * kinds/semantics; release names one explicit claim and holder. Free-form
118
+ * request bodies are never echoed in diagnostics.
119
+ */
120
+ export const COLLAB_RESOURCE_REQUEST_SCHEMA = 'pappra/collaboration-resource-request/1';
121
+ const resourceHolder = z.strictObject({
122
+ agent_id: z.string().min(1).max(128),
123
+ session_id: z.string().min(1).max(256),
124
+ harness: z.string().min(1).max(64).nullable().optional(),
125
+ });
126
+ const pathResourceKind = z.enum([
127
+ 'path',
128
+ 'git-index',
129
+ 'git-head',
130
+ 'git-common-dir',
131
+ 'build-cache',
132
+ 'file',
133
+ ]);
134
+ const pathResource = z.strictObject({
135
+ kind: pathResourceKind,
136
+ path: absolutePath,
137
+ scope: z.enum(['file', 'tree']).optional(),
138
+ label: z.string().min(1).max(512).optional(),
139
+ });
140
+ const defaultPathResource = z.strictObject({
141
+ path: absolutePath,
142
+ scope: z.enum(['file', 'tree']).optional(),
143
+ label: z.string().min(1).max(512).optional(),
144
+ });
145
+ const portResource = z.strictObject({
146
+ kind: z.literal('port'),
147
+ port: z.number().int().min(1).max(65535),
148
+ label: z.string().min(1).max(512).optional(),
149
+ });
150
+ const opaqueResource = z.strictObject({
151
+ kind: z.enum(['opaque', 'process']),
152
+ value: z.string().min(1).max(4096),
153
+ label: z.string().min(1).max(512).optional(),
154
+ });
155
+ const requestResource = z.union([
156
+ defaultPathResource,
157
+ pathResource,
158
+ portResource,
159
+ opaqueResource,
160
+ ]);
161
+ export const collaborationResourceRequestSchema = z.discriminatedUnion('action', [
162
+ z.strictObject({
163
+ schema: z.literal(COLLAB_RESOURCE_REQUEST_SCHEMA),
164
+ action: z.literal('claim'),
165
+ holder: resourceHolder,
166
+ resources: z.array(requestResource).min(1).max(256),
167
+ access: z.enum(['read', 'write']),
168
+ include_shared_git: z.boolean().optional(),
169
+ note: z.string().max(4096).nullable().optional(),
170
+ subtask_id: z.string().min(1).max(128).nullable().optional(),
171
+ attempt: z.number().int().min(1).optional(),
172
+ }),
173
+ z.strictObject({
174
+ schema: z.literal(COLLAB_RESOURCE_REQUEST_SCHEMA),
175
+ action: z.literal('release'),
176
+ holder: resourceHolder,
177
+ claim_id: z.string().min(1).max(512),
178
+ reason: z.string().max(4096).nullable().optional(),
179
+ }),
180
+ ]);
181
+ /**
182
+ * Recorded handoff requests. Action fields map directly to the existing
183
+ * handoff primitives; actor/owner_epoch are editable protocol inputs, not
184
+ * authentication. No clock or inline confirmation envelope is accepted.
185
+ */
186
+ export const COLLAB_HANDOFF_REQUEST_SCHEMA = 'pappra/collaboration-handoff-request/1';
187
+ const handoffIdentity = z.strictObject({
188
+ agent_id: z.string().min(1).max(128),
189
+ session_id: z.string().min(1).max(256),
190
+ harness: z.string().min(1).max(64).nullable().optional(),
191
+ });
192
+ const handoffBase = {
193
+ schema: z.literal(COLLAB_HANDOFF_REQUEST_SCHEMA),
194
+ actor: z.string().min(1).max(128),
195
+ owner_epoch: z.number().int().min(1),
196
+ expect_revision: z.number().int().min(0).optional(),
197
+ };
198
+ const handoffId = z.string().min(1).max(256);
199
+ const evidenceRef = z.string().min(1).max(4096);
200
+ const handoffReason = z.string().max(4096).nullable().optional();
201
+ const handoffInventoryList = z.array(z.unknown()).max(128).optional();
202
+ export const collaborationHandoffRequestSchema = z.discriminatedUnion('action', [
203
+ z.strictObject({
204
+ ...handoffBase,
205
+ action: z.literal('begin'),
206
+ handoff_id: handoffId,
207
+ kind: z.enum(['writer', 'coordinator']),
208
+ from: handoffIdentity,
209
+ to: handoffIdentity,
210
+ resources: z.array(z.string().min(1).max(256)).max(64).optional(),
211
+ subtask_id: z.string().min(1).max(128).nullable().optional(),
212
+ attempt: z.number().int().min(1).optional(),
213
+ reason: handoffReason,
214
+ }),
215
+ z.strictObject({
216
+ ...handoffBase,
217
+ action: z.literal('stopped'),
218
+ handoff_id: handoffId,
219
+ observation: z.string().min(1).max(128),
220
+ evidence_ref: evidenceRef,
221
+ detail: z.string().max(4096).nullable().optional(),
222
+ }),
223
+ z.strictObject({
224
+ ...handoffBase,
225
+ action: z.literal('rebind'),
226
+ handoff_id: handoffId,
227
+ to: handoffIdentity,
228
+ evidence_ref: evidenceRef,
229
+ }),
230
+ z.strictObject({
231
+ ...handoffBase,
232
+ action: z.literal('transfer'),
233
+ handoff_id: handoffId,
234
+ partial_outputs: handoffInventoryList,
235
+ inflight: handoffInventoryList,
236
+ pending_approvals: handoffInventoryList,
237
+ }),
238
+ z.strictObject({
239
+ ...handoffBase,
240
+ action: z.literal('confirm'),
241
+ handoff_id: handoffId,
242
+ confirmation_message_id: z.string().min(1).max(256),
243
+ }),
244
+ z.strictObject({
245
+ ...handoffBase,
246
+ action: z.literal('complete'),
247
+ handoff_id: handoffId,
248
+ }),
249
+ z.strictObject({
250
+ ...handoffBase,
251
+ action: z.literal('abort'),
252
+ handoff_id: handoffId,
253
+ reason: handoffReason,
254
+ }),
255
+ z.strictObject({
256
+ ...handoffBase,
257
+ action: z.literal('release-dispatch'),
258
+ }),
259
+ ]);
260
+ /**
261
+ * Explicit recovery requests: reconcile one uncertainty and optionally apply an
262
+ * existing state transition atomically, or break one task write lock after an
263
+ * operator stop assertion and an exact inspected fingerprint.
264
+ */
265
+ export const COLLAB_RECOVERY_REQUEST_SCHEMA = 'pappra/collaboration-recovery-request/1';
266
+ const recoveryBase = {
267
+ schema: z.literal(COLLAB_RECOVERY_REQUEST_SCHEMA),
268
+ actor: z.string().min(1).max(128),
269
+ owner_epoch: z.number().int().min(1),
270
+ };
271
+ const attemptState = z.enum([
272
+ 'assigned',
273
+ 'accepted',
274
+ 'running',
275
+ 'completed',
276
+ 'needs_input',
277
+ 'failed',
278
+ 'cancelled',
279
+ 'unknown',
280
+ ]);
281
+ export const collaborationRecoveryRequestSchema = z.discriminatedUnion('action', [
282
+ z.strictObject({
283
+ ...recoveryBase,
284
+ action: z.literal('reconcile'),
285
+ uncertainty_id: z.string().min(1).max(128),
286
+ resolution: z.string().min(1).max(4096),
287
+ resolution_evidence: z.string().min(1).max(4096),
288
+ expect_revision: z.number().int().min(0).optional(),
289
+ set_state: attemptState.optional(),
290
+ }),
291
+ z.strictObject({
292
+ ...recoveryBase,
293
+ action: z.literal('lock-break'),
294
+ reason: z.string().min(1).max(4096),
295
+ confirm_holder_stopped: z.literal(true),
296
+ expected_lock_fingerprint: z.string().min(1).max(128),
297
+ }),
298
+ ]);
299
+ /**
300
+ * Task-local routing metadata for explicit notification. A binding maps exact
301
+ * protocol participants to named Herdr agents; it grants no authority and is not
302
+ * proof that a native session exists.
303
+ */
304
+ export const COLLAB_BINDING_SCHEMA = 'pappra/collab-binding/1';
305
+ export const COLLAB_DELIVERY_SCHEMA = 'pappra/collab-delivery/1';
306
+ const herdrPaneId = z
307
+ .string()
308
+ .regex(/^[A-Za-z0-9]+:p[A-Za-z0-9]+$/, 'Use a Herdr pane id such as w3:p3.');
309
+ const participantId = z.string().min(1).max(128);
310
+ export const collabBindingParticipantSchema = z.strictObject({
311
+ agent_id: participantId,
312
+ harness: z.string().min(1).max(64),
313
+ cwd: absolutePath,
314
+ herdr_agent: z.string().min(1).max(128),
315
+ pane_id: herdrPaneId,
316
+ native_session_id: z.string().min(1).max(256).nullable(),
317
+ });
318
+ export const collabBindingSchema = z.strictObject({
319
+ schema: z.literal(COLLAB_BINDING_SCHEMA),
320
+ task_id: participantId,
321
+ task_root: absolutePath,
322
+ channel: z.literal('herdr'),
323
+ participants: z.array(collabBindingParticipantSchema).min(1).max(16),
324
+ });
325
+ export const collabDeliveryStatusSchema = z.enum([
326
+ 'submitting',
327
+ 'submitted',
328
+ 'blocked',
329
+ 'refused',
330
+ 'unknown',
331
+ 'failed',
332
+ ]);
333
+ export const collabDeliveryAttemptSchema = z.strictObject({
334
+ at: z.string().min(1),
335
+ status: collabDeliveryStatusSchema,
336
+ detail: z.string().max(4096).nullable(),
337
+ /** Present for attempts reserved after the C0 repair; older evidence omits it. */
338
+ reservation_id: z.string().min(1).max(64).optional(),
339
+ });
340
+ /**
341
+ * Optional caller-routing evidence. Selecting a pane (current or explicit) is
342
+ * routing, not sender authentication: process affiliation is not established.
343
+ */
344
+ export const collabDeliveryCallerSchema = z.strictObject({
345
+ source: z.enum(['current', 'explicit']),
346
+ pane_id: herdrPaneId,
347
+ harness: z.string().min(1).max(64).nullable(),
348
+ cwd: z.string().min(1).max(4096).nullable(),
349
+ observed_at: z.string().min(1),
350
+ native_session: z.enum(['match', 'unknown']),
351
+ native_session_kind: z.string().min(1).max(64).nullable(),
352
+ process_affiliation: z.literal('not-established'),
353
+ });
354
+ export const collabDeliverySchema = z.strictObject({
355
+ schema: z.literal(COLLAB_DELIVERY_SCHEMA),
356
+ message_id: participantId,
357
+ message_path: z.string().min(1).max(4096),
358
+ message_digest: z.string().regex(/^sha256:[0-9a-f]{64}$/),
359
+ task_id: participantId,
360
+ task_root: absolutePath,
361
+ recipient: z.strictObject({
362
+ agent_id: participantId,
363
+ harness: z.string().min(1).max(64),
364
+ }),
365
+ target: z.strictObject({
366
+ herdr_agent: z.string().min(1).max(128),
367
+ pane_id: herdrPaneId,
368
+ native_session: z.enum(['match', 'unknown']),
369
+ /** Reported Herdr session kind (`path`, `id`, ...); older evidence omits it. */
370
+ native_session_kind: z.string().min(1).max(64).nullable().optional(),
371
+ }),
372
+ /** Present for caller-routing evidence recorded after C1; older records omit it. */
373
+ caller: collabDeliveryCallerSchema.optional(),
374
+ status: collabDeliveryStatusSchema,
375
+ attempts: z.array(collabDeliveryAttemptSchema).max(8),
376
+ created_at: z.string().min(1),
377
+ updated_at: z.string().min(1),
378
+ });
@@ -3,6 +3,14 @@ export declare const TASK_CONTEXT_SCHEMA = "pappra/task-context/1";
3
3
  export declare const CHECKPOINT_SCHEMA = "pappra/checkpoint/1";
4
4
  export declare const CHECKPOINT_POINTER_SCHEMA = "pappra/checkpoint-pointer/1";
5
5
  export declare const RESUME_PACKET_SCHEMA = "pappra/resume-packet/1";
6
+ /**
7
+ * One task identifier rule for pin records, continuity paths and schemas:
8
+ * up to 64 characters from letters, digits, dot, dash and underscore, starting
9
+ * with a letter or digit. Invalid identifiers are rejected before any write.
10
+ */
11
+ export declare const TASK_ID_MAX_LENGTH = 64;
12
+ export declare const taskIdSchema: z.ZodString;
13
+ export declare function isValidTaskId(value: string): boolean;
6
14
  export declare const continuityArtifactPathSchema: z.ZodString;
7
15
  export declare const taskContextSchema: z.ZodObject<{
8
16
  schema: z.ZodLiteral<"pappra/task-context/1">;
@@ -4,11 +4,21 @@ export const CHECKPOINT_SCHEMA = 'pappra/checkpoint/1';
4
4
  export const CHECKPOINT_POINTER_SCHEMA = 'pappra/checkpoint-pointer/1';
5
5
  export const RESUME_PACKET_SCHEMA = 'pappra/resume-packet/1';
6
6
  const digestSchema = z.string().regex(/^sha256:[0-9a-f]{64}$/);
7
- const taskIdSchema = z
7
+ /**
8
+ * One task identifier rule for pin records, continuity paths and schemas:
9
+ * up to 64 characters from letters, digits, dot, dash and underscore, starting
10
+ * with a letter or digit. Invalid identifiers are rejected before any write.
11
+ */
12
+ export const TASK_ID_MAX_LENGTH = 64;
13
+ const TASK_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
14
+ export const taskIdSchema = z
8
15
  .string()
9
16
  .min(1)
10
- .max(64)
11
- .regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/);
17
+ .max(TASK_ID_MAX_LENGTH)
18
+ .regex(TASK_ID_PATTERN, 'Use a letter or digit followed by letters, digits, dot, underscore or dash.');
19
+ export function isValidTaskId(value) {
20
+ return value.length <= TASK_ID_MAX_LENGTH && TASK_ID_PATTERN.test(value);
21
+ }
12
22
  const digestOrNull = digestSchema.nullable();
13
23
  const optionalString = z.string().max(4096).nullable();
14
24
  export const continuityArtifactPathSchema = z
@@ -86,6 +86,7 @@ export declare const doctorReportSchema: z.ZodObject<{
86
86
  passiveStatus: z.ZodNullable<z.ZodEnum<{
87
87
  "content-match": "content-match";
88
88
  corrupt: "corrupt";
89
+ incompatible: "incompatible";
89
90
  locked: "locked";
90
91
  missing: "missing";
91
92
  partial: "partial";
@@ -51,6 +51,7 @@ export const doctorReportSchema = z.strictObject({
51
51
  'locked',
52
52
  'partial',
53
53
  'unreadable',
54
+ 'incompatible',
54
55
  ])
55
56
  .nullable(),
56
57
  }),