@spencerboucher/switchyard 0.19.0 → 0.21.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 (163) hide show
  1. package/README.md +23 -16
  2. package/dist/bridge/enroll.js +36 -6
  3. package/dist/bridge/switchyard-terminal.js +2 -1
  4. package/dist/policies/worker.js +1042 -1018
  5. package/dist/switchyard.mjs +3622 -2671
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-8yzlARUS.js +2 -0
  8. package/web-dist/assets/{AutomationView-X-U6Fpm7.js.map → AutomationView-8yzlARUS.js.map} +1 -1
  9. package/web-dist/assets/Button-C7TQGuSX.js +2 -0
  10. package/web-dist/assets/Button-C7TQGuSX.js.map +1 -0
  11. package/web-dist/assets/{Card-WONLvqGM.js → Card-DzHrwFrv.js} +2 -2
  12. package/web-dist/assets/{Card-WONLvqGM.js.map → Card-DzHrwFrv.js.map} +1 -1
  13. package/web-dist/assets/{Checkbox-BmiLcC-z.js → Checkbox-BnRsg6ki.js} +2 -2
  14. package/web-dist/assets/{Checkbox-BmiLcC-z.js.map → Checkbox-BnRsg6ki.js.map} +1 -1
  15. package/web-dist/assets/{DangerZone-Ch2KNmob.js → DangerZone-BicyqXv8.js} +2 -2
  16. package/web-dist/assets/{DangerZone-Ch2KNmob.js.map → DangerZone-BicyqXv8.js.map} +1 -1
  17. package/web-dist/assets/Field-DBm2uYcg.js +2 -0
  18. package/web-dist/assets/Field-DBm2uYcg.js.map +1 -0
  19. package/web-dist/assets/{Markdown-BKOAPNDn.js → Markdown-BijzTpiJ.js} +2 -2
  20. package/web-dist/assets/{Markdown-BKOAPNDn.js.map → Markdown-BijzTpiJ.js.map} +1 -1
  21. package/web-dist/assets/Menu-BCTLk6pj.js +2 -0
  22. package/web-dist/assets/Menu-BCTLk6pj.js.map +1 -0
  23. package/web-dist/assets/{Priority-DTBkp1nb.js → Priority-DAhFDJ7E.js} +2 -2
  24. package/web-dist/assets/{Priority-DTBkp1nb.js.map → Priority-DAhFDJ7E.js.map} +1 -1
  25. package/web-dist/assets/ScopeSelect-CMmLEwNw.js +2 -0
  26. package/web-dist/assets/ScopeSelect-CMmLEwNw.js.map +1 -0
  27. package/web-dist/assets/{SegmentedControl-Ca8Fsw-g.js → SegmentedControl-Cvkz7C_A.js} +2 -2
  28. package/web-dist/assets/{SegmentedControl-Ca8Fsw-g.js.map → SegmentedControl-Cvkz7C_A.js.map} +1 -1
  29. package/web-dist/assets/{Select-YFnt2Br2.js → Select-CDRJ35wi.js} +2 -2
  30. package/web-dist/assets/{Select-YFnt2Br2.js.map → Select-CDRJ35wi.js.map} +1 -1
  31. package/web-dist/assets/{Switch-DHX-YYPr.js → Switch-D5pVfZgf.js} +2 -2
  32. package/web-dist/assets/{Switch-DHX-YYPr.js.map → Switch-D5pVfZgf.js.map} +1 -1
  33. package/web-dist/assets/{Tabs-DrFCe494.js → Tabs-D1t1tQzS.js} +2 -2
  34. package/web-dist/assets/{Tabs-DrFCe494.js.map → Tabs-D1t1tQzS.js.map} +1 -1
  35. package/web-dist/assets/{TextLink-CCc3WEdm.js → TextLink-BGtYWCW9.js} +2 -2
  36. package/web-dist/assets/{TextLink-CCc3WEdm.js.map → TextLink-BGtYWCW9.js.map} +1 -1
  37. package/web-dist/assets/{UINodeRenderer-BdvzPTz0.js → UINodeRenderer-CzoNfuWZ.js} +2 -2
  38. package/web-dist/assets/{UINodeRenderer-BdvzPTz0.js.map → UINodeRenderer-CzoNfuWZ.js.map} +1 -1
  39. package/web-dist/assets/UnfilteredNote-ddFROo9x.js +2 -0
  40. package/web-dist/assets/UnfilteredNote-ddFROo9x.js.map +1 -0
  41. package/web-dist/assets/api-hJ_Ikv1a.js +2 -0
  42. package/web-dist/assets/api-hJ_Ikv1a.js.map +1 -0
  43. package/web-dist/assets/{arrow-down-YwTzxo-r.js → arrow-down-Dn3KG_JI.js} +2 -2
  44. package/web-dist/assets/{arrow-down-YwTzxo-r.js.map → arrow-down-Dn3KG_JI.js.map} +1 -1
  45. package/web-dist/assets/{arrow-up-Bzh112dp.js → arrow-up-BiPtOqqy.js} +2 -2
  46. package/web-dist/assets/{arrow-up-Bzh112dp.js.map → arrow-up-BiPtOqqy.js.map} +1 -1
  47. package/web-dist/assets/attention-8UbWvCkj.js +2 -0
  48. package/web-dist/assets/attention-8UbWvCkj.js.map +1 -0
  49. package/web-dist/assets/{automations-CkbEL-3K.js → automations-ClK2gYj8.js} +2 -2
  50. package/web-dist/assets/{automations-CkbEL-3K.js.map → automations-ClK2gYj8.js.map} +1 -1
  51. package/web-dist/assets/board-4FKGJU8D.js +6 -0
  52. package/web-dist/assets/board-4FKGJU8D.js.map +1 -0
  53. package/web-dist/assets/{calendar-clock-CwOgyN2z.js → calendar-clock-DVlat602.js} +2 -2
  54. package/web-dist/assets/{calendar-clock-CwOgyN2z.js.map → calendar-clock-DVlat602.js.map} +1 -1
  55. package/web-dist/assets/check-CEnbWw4D.js +2 -0
  56. package/web-dist/assets/{check-DTN2VHtE.js.map → check-CEnbWw4D.js.map} +1 -1
  57. package/web-dist/assets/chevron-right-BM1IJI2z.js +2 -0
  58. package/web-dist/assets/{chevron-right-aaHL5Igi.js.map → chevron-right-BM1IJI2z.js.map} +1 -1
  59. package/web-dist/assets/code-BD2TozC7.js +25 -0
  60. package/web-dist/assets/code-BD2TozC7.js.map +1 -0
  61. package/web-dist/assets/{core.esm-C84Qlq9d.js → core.esm-B2OVQjr5.js} +2 -2
  62. package/web-dist/assets/{core.esm-C84Qlq9d.js.map → core.esm-B2OVQjr5.js.map} +1 -1
  63. package/web-dist/assets/{describe-Bt36Y0d7.js → describe-DBhLxCUs.js} +2 -2
  64. package/web-dist/assets/{describe-Bt36Y0d7.js.map → describe-DBhLxCUs.js.map} +1 -1
  65. package/web-dist/assets/{enroll--c9VSPgK.js → enroll-JhMxQuxw.js} +2 -2
  66. package/web-dist/assets/{enroll--c9VSPgK.js.map → enroll-JhMxQuxw.js.map} +1 -1
  67. package/web-dist/assets/{external-link-CI-Uzhfh.js → external-link-B3hnazCa.js} +2 -2
  68. package/web-dist/assets/{external-link-CI-Uzhfh.js.map → external-link-B3hnazCa.js.map} +1 -1
  69. package/web-dist/assets/{hand-HCdmhGph.js → hand-B6lvj014.js} +2 -2
  70. package/web-dist/assets/{hand-HCdmhGph.js.map → hand-B6lvj014.js.map} +1 -1
  71. package/web-dist/assets/{index-C6YuwL8H.js → index-Bc5JWkn9.js} +6 -6
  72. package/web-dist/assets/index-Bc5JWkn9.js.map +1 -0
  73. package/web-dist/assets/index-C9iuCGwg.css +2 -0
  74. package/web-dist/assets/{keyboardLayers-DKHA_Gcs.js → keyboardLayers-4IDHV-jq.js} +2 -2
  75. package/web-dist/assets/{keyboardLayers-DKHA_Gcs.js.map → keyboardLayers-4IDHV-jq.js.map} +1 -1
  76. package/web-dist/assets/{link-2-D6l0YZ-8.js → link-2-CCq9WzMy.js} +2 -2
  77. package/web-dist/assets/{link-2-D6l0YZ-8.js.map → link-2-CCq9WzMy.js.map} +1 -1
  78. package/web-dist/assets/{logic-CzU-NdeO.js → logic-BnSIy9_P.js} +2 -2
  79. package/web-dist/assets/{logic-CzU-NdeO.js.map → logic-BnSIy9_P.js.map} +1 -1
  80. package/web-dist/assets/logic-DUKcqVPg.js +4 -0
  81. package/web-dist/assets/logic-DUKcqVPg.js.map +1 -0
  82. package/web-dist/assets/{more-Dca-1nh1.js → more-CUfPZ6AG.js} +2 -2
  83. package/web-dist/assets/{more-Dca-1nh1.js.map → more-CUfPZ6AG.js.map} +1 -1
  84. package/web-dist/assets/{pencil-BtK08_f_.js → pencil-DeML-0z2.js} +2 -2
  85. package/web-dist/assets/{pencil-BtK08_f_.js.map → pencil-DeML-0z2.js.map} +1 -1
  86. package/web-dist/assets/{play-j138GLHB.js → play-NHO6U6cY.js} +2 -2
  87. package/web-dist/assets/{play-j138GLHB.js.map → play-NHO6U6cY.js.map} +1 -1
  88. package/web-dist/assets/{plus-D935l0Os.js → plus-C83uJhbf.js} +2 -2
  89. package/web-dist/assets/{plus-D935l0Os.js.map → plus-C83uJhbf.js.map} +1 -1
  90. package/web-dist/assets/policyLogic-Btk1SjgX.js +2 -0
  91. package/web-dist/assets/policyLogic-Btk1SjgX.js.map +1 -0
  92. package/web-dist/assets/{queue-CbFYHdtZ.js → queue-gs6Ez_u3.js} +2 -2
  93. package/web-dist/assets/queue-gs6Ez_u3.js.map +1 -0
  94. package/web-dist/assets/repo-T2dxdBnU.js +2 -0
  95. package/web-dist/assets/repo-T2dxdBnU.js.map +1 -0
  96. package/web-dist/assets/{rotate-ccw-mfO3Crkq.js → rotate-ccw-BRrlVEAQ.js} +2 -2
  97. package/web-dist/assets/{rotate-ccw-mfO3Crkq.js.map → rotate-ccw-BRrlVEAQ.js.map} +1 -1
  98. package/web-dist/assets/{search-DdgUAUi7.js → search-C5H14z0D.js} +2 -2
  99. package/web-dist/assets/{search-DdgUAUi7.js.map → search-C5H14z0D.js.map} +1 -1
  100. package/web-dist/assets/selection-DBzwvhnW.js +7 -0
  101. package/web-dist/assets/selection-DBzwvhnW.js.map +1 -0
  102. package/web-dist/assets/settings-DpK1_7vb.js +12 -0
  103. package/web-dist/assets/settings-DpK1_7vb.js.map +1 -0
  104. package/web-dist/assets/states-DL6w2pmK.js +58 -0
  105. package/web-dist/assets/states-DL6w2pmK.js.map +1 -0
  106. package/web-dist/assets/{terminal-DKqo1lis.js → terminal-CATQN_17.js} +2 -2
  107. package/web-dist/assets/{terminal-DKqo1lis.js.map → terminal-CATQN_17.js.map} +1 -1
  108. package/web-dist/assets/terminal-login-DNyAyWlB.js +2 -0
  109. package/web-dist/assets/{terminal-login-CK1PXQq9.js.map → terminal-login-DNyAyWlB.js.map} +1 -1
  110. package/web-dist/assets/{timer-CDGYPIoD.js → timer-DFrvOKOy.js} +2 -2
  111. package/web-dist/assets/{timer-CDGYPIoD.js.map → timer-DFrvOKOy.js.map} +1 -1
  112. package/web-dist/assets/{useBreakpoint-kT0J1Dnk.js → useBreakpoint-BYCN9s8X.js} +2 -2
  113. package/web-dist/assets/{useBreakpoint-kT0J1Dnk.js.map → useBreakpoint-BYCN9s8X.js.map} +1 -1
  114. package/web-dist/assets/useNow-wwKWj7oX.js +2 -0
  115. package/web-dist/assets/useNow-wwKWj7oX.js.map +1 -0
  116. package/web-dist/assets/{useResource-OCKiw9Xe.js → useResource-D_GOVIub.js} +2 -2
  117. package/web-dist/assets/{useResource-OCKiw9Xe.js.map → useResource-D_GOVIub.js.map} +1 -1
  118. package/web-dist/assets/workboard-B89WFLVO.js +3 -0
  119. package/web-dist/assets/workboard-B89WFLVO.js.map +1 -0
  120. package/web-dist/index.html +8 -8
  121. package/web-dist/sw.js +1 -1
  122. package/web-dist/sw.js.map +1 -1
  123. package/web-dist/assets/AutomationView-X-U6Fpm7.js +0 -2
  124. package/web-dist/assets/Button-BKQW9doW.js +0 -2
  125. package/web-dist/assets/Button-BKQW9doW.js.map +0 -1
  126. package/web-dist/assets/Copy-CdlOSzns.js +0 -2
  127. package/web-dist/assets/Copy-CdlOSzns.js.map +0 -1
  128. package/web-dist/assets/InteractionCard-CMLAH54x.js +0 -4
  129. package/web-dist/assets/InteractionCard-CMLAH54x.js.map +0 -1
  130. package/web-dist/assets/UnfilteredNote-C44Gi9gP.js +0 -2
  131. package/web-dist/assets/UnfilteredNote-C44Gi9gP.js.map +0 -1
  132. package/web-dist/assets/ViewSelect-Dr9Akgak.js +0 -2
  133. package/web-dist/assets/ViewSelect-Dr9Akgak.js.map +0 -1
  134. package/web-dist/assets/api-Dbc6zmlY.js +0 -2
  135. package/web-dist/assets/api-Dbc6zmlY.js.map +0 -1
  136. package/web-dist/assets/attention-BWVl_pfs.js +0 -2
  137. package/web-dist/assets/attention-BWVl_pfs.js.map +0 -1
  138. package/web-dist/assets/board-DRNTDqMF.js +0 -6
  139. package/web-dist/assets/board-DRNTDqMF.js.map +0 -1
  140. package/web-dist/assets/check-DTN2VHtE.js +0 -2
  141. package/web-dist/assets/chevron-right-aaHL5Igi.js +0 -2
  142. package/web-dist/assets/code-0I1wn1N7.js +0 -25
  143. package/web-dist/assets/code-0I1wn1N7.js.map +0 -1
  144. package/web-dist/assets/index-9TW72kVM.css +0 -2
  145. package/web-dist/assets/index-C6YuwL8H.js.map +0 -1
  146. package/web-dist/assets/policyLogic-Bs-3OIqh.js +0 -2
  147. package/web-dist/assets/policyLogic-Bs-3OIqh.js.map +0 -1
  148. package/web-dist/assets/queue-CbFYHdtZ.js.map +0 -1
  149. package/web-dist/assets/repo-BB50Kdri.js +0 -2
  150. package/web-dist/assets/repo-BB50Kdri.js.map +0 -1
  151. package/web-dist/assets/selection-QGVHfoxz.js +0 -7
  152. package/web-dist/assets/selection-QGVHfoxz.js.map +0 -1
  153. package/web-dist/assets/settings-BvUmCxtY.js +0 -12
  154. package/web-dist/assets/settings-BvUmCxtY.js.map +0 -1
  155. package/web-dist/assets/states-DM6omTC-.js +0 -58
  156. package/web-dist/assets/states-DM6omTC-.js.map +0 -1
  157. package/web-dist/assets/terminal-login-CK1PXQq9.js +0 -2
  158. package/web-dist/assets/trackers-BIhLByAc.js +0 -2
  159. package/web-dist/assets/trackers-BIhLByAc.js.map +0 -1
  160. package/web-dist/assets/useNow-DOQOgv7k.js +0 -2
  161. package/web-dist/assets/useNow-DOQOgv7k.js.map +0 -1
  162. package/web-dist/assets/workboard-C0XpNo0s.js +0 -3
  163. package/web-dist/assets/workboard-C0XpNo0s.js.map +0 -1
@@ -3,7 +3,7 @@ import { parentPort } from "node:worker_threads";
3
3
  import { Environment } from "@marcbachmann/cel-js";
4
4
 
5
5
  // packages/protocol/dist/adapter-preview.js
6
- import { z as z7 } from "zod";
6
+ import { z as z8 } from "zod";
7
7
 
8
8
  // packages/protocol/dist/contributions.js
9
9
  import { z as z3 } from "zod";
@@ -353,7 +353,7 @@ function contributionSlot(id) {
353
353
  }
354
354
 
355
355
  // packages/protocol/dist/entities.js
356
- import { z as z6 } from "zod";
356
+ import { z as z7 } from "zod";
357
357
 
358
358
  // packages/protocol/dist/github.js
359
359
  import { z as z4 } from "zod";
@@ -602,20 +602,207 @@ var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
602
602
  expectedPullRequestNodeId: z4.string().min(1)
603
603
  });
604
604
 
605
- // packages/protocol/dist/policies.js
605
+ // packages/protocol/dist/issues.js
606
606
  import { z as z5 } from "zod";
