@spencerboucher/switchyard 0.24.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 (142) hide show
  1. package/README.md +1 -1
  2. package/dist/bridge/enroll.js +12 -3
  3. package/dist/catalog/worker.js +5913 -0
  4. package/dist/policies/worker.js +935 -950
  5. package/dist/switchyard.mjs +2413 -2484
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-I80YGJ3M.js +2 -0
  8. package/web-dist/assets/{AutomationView-BiSxKpgA.js.map → AutomationView-I80YGJ3M.js.map} +1 -1
  9. package/web-dist/assets/{Checkbox-CneW7ZHn.js → Checkbox-BdFQsqCG.js} +2 -2
  10. package/web-dist/assets/{Checkbox-CneW7ZHn.js.map → Checkbox-BdFQsqCG.js.map} +1 -1
  11. package/web-dist/assets/{DangerZone-tpxj5S8V.js → DangerZone-C6qU1pp7.js} +2 -2
  12. package/web-dist/assets/{DangerZone-tpxj5S8V.js.map → DangerZone-C6qU1pp7.js.map} +1 -1
  13. package/web-dist/assets/{Field-0rAadZ7B.js → Field-DGV7eljt.js} +2 -2
  14. package/web-dist/assets/{Field-0rAadZ7B.js.map → Field-DGV7eljt.js.map} +1 -1
  15. package/web-dist/assets/{NavigationEditor-DE3vVnHw.js → NavigationEditor-COtm2NQY.js} +2 -2
  16. package/web-dist/assets/{NavigationEditor-DE3vVnHw.js.map → NavigationEditor-COtm2NQY.js.map} +1 -1
  17. package/web-dist/assets/{Overlay-kkZVSidv.js → Overlay-hRkfpjK4.js} +2 -2
  18. package/web-dist/assets/{Overlay-kkZVSidv.js.map → Overlay-hRkfpjK4.js.map} +1 -1
  19. package/web-dist/assets/{Priority-VTOBYjs9.js → Priority-DL3f-tRD.js} +2 -2
  20. package/web-dist/assets/{Priority-VTOBYjs9.js.map → Priority-DL3f-tRD.js.map} +1 -1
  21. package/web-dist/assets/{RadioCards-Oy23yrpF.js → RadioCards-9YvqB3va.js} +2 -2
  22. package/web-dist/assets/{RadioCards-Oy23yrpF.js.map → RadioCards-9YvqB3va.js.map} +1 -1
  23. package/web-dist/assets/{ScopeRepository-BU9I7Gs_.js → ScopeRepository-BPiPUjHi.js} +3 -3
  24. package/web-dist/assets/{ScopeRepository-BU9I7Gs_.js.map → ScopeRepository-BPiPUjHi.js.map} +1 -1
  25. package/web-dist/assets/{ScopeSelect-7ZYRzci5.js → ScopeSelect-DmWCXeIf.js} +2 -2
  26. package/web-dist/assets/{ScopeSelect-7ZYRzci5.js.map → ScopeSelect-DmWCXeIf.js.map} +1 -1
  27. package/web-dist/assets/{SegmentedControl-CCObjCnv.js → SegmentedControl-CefWecy1.js} +2 -2
  28. package/web-dist/assets/{SegmentedControl-CCObjCnv.js.map → SegmentedControl-CefWecy1.js.map} +1 -1
  29. package/web-dist/assets/{Select-CRC4mF4U.js → Select-CdANXO3X.js} +2 -2
  30. package/web-dist/assets/{Select-CRC4mF4U.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-llihKH_2.js → Switch-DrrWalaQ.js} +2 -2
  34. package/web-dist/assets/{Switch-llihKH_2.js.map → Switch-DrrWalaQ.js.map} +1 -1
  35. package/web-dist/assets/{Tabs-CIolUgNo.js → Tabs-Cvyw8P4s.js} +4 -4
  36. package/web-dist/assets/{Tabs-CIolUgNo.js.map → Tabs-Cvyw8P4s.js.map} +1 -1
  37. package/web-dist/assets/TextLink-DMi_ZI43.js +2 -0
  38. package/web-dist/assets/{TextLink-BJlPjvKn.js.map → TextLink-DMi_ZI43.js.map} +1 -1
  39. package/web-dist/assets/{UINodeRenderer-DwZNt-8y.js → UINodeRenderer-CDPAUIOO.js} +2 -2
  40. package/web-dist/assets/{UINodeRenderer-DwZNt-8y.js.map → UINodeRenderer-CDPAUIOO.js.map} +1 -1
  41. package/web-dist/assets/{UnfilteredNote-B77oGOcW.js → UnfilteredNote-CgsOTad1.js} +2 -2
  42. package/web-dist/assets/{UnfilteredNote-B77oGOcW.js.map → UnfilteredNote-CgsOTad1.js.map} +1 -1
  43. package/web-dist/assets/{api-C7CMr6g-.js → api-Dlk6L3Cu.js} +2 -2
  44. package/web-dist/assets/{api-C7CMr6g-.js.map → api-Dlk6L3Cu.js.map} +1 -1
  45. package/web-dist/assets/{arrow-down-Bqx9CSB1.js → arrow-down-Cc6k_L7W.js} +2 -2
  46. package/web-dist/assets/{arrow-down-Bqx9CSB1.js.map → arrow-down-Cc6k_L7W.js.map} +1 -1
  47. package/web-dist/assets/{arrow-up-D0b2fv0Q.js → arrow-up-CW1a5Bhp.js} +2 -2
  48. package/web-dist/assets/{arrow-up-D0b2fv0Q.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-DMhF0I-p.js.map → attention-AZ2a-mzO.js.map} +1 -1
  51. package/web-dist/assets/{auth-vd8OFoQx.js → auth-Dzip9fVv.js} +2 -2
  52. package/web-dist/assets/{auth-vd8OFoQx.js.map → auth-Dzip9fVv.js.map} +1 -1
  53. package/web-dist/assets/{automations-Dz_JHvUj.js → automations-BYFgPSs2.js} +2 -2
  54. package/web-dist/assets/{automations-Dz_JHvUj.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-C5cMYlld.js → calendar-clock-CkYP2-Qf.js} +2 -2
  58. package/web-dist/assets/{calendar-clock-C5cMYlld.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-5ip-ZfOW.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-C_QgTrGe.js → core.esm-yL4bmFrt.js} +2 -2
  64. package/web-dist/assets/{core.esm-C_QgTrGe.js.map → core.esm-yL4bmFrt.js.map} +1 -1
  65. package/web-dist/assets/{describe-Bd1JbydU.js → describe-B1R7Rpb3.js} +3 -3
  66. package/web-dist/assets/{describe-Bd1JbydU.js.map → describe-B1R7Rpb3.js.map} +1 -1
  67. package/web-dist/assets/{enroll-B_ZjVnEj.js → enroll-BJIkw0lm.js} +2 -2
  68. package/web-dist/assets/{enroll-B_ZjVnEj.js.map → enroll-BJIkw0lm.js.map} +1 -1
  69. package/web-dist/assets/{external-link-DeLk0jmb.js → external-link-BHZxy4tb.js} +2 -2
  70. package/web-dist/assets/{external-link-DeLk0jmb.js.map → external-link-BHZxy4tb.js.map} +1 -1
  71. package/web-dist/assets/{git-branch-DuApoZes.js → git-branch-C5Xwi6aW.js} +2 -2
  72. package/web-dist/assets/{git-branch-DuApoZes.js.map → git-branch-C5Xwi6aW.js.map} +1 -1
  73. package/web-dist/assets/{grip-vertical-DfKSP8jp.js → grip-vertical-kzr2x5pf.js} +2 -2
  74. package/web-dist/assets/{grip-vertical-DfKSP8jp.js.map → grip-vertical-kzr2x5pf.js.map} +1 -1
  75. package/web-dist/assets/{hand-ryhCgGbh.js → hand-DStB4fR7.js} +2 -2
  76. package/web-dist/assets/{hand-ryhCgGbh.js.map → hand-DStB4fR7.js.map} +1 -1
  77. package/web-dist/assets/index-D3WBnjbc.js +17 -0
  78. package/web-dist/assets/{index-BXoBPAUR.js.map → index-D3WBnjbc.js.map} +1 -1
  79. package/web-dist/assets/{link-2-pHvZvxCs.js → link-2-Cny9mRKW.js} +2 -2
  80. package/web-dist/assets/{link-2-pHvZvxCs.js.map → link-2-Cny9mRKW.js.map} +1 -1
  81. package/web-dist/assets/{logic-3so3T0af.js → logic-BOdOYgZ4.js} +3 -3
  82. package/web-dist/assets/{logic-3so3T0af.js.map → logic-BOdOYgZ4.js.map} +1 -1
  83. package/web-dist/assets/{logic-uhnfzaYJ.js → logic-CHh1lc3G.js} +2 -2
  84. package/web-dist/assets/{logic-uhnfzaYJ.js.map → logic-CHh1lc3G.js.map} +1 -1
  85. package/web-dist/assets/{more-C41VHBVG.js → more-BrHzsSfh.js} +2 -2
  86. package/web-dist/assets/{more-C41VHBVG.js.map → more-BrHzsSfh.js.map} +1 -1
  87. package/web-dist/assets/{pencil-BoQa6LEV.js → pencil-BmHgPcCk.js} +2 -2
  88. package/web-dist/assets/{pencil-BoQa6LEV.js.map → pencil-BmHgPcCk.js.map} +1 -1
  89. package/web-dist/assets/{play-DjTVY8Ej.js → play-Dul6ZDzY.js} +2 -2
  90. package/web-dist/assets/{play-DjTVY8Ej.js.map → play-Dul6ZDzY.js.map} +1 -1
  91. package/web-dist/assets/{plus-BQPgQYui.js → plus-DzBRN9tc.js} +2 -2
  92. package/web-dist/assets/{plus-BQPgQYui.js.map → plus-DzBRN9tc.js.map} +1 -1
  93. package/web-dist/assets/{policyLogic-cyMrhCM6.js → policyLogic-DVorBdH6.js} +2 -2
  94. package/web-dist/assets/{policyLogic-cyMrhCM6.js.map → policyLogic-DVorBdH6.js.map} +1 -1
  95. package/web-dist/assets/{prefs-CkiUftvR.js → prefs-CUMuH2EM.js} +2 -2
  96. package/web-dist/assets/{prefs-CkiUftvR.js.map → prefs-CUMuH2EM.js.map} +1 -1
  97. package/web-dist/assets/preload-helper-vwPq19u5.js +9 -0
  98. package/web-dist/assets/preload-helper-vwPq19u5.js.map +1 -0
  99. package/web-dist/assets/queue-hRZWM_pM.js +2 -0
  100. package/web-dist/assets/{queue-CSCmR2Xf.js.map → queue-hRZWM_pM.js.map} +1 -1
  101. package/web-dist/assets/{rotate-ccw-C07CP9JG.js → rotate-ccw-ByDiAA6o.js} +2 -2
  102. package/web-dist/assets/{rotate-ccw-C07CP9JG.js.map → rotate-ccw-ByDiAA6o.js.map} +1 -1
  103. package/web-dist/assets/{search-bqDM8qB0.js → search-DarT116I.js} +2 -2
  104. package/web-dist/assets/{search-bqDM8qB0.js.map → search-DarT116I.js.map} +1 -1
  105. package/web-dist/assets/settings-DHfdrqxv.js +6 -0
  106. package/web-dist/assets/settings-DHfdrqxv.js.map +1 -0
  107. package/web-dist/assets/{states-goHGz_CJ.js → states-hcvSpyb1.js} +5 -5
  108. package/web-dist/assets/states-hcvSpyb1.js.map +1 -0
  109. package/web-dist/assets/{terminal-BFJK8pLS.js → terminal-BmpsRI95.js} +2 -2
  110. package/web-dist/assets/{terminal-BFJK8pLS.js.map → terminal-BmpsRI95.js.map} +1 -1
  111. package/web-dist/assets/{terminal-login-DwI8gUw-.js → terminal-login-COaZPzQx.js} +2 -2
  112. package/web-dist/assets/{terminal-login-DwI8gUw-.js.map → terminal-login-COaZPzQx.js.map} +1 -1
  113. package/web-dist/assets/{useBreakpoint-C7ONetzK.js → useBreakpoint-CXotoLeq.js} +2 -2
  114. package/web-dist/assets/{useBreakpoint-C7ONetzK.js.map → useBreakpoint-CXotoLeq.js.map} +1 -1
  115. package/web-dist/assets/{useNow-BFhACgmu.js → useNow-BweXkeWc.js} +2 -2
  116. package/web-dist/assets/{useNow-BFhACgmu.js.map → useNow-BweXkeWc.js.map} +1 -1
  117. package/web-dist/assets/{useResource-Br3v4Sui.js → useResource-DAMkbbuf.js} +2 -2
  118. package/web-dist/assets/{useResource-Br3v4Sui.js.map → useResource-DAMkbbuf.js.map} +1 -1
  119. package/web-dist/assets/{useSwipeTabs-_JvGirwa.js → useSwipeTabs-3qLCxSS7.js} +2 -2
  120. package/web-dist/assets/{useSwipeTabs-_JvGirwa.js.map → useSwipeTabs-3qLCxSS7.js.map} +1 -1
  121. package/web-dist/assets/workboard-BEcRsjyQ.js +3 -0
  122. package/web-dist/assets/{workboard-IozvaLbf.js.map → workboard-BEcRsjyQ.js.map} +1 -1
  123. package/web-dist/index.html +7 -7
  124. package/web-dist/sw.js +1 -1
  125. package/web-dist/assets/AutomationView-BiSxKpgA.js +0 -2
  126. package/web-dist/assets/StructuredValue-DdwqFsZd.js +0 -5
  127. package/web-dist/assets/StructuredValue-DdwqFsZd.js.map +0 -1
  128. package/web-dist/assets/TextLink-BJlPjvKn.js +0 -2
  129. package/web-dist/assets/attention-DMhF0I-p.js +0 -2
  130. package/web-dist/assets/board-CMfIsKrb.js +0 -6
  131. package/web-dist/assets/board-CMfIsKrb.js.map +0 -1
  132. package/web-dist/assets/chevron-right-5ip-ZfOW.js +0 -2
  133. package/web-dist/assets/code-BpPDYwth.js +0 -24
  134. package/web-dist/assets/code-BpPDYwth.js.map +0 -1
  135. package/web-dist/assets/index-BXoBPAUR.js +0 -17
  136. package/web-dist/assets/preload-helper-B_HW6k8N.js +0 -9
  137. package/web-dist/assets/preload-helper-B_HW6k8N.js.map +0 -1
  138. package/web-dist/assets/queue-CSCmR2Xf.js +0 -2
  139. package/web-dist/assets/settings-iTwK6CzQ.js +0 -6
  140. package/web-dist/assets/settings-iTwK6CzQ.js.map +0 -1
  141. package/web-dist/assets/states-goHGz_CJ.js.map +0 -1
  142. package/web-dist/assets/workboard-IozvaLbf.js +0 -3
