@spencerboucher/switchyard 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +7 -7
  2. package/dist/bridge/enroll.js +12 -3
  3. package/dist/catalog/worker.js +5913 -0
  4. package/dist/policies/worker.js +1024 -913
  5. package/dist/switchyard.mjs +11098 -7609
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-I80YGJ3M.js +2 -0
  8. package/web-dist/assets/AutomationView-I80YGJ3M.js.map +1 -0
  9. package/web-dist/assets/Checkbox-BdFQsqCG.js +2 -0
  10. package/web-dist/assets/{Checkbox-Bh46F55q.js.map → Checkbox-BdFQsqCG.js.map} +1 -1
  11. package/web-dist/assets/DangerZone-C6qU1pp7.js +2 -0
  12. package/web-dist/assets/{DangerZone-K_oXMpbq.js.map → DangerZone-C6qU1pp7.js.map} +1 -1
  13. package/web-dist/assets/Field-DGV7eljt.js +2 -0
  14. package/web-dist/assets/Field-DGV7eljt.js.map +1 -0
  15. package/web-dist/assets/NavigationEditor-COtm2NQY.js +2 -0
  16. package/web-dist/assets/{NavigationEditor-BfNZ411c.js.map → NavigationEditor-COtm2NQY.js.map} +1 -1
  17. package/web-dist/assets/Overlay-hRkfpjK4.js +2 -0
  18. package/web-dist/assets/{Overlay-wZFuaSA5.js.map → Overlay-hRkfpjK4.js.map} +1 -1
  19. package/web-dist/assets/{Priority-Ce4btFLm.js → Priority-DL3f-tRD.js} +2 -2
  20. package/web-dist/assets/{Priority-Ce4btFLm.js.map → Priority-DL3f-tRD.js.map} +1 -1
  21. package/web-dist/assets/RadioCards-9YvqB3va.js +2 -0
  22. package/web-dist/assets/{RadioCards-DR-fWNLB.js.map → RadioCards-9YvqB3va.js.map} +1 -1
  23. package/web-dist/assets/ScopeRepository-BPiPUjHi.js +6 -0
  24. package/web-dist/assets/ScopeRepository-BPiPUjHi.js.map +1 -0
  25. package/web-dist/assets/ScopeSelect-DmWCXeIf.js +2 -0
  26. package/web-dist/assets/ScopeSelect-DmWCXeIf.js.map +1 -0
  27. package/web-dist/assets/SegmentedControl-CefWecy1.js +2 -0
  28. package/web-dist/assets/SegmentedControl-CefWecy1.js.map +1 -0
  29. package/web-dist/assets/Select-CdANXO3X.js +2 -0
  30. package/web-dist/assets/{Select-CvbSg3M1.js.map → Select-CdANXO3X.js.map} +1 -1
  31. package/web-dist/assets/StructuredValue-BjKzgQDM.js +5 -0
  32. package/web-dist/assets/StructuredValue-BjKzgQDM.js.map +1 -0
  33. package/web-dist/assets/Switch-DrrWalaQ.js +2 -0
  34. package/web-dist/assets/{Switch-B89oAK_3.js.map → Switch-DrrWalaQ.js.map} +1 -1
  35. package/web-dist/assets/Tabs-Cvyw8P4s.js +184 -0
  36. package/web-dist/assets/Tabs-Cvyw8P4s.js.map +1 -0
  37. package/web-dist/assets/{TextLink-irMcg7Xz.js → TextLink-DMi_ZI43.js} +2 -2
  38. package/web-dist/assets/{TextLink-irMcg7Xz.js.map → TextLink-DMi_ZI43.js.map} +1 -1
  39. package/web-dist/assets/{UINodeRenderer-_99GFFDS.js → UINodeRenderer-CDPAUIOO.js} +3 -3
  40. package/web-dist/assets/{UINodeRenderer-_99GFFDS.js.map → UINodeRenderer-CDPAUIOO.js.map} +1 -1
  41. package/web-dist/assets/UnfilteredNote-CgsOTad1.js +2 -0
  42. package/web-dist/assets/{UnfilteredNote-iQIfVXkA.js.map → UnfilteredNote-CgsOTad1.js.map} +1 -1
  43. package/web-dist/assets/api-Dlk6L3Cu.js +2 -0
  44. package/web-dist/assets/api-Dlk6L3Cu.js.map +1 -0
  45. package/web-dist/assets/{arrow-down-BKhm3D2d.js → arrow-down-Cc6k_L7W.js} +2 -2
  46. package/web-dist/assets/{arrow-down-BKhm3D2d.js.map → arrow-down-Cc6k_L7W.js.map} +1 -1
  47. package/web-dist/assets/{arrow-up-poMxdOwI.js → arrow-up-CW1a5Bhp.js} +2 -2
  48. package/web-dist/assets/{arrow-up-poMxdOwI.js.map → arrow-up-CW1a5Bhp.js.map} +1 -1
  49. package/web-dist/assets/attention-AZ2a-mzO.js +2 -0
  50. package/web-dist/assets/attention-AZ2a-mzO.js.map +1 -0
  51. package/web-dist/assets/auth-Dzip9fVv.js +2 -0
  52. package/web-dist/assets/auth-Dzip9fVv.js.map +1 -0
  53. package/web-dist/assets/automations-BYFgPSs2.js +2 -0
  54. package/web-dist/assets/{automations-DWz_Lxch.js.map → automations-BYFgPSs2.js.map} +1 -1
  55. package/web-dist/assets/board-D2LALQcR.js +6 -0
  56. package/web-dist/assets/board-D2LALQcR.js.map +1 -0
  57. package/web-dist/assets/{calendar-clock-U5kMaB5u.js → calendar-clock-CkYP2-Qf.js} +2 -2
  58. package/web-dist/assets/{calendar-clock-U5kMaB5u.js.map → calendar-clock-CkYP2-Qf.js.map} +1 -1
  59. package/web-dist/assets/chevron-right-Q-RTE0ar.js +2 -0
  60. package/web-dist/assets/{chevron-right-B-aa_CvO.js.map → chevron-right-Q-RTE0ar.js.map} +1 -1
  61. package/web-dist/assets/code-BuAtgr-5.js +24 -0
  62. package/web-dist/assets/code-BuAtgr-5.js.map +1 -0
  63. package/web-dist/assets/{core.esm-CHa4oRMo.js → core.esm-yL4bmFrt.js} +2 -2
  64. package/web-dist/assets/{core.esm-CHa4oRMo.js.map → core.esm-yL4bmFrt.js.map} +1 -1
  65. package/web-dist/assets/{describe-C5NtR2LE.js → describe-B1R7Rpb3.js} +3 -3
  66. package/web-dist/assets/{describe-C5NtR2LE.js.map → describe-B1R7Rpb3.js.map} +1 -1
  67. package/web-dist/assets/enroll-BJIkw0lm.js +2 -0
  68. package/web-dist/assets/{enroll-DlZYKudD.js.map → enroll-BJIkw0lm.js.map} +1 -1
  69. package/web-dist/assets/external-link-BHZxy4tb.js +2 -0
  70. package/web-dist/assets/external-link-BHZxy4tb.js.map +1 -0
  71. package/web-dist/assets/{git-branch-CltFrgh4.js → git-branch-C5Xwi6aW.js} +2 -2
  72. package/web-dist/assets/{git-branch-CltFrgh4.js.map → git-branch-C5Xwi6aW.js.map} +1 -1
  73. package/web-dist/assets/{grip-vertical-QSdwyQ9C.js → grip-vertical-kzr2x5pf.js} +2 -2
  74. package/web-dist/assets/{grip-vertical-QSdwyQ9C.js.map → grip-vertical-kzr2x5pf.js.map} +1 -1
  75. package/web-dist/assets/{hand-5eeZJSl_.js → hand-DStB4fR7.js} +2 -2
  76. package/web-dist/assets/{hand-5eeZJSl_.js.map → hand-DStB4fR7.js.map} +1 -1
  77. package/web-dist/assets/index-Bm6tklht.css +2 -0
  78. package/web-dist/assets/index-D3WBnjbc.js +17 -0
  79. package/web-dist/assets/index-D3WBnjbc.js.map +1 -0
  80. package/web-dist/assets/{link-2-DXaJEVgz.js → link-2-Cny9mRKW.js} +2 -2
  81. package/web-dist/assets/{link-2-DXaJEVgz.js.map → link-2-Cny9mRKW.js.map} +1 -1
  82. package/web-dist/assets/logic-BOdOYgZ4.js +4 -0
  83. package/web-dist/assets/{logic-4hQwsm8w.js.map → logic-BOdOYgZ4.js.map} +1 -1
  84. package/web-dist/assets/logic-CHh1lc3G.js +2 -0
  85. package/web-dist/assets/{logic-c8AsGwGr.js.map → logic-CHh1lc3G.js.map} +1 -1
  86. package/web-dist/assets/more-BrHzsSfh.js +2 -0
  87. package/web-dist/assets/{more-RENHRep9.js.map → more-BrHzsSfh.js.map} +1 -1
  88. package/web-dist/assets/{pencil-DvO-Zlyh.js → pencil-BmHgPcCk.js} +2 -2
  89. package/web-dist/assets/{pencil-DvO-Zlyh.js.map → pencil-BmHgPcCk.js.map} +1 -1
  90. package/web-dist/assets/{play-CPNEXvVs.js → play-Dul6ZDzY.js} +2 -2
  91. package/web-dist/assets/{play-CPNEXvVs.js.map → play-Dul6ZDzY.js.map} +1 -1
  92. package/web-dist/assets/{plus-DC4JQpXX.js → plus-DzBRN9tc.js} +2 -2
  93. package/web-dist/assets/{plus-DC4JQpXX.js.map → plus-DzBRN9tc.js.map} +1 -1
  94. package/web-dist/assets/{policyLogic-CXFbVtEs.js → policyLogic-DVorBdH6.js} +2 -2
  95. package/web-dist/assets/{policyLogic-CXFbVtEs.js.map → policyLogic-DVorBdH6.js.map} +1 -1
  96. package/web-dist/assets/{prefs-BTwRvULi.js → prefs-CUMuH2EM.js} +2 -2
  97. package/web-dist/assets/{prefs-BTwRvULi.js.map → prefs-CUMuH2EM.js.map} +1 -1
  98. package/web-dist/assets/preload-helper-vwPq19u5.js +9 -0
  99. package/web-dist/assets/preload-helper-vwPq19u5.js.map +1 -0
  100. package/web-dist/assets/queue-hRZWM_pM.js +2 -0
  101. package/web-dist/assets/{queue-C25GCl3M.js.map → queue-hRZWM_pM.js.map} +1 -1
  102. package/web-dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  103. package/web-dist/assets/{rotate-ccw-DuLdXOxM.js → rotate-ccw-ByDiAA6o.js} +2 -2
  104. package/web-dist/assets/{rotate-ccw-DuLdXOxM.js.map → rotate-ccw-ByDiAA6o.js.map} +1 -1
  105. package/web-dist/assets/{search-tZdcGLqS.js → search-DarT116I.js} +2 -2
  106. package/web-dist/assets/{search-tZdcGLqS.js.map → search-DarT116I.js.map} +1 -1
  107. package/web-dist/assets/settings-DHfdrqxv.js +6 -0
  108. package/web-dist/assets/settings-DHfdrqxv.js.map +1 -0
  109. package/web-dist/assets/states-hcvSpyb1.js +60 -0
  110. package/web-dist/assets/states-hcvSpyb1.js.map +1 -0
  111. package/web-dist/assets/{terminal-CEttp_7_.js → terminal-BmpsRI95.js} +2 -2
  112. package/web-dist/assets/{terminal-CEttp_7_.js.map → terminal-BmpsRI95.js.map} +1 -1
  113. package/web-dist/assets/terminal-login-COaZPzQx.js +2 -0
  114. package/web-dist/assets/{terminal-login-BceUiMHs.js.map → terminal-login-COaZPzQx.js.map} +1 -1
  115. package/web-dist/assets/useBreakpoint-CXotoLeq.js +2 -0
  116. package/web-dist/assets/{useBreakpoint-CdYPa6z0.js.map → useBreakpoint-CXotoLeq.js.map} +1 -1
  117. package/web-dist/assets/useNow-BweXkeWc.js +2 -0
  118. package/web-dist/assets/{useNow-CyygPGnv.js.map → useNow-BweXkeWc.js.map} +1 -1
  119. package/web-dist/assets/useResource-DAMkbbuf.js +2 -0
  120. package/web-dist/assets/useResource-DAMkbbuf.js.map +1 -0
  121. package/web-dist/assets/useSwipeTabs-3qLCxSS7.js +2 -0
  122. package/web-dist/assets/{useSwipeTabs-CJFQTmAs.js.map → useSwipeTabs-3qLCxSS7.js.map} +1 -1
  123. package/web-dist/assets/workboard-BEcRsjyQ.js +3 -0
  124. package/web-dist/assets/workboard-BEcRsjyQ.js.map +1 -0
  125. package/web-dist/index.html +9 -7
  126. package/web-dist/sw.js +1 -1
  127. package/web-dist/sw.js.map +1 -1
  128. package/web-dist/assets/AutomationView-BFZ5tGrI.js +0 -2
  129. package/web-dist/assets/AutomationView-BFZ5tGrI.js.map +0 -1
  130. package/web-dist/assets/Checkbox-Bh46F55q.js +0 -2
  131. package/web-dist/assets/DangerZone-K_oXMpbq.js +0 -2
  132. package/web-dist/assets/Field-DRcZixOF.js +0 -2
  133. package/web-dist/assets/Field-DRcZixOF.js.map +0 -1
  134. package/web-dist/assets/Markdown-BaCvc-cI.js +0 -184
  135. package/web-dist/assets/Markdown-BaCvc-cI.js.map +0 -1
  136. package/web-dist/assets/NavigationEditor-BfNZ411c.js +0 -2
  137. package/web-dist/assets/Overlay-wZFuaSA5.js +0 -2
  138. package/web-dist/assets/RadioCards-DR-fWNLB.js +0 -2
  139. package/web-dist/assets/ScopeSelect-B1RxBDV7.js +0 -2
  140. package/web-dist/assets/ScopeSelect-B1RxBDV7.js.map +0 -1
  141. package/web-dist/assets/SegmentedControl-M7WpGnaN.js +0 -2
  142. package/web-dist/assets/SegmentedControl-M7WpGnaN.js.map +0 -1
  143. package/web-dist/assets/Select-CvbSg3M1.js +0 -2
  144. package/web-dist/assets/StructuredValue-By3sh_00.js +0 -5
  145. package/web-dist/assets/StructuredValue-By3sh_00.js.map +0 -1
  146. package/web-dist/assets/Switch-B89oAK_3.js +0 -2
  147. package/web-dist/assets/Tabs-CzGFkSHO.js +0 -2
  148. package/web-dist/assets/Tabs-CzGFkSHO.js.map +0 -1
  149. package/web-dist/assets/UnfilteredNote-iQIfVXkA.js +0 -2
  150. package/web-dist/assets/api-CzS9UH7Q.js +0 -2
  151. package/web-dist/assets/api-CzS9UH7Q.js.map +0 -1
  152. package/web-dist/assets/attention-UZIRcx_k.js +0 -2
  153. package/web-dist/assets/attention-UZIRcx_k.js.map +0 -1
  154. package/web-dist/assets/automations-DWz_Lxch.js +0 -2
  155. package/web-dist/assets/board-BqGDwbGB.js +0 -6
  156. package/web-dist/assets/board-BqGDwbGB.js.map +0 -1
  157. package/web-dist/assets/chevron-right-B-aa_CvO.js +0 -2
  158. package/web-dist/assets/code-Di_a0pVO.js +0 -28
  159. package/web-dist/assets/code-Di_a0pVO.js.map +0 -1
  160. package/web-dist/assets/enroll-DlZYKudD.js +0 -2
  161. package/web-dist/assets/index-CbdB9RE5.js +0 -17
  162. package/web-dist/assets/index-CbdB9RE5.js.map +0 -1
  163. package/web-dist/assets/index-XQGPQuFK.css +0 -2
  164. package/web-dist/assets/logic-4hQwsm8w.js +0 -4
  165. package/web-dist/assets/logic-c8AsGwGr.js +0 -2
  166. package/web-dist/assets/more-RENHRep9.js +0 -2
  167. package/web-dist/assets/queue-C25GCl3M.js +0 -2
  168. package/web-dist/assets/selection-BVtvp1aZ.js +0 -9
  169. package/web-dist/assets/selection-BVtvp1aZ.js.map +0 -1
  170. package/web-dist/assets/settings-BApavmGp.js +0 -7
  171. package/web-dist/assets/settings-BApavmGp.js.map +0 -1
  172. package/web-dist/assets/states-CM1Zt9qO.js +0 -60
  173. package/web-dist/assets/states-CM1Zt9qO.js.map +0 -1
  174. package/web-dist/assets/terminal-login-BceUiMHs.js +0 -2
  175. package/web-dist/assets/useBreakpoint-CdYPa6z0.js +0 -2
  176. package/web-dist/assets/useNow-CyygPGnv.js +0 -2
  177. package/web-dist/assets/useResource-DQOWQ7YZ.js +0 -2
  178. package/web-dist/assets/useResource-DQOWQ7YZ.js.map +0 -1
  179. package/web-dist/assets/useSwipeTabs-CJFQTmAs.js +0 -2
  180. package/web-dist/assets/workboard-D39MZMSb.js +0 -3
  181. package/web-dist/assets/workboard-D39MZMSb.js.map +0 -1
