@spencerboucher/switchyard 0.20.0 → 0.22.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 (198) hide show
  1. package/README.md +20 -16
  2. package/dist/policies/worker.js +1866 -1777
  3. package/dist/switchyard.mjs +5526 -4684
  4. package/package.json +1 -1
  5. package/web-dist/assets/AutomationView-DwZ_2m9J.js +2 -0
  6. package/web-dist/assets/AutomationView-DwZ_2m9J.js.map +1 -0
  7. package/web-dist/assets/Checkbox-DR78wXsg.js +2 -0
  8. package/web-dist/assets/{Checkbox-BnRsg6ki.js.map → Checkbox-DR78wXsg.js.map} +1 -1
  9. package/web-dist/assets/DangerZone-CBnW9h0p.js +2 -0
  10. package/web-dist/assets/{DangerZone-BicyqXv8.js.map → DangerZone-CBnW9h0p.js.map} +1 -1
  11. package/web-dist/assets/Field-DS2BMoqA.js +2 -0
  12. package/web-dist/assets/{Field-Cp-08kpe.js.map → Field-DS2BMoqA.js.map} +1 -1
  13. package/web-dist/assets/{Markdown-BPWc6K6m.js → Markdown-BIO6MBTM.js} +7 -7
  14. package/web-dist/assets/{Markdown-BPWc6K6m.js.map → Markdown-BIO6MBTM.js.map} +1 -1
  15. package/web-dist/assets/NavigationEditor-C0J7vDXL.js +2 -0
  16. package/web-dist/assets/NavigationEditor-C0J7vDXL.js.map +1 -0
  17. package/web-dist/assets/Overlay-DPZqU_vB.js +2 -0
  18. package/web-dist/assets/Overlay-DPZqU_vB.js.map +1 -0
  19. package/web-dist/assets/Priority-0hv1Vpg7.js +2 -0
  20. package/web-dist/assets/{Priority-ZGpTH645.js.map → Priority-0hv1Vpg7.js.map} +1 -1
  21. package/web-dist/assets/RadioCards-CN5xELnc.js +2 -0
  22. package/web-dist/assets/RadioCards-CN5xELnc.js.map +1 -0
  23. package/web-dist/assets/ScopeSelect-BaJjip1Y.js +2 -0
  24. package/web-dist/assets/ScopeSelect-BaJjip1Y.js.map +1 -0
  25. package/web-dist/assets/SegmentedControl-CRmhE-Kn.js +2 -0
  26. package/web-dist/assets/SegmentedControl-CRmhE-Kn.js.map +1 -0
  27. package/web-dist/assets/Select-CN7M29ap.js +2 -0
  28. package/web-dist/assets/{Select-DHRR7IAK.js.map → Select-CN7M29ap.js.map} +1 -1
  29. package/web-dist/assets/Switch-CZMY83Fw.js +2 -0
  30. package/web-dist/assets/{Switch-D5pVfZgf.js.map → Switch-CZMY83Fw.js.map} +1 -1
  31. package/web-dist/assets/Tabs-_1w3hoAR.js +2 -0
  32. package/web-dist/assets/Tabs-_1w3hoAR.js.map +1 -0
  33. package/web-dist/assets/TextLink-BpF2vLiL.js +2 -0
  34. package/web-dist/assets/{TextLink-BGtYWCW9.js.map → TextLink-BpF2vLiL.js.map} +1 -1
  35. package/web-dist/assets/UINodeRenderer-DqIkLhF8.js +4 -0
  36. package/web-dist/assets/UINodeRenderer-DqIkLhF8.js.map +1 -0
  37. package/web-dist/assets/UnfilteredNote-22-Qjb-f.js +2 -0
  38. package/web-dist/assets/UnfilteredNote-22-Qjb-f.js.map +1 -0
  39. package/web-dist/assets/api-RftVSu44.js +2 -0
  40. package/web-dist/assets/api-RftVSu44.js.map +1 -0
  41. package/web-dist/assets/{arrow-down-Dn3KG_JI.js → arrow-down-CzjHSpfM.js} +2 -2
  42. package/web-dist/assets/{arrow-down-Dn3KG_JI.js.map → arrow-down-CzjHSpfM.js.map} +1 -1
  43. package/web-dist/assets/{arrow-up-BiPtOqqy.js → arrow-up-B4YU8Bg0.js} +2 -2
  44. package/web-dist/assets/{arrow-up-BiPtOqqy.js.map → arrow-up-B4YU8Bg0.js.map} +1 -1
  45. package/web-dist/assets/attention-CEgIsUuq.js +2 -0
  46. package/web-dist/assets/attention-CEgIsUuq.js.map +1 -0
  47. package/web-dist/assets/automations-DnydDML9.js +2 -0
  48. package/web-dist/assets/{automations-IX9DQNk8.js.map → automations-DnydDML9.js.map} +1 -1
  49. package/web-dist/assets/board-BPxxc8G4.js +6 -0
  50. package/web-dist/assets/board-BPxxc8G4.js.map +1 -0
  51. package/web-dist/assets/{calendar-clock-DVlat602.js → calendar-clock-B3bQkNKq.js} +2 -2
  52. package/web-dist/assets/{calendar-clock-DVlat602.js.map → calendar-clock-B3bQkNKq.js.map} +1 -1
  53. package/web-dist/assets/chevron-right-DuAbbYQ-.js +2 -0
  54. package/web-dist/assets/{chevron-right-BM1IJI2z.js.map → chevron-right-DuAbbYQ-.js.map} +1 -1
  55. package/web-dist/assets/code-D5IB7jTT.js +28 -0
  56. package/web-dist/assets/code-D5IB7jTT.js.map +1 -0
  57. package/web-dist/assets/{core.esm-C4dCvG0s.js → core.esm-BbOnWvFK.js} +2 -2
  58. package/web-dist/assets/{core.esm-C4dCvG0s.js.map → core.esm-BbOnWvFK.js.map} +1 -1
  59. package/web-dist/assets/describe-DWsoiUix.js +5 -0
  60. package/web-dist/assets/describe-DWsoiUix.js.map +1 -0
  61. package/web-dist/assets/enroll-CV77Sk6h.js +2 -0
  62. package/web-dist/assets/{enroll-GUEF5Uxu.js.map → enroll-CV77Sk6h.js.map} +1 -1
  63. package/web-dist/assets/git-branch-Dr8PvfHN.js +2 -0
  64. package/web-dist/assets/git-branch-Dr8PvfHN.js.map +1 -0
  65. package/web-dist/assets/grip-vertical-Bc5pJHHF.js +2 -0
  66. package/web-dist/assets/grip-vertical-Bc5pJHHF.js.map +1 -0
  67. package/web-dist/assets/{hand-B6lvj014.js → hand-B2TrADIv.js} +2 -2
  68. package/web-dist/assets/{hand-B6lvj014.js.map → hand-B2TrADIv.js.map} +1 -1
  69. package/web-dist/assets/haptics-O69vKVoK.js +2 -0
  70. package/web-dist/assets/haptics-O69vKVoK.js.map +1 -0
  71. package/web-dist/assets/index-BXQwol8u.css +2 -0
  72. package/web-dist/assets/index-cmIcNnnF.js +17 -0
  73. package/web-dist/assets/index-cmIcNnnF.js.map +1 -0
  74. package/web-dist/assets/{link-2-CCq9WzMy.js → link-2-M5ENDPWT.js} +2 -2
  75. package/web-dist/assets/{link-2-CCq9WzMy.js.map → link-2-M5ENDPWT.js.map} +1 -1
  76. package/web-dist/assets/logic-CG2E-voG.js +2 -0
  77. package/web-dist/assets/{logic-BnSIy9_P.js.map → logic-CG2E-voG.js.map} +1 -1
  78. package/web-dist/assets/logic-D_vBBkcD.js +4 -0
  79. package/web-dist/assets/logic-D_vBBkcD.js.map +1 -0
  80. package/web-dist/assets/more-CVjg2O5h.js +2 -0
  81. package/web-dist/assets/more-CVjg2O5h.js.map +1 -0
  82. package/web-dist/assets/pencil-y_4AgVa2.js +2 -0
  83. package/web-dist/assets/pencil-y_4AgVa2.js.map +1 -0
  84. package/web-dist/assets/{play-NHO6U6cY.js → play-CYKX2aVL.js} +2 -2
  85. package/web-dist/assets/{play-NHO6U6cY.js.map → play-CYKX2aVL.js.map} +1 -1
  86. package/web-dist/assets/{plus-C83uJhbf.js → plus-B6uH1yKa.js} +2 -2
  87. package/web-dist/assets/{plus-C83uJhbf.js.map → plus-B6uH1yKa.js.map} +1 -1
  88. package/web-dist/assets/policyLogic-CioD2rMm.js +2 -0
  89. package/web-dist/assets/{policyLogic-DqKyFQEW.js.map → policyLogic-CioD2rMm.js.map} +1 -1
  90. package/web-dist/assets/prefs-V29Ms2ZL.js +2 -0
  91. package/web-dist/assets/prefs-V29Ms2ZL.js.map +1 -0
  92. package/web-dist/assets/queue-BGK9c062.js +2 -0
  93. package/web-dist/assets/queue-BGK9c062.js.map +1 -0
  94. package/web-dist/assets/repo-CuL_qbqU.js +5 -0
  95. package/web-dist/assets/repo-CuL_qbqU.js.map +1 -0
  96. package/web-dist/assets/{rotate-ccw-BRrlVEAQ.js → rotate-ccw-DvfmNYNE.js} +2 -2
  97. package/web-dist/assets/{rotate-ccw-BRrlVEAQ.js.map → rotate-ccw-DvfmNYNE.js.map} +1 -1
  98. package/web-dist/assets/{search-C5H14z0D.js → search-GTFKEqAS.js} +2 -2
  99. package/web-dist/assets/{search-C5H14z0D.js.map → search-GTFKEqAS.js.map} +1 -1
  100. package/web-dist/assets/selection-CAMJBh5A.js +9 -0
  101. package/web-dist/assets/selection-CAMJBh5A.js.map +1 -0
  102. package/web-dist/assets/settings-o7k_MPK7.js +9 -0
  103. package/web-dist/assets/settings-o7k_MPK7.js.map +1 -0
  104. package/web-dist/assets/states-BUWwUyu-.js +60 -0
  105. package/web-dist/assets/states-BUWwUyu-.js.map +1 -0
  106. package/web-dist/assets/{terminal-CATQN_17.js → terminal-DGVFZER3.js} +2 -2
  107. package/web-dist/assets/{terminal-CATQN_17.js.map → terminal-DGVFZER3.js.map} +1 -1
  108. package/web-dist/assets/terminal-login-Gy6aLzgC.js +2 -0
  109. package/web-dist/assets/{terminal-login-BdkmJdOO.js.map → terminal-login-Gy6aLzgC.js.map} +1 -1
  110. package/web-dist/assets/useBreakpoint-DoLUoCMf.js +2 -0
  111. package/web-dist/assets/useBreakpoint-DoLUoCMf.js.map +1 -0
  112. package/web-dist/assets/useIndicator-BKqIsw2Q.js +2 -0
  113. package/web-dist/assets/useIndicator-BKqIsw2Q.js.map +1 -0
  114. package/web-dist/assets/useNow-BS_9T7IY.js +2 -0
  115. package/web-dist/assets/useNow-BS_9T7IY.js.map +1 -0
  116. package/web-dist/assets/useResource-CPN6cDQ5.js +2 -0
  117. package/web-dist/assets/useResource-CPN6cDQ5.js.map +1 -0
  118. package/web-dist/assets/useSwipeTabs-XRK0_O6T.js +2 -0
  119. package/web-dist/assets/useSwipeTabs-XRK0_O6T.js.map +1 -0
  120. package/web-dist/assets/workboard-FE6bAMnW.js +3 -0
  121. package/web-dist/assets/workboard-FE6bAMnW.js.map +1 -0
  122. package/web-dist/index.html +7 -7
  123. package/web-dist/sw.js +1 -1
  124. package/web-dist/sw.js.map +1 -1
  125. package/web-dist/assets/AutomationView-B4O_teaB.js +0 -2
  126. package/web-dist/assets/AutomationView-B4O_teaB.js.map +0 -1
  127. package/web-dist/assets/Button-C7TQGuSX.js +0 -2
  128. package/web-dist/assets/Button-C7TQGuSX.js.map +0 -1
  129. package/web-dist/assets/Card-DzHrwFrv.js +0 -2
  130. package/web-dist/assets/Card-DzHrwFrv.js.map +0 -1
  131. package/web-dist/assets/Checkbox-BnRsg6ki.js +0 -2
  132. package/web-dist/assets/DangerZone-BicyqXv8.js +0 -2
  133. package/web-dist/assets/Field-Cp-08kpe.js +0 -2
  134. package/web-dist/assets/Priority-ZGpTH645.js +0 -2
  135. package/web-dist/assets/SegmentedControl-Cvkz7C_A.js +0 -2
  136. package/web-dist/assets/SegmentedControl-Cvkz7C_A.js.map +0 -1
  137. package/web-dist/assets/Select-DHRR7IAK.js +0 -2
  138. package/web-dist/assets/Switch-D5pVfZgf.js +0 -2
  139. package/web-dist/assets/Tabs-2GilVMsH.js +0 -2
  140. package/web-dist/assets/Tabs-2GilVMsH.js.map +0 -1
  141. package/web-dist/assets/TextLink-BGtYWCW9.js +0 -2
  142. package/web-dist/assets/UINodeRenderer-BaANWHvJ.js +0 -4
  143. package/web-dist/assets/UINodeRenderer-BaANWHvJ.js.map +0 -1
  144. package/web-dist/assets/UnfilteredNote-zVO8ajSi.js +0 -2
  145. package/web-dist/assets/UnfilteredNote-zVO8ajSi.js.map +0 -1
  146. package/web-dist/assets/ViewSelect-C9gNftWK.js +0 -2
  147. package/web-dist/assets/ViewSelect-C9gNftWK.js.map +0 -1
  148. package/web-dist/assets/api-DMrk4xwq.js +0 -2
  149. package/web-dist/assets/api-DMrk4xwq.js.map +0 -1
  150. package/web-dist/assets/attention-B9uawu1d.js +0 -2
  151. package/web-dist/assets/attention-B9uawu1d.js.map +0 -1
  152. package/web-dist/assets/automations-IX9DQNk8.js +0 -2
  153. package/web-dist/assets/board-BUAI4L7M.js +0 -6
  154. package/web-dist/assets/board-BUAI4L7M.js.map +0 -1
  155. package/web-dist/assets/check-CEnbWw4D.js +0 -2
  156. package/web-dist/assets/check-CEnbWw4D.js.map +0 -1
  157. package/web-dist/assets/chevron-right-BM1IJI2z.js +0 -2
  158. package/web-dist/assets/code-Dav4E15n.js +0 -25
  159. package/web-dist/assets/code-Dav4E15n.js.map +0 -1
  160. package/web-dist/assets/describe-B66LJTqU.js +0 -2
  161. package/web-dist/assets/describe-B66LJTqU.js.map +0 -1
  162. package/web-dist/assets/describe-BeFxHr2Y.js +0 -5
  163. package/web-dist/assets/describe-BeFxHr2Y.js.map +0 -1
  164. package/web-dist/assets/enroll-GUEF5Uxu.js +0 -2
  165. package/web-dist/assets/external-link-B3hnazCa.js +0 -2
  166. package/web-dist/assets/external-link-B3hnazCa.js.map +0 -1
  167. package/web-dist/assets/index-BUZpNu-R.js +0 -22
  168. package/web-dist/assets/index-BUZpNu-R.js.map +0 -1
  169. package/web-dist/assets/index-C9iuCGwg.css +0 -2
  170. package/web-dist/assets/keyboardLayers-BZOygMAH.js +0 -2
  171. package/web-dist/assets/keyboardLayers-BZOygMAH.js.map +0 -1
  172. package/web-dist/assets/logic-BBQ4d1GC.js +0 -4
  173. package/web-dist/assets/logic-BBQ4d1GC.js.map +0 -1
  174. package/web-dist/assets/logic-BnSIy9_P.js +0 -2
  175. package/web-dist/assets/more-C1oPXLVM.js +0 -2
  176. package/web-dist/assets/more-C1oPXLVM.js.map +0 -1
  177. package/web-dist/assets/pencil-DeML-0z2.js +0 -2
  178. package/web-dist/assets/pencil-DeML-0z2.js.map +0 -1
  179. package/web-dist/assets/policyLogic-DqKyFQEW.js +0 -2
  180. package/web-dist/assets/queue-DWSd1kia.js +0 -2
  181. package/web-dist/assets/queue-DWSd1kia.js.map +0 -1
  182. package/web-dist/assets/repo-DRwGWCut.js +0 -2
  183. package/web-dist/assets/repo-DRwGWCut.js.map +0 -1
  184. package/web-dist/assets/settings-B0IbaTOd.js +0 -12
  185. package/web-dist/assets/settings-B0IbaTOd.js.map +0 -1
  186. package/web-dist/assets/states-hyf_ATdQ.js +0 -58
  187. package/web-dist/assets/states-hyf_ATdQ.js.map +0 -1
  188. package/web-dist/assets/terminal-login-BdkmJdOO.js +0 -2
  189. package/web-dist/assets/timer-DFrvOKOy.js +0 -2
  190. package/web-dist/assets/timer-DFrvOKOy.js.map +0 -1
  191. package/web-dist/assets/useBreakpoint-BYCN9s8X.js +0 -2
  192. package/web-dist/assets/useBreakpoint-BYCN9s8X.js.map +0 -1
  193. package/web-dist/assets/useNow-DXyC-YfE.js +0 -2
  194. package/web-dist/assets/useNow-DXyC-YfE.js.map +0 -1
  195. package/web-dist/assets/useResource-DYNGG9XS.js +0 -2
  196. package/web-dist/assets/useResource-DYNGG9XS.js.map +0 -1
  197. package/web-dist/assets/workboard-BJCZsLp5.js +0 -3
  198. 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 z9 } from "zod";
7
7
 
8
8
  // packages/protocol/dist/contributions.js
9
9
  import { z as z3 } from "zod";
@@ -107,7 +107,11 @@ var RefSchema = z2.discriminatedUnion("kind", [
107
107
  z2.object({ kind: z2.literal("file"), path: z2.string() }),
108
108
  z2.object({ kind: z2.literal("session"), sessionId: z2.string() }),
109
109
  z2.object({ kind: z2.literal("task"), taskId: z2.string() }),
110
- z2.object({ kind: z2.literal("native_session"), hostId: z2.string(), sessionFile: z2.string() })
110
+ z2.object({ kind: z2.literal("native_session"), hostId: z2.string(), sessionFile: z2.string() }),
111
+ z2.object({
112
+ kind: z2.literal("url"),
113
+ url: z2.string().max(2e3).regex(/^https?:\/\/[^\s]+$/i, "must be an http(s) URL")
114
+ })
111
115
  ]);
112
116
  var UINodeSchema = z2.lazy(() => z2.discriminatedUnion("t", [
113
117
  z2.object({ t: z2.literal("text"), text: z2.string(), tone: ToneSchema.optional() }),
@@ -128,6 +132,7 @@ var UINodeSchema = z2.lazy(() => z2.discriminatedUnion("t", [
128
132
  t: z2.literal("section"),
129
133
  title: z2.string().optional(),
130
134
  collapsible: z2.boolean().optional(),
135
+ open: z2.boolean().optional(),
131
136
  children: z2.array(UINodeSchema)
132
137
  }),
133
138
  z2.object({
@@ -162,7 +167,30 @@ var UINodeSchema = z2.lazy(() => z2.discriminatedUnion("t", [
162
167
  label: z2.string(),
163
168
  tone: z2.enum(["default", "primary", "danger"]).optional()
164
169
  }))
165
- })
170
+ }),
171
+ z2.object({
172
+ t: z2.literal("checklist"),
173
+ items: z2.array(z2.object({
174
+ text: z2.string(),
175
+ state: z2.enum(["todo", "doing", "done", "skipped"]),
176
+ note: z2.string().optional()
177
+ }))
178
+ }),
179
+ z2.object({
180
+ t: z2.literal("facts"),
181
+ items: z2.array(z2.object({ label: z2.string(), value: z2.string(), mono: z2.boolean().optional() }))
182
+ }),
183
+ z2.object({
184
+ t: z2.literal("rows"),
185
+ rows: z2.array(z2.object({
186
+ title: z2.string(),
187
+ status: z2.string().optional(),
188
+ tone: ToneSchema.optional(),
189
+ meta: z2.string().optional(),
190
+ ref: RefSchema.optional()
191
+ }))
192
+ }),
193
+ z2.object({ t: z2.literal("badge"), text: z2.string(), tone: ToneSchema.optional() })
166
194
  ]));
167
195
  var UI_MAX_DEPTH = 12;
168
196
  var UI_MAX_NODES = 2e3;
@@ -213,16 +241,28 @@ var ContributionPlacement = z3.enum([
213
241
  "sidebar.footer",
214
242
  "session.panel",
215
243
  "composer.pill",
244
+ /** `adapter.trackers.v1`: a live summary above the input that opens its detail. */
245
+ "composer.tracker",
246
+ /** `adapter.trackers.v1`: a short word on the session's navigator row. */
247
+ "session.badge",
216
248
  "palette.item",
217
249
  "slash.command"
218
250
  ]);
219
251
  var Id = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
220
252
  var ActionId = z3.string().min(1).max(200);
221
253
  var Keywords = z3.array(z3.string().min(1).max(80)).max(20);
254
+ var TrackerSummary = z3.object({
255
+ /** Progress or a count, such as "2/5" or "3". */
256
+ count: z3.string().min(1).max(24).optional(),
257
+ status: z3.enum(["idle", "running", "ok", "error", "attention"]).optional(),
258
+ /** The step in progress, such as the current todo. */
259
+ step: z3.string().min(1).max(120).optional()
260
+ }).strict();
222
261
  var Common = {
223
262
  placement: ContributionPlacement,
224
263
  order: z3.number().int().min(-1e3).max(1e3).optional(),
225
- actionId: ActionId.optional()
264
+ actionId: ActionId.optional(),
265
+ tracker: TrackerSummary.optional()
226
266
  };