@@ -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) => {
@@ -722,7 +735,7 @@ var GitHubSource = z5.object({
722
735
  /** Make a worktree for an issue branch that has none; absent means true. */
723
736
  worktrees: z5.boolean().optional(),
724
737
  enabled: z5.boolean(),
725
- /** The host's `gh` user, from the last sync. */
738
+ /** The connected GitHub account login, from the last sync. */
726
739
  login: z5.string().nullable(),
727
740
  lastSyncedAt: Iso.nullable(),
728
741
  lastError: z5.string().max(2e3).nullable()
@@ -2244,759 +2257,253 @@ var AgentResultFrame = z11.discriminatedUnion("ok", [
2244
2257
  ]);
2245
2258
 
2246
2259
  // packages/protocol/dist/api.js
2247
- import { z as z15 } from "zod";
2248
-
2249
- // packages/protocol/dist/host-wire.js
2250
- import { z as z14 } from "zod";
2251
-
2252
- // packages/protocol/dist/events.js
2253
2260
  import { z as z12 } from "zod";
2254
- var EventDataSchemas = {
2255
- "host.updated": Host,
2256
- "project.updated": Project,
2257
- "project.deleted": z12.object({ id: z12.string() }),
2258
- "checkout.updated": Checkout,
2259
- "workspace.updated": Workspace,
2260
- "workspace.deleted": z12.object({ id: z12.string() }),
2261
- "profile.updated": Profile,
2262
- "profile.deleted": z12.object({ id: z12.string() }),
2263
- "scope.updated": Scope,
2264
- "scope.deleted": z12.object({ id: z12.string() }),
2265
- "session.updated": Session,
2266
- "transcript.item": TranscriptItem,
2267
- "transcript.reset": z12.object({ sessionId: z12.string(), epoch: z12.number().int() }),
2268
- "interaction.updated": Interaction,
2269
- "panel.updated": Panel,
2270
- "adapters.updated": z12.object({ hostId: z12.string(), adapters: z12.array(AdapterInfo) }),
2271
- diagnostic: Diagnostic,
2272
- "task.updated": Task,
2273
- "task.deleted": z12.object({ id: z12.string() }),
2274
- "run.updated": Run,
2275
- "automation.updated": Automation,
2276
- "automation.deleted": z12.object({ id: z12.string() }),
2277
- "occurrence.created": Occurrence,
2278
- "occurrence.updated": Occurrence,
2279
- "attention.updated": AttentionItem,
2280
- "device.updated": Device,
2281
- "issue.updated": TrackedIssue,
2282
- "issue.deleted": z12.object({ id: z12.string() }),
2283
- "client.updated": Client,
2284
- "client.deleted": z12.object({ id: z12.string() }),
2285
- "settings.updated": z12.object({ dispatchPaused: z12.boolean() })
2286
- };
2287
- var EVENT_TYPES = Object.keys(EventDataSchemas);
2288
- var LEGACY_EVENT_TYPES = {
2289
- "workspace.removed": "workspace.deleted"
2290
- };
2291
- function canonicalEventType(type) {
2292
- return LEGACY_EVENT_TYPES[type] ?? type;
2293
- }
2294
- var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
2295
- var EventTypeSchema = z12.preprocess(canonical, z12.enum(EVENT_TYPES));
2296
- var EventScope = z12.object({
2297
- hostId: z12.string().optional(),
2298
- sessionId: z12.string().optional(),
2299
- taskId: z12.string().optional(),
2300
- projectId: z12.string().optional()
2301
- });
2302
- var EventEnvelope = EventScope.extend({
2303
- seq: z12.number().int(),
2304
- id: z12.string(),
2305
- type: EventTypeSchema,
2306
- at: z12.string(),
2307
- data: z12.unknown()
2308
- });
2309
- var HOST_EVENT_TYPES = [
2310
- "session.updated",
2311
- "transcript.item",
2312
- "interaction.updated",
2313
- "panel.updated",
2314
- "adapters.updated",
2315
- "diagnostic",
2316
- "workspace.updated",
2317
- "workspace.deleted"
2318
- ];
2319
- var HostEvent = EventScope.extend({
2320
- eventId: z12.string(),
2321
- type: z12.preprocess(canonical, z12.enum(HOST_EVENT_TYPES)),
2322
- at: z12.string(),
2323
- data: z12.unknown()
2324
- });
2325
- var StreamDelta = z12.object({
2326
- sessionId: z12.string(),
2327
- itemId: z12.string(),
2328
- kind: z12.enum(["text", "thinking", "tool_args", "tool_output"]),
2329
- delta: z12.string(),
2330
- order: z12.number().int().optional()
2331
- });
2332
-
2333
- // packages/protocol/dist/terminal-wire.js
2334
- import { z as z13 } from "zod";
2335
- var Cols = z13.number().int().min(10).max(1e3);
2336
- var Rows = z13.number().int().min(5).max(500);
2337
- var TermViewerToServer = z13.discriminatedUnion("t", [
2338
- z13.object({ t: z13.literal("in"), d: z13.string() }),
2339
- z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2340
- z13.object({ t: z13.literal("claim") })
2341
- ]);
2342
- var TermServerToViewer = z13.discriminatedUnion("t", [
2343
- z13.object({ t: z13.literal("out"), d: z13.string() }),
2344
- z13.object({ t: z13.literal("closed"), reason: z13.string() }),
2345
- z13.object({ t: z13.literal("size"), cols: Cols, rows: Rows, owner: z13.boolean() })
2346
- ]);
2347
- var TermCoordinatorMsg = z13.discriminatedUnion("t", [
2348
- z13.object({
2349
- t: z13.literal("open"),
2350
- sessionId: z13.string(),
2351
- cols: Cols,
2352
- rows: Rows,
2353
- passive: z13.boolean().optional()
2354
- }),
2355
- z13.object({ t: z13.literal("claim") }),
2356
- z13.object({ t: z13.literal("in"), d: z13.string() }),
2357
- z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2358
- z13.object({ t: z13.literal("close") })
2359
- ]);
2360
-
2361
- // packages/protocol/dist/host-wire.js
2362
- var Origin = z14.enum(["human", "automation"]);
2363
- var DiffRev = z14.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
2364
- var HostCommand = z14.discriminatedUnion("type", [
2365
- z14.object({
2366
- type: z14.literal("session.start"),
2367
- sessionId: z14.string(),
2368
- title: z14.string(),
2369
- workspacePath: z14.string(),
2370
- projectId: z14.string().nullable(),
2371
- profile: Profile,
2372
- nativeHandle: NativeHandle.nullable(),
2373
- initialPrompt: z14.string().nullable(),
2374
- dispatchKey: z14.string().nullable(),
2375
- controlRevision: z14.number().int(),
2376
- controlMode: ControlMode,
2377
- origin: Origin,
2378
- readOnly: z14.boolean().default(false),
2379
- policyRequired: z14.boolean().optional()
2380
- }),
2381
- z14.object({
2382
- type: z14.literal("session.deliverMessage"),
2383
- sessionId: z14.string(),
2384
- messageId: z14.string(),
2385
- payload: z14.object({
2386
- deliveryId: z14.string(),
2387
- kind: z14.enum(["message", "completion"]),
2388
- text: z14.string()
2389
- }),
2390
- mode: z14.enum(["steer", "queue"]),
2391
- holdUntil: z14.string()
2392
- }),
2393
- HostPolicySampleRequest.extend({ type: z14.literal("session.classifyPolicySample") }),
2394
- z14.object({
2395
- type: z14.literal("session.messageStatus"),
2396
- sessionId: z14.string(),
2397
- messageIds: z14.array(z14.string().min(1)).min(1).max(100)
2398
- }),
2399
- z14.object({
2400
- type: z14.literal("session.prompt"),
2401
- sessionId: z14.string(),
2402
- text: z14.string(),
2403
- images: z14.array(z14.object({ mimeType: z14.string(), data: z14.string() })).default([]),
2404
- mode: z14.enum(["prompt", "steer", "followUp"]),
2405
- origin: Origin,
2406
- controlRevision: z14.number().int()
2407
- }),
2408
- z14.object({ type: z14.literal("session.abort"), sessionId: z14.string(), clearQueue: z14.boolean() }),
2409
- /** `queueClear.v1`: empty Pi's queue without aborting; the receipt's result has the messages. */
2410
- z14.object({ type: z14.literal("session.clearQueue"), sessionId: z14.string() }),
2411
- z14.object({ type: z14.literal("session.stop"), sessionId: z14.string() }),
2412
- z14.object({
2413
- type: z14.literal("session.answer"),
2414
- sessionId: z14.string(),
2415
- interactionId: z14.string(),
2416
- revision: z14.number().int(),
2417
- response: InteractionResponseSchema,
2418
- deviceId: z14.string()
2419
- }),
2420
- z14.object({
2421
- type: z14.literal("session.adapterAction"),
2422
- sessionId: z14.string(),
2423
- generation: z14.string().uuid().optional(),
2424
- adapterId: z14.string(),
2425
- actionId: z14.string(),
2426
- payload: z14.unknown()
2427
- }),
2428
- z14.object({
2429
- type: z14.literal("session.setControl"),
2430
- sessionId: z14.string(),
2431
- controlRevision: z14.number().int(),
2432
- mode: ControlMode
2433
- }),
2434
- z14.object({ type: z14.literal("session.rename"), sessionId: z14.string(), title: z14.string() }),
2435
- z14.object({ type: z14.literal("session.importable") }),
2436
- z14.object({ type: z14.literal("session.readNative"), sessionFile: z14.string() }),
2437
- z14.object({ type: z14.literal("session.snapshot"), sessionId: z14.string() }),
2438
- z14.object({ type: z14.literal("session.models"), sessionId: z14.string() }),
2439
- z14.object({ type: z14.literal("session.commands"), sessionId: z14.string() }),
2440
- z14.object({
2441
- type: z14.literal("session.complete"),
2442
- sessionId: z14.string(),
2443
- text: z14.string().max(500)
2444
- }),
2445
- z14.object({ type: z14.literal("session.tree"), sessionId: z14.string() }),
2446
- z14.object({
2447
- type: z14.literal("session.branch"),
2448
- sessionId: z14.string(),
2449
- entryId: z14.string().nullable(),
2450
- fork: z14.boolean()
2451
- }),
2452
- z14.object({
2453
- type: z14.literal("session.navigate"),
2454
- sessionId: z14.string(),
2455
- entryId: z14.string(),
2456
- summarize: z14.boolean(),
2457
- instructions: z14.string().max(2e3).nullable()
2458
- }),
2459
- z14.object({ type: z14.literal("session.reload"), sessionId: z14.string() }),
2460
- z14.object({ type: z14.literal("session.adapters"), sessionId: z14.string() }),
2461
- z14.object({ type: z14.literal("session.reloadAdapters"), sessionId: z14.string() }),
2462
- z14.object({ type: z14.literal("session.export"), sessionId: z14.string() }),
2463
- z14.object({
2464
- type: z14.literal("session.setModel"),
2465
- sessionId: z14.string(),
2466
- provider: z14.string().min(1),
2467
- modelId: z14.string().min(1)
2468
- }),
2469
- z14.object({ type: z14.literal("session.setThinking"), sessionId: z14.string(), level: ThinkingLevel }),
2470
- z14.object({
2471
- type: z14.literal("session.compact"),
2472
- sessionId: z14.string(),
2473
- instructions: z14.string().nullable()
2474
- }),
2475
- z14.object({ type: z14.literal("checkout.inspect"), path: z14.string() }),
2476
- z14.strictObject({
2477
- type: z14.literal("checkout.preview"),
2478
- root: z14.string().min(1).max(4096),
2479
- folderName: z14.string().min(1).max(128)
2480
- }),
2481
- z14.strictObject({
2482
- type: z14.literal("checkout.provision"),
2483
- root: z14.string().min(1).max(4096),
2484
- folderName: z14.string().min(1).max(128),
2485
- expectedPath: z14.string().min(1).max(4096),
2486
- cloneUrl: z14.string().min(1).max(4096),
2487
- /** Only carried by a confirmed live command. Never persist or replay this payload. */
2488
- grant: z14.strictObject({
2489
- token: z14.string().min(1).max(4096).refine((token) => !/[^!-~]/.test(token)),
2490
- expiresAt: z14.iso.datetime({ offset: true })
2491
- })
2492
- }),
2493
- z14.strictObject({ type: z14.literal("checkout.locate"), cwd: z14.string().min(1).max(4096) }),
2494
- z14.object({ type: z14.literal("projects.scan"), folder: z14.string().min(1) }),
2495
- z14.object({
2496
- type: z14.literal("projects.suggest"),
2497
- days: z14.number().int().min(1).max(365).default(30)
2498
- }),
2499
- z14.object({
2500
- type: z14.literal("workspace.discover"),
2501
- checkoutPath: z14.string(),
2502
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2503
- }),
2504
- z14.object({
2505
- type: z14.literal("workspace.create"),
2506
- checkoutPath: z14.string(),
2507
- branch: z14.string(),
2508
- base: z14.string(),
2509
- setupCommand: z14.string().nullable(),
2510
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2511
- }),
2512
- z14.object({ type: z14.literal("workspace.status"), path: z14.string(), base: z14.string().nullable() }),
2513
- z14.object({
2514
- type: z14.literal("workspace.remove"),
2515
- path: z14.string(),
2516
- checkoutPath: z14.string(),
2517
- base: z14.string().nullable(),
2518
- force: z14.object({ dirty: z14.boolean(), unmerged: z14.boolean() }),
2519
- /** Also delete the worktree's local branch (hosts before GitHub issue sync ignore it). */
2520
- deleteBranch: z14.boolean().optional()
2521
- }),
2522
- z14.object({
2523
- type: z14.literal("workspace.diff"),
2524
- path: z14.string(),
2525
- base: z14.string().nullable(),
2526
- file: z14.string().nullable(),
2527
- /** Hosts without gitLog.v1 never receive it. */
2528
- rev: DiffRev.optional()
2529
- }),
2530
- z14.object({
2531
- type: z14.literal("workspace.log"),
2532
- path: z14.string(),
2533
- base: z14.string().nullable(),
2534
- limit: z14.number().int().min(1).max(200)
2535
- }),
2536
- z14.object({ type: z14.literal("workspace.files"), path: z14.string(), dir: z14.string() }),
2537
- z14.object({ type: z14.literal("workspace.readFile"), path: z14.string(), file: z14.string() }),
2538
- IssueHostPrepareBranchRequest.extend({ type: z14.literal("tracker.prepareBranch") }),
2539
- z14.object({
2540
- type: z14.literal("dispatch.start"),
2541
- dispatchKey: z14.string(),
2542
- runId: z14.string(),
2543
- taskId: z14.string(),
2544
- sessionId: z14.string(),
2545
- projectId: z14.string(),
2546
- title: z14.string(),
2547
- workspace: z14.union([
2548
- z14.object({ path: z14.string() }),
2549
- z14.object({
2550
- createFrom: z14.object({
2551
- checkoutPath: z14.string(),
2552
- branch: z14.string(),
2553
- base: z14.string(),
2554
- setupCommand: z14.string().nullable(),
2555
- worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2556
- })
2557
- })
2558
- ]),
2559
- nativeHandle: NativeHandle.nullable(),
2560
- profile: Profile,
2561
- prompt: z14.string(),
2562
- /** The launch's own revision; a takeover always carries a newer one. */
2563
- controlRevision: z14.number().int(),
2564
- controlMode: ControlMode.default("automation"),
2565
- policyRequired: z14.boolean().optional()
2566
- }),
2567
- z14.object({ type: z14.literal("dispatch.reconcile"), dispatchKey: z14.string() }),
2568
- z14.object({
2569
- type: z14.literal("checks.run"),
2570
- sessionId: z14.string(),
2571
- path: z14.string(),
2572
- commands: z14.array(z14.string())
2573
- })
2574
- ]);
2575
- var ImportableSession = z14.object({
2576
- sessionFile: z14.string(),
2577
- sessionId: z14.string(),
2578
- cwd: z14.string(),
2579
- name: z14.string().nullable(),
2580
- mtime: z14.string(),
2581
- inactive: z14.boolean()
2582
- });
2583
- var DiscoveredWorktree = z14.object({
2584
- path: z14.string(),
2585
- head: z14.string().nullable(),
2586
- branch: z14.string().nullable(),
2587
- bare: z14.boolean(),
2588
- detached: z14.boolean(),
2589
- locked: z14.boolean(),
2590
- prunable: z14.boolean(),
2591
- provenance: z14.enum(["managed", "discovered", "main"]),
2592
- git: GitState.nullable()
2593
- });
2594
- var CheckoutInfo = z14.object({
2595
- root: z14.string(),
2596
- commonDir: z14.string(),
2597
- repoIdentity: z14.string(),
2598
- defaultBranch: z14.string()
2599
- });
2600
- var CheckoutPreviewResult = z14.object({
2601
- path: z14.string(),
2602
- root: z14.string(),
2603
- state: z14.enum(["missing", "existing", "collision"]),
2604
- checkout: CheckoutInfo.optional()
2605
- });
2606
- var CheckoutLocateResult = z14.object({ checkout: CheckoutInfo, worktreePath: z14.string() }).nullable();
2607
- var ScannedRepository = CheckoutInfo.extend({ name: z14.string() });
2608
- var ProjectFolderScan = z14.object({
2609
- /** The folder, ~ expanded and realpath'd. */
2610
- folder: z14.string(),
2611
- repositories: z14.array(ScannedRepository)
2612
- });
2613
- var ProjectSuggestion = z14.object({
2614
- rootPath: z14.string(),
2615
- sessionCount: z14.number().int(),
2616
- lastActivityAt: z14.string()
2617
- });
2618
- var ProjectSuggestions = z14.object({ suggestions: z14.array(ProjectSuggestion) });
2619
- var GitCommit = z14.object({
2620
- sha: z14.string().regex(/^[0-9a-f]{40}$/),
2621
- subject: z14.string().max(300),
2622
- author: z14.string().max(200),
2623
- authoredAt: z14.string(),
2624
- pushed: z14.boolean()
2625
- });
2626
- var LogResult = z14.object({
2627
- /** The base branch the commits are counted from. */
2628
- base: z14.string(),
2629
- /** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
2630
- scope: z14.enum(["branch", "recent"]),
2631
- commits: z14.array(GitCommit).max(200),
2632
- truncated: z14.boolean(),
2633
- /** Changed and untracked files not committed yet. */
2634
- uncommitted: z14.number().int().min(0)
2635
- });
2636
- var DiffFile = z14.object({
2637
- path: z14.string(),
2638
- oldPath: z14.string().nullable(),
2639
- added: z14.number().int(),
2640
- deleted: z14.number().int(),
2641
- status: z14.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
2642
- });
2643
- var DiffResult = z14.object({
2644
- base: z14.string(),
2645
- files: z14.array(DiffFile),
2646
- patch: z14.string().nullable()
2647
- });
2648
- var FileEntry = z14.object({
2649
- name: z14.string(),
2650
- path: z14.string(),
2651
- kind: z14.enum(["file", "dir", "symlink"]),
2652
- size: z14.number().int().nullable()
2653
- });
2654
- var ReconcileResult = z14.union([
2655
- z14.object({ known: z14.literal(false) }),
2656
- z14.object({
2657
- known: z14.literal(true),
2658
- sessionId: z14.string().nullable(),
2659
- state: z14.enum(["accepted", "workspace_ready", "started", "failed"]),
2660
- runtime: RuntimeState.nullable(),
2661
- workspacePath: z14.string().nullable(),
2662
- nativeHandle: NativeHandle.nullable(),
2663
- error: z14.string().nullable(),
2664
- /** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
2665
- errorDetails: z14.record(z14.string(), z14.unknown()).nullable().default(null)
2666
- })
2667
- ]);
2668
- var DispatchStartResult = z14.object({
2669
- sessionId: z14.string(),
2670
- workspacePath: z14.string(),
2671
- nativeHandle: NativeHandle.nullable(),
2672
- reused: z14.boolean(),
2673
- /** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
2674
- promptError: z14.string().nullable().optional()
2675
- });
2676
- var AnswerResult = z14.object({
2677
- status: z14.enum(["answered", "already_answered"]),
2678
- interaction: Interaction
2679
- });
2680
- var SnapshotResult = z14.object({
2681
- partial: z14.array(TranscriptItem),
2682
- pendingInteractions: z14.array(Interaction)
2683
- });
2684
- var ChecksResult = z14.object({ results: z14.array(CheckResult) });
2685
- var Receipt = z14.union([
2686
- z14.object({ commandId: z14.string(), ok: z14.literal(true), result: z14.unknown() }),
2687
- z14.object({ commandId: z14.string(), ok: z14.literal(false), error: ErrorBody })
2688
- ]);
2689
- var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
2690
- policyContext: HostToolPolicyContext.optional()
2691
- }).strict().superRefine((frame, ctx) => {
2692
- if (frame.method === "policy.evaluate" ? frame.policyContext === void 0 : Object.hasOwn(frame, "policyContext")) {
2693
- ctx.addIssue({
2694
- code: "custom",
2695
- path: ["policyContext"],
2696
- message: "Host policy context is required only for policy.evaluate."
2697
- });
2698
- }
2699
- try {
2700
- if (new TextEncoder().encode(JSON.stringify(frame)).length <= AGENT_FRAME_MAX_BYTES)
2701
- return;
2702
- } catch {
2703
- }
2704
- ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
2705
- });
2706
- var HostToCoordinator = z14.discriminatedUnion("type", [
2707
- z14.object({
2708
- type: z14.literal("hello"),
2709
- hostId: z14.string(),
2710
- credential: z14.string(),
2711
- name: z14.string(),
2712
- agentVersion: z14.string(),
2713
- piVersion: z14.string().nullable(),
2714
- piCompatible: z14.boolean(),
2715
- platform: Platform,
2716
- capabilities: RuntimeCapabilities.nullable(),
2717
- github: HostGitHub.optional(),
2718
- protocolVersion: z14.number().int(),
2719
- features: z14.array(z14.string()).optional()
2720
- }),
2721
- HostAgentRequestFrame,
2722
- z14.object({ type: z14.literal("event"), hostSeq: z14.number().int(), event: HostEvent }),
2723
- z14.object({ type: z14.literal("stream"), delta: StreamDelta }),
2724
- z14.object({ type: z14.literal("receipt"), receipt: Receipt }),
2725
- z14.object({ type: z14.literal("pong") }),
2726
- z14.object({ type: z14.literal("usage"), usage: z14.array(ProviderUsage) }),
2727
- z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermServerToViewer })
2728
- ]);
2729
- var CoordinatorToHost = z14.discriminatedUnion("type", [
2730
- z14.object({
2731
- type: z14.literal("welcome"),
2732
- coordinatorVersion: z14.string(),
2733
- ackedHostSeq: z14.number().int(),
2734
- features: z14.array(z14.string()).optional()
2735
- }),
2736
- AgentResultFrame,
2737
- z14.object({ type: z14.literal("ack"), hostSeq: z14.number().int() }),
2738
- z14.object({ type: z14.literal("command"), commandId: z14.string(), command: HostCommand }),
2739
- z14.object({ type: z14.literal("ping") }),
2740
- z14.object({ type: z14.literal("reject"), error: ErrorBody }),
2741
- z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermCoordinatorMsg })
2742
- ]);
2743
-
2744
- // packages/protocol/dist/api.js
2745
- var EnrollRequest = z15.object({
2746
- token: z15.string().min(1),
2747
- 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),
2748
2264
  kind: DeviceKind
2749
2265
  });
2750
- var EnrollResponse = z15.object({ deviceId: z15.string(), credential: z15.string() });
2751
- var CreateEnrollmentRequest = z15.object({ kind: z15.enum(["device", "host"]) });
2752
- var CreateEnrollmentResponse = z15.object({
2753
- token: z15.string(),
2754
- url: z15.string(),
2755
- expiresAt: z15.string(),
2756
- qrSvg: z15.string(),
2757
- command: z15.string().nullable()
2758
- });
2759
- var HostEnrollRequest = z15.union([
2760
- z15.object({
2761
- token: z15.string().min(1),
2762
- 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),
2763
2279
  platform: Platform
2764
2280
  }),
2765
- z15.object({
2766
- secret: z15.string().min(1),
2767
- name: z15.string().min(1).max(80),
2281
+ z12.object({
2282
+ secret: z12.string().min(1),
2283
+ name: z12.string().min(1).max(80),
2768
2284
  platform: Platform
2769
2285
  })
2770
2286
  ]);
2771
- var HostEnrollResponse = z15.object({ hostId: z15.string(), credential: z15.string() });
2772
- var CreateProjectRequest = z15.object({
2773
- name: z15.string().min(1),
2774
- hostId: z15.string(),
2775
- path: z15.string().min(1),
2776
- defaultProfileId: z15.string().nullable().optional(),
2777
- setupCommand: z15.string().nullable().optional(),
2778
- checks: z15.array(z15.string()).optional(),
2779
- 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(),
2780
2296
  worktreeDir: WorktreeDir.optional()
2781
2297
  });
2782
- var UpdateProjectRequest = z15.object({
2783
- name: z15.string().min(1).optional(),
2784
- defaultProfileId: z15.string().nullable().optional(),
2785
- defaultHostId: z15.string().nullable().optional(),
2786
- maxConcurrentRuns: z15.number().int().min(1).max(32).optional(),
2787
- automationEnabled: z15.boolean().optional(),
2788
- setupCommand: z15.string().nullable().optional(),
2789
- checks: z15.array(z15.string()).optional(),
2790
- 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(),
2791
2307
  worktreeDir: WorktreeDir.optional(),
2792
- ensureSessions: z15.boolean().optional(),
2793
- removeLanded: z15.boolean().optional()
2308
+ ensureSessions: z12.boolean().optional(),
2309
+ removeLanded: z12.boolean().optional()
2794
2310
  });
2795
- 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) });
2796
2312
  function isProjectFolderPath(s) {
2797
2313
  if (s.includes("\0"))
2798
2314
  return false;
2799
2315
  return s === "~" || s.startsWith("~/") || s.startsWith("/");
2800
2316
  }
2801
- var ProjectFolder = z15.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
2802
- var UpdateHostRequest = z15.object({
2803
- projectFolders: z15.array(ProjectFolder).max(20).optional(),
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({
2804
2319
  checkoutRoot: ProjectFolder.nullable().optional()
2805
2320
  });
2806
- var ProjectScanResult = ProjectScan.extend({
2807
- added: z15.array(z15.object({
2808
- projectId: z15.string(),
2809
- name: z15.string(),
2810
- path: z15.string(),
2811
- newProject: z15.boolean()
2812
- }))
2813
- });
2814
- var ProfileInput = z15.object({
2815
- name: z15.string().min(1),
2816
- provider: z15.string().nullable().default(null),
2817
- model: z15.string().nullable().default(null),
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),
2818
2325
  thinking: ThinkingLevel.nullable().default(null),
2819
- projectTrust: z15.enum(["ask", "approve", "ignore"]).default("ask"),
2820
- extraArgs: z15.array(ExtraArg).default([]),
2821
- resources: z15.enum(["all", "vanilla"]).default("all")
2822
- });
2823
- var CreateWorkspaceRequest = z15.object({
2824
- checkoutId: z15.string(),
2825
- branch: z15.string().min(1),
2826
- base: z15.string().nullable().optional()
2827
- });
2828
- var RemoveWorkspaceRequest = z15.object({
2829
- force: z15.object({ dirty: z15.boolean(), unmerged: z15.boolean() }).default({ dirty: false, unmerged: false })
2830
- });
2831
- var CreateSessionRequest = z15.object({
2832
- projectId: z15.string(),
2833
- workspace: z15.union([
2834
- z15.object({ existingId: z15.string() }),
2835
- z15.object({
2836
- checkoutId: z15.string(),
2837
- newBranch: z15.string().min(1),
2838
- 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()
2839
2346
  })
2840
2347
  ]),
2841
- profileId: z15.string().nullable().optional(),
2842
- prompt: z15.string().default(""),
2843
- title: z15.string().optional(),
2844
- 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(),
2845
2352
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2846
- viewId: z15.string().optional()
2847
- });
2848
- var OpenBranchRequest = z15.object({
2849
- projectId: z15.string(),
2850
- branch: z15.string().min(1),
2851
- hostId: z15.string().optional(),
2852
- base: z15.string().nullable().optional(),
2853
- prompt: z15.string().default(""),
2854
- profileId: z15.string().nullable().optional(),
2855
- title: z15.string().optional(),
2856
- 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(),
2857
2364
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2858
- viewId: z15.string().optional(),
2365
+ viewId: z12.string().optional(),
2859
2366
  /** Start another session even when the branch has one. */
2860
- another: z15.boolean().default(false)
2861
- });
2862
- var OpenBranchResult = z15.object({ session: Session, created: z15.boolean() });
2863
- var SetPrimaryRequest = z15.object({ primary: z15.boolean() });
2864
- var PromptRequest = z15.object({
2865
- text: z15.string().min(1),
2866
- mode: z15.enum(["prompt", "steer", "followUp"]).default("prompt"),
2867
- images: z15.array(z15.object({ mimeType: z15.string(), data: z15.string() })).default([]),
2868
- clientMessageId: z15.string().optional()
2869
- });
2870
- var CacheAlertRequest = z15.object({
2871
- enabled: z15.boolean(),
2872
- ttlSec: z15.number().int().min(60).max(86400).nullable().default(null)
2873
- });
2874
- var RenameRequest = z15.object({ title: z15.string().min(1).max(200) });
2875
- var SetModelRequest = z15.object({
2876
- provider: z15.string().min(1),
2877
- modelId: z15.string().min(1)
2878
- });
2879
- var SetThinkingRequest = z15.object({ level: ThinkingLevel });
2880
- var CompactRequest = z15.object({ instructions: z15.string().max(4e3).optional() });
2881
- var SessionModelsResult = z15.object({ models: z15.array(SessionModel) });
2882
- var SessionCommandsResult = z15.object({ commands: z15.array(SlashCommand) });
2883
- var CompleteRequest = z15.object({ text: z15.string().min(1).max(500) });
2884
- var CompletionItem = z15.object({
2885
- value: z15.string(),
2886
- label: z15.string(),
2887
- description: z15.string().nullable()
2888
- });
2889
- var SessionCompleteResult = z15.object({
2890
- items: z15.array(CompletionItem).max(50),
2891
- prefix: z15.string()
2892
- });
2893
- var TreeRow = z15.object({
2894
- entryId: z15.string(),
2895
- parentId: z15.string().nullable(),
2896
- depth: z15.number().int(),
2897
- role: z15.enum(["user", "assistant"]),
2898
- text: z15.string(),
2899
- activeBranch: z15.boolean(),
2900
- leaf: z15.boolean(),
2901
- label: z15.string().nullable(),
2902
- at: z15.string().nullable()
2903
- });
2904
- var SessionTreeResult = z15.object({ rows: z15.array(TreeRow) });
2905
- var BranchRequest = z15.object({
2906
- entryId: z15.string().nullable(),
2907
- fork: z15.boolean().default(false)
2908
- });
2909
- var HostBranchResult = z15.object({
2910
- sessionFile: z15.string().nullable(),
2911
- prefill: z15.string().nullable()
2912
- });
2913
- var TranscriptPage = z15.object({
2914
- items: z15.array(TranscriptItem),
2915
- hasMore: z15.boolean(),
2916
- epoch: z15.number().int().optional(),
2917
- rev: z15.number().int().optional(),
2918
- delta: z15.boolean().optional(),
2919
- reset: z15.boolean().optional()
2920
- });
2921
- var NavigateRequest = z15.object({
2922
- entryId: z15.string().min(1),
2923
- summarize: z15.boolean().default(false),
2924
- instructions: z15.string().max(2e3).nullable().default(null)
2925
- });
2926
- var HostNavigateResult = z15.object({
2927
- items: z15.array(TranscriptItem),
2928
- prefill: z15.string().nullable()
2929
- });
2930
- var NavigateResult = z15.object({
2931
- prefill: z15.string().nullable(),
2932
- epoch: z15.number().int()
2933
- });
2934
- 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({
2935
2442
  session: Session.nullable(),
2936
- prefill: z15.string().nullable()
2443
+ prefill: z12.string().nullable()
2937
2444
  });
2938
- var SessionExportResult = z15.object({ fileName: z15.string(), content: z15.string() });
2939
- var CommandViewAction = z15.object({
2940
- label: z15.string().min(1).max(80),
2941
- command: z15.string().startsWith("/").max(500),
2942
- 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()
2943
2450
  });
2944
- var CommandView = z15.object({
2945
- title: z15.string().min(1).max(200),
2451
+ var CommandView = z12.object({
2452
+ title: z12.string().min(1).max(200),
2946
2453
  body: UINodeSchema,
2947
- actions: z15.array(CommandViewAction).max(30).default([])
2454
+ actions: z12.array(CommandViewAction).max(30).default([])
2948
2455
  });
2949
- var ModelStateResult = z15.object({
2456
+ var ModelStateResult = z12.object({
2950
2457
  model: SessionModel.nullable(),
2951
2458
  thinking: ThinkingLevel.nullable()
2952
2459
  });
2953
- var ImportSessionRequest = z15.object({
2954
- hostId: z15.string(),
2955
- sessionFile: z15.string(),
2956
- projectId: z15.string().nullable().optional()
2460
+ var ImportSessionRequest = z12.object({
2461
+ hostId: z12.string(),
2462
+ sessionFile: z12.string(),
2463
+ projectId: z12.string().nullable().optional()
2957
2464
  });
2958
- var AnswerRequest = z15.object({
2959
- revision: z15.number().int(),
2465
+ var AnswerRequest = z12.object({
2466
+ revision: z12.number().int(),
2960
2467
  response: InteractionResponseSchema
2961
2468
  });
2962
- var AdapterActionRequest = z15.object({
2963
- generation: z15.string().uuid().optional(),
2964
- adapterId: z15.string(),
2965
- actionId: z15.string(),
2966
- payload: z15.unknown().optional()
2967
- });
2968
- var TaskPolicyPatch = z15.object({
2969
- hostId: z15.string().nullable().optional(),
2970
- profileId: z15.string().nullable().optional(),
2971
- workspace: z15.object({
2972
- mode: z15.enum(["new_worktree", "existing"]).optional(),
2973
- branch: z15.string().nullable().optional(),
2974
- base: z15.string().nullable().optional(),
2975
- 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()
2976
2483
  }).optional(),
2977
- continuation: z15.object({
2978
- enabled: z15.boolean().optional(),
2979
- objective: z15.string().min(1).optional(),
2980
- maxContinuations: z15.number().int().min(1).max(50).optional(),
2981
- maxElapsedMinutes: z15.number().int().min(1).max(1440).optional(),
2982
- maxTokens: z15.number().int().positive().nullable().optional(),
2983
- 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()
2984
2491
  }).optional(),
2985
2492
  completion: CompletionPolicy.partial().optional()
2986
2493
  });
2987
- var CreateTaskRequest = z15.object({
2988
- projectId: z15.string(),
2989
- title: z15.string().max(300).optional(),
2494
+ var CreateTaskRequest = z12.object({
2495
+ projectId: z12.string(),
2496
+ title: z12.string().max(300).optional(),
2990
2497
  githubIssueUrl: GitHubIssueUrl.optional(),
2991
- githubIssue: z15.never().optional(),
2992
- launchPrompt: z15.never().optional(),
2993
- objective: z15.string().default(""),
2994
- acceptanceCriteria: z15.array(z15.string()).default([]),
2995
- dependencies: z15.array(z15.string()).default([]),
2996
- 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(),
2997
2504
  priority: Priority.default(2),
2998
- state: z15.enum(["backlog", "ready"]).default("backlog"),
2999
- notBefore: z15.string().nullable().optional(),
2505
+ state: z12.enum(["backlog", "ready"]).default("backlog"),
2506
+ notBefore: z12.string().nullable().optional(),
3000
2507
  policy: TaskPolicyPatch.optional()
3001
2508
  }).superRefine((v, ctx) => {
3002
2509
  if (v.githubIssueUrl === void 0) {
@@ -3034,32 +2541,32 @@ var CreateTaskRequest = z15.object({
3034
2541
  const issue = githubIssueFromUrl(v.githubIssueUrl);
3035
2542
  return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
3036
2543
  });
3037
- var UpdateTaskRequest = z15.object({
3038
- githubIssueUrl: z15.never().optional(),
3039
- githubIssue: z15.never().optional(),
3040
- launchPrompt: z15.never().optional(),
3041
- title: z15.string().min(1).max(300).optional(),
3042
- objective: z15.string().optional(),
3043
- acceptanceCriteria: z15.array(z15.string()).optional(),
3044
- dependencies: z15.array(z15.string()).optional(),
3045
- 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(),
3046
2553
  priority: Priority.optional(),
3047
- position: z15.number().optional(),
3048
- notBefore: z15.string().nullable().optional(),
2554
+ position: z12.number().optional(),
2555
+ notBefore: z12.string().nullable().optional(),
3049
2556
  policy: TaskPolicyPatch.optional()
3050
2557
  });
3051
- var MoveTaskRequest = z15.object({
2558
+ var MoveTaskRequest = z12.object({
3052
2559
  to: TaskState,
3053
- confirm: z15.boolean().optional(),
3054
- onRunning: z15.enum(["pause", "stop"]).optional(),
3055
- position: z15.number().optional()
3056
- });
3057
- var RequestChangesRequest = z15.object({ feedback: z15.array(z15.string().min(1)).min(1) });
3058
- var Eligibility = z15.union([
3059
- z15.object({ eligible: z15.literal(true), hostId: z15.string(), hostName: z15.string() }),
3060
- z15.object({
3061
- eligible: z15.literal(false),
3062
- 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([
3063
2570
  "dependency",
3064
2571
  "host_offline",
3065
2572
  "project_limit",
@@ -3072,157 +2579,157 @@ var Eligibility = z15.union([
3072
2579
  "already_dispatched",
3073
2580
  "retry_backoff"
3074
2581
  ]),
3075
- message: z15.string()
2582
+ message: z12.string()
3076
2583
  })
3077
2584
  ]);
3078
- var NowResponse = z15.object({
3079
- running: z15.array(z15.object({ taskId: z15.string(), runId: z15.string(), sessionId: z15.string().nullable() })),
3080
- queued: z15.array(z15.object({ taskId: z15.string(), eligibility: Eligibility })),
3081
- dispatchPaused: z15.boolean()
3082
- });
3083
- var AutomationInput = z15.object({
3084
- name: z15.string().min(1),
3085
- enabled: z15.boolean().default(true),
3086
- 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(),
3087
2594
  trigger: Trigger,
3088
- 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([]),
3089
2596
  template: TaskTemplate,
3090
- hostId: z15.string().nullable().default(null),
3091
- profileId: z15.string().nullable().default(null),
3092
- mode: z15.enum(["fresh", "continue", "watch"]).default("fresh"),
3093
- groupingKey: z15.string().nullable().default(null),
3094
- overlap: z15.enum(["skip", "queue_one", "append"]).default("skip"),
3095
- 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"),
3096
2603
  continuation: ContinuationPolicy.default({ enabled: false }),
3097
2604
  completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
3098
2605
  });
3099
- var AutomationView = Automation.extend({ summary: z15.string() });
3100
- var AutomationPreview = z15.object({
3101
- summary: z15.string(),
2606
+ var AutomationView = Automation.extend({ summary: z12.string() });
2607
+ var AutomationPreview = z12.object({
2608
+ summary: z12.string(),
3102
2609
  task: TaskTemplate,
3103
- next: z15.array(z15.string())
3104
- });
3105
- var WebhookTokenResponse = z15.object({ token: z15.string(), url: z15.string() });
3106
- var PushSubscriptionRequest = z15.object({
3107
- endpoint: z15.string().url(),
3108
- keys: z15.object({ p256dh: z15.string(), auth: z15.string() }),
3109
- permission: z15.enum(["granted", "denied", "default", "unknown"]).default("granted")
3110
- });
3111
- var NotificationSettings = z15.object({
3112
- quietHours: z15.object({
3113
- start: z15.string().regex(/^\d{2}:\d{2}$/),
3114
- end: z15.string().regex(/^\d{2}:\d{2}$/),
3115
- 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()
3116
2623
  }).nullable(),
3117
- privatePreviews: z15.boolean(),
3118
- preferredDeviceId: z15.string().nullable()
3119
- });
3120
- var PushPayload = z15.union([
3121
- z15.object({
3122
- type: z15.literal("show"),
3123
- title: z15.string(),
3124
- body: z15.string(),
3125
- tag: z15.string(),
3126
- url: z15.string(),
3127
- 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()
3128
2635
  }),
3129
- z15.object({ type: z15.literal("clear"), tag: z15.string() })
2636
+ z12.object({ type: z12.literal("clear"), tag: z12.string() })
3130
2637
  ]);
3131
- var SetupState = z15.object({
3132
- passkey: z15.object({
3133
- available: z15.boolean(),
3134
- registered: z15.boolean(),
3135
- 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()
3136
2643
  }),
3137
- oidc: z15.object({ label: z15.string() }).nullable()
2644
+ oidc: z12.object({ label: z12.string() }).nullable()
3138
2645
  });
3139
- var PasskeyRegisterOptionsResponse = z15.object({
3140
- challengeId: z15.string(),
3141
- options: z15.unknown()
2646
+ var PasskeyRegisterOptionsResponse = z12.object({
2647
+ challengeId: z12.string(),
2648
+ options: z12.unknown()
3142
2649
  });
3143
- var PasskeyRegisterVerifyRequest = z15.object({
3144
- challengeId: z15.string(),
3145
- name: z15.string().min(1).max(80),
3146
- response: z15.unknown()
2650
+ var PasskeyRegisterVerifyRequest = z12.object({
2651
+ challengeId: z12.string(),
2652
+ name: z12.string().min(1).max(80),
2653
+ response: z12.unknown()
3147
2654
  });
3148
- var PasskeySignInOptionsResponse = z15.object({
3149
- challengeId: z15.string(),
3150
- options: z15.unknown()
2655
+ var PasskeySignInOptionsResponse = z12.object({
2656
+ challengeId: z12.string(),
2657
+ options: z12.unknown()
3151
2658
  });
3152
- var PasskeySignInVerifyRequest = z15.object({
3153
- challengeId: z15.string(),
3154
- response: z15.unknown(),
3155
- 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),
3156
2663
  kind: DeviceKind.extract(["browser", "pwa"])
3157
2664
  });
3158
- var OidcBeginRequest = z15.object({
3159
- deviceName: z15.string().min(1).max(80),
2665
+ var OidcBeginRequest = z12.object({
2666
+ deviceName: z12.string().min(1).max(80),
3160
2667
  kind: DeviceKind.extract(["browser", "pwa"]),
3161
- next: z15.string().default("/"),
3162
- handoff: z15.boolean().default(false)
3163
- });
3164
- var OidcBeginResponse = z15.object({
3165
- authorizeUrl: z15.string(),
3166
- flowId: z15.string().nullable(),
3167
- pollToken: z15.string().nullable()
3168
- });
3169
- var OidcClaimRequest = z15.object({ flowId: z15.string(), pollToken: z15.string() });
3170
- var OidcClaimResponse = z15.union([
3171
- z15.object({ status: z15.literal("pending") }),
3172
- 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() })
3173
2680
  ]);
3174
- var TerminalLoginStartRequest = z15.object({ name: z15.string().min(1).max(80) });
3175
- var TerminalLoginStartResponse = z15.object({
3176
- userCode: z15.string(),
3177
- pollToken: z15.string(),
3178
- verifyUrl: z15.string(),
3179
- expiresAt: z15.string(),
3180
- intervalMs: z15.number().int()
3181
- });
3182
- var TerminalLoginClaimRequest = z15.object({
3183
- userCode: z15.string().min(1),
3184
- pollToken: z15.string().min(1)
3185
- });
3186
- var TerminalLoginClaimResponse = z15.union([
3187
- z15.object({ status: z15.literal("pending") }),
3188
- z15.object({ status: z15.literal("denied") }),
3189
- 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() })
3190
2697
  ]);
3191
- var TerminalLoginRequest = z15.object({
3192
- userCode: z15.string(),
3193
- name: z15.string(),
3194
- requestedFrom: z15.string(),
3195
- createdAt: z15.string(),
3196
- expiresAt: z15.string(),
3197
- status: z15.enum(["pending", "approved", "denied"])
3198
- });
3199
- var AuthMethods = z15.object({
3200
- passkeys: z15.array(Passkey),
3201
- passkeyAvailability: z15.object({ available: z15.boolean(), reason: z15.string().nullable() }),
3202
- oidc: z15.object({
3203
- issuer: z15.string(),
3204
- label: z15.string(),
3205
- ownerMatch: z15.string(),
3206
- status: z15.enum(["ready", "error"]),
3207
- 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()
3208
2715
  }).nullable()
3209
2716
  });
3210
- var MeResponse = z15.object({
2717
+ var MeResponse = z12.object({
3211
2718
  device: Device,
3212
- admin: z15.boolean(),
3213
- publicUrl: z15.string()
2719
+ admin: z12.boolean(),
2720
+ publicUrl: z12.string()
3214
2721
  });
3215
- 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, {
3216
2723
  message: "scopeId is required for mirror=scope and only then"
3217
2724
  });
3218
2725
  var ClientReport = Client.pick({ kind: true, name: true, machine: true }).extend({
3219
- hostId: z15.string().nullable().optional(),
2726
+ hostId: z12.string().nullable().optional(),
3220
2727
  /** Sessions in its mirror tabs or windows; omitted when unchanged or unknown. */
3221
- shows: z15.array(z15.string()).max(1e3).optional(),
2728
+ shows: z12.array(z12.string()).max(1e3).optional(),
3222
2729
  /** The binding this client had before bindings were recorded (env file); applied only when none is recorded. */
3223
2730
  seed: ClientBindingInput.optional()
3224
2731
  });
3225
- var ScopeInput = z15.object({
2732
+ var ScopeInput = z12.object({
3226
2733
  name: Scope.shape.name,
3227
2734
  mode: Scope.shape.mode.optional(),
3228
2735
  projectIds: Scope.shape.projectIds.optional(),
@@ -3230,7 +2737,7 @@ var ScopeInput = z15.object({
3230
2737
  /** A GitHub source makes this a GitHub scope; its projects are then kept by GitHub. */
3231
2738
  source: GitHubSourceInput.nullable().optional()
3232
2739
  });
3233
- var ScopePatch = z15.object({
2740
+ var ScopePatch = z12.object({
3234
2741
  name: Scope.shape.name.optional(),
3235
2742
  mode: Scope.shape.mode.optional(),
3236
2743
  projectIds: Scope.shape.projectIds.optional(),
@@ -3238,100 +2745,181 @@ var ScopePatch = z15.object({
3238
2745
  /** null removes the source; an object changes it, or adds one (then hostId and owner are required). */
3239
2746
  source: GitHubSourcePatch.nullable().optional()
3240
2747
  });
3241
- var ProjectSuggestionsResponse = z15.object({
3242
- suggestions: z15.array(ProjectSuggestion.extend({ name: z15.string(), preselected: z15.boolean() }))
3243
- });
3244
2748
 
3245
2749
  // packages/protocol/dist/scopes.js
3246
2750
  var CLIENT_OPEN_MS = 10 * 6e4;
3247
2751
 
3248
2752
  // packages/protocol/dist/catalog.js
3249
- import { z as z16 } from "zod";
3250
- var CatalogRepository = z16.strictObject({
3251
- authority: z16.string().min(1),
3252
- externalId: z16.string().min(1),
3253
- owner: z16.string().min(1),
3254
- name: z16.string().min(1),
3255
- webUrl: z16.url({ protocol: /^https$/ }),
3256
- cloneUrl: z16.url({ protocol: /^https$/ }),
3257
- defaultBranch: z16.string().nullable()
3258
- });
3259
- var CatalogAccountType = z16.enum(["personal", "organization"]);
3260
- var CatalogConnectionKind = z16.enum(["github_app", "pat"]);
3261
- var CatalogSelection = z16.strictObject({
3262
- owners: z16.array(z16.string().min(1).max(39)).max(50),
3263
- repositories: z16.array(z16.string().min(1).max(140)).max(500)
3264
- });
3265
- var CatalogConnectionStatus = z16.object({
3266
- id: z16.string(),
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(),
3267
2771
  kind: CatalogConnectionKind.default("github_app"),
3268
- account: z16.string(),
2772
+ authority: z13.string().min(1).default("github.com"),
2773
+ account: z13.string(),
3269
2774
  accountType: CatalogAccountType,
3270
- state: z16.enum(["pending", "ready", "stale", "suspended", "removed", "disconnected"]),
3271
- lastSyncedAt: z16.string().nullable(),
3272
- lastError: z16.string().nullable(),
3273
- installUrl: z16.string().nullable(),
3274
- manageUrl: z16.string().nullable(),
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(),
3275
2780
  selection: CatalogSelection.nullable().optional()
3276
2781
  });
3277
- var CatalogAvailableOwner = z16.object({
3278
- login: z16.string(),
2782
+ var CatalogAvailableOwner = z13.object({
2783
+ login: z13.string(),
3279
2784
  type: CatalogAccountType
3280
2785
  });
3281
- var CatalogAvailableInventory = z16.object({
3282
- account: z16.string(),
3283
- owners: z16.array(CatalogAvailableOwner),
3284
- repositories: z16.array(CatalogRepository)
2786
+ var CatalogAvailableInventory = z13.object({
2787
+ account: z13.string(),
2788
+ owners: z13.array(CatalogAvailableOwner),
2789
+ repositories: z13.array(CatalogRepository)
3285
2790
  });
3286
- var ConnectPatRequest = z16.strictObject({
3287
- token: z16.string().trim().min(10).max(512),
2791
+ var ConnectPatRequest = z13.strictObject({
2792
+ token: z13.string().trim().min(10).max(512),
3288
2793
  selection: CatalogSelection.optional()
3289
2794
  });
3290
- var UpdateCatalogSelectionRequest = z16.strictObject({
2795
+ var UpdateCatalogSelectionRequest = z13.strictObject({
3291
2796
  selection: CatalogSelection
3292
2797
  });
3293
- var CheckoutPreviewRequest = z16.strictObject({
3294
- hostId: z16.string().min(1),
3295
- folderName: z16.string().min(1).max(128).optional()
2798
+ var CheckoutPreviewRequest = z13.strictObject({
2799
+ hostId: z13.string().min(1),
2800
+ folderName: z13.string().min(1).max(128).optional()
3296
2801
  });
3297
- var CheckoutProvisionRequest = z16.strictObject({ previewId: z16.string().min(1).max(128) });
2802
+ var CheckoutProvisionRequest = z13.strictObject({ previewId: z13.string().min(1).max(128) });
3298
2803
 
3299
2804
  // packages/protocol/dist/client-wire.js
3300
- import { z as z17 } from "zod";
3301
- var SyncState = z17.object({
3302
- hosts: z17.array(Host),
3303
- projects: z17.array(Project),
3304
- checkouts: z17.array(Checkout),
3305
- workspaces: z17.array(Workspace),
3306
- profiles: z17.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),
3307
2895
  /** Scopes; absent from coordinators before 0.21. */
3308
- scopes: z17.array(Scope).default([]),
3309
- sessions: z17.array(Session),
3310
- tasks: z17.array(Task),
3311
- runs: z17.array(Run),
3312
- automations: z17.array(Automation),
3313
- attention: z17.array(AttentionItem),
3314
- interactions: z17.array(Interaction),
3315
- panels: z17.array(Panel),
3316
- devices: z17.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),
3317
2905
  /** Tracked issues; absent from older coordinators. */
3318
- issues: z17.array(TrackedIssue).default([]),
2906
+ issues: z15.array(TrackedIssue).default([]),
3319
2907
  /** Clients (herdr and tmux sessions); absent from coordinators before 0.21. */
3320
- clients: z17.array(Client).default([]),
3321
- adapters: z17.record(z17.string(), z17.array(AdapterInfo)),
3322
- dispatchPaused: z17.boolean()
3323
- });
3324
- var Presence = z17.object({
3325
- foreground: z17.boolean(),
3326
- interactedAt: z17.string().nullable(),
3327
- viewing: z17.object({ sessionId: z17.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(),
3328
2916
  /**
3329
2917
  * A herdr or tmux daemon reporting the session focused in its client (kept apart from the
3330
2918
  * device's own presence).
3331
2919
  */
3332
- clientId: z17.string().min(1).max(200).optional(),
2920
+ clientId: z15.string().min(1).max(200).optional(),
3333
2921
  /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of clientId. */
3334
- terminalId: z17.string().min(1).max(200).optional()
2922
+ terminalId: z15.string().min(1).max(200).optional()
3335
2923
  });
3336
2924
  var CLIENT_CAPABILITIES = [
3337
2925
  "adapter.slots.v1",
@@ -3344,35 +2932,432 @@ var CLIENT_CAPABILITIES = [
3344
2932
  /** The client draws `composer.tracker` and `session.badge` contributions. */
3345
2933
  "adapter.trackers.v1"
3346
2934
  ];
3347
- var ClientToServer = z17.discriminatedUnion("type", [
3348
- z17.object({
3349
- type: z17.literal("hello"),
3350
- cursor: z17.number().int().nullable(),
3351
- capabilities: z17.array(z17.string().min(1).max(80)).max(32).optional(),
3352
- projectionId: z17.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()
3353
2941
  }),
3354
- z17.object({ type: z17.literal("presence"), presence: Presence }),
3355
- z17.object({ type: z17.literal("ping") })
2942
+ z15.object({ type: z15.literal("presence"), presence: Presence }),
2943
+ z15.object({ type: z15.literal("ping") })
3356
2944
  ]);
3357
- var ServerToClient = z17.discriminatedUnion("type", [
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()
2952
+ }),
2953
+ z15.object({
2954
+ type: z15.literal("snapshot"),
2955
+ seq: z15.number().int(),
2956
+ state: SyncState,
2957
+ capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
2958
+ projectionId: z15.string().optional()
2959
+ }),
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", [
3358
3001
  z17.object({
3359
- type: z17.literal("replay"),
3360
- seq: z17.number().int(),
3361
- events: z17.array(EventEnvelope),
3362
- capabilities: z17.array(z17.enum(CLIENT_CAPABILITIES)).optional(),
3363
- projectionId: z17.string().optional()
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()
3364
3016
  }),
3365
3017
  z17.object({
3366
- type: z17.literal("snapshot"),
3367
- seq: z17.number().int(),
3368
- state: SyncState,
3369
- capabilities: z17.array(z17.enum(CLIENT_CAPABILITIES)).optional(),
3370
- projectionId: z17.string().optional()
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()
3371
3152
  }),
3372
- z17.object({ type: z17.literal("event"), event: EventEnvelope }),
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 }),
3373
3342
  z17.object({ type: z17.literal("stream"), delta: StreamDelta }),
3343
+ z17.object({ type: z17.literal("receipt"), receipt: Receipt }),
3374
3344
  z17.object({ type: z17.literal("pong") }),
3375
- z17.object({ type: z17.literal("force_logout"), reason: z17.string() })
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 })
3376
3361
  ]);
3377
3362
 
3378
3363
  // packages/protocol/dist/ids.js