@@ -434,30 +434,42 @@ var displayUrl = z4.string().max(4096).refine((s) => {
434
434
  return false;
435
435
  }
436
436
  });
437
+ var AUTHORITY_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+$/;
438
+ var GitAuthority = z4.string().trim().transform((s) => s.toLowerCase()).refine((s) => s.length <= 253 && AUTHORITY_RE.test(s) && !/^\d+(?:\.\d+)*$/.test(s), {
439
+ message: "Invalid Git authority hostname"
440
+ });
437
441
  var githubUrl = displayUrl.refine((s) => {
438
442
  try {
439
443
  const u = new URL(s);
440
- return u.protocol === "https:" && u.hostname === "github.com" && !u.port && /^https:\/\/github\.com(?:[/?#]|$)/i.test(s);
444
+ return u.protocol === "https:" && !u.port && /^https:\/\/[^/:?#]+(?:[/?#]|$)/i.test(s) && GitAuthority.safeParse(u.hostname).success;
441
445
  } catch {
442
446
  return false;
443
447
  }
444
448
  });
445
449
  var GitHubRepository = z4.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\/(?!\.{1,2}$)[A-Za-z0-9_.-]{1,100}$/);
446
- var issuePath = /^[hH][tT][tT][pP][sS]:\/\/[gG][iI][tT][hH][uU][bB]\.[cC][oO][mM]\/([^/]+)\/([^/]+)\/issues\/([1-9][0-9]*)$/;
450
+ var issuePath = /^[hH][tT][tT][pP][sS]:\/\/([^/:?#]+)\/([^/]+)\/([^/]+)\/issues\/([1-9][0-9]*)$/;
447
451
  var GitHubIssueUrl = z4.string().trim().transform((raw, ctx) => {
448
452
  const match = issuePath.exec(raw);
449
- const number = match ? Number(match[3]) : NaN;
450
- if (!match || !GitHubRepository.safeParse(`${match[1]}/${match[2]}`).success || !Number.isSafeInteger(number)) {
453
+ const authority = match ? GitAuthority.safeParse(match[1]) : null;
454
+ const number = match ? Number(match[4]) : NaN;
455
+ if (!match || !authority?.success || authority.data === "www.github.com" || !GitHubRepository.safeParse(`${match[2]}/${match[3]}`).success || !Number.isSafeInteger(number)) {
451
456
  ctx.addIssue({ code: "custom", message: "Invalid GitHub issue URL" });
452
457
  return z4.NEVER;
453
458
  }
454
- return `https://github.com/${match[1]}/${match[2]}/issues/${number}`;
459
+ return `https://${authority.data}/${match[2]}/${match[3]}/issues/${number}`;
455
460
  });
456
461
  function issueParts(url) {
457
462
  const match = issuePath.exec(url);
458
- return { repository: `${match[1]}/${match[2]}`, number: Number(match[3]) };
463
+ return {
464
+ authority: match[1].toLowerCase(),
465
+ repository: `${match[2]}/${match[3]}`,
466
+ number: Number(match[4])
467
+ };
459
468
  }
460
469
  function issuePrompt(url) {
470
+ return `Work on GitHub issue ${url}.`;
471
+ }
472
+ function legacyGhIssuePrompt(url) {
461
473
  return `${url}
462
474
 
463
475
  Read it with \`gh issue view ${url}\`.`;
@@ -477,11 +489,12 @@ var GitHubIssue = z4.object({
477
489
  launchPrompt: z4.string()
478
490
  }).strict().refine((v) => {
479
491
  const parts = issueParts(v.url);
480
- return v.repository === parts.repository && v.number === parts.number && v.launchPrompt === issuePrompt(v.url);
492
+ return v.repository === parts.repository && v.number === parts.number && (v.launchPrompt === issuePrompt(v.url) || v.launchPrompt === legacyGhIssuePrompt(v.url));
481
493
  });
482
494
  function githubIssueFromUrl(raw) {
483
495
  const url = GitHubIssueUrl.parse(raw);
484
- return { ...issueParts(url), url, launchPrompt: issuePrompt(url) };
496
+ const { repository, number } = issueParts(url);
497
+ return { repository, number, url, launchPrompt: issuePrompt(url) };
485
498
  }
486
499
  var GitHubSha = z4.string().regex(/^[0-9a-f]{40}$/);
487
500
  var prUrl = githubUrl.refine((s) => {
@@ -661,6 +674,31 @@ var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
661
674
  import { z as z5 } from "zod";
662
675
  var Iso = z5.string();
663
676
  var Id3 = z5.string().min(1);
677
+ var RepoCursor = z5.string().min(1).max(2048).refine((v) => {
678
+ let bytes3 = 0;
679
+ for (const char of v) {
680
+ const code = char.codePointAt(0);
681
+ bytes3 += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
682
+ }
683
+ return bytes3 <= 2048;
684
+ });
685
+ var RepoIssuesPageRequest = z5.object({
686
+ repository: GitHubRepository,
687
+ after: RepoCursor.optional()
688
+ }).strict();
689
+ var RepoIssueRequest = z5.object({
690
+ repository: GitHubRepository,
691
+ number: z5.number().int().safe().positive()
692
+ }).strict();
693
+ var ISSUE_DESCRIPTION_MAX_LENGTH = 32768;
694
+ var IssueDescriptionRequest = z5.object({
695
+ repository: GitHubRepository,
696
+ number: z5.number().int().safe().positive()
697
+ });
698
+ var IssueDescriptionResult = z5.object({
699
+ body: z5.string().max(ISSUE_DESCRIPTION_MAX_LENGTH),
700
+ truncated: z5.boolean()
701
+ });
664
702
  var IssueFollow = z5.enum(["assigned", "board"]);
665
703
  var GitHubLogin = z5.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
666
704
  var BoardStatusOption = z5.object({
@@ -681,8 +719,10 @@ var SourceBoard = z5.object({
681
719
  });
682
720
  var GitHubSource = z5.object({
683
721
  kind: z5.literal("github"),
684
- /** The host whose `gh` login reads the issues. */
685
- hostId: Id3,
722
+ /** The GitHub catalog connection that reads issues and moves board cards. */
723
+ connectionId: z5.string().min(1).nullable().optional(),
724
+ /** Legacy host id retained only for parsing pre-upgrade scopes. */
725
+ hostId: Id3.nullable().optional(),
686
726
  owner: GitHubLogin,
687
727
  repositories: z5.array(GitHubRepository).min(1).max(50).nullable(),
688
728
  /** Repositories outside `owner` that belong to this source too (never limited by `repositories`). */
@@ -695,13 +735,14 @@ var GitHubSource = z5.object({
695
735
  /** Make a worktree for an issue branch that has none; absent means true. */
696
736
  worktrees: z5.boolean().optional(),
697
737
  enabled: z5.boolean(),
698
- /** The host's `gh` user, from the last sync. */
738
+ /** The connected GitHub account login, from the last sync. */
699
739
  login: z5.string().nullable(),
700
740
  lastSyncedAt: Iso.nullable(),
701
741
  lastError: z5.string().max(2e3).nullable()
702
742
  });
703
743
  var GitHubSourceInput = z5.object({
704
- hostId: Id3,
744
+ connectionId: z5.string().min(1),
745
+ hostId: Id3.nullable().optional(),
705
746
  owner: GitHubLogin,
706
747
  repositories: GitHubSource.shape.repositories.default(null),
707
748
  extraRepositories: z5.array(GitHubRepository).max(20).default([]),
@@ -713,7 +754,8 @@ var GitHubSourceInput = z5.object({
713
754
  enabled: z5.boolean().default(true)
714
755
  });
715
756
  var GitHubSourcePatch = z5.object({
716
- hostId: Id3.optional(),
757
+ connectionId: z5.string().min(1).optional(),
758
+ hostId: Id3.nullable().optional(),
717
759
  owner: GitHubLogin.optional(),
718
760
  repositories: GitHubSource.shape.repositories.optional(),
719
761
  extraRepositories: z5.array(GitHubRepository).max(20).optional(),
@@ -762,6 +804,21 @@ var SyncedIssue = z5.object({
762
804
  parent: IssueParent.nullable().optional(),
763
805
  subIssues: IssueSubIssues.nullable().optional()
764
806
  });
807
+ var RepoIssuesPageResult = z5.object({
808
+ items: z5.array(SyncedIssue).max(50),
809
+ nextCursor: RepoCursor.nullable()
810
+ });
811
+ var RepoIssueResult = z5.object({ state: z5.enum(["OPEN", "CLOSED"]), issue: SyncedIssue });
812
+ var RepoIssueItem = SyncedIssue.extend({
813
+ projectId: Id3,
814
+ branch: z5.string().nullable(),
815
+ workspaceId: Id3.nullable(),
816
+ sessionId: Id3.nullable()
817
+ });
818
+ var RepoIssuesPage = z5.object({
819
+ items: z5.array(RepoIssueItem).max(50),
820
+ nextCursor: RepoCursor.nullable()
821
+ });
765
822
  var IssueSyncResult = z5.object({
766
823
  login: z5.string().min(1),
767
824
  items: z5.array(SyncedIssue).max(200),
@@ -801,6 +858,7 @@ var OpenIssueRequest = z5.object({
801
858
  prompt: z5.string().optional(),
802
859
  profileId: z5.string().nullable().optional()
803
860
  });
861
+ var OpenRepoIssueRequest = OpenIssueRequest.extend({ expectedNodeId: Id3 });
804
862
  var IssueSetStatusResult = z5.discriminatedUnion("status", [
805
863
  z5.object({ status: z5.literal("moved") }),
806
864
  z5.object({
@@ -823,14 +881,16 @@ var IssueHostSyncRequest = z5.object({
823
881
  });
824
882
  var IssueHostPrepareBranchRequest = z5.object({
825
883
  checkoutPath: z5.string().min(1),
826
- branch: z5.string().min(1).max(255)
884
+ branch: z5.string().min(1).max(255),
885
+ strict: z5.boolean().optional()
827
886
  });
828
887
  var IssueHostStartIssueRequest = z5.object({
829
888
  checkoutPath: z5.string().min(1),
830
889
  repository: GitHubRepository,
831
890
  number: z5.number().int().positive(),
832
891
  branch: z5.string().min(1).max(255),
833
- base: z5.string().min(1)
892
+ base: z5.string().min(1),
893
+ strict: z5.boolean().optional()
834
894
  });
835
895
  var IssueHostSetStatusRequest = z5.object({
836
896
  projectId: z5.string().min(1),
@@ -1247,6 +1307,8 @@ var Host = z8.object({
1247
1307
  /** Folders on the host whose git repositories become projects (absolute or ~/...). */
1248
1308
  projectFolders: z8.array(z8.string()).optional(),
1249
1309
  projectScan: ProjectScan.nullable().optional(),
1310
+ checkoutRoot: z8.string().nullable().optional(),
1311
+ checkoutProvision: z8.boolean().optional(),
1250
1312
  /** Subscription limits (host-reported, refreshed every few minutes). */
1251
1313
  usage: z8.array(ProviderUsage).optional(),
1252
1314
  github: HostGitHub.optional()
@@ -1256,6 +1318,12 @@ var Project = z8.object({
1256
1318
  id: Id5,
1257
1319
  name: z8.string().min(1),
1258
1320
  repoIdentity: z8.string(),
1321
+ catalog: z8.object({
1322
+ state: z8.enum(["listed", "delisted", "legacy"]),
1323
+ authority: z8.string().optional(),
1324
+ externalId: z8.string().optional(),
1325
+ fullName: z8.string().optional()
1326
+ }).optional(),
1259
1327
  defaultProfileId: Id5.nullable(),
1260
1328
  defaultHostId: Id5.nullable(),
1261
1329
  maxConcurrentRuns: z8.number().int().min(1).max(32),
@@ -2189,739 +2257,253 @@ var AgentResultFrame = z11.discriminatedUnion("ok", [
2189
2257
  ]);
2190
2258
 
2191
2259
  // packages/protocol/dist/api.js
2192
- import { z as z15 } from "zod";
2193
-
2194
- // packages/protocol/dist/host-wire.js
2195
- import { z as z14 } from "zod";
2196
-
2197
- // packages/protocol/dist/events.js
2198
2260
  import { z as z12 } from "zod";
2199
- var EventDataSchemas = {
2200
- "host.updated": Host,
2201
- "project.updated": Project,
2202
- "project.deleted": z12.object({ id: z12.string() }),
2203
- "checkout.updated": Checkout,
2204
- "workspace.updated": Workspace,
2205
- "workspace.deleted": z12.object({ id: z12.string() }),
2206
- "profile.updated": Profile,
2207
- "profile.deleted": z12.object({ id: z12.string() }),
2208
- "scope.updated": Scope,
2209
- "scope.deleted": z12.object({ id: z12.string() }),
2210
- "session.updated": Session,
2211
- "transcript.item": TranscriptItem,
2212
- "transcript.reset": z12.object({ sessionId: z12.string(), epoch: z12.number().int() }),
2213
- "interaction.updated": Interaction,
2214
- "panel.updated": Panel,
2215
- "adapters.updated": z12.object({ hostId: z12.string(), adapters: z12.array(AdapterInfo) }),
2216
- diagnostic: Diagnostic,
2217
- "task.updated": Task,
2218
- "task.deleted": z12.object({ id: z12.string() }),
2219
- "run.updated": Run,
2220
- "automation.updated": Automation,
2221
- "automation.deleted": z12.object({ id: z12.string() }),
2222
- "occurrence.created": Occurrence,
2223
- "occurrence.updated": Occurrence,
2224
- "attention.updated": AttentionItem,
2225
- "device.updated": Device,
2226
- "issue.updated": TrackedIssue,
2227
- "issue.deleted": z12.object({ id: z12.string() }),
2228
- "client.updated": Client,
2229
- "client.deleted": z12.object({ id: z12.string() }),
2230
- "settings.updated": z12.object({ dispatchPaused: z12.boolean() })
2231
- };
2232
- var EVENT_TYPES = Object.keys(EventDataSchemas);
2233
- var LEGACY_EVENT_TYPES = {
2234
- "workspace.removed": "workspace.deleted"
2235
- };
2236
- function canonicalEventType(type) {
2237
- return LEGACY_EVENT_TYPES[type] ?? type;
2238
- }
2239
- var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
2240
- var EventTypeSchema = z12.preprocess(canonical, z12.enum(EVENT_TYPES));
2241
- var EventScope = z12.object({
2242
- hostId: z12.string().optional(),
2243
- sessionId: z12.string().optional(),
2244
- taskId: z12.string().optional(),
2245
- projectId: z12.string().optional()
2246
- });
2247
- var EventEnvelope = EventScope.extend({
2248
- seq: z12.number().int(),
2249
- id: z12.string(),
2250
- type: EventTypeSchema,
2251
- at: z12.string(),
2252
- data: z12.unknown()
2253
- });
2254
- var HOST_EVENT_TYPES = [
2255
- "session.updated",
2256
- "transcript.item",
2257
- "interaction.updated",
2258
- "panel.updated",
2259
- "adapters.updated",
2260
- "diagnostic",
2261
- "workspace.updated",
2262
- "workspace.deleted"
2263
- ];
2264
- var HostEvent = EventScope.extend({
2265
- eventId: z12.string(),
2266
- type: z12.preprocess(canonical, z12.enum(HOST_EVENT_TYPES)),
2267
- at: z12.string(),
2268
- data: z12.unknown()
2269
- });
2270
- var StreamDelta = z12.object({
2271
- sessionId: z12.string(),
2272
- itemId: z12.string(),
2273
- kind: z12.enum(["text", "thinking", "tool_args", "tool_output"]),
2274
- delta: z12.string(),
2275
- order: z12.number().int().optional()
2276
- });
2277
-
2278
- // packages/protocol/dist/terminal-wire.js
2279
- import { z as z13 } from "zod";
2280
- var Cols = z13.number().int().min(10).max(1e3);
2281
- var Rows = z13.number().int().min(5).max(500);
2282
- var TermViewerToServer = z13.discriminatedUnion("t", [
2283
- z13.object({ t: z13.literal("in"), d: z13.string() }),
2284
- z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2285
- z13.object({ t: z13.literal("claim") })
2286
- ]);
2287
- var TermServerToViewer = z13.discriminatedUnion("t", [
2288
- z13.object({ t: z13.literal("out"), d: z13.string() }),
2289
- z13.object({ t: z13.literal("closed"), reason: z13.string() }),
2290
- z13.object({ t: z13.literal("size"), cols: Cols, rows: Rows, owner: z13.boolean() })
2291
- ]);
2292
- var TermCoordinatorMsg = z13.discriminatedUnion("t", [
2293
- z13.object({
2294
- t: z13.literal("open"),
2295
- sessionId: z13.string(),
2296
- cols: Cols,
2297
- rows: Rows,
2298
- passive: z13.boolean().optional()
2299
- }),
2300
- z13.object({ t: z13.literal("claim") }),
2301
- z13.object({ t: z13.literal("in"), d: z13.string() }),
2302
- z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2303
- z13.object({ t: z13.literal("close") })
2304
- ]);
2305
-
2306
- // packages/protocol/dist/host-wire.js
2307
- var Origin = z14.enum(["human", "automation"]);
2308
- var DiffRev = z14.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
2309
- var HostCommand = z14.discriminatedUnion("type", [
2310
- z14.object({
2311
- type: z14.literal("session.start"),
2312
- sessionId: z14.string(),
2313
- title: z14.string(),
2314
- workspacePath: z14.string(),
2315
- projectId: z14.string().nullable(),
2316
- profile: Profile,
2317
- nativeHandle: NativeHandle.nullable(),
2318
- initialPrompt: z14.string().nullable(),
2319
- dispatchKey: z14.string().nullable(),
2320
- controlRevision: z14.number().int(),
2321
- controlMode: ControlMode,
2322
- origin: Origin,
2323
- readOnly: z14.boolean().default(false),
2324
- policyRequired: z14.boolean().optional()
2325
- }),
2326
- z14.object({
2327
- type: z14.literal("session.deliverMessage"),
2328
- sessionId: z14.string(),
2329
- messageId: z14.string(),
2330
- payload: z14.object({
2331
- deliveryId: z14.string(),
2332
- kind: z14.enum(["message", "completion"]),
2333
- text: z14.string()
2334
- }),
2335
- mode: z14.enum(["steer", "queue"]),
2336
- holdUntil: z14.string()
2337
- }),
2338
- HostPolicySampleRequest.extend({ type: z14.literal("session.classifyPolicySample") }),
2339
- z14.object({
2340
- type: z14.literal("session.messageStatus"),
2341
- sessionId: z14.string(),
2342
- messageIds: z14.array(z14.string().min(1)).min(1).max(100)
2343
- }),
2344
- z14.object({
2345
- type: z14.literal("session.prompt"),
2346
- sessionId: z14.string(),
2347
- text: z14.string(),
2348
- images: z14.array(z14.object({ mimeType: z14.string(), data: z14.string() })).default([]),
2349
- mode: z14.enum(["prompt", "steer", "followUp"]),
2350
- origin: Origin,
2351
- controlRevision: z14.number().int()
2352
- }),
2353
- z14.object({ type: z14.literal("session.abort"), sessionId: z14.string(), clearQueue: z14.boolean() }),
2354
- /** `queueClear.v1`: empty Pi's queue without aborting; the receipt's result has the messages. */
2355
- z14.object({ type: z14.literal("session.clearQueue"), sessionId: z14.string() }),
2356
- z14.object({ type: z14.literal("session.stop"), sessionId: z14.string() }),
2357
- z14.object({
2358
- type: z14.literal("session.answer"),
2359
- sessionId: z14.string(),
2360
- interactionId: z14.string(),
2361
- revision: z14.number().int(),
2362
- response: InteractionResponseSchema,
2363
- deviceId: z14.string()
2364
- }),
2365
- z14.object({
2366
- type: z14.literal("session.adapterAction"),
2367
- sessionId: z14.string(),
2368
- generation: z14.string().uuid().optional(),
2369
- adapterId: z14.string(),
2370
- actionId: z14.string(),
2371
- payload: z14.unknown()
2372
- }),
2373
- z14.object({
2374
- type: z14.literal("session.setControl"),
2375
- sessionId: z14.string(),
2376
- controlRevision: z14.number().int(),
2377
- mode: ControlMode
2378
- }),
2379
- z14.object({ type: z14.literal("session.rename"), sessionId: z14.string(), title: z14.string() }),
2380
- z14.object({ type: z14.literal("session.importable") }),
2381
- z14.object({ type: z14.literal("session.readNative"), sessionFile: z14.string() }),
2382
- z14.object({ type: z14.literal("session.snapshot"), sessionId: z14.string() }),
2383
- z14.object({ type: z14.literal("session.models"), sessionId: z14.string() }),
2384
- z14.object({ type: z14.literal("session.commands"), sessionId: z14.string() }),
2385
- z14.object({
2386
- type: z14.literal("session.complete"),
2387
- sessionId: z14.string(),
2388
- text: z14.string().max(500)
2389
- }),
2390
- z14.object({ type: z14.literal("session.tree"), sessionId: z14.string() }),
2391
- z14.object({
2392
- type: z14.literal("session.branch"),
2393
- sessionId: z14.string(),
2394
- entryId: z14.string().nullable(),
2395
- fork: z14.boolean()
2396
- }),
2397
- z14.object({
2398
- type: z14.literal("session.navigate"),
2399
- sessionId: z14.string(),
2400
- entryId: z14.string(),
2401
- summarize: z14.boolean(),
2402
- instructions: z14.string().max(2e3).nullable()
2403
- }),
2404
- z14.object({ type: z14.literal("session.reload"), sessionId: z14.string() }),
2405
- z14.object({ type: z14.literal("session.adapters"), sessionId: z14.string() }),
2406
- z14.object({ type: z14.literal("session.reloadAdapters"), sessionId: z14.string() }),
2407
- z14.object({ type: z14.literal("session.export"), sessionId: z14.string() }),
2408
- z14.object({
2409
- type: z14.literal("session.setModel"),
2410
- sessionId: z14.string(),
2411
- provider: z14.string().min(1),
2412
- modelId: z14.string().min(1)
2413
- }),
2414
- z14.object({ type: z14.literal("session.setThinking"), sessionId: z14.string(), level: ThinkingLevel }),
2415
- z14.object({
2416
- type: z14.literal("session.compact"),
2417
- sessionId: z14.string(),
2418
- instructions: z14.string().nullable()
2419
- }),
2420
- z14.object({ type: z14.literal("checkout.inspect"), path: z14.string() }),
2421
- z14.object({ type: z14.literal("projects.scan"), folder: z14.string().min(1) }),
2422
- z14.object({
2423
- type: z14.literal("projects.suggest"),
2424
- days: z14.number().int().min(1).max(365).default(30)
2425
- }),
2426
- z14.object({
2427
- type: z14.literal("workspace.discover"),
2428
- checkoutPath: z14.string(),
2429
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2430
- }),
2431
- z14.object({
2432
- type: z14.literal("workspace.create"),
2433
- checkoutPath: z14.string(),
2434
- branch: z14.string(),
2435
- base: z14.string(),
2436
- setupCommand: z14.string().nullable(),
2437
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2438
- }),
2439
- z14.object({ type: z14.literal("workspace.status"), path: z14.string(), base: z14.string().nullable() }),
2440
- z14.object({
2441
- type: z14.literal("workspace.remove"),
2442
- path: z14.string(),
2443
- checkoutPath: z14.string(),
2444
- base: z14.string().nullable(),
2445
- force: z14.object({ dirty: z14.boolean(), unmerged: z14.boolean() }),
2446
- /** Also delete the worktree's local branch (hosts before GitHub issue sync ignore it). */
2447
- deleteBranch: z14.boolean().optional()
2448
- }),
2449
- z14.object({
2450
- type: z14.literal("workspace.diff"),
2451
- path: z14.string(),
2452
- base: z14.string().nullable(),
2453
- file: z14.string().nullable(),
2454
- /** Hosts without gitLog.v1 never receive it. */
2455
- rev: DiffRev.optional()
2456
- }),
2457
- z14.object({
2458
- type: z14.literal("workspace.log"),
2459
- path: z14.string(),
2460
- base: z14.string().nullable(),
2461
- limit: z14.number().int().min(1).max(200)
2462
- }),
2463
- z14.object({ type: z14.literal("workspace.files"), path: z14.string(), dir: z14.string() }),
2464
- z14.object({ type: z14.literal("workspace.readFile"), path: z14.string(), file: z14.string() }),
2465
- GitHubHostViewRequest.extend({ type: z14.literal("workspace.prView") }),
2466
- GitHubHostLogsRequest.extend({ type: z14.literal("workspace.prFailedLogs") }),
2467
- GitHubHostMergeRequest.extend({ type: z14.literal("workspace.prMerge") }),
2468
- IssueHostSyncRequest.extend({ type: z14.literal("tracker.sync") }),
2469
- IssueHostPrepareBranchRequest.extend({ type: z14.literal("tracker.prepareBranch") }),
2470
- IssueHostStartIssueRequest.extend({ type: z14.literal("tracker.startIssue") }),
2471
- IssueHostSetStatusRequest.extend({ type: z14.literal("tracker.setStatus") }),
2472
- z14.object({
2473
- type: z14.literal("dispatch.start"),
2474
- dispatchKey: z14.string(),
2475
- runId: z14.string(),
2476
- taskId: z14.string(),
2477
- sessionId: z14.string(),
2478
- projectId: z14.string(),
2479
- title: z14.string(),
2480
- workspace: z14.union([
2481
- z14.object({ path: z14.string() }),
2482
- z14.object({
2483
- createFrom: z14.object({
2484
- checkoutPath: z14.string(),
2485
- branch: z14.string(),
2486
- base: z14.string(),
2487
- setupCommand: z14.string().nullable(),
2488
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2489
- })
2490
- })
2491
- ]),
2492
- nativeHandle: NativeHandle.nullable(),
2493
- profile: Profile,
2494
- prompt: z14.string(),
2495
- /** The launch's own revision; a takeover always carries a newer one. */
2496
- controlRevision: z14.number().int(),
2497
- controlMode: ControlMode.default("automation"),
2498
- policyRequired: z14.boolean().optional()
2499
- }),
2500
- z14.object({ type: z14.literal("dispatch.reconcile"), dispatchKey: z14.string() }),
2501
- z14.object({
2502
- type: z14.literal("checks.run"),
2503
- sessionId: z14.string(),
2504
- path: z14.string(),
2505
- commands: z14.array(z14.string())
2506
- })
2507
- ]);
2508
- var ImportableSession = z14.object({
2509
- sessionFile: z14.string(),
2510
- sessionId: z14.string(),
2511
- cwd: z14.string(),
2512
- name: z14.string().nullable(),
2513
- mtime: z14.string(),
2514
- inactive: z14.boolean()
2515
- });
2516
- var DiscoveredWorktree = z14.object({
2517
- path: z14.string(),
2518
- head: z14.string().nullable(),
2519
- branch: z14.string().nullable(),
2520
- bare: z14.boolean(),
2521
- detached: z14.boolean(),
2522
- locked: z14.boolean(),
2523
- prunable: z14.boolean(),
2524
- provenance: z14.enum(["managed", "discovered", "main"]),
2525
- git: GitState.nullable()
2526
- });
2527
- var CheckoutInfo = z14.object({
2528
- root: z14.string(),
2529
- commonDir: z14.string(),
2530
- repoIdentity: z14.string(),
2531
- defaultBranch: z14.string()
2532
- });
2533
- var ScannedRepository = CheckoutInfo.extend({ name: z14.string() });
2534
- var ProjectFolderScan = z14.object({
2535
- /** The folder, ~ expanded and realpath'd. */
2536
- folder: z14.string(),
2537
- repositories: z14.array(ScannedRepository)
2538
- });
2539
- var ProjectSuggestion = z14.object({
2540
- rootPath: z14.string(),
2541
- sessionCount: z14.number().int(),
2542
- lastActivityAt: z14.string()
2543
- });
2544
- var ProjectSuggestions = z14.object({ suggestions: z14.array(ProjectSuggestion) });
2545
- var GitCommit = z14.object({
2546
- sha: z14.string().regex(/^[0-9a-f]{40}$/),
2547
- subject: z14.string().max(300),
2548
- author: z14.string().max(200),
2549
- authoredAt: z14.string(),
2550
- pushed: z14.boolean()
2551
- });
2552
- var LogResult = z14.object({
2553
- /** The base branch the commits are counted from. */
2554
- base: z14.string(),
2555
- /** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
2556
- scope: z14.enum(["branch", "recent"]),
2557
- commits: z14.array(GitCommit).max(200),
2558
- truncated: z14.boolean(),
2559
- /** Changed and untracked files not committed yet. */
2560
- uncommitted: z14.number().int().min(0)
2561
- });
2562
- var DiffFile = z14.object({
2563
- path: z14.string(),
2564
- oldPath: z14.string().nullable(),
2565
- added: z14.number().int(),
2566
- deleted: z14.number().int(),
2567
- status: z14.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
2568
- });
2569
- var DiffResult = z14.object({
2570
- base: z14.string(),
2571
- files: z14.array(DiffFile),
2572
- patch: z14.string().nullable()
2573
- });
2574
- var FileEntry = z14.object({
2575
- name: z14.string(),
2576
- path: z14.string(),
2577
- kind: z14.enum(["file", "dir", "symlink"]),
2578
- size: z14.number().int().nullable()
2579
- });
2580
- var ReconcileResult = z14.union([
2581
- z14.object({ known: z14.literal(false) }),
2582
- z14.object({
2583
- known: z14.literal(true),
2584
- sessionId: z14.string().nullable(),
2585
- state: z14.enum(["accepted", "workspace_ready", "started", "failed"]),
2586
- runtime: RuntimeState.nullable(),
2587
- workspacePath: z14.string().nullable(),
2588
- nativeHandle: NativeHandle.nullable(),
2589
- error: z14.string().nullable(),
2590
- /** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
2591
- errorDetails: z14.record(z14.string(), z14.unknown()).nullable().default(null)
2592
- })
2593
- ]);
2594
- var DispatchStartResult = z14.object({
2595
- sessionId: z14.string(),
2596
- workspacePath: z14.string(),
2597
- nativeHandle: NativeHandle.nullable(),
2598
- reused: z14.boolean(),
2599
- /** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
2600
- promptError: z14.string().nullable().optional()
2601
- });
2602
- var AnswerResult = z14.object({
2603
- status: z14.enum(["answered", "already_answered"]),
2604
- interaction: Interaction
2605
- });
2606
- var SnapshotResult = z14.object({
2607
- partial: z14.array(TranscriptItem),
2608
- pendingInteractions: z14.array(Interaction)
2609
- });
2610
- var ChecksResult = z14.object({ results: z14.array(CheckResult) });
2611
- var Receipt = z14.union([
2612
- z14.object({ commandId: z14.string(), ok: z14.literal(true), result: z14.unknown() }),
2613
- z14.object({ commandId: z14.string(), ok: z14.literal(false), error: ErrorBody })
2614
- ]);
2615
- var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
2616
- policyContext: HostToolPolicyContext.optional()
2617
- }).strict().superRefine((frame, ctx) => {
2618
- if (frame.method === "policy.evaluate" ? frame.policyContext === void 0 : Object.hasOwn(frame, "policyContext")) {
2619
- ctx.addIssue({
2620
- code: "custom",
2621
- path: ["policyContext"],
2622
- message: "Host policy context is required only for policy.evaluate."
2623
- });
2624
- }
2625
- try {
2626
- if (new TextEncoder().encode(JSON.stringify(frame)).length <= AGENT_FRAME_MAX_BYTES)
2627
- return;
2628
- } catch {
2629
- }
2630
- ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
2631
- });
2632
- var HostToCoordinator = z14.discriminatedUnion("type", [
2633
- z14.object({
2634
- type: z14.literal("hello"),
2635
- hostId: z14.string(),
2636
- credential: z14.string(),
2637
- name: z14.string(),
2638
- agentVersion: z14.string(),
2639
- piVersion: z14.string().nullable(),
2640
- piCompatible: z14.boolean(),
2641
- platform: Platform,
2642
- capabilities: RuntimeCapabilities.nullable(),
2643
- github: HostGitHub.optional(),
2644
- protocolVersion: z14.number().int(),
2645
- features: z14.array(z14.string()).optional()
2646
- }),
2647
- HostAgentRequestFrame,
2648
- z14.object({ type: z14.literal("event"), hostSeq: z14.number().int(), event: HostEvent }),
2649
- z14.object({ type: z14.literal("stream"), delta: StreamDelta }),
2650
- z14.object({ type: z14.literal("receipt"), receipt: Receipt }),
2651
- z14.object({ type: z14.literal("pong") }),
2652
- z14.object({ type: z14.literal("usage"), usage: z14.array(ProviderUsage) }),
2653
- z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermServerToViewer })
2654
- ]);
2655
- var CoordinatorToHost = z14.discriminatedUnion("type", [
2656
- z14.object({
2657
- type: z14.literal("welcome"),
2658
- coordinatorVersion: z14.string(),
2659
- ackedHostSeq: z14.number().int(),
2660
- features: z14.array(z14.string()).optional()
2661
- }),
2662
- AgentResultFrame,
2663
- z14.object({ type: z14.literal("ack"), hostSeq: z14.number().int() }),
2664
- z14.object({ type: z14.literal("command"), commandId: z14.string(), command: HostCommand }),
2665
- z14.object({ type: z14.literal("ping") }),
2666
- z14.object({ type: z14.literal("reject"), error: ErrorBody }),
2667
- z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermCoordinatorMsg })
2668
- ]);
2669
-
2670
- // packages/protocol/dist/api.js
2671
- var EnrollRequest = z15.object({
2672
- token: z15.string().min(1),
2673
- name: z15.string().min(1).max(80),
2261
+ var EnrollRequest = z12.object({
2262
+ token: z12.string().min(1),
2263
+ name: z12.string().min(1).max(80),
2674
2264
  kind: DeviceKind
2675
2265
  });
2676
- var EnrollResponse = z15.object({ deviceId: z15.string(), credential: z15.string() });
2677
- var CreateEnrollmentRequest = z15.object({ kind: z15.enum(["device", "host"]) });
2678
- var CreateEnrollmentResponse = z15.object({
2679
- token: z15.string(),
2680
- url: z15.string(),
2681
- expiresAt: z15.string(),
2682
- qrSvg: z15.string(),
2683
- command: z15.string().nullable()
2684
- });
2685
- var HostEnrollRequest = z15.union([
2686
- z15.object({
2687
- token: z15.string().min(1),
2688
- name: z15.string().min(1).max(80),
2266
+ var EnrollResponse = z12.object({ deviceId: z12.string(), credential: z12.string() });
2267
+ var CreateEnrollmentRequest = z12.object({ kind: z12.enum(["device", "host"]) });
2268
+ var CreateEnrollmentResponse = z12.object({
2269
+ token: z12.string(),
2270
+ url: z12.string(),
2271
+ expiresAt: z12.string(),
2272
+ qrSvg: z12.string(),
2273
+ command: z12.string().nullable()
2274
+ });
2275
+ var HostEnrollRequest = z12.union([
2276
+ z12.object({
2277
+ token: z12.string().min(1),
2278
+ name: z12.string().min(1).max(80),
2689
2279
  platform: Platform
2690
2280
  }),
2691
- z15.object({
2692
- secret: z15.string().min(1),
2693
- name: z15.string().min(1).max(80),
2281
+ z12.object({
2282
+ secret: z12.string().min(1),
2283
+ name: z12.string().min(1).max(80),
2694
2284
  platform: Platform
2695
2285
  })
2696
2286
  ]);
2697
- var HostEnrollResponse = z15.object({ hostId: z15.string(), credential: z15.string() });
2698
- var CreateProjectRequest = z15.object({
2699
- name: z15.string().min(1),
2700
- hostId: z15.string(),
2701
- path: z15.string().min(1),
2702
- defaultProfileId: z15.string().nullable().optional(),
2703
- setupCommand: z15.string().nullable().optional(),
2704
- checks: z15.array(z15.string()).optional(),
2705
- maxConcurrentRuns: z15.number().int().min(1).max(32).optional(),
2287
+ var HostEnrollResponse = z12.object({ hostId: z12.string(), credential: z12.string() });
2288
+ var CreateProjectRequest = z12.object({
2289
+ name: z12.string().min(1),
2290
+ hostId: z12.string(),
2291
+ path: z12.string().min(1),
2292
+ defaultProfileId: z12.string().nullable().optional(),
2293
+ setupCommand: z12.string().nullable().optional(),
2294
+ checks: z12.array(z12.string()).optional(),
2295
+ maxConcurrentRuns: z12.number().int().min(1).max(32).optional(),
2706
2296
  worktreeDir: WorktreeDir.optional()
2707
2297
  });
2708
- var UpdateProjectRequest = z15.object({
2709
- name: z15.string().min(1).optional(),
2710
- defaultProfileId: z15.string().nullable().optional(),
2711
- defaultHostId: z15.string().nullable().optional(),
2712
- maxConcurrentRuns: z15.number().int().min(1).max(32).optional(),
2713
- automationEnabled: z15.boolean().optional(),
2714
- setupCommand: z15.string().nullable().optional(),
2715
- checks: z15.array(z15.string()).optional(),
2716
- workspaceSharing: z15.enum(["single_writer", "shared"]).optional(),
2298
+ var UpdateProjectRequest = z12.object({
2299
+ name: z12.string().min(1).optional(),
2300
+ defaultProfileId: z12.string().nullable().optional(),
2301
+ defaultHostId: z12.string().nullable().optional(),
2302
+ maxConcurrentRuns: z12.number().int().min(1).max(32).optional(),
2303
+ automationEnabled: z12.boolean().optional(),
2304
+ setupCommand: z12.string().nullable().optional(),
2305
+ checks: z12.array(z12.string()).optional(),
2306
+ workspaceSharing: z12.enum(["single_writer", "shared"]).optional(),
2717
2307
  worktreeDir: WorktreeDir.optional(),
2718
- ensureSessions: z15.boolean().optional(),
2719
- removeLanded: z15.boolean().optional()
2308
+ ensureSessions: z12.boolean().optional(),
2309
+ removeLanded: z12.boolean().optional()
2720
2310
  });
2721
- var AddCheckoutRequest = z15.object({ hostId: z15.string(), path: z15.string().min(1) });
2311
+ var AddCheckoutRequest = z12.object({ hostId: z12.string(), path: z12.string().min(1) });
2722
2312
  function isProjectFolderPath(s) {
2723
2313
  if (s.includes("\0"))
2724
2314
  return false;
2725
2315
  return s === "~" || s.startsWith("~/") || s.startsWith("/");
2726
2316
  }
2727
- var ProjectFolder = z15.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
2728
- var UpdateHostRequest = z15.object({
2729
- projectFolders: z15.array(ProjectFolder).max(20).optional()
2730
- });
2731
- var ProjectScanResult = ProjectScan.extend({
2732
- added: z15.array(z15.object({
2733
- projectId: z15.string(),
2734
- name: z15.string(),
2735
- path: z15.string(),
2736
- newProject: z15.boolean()
2737
- }))
2738
- });
2739
- var ProfileInput = z15.object({
2740
- name: z15.string().min(1),
2741
- provider: z15.string().nullable().default(null),
2742
- model: z15.string().nullable().default(null),
2317
+ var ProjectFolder = z12.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
2318
+ var UpdateHostRequest = z12.object({
2319
+ checkoutRoot: ProjectFolder.nullable().optional()
2320
+ });
2321
+ var ProfileInput = z12.object({
2322
+ name: z12.string().min(1),
2323
+ provider: z12.string().nullable().default(null),
2324
+ model: z12.string().nullable().default(null),
2743
2325
  thinking: ThinkingLevel.nullable().default(null),
2744
- projectTrust: z15.enum(["ask", "approve", "ignore"]).default("ask"),
2745
- extraArgs: z15.array(ExtraArg).default([]),
2746
- resources: z15.enum(["all", "vanilla"]).default("all")
2747
- });
2748
- var CreateWorkspaceRequest = z15.object({
2749
- checkoutId: z15.string(),
2750
- branch: z15.string().min(1),
2751
- base: z15.string().nullable().optional()
2752
- });
2753
- var RemoveWorkspaceRequest = z15.object({
2754
- force: z15.object({ dirty: z15.boolean(), unmerged: z15.boolean() }).default({ dirty: false, unmerged: false })
2755
- });
2756
- var CreateSessionRequest = z15.object({
2757
- projectId: z15.string(),
2758
- workspace: z15.union([
2759
- z15.object({ existingId: z15.string() }),
2760
- z15.object({
2761
- checkoutId: z15.string(),
2762
- newBranch: z15.string().min(1),
2763
- base: z15.string().nullable().optional()
2326
+ projectTrust: z12.enum(["ask", "approve", "ignore"]).default("ask"),
2327
+ extraArgs: z12.array(ExtraArg).default([]),
2328
+ resources: z12.enum(["all", "vanilla"]).default("all")
2329
+ });
2330
+ var CreateWorkspaceRequest = z12.object({
2331
+ checkoutId: z12.string(),
2332
+ branch: z12.string().min(1),
2333
+ base: z12.string().nullable().optional()
2334
+ });
2335
+ var RemoveWorkspaceRequest = z12.object({
2336
+ force: z12.object({ dirty: z12.boolean(), unmerged: z12.boolean() }).default({ dirty: false, unmerged: false })
2337
+ });
2338
+ var CreateSessionRequest = z12.object({
2339
+ projectId: z12.string(),
2340
+ workspace: z12.union([
2341
+ z12.object({ existingId: z12.string() }),
2342
+ z12.object({
2343
+ checkoutId: z12.string(),
2344
+ newBranch: z12.string().min(1),
2345
+ base: z12.string().nullable().optional()
2764
2346
  })
2765
2347
  ]),
2766
- profileId: z15.string().nullable().optional(),
2767
- prompt: z15.string().default(""),
2768
- title: z15.string().optional(),
2769
- scopeId: z15.string().optional(),
2348
+ profileId: z12.string().nullable().optional(),
2349
+ prompt: z12.string().default(""),
2350
+ title: z12.string().optional(),
2351
+ scopeId: z12.string().optional(),
2770
2352
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2771
- viewId: z15.string().optional()
2772
- });
2773
- var OpenBranchRequest = z15.object({
2774
- projectId: z15.string(),
2775
- branch: z15.string().min(1),
2776
- hostId: z15.string().optional(),
2777
- base: z15.string().nullable().optional(),
2778
- prompt: z15.string().default(""),
2779
- profileId: z15.string().nullable().optional(),
2780
- title: z15.string().optional(),
2781
- scopeId: z15.string().optional(),
2353
+ viewId: z12.string().optional()
2354
+ });
2355
+ var OpenBranchRequest = z12.object({
2356
+ projectId: z12.string(),
2357
+ branch: z12.string().min(1),
2358
+ hostId: z12.string().optional(),
2359
+ base: z12.string().nullable().optional(),
2360
+ prompt: z12.string().default(""),
2361
+ profileId: z12.string().nullable().optional(),
2362
+ title: z12.string().optional(),
2363
+ scopeId: z12.string().optional(),
2782
2364
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2783
- viewId: z15.string().optional(),
2365
+ viewId: z12.string().optional(),
2784
2366
  /** Start another session even when the branch has one. */
2785
- another: z15.boolean().default(false)
2786
- });
2787
- var OpenBranchResult = z15.object({ session: Session, created: z15.boolean() });
2788
- var SetPrimaryRequest = z15.object({ primary: z15.boolean() });
2789
- var PromptRequest = z15.object({
2790
- text: z15.string().min(1),
2791
- mode: z15.enum(["prompt", "steer", "followUp"]).default("prompt"),
2792
- images: z15.array(z15.object({ mimeType: z15.string(), data: z15.string() })).default([]),
2793
- clientMessageId: z15.string().optional()
2794
- });
2795
- var CacheAlertRequest = z15.object({
2796
- enabled: z15.boolean(),
2797
- ttlSec: z15.number().int().min(60).max(86400).nullable().default(null)
2798
- });
2799
- var RenameRequest = z15.object({ title: z15.string().min(1).max(200) });
2800
- var SetModelRequest = z15.object({
2801
- provider: z15.string().min(1),
2802
- modelId: z15.string().min(1)
2803
- });
2804
- var SetThinkingRequest = z15.object({ level: ThinkingLevel });
2805
- var CompactRequest = z15.object({ instructions: z15.string().max(4e3).optional() });
2806
- var SessionModelsResult = z15.object({ models: z15.array(SessionModel) });
2807
- var SessionCommandsResult = z15.object({ commands: z15.array(SlashCommand) });
2808
- var CompleteRequest = z15.object({ text: z15.string().min(1).max(500) });
2809
- var CompletionItem = z15.object({
2810
- value: z15.string(),
2811
- label: z15.string(),
2812
- description: z15.string().nullable()
2813
- });
2814
- var SessionCompleteResult = z15.object({
2815
- items: z15.array(CompletionItem).max(50),
2816
- prefix: z15.string()
2817
- });
2818
- var TreeRow = z15.object({
2819
- entryId: z15.string(),
2820
- parentId: z15.string().nullable(),
2821
- depth: z15.number().int(),
2822
- role: z15.enum(["user", "assistant"]),
2823
- text: z15.string(),
2824
- activeBranch: z15.boolean(),
2825
- leaf: z15.boolean(),
2826
- label: z15.string().nullable(),
2827
- at: z15.string().nullable()
2828
- });
2829
- var SessionTreeResult = z15.object({ rows: z15.array(TreeRow) });
2830
- var BranchRequest = z15.object({
2831
- entryId: z15.string().nullable(),
2832
- fork: z15.boolean().default(false)
2833
- });
2834
- var HostBranchResult = z15.object({
2835
- sessionFile: z15.string().nullable(),
2836
- prefill: z15.string().nullable()
2837
- });
2838
- var TranscriptPage = z15.object({
2839
- items: z15.array(TranscriptItem),
2840
- hasMore: z15.boolean(),
2841
- epoch: z15.number().int().optional(),
2842
- rev: z15.number().int().optional(),
2843
- delta: z15.boolean().optional(),
2844
- reset: z15.boolean().optional()
2845
- });
2846
- var NavigateRequest = z15.object({
2847
- entryId: z15.string().min(1),
2848
- summarize: z15.boolean().default(false),
2849
- instructions: z15.string().max(2e3).nullable().default(null)
2850
- });
2851
- var HostNavigateResult = z15.object({
2852
- items: z15.array(TranscriptItem),
2853
- prefill: z15.string().nullable()
2854
- });
2855
- var NavigateResult = z15.object({
2856
- prefill: z15.string().nullable(),
2857
- epoch: z15.number().int()
2858
- });
2859
- var BranchResult = z15.object({
2367
+ another: z12.boolean().default(false)
2368
+ });
2369
+ var OpenBranchResult = z12.object({ session: Session, created: z12.boolean() });
2370
+ var SetPrimaryRequest = z12.object({ primary: z12.boolean() });
2371
+ var PromptRequest = z12.object({
2372
+ text: z12.string().min(1),
2373
+ mode: z12.enum(["prompt", "steer", "followUp"]).default("prompt"),
2374
+ images: z12.array(z12.object({ mimeType: z12.string(), data: z12.string() })).default([]),
2375
+ clientMessageId: z12.string().optional()
2376
+ });
2377
+ var CacheAlertRequest = z12.object({
2378
+ enabled: z12.boolean(),
2379
+ ttlSec: z12.number().int().min(60).max(86400).nullable().default(null)
2380
+ });
2381
+ var RenameRequest = z12.object({ title: z12.string().min(1).max(200) });
2382
+ var SetModelRequest = z12.object({
2383
+ provider: z12.string().min(1),
2384
+ modelId: z12.string().min(1)
2385
+ });
2386
+ var SetThinkingRequest = z12.object({ level: ThinkingLevel });
2387
+ var CompactRequest = z12.object({ instructions: z12.string().max(4e3).optional() });
2388
+ var SessionModelsResult = z12.object({ models: z12.array(SessionModel) });
2389
+ var SessionCommandsResult = z12.object({ commands: z12.array(SlashCommand) });
2390
+ var CompleteRequest = z12.object({ text: z12.string().min(1).max(500) });
2391
+ var CompletionItem = z12.object({
2392
+ value: z12.string(),
2393
+ label: z12.string(),
2394
+ description: z12.string().nullable()
2395
+ });
2396
+ var SessionCompleteResult = z12.object({
2397
+ items: z12.array(CompletionItem).max(50),
2398
+ prefix: z12.string()
2399
+ });
2400
+ var TreeRow = z12.object({
2401
+ entryId: z12.string(),
2402
+ parentId: z12.string().nullable(),
2403
+ depth: z12.number().int(),
2404
+ role: z12.enum(["user", "assistant"]),
2405
+ text: z12.string(),
2406
+ activeBranch: z12.boolean(),
2407
+ leaf: z12.boolean(),
2408
+ label: z12.string().nullable(),
2409
+ at: z12.string().nullable()
2410
+ });
2411
+ var SessionTreeResult = z12.object({ rows: z12.array(TreeRow) });
2412
+ var BranchRequest = z12.object({
2413
+ entryId: z12.string().nullable(),
2414
+ fork: z12.boolean().default(false)
2415
+ });
2416
+ var HostBranchResult = z12.object({
2417
+ sessionFile: z12.string().nullable(),
2418
+ prefill: z12.string().nullable()
2419
+ });
2420
+ var TranscriptPage = z12.object({
2421
+ items: z12.array(TranscriptItem),
2422
+ hasMore: z12.boolean(),
2423
+ epoch: z12.number().int().optional(),
2424
+ rev: z12.number().int().optional(),
2425
+ delta: z12.boolean().optional(),
2426
+ reset: z12.boolean().optional()
2427
+ });
2428
+ var NavigateRequest = z12.object({
2429
+ entryId: z12.string().min(1),
2430
+ summarize: z12.boolean().default(false),
2431
+ instructions: z12.string().max(2e3).nullable().default(null)
2432
+ });
2433
+ var HostNavigateResult = z12.object({
2434
+ items: z12.array(TranscriptItem),
2435
+ prefill: z12.string().nullable()
2436
+ });
2437
+ var NavigateResult = z12.object({
2438
+ prefill: z12.string().nullable(),
2439
+ epoch: z12.number().int()
2440
+ });
2441
+ var BranchResult = z12.object({
2860
2442
  session: Session.nullable(),
2861
- prefill: z15.string().nullable()
2443
+ prefill: z12.string().nullable()
2862
2444
  });
2863
- var SessionExportResult = z15.object({ fileName: z15.string(), content: z15.string() });
2864
- var CommandViewAction = z15.object({
2865
- label: z15.string().min(1).max(80),
2866
- command: z15.string().startsWith("/").max(500),
2867
- tone: z15.enum(["default", "primary", "danger"]).optional()
2445
+ var SessionExportResult = z12.object({ fileName: z12.string(), content: z12.string() });
2446
+ var CommandViewAction = z12.object({
2447
+ label: z12.string().min(1).max(80),
2448
+ command: z12.string().startsWith("/").max(500),
2449
+ tone: z12.enum(["default", "primary", "danger"]).optional()
2868
2450
  });
2869
- var CommandView = z15.object({
2870
- title: z15.string().min(1).max(200),
2451
+ var CommandView = z12.object({
2452
+ title: z12.string().min(1).max(200),
2871
2453
  body: UINodeSchema,
2872
- actions: z15.array(CommandViewAction).max(30).default([])
2454
+ actions: z12.array(CommandViewAction).max(30).default([])
2873
2455
  });
2874
- var ModelStateResult = z15.object({
2456
+ var ModelStateResult = z12.object({
2875
2457
  model: SessionModel.nullable(),
2876
2458
  thinking: ThinkingLevel.nullable()
2877
2459
  });
2878
- var ImportSessionRequest = z15.object({
2879
- hostId: z15.string(),
2880
- sessionFile: z15.string(),
2881
- projectId: z15.string().nullable().optional()
2460
+ var ImportSessionRequest = z12.object({
2461
+ hostId: z12.string(),
2462
+ sessionFile: z12.string(),
2463
+ projectId: z12.string().nullable().optional()
2882
2464
  });
2883
- var AnswerRequest = z15.object({
2884
- revision: z15.number().int(),
2465
+ var AnswerRequest = z12.object({
2466
+ revision: z12.number().int(),
2885
2467
  response: InteractionResponseSchema
2886
2468
  });
2887
- var AdapterActionRequest = z15.object({
2888
- generation: z15.string().uuid().optional(),
2889
- adapterId: z15.string(),
2890
- actionId: z15.string(),
2891
- payload: z15.unknown().optional()
2892
- });
2893
- var TaskPolicyPatch = z15.object({
2894
- hostId: z15.string().nullable().optional(),
2895
- profileId: z15.string().nullable().optional(),
2896
- workspace: z15.object({
2897
- mode: z15.enum(["new_worktree", "existing"]).optional(),
2898
- branch: z15.string().nullable().optional(),
2899
- base: z15.string().nullable().optional(),
2900
- workspaceId: z15.string().optional()
2469
+ var AdapterActionRequest = z12.object({
2470
+ generation: z12.string().uuid().optional(),
2471
+ adapterId: z12.string(),
2472
+ actionId: z12.string(),
2473
+ payload: z12.unknown().optional()
2474
+ });
2475
+ var TaskPolicyPatch = z12.object({
2476
+ hostId: z12.string().nullable().optional(),
2477
+ profileId: z12.string().nullable().optional(),
2478
+ workspace: z12.object({
2479
+ mode: z12.enum(["new_worktree", "existing"]).optional(),
2480
+ branch: z12.string().nullable().optional(),
2481
+ base: z12.string().nullable().optional(),
2482
+ workspaceId: z12.string().optional()
2901
2483
  }).optional(),
2902
- continuation: z15.object({
2903
- enabled: z15.boolean().optional(),
2904
- objective: z15.string().min(1).optional(),
2905
- maxContinuations: z15.number().int().min(1).max(50).optional(),
2906
- maxElapsedMinutes: z15.number().int().min(1).max(1440).optional(),
2907
- maxTokens: z15.number().int().positive().nullable().optional(),
2908
- maxCostUsd: z15.number().positive().nullable().optional()
2484
+ continuation: z12.object({
2485
+ enabled: z12.boolean().optional(),
2486
+ objective: z12.string().min(1).optional(),
2487
+ maxContinuations: z12.number().int().min(1).max(50).optional(),
2488
+ maxElapsedMinutes: z12.number().int().min(1).max(1440).optional(),
2489
+ maxTokens: z12.number().int().positive().nullable().optional(),
2490
+ maxCostUsd: z12.number().positive().nullable().optional()
2909
2491
  }).optional(),
2910
2492
  completion: CompletionPolicy.partial().optional()
2911
2493
  });
2912
- var CreateTaskRequest = z15.object({
2913
- projectId: z15.string(),
2914
- title: z15.string().max(300).optional(),
2494
+ var CreateTaskRequest = z12.object({
2495
+ projectId: z12.string(),
2496
+ title: z12.string().max(300).optional(),
2915
2497
  githubIssueUrl: GitHubIssueUrl.optional(),
2916
- githubIssue: z15.never().optional(),
2917
- launchPrompt: z15.never().optional(),
2918
- objective: z15.string().default(""),
2919
- acceptanceCriteria: z15.array(z15.string()).default([]),
2920
- dependencies: z15.array(z15.string()).default([]),
2921
- parentTaskId: z15.string().nullable().optional(),
2498
+ githubIssue: z12.never().optional(),
2499
+ launchPrompt: z12.never().optional(),
2500
+ objective: z12.string().default(""),
2501
+ acceptanceCriteria: z12.array(z12.string()).default([]),
2502
+ dependencies: z12.array(z12.string()).default([]),
2503
+ parentTaskId: z12.string().nullable().optional(),
2922
2504
  priority: Priority.default(2),
2923
- state: z15.enum(["backlog", "ready"]).default("backlog"),
2924
- notBefore: z15.string().nullable().optional(),
2505
+ state: z12.enum(["backlog", "ready"]).default("backlog"),
2506
+ notBefore: z12.string().nullable().optional(),
2925
2507
  policy: TaskPolicyPatch.optional()
2926
2508
  }).superRefine((v, ctx) => {
2927
2509
  if (v.githubIssueUrl === void 0) {
@@ -2959,32 +2541,32 @@ var CreateTaskRequest = z15.object({
2959
2541
  const issue = githubIssueFromUrl(v.githubIssueUrl);
2960
2542
  return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
2961
2543
  });
2962
- var UpdateTaskRequest = z15.object({
2963
- githubIssueUrl: z15.never().optional(),
2964
- githubIssue: z15.never().optional(),
2965
- launchPrompt: z15.never().optional(),
2966
- title: z15.string().min(1).max(300).optional(),
2967
- objective: z15.string().optional(),
2968
- acceptanceCriteria: z15.array(z15.string()).optional(),
2969
- dependencies: z15.array(z15.string()).optional(),
2970
- parentTaskId: z15.string().nullable().optional(),
2544
+ var UpdateTaskRequest = z12.object({
2545
+ githubIssueUrl: z12.never().optional(),
2546
+ githubIssue: z12.never().optional(),
2547
+ launchPrompt: z12.never().optional(),
2548
+ title: z12.string().min(1).max(300).optional(),
2549
+ objective: z12.string().optional(),
2550
+ acceptanceCriteria: z12.array(z12.string()).optional(),
2551
+ dependencies: z12.array(z12.string()).optional(),
2552
+ parentTaskId: z12.string().nullable().optional(),
2971
2553
  priority: Priority.optional(),
2972
- position: z15.number().optional(),
2973
- notBefore: z15.string().nullable().optional(),
2554
+ position: z12.number().optional(),
2555
+ notBefore: z12.string().nullable().optional(),
2974
2556
  policy: TaskPolicyPatch.optional()
2975
2557
  });
2976
- var MoveTaskRequest = z15.object({
2558
+ var MoveTaskRequest = z12.object({
2977
2559
  to: TaskState,
2978
- confirm: z15.boolean().optional(),
2979
- onRunning: z15.enum(["pause", "stop"]).optional(),
2980
- position: z15.number().optional()
2981
- });
2982
- var RequestChangesRequest = z15.object({ feedback: z15.array(z15.string().min(1)).min(1) });
2983
- var Eligibility = z15.union([
2984
- z15.object({ eligible: z15.literal(true), hostId: z15.string(), hostName: z15.string() }),
2985
- z15.object({
2986
- eligible: z15.literal(false),
2987
- wait: z15.enum([
2560
+ confirm: z12.boolean().optional(),
2561
+ onRunning: z12.enum(["pause", "stop"]).optional(),
2562
+ position: z12.number().optional()
2563
+ });
2564
+ var RequestChangesRequest = z12.object({ feedback: z12.array(z12.string().min(1)).min(1) });
2565
+ var Eligibility = z12.union([
2566
+ z12.object({ eligible: z12.literal(true), hostId: z12.string(), hostName: z12.string() }),
2567
+ z12.object({
2568
+ eligible: z12.literal(false),
2569
+ wait: z12.enum([
2988
2570
  "dependency",
2989
2571
  "host_offline",
2990
2572
  "project_limit",
@@ -2997,157 +2579,157 @@ var Eligibility = z15.union([
2997
2579
  "already_dispatched",
2998
2580
  "retry_backoff"
2999
2581
  ]),
3000
- message: z15.string()
2582
+ message: z12.string()
3001
2583
  })
3002
2584
  ]);
3003
- var NowResponse = z15.object({
3004
- running: z15.array(z15.object({ taskId: z15.string(), runId: z15.string(), sessionId: z15.string().nullable() })),
3005
- queued: z15.array(z15.object({ taskId: z15.string(), eligibility: Eligibility })),
3006
- dispatchPaused: z15.boolean()
3007
- });
3008
- var AutomationInput = z15.object({
3009
- name: z15.string().min(1),
3010
- enabled: z15.boolean().default(true),
3011
- projectId: z15.string(),
2585
+ var NowResponse = z12.object({
2586
+ running: z12.array(z12.object({ taskId: z12.string(), runId: z12.string(), sessionId: z12.string().nullable() })),
2587
+ queued: z12.array(z12.object({ taskId: z12.string(), eligibility: Eligibility })),
2588
+ dispatchPaused: z12.boolean()
2589
+ });
2590
+ var AutomationInput = z12.object({
2591
+ name: z12.string().min(1),
2592
+ enabled: z12.boolean().default(true),
2593
+ projectId: z12.string(),
3012
2594
  trigger: Trigger,
3013
- filters: z15.array(z15.object({ path: z15.string(), equals: z15.string() })).default([]),
2595
+ filters: z12.array(z12.object({ path: z12.string(), equals: z12.string() })).default([]),
3014
2596
  template: TaskTemplate,
3015
- hostId: z15.string().nullable().default(null),
3016
- profileId: z15.string().nullable().default(null),
3017
- mode: z15.enum(["fresh", "continue", "watch"]).default("fresh"),
3018
- groupingKey: z15.string().nullable().default(null),
3019
- overlap: z15.enum(["skip", "queue_one", "append"]).default("skip"),
3020
- missed: z15.enum(["skip", "run_once"]).default("skip"),
2597
+ hostId: z12.string().nullable().default(null),
2598
+ profileId: z12.string().nullable().default(null),
2599
+ mode: z12.enum(["fresh", "continue", "watch"]).default("fresh"),
2600
+ groupingKey: z12.string().nullable().default(null),
2601
+ overlap: z12.enum(["skip", "queue_one", "append"]).default("skip"),
2602
+ missed: z12.enum(["skip", "run_once"]).default("skip"),
3021
2603
  continuation: ContinuationPolicy.default({ enabled: false }),
3022
2604
  completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
3023
2605
  });
3024
- var AutomationView = Automation.extend({ summary: z15.string() });
3025
- var AutomationPreview = z15.object({
3026
- summary: z15.string(),
2606
+ var AutomationView = Automation.extend({ summary: z12.string() });
2607
+ var AutomationPreview = z12.object({
2608
+ summary: z12.string(),
3027
2609
  task: TaskTemplate,
3028
- next: z15.array(z15.string())
3029
- });
3030
- var WebhookTokenResponse = z15.object({ token: z15.string(), url: z15.string() });
3031
- var PushSubscriptionRequest = z15.object({
3032
- endpoint: z15.string().url(),
3033
- keys: z15.object({ p256dh: z15.string(), auth: z15.string() }),
3034
- permission: z15.enum(["granted", "denied", "default", "unknown"]).default("granted")
3035
- });
3036
- var NotificationSettings = z15.object({
3037
- quietHours: z15.object({
3038
- start: z15.string().regex(/^\d{2}:\d{2}$/),
3039
- end: z15.string().regex(/^\d{2}:\d{2}$/),
3040
- timezone: z15.string()
2610
+ next: z12.array(z12.string())
2611
+ });
2612
+ var WebhookTokenResponse = z12.object({ token: z12.string(), url: z12.string() });
2613
+ var PushSubscriptionRequest = z12.object({
2614
+ endpoint: z12.string().url(),
2615
+ keys: z12.object({ p256dh: z12.string(), auth: z12.string() }),
2616
+ permission: z12.enum(["granted", "denied", "default", "unknown"]).default("granted")
2617
+ });
2618
+ var NotificationSettings = z12.object({
2619
+ quietHours: z12.object({
2620
+ start: z12.string().regex(/^\d{2}:\d{2}$/),
2621
+ end: z12.string().regex(/^\d{2}:\d{2}$/),
2622
+ timezone: z12.string()
3041
2623
  }).nullable(),
3042
- privatePreviews: z15.boolean(),
3043
- preferredDeviceId: z15.string().nullable()
3044
- });
3045
- var PushPayload = z15.union([
3046
- z15.object({
3047
- type: z15.literal("show"),
3048
- title: z15.string(),
3049
- body: z15.string(),
3050
- tag: z15.string(),
3051
- url: z15.string(),
3052
- renotify: z15.boolean()
2624
+ privatePreviews: z12.boolean(),
2625
+ preferredDeviceId: z12.string().nullable()
2626
+ });
2627
+ var PushPayload = z12.union([
2628
+ z12.object({
2629
+ type: z12.literal("show"),
2630
+ title: z12.string(),
2631
+ body: z12.string(),
2632
+ tag: z12.string(),
2633
+ url: z12.string(),
2634
+ renotify: z12.boolean()
3053
2635
  }),
3054
- z15.object({ type: z15.literal("clear"), tag: z15.string() })
2636
+ z12.object({ type: z12.literal("clear"), tag: z12.string() })
3055
2637
  ]);
3056
- var SetupState = z15.object({
3057
- passkey: z15.object({
3058
- available: z15.boolean(),
3059
- registered: z15.boolean(),
3060
- reason: z15.string().nullable()
2638
+ var SetupState = z12.object({
2639
+ passkey: z12.object({
2640
+ available: z12.boolean(),
2641
+ registered: z12.boolean(),
2642
+ reason: z12.string().nullable()
3061
2643
  }),
3062
- oidc: z15.object({ label: z15.string() }).nullable()
2644
+ oidc: z12.object({ label: z12.string() }).nullable()
3063
2645
  });
3064
- var PasskeyRegisterOptionsResponse = z15.object({
3065
- challengeId: z15.string(),
3066
- options: z15.unknown()
2646
+ var PasskeyRegisterOptionsResponse = z12.object({
2647
+ challengeId: z12.string(),
2648
+ options: z12.unknown()
3067
2649
  });
3068
- var PasskeyRegisterVerifyRequest = z15.object({
3069
- challengeId: z15.string(),
3070
- name: z15.string().min(1).max(80),
3071
- response: z15.unknown()
2650
+ var PasskeyRegisterVerifyRequest = z12.object({
2651
+ challengeId: z12.string(),
2652
+ name: z12.string().min(1).max(80),
2653
+ response: z12.unknown()
3072
2654
  });
3073
- var PasskeySignInOptionsResponse = z15.object({
3074
- challengeId: z15.string(),
3075
- options: z15.unknown()
2655
+ var PasskeySignInOptionsResponse = z12.object({
2656
+ challengeId: z12.string(),
2657
+ options: z12.unknown()
3076
2658
  });
3077
- var PasskeySignInVerifyRequest = z15.object({
3078
- challengeId: z15.string(),
3079
- response: z15.unknown(),
3080
- deviceName: z15.string().min(1).max(80),
2659
+ var PasskeySignInVerifyRequest = z12.object({
2660
+ challengeId: z12.string(),
2661
+ response: z12.unknown(),
2662
+ deviceName: z12.string().min(1).max(80),
3081
2663
  kind: DeviceKind.extract(["browser", "pwa"])
3082
2664
  });
3083
- var OidcBeginRequest = z15.object({
3084
- deviceName: z15.string().min(1).max(80),
2665
+ var OidcBeginRequest = z12.object({
2666
+ deviceName: z12.string().min(1).max(80),
3085
2667
  kind: DeviceKind.extract(["browser", "pwa"]),
3086
- next: z15.string().default("/"),
3087
- handoff: z15.boolean().default(false)
3088
- });
3089
- var OidcBeginResponse = z15.object({
3090
- authorizeUrl: z15.string(),
3091
- flowId: z15.string().nullable(),
3092
- pollToken: z15.string().nullable()
3093
- });
3094
- var OidcClaimRequest = z15.object({ flowId: z15.string(), pollToken: z15.string() });
3095
- var OidcClaimResponse = z15.union([
3096
- z15.object({ status: z15.literal("pending") }),
3097
- z15.object({ status: z15.literal("done"), deviceId: z15.string() })
2668
+ next: z12.string().default("/"),
2669
+ handoff: z12.boolean().default(false)
2670
+ });
2671
+ var OidcBeginResponse = z12.object({
2672
+ authorizeUrl: z12.string(),
2673
+ flowId: z12.string().nullable(),
2674
+ pollToken: z12.string().nullable()
2675
+ });
2676
+ var OidcClaimRequest = z12.object({ flowId: z12.string(), pollToken: z12.string() });
2677
+ var OidcClaimResponse = z12.union([
2678
+ z12.object({ status: z12.literal("pending") }),
2679
+ z12.object({ status: z12.literal("done"), deviceId: z12.string() })
3098
2680
  ]);
3099
- var TerminalLoginStartRequest = z15.object({ name: z15.string().min(1).max(80) });
3100
- var TerminalLoginStartResponse = z15.object({
3101
- userCode: z15.string(),
3102
- pollToken: z15.string(),
3103
- verifyUrl: z15.string(),
3104
- expiresAt: z15.string(),
3105
- intervalMs: z15.number().int()
3106
- });
3107
- var TerminalLoginClaimRequest = z15.object({
3108
- userCode: z15.string().min(1),
3109
- pollToken: z15.string().min(1)
3110
- });
3111
- var TerminalLoginClaimResponse = z15.union([
3112
- z15.object({ status: z15.literal("pending") }),
3113
- z15.object({ status: z15.literal("denied") }),
3114
- z15.object({ status: z15.literal("done"), deviceId: z15.string(), credential: z15.string() })
2681
+ var TerminalLoginStartRequest = z12.object({ name: z12.string().min(1).max(80) });
2682
+ var TerminalLoginStartResponse = z12.object({
2683
+ userCode: z12.string(),
2684
+ pollToken: z12.string(),
2685
+ verifyUrl: z12.string(),
2686
+ expiresAt: z12.string(),
2687
+ intervalMs: z12.number().int()
2688
+ });
2689
+ var TerminalLoginClaimRequest = z12.object({
2690
+ userCode: z12.string().min(1),
2691
+ pollToken: z12.string().min(1)
2692
+ });
2693
+ var TerminalLoginClaimResponse = z12.union([
2694
+ z12.object({ status: z12.literal("pending") }),
2695
+ z12.object({ status: z12.literal("denied") }),
2696
+ z12.object({ status: z12.literal("done"), deviceId: z12.string(), credential: z12.string() })
3115
2697
  ]);
3116
- var TerminalLoginRequest = z15.object({
3117
- userCode: z15.string(),
3118
- name: z15.string(),
3119
- requestedFrom: z15.string(),
3120
- createdAt: z15.string(),
3121
- expiresAt: z15.string(),
3122
- status: z15.enum(["pending", "approved", "denied"])
3123
- });
3124
- var AuthMethods = z15.object({
3125
- passkeys: z15.array(Passkey),
3126
- passkeyAvailability: z15.object({ available: z15.boolean(), reason: z15.string().nullable() }),
3127
- oidc: z15.object({
3128
- issuer: z15.string(),
3129
- label: z15.string(),
3130
- ownerMatch: z15.string(),
3131
- status: z15.enum(["ready", "error"]),
3132
- error: z15.string().nullable()
2698
+ var TerminalLoginRequest = z12.object({
2699
+ userCode: z12.string(),
2700
+ name: z12.string(),
2701
+ requestedFrom: z12.string(),
2702
+ createdAt: z12.string(),
2703
+ expiresAt: z12.string(),
2704
+ status: z12.enum(["pending", "approved", "denied"])
2705
+ });
2706
+ var AuthMethods = z12.object({
2707
+ passkeys: z12.array(Passkey),
2708
+ passkeyAvailability: z12.object({ available: z12.boolean(), reason: z12.string().nullable() }),
2709
+ oidc: z12.object({
2710
+ issuer: z12.string(),
2711
+ label: z12.string(),
2712
+ ownerMatch: z12.string(),
2713
+ status: z12.enum(["ready", "error"]),
2714
+ error: z12.string().nullable()
3133
2715
  }).nullable()
3134
2716
  });
3135
- var MeResponse = z15.object({
2717
+ var MeResponse = z12.object({
3136
2718
  device: Device,
3137
- admin: z15.boolean(),
3138
- publicUrl: z15.string()
2719
+ admin: z12.boolean(),
2720
+ publicUrl: z12.string()
3139
2721
  });
3140
- var ClientBindingInput = z15.object({ mirror: ClientMirror, scopeId: z15.string().min(1).nullable().optional() }).refine((b) => b.mirror === "scope" === !!b.scopeId, {
2722
+ var ClientBindingInput = z12.object({ mirror: ClientMirror, scopeId: z12.string().min(1).nullable().optional() }).refine((b) => b.mirror === "scope" === !!b.scopeId, {
3141
2723
  message: "scopeId is required for mirror=scope and only then"
3142
2724
  });
3143
2725
  var ClientReport = Client.pick({ kind: true, name: true, machine: true }).extend({
3144
- hostId: z15.string().nullable().optional(),
2726
+ hostId: z12.string().nullable().optional(),
3145
2727
  /** Sessions in its mirror tabs or windows; omitted when unchanged or unknown. */
3146
- shows: z15.array(z15.string()).max(1e3).optional(),
2728
+ shows: z12.array(z12.string()).max(1e3).optional(),
3147
2729
  /** The binding this client had before bindings were recorded (env file); applied only when none is recorded. */
3148
2730
  seed: ClientBindingInput.optional()
3149
2731
  });
3150
- var ScopeInput = z15.object({
2732
+ var ScopeInput = z12.object({
3151
2733
  name: Scope.shape.name,
3152
2734
  mode: Scope.shape.mode.optional(),
3153
2735
  projectIds: Scope.shape.projectIds.optional(),
@@ -3155,7 +2737,7 @@ var ScopeInput = z15.object({
3155
2737
  /** A GitHub source makes this a GitHub scope; its projects are then kept by GitHub. */
3156
2738
  source: GitHubSourceInput.nullable().optional()
3157
2739
  });
3158
- var ScopePatch = z15.object({
2740
+ var ScopePatch = z12.object({
3159
2741
  name: Scope.shape.name.optional(),
3160
2742
  mode: Scope.shape.mode.optional(),
3161
2743
  projectIds: Scope.shape.projectIds.optional(),
@@ -3163,49 +2745,181 @@ var ScopePatch = z15.object({
3163
2745
  /** null removes the source; an object changes it, or adds one (then hostId and owner are required). */
3164
2746
  source: GitHubSourcePatch.nullable().optional()
3165
2747
  });
3166
- var ProjectSuggestionsResponse = z15.object({
3167
- suggestions: z15.array(ProjectSuggestion.extend({ name: z15.string(), preselected: z15.boolean() }))
3168
- });
3169
2748
 
3170
2749
  // packages/protocol/dist/scopes.js
3171
2750
  var CLIENT_OPEN_MS = 10 * 6e4;
3172
2751
 
2752
+ // packages/protocol/dist/catalog.js
2753
+ import { z as z13 } from "zod";
2754
+ var CatalogRepository = z13.strictObject({
2755
+ authority: z13.string().min(1),
2756
+ externalId: z13.string().min(1),
2757
+ owner: z13.string().min(1),
2758
+ name: z13.string().min(1),
2759
+ webUrl: z13.url({ protocol: /^https$/ }),
2760
+ cloneUrl: z13.url({ protocol: /^https$/ }),
2761
+ defaultBranch: z13.string().nullable()
2762
+ });
2763
+ var CatalogAccountType = z13.enum(["personal", "organization"]);
2764
+ var CatalogConnectionKind = z13.enum(["github_app", "pat"]);
2765
+ var CatalogSelection = z13.strictObject({
2766
+ owners: z13.array(z13.string().min(1).max(39)).max(50),
2767
+ repositories: z13.array(z13.string().min(1).max(140)).max(500)
2768
+ });
2769
+ var CatalogConnectionStatus = z13.object({
2770
+ id: z13.string(),
2771
+ kind: CatalogConnectionKind.default("github_app"),
2772
+ authority: z13.string().min(1).default("github.com"),
2773
+ account: z13.string(),
2774
+ accountType: CatalogAccountType,
2775
+ state: z13.enum(["pending", "ready", "stale", "suspended", "removed", "disconnected"]),
2776
+ lastSyncedAt: z13.string().nullable(),
2777
+ lastError: z13.string().nullable(),
2778
+ installUrl: z13.string().nullable(),
2779
+ manageUrl: z13.string().nullable(),
2780
+ selection: CatalogSelection.nullable().optional()
2781
+ });
2782
+ var CatalogAvailableOwner = z13.object({
2783
+ login: z13.string(),
2784
+ type: CatalogAccountType
2785
+ });
2786
+ var CatalogAvailableInventory = z13.object({
2787
+ account: z13.string(),
2788
+ owners: z13.array(CatalogAvailableOwner),
2789
+ repositories: z13.array(CatalogRepository)
2790
+ });
2791
+ var ConnectPatRequest = z13.strictObject({
2792
+ token: z13.string().trim().min(10).max(512),
2793
+ selection: CatalogSelection.optional()
2794
+ });
2795
+ var UpdateCatalogSelectionRequest = z13.strictObject({
2796
+ selection: CatalogSelection
2797
+ });
2798
+ var CheckoutPreviewRequest = z13.strictObject({
2799
+ hostId: z13.string().min(1),
2800
+ folderName: z13.string().min(1).max(128).optional()
2801
+ });
2802
+ var CheckoutProvisionRequest = z13.strictObject({ previewId: z13.string().min(1).max(128) });
2803
+
3173
2804
  // packages/protocol/dist/client-wire.js
3174
- import { z as z16 } from "zod";
3175
- var SyncState = z16.object({
3176
- hosts: z16.array(Host),
3177
- projects: z16.array(Project),
3178
- checkouts: z16.array(Checkout),
3179
- workspaces: z16.array(Workspace),
3180
- profiles: z16.array(Profile),
2805
+ import { z as z15 } from "zod";
2806
+
2807
+ // packages/protocol/dist/events.js
2808
+ import { z as z14 } from "zod";
2809
+ var EventDataSchemas = {
2810
+ "host.updated": Host,
2811
+ "project.updated": Project,
2812
+ "project.deleted": z14.object({ id: z14.string() }),
2813
+ "checkout.updated": Checkout,
2814
+ "workspace.updated": Workspace,
2815
+ "workspace.deleted": z14.object({ id: z14.string() }),
2816
+ "profile.updated": Profile,
2817
+ "profile.deleted": z14.object({ id: z14.string() }),
2818
+ "scope.updated": Scope,
2819
+ "scope.deleted": z14.object({ id: z14.string() }),
2820
+ "session.updated": Session,
2821
+ "transcript.item": TranscriptItem,
2822
+ "transcript.reset": z14.object({ sessionId: z14.string(), epoch: z14.number().int() }),
2823
+ "interaction.updated": Interaction,
2824
+ "panel.updated": Panel,
2825
+ "adapters.updated": z14.object({ hostId: z14.string(), adapters: z14.array(AdapterInfo) }),
2826
+ diagnostic: Diagnostic,
2827
+ "task.updated": Task,
2828
+ "task.deleted": z14.object({ id: z14.string() }),
2829
+ "run.updated": Run,
2830
+ "automation.updated": Automation,
2831
+ "automation.deleted": z14.object({ id: z14.string() }),
2832
+ "occurrence.created": Occurrence,
2833
+ "occurrence.updated": Occurrence,
2834
+ "attention.updated": AttentionItem,
2835
+ "device.updated": Device,
2836
+ "issue.updated": TrackedIssue,
2837
+ "issue.deleted": z14.object({ id: z14.string() }),
2838
+ "client.updated": Client,
2839
+ "client.deleted": z14.object({ id: z14.string() }),
2840
+ "settings.updated": z14.object({ dispatchPaused: z14.boolean() })
2841
+ };
2842
+ var EVENT_TYPES = Object.keys(EventDataSchemas);
2843
+ var LEGACY_EVENT_TYPES = {
2844
+ "workspace.removed": "workspace.deleted"
2845
+ };
2846
+ function canonicalEventType(type) {
2847
+ return LEGACY_EVENT_TYPES[type] ?? type;
2848
+ }
2849
+ var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
2850
+ var EventTypeSchema = z14.preprocess(canonical, z14.enum(EVENT_TYPES));
2851
+ var EventScope = z14.object({
2852
+ hostId: z14.string().optional(),
2853
+ sessionId: z14.string().optional(),
2854
+ taskId: z14.string().optional(),
2855
+ projectId: z14.string().optional()
2856
+ });
2857
+ var EventEnvelope = EventScope.extend({
2858
+ seq: z14.number().int(),
2859
+ id: z14.string(),
2860
+ type: EventTypeSchema,
2861
+ at: z14.string(),
2862
+ data: z14.unknown()
2863
+ });
2864
+ var HOST_EVENT_TYPES = [
2865
+ "session.updated",
2866
+ "transcript.item",
2867
+ "interaction.updated",
2868
+ "panel.updated",
2869
+ "adapters.updated",
2870
+ "diagnostic",
2871
+ "workspace.updated",
2872
+ "workspace.deleted"
2873
+ ];
2874
+ var HostEvent = EventScope.extend({
2875
+ eventId: z14.string(),
2876
+ type: z14.preprocess(canonical, z14.enum(HOST_EVENT_TYPES)),
2877
+ at: z14.string(),
2878
+ data: z14.unknown()
2879
+ });
2880
+ var StreamDelta = z14.object({
2881
+ sessionId: z14.string(),
2882
+ itemId: z14.string(),
2883
+ kind: z14.enum(["text", "thinking", "tool_args", "tool_output"]),
2884
+ delta: z14.string(),
2885
+ order: z14.number().int().optional()
2886
+ });
2887
+
2888
+ // packages/protocol/dist/client-wire.js
2889
+ var SyncState = z15.object({
2890
+ hosts: z15.array(Host),
2891
+ projects: z15.array(Project),
2892
+ checkouts: z15.array(Checkout),
2893
+ workspaces: z15.array(Workspace),
2894
+ profiles: z15.array(Profile),
3181
2895
  /** Scopes; absent from coordinators before 0.21. */
3182
- scopes: z16.array(Scope).default([]),
3183
- sessions: z16.array(Session),
3184
- tasks: z16.array(Task),
3185
- runs: z16.array(Run),
3186
- automations: z16.array(Automation),
3187
- attention: z16.array(AttentionItem),
3188
- interactions: z16.array(Interaction),
3189
- panels: z16.array(Panel),
3190
- devices: z16.array(Device),
2896
+ scopes: z15.array(Scope).default([]),
2897
+ sessions: z15.array(Session),
2898
+ tasks: z15.array(Task),
2899
+ runs: z15.array(Run),
2900
+ automations: z15.array(Automation),
2901
+ attention: z15.array(AttentionItem),
2902
+ interactions: z15.array(Interaction),
2903
+ panels: z15.array(Panel),
2904
+ devices: z15.array(Device),
3191
2905
  /** Tracked issues; absent from older coordinators. */
3192
- issues: z16.array(TrackedIssue).default([]),
2906
+ issues: z15.array(TrackedIssue).default([]),
3193
2907
  /** Clients (herdr and tmux sessions); absent from coordinators before 0.21. */
3194
- clients: z16.array(Client).default([]),
3195
- adapters: z16.record(z16.string(), z16.array(AdapterInfo)),
3196
- dispatchPaused: z16.boolean()
3197
- });
3198
- var Presence = z16.object({
3199
- foreground: z16.boolean(),
3200
- interactedAt: z16.string().nullable(),
3201
- viewing: z16.object({ sessionId: z16.string() }).nullable(),
2908
+ clients: z15.array(Client).default([]),
2909
+ adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
2910
+ dispatchPaused: z15.boolean()
2911
+ });
2912
+ var Presence = z15.object({
2913
+ foreground: z15.boolean(),
2914
+ interactedAt: z15.string().nullable(),
2915
+ viewing: z15.object({ sessionId: z15.string() }).nullable(),
3202
2916
  /**
3203
2917
  * A herdr or tmux daemon reporting the session focused in its client (kept apart from the
3204
2918
  * device's own presence).
3205
2919
  */
3206
- clientId: z16.string().min(1).max(200).optional(),
2920
+ clientId: z15.string().min(1).max(200).optional(),
3207
2921
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of clientId. */
3208
- terminalId: z16.string().min(1).max(200).optional()
2922
+ terminalId: z15.string().min(1).max(200).optional()
3209
2923
  });
3210
2924
  var CLIENT_CAPABILITIES = [
3211
2925
  "adapter.slots.v1",
@@ -3218,35 +2932,432 @@ var CLIENT_CAPABILITIES = [
3218
2932
  /** The client draws `composer.tracker` and `session.badge` contributions. */
3219
2933
  "adapter.trackers.v1"
3220
2934
  ];
3221
- var ClientToServer = z16.discriminatedUnion("type", [
3222
- z16.object({
3223
- type: z16.literal("hello"),
3224
- cursor: z16.number().int().nullable(),
3225
- capabilities: z16.array(z16.string().min(1).max(80)).max(32).optional(),
3226
- projectionId: z16.string().max(256).nullable().optional()
2935
+ var ClientToServer = z15.discriminatedUnion("type", [
2936
+ z15.object({
2937
+ type: z15.literal("hello"),
2938
+ cursor: z15.number().int().nullable(),
2939
+ capabilities: z15.array(z15.string().min(1).max(80)).max(32).optional(),
2940
+ projectionId: z15.string().max(256).nullable().optional()
3227
2941
  }),
3228
- z16.object({ type: z16.literal("presence"), presence: Presence }),
3229
- z16.object({ type: z16.literal("ping") })
2942
+ z15.object({ type: z15.literal("presence"), presence: Presence }),
2943
+ z15.object({ type: z15.literal("ping") })
3230
2944
  ]);
3231
- var ServerToClient = z16.discriminatedUnion("type", [
3232
- z16.object({
3233
- type: z16.literal("replay"),
3234
- seq: z16.number().int(),
3235
- events: z16.array(EventEnvelope),
3236
- capabilities: z16.array(z16.enum(CLIENT_CAPABILITIES)).optional(),
3237
- projectionId: z16.string().optional()
2945
+ var ServerToClient = z15.discriminatedUnion("type", [
2946
+ z15.object({
2947
+ type: z15.literal("replay"),
2948
+ seq: z15.number().int(),
2949
+ events: z15.array(EventEnvelope),
2950
+ capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
2951
+ projectionId: z15.string().optional()
3238
2952
  }),
3239
- z16.object({
3240
- type: z16.literal("snapshot"),
3241
- seq: z16.number().int(),
2953
+ z15.object({
2954
+ type: z15.literal("snapshot"),
2955
+ seq: z15.number().int(),
3242
2956
  state: SyncState,
3243
- capabilities: z16.array(z16.enum(CLIENT_CAPABILITIES)).optional(),
3244
- projectionId: z16.string().optional()
2957
+ capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
2958
+ projectionId: z15.string().optional()
3245
2959
  }),
3246
- z16.object({ type: z16.literal("event"), event: EventEnvelope }),
3247
- z16.object({ type: z16.literal("stream"), delta: StreamDelta }),
3248
- z16.object({ type: z16.literal("pong") }),
3249
- z16.object({ type: z16.literal("force_logout"), reason: z16.string() })
2960
+ z15.object({ type: z15.literal("event"), event: EventEnvelope }),
2961
+ z15.object({ type: z15.literal("stream"), delta: StreamDelta }),
2962
+ z15.object({ type: z15.literal("pong") }),
2963
+ z15.object({ type: z15.literal("force_logout"), reason: z15.string() })
2964
+ ]);
2965
+
2966
+ // packages/protocol/dist/host-wire.js
2967
+ import { z as z17 } from "zod";
2968
+
2969
+ // packages/protocol/dist/terminal-wire.js
2970
+ import { z as z16 } from "zod";
2971
+ var Cols = z16.number().int().min(10).max(1e3);
2972
+ var Rows = z16.number().int().min(5).max(500);
2973
+ var TermViewerToServer = z16.discriminatedUnion("t", [
2974
+ z16.object({ t: z16.literal("in"), d: z16.string() }),
2975
+ z16.object({ t: z16.literal("resize"), cols: Cols, rows: Rows }),
2976
+ z16.object({ t: z16.literal("claim") })
2977
+ ]);
2978
+ var TermServerToViewer = z16.discriminatedUnion("t", [
2979
+ z16.object({ t: z16.literal("out"), d: z16.string() }),
2980
+ z16.object({ t: z16.literal("closed"), reason: z16.string() }),
2981
+ z16.object({ t: z16.literal("size"), cols: Cols, rows: Rows, owner: z16.boolean() })
2982
+ ]);
2983
+ var TermCoordinatorMsg = z16.discriminatedUnion("t", [
2984
+ z16.object({
2985
+ t: z16.literal("open"),
2986
+ sessionId: z16.string(),
2987
+ cols: Cols,
2988
+ rows: Rows,
2989
+ passive: z16.boolean().optional()
2990
+ }),
2991
+ z16.object({ t: z16.literal("claim") }),
2992
+ z16.object({ t: z16.literal("in"), d: z16.string() }),
2993
+ z16.object({ t: z16.literal("resize"), cols: Cols, rows: Rows }),
2994
+ z16.object({ t: z16.literal("close") })
2995
+ ]);
2996
+
2997
+ // packages/protocol/dist/host-wire.js
2998
+ var Origin = z17.enum(["human", "automation"]);
2999
+ var DiffRev = z17.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
3000
+ var HostCommand = z17.discriminatedUnion("type", [
3001
+ z17.object({
3002
+ type: z17.literal("session.start"),
3003
+ sessionId: z17.string(),
3004
+ title: z17.string(),
3005
+ workspacePath: z17.string(),
3006
+ projectId: z17.string().nullable(),
3007
+ profile: Profile,
3008
+ nativeHandle: NativeHandle.nullable(),
3009
+ initialPrompt: z17.string().nullable(),
3010
+ dispatchKey: z17.string().nullable(),
3011
+ controlRevision: z17.number().int(),
3012
+ controlMode: ControlMode,
3013
+ origin: Origin,
3014
+ readOnly: z17.boolean().default(false),
3015
+ policyRequired: z17.boolean().optional()
3016
+ }),
3017
+ z17.object({
3018
+ type: z17.literal("session.deliverMessage"),
3019
+ sessionId: z17.string(),
3020
+ messageId: z17.string(),
3021
+ payload: z17.object({
3022
+ deliveryId: z17.string(),
3023
+ kind: z17.enum(["message", "completion"]),
3024
+ text: z17.string()
3025
+ }),
3026
+ mode: z17.enum(["steer", "queue"]),
3027
+ holdUntil: z17.string()
3028
+ }),
3029
+ HostPolicySampleRequest.extend({ type: z17.literal("session.classifyPolicySample") }),
3030
+ z17.object({
3031
+ type: z17.literal("session.messageStatus"),
3032
+ sessionId: z17.string(),
3033
+ messageIds: z17.array(z17.string().min(1)).min(1).max(100)
3034
+ }),
3035
+ z17.object({
3036
+ type: z17.literal("session.prompt"),
3037
+ sessionId: z17.string(),
3038
+ text: z17.string(),
3039
+ images: z17.array(z17.object({ mimeType: z17.string(), data: z17.string() })).default([]),
3040
+ mode: z17.enum(["prompt", "steer", "followUp"]),
3041
+ origin: Origin,
3042
+ controlRevision: z17.number().int()
3043
+ }),
3044
+ z17.object({ type: z17.literal("session.abort"), sessionId: z17.string(), clearQueue: z17.boolean() }),
3045
+ /** `queueClear.v1`: empty Pi's queue without aborting; the receipt's result has the messages. */
3046
+ z17.object({ type: z17.literal("session.clearQueue"), sessionId: z17.string() }),
3047
+ z17.object({ type: z17.literal("session.stop"), sessionId: z17.string() }),
3048
+ z17.object({
3049
+ type: z17.literal("session.answer"),
3050
+ sessionId: z17.string(),
3051
+ interactionId: z17.string(),
3052
+ revision: z17.number().int(),
3053
+ response: InteractionResponseSchema,
3054
+ deviceId: z17.string()
3055
+ }),
3056
+ z17.object({
3057
+ type: z17.literal("session.adapterAction"),
3058
+ sessionId: z17.string(),
3059
+ generation: z17.string().uuid().optional(),
3060
+ adapterId: z17.string(),
3061
+ actionId: z17.string(),
3062
+ payload: z17.unknown()
3063
+ }),
3064
+ z17.object({
3065
+ type: z17.literal("session.setControl"),
3066
+ sessionId: z17.string(),
3067
+ controlRevision: z17.number().int(),
3068
+ mode: ControlMode
3069
+ }),
3070
+ z17.object({ type: z17.literal("session.rename"), sessionId: z17.string(), title: z17.string() }),
3071
+ z17.object({ type: z17.literal("session.importable") }),
3072
+ z17.object({ type: z17.literal("session.readNative"), sessionFile: z17.string() }),
3073
+ z17.object({ type: z17.literal("session.snapshot"), sessionId: z17.string() }),
3074
+ z17.object({ type: z17.literal("session.models"), sessionId: z17.string() }),
3075
+ z17.object({ type: z17.literal("session.commands"), sessionId: z17.string() }),
3076
+ z17.object({
3077
+ type: z17.literal("session.complete"),
3078
+ sessionId: z17.string(),
3079
+ text: z17.string().max(500)
3080
+ }),
3081
+ z17.object({ type: z17.literal("session.tree"), sessionId: z17.string() }),
3082
+ z17.object({
3083
+ type: z17.literal("session.branch"),
3084
+ sessionId: z17.string(),
3085
+ entryId: z17.string().nullable(),
3086
+ fork: z17.boolean()
3087
+ }),
3088
+ z17.object({
3089
+ type: z17.literal("session.navigate"),
3090
+ sessionId: z17.string(),
3091
+ entryId: z17.string(),
3092
+ summarize: z17.boolean(),
3093
+ instructions: z17.string().max(2e3).nullable()
3094
+ }),
3095
+ z17.object({ type: z17.literal("session.reload"), sessionId: z17.string() }),
3096
+ z17.object({ type: z17.literal("session.adapters"), sessionId: z17.string() }),
3097
+ z17.object({ type: z17.literal("session.reloadAdapters"), sessionId: z17.string() }),
3098
+ z17.object({ type: z17.literal("session.export"), sessionId: z17.string() }),
3099
+ z17.object({
3100
+ type: z17.literal("session.setModel"),
3101
+ sessionId: z17.string(),
3102
+ provider: z17.string().min(1),
3103
+ modelId: z17.string().min(1)
3104
+ }),
3105
+ z17.object({ type: z17.literal("session.setThinking"), sessionId: z17.string(), level: ThinkingLevel }),
3106
+ z17.object({
3107
+ type: z17.literal("session.compact"),
3108
+ sessionId: z17.string(),
3109
+ instructions: z17.string().nullable()
3110
+ }),
3111
+ z17.object({ type: z17.literal("checkout.inspect"), path: z17.string() }),
3112
+ z17.strictObject({
3113
+ type: z17.literal("checkout.preview"),
3114
+ root: z17.string().min(1).max(4096),
3115
+ folderName: z17.string().min(1).max(128)
3116
+ }),
3117
+ z17.strictObject({
3118
+ type: z17.literal("checkout.provision"),
3119
+ root: z17.string().min(1).max(4096),
3120
+ folderName: z17.string().min(1).max(128),
3121
+ expectedPath: z17.string().min(1).max(4096),
3122
+ cloneUrl: z17.string().min(1).max(4096),
3123
+ /** Only carried by a confirmed live command. Never persist or replay this payload. */
3124
+ grant: z17.strictObject({
3125
+ token: z17.string().min(1).max(4096).refine((token) => !/[^!-~]/.test(token)),
3126
+ expiresAt: z17.iso.datetime({ offset: true })
3127
+ })
3128
+ }),
3129
+ z17.strictObject({ type: z17.literal("checkout.locate"), cwd: z17.string().min(1).max(4096) }),
3130
+ z17.object({
3131
+ type: z17.literal("workspace.discover"),
3132
+ checkoutPath: z17.string(),
3133
+ worktreeDir: z17.string().default(DEFAULT_WORKTREE_DIR)
3134
+ }),
3135
+ z17.object({
3136
+ type: z17.literal("workspace.create"),
3137
+ checkoutPath: z17.string(),
3138
+ branch: z17.string(),
3139
+ base: z17.string(),
3140
+ setupCommand: z17.string().nullable(),
3141
+ worktreeDir: z17.string().default(DEFAULT_WORKTREE_DIR)
3142
+ }),
3143
+ z17.object({ type: z17.literal("workspace.status"), path: z17.string(), base: z17.string().nullable() }),
3144
+ z17.object({
3145
+ type: z17.literal("workspace.remove"),
3146
+ path: z17.string(),
3147
+ checkoutPath: z17.string(),
3148
+ base: z17.string().nullable(),
3149
+ force: z17.object({ dirty: z17.boolean(), unmerged: z17.boolean() }),
3150
+ /** Also delete the worktree's local branch (hosts before GitHub issue sync ignore it). */
3151
+ deleteBranch: z17.boolean().optional()
3152
+ }),
3153
+ z17.object({
3154
+ type: z17.literal("workspace.diff"),
3155
+ path: z17.string(),
3156
+ base: z17.string().nullable(),
3157
+ file: z17.string().nullable(),
3158
+ /** Hosts without gitLog.v1 never receive it. */
3159
+ rev: DiffRev.optional()
3160
+ }),
3161
+ z17.object({
3162
+ type: z17.literal("workspace.log"),
3163
+ path: z17.string(),
3164
+ base: z17.string().nullable(),
3165
+ limit: z17.number().int().min(1).max(200)
3166
+ }),
3167
+ z17.object({ type: z17.literal("workspace.files"), path: z17.string(), dir: z17.string() }),
3168
+ z17.object({ type: z17.literal("workspace.readFile"), path: z17.string(), file: z17.string() }),
3169
+ IssueHostPrepareBranchRequest.extend({ type: z17.literal("tracker.prepareBranch") }),
3170
+ z17.object({
3171
+ type: z17.literal("dispatch.start"),
3172
+ dispatchKey: z17.string(),
3173
+ runId: z17.string(),
3174
+ taskId: z17.string(),
3175
+ sessionId: z17.string(),
3176
+ projectId: z17.string(),
3177
+ title: z17.string(),
3178
+ workspace: z17.union([
3179
+ z17.object({ path: z17.string() }),
3180
+ z17.object({
3181
+ createFrom: z17.object({
3182
+ checkoutPath: z17.string(),
3183
+ branch: z17.string(),
3184
+ base: z17.string(),
3185
+ setupCommand: z17.string().nullable(),
3186
+ worktreeDir: z17.string().default(DEFAULT_WORKTREE_DIR)
3187
+ })
3188
+ })
3189
+ ]),
3190
+ nativeHandle: NativeHandle.nullable(),
3191
+ profile: Profile,
3192
+ prompt: z17.string(),
3193
+ /** The launch's own revision; a takeover always carries a newer one. */
3194
+ controlRevision: z17.number().int(),
3195
+ controlMode: ControlMode.default("automation"),
3196
+ policyRequired: z17.boolean().optional()
3197
+ }),
3198
+ z17.object({ type: z17.literal("dispatch.reconcile"), dispatchKey: z17.string() }),
3199
+ z17.object({
3200
+ type: z17.literal("checks.run"),
3201
+ sessionId: z17.string(),
3202
+ path: z17.string(),
3203
+ commands: z17.array(z17.string())
3204
+ })
3205
+ ]);
3206
+ var ImportableSession = z17.object({
3207
+ sessionFile: z17.string(),
3208
+ sessionId: z17.string(),
3209
+ cwd: z17.string(),
3210
+ name: z17.string().nullable(),
3211
+ mtime: z17.string(),
3212
+ inactive: z17.boolean()
3213
+ });
3214
+ var DiscoveredWorktree = z17.object({
3215
+ path: z17.string(),
3216
+ head: z17.string().nullable(),
3217
+ branch: z17.string().nullable(),
3218
+ bare: z17.boolean(),
3219
+ detached: z17.boolean(),
3220
+ locked: z17.boolean(),
3221
+ prunable: z17.boolean(),
3222
+ provenance: z17.enum(["managed", "discovered", "main"]),
3223
+ git: GitState.nullable()
3224
+ });
3225
+ var CheckoutInfo = z17.object({
3226
+ root: z17.string(),
3227
+ commonDir: z17.string(),
3228
+ repoIdentity: z17.string(),
3229
+ defaultBranch: z17.string()
3230
+ });
3231
+ var CheckoutPreviewResult = z17.object({
3232
+ path: z17.string(),
3233
+ root: z17.string(),
3234
+ state: z17.enum(["missing", "existing", "collision"]),
3235
+ checkout: CheckoutInfo.optional()
3236
+ });
3237
+ var CheckoutLocateResult = z17.object({ checkout: CheckoutInfo, worktreePath: z17.string() }).nullable();
3238
+ var GitCommit = z17.object({
3239
+ sha: z17.string().regex(/^[0-9a-f]{40}$/),
3240
+ subject: z17.string().max(300),
3241
+ author: z17.string().max(200),
3242
+ authoredAt: z17.string(),
3243
+ pushed: z17.boolean()
3244
+ });
3245
+ var LogResult = z17.object({
3246
+ /** The base branch the commits are counted from. */
3247
+ base: z17.string(),
3248
+ /** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
3249
+ scope: z17.enum(["branch", "recent"]),
3250
+ commits: z17.array(GitCommit).max(200),
3251
+ truncated: z17.boolean(),
3252
+ /** Changed and untracked files not committed yet. */
3253
+ uncommitted: z17.number().int().min(0)
3254
+ });
3255
+ var DiffFile = z17.object({
3256
+ path: z17.string(),
3257
+ oldPath: z17.string().nullable(),
3258
+ added: z17.number().int(),
3259
+ deleted: z17.number().int(),
3260
+ status: z17.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
3261
+ });
3262
+ var DiffResult = z17.object({
3263
+ base: z17.string(),
3264
+ files: z17.array(DiffFile),
3265
+ patch: z17.string().nullable()
3266
+ });
3267
+ var FileEntry = z17.object({
3268
+ name: z17.string(),
3269
+ path: z17.string(),
3270
+ kind: z17.enum(["file", "dir", "symlink"]),
3271
+ size: z17.number().int().nullable()
3272
+ });
3273
+ var ReconcileResult = z17.union([
3274
+ z17.object({ known: z17.literal(false) }),
3275
+ z17.object({
3276
+ known: z17.literal(true),
3277
+ sessionId: z17.string().nullable(),
3278
+ state: z17.enum(["accepted", "workspace_ready", "started", "failed"]),
3279
+ runtime: RuntimeState.nullable(),
3280
+ workspacePath: z17.string().nullable(),
3281
+ nativeHandle: NativeHandle.nullable(),
3282
+ error: z17.string().nullable(),
3283
+ /** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
3284
+ errorDetails: z17.record(z17.string(), z17.unknown()).nullable().default(null)
3285
+ })
3286
+ ]);
3287
+ var DispatchStartResult = z17.object({
3288
+ sessionId: z17.string(),
3289
+ workspacePath: z17.string(),
3290
+ nativeHandle: NativeHandle.nullable(),
3291
+ reused: z17.boolean(),
3292
+ /** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
3293
+ promptError: z17.string().nullable().optional()
3294
+ });
3295
+ var AnswerResult = z17.object({
3296
+ status: z17.enum(["answered", "already_answered"]),
3297
+ interaction: Interaction
3298
+ });
3299
+ var SnapshotResult = z17.object({
3300
+ partial: z17.array(TranscriptItem),
3301
+ pendingInteractions: z17.array(Interaction)
3302
+ });
3303
+ var ChecksResult = z17.object({ results: z17.array(CheckResult) });
3304
+ var Receipt = z17.union([
3305
+ z17.object({ commandId: z17.string(), ok: z17.literal(true), result: z17.unknown() }),
3306
+ z17.object({ commandId: z17.string(), ok: z17.literal(false), error: ErrorBody })
3307
+ ]);
3308
+ var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
3309
+ policyContext: HostToolPolicyContext.optional()
3310
+ }).strict().superRefine((frame, ctx) => {
3311
+ if (frame.method === "policy.evaluate" ? frame.policyContext === void 0 : Object.hasOwn(frame, "policyContext")) {
3312
+ ctx.addIssue({
3313
+ code: "custom",
3314
+ path: ["policyContext"],
3315
+ message: "Host policy context is required only for policy.evaluate."
3316
+ });
3317
+ }
3318
+ try {
3319
+ if (new TextEncoder().encode(JSON.stringify(frame)).length <= AGENT_FRAME_MAX_BYTES)
3320
+ return;
3321
+ } catch {
3322
+ }
3323
+ ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
3324
+ });
3325
+ var HostToCoordinator = z17.discriminatedUnion("type", [
3326
+ z17.object({
3327
+ type: z17.literal("hello"),
3328
+ hostId: z17.string(),
3329
+ credential: z17.string(),
3330
+ name: z17.string(),
3331
+ agentVersion: z17.string(),
3332
+ piVersion: z17.string().nullable(),
3333
+ piCompatible: z17.boolean(),
3334
+ platform: Platform,
3335
+ capabilities: RuntimeCapabilities.nullable(),
3336
+ github: HostGitHub.optional(),
3337
+ protocolVersion: z17.number().int(),
3338
+ features: z17.array(z17.string()).optional()
3339
+ }),
3340
+ HostAgentRequestFrame,
3341
+ z17.object({ type: z17.literal("event"), hostSeq: z17.number().int(), event: HostEvent }),
3342
+ z17.object({ type: z17.literal("stream"), delta: StreamDelta }),
3343
+ z17.object({ type: z17.literal("receipt"), receipt: Receipt }),
3344
+ z17.object({ type: z17.literal("pong") }),
3345
+ z17.object({ type: z17.literal("usage"), usage: z17.array(ProviderUsage) }),
3346
+ z17.object({ type: z17.literal("term"), streamId: z17.string(), msg: TermServerToViewer })
3347
+ ]);
3348
+ var CoordinatorToHost = z17.discriminatedUnion("type", [
3349
+ z17.object({
3350
+ type: z17.literal("welcome"),
3351
+ coordinatorVersion: z17.string(),
3352
+ ackedHostSeq: z17.number().int(),
3353
+ features: z17.array(z17.string()).optional()
3354
+ }),
3355
+ AgentResultFrame,
3356
+ z17.object({ type: z17.literal("ack"), hostSeq: z17.number().int() }),
3357
+ z17.object({ type: z17.literal("command"), commandId: z17.string(), command: HostCommand }),
3358
+ z17.object({ type: z17.literal("ping") }),
3359
+ z17.object({ type: z17.literal("reject"), error: ErrorBody }),
3360
+ z17.object({ type: z17.literal("term"), streamId: z17.string(), msg: TermCoordinatorMsg })
3250
3361
  ]);
3251
3362
 
3252
3363
  // packages/protocol/dist/ids.js
@@ -3254,17 +3365,17 @@ import { monotonicFactory } from "ulid";
3254
3365
  var ulid = monotonicFactory();
3255
3366
 
3256
3367
  // packages/protocol/dist/web-bridge.js
3257
- import { z as z17 } from "zod";
3368
+ import { z as z18 } from "zod";
3258
3369
  var FRAME_MAX_HEIGHT = 4e3;
3259
- var FrameToParentMessageSchema = z17.discriminatedUnion("type", [
3260
- z17.object({
3261
- type: z17.literal("action"),
3262
- actionId: z17.string().min(1).max(200),
3263
- payload: z17.unknown().optional()
3370
+ var FrameToParentMessageSchema = z18.discriminatedUnion("type", [
3371
+ z18.object({
3372
+ type: z18.literal("action"),
3373
+ actionId: z18.string().min(1).max(200),
3374
+ payload: z18.unknown().optional()
3264
3375
  }),
3265
- z17.object({
3266
- type: z17.literal("resize"),
3267
- height: z17.number().finite().min(0).max(FRAME_MAX_HEIGHT)
3376
+ z18.object({
3377
+ type: z18.literal("resize"),
3378
+ height: z18.number().finite().min(0).max(FRAME_MAX_HEIGHT)
3268
3379
  })
3269
3380
  ]);
3270
3381