@spencerboucher/switchyard 0.20.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 (107) hide show
  1. package/README.md +20 -16
  2. package/dist/policies/worker.js +1029 -1040
  3. package/dist/switchyard.mjs +3426 -3311
  4. package/package.json +1 -1
  5. package/web-dist/assets/AutomationView-8yzlARUS.js +2 -0
  6. package/web-dist/assets/{AutomationView-B4O_teaB.js.map → AutomationView-8yzlARUS.js.map} +1 -1
  7. package/web-dist/assets/{Field-Cp-08kpe.js → Field-DBm2uYcg.js} +2 -2
  8. package/web-dist/assets/{Field-Cp-08kpe.js.map → Field-DBm2uYcg.js.map} +1 -1
  9. package/web-dist/assets/{Markdown-BPWc6K6m.js → Markdown-BijzTpiJ.js} +2 -2
  10. package/web-dist/assets/{Markdown-BPWc6K6m.js.map → Markdown-BijzTpiJ.js.map} +1 -1
  11. package/web-dist/assets/Menu-BCTLk6pj.js +2 -0
  12. package/web-dist/assets/Menu-BCTLk6pj.js.map +1 -0
  13. package/web-dist/assets/{Priority-ZGpTH645.js → Priority-DAhFDJ7E.js} +2 -2
  14. package/web-dist/assets/{Priority-ZGpTH645.js.map → Priority-DAhFDJ7E.js.map} +1 -1
  15. package/web-dist/assets/ScopeSelect-CMmLEwNw.js +2 -0
  16. package/web-dist/assets/ScopeSelect-CMmLEwNw.js.map +1 -0
  17. package/web-dist/assets/Select-CDRJ35wi.js +2 -0
  18. package/web-dist/assets/{Select-DHRR7IAK.js.map → Select-CDRJ35wi.js.map} +1 -1
  19. package/web-dist/assets/Tabs-D1t1tQzS.js +2 -0
  20. package/web-dist/assets/{Tabs-2GilVMsH.js.map → Tabs-D1t1tQzS.js.map} +1 -1
  21. package/web-dist/assets/{UINodeRenderer-BaANWHvJ.js → UINodeRenderer-CzoNfuWZ.js} +3 -3
  22. package/web-dist/assets/{UINodeRenderer-BaANWHvJ.js.map → UINodeRenderer-CzoNfuWZ.js.map} +1 -1
  23. package/web-dist/assets/UnfilteredNote-ddFROo9x.js +2 -0
  24. package/web-dist/assets/UnfilteredNote-ddFROo9x.js.map +1 -0
  25. package/web-dist/assets/api-hJ_Ikv1a.js +2 -0
  26. package/web-dist/assets/api-hJ_Ikv1a.js.map +1 -0
  27. package/web-dist/assets/attention-8UbWvCkj.js +2 -0
  28. package/web-dist/assets/attention-8UbWvCkj.js.map +1 -0
  29. package/web-dist/assets/automations-ClK2gYj8.js +2 -0
  30. package/web-dist/assets/{automations-IX9DQNk8.js.map → automations-ClK2gYj8.js.map} +1 -1
  31. package/web-dist/assets/board-4FKGJU8D.js +6 -0
  32. package/web-dist/assets/board-4FKGJU8D.js.map +1 -0
  33. package/web-dist/assets/code-BD2TozC7.js +25 -0
  34. package/web-dist/assets/code-BD2TozC7.js.map +1 -0
  35. package/web-dist/assets/{core.esm-C4dCvG0s.js → core.esm-B2OVQjr5.js} +2 -2
  36. package/web-dist/assets/{core.esm-C4dCvG0s.js.map → core.esm-B2OVQjr5.js.map} +1 -1
  37. package/web-dist/assets/{describe-BeFxHr2Y.js → describe-DBhLxCUs.js} +3 -3
  38. package/web-dist/assets/{describe-BeFxHr2Y.js.map → describe-DBhLxCUs.js.map} +1 -1
  39. package/web-dist/assets/enroll-JhMxQuxw.js +2 -0
  40. package/web-dist/assets/{enroll-GUEF5Uxu.js.map → enroll-JhMxQuxw.js.map} +1 -1
  41. package/web-dist/assets/index-Bc5JWkn9.js +17 -0
  42. package/web-dist/assets/index-Bc5JWkn9.js.map +1 -0
  43. package/web-dist/assets/{keyboardLayers-BZOygMAH.js → keyboardLayers-4IDHV-jq.js} +2 -2
  44. package/web-dist/assets/{keyboardLayers-BZOygMAH.js.map → keyboardLayers-4IDHV-jq.js.map} +1 -1
  45. package/web-dist/assets/logic-DUKcqVPg.js +4 -0
  46. package/web-dist/assets/logic-DUKcqVPg.js.map +1 -0
  47. package/web-dist/assets/more-CUfPZ6AG.js +2 -0
  48. package/web-dist/assets/{more-C1oPXLVM.js.map → more-CUfPZ6AG.js.map} +1 -1
  49. package/web-dist/assets/{policyLogic-DqKyFQEW.js → policyLogic-Btk1SjgX.js} +2 -2
  50. package/web-dist/assets/{policyLogic-DqKyFQEW.js.map → policyLogic-Btk1SjgX.js.map} +1 -1
  51. package/web-dist/assets/{queue-DWSd1kia.js → queue-gs6Ez_u3.js} +2 -2
  52. package/web-dist/assets/queue-gs6Ez_u3.js.map +1 -0
  53. package/web-dist/assets/repo-T2dxdBnU.js +2 -0
  54. package/web-dist/assets/repo-T2dxdBnU.js.map +1 -0
  55. package/web-dist/assets/selection-DBzwvhnW.js +7 -0
  56. package/web-dist/assets/selection-DBzwvhnW.js.map +1 -0
  57. package/web-dist/assets/settings-DpK1_7vb.js +12 -0
  58. package/web-dist/assets/settings-DpK1_7vb.js.map +1 -0
  59. package/web-dist/assets/states-DL6w2pmK.js +58 -0
  60. package/web-dist/assets/states-DL6w2pmK.js.map +1 -0
  61. package/web-dist/assets/terminal-login-DNyAyWlB.js +2 -0
  62. package/web-dist/assets/{terminal-login-BdkmJdOO.js.map → terminal-login-DNyAyWlB.js.map} +1 -1
  63. package/web-dist/assets/useNow-wwKWj7oX.js +2 -0
  64. package/web-dist/assets/useNow-wwKWj7oX.js.map +1 -0
  65. package/web-dist/assets/{useResource-DYNGG9XS.js → useResource-D_GOVIub.js} +2 -2
  66. package/web-dist/assets/{useResource-DYNGG9XS.js.map → useResource-D_GOVIub.js.map} +1 -1
  67. package/web-dist/assets/workboard-B89WFLVO.js +3 -0
  68. package/web-dist/assets/workboard-B89WFLVO.js.map +1 -0
  69. package/web-dist/index.html +4 -3
  70. package/web-dist/sw.js +1 -1
  71. package/web-dist/sw.js.map +1 -1
  72. package/web-dist/assets/AutomationView-B4O_teaB.js +0 -2
  73. package/web-dist/assets/Select-DHRR7IAK.js +0 -2
  74. package/web-dist/assets/Tabs-2GilVMsH.js +0 -2
  75. package/web-dist/assets/UnfilteredNote-zVO8ajSi.js +0 -2
  76. package/web-dist/assets/UnfilteredNote-zVO8ajSi.js.map +0 -1
  77. package/web-dist/assets/ViewSelect-C9gNftWK.js +0 -2
  78. package/web-dist/assets/ViewSelect-C9gNftWK.js.map +0 -1
  79. package/web-dist/assets/api-DMrk4xwq.js +0 -2
  80. package/web-dist/assets/api-DMrk4xwq.js.map +0 -1
  81. package/web-dist/assets/attention-B9uawu1d.js +0 -2
  82. package/web-dist/assets/attention-B9uawu1d.js.map +0 -1
  83. package/web-dist/assets/automations-IX9DQNk8.js +0 -2
  84. package/web-dist/assets/board-BUAI4L7M.js +0 -6
  85. package/web-dist/assets/board-BUAI4L7M.js.map +0 -1
  86. package/web-dist/assets/code-Dav4E15n.js +0 -25
  87. package/web-dist/assets/code-Dav4E15n.js.map +0 -1
  88. package/web-dist/assets/describe-B66LJTqU.js +0 -2
  89. package/web-dist/assets/describe-B66LJTqU.js.map +0 -1
  90. package/web-dist/assets/enroll-GUEF5Uxu.js +0 -2
  91. package/web-dist/assets/index-BUZpNu-R.js +0 -22
  92. package/web-dist/assets/index-BUZpNu-R.js.map +0 -1
  93. package/web-dist/assets/logic-BBQ4d1GC.js +0 -4
  94. package/web-dist/assets/logic-BBQ4d1GC.js.map +0 -1
  95. package/web-dist/assets/more-C1oPXLVM.js +0 -2
  96. package/web-dist/assets/queue-DWSd1kia.js.map +0 -1
  97. package/web-dist/assets/repo-DRwGWCut.js +0 -2
  98. package/web-dist/assets/repo-DRwGWCut.js.map +0 -1
  99. package/web-dist/assets/settings-B0IbaTOd.js +0 -12
  100. package/web-dist/assets/settings-B0IbaTOd.js.map +0 -1
  101. package/web-dist/assets/states-hyf_ATdQ.js +0 -58
  102. package/web-dist/assets/states-hyf_ATdQ.js.map +0 -1
  103. package/web-dist/assets/terminal-login-BdkmJdOO.js +0 -2
  104. package/web-dist/assets/useNow-DXyC-YfE.js +0 -2
  105. package/web-dist/assets/useNow-DXyC-YfE.js.map +0 -1
  106. package/web-dist/assets/workboard-BJCZsLp5.js +0 -3
  107. package/web-dist/assets/workboard-BJCZsLp5.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,322 +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 Terminal. */
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 TerminalKind = z6.enum(["herdr", "tmux"]);
1107
- var TerminalMirror = z6.enum(["none", "all", "view"]);
1108
- var Terminal = 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({
1109
1286
  /** `${kind}:${name}@${machine}` */
1110
- id: z6.string().min(1).max(200),
1111
- kind: TerminalKind,
1112
- name: z6.string().min(1),
1113
- machine: z6.string().min(1),
1114
- deviceId: Id4,
1115
- hostId: Id4.nullable(),
1116
- /** What it mirrors (coordinator-owned); older records have only `viewId`. */
1117
- mirror: TerminalMirror.optional(),
1118
- /** The view it mirrors when `mirror` is "view" (coordinator-owned). */
1119
- viewId: Id4.nullable(),
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(),
1120
1297
  /** When the binding was recorded; null when it never was (a daemon may seed it once). */
1121
- bindingSetAt: Iso.nullable().optional(),
1298
+ bindingSetAt: Iso2.nullable().optional(),
1122
1299
  /** Sessions it shows in mirror tabs or windows now (daemon-owned). */
1123
- shows: z6.array(Id4).max(1e3).optional(),
1124
- lastSeenAt: Iso,
1125
- createdAt: Iso
1300
+ shows: z7.array(Id5).max(1e3).optional(),
1301
+ lastSeenAt: Iso2,
1302
+ createdAt: Iso2
1126
1303
  });