607
- var Id3 = z5.string().min(1).max(200);
608
- var Revision = z5.number().int().safe().min(1);
609
- var Instant2 = z5.string().refine((s) => {
607
+ var Iso = z5.string();
608
+ var Id3 = z5.string().min(1);
609
+ var IssueFollow = z5.enum(["assigned", "board"]);
610
+ var GitHubLogin = z5.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
611
+ var BoardStatusOption = z5.object({
612
+ id: z5.string().min(1),
613
+ name: z5.string().min(1).max(200)
614
+ });
615
+ var SourceBoard = z5.object({
616
+ projectNumber: z5.number().int().positive(),
617
+ statusField: z5.string().min(1).max(100).default("Status"),
618
+ /** Column to move a card to once its worktree exists (write-back). */
619
+ onStart: z5.string().min(1).max(200).nullable().default(null),
620
+ /** Column to move a card to once a pull request is open (write-back). */
621
+ onReview: z5.string().min(1).max(200).nullable().default(null),
622
+ /** A single-select field that ranks issues: its first option is the highest. */
623
+ priorityField: z5.string().min(1).max(100).nullable().optional(),
624
+ /** Columns whose cards are not tracked until they have a branch or pull request. */
625
+ backlog: z5.array(z5.string().min(1).max(200)).max(20).optional()
626
+ });
627
+ var GitHubSource = z5.object({
628
+ kind: z5.literal("github"),
629
+ /** The host whose `gh` login reads the issues. */
630
+ hostId: Id3,
631
+ owner: GitHubLogin,
632
+ repositories: z5.array(GitHubRepository).min(1).max(50).nullable(),
633
+ /** Repositories outside `owner` that belong to this source too (never limited by `repositories`). */
634
+ extraRepositories: z5.array(GitHubRepository).max(20).optional(),
635
+ board: SourceBoard.nullable(),
636
+ /** Which issues it follows; absent means "assigned". "board": every open issue on its board. */
637
+ follow: IssueFollow.optional(),
638
+ writeBack: z5.boolean(),
639
+ moveShared: z5.boolean(),
640
+ /** Make a worktree for an issue branch that has none; absent means true. */
641
+ worktrees: z5.boolean().optional(),
642
+ enabled: z5.boolean(),
643
+ /** The host's `gh` user, from the last sync. */
644
+ login: z5.string().nullable(),
645
+ lastSyncedAt: Iso.nullable(),
646
+ lastError: z5.string().max(2e3).nullable()
647
+ });
648
+ var GitHubSourceInput = z5.object({
649
+ hostId: Id3,
650
+ owner: GitHubLogin,
651
+ repositories: GitHubSource.shape.repositories.default(null),
652
+ extraRepositories: z5.array(GitHubRepository).max(20).default([]),
653
+ board: SourceBoard.nullable().default(null),
654
+ follow: IssueFollow.default("assigned"),
655
+ writeBack: z5.boolean().default(false),
656
+ moveShared: z5.boolean().default(true),
657
+ worktrees: z5.boolean().default(true),
658
+ enabled: z5.boolean().default(true)
659
+ });
660
+ var GitHubSourcePatch = z5.object({
661
+ hostId: Id3.optional(),
662
+ owner: GitHubLogin.optional(),
663
+ repositories: GitHubSource.shape.repositories.optional(),
664
+ extraRepositories: z5.array(GitHubRepository).max(20).optional(),
665
+ board: SourceBoard.nullable().optional(),
666
+ follow: IssueFollow.optional(),
667
+ writeBack: z5.boolean().optional(),
668
+ moveShared: z5.boolean().optional(),
669
+ worktrees: z5.boolean().optional(),
670
+ enabled: z5.boolean().optional()
671
+ });
672
+ var IssueBoard = z5.object({
673
+ projectId: z5.string().min(1),
674
+ projectItemId: z5.string().min(1),
675
+ fieldId: z5.string().min(1),
676
+ status: z5.string().nullable(),
677
+ statusOptionId: z5.string().nullable(),
678
+ options: z5.array(BoardStatusOption).max(50),
679
+ /** The issue's value of the source's priority field; `rank` is its option's position. */
680
+ priority: z5.object({ name: z5.string().min(1).max(200), rank: z5.number().int().min(0) }).nullable().optional()
681
+ });
682
+ var IssuePullRequest = z5.object({
683
+ number: z5.number().int().positive(),
684
+ state: z5.enum(["OPEN", "CLOSED", "MERGED"]),
685
+ url: z5.string().url(),
686
+ headRefName: z5.string().min(1).max(255)
687
+ });
688
+ var IssueParent = z5.object({
689
+ number: z5.number().int().positive(),
690
+ title: z5.string().max(300),
691
+ url: GitHubIssueUrl
692
+ });
693
+ var IssueSubIssues = z5.object({
694
+ total: z5.number().int().min(0),
695
+ completed: z5.number().int().min(0)
696
+ });
697
+ var SyncedIssue = z5.object({
698
+ itemId: z5.string().min(1),
699
+ repository: GitHubRepository,
700
+ number: z5.number().int().positive(),
701
+ title: z5.string().min(1).max(1e3),
702
+ url: GitHubIssueUrl,
703
+ assignees: z5.array(z5.string()).max(20),
704
+ branches: z5.array(z5.string().min(1).max(255)).max(10),
705
+ pullRequest: IssuePullRequest.nullable(),
706
+ board: IssueBoard.nullable(),
707
+ parent: IssueParent.nullable().optional(),
708
+ subIssues: IssueSubIssues.nullable().optional()
709
+ });
710
+ var IssueSyncResult = z5.object({
711
+ login: z5.string().min(1),
712
+ items: z5.array(SyncedIssue).max(200),
713
+ truncated: z5.boolean()
714
+ });
715
+ var TrackedIssue = z5.object({
716
+ /** `${scopeId}:${itemId}` */
717
+ id: Id3,
718
+ scopeId: Id3,
719
+ /** COMPAT(scopes-rename): remove after 2027-03-01. A copy of scopeId for 0.20 clients. */
720
+ trackerId: Id3.optional(),
721
+ itemId: z5.string().min(1),
722
+ projectId: Id3,
723
+ repository: GitHubRepository,
724
+ number: z5.number().int().positive(),
725
+ title: z5.string().min(1).max(300),
726
+ url: GitHubIssueUrl,
727
+ assignees: z5.array(z5.string()).max(20),
728
+ /** Branches GitHub links to the issue. */
729
+ branches: z5.array(z5.string()).max(10),
730
+ /** The branch Switchyard works on. */
731
+ branch: z5.string().nullable(),
732
+ workspaceId: Id3.nullable(),
733
+ pullRequest: IssuePullRequest.nullable(),
734
+ board: IssueBoard.nullable(),
735
+ /** The issue this one is a sub-issue of. */
736
+ parent: IssueParent.nullable().optional(),
737
+ subIssues: IssueSubIssues.nullable().optional(),
738
+ updatedAt: Iso
739
+ });
740
+ var OpenIssueRequest = z5.object({
741
+ hostId: Id3.optional(),
742
+ scopeId: z5.string().optional(),
743
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
744
+ viewId: z5.string().optional(),
745
+ /** The first prompt of a new session. */
746
+ prompt: z5.string().optional(),
747
+ profileId: z5.string().nullable().optional()
748
+ });
749
+ var IssueSetStatusResult = z5.discriminatedUnion("status", [
750
+ z5.object({ status: z5.literal("moved") }),
751
+ z5.object({
752
+ status: z5.literal("skipped"),
753
+ reason: z5.enum(["not_assigned", "shared", "stale"])
754
+ })
755
+ ]);
756
+ var LinkIssueRequest = z5.object({ workspaceId: Id3 });
757
+ var IssueStatusRequest = z5.object({ status: z5.string().min(1).max(200) });
758
+ var IssueHostSyncRequest = z5.object({
759
+ owner: GitHubLogin,
760
+ repositories: z5.array(GitHubRepository).nullable(),
761
+ board: z5.object({
762
+ projectNumber: z5.number().int().positive(),
763
+ statusField: z5.string().min(1),
764
+ priorityField: z5.string().min(1).nullable().optional()
765
+ }).nullable(),
766
+ follow: IssueFollow.optional(),
767
+ backlog: z5.array(z5.string().min(1)).max(20).optional()
768
+ });
769
+ var IssueHostPrepareBranchRequest = z5.object({
770
+ checkoutPath: z5.string().min(1),
771
+ branch: z5.string().min(1).max(255)
772
+ });
773
+ var IssueHostStartIssueRequest = z5.object({
774
+ checkoutPath: z5.string().min(1),
775
+ repository: GitHubRepository,
776
+ number: z5.number().int().positive(),
777
+ branch: z5.string().min(1).max(255),
778
+ base: z5.string().min(1)
779
+ });
780
+ var IssueHostSetStatusRequest = z5.object({
781
+ projectId: z5.string().min(1),
782
+ projectItemId: z5.string().min(1),
783
+ fieldId: z5.string().min(1),
784
+ statusField: z5.string().min(1),
785
+ optionId: z5.string().min(1),
786
+ expectedOptionId: z5.string().nullable(),
787
+ login: z5.string().min(1),
788
+ allowShared: z5.boolean(),
789
+ allowUnassigned: z5.boolean().optional()
790
+ });
791
+
792
+ // packages/protocol/dist/policies.js
793
+ import { z as z6 } from "zod";
794
+ var Id4 = z6.string().min(1).max(200);
795
+ var Revision = z6.number().int().safe().min(1);
796
+ var Instant2 = z6.string().refine((s) => {
610
797
  try {
611
798
  return new Date(s).toISOString() === s;
612
799
  } catch {
613
800
  return false;
614
801
  }
615
802
  });
616
- var Text = z5.string().max(4e3);
803
+ var Text = z6.string().max(4e3);
617
804
  var Reason = Text.min(1);
618
- var Fingerprint = z5.string().regex(/^[0-9a-f]{64}$/);
805
+ var Fingerprint = z6.string().regex(/^[0-9a-f]{64}$/);
619
806
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
620
807
  var bytes2 = (s) => new TextEncoder().encode(s).length;
621
808
  function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
@@ -652,43 +839,43 @@ function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
652
839
  seen.delete(value);
653
840
  }
654
841
  }
655
- var JsonObject = z5.custom((v) => !!v && typeof v === "object" && !Array.isArray(v) && validJson(v));
656
- var CompletedUsageWatermark = z5.object({ runtimeId: Id3, settleSeq: Revision }).strict();
657
- var scopeShape = { scope: z5.enum(["session", "profile", "server"]), scopeId: Id3.nullable() };
842
+ var JsonObject = z6.custom((v) => !!v && typeof v === "object" && !Array.isArray(v) && validJson(v));
843
+ var CompletedUsageWatermark = z6.object({ runtimeId: Id4, settleSeq: Revision }).strict();
844
+ var scopeShape = { scope: z6.enum(["session", "profile", "server"]), scopeId: Id4.nullable() };
658
845
  var scopeValid = (v) => v.scope === "server" === (v.scopeId === null);
659
- var PolicyPhase = z5.enum(["tool_call", "request"]);
660
- var PolicyVerdict = z5.enum(["ALLOW", "ASK", "DENY"]);
661
- var PolicyRequestAction = z5.enum([
846
+ var PolicyPhase = z6.enum(["tool_call", "request"]);
847
+ var PolicyVerdict = z6.enum(["ALLOW", "ASK", "DENY"]);
848
+ var PolicyRequestAction = z6.enum([
662
849
  "task.create",
663
850
  "message.send",
664
851
  "inbox.read",
665
852
  "run.continue"
666
853
  ]);
667
854
  var PolicyScope = scopeShape.scope;
668
- var PolicyCounterMap = z5.record(z5.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/).refine((k) => !forbidden.has(k)), z5.number().int().safe()).refine((v) => Object.keys(v).length <= 64);
669
- var phases = z5.array(PolicyPhase).min(1).max(2).refine((v) => new Set(v).size === v.length);
855
+ var PolicyCounterMap = z6.record(z6.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/).refine((k) => !forbidden.has(k)), z6.number().int().safe()).refine((v) => Object.keys(v).length <= 64);
856
+ var phases = z6.array(PolicyPhase).min(1).max(2).refine((v) => new Set(v).size === v.length);
670
857
  var ruleFields = {
671
- priority: z5.number().int().safe().min(-1e6).max(1e6),
672
- enabled: z5.boolean(),
858
+ priority: z6.number().int().safe().min(-1e6).max(1e6),
859
+ enabled: z6.boolean(),
673
860
  phases,
674
- name: z5.string().min(1).max(120),
675
- expression: z5.string().min(1).max(8192)
861
+ name: z6.string().min(1).max(120),
862
+ expression: z6.string().min(1).max(8192)
676
863
  };