227
267
  var ContributionDescriptor = z3.object({
228
268
  id: Id,
@@ -245,6 +285,12 @@ var ContributionDescriptor = z3.object({
245
285
  if (v.placement === "composer.pill" && v.actionId !== void 0) {
246
286
  ctx.addIssue({ code: "custom", message: "Composer pills are not interactive" });
247
287
  }
288
+ if (v.placement === "session.badge" && v.actionId !== void 0) {
289
+ ctx.addIssue({ code: "custom", message: "Session badges are not interactive" });
290
+ }
291
+ if (v.placement !== "composer.tracker" && v.tracker !== void 0) {
292
+ ctx.addIssue({ code: "custom", message: "Only composer trackers have a tracker summary" });
293
+ }
248
294
  });
249
295
  var ContributionInput = z3.object({
250
296
  ...Common,
@@ -255,6 +301,7 @@ var ContributionInput = z3.object({
255
301
  name: z3.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
256
302
  keywords: Keywords.optional()
257
303
  }).strict();
304
+ var SESSION_BADGE_MAX = 24;
258
305
  function boundContributionJson(value, maxBytes = 256 * 1024) {
259
306
  const stack = [{ value, depth: 0 }];
260
307
  const ancestors = /* @__PURE__ */ new Set();
@@ -331,6 +378,14 @@ function validateContribution(id, input) {
331
378
  if (descriptor.placement === "composer.pill" && node.t !== "text" && node.t !== "progress") {
332
379
  throw new Error("Composer pill content must be text or progress");
333
380
  }
381
+ if (descriptor.placement === "session.badge") {
382
+ if (node.t !== "text" && node.t !== "badge") {
383
+ throw new Error("Session badge content must be text or a badge");
384
+ }
385
+ if (node.text.length === 0 || node.text.length > SESSION_BADGE_MAX) {
386
+ throw new Error(`Session badge text must be 1 to ${SESSION_BADGE_MAX} characters`);
387
+ }
388
+ }
334
389
  if (descriptor.placement !== "session.panel" && state !== void 0) {
335
390
  throw new Error("Only session panels accept renderer state");
336
391
  }
@@ -353,7 +408,7 @@ function contributionSlot(id) {
353
408
  }
354
409
 
355
410
  // packages/protocol/dist/entities.js
356
- import { z as z6 } from "zod";
411
+ import { z as z8 } from "zod";
357
412
 
358
413
  // packages/protocol/dist/github.js
359
414
  import { z as z4 } from "zod";
@@ -602,20 +657,207 @@ var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
602
657
  expectedPullRequestNodeId: z4.string().min(1)
603
658
  });
604
659
 
605
- // packages/protocol/dist/policies.js
660
+ // packages/protocol/dist/issues.js
606
661
  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) => {
662
+ var Iso = z5.string();
663
+ var Id3 = z5.string().min(1);
664
+ var IssueFollow = z5.enum(["assigned", "board"]);
665
+ var GitHubLogin = z5.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
666
+ var BoardStatusOption = z5.object({
667
+ id: z5.string().min(1),
668
+ name: z5.string().min(1).max(200)
669
+ });
670
+ var SourceBoard = z5.object({
671
+ projectNumber: z5.number().int().positive(),
672
+ statusField: z5.string().min(1).max(100).default("Status"),
673
+ /** Column to move a card to once its worktree exists (write-back). */
674
+ onStart: z5.string().min(1).max(200).nullable().default(null),
675
+ /** Column to move a card to once a pull request is open (write-back). */
676
+ onReview: z5.string().min(1).max(200).nullable().default(null),
677
+ /** A single-select field that ranks issues: its first option is the highest. */
678
+ priorityField: z5.string().min(1).max(100).nullable().optional(),
679
+ /** Columns whose cards are not tracked until they have a branch or pull request. */
680
+ backlog: z5.array(z5.string().min(1).max(200)).max(20).optional()
681
+ });
682
+ var GitHubSource = z5.object({
683
+ kind: z5.literal("github"),
684
+ /** The host whose `gh` login reads the issues. */
685
+ hostId: Id3,
686
+ owner: GitHubLogin,
687
+ repositories: z5.array(GitHubRepository).min(1).max(50).nullable(),
688
+ /** Repositories outside `owner` that belong to this source too (never limited by `repositories`). */
689
+ extraRepositories: z5.array(GitHubRepository).max(20).optional(),
690
+ board: SourceBoard.nullable(),
691
+ /** Which issues it follows; absent means "assigned". "board": every open issue on its board. */
692
+ follow: IssueFollow.optional(),
693
+ writeBack: z5.boolean(),
694
+ moveShared: z5.boolean(),
695
+ /** Make a worktree for an issue branch that has none; absent means true. */
696
+ worktrees: z5.boolean().optional(),
697
+ enabled: z5.boolean(),
698
+ /** The host's `gh` user, from the last sync. */
699
+ login: z5.string().nullable(),
700
+ lastSyncedAt: Iso.nullable(),
701
+ lastError: z5.string().max(2e3).nullable()
702
+ });
703
+ var GitHubSourceInput = z5.object({
704
+ hostId: Id3,
705
+ owner: GitHubLogin,
706
+ repositories: GitHubSource.shape.repositories.default(null),
707
+ extraRepositories: z5.array(GitHubRepository).max(20).default([]),
708
+ board: SourceBoard.nullable().default(null),
709
+ follow: IssueFollow.default("assigned"),
710
+ writeBack: z5.boolean().default(false),
711
+ moveShared: z5.boolean().default(true),
712
+ worktrees: z5.boolean().default(true),
713
+ enabled: z5.boolean().default(true)
714
+ });
715
+ var GitHubSourcePatch = z5.object({
716
+ hostId: Id3.optional(),
717
+ owner: GitHubLogin.optional(),
718
+ repositories: GitHubSource.shape.repositories.optional(),
719
+ extraRepositories: z5.array(GitHubRepository).max(20).optional(),
720
+ board: SourceBoard.nullable().optional(),
721
+ follow: IssueFollow.optional(),
722
+ writeBack: z5.boolean().optional(),
723
+ moveShared: z5.boolean().optional(),
724
+ worktrees: z5.boolean().optional(),
725
+ enabled: z5.boolean().optional()
726
+ });
727
+ var IssueBoard = z5.object({
728
+ projectId: z5.string().min(1),
729
+ projectItemId: z5.string().min(1),
730
+ fieldId: z5.string().min(1),
731
+ status: z5.string().nullable(),
732
+ statusOptionId: z5.string().nullable(),
733
+ options: z5.array(BoardStatusOption).max(50),
734
+ /** The issue's value of the source's priority field; `rank` is its option's position. */
735
+ priority: z5.object({ name: z5.string().min(1).max(200), rank: z5.number().int().min(0) }).nullable().optional()
736
+ });
737
+ var IssuePullRequest = z5.object({
738
+ number: z5.number().int().positive(),
739
+ state: z5.enum(["OPEN", "CLOSED", "MERGED"]),
740
+ url: z5.string().url(),
741
+ headRefName: z5.string().min(1).max(255)
742
+ });
743
+ var IssueParent = z5.object({
744
+ number: z5.number().int().positive(),
745
+ title: z5.string().max(300),
746
+ url: GitHubIssueUrl
747
+ });
748
+ var IssueSubIssues = z5.object({
749
+ total: z5.number().int().min(0),
750
+ completed: z5.number().int().min(0)
751
+ });
752
+ var SyncedIssue = z5.object({
753
+ itemId: z5.string().min(1),
754
+ repository: GitHubRepository,
755
+ number: z5.number().int().positive(),
756
+ title: z5.string().min(1).max(1e3),
757
+ url: GitHubIssueUrl,
758
+ assignees: z5.array(z5.string()).max(20),
759
+ branches: z5.array(z5.string().min(1).max(255)).max(10),
760
+ pullRequest: IssuePullRequest.nullable(),
761
+ board: IssueBoard.nullable(),
762
+ parent: IssueParent.nullable().optional(),
763
+ subIssues: IssueSubIssues.nullable().optional()
764
+ });
765
+ var IssueSyncResult = z5.object({
766
+ login: z5.string().min(1),
767
+ items: z5.array(SyncedIssue).max(200),
768
+ truncated: z5.boolean()
769
+ });
770
+ var TrackedIssue = z5.object({
771
+ /** `${scopeId}:${itemId}` */
772
+ id: Id3,
773
+ scopeId: Id3,
774
+ /** COMPAT(scopes-rename): remove after 2027-03-01. A copy of scopeId for 0.20 clients. */
775
+ trackerId: Id3.optional(),
776
+ itemId: z5.string().min(1),
777
+ projectId: Id3,
778
+ repository: GitHubRepository,
779
+ number: z5.number().int().positive(),
780
+ title: z5.string().min(1).max(300),
781
+ url: GitHubIssueUrl,
782
+ assignees: z5.array(z5.string()).max(20),
783
+ /** Branches GitHub links to the issue. */
784
+ branches: z5.array(z5.string()).max(10),
785
+ /** The branch Switchyard works on. */
786
+ branch: z5.string().nullable(),
787
+ workspaceId: Id3.nullable(),
788
+ pullRequest: IssuePullRequest.nullable(),
789
+ board: IssueBoard.nullable(),
790
+ /** The issue this one is a sub-issue of. */
791
+ parent: IssueParent.nullable().optional(),
792
+ subIssues: IssueSubIssues.nullable().optional(),
793
+ updatedAt: Iso
794
+ });
795
+ var OpenIssueRequest = z5.object({
796
+ hostId: Id3.optional(),
797
+ scopeId: z5.string().optional(),
798
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
799
+ viewId: z5.string().optional(),
800
+ /** The first prompt of a new session. */
801
+ prompt: z5.string().optional(),
802
+ profileId: z5.string().nullable().optional()
803
+ });
804
+ var IssueSetStatusResult = z5.discriminatedUnion("status", [
805
+ z5.object({ status: z5.literal("moved") }),
806
+ z5.object({
807
+ status: z5.literal("skipped"),
808
+ reason: z5.enum(["not_assigned", "shared", "stale"])
809
+ })
810
+ ]);
811
+ var LinkIssueRequest = z5.object({ workspaceId: Id3 });
812
+ var IssueStatusRequest = z5.object({ status: z5.string().min(1).max(200) });
813
+ var IssueHostSyncRequest = z5.object({
814
+ owner: GitHubLogin,
815
+ repositories: z5.array(GitHubRepository).nullable(),
816
+ board: z5.object({
817
+ projectNumber: z5.number().int().positive(),
818
+ statusField: z5.string().min(1),
819
+ priorityField: z5.string().min(1).nullable().optional()
820
+ }).nullable(),
821
+ follow: IssueFollow.optional(),
822
+ backlog: z5.array(z5.string().min(1)).max(20).optional()
823
+ });
824
+ var IssueHostPrepareBranchRequest = z5.object({
825
+ checkoutPath: z5.string().min(1),
826
+ branch: z5.string().min(1).max(255)
827
+ });
828
+ var IssueHostStartIssueRequest = z5.object({
829
+ checkoutPath: z5.string().min(1),
830
+ repository: GitHubRepository,
831
+ number: z5.number().int().positive(),
832
+ branch: z5.string().min(1).max(255),
833
+ base: z5.string().min(1)
834
+ });
835
+ var IssueHostSetStatusRequest = z5.object({
836
+ projectId: z5.string().min(1),
837
+ projectItemId: z5.string().min(1),
838
+ fieldId: z5.string().min(1),
839
+ statusField: z5.string().min(1),
840
+ optionId: z5.string().min(1),
841
+ expectedOptionId: z5.string().nullable(),
842
+ login: z5.string().min(1),
843
+ allowShared: z5.boolean(),
844
+ allowUnassigned: z5.boolean().optional()
845
+ });
846
+
847
+ // packages/protocol/dist/policies.js
848
+ import { z as z6 } from "zod";
849
+ var Id4 = z6.string().min(1).max(200);
850
+ var Revision = z6.number().int().safe().min(1);
851
+ var Instant2 = z6.string().refine((s) => {
610
852
  try {
611
853
  return new Date(s).toISOString() === s;
612
854
  } catch {
613
855
  return false;
614
856
  }
615
857
  });
616
- var Text = z5.string().max(4e3);
858
+ var Text = z6.string().max(4e3);
617
859
  var Reason = Text.min(1);
618
- var Fingerprint = z5.string().regex(/^[0-9a-f]{64}$/);
860
+ var Fingerprint = z6.string().regex(/^[0-9a-f]{64}$/);
619
861
  var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
620
862
  var bytes2 = (s) => new TextEncoder().encode(s).length;
621
863
  function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
@@ -652,43 +894,43 @@ function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
652
894
  seen.delete(value);
653
895
  }
654
896
  }
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() };
897
+ var JsonObject = z6.custom((v) => !!v && typeof v === "object" && !Array.isArray(v) && validJson(v));
898
+ var CompletedUsageWatermark = z6.object({ runtimeId: Id4, settleSeq: Revision }).strict();
899
+ var scopeShape = { scope: z6.enum(["session", "profile", "server"]), scopeId: Id4.nullable() };
658
900
  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([
901
+ var PolicyPhase = z6.enum(["tool_call", "request"]);
902
+ var PolicyVerdict = z6.enum(["ALLOW", "ASK", "DENY"]);
903
+ var PolicyRequestAction = z6.enum([
662
904
  "task.create",
663
905
  "message.send",
664
906
  "inbox.read",
665
907
  "run.continue"
666
908
  ]);
667
909
  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);
910
+ 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);
911
+ var phases = z6.array(PolicyPhase).min(1).max(2).refine((v) => new Set(v).size === v.length);
670
912
  var ruleFields = {
671
- priority: z5.number().int().safe().min(-1e6).max(1e6),
672
- enabled: z5.boolean(),
913
+ priority: z6.number().int().safe().min(-1e6).max(1e6),
914
+ enabled: z6.boolean(),
673
915
  phases,
674
- name: z5.string().min(1).max(120),
675
- expression: z5.string().min(1).max(8192)
916
+ name: z6.string().min(1).max(120),
917
+ expression: z6.string().min(1).max(8192)
676
918
  };
677
- var PolicyRule = z5.object({
678
- id: Id3,
919
+ var PolicyRule = z6.object({
920
+ id: Id4,
679
921
  ...scopeShape,
680
922
  ...ruleFields,
681
923
  revision: Revision,
682
- builtIn: z5.boolean(),
924
+ builtIn: z6.boolean(),
683
925
  createdAt: Instant2,
684
926
  updatedAt: Instant2
685
927
  }).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)
928
+ var PolicyToolSafety = z6.object({
929
+ destructiveDelete: z6.boolean(),
930
+ forcePush: z6.boolean(),
931
+ defaultBranchPush: z6.boolean(),
932
+ uncertain: z6.boolean(),
933
+ reasons: z6.array(z6.string().min(1).max(1e3)).max(16)
692
934
  }).strict();
693
935
  function normalizePosixPath(value) {
694
936
  const parts = [];
@@ -700,7 +942,7 @@ function normalizePosixPath(value) {
700
942
  }
701
943
  return `/${parts.join("/")}`;
702
944
  }
703
- var hostPath = z5.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
945
+ var hostPath = z6.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
704
946
  function relativePosixPath(from, to) {
705
947
  const fromParts = from.split("/").filter(Boolean);
706
948
  const toParts = to.split("/").filter(Boolean);
@@ -709,7 +951,7 @@ function relativePosixPath(from, to) {
709
951
  shared++;
710
952
  return [...fromParts.slice(shared).map(() => ".."), ...toParts.slice(shared)].join("/");
711
953
  }
712
- var HostPolicyBoundary = z5.object({
954
+ var HostPolicyBoundary = z6.object({
713
955
  cwd: hostPath,
714
956
  workspaceRoot: hostPath,
715
957
  cwdReal: hostPath,
@@ -718,51 +960,51 @@ var HostPolicyBoundary = z5.object({
718
960
  const relative = relativePosixPath(boundary.workspaceRootReal, boundary.cwdReal);
719
961
  return relative !== ".." && !relative.startsWith("../");
720
962
  }, "Real cwd must be within the real workspace boundary.");
721
- var HostToolPolicyContext = z5.object({
722
- version: z5.literal(1),
723
- toolCallId: Id3,
963
+ var HostToolPolicyContext = z6.object({
964
+ version: z6.literal(1),
965
+ toolCallId: Id4,
724
966
  toolHash: Fingerprint,
725
967
  boundary: HostPolicyBoundary,
726
- defaultBranch: z5.string().min(1).max(255).nullable(),
968
+ defaultBranch: z6.string().min(1).max(255).nullable(),
727
969
  safety: PolicyToolSafety
728
970
  }).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(),
971
+ var PolicyToolContext = z6.object({ name: Id4, args: JsonObject, safety: PolicyToolSafety }).strict();
972
+ var PolicyRequestContext = z6.object({ method: PolicyRequestAction, args: JsonObject }).strict();
973
+ var absolutePath = z6.string().min(1).max(8192).refine((v) => v.startsWith("/") || /^[A-Za-z]:[\\/]/.test(v));
974
+ var controlMode = z6.enum(["human", "automation"]);
975
+ var PolicySessionContext = z6.object({
976
+ id: Id4,
977
+ hostId: Id4,
978
+ nativeSessionId: Id4.nullable(),
979
+ runtimeId: Id4.nullable(),
980
+ profileId: Id4,
981
+ projectId: Id4.nullable(),
982
+ taskId: Id4.nullable(),
983
+ runId: Id4.nullable(),
742
984
  controlMode,
743
985
  controlRevision: Revision,
744
986
  cwd: absolutePath,
745
987
  workspaceRoot: absolutePath,
746
- repository: z5.string().min(1).max(2048).nullable(),
747
- defaultBranch: z5.string().min(1).max(255).nullable(),
748
- readOnly: z5.boolean()
988
+ repository: z6.string().min(1).max(2048).nullable(),
989
+ defaultBranch: z6.string().min(1).max(255).nullable(),
990
+ readOnly: z6.boolean()
749
991
  }).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"])
992
+ var PolicyTaskContext = z6.object({
993
+ id: Id4,
994
+ projectId: Id4,
995
+ rootTaskId: Id4,
996
+ parentTaskId: Id4.nullable(),
997
+ title: z6.string().min(1).max(300),
998
+ state: z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"])
757
999
  }).strict();
758
- var PolicyTargetContext = z5.object({
759
- id: Id3,
760
- hostId: Id3,
761
- projectId: Id3.nullable(),
762
- taskId: Id3.nullable(),
1000
+ var PolicyTargetContext = z6.object({
1001
+ id: Id4,
1002
+ hostId: Id4,
1003
+ projectId: Id4.nullable(),
1004
+ taskId: Id4.nullable(),
763
1005
  controlMode,
764
1006
  controlRevision: Revision,
765
- runtime: z5.enum([
1007
+ runtime: z6.enum([
766
1008
  "starting",
767
1009
  "idle",
768
1010
  "running",
@@ -771,24 +1013,24 @@ var PolicyTargetContext = z5.object({
771
1013
  "failed",
772
1014
  "stopped"
773
1015
  ]),
774
- readOnly: z5.boolean()
1016
+ readOnly: z6.boolean()
775
1017
  }).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(),
1018
+ var PolicyCostContext = z6.object({
1019
+ tokens: z6.number().int().safe().nonnegative().nullable(),
1020
+ costUsd: z6.number().finite().nonnegative().nullable(),
1021
+ maxTokens: z6.number().int().safe().positive().nullable(),
1022
+ maxCostUsd: z6.number().finite().positive().nullable(),
1023
+ accounting: z6.enum(["available", "unavailable"]),
1024
+ fresh: z6.boolean(),
783
1025
  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()
1026
+ provider: Id4.nullable(),
1027
+ modelId: z6.string().min(1).max(512).nullable(),
1028
+ classification: z6.enum(["cheap", "expensive", "unclassified"]),
1029
+ expensive: z6.boolean()
788
1030
  }).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({
1031
+ var PolicyContext = z6.object({
790
1032
  phase: PolicyPhase,
791
- action: z5.union([z5.literal("tool.call"), PolicyRequestAction]),
1033
+ action: z6.union([z6.literal("tool.call"), PolicyRequestAction]),
792
1034
  tool: PolicyToolContext.nullable(),
793
1035
  request: PolicyRequestContext.nullable(),
794
1036
  session: PolicySessionContext,
@@ -797,11 +1039,11 @@ var PolicyContext = z5.object({
797
1039
  cost: PolicyCostContext,
798
1040
  counters: PolicyCounterMap
799
1041
  }).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)
1042
+ var PolicyRuleResult = z6.union([
1043
+ z6.null(),
1044
+ z6.object({ verdict: PolicyVerdict, reason: Text, state_updates: PolicyCounterMap.optional() }).strict().refine((v) => v.verdict === "ALLOW" || v.reason.length > 0)
803
1045
  ]);
804
- var webUrl = z5.string().max(4096).refine((s) => {
1046
+ var webUrl = z6.string().max(4096).refine((s) => {
805
1047
  try {
806
1048
  const u = new URL(s);
807
1049
  return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
@@ -809,322 +1051,335 @@ var webUrl = z5.string().max(4096).refine((s) => {
809
1051
  return false;
810
1052
  }
811
1053
  });
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,
1054
+ var PolicyEvaluation = z6.discriminatedUnion("verdict", [
1055
+ z6.object({ verdict: z6.literal("ALLOW") }).strict(),
1056
+ z6.object({ verdict: z6.literal("DENY"), reason: Reason }).strict(),
1057
+ z6.object({
1058
+ verdict: z6.literal("ASK"),
1059
+ decisionId: Id4,
1060
+ interactionId: Id4,
819
1061
  interactionUrl: webUrl
820
1062
  }).strict()
821
1063
  ]);
822
- var PolicyPermission = z5.object({
823
- kind: z5.literal("policy"),
824
- decisionId: Id3,
825
- rootTaskId: Id3.nullable(),
826
- ruleId: Id3,
1064
+ var PolicyPermission = z6.object({
1065
+ kind: z6.literal("policy"),
1066
+ decisionId: Id4,
1067
+ rootTaskId: Id4.nullable(),
1068
+ ruleId: Id4,
827
1069
  ruleRevision: Revision,
828
1070
  fingerprint: Fingerprint
829
1071
  }).strict();
830
- var PolicyGrant = z5.object({
831
- id: Id3,
832
- scope: z5.object({ kind: z5.enum(["task", "session"]), id: Id3 }).strict(),
833
- ruleId: Id3,
1072
+ var PolicyGrant = z6.object({
1073
+ id: Id4,
1074
+ scope: z6.object({ kind: z6.enum(["task", "session"]), id: Id4 }).strict(),
1075
+ ruleId: Id4,
834
1076
  ruleRevision: Revision,
835
1077
  fingerprint: Fingerprint,
836
- approvedByDeviceId: Id3,
1078
+ approvedByDeviceId: Id4,
837
1079
  approvedAt: Instant2
838
1080
  }).strict();
839
- var trimmed = (max) => z5.string().min(1).max(max).refine((s) => s.trim() === s);
840
- var PolicyModelClassification = z5.object({
1081
+ var trimmed = (max) => z6.string().min(1).max(max).refine((s) => s.trim() === s);
1082
+ var PolicyModelClassification = z6.object({
841
1083
  provider: trimmed(200),
842
1084
  modelId: trimmed(512),
843
- classification: z5.enum(["cheap", "expensive"])
1085
+ classification: z6.enum(["cheap", "expensive"])
844
1086
  }).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({
1087
+ var classifications = z6.array(PolicyModelClassification).max(1e3).refine((v) => new Set(v.map((x) => JSON.stringify([x.provider, x.modelId]))).size === v.length);
1088
+ var PolicySettings = z6.object({ revision: Revision, modelClassifications: classifications, updatedAt: Instant2 }).strict();
1089
+ var toolInput = z6.object({ name: Id4, args: JsonObject }).strict();
1090
+ var sampleIdentity = { sessionId: Id4, nativeSessionId: Id4, runtimeId: Id4, sampleId: Id4 };
1091
+ var HostPolicySampleRequest = z6.object({ ...sampleIdentity, tool: toolInput }).strict();
1092
+ var HostPolicySampleResult = z6.object({
851
1093
  ...sampleIdentity,
852
1094
  toolHash: Fingerprint,
853
1095
  boundary: HostPolicyBoundary,
854
- defaultBranch: z5.string().min(1).max(255).nullable(),
1096
+ defaultBranch: z6.string().min(1).max(255).nullable(),
855
1097
  safety: PolicyToolSafety
856
1098
  }).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()
1099
+ var PolicyEvaluateRequest = z6.object({ evaluationId: Id4, toolCallId: Id4, tool: toolInput }).strict();
1100
+ var PolicyStatusRequest = z6.object({ decisionId: Id4, waitMs: z6.literal(25e3) }).strict();
1101
+ var PolicyStatusResult = z6.discriminatedUnion("state", [
1102
+ z6.object({ state: z6.literal("pending") }).strict(),
1103
+ z6.object({ state: z6.literal("allowed") }).strict(),
1104
+ z6.object({ state: z6.literal("denied"), reason: Reason }).strict(),
1105
+ z6.object({ state: z6.literal("canceled"), reason: Reason }).strict()
864
1106
  ]);
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,
1107
+ var PolicyCancelRequest = z6.object({ decisionId: Id4 }).strict();
1108
+ var PolicyCancelResult = z6.object({ state: z6.enum(["canceled", "already_resolved"]) }).strict();
1109
+ var PolicyTrace = z6.object({
1110
+ ruleId: Id4,
869
1111
  ruleRevision: Revision,
870
1112
  ...scopeShape,
871
1113
  verdict: PolicyVerdict.nullable(),
872
1114
  reason: Text.nullable(),
873
- granted: z5.boolean(),
874
- overridden: z5.boolean(),
1115
+ granted: z6.boolean(),
1116
+ overridden: z6.boolean(),
875
1117
  proposedStateUpdates: PolicyCounterMap
876
1118
  }).strict().refine(scopeValid);
877
- var PolicyTestResult = z5.object({
1119
+ var PolicyTestResult = z6.object({
878
1120
  verdict: PolicyVerdict,
879
1121
  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()
1122
+ trace: z6.array(PolicyTrace).max(128),
1123
+ proposedStateUpdates: z6.record(Id4, PolicyCounterMap),
1124
+ enforcement: z6.object({
1125
+ phases: z6.array(PolicyPhase),
1126
+ modelRequest: z6.literal(false),
1127
+ explanation: z6.string()
886
1128
  }).strict()
887
1129
  }).strict();
888
- var CreatePolicyRuleRequest = z5.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
889
- var UpdatePolicyRuleRequest = z5.object({
1130
+ var CreatePolicyRuleRequest = z6.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
1131
+ var UpdatePolicyRuleRequest = z6.object({
890
1132
  expectedRevision: Revision,
891
1133
  name: ruleFields.name.optional(),
892
1134
  priority: ruleFields.priority.optional(),
893
- enabled: z5.boolean().optional(),
1135
+ enabled: z6.boolean().optional(),
894
1136
  phases: phases.optional(),
895
1137
  expression: ruleFields.expression.optional()
896
1138
  }).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,
1139
+ var DeletePolicyRuleQuery = z6.object({ expectedRevision: Revision }).strict();
1140
+ var UpdatePolicySettingsRequest = z6.object({ expectedRevision: Revision, modelClassifications: classifications }).strict();
1141
+ var PolicyTestRequest = z6.object({
1142
+ sessionId: Id4,
901
1143
  phase: PolicyPhase,
902
1144
  tool: toolInput.nullable(),
903
1145
  request: PolicyRequestContext.nullable()
904
1146
  }).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
905
1147
 
1148
+ // packages/protocol/dist/tool-view.js
1149
+ import { z as z7 } from "zod";
1150
+ var TOOL_KINDS = ["read", "edit", "write", "command", "search", "other"];
1151
+ var ToolViewData = z7.object({
1152
+ kind: z7.enum(TOOL_KINDS).optional(),
1153
+ /** Finished: "Asked", "Updated todo". */
1154
+ verb: z7.string().min(1).max(40).optional(),
1155
+ /** Running: "Asking". Defaults to `verb`. */
1156
+ activeVerb: z7.string().min(1).max(40).optional(),
1157
+ /** What the call acted on, shown in mono. */
1158
+ target: z7.string().max(500).optional(),
1159
+ /** Short facts after the target ("3 items", "exit 1"). */
1160
+ meta: z7.array(z7.string().min(1).max(80)).max(6).optional(),
1161
+ /** Lines added and removed. */
1162
+ stat: z7.object({ added: z7.number().int().min(0), removed: z7.number().int().min(0) }).optional(),
1163
+ /** Shown when the row is opened, in place of the typed detail. No forms or confirms. */
1164
+ detail: UINodeSchema.optional(),
1165
+ /** Do not draw the row: a dock question or a tracker already stands for this call. */
1166
+ hide: z7.boolean().optional()
1167
+ });
1168
+
906
1169
  // 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"]);
1170
+ var Iso2 = z8.string();
1171
+ var Id5 = z8.string();
1172
+ var Connectivity = z8.enum(["connected", "reconnecting", "unreachable"]);
1173
+ var ControlMode = z8.enum(["automation", "human"]);
1174
+ var Platform = z8.enum(["darwin", "linux"]);
1175
+ var DeviceKind = z8.enum(["browser", "pwa", "terminal", "cli"]);
1176
+ var DiagnosticLevel = z8.enum(["info", "warning", "error"]);
914
1177
  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()
1178
+ var CoreCapabilities = z8.object({
1179
+ prompt: z8.boolean(),
1180
+ steer: z8.boolean(),
1181
+ followUp: z8.boolean(),
1182
+ abort: z8.boolean(),
1183
+ resume: z8.boolean(),
1184
+ rename: z8.boolean(),
1185
+ importInactive: z8.boolean(),
1186
+ extensionDialogs: z8.boolean(),
1187
+ customUi: z8.boolean(),
1188
+ widgetsText: z8.boolean(),
1189
+ widgetsComponent: z8.boolean(),
1190
+ tokenAccounting: z8.boolean(),
1191
+ costAccounting: z8.boolean()
929
1192
  });
930
1193
  var CAPABILITY_KEYS = CoreCapabilities.keyof().options;
931
1194
  var RuntimeCapabilities = CoreCapabilities.extend({
932
1195
  /** The host runs sessions as interactive Pi in a terminal that clients can attach to. */
933
- terminal: z6.boolean().optional(),
1196
+ terminal: z8.boolean().optional(),
934
1197
  /** The host answers session.models, session.commands, session.setModel, session.setThinking and session.compact. */
935
- sessionControls: z6.boolean().optional(),
1198
+ sessionControls: z8.boolean().optional(),
936
1199
  /** 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(),
1200
+ treeNavigation: z8.boolean().optional(),
1201
+ agentRequests: z8.boolean().optional(),
1202
+ messageDelivery: z8.boolean().optional(),
1203
+ policies: z8.boolean().optional(),
941
1204
  /** Session-scoped adapter inspection and safe reload. */
942
- adapterDevelopment: z6.boolean().optional(),
943
- unsupported: z6.array(z6.object({ capability: z6.string(), reason: z6.string() }))
944
- });
945
- var ProjectScan = z6.object({
946
- state: z6.enum(["running", "done", "failed"]),
947
- startedAt: Iso,
948
- finishedAt: Iso.nullable(),
1205
+ adapterDevelopment: z8.boolean().optional(),
1206
+ /** The host answers session.clearQueue (Edit queue). */
1207
+ queueEdit: z8.boolean().optional(),
1208
+ unsupported: z8.array(z8.object({ capability: z8.string(), reason: z8.string() }))
1209
+ });
1210
+ var ProjectScan = z8.object({
1211
+ state: z8.enum(["running", "done", "failed"]),
1212
+ startedAt: Iso2,
1213
+ finishedAt: Iso2.nullable(),
949
1214
  /** Repositories found across all folders. */
950
- repositories: z6.number().int(),
1215
+ repositories: z8.number().int(),
951
1216
  /** New projects created by this scan. */
952
- projectsCreated: z6.number().int(),
1217
+ projectsCreated: z8.number().int(),
953
1218
  /** New checkouts (including the ones of new projects). */
954
- checkoutsAdded: z6.number().int(),
1219
+ checkoutsAdded: z8.number().int(),
955
1220
  /** "<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(),
1221
+ errors: z8.array(z8.string())
1222
+ });
1223
+ var UsageWindow = z8.object({
1224
+ id: z8.enum(["five_hour", "weekly"]),
1225
+ usedPct: z8.number(),
1226
+ resetsAt: Iso2.nullable()
1227
+ });
1228
+ var ProviderUsage = z8.object({
1229
+ provider: z8.enum(["anthropic", "openai-codex"]),
1230
+ status: z8.enum(["available", "expired", "rejected", "error"]),
1231
+ message: z8.string().nullable(),
1232
+ windows: z8.array(UsageWindow),
1233
+ fetchedAt: Iso2
1234
+ });
1235
+ var Host = z8.object({
1236
+ id: Id5,
1237
+ name: z8.string(),
973
1238
  platform: Platform,
974
- agentVersion: z6.string(),
975
- piVersion: z6.string().nullable(),
976
- piCompatible: z6.boolean(),
1239
+ agentVersion: z8.string(),
1240
+ piVersion: z8.string().nullable(),
1241
+ piCompatible: z8.boolean(),
977
1242
  capabilities: RuntimeCapabilities.nullable(),
978
1243
  connectivity: Connectivity,
979
- lastSeenAt: Iso.nullable(),
980
- revokedAt: Iso.nullable(),
981
- createdAt: Iso,
1244
+ lastSeenAt: Iso2.nullable(),
1245
+ revokedAt: Iso2.nullable(),
1246
+ createdAt: Iso2,
982
1247
  /** Folders on the host whose git repositories become projects (absolute or ~/...). */
983
- projectFolders: z6.array(z6.string()).optional(),
1248
+ projectFolders: z8.array(z8.string()).optional(),
984
1249
  projectScan: ProjectScan.nullable().optional(),
985
1250
  /** Subscription limits (host-reported, refreshed every few minutes). */
986
- usage: z6.array(ProviderUsage).optional(),
1251
+ usage: z8.array(ProviderUsage).optional(),
987
1252
  github: HostGitHub.optional()
988
1253
  });
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"]),
1254
+ var WorktreeDir = z8.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");
1255
+ var Project = z8.object({
1256
+ id: Id5,
1257
+ name: z8.string().min(1),
1258
+ repoIdentity: z8.string(),
1259
+ defaultProfileId: Id5.nullable(),
1260
+ defaultHostId: Id5.nullable(),
1261
+ maxConcurrentRuns: z8.number().int().min(1).max(32),
1262
+ automationEnabled: z8.boolean(),
1263
+ setupCommand: z8.string().nullable(),
1264
+ checks: z8.array(z8.string()),
1265
+ workspaceSharing: z8.enum(["single_writer", "shared"]),
1001
1266
  worktreeDir: WorktreeDir.default(DEFAULT_WORKTREE_DIR),
1002
1267
  /** Start one session in every non-main worktree the first time it appears without one. */
1003
- ensureSessions: z6.boolean().default(false),
1268
+ ensureSessions: z8.boolean().default(false),
1004
1269
  /** 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
1270
+ removeLanded: z8.boolean().default(false),
1271
+ createdAt: Iso2,
1272
+ updatedAt: Iso2
1008
1273
  });
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(),
1274
+ var Checkout = z8.object({
1275
+ id: Id5,
1276
+ projectId: Id5,
1277
+ hostId: Id5,
1278
+ path: z8.string(),
1279
+ commonDir: z8.string(),
1280
+ defaultBranch: z8.string(),
1281
+ createdAt: Iso2
1282
+ });
1283
+ var GitState = z8.object({
1284
+ dirty: z8.boolean(),
1285
+ changedFiles: z8.number().int(),
1286
+ ahead: z8.number().int(),
1287
+ behind: z8.number().int(),
1288
+ unmerged: z8.boolean(),
1024
1289
  /** 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"]),
1290
+ head: z8.string().regex(/^[0-9a-f]{40}$/).optional()
1291
+ });
1292
+ var Workspace = z8.object({
1293
+ id: Id5,
1294
+ checkoutId: Id5,
1295
+ projectId: Id5,
1296
+ hostId: Id5,
1297
+ path: z8.string(),
1298
+ branch: z8.string().nullable(),
1299
+ baseBranch: z8.string().nullable(),
1300
+ provenance: z8.enum(["managed", "discovered", "main"]),
1036
1301
  git: GitState,
1037
- setup: z6.object({
1038
- state: z6.enum(["none", "running", "succeeded", "failed"]),
1039
- log: z6.string()
1302
+ setup: z8.object({
1303
+ state: z8.enum(["none", "running", "succeeded", "failed"]),
1304
+ log: z8.string()
1040
1305
  }),
1041
- archivedAt: Iso.nullable(),
1042
- updatedAt: Iso,
1306
+ archivedAt: Iso2.nullable(),
1307
+ updatedAt: Iso2,
1043
1308
  github: WorkspaceGitHub.optional()
1044
1309
  });
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(),
1310
+ var ThinkingLevel = z8.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
1311
+ var SessionModel = z8.object({
1312
+ provider: z8.string(),
1313
+ id: z8.string(),
1314
+ name: z8.string().nullable(),
1315
+ contextWindow: z8.number().nullable(),
1316
+ reasoning: z8.boolean(),
1052
1317
  /** In Pi's scoped (favorite) model list; set only when Pi has one. */
1053
- scoped: z6.boolean().optional(),
1318
+ scoped: z8.boolean().optional(),
1054
1319
  /** Effort levels this model accepts, in Pi's order; ["off"] without reasoning. */
1055
- thinkingLevels: z6.array(ThinkingLevel),
1320
+ thinkingLevels: z8.array(ThinkingLevel),
1056
1321
  /** Prompt-cache lifetimes in seconds from Pi's model metadata. */
1057
- promptCache: z6.object({ short: z6.number().optional(), long: z6.number().optional() }).nullable().optional()
1322
+ promptCache: z8.object({ short: z8.number().optional(), long: z8.number().optional() }).nullable().optional()
1058
1323
  });
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()
1324
+ var SlashCommand = z8.object({
1325
+ name: z8.string().min(1),
1326
+ description: z8.string().nullable(),
1327
+ source: z8.enum(["extension", "prompt", "skill"]),
1328
+ argumentHint: z8.string().nullable().optional()
1064
1329
  });
1065
- var ContextUsage = z6.object({
1330
+ var ContextUsage = z8.object({
1066
1331
  /** 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()
1332
+ tokens: z8.number().nullable(),
1333
+ window: z8.number(),
1334
+ percent: z8.number().nullable()
1070
1335
  });
1071
1336
  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(),
1337
+ var ExtraArg = z8.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");
1338
+ var Profile = z8.object({
1339
+ id: Id5,
1340
+ name: z8.string().min(1),
1341
+ provider: z8.string().nullable(),
1342
+ model: z8.string().nullable(),
1078
1343
  thinking: ThinkingLevel.nullable(),
1079
- projectTrust: z6.enum(["ask", "approve", "ignore"]),
1080
- extraArgs: z6.array(ExtraArg),
1344
+ projectTrust: z8.enum(["ask", "approve", "ignore"]),
1345
+ extraArgs: z8.array(ExtraArg),
1081
1346
  /** "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
1347
+ resources: z8.enum(["all", "vanilla"]).optional()
1348
+ });
1349
+ var Scope = z8.object({
1350
+ id: Id5,
1351
+ name: z8.string().min(1).max(60),
1352
+ mode: z8.enum(["all", "pinned"]),
1353
+ projectIds: z8.array(z8.string()).nullable(),
1354
+ hostIds: z8.array(z8.string()).nullable(),
1355
+ sessionIds: z8.array(z8.string()),
1356
+ /** What feeds this scope its issues; null for a scope of projects you choose. */
1357
+ source: GitHubSource.nullable(),
1358
+ createdAt: Iso2,
1359
+ updatedAt: Iso2
1105
1360
  });
1106
- var TerminalKind = z6.enum(["herdr", "tmux"]);
1107
- var TerminalMirror = z6.enum(["none", "all", "view"]);
1108
- var Terminal = z6.object({
1361
+ var ClientKind = z8.string().regex(/^[a-z][a-z0-9-]{0,31}$/);
1362
+ var ClientMirror = z8.enum(["none", "all", "scope"]);
1363
+ var Client = z8.object({
1109
1364
  /** `${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(),
1365
+ id: z8.string().min(1).max(200),
1366
+ kind: ClientKind,
1367
+ name: z8.string().min(1),
1368
+ machine: z8.string().min(1),
1369
+ deviceId: Id5,
1370
+ hostId: Id5.nullable(),
1371
+ /** What it mirrors (coordinator-owned). */
1372
+ mirror: ClientMirror,
1373
+ /** The scope it mirrors when `mirror` is "scope" (coordinator-owned). */
1374
+ scopeId: Id5.nullable(),
1120
1375
  /** When the binding was recorded; null when it never was (a daemon may seed it once). */
1121
- bindingSetAt: Iso.nullable().optional(),
1376
+ bindingSetAt: Iso2.nullable().optional(),
1122
1377
  /** 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
1378
+ shows: z8.array(Id5).max(1e3).optional(),
1379
+ lastSeenAt: Iso2,
1380
+ createdAt: Iso2
1126
1381
  });
1127
- var RuntimeState = z6.enum([
1382
+ var RuntimeState = z8.enum([
1128
1383
  "starting",
1129
1384
  "idle",
1130
1385
  "running",
@@ -1133,160 +1388,161 @@ var RuntimeState = z6.enum([
1133
1388
  "failed",
1134
1389
  "stopped"
1135
1390
  ]);
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(),
1391
+ var NativeHandle = z8.object({ sessionId: z8.string(), sessionFile: z8.string() });
1392
+ var SessionStats = z8.object({
1393
+ tokens: z8.number().nullable(),
1394
+ costUsd: z8.number().nullable(),
1140
1395
  /** Completed usage, refreshed for this exact settlement; absent on older hosts or failure. */
1141
1396
  watermark: CompletedUsageWatermark.optional(),
1142
1397
  context: ContextUsage.nullable().optional()
1143
1398
  });
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(),
1399
+ var PromptCacheInfo = z8.object({
1400
+ at: Iso2,
1401
+ provider: z8.string(),
1402
+ model: z8.string(),
1403
+ cacheRead: z8.number(),
1404
+ cacheWrite: z8.number(),
1405
+ cacheWrite1h: z8.number()
1406
+ });
1407
+ var Session = z8.object({
1408
+ id: Id5,
1409
+ title: z8.string(),
1410
+ subtitle: z8.string().nullable(),
1411
+ hostId: Id5,
1412
+ workspaceId: Id5.nullable(),
1413
+ projectId: Id5.nullable(),
1414
+ cwd: z8.string(),
1160
1415
  nativeHandle: NativeHandle.nullable(),
1161
1416
  profileSnapshot: Profile,
1162
1417
  runtime: RuntimeState,
1163
- runtimeDetail: z6.string().nullable(),
1418
+ runtimeDetail: z8.string().nullable(),
1164
1419
  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()) }),
1420
+ runId: Id5.nullable(),
1421
+ taskId: Id5.nullable(),
1422
+ provenance: z8.enum(["created", "imported", "subagent"]),
1423
+ readOnly: z8.boolean(),
1424
+ lastActivityAt: Iso2,
1425
+ archivedAt: Iso2.nullable(),
1426
+ queue: z8.object({ steering: z8.array(z8.string()), followUp: z8.array(z8.string()) }),
1172
1427
  stats: SessionStats.nullable(),
1173
1428
  /** The live model (host-owned; last known when stopped). */
1174
1429
  model: SessionModel.nullable().optional(),
1175
1430
  /** The live effort (Pi's thinking level). */
1176
1431
  thinking: ThinkingLevel.nullable().optional(),
1177
1432
  /** Pi is compacting the context. */
1178
- compacting: z6.boolean().optional(),
1179
- lastAssistantText: z6.string().nullable(),
1180
- createdAt: Iso,
1433
+ compacting: z8.boolean().optional(),
1434
+ lastAssistantText: z8.string().nullable(),
1435
+ createdAt: Iso2,
1181
1436
  /** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
1182
- terminal: z6.boolean().optional(),
1437
+ terminal: z8.boolean().optional(),
1183
1438
  /**
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.
1439
+ * A Pi the user started in their own terminal and enrolled (`client`: the id of the herdr or
1440
+ * tmux client it runs in, when known). Switchyard never shows or closes that terminal.
1186
1441
  */
1187
- external: z6.object({ client: z6.string().min(1).max(200).nullable() }).nullable().optional(),
1442
+ external: z8.object({ client: z8.string().min(1).max(200).nullable() }).nullable().optional(),
1188
1443
  /**
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.
1444
+ * Where this Pi last ran by hand (host-owned): the client (`herdr:<s>@<m>`, `tmux:<s>@<m>`;
1445
+ * the wire field keeps the name `terminalId`) and pane. Kept after it stops; cleared once
1446
+ * Switchyard starts it. Older hosts omit it.
1191
1447
  */
1192
- place: z6.object({
1193
- terminalId: z6.string().min(1).max(200),
1194
- pane: z6.string().min(1).max(200).nullable()
1448
+ place: z8.object({
1449
+ terminalId: z8.string().min(1).max(200),
1450
+ pane: z8.string().min(1).max(200).nullable()
1195
1451
  }).nullable().optional(),
1196
1452
  /** The session this subagent was started by (coordinator-owned). */
1197
- parentSessionId: Id4.nullable().optional(),
1453
+ parentSessionId: Id5.nullable().optional(),
1198
1454
  /** Chosen as its branch's primary session (coordinator-owned); without one the primary is derived. */
1199
- primary: z6.boolean().optional(),
1455
+ primary: z8.boolean().optional(),
1200
1456
  /** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
1201
- unreadSince: Iso.nullable().optional(),
1457
+ unreadSince: Iso2.nullable().optional(),
1202
1458
  /** Identity of the adapter presentation currently installed on the host. */
1203
- adapterGeneration: z6.string().uuid().optional(),
1459
+ adapterGeneration: z8.string().uuid().optional(),
1204
1460
  /** 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,
1461
+ transcriptEpoch: z8.number().int().min(0).optional(),
1462
+ bridge: z8.object({
1463
+ version: z8.literal(1),
1464
+ runtimeId: Id5,
1465
+ nativeSessionId: Id5,
1210
1466
  /** 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)
1467
+ controllerEpoch: Id5.optional(),
1468
+ agentTools: z8.boolean(),
1469
+ messageDelivery: z8.boolean(),
1470
+ policyState: z8.enum(["initializing", "active", "unsupported", "lost"]),
1471
+ policyPhases: z8.array(PolicyPhase)
1216
1472
  }).optional(),
1217
1473
  /** Last assistant message's cache usage (host-owned). */
1218
1474
  promptCache: PromptCacheInfo.nullable().optional(),
1219
1475
  /** 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()
1221
- });
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()
1476
+ cacheAlert: z8.object({ ttlSec: z8.number().int().min(60).max(86400).nullable(), warnedFor: Iso2.nullable() }).nullable().optional()
1477
+ });
1478
+ var ContinuationPolicy = z8.discriminatedUnion("enabled", [
1479
+ z8.object({ enabled: z8.literal(false) }),
1480
+ z8.object({
1481
+ enabled: z8.literal(true),
1482
+ objective: z8.string().min(1),
1483
+ maxContinuations: z8.number().int().min(1).max(50),
1484
+ maxElapsedMinutes: z8.number().int().min(1).max(1440),
1485
+ maxTokens: z8.number().int().positive().nullable(),
1486
+ maxCostUsd: z8.number().positive().nullable()
1231
1487
  })
1232
1488
  ]);
1233
- var CompletionPolicy = z6.object({
1234
- checks: z6.array(z6.string()).nullable(),
1235
- requireHumanReview: z6.boolean()
1236
- });
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()
1489
+ var CompletionPolicy = z8.object({
1490
+ checks: z8.array(z8.string()).nullable(),
1491
+ requireHumanReview: z8.boolean()
1492
+ });
1493
+ var WorkspacePolicy = z8.discriminatedUnion("mode", [
1494
+ z8.object({
1495
+ mode: z8.literal("new_worktree"),
1496
+ branch: z8.string().nullable(),
1497
+ base: z8.string().nullable()
1242
1498
  }),
1243
- z6.object({ mode: z6.literal("existing"), workspaceId: Id4 })
1499
+ z8.object({ mode: z8.literal("existing"), workspaceId: Id5 })
1244
1500
  ]);
1245
- var TaskPolicy = z6.object({
1246
- hostId: Id4.nullable(),
1247
- profileId: Id4.nullable(),
1501
+ var TaskPolicy = z8.object({
1502
+ hostId: Id5.nullable(),
1503
+ profileId: Id5.nullable(),
1248
1504
  workspace: WorkspacePolicy,
1249
1505
  continuation: ContinuationPolicy,
1250
1506
  completion: CompletionPolicy
1251
1507
  });
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()
1508
+ var TaskState = z8.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
1509
+ var Priority = z8.union([z8.literal(0), z8.literal(1), z8.literal(2), z8.literal(3)]);
1510
+ var TaskOrigin = z8.discriminatedUnion("kind", [
1511
+ z8.object({ kind: z8.literal("manual") }),
1512
+ z8.object({
1513
+ kind: z8.literal("automation"),
1514
+ automationId: Id5,
1515
+ occurrenceId: Id5,
1516
+ routine: z8.boolean()
1261
1517
  })
1262
1518
  ]);
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),
1519
+ var Task = z8.object({
1520
+ id: Id5,
1521
+ projectId: Id5,
1522
+ title: z8.string().min(1),
1523
+ objective: z8.string(),
1524
+ acceptanceCriteria: z8.array(z8.string()),
1525
+ dependencies: z8.array(Id5),
1270
1526
  priority: Priority,
1271
- position: z6.number(),
1527
+ position: z8.number(),
1272
1528
  state: TaskState,
1273
- blocked: z6.object({ reason: z6.string() }).nullable(),
1274
- notBefore: Iso.nullable(),
1529
+ blocked: z8.object({ reason: z8.string() }).nullable(),
1530
+ notBefore: Iso2.nullable(),
1275
1531
  policy: TaskPolicy,
1276
1532
  origin: TaskOrigin,
1277
- groupingKey: z6.string().nullable(),
1278
- parentTaskId: Id4.nullable().optional(),
1279
- agentOrigin: z6.object({ sessionId: Id4, toolCallId: Id4 }).optional(),
1533
+ groupingKey: z8.string().nullable(),
1534
+ parentTaskId: Id5.nullable().optional(),
1535
+ agentOrigin: z8.object({ sessionId: Id5, toolCallId: Id5 }).optional(),
1280
1536
  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
1537
+ currentRunId: Id5.nullable(),
1538
+ sessionId: Id5.nullable(),
1539
+ review: z8.object({ feedback: z8.array(z8.string()), changesRequested: z8.boolean() }),
1540
+ hiddenFromBoard: z8.boolean(),
1541
+ lastActivityAt: Iso2,
1542
+ createdAt: Iso2,
1543
+ updatedAt: Iso2
1288
1544
  });
1289
- var RunState = z6.enum([
1545
+ var RunState = z8.enum([
1290
1546
  "queued",
1291
1547
  "dispatching",
1292
1548
  "uncertain",
@@ -1298,79 +1554,79 @@ var RunState = z6.enum([
1298
1554
  "interrupted",
1299
1555
  "canceled"
1300
1556
  ]);
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),
1557
+ var CheckResult = z8.object({
1558
+ command: z8.string(),
1559
+ exitCode: z8.number().int().nullable(),
1560
+ outputTail: z8.string()
1561
+ });
1562
+ var Run = z8.object({
1563
+ id: Id5,
1564
+ taskId: Id5,
1565
+ sessionId: Id5.nullable(),
1566
+ hostId: Id5.nullable(),
1567
+ dispatchKey: z8.string(),
1568
+ attempt: z8.number().int().min(1),
1313
1569
  state: RunState,
1314
1570
  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()
1571
+ controlRevision: z8.number().int().min(1),
1572
+ continuationsUsed: z8.number().int().min(0),
1573
+ infraRetries: z8.number().int().min(0),
1574
+ nextAttemptAt: Iso2.nullable(),
1575
+ startedAt: Iso2.nullable(),
1576
+ endedAt: Iso2.nullable(),
1577
+ outcome: z8.object({
1578
+ kind: z8.enum(["review", "failed", "blocked", "no_change", "canceled"]),
1579
+ summary: z8.string()
1324
1580
  }).nullable(),
1325
1581
  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()
1582
+ usage: z8.object({
1583
+ tokens: z8.number().nullable(),
1584
+ costUsd: z8.number().nullable(),
1585
+ accounting: z8.enum(["available", "unavailable"]),
1586
+ note: z8.string().nullable()
1331
1587
  }),
1332
- checks: z6.array(CheckResult),
1333
- createdAt: Iso,
1334
- updatedAt: Iso
1588
+ checks: z8.array(CheckResult),
1589
+ createdAt: Iso2,
1590
+ updatedAt: Iso2
1335
1591
  });
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 })
1592
+ var Trigger = z8.discriminatedUnion("kind", [
1593
+ z8.object({ kind: z8.literal("manual") }),
1594
+ z8.object({ kind: z8.literal("once"), at: Iso2 }),
1595
+ z8.object({ kind: z8.literal("cron"), expr: z8.string().min(1), timezone: z8.string().min(1) }),
1596
+ z8.object({ kind: z8.literal("webhook") }),
1597
+ z8.object({ kind: z8.literal("dependency"), taskId: Id5 })
1342
1598
  ]);
1343
- var TaskTemplate = z6.object({
1344
- title: z6.string().min(1),
1345
- objective: z6.string(),
1346
- acceptanceCriteria: z6.array(z6.string()),
1599
+ var TaskTemplate = z8.object({
1600
+ title: z8.string().min(1),
1601
+ objective: z8.string(),
1602
+ acceptanceCriteria: z8.array(z8.string()),
1347
1603
  priority: Priority
1348
1604
  });
1349
- var Automation = z6.object({
1350
- id: Id4,
1351
- name: z6.string().min(1),
1352
- enabled: z6.boolean(),
1353
- projectId: Id4,
1605
+ var Automation = z8.object({
1606
+ id: Id5,
1607
+ name: z8.string().min(1),
1608
+ enabled: z8.boolean(),
1609
+ projectId: Id5,
1354
1610
  trigger: Trigger,
1355
- filters: z6.array(z6.object({ path: z6.string(), equals: z6.string() })),
1611
+ filters: z8.array(z8.object({ path: z8.string(), equals: z8.string() })),
1356
1612
  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"]),
1613
+ hostId: Id5.nullable(),
1614
+ profileId: Id5.nullable(),
1615
+ mode: z8.enum(["fresh", "continue", "watch"]),
1616
+ groupingKey: z8.string().nullable(),
1617
+ overlap: z8.enum(["skip", "queue_one", "append"]),
1618
+ missed: z8.enum(["skip", "run_once"]),
1363
1619
  continuation: ContinuationPolicy,
1364
1620
  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
1621
+ nextAt: Iso2.nullable(),
1622
+ lastEvaluatedAt: Iso2.nullable(),
1623
+ lastOutcome: z8.string().nullable(),
1624
+ failureCount: z8.number().int().min(0),
1625
+ webhookTokenSet: z8.boolean(),
1626
+ createdAt: Iso2,
1627
+ updatedAt: Iso2
1372
1628
  });
1373
- var OccurrenceState = z6.enum([
1629
+ var OccurrenceState = z8.enum([
1374
1630
  "fired",
1375
1631
  "skipped_overlap",
1376
1632
  "skipped_missed",
@@ -1379,39 +1635,47 @@ var OccurrenceState = z6.enum([
1379
1635
  "failed",
1380
1636
  "filtered"
1381
1637
  ]);
1382
- var Occurrence = z6.object({
1383
- id: Id4,
1384
- automationId: Id4,
1385
- key: z6.string(),
1386
- scheduledFor: Iso.nullable(),
1638
+ var Occurrence = z8.object({
1639
+ id: Id5,
1640
+ automationId: Id5,
1641
+ key: z8.string(),
1642
+ scheduledFor: Iso2.nullable(),
1387
1643
  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())
1644
+ taskId: Id5.nullable(),
1645
+ reason: z8.string().nullable(),
1646
+ outcome: z8.string().nullable(),
1647
+ createdAt: Iso2
1648
+ });
1649
+ var InteractionState = z8.preprocess((v) => v === "cancelled" ? "canceled" : v, z8.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
1650
+ var InteractionKind = z8.enum(["question", "approval", "plan"]);
1651
+ var Interaction = z8.object({
1652
+ id: Id5,
1653
+ sessionId: Id5,
1654
+ revision: z8.number().int().min(1),
1655
+ source: z8.discriminatedUnion("kind", [
1656
+ z8.object({
1657
+ kind: z8.literal("extension_ui"),
1658
+ method: z8.enum(["select", "confirm", "input", "editor"]),
1659
+ piRequestIds: z8.array(z8.string())
1403
1660
  }),
1404
- z6.object({ kind: z6.literal("unsupported_custom"), title: z6.string().nullable() })
1661
+ z8.object({ kind: z8.literal("unsupported_custom"), title: z8.string().nullable() })
1405
1662
  ]),
1406
- adapterId: z6.string().nullable(),
1663
+ adapterId: z8.string().nullable(),
1407
1664
  permission: PolicyPermission.optional(),
1408
- title: z6.string(),
1665
+ /**
1666
+ * What the dialog is, when its adapter or the host says so: a question to answer, an approval
1667
+ * of something Pi wants to do, or a plan to accept. Absent for a dialog nobody described.
1668
+ */
1669
+ kind: InteractionKind.optional(),
1670
+ /** The tool call that opened the dialog, when the host knows it. */
1671
+ toolCallId: z8.string().optional(),
1672
+ title: z8.string(),
1409
1673
  presentation: UINodeSchema,
1410
1674
  state: InteractionState,
1411
- resolution: z6.object({ by: z6.string(), summary: z6.string(), at: Iso }).nullable(),
1412
- createdAt: Iso
1675
+ resolution: z8.object({ by: z8.string(), summary: z8.string(), at: Iso2 }).nullable(),
1676
+ createdAt: Iso2
1413
1677
  });
1414
- var AttentionReason = z6.enum([
1678
+ var AttentionReason = z8.enum([
1415
1679
  "needs_input",
1416
1680
  "failed",
1417
1681
  "ready_for_review",
@@ -1419,171 +1683,173 @@ var AttentionReason = z6.enum([
1419
1683
  "host_unreachable",
1420
1684
  "cache_expiring"
1421
1685
  ]);
1422
- var AttentionItem = z6.object({
1423
- id: Id4,
1424
- sessionId: Id4.nullable(),
1425
- taskId: Id4.nullable(),
1426
- projectId: Id4.nullable(),
1686
+ var AttentionItem = z8.object({
1687
+ id: Id5,
1688
+ sessionId: Id5.nullable(),
1689
+ taskId: Id5.nullable(),
1690
+ projectId: Id5.nullable(),
1427
1691
  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(),
1692
+ severity: z8.enum(["info", "warning", "critical"]),
1693
+ summary: z8.string(),
1694
+ interactionId: Id5.nullable(),
1695
+ deepLink: z8.string(),
1696
+ acknowledgedAt: Iso2.nullable(),
1697
+ resolvedAt: Iso2.nullable(),
1698
+ createdAt: Iso2
1699
+ });
1700
+ var Device = z8.object({
1701
+ id: Id5,
1702
+ name: z8.string(),
1439
1703
  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"])
1704
+ createdAt: Iso2,
1705
+ lastSeenAt: Iso2.nullable(),
1706
+ revokedAt: Iso2.nullable(),
1707
+ push: z8.object({
1708
+ subscribed: z8.boolean(),
1709
+ permission: z8.enum(["granted", "denied", "default", "unknown"])
1446
1710
  }),
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(),
1711
+ preferredMobile: z8.boolean(),
1712
+ enrolledVia: z8.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
1713
+ });
1714
+ var ToolItemData = z8.object({
1715
+ toolCallId: z8.string(),
1716
+ name: z8.string(),
1717
+ status: z8.enum(["running", "ok", "error"]),
1718
+ args: z8.unknown(),
1719
+ summary: z8.string(),
1720
+ output: z8.string(),
1721
+ startedAt: Iso2,
1722
+ durationMs: z8.number().nullable(),
1459
1723
  card: UINodeSchema.nullable(),
1460
- adapterId: z6.string().nullable(),
1461
- adapterGeneration: z6.string().uuid().optional()
1462
- });
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(),
1724
+ adapterId: z8.string().nullable(),
1725
+ adapterGeneration: z8.string().uuid().optional(),
1726
+ /** `tool.views.v1`: what the host and an adapter say about the call (see tool-view.ts). */
1727
+ view: ToolViewData.optional()
1728
+ });
1729
+ var TranscriptItem = z8.discriminatedUnion("kind", [
1730
+ z8.object({
1731
+ id: Id5,
1732
+ sessionId: Id5,
1733
+ order: z8.number().int(),
1734
+ at: Iso2,
1735
+ kind: z8.literal("user"),
1736
+ data: z8.object({
1737
+ text: z8.string(),
1738
+ images: z8.number().int().optional(),
1473
1739
  /** Pi session entry id, for rewind and fork from this message. */
1474
- entryId: z6.string().optional()
1740
+ entryId: z8.string().optional()
1475
1741
  })
1476
1742
  }),
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() })
1743
+ z8.object({
1744
+ id: Id5,
1745
+ sessionId: Id5,
1746
+ order: z8.number().int(),
1747
+ at: Iso2,
1748
+ kind: z8.literal("assistant"),
1749
+ data: z8.object({ text: z8.string(), streaming: z8.boolean().optional() })
1484
1750
  }),
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() })
1751
+ z8.object({
1752
+ id: Id5,
1753
+ sessionId: Id5,
1754
+ order: z8.number().int(),
1755
+ at: Iso2,
1756
+ kind: z8.literal("thinking"),
1757
+ data: z8.object({ text: z8.string() })
1492
1758
  }),
1493
- z6.object({
1494
- id: Id4,
1495
- sessionId: Id4,
1496
- order: z6.number().int(),
1497
- at: Iso,
1498
- kind: z6.literal("tool"),
1759
+ z8.object({
1760
+ id: Id5,
1761
+ sessionId: Id5,
1762
+ order: z8.number().int(),
1763
+ at: Iso2,
1764
+ kind: z8.literal("tool"),
1499
1765
  data: ToolItemData
1500
1766
  }),
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({
1767
+ z8.object({
1768
+ id: Id5,
1769
+ sessionId: Id5,
1770
+ order: z8.number().int(),
1771
+ at: Iso2,
1772
+ kind: z8.literal("notice"),
1773
+ data: z8.object({
1508
1774
  level: DiagnosticLevel,
1509
- text: z6.string(),
1510
- customType: z6.string().min(1).max(200).optional(),
1775
+ text: z8.string(),
1776
+ customType: z8.string().min(1).max(200).optional(),
1511
1777
  card: UINodeSchema.optional(),
1512
- adapterId: z6.string().optional(),
1513
- adapterGeneration: z6.string().uuid().optional()
1778
+ adapterId: z8.string().optional(),
1779
+ adapterGeneration: z8.string().uuid().optional()
1514
1780
  }).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
1515
1781
  }),
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 })
1782
+ z8.object({
1783
+ id: Id5,
1784
+ sessionId: Id5,
1785
+ order: z8.number().int(),
1786
+ at: Iso2,
1787
+ kind: z8.literal("interaction"),
1788
+ data: z8.object({ interactionId: Id5 })
1523
1789
  }),
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()
1790
+ z8.object({
1791
+ id: Id5,
1792
+ sessionId: Id5,
1793
+ order: z8.number().int(),
1794
+ at: Iso2,
1795
+ kind: z8.literal("subagent"),
1796
+ data: z8.object({
1797
+ runId: z8.string(),
1798
+ label: z8.string(),
1799
+ status: z8.string(),
1800
+ sessionFile: z8.string().nullable(),
1801
+ linkedSessionId: Id5.nullable()
1536
1802
  })
1537
1803
  }),
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() })
1804
+ z8.object({
1805
+ id: Id5,
1806
+ sessionId: Id5,
1807
+ order: z8.number().int(),
1808
+ at: Iso2,
1809
+ kind: z8.literal("system"),
1810
+ data: z8.object({ text: z8.string(), suggestion: z8.boolean().optional() })
1545
1811
  })
1546
1812
  ]);
1547
- var Panel = z6.object({
1548
- sessionId: Id4,
1549
- adapterId: z6.string(),
1550
- slot: z6.string(),
1551
- title: z6.string(),
1813
+ var Panel = z8.object({
1814
+ sessionId: Id5,
1815
+ adapterId: z8.string(),
1816
+ slot: z8.string(),
1817
+ title: z8.string(),
1552
1818
  node: UINodeSchema.nullable(),
1553
- webRenderer: z6.boolean(),
1554
- mobileFallback: z6.string().nullable(),
1819
+ webRenderer: z8.boolean(),
1820
+ mobileFallback: z8.string().nullable(),
1555
1821
  contribution: ContributionDescriptor.optional(),
1556
- state: z6.unknown().optional(),
1557
- adapterGeneration: z6.string().uuid().optional(),
1558
- updatedAt: Iso
1822
+ state: z8.unknown().optional(),
1823
+ adapterGeneration: z8.string().uuid().optional(),
1824
+ updatedAt: Iso2
1559
1825
  });
1560
- var Diagnostic = z6.object({
1561
- sessionId: Id4.nullable(),
1562
- adapterId: z6.string().nullable(),
1826
+ var Diagnostic = z8.object({
1827
+ sessionId: Id5.nullable(),
1828
+ adapterId: z8.string().nullable(),
1563
1829
  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())
1830
+ message: z8.string(),
1831
+ at: Iso2
1832
+ });
1833
+ var AdapterInfo = z8.object({
1834
+ id: z8.string(),
1835
+ version: z8.string(),
1836
+ tier: z8.enum(["project", "owner", "plugin", "bundled"]),
1837
+ target: z8.object({
1838
+ extension: z8.string(),
1839
+ versionRange: z8.string(),
1840
+ testedVersions: z8.array(z8.string())
1575
1841
  }),
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())
1842
+ capabilities: z8.array(z8.string()),
1843
+ webRenderer: z8.boolean(),
1844
+ status: z8.enum(["active", "disabled", "error"]),
1845
+ detail: z8.string().nullable()
1846
+ });
1847
+ var Passkey = z8.object({
1848
+ id: z8.string(),
1849
+ name: z8.string(),
1850
+ createdAt: Iso2,
1851
+ lastUsedAt: Iso2.nullable(),
1852
+ transports: z8.array(z8.string())
1587
1853
  });
1588
1854
 
1589
1855
  // packages/protocol/dist/adapter-preview.js
@@ -1596,92 +1862,92 @@ function bounded(input, ctx) {
1596
1862
  return input;
1597
1863
  } catch (error) {
1598
1864
  ctx.addIssue({ code: "custom", message: error.message });
1599
- return z7.NEVER;
1865
+ return z9.NEVER;
1600
1866
  }
1601
1867
  }
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({
1868
+ var Id6 = z9.string().min(1).max(200);
1869
+ var Text2 = z9.string().max(64 * 1024);
1870
+ var Tool = { toolCallId: Id6, name: Id6, args: z9.unknown() };
1871
+ var DialogCommon = { id: Id6, title: Text2 };
1872
+ var AdapterPreviewPiUiRequestSchema = z9.discriminatedUnion("method", [
1873
+ z9.object({
1608
1874
  ...DialogCommon,
1609
- method: z7.literal("select"),
1610
- options: z7.array(Text2).max(200),
1611
- timeout: z7.number().nonnegative().optional()
1875
+ method: z9.literal("select"),
1876
+ options: z9.array(Text2).max(200),
1877
+ timeout: z9.number().nonnegative().optional()
1612
1878
  }).strict(),
1613
- z7.object({
1879
+ z9.object({
1614
1880
  ...DialogCommon,
1615
- method: z7.literal("confirm"),
1881
+ method: z9.literal("confirm"),
1616
1882
  message: Text2,
1617
- timeout: z7.number().nonnegative().optional()
1883
+ timeout: z9.number().nonnegative().optional()
1618
1884
  }).strict(),
1619
- z7.object({
1885
+ z9.object({
1620
1886
  ...DialogCommon,
1621
- method: z7.literal("input"),
1887
+ method: z9.literal("input"),
1622
1888
  placeholder: Text2.optional(),
1623
- timeout: z7.number().nonnegative().optional()
1889
+ timeout: z9.number().nonnegative().optional()
1624
1890
  }).strict(),
1625
- z7.object({ ...DialogCommon, method: z7.literal("editor"), prefill: Text2.optional() }).strict()
1891
+ z9.object({ ...DialogCommon, method: z9.literal("editor"), prefill: Text2.optional() }).strict()
1626
1892
  ]);
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()
1893
+ var AdapterPreviewStepSchema = z9.discriminatedUnion("kind", [
1894
+ z9.object({ kind: z9.literal("restore") }).strict(),
1895
+ z9.object({ kind: z9.literal("toolStart"), data: z9.object(Tool).strict() }).strict(),
1896
+ z9.object({
1897
+ kind: z9.literal("toolUpdate"),
1898
+ data: z9.object({ ...Tool, partialResult: z9.unknown(), details: z9.unknown().optional() }).strict()
1633
1899
  }).strict(),
1634
- z7.object({
1635
- kind: z7.literal("toolEnd"),
1636
- data: z7.object({
1900
+ z9.object({
1901
+ kind: z9.literal("toolEnd"),
1902
+ data: z9.object({
1637
1903
  ...Tool,
1638
- result: z7.unknown(),
1639
- isError: z7.boolean(),
1640
- details: z7.unknown().optional()
1904
+ result: z9.unknown(),
1905
+ isError: z9.boolean(),
1906
+ details: z9.unknown().optional()
1641
1907
  }).strict()
1642
1908
  }).strict(),
1643
- z7.object({
1644
- kind: z7.literal("status"),
1645
- data: z7.object({ key: Id5, text: Text2.optional() }).strict()
1909
+ z9.object({
1910
+ kind: z9.literal("status"),
1911
+ data: z9.object({ key: Id6, text: Text2.optional() }).strict()
1646
1912
  }).strict(),
1647
- z7.object({
1648
- kind: z7.literal("widget"),
1649
- data: z7.object({ key: Id5, lines: z7.array(Text2).max(200).optional() }).strict()
1913
+ z9.object({
1914
+ kind: z9.literal("widget"),
1915
+ data: z9.object({ key: Id6, lines: z9.array(Text2).max(200).optional() }).strict()
1650
1916
  }).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()
1917
+ z9.object({ kind: z9.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
1918
+ z9.object({
1919
+ kind: z9.literal("answer"),
1920
+ data: z9.object({ requestId: Id6, response: InteractionResponseSchema }).strict()
1655
1921
  }).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()
1922
+ z9.object({
1923
+ kind: z9.literal("customMessage"),
1924
+ data: z9.object({
1925
+ customType: Id6,
1926
+ content: z9.unknown(),
1927
+ display: z9.boolean().optional(),
1928
+ details: z9.unknown().optional()
1663
1929
  }).strict()
1664
1930
  }).strict(),
1665
- z7.object({
1666
- kind: z7.literal("action"),
1667
- data: z7.object({ actionId: Id5, payload: z7.unknown() }).strict()
1931
+ z9.object({
1932
+ kind: z9.literal("action"),
1933
+ data: z9.object({ actionId: Id6, payload: z9.unknown() }).strict()
1668
1934
  }).strict()
1669
1935
  ]);
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)
1936
+ var AdapterPreviewFixtureSchema = z9.unknown().transform(bounded).pipe(z9.object({
1937
+ version: z9.literal(1),
1938
+ name: z9.string().min(1).max(200),
1939
+ initialState: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())).optional(),
1940
+ steps: z9.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
1675
1941
  }).strict());
1676
- var PortableNode = z7.unknown().transform((input, ctx) => {
1942
+ var PortableNode = z9.unknown().transform((input, ctx) => {
1677
1943
  try {
1678
1944
  return validateUINode(input);
1679
1945
  } catch (error) {
1680
1946
  ctx.addIssue({ code: "custom", message: error.message });
1681
- return z7.NEVER;
1947
+ return z9.NEVER;
1682
1948
  }
1683
1949
  });
1684
- var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine((panel, ctx) => {
1950
+ var PreviewPanel = Panel.extend({ webRenderer: z9.literal(false) }).superRefine((panel, ctx) => {
1685
1951
  try {
1686
1952
  if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
1687
1953
  throw new Error("Preview panels must use the fake preview session");
@@ -1703,13 +1969,13 @@ var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine(
1703
1969
  ctx.addIssue({ code: "custom", message: error.message });
1704
1970
  }
1705
1971
  });
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([
1972
+ var AdapterPreviewSchema = z9.unknown().transform(bounded).pipe(z9.object({
1973
+ version: z9.literal(1),
1974
+ name: z9.string().min(1).max(200),
1975
+ adapter: z9.object({ id: Id6, version: Id6 }).strict(),
1976
+ steps: z9.array(z9.object({
1977
+ index: z9.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
1978
+ kind: z9.enum([
1713
1979
  "restore",
1714
1980
  "toolStart",
1715
1981
  "toolUpdate",
@@ -1721,24 +1987,24 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1721
1987
  "customMessage",
1722
1988
  "action"
1723
1989
  ]),
1724
- ok: z7.boolean(),
1725
- error: z7.string().max(4e3).nullable()
1990
+ ok: z9.boolean(),
1991
+ error: z9.string().max(4e3).nullable()
1726
1992
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1727
- panels: z7.array(PreviewPanel).max(256),
1728
- interactions: z7.array(z7.object({
1993
+ panels: z9.array(PreviewPanel).max(256),
1994
+ interactions: z9.array(z9.object({
1729
1995
  request: AdapterPreviewPiUiRequestSchema,
1730
1996
  presentation: PortableNode,
1731
- state: z7.enum(["pending", "resolved"])
1997
+ state: z9.enum(["pending", "resolved"])
1732
1998
  }).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
1733
- cards: z7.array(z7.unknown().transform((input, ctx) => {
1999
+ cards: z9.array(z9.unknown().transform((input, ctx) => {
1734
2000
  try {
1735
2001
  return validateContributionCard(input);
1736
2002
  } catch (error) {
1737
2003
  ctx.addIssue({ code: "custom", message: error.message });
1738
- return z7.NEVER;
2004
+ return z9.NEVER;
1739
2005
  }
1740
2006
  })).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)
2007
+ diagnostics: z9.array(Diagnostic.extend({ message: z9.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
2008
  }).strict().superRefine((preview, ctx) => {
1743
2009
  const slots = /* @__PURE__ */ new Set();
1744
2010
  let contributions = 0;
@@ -1767,39 +2033,39 @@ var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
1767
2033
  }));
1768
2034
 
1769
2035
  // packages/protocol/dist/adapters.js
1770
- import { z as z8 } from "zod";
1771
- var Path = z8.string().max(4096);
2036
+ import { z as z10 } from "zod";
2037
+ var Path = z10.string().max(4096);
1772
2038
  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"]),
2039
+ runtimeStatus: z10.enum(["active", "disabled", "unavailable"]),
2040
+ runtimeDetail: z10.string().max(4e3).nullable(),
2041
+ provenance: z10.object({
2042
+ scope: z10.enum(["user", "project", "explicit"]),
1777
2043
  source: Path.nullable(),
1778
2044
  packageDir: Path.nullable(),
1779
2045
  manifestPath: Path.nullable(),
1780
- targetVersion: z8.string().nullable(),
1781
- entrypoints: z8.array(Path).max(128),
1782
- evidence: z8.enum(["runtime-reported", "package-level", "explicit"])
2046
+ targetVersion: z10.string().nullable(),
2047
+ entrypoints: z10.array(Path).max(128),
2048
+ evidence: z10.enum(["runtime-reported", "package-level", "explicit"])
1783
2049
  })
1784
2050
  });
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)
2051
+ var SessionAdaptersResult = z10.object({
2052
+ generation: z10.string().uuid().nullable(),
2053
+ runtimeId: z10.string().nullable(),
2054
+ reloadable: z10.boolean(),
2055
+ blockedReason: z10.string().nullable(),
2056
+ adapters: z10.array(SessionAdapterInfo).max(256),
2057
+ diagnostics: z10.array(Diagnostic).max(100)
1792
2058
  });
1793
2059
 
1794
2060
  // 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) => {
2061
+ import { z as z11 } from "zod";
2062
+ var Id7 = z11.string().min(1).max(200);
2063
+ var Instant3 = z11.string().refine((value) => {
1798
2064
  const date = new Date(value);
1799
2065
  return Number.isFinite(date.getTime()) && date.toISOString() === value;
1800
2066
  }, "Expected canonical UTC timestamp");
1801
2067
  var AGENT_FRAME_MAX_BYTES = 128 * 1024;
1802
- var AgentMethod = z9.enum([
2068
+ var AgentMethod = z11.enum([
1803
2069
  "session.bind",
1804
2070
  "task.create",
1805
2071
  "message.send",
@@ -1809,34 +2075,34 @@ var AgentMethod = z9.enum([
1809
2075
  "policy.status",
1810
2076
  "policy.cancel"
1811
2077
  ]);
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()
2078
+ var AgentToolMethod = z11.enum(["task.create", "message.send", "inbox.read"]);
2079
+ var RequestHash = z11.string().regex(/^[a-f0-9]{64}$/);
2080
+ var AgentReceiptPeekRequest = z11.object({ method: AgentToolMethod, args: z11.record(z11.string(), z11.json()) }).strict();
2081
+ var AgentReceiptPeekResult = z11.discriminatedUnion("found", [
2082
+ z11.object({ found: z11.literal(false) }).strict(),
2083
+ z11.object({ found: z11.literal(true), requestHash: RequestHash }).strict()
1818
2084
  ]);
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([
2085
+ var AgentReceiptReplay = z11.object({ requestHash: RequestHash }).strict();
2086
+ var CreateAgentTask = z11.object({
2087
+ objective: z11.string().min(1).max(16e3),
2088
+ acceptance: z11.array(z11.string().min(1).max(2e3)).max(100).default([]),
2089
+ dependencies: z11.array(Id7).max(100).default([]),
2090
+ parentTaskId: Id7.nullable().optional(),
2091
+ hostId: Id7.optional(),
2092
+ profileId: Id7.optional(),
2093
+ notifyOnFinish: z11.boolean().default(true)
2094
+ });
2095
+ var SendAgentMessage = z11.object({
2096
+ sessionId: Id7,
2097
+ body: z11.string().min(1).max(16e3),
2098
+ mode: z11.enum(["steer", "queue"]),
2099
+ replyTo: Id7.optional()
2100
+ });
2101
+ var ReadAgentInbox = z11.object({
2102
+ after: z11.number().int().nonnegative().default(0),
2103
+ limit: z11.number().int().min(1).max(100).default(20)
2104
+ });
2105
+ var DeliveryState = z11.enum([
1840
2106
  "pending",
1841
2107
  "held",
1842
2108
  "deferred",
@@ -1847,46 +2113,46 @@ var DeliveryState = z9.enum([
1847
2113
  "failed"
1848
2114
  ]);
1849
2115
  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"]),
2116
+ seq: z11.number().int().positive(),
2117
+ id: Id7,
2118
+ recipientSessionId: Id7,
2119
+ replyTo: Id7.nullable(),
2120
+ chainId: Id7,
2121
+ depth: z11.number().int().min(0).max(4),
2122
+ body: z11.unknown(),
2123
+ requestedMode: z11.enum(["steer", "queue"]),
1858
2124
  deliveryState: DeliveryState,
1859
- holdUntil: z9.string(),
1860
- readAt: z9.string().nullable(),
1861
- createdAt: z9.string()
2125
+ holdUntil: z11.string(),
2126
+ readAt: z11.string().nullable(),
2127
+ createdAt: z11.string()
1862
2128
  };
1863
- var AgentMessage = z9.discriminatedUnion("kind", [
1864
- z9.object({ ...AgentMessageFields, kind: z9.literal("message"), senderSessionId: Id6 }),
1865
- z9.object({
2129
+ var AgentMessage = z11.discriminatedUnion("kind", [
2130
+ z11.object({ ...AgentMessageFields, kind: z11.literal("message"), senderSessionId: Id7 }),
2131
+ z11.object({
1866
2132
  ...AgentMessageFields,
1867
- kind: z9.literal("completion"),
1868
- senderSessionId: Id6.nullable()
2133
+ kind: z11.literal("completion"),
2134
+ senderSessionId: Id7.nullable()
1869
2135
  })
1870
2136
  ]);
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(),
2137
+ var AgentInbox = z11.object({
2138
+ messages: z11.array(AgentMessage),
2139
+ nextAfter: z11.number().int().nonnegative(),
2140
+ hasMore: z11.boolean()
2141
+ });
2142
+ var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z11.literal("policy.required") }).strict();
2143
+ var AgentRequestFrame = z11.object({
2144
+ type: z11.literal("agent.request"),
2145
+ requestId: Id7,
2146
+ sessionId: Id7,
2147
+ nativeSessionId: Id7,
2148
+ runtimeId: Id7,
2149
+ context: z11.object({ humanInputId: Id7.nullable(), causalMessageId: Id7.nullable() }).strict(),
2150
+ toolCallId: Id7.optional(),
1885
2151
  receiptReplay: AgentReceiptReplay.optional(),
1886
2152
  // Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
1887
2153
  deadlineAt: Instant3.optional(),
1888
2154
  method: AgentMethod,
1889
- args: z9.unknown()
2155
+ args: z11.unknown()
1890
2156
  }).strict().superRefine((frame, ctx) => {
1891
2157
  if (frame.method === "receipt.peek") {
1892
2158
  if (!frame.toolCallId) {
@@ -1905,277 +2171,85 @@ var AgentRequestFrame = z9.object({
1905
2171
  });
1906
2172
  }
1907
2173
  });
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()
2174
+ var AgentResultFrame = z11.discriminatedUnion("ok", [
2175
+ z11.object({
2176
+ type: z11.literal("agent.result"),
2177
+ requestId: Id7,
2178
+ runtimeId: Id7,
2179
+ ok: z11.literal(true),
2180
+ result: z11.unknown()
1915
2181
  }),
1916
- z9.object({
1917
- type: z9.literal("agent.result"),
1918
- requestId: Id6,
1919
- runtimeId: Id6,
1920
- ok: z9.literal(false),
2182
+ z11.object({
2183
+ type: z11.literal("agent.result"),
2184
+ requestId: Id7,
2185
+ runtimeId: Id7,
2186
+ ok: z11.literal(false),
1921
2187
  error: ErrorBody
1922
2188
  })
1923
2189
  ]);
1924
2190
 
1925
2191
  // packages/protocol/dist/api.js
1926
- import { z as z14 } from "zod";
2192
+ import { z as z15 } from "zod";
1927
2193
 
1928
2194
  // packages/protocol/dist/host-wire.js
1929
- import { z as z13 } from "zod";
1930
-
1931
- // packages/protocol/dist/events.js
1932
- 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
- });
2195
+ import { z as z14 } from "zod";
2121
2196
 
2122
2197
  // packages/protocol/dist/events.js
2198
+ import { z as z12 } from "zod";
2123
2199
  var EventDataSchemas = {
2124
2200
  "host.updated": Host,
2125
2201
  "project.updated": Project,
2126
- "project.deleted": z11.object({ id: z11.string() }),
2202
+ "project.deleted": z12.object({ id: z12.string() }),
2127
2203
  "checkout.updated": Checkout,
2128
2204
  "workspace.updated": Workspace,
2129
- "workspace.deleted": z11.object({ id: z11.string() }),
2205
+ "workspace.deleted": z12.object({ id: z12.string() }),
2130
2206
  "profile.updated": Profile,
2131
- "profile.deleted": z11.object({ id: z11.string() }),
2132
- "view.updated": View,
2133
- "view.deleted": z11.object({ id: z11.string() }),
2207
+ "profile.deleted": z12.object({ id: z12.string() }),
2208
+ "scope.updated": Scope,
2209
+ "scope.deleted": z12.object({ id: z12.string() }),
2134
2210
  "session.updated": Session,
2135
2211
  "transcript.item": TranscriptItem,
2136
- "transcript.reset": z11.object({ sessionId: z11.string(), epoch: z11.number().int() }),
2212
+ "transcript.reset": z12.object({ sessionId: z12.string(), epoch: z12.number().int() }),
2137
2213
  "interaction.updated": Interaction,
2138
2214
  "panel.updated": Panel,
2139
- "adapters.updated": z11.object({ hostId: z11.string(), adapters: z11.array(AdapterInfo) }),
2215
+ "adapters.updated": z12.object({ hostId: z12.string(), adapters: z12.array(AdapterInfo) }),
2140
2216
  diagnostic: Diagnostic,
2141
2217
  "task.updated": Task,
2142
- "task.deleted": z11.object({ id: z11.string() }),
2218
+ "task.deleted": z12.object({ id: z12.string() }),
2143
2219
  "run.updated": Run,
2144
2220
  "automation.updated": Automation,
2145
- "automation.deleted": z11.object({ id: z11.string() }),
2221
+ "automation.deleted": z12.object({ id: z12.string() }),
2146
2222
  "occurrence.created": Occurrence,
2147
2223
  "occurrence.updated": Occurrence,
2148
2224
  "attention.updated": AttentionItem,
2149
2225
  "device.updated": Device,
2150
2226
  "issue.updated": TrackedIssue,
2151
- "issue.deleted": z11.object({ id: z11.string() }),
2152
- "terminal.updated": Terminal,
2153
- "terminal.deleted": z11.object({ id: z11.string() }),
2154
- "settings.updated": z11.object({ dispatchPaused: z11.boolean() })
2227
+ "issue.deleted": z12.object({ id: z12.string() }),
2228
+ "client.updated": Client,
2229
+ "client.deleted": z12.object({ id: z12.string() }),
2230
+ "settings.updated": z12.object({ dispatchPaused: z12.boolean() })
2155
2231
  };
2156
2232
  var EVENT_TYPES = Object.keys(EventDataSchemas);
2157
2233
  var LEGACY_EVENT_TYPES = {
2158
- "workspace.removed": "workspace.deleted",
2159
- "surface.updated": "terminal.updated",
2160
- "surface.deleted": "terminal.deleted"
2234
+ "workspace.removed": "workspace.deleted"
2161
2235
  };
2162
2236
  function canonicalEventType(type) {
2163
2237
  return LEGACY_EVENT_TYPES[type] ?? type;
2164
2238
  }
2165
2239
  var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
2166
- var EventTypeSchema = z11.preprocess(canonical, z11.enum(EVENT_TYPES));
2167
- var EventScope = z11.object({
2168
- hostId: z11.string().optional(),
2169
- sessionId: z11.string().optional(),
2170
- taskId: z11.string().optional(),
2171
- projectId: z11.string().optional()
2240
+ var EventTypeSchema = z12.preprocess(canonical, z12.enum(EVENT_TYPES));
2241
+ var EventScope = z12.object({
2242
+ hostId: z12.string().optional(),
2243
+ sessionId: z12.string().optional(),
2244
+ taskId: z12.string().optional(),
2245
+ projectId: z12.string().optional()
2172
2246
  });
2173
2247
  var EventEnvelope = EventScope.extend({
2174
- seq: z11.number().int(),
2175
- id: z11.string(),
2248
+ seq: z12.number().int(),
2249
+ id: z12.string(),
2176
2250
  type: EventTypeSchema,
2177
- at: z11.string(),
2178
- data: z11.unknown()
2251
+ at: z12.string(),
2252
+ data: z12.unknown()
2179
2253
  });
2180
2254
  var HOST_EVENT_TYPES = [
2181
2255
  "session.updated",
@@ -2188,353 +2262,355 @@ var HOST_EVENT_TYPES = [
2188
2262
  "workspace.deleted"
2189
2263
  ];
2190
2264
  var HostEvent = EventScope.extend({
2191
- eventId: z11.string(),
2192
- type: z11.preprocess(canonical, z11.enum(HOST_EVENT_TYPES)),
2193
- at: z11.string(),
2194
- data: z11.unknown()
2195
- });
2196
- var StreamDelta = z11.object({
2197
- sessionId: z11.string(),
2198
- itemId: z11.string(),
2199
- kind: z11.enum(["text", "thinking", "tool_args", "tool_output"]),
2200
- delta: z11.string(),
2201
- order: z11.number().int().optional()
2265
+ eventId: z12.string(),
2266
+ type: z12.preprocess(canonical, z12.enum(HOST_EVENT_TYPES)),
2267
+ at: z12.string(),
2268
+ data: z12.unknown()
2269
+ });
2270
+ var StreamDelta = z12.object({
2271
+ sessionId: z12.string(),
2272
+ itemId: z12.string(),
2273
+ kind: z12.enum(["text", "thinking", "tool_args", "tool_output"]),
2274
+ delta: z12.string(),
2275
+ order: z12.number().int().optional()
2202
2276
  });
2203
2277
 
2204
2278
  // packages/protocol/dist/terminal-wire.js
2205
- import { z as z12 } from "zod";
2206
- var Cols = z12.number().int().min(10).max(1e3);
2207
- var Rows = z12.number().int().min(5).max(500);
2208
- var TermViewerToServer = z12.discriminatedUnion("t", [
2209
- z12.object({ t: z12.literal("in"), d: z12.string() }),
2210
- z12.object({ t: z12.literal("resize"), cols: Cols, rows: Rows }),
2211
- z12.object({ t: z12.literal("claim") })
2279
+ import { z as z13 } from "zod";
2280
+ var Cols = z13.number().int().min(10).max(1e3);
2281
+ var Rows = z13.number().int().min(5).max(500);
2282
+ var TermViewerToServer = z13.discriminatedUnion("t", [
2283
+ z13.object({ t: z13.literal("in"), d: z13.string() }),
2284
+ z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2285
+ z13.object({ t: z13.literal("claim") })
2212
2286
  ]);
2213
- var TermServerToViewer = z12.discriminatedUnion("t", [
2214
- z12.object({ t: z12.literal("out"), d: z12.string() }),
2215
- z12.object({ t: z12.literal("closed"), reason: z12.string() }),
2216
- z12.object({ t: z12.literal("size"), cols: Cols, rows: Rows, owner: z12.boolean() })
2287
+ var TermServerToViewer = z13.discriminatedUnion("t", [
2288
+ z13.object({ t: z13.literal("out"), d: z13.string() }),
2289
+ z13.object({ t: z13.literal("closed"), reason: z13.string() }),
2290
+ z13.object({ t: z13.literal("size"), cols: Cols, rows: Rows, owner: z13.boolean() })
2217
2291
  ]);
2218
- var TermCoordinatorMsg = z12.discriminatedUnion("t", [
2219
- z12.object({
2220
- t: z12.literal("open"),
2221
- sessionId: z12.string(),
2292
+ var TermCoordinatorMsg = z13.discriminatedUnion("t", [
2293
+ z13.object({
2294
+ t: z13.literal("open"),
2295
+ sessionId: z13.string(),
2222
2296
  cols: Cols,
2223
2297
  rows: Rows,
2224
- passive: z12.boolean().optional()
2298
+ passive: z13.boolean().optional()
2225
2299
  }),
2226
- z12.object({ t: z12.literal("claim") }),
2227
- z12.object({ t: z12.literal("in"), d: z12.string() }),
2228
- z12.object({ t: z12.literal("resize"), cols: Cols, rows: Rows }),
2229
- z12.object({ t: z12.literal("close") })
2300
+ z13.object({ t: z13.literal("claim") }),
2301
+ z13.object({ t: z13.literal("in"), d: z13.string() }),
2302
+ z13.object({ t: z13.literal("resize"), cols: Cols, rows: Rows }),
2303
+ z13.object({ t: z13.literal("close") })
2230
2304
  ]);
2231
2305
 
2232
2306
  // packages/protocol/dist/host-wire.js
2233
- var Origin = z13.enum(["human", "automation"]);
2234
- var DiffRev = z13.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
2235
- var HostCommand = z13.discriminatedUnion("type", [
2236
- z13.object({
2237
- type: z13.literal("session.start"),
2238
- sessionId: z13.string(),
2239
- title: z13.string(),
2240
- workspacePath: z13.string(),
2241
- projectId: z13.string().nullable(),
2307
+ var Origin = z14.enum(["human", "automation"]);
2308
+ var DiffRev = z14.string().regex(/^(uncommitted|[0-9a-f]{40})$/);
2309
+ var HostCommand = z14.discriminatedUnion("type", [
2310
+ z14.object({
2311
+ type: z14.literal("session.start"),
2312
+ sessionId: z14.string(),
2313
+ title: z14.string(),
2314
+ workspacePath: z14.string(),
2315
+ projectId: z14.string().nullable(),
2242
2316
  profile: Profile,
2243
2317
  nativeHandle: NativeHandle.nullable(),
2244
- initialPrompt: z13.string().nullable(),
2245
- dispatchKey: z13.string().nullable(),
2246
- controlRevision: z13.number().int(),
2318
+ initialPrompt: z14.string().nullable(),
2319
+ dispatchKey: z14.string().nullable(),
2320
+ controlRevision: z14.number().int(),
2247
2321
  controlMode: ControlMode,
2248
2322
  origin: Origin,
2249
- readOnly: z13.boolean().default(false),
2250
- policyRequired: z13.boolean().optional()
2323
+ readOnly: z14.boolean().default(false),
2324
+ policyRequired: z14.boolean().optional()
2251
2325
  }),
2252
- z13.object({
2253
- type: z13.literal("session.deliverMessage"),
2254
- sessionId: z13.string(),
2255
- messageId: z13.string(),
2256
- payload: z13.object({
2257
- deliveryId: z13.string(),
2258
- kind: z13.enum(["message", "completion"]),
2259
- text: z13.string()
2326
+ z14.object({
2327
+ type: z14.literal("session.deliverMessage"),
2328
+ sessionId: z14.string(),
2329
+ messageId: z14.string(),
2330
+ payload: z14.object({
2331
+ deliveryId: z14.string(),
2332
+ kind: z14.enum(["message", "completion"]),
2333
+ text: z14.string()
2260
2334
  }),
2261
- mode: z13.enum(["steer", "queue"]),
2262
- holdUntil: z13.string()
2335
+ mode: z14.enum(["steer", "queue"]),
2336
+ holdUntil: z14.string()
2263
2337
  }),
2264
- HostPolicySampleRequest.extend({ type: z13.literal("session.classifyPolicySample") }),
2265
- z13.object({
2266
- type: z13.literal("session.messageStatus"),
2267
- sessionId: z13.string(),
2268
- messageIds: z13.array(z13.string().min(1)).min(1).max(100)
2338
+ HostPolicySampleRequest.extend({ type: z14.literal("session.classifyPolicySample") }),
2339
+ z14.object({
2340
+ type: z14.literal("session.messageStatus"),
2341
+ sessionId: z14.string(),
2342
+ messageIds: z14.array(z14.string().min(1)).min(1).max(100)
2269
2343
  }),
2270
- z13.object({
2271
- type: z13.literal("session.prompt"),
2272
- sessionId: z13.string(),
2273
- text: z13.string(),
2274
- images: z13.array(z13.object({ mimeType: z13.string(), data: z13.string() })).default([]),
2275
- mode: z13.enum(["prompt", "steer", "followUp"]),
2344
+ z14.object({
2345
+ type: z14.literal("session.prompt"),
2346
+ sessionId: z14.string(),
2347
+ text: z14.string(),
2348
+ images: z14.array(z14.object({ mimeType: z14.string(), data: z14.string() })).default([]),
2349
+ mode: z14.enum(["prompt", "steer", "followUp"]),
2276
2350
  origin: Origin,
2277
- controlRevision: z13.number().int()
2351
+ controlRevision: z14.number().int()
2278
2352
  }),
2279
- z13.object({ type: z13.literal("session.abort"), sessionId: z13.string(), clearQueue: z13.boolean() }),
2280
- z13.object({ type: z13.literal("session.stop"), sessionId: z13.string() }),
2281
- z13.object({
2282
- type: z13.literal("session.answer"),
2283
- sessionId: z13.string(),
2284
- interactionId: z13.string(),
2285
- revision: z13.number().int(),
2353
+ z14.object({ type: z14.literal("session.abort"), sessionId: z14.string(), clearQueue: z14.boolean() }),
2354
+ /** `queueClear.v1`: empty Pi's queue without aborting; the receipt's result has the messages. */
2355
+ z14.object({ type: z14.literal("session.clearQueue"), sessionId: z14.string() }),
2356
+ z14.object({ type: z14.literal("session.stop"), sessionId: z14.string() }),
2357
+ z14.object({
2358
+ type: z14.literal("session.answer"),
2359
+ sessionId: z14.string(),
2360
+ interactionId: z14.string(),
2361
+ revision: z14.number().int(),
2286
2362
  response: InteractionResponseSchema,
2287
- deviceId: z13.string()
2363
+ deviceId: z14.string()
2288
2364
  }),
2289
- z13.object({
2290
- type: z13.literal("session.adapterAction"),
2291
- sessionId: z13.string(),
2292
- generation: z13.string().uuid().optional(),
2293
- adapterId: z13.string(),
2294
- actionId: z13.string(),
2295
- payload: z13.unknown()
2365
+ z14.object({
2366
+ type: z14.literal("session.adapterAction"),
2367
+ sessionId: z14.string(),
2368
+ generation: z14.string().uuid().optional(),
2369
+ adapterId: z14.string(),
2370
+ actionId: z14.string(),
2371
+ payload: z14.unknown()
2296
2372
  }),
2297
- z13.object({
2298
- type: z13.literal("session.setControl"),
2299
- sessionId: z13.string(),
2300
- controlRevision: z13.number().int(),
2373
+ z14.object({
2374
+ type: z14.literal("session.setControl"),
2375
+ sessionId: z14.string(),
2376
+ controlRevision: z14.number().int(),
2301
2377
  mode: ControlMode
2302
2378
  }),
2303
- z13.object({ type: z13.literal("session.rename"), sessionId: z13.string(), title: z13.string() }),
2304
- z13.object({ type: z13.literal("session.importable") }),
2305
- z13.object({ type: z13.literal("session.readNative"), sessionFile: z13.string() }),
2306
- z13.object({ type: z13.literal("session.snapshot"), sessionId: z13.string() }),
2307
- z13.object({ type: z13.literal("session.models"), sessionId: z13.string() }),
2308
- z13.object({ type: z13.literal("session.commands"), sessionId: z13.string() }),
2309
- z13.object({
2310
- type: z13.literal("session.complete"),
2311
- sessionId: z13.string(),
2312
- text: z13.string().max(500)
2379
+ z14.object({ type: z14.literal("session.rename"), sessionId: z14.string(), title: z14.string() }),
2380
+ z14.object({ type: z14.literal("session.importable") }),
2381
+ z14.object({ type: z14.literal("session.readNative"), sessionFile: z14.string() }),
2382
+ z14.object({ type: z14.literal("session.snapshot"), sessionId: z14.string() }),
2383
+ z14.object({ type: z14.literal("session.models"), sessionId: z14.string() }),
2384
+ z14.object({ type: z14.literal("session.commands"), sessionId: z14.string() }),
2385
+ z14.object({
2386
+ type: z14.literal("session.complete"),
2387
+ sessionId: z14.string(),
2388
+ text: z14.string().max(500)
2313
2389
  }),
2314
- z13.object({ type: z13.literal("session.tree"), sessionId: z13.string() }),
2315
- z13.object({
2316
- type: z13.literal("session.branch"),
2317
- sessionId: z13.string(),
2318
- entryId: z13.string().nullable(),
2319
- fork: z13.boolean()
2390
+ z14.object({ type: z14.literal("session.tree"), sessionId: z14.string() }),
2391
+ z14.object({
2392
+ type: z14.literal("session.branch"),
2393
+ sessionId: z14.string(),
2394
+ entryId: z14.string().nullable(),
2395
+ fork: z14.boolean()
2320
2396
  }),
2321
- z13.object({
2322
- type: z13.literal("session.navigate"),
2323
- sessionId: z13.string(),
2324
- entryId: z13.string(),
2325
- summarize: z13.boolean(),
2326
- instructions: z13.string().max(2e3).nullable()
2397
+ z14.object({
2398
+ type: z14.literal("session.navigate"),
2399
+ sessionId: z14.string(),
2400
+ entryId: z14.string(),
2401
+ summarize: z14.boolean(),
2402
+ instructions: z14.string().max(2e3).nullable()
2327
2403
  }),
2328
- z13.object({ type: z13.literal("session.reload"), sessionId: z13.string() }),
2329
- z13.object({ type: z13.literal("session.adapters"), sessionId: z13.string() }),
2330
- z13.object({ type: z13.literal("session.reloadAdapters"), sessionId: z13.string() }),
2331
- z13.object({ type: z13.literal("session.export"), sessionId: z13.string() }),
2332
- z13.object({
2333
- type: z13.literal("session.setModel"),
2334
- sessionId: z13.string(),
2335
- provider: z13.string().min(1),
2336
- modelId: z13.string().min(1)
2404
+ z14.object({ type: z14.literal("session.reload"), sessionId: z14.string() }),
2405
+ z14.object({ type: z14.literal("session.adapters"), sessionId: z14.string() }),
2406
+ z14.object({ type: z14.literal("session.reloadAdapters"), sessionId: z14.string() }),
2407
+ z14.object({ type: z14.literal("session.export"), sessionId: z14.string() }),
2408
+ z14.object({
2409
+ type: z14.literal("session.setModel"),
2410
+ sessionId: z14.string(),
2411
+ provider: z14.string().min(1),
2412
+ modelId: z14.string().min(1)
2337
2413
  }),
2338
- z13.object({ type: z13.literal("session.setThinking"), sessionId: z13.string(), level: ThinkingLevel }),
2339
- z13.object({
2340
- type: z13.literal("session.compact"),
2341
- sessionId: z13.string(),
2342
- instructions: z13.string().nullable()
2414
+ z14.object({ type: z14.literal("session.setThinking"), sessionId: z14.string(), level: ThinkingLevel }),
2415
+ z14.object({
2416
+ type: z14.literal("session.compact"),
2417
+ sessionId: z14.string(),
2418
+ instructions: z14.string().nullable()
2343
2419
  }),
2344
- z13.object({ type: z13.literal("checkout.inspect"), path: z13.string() }),
2345
- z13.object({ type: z13.literal("projects.scan"), folder: z13.string().min(1) }),
2346
- z13.object({
2347
- type: z13.literal("projects.suggest"),
2348
- days: z13.number().int().min(1).max(365).default(30)
2420
+ z14.object({ type: z14.literal("checkout.inspect"), path: z14.string() }),
2421
+ z14.object({ type: z14.literal("projects.scan"), folder: z14.string().min(1) }),
2422
+ z14.object({
2423
+ type: z14.literal("projects.suggest"),
2424
+ days: z14.number().int().min(1).max(365).default(30)
2349
2425
  }),
2350
- z13.object({
2351
- type: z13.literal("workspace.discover"),
2352
- checkoutPath: z13.string(),
2353
- worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
2426
+ z14.object({
2427
+ type: z14.literal("workspace.discover"),
2428
+ checkoutPath: z14.string(),
2429
+ worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2354
2430
  }),
2355
- z13.object({
2356
- type: z13.literal("workspace.create"),
2357
- checkoutPath: z13.string(),
2358
- branch: z13.string(),
2359
- base: z13.string(),
2360
- setupCommand: z13.string().nullable(),
2361
- worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
2431
+ z14.object({
2432
+ type: z14.literal("workspace.create"),
2433
+ checkoutPath: z14.string(),
2434
+ branch: z14.string(),
2435
+ base: z14.string(),
2436
+ setupCommand: z14.string().nullable(),
2437
+ worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2362
2438
  }),
2363
- z13.object({ type: z13.literal("workspace.status"), path: z13.string(), base: z13.string().nullable() }),
2364
- z13.object({
2365
- type: z13.literal("workspace.remove"),
2366
- path: z13.string(),
2367
- checkoutPath: z13.string(),
2368
- base: z13.string().nullable(),
2369
- force: z13.object({ dirty: z13.boolean(), unmerged: z13.boolean() }),
2370
- /** Also delete the worktree's local branch (hosts before trackers ignore it). */
2371
- deleteBranch: z13.boolean().optional()
2439
+ z14.object({ type: z14.literal("workspace.status"), path: z14.string(), base: z14.string().nullable() }),
2440
+ z14.object({
2441
+ type: z14.literal("workspace.remove"),
2442
+ path: z14.string(),
2443
+ checkoutPath: z14.string(),
2444
+ base: z14.string().nullable(),
2445
+ force: z14.object({ dirty: z14.boolean(), unmerged: z14.boolean() }),
2446
+ /** Also delete the worktree's local branch (hosts before GitHub issue sync ignore it). */
2447
+ deleteBranch: z14.boolean().optional()
2372
2448
  }),
2373
- z13.object({
2374
- type: z13.literal("workspace.diff"),
2375
- path: z13.string(),
2376
- base: z13.string().nullable(),
2377
- file: z13.string().nullable(),
2449
+ z14.object({
2450
+ type: z14.literal("workspace.diff"),
2451
+ path: z14.string(),
2452
+ base: z14.string().nullable(),
2453
+ file: z14.string().nullable(),
2378
2454
  /** Hosts without gitLog.v1 never receive it. */
2379
2455
  rev: DiffRev.optional()
2380
2456
  }),
2381
- z13.object({
2382
- type: z13.literal("workspace.log"),
2383
- path: z13.string(),
2384
- base: z13.string().nullable(),
2385
- limit: z13.number().int().min(1).max(200)
2457
+ z14.object({
2458
+ type: z14.literal("workspace.log"),
2459
+ path: z14.string(),
2460
+ base: z14.string().nullable(),
2461
+ limit: z14.number().int().min(1).max(200)
2386
2462
  }),
2387
- z13.object({ type: z13.literal("workspace.files"), path: z13.string(), dir: z13.string() }),
2388
- z13.object({ type: z13.literal("workspace.readFile"), path: z13.string(), file: z13.string() }),
2389
- GitHubHostViewRequest.extend({ type: z13.literal("workspace.prView") }),
2390
- GitHubHostLogsRequest.extend({ type: z13.literal("workspace.prFailedLogs") }),
2391
- 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") }),
2396
- z13.object({
2397
- type: z13.literal("dispatch.start"),
2398
- dispatchKey: z13.string(),
2399
- runId: z13.string(),
2400
- taskId: z13.string(),
2401
- sessionId: z13.string(),
2402
- projectId: z13.string(),
2403
- title: z13.string(),
2404
- workspace: z13.union([
2405
- z13.object({ path: z13.string() }),
2406
- z13.object({
2407
- createFrom: z13.object({
2408
- checkoutPath: z13.string(),
2409
- branch: z13.string(),
2410
- base: z13.string(),
2411
- setupCommand: z13.string().nullable(),
2412
- worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
2463
+ z14.object({ type: z14.literal("workspace.files"), path: z14.string(), dir: z14.string() }),
2464
+ z14.object({ type: z14.literal("workspace.readFile"), path: z14.string(), file: z14.string() }),
2465
+ GitHubHostViewRequest.extend({ type: z14.literal("workspace.prView") }),
2466
+ GitHubHostLogsRequest.extend({ type: z14.literal("workspace.prFailedLogs") }),
2467
+ GitHubHostMergeRequest.extend({ type: z14.literal("workspace.prMerge") }),
2468
+ IssueHostSyncRequest.extend({ type: z14.literal("tracker.sync") }),
2469
+ IssueHostPrepareBranchRequest.extend({ type: z14.literal("tracker.prepareBranch") }),
2470
+ IssueHostStartIssueRequest.extend({ type: z14.literal("tracker.startIssue") }),
2471
+ IssueHostSetStatusRequest.extend({ type: z14.literal("tracker.setStatus") }),
2472
+ z14.object({
2473
+ type: z14.literal("dispatch.start"),
2474
+ dispatchKey: z14.string(),
2475
+ runId: z14.string(),
2476
+ taskId: z14.string(),
2477
+ sessionId: z14.string(),
2478
+ projectId: z14.string(),
2479
+ title: z14.string(),
2480
+ workspace: z14.union([
2481
+ z14.object({ path: z14.string() }),
2482
+ z14.object({
2483
+ createFrom: z14.object({
2484
+ checkoutPath: z14.string(),
2485
+ branch: z14.string(),
2486
+ base: z14.string(),
2487
+ setupCommand: z14.string().nullable(),
2488
+ worktreeDir: z14.string().default(DEFAULT_WORKTREE_DIR)
2413
2489
  })
2414
2490
  })
2415
2491
  ]),
2416
2492
  nativeHandle: NativeHandle.nullable(),
2417
2493
  profile: Profile,
2418
- prompt: z13.string(),
2494
+ prompt: z14.string(),
2419
2495
  /** The launch's own revision; a takeover always carries a newer one. */
2420
- controlRevision: z13.number().int(),
2496
+ controlRevision: z14.number().int(),
2421
2497
  controlMode: ControlMode.default("automation"),
2422
- policyRequired: z13.boolean().optional()
2498
+ policyRequired: z14.boolean().optional()
2423
2499
  }),
2424
- z13.object({ type: z13.literal("dispatch.reconcile"), dispatchKey: z13.string() }),
2425
- z13.object({
2426
- type: z13.literal("checks.run"),
2427
- sessionId: z13.string(),
2428
- path: z13.string(),
2429
- commands: z13.array(z13.string())
2500
+ z14.object({ type: z14.literal("dispatch.reconcile"), dispatchKey: z14.string() }),
2501
+ z14.object({
2502
+ type: z14.literal("checks.run"),
2503
+ sessionId: z14.string(),
2504
+ path: z14.string(),
2505
+ commands: z14.array(z14.string())
2430
2506
  })
2431
2507
  ]);
2432
- var ImportableSession = z13.object({
2433
- sessionFile: z13.string(),
2434
- sessionId: z13.string(),
2435
- cwd: z13.string(),
2436
- name: z13.string().nullable(),
2437
- mtime: z13.string(),
2438
- inactive: z13.boolean()
2439
- });
2440
- var DiscoveredWorktree = z13.object({
2441
- path: z13.string(),
2442
- head: z13.string().nullable(),
2443
- branch: z13.string().nullable(),
2444
- bare: z13.boolean(),
2445
- detached: z13.boolean(),
2446
- locked: z13.boolean(),
2447
- prunable: z13.boolean(),
2448
- provenance: z13.enum(["managed", "discovered", "main"]),
2508
+ var ImportableSession = z14.object({
2509
+ sessionFile: z14.string(),
2510
+ sessionId: z14.string(),
2511
+ cwd: z14.string(),
2512
+ name: z14.string().nullable(),
2513
+ mtime: z14.string(),
2514
+ inactive: z14.boolean()
2515
+ });
2516
+ var DiscoveredWorktree = z14.object({
2517
+ path: z14.string(),
2518
+ head: z14.string().nullable(),
2519
+ branch: z14.string().nullable(),
2520
+ bare: z14.boolean(),
2521
+ detached: z14.boolean(),
2522
+ locked: z14.boolean(),
2523
+ prunable: z14.boolean(),
2524
+ provenance: z14.enum(["managed", "discovered", "main"]),
2449
2525
  git: GitState.nullable()
2450
2526
  });
2451
- var CheckoutInfo = z13.object({
2452
- root: z13.string(),
2453
- commonDir: z13.string(),
2454
- repoIdentity: z13.string(),
2455
- defaultBranch: z13.string()
2527
+ var CheckoutInfo = z14.object({
2528
+ root: z14.string(),
2529
+ commonDir: z14.string(),
2530
+ repoIdentity: z14.string(),
2531
+ defaultBranch: z14.string()
2456
2532
  });
2457
- var ScannedRepository = CheckoutInfo.extend({ name: z13.string() });
2458
- var ProjectFolderScan = z13.object({
2533
+ var ScannedRepository = CheckoutInfo.extend({ name: z14.string() });
2534
+ var ProjectFolderScan = z14.object({
2459
2535
  /** The folder, ~ expanded and realpath'd. */
2460
- folder: z13.string(),
2461
- repositories: z13.array(ScannedRepository)
2462
- });
2463
- var ProjectSuggestion = z13.object({
2464
- rootPath: z13.string(),
2465
- sessionCount: z13.number().int(),
2466
- lastActivityAt: z13.string()
2467
- });
2468
- var ProjectSuggestions = z13.object({ suggestions: z13.array(ProjectSuggestion) });
2469
- var GitCommit = z13.object({
2470
- sha: z13.string().regex(/^[0-9a-f]{40}$/),
2471
- subject: z13.string().max(300),
2472
- author: z13.string().max(200),
2473
- authoredAt: z13.string(),
2474
- pushed: z13.boolean()
2475
- });
2476
- var LogResult = z13.object({
2536
+ folder: z14.string(),
2537
+ repositories: z14.array(ScannedRepository)
2538
+ });
2539
+ var ProjectSuggestion = z14.object({
2540
+ rootPath: z14.string(),
2541
+ sessionCount: z14.number().int(),
2542
+ lastActivityAt: z14.string()
2543
+ });
2544
+ var ProjectSuggestions = z14.object({ suggestions: z14.array(ProjectSuggestion) });
2545
+ var GitCommit = z14.object({
2546
+ sha: z14.string().regex(/^[0-9a-f]{40}$/),
2547
+ subject: z14.string().max(300),
2548
+ author: z14.string().max(200),
2549
+ authoredAt: z14.string(),
2550
+ pushed: z14.boolean()
2551
+ });
2552
+ var LogResult = z14.object({
2477
2553
  /** The base branch the commits are counted from. */
2478
- base: z13.string(),
2554
+ base: z14.string(),
2479
2555
  /** `branch`: commits since the merge base; `recent`: HEAD's latest commits (no commits of its own). */
2480
- scope: z13.enum(["branch", "recent"]),
2481
- commits: z13.array(GitCommit).max(200),
2482
- truncated: z13.boolean(),
2556
+ scope: z14.enum(["branch", "recent"]),
2557
+ commits: z14.array(GitCommit).max(200),
2558
+ truncated: z14.boolean(),
2483
2559
  /** Changed and untracked files not committed yet. */
2484
- uncommitted: z13.number().int().min(0)
2485
- });
2486
- var DiffFile = z13.object({
2487
- path: z13.string(),
2488
- oldPath: z13.string().nullable(),
2489
- added: z13.number().int(),
2490
- deleted: z13.number().int(),
2491
- status: z13.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
2492
- });
2493
- var DiffResult = z13.object({
2494
- base: z13.string(),
2495
- files: z13.array(DiffFile),
2496
- patch: z13.string().nullable()
2497
- });
2498
- var FileEntry = z13.object({
2499
- name: z13.string(),
2500
- path: z13.string(),
2501
- kind: z13.enum(["file", "dir", "symlink"]),
2502
- size: z13.number().int().nullable()
2503
- });
2504
- var ReconcileResult = z13.union([
2505
- z13.object({ known: z13.literal(false) }),
2506
- z13.object({
2507
- known: z13.literal(true),
2508
- sessionId: z13.string().nullable(),
2509
- state: z13.enum(["accepted", "workspace_ready", "started", "failed"]),
2560
+ uncommitted: z14.number().int().min(0)
2561
+ });
2562
+ var DiffFile = z14.object({
2563
+ path: z14.string(),
2564
+ oldPath: z14.string().nullable(),
2565
+ added: z14.number().int(),
2566
+ deleted: z14.number().int(),
2567
+ status: z14.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
2568
+ });
2569
+ var DiffResult = z14.object({
2570
+ base: z14.string(),
2571
+ files: z14.array(DiffFile),
2572
+ patch: z14.string().nullable()
2573
+ });
2574
+ var FileEntry = z14.object({
2575
+ name: z14.string(),
2576
+ path: z14.string(),
2577
+ kind: z14.enum(["file", "dir", "symlink"]),
2578
+ size: z14.number().int().nullable()
2579
+ });
2580
+ var ReconcileResult = z14.union([
2581
+ z14.object({ known: z14.literal(false) }),
2582
+ z14.object({
2583
+ known: z14.literal(true),
2584
+ sessionId: z14.string().nullable(),
2585
+ state: z14.enum(["accepted", "workspace_ready", "started", "failed"]),
2510
2586
  runtime: RuntimeState.nullable(),
2511
- workspacePath: z13.string().nullable(),
2587
+ workspacePath: z14.string().nullable(),
2512
2588
  nativeHandle: NativeHandle.nullable(),
2513
- error: z13.string().nullable(),
2589
+ error: z14.string().nullable(),
2514
2590
  /** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
2515
- errorDetails: z13.record(z13.string(), z13.unknown()).nullable().default(null)
2591
+ errorDetails: z14.record(z14.string(), z14.unknown()).nullable().default(null)
2516
2592
  })
2517
2593
  ]);
2518
- var DispatchStartResult = z13.object({
2519
- sessionId: z13.string(),
2520
- workspacePath: z13.string(),
2594
+ var DispatchStartResult = z14.object({
2595
+ sessionId: z14.string(),
2596
+ workspacePath: z14.string(),
2521
2597
  nativeHandle: NativeHandle.nullable(),
2522
- reused: z13.boolean(),
2598
+ reused: z14.boolean(),
2523
2599
  /** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
2524
- promptError: z13.string().nullable().optional()
2600
+ promptError: z14.string().nullable().optional()
2525
2601
  });
2526
- var AnswerResult = z13.object({
2527
- status: z13.enum(["answered", "already_answered"]),
2602
+ var AnswerResult = z14.object({
2603
+ status: z14.enum(["answered", "already_answered"]),
2528
2604
  interaction: Interaction
2529
2605
  });
2530
- var SnapshotResult = z13.object({
2531
- partial: z13.array(TranscriptItem),
2532
- pendingInteractions: z13.array(Interaction)
2606
+ var SnapshotResult = z14.object({
2607
+ partial: z14.array(TranscriptItem),
2608
+ pendingInteractions: z14.array(Interaction)
2533
2609
  });
2534
- var ChecksResult = z13.object({ results: z13.array(CheckResult) });
2535
- var Receipt = z13.union([
2536
- z13.object({ commandId: z13.string(), ok: z13.literal(true), result: z13.unknown() }),
2537
- z13.object({ commandId: z13.string(), ok: z13.literal(false), error: ErrorBody })
2610
+ var ChecksResult = z14.object({ results: z14.array(CheckResult) });
2611
+ var Receipt = z14.union([
2612
+ z14.object({ commandId: z14.string(), ok: z14.literal(true), result: z14.unknown() }),
2613
+ z14.object({ commandId: z14.string(), ok: z14.literal(false), error: ErrorBody })
2538
2614
  ]);
2539
2615
  var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
2540
2616
  policyContext: HostToolPolicyContext.optional()
@@ -2553,295 +2629,299 @@ var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
2553
2629
  }
2554
2630
  ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
2555
2631
  });
2556
- var HostToCoordinator = z13.discriminatedUnion("type", [
2557
- z13.object({
2558
- type: z13.literal("hello"),
2559
- hostId: z13.string(),
2560
- credential: z13.string(),
2561
- name: z13.string(),
2562
- agentVersion: z13.string(),
2563
- piVersion: z13.string().nullable(),
2564
- piCompatible: z13.boolean(),
2632
+ var HostToCoordinator = z14.discriminatedUnion("type", [
2633
+ z14.object({
2634
+ type: z14.literal("hello"),
2635
+ hostId: z14.string(),
2636
+ credential: z14.string(),
2637
+ name: z14.string(),
2638
+ agentVersion: z14.string(),
2639
+ piVersion: z14.string().nullable(),
2640
+ piCompatible: z14.boolean(),
2565
2641
  platform: Platform,
2566
2642
  capabilities: RuntimeCapabilities.nullable(),
2567
2643
  github: HostGitHub.optional(),
2568
- protocolVersion: z13.number().int(),
2569
- features: z13.array(z13.string()).optional()
2644
+ protocolVersion: z14.number().int(),
2645
+ features: z14.array(z14.string()).optional()
2570
2646
  }),
2571
2647
  HostAgentRequestFrame,
2572
- z13.object({ type: z13.literal("event"), hostSeq: z13.number().int(), event: HostEvent }),
2573
- z13.object({ type: z13.literal("stream"), delta: StreamDelta }),
2574
- z13.object({ type: z13.literal("receipt"), receipt: Receipt }),
2575
- z13.object({ type: z13.literal("pong") }),
2576
- z13.object({ type: z13.literal("usage"), usage: z13.array(ProviderUsage) }),
2577
- z13.object({ type: z13.literal("term"), streamId: z13.string(), msg: TermServerToViewer })
2648
+ z14.object({ type: z14.literal("event"), hostSeq: z14.number().int(), event: HostEvent }),
2649
+ z14.object({ type: z14.literal("stream"), delta: StreamDelta }),
2650
+ z14.object({ type: z14.literal("receipt"), receipt: Receipt }),
2651
+ z14.object({ type: z14.literal("pong") }),
2652
+ z14.object({ type: z14.literal("usage"), usage: z14.array(ProviderUsage) }),
2653
+ z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermServerToViewer })
2578
2654
  ]);
2579
- var CoordinatorToHost = z13.discriminatedUnion("type", [
2580
- z13.object({
2581
- type: z13.literal("welcome"),
2582
- coordinatorVersion: z13.string(),
2583
- ackedHostSeq: z13.number().int(),
2584
- features: z13.array(z13.string()).optional()
2655
+ var CoordinatorToHost = z14.discriminatedUnion("type", [
2656
+ z14.object({
2657
+ type: z14.literal("welcome"),
2658
+ coordinatorVersion: z14.string(),
2659
+ ackedHostSeq: z14.number().int(),
2660
+ features: z14.array(z14.string()).optional()
2585
2661
  }),
2586
2662
  AgentResultFrame,
2587
- z13.object({ type: z13.literal("ack"), hostSeq: z13.number().int() }),
2588
- z13.object({ type: z13.literal("command"), commandId: z13.string(), command: HostCommand }),
2589
- z13.object({ type: z13.literal("ping") }),
2590
- z13.object({ type: z13.literal("reject"), error: ErrorBody }),
2591
- z13.object({ type: z13.literal("term"), streamId: z13.string(), msg: TermCoordinatorMsg })
2663
+ z14.object({ type: z14.literal("ack"), hostSeq: z14.number().int() }),
2664
+ z14.object({ type: z14.literal("command"), commandId: z14.string(), command: HostCommand }),
2665
+ z14.object({ type: z14.literal("ping") }),
2666
+ z14.object({ type: z14.literal("reject"), error: ErrorBody }),
2667
+ z14.object({ type: z14.literal("term"), streamId: z14.string(), msg: TermCoordinatorMsg })
2592
2668
  ]);
2593
2669
 
2594
2670
  // packages/protocol/dist/api.js
2595
- var EnrollRequest = z14.object({
2596
- token: z14.string().min(1),
2597
- name: z14.string().min(1).max(80),
2671
+ var EnrollRequest = z15.object({
2672
+ token: z15.string().min(1),
2673
+ name: z15.string().min(1).max(80),
2598
2674
  kind: DeviceKind
2599
2675
  });
2600
- var EnrollResponse = z14.object({ deviceId: z14.string(), credential: z14.string() });
2601
- var CreateEnrollmentRequest = z14.object({ kind: z14.enum(["device", "host"]) });
2602
- var CreateEnrollmentResponse = z14.object({
2603
- token: z14.string(),
2604
- url: z14.string(),
2605
- expiresAt: z14.string(),
2606
- qrSvg: z14.string(),
2607
- command: z14.string().nullable()
2676
+ var EnrollResponse = z15.object({ deviceId: z15.string(), credential: z15.string() });
2677
+ var CreateEnrollmentRequest = z15.object({ kind: z15.enum(["device", "host"]) });
2678
+ var CreateEnrollmentResponse = z15.object({
2679
+ token: z15.string(),
2680
+ url: z15.string(),
2681
+ expiresAt: z15.string(),
2682
+ qrSvg: z15.string(),
2683
+ command: z15.string().nullable()
2608
2684
  });
2609
- var HostEnrollRequest = z14.union([
2610
- z14.object({
2611
- token: z14.string().min(1),
2612
- name: z14.string().min(1).max(80),
2685
+ var HostEnrollRequest = z15.union([
2686
+ z15.object({
2687
+ token: z15.string().min(1),
2688
+ name: z15.string().min(1).max(80),
2613
2689
  platform: Platform
2614
2690
  }),
2615
- z14.object({
2616
- secret: z14.string().min(1),
2617
- name: z14.string().min(1).max(80),
2691
+ z15.object({
2692
+ secret: z15.string().min(1),
2693
+ name: z15.string().min(1).max(80),
2618
2694
  platform: Platform
2619
2695
  })
2620
2696
  ]);
2621
- var HostEnrollResponse = z14.object({ hostId: z14.string(), credential: z14.string() });
2622
- var CreateProjectRequest = z14.object({
2623
- name: z14.string().min(1),
2624
- hostId: z14.string(),
2625
- path: z14.string().min(1),
2626
- defaultProfileId: z14.string().nullable().optional(),
2627
- setupCommand: z14.string().nullable().optional(),
2628
- checks: z14.array(z14.string()).optional(),
2629
- maxConcurrentRuns: z14.number().int().min(1).max(32).optional(),
2697
+ var HostEnrollResponse = z15.object({ hostId: z15.string(), credential: z15.string() });
2698
+ var CreateProjectRequest = z15.object({
2699
+ name: z15.string().min(1),
2700
+ hostId: z15.string(),
2701
+ path: z15.string().min(1),
2702
+ defaultProfileId: z15.string().nullable().optional(),
2703
+ setupCommand: z15.string().nullable().optional(),
2704
+ checks: z15.array(z15.string()).optional(),
2705
+ maxConcurrentRuns: z15.number().int().min(1).max(32).optional(),
2630
2706
  worktreeDir: WorktreeDir.optional()
2631
2707
  });
2632
- var UpdateProjectRequest = z14.object({
2633
- name: z14.string().min(1).optional(),
2634
- defaultProfileId: z14.string().nullable().optional(),
2635
- defaultHostId: z14.string().nullable().optional(),
2636
- maxConcurrentRuns: z14.number().int().min(1).max(32).optional(),
2637
- automationEnabled: z14.boolean().optional(),
2638
- setupCommand: z14.string().nullable().optional(),
2639
- checks: z14.array(z14.string()).optional(),
2640
- workspaceSharing: z14.enum(["single_writer", "shared"]).optional(),
2708
+ var UpdateProjectRequest = z15.object({
2709
+ name: z15.string().min(1).optional(),
2710
+ defaultProfileId: z15.string().nullable().optional(),
2711
+ defaultHostId: z15.string().nullable().optional(),
2712
+ maxConcurrentRuns: z15.number().int().min(1).max(32).optional(),
2713
+ automationEnabled: z15.boolean().optional(),
2714
+ setupCommand: z15.string().nullable().optional(),
2715
+ checks: z15.array(z15.string()).optional(),
2716
+ workspaceSharing: z15.enum(["single_writer", "shared"]).optional(),
2641
2717
  worktreeDir: WorktreeDir.optional(),
2642
- ensureSessions: z14.boolean().optional(),
2643
- removeLanded: z14.boolean().optional()
2718
+ ensureSessions: z15.boolean().optional(),
2719
+ removeLanded: z15.boolean().optional()
2644
2720
  });
2645
- var AddCheckoutRequest = z14.object({ hostId: z14.string(), path: z14.string().min(1) });
2721
+ var AddCheckoutRequest = z15.object({ hostId: z15.string(), path: z15.string().min(1) });
2646
2722
  function isProjectFolderPath(s) {
2647
2723
  if (s.includes("\0"))
2648
2724
  return false;
2649
2725
  return s === "~" || s.startsWith("~/") || s.startsWith("/");
2650
2726
  }
2651
- var ProjectFolder = z14.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
2652
- var UpdateHostRequest = z14.object({
2653
- projectFolders: z14.array(ProjectFolder).max(20).optional()
2727
+ var ProjectFolder = z15.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
2728
+ var UpdateHostRequest = z15.object({
2729
+ projectFolders: z15.array(ProjectFolder).max(20).optional()
2654
2730
  });
2655
2731
  var ProjectScanResult = ProjectScan.extend({
2656
- added: z14.array(z14.object({
2657
- projectId: z14.string(),
2658
- name: z14.string(),
2659
- path: z14.string(),
2660
- newProject: z14.boolean()
2732
+ added: z15.array(z15.object({
2733
+ projectId: z15.string(),
2734
+ name: z15.string(),
2735
+ path: z15.string(),
2736
+ newProject: z15.boolean()
2661
2737
  }))
2662
2738
  });
2663
- var ProfileInput = z14.object({
2664
- name: z14.string().min(1),
2665
- provider: z14.string().nullable().default(null),
2666
- model: z14.string().nullable().default(null),
2739
+ var ProfileInput = z15.object({
2740
+ name: z15.string().min(1),
2741
+ provider: z15.string().nullable().default(null),
2742
+ model: z15.string().nullable().default(null),
2667
2743
  thinking: ThinkingLevel.nullable().default(null),
2668
- projectTrust: z14.enum(["ask", "approve", "ignore"]).default("ask"),
2669
- extraArgs: z14.array(ExtraArg).default([]),
2670
- resources: z14.enum(["all", "vanilla"]).default("all")
2671
- });
2672
- var CreateWorkspaceRequest = z14.object({
2673
- checkoutId: z14.string(),
2674
- branch: z14.string().min(1),
2675
- base: z14.string().nullable().optional()
2676
- });
2677
- var RemoveWorkspaceRequest = z14.object({
2678
- force: z14.object({ dirty: z14.boolean(), unmerged: z14.boolean() }).default({ dirty: false, unmerged: false })
2679
- });
2680
- var CreateSessionRequest = z14.object({
2681
- projectId: z14.string(),
2682
- workspace: z14.union([
2683
- z14.object({ existingId: z14.string() }),
2684
- z14.object({
2685
- checkoutId: z14.string(),
2686
- newBranch: z14.string().min(1),
2687
- base: z14.string().nullable().optional()
2744
+ projectTrust: z15.enum(["ask", "approve", "ignore"]).default("ask"),
2745
+ extraArgs: z15.array(ExtraArg).default([]),
2746
+ resources: z15.enum(["all", "vanilla"]).default("all")
2747
+ });
2748
+ var CreateWorkspaceRequest = z15.object({
2749
+ checkoutId: z15.string(),
2750
+ branch: z15.string().min(1),
2751
+ base: z15.string().nullable().optional()
2752
+ });
2753
+ var RemoveWorkspaceRequest = z15.object({
2754
+ force: z15.object({ dirty: z15.boolean(), unmerged: z15.boolean() }).default({ dirty: false, unmerged: false })
2755
+ });
2756
+ var CreateSessionRequest = z15.object({
2757
+ projectId: z15.string(),
2758
+ workspace: z15.union([
2759
+ z15.object({ existingId: z15.string() }),
2760
+ z15.object({
2761
+ checkoutId: z15.string(),
2762
+ newBranch: z15.string().min(1),
2763
+ base: z15.string().nullable().optional()
2688
2764
  })
2689
2765
  ]),
2690
- profileId: z14.string().nullable().optional(),
2691
- prompt: z14.string().default(""),
2692
- title: z14.string().optional(),
2693
- viewId: z14.string().optional()
2694
- });
2695
- var OpenBranchRequest = z14.object({
2696
- projectId: z14.string(),
2697
- branch: z14.string().min(1),
2698
- hostId: z14.string().optional(),
2699
- base: z14.string().nullable().optional(),
2700
- prompt: z14.string().default(""),
2701
- profileId: z14.string().nullable().optional(),
2702
- title: z14.string().optional(),
2703
- viewId: z14.string().optional(),
2766
+ profileId: z15.string().nullable().optional(),
2767
+ prompt: z15.string().default(""),
2768
+ title: z15.string().optional(),
2769
+ scopeId: z15.string().optional(),
2770
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2771
+ viewId: z15.string().optional()
2772
+ });
2773
+ var OpenBranchRequest = z15.object({
2774
+ projectId: z15.string(),
2775
+ branch: z15.string().min(1),
2776
+ hostId: z15.string().optional(),
2777
+ base: z15.string().nullable().optional(),
2778
+ prompt: z15.string().default(""),
2779
+ profileId: z15.string().nullable().optional(),
2780
+ title: z15.string().optional(),
2781
+ scopeId: z15.string().optional(),
2782
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of scopeId. */
2783
+ viewId: z15.string().optional(),
2704
2784
  /** Start another session even when the branch has one. */
2705
- another: z14.boolean().default(false)
2706
- });
2707
- var OpenBranchResult = z14.object({ session: Session, created: z14.boolean() });
2708
- var SetPrimaryRequest = z14.object({ primary: z14.boolean() });
2709
- var PromptRequest = z14.object({
2710
- text: z14.string().min(1),
2711
- mode: z14.enum(["prompt", "steer", "followUp"]).default("prompt"),
2712
- images: z14.array(z14.object({ mimeType: z14.string(), data: z14.string() })).default([]),
2713
- clientMessageId: z14.string().optional()
2714
- });
2715
- var CacheAlertRequest = z14.object({
2716
- enabled: z14.boolean(),
2717
- ttlSec: z14.number().int().min(60).max(86400).nullable().default(null)
2718
- });
2719
- var RenameRequest = z14.object({ title: z14.string().min(1).max(200) });
2720
- var SetModelRequest = z14.object({
2721
- provider: z14.string().min(1),
2722
- modelId: z14.string().min(1)
2723
- });
2724
- var SetThinkingRequest = z14.object({ level: ThinkingLevel });
2725
- var CompactRequest = z14.object({ instructions: z14.string().max(4e3).optional() });
2726
- var SessionModelsResult = z14.object({ models: z14.array(SessionModel) });
2727
- var SessionCommandsResult = z14.object({ commands: z14.array(SlashCommand) });
2728
- var CompleteRequest = z14.object({ text: z14.string().min(1).max(500) });
2729
- var CompletionItem = z14.object({
2730
- value: z14.string(),
2731
- label: z14.string(),
2732
- description: z14.string().nullable()
2733
- });
2734
- var SessionCompleteResult = z14.object({
2735
- items: z14.array(CompletionItem).max(50),
2736
- prefix: z14.string()
2737
- });
2738
- var TreeRow = z14.object({
2739
- entryId: z14.string(),
2740
- parentId: z14.string().nullable(),
2741
- depth: z14.number().int(),
2742
- role: z14.enum(["user", "assistant"]),
2743
- text: z14.string(),
2744
- activeBranch: z14.boolean(),
2745
- leaf: z14.boolean(),
2746
- label: z14.string().nullable(),
2747
- at: z14.string().nullable()
2748
- });
2749
- var SessionTreeResult = z14.object({ rows: z14.array(TreeRow) });
2750
- var BranchRequest = z14.object({
2751
- entryId: z14.string().nullable(),
2752
- fork: z14.boolean().default(false)
2753
- });
2754
- var HostBranchResult = z14.object({
2755
- sessionFile: z14.string().nullable(),
2756
- prefill: z14.string().nullable()
2757
- });
2758
- var TranscriptPage = z14.object({
2759
- items: z14.array(TranscriptItem),
2760
- hasMore: z14.boolean(),
2761
- epoch: z14.number().int().optional(),
2762
- rev: z14.number().int().optional(),
2763
- delta: z14.boolean().optional(),
2764
- reset: z14.boolean().optional()
2765
- });
2766
- var NavigateRequest = z14.object({
2767
- entryId: z14.string().min(1),
2768
- summarize: z14.boolean().default(false),
2769
- instructions: z14.string().max(2e3).nullable().default(null)
2770
- });
2771
- var HostNavigateResult = z14.object({
2772
- items: z14.array(TranscriptItem),
2773
- prefill: z14.string().nullable()
2774
- });
2775
- var NavigateResult = z14.object({
2776
- prefill: z14.string().nullable(),
2777
- epoch: z14.number().int()
2778
- });
2779
- var BranchResult = z14.object({
2785
+ another: z15.boolean().default(false)
2786
+ });
2787
+ var OpenBranchResult = z15.object({ session: Session, created: z15.boolean() });
2788
+ var SetPrimaryRequest = z15.object({ primary: z15.boolean() });
2789
+ var PromptRequest = z15.object({
2790
+ text: z15.string().min(1),
2791
+ mode: z15.enum(["prompt", "steer", "followUp"]).default("prompt"),
2792
+ images: z15.array(z15.object({ mimeType: z15.string(), data: z15.string() })).default([]),
2793
+ clientMessageId: z15.string().optional()
2794
+ });
2795
+ var CacheAlertRequest = z15.object({
2796
+ enabled: z15.boolean(),
2797
+ ttlSec: z15.number().int().min(60).max(86400).nullable().default(null)
2798
+ });
2799
+ var RenameRequest = z15.object({ title: z15.string().min(1).max(200) });
2800
+ var SetModelRequest = z15.object({
2801
+ provider: z15.string().min(1),
2802
+ modelId: z15.string().min(1)
2803
+ });
2804
+ var SetThinkingRequest = z15.object({ level: ThinkingLevel });
2805
+ var CompactRequest = z15.object({ instructions: z15.string().max(4e3).optional() });
2806
+ var SessionModelsResult = z15.object({ models: z15.array(SessionModel) });
2807
+ var SessionCommandsResult = z15.object({ commands: z15.array(SlashCommand) });
2808
+ var CompleteRequest = z15.object({ text: z15.string().min(1).max(500) });
2809
+ var CompletionItem = z15.object({
2810
+ value: z15.string(),
2811
+ label: z15.string(),
2812
+ description: z15.string().nullable()
2813
+ });
2814
+ var SessionCompleteResult = z15.object({
2815
+ items: z15.array(CompletionItem).max(50),
2816
+ prefix: z15.string()
2817
+ });
2818
+ var TreeRow = z15.object({
2819
+ entryId: z15.string(),
2820
+ parentId: z15.string().nullable(),
2821
+ depth: z15.number().int(),
2822
+ role: z15.enum(["user", "assistant"]),
2823
+ text: z15.string(),
2824
+ activeBranch: z15.boolean(),
2825
+ leaf: z15.boolean(),
2826
+ label: z15.string().nullable(),
2827
+ at: z15.string().nullable()
2828
+ });
2829
+ var SessionTreeResult = z15.object({ rows: z15.array(TreeRow) });
2830
+ var BranchRequest = z15.object({
2831
+ entryId: z15.string().nullable(),
2832
+ fork: z15.boolean().default(false)
2833
+ });
2834
+ var HostBranchResult = z15.object({
2835
+ sessionFile: z15.string().nullable(),
2836
+ prefill: z15.string().nullable()
2837
+ });
2838
+ var TranscriptPage = z15.object({
2839
+ items: z15.array(TranscriptItem),
2840
+ hasMore: z15.boolean(),
2841
+ epoch: z15.number().int().optional(),
2842
+ rev: z15.number().int().optional(),
2843
+ delta: z15.boolean().optional(),
2844
+ reset: z15.boolean().optional()
2845
+ });
2846
+ var NavigateRequest = z15.object({
2847
+ entryId: z15.string().min(1),
2848
+ summarize: z15.boolean().default(false),
2849
+ instructions: z15.string().max(2e3).nullable().default(null)
2850
+ });
2851
+ var HostNavigateResult = z15.object({
2852
+ items: z15.array(TranscriptItem),
2853
+ prefill: z15.string().nullable()
2854
+ });
2855
+ var NavigateResult = z15.object({
2856
+ prefill: z15.string().nullable(),
2857
+ epoch: z15.number().int()
2858
+ });
2859
+ var BranchResult = z15.object({
2780
2860
  session: Session.nullable(),
2781
- prefill: z14.string().nullable()
2861
+ prefill: z15.string().nullable()
2782
2862
  });
2783
- var SessionExportResult = z14.object({ fileName: z14.string(), content: z14.string() });
2784
- var CommandViewAction = z14.object({
2785
- label: z14.string().min(1).max(80),
2786
- command: z14.string().startsWith("/").max(500),
2787
- tone: z14.enum(["default", "primary", "danger"]).optional()
2863
+ var SessionExportResult = z15.object({ fileName: z15.string(), content: z15.string() });
2864
+ var CommandViewAction = z15.object({
2865
+ label: z15.string().min(1).max(80),
2866
+ command: z15.string().startsWith("/").max(500),
2867
+ tone: z15.enum(["default", "primary", "danger"]).optional()
2788
2868
  });
2789
- var CommandView = z14.object({
2790
- title: z14.string().min(1).max(200),
2869
+ var CommandView = z15.object({
2870
+ title: z15.string().min(1).max(200),
2791
2871
  body: UINodeSchema,
2792
- actions: z14.array(CommandViewAction).max(30).default([])
2872
+ actions: z15.array(CommandViewAction).max(30).default([])
2793
2873
  });
2794
- var ModelStateResult = z14.object({
2874
+ var ModelStateResult = z15.object({
2795
2875
  model: SessionModel.nullable(),
2796
2876
  thinking: ThinkingLevel.nullable()
2797
2877
  });
2798
- var ImportSessionRequest = z14.object({
2799
- hostId: z14.string(),
2800
- sessionFile: z14.string(),
2801
- projectId: z14.string().nullable().optional()
2878
+ var ImportSessionRequest = z15.object({
2879
+ hostId: z15.string(),
2880
+ sessionFile: z15.string(),
2881
+ projectId: z15.string().nullable().optional()
2802
2882
  });
2803
- var AnswerRequest = z14.object({
2804
- revision: z14.number().int(),
2883
+ var AnswerRequest = z15.object({
2884
+ revision: z15.number().int(),
2805
2885
  response: InteractionResponseSchema
2806
2886
  });
2807
- var AdapterActionRequest = z14.object({
2808
- generation: z14.string().uuid().optional(),
2809
- adapterId: z14.string(),
2810
- actionId: z14.string(),
2811
- payload: z14.unknown().optional()
2812
- });
2813
- var TaskPolicyPatch = z14.object({
2814
- hostId: z14.string().nullable().optional(),
2815
- profileId: z14.string().nullable().optional(),
2816
- workspace: z14.object({
2817
- mode: z14.enum(["new_worktree", "existing"]).optional(),
2818
- branch: z14.string().nullable().optional(),
2819
- base: z14.string().nullable().optional(),
2820
- workspaceId: z14.string().optional()
2887
+ var AdapterActionRequest = z15.object({
2888
+ generation: z15.string().uuid().optional(),
2889
+ adapterId: z15.string(),
2890
+ actionId: z15.string(),
2891
+ payload: z15.unknown().optional()
2892
+ });
2893
+ var TaskPolicyPatch = z15.object({
2894
+ hostId: z15.string().nullable().optional(),
2895
+ profileId: z15.string().nullable().optional(),
2896
+ workspace: z15.object({
2897
+ mode: z15.enum(["new_worktree", "existing"]).optional(),
2898
+ branch: z15.string().nullable().optional(),
2899
+ base: z15.string().nullable().optional(),
2900
+ workspaceId: z15.string().optional()
2821
2901
  }).optional(),
2822
- continuation: z14.object({
2823
- enabled: z14.boolean().optional(),
2824
- objective: z14.string().min(1).optional(),
2825
- maxContinuations: z14.number().int().min(1).max(50).optional(),
2826
- maxElapsedMinutes: z14.number().int().min(1).max(1440).optional(),
2827
- maxTokens: z14.number().int().positive().nullable().optional(),
2828
- maxCostUsd: z14.number().positive().nullable().optional()
2902
+ continuation: z15.object({
2903
+ enabled: z15.boolean().optional(),
2904
+ objective: z15.string().min(1).optional(),
2905
+ maxContinuations: z15.number().int().min(1).max(50).optional(),
2906
+ maxElapsedMinutes: z15.number().int().min(1).max(1440).optional(),
2907
+ maxTokens: z15.number().int().positive().nullable().optional(),
2908
+ maxCostUsd: z15.number().positive().nullable().optional()
2829
2909
  }).optional(),
2830
2910
  completion: CompletionPolicy.partial().optional()
2831
2911
  });
2832
- var CreateTaskRequest = z14.object({
2833
- projectId: z14.string(),
2834
- title: z14.string().max(300).optional(),
2912
+ var CreateTaskRequest = z15.object({
2913
+ projectId: z15.string(),
2914
+ title: z15.string().max(300).optional(),
2835
2915
  githubIssueUrl: GitHubIssueUrl.optional(),
2836
- githubIssue: z14.never().optional(),
2837
- launchPrompt: z14.never().optional(),
2838
- objective: z14.string().default(""),
2839
- acceptanceCriteria: z14.array(z14.string()).default([]),
2840
- dependencies: z14.array(z14.string()).default([]),
2841
- parentTaskId: z14.string().nullable().optional(),
2916
+ githubIssue: z15.never().optional(),
2917
+ launchPrompt: z15.never().optional(),
2918
+ objective: z15.string().default(""),
2919
+ acceptanceCriteria: z15.array(z15.string()).default([]),
2920
+ dependencies: z15.array(z15.string()).default([]),
2921
+ parentTaskId: z15.string().nullable().optional(),
2842
2922
  priority: Priority.default(2),
2843
- state: z14.enum(["backlog", "ready"]).default("backlog"),
2844
- notBefore: z14.string().nullable().optional(),
2923
+ state: z15.enum(["backlog", "ready"]).default("backlog"),
2924
+ notBefore: z15.string().nullable().optional(),
2845
2925
  policy: TaskPolicyPatch.optional()
2846
2926
  }).superRefine((v, ctx) => {
2847
2927
  if (v.githubIssueUrl === void 0) {
@@ -2879,32 +2959,32 @@ var CreateTaskRequest = z14.object({
2879
2959
  const issue = githubIssueFromUrl(v.githubIssueUrl);
2880
2960
  return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
2881
2961
  });
2882
- var UpdateTaskRequest = z14.object({
2883
- githubIssueUrl: z14.never().optional(),
2884
- githubIssue: z14.never().optional(),
2885
- launchPrompt: z14.never().optional(),
2886
- title: z14.string().min(1).max(300).optional(),
2887
- objective: z14.string().optional(),
2888
- acceptanceCriteria: z14.array(z14.string()).optional(),
2889
- dependencies: z14.array(z14.string()).optional(),
2890
- parentTaskId: z14.string().nullable().optional(),
2962
+ var UpdateTaskRequest = z15.object({
2963
+ githubIssueUrl: z15.never().optional(),
2964
+ githubIssue: z15.never().optional(),
2965
+ launchPrompt: z15.never().optional(),
2966
+ title: z15.string().min(1).max(300).optional(),
2967
+ objective: z15.string().optional(),
2968
+ acceptanceCriteria: z15.array(z15.string()).optional(),
2969
+ dependencies: z15.array(z15.string()).optional(),
2970
+ parentTaskId: z15.string().nullable().optional(),
2891
2971
  priority: Priority.optional(),
2892
- position: z14.number().optional(),
2893
- notBefore: z14.string().nullable().optional(),
2972
+ position: z15.number().optional(),
2973
+ notBefore: z15.string().nullable().optional(),
2894
2974
  policy: TaskPolicyPatch.optional()
2895
2975
  });
2896
- var MoveTaskRequest = z14.object({
2976
+ var MoveTaskRequest = z15.object({
2897
2977
  to: TaskState,
2898
- confirm: z14.boolean().optional(),
2899
- onRunning: z14.enum(["pause", "stop"]).optional(),
2900
- position: z14.number().optional()
2978
+ confirm: z15.boolean().optional(),
2979
+ onRunning: z15.enum(["pause", "stop"]).optional(),
2980
+ position: z15.number().optional()
2901
2981
  });
2902
- var RequestChangesRequest = z14.object({ feedback: z14.array(z14.string().min(1)).min(1) });
2903
- var Eligibility = z14.union([
2904
- z14.object({ eligible: z14.literal(true), hostId: z14.string(), hostName: z14.string() }),
2905
- z14.object({
2906
- eligible: z14.literal(false),
2907
- wait: z14.enum([
2982
+ var RequestChangesRequest = z15.object({ feedback: z15.array(z15.string().min(1)).min(1) });
2983
+ var Eligibility = z15.union([
2984
+ z15.object({ eligible: z15.literal(true), hostId: z15.string(), hostName: z15.string() }),
2985
+ z15.object({
2986
+ eligible: z15.literal(false),
2987
+ wait: z15.enum([
2908
2988
  "dependency",
2909
2989
  "host_offline",
2910
2990
  "project_limit",
@@ -2917,247 +2997,256 @@ var Eligibility = z14.union([
2917
2997
  "already_dispatched",
2918
2998
  "retry_backoff"
2919
2999
  ]),
2920
- message: z14.string()
3000
+ message: z15.string()
2921
3001
  })
2922
3002
  ]);
2923
- var NowResponse = z14.object({
2924
- running: z14.array(z14.object({ taskId: z14.string(), runId: z14.string(), sessionId: z14.string().nullable() })),
2925
- queued: z14.array(z14.object({ taskId: z14.string(), eligibility: Eligibility })),
2926
- dispatchPaused: z14.boolean()
2927
- });
2928
- var AutomationInput = z14.object({
2929
- name: z14.string().min(1),
2930
- enabled: z14.boolean().default(true),
2931
- projectId: z14.string(),
3003
+ var NowResponse = z15.object({
3004
+ running: z15.array(z15.object({ taskId: z15.string(), runId: z15.string(), sessionId: z15.string().nullable() })),
3005
+ queued: z15.array(z15.object({ taskId: z15.string(), eligibility: Eligibility })),
3006
+ dispatchPaused: z15.boolean()
3007
+ });
3008
+ var AutomationInput = z15.object({
3009
+ name: z15.string().min(1),
3010
+ enabled: z15.boolean().default(true),
3011
+ projectId: z15.string(),
2932
3012
  trigger: Trigger,
2933
- filters: z14.array(z14.object({ path: z14.string(), equals: z14.string() })).default([]),
3013
+ filters: z15.array(z15.object({ path: z15.string(), equals: z15.string() })).default([]),
2934
3014
  template: TaskTemplate,
2935
- hostId: z14.string().nullable().default(null),
2936
- profileId: z14.string().nullable().default(null),
2937
- mode: z14.enum(["fresh", "continue", "watch"]).default("fresh"),
2938
- groupingKey: z14.string().nullable().default(null),
2939
- overlap: z14.enum(["skip", "queue_one", "append"]).default("skip"),
2940
- missed: z14.enum(["skip", "run_once"]).default("skip"),
3015
+ hostId: z15.string().nullable().default(null),
3016
+ profileId: z15.string().nullable().default(null),
3017
+ mode: z15.enum(["fresh", "continue", "watch"]).default("fresh"),
3018
+ groupingKey: z15.string().nullable().default(null),
3019
+ overlap: z15.enum(["skip", "queue_one", "append"]).default("skip"),
3020
+ missed: z15.enum(["skip", "run_once"]).default("skip"),
2941
3021
  continuation: ContinuationPolicy.default({ enabled: false }),
2942
3022
  completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
2943
3023
  });
2944
- var AutomationView = Automation.extend({ summary: z14.string() });
2945
- var AutomationPreview = z14.object({
2946
- summary: z14.string(),
3024
+ var AutomationView = Automation.extend({ summary: z15.string() });
3025
+ var AutomationPreview = z15.object({
3026
+ summary: z15.string(),
2947
3027
  task: TaskTemplate,
2948
- next: z14.array(z14.string())
2949
- });
2950
- var WebhookTokenResponse = z14.object({ token: z14.string(), url: z14.string() });
2951
- var PushSubscriptionRequest = z14.object({
2952
- endpoint: z14.string().url(),
2953
- keys: z14.object({ p256dh: z14.string(), auth: z14.string() }),
2954
- permission: z14.enum(["granted", "denied", "default", "unknown"]).default("granted")
2955
- });
2956
- var NotificationSettings = z14.object({
2957
- quietHours: z14.object({
2958
- start: z14.string().regex(/^\d{2}:\d{2}$/),
2959
- end: z14.string().regex(/^\d{2}:\d{2}$/),
2960
- timezone: z14.string()
3028
+ next: z15.array(z15.string())
3029
+ });
3030
+ var WebhookTokenResponse = z15.object({ token: z15.string(), url: z15.string() });
3031
+ var PushSubscriptionRequest = z15.object({
3032
+ endpoint: z15.string().url(),
3033
+ keys: z15.object({ p256dh: z15.string(), auth: z15.string() }),
3034
+ permission: z15.enum(["granted", "denied", "default", "unknown"]).default("granted")
3035
+ });
3036
+ var NotificationSettings = z15.object({
3037
+ quietHours: z15.object({
3038
+ start: z15.string().regex(/^\d{2}:\d{2}$/),
3039
+ end: z15.string().regex(/^\d{2}:\d{2}$/),
3040
+ timezone: z15.string()
2961
3041
  }).nullable(),
2962
- privatePreviews: z14.boolean(),
2963
- preferredDeviceId: z14.string().nullable()
3042
+ privatePreviews: z15.boolean(),
3043
+ preferredDeviceId: z15.string().nullable()
2964
3044
  });
2965
- var PushPayload = z14.union([
2966
- z14.object({
2967
- type: z14.literal("show"),
2968
- title: z14.string(),
2969
- body: z14.string(),
2970
- tag: z14.string(),
2971
- url: z14.string(),
2972
- renotify: z14.boolean()
3045
+ var PushPayload = z15.union([
3046
+ z15.object({
3047
+ type: z15.literal("show"),
3048
+ title: z15.string(),
3049
+ body: z15.string(),
3050
+ tag: z15.string(),
3051
+ url: z15.string(),
3052
+ renotify: z15.boolean()
2973
3053
  }),
2974
- z14.object({ type: z14.literal("clear"), tag: z14.string() })
3054
+ z15.object({ type: z15.literal("clear"), tag: z15.string() })
2975
3055
  ]);
2976
- var SetupState = z14.object({
2977
- passkey: z14.object({
2978
- available: z14.boolean(),
2979
- registered: z14.boolean(),
2980
- reason: z14.string().nullable()
3056
+ var SetupState = z15.object({
3057
+ passkey: z15.object({
3058
+ available: z15.boolean(),
3059
+ registered: z15.boolean(),
3060
+ reason: z15.string().nullable()
2981
3061
  }),
2982
- oidc: z14.object({ label: z14.string() }).nullable()
3062
+ oidc: z15.object({ label: z15.string() }).nullable()
2983
3063
  });
2984
- var PasskeyRegisterOptionsResponse = z14.object({
2985
- challengeId: z14.string(),
2986
- options: z14.unknown()
3064
+ var PasskeyRegisterOptionsResponse = z15.object({
3065
+ challengeId: z15.string(),
3066
+ options: z15.unknown()
2987
3067
  });
2988
- var PasskeyRegisterVerifyRequest = z14.object({
2989
- challengeId: z14.string(),
2990
- name: z14.string().min(1).max(80),
2991
- response: z14.unknown()
3068
+ var PasskeyRegisterVerifyRequest = z15.object({
3069
+ challengeId: z15.string(),
3070
+ name: z15.string().min(1).max(80),
3071
+ response: z15.unknown()
2992
3072
  });
2993
- var PasskeySignInOptionsResponse = z14.object({
2994
- challengeId: z14.string(),
2995
- options: z14.unknown()
3073
+ var PasskeySignInOptionsResponse = z15.object({
3074
+ challengeId: z15.string(),
3075
+ options: z15.unknown()
2996
3076
  });
2997
- var PasskeySignInVerifyRequest = z14.object({
2998
- challengeId: z14.string(),
2999
- response: z14.unknown(),
3000
- deviceName: z14.string().min(1).max(80),
3077
+ var PasskeySignInVerifyRequest = z15.object({
3078
+ challengeId: z15.string(),
3079
+ response: z15.unknown(),
3080
+ deviceName: z15.string().min(1).max(80),
3001
3081
  kind: DeviceKind.extract(["browser", "pwa"])
3002
3082
  });
3003
- var OidcBeginRequest = z14.object({
3004
- deviceName: z14.string().min(1).max(80),
3083
+ var OidcBeginRequest = z15.object({
3084
+ deviceName: z15.string().min(1).max(80),
3005
3085
  kind: DeviceKind.extract(["browser", "pwa"]),
3006
- next: z14.string().default("/"),
3007
- handoff: z14.boolean().default(false)
3008
- });
3009
- var OidcBeginResponse = z14.object({
3010
- authorizeUrl: z14.string(),
3011
- flowId: z14.string().nullable(),
3012
- pollToken: z14.string().nullable()
3013
- });
3014
- var OidcClaimRequest = z14.object({ flowId: z14.string(), pollToken: z14.string() });
3015
- var OidcClaimResponse = z14.union([
3016
- z14.object({ status: z14.literal("pending") }),
3017
- z14.object({ status: z14.literal("done"), deviceId: z14.string() })
3086
+ next: z15.string().default("/"),
3087
+ handoff: z15.boolean().default(false)
3088
+ });
3089
+ var OidcBeginResponse = z15.object({
3090
+ authorizeUrl: z15.string(),
3091
+ flowId: z15.string().nullable(),
3092
+ pollToken: z15.string().nullable()
3093
+ });
3094
+ var OidcClaimRequest = z15.object({ flowId: z15.string(), pollToken: z15.string() });
3095
+ var OidcClaimResponse = z15.union([
3096
+ z15.object({ status: z15.literal("pending") }),
3097
+ z15.object({ status: z15.literal("done"), deviceId: z15.string() })
3018
3098
  ]);
3019
- var TerminalLoginStartRequest = z14.object({ name: z14.string().min(1).max(80) });
3020
- var TerminalLoginStartResponse = z14.object({
3021
- userCode: z14.string(),
3022
- pollToken: z14.string(),
3023
- verifyUrl: z14.string(),
3024
- expiresAt: z14.string(),
3025
- intervalMs: z14.number().int()
3026
- });
3027
- var TerminalLoginClaimRequest = z14.object({
3028
- userCode: z14.string().min(1),
3029
- pollToken: z14.string().min(1)
3030
- });
3031
- var TerminalLoginClaimResponse = z14.union([
3032
- z14.object({ status: z14.literal("pending") }),
3033
- z14.object({ status: z14.literal("denied") }),
3034
- z14.object({ status: z14.literal("done"), deviceId: z14.string(), credential: z14.string() })
3099
+ var TerminalLoginStartRequest = z15.object({ name: z15.string().min(1).max(80) });
3100
+ var TerminalLoginStartResponse = z15.object({
3101
+ userCode: z15.string(),
3102
+ pollToken: z15.string(),
3103
+ verifyUrl: z15.string(),
3104
+ expiresAt: z15.string(),
3105
+ intervalMs: z15.number().int()
3106
+ });
3107
+ var TerminalLoginClaimRequest = z15.object({
3108
+ userCode: z15.string().min(1),
3109
+ pollToken: z15.string().min(1)
3110
+ });
3111
+ var TerminalLoginClaimResponse = z15.union([
3112
+ z15.object({ status: z15.literal("pending") }),
3113
+ z15.object({ status: z15.literal("denied") }),
3114
+ z15.object({ status: z15.literal("done"), deviceId: z15.string(), credential: z15.string() })
3035
3115
  ]);
3036
- var TerminalLoginRequest = z14.object({
3037
- userCode: z14.string(),
3038
- name: z14.string(),
3039
- requestedFrom: z14.string(),
3040
- createdAt: z14.string(),
3041
- expiresAt: z14.string(),
3042
- status: z14.enum(["pending", "approved", "denied"])
3043
- });
3044
- var AuthMethods = z14.object({
3045
- passkeys: z14.array(Passkey),
3046
- passkeyAvailability: z14.object({ available: z14.boolean(), reason: z14.string().nullable() }),
3047
- oidc: z14.object({
3048
- issuer: z14.string(),
3049
- label: z14.string(),
3050
- ownerMatch: z14.string(),
3051
- status: z14.enum(["ready", "error"]),
3052
- error: z14.string().nullable()
3116
+ var TerminalLoginRequest = z15.object({
3117
+ userCode: z15.string(),
3118
+ name: z15.string(),
3119
+ requestedFrom: z15.string(),
3120
+ createdAt: z15.string(),
3121
+ expiresAt: z15.string(),
3122
+ status: z15.enum(["pending", "approved", "denied"])
3123
+ });
3124
+ var AuthMethods = z15.object({
3125
+ passkeys: z15.array(Passkey),
3126
+ passkeyAvailability: z15.object({ available: z15.boolean(), reason: z15.string().nullable() }),
3127
+ oidc: z15.object({
3128
+ issuer: z15.string(),
3129
+ label: z15.string(),
3130
+ ownerMatch: z15.string(),
3131
+ status: z15.enum(["ready", "error"]),
3132
+ error: z15.string().nullable()
3053
3133
  }).nullable()
3054
3134
  });
3055
- var MeResponse = z14.object({
3135
+ var MeResponse = z15.object({
3056
3136
  device: Device,
3057
- admin: z14.boolean(),
3058
- publicUrl: z14.string()
3137
+ admin: z15.boolean(),
3138
+ publicUrl: z15.string()
3059
3139
  });
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"
3140
+ var ClientBindingInput = z15.object({ mirror: ClientMirror, scopeId: z15.string().min(1).nullable().optional() }).refine((b) => b.mirror === "scope" === !!b.scopeId, {
3141
+ message: "scopeId is required for mirror=scope and only then"
3062
3142
  });
3063
- var TerminalReport = Terminal.pick({ kind: true, name: true, machine: true }).extend({
3064
- hostId: z14.string().nullable().optional(),
3143
+ var ClientReport = Client.pick({ kind: true, name: true, machine: true }).extend({
3144
+ hostId: z15.string().nullable().optional(),
3065
3145
  /** Sessions in its mirror tabs or windows; omitted when unchanged or unknown. */
3066
- 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 });
3088
- var ProjectSuggestionsResponse = z14.object({
3089
- suggestions: z14.array(ProjectSuggestion.extend({ name: z14.string(), preselected: z14.boolean() }))
3146
+ shows: z15.array(z15.string()).max(1e3).optional(),
3147
+ /** The binding this client had before bindings were recorded (env file); applied only when none is recorded. */
3148
+ seed: ClientBindingInput.optional()
3149
+ });
3150
+ var ScopeInput = z15.object({
3151
+ name: Scope.shape.name,
3152
+ mode: Scope.shape.mode.optional(),
3153
+ projectIds: Scope.shape.projectIds.optional(),
3154
+ hostIds: Scope.shape.hostIds.optional(),
3155
+ /** A GitHub source makes this a GitHub scope; its projects are then kept by GitHub. */
3156
+ source: GitHubSourceInput.nullable().optional()
3157
+ });
3158
+ var ScopePatch = z15.object({
3159
+ name: Scope.shape.name.optional(),
3160
+ mode: Scope.shape.mode.optional(),
3161
+ projectIds: Scope.shape.projectIds.optional(),
3162
+ hostIds: Scope.shape.hostIds.optional(),
3163
+ /** null removes the source; an object changes it, or adds one (then hostId and owner are required). */
3164
+ source: GitHubSourcePatch.nullable().optional()
3165
+ });
3166
+ var ProjectSuggestionsResponse = z15.object({
3167
+ suggestions: z15.array(ProjectSuggestion.extend({ name: z15.string(), preselected: z15.boolean() }))
3090
3168
  });
3091
3169
 
3092
- // packages/protocol/dist/views.js
3093
- var TERMINAL_OPEN_MS = 10 * 6e4;
3170
+ // packages/protocol/dist/scopes.js
3171
+ var CLIENT_OPEN_MS = 10 * 6e4;
3094
3172
 
3095
3173
  // packages/protocol/dist/client-wire.js
3096
- import { z as z15 } from "zod";
3097
- var SyncState = z15.object({
3098
- hosts: z15.array(Host),
3099
- projects: z15.array(Project),
3100
- checkouts: z15.array(Checkout),
3101
- workspaces: z15.array(Workspace),
3102
- profiles: z15.array(Profile),
3103
- views: z15.array(View),
3104
- sessions: z15.array(Session),
3105
- tasks: z15.array(Task),
3106
- runs: z15.array(Run),
3107
- automations: z15.array(Automation),
3108
- attention: z15.array(AttentionItem),
3109
- interactions: z15.array(Interaction),
3110
- panels: z15.array(Panel),
3111
- devices: z15.array(Device),
3174
+ import { z as z16 } from "zod";
3175
+ var SyncState = z16.object({
3176
+ hosts: z16.array(Host),
3177
+ projects: z16.array(Project),
3178
+ checkouts: z16.array(Checkout),
3179
+ workspaces: z16.array(Workspace),
3180
+ profiles: z16.array(Profile),
3181
+ /** Scopes; absent from coordinators before 0.21. */
3182
+ scopes: z16.array(Scope).default([]),
3183
+ sessions: z16.array(Session),
3184
+ tasks: z16.array(Task),
3185
+ runs: z16.array(Run),
3186
+ automations: z16.array(Automation),
3187
+ attention: z16.array(AttentionItem),
3188
+ interactions: z16.array(Interaction),
3189
+ panels: z16.array(Panel),
3190
+ devices: z16.array(Device),
3112
3191
  /** Tracked issues; absent from older coordinators. */
3113
- 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(),
3118
- adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
3119
- dispatchPaused: z15.boolean()
3120
- });
3121
- var Presence = z15.object({
3122
- foreground: z15.boolean(),
3123
- interactedAt: z15.string().nullable(),
3124
- viewing: z15.object({ sessionId: z15.string() }).nullable(),
3192
+ issues: z16.array(TrackedIssue).default([]),
3193
+ /** Clients (herdr and tmux sessions); absent from coordinators before 0.21. */
3194
+ clients: z16.array(Client).default([]),
3195
+ adapters: z16.record(z16.string(), z16.array(AdapterInfo)),
3196
+ dispatchPaused: z16.boolean()
3197
+ });
3198
+ var Presence = z16.object({
3199
+ foreground: z16.boolean(),
3200
+ interactedAt: z16.string().nullable(),
3201
+ viewing: z16.object({ sessionId: z16.string() }).nullable(),
3125
3202
  /**
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.
3203
+ * A herdr or tmux daemon reporting the session focused in its client (kept apart from the
3204
+ * device's own presence).
3128
3205
  */
3129
- terminalId: z15.string().min(1).max(200).optional()
3130
- });
3131
- var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
3132
- var ClientToServer = z15.discriminatedUnion("type", [
3133
- z15.object({
3134
- type: z15.literal("hello"),
3135
- cursor: z15.number().int().nullable(),
3136
- capabilities: z15.array(z15.string().min(1).max(80)).max(32).optional(),
3137
- projectionId: z15.string().max(256).nullable().optional()
3206
+ clientId: z16.string().min(1).max(200).optional(),
3207
+ /** COMPAT(scopes-rename): remove after 2027-03-01. The old name of clientId. */
3208
+ terminalId: z16.string().min(1).max(200).optional()
3209
+ });
3210
+ var CLIENT_CAPABILITIES = [
3211
+ "adapter.slots.v1",
3212
+ "timeline.cards.v1",
3213
+ "scopes.v1",
3214
+ /** The client reads `ToolItemData.view`. */
3215
+ "tool.views.v1",
3216
+ /** The client draws checklist, facts, rows and badge nodes, `section.open` and URL refs. */
3217
+ "ui.nodes.v2",
3218
+ /** The client draws `composer.tracker` and `session.badge` contributions. */
3219
+ "adapter.trackers.v1"
3220
+ ];
3221
+ var ClientToServer = z16.discriminatedUnion("type", [
3222
+ z16.object({
3223
+ type: z16.literal("hello"),
3224
+ cursor: z16.number().int().nullable(),
3225
+ capabilities: z16.array(z16.string().min(1).max(80)).max(32).optional(),
3226
+ projectionId: z16.string().max(256).nullable().optional()
3138
3227
  }),
3139
- z15.object({ type: z15.literal("presence"), presence: Presence }),
3140
- z15.object({ type: z15.literal("ping") })
3228
+ z16.object({ type: z16.literal("presence"), presence: Presence }),
3229
+ z16.object({ type: z16.literal("ping") })
3141
3230
  ]);
3142
- var ServerToClient = z15.discriminatedUnion("type", [
3143
- z15.object({
3144
- type: z15.literal("replay"),
3145
- seq: z15.number().int(),
3146
- events: z15.array(EventEnvelope),
3147
- capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
3148
- projectionId: z15.string().optional()
3231
+ var ServerToClient = z16.discriminatedUnion("type", [
3232
+ z16.object({
3233
+ type: z16.literal("replay"),
3234
+ seq: z16.number().int(),
3235
+ events: z16.array(EventEnvelope),
3236
+ capabilities: z16.array(z16.enum(CLIENT_CAPABILITIES)).optional(),
3237
+ projectionId: z16.string().optional()
3149
3238
  }),
3150
- z15.object({
3151
- type: z15.literal("snapshot"),
3152
- seq: z15.number().int(),
3239
+ z16.object({
3240
+ type: z16.literal("snapshot"),
3241
+ seq: z16.number().int(),
3153
3242
  state: SyncState,
3154
- capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
3155
- projectionId: z15.string().optional()
3243
+ capabilities: z16.array(z16.enum(CLIENT_CAPABILITIES)).optional(),
3244
+ projectionId: z16.string().optional()
3156
3245
  }),
3157
- z15.object({ type: z15.literal("event"), event: EventEnvelope }),
3158
- z15.object({ type: z15.literal("stream"), delta: StreamDelta }),
3159
- z15.object({ type: z15.literal("pong") }),
3160
- z15.object({ type: z15.literal("force_logout"), reason: z15.string() })
3246
+ z16.object({ type: z16.literal("event"), event: EventEnvelope }),
3247
+ z16.object({ type: z16.literal("stream"), delta: StreamDelta }),
3248
+ z16.object({ type: z16.literal("pong") }),
3249
+ z16.object({ type: z16.literal("force_logout"), reason: z16.string() })
3161
3250
  ]);
3162
3251
 
3163
3252
  // packages/protocol/dist/ids.js
@@ -3165,17 +3254,17 @@ import { monotonicFactory } from "ulid";
3165
3254
  var ulid = monotonicFactory();
3166
3255
 
3167
3256
  // packages/protocol/dist/web-bridge.js
3168
- import { z as z16 } from "zod";
3257
+ import { z as z17 } from "zod";
3169
3258
  var FRAME_MAX_HEIGHT = 4e3;
3170
- var FrameToParentMessageSchema = z16.discriminatedUnion("type", [
3171
- z16.object({
3172
- type: z16.literal("action"),
3173
- actionId: z16.string().min(1).max(200),
3174
- payload: z16.unknown().optional()
3259
+ var FrameToParentMessageSchema = z17.discriminatedUnion("type", [
3260
+ z17.object({
3261
+ type: z17.literal("action"),
3262
+ actionId: z17.string().min(1).max(200),
3263
+ payload: z17.unknown().optional()
3175
3264
  }),
3176
- z16.object({
3177
- type: z16.literal("resize"),
3178
- height: z16.number().finite().min(0).max(FRAME_MAX_HEIGHT)
3265
+ z17.object({
3266
+ type: z17.literal("resize"),
3267
+ height: z17.number().finite().min(0).max(FRAME_MAX_HEIGHT)
3179
3268
  })
3180
3269
  ]);
3181
3270