1127
- var RuntimeState = z6.enum([
1304
+ var RuntimeState = z7.enum([
1128
1305
  "starting",
1129
1306
  "idle",
1130
1307
  "running",
@@ -1133,160 +1310,161 @@ var RuntimeState = z6.enum([
1133
1310
  "failed",
1134
1311
  "stopped"
1135
1312
  ]);
1136
- var NativeHandle = z6.object({ sessionId: z6.string(), sessionFile: z6.string() });
1137
- var SessionStats = z6.object({
1138
- tokens: z6.number().nullable(),
1139
- 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(),
1140
1317
  /** Completed usage, refreshed for this exact settlement; absent on older hosts or failure. */
1141
1318
  watermark: CompletedUsageWatermark.optional(),
1142
1319
  context: ContextUsage.nullable().optional()
1143
1320
  });
1144
- var PromptCacheInfo = z6.object({
1145
- at: Iso,
1146
- provider: z6.string(),
1147
- model: z6.string(),
1148
- cacheRead: z6.number(),
1149
- cacheWrite: z6.number(),
1150
- cacheWrite1h: z6.number()
1151
- });
1152
- var Session = z6.object({
1153
- id: Id4,
1154
- title: z6.string(),
1155
- subtitle: z6.string().nullable(),
1156
- hostId: Id4,
1157
- workspaceId: Id4.nullable(),
1158
- projectId: Id4.nullable(),
1159
- 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(),
1160
1337
  nativeHandle: NativeHandle.nullable(),
1161
1338
  profileSnapshot: Profile,
1162
1339
  runtime: RuntimeState,
1163
- runtimeDetail: z6.string().nullable(),
1340
+ runtimeDetail: z7.string().nullable(),
1164
1341
  connectivity: Connectivity,
1165
- runId: Id4.nullable(),
1166
- taskId: Id4.nullable(),
1167
- provenance: z6.enum(["created", "imported", "subagent"]),
1168
- readOnly: z6.boolean(),
1169
- lastActivityAt: Iso,
1170
- archivedAt: Iso.nullable(),
1171
- 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()) }),
1172
1349
  stats: SessionStats.nullable(),
1173
1350
  /** The live model (host-owned; last known when stopped). */
1174
1351
  model: SessionModel.nullable().optional(),
1175
1352
  /** The live effort (Pi's thinking level). */
1176
1353
  thinking: ThinkingLevel.nullable().optional(),
1177
1354
  /** Pi is compacting the context. */
1178
- compacting: z6.boolean().optional(),
1179
- lastAssistantText: z6.string().nullable(),
1180
- createdAt: Iso,
1355
+ compacting: z7.boolean().optional(),
1356
+ lastAssistantText: z7.string().nullable(),
1357
+ createdAt: Iso2,
1181
1358
  /** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
1182
- terminal: z6.boolean().optional(),
1359
+ terminal: z7.boolean().optional(),
1183
1360
  /**
1184
- * A Pi the user started in their own terminal and enrolled (`client`: the herdr session it runs
1185
- * in, when known). Switchyard never shows or closes that terminal.
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.
1186
1363
  */
1187
- external: z6.object({ client: z6.string().min(1).max(200).nullable() }).nullable().optional(),
1364
+ external: z7.object({ client: z7.string().min(1).max(200).nullable() }).nullable().optional(),
1188
1365
  /**
1189
- * Where this Pi last ran by hand (host-owned): the terminal (`herdr:<s>@<m>`, `tmux:<s>@<m>`)
1190
- * and pane. Kept after it stops; cleared once Switchyard starts it. Older hosts omit it.
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.
1191
1369
  */
1192
- place: z6.object({
1193
- terminalId: z6.string().min(1).max(200),
1194
- pane: z6.string().min(1).max(200).nullable()
1370
+ place: z7.object({
1371
+ terminalId: z7.string().min(1).max(200),
1372
+ pane: z7.string().min(1).max(200).nullable()
1195
1373
  }).nullable().optional(),
1196
1374
  /** The session this subagent was started by (coordinator-owned). */
1197
- parentSessionId: Id4.nullable().optional(),
1375
+ parentSessionId: Id5.nullable().optional(),
1198
1376
  /** Chosen as its branch's primary session (coordinator-owned); without one the primary is derived. */
1199
- primary: z6.boolean().optional(),
1377
+ primary: z7.boolean().optional(),
1200
1378
  /** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
1201
- unreadSince: Iso.nullable().optional(),
1379
+ unreadSince: Iso2.nullable().optional(),
1202
1380
  /** Identity of the adapter presentation currently installed on the host. */
1203
- adapterGeneration: z6.string().uuid().optional(),
1381
+ adapterGeneration: z7.string().uuid().optional(),
1204
1382
  /** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
1205
- transcriptEpoch: z6.number().int().min(0).optional(),
1206
- bridge: z6.object({
1207
- version: z6.literal(1),
1208
- runtimeId: Id4,
1209
- 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,
1210
1388
  /** Host-generated local-controller identity, not Pi's private binding credential. */
1211
- controllerEpoch: Id4.optional(),
1212
- agentTools: z6.boolean(),
1213
- messageDelivery: z6.boolean(),
1214
- policyState: z6.enum(["initializing", "active", "unsupported", "lost"]),
1215
- 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)
1216
1394
  }).optional(),
1217
1395
  /** Last assistant message's cache usage (host-owned). */
1218
1396
  promptCache: PromptCacheInfo.nullable().optional(),
1219
1397
  /** Warn before the prompt cache expires; non-null means on (coordinator-owned). */
1220
- 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()
1221
1399
  });