677
- var PolicyRule = z5.object({
678
- id: Id3,
864
+ var PolicyRule = z6.object({
865
+ id: Id4,
679
866
  ...scopeShape,
680
867
  ...ruleFields,
681
868
  revision: Revision,
682
- builtIn: z5.boolean(),
869
+ builtIn: z6.boolean(),
683
870
  createdAt: Instant2,
684
871
  updatedAt: Instant2
685
872
  }).strict().refine(scopeValid);
686
- var PolicyToolSafety = z5.object({
687
- destructiveDelete: z5.boolean(),
688
- forcePush: z5.boolean(),
689
- defaultBranchPush: z5.boolean(),
690
- uncertain: z5.boolean(),
691
- reasons: z5.array(z5.string().min(1).max(1e3)).max(16)
873
+ var PolicyToolSafety = z6.object({
874
+ destructiveDelete: z6.boolean(),
875
+ forcePush: z6.boolean(),
876
+ defaultBranchPush: z6.boolean(),
877
+ uncertain: z6.boolean(),
878
+ reasons: z6.array(z6.string().min(1).max(1e3)).max(16)
692
879
  }).strict();
693
880
  function normalizePosixPath(value) {
694
881
  const parts = [];
@@ -700,7 +887,7 @@ function normalizePosixPath(value) {
700
887
  }
701
888
  return `/${parts.join("/")}`;
702
889
  }
703
- var hostPath = z5.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
890
+ var hostPath = z6.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
704
891
  function relativePosixPath(from, to) {
705
892
  const fromParts = from.split("/").filter(Boolean);
706
893
  const toParts = to.split("/").filter(Boolean);
@@ -709,7 +896,7 @@ function relativePosixPath(from, to) {
709
896
  shared++;
710
897
  return [...fromParts.slice(shared).map(() => ".."), ...toParts.slice(shared)].join("/");
711
898
  }
712
- var HostPolicyBoundary = z5.object({
899
+ var HostPolicyBoundary = z6.object({
713
900
  cwd: hostPath,
714
901
  workspaceRoot: hostPath,
715
902
  cwdReal: hostPath,
@@ -718,51 +905,51 @@ var HostPolicyBoundary = z5.object({
718
905
  const relative = relativePosixPath(boundary.workspaceRootReal, boundary.cwdReal);
719
906
  return relative !== ".." && !relative.startsWith("../");
720
907
  }, "Real cwd must be within the real workspace boundary.");
721
- var HostToolPolicyContext = z5.object({
722
- version: z5.literal(1),
723
- toolCallId: Id3,
908
+ var HostToolPolicyContext = z6.object({
909
+ version: z6.literal(1),
910
+ toolCallId: Id4,
724
911
  toolHash: Fingerprint,
725
912
  boundary: HostPolicyBoundary,
726
- defaultBranch: z5.string().min(1).max(255).nullable(),
913
+ defaultBranch: z6.string().min(1).max(255).nullable(),
727
914
  safety: PolicyToolSafety
728
915
  }).strict();
729
- var PolicyToolContext = z5.object({ name: Id3, args: JsonObject, safety: PolicyToolSafety }).strict();
730
- var PolicyRequestContext = z5.object({ method: PolicyRequestAction, args: JsonObject }).strict();
731
- var absolutePath = z5.string().min(1).max(8192).refine((v) => v.startsWith("/") || /^[A-Za-z]:[\\/]/.test(v));
732
- var controlMode = z5.enum(["human", "automation"]);
733
- var PolicySessionContext = z5.object({
734
- id: Id3,
735
- hostId: Id3,
736
- nativeSessionId: Id3.nullable(),
737
- runtimeId: Id3.nullable(),
738
- profileId: Id3,
739
- projectId: Id3.nullable(),
740
- taskId: Id3.nullable(),
741
- runId: Id3.nullable(),
916
+ var PolicyToolContext = z6.object({ name: Id4, args: JsonObject, safety: PolicyToolSafety }).strict();
917
+ var PolicyRequestContext = z6.object({ method: PolicyRequestAction, args: JsonObject }).strict();
918
+ var absolutePath = z6.string().min(1).max(8192).refine((v) => v.startsWith("/") || /^[A-Za-z]:[\\/]/.test(v));
919
+ var controlMode = z6.enum(["human", "automation"]);
920
+ var PolicySessionContext = z6.object({
921
+ id: Id4,
922
+ hostId: Id4,
923
+ nativeSessionId: Id4.nullable(),
924
+ runtimeId: Id4.nullable(),
925
+ profileId: Id4,
926
+ projectId: Id4.nullable(),
927
+ taskId: Id4.nullable(),
928
+ runId: Id4.nullable(),
742
929
  controlMode,
743
930
  controlRevision: Revision,
744
931
  cwd: absolutePath,
745
932
  workspaceRoot: absolutePath,
746
- repository: z5.string().min(1).max(2048).nullable(),
747
- defaultBranch: z5.string().min(1).max(255).nullable(),
748
- readOnly: z5.boolean()
933
+ repository: z6.string().min(1).max(2048).nullable(),
934
+ defaultBranch: z6.string().min(1).max(255).nullable(),
935
+ readOnly: z6.boolean()
749
936
  }).strict();
750
- var PolicyTaskContext = z5.object({
751
- id: Id3,
752
- projectId: Id3,
753
- rootTaskId: Id3,
754
- parentTaskId: Id3.nullable(),
755
- title: z5.string().min(1).max(300),
756
- state: z5.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"])
937
+ var PolicyTaskContext = z6.object({
938
+ id: Id4,
939
+ projectId: Id4,
940
+ rootTaskId: Id4,
941
+ parentTaskId: Id4.nullable(),
942
+ title: z6.string().min(1).max(300),
943
+ state: z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"])
757
944
  }).strict();
758
- var PolicyTargetContext = z5.object({
759
- id: Id3,
760
- hostId: Id3,
761
- projectId: Id3.nullable(),
762
- taskId: Id3.nullable(),
945
+ var PolicyTargetContext = z6.object({
946
+ id: Id4,
947
+ hostId: Id4,
948
+ projectId: Id4.nullable(),
949
+ taskId: Id4.nullable(),
763
950
  controlMode,
764
951
  controlRevision: Revision,
765
- runtime: z5.enum([
952
+ runtime: z6.enum([
766
953
  "starting",
767
954
  "idle",
768
955
  "running",
@@ -771,24 +958,24 @@ var PolicyTargetContext = z5.object({
771
958
  "failed",
772
959
  "stopped"
773
960
  ]),
774
- readOnly: z5.boolean()
961
+ readOnly: z6.boolean()
775
962
  }).strict();
776
- var PolicyCostContext = z5.object({
777
- tokens: z5.number().int().safe().nonnegative().nullable(),
778
- costUsd: z5.number().finite().nonnegative().nullable(),
779
- maxTokens: z5.number().int().safe().positive().nullable(),
780
- maxCostUsd: z5.number().finite().positive().nullable(),
781
- accounting: z5.enum(["available", "unavailable"]),
782
- fresh: z5.boolean(),
963
+ var PolicyCostContext = z6.object({
964
+ tokens: z6.number().int().safe().nonnegative().nullable(),
965
+ costUsd: z6.number().finite().nonnegative().nullable(),
966
+ maxTokens: z6.number().int().safe().positive().nullable(),
967
+ maxCostUsd: z6.number().finite().positive().nullable(),
968
+ accounting: z6.enum(["available", "unavailable"]),
969
+ fresh: z6.boolean(),
783
970
  watermark: CompletedUsageWatermark.nullable(),
784
- provider: Id3.nullable(),
785
- modelId: z5.string().min(1).max(512).nullable(),
786
- classification: z5.enum(["cheap", "expensive", "unclassified"]),
787
- expensive: z5.boolean()
971
+ provider: Id4.nullable(),
972
+ modelId: z6.string().min(1).max(512).nullable(),
973
+ classification: z6.enum(["cheap", "expensive", "unclassified"]),
974
+ expensive: z6.boolean()
788
975
  }).strict().refine((v) => v.expensive === (v.classification !== "cheap") && (v.provider !== null && v.modelId !== null || v.classification === "unclassified") && v.accounting === "available" === (v.tokens !== null || v.costUsd !== null));
789
- var PolicyContext = z5.object({
976
+ var PolicyContext = z6.object({
790
977
  phase: PolicyPhase,
791
- action: z5.union([z5.literal("tool.call"), PolicyRequestAction]),
978
+ action: z6.union([z6.literal("tool.call"), PolicyRequestAction]),
792
979
  tool: PolicyToolContext.nullable(),
793
980
  request: PolicyRequestContext.nullable(),
794
981
  session: PolicySessionContext,
@@ -797,11 +984,11 @@ var PolicyContext = z5.object({
797
984
  cost: PolicyCostContext,
798
985
  counters: PolicyCounterMap
799
986
  }).strict().refine((v) => (v.phase === "tool_call" ? v.action === "tool.call" && v.tool !== null && v.request === null : v.tool === null && v.request !== null && v.action === v.request.method) && (v.action === "message.send" ? v.target !== null : v.target === null)).refine((v) => bytes2(JSON.stringify(v)) <= 65536, "Policy input is too large to evaluate.");
800
- var PolicyRuleResult = z5.union([
801
- z5.null(),
802
- z5.object({ verdict: PolicyVerdict, reason: Text, state_updates: PolicyCounterMap.optional() }).strict().refine((v) => v.verdict === "ALLOW" || v.reason.length > 0)
987
+ var PolicyRuleResult = z6.union([
988
+ z6.null(),
989
+ z6.object({ verdict: PolicyVerdict, reason: Text, state_updates: PolicyCounterMap.optional() }).strict().refine((v) => v.verdict === "ALLOW" || v.reason.length > 0)
803
990
  ]);
804
- var webUrl = z5.string().max(4096).refine((s) => {
991
+ var webUrl = z6.string().max(4096).refine((s) => {
805
992
  try {
806
993
  const u = new URL(s);
807
994
  return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
@@ -809,314 +996,312 @@ var webUrl = z5.string().max(4096).refine((s) => {
809
996
  return false;
810
997
  }
811
998
  });
812
- var PolicyEvaluation = z5.discriminatedUnion("verdict", [
813
- z5.object({ verdict: z5.literal("ALLOW") }).strict(),
814
- z5.object({ verdict: z5.literal("DENY"), reason: Reason }).strict(),
815
- z5.object({
816
- verdict: z5.literal("ASK"),
817
- decisionId: Id3,
818
- interactionId: Id3,
999
+ var PolicyEvaluation = z6.discriminatedUnion("verdict", [
1000
+ z6.object({ verdict: z6.literal("ALLOW") }).strict(),
1001
+ z6.object({ verdict: z6.literal("DENY"), reason: Reason }).strict(),
1002
+ z6.object({
1003
+ verdict: z6.literal("ASK"),
1004
+ decisionId: Id4,
1005
+ interactionId: Id4,
819
1006
  interactionUrl: webUrl
820
1007
  }).strict()
821
1008
  ]);
822
- var PolicyPermission = z5.object({
823
- kind: z5.literal("policy"),
824
- decisionId: Id3,
825
- rootTaskId: Id3.nullable(),
826
- ruleId: Id3,
1009
+ var PolicyPermission = z6.object({
1010
+ kind: z6.literal("policy"),
1011
+ decisionId: Id4,
1012
+ rootTaskId: Id4.nullable(),
1013
+ ruleId: Id4,
827
1014
  ruleRevision: Revision,
828
1015
  fingerprint: Fingerprint
829
1016
  }).strict();
830
- var PolicyGrant = z5.object({
831
- id: Id3,
832
- scope: z5.object({ kind: z5.enum(["task", "session"]), id: Id3 }).strict(),
833
- ruleId: Id3,
1017
+ var PolicyGrant = z6.object({
1018
+ id: Id4,
1019
+ scope: z6.object({ kind: z6.enum(["task", "session"]), id: Id4 }).strict(),
1020
+ ruleId: Id4,
834
1021
  ruleRevision: Revision,
835
1022
  fingerprint: Fingerprint,
836
- approvedByDeviceId: Id3,
1023
+ approvedByDeviceId: Id4,
837
1024
  approvedAt: Instant2
838
1025
  }).strict();
839
- var trimmed = (max) => z5.string().min(1).max(max).refine((s) => s.trim() === s);
840
- var PolicyModelClassification = z5.object({
1026
+ var trimmed = (max) => z6.string().min(1).max(max).refine((s) => s.trim() === s);
1027
+ var PolicyModelClassification = z6.object({
841
1028
  provider: trimmed(200),
842
1029
  modelId: trimmed(512),
843
- classification: z5.enum(["cheap", "expensive"])
1030
+ classification: z6.enum(["cheap", "expensive"])
844
1031
  }).strict();
845
- var classifications = z5.array(PolicyModelClassification).max(1e3).refine((v) => new Set(v.map((x) => JSON.stringify([x.provider, x.modelId]))).size === v.length);
846
- var PolicySettings = z5.object({ revision: Revision, modelClassifications: classifications, updatedAt: Instant2 }).strict();
847
- var toolInput = z5.object({ name: Id3, args: JsonObject }).strict();
848
- var sampleIdentity = { sessionId: Id3, nativeSessionId: Id3, runtimeId: Id3, sampleId: Id3 };
849
- var HostPolicySampleRequest = z5.object({ ...sampleIdentity, tool: toolInput }).strict();
850
- var HostPolicySampleResult = z5.object({
1032
+ var classifications = z6.array(PolicyModelClassification).max(1e3).refine((v) => new Set(v.map((x) => JSON.stringify([x.provider, x.modelId]))).size === v.length);
1033
+ var PolicySettings = z6.object({ revision: Revision, modelClassifications: classifications, updatedAt: Instant2 }).strict();
1034
+ var toolInput = z6.object({ name: Id4, args: JsonObject }).strict();
1035
+ var sampleIdentity = { sessionId: Id4, nativeSessionId: Id4, runtimeId: Id4, sampleId: Id4 };
1036
+ var HostPolicySampleRequest = z6.object({ ...sampleIdentity, tool: toolInput }).strict();
1037
+ var HostPolicySampleResult = z6.object({
851
1038
  ...sampleIdentity,
852
1039
  toolHash: Fingerprint,
853
1040
  boundary: HostPolicyBoundary,
854
- defaultBranch: z5.string().min(1).max(255).nullable(),
1041
+ defaultBranch: z6.string().min(1).max(255).nullable(),
855
1042
  safety: PolicyToolSafety
856
1043
  }).strict();
857
- var PolicyEvaluateRequest = z5.object({ evaluationId: Id3, toolCallId: Id3, tool: toolInput }).strict();
858
- var PolicyStatusRequest = z5.object({ decisionId: Id3, waitMs: z5.literal(25e3) }).strict();
859
- var PolicyStatusResult = z5.discriminatedUnion("state", [
860
- z5.object({ state: z5.literal("pending") }).strict(),
861
- z5.object({ state: z5.literal("allowed") }).strict(),
862
- z5.object({ state: z5.literal("denied"), reason: Reason }).strict(),
863
- z5.object({ state: z5.literal("canceled"), reason: Reason }).strict()
1044
+ var PolicyEvaluateRequest = z6.object({ evaluationId: Id4, toolCallId: Id4, tool: toolInput }).strict();
1045
+ var PolicyStatusRequest = z6.object({ decisionId: Id4, waitMs: z6.literal(25e3) }).strict();
1046
+ var PolicyStatusResult = z6.discriminatedUnion("state", [
1047
+ z6.object({ state: z6.literal("pending") }).strict(),
1048
+ z6.object({ state: z6.literal("allowed") }).strict(),
1049
+ z6.object({ state: z6.literal("denied"), reason: Reason }).strict(),
1050
+ z6.object({ state: z6.literal("canceled"), reason: Reason }).strict()
864
1051
  ]);
865
- var PolicyCancelRequest = z5.object({ decisionId: Id3 }).strict();
866
- var PolicyCancelResult = z5.object({ state: z5.enum(["canceled", "already_resolved"]) }).strict();
867
- var PolicyTrace = z5.object({
868
- ruleId: Id3,
1052
+ var PolicyCancelRequest = z6.object({ decisionId: Id4 }).strict();
1053
+ var PolicyCancelResult = z6.object({ state: z6.enum(["canceled", "already_resolved"]) }).strict();
1054
+ var PolicyTrace = z6.object({
1055
+ ruleId: Id4,
869
1056
  ruleRevision: Revision,
870
1057
  ...scopeShape,
871
1058
  verdict: PolicyVerdict.nullable(),
872
1059
  reason: Text.nullable(),
873
- granted: z5.boolean(),
874
- overridden: z5.boolean(),
1060
+ granted: z6.boolean(),
1061
+ overridden: z6.boolean(),
875
1062
  proposedStateUpdates: PolicyCounterMap
876
1063
  }).strict().refine(scopeValid);
877
- var PolicyTestResult = z5.object({
1064
+ var PolicyTestResult = z6.object({
878
1065
  verdict: PolicyVerdict,
879
1066
  reason: Text.nullable(),
880
- trace: z5.array(PolicyTrace).max(128),
881
- proposedStateUpdates: z5.record(Id3, PolicyCounterMap),
882
- enforcement: z5.object({
883
- phases: z5.array(PolicyPhase),
884
- modelRequest: z5.literal(false),
885
- explanation: z5.string()
1067
+ trace: z6.array(PolicyTrace).max(128),
1068
+ proposedStateUpdates: z6.record(Id4, PolicyCounterMap),
1069
+ enforcement: z6.object({
1070
+ phases: z6.array(PolicyPhase),
1071
+ modelRequest: z6.literal(false),
1072
+ explanation: z6.string()
886
1073
  }).strict()
887
1074
  }).strict();
888
- var CreatePolicyRuleRequest = z5.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
889
- var UpdatePolicyRuleRequest = z5.object({
1075
+ var CreatePolicyRuleRequest = z6.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
1076
+ var UpdatePolicyRuleRequest = z6.object({
890
1077
  expectedRevision: Revision,
891
1078
  name: ruleFields.name.optional(),
892
1079
  priority: ruleFields.priority.optional(),
893
- enabled: z5.boolean().optional(),
1080
+ enabled: z6.boolean().optional(),
894
1081
  phases: phases.optional(),
895
1082
  expression: ruleFields.expression.optional()
896
1083
  }).strict().refine((v) => Object.keys(v).length > 1);
897
- var DeletePolicyRuleQuery = z5.object({ expectedRevision: Revision }).strict();
898
- var UpdatePolicySettingsRequest = z5.object({ expectedRevision: Revision, modelClassifications: classifications }).strict();
899
- var PolicyTestRequest = z5.object({
900
- sessionId: Id3,
1084
+ var DeletePolicyRuleQuery = z6.object({ expectedRevision: Revision }).strict();
1085
+ var UpdatePolicySettingsRequest = z6.object({ expectedRevision: Revision, modelClassifications: classifications }).strict();
1086
+ var PolicyTestRequest = z6.object({
1087
+ sessionId: Id4,
901
1088
  phase: PolicyPhase,
902
1089
  tool: toolInput.nullable(),
903
1090
  request: PolicyRequestContext.nullable()
904
1091
  }).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
905
1092
 
906
1093
  // packages/protocol/dist/entities.js
907
- var Iso = z6.string();
908
- var Id4 = z6.string();
909
- var Connectivity = z6.enum(["connected", "reconnecting", "unreachable"]);
910
- var ControlMode = z6.enum(["automation", "human"]);
911
- var Platform = z6.enum(["darwin", "linux"]);
912
- var DeviceKind = z6.enum(["browser", "pwa", "terminal", "cli"]);
913
- var DiagnosticLevel = z6.enum(["info", "warning", "error"]);
1094
+ var Iso2 = z7.string();
1095
+ var Id5 = z7.string();
1096
+ var Connectivity = z7.enum(["connected", "reconnecting", "unreachable"]);
1097
+ var ControlMode = z7.enum(["automation", "human"]);
1098
+ var Platform = z7.enum(["darwin", "linux"]);
1099
+ var DeviceKind = z7.enum(["browser", "pwa", "terminal", "cli"]);
1100
+ var DiagnosticLevel = z7.enum(["info", "warning", "error"]);
914
1101
  var DEFAULT_WORKTREE_DIR = ".worktrees";
915
- var CoreCapabilities = z6.object({
916
- prompt: z6.boolean(),
917
- steer: z6.boolean(),
918
- followUp: z6.boolean(),
919
- abort: z6.boolean(),
920
- resume: z6.boolean(),
921
- rename: z6.boolean(),
922
- importInactive: z6.boolean(),
923
- extensionDialogs: z6.boolean(),
924
- customUi: z6.boolean(),
925
- widgetsText: z6.boolean(),
926
- widgetsComponent: z6.boolean(),
927
- tokenAccounting: z6.boolean(),
928
- costAccounting: z6.boolean()
1102
+ var CoreCapabilities = z7.object({
1103
+ prompt: z7.boolean(),
1104
+ steer: z7.boolean(),
1105
+ followUp: z7.boolean(),
1106
+ abort: z7.boolean(),
1107
+ resume: z7.boolean(),
1108
+ rename: z7.boolean(),
1109
+ importInactive: z7.boolean(),
1110
+ extensionDialogs: z7.boolean(),
1111
+ customUi: z7.boolean(),
1112
+ widgetsText: z7.boolean(),
1113
+ widgetsComponent: z7.boolean(),
1114
+ tokenAccounting: z7.boolean(),
1115
+ costAccounting: z7.boolean()
929
1116
  });
930
1117
  var CAPABILITY_KEYS = CoreCapabilities.keyof().options;
931
1118
  var RuntimeCapabilities = CoreCapabilities.extend({
932
1119
  /** The host runs sessions as interactive Pi in a terminal that clients can attach to. */
933
- terminal: z6.boolean().optional(),
1120
+ terminal: z7.boolean().optional(),
934
1121
  /** The host answers session.models, session.commands, session.setModel, session.setThinking and session.compact. */
935
- sessionControls: z6.boolean().optional(),
1122
+ sessionControls: z7.boolean().optional(),
936
1123
  /** The host answers session.navigate for terminal sessions. */
937
- treeNavigation: z6.boolean().optional(),
938
- agentRequests: z6.boolean().optional(),
939
- messageDelivery: z6.boolean().optional(),
940
- policies: z6.boolean().optional(),
1124
+ treeNavigation: z7.boolean().optional(),
1125
+ agentRequests: z7.boolean().optional(),
1126
+ messageDelivery: z7.boolean().optional(),
1127
+ policies: z7.boolean().optional(),
941
1128
  /** Session-scoped adapter inspection and safe reload. */
942
- adapterDevelopment: z6.boolean().optional(),
943
- unsupported: z6.array(z6.object({ capability: z6.string(), reason: z6.string() }))
1129
+ adapterDevelopment: z7.boolean().optional(),
1130
+ unsupported: z7.array(z7.object({ capability: z7.string(), reason: z7.string() }))
944
1131
  });
945
- var ProjectScan = z6.object({
946
- state: z6.enum(["running", "done", "failed"]),
947
- startedAt: Iso,
948
- finishedAt: Iso.nullable(),
1132
+ var ProjectScan = z7.object({
1133
+ state: z7.enum(["running", "done", "failed"]),
1134
+ startedAt: Iso2,
1135
+ finishedAt: Iso2.nullable(),
949
1136
  /** Repositories found across all folders. */
950
- repositories: z6.number().int(),
1137
+ repositories: z7.number().int(),
951
1138
  /** New projects created by this scan. */
952
- projectsCreated: z6.number().int(),
1139
+ projectsCreated: z7.number().int(),
953
1140
  /** New checkouts (including the ones of new projects). */
954
- checkoutsAdded: z6.number().int(),
1141
+ checkoutsAdded: z7.number().int(),
955
1142
  /** "<folder>: <message>" per folder that failed; for state "failed", the reason last. */
956
- errors: z6.array(z6.string())
957
- });
958
- var UsageWindow = z6.object({
959
- id: z6.enum(["five_hour", "weekly"]),
960
- usedPct: z6.number(),
961
- resetsAt: Iso.nullable()
962
- });
963
- var ProviderUsage = z6.object({
964
- provider: z6.enum(["anthropic", "openai-codex"]),
965
- status: z6.enum(["available", "expired", "rejected", "error"]),
966
- message: z6.string().nullable(),
967
- windows: z6.array(UsageWindow),
968
- fetchedAt: Iso
969
- });
970
- var Host = z6.object({
971
- id: Id4,
972
- name: z6.string(),
1143
+ errors: z7.array(z7.string())
1144
+ });
1145
+ var UsageWindow = z7.object({
1146
+ id: z7.enum(["five_hour", "weekly"]),
1147
+ usedPct: z7.number(),
1148
+ resetsAt: Iso2.nullable()
1149
+ });
1150
+ var ProviderUsage = z7.object({
1151
+ provider: z7.enum(["anthropic", "openai-codex"]),
1152
+ status: z7.enum(["available", "expired", "rejected", "error"]),
1153
+ message: z7.string().nullable(),
1154
+ windows: z7.array(UsageWindow),
1155
+ fetchedAt: Iso2
1156
+ });
1157
+ var Host = z7.object({
1158
+ id: Id5,
1159
+ name: z7.string(),
973
1160
  platform: Platform,
974
- agentVersion: z6.string(),
975
- piVersion: z6.string().nullable(),
976
- piCompatible: z6.boolean(),
1161
+ agentVersion: z7.string(),
1162
+ piVersion: z7.string().nullable(),
1163
+ piCompatible: z7.boolean(),
977
1164
  capabilities: RuntimeCapabilities.nullable(),
978
1165
  connectivity: Connectivity,
979
- lastSeenAt: Iso.nullable(),
980
- revokedAt: Iso.nullable(),
981
- createdAt: Iso,
1166
+ lastSeenAt: Iso2.nullable(),
1167
+ revokedAt: Iso2.nullable(),
1168
+ createdAt: Iso2,
982
1169
  /** Folders on the host whose git repositories become projects (absolute or ~/...). */
983
- projectFolders: z6.array(z6.string()).optional(),
1170
+ projectFolders: z7.array(z7.string()).optional(),
984
1171
  projectScan: ProjectScan.nullable().optional(),
985
1172
  /** Subscription limits (host-reported, refreshed every few minutes). */
986
- usage: z6.array(ProviderUsage).optional(),
1173
+ usage: z7.array(ProviderUsage).optional(),
987
1174
  github: HostGitHub.optional()
988
1175
  });
989
- var WorktreeDir = z6.string().min(1).refine((d) => !d.startsWith("/") && !d.includes("\\"), "must be a relative path").refine((d) => !d.split("/").includes(".."), "must stay inside the repository").refine((d) => d.split("/").every((s) => s.length > 0 && s !== "."), "must be a plain relative path");
990
- var Project = z6.object({
991
- id: Id4,
992
- name: z6.string().min(1),
993
- repoIdentity: z6.string(),
994
- defaultProfileId: Id4.nullable(),
995
- defaultHostId: Id4.nullable(),
996
- maxConcurrentRuns: z6.number().int().min(1).max(32),
997
- automationEnabled: z6.boolean(),
998
- setupCommand: z6.string().nullable(),
999
- checks: z6.array(z6.string()),
1000
- workspaceSharing: z6.enum(["single_writer", "shared"]),
1176
+ var WorktreeDir = z7.string().min(1).refine((d) => !d.startsWith("/") && !d.includes("\\"), "must be a relative path").refine((d) => !d.split("/").includes(".."), "must stay inside the repository").refine((d) => d.split("/").every((s) => s.length > 0 && s !== "."), "must be a plain relative path");
1177
+ var Project = z7.object({
1178
+ id: Id5,
1179
+ name: z7.string().min(1),
1180
+ repoIdentity: z7.string(),
1181
+ defaultProfileId: Id5.nullable(),
1182
+ defaultHostId: Id5.nullable(),
1183
+ maxConcurrentRuns: z7.number().int().min(1).max(32),
1184
+ automationEnabled: z7.boolean(),
1185
+ setupCommand: z7.string().nullable(),
1186
+ checks: z7.array(z7.string()),
1187
+ workspaceSharing: z7.enum(["single_writer", "shared"]),
1001
1188
  worktreeDir: WorktreeDir.default(DEFAULT_WORKTREE_DIR),
1002
1189
  /** Start one session in every non-main worktree the first time it appears without one. */
1003
- ensureSessions: z6.boolean().default(false),
1190
+ ensureSessions: z7.boolean().default(false),
1004
1191
  /** Archive sessions and remove a worktree (and its local branch) once its PR has merged. */
1005
- removeLanded: z6.boolean().default(false),
1006
- createdAt: Iso,
1007
- updatedAt: Iso
1192
+ removeLanded: z7.boolean().default(false),
1193
+ createdAt: Iso2,
1194
+ updatedAt: Iso2
1008
1195
  });
1009
- var Checkout = z6.object({
1010
- id: Id4,
1011
- projectId: Id4,
1012
- hostId: Id4,
1013
- path: z6.string(),
1014
- commonDir: z6.string(),
1015
- defaultBranch: z6.string(),
1016
- createdAt: Iso
1017
- });
1018
- var GitState = z6.object({
1019
- dirty: z6.boolean(),
1020
- changedFiles: z6.number().int(),
1021
- ahead: z6.number().int(),
1022
- behind: z6.number().int(),
1023
- unmerged: z6.boolean(),
1196
+ var Checkout = z7.object({
1197
+ id: Id5,
1198
+ projectId: Id5,
1199
+ hostId: Id5,
1200
+ path: z7.string(),
1201
+ commonDir: z7.string(),
1202
+ defaultBranch: z7.string(),
1203
+ createdAt: Iso2
1204
+ });
1205
+ var GitState = z7.object({
1206
+ dirty: z7.boolean(),
1207
+ changedFiles: z7.number().int(),
1208
+ ahead: z7.number().int(),
1209
+ behind: z7.number().int(),
1210
+ unmerged: z7.boolean(),
1024
1211
  /** HEAD commit; absent from older hosts. */
1025
- head: z6.string().regex(/^[0-9a-f]{40}$/).optional()
1026
- });
1027
- var Workspace = z6.object({
1028
- id: Id4,
1029
- checkoutId: Id4,
1030
- projectId: Id4,
1031
- hostId: Id4,
1032
- path: z6.string(),
1033
- branch: z6.string().nullable(),
1034
- baseBranch: z6.string().nullable(),
1035
- provenance: z6.enum(["managed", "discovered", "main"]),
1212
+ head: z7.string().regex(/^[0-9a-f]{40}$/).optional()
1213
+ });
1214
+ var Workspace = z7.object({
1215
+ id: Id5,
1216
+ checkoutId: Id5,
1217
+ projectId: Id5,
1218
+ hostId: Id5,
1219
+ path: z7.string(),
1220
+ branch: z7.string().nullable(),
1221
+ baseBranch: z7.string().nullable(),
1222
+ provenance: z7.enum(["managed", "discovered", "main"]),
1036
1223
  git: GitState,
1037
- setup: z6.object({
1038
- state: z6.enum(["none", "running", "succeeded", "failed"]),
1039
- log: z6.string()
1224
+ setup: z7.object({
1225
+ state: z7.enum(["none", "running", "succeeded", "failed"]),
1226
+ log: z7.string()
1040
1227
  }),
1041
- archivedAt: Iso.nullable(),
1042
- updatedAt: Iso,
1228
+ archivedAt: Iso2.nullable(),
1229
+ updatedAt: Iso2,
1043
1230
  github: WorkspaceGitHub.optional()
1044
1231
  });
1045
- var ThinkingLevel = z6.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
1046
- var SessionModel = z6.object({
1047
- provider: z6.string(),
1048
- id: z6.string(),
1049
- name: z6.string().nullable(),
1050
- contextWindow: z6.number().nullable(),
1051
- reasoning: z6.boolean(),
1232
+ var ThinkingLevel = z7.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
1233
+ var SessionModel = z7.object({
1234
+ provider: z7.string(),
1235
+ id: z7.string(),
1236
+ name: z7.string().nullable(),
1237
+ contextWindow: z7.number().nullable(),
1238
+ reasoning: z7.boolean(),
1052
1239
  /** In Pi's scoped (favorite) model list; set only when Pi has one. */
1053
- scoped: z6.boolean().optional(),
1240
+ scoped: z7.boolean().optional(),
1054
1241
  /** Effort levels this model accepts, in Pi's order; ["off"] without reasoning. */
1055
- thinkingLevels: z6.array(ThinkingLevel),
1242
+ thinkingLevels: z7.array(ThinkingLevel),
1056
1243
  /** Prompt-cache lifetimes in seconds from Pi's model metadata. */
1057
- promptCache: z6.object({ short: z6.number().optional(), long: z6.number().optional() }).nullable().optional()
1244
+ promptCache: z7.object({ short: z7.number().optional(), long: z7.number().optional() }).nullable().optional()
1058
1245
  });
1059
- var SlashCommand = z6.object({
1060
- name: z6.string().min(1),
1061
- description: z6.string().nullable(),
1062
- source: z6.enum(["extension", "prompt", "skill"]),
1063
- argumentHint: z6.string().nullable().optional()
1246
+ var SlashCommand = z7.object({
1247
+ name: z7.string().min(1),
1248
+ description: z7.string().nullable(),
1249
+ source: z7.enum(["extension", "prompt", "skill"]),
1250
+ argumentHint: z7.string().nullable().optional()
1064
1251
  });
1065
- var ContextUsage = z6.object({
1252
+ var ContextUsage = z7.object({
1066
1253
  /** Estimated tokens in context; null right after compaction until the next reply. */
1067
- tokens: z6.number().nullable(),
1068
- window: z6.number(),
1069
- percent: z6.number().nullable()
1254
+ tokens: z7.number().nullable(),
1255
+ window: z7.number(),
1256
+ percent: z7.number().nullable()
1070
1257
  });
1071
1258
  var FORBIDDEN_EXTRA_ARGS = ["--mode", "--fork", "--no-session", "-e", "--extension"];
1072
- var ExtraArg = z6.string().refine((a) => a.startsWith("--") || !a.startsWith("-"), "extra args must be long flags").refine((a) => !FORBIDDEN_EXTRA_ARGS.includes(a.split("=")[0]) && !a.startsWith("--session"), "this flag is managed by Switchyard");
1073
- var Profile = z6.object({
1074
- id: Id4,
1075
- name: z6.string().min(1),
1076
- provider: z6.string().nullable(),
1077
- model: z6.string().nullable(),
1259
+ var ExtraArg = z7.string().refine((a) => a.startsWith("--") || !a.startsWith("-"), "extra args must be long flags").refine((a) => !FORBIDDEN_EXTRA_ARGS.includes(a.split("=")[0]) && !a.startsWith("--session"), "this flag is managed by Switchyard");
1260
+ var Profile = z7.object({
1261
+ id: Id5,
1262
+ name: z7.string().min(1),
1263
+ provider: z7.string().nullable(),
1264
+ model: z7.string().nullable(),
1078
1265
  thinking: ThinkingLevel.nullable(),
1079
- projectTrust: z6.enum(["ask", "approve", "ignore"]),
1080
- extraArgs: z6.array(ExtraArg),
1266
+ projectTrust: z7.enum(["ask", "approve", "ignore"]),
1267
+ extraArgs: z7.array(ExtraArg),
1081
1268
  /** "vanilla": --no-extensions --no-skills --no-prompt-templates. Undefined means "all". */
1082
- resources: z6.enum(["all", "vanilla"]).optional()
1083
- });
1084
- var ViewClient = z6.object({
1085
- /** `${kind}:${name}@${machine}` */
1086
- id: z6.string().min(1),
1087
- kind: z6.enum(["herdr", "tmux"]),
1088
- name: z6.string().min(1),
1089
- machine: z6.string().min(1),
1090
- lastSeenAt: Iso
1091
- });
1092
- var View = z6.object({
1093
- id: Id4,
1094
- name: z6.string().min(1).max(60),
1095
- mode: z6.enum(["all", "pinned"]),
1096
- projectIds: z6.array(z6.string()).nullable(),
1097
- hostIds: z6.array(z6.string()).nullable(),
1098
- sessionIds: z6.array(z6.string()),
1099
- /** Deprecated: always empty; see Surface. */
1100
- clients: z6.array(ViewClient).default([]),
1101
- /** A tracker keeps this view's projects (see docs/trackers.md). */
1102
- trackerId: z6.string().nullable().optional(),
1103
- createdAt: Iso,
1104
- updatedAt: Iso
1269
+ resources: z7.enum(["all", "vanilla"]).optional()
1270
+ });
1271
+ var Scope = z7.object({
1272
+ id: Id5,
1273
+ name: z7.string().min(1).max(60),
1274
+ mode: z7.enum(["all", "pinned"]),
1275
+ projectIds: z7.array(z7.string()).nullable(),
1276
+ hostIds: z7.array(z7.string()).nullable(),
1277
+ sessionIds: z7.array(z7.string()),
1278
+ /** What feeds this scope its issues; null for a scope of projects you choose. */
1279
+ source: GitHubSource.nullable(),
1280
+ createdAt: Iso2,
1281
+ updatedAt: Iso2
1105
1282
  });
1106
- var SurfaceKind = z6.enum(["herdr", "tmux"]);
1107
- var Surface = z6.object({
1283
+ var ClientKind = z7.string().regex(/^[a-z][a-z0-9-]{0,31}$/);
1284
+ var ClientMirror = z7.enum(["none", "all", "scope"]);
1285
+ var Client = z7.object({
1108
1286
  /** `${kind}:${name}@${machine}` */
1109
- id: z6.string().min(1).max(200),
1110
- kind: SurfaceKind,
1111
- name: z6.string().min(1),
1112
- machine: z6.string().min(1),
1113
- deviceId: Id4,
1114
- hostId: Id4.nullable(),
1115
- viewId: Id4.nullable(),
1116
- lastSeenAt: Iso,
1117
- createdAt: Iso
1118
- });
1119
- var RuntimeState = z6.enum([
1287
+ id: z7.string().min(1).max(200),
1288
+ kind: ClientKind,
1289
+ name: z7.string().min(1),
1290
+ machine: z7.string().min(1),
1291
+ deviceId: Id5,
1292
+ hostId: Id5.nullable(),
1293
+ /** What it mirrors (coordinator-owned). */
1294
+ mirror: ClientMirror,
1295
+ /** The scope it mirrors when `mirror` is "scope" (coordinator-owned). */
1296
+ scopeId: Id5.nullable(),
1297
+ /** When the binding was recorded; null when it never was (a daemon may seed it once). */
1298
+ bindingSetAt: Iso2.nullable().optional(),
1299
+ /** Sessions it shows in mirror tabs or windows now (daemon-owned). */
1300
+ shows: z7.array(Id5).max(1e3).optional(),
1301
+ lastSeenAt: Iso2,
1302
+ createdAt: Iso2
1303
+ });
1304
+ var RuntimeState = z7.enum([
1120
1305
  "starting",
1121
1306
  "idle",
1122
1307
  "running",
@@ -1125,152 +1310,161 @@ var RuntimeState = z6.enum([
1125
1310
  "failed",
1126
1311
  "stopped"
1127
1312
  ]);
1128
- var NativeHandle = z6.object({ sessionId: z6.string(), sessionFile: z6.string() });
1129
- var SessionStats = z6.object({
1130
- tokens: z6.number().nullable(),
1131
- costUsd: z6.number().nullable(),
1313
+ var NativeHandle = z7.object({ sessionId: z7.string(), sessionFile: z7.string() });
1314
+ var SessionStats = z7.object({
1315
+ tokens: z7.number().nullable(),
1316
+ costUsd: z7.number().nullable(),
1132
1317
  /** Completed usage, refreshed for this exact settlement; absent on older hosts or failure. */
1133
1318
  watermark: CompletedUsageWatermark.optional(),
1134
1319
  context: ContextUsage.nullable().optional()
1135
1320
  });
1136
- var PromptCacheInfo = z6.object({
1137
- at: Iso,
1138
- provider: z6.string(),
1139
- model: z6.string(),
1140
- cacheRead: z6.number(),
1141
- cacheWrite: z6.number(),
1142
- cacheWrite1h: z6.number()
1143
- });
1144
- var Session = z6.object({
1145
- id: Id4,
1146
- title: z6.string(),
1147
- subtitle: z6.string().nullable(),
1148
- hostId: Id4,
1149
- workspaceId: Id4.nullable(),
1150
- projectId: Id4.nullable(),
1151
- cwd: z6.string(),
1321
+ var PromptCacheInfo = z7.object({
1322
+ at: Iso2,
1323
+ provider: z7.string(),
1324
+ model: z7.string(),
1325
+ cacheRead: z7.number(),
1326
+ cacheWrite: z7.number(),
1327
+ cacheWrite1h: z7.number()
1328
+ });
1329
+ var Session = z7.object({
1330
+ id: Id5,
1331
+ title: z7.string(),
1332
+ subtitle: z7.string().nullable(),
1333
+ hostId: Id5,
1334
+ workspaceId: Id5.nullable(),
1335
+ projectId: Id5.nullable(),
1336
+ cwd: z7.string(),
1152
1337
  nativeHandle: NativeHandle.nullable(),
1153
1338
  profileSnapshot: Profile,
1154
1339
  runtime: RuntimeState,
1155
- runtimeDetail: z6.string().nullable(),
1340
+ runtimeDetail: z7.string().nullable(),
1156
1341
  connectivity: Connectivity,
1157
- runId: Id4.nullable(),
1158
- taskId: Id4.nullable(),
1159
- provenance: z6.enum(["created", "imported", "subagent"]),
1160
- readOnly: z6.boolean(),
1161
- lastActivityAt: Iso,
1162
- archivedAt: Iso.nullable(),
1163
- queue: z6.object({ steering: z6.array(z6.string()), followUp: z6.array(z6.string()) }),
1342
+ runId: Id5.nullable(),
1343
+ taskId: Id5.nullable(),
1344
+ provenance: z7.enum(["created", "imported", "subagent"]),
1345
+ readOnly: z7.boolean(),
1346
+ lastActivityAt: Iso2,
1347
+ archivedAt: Iso2.nullable(),
1348
+ queue: z7.object({ steering: z7.array(z7.string()), followUp: z7.array(z7.string()) }),
1164
1349
  stats: SessionStats.nullable(),
1165
1350
  /** The live model (host-owned; last known when stopped). */
1166
1351
  model: SessionModel.nullable().optional(),
1167
1352
  /** The live effort (Pi's thinking level). */
1168
1353
  thinking: ThinkingLevel.nullable().optional(),
1169
1354
  /** Pi is compacting the context. */
1170
- compacting: z6.boolean().optional(),
1171
- lastAssistantText: z6.string().nullable(),
1172
- createdAt: Iso,
1355
+ compacting: z7.boolean().optional(),
1356
+ lastAssistantText: z7.string().nullable(),
1357
+ createdAt: Iso2,
1173
1358
  /** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
1174
- terminal: z6.boolean().optional(),
1359
+ terminal: z7.boolean().optional(),
1360
+ /**
1361
+ * A Pi the user started in their own terminal and enrolled (`client`: the id of the herdr or
1362
+ * tmux client it runs in, when known). Switchyard never shows or closes that terminal.
1363
+ */
1364
+ external: z7.object({ client: z7.string().min(1).max(200).nullable() }).nullable().optional(),
1175
1365
  /**
1176
- * A Pi the user started in their own terminal and enrolled (`client`: the herdr session it runs
1177
- * in, when known). Switchyard never shows or closes that terminal.
1366
+ * Where this Pi last ran by hand (host-owned): the client (`herdr:<s>@<m>`, `tmux:<s>@<m>`;
1367
+ * the wire field keeps the name `terminalId`) and pane. Kept after it stops; cleared once
1368
+ * Switchyard starts it. Older hosts omit it.
1178
1369
  */
1179
- external: z6.object({ client: z6.string().min(1).max(200).nullable() }).nullable().optional(),
1370
+ place: z7.object({
1371
+ terminalId: z7.string().min(1).max(200),
1372
+ pane: z7.string().min(1).max(200).nullable()
1373
+ }).nullable().optional(),
1180
1374
  /** The session this subagent was started by (coordinator-owned). */
1181
- parentSessionId: Id4.nullable().optional(),
1375
+ parentSessionId: Id5.nullable().optional(),
1182
1376
  /** Chosen as its branch's primary session (coordinator-owned); without one the primary is derived. */
1183
- primary: z6.boolean().optional(),
1377
+ primary: z7.boolean().optional(),
1184
1378
  /** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
1185
- unreadSince: Iso.nullable().optional(),
1379
+ unreadSince: Iso2.nullable().optional(),
1186
1380
  /** Identity of the adapter presentation currently installed on the host. */
1187
- adapterGeneration: z6.string().uuid().optional(),
1381
+ adapterGeneration: z7.string().uuid().optional(),
1188
1382
  /** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
1189
- transcriptEpoch: z6.number().int().min(0).optional(),
1190
- bridge: z6.object({
1191
- version: z6.literal(1),
1192
- runtimeId: Id4,
1193
- nativeSessionId: Id4,
1383
+ transcriptEpoch: z7.number().int().min(0).optional(),
1384
+ bridge: z7.object({
1385
+ version: z7.literal(1),
1386
+ runtimeId: Id5,
1387
+ nativeSessionId: Id5,
1194
1388
  /** Host-generated local-controller identity, not Pi's private binding credential. */
1195
- controllerEpoch: Id4.optional(),
1196
- agentTools: z6.boolean(),
1197
- messageDelivery: z6.boolean(),
1198
- policyState: z6.enum(["initializing", "active", "unsupported", "lost"]),
1199
- policyPhases: z6.array(PolicyPhase)
1389
+ controllerEpoch: Id5.optional(),
1390
+ agentTools: z7.boolean(),
1391
+ messageDelivery: z7.boolean(),
1392
+ policyState: z7.enum(["initializing", "active", "unsupported", "lost"]),
1393
+ policyPhases: z7.array(PolicyPhase)
1200
1394
  }).optional(),
1201
1395
  /** Last assistant message's cache usage (host-owned). */
1202
1396
  promptCache: PromptCacheInfo.nullable().optional(),
1203
1397
  /** Warn before the prompt cache expires; non-null means on (coordinator-owned). */
1204
- cacheAlert: z6.object({ ttlSec: z6.number().int().min(60).max(86400).nullable(), warnedFor: Iso.nullable() }).nullable().optional()
1398
+ cacheAlert: z7.object({ ttlSec: z7.number().int().min(60).max(86400).nullable(), warnedFor: Iso2.nullable() }).nullable().optional()
1205
1399
  });
1206
- var ContinuationPolicy = z6.discriminatedUnion("enabled", [
1207
- z6.object({ enabled: z6.literal(false) }),
1208
- z6.object({
1209
- enabled: z6.literal(true),
1210
- objective: z6.string().min(1),
1211
- maxContinuations: z6.number().int().min(1).max(50),
1212
- maxElapsedMinutes: z6.number().int().min(1).max(1440),
1213
- maxTokens: z6.number().int().positive().nullable(),
1214
- maxCostUsd: z6.number().positive().nullable()
1400
+ var ContinuationPolicy = z7.discriminatedUnion("enabled", [
1401
+ z7.object({ enabled: z7.literal(false) }),
1402
+ z7.object({
1403
+ enabled: z7.literal(true),
1404
+ objective: z7.string().min(1),
1405
+ maxContinuations: z7.number().int().min(1).max(50),
1406
+ maxElapsedMinutes: z7.number().int().min(1).max(1440),
1407
+ maxTokens: z7.number().int().positive().nullable(),
1408
+ maxCostUsd: z7.number().positive().nullable()
1215
1409
  })
1216
1410
  ]);
1217
- var CompletionPolicy = z6.object({
1218
- checks: z6.array(z6.string()).nullable(),
1219
- requireHumanReview: z6.boolean()
1411
+ var CompletionPolicy = z7.object({
1412
+ checks: z7.array(z7.string()).nullable(),
1413
+ requireHumanReview: z7.boolean()
1220
1414
  });
1221
- var WorkspacePolicy = z6.discriminatedUnion("mode", [
1222
- z6.object({
1223
- mode: z6.literal("new_worktree"),
1224
- branch: z6.string().nullable(),
1225
- base: z6.string().nullable()
1415
+ var WorkspacePolicy = z7.discriminatedUnion("mode", [
1416
+ z7.object({
1417
+ mode: z7.literal("new_worktree"),
1418
+ branch: z7.string().nullable(),
1419
+ base: z7.string().nullable()
1226
1420
  }),
1227
- z6.object({ mode: z6.literal("existing"), workspaceId: Id4 })
1421
+ z7.object({ mode: z7.literal("existing"), workspaceId: Id5 })
1228
1422
  ]);
1229
- var TaskPolicy = z6.object({
1230
- hostId: Id4.nullable(),
1231
- profileId: Id4.nullable(),
1423
+ var TaskPolicy = z7.object({
1424
+ hostId: Id5.nullable(),
1425
+ profileId: Id5.nullable(),
1232
1426
  workspace: WorkspacePolicy,
1233
1427
  continuation: ContinuationPolicy,
1234
1428
  completion: CompletionPolicy
1235
1429
  });
1236
- var TaskState = z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1237
- var Priority = z6.union([z6.literal(0), z6.literal(1), z6.literal(2), z6.literal(3)]);
1238
- var TaskOrigin = z6.discriminatedUnion("kind", [
1239
- z6.object({ kind: z6.literal("manual") }),
1240
- z6.object({
1241
- kind: z6.literal("automation"),
1242
- automationId: Id4,
1243
- occurrenceId: Id4,
1244
- routine: z6.boolean()
1430
+ var TaskState = z7.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1431
+ var Priority = z7.union([z7.literal(0), z7.literal(1), z7.literal(2), z7.literal(3)]);
1432
+ var TaskOrigin = z7.discriminatedUnion("kind", [
1433
+ z7.object({ kind: z7.literal("manual") }),
1434
+ z7.object({
1435
+ kind: z7.literal("automation"),
1436
+ automationId: Id5,
1437
+ occurrenceId: Id5,
1438
+ routine: z7.boolean()
1245
1439
  })
1246
1440
  ]);
1247
- var Task = z6.object({
1248
- id: Id4,
1249
- projectId: Id4,
1250
- title: z6.string().min(1),
1251
- objective: z6.string(),
1252
- acceptanceCriteria: z6.array(z6.string()),
1253
- dependencies: z6.array(Id4),
1441
+ var Task = z7.object({
1442
+ id: Id5,
1443
+ projectId: Id5,
1444
+ title: z7.string().min(1),
1445
+ objective: z7.string(),
1446
+ acceptanceCriteria: z7.array(z7.string()),
1447
+ dependencies: z7.array(Id5),
1254
1448
  priority: Priority,
1255
- position: z6.number(),
1449
+ position: z7.number(),
1256
1450
  state: TaskState,
1257
- blocked: z6.object({ reason: z6.string() }).nullable(),
1258
- notBefore: Iso.nullable(),
1451
+ blocked: z7.object({ reason: z7.string() }).nullable(),
1452
+ notBefore: Iso2.nullable(),
1259
1453
  policy: TaskPolicy,
1260
1454
  origin: TaskOrigin,
1261
- groupingKey: z6.string().nullable(),
1262
- parentTaskId: Id4.nullable().optional(),
1263
- agentOrigin: z6.object({ sessionId: Id4, toolCallId: Id4 }).optional(),
1455
+ groupingKey: z7.string().nullable(),
1456
+ parentTaskId: Id5.nullable().optional(),
1457
+ agentOrigin: z7.object({ sessionId: Id5, toolCallId: Id5 }).optional(),
1264
1458
  githubIssue: GitHubIssue.optional(),
1265
- currentRunId: Id4.nullable(),
1266
- sessionId: Id4.nullable(),
1267
- review: z6.object({ feedback: z6.array(z6.string()), changesRequested: z6.boolean() }),
1268
- hiddenFromBoard: z6.boolean(),
1269
- lastActivityAt: Iso,
1270
- createdAt: Iso,
1271
- updatedAt: Iso
1459
+ currentRunId: Id5.nullable(),
1460
+ sessionId: Id5.nullable(),
1461
+ review: z7.object({ feedback: z7.array(z7.string()), changesRequested: z7.boolean() }),
1462
+ hiddenFromBoard: z7.boolean(),
1463
+ lastActivityAt: Iso2,
1464
+ createdAt: Iso2,
1465
+ updatedAt: Iso2
1272
1466
  });
1273
- var RunState = z6.enum([
1467
+ var RunState = z7.enum([
1274
1468
  "queued",
1275
1469
  "dispatching",
1276
1470
  "uncertain",
@@ -1282,79 +1476,79 @@ var RunState = z6.enum([
1282
1476
  "interrupted",
1283
1477
  "canceled"
1284
1478
  ]);
1285
- var CheckResult = z6.object({
1286
- command: z6.string(),
1287
- exitCode: z6.number().int().nullable(),
1288
- outputTail: z6.string()
1289
- });
1290
- var Run = z6.object({
1291
- id: Id4,
1292
- taskId: Id4,
1293
- sessionId: Id4.nullable(),
1294
- hostId: Id4.nullable(),
1295
- dispatchKey: z6.string(),
1296
- attempt: z6.number().int().min(1),
1479
+ var CheckResult = z7.object({
1480
+ command: z7.string(),
1481
+ exitCode: z7.number().int().nullable(),
1482
+ outputTail: z7.string()
1483
+ });
1484
+ var Run = z7.object({
1485
+ id: Id5,
1486
+ taskId: Id5,
1487
+ sessionId: Id5.nullable(),
1488
+ hostId: Id5.nullable(),
1489
+ dispatchKey: z7.string(),
1490
+ attempt: z7.number().int().min(1),
1297
1491
  state: RunState,
1298
1492
  controlMode: ControlMode,
1299
- controlRevision: z6.number().int().min(1),
1300
- continuationsUsed: z6.number().int().min(0),
1301
- infraRetries: z6.number().int().min(0),
1302
- nextAttemptAt: Iso.nullable(),
1303
- startedAt: Iso.nullable(),
1304
- endedAt: Iso.nullable(),
1305
- outcome: z6.object({
1306
- kind: z6.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1307
- summary: z6.string()
1493
+ controlRevision: z7.number().int().min(1),
1494
+ continuationsUsed: z7.number().int().min(0),
1495
+ infraRetries: z7.number().int().min(0),
1496
+ nextAttemptAt: Iso2.nullable(),
1497
+ startedAt: Iso2.nullable(),
1498
+ endedAt: Iso2.nullable(),
1499
+ outcome: z7.object({
1500
+ kind: z7.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1501
+ summary: z7.string()
1308
1502
  }).nullable(),
1309
1503
  limits: ContinuationPolicy,
1310
- usage: z6.object({
1311
- tokens: z6.number().nullable(),
1312
- costUsd: z6.number().nullable(),
1313
- accounting: z6.enum(["available", "unavailable"]),
1314
- note: z6.string().nullable()
1504
+ usage: z7.object({
1505
+ tokens: z7.number().nullable(),
1506
+ costUsd: z7.number().nullable(),
1507
+ accounting: z7.enum(["available", "unavailable"]),
1508
+ note: z7.string().nullable()
1315
1509
  }),
1316
- checks: z6.array(CheckResult),
1317
- createdAt: Iso,
1318
- updatedAt: Iso
1510
+ checks: z7.array(CheckResult),
1511
+ createdAt: Iso2,
1512
+ updatedAt: Iso2
1319
1513
  });
1320
- var Trigger = z6.discriminatedUnion("kind", [
1321
- z6.object({ kind: z6.literal("manual") }),
1322
- z6.object({ kind: z6.literal("once"), at: Iso }),
1323
- z6.object({ kind: z6.literal("cron"), expr: z6.string().min(1), timezone: z6.string().min(1) }),
1324
- z6.object({ kind: z6.literal("webhook") }),
1325
- z6.object({ kind: z6.literal("dependency"), taskId: Id4 })
1514
+ var Trigger = z7.discriminatedUnion("kind", [
1515
+ z7.object({ kind: z7.literal("manual") }),
1516
+ z7.object({ kind: z7.literal("once"), at: Iso2 }),
1517
+ z7.object({ kind: z7.literal("cron"), expr: z7.string().min(1), timezone: z7.string().min(1) }),
1518
+ z7.object({ kind: z7.literal("webhook") }),
1519
+ z7.object({ kind: z7.literal("dependency"), taskId: Id5 })
1326
1520
  ]);
1327
- var TaskTemplate = z6.object({
1328
- title: z6.string().min(1),
1329
- objective: z6.string(),
1330
- acceptanceCriteria: z6.array(z6.string()),
1521
+ var TaskTemplate = z7.object({
1522
+ title: z7.string().min(1),
1523
+ objective: z7.string(),
1524
+ acceptanceCriteria: z7.array(z7.string()),
1331
1525
  priority: Priority
1332
1526
  });
1333
- var Automation = z6.object({
1334
- id: Id4,
1335
- name: z6.string().min(1),
1336
- enabled: z6.boolean(),
1337
- projectId: Id4,
1527
+ var Automation = z7.object({
1528
+ id: Id5,
1529
+ name: z7.string().min(1),
1530
+ enabled: z7.boolean(),
1531
+ projectId: Id5,
1338
1532
  trigger: Trigger,
1339
- filters: z6.array(z6.object({ path: z6.string(), equals: z6.string() })),
1533
+ filters: z7.array(z7.object({ path: z7.string(), equals: z7.string() })),
1340
1534
  template: TaskTemplate,
1341
- hostId: Id4.nullable(),
1342
- profileId: Id4.nullable(),
1343
- mode: z6.enum(["fresh", "continue", "watch"]),
1344
- groupingKey: z6.string().nullable(),
1345
- overlap: z6.enum(["skip", "queue_one", "append"]),
1346
- missed: z6.enum(["skip", "run_once"]),
1535
+ hostId: Id5.nullable(),
1536
+ profileId: Id5.nullable(),
1537
+ mode: z7.enum(["fresh", "continue", "watch"]),
1538
+ groupingKey: z7.string().nullable(),
1539
+ overlap: z7.enum(["skip", "queue_one", "append"]),
1540
+ missed: z7.enum(["skip", "run_once"]),
1347
1541
  continuation: ContinuationPolicy,
1348
1542
  completion: CompletionPolicy,
1349
- nextAt: Iso.nullable(),
1350
- lastEvaluatedAt: Iso.nullable(),
1351
- lastOutcome: z6.string().nullable(),
1352
- failureCount: z6.number().int().min(0),
1353
- webhookTokenSet: z6.boolean(),
1354
- createdAt: Iso,
1355
- updatedAt: Iso
1543
+ nextAt: Iso2.nullable(),
1544
+ lastEvaluatedAt: Iso2.nullable(),
1545
+ lastOutcome: z7.string().nullable(),
1546
+ failureCount: z7.number().int().min(0),
1547
+ webhookTokenSet: z7.boolean(),
1548
+ createdAt: Iso2,
1549
+ updatedAt: Iso2
1356
1550
  });
1357
- var OccurrenceState = z6.enum([
1551
+ var OccurrenceState = z7.enum([
1358
1552
  "fired",
1359
1553
  "skipped_overlap",
1360
1554
  "skipped_missed",
@@ -1363,39 +1557,39 @@ var OccurrenceState = z6.enum([
1363
1557
  "failed",
1364
1558
  "filtered"
1365
1559
  ]);
1366
- var Occurrence = z6.object({
1367
- id: Id4,
1368
- automationId: Id4,
1369
- key: z6.string(),
1370
- scheduledFor: Iso.nullable(),
1560
+ var Occurrence = z7.object({
1561
+ id: Id5,
1562
+ automationId: Id5,
1563
+ key: z7.string(),
1564
+ scheduledFor: Iso2.nullable(),
1371
1565
  state: OccurrenceState,
1372
- taskId: Id4.nullable(),
1373
- reason: z6.string().nullable(),
1374
- outcome: z6.string().nullable(),
1375
- createdAt: Iso
1376
- });
1377
- var InteractionState = z6.preprocess((v) => v === "cancelled" ? "canceled" : v, z6.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1378
- var Interaction = z6.object({
1379
- id: Id4,
1380
- sessionId: Id4,
1381
- revision: z6.number().int().min(1),
1382
- source: z6.discriminatedUnion("kind", [
1383
- z6.object({
1384
- kind: z6.literal("extension_ui"),
1385
- method: z6.enum(["select", "confirm", "input", "editor"]),
1386
- piRequestIds: z6.array(z6.string())
1566
+ taskId: Id5.nullable(),
1567
+ reason: z7.string().nullable(),
1568
+ outcome: z7.string().nullable(),
1569
+ createdAt: Iso2
1570
+ });
1571
+ var InteractionState = z7.preprocess((v) => v === "cancelled" ? "canceled" : v, z7.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1572
+ var Interaction = z7.object({
1573
+ id: Id5,
1574
+ sessionId: Id5,
1575
+ revision: z7.number().int().min(1),
1576
+ source: z7.discriminatedUnion("kind", [
1577
+ z7.object({
1578
+ kind: z7.literal("extension_ui"),
1579
+ method: z7.enum(["select", "confirm", "input", "editor"]),
1580
+ piRequestIds: z7.array(z7.string())
1387
1581
  }),
1388
- z6.object({ kind: z6.literal("unsupported_custom"), title: z6.string().nullable() })
1582
+ z7.object({ kind: z7.literal("unsupported_custom"), title: z7.string().nullable() })
1389
1583
  ]),
1390
- adapterId: z6.string().nullable(),
1584
+ adapterId: z7.string().nullable(),
1391
1585
  permission: PolicyPermission.optional(),
1392
- title: z6.string(),
1586
+ title: z7.string(),
1393
1587
  presentation: UINodeSchema,
1394
1588
  state: InteractionState,
1395
- resolution: z6.object({ by: z6.string(), summary: z6.string(), at: Iso }).nullable(),
1396
- createdAt: Iso
1589
+ resolution: z7.object({ by: z7.string(), summary: z7.string(), at: Iso2 }).nullable(),
1590
+ createdAt: Iso2
1397
1591
  });
1398
- var AttentionReason = z6.enum([
1592
+ var AttentionReason = z7.enum([
1399
1593
  "needs_input",
1400
1594
  "failed",
1401
1595
  "ready_for_review",
@@ -1403,171 +1597,171 @@ var AttentionReason = z6.enum([
1403
1597
  "host_unreachable",
1404
1598
  "cache_expiring"
1405
1599
  ]);
1406
- var AttentionItem = z6.object({
1407
- id: Id4,
1408
- sessionId: Id4.nullable(),
1409
- taskId: Id4.nullable(),
1410
- projectId: Id4.nullable(),
1600
+ var AttentionItem = z7.object({
1601
+ id: Id5,
1602
+ sessionId: Id5.nullable(),
1603
+ taskId: Id5.nullable(),
1604
+ projectId: Id5.nullable(),
1411
1605
  reason: AttentionReason,
1412
- severity: z6.enum(["info", "warning", "critical"]),
1413
- summary: z6.string(),
1414
- interactionId: Id4.nullable(),
1415
- deepLink: z6.string(),
1416
- acknowledgedAt: Iso.nullable(),
1417
- resolvedAt: Iso.nullable(),
1418
- createdAt: Iso
1419
- });
1420
- var Device = z6.object({
1421
- id: Id4,
1422
- name: z6.string(),
1606
+ severity: z7.enum(["info", "warning", "critical"]),
1607
+ summary: z7.string(),
1608
+ interactionId: Id5.nullable(),
1609
+ deepLink: z7.string(),
1610
+ acknowledgedAt: Iso2.nullable(),
1611
+ resolvedAt: Iso2.nullable(),
1612
+ createdAt: Iso2
1613
+ });
1614
+ var Device = z7.object({
1615
+ id: Id5,
1616
+ name: z7.string(),
1423
1617
  kind: DeviceKind,
1424
- createdAt: Iso,
1425
- lastSeenAt: Iso.nullable(),
1426
- revokedAt: Iso.nullable(),
1427
- push: z6.object({
1428
- subscribed: z6.boolean(),
1429
- permission: z6.enum(["granted", "denied", "default", "unknown"])
1618
+ createdAt: Iso2,
1619
+ lastSeenAt: Iso2.nullable(),
1620
+ revokedAt: Iso2.nullable(),
1621
+ push: z7.object({
1622
+ subscribed: z7.boolean(),
1623
+ permission: z7.enum(["granted", "denied", "default", "unknown"])
1430
1624
  }),
1431
- preferredMobile: z6.boolean(),
1432
- enrolledVia: z6.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1433
- });
1434
- var ToolItemData = z6.object({
1435
- toolCallId: z6.string(),
1436
- name: z6.string(),
1437
- status: z6.enum(["running", "ok", "error"]),
1438
- args: z6.unknown(),
1439
- summary: z6.string(),
1440
- output: z6.string(),
1441
- startedAt: Iso,
1442
- durationMs: z6.number().nullable(),
1625
+ preferredMobile: z7.boolean(),
1626
+ enrolledVia: z7.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1627
+ });
1628
+ var ToolItemData = z7.object({
1629
+ toolCallId: z7.string(),
1630
+ name: z7.string(),
1631
+ status: z7.enum(["running", "ok", "error"]),
1632
+ args: z7.unknown(),
1633
+ summary: z7.string(),
1634
+ output: z7.string(),
1635
+ startedAt: Iso2,
1636
+ durationMs: z7.number().nullable(),
1443
1637
  card: UINodeSchema.nullable(),
1444
- adapterId: z6.string().nullable(),
1445
- adapterGeneration: z6.string().uuid().optional()
1638
+ adapterId: z7.string().nullable(),
1639
+ adapterGeneration: z7.string().uuid().optional()
1446
1640
  });
1447
- var TranscriptItem = z6.discriminatedUnion("kind", [
1448
- z6.object({
1449
- id: Id4,
1450
- sessionId: Id4,
1451
- order: z6.number().int(),
1452
- at: Iso,
1453
- kind: z6.literal("user"),
1454
- data: z6.object({
1455
- text: z6.string(),
1456
- images: z6.number().int().optional(),
1641
+ var TranscriptItem = z7.discriminatedUnion("kind", [
1642
+ z7.object({
1643
+ id: Id5,
1644
+ sessionId: Id5,
1645
+ order: z7.number().int(),
1646
+ at: Iso2,
1647
+ kind: z7.literal("user"),
1648
+ data: z7.object({
1649
+ text: z7.string(),
1650
+ images: z7.number().int().optional(),
1457
1651
  /** Pi session entry id, for rewind and fork from this message. */
1458
- entryId: z6.string().optional()
1652
+ entryId: z7.string().optional()
1459
1653
  })
1460
1654
  }),
1461
- z6.object({
1462
- id: Id4,
1463
- sessionId: Id4,
1464
- order: z6.number().int(),
1465
- at: Iso,
1466
- kind: z6.literal("assistant"),
1467
- data: z6.object({ text: z6.string(), streaming: z6.boolean().optional() })
1655
+ z7.object({
1656
+ id: Id5,
1657
+ sessionId: Id5,
1658
+ order: z7.number().int(),
1659
+ at: Iso2,
1660
+ kind: z7.literal("assistant"),
1661
+ data: z7.object({ text: z7.string(), streaming: z7.boolean().optional() })
1468
1662
  }),
1469
- z6.object({
1470
- id: Id4,
1471
- sessionId: Id4,
1472
- order: z6.number().int(),
1473
- at: Iso,
1474
- kind: z6.literal("thinking"),
1475
- data: z6.object({ text: z6.string() })
1663
+ z7.object({
1664
+ id: Id5,
1665
+ sessionId: Id5,
1666
+ order: z7.number().int(),
1667
+ at: Iso2,
1668
+ kind: z7.literal("thinking"),
1669
+ data: z7.object({ text: z7.string() })
1476
1670
  }),
1477
- z6.object({
1478
- id: Id4,
1479
- sessionId: Id4,
1480
- order: z6.number().int(),
1481
- at: Iso,
1482
- kind: z6.literal("tool"),
1671
+ z7.object({
1672
+ id: Id5,
1673
+ sessionId: Id5,
1674
+ order: z7.number().int(),
1675
+ at: Iso2,
1676
+ kind: z7.literal("tool"),
1483
1677
  data: ToolItemData
1484
1678
  }),
1485
- z6.object({
1486
- id: Id4,
1487
- sessionId: Id4,
1488
- order: z6.number().int(),
1489
- at: Iso,
1490
- kind: z6.literal("notice"),
1491
- data: z6.object({
1679
+ z7.object({
1680
+ id: Id5,
1681
+ sessionId: Id5,
1682
+ order: z7.number().int(),
1683
+ at: Iso2,
1684
+ kind: z7.literal("notice"),
1685
+ data: z7.object({
1492
1686
  level: DiagnosticLevel,
1493
- text: z6.string(),
1494
- customType: z6.string().min(1).max(200).optional(),
1687
+ text: z7.string(),
1688
+ customType: z7.string().min(1).max(200).optional(),
1495
1689
  card: UINodeSchema.optional(),
1496
- adapterId: z6.string().optional(),
1497
- adapterGeneration: z6.string().uuid().optional()
1690
+ adapterId: z7.string().optional(),
1691
+ adapterGeneration: z7.string().uuid().optional()
1498
1692
  }).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
1499
1693
  }),
1500
- z6.object({
1501
- id: Id4,
1502
- sessionId: Id4,
1503
- order: z6.number().int(),
1504
- at: Iso,
1505
- kind: z6.literal("interaction"),
1506
- data: z6.object({ interactionId: Id4 })
1694
+ z7.object({
1695
+ id: Id5,
1696
+ sessionId: Id5,
1697
+ order: z7.number().int(),
1698
+ at: Iso2,
1699
+ kind: z7.literal("interaction"),
1700
+ data: z7.object({ interactionId: Id5 })
1507
1701
  }),
1508
- z6.object({
1509
- id: Id4,
1510
- sessionId: Id4,
1511
- order: z6.number().int(),
1512
- at: Iso,
1513
- kind: z6.literal("subagent"),
1514
- data: z6.object({
1515
- runId: z6.string(),
1516
- label: z6.string(),
1517
- status: z6.string(),
1518
- sessionFile: z6.string().nullable(),
1519
- linkedSessionId: Id4.nullable()
1702
+ z7.object({
1703
+ id: Id5,
1704
+ sessionId: Id5,
1705
+ order: z7.number().int(),
1706
+ at: Iso2,
1707
+ kind: z7.literal("subagent"),
1708
+ data: z7.object({
1709
+ runId: z7.string(),
1710
+ label: z7.string(),
1711
+ status: z7.string(),
1712
+ sessionFile: z7.string().nullable(),
1713
+ linkedSessionId: Id5.nullable()
1520
1714
  })
1521
1715
  }),
1522
- z6.object({
1523
- id: Id4,
1524
- sessionId: Id4,
1525
- order: z6.number().int(),
1526
- at: Iso,
1527
- kind: z6.literal("system"),
1528
- data: z6.object({ text: z6.string(), suggestion: z6.boolean().optional() })
1716
+ z7.object({
1717
+ id: Id5,
1718
+ sessionId: Id5,
1719
+ order: z7.number().int(),
1720
+ at: Iso2,
1721
+ kind: z7.literal("system"),
1722
+ data: z7.object({ text: z7.string(), suggestion: z7.boolean().optional() })
1529
1723
  })
1530
1724
  ]);
1531
- var Panel = z6.object({
1532
- sessionId: Id4,
1533
- adapterId: z6.string(),
1534
- slot: z6.string(),
1535
- title: z6.string(),
1725
+ var Panel = z7.object({
1726
+ sessionId: Id5,
1727
+ adapterId: z7.string(),
1728
+ slot: z7.string(),
1729
+ title: z7.string(),
1536
1730
  node: UINodeSchema.nullable(),
1537
- webRenderer: z6.boolean(),
1538
- mobileFallback: z6.string().nullable(),
1731
+ webRenderer: z7.boolean(),
1732
+ mobileFallback: z7.string().nullable(),
1539
1733
  contribution: ContributionDescriptor.optional(),
1540
- state: z6.unknown().optional(),
1541
- adapterGeneration: z6.string().uuid().optional(),
1542
- updatedAt: Iso
1734
+ state: z7.unknown().optional(),
1735
+ adapterGeneration: z7.string().uuid().optional(),
1736
+ updatedAt: Iso2
1543
1737
  });
1544
- var Diagnostic = z6.object({
1545
- sessionId: Id4.nullable(),
1546
- adapterId: z6.string().nullable(),
1738
+ var Diagnostic = z7.object({
1739
+ sessionId: Id5.nullable(),
1740
+ adapterId: z7.string().nullable(),
1547
1741
  level: DiagnosticLevel,
1548
- message: z6.string(),
1549
- at: Iso
1550
- });
1551
- var AdapterInfo = z6.object({
1552
- id: z6.string(),
1553
- version: z6.string(),
1554
- tier: z6.enum(["project", "owner", "plugin", "bundled"]),
1555
- target: z6.object({
1556
- extension: z6.string(),
1557
- versionRange: z6.string(),
1558
- testedVersions: z6.array(z6.string())
1742
+ message: z7.string(),
1743
+ at: Iso2
1744
+ });
1745
+ var AdapterInfo = z7.object({
1746
+ id: z7.string(),
1747
+ version: z7.string(),
1748
+ tier: z7.enum(["project", "owner", "plugin", "bundled"]),
1749
+ target: z7.object({
1750
+ extension: z7.string(),
1751
+ versionRange: z7.string(),
1752
+ testedVersions: z7.array(z7.string())
1559
1753
  }),
1560
- capabilities: z6.array(z6.string()),
1561
- webRenderer: z6.boolean(),
1562
- status: z6.enum(["active", "disabled", "error"]),
1563
- detail: z6.string().nullable()
1564
- });
1565
- var Passkey = z6.object({
1566
- id: z6.string(),
1567
- name: z6.string(),
1568
- createdAt: Iso,
1569
- lastUsedAt: Iso.nullable(),
1570
- transports: z6.array(z6.string())
1754
+ capabilities: z7.array(z7.string()),
1755
+ webRenderer: z7.boolean(),
1756
+ status: z7.enum(["active", "disabled", "error"]),
1757
+ detail: z7.string().nullable()
1758
+ });
1759
+ var Passkey = z7.object({
1760
+ id: z7.string(),
1761
+ name: z7.string(),
1762
+ createdAt: Iso2,
1763
+ lastUsedAt: Iso2.nullable(),
1764
+ transports: z7.array(z7.string())
1571
1765
  });
1572
1766
 
1573
1767
  // packages/protocol/dist/adapter-preview.js
@@ -1580,92 +1774,92 @@ function bounded(input, ctx) {
1580
1774
  return input;
1581
1775
  } catch (error) {
1582
1776
  ctx.addIssue({ code: "custom", message: error.message });
1583
- return z7.NEVER;
1777
+ return z8.NEVER;
1584
1778
  }
1585
1779
  }
1586
- var Id5 = z7.string().min(1).max(200);
1587
- var Text2 = z7.string().max(64 * 1024);
1588
- var Tool = { toolCallId: Id5, name: Id5, args: z7.unknown() };
1589
- var DialogCommon = { id: Id5, title: Text2 };
1590
- var AdapterPreviewPiUiRequestSchema = z7.discriminatedUnion("method", [
1591
- z7.object({
1780
+ var Id6 = z8.string().min(1).max(200);
1781
+ var Text2 = z8.string().max(64 * 1024);
1782
+ var Tool = { toolCallId: Id6, name: Id6, args: z8.unknown() };
1783
+ var DialogCommon = { id: Id6, title: Text2 };
1784
+ var AdapterPreviewPiUiRequestSchema = z8.discriminatedUnion("method", [
1785
+ z8.object({
1592
1786
  ...DialogCommon,
1593
- method: z7.literal("select"),
1594
- options: z7.array(Text2).max(200),
1595
- timeout: z7.number().nonnegative().optional()
1787
+ method: z8.literal("select"),
1788
+ options: z8.array(Text2).max(200),
1789
+ timeout: z8.number().nonnegative().optional()
1596
1790
  }).strict(),
1597
- z7.object({
1791
+ z8.object({
1598
1792
  ...DialogCommon,
1599
- method: z7.literal("confirm"),
1793
+ method: z8.literal("confirm"),
1600
1794
  message: Text2,
1601
- timeout: z7.number().nonnegative().optional()
1795
+ timeout: z8.number().nonnegative().optional()
1602
1796
  }).strict(),
1603
- z7.object({
1797
+ z8.object({
1604
1798
  ...DialogCommon,
1605
- method: z7.literal("input"),
1799
+ method: z8.literal("input"),
1606
1800
  placeholder: Text2.optional(),
1607
- timeout: z7.number().nonnegative().optional()
1801
+ timeout: z8.number().nonnegative().optional()
1608
1802
  }).strict(),
1609
- z7.object({ ...DialogCommon, method: z7.literal("editor"), prefill: Text2.optional() }).strict()
1803
+ z8.object({ ...DialogCommon, method: z8.literal("editor"), prefill: Text2.optional() }).strict()
1610
1804
  ]);
1611
- var AdapterPreviewStepSchema = z7.discriminatedUnion("kind", [
1612
- z7.object({ kind: z7.literal("restore") }).strict(),
1613
- z7.object({ kind: z7.literal("toolStart"), data: z7.object(Tool).strict() }).strict(),
1614
- z7.object({
1615
- kind: z7.literal("toolUpdate"),
1616
- data: z7.object({ ...Tool, partialResult: z7.unknown(), details: z7.unknown().optional() }).strict()
1805
+ var AdapterPreviewStepSchema = z8.discriminatedUnion("kind", [
1806
+ z8.object({ kind: z8.literal("restore") }).strict(),
1807
+ z8.object({ kind: z8.literal("toolStart"), data: z8.object(Tool).strict() }).strict(),
1808
+ z8.object({
1809
+ kind: z8.literal("toolUpdate"),
1810
+ data: z8.object({ ...Tool, partialResult: z8.unknown(), details: z8.unknown().optional() }).strict()
1617
1811
  }).strict(),
1618
- z7.object({
1619
- kind: z7.literal("toolEnd"),
1620
- data: z7.object({
1812
+ z8.object({
1813
+ kind: z8.literal("toolEnd"),
1814
+ data: z8.object({
1621
1815
  ...Tool,
1622
- result: z7.unknown(),
1623
- isError: z7.boolean(),
1624
- details: z7.unknown().optional()
1816
+ result: z8.unknown(),
1817
+ isError: z8.boolean(),
1818
+ details: z8.unknown().optional()
1625
1819
  }).strict()
1626
1820
  }).strict(),
1627
- z7.object({
1628
- kind: z7.literal("status"),
1629
- data: z7.object({ key: Id5, text: Text2.optional() }).strict()
1821
+ z8.object({
1822
+ kind: z8.literal("status"),
1823
+ data: z8.object({ key: Id6, text: Text2.optional() }).strict()
1630
1824
  }).strict(),
1631
- z7.object({
1632
- kind: z7.literal("widget"),
1633
- data: z7.object({ key: Id5, lines: z7.array(Text2).max(200).optional() }).strict()
1825
+ z8.object({
1826
+ kind: z8.literal("widget"),
1827
+ data: z8.object({ key: Id6, lines: z8.array(Text2).max(200).optional() }).strict()
1634
1828
  }).strict(),
1635
- z7.object({ kind: z7.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1636
- z7.object({
1637
- kind: z7.literal("answer"),
1638
- data: z7.object({ requestId: Id5, response: InteractionResponseSchema }).strict()
1829
+ z8.object({ kind: z8.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1830
+ z8.object({
1831
+ kind: z8.literal("answer"),
1832
+ data: z8.object({ requestId: Id6, response: InteractionResponseSchema }).strict()
1639
1833
  }).strict(),
1640
- z7.object({
1641
- kind: z7.literal("customMessage"),
1642
- data: z7.object({
1643
- customType: Id5,
1644
- content: z7.unknown(),
1645
- display: z7.boolean().optional(),
1646
- details: z7.unknown().optional()
1834
+ z8.object({
1835
+ kind: z8.literal("customMessage"),
1836
+ data: z8.object({
1837
+ customType: Id6,
1838
+ content: z8.unknown(),
1839
+ display: z8.boolean().optional(),
1840
+ details: z8.unknown().optional()
1647
1841
  }).strict()
1648
1842
  }).strict(),
1649
- z7.object({
1650
- kind: z7.literal("action"),
1651
- data: z7.object({ actionId: Id5, payload: z7.unknown() }).strict()
1843
+ z8.object({
1844
+ kind: z8.literal("action"),
1845
+ data: z8.object({ actionId: Id6, payload: z8.unknown() }).strict()
1652
1846
  }).strict()
1653
1847
  ]);
1654
- var AdapterPreviewFixtureSchema = z7.unknown().transform(bounded).pipe(z7.object({
1655
- version: z7.literal(1),
1656
- name: z7.string().min(1).max(200),
1657
- initialState: z7.record(z7.string(), z7.record(z7.string(), z7.unknown())).optional(),
1658
- steps: z7.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
1848
+ var AdapterPreviewFixtureSchema = z8.unknown().transform(bounded).pipe(z8.object({
1849
+ version: z8.literal(1),
1850
+ name: z8.string().min(1).max(200),
1851
+ initialState: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional(),
1852
+ steps: z8.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
1659
1853
  }).strict());
1660
- var PortableNode = z7.unknown().transform((input, ctx) => {
1854
+ var PortableNode = z8.unknown().transform((input, ctx) => {
1661
1855
  try {
1662
1856
  return validateUINode(input);
1663
1857
  } catch (error) {
1664
1858
  ctx.addIssue({ code: "custom", message: error.message });
1665
- return z7.NEVER;
1859
+ return z8.NEVER;
1666
1860
  }
1667
1861
  });
1668
- var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine((panel, ctx) => {
1862
+ var PreviewPanel = Panel.extend({ webRenderer: z8.literal(false) }).superRefine((panel, ctx) => {
1669
1863
  try {
1670
1864
  if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
1671
1865
  throw new Error("Preview panels must use the fake preview session");
@@ -1687,13 +1881,13 @@ var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine(
1687
1881
  ctx.addIssue({ code: "custom", message: error.message });
1688
1882
  }
1689
1883
  });
1690
- var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1691
- version: z7.literal(1),
1692
- name: z7.string().min(1).max(200),
1693
- adapter: z7.object({ id: Id5, version: Id5 }).strict(),
1694
- steps: z7.array(z7.object({
1695
- index: z7.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1696
- kind: z7.enum([
1884
+ var AdapterPreviewSchema = z8.unknown().transform(bounded).pipe(z8.object({
1885
+ version: z8.literal(1),
1886
+ name: z8.string().min(1).max(200),
1887
+ adapter: z8.object({ id: Id6, version: Id6 }).strict(),
1888
+ steps: z8.array(z8.object({
1889
+ index: z8.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1890
+ kind: z8.enum([
1697
1891
  "restore",
1698
1892
  "toolStart",
1699
1893
  "toolUpdate",
@@ -1705,24 +1899,24 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1705
1899
  "customMessage",
1706
1900
  "action"
1707
1901
  ]),
1708
- ok: z7.boolean(),
1709
- error: z7.string().max(4e3).nullable()
1902
+ ok: z8.boolean(),
1903
+ error: z8.string().max(4e3).nullable()
1710
1904
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1711
- panels: z7.array(PreviewPanel).max(256),
1712
- interactions: z7.array(z7.object({
1905
+ panels: z8.array(PreviewPanel).max(256),
1906
+ interactions: z8.array(z8.object({
1713
1907
  request: AdapterPreviewPiUiRequestSchema,
1714
1908
  presentation: PortableNode,
1715
- state: z7.enum(["pending", "resolved"])
1909
+ state: z8.enum(["pending", "resolved"])
1716
1910
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1717
- cards: z7.array(z7.unknown().transform((input, ctx) => {
1911
+ cards: z8.array(z8.unknown().transform((input, ctx) => {
1718
1912
  try {
1719
1913
  return validateContributionCard(input);
1720
1914
  } catch (error) {
1721
1915
  ctx.addIssue({ code: "custom", message: error.message });
1722
- return z7.NEVER;
1916
+ return z8.NEVER;
1723
1917
  }
1724
1918
  })).max(ADAPTER_PREVIEW_MAX_STEPS * 3),
1725
- diagnostics: z7.array(Diagnostic.extend({ message: z7.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
1919
+ diagnostics: z8.array(Diagnostic.extend({ message: z8.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
1726
1920
  }).strict().superRefine((preview, ctx) => {
1727
1921
  const slots = /* @__PURE__ */ new Set();
1728
1922
  let contributions = 0;
@@ -1751,39 +1945,39 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1751
1945
  }));
1752
1946
 
1753
1947
  // packages/protocol/dist/adapters.js
1754
- import { z as z8 } from "zod";
1755
- var Path = z8.string().max(4096);
1948
+ import { z as z9 } from "zod";
1949
+ var Path = z9.string().max(4096);
1756
1950
  var SessionAdapterInfo = AdapterInfo.extend({
1757
- runtimeStatus: z8.enum(["active", "disabled", "unavailable"]),
1758
- runtimeDetail: z8.string().max(4e3).nullable(),
1759
- provenance: z8.object({
1760
- scope: z8.enum(["user", "project", "explicit"]),
1951
+ runtimeStatus: z9.enum(["active", "disabled", "unavailable"]),
1952
+ runtimeDetail: z9.string().max(4e3).nullable(),
1953
+ provenance: z9.object({
1954
+ scope: z9.enum(["user", "project", "explicit"]),
1761
1955
  source: Path.nullable(),
1762
1956
  packageDir: Path.nullable(),
1763
1957
  manifestPath: Path.nullable(),
1764
- targetVersion: z8.string().nullable(),
1765
- entrypoints: z8.array(Path).max(128),
1766
- evidence: z8.enum(["runtime-reported", "package-level", "explicit"])
1958
+ targetVersion: z9.string().nullable(),
1959
+ entrypoints: z9.array(Path).max(128),
1960
+ evidence: z9.enum(["runtime-reported", "package-level", "explicit"])
1767
1961
  })
1768
1962
  });
1769
- var SessionAdaptersResult = z8.object({
1770
- generation: z8.string().uuid().nullable(),
1771
- runtimeId: z8.string().nullable(),
1772
- reloadable: z8.boolean(),
1773
- blockedReason: z8.string().nullable(),
1774
- adapters: z8.array(SessionAdapterInfo).max(256),
1775
- diagnostics: z8.array(Diagnostic).max(100)
1963
+ var SessionAdaptersResult = z9.object({
1964
+ generation: z9.string().uuid().nullable(),
1965
+ runtimeId: z9.string().nullable(),
1966
+ reloadable: z9.boolean(),
1967
+ blockedReason: z9.string().nullable(),
1968
+ adapters: z9.array(SessionAdapterInfo).max(256),
1969
+ diagnostics: z9.array(Diagnostic).max(100)
1776
1970
  });
1777
1971
 
1778
1972
  // packages/protocol/dist/agent-wire.js
1779
- import { z as z9 } from "zod";
1780
- var Id6 = z9.string().min(1).max(200);
1781
- var Instant3 = z9.string().refine((value) => {
1973
+ import { z as z10 } from "zod";
1974
+ var Id7 = z10.string().min(1).max(200);
1975
+ var Instant3 = z10.string().refine((value) => {
1782
1976
  const date = new Date(value);
1783
1977
  return Number.isFinite(date.getTime()) && date.toISOString() === value;
1784
1978
  }, "Expected canonical UTC timestamp");
1785
1979
  var AGENT_FRAME_MAX_BYTES = 128 * 1024;
1786
- var AgentMethod = z9.enum([
1980
+ var AgentMethod = z10.enum([
1787
1981
  "session.bind",
1788
1982
  "task.create",
1789
1983
  "message.send",
@@ -1793,34 +1987,34 @@ var AgentMethod = z9.enum([
1793
1987
  "policy.status",
1794
1988
  "policy.cancel"
1795
1989
  ]);
1796
- var AgentToolMethod = z9.enum(["task.create", "message.send", "inbox.read"]);
1797
- var RequestHash = z9.string().regex(/^[a-f0-9]{64}$/);
1798
- var AgentReceiptPeekRequest = z9.object({ method: AgentToolMethod, args: z9.record(z9.string(), z9.json()) }).strict();
1799
- var AgentReceiptPeekResult = z9.discriminatedUnion("found", [
1800
- z9.object({ found: z9.literal(false) }).strict(),
1801
- z9.object({ found: z9.literal(true), requestHash: RequestHash }).strict()
1990
+ var AgentToolMethod = z10.enum(["task.create", "message.send", "inbox.read"]);
1991
+ var RequestHash = z10.string().regex(/^[a-f0-9]{64}$/);
1992
+ var AgentReceiptPeekRequest = z10.object({ method: AgentToolMethod, args: z10.record(z10.string(), z10.json()) }).strict();
1993
+ var AgentReceiptPeekResult = z10.discriminatedUnion("found", [
1994
+ z10.object({ found: z10.literal(false) }).strict(),
1995
+ z10.object({ found: z10.literal(true), requestHash: RequestHash }).strict()
1802
1996
  ]);
1803
- var AgentReceiptReplay = z9.object({ requestHash: RequestHash }).strict();
1804
- var CreateAgentTask = z9.object({
1805
- objective: z9.string().min(1).max(16e3),
1806
- acceptance: z9.array(z9.string().min(1).max(2e3)).max(100).default([]),
1807
- dependencies: z9.array(Id6).max(100).default([]),
1808
- parentTaskId: Id6.nullable().optional(),
1809
- hostId: Id6.optional(),
1810
- profileId: Id6.optional(),
1811
- notifyOnFinish: z9.boolean().default(true)
1812
- });
1813
- var SendAgentMessage = z9.object({
1814
- sessionId: Id6,
1815
- body: z9.string().min(1).max(16e3),
1816
- mode: z9.enum(["steer", "queue"]),
1817
- replyTo: Id6.optional()
1818
- });
1819
- var ReadAgentInbox = z9.object({
1820
- after: z9.number().int().nonnegative().default(0),
1821
- limit: z9.number().int().min(1).max(100).default(20)
1822
- });
1823
- var DeliveryState = z9.enum([
1997
+ var AgentReceiptReplay = z10.object({ requestHash: RequestHash }).strict();
1998
+ var CreateAgentTask = z10.object({
1999
+ objective: z10.string().min(1).max(16e3),
2000
+ acceptance: z10.array(z10.string().min(1).max(2e3)).max(100).default([]),
2001
+ dependencies: z10.array(Id7).max(100).default([]),
2002
+ parentTaskId: Id7.nullable().optional(),
2003
+ hostId: Id7.optional(),
2004
+ profileId: Id7.optional(),
2005
+ notifyOnFinish: z10.boolean().default(true)
2006
+ });
2007
+ var SendAgentMessage = z10.object({
2008
+ sessionId: Id7,
2009
+ body: z10.string().min(1).max(16e3),
2010
+ mode: z10.enum(["steer", "queue"]),
2011
+ replyTo: Id7.optional()
2012
+ });
2013
+ var ReadAgentInbox = z10.object({
2014
+ after: z10.number().int().nonnegative().default(0),
2015
+ limit: z10.number().int().min(1).max(100).default(20)
2016
+ });
2017
+ var DeliveryState = z10.enum([
1824
2018
  "pending",
1825
2019
  "held",
1826
2020
  "deferred",
@@ -1831,46 +2025,46 @@ var DeliveryState = z9.enum([
1831
2025
  "failed"
1832
2026
  ]);
1833
2027
  var AgentMessageFields = {
1834
- seq: z9.number().int().positive(),
1835
- id: Id6,
1836
- recipientSessionId: Id6,
1837
- replyTo: Id6.nullable(),
1838
- chainId: Id6,
1839
- depth: z9.number().int().min(0).max(4),
1840
- body: z9.unknown(),
1841
- requestedMode: z9.enum(["steer", "queue"]),
2028
+ seq: z10.number().int().positive(),
2029
+ id: Id7,
2030
+ recipientSessionId: Id7,
2031
+ replyTo: Id7.nullable(),
2032
+ chainId: Id7,
2033
+ depth: z10.number().int().min(0).max(4),
2034
+ body: z10.unknown(),
2035
+ requestedMode: z10.enum(["steer", "queue"]),
1842
2036
  deliveryState: DeliveryState,
1843
- holdUntil: z9.string(),
1844
- readAt: z9.string().nullable(),
1845
- createdAt: z9.string()
2037
+ holdUntil: z10.string(),
2038
+ readAt: z10.string().nullable(),
2039
+ createdAt: z10.string()
1846
2040
  };
1847
- var AgentMessage = z9.discriminatedUnion("kind", [
1848
- z9.object({ ...AgentMessageFields, kind: z9.literal("message"), senderSessionId: Id6 }),
1849
- z9.object({
2041
+ var AgentMessage = z10.discriminatedUnion("kind", [
2042
+ z10.object({ ...AgentMessageFields, kind: z10.literal("message"), senderSessionId: Id7 }),
2043
+ z10.object({
1850
2044
  ...AgentMessageFields,
1851
- kind: z9.literal("completion"),
1852
- senderSessionId: Id6.nullable()
2045
+ kind: z10.literal("completion"),
2046
+ senderSessionId: Id7.nullable()
1853
2047
  })
1854
2048
  ]);
1855
- var AgentInbox = z9.object({
1856
- messages: z9.array(AgentMessage),
1857
- nextAfter: z9.number().int().nonnegative(),
1858
- hasMore: z9.boolean()
1859
- });
1860
- var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z9.literal("policy.required") }).strict();
1861
- var AgentRequestFrame = z9.object({
1862
- type: z9.literal("agent.request"),
1863
- requestId: Id6,
1864
- sessionId: Id6,
1865
- nativeSessionId: Id6,
1866
- runtimeId: Id6,
1867
- context: z9.object({ humanInputId: Id6.nullable(), causalMessageId: Id6.nullable() }).strict(),
1868
- toolCallId: Id6.optional(),
2049
+ var AgentInbox = z10.object({
2050
+ messages: z10.array(AgentMessage),
2051
+ nextAfter: z10.number().int().nonnegative(),
2052
+ hasMore: z10.boolean()
2053
+ });
2054
+ var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z10.literal("policy.required") }).strict();
2055
+ var AgentRequestFrame = z10.object({
2056
+ type: z10.literal("agent.request"),
2057
+ requestId: Id7,
2058
+ sessionId: Id7,
2059
+ nativeSessionId: Id7,
2060
+ runtimeId: Id7,
2061
+ context: z10.object({ humanInputId: Id7.nullable(), causalMessageId: Id7.nullable() }).strict(),
2062
+ toolCallId: Id7.optional(),
1869
2063
  receiptReplay: AgentReceiptReplay.optional(),
1870
2064
  // Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
1871
2065
  deadlineAt: Instant3.optional(),
1872
2066
  method: AgentMethod,
1873
- args: z9.unknown()
2067
+ args: z10.unknown()
1874
2068
  }).strict().superRefine((frame, ctx) => {
1875
2069
  if (frame.method === "receipt.peek") {
1876
2070
  if (!frame.toolCallId) {
@@ -1889,19 +2083,19 @@ var AgentRequestFrame = z9.object({
1889
2083
  });
1890
2084
  }
1891
2085
  });
1892
- var AgentResultFrame = z9.discriminatedUnion("ok", [
1893
- z9.object({
1894
- type: z9.literal("agent.result"),
1895
- requestId: Id6,
1896
- runtimeId: Id6,
1897
- ok: z9.literal(true),
1898
- result: z9.unknown()
2086
+ var AgentResultFrame = z10.discriminatedUnion("ok", [
2087
+ z10.object({
2088
+ type: z10.literal("agent.result"),
2089
+ requestId: Id7,
2090
+ runtimeId: Id7,
2091
+ ok: z10.literal(true),
2092
+ result: z10.unknown()
1899
2093
  }),
1900
- z9.object({
1901
- type: z9.literal("agent.result"),
1902
- requestId: Id6,
1903
- runtimeId: Id6,
1904
- ok: z9.literal(false),
2094
+ z10.object({
2095
+ type: z10.literal("agent.result"),
2096
+ requestId: Id7,
2097
+ runtimeId: Id7,
2098
+ ok: z10.literal(false),
1905
2099
  error: ErrorBody
1906
2100
  })
1907
2101
  ]);
@@ -1914,196 +2108,6 @@ import { z as z13 } from "zod";
1914
2108
 
1915
2109
  // packages/protocol/dist/events.js
1916
2110
  import { z as z11 } from "zod";
1917
-
1918
- // packages/protocol/dist/trackers.js
1919
- import { z as z10 } from "zod";
1920
- var Iso2 = z10.string();
1921
- var Id7 = z10.string().min(1);
1922
- var TrackerFollow = z10.enum(["assigned", "board"]);
1923
- var GitHubLogin = z10.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
1924
- var TrackerStatusOption = z10.object({
1925
- id: z10.string().min(1),
1926
- name: z10.string().min(1).max(200)
1927
- });
1928
- var TrackerBoard = z10.object({
1929
- projectNumber: z10.number().int().positive(),
1930
- statusField: z10.string().min(1).max(100).default("Status"),
1931
- /** Column to move a card to once its worktree exists (write-back). */
1932
- onStart: z10.string().min(1).max(200).nullable().default(null),
1933
- /** Column to move a card to once a pull request is open (write-back). */
1934
- onReview: z10.string().min(1).max(200).nullable().default(null),
1935
- /** A single-select field that ranks issues: its first option is the highest. */
1936
- priorityField: z10.string().min(1).max(100).nullable().optional(),
1937
- /** Columns whose cards are not tracked until they have a branch or pull request. */
1938
- backlog: z10.array(z10.string().min(1).max(200)).max(20).optional()
1939
- });
1940
- var Tracker = z10.object({
1941
- id: Id7,
1942
- name: z10.string().min(1).max(60),
1943
- provider: z10.literal("github"),
1944
- hostId: Id7,
1945
- owner: GitHubLogin,
1946
- repositories: z10.array(GitHubRepository).min(1).max(50).nullable(),
1947
- /** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
1948
- extraRepositories: z10.array(GitHubRepository).max(20).optional(),
1949
- board: TrackerBoard.nullable(),
1950
- /** Which issues it follows; absent means "assigned". "board": every open issue on its board. */
1951
- follow: TrackerFollow.optional(),
1952
- writeBack: z10.boolean(),
1953
- moveShared: z10.boolean(),
1954
- /** Make a worktree for an issue branch that has none; absent means true. */
1955
- worktrees: z10.boolean().optional(),
1956
- enabled: z10.boolean(),
1957
- /** The host's `gh` user, from the last sync. */
1958
- login: z10.string().nullable(),
1959
- lastSyncedAt: Iso2.nullable(),
1960
- lastError: z10.string().max(2e3).nullable(),
1961
- createdAt: Iso2,
1962
- updatedAt: Iso2
1963
- });
1964
- var TrackerInput = z10.object({
1965
- name: Tracker.shape.name,
1966
- hostId: Id7,
1967
- owner: GitHubLogin,
1968
- repositories: Tracker.shape.repositories.default(null),
1969
- extraRepositories: z10.array(GitHubRepository).max(20).default([]),
1970
- board: TrackerBoard.nullable().default(null),
1971
- follow: TrackerFollow.default("assigned"),
1972
- writeBack: z10.boolean().default(false),
1973
- moveShared: z10.boolean().default(true),
1974
- worktrees: z10.boolean().default(true),
1975
- enabled: z10.boolean().default(true)
1976
- });
1977
- var TrackerPatch = z10.object({
1978
- name: Tracker.shape.name.optional(),
1979
- hostId: Id7.optional(),
1980
- owner: GitHubLogin.optional(),
1981
- repositories: Tracker.shape.repositories.optional(),
1982
- extraRepositories: z10.array(GitHubRepository).max(20).optional(),
1983
- board: TrackerBoard.nullable().optional(),
1984
- follow: TrackerFollow.optional(),
1985
- writeBack: z10.boolean().optional(),
1986
- moveShared: z10.boolean().optional(),
1987
- worktrees: z10.boolean().optional(),
1988
- enabled: z10.boolean().optional()
1989
- });
1990
- var TrackerItemBoard = z10.object({
1991
- projectId: z10.string().min(1),
1992
- projectItemId: z10.string().min(1),
1993
- fieldId: z10.string().min(1),
1994
- status: z10.string().nullable(),
1995
- statusOptionId: z10.string().nullable(),
1996
- options: z10.array(TrackerStatusOption).max(50),
1997
- /** The issue's value of the tracker's priority field; `rank` is its option's position. */
1998
- priority: z10.object({ name: z10.string().min(1).max(200), rank: z10.number().int().min(0) }).nullable().optional()
1999
- });
2000
- var TrackerPullRequest = z10.object({
2001
- number: z10.number().int().positive(),
2002
- state: z10.enum(["OPEN", "CLOSED", "MERGED"]),
2003
- url: z10.string().url(),
2004
- headRefName: z10.string().min(1).max(255)
2005
- });
2006
- var TrackerParent = z10.object({
2007
- number: z10.number().int().positive(),
2008
- title: z10.string().max(300),
2009
- url: GitHubIssueUrl
2010
- });
2011
- var TrackerSubIssues = z10.object({
2012
- total: z10.number().int().min(0),
2013
- completed: z10.number().int().min(0)
2014
- });
2015
- var TrackerItem = z10.object({
2016
- itemId: z10.string().min(1),
2017
- repository: GitHubRepository,
2018
- number: z10.number().int().positive(),
2019
- title: z10.string().min(1).max(1e3),
2020
- url: GitHubIssueUrl,
2021
- assignees: z10.array(z10.string()).max(20),
2022
- branches: z10.array(z10.string().min(1).max(255)).max(10),
2023
- pullRequest: TrackerPullRequest.nullable(),
2024
- board: TrackerItemBoard.nullable(),
2025
- parent: TrackerParent.nullable().optional(),
2026
- subIssues: TrackerSubIssues.nullable().optional()
2027
- });
2028
- var TrackerSyncResult = z10.object({
2029
- login: z10.string().min(1),
2030
- items: z10.array(TrackerItem).max(200),
2031
- truncated: z10.boolean()
2032
- });
2033
- var TrackedIssue = z10.object({
2034
- /** `${trackerId}:${itemId}` */
2035
- id: Id7,
2036
- trackerId: Id7,
2037
- itemId: z10.string().min(1),
2038
- projectId: Id7,
2039
- repository: GitHubRepository,
2040
- number: z10.number().int().positive(),
2041
- title: z10.string().min(1).max(300),
2042
- url: GitHubIssueUrl,
2043
- assignees: z10.array(z10.string()).max(20),
2044
- /** Branches GitHub links to the issue. */
2045
- branches: z10.array(z10.string()).max(10),
2046
- /** The branch Switchyard works on. */
2047
- branch: z10.string().nullable(),
2048
- workspaceId: Id7.nullable(),
2049
- pullRequest: TrackerPullRequest.nullable(),
2050
- board: TrackerItemBoard.nullable(),
2051
- /** The issue this one is a sub-issue of. */
2052
- parent: TrackerParent.nullable().optional(),
2053
- subIssues: TrackerSubIssues.nullable().optional(),
2054
- updatedAt: Iso2
2055
- });
2056
- var OpenIssueRequest = z10.object({
2057
- hostId: Id7.optional(),
2058
- viewId: z10.string().optional(),
2059
- /** The first prompt of a new session. */
2060
- prompt: z10.string().optional(),
2061
- profileId: z10.string().nullable().optional()
2062
- });
2063
- var TrackerSetStatusResult = z10.discriminatedUnion("status", [
2064
- z10.object({ status: z10.literal("moved") }),
2065
- z10.object({
2066
- status: z10.literal("skipped"),
2067
- reason: z10.enum(["not_assigned", "shared", "stale"])
2068
- })
2069
- ]);
2070
- var LinkIssueRequest = z10.object({ workspaceId: Id7 });
2071
- var TrackerStatusRequest = z10.object({ status: z10.string().min(1).max(200) });
2072
- var TrackerHostSyncRequest = z10.object({
2073
- owner: GitHubLogin,
2074
- repositories: z10.array(GitHubRepository).nullable(),
2075
- board: z10.object({
2076
- projectNumber: z10.number().int().positive(),
2077
- statusField: z10.string().min(1),
2078
- priorityField: z10.string().min(1).nullable().optional()
2079
- }).nullable(),
2080
- follow: TrackerFollow.optional(),
2081
- backlog: z10.array(z10.string().min(1)).max(20).optional()
2082
- });
2083
- var TrackerHostPrepareBranchRequest = z10.object({
2084
- checkoutPath: z10.string().min(1),
2085
- branch: z10.string().min(1).max(255)
2086
- });
2087
- var TrackerHostStartIssueRequest = z10.object({
2088
- checkoutPath: z10.string().min(1),
2089
- repository: GitHubRepository,
2090
- number: z10.number().int().positive(),
2091
- branch: z10.string().min(1).max(255),
2092
- base: z10.string().min(1)
2093
- });
2094
- var TrackerHostSetStatusRequest = z10.object({
2095
- projectId: z10.string().min(1),
2096
- projectItemId: z10.string().min(1),
2097
- fieldId: z10.string().min(1),
2098
- statusField: z10.string().min(1),
2099
- optionId: z10.string().min(1),
2100
- expectedOptionId: z10.string().nullable(),
2101
- login: z10.string().min(1),
2102
- allowShared: z10.boolean(),
2103
- allowUnassigned: z10.boolean().optional()
2104
- });
2105
-
2106
- // packages/protocol/dist/events.js
2107
2111
  var EventDataSchemas = {
2108
2112
  "host.updated": Host,
2109
2113
  "project.updated": Project,
@@ -2113,8 +2117,8 @@ var EventDataSchemas = {
2113
2117
  "workspace.deleted": z11.object({ id: z11.string() }),
2114
2118
  "profile.updated": Profile,
2115
2119
  "profile.deleted": z11.object({ id: z11.string() }),
2116
- "view.updated": View,
2117
- "view.deleted": z11.object({ id: z11.string() }),
2120
+ "scope.updated": Scope,
2121
+ "scope.deleted": z11.object({ id: z11.string() }),
2118
2122
  "session.updated": Session,
2119
2123
  "transcript.item": TranscriptItem,
2120
2124
  "transcript.reset": z11.object({ sessionId: z11.string(), epoch: z11.number().int() }),
@@ -2133,8 +2137,8 @@ var EventDataSchemas = {
2133
2137
  "device.updated": Device,
2134
2138
  "issue.updated": TrackedIssue,
2135
2139
  "issue.deleted": z11.object({ id: z11.string() }),
2136
- "surface.updated": Surface,
2137
- "surface.deleted": z11.object({ id: z11.string() }),
2140
+ "client.updated": Client,
2141
+ "client.deleted": z11.object({ id: z11.string() }),
2138
2142
  "settings.updated": z11.object({ dispatchPaused: z11.boolean() })
2139
2143
  };
2140
2144
  var EVENT_TYPES = Object.keys(EventDataSchemas);
@@ -2349,7 +2353,7 @@ var HostCommand = z13.discriminatedUnion("type", [
2349
2353
  checkoutPath: z13.string(),
2350
2354
  base: z13.string().nullable(),
2351
2355
  force: z13.object({ dirty: z13.boolean(), unmerged: z13.boolean() }),
2352
- /** Also delete the worktree's local branch (hosts before trackers ignore it). */
2356
+ /** Also delete the worktree's local branch (hosts before GitHub issue sync ignore it). */
2353
2357
  deleteBranch: z13.boolean().optional()
2354
2358
  }),
2355
2359
  z13.object({
@@ -2371,10 +2375,10 @@ var HostCommand = z13.discriminatedUnion("type", [
2371
2375
  GitHubHostViewRequest.extend({ type: z13.literal("workspace.prView") }),
2372
2376
  GitHubHostLogsRequest.extend({ type: z13.literal("workspace.prFailedLogs") }),
2373
2377
  GitHubHostMergeRequest.extend({ type: z13.literal("workspace.prMerge") }),
2374
- TrackerHostSyncRequest.extend({ type: z13.literal("tracker.sync") }),
2375
- TrackerHostPrepareBranchRequest.extend({ type: z13.literal("tracker.prepareBranch") }),
2376
- TrackerHostStartIssueRequest.extend({ type: z13.literal("tracker.startIssue") }),
2377
- TrackerHostSetStatusRequest.extend({ type: z13.literal("tracker.setStatus") }),
2378
+ IssueHostSyncRequest.extend({ type: z13.literal("tracker.sync") }),
2379
+ IssueHostPrepareBranchRequest.extend({ type: z13.literal("tracker.prepareBranch") }),
2380
+ IssueHostStartIssueRequest.extend({ type: z13.literal("tracker.startIssue") }),
2381
+ IssueHostSetStatusRequest.extend({ type: z13.literal("tracker.setStatus") }),
2378
2382
  z13.object({
2379
2383
  type: z13.literal("dispatch.start"),
2380
2384
  dispatchKey: z13.string(),
@@ -2672,6 +2676,8 @@ var CreateSessionRequest = z14.object({
2672
2676
  profileId: z14.string().nullable().optional(),
2673
2677
  prompt: z14.string().default(""),
2674
2678
  title: z14.string().optional(),
2679
+ scopeId: z14.string().optional(),
2680
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2675
2681
  viewId: z14.string().optional()
2676
2682
  });
2677
2683
  var OpenBranchRequest = z14.object({
@@ -2682,6 +2688,8 @@ var OpenBranchRequest = z14.object({
2682
2688
  prompt: z14.string().default(""),
2683
2689
  profileId: z14.string().nullable().optional(),
2684
2690
  title: z14.string().optional(),
2691
+ scopeId: z14.string().optional(),
2692
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2685
2693
  viewId: z14.string().optional(),
2686
2694
  /** Start another session even when the branch has one. */
2687
2695
  another: z14.boolean().default(false)
@@ -3039,30 +3047,38 @@ var MeResponse = z14.object({
3039
3047
  admin: z14.boolean(),
3040
3048
  publicUrl: z14.string()
3041
3049
  });
3042
- var SurfaceReport = Surface.pick({
3043
- kind: true,
3044
- name: true,
3045
- machine: true,
3046
- viewId: true
3047
- }).extend({ hostId: z14.string().nullable().optional() });
3048
- var ViewInput = View.pick({
3049
- name: true,
3050
- mode: true,
3051
- projectIds: true,
3052
- hostIds: true
3053
- }).partial({
3054
- mode: true,
3055
- projectIds: true,
3056
- hostIds: true
3057
- });
3058
- var ViewPatch = ViewInput.partial();
3059
- var ViewClientReport = ViewClient.omit({ lastSeenAt: true });
3050
+ var ClientBindingInput = z14.object({ mirror: ClientMirror, scopeId: z14.string().min(1).nullable().optional() }).refine((b) => b.mirror === "scope" === !!b.scopeId, {
3051
+ message: "scopeId is required for mirror=scope and only then"
3052
+ });
3053
+ var ClientReport = Client.pick({ kind: true, name: true, machine: true }).extend({
3054
+ hostId: z14.string().nullable().optional(),
3055
+ /** Sessions in its mirror tabs or windows; omitted when unchanged or unknown. */
3056
+ shows: z14.array(z14.string()).max(1e3).optional(),
3057
+ /** The binding this client had before bindings were recorded (env file); applied only when none is recorded. */
3058
+ seed: ClientBindingInput.optional()
3059
+ });
3060
+ var ScopeInput = z14.object({
3061
+ name: Scope.shape.name,
3062
+ mode: Scope.shape.mode.optional(),
3063
+ projectIds: Scope.shape.projectIds.optional(),
3064
+ hostIds: Scope.shape.hostIds.optional(),
3065
+ /** A GitHub source makes this a GitHub scope; its projects are then kept by GitHub. */
3066
+ source: GitHubSourceInput.nullable().optional()
3067
+ });
3068
+ var ScopePatch = z14.object({
3069
+ name: Scope.shape.name.optional(),
3070
+ mode: Scope.shape.mode.optional(),
3071
+ projectIds: Scope.shape.projectIds.optional(),
3072
+ hostIds: Scope.shape.hostIds.optional(),
3073
+ /** null removes the source; an object changes it, or adds one (then hostId and owner are required). */
3074
+ source: GitHubSourcePatch.nullable().optional()
3075
+ });
3060
3076
  var ProjectSuggestionsResponse = z14.object({
3061
3077
  suggestions: z14.array(ProjectSuggestion.extend({ name: z14.string(), preselected: z14.boolean() }))
3062
3078
  });
3063
3079
 
3064
- // packages/protocol/dist/views.js
3065
- var SURFACE_OPEN_MS = 10 * 6e4;
3080
+ // packages/protocol/dist/scopes.js
3081
+ var CLIENT_OPEN_MS = 10 * 6e4;
3066
3082
 
3067
3083
  // packages/protocol/dist/client-wire.js
3068
3084
  import { z as z15 } from "zod";
@@ -3072,7 +3088,8 @@ var SyncState = z15.object({
3072
3088
  checkouts: z15.array(Checkout),
3073
3089
  workspaces: z15.array(Workspace),
3074
3090
  profiles: z15.array(Profile),
3075
- views: z15.array(View),
3091
+ /** Scopes; absent from coordinators before 0.21. */
3092
+ scopes: z15.array(Scope).default([]),
3076
3093
  sessions: z15.array(Session),
3077
3094
  tasks: z15.array(Task),
3078
3095
  runs: z15.array(Run),
@@ -3083,17 +3100,24 @@ var SyncState = z15.object({
3083
3100
  devices: z15.array(Device),
3084
3101
  /** Tracked issues; absent from older coordinators. */
3085
3102
  issues: z15.array(TrackedIssue).default([]),
3086
- /** Terminal surfaces; absent from older coordinators. */
3087
- surfaces: z15.array(Surface).default([]),
3103
+ /** Clients (herdr and tmux sessions); absent from coordinators before 0.21. */
3104
+ clients: z15.array(Client).default([]),
3088
3105
  adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
3089
3106
  dispatchPaused: z15.boolean()
3090
3107
  });
3091
3108
  var Presence = z15.object({
3092
3109
  foreground: z15.boolean(),
3093
3110
  interactedAt: z15.string().nullable(),
3094
- viewing: z15.object({ sessionId: z15.string() }).nullable()
3111
+ viewing: z15.object({ sessionId: z15.string() }).nullable(),
3112
+ /**
3113
+ * A herdr or tmux daemon reporting the session focused in its client (kept apart from the
3114
+ * device's own presence).
3115
+ */
3116
+ clientId: z15.string().min(1).max(200).optional(),
3117
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of clientId. */
3118
+ terminalId: z15.string().min(1).max(200).optional()
3095
3119
  });
3096
- var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
3120
+ var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1", "scopes.v1"];
3097
3121
  var ClientToServer = z15.discriminatedUnion("type", [
3098
3122
  z15.object({
3099
3123
  type: z15.literal("hello"),