1222
- var ContinuationPolicy = z6.discriminatedUnion("enabled", [
1223
- z6.object({ enabled: z6.literal(false) }),
1224
- z6.object({
1225
- enabled: z6.literal(true),
1226
- objective: z6.string().min(1),
1227
- maxContinuations: z6.number().int().min(1).max(50),
1228
- maxElapsedMinutes: z6.number().int().min(1).max(1440),
1229
- maxTokens: z6.number().int().positive().nullable(),
1230
- 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()
1231
1409
  })
1232
1410
  ]);
1233
- var CompletionPolicy = z6.object({
1234
- checks: z6.array(z6.string()).nullable(),
1235
- requireHumanReview: z6.boolean()
1411
+ var CompletionPolicy = z7.object({
1412
+ checks: z7.array(z7.string()).nullable(),
1413
+ requireHumanReview: z7.boolean()
1236
1414
  });
1237
- var WorkspacePolicy = z6.discriminatedUnion("mode", [
1238
- z6.object({
1239
- mode: z6.literal("new_worktree"),
1240
- branch: z6.string().nullable(),
1241
- 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()
1242
1420
  }),
1243
- z6.object({ mode: z6.literal("existing"), workspaceId: Id4 })
1421
+ z7.object({ mode: z7.literal("existing"), workspaceId: Id5 })
1244
1422
  ]);
1245
- var TaskPolicy = z6.object({
1246
- hostId: Id4.nullable(),
1247
- profileId: Id4.nullable(),
1423
+ var TaskPolicy = z7.object({
1424
+ hostId: Id5.nullable(),
1425
+ profileId: Id5.nullable(),
1248
1426
  workspace: WorkspacePolicy,
1249
1427
  continuation: ContinuationPolicy,
1250
1428
  completion: CompletionPolicy
1251
1429
  });
1252
- var TaskState = z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1253
- var Priority = z6.union([z6.literal(0), z6.literal(1), z6.literal(2), z6.literal(3)]);
1254
- var TaskOrigin = z6.discriminatedUnion("kind", [
1255
- z6.object({ kind: z6.literal("manual") }),
1256
- z6.object({
1257
- kind: z6.literal("automation"),
1258
- automationId: Id4,
1259
- occurrenceId: Id4,
1260
- 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()
1261
1439
  })
1262
1440
  ]);
1263
- var Task = z6.object({
1264
- id: Id4,
1265
- projectId: Id4,
1266
- title: z6.string().min(1),
1267
- objective: z6.string(),
1268
- acceptanceCriteria: z6.array(z6.string()),
1269
- 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),
1270
1448
  priority: Priority,
1271
- position: z6.number(),
1449
+ position: z7.number(),
1272
1450
  state: TaskState,
1273
- blocked: z6.object({ reason: z6.string() }).nullable(),
1274
- notBefore: Iso.nullable(),
1451
+ blocked: z7.object({ reason: z7.string() }).nullable(),
1452
+ notBefore: Iso2.nullable(),
1275
1453
  policy: TaskPolicy,
1276
1454
  origin: TaskOrigin,
1277
- groupingKey: z6.string().nullable(),
1278
- parentTaskId: Id4.nullable().optional(),
1279
- 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(),
1280
1458
  githubIssue: GitHubIssue.optional(),
1281
- currentRunId: Id4.nullable(),
1282
- sessionId: Id4.nullable(),
1283
- review: z6.object({ feedback: z6.array(z6.string()), changesRequested: z6.boolean() }),
1284
- hiddenFromBoard: z6.boolean(),
1285
- lastActivityAt: Iso,
1286
- createdAt: Iso,
1287
- 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
1288
1466
  });
1289
- var RunState = z6.enum([
1467
+ var RunState = z7.enum([
1290
1468
  "queued",
1291
1469
  "dispatching",
1292
1470
  "uncertain",
@@ -1298,79 +1476,79 @@ var RunState = z6.enum([
1298
1476
  "interrupted",
1299
1477
  "canceled"
1300
1478
  ]);
1301
- var CheckResult = z6.object({
1302
- command: z6.string(),
1303
- exitCode: z6.number().int().nullable(),
1304
- outputTail: z6.string()
1305
- });
1306
- var Run = z6.object({
1307
- id: Id4,
1308
- taskId: Id4,
1309
- sessionId: Id4.nullable(),
1310
- hostId: Id4.nullable(),
1311
- dispatchKey: z6.string(),
1312
- 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),
1313
1491
  state: RunState,
1314
1492
  controlMode: ControlMode,
1315
- controlRevision: z6.number().int().min(1),
1316
- continuationsUsed: z6.number().int().min(0),
1317
- infraRetries: z6.number().int().min(0),
1318
- nextAttemptAt: Iso.nullable(),
1319
- startedAt: Iso.nullable(),
1320
- endedAt: Iso.nullable(),
1321
- outcome: z6.object({
1322
- kind: z6.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1323
- 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()
1324
1502
  }).nullable(),
1325
1503
  limits: ContinuationPolicy,
1326
- usage: z6.object({
1327
- tokens: z6.number().nullable(),
1328
- costUsd: z6.number().nullable(),
1329
- accounting: z6.enum(["available", "unavailable"]),
1330
- 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()
1331
1509
  }),
1332
- checks: z6.array(CheckResult),
1333
- createdAt: Iso,
1334
- updatedAt: Iso
1510
+ checks: z7.array(CheckResult),
1511
+ createdAt: Iso2,
1512
+ updatedAt: Iso2
1335
1513
  });
1336
- var Trigger = z6.discriminatedUnion("kind", [
1337
- z6.object({ kind: z6.literal("manual") }),
1338
- z6.object({ kind: z6.literal("once"), at: Iso }),
1339
- z6.object({ kind: z6.literal("cron"), expr: z6.string().min(1), timezone: z6.string().min(1) }),
1340
- z6.object({ kind: z6.literal("webhook") }),
1341
- 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 })
1342
1520
  ]);
1343
- var TaskTemplate = z6.object({
1344
- title: z6.string().min(1),
1345
- objective: z6.string(),
1346
- 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()),
1347
1525
  priority: Priority
1348
1526
  });
1349
- var Automation = z6.object({
1350
- id: Id4,
1351
- name: z6.string().min(1),
1352
- enabled: z6.boolean(),
1353
- projectId: Id4,
1527
+ var Automation = z7.object({
1528
+ id: Id5,
1529
+ name: z7.string().min(1),
1530
+ enabled: z7.boolean(),
1531
+ projectId: Id5,
1354
1532
  trigger: Trigger,
1355
- filters: z6.array(z6.object({ path: z6.string(), equals: z6.string() })),
1533
+ filters: z7.array(z7.object({ path: z7.string(), equals: z7.string() })),
1356
1534
  template: TaskTemplate,
1357
- hostId: Id4.nullable(),
1358
- profileId: Id4.nullable(),
1359
- mode: z6.enum(["fresh", "continue", "watch"]),
1360
- groupingKey: z6.string().nullable(),
1361
- overlap: z6.enum(["skip", "queue_one", "append"]),
1362
- 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"]),
1363
1541
  continuation: ContinuationPolicy,
1364
1542
  completion: CompletionPolicy,
1365
- nextAt: Iso.nullable(),
1366
- lastEvaluatedAt: Iso.nullable(),
1367
- lastOutcome: z6.string().nullable(),
1368
- failureCount: z6.number().int().min(0),
1369
- webhookTokenSet: z6.boolean(),
1370
- createdAt: Iso,
1371
- 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
1372
1550
  });
1373
- var OccurrenceState = z6.enum([
1551
+ var OccurrenceState = z7.enum([
1374
1552
  "fired",
1375
1553
  "skipped_overlap",
1376
1554
  "skipped_missed",
@@ -1379,39 +1557,39 @@ var OccurrenceState = z6.enum([
1379
1557
  "failed",
1380
1558
  "filtered"
1381
1559
  ]);
1382
- var Occurrence = z6.object({
1383
- id: Id4,
1384
- automationId: Id4,
1385
- key: z6.string(),
1386
- scheduledFor: Iso.nullable(),
1560
+ var Occurrence = z7.object({
1561
+ id: Id5,
1562
+ automationId: Id5,
1563
+ key: z7.string(),
1564
+ scheduledFor: Iso2.nullable(),
1387
1565
  state: OccurrenceState,
1388
- taskId: Id4.nullable(),
1389
- reason: z6.string().nullable(),
1390
- outcome: z6.string().nullable(),
1391
- createdAt: Iso
1392
- });
1393
- var InteractionState = z6.preprocess((v) => v === "cancelled" ? "canceled" : v, z6.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1394
- var Interaction = z6.object({
1395
- id: Id4,
1396
- sessionId: Id4,
1397
- revision: z6.number().int().min(1),
1398
- source: z6.discriminatedUnion("kind", [
1399
- z6.object({
1400
- kind: z6.literal("extension_ui"),
1401
- method: z6.enum(["select", "confirm", "input", "editor"]),
1402
- 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())
1403
1581
  }),
1404
- z6.object({ kind: z6.literal("unsupported_custom"), title: z6.string().nullable() })
1582
+ z7.object({ kind: z7.literal("unsupported_custom"), title: z7.string().nullable() })
1405
1583
  ]),
1406
- adapterId: z6.string().nullable(),
1584
+ adapterId: z7.string().nullable(),
1407
1585
  permission: PolicyPermission.optional(),
1408
- title: z6.string(),
1586
+ title: z7.string(),
1409
1587
  presentation: UINodeSchema,
1410
1588
  state: InteractionState,
1411
- resolution: z6.object({ by: z6.string(), summary: z6.string(), at: Iso }).nullable(),
1412
- createdAt: Iso
1589
+ resolution: z7.object({ by: z7.string(), summary: z7.string(), at: Iso2 }).nullable(),
1590
+ createdAt: Iso2
1413
1591
  });
1414
- var AttentionReason = z6.enum([
1592
+ var AttentionReason = z7.enum([
1415
1593
  "needs_input",
1416
1594
  "failed",
1417
1595
  "ready_for_review",
@@ -1419,171 +1597,171 @@ var AttentionReason = z6.enum([
1419
1597
  "host_unreachable",
1420
1598
  "cache_expiring"
1421
1599
  ]);
1422
- var AttentionItem = z6.object({
1423
- id: Id4,
1424
- sessionId: Id4.nullable(),
1425
- taskId: Id4.nullable(),
1426
- projectId: Id4.nullable(),
1600
+ var AttentionItem = z7.object({
1601
+ id: Id5,
1602
+ sessionId: Id5.nullable(),
1603
+ taskId: Id5.nullable(),
1604
+ projectId: Id5.nullable(),
1427
1605
  reason: AttentionReason,
1428
- severity: z6.enum(["info", "warning", "critical"]),
1429
- summary: z6.string(),
1430
- interactionId: Id4.nullable(),
1431
- deepLink: z6.string(),
1432
- acknowledgedAt: Iso.nullable(),
1433
- resolvedAt: Iso.nullable(),
1434
- createdAt: Iso
1435
- });
1436
- var Device = z6.object({
1437
- id: Id4,
1438
- 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(),
1439
1617
  kind: DeviceKind,
1440
- createdAt: Iso,
1441
- lastSeenAt: Iso.nullable(),
1442
- revokedAt: Iso.nullable(),
1443
- push: z6.object({
1444
- subscribed: z6.boolean(),
1445
- 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"])
1446
1624
  }),
1447
- preferredMobile: z6.boolean(),
1448
- enrolledVia: z6.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1449
- });
1450
- var ToolItemData = z6.object({
1451
- toolCallId: z6.string(),
1452
- name: z6.string(),
1453
- status: z6.enum(["running", "ok", "error"]),
1454
- args: z6.unknown(),
1455
- summary: z6.string(),
1456
- output: z6.string(),
1457
- startedAt: Iso,
1458
- 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(),
1459
1637
  card: UINodeSchema.nullable(),
1460
- adapterId: z6.string().nullable(),
1461
- adapterGeneration: z6.string().uuid().optional()
1638
+ adapterId: z7.string().nullable(),
1639
+ adapterGeneration: z7.string().uuid().optional()
1462
1640
  });
1463
- var TranscriptItem = z6.discriminatedUnion("kind", [
1464
- z6.object({
1465
- id: Id4,
1466
- sessionId: Id4,
1467
- order: z6.number().int(),
1468
- at: Iso,
1469
- kind: z6.literal("user"),
1470
- data: z6.object({
1471
- text: z6.string(),
1472
- 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(),
1473
1651
  /** Pi session entry id, for rewind and fork from this message. */
1474
- entryId: z6.string().optional()
1652
+ entryId: z7.string().optional()
1475
1653
  })
1476
1654
  }),
1477
- z6.object({
1478
- id: Id4,
1479
- sessionId: Id4,
1480
- order: z6.number().int(),
1481
- at: Iso,
1482
- kind: z6.literal("assistant"),
1483
- 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() })
1484
1662
  }),
1485
- z6.object({
1486
- id: Id4,
1487
- sessionId: Id4,
1488
- order: z6.number().int(),
1489
- at: Iso,
1490
- kind: z6.literal("thinking"),
1491
- 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() })
1492
1670
  }),
1493
- z6.object({
1494
- id: Id4,
1495
- sessionId: Id4,
1496
- order: z6.number().int(),
1497
- at: Iso,
1498
- 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"),
1499
1677
  data: ToolItemData
1500
1678
  }),
1501
- z6.object({
1502
- id: Id4,
1503
- sessionId: Id4,
1504
- order: z6.number().int(),
1505
- at: Iso,
1506
- kind: z6.literal("notice"),
1507
- 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({
1508
1686
  level: DiagnosticLevel,
1509
- text: z6.string(),
1510
- customType: z6.string().min(1).max(200).optional(),
1687
+ text: z7.string(),
1688
+ customType: z7.string().min(1).max(200).optional(),
1511
1689
  card: UINodeSchema.optional(),
1512
- adapterId: z6.string().optional(),
1513
- adapterGeneration: z6.string().uuid().optional()
1690
+ adapterId: z7.string().optional(),
1691
+ adapterGeneration: z7.string().uuid().optional()
1514
1692
  }).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
1515
1693
  }),
1516
- z6.object({
1517
- id: Id4,
1518
- sessionId: Id4,
1519
- order: z6.number().int(),
1520
- at: Iso,
1521
- kind: z6.literal("interaction"),
1522
- 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 })
1523
1701
  }),
1524
- z6.object({
1525
- id: Id4,
1526
- sessionId: Id4,
1527
- order: z6.number().int(),
1528
- at: Iso,
1529
- kind: z6.literal("subagent"),
1530
- data: z6.object({
1531
- runId: z6.string(),
1532
- label: z6.string(),
1533
- status: z6.string(),
1534
- sessionFile: z6.string().nullable(),
1535
- 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()
1536
1714
  })
1537
1715
  }),
1538
- z6.object({
1539
- id: Id4,
1540
- sessionId: Id4,
1541
- order: z6.number().int(),
1542
- at: Iso,
1543
- kind: z6.literal("system"),
1544
- 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() })
1545
1723
  })
1546
1724
  ]);
1547
- var Panel = z6.object({
1548
- sessionId: Id4,
1549
- adapterId: z6.string(),
1550
- slot: z6.string(),
1551
- title: z6.string(),
1725
+ var Panel = z7.object({
1726
+ sessionId: Id5,
1727
+ adapterId: z7.string(),
1728
+ slot: z7.string(),
1729
+ title: z7.string(),
1552
1730
  node: UINodeSchema.nullable(),
1553
- webRenderer: z6.boolean(),
1554
- mobileFallback: z6.string().nullable(),
1731
+ webRenderer: z7.boolean(),
1732
+ mobileFallback: z7.string().nullable(),
1555
1733
  contribution: ContributionDescriptor.optional(),
1556
- state: z6.unknown().optional(),
1557
- adapterGeneration: z6.string().uuid().optional(),
1558
- updatedAt: Iso
1734
+ state: z7.unknown().optional(),
1735
+ adapterGeneration: z7.string().uuid().optional(),
1736
+ updatedAt: Iso2
1559
1737
  });
1560
- var Diagnostic = z6.object({
1561
- sessionId: Id4.nullable(),
1562
- adapterId: z6.string().nullable(),
1738
+ var Diagnostic = z7.object({
1739
+ sessionId: Id5.nullable(),
1740
+ adapterId: z7.string().nullable(),
1563
1741
  level: DiagnosticLevel,
1564
- message: z6.string(),
1565
- at: Iso
1566
- });
1567
- var AdapterInfo = z6.object({
1568
- id: z6.string(),
1569
- version: z6.string(),
1570
- tier: z6.enum(["project", "owner", "plugin", "bundled"]),
1571
- target: z6.object({
1572
- extension: z6.string(),
1573
- versionRange: z6.string(),
1574
- 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())
1575
1753
  }),
1576
- capabilities: z6.array(z6.string()),
1577
- webRenderer: z6.boolean(),
1578
- status: z6.enum(["active", "disabled", "error"]),
1579
- detail: z6.string().nullable()
1580
- });
1581
- var Passkey = z6.object({
1582
- id: z6.string(),
1583
- name: z6.string(),
1584
- createdAt: Iso,
1585
- lastUsedAt: Iso.nullable(),
1586
- 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())
1587
1765
  });
1588
1766
 
1589
1767
  // packages/protocol/dist/adapter-preview.js
@@ -1596,92 +1774,92 @@ function bounded(input, ctx) {
1596
1774
  return input;
1597
1775
  } catch (error) {
1598
1776
  ctx.addIssue({ code: "custom", message: error.message });
1599
- return z7.NEVER;
1777
+ return z8.NEVER;
1600
1778
  }
1601
1779
  }
1602
- var Id5 = z7.string().min(1).max(200);
1603
- var Text2 = z7.string().max(64 * 1024);
1604
- var Tool = { toolCallId: Id5, name: Id5, args: z7.unknown() };
1605
- var DialogCommon = { id: Id5, title: Text2 };
1606
- var AdapterPreviewPiUiRequestSchema = z7.discriminatedUnion("method", [
1607
- 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({
1608
1786
  ...DialogCommon,
1609
- method: z7.literal("select"),
1610
- options: z7.array(Text2).max(200),
1611
- timeout: z7.number().nonnegative().optional()
1787
+ method: z8.literal("select"),
1788
+ options: z8.array(Text2).max(200),
1789
+ timeout: z8.number().nonnegative().optional()
1612
1790
  }).strict(),
1613
- z7.object({
1791
+ z8.object({
1614
1792
  ...DialogCommon,
1615
- method: z7.literal("confirm"),
1793
+ method: z8.literal("confirm"),
1616
1794
  message: Text2,
1617
- timeout: z7.number().nonnegative().optional()
1795
+ timeout: z8.number().nonnegative().optional()
1618
1796
  }).strict(),
1619
- z7.object({
1797
+ z8.object({
1620
1798
  ...DialogCommon,
1621
- method: z7.literal("input"),
1799
+ method: z8.literal("input"),
1622
1800
  placeholder: Text2.optional(),
1623
- timeout: z7.number().nonnegative().optional()
1801
+ timeout: z8.number().nonnegative().optional()
1624
1802
  }).strict(),
1625
- z7.object({ ...DialogCommon, method: z7.literal("editor"), prefill: Text2.optional() }).strict()
1803
+ z8.object({ ...DialogCommon, method: z8.literal("editor"), prefill: Text2.optional() }).strict()
1626
1804
  ]);
1627
- var AdapterPreviewStepSchema = z7.discriminatedUnion("kind", [
1628
- z7.object({ kind: z7.literal("restore") }).strict(),
1629
- z7.object({ kind: z7.literal("toolStart"), data: z7.object(Tool).strict() }).strict(),
1630
- z7.object({
1631
- kind: z7.literal("toolUpdate"),
1632
- 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()
1633
1811
  }).strict(),
1634
- z7.object({
1635
- kind: z7.literal("toolEnd"),
1636
- data: z7.object({
1812
+ z8.object({
1813
+ kind: z8.literal("toolEnd"),
1814
+ data: z8.object({
1637
1815
  ...Tool,
1638
- result: z7.unknown(),
1639
- isError: z7.boolean(),
1640
- details: z7.unknown().optional()
1816
+ result: z8.unknown(),
1817
+ isError: z8.boolean(),
1818
+ details: z8.unknown().optional()
1641
1819
  }).strict()
1642
1820
  }).strict(),
1643
- z7.object({
1644
- kind: z7.literal("status"),
1645
- 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()
1646
1824
  }).strict(),
1647
- z7.object({
1648
- kind: z7.literal("widget"),
1649
- 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()
1650
1828
  }).strict(),
1651
- z7.object({ kind: z7.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1652
- z7.object({
1653
- kind: z7.literal("answer"),
1654
- 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()
1655
1833
  }).strict(),
1656
- z7.object({
1657
- kind: z7.literal("customMessage"),
1658
- data: z7.object({
1659
- customType: Id5,
1660
- content: z7.unknown(),
1661
- display: z7.boolean().optional(),
1662
- 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()
1663
1841
  }).strict()
1664
1842
  }).strict(),
1665
- z7.object({
1666
- kind: z7.literal("action"),
1667
- 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()
1668
1846
  }).strict()
1669
1847
  ]);
1670
- var AdapterPreviewFixtureSchema = z7.unknown().transform(bounded).pipe(z7.object({
1671
- version: z7.literal(1),
1672
- name: z7.string().min(1).max(200),
1673
- initialState: z7.record(z7.string(), z7.record(z7.string(), z7.unknown())).optional(),
1674
- 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)
1675
1853
  }).strict());
1676
- var PortableNode = z7.unknown().transform((input, ctx) => {
1854
+ var PortableNode = z8.unknown().transform((input, ctx) => {
1677
1855
  try {
1678
1856
  return validateUINode(input);
1679
1857
  } catch (error) {
1680
1858
  ctx.addIssue({ code: "custom", message: error.message });
1681
- return z7.NEVER;
1859
+ return z8.NEVER;
1682
1860
  }
1683
1861
  });
1684
- var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine((panel, ctx) => {
1862
+ var PreviewPanel = Panel.extend({ webRenderer: z8.literal(false) }).superRefine((panel, ctx) => {
1685
1863
  try {
1686
1864
  if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
1687
1865
  throw new Error("Preview panels must use the fake preview session");
@@ -1703,13 +1881,13 @@ var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine(
1703
1881
  ctx.addIssue({ code: "custom", message: error.message });
1704
1882
  }
1705
1883
  });
1706
- var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1707
- version: z7.literal(1),
1708
- name: z7.string().min(1).max(200),
1709
- adapter: z7.object({ id: Id5, version: Id5 }).strict(),
1710
- steps: z7.array(z7.object({
1711
- index: z7.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1712
- 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([
1713
1891
  "restore",
1714
1892
  "toolStart",
1715
1893
  "toolUpdate",
@@ -1721,24 +1899,24 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1721
1899
  "customMessage",
1722
1900
  "action"
1723
1901
  ]),
1724
- ok: z7.boolean(),
1725
- error: z7.string().max(4e3).nullable()
1902
+ ok: z8.boolean(),
1903
+ error: z8.string().max(4e3).nullable()
1726
1904
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1727
- panels: z7.array(PreviewPanel).max(256),
1728
- interactions: z7.array(z7.object({
1905
+ panels: z8.array(PreviewPanel).max(256),
1906
+ interactions: z8.array(z8.object({
1729
1907
  request: AdapterPreviewPiUiRequestSchema,
1730
1908
  presentation: PortableNode,
1731
- state: z7.enum(["pending", "resolved"])
1909
+ state: z8.enum(["pending", "resolved"])
1732
1910
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1733
- cards: z7.array(z7.unknown().transform((input, ctx) => {
1911
+ cards: z8.array(z8.unknown().transform((input, ctx) => {
1734
1912
  try {
1735
1913
  return validateContributionCard(input);
1736
1914
  } catch (error) {
1737
1915
  ctx.addIssue({ code: "custom", message: error.message });
1738
- return z7.NEVER;
1916
+ return z8.NEVER;
1739
1917
  }
1740
1918
  })).max(ADAPTER_PREVIEW_MAX_STEPS * 3),
1741
- 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)
1742
1920
  }).strict().superRefine((preview, ctx) => {
1743
1921
  const slots = /* @__PURE__ */ new Set();
1744
1922
  let contributions = 0;
@@ -1767,39 +1945,39 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1767
1945
  }));
1768
1946
 
1769
1947
  // packages/protocol/dist/adapters.js
1770
- import { z as z8 } from "zod";
1771
- var Path = z8.string().max(4096);
1948
+ import { z as z9 } from "zod";
1949
+ var Path = z9.string().max(4096);
1772
1950
  var SessionAdapterInfo = AdapterInfo.extend({
1773
- runtimeStatus: z8.enum(["active", "disabled", "unavailable"]),
1774
- runtimeDetail: z8.string().max(4e3).nullable(),
1775
- provenance: z8.object({
1776
- 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"]),
1777
1955
  source: Path.nullable(),
1778
1956
  packageDir: Path.nullable(),
1779
1957
  manifestPath: Path.nullable(),
1780
- targetVersion: z8.string().nullable(),
1781
- entrypoints: z8.array(Path).max(128),
1782
- 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"])
1783
1961
  })
1784
1962
  });
1785
- var SessionAdaptersResult = z8.object({
1786
- generation: z8.string().uuid().nullable(),
1787
- runtimeId: z8.string().nullable(),
1788
- reloadable: z8.boolean(),
1789
- blockedReason: z8.string().nullable(),
1790
- adapters: z8.array(SessionAdapterInfo).max(256),
1791
- 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)
1792
1970
  });
1793
1971
 
1794
1972
  // packages/protocol/dist/agent-wire.js
1795
- import { z as z9 } from "zod";
1796
- var Id6 = z9.string().min(1).max(200);
1797
- 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) => {
1798
1976
  const date = new Date(value);
1799
1977
  return Number.isFinite(date.getTime()) && date.toISOString() === value;
1800
1978
  }, "Expected canonical UTC timestamp");
1801
1979
  var AGENT_FRAME_MAX_BYTES = 128 * 1024;
1802
- var AgentMethod = z9.enum([
1980
+ var AgentMethod = z10.enum([
1803
1981
  "session.bind",
1804
1982
  "task.create",
1805
1983
  "message.send",
@@ -1809,34 +1987,34 @@ var AgentMethod = z9.enum([
1809
1987
  "policy.status",
1810
1988
  "policy.cancel"
1811
1989
  ]);
1812
- var AgentToolMethod = z9.enum(["task.create", "message.send", "inbox.read"]);
1813
- var RequestHash = z9.string().regex(/^[a-f0-9]{64}$/);
1814
- var AgentReceiptPeekRequest = z9.object({ method: AgentToolMethod, args: z9.record(z9.string(), z9.json()) }).strict();
1815
- var AgentReceiptPeekResult = z9.discriminatedUnion("found", [
1816
- z9.object({ found: z9.literal(false) }).strict(),
1817
- 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()
1818
1996
  ]);
1819
- var AgentReceiptReplay = z9.object({ requestHash: RequestHash }).strict();
1820
- var CreateAgentTask = z9.object({
1821
- objective: z9.string().min(1).max(16e3),
1822
- acceptance: z9.array(z9.string().min(1).max(2e3)).max(100).default([]),
1823
- dependencies: z9.array(Id6).max(100).default([]),
1824
- parentTaskId: Id6.nullable().optional(),
1825
- hostId: Id6.optional(),
1826
- profileId: Id6.optional(),
1827
- notifyOnFinish: z9.boolean().default(true)
1828
- });
1829
- var SendAgentMessage = z9.object({
1830
- sessionId: Id6,
1831
- body: z9.string().min(1).max(16e3),
1832
- mode: z9.enum(["steer", "queue"]),
1833
- replyTo: Id6.optional()
1834
- });
1835
- var ReadAgentInbox = z9.object({
1836
- after: z9.number().int().nonnegative().default(0),
1837
- limit: z9.number().int().min(1).max(100).default(20)
1838
- });
1839
- 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([
1840
2018
  "pending",
1841
2019
  "held",
1842
2020
  "deferred",
@@ -1847,46 +2025,46 @@ var DeliveryState = z9.enum([
1847
2025
  "failed"
1848
2026
  ]);
1849
2027
  var AgentMessageFields = {
1850
- seq: z9.number().int().positive(),
1851
- id: Id6,
1852
- recipientSessionId: Id6,
1853
- replyTo: Id6.nullable(),
1854
- chainId: Id6,
1855
- depth: z9.number().int().min(0).max(4),
1856
- body: z9.unknown(),
1857
- 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"]),
1858
2036
  deliveryState: DeliveryState,
1859
- holdUntil: z9.string(),
1860
- readAt: z9.string().nullable(),
1861
- createdAt: z9.string()
2037
+ holdUntil: z10.string(),
2038
+ readAt: z10.string().nullable(),
2039
+ createdAt: z10.string()
1862
2040
  };
1863
- var AgentMessage = z9.discriminatedUnion("kind", [
1864
- z9.object({ ...AgentMessageFields, kind: z9.literal("message"), senderSessionId: Id6 }),
1865
- z9.object({
2041
+ var AgentMessage = z10.discriminatedUnion("kind", [
2042
+ z10.object({ ...AgentMessageFields, kind: z10.literal("message"), senderSessionId: Id7 }),
2043
+ z10.object({
1866
2044
  ...AgentMessageFields,
1867
- kind: z9.literal("completion"),
1868
- senderSessionId: Id6.nullable()
2045
+ kind: z10.literal("completion"),
2046
+ senderSessionId: Id7.nullable()
1869
2047
  })
1870
2048
  ]);
1871
- var AgentInbox = z9.object({
1872
- messages: z9.array(AgentMessage),
1873
- nextAfter: z9.number().int().nonnegative(),
1874
- hasMore: z9.boolean()
1875
- });
1876
- var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z9.literal("policy.required") }).strict();
1877
- var AgentRequestFrame = z9.object({
1878
- type: z9.literal("agent.request"),
1879
- requestId: Id6,
1880
- sessionId: Id6,
1881
- nativeSessionId: Id6,
1882
- runtimeId: Id6,
1883
- context: z9.object({ humanInputId: Id6.nullable(), causalMessageId: Id6.nullable() }).strict(),
1884
- 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(),
1885
2063
  receiptReplay: AgentReceiptReplay.optional(),
1886
2064
  // Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
1887
2065
  deadlineAt: Instant3.optional(),
1888
2066
  method: AgentMethod,
1889
- args: z9.unknown()
2067
+ args: z10.unknown()
1890
2068
  }).strict().superRefine((frame, ctx) => {
1891
2069
  if (frame.method === "receipt.peek") {
1892
2070
  if (!frame.toolCallId) {
@@ -1905,19 +2083,19 @@ var AgentRequestFrame = z9.object({
1905
2083
  });
1906
2084
  }
1907
2085
  });
1908
- var AgentResultFrame = z9.discriminatedUnion("ok", [
1909
- z9.object({
1910
- type: z9.literal("agent.result"),
1911
- requestId: Id6,
1912
- runtimeId: Id6,
1913
- ok: z9.literal(true),
1914
- 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()
1915
2093
  }),
1916
- z9.object({
1917
- type: z9.literal("agent.result"),
1918
- requestId: Id6,
1919
- runtimeId: Id6,
1920
- ok: z9.literal(false),
2094
+ z10.object({
2095
+ type: z10.literal("agent.result"),
2096
+ requestId: Id7,
2097
+ runtimeId: Id7,
2098
+ ok: z10.literal(false),
1921
2099
  error: ErrorBody
1922
2100
  })
1923
2101
  ]);
@@ -1930,196 +2108,6 @@ import { z as z13 } from "zod";
1930
2108
 
1931
2109
  // packages/protocol/dist/events.js
1932
2110
  import { z as z11 } from "zod";
1933
-
1934
- // packages/protocol/dist/trackers.js
1935
- import { z as z10 } from "zod";
1936
- var Iso2 = z10.string();
1937
- var Id7 = z10.string().min(1);
1938
- var TrackerFollow = z10.enum(["assigned", "board"]);
1939
- var GitHubLogin = z10.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
1940
- var TrackerStatusOption = z10.object({
1941
- id: z10.string().min(1),
1942
- name: z10.string().min(1).max(200)
1943
- });
1944
- var TrackerBoard = z10.object({
1945
- projectNumber: z10.number().int().positive(),
1946
- statusField: z10.string().min(1).max(100).default("Status"),
1947
- /** Column to move a card to once its worktree exists (write-back). */
1948
- onStart: z10.string().min(1).max(200).nullable().default(null),
1949
- /** Column to move a card to once a pull request is open (write-back). */
1950
- onReview: z10.string().min(1).max(200).nullable().default(null),
1951
- /** A single-select field that ranks issues: its first option is the highest. */
1952
- priorityField: z10.string().min(1).max(100).nullable().optional(),
1953
- /** Columns whose cards are not tracked until they have a branch or pull request. */
1954
- backlog: z10.array(z10.string().min(1).max(200)).max(20).optional()
1955
- });
1956
- var Tracker = z10.object({
1957
- id: Id7,
1958
- name: z10.string().min(1).max(60),
1959
- provider: z10.literal("github"),
1960
- hostId: Id7,
1961
- owner: GitHubLogin,
1962
- repositories: z10.array(GitHubRepository).min(1).max(50).nullable(),
1963
- /** Repositories outside `owner` that belong to this tracker too (never limited by `repositories`). */
1964
- extraRepositories: z10.array(GitHubRepository).max(20).optional(),
1965
- board: TrackerBoard.nullable(),
1966
- /** Which issues it follows; absent means "assigned". "board": every open issue on its board. */
1967
- follow: TrackerFollow.optional(),
1968
- writeBack: z10.boolean(),
1969
- moveShared: z10.boolean(),
1970
- /** Make a worktree for an issue branch that has none; absent means true. */
1971
- worktrees: z10.boolean().optional(),
1972
- enabled: z10.boolean(),
1973
- /** The host's `gh` user, from the last sync. */
1974
- login: z10.string().nullable(),
1975
- lastSyncedAt: Iso2.nullable(),
1976
- lastError: z10.string().max(2e3).nullable(),
1977
- createdAt: Iso2,
1978
- updatedAt: Iso2
1979
- });
1980
- var TrackerInput = z10.object({
1981
- name: Tracker.shape.name,
1982
- hostId: Id7,
1983
- owner: GitHubLogin,
1984
- repositories: Tracker.shape.repositories.default(null),
1985
- extraRepositories: z10.array(GitHubRepository).max(20).default([]),
1986
- board: TrackerBoard.nullable().default(null),
1987
- follow: TrackerFollow.default("assigned"),
1988
- writeBack: z10.boolean().default(false),
1989
- moveShared: z10.boolean().default(true),
1990
- worktrees: z10.boolean().default(true),
1991
- enabled: z10.boolean().default(true)
1992
- });
1993
- var TrackerPatch = z10.object({
1994
- name: Tracker.shape.name.optional(),
1995
- hostId: Id7.optional(),
1996
- owner: GitHubLogin.optional(),
1997
- repositories: Tracker.shape.repositories.optional(),
1998
- extraRepositories: z10.array(GitHubRepository).max(20).optional(),
1999
- board: TrackerBoard.nullable().optional(),
2000
- follow: TrackerFollow.optional(),
2001
- writeBack: z10.boolean().optional(),
2002
- moveShared: z10.boolean().optional(),
2003
- worktrees: z10.boolean().optional(),
2004
- enabled: z10.boolean().optional()
2005
- });
2006
- var TrackerItemBoard = z10.object({
2007
- projectId: z10.string().min(1),
2008
- projectItemId: z10.string().min(1),
2009
- fieldId: z10.string().min(1),
2010
- status: z10.string().nullable(),
2011
- statusOptionId: z10.string().nullable(),
2012
- options: z10.array(TrackerStatusOption).max(50),
2013
- /** The issue's value of the tracker's priority field; `rank` is its option's position. */
2014
- priority: z10.object({ name: z10.string().min(1).max(200), rank: z10.number().int().min(0) }).nullable().optional()
2015
- });
2016
- var TrackerPullRequest = z10.object({
2017
- number: z10.number().int().positive(),
2018
- state: z10.enum(["OPEN", "CLOSED", "MERGED"]),
2019
- url: z10.string().url(),
2020
- headRefName: z10.string().min(1).max(255)
2021
- });
2022
- var TrackerParent = z10.object({
2023
- number: z10.number().int().positive(),
2024
- title: z10.string().max(300),
2025
- url: GitHubIssueUrl
2026
- });
2027
- var TrackerSubIssues = z10.object({
2028
- total: z10.number().int().min(0),
2029
- completed: z10.number().int().min(0)
2030
- });
2031
- var TrackerItem = z10.object({
2032
- itemId: z10.string().min(1),
2033
- repository: GitHubRepository,
2034
- number: z10.number().int().positive(),
2035
- title: z10.string().min(1).max(1e3),
2036
- url: GitHubIssueUrl,
2037
- assignees: z10.array(z10.string()).max(20),
2038
- branches: z10.array(z10.string().min(1).max(255)).max(10),
2039
- pullRequest: TrackerPullRequest.nullable(),
2040
- board: TrackerItemBoard.nullable(),
2041
- parent: TrackerParent.nullable().optional(),
2042
- subIssues: TrackerSubIssues.nullable().optional()
2043
- });
2044
- var TrackerSyncResult = z10.object({
2045
- login: z10.string().min(1),
2046
- items: z10.array(TrackerItem).max(200),
2047
- truncated: z10.boolean()
2048
- });
2049
- var TrackedIssue = z10.object({
2050
- /** `${trackerId}:${itemId}` */
2051
- id: Id7,
2052
- trackerId: Id7,
2053
- itemId: z10.string().min(1),
2054
- projectId: Id7,
2055
- repository: GitHubRepository,
2056
- number: z10.number().int().positive(),
2057
- title: z10.string().min(1).max(300),
2058
- url: GitHubIssueUrl,
2059
- assignees: z10.array(z10.string()).max(20),
2060
- /** Branches GitHub links to the issue. */
2061
- branches: z10.array(z10.string()).max(10),
2062
- /** The branch Switchyard works on. */
2063
- branch: z10.string().nullable(),
2064
- workspaceId: Id7.nullable(),
2065
- pullRequest: TrackerPullRequest.nullable(),
2066
- board: TrackerItemBoard.nullable(),
2067
- /** The issue this one is a sub-issue of. */
2068
- parent: TrackerParent.nullable().optional(),
2069
- subIssues: TrackerSubIssues.nullable().optional(),
2070
- updatedAt: Iso2
2071
- });
2072
- var OpenIssueRequest = z10.object({
2073
- hostId: Id7.optional(),
2074
- viewId: z10.string().optional(),
2075
- /** The first prompt of a new session. */
2076
- prompt: z10.string().optional(),
2077
- profileId: z10.string().nullable().optional()
2078
- });
2079
- var TrackerSetStatusResult = z10.discriminatedUnion("status", [
2080
- z10.object({ status: z10.literal("moved") }),
2081
- z10.object({
2082
- status: z10.literal("skipped"),
2083
- reason: z10.enum(["not_assigned", "shared", "stale"])
2084
- })
2085
- ]);
2086
- var LinkIssueRequest = z10.object({ workspaceId: Id7 });
2087
- var TrackerStatusRequest = z10.object({ status: z10.string().min(1).max(200) });
2088
- var TrackerHostSyncRequest = z10.object({
2089
- owner: GitHubLogin,
2090
- repositories: z10.array(GitHubRepository).nullable(),
2091
- board: z10.object({
2092
- projectNumber: z10.number().int().positive(),
2093
- statusField: z10.string().min(1),
2094
- priorityField: z10.string().min(1).nullable().optional()
2095
- }).nullable(),
2096
- follow: TrackerFollow.optional(),
2097
- backlog: z10.array(z10.string().min(1)).max(20).optional()
2098
- });
2099
- var TrackerHostPrepareBranchRequest = z10.object({
2100
- checkoutPath: z10.string().min(1),
2101
- branch: z10.string().min(1).max(255)
2102
- });
2103
- var TrackerHostStartIssueRequest = z10.object({
2104
- checkoutPath: z10.string().min(1),
2105
- repository: GitHubRepository,
2106
- number: z10.number().int().positive(),
2107
- branch: z10.string().min(1).max(255),
2108
- base: z10.string().min(1)
2109
- });
2110
- var TrackerHostSetStatusRequest = z10.object({
2111
- projectId: z10.string().min(1),
2112
- projectItemId: z10.string().min(1),
2113
- fieldId: z10.string().min(1),
2114
- statusField: z10.string().min(1),
2115
- optionId: z10.string().min(1),
2116
- expectedOptionId: z10.string().nullable(),
2117
- login: z10.string().min(1),
2118
- allowShared: z10.boolean(),
2119
- allowUnassigned: z10.boolean().optional()
2120
- });
2121
-
2122
- // packages/protocol/dist/events.js
2123
2111
  var EventDataSchemas = {
2124
2112
  "host.updated": Host,
2125
2113
  "project.updated": Project,
@@ -2129,8 +2117,8 @@ var EventDataSchemas = {
2129
2117
  "workspace.deleted": z11.object({ id: z11.string() }),
2130
2118
  "profile.updated": Profile,
2131
2119
  "profile.deleted": z11.object({ id: z11.string() }),
2132
- "view.updated": View,
2133
- "view.deleted": z11.object({ id: z11.string() }),
2120
+ "scope.updated": Scope,
2121
+ "scope.deleted": z11.object({ id: z11.string() }),
2134
2122
  "session.updated": Session,
2135
2123
  "transcript.item": TranscriptItem,
2136
2124
  "transcript.reset": z11.object({ sessionId: z11.string(), epoch: z11.number().int() }),
@@ -2149,15 +2137,13 @@ var EventDataSchemas = {
2149
2137
  "device.updated": Device,
2150
2138
  "issue.updated": TrackedIssue,
2151
2139
  "issue.deleted": z11.object({ id: z11.string() }),
2152
- "terminal.updated": Terminal,
2153
- "terminal.deleted": z11.object({ id: z11.string() }),
2140
+ "client.updated": Client,
2141
+ "client.deleted": z11.object({ id: z11.string() }),
2154
2142
  "settings.updated": z11.object({ dispatchPaused: z11.boolean() })
2155
2143
  };
2156
2144
  var EVENT_TYPES = Object.keys(EventDataSchemas);
2157
2145
  var LEGACY_EVENT_TYPES = {
2158
- "workspace.removed": "workspace.deleted",
2159
- "surface.updated": "terminal.updated",
2160
- "surface.deleted": "terminal.deleted"
2146
+ "workspace.removed": "workspace.deleted"
2161
2147
  };
2162
2148
  function canonicalEventType(type) {
2163
2149
  return LEGACY_EVENT_TYPES[type] ?? type;
@@ -2367,7 +2353,7 @@ var HostCommand = z13.discriminatedUnion("type", [
2367
2353
  checkoutPath: z13.string(),
2368
2354
  base: z13.string().nullable(),
2369
2355
  force: z13.object({ dirty: z13.boolean(), unmerged: z13.boolean() }),
2370
- /** 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). */
2371
2357
  deleteBranch: z13.boolean().optional()
2372
2358
  }),
2373
2359
  z13.object({
@@ -2389,10 +2375,10 @@ var HostCommand = z13.discriminatedUnion("type", [
2389
2375
  GitHubHostViewRequest.extend({ type: z13.literal("workspace.prView") }),
2390
2376
  GitHubHostLogsRequest.extend({ type: z13.literal("workspace.prFailedLogs") }),
2391
2377
  GitHubHostMergeRequest.extend({ type: z13.literal("workspace.prMerge") }),
2392
- TrackerHostSyncRequest.extend({ type: z13.literal("tracker.sync") }),
2393
- TrackerHostPrepareBranchRequest.extend({ type: z13.literal("tracker.prepareBranch") }),
2394
- TrackerHostStartIssueRequest.extend({ type: z13.literal("tracker.startIssue") }),
2395
- 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") }),
2396
2382
  z13.object({
2397
2383
  type: z13.literal("dispatch.start"),
2398
2384
  dispatchKey: z13.string(),
@@ -2690,6 +2676,8 @@ var CreateSessionRequest = z14.object({
2690
2676
  profileId: z14.string().nullable().optional(),
2691
2677
  prompt: z14.string().default(""),
2692
2678
  title: z14.string().optional(),
2679
+ scopeId: z14.string().optional(),
2680
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2693
2681
  viewId: z14.string().optional()
2694
2682
  });
2695
2683
  var OpenBranchRequest = z14.object({
@@ -2700,6 +2688,8 @@ var OpenBranchRequest = z14.object({
2700
2688
  prompt: z14.string().default(""),
2701
2689
  profileId: z14.string().nullable().optional(),
2702
2690
  title: z14.string().optional(),
2691
+ scopeId: z14.string().optional(),
2692
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2703
2693
  viewId: z14.string().optional(),
2704
2694
  /** Start another session even when the branch has one. */
2705
2695
  another: z14.boolean().default(false)
@@ -3057,40 +3047,38 @@ var MeResponse = z14.object({
3057
3047
  admin: z14.boolean(),
3058
3048
  publicUrl: z14.string()
3059
3049
  });
3060
- var TerminalBindingInput = z14.object({ mirror: TerminalMirror, viewId: z14.string().min(1).nullable().optional() }).refine((b) => b.mirror === "view" === !!b.viewId, {
3061
- message: "viewId is required for mirror=view and only then"
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"
3062
3052
  });
3063
- var TerminalReport = Terminal.pick({ kind: true, name: true, machine: true }).extend({
3053
+ var ClientReport = Client.pick({ kind: true, name: true, machine: true }).extend({
3064
3054
  hostId: z14.string().nullable().optional(),
3065
3055
  /** Sessions in its mirror tabs or windows; omitted when unchanged or unknown. */
3066
3056
  shows: z14.array(z14.string()).max(1e3).optional(),
3067
- /** The binding this terminal had before bindings were recorded (env file); applied only when none is recorded. */
3068
- seed: TerminalBindingInput.optional()
3069
- });
3070
- var SurfaceReport = Terminal.pick({
3071
- kind: true,
3072
- name: true,
3073
- machine: true,
3074
- viewId: true
3075
- }).extend({ hostId: z14.string().nullable().optional() });
3076
- var ViewInput = View.pick({
3077
- name: true,
3078
- mode: true,
3079
- projectIds: true,
3080
- hostIds: true
3081
- }).partial({
3082
- mode: true,
3083
- projectIds: true,
3084
- hostIds: true
3085
- });
3086
- var ViewPatch = ViewInput.partial();
3087
- var ViewClientReport = ViewClient.omit({ lastSeenAt: true });
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
+ });
3088
3076
  var ProjectSuggestionsResponse = z14.object({
3089
3077
  suggestions: z14.array(ProjectSuggestion.extend({ name: z14.string(), preselected: z14.boolean() }))
3090
3078
  });
3091
3079
 
3092
- // packages/protocol/dist/views.js
3093
- var TERMINAL_OPEN_MS = 10 * 6e4;
3080
+ // packages/protocol/dist/scopes.js
3081
+ var CLIENT_OPEN_MS = 10 * 6e4;
3094
3082
 
3095
3083
  // packages/protocol/dist/client-wire.js
3096
3084
  import { z as z15 } from "zod";
@@ -3100,7 +3088,8 @@ var SyncState = z15.object({
3100
3088
  checkouts: z15.array(Checkout),
3101
3089
  workspaces: z15.array(Workspace),
3102
3090
  profiles: z15.array(Profile),
3103
- views: z15.array(View),
3091
+ /** Scopes; absent from coordinators before 0.21. */
3092
+ scopes: z15.array(Scope).default([]),
3104
3093
  sessions: z15.array(Session),
3105
3094
  tasks: z15.array(Task),
3106
3095
  runs: z15.array(Run),
@@ -3111,10 +3100,8 @@ var SyncState = z15.object({
3111
3100
  devices: z15.array(Device),
3112
3101
  /** Tracked issues; absent from older coordinators. */
3113
3102
  issues: z15.array(TrackedIssue).default([]),
3114
- /** Terminals (herdr and tmux sessions); absent from older coordinators. */
3115
- terminals: z15.array(Terminal).optional(),
3116
- /** Deprecated: terminals as older coordinators send them (`terminals` replaces it). */
3117
- surfaces: z15.array(Terminal).optional(),
3103
+ /** Clients (herdr and tmux sessions); absent from coordinators before 0.21. */
3104
+ clients: z15.array(Client).default([]),
3118
3105
  adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
3119
3106
  dispatchPaused: z15.boolean()
3120
3107
  });
@@ -3123,12 +3110,14 @@ var Presence = z15.object({
3123
3110
  interactedAt: z15.string().nullable(),
3124
3111
  viewing: z15.object({ sessionId: z15.string() }).nullable(),
3125
3112
  /**
3126
- * A herdr or tmux daemon reporting the session focused in its terminal (kept apart from the
3127
- * device's own presence). Older coordinators ignore it.
3113
+ * A herdr or tmux daemon reporting the session focused in its client (kept apart from the
3114
+ * device's own presence).
3128
3115
  */
3116
+ clientId: z15.string().min(1).max(200).optional(),
3117
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of clientId. */
3129
3118
  terminalId: z15.string().min(1).max(200).optional()
3130
3119
  });
3131
- var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
3120
+ var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1", "scopes.v1"];
3132
3121
  var ClientToServer = z15.discriminatedUnion("type", [
3133
3122
  z15.object({
3134
3123
  type: z15.literal("hello"),