@spencerboucher/switchyard 0.13.0 → 0.15.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.
- package/README.md +4 -3
- package/dist/bridge/agent-channel.js +26 -0
- package/dist/bridge/enroll.js +55 -0
- package/dist/bridge/resource-snapshot.js +47 -0
- package/dist/bridge/socket-paths.js +57 -0
- package/dist/bridge/state-dir.js +17 -0
- package/dist/bridge/switchyard-bridge.js +11 -0
- package/dist/bridge/switchyard-terminal.js +251 -23
- package/dist/policies/worker.js +1951 -1431
- package/dist/switchyard.mjs +5108 -2426
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-CMDz-eFh.js +2 -0
- package/web-dist/assets/{AutomationView-Cg7yk8nb.js.map → AutomationView-CMDz-eFh.js.map} +1 -1
- package/web-dist/assets/{jsx-runtime-D13aM9HY.js → Button-BKQW9doW.js} +2 -2
- package/web-dist/assets/Button-BKQW9doW.js.map +1 -0
- package/web-dist/assets/Card-WONLvqGM.js +2 -0
- package/web-dist/assets/{Card-sHm0eI2Q.js.map → Card-WONLvqGM.js.map} +1 -1
- package/web-dist/assets/Checkbox-D18Ch0n4.js +2 -0
- package/web-dist/assets/{Checkbox-CEvKyfJz.js.map → Checkbox-D18Ch0n4.js.map} +1 -1
- package/web-dist/assets/Copy-D6U5ewFc.js +2 -0
- package/web-dist/assets/{Copy-BHOLVthK.js.map → Copy-D6U5ewFc.js.map} +1 -1
- package/web-dist/assets/{DangerZone-og55TRug.js → DangerZone-Ch2KNmob.js} +2 -2
- package/web-dist/assets/{DangerZone-og55TRug.js.map → DangerZone-Ch2KNmob.js.map} +1 -1
- package/web-dist/assets/InteractionCard-Bhur-sU9.js +4 -0
- package/web-dist/assets/InteractionCard-Bhur-sU9.js.map +1 -0
- package/web-dist/assets/Menu-dT22Gwzm.js +2 -0
- package/web-dist/assets/Menu-dT22Gwzm.js.map +1 -0
- package/web-dist/assets/Overlay-zQBNtPf6.js +2 -0
- package/web-dist/assets/Overlay-zQBNtPf6.js.map +1 -0
- package/web-dist/assets/Priority-CgO3ns6b.js +2 -0
- package/web-dist/assets/{Priority-xSUsxoXm.js.map → Priority-CgO3ns6b.js.map} +1 -1
- package/web-dist/assets/SegmentedControl-D2kj3j7u.js +2 -0
- package/web-dist/assets/SegmentedControl-D2kj3j7u.js.map +1 -0
- package/web-dist/assets/Select-CpWLZnId.js +2 -0
- package/web-dist/assets/{Select-C5xlhWYb.js.map → Select-CpWLZnId.js.map} +1 -1
- package/web-dist/assets/Switch-DHX-YYPr.js +2 -0
- package/web-dist/assets/{Switch-dVcf-7Je.js.map → Switch-DHX-YYPr.js.map} +1 -1
- package/web-dist/assets/Tabs-DZ2T9VBY.js +184 -0
- package/web-dist/assets/Tabs-DZ2T9VBY.js.map +1 -0
- package/web-dist/assets/TextArea-BQPdfjO_.js +2 -0
- package/web-dist/assets/{TextArea-D8WB5GD8.js.map → TextArea-BQPdfjO_.js.map} +1 -1
- package/web-dist/assets/TextLink-CCc3WEdm.js +2 -0
- package/web-dist/assets/{TextLink-CrfA8AeH.js.map → TextLink-CCc3WEdm.js.map} +1 -1
- package/web-dist/assets/UINodeRenderer-JQy6g7ZB.js +4 -0
- package/web-dist/assets/UINodeRenderer-JQy6g7ZB.js.map +1 -0
- package/web-dist/assets/arrow-down-YwTzxo-r.js +2 -0
- package/web-dist/assets/{arrow-down-C-iLrN8I.js.map → arrow-down-YwTzxo-r.js.map} +1 -1
- package/web-dist/assets/arrow-up-Bzh112dp.js +2 -0
- package/web-dist/assets/{arrow-up-Dj-VTKx4.js.map → arrow-up-Bzh112dp.js.map} +1 -1
- package/web-dist/assets/attention-DrHtkJHs.js +2 -0
- package/web-dist/assets/attention-DrHtkJHs.js.map +1 -0
- package/web-dist/assets/automations-TOhPm8sF.js +2 -0
- package/web-dist/assets/automations-TOhPm8sF.js.map +1 -0
- package/web-dist/assets/board-BZWPMk0Z.js +10 -0
- package/web-dist/assets/board-BZWPMk0Z.js.map +1 -0
- package/web-dist/assets/calendar-clock-CwOgyN2z.js +2 -0
- package/web-dist/assets/{calendar-clock-B8zE4JsX.js.map → calendar-clock-CwOgyN2z.js.map} +1 -1
- package/web-dist/assets/chevron-right-aaHL5Igi.js +2 -0
- package/web-dist/assets/{chevron-right-evVLS6hq.js.map → chevron-right-aaHL5Igi.js.map} +1 -1
- package/web-dist/assets/code-DVA5CKfS.js +25 -0
- package/web-dist/assets/code-DVA5CKfS.js.map +1 -0
- package/web-dist/assets/{describe-w4KmQFfU.js → describe-CtmmeUfI.js} +3 -3
- package/web-dist/assets/{describe-w4KmQFfU.js.map → describe-CtmmeUfI.js.map} +1 -1
- package/web-dist/assets/drafts-BP2GMlHS.js +13 -0
- package/web-dist/assets/drafts-BP2GMlHS.js.map +1 -0
- package/web-dist/assets/enroll-C4m0rxHw.js +2 -0
- package/web-dist/assets/{enroll-DPKdD0en.js.map → enroll-C4m0rxHw.js.map} +1 -1
- package/web-dist/assets/external-link-CI-Uzhfh.js +2 -0
- package/web-dist/assets/{external-link-3jjTxo92.js.map → external-link-CI-Uzhfh.js.map} +1 -1
- package/web-dist/assets/hand-HCdmhGph.js +2 -0
- package/web-dist/assets/{hand-UPoHamrn.js.map → hand-HCdmhGph.js.map} +1 -1
- package/web-dist/assets/index-LsagdEq-.js +11 -0
- package/web-dist/assets/index-LsagdEq-.js.map +1 -0
- package/web-dist/assets/index-f4tQ91xN.css +2 -0
- package/web-dist/assets/key-round-DIA3lje5.js +2 -0
- package/web-dist/assets/{key-round-VDbE9E4X.js.map → key-round-DIA3lje5.js.map} +1 -1
- package/web-dist/assets/link-2-D6l0YZ-8.js +2 -0
- package/web-dist/assets/{link-2-CaMlUDRG.js.map → link-2-D6l0YZ-8.js.map} +1 -1
- package/web-dist/assets/logic-CzU-NdeO.js +2 -0
- package/web-dist/assets/{logic-B46fwD-8.js.map → logic-CzU-NdeO.js.map} +1 -1
- package/web-dist/assets/more-BonXabXm.js +2 -0
- package/web-dist/assets/more-BonXabXm.js.map +1 -0
- package/web-dist/assets/pencil-BtK08_f_.js +2 -0
- package/web-dist/assets/{pencil-DI8QbCN8.js.map → pencil-BtK08_f_.js.map} +1 -1
- package/web-dist/assets/play-j138GLHB.js +2 -0
- package/web-dist/assets/{play-CjoDg3ws.js.map → play-j138GLHB.js.map} +1 -1
- package/web-dist/assets/plus-D935l0Os.js +2 -0
- package/web-dist/assets/{plus-BLP-wIYD.js.map → plus-D935l0Os.js.map} +1 -1
- package/web-dist/assets/{policyLogic-7OOzM_xa.js → policyLogic-nqL3E08V.js} +2 -2
- package/web-dist/assets/{policyLogic-7OOzM_xa.js.map → policyLogic-nqL3E08V.js.map} +1 -1
- package/web-dist/assets/preload-helper-DOFsWE7_.js +3 -0
- package/web-dist/assets/preload-helper-DOFsWE7_.js.map +1 -0
- package/web-dist/assets/presence-BnGwJNSq.js +2 -0
- package/web-dist/assets/{presence-05bJD5G3.js.map → presence-BnGwJNSq.js.map} +1 -1
- package/web-dist/assets/queue-p_rnOc-9.js +2 -0
- package/web-dist/assets/queue-p_rnOc-9.js.map +1 -0
- package/web-dist/assets/registry-D8Ph1G2W.js +2 -0
- package/web-dist/assets/registry-D8Ph1G2W.js.map +1 -0
- package/web-dist/assets/{repo-BA_bnCvu.js → repo-3GZtN4L8.js} +2 -2
- package/web-dist/assets/{repo-BA_bnCvu.js.map → repo-3GZtN4L8.js.map} +1 -1
- package/web-dist/assets/settings-jyGW1LsI.js +9 -0
- package/web-dist/assets/settings-jyGW1LsI.js.map +1 -0
- package/web-dist/assets/states-BXOts8eT.js +58 -0
- package/web-dist/assets/states-BXOts8eT.js.map +1 -0
- package/web-dist/assets/terminal-DKqo1lis.js +2 -0
- package/web-dist/assets/{terminal-BOV_MXPZ.js.map → terminal-DKqo1lis.js.map} +1 -1
- package/web-dist/assets/terminal-login-j20zSRZp.js +2 -0
- package/web-dist/assets/{terminal-login-C0n8cXqn.js.map → terminal-login-j20zSRZp.js.map} +1 -1
- package/web-dist/assets/timer-CyFp7DQs.js +2 -0
- package/web-dist/assets/{timer-BCIucSXh.js.map → timer-CyFp7DQs.js.map} +1 -1
- package/web-dist/assets/useBreakpoint-kT0J1Dnk.js +2 -0
- package/web-dist/assets/{useBreakpoint-CYDIV-KM.js.map → useBreakpoint-kT0J1Dnk.js.map} +1 -1
- package/web-dist/assets/useNow-DfER3XvS.js +2 -0
- package/web-dist/assets/useNow-DfER3XvS.js.map +1 -0
- package/web-dist/assets/useResource-DhvWL_9X.js +2 -0
- package/web-dist/assets/{useResource-DHtFcID5.js.map → useResource-DhvWL_9X.js.map} +1 -1
- package/web-dist/index.html +13 -12
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-Cg7yk8nb.js +0 -2
- package/web-dist/assets/Card-sHm0eI2Q.js +0 -2
- package/web-dist/assets/Checkbox-CEvKyfJz.js +0 -2
- package/web-dist/assets/Copy-BHOLVthK.js +0 -2
- package/web-dist/assets/InteractionCard-B-yhxwKs.js +0 -6
- package/web-dist/assets/InteractionCard-B-yhxwKs.js.map +0 -1
- package/web-dist/assets/Menu-Cyt18mF2.js +0 -2
- package/web-dist/assets/Menu-Cyt18mF2.js.map +0 -1
- package/web-dist/assets/Overlay-BPNYBq3V.js +0 -2
- package/web-dist/assets/Overlay-BPNYBq3V.js.map +0 -1
- package/web-dist/assets/Priority-xSUsxoXm.js +0 -2
- package/web-dist/assets/SegmentedControl-DaBwumC0.js +0 -2
- package/web-dist/assets/SegmentedControl-DaBwumC0.js.map +0 -1
- package/web-dist/assets/Select-C5xlhWYb.js +0 -2
- package/web-dist/assets/Switch-dVcf-7Je.js +0 -2
- package/web-dist/assets/Tabs-93APobOB.js +0 -184
- package/web-dist/assets/Tabs-93APobOB.js.map +0 -1
- package/web-dist/assets/TextArea-D8WB5GD8.js +0 -2
- package/web-dist/assets/TextLink-CrfA8AeH.js +0 -2
- package/web-dist/assets/arrow-down-C-iLrN8I.js +0 -2
- package/web-dist/assets/arrow-up-Dj-VTKx4.js +0 -2
- package/web-dist/assets/attention-C8rfu6Uw.js +0 -2
- package/web-dist/assets/attention-C8rfu6Uw.js.map +0 -1
- package/web-dist/assets/automations-DQxUzi5Q.js +0 -2
- package/web-dist/assets/automations-DQxUzi5Q.js.map +0 -1
- package/web-dist/assets/board-aS6ooJpx.js +0 -10
- package/web-dist/assets/board-aS6ooJpx.js.map +0 -1
- package/web-dist/assets/calendar-clock-B8zE4JsX.js +0 -2
- package/web-dist/assets/chevron-right-evVLS6hq.js +0 -2
- package/web-dist/assets/code-Zr5DqwWI.js +0 -25
- package/web-dist/assets/code-Zr5DqwWI.js.map +0 -1
- package/web-dist/assets/enroll-DPKdD0en.js +0 -2
- package/web-dist/assets/external-link-3jjTxo92.js +0 -2
- package/web-dist/assets/hand-UPoHamrn.js +0 -2
- package/web-dist/assets/index-DFNY2EUd.css +0 -2
- package/web-dist/assets/index-DPScWz2I.js +0 -11
- package/web-dist/assets/index-DPScWz2I.js.map +0 -1
- package/web-dist/assets/jsx-runtime-D13aM9HY.js.map +0 -1
- package/web-dist/assets/key-round-VDbE9E4X.js +0 -2
- package/web-dist/assets/link-2-CaMlUDRG.js +0 -2
- package/web-dist/assets/logic-B46fwD-8.js +0 -2
- package/web-dist/assets/more-CiyGP5GD.js +0 -2
- package/web-dist/assets/more-CiyGP5GD.js.map +0 -1
- package/web-dist/assets/pencil-DI8QbCN8.js +0 -2
- package/web-dist/assets/play-CjoDg3ws.js +0 -2
- package/web-dist/assets/plus-BLP-wIYD.js +0 -2
- package/web-dist/assets/preload-helper-B2m1UyXR.js +0 -13
- package/web-dist/assets/preload-helper-B2m1UyXR.js.map +0 -1
- package/web-dist/assets/presence-05bJD5G3.js +0 -2
- package/web-dist/assets/queue-BcbJqzTY.js +0 -2
- package/web-dist/assets/queue-BcbJqzTY.js.map +0 -1
- package/web-dist/assets/settings-D03MF_Kx.js +0 -7
- package/web-dist/assets/settings-D03MF_Kx.js.map +0 -1
- package/web-dist/assets/shared-Bxc2JM1K.js +0 -3
- package/web-dist/assets/shared-Bxc2JM1K.js.map +0 -1
- package/web-dist/assets/states-DynH8-o6.js +0 -58
- package/web-dist/assets/states-DynH8-o6.js.map +0 -1
- package/web-dist/assets/terminal-BOV_MXPZ.js +0 -2
- package/web-dist/assets/terminal-login-C0n8cXqn.js +0 -2
- package/web-dist/assets/timer-BCIucSXh.js +0 -2
- package/web-dist/assets/useBreakpoint-CYDIV-KM.js +0 -2
- package/web-dist/assets/useNow-0tMsLHnB.js +0 -2
- package/web-dist/assets/useNow-0tMsLHnB.js.map +0 -1
- package/web-dist/assets/useResource-DHtFcID5.js +0 -2
package/dist/policies/worker.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
import { parentPort } from "node:worker_threads";
|
|
3
3
|
import { Environment } from "@marcbachmann/cel-js";
|
|
4
4
|
|
|
5
|
-
// packages/protocol/dist/
|
|
5
|
+
// packages/protocol/dist/adapter-preview.js
|
|
6
|
+
import { z as z8 } from "zod";
|
|
7
|
+
|
|
8
|
+
// packages/protocol/dist/contributions.js
|
|
6
9
|
import { z as z3 } from "zod";
|
|
7
10
|
|
|
11
|
+
// packages/protocol/dist/ui.js
|
|
12
|
+
import { z as z2 } from "zod";
|
|
13
|
+
|
|
8
14
|
// packages/protocol/dist/errors.js
|
|
9
15
|
import { z } from "zod";
|
|
10
16
|
var ERROR_CODES = [
|
|
@@ -44,23 +50,574 @@ var ErrorBody = z.object({
|
|
|
44
50
|
details: z.unknown().optional()
|
|
45
51
|
});
|
|
46
52
|
var ApiError = z.object({ error: ErrorBody });
|
|
53
|
+
var SwitchyardError = class extends Error {
|
|
54
|
+
code;
|
|
55
|
+
details;
|
|
56
|
+
constructor(code, message, details) {
|
|
57
|
+
super(message);
|
|
58
|
+
this.name = "SwitchyardError";
|
|
59
|
+
this.code = code;
|
|
60
|
+
this.details = details;
|
|
61
|
+
}
|
|
62
|
+
toBody() {
|
|
63
|
+
return this.details === void 0 ? { code: this.code, message: this.message } : { code: this.code, message: this.message, details: this.details };
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// packages/protocol/dist/ui.js
|
|
68
|
+
var ToneSchema = z2.enum(["default", "muted", "success", "warning", "danger"]);
|
|
69
|
+
var ShowIfSchema = z2.object({ field: z2.string(), values: z2.array(z2.string()) });
|
|
70
|
+
var OptionSchema = z2.object({
|
|
71
|
+
value: z2.string(),
|
|
72
|
+
label: z2.string(),
|
|
73
|
+
description: z2.string().optional(),
|
|
74
|
+
preview: z2.string().optional()
|
|
75
|
+
});
|
|
76
|
+
var AllowOther = z2.object({ label: z2.string(), placeholder: z2.string().optional() });
|
|
77
|
+
var FieldSchema = z2.discriminatedUnion("kind", [
|
|
78
|
+
z2.object({
|
|
79
|
+
kind: z2.literal("select"),
|
|
80
|
+
name: z2.string(),
|
|
81
|
+
label: z2.string(),
|
|
82
|
+
options: z2.array(OptionSchema),
|
|
83
|
+
allowOther: AllowOther.optional(),
|
|
84
|
+
showIf: ShowIfSchema.optional()
|
|
85
|
+
}),
|
|
86
|
+
z2.object({
|
|
87
|
+
kind: z2.literal("multiselect"),
|
|
88
|
+
name: z2.string(),
|
|
89
|
+
label: z2.string(),
|
|
90
|
+
options: z2.array(OptionSchema),
|
|
91
|
+
allowOther: AllowOther.optional(),
|
|
92
|
+
min: z2.number().int().min(0).optional(),
|
|
93
|
+
max: z2.number().int().min(1).optional(),
|
|
94
|
+
showIf: ShowIfSchema.optional()
|
|
95
|
+
}),
|
|
96
|
+
z2.object({
|
|
97
|
+
kind: z2.literal("text"),
|
|
98
|
+
name: z2.string(),
|
|
99
|
+
label: z2.string(),
|
|
100
|
+
placeholder: z2.string().optional(),
|
|
101
|
+
multiline: z2.boolean().optional(),
|
|
102
|
+
prefill: z2.string().optional(),
|
|
103
|
+
showIf: ShowIfSchema.optional()
|
|
104
|
+
})
|
|
105
|
+
]);
|
|
106
|
+
var RefSchema = z2.discriminatedUnion("kind", [
|
|
107
|
+
z2.object({ kind: z2.literal("file"), path: z2.string() }),
|
|
108
|
+
z2.object({ kind: z2.literal("session"), sessionId: z2.string() }),
|
|
109
|
+
z2.object({ kind: z2.literal("task"), taskId: z2.string() }),
|
|
110
|
+
z2.object({ kind: z2.literal("native_session"), hostId: z2.string(), sessionFile: z2.string() })
|
|
111
|
+
]);
|
|
112
|
+
var UINodeSchema = z2.lazy(() => z2.discriminatedUnion("t", [
|
|
113
|
+
z2.object({ t: z2.literal("text"), text: z2.string(), tone: ToneSchema.optional() }),
|
|
114
|
+
z2.object({ t: z2.literal("markdown"), text: z2.string() }),
|
|
115
|
+
z2.object({ t: z2.literal("code"), text: z2.string(), lang: z2.string().optional() }),
|
|
116
|
+
z2.object({ t: z2.literal("diff"), patch: z2.string() }),
|
|
117
|
+
z2.object({
|
|
118
|
+
t: z2.literal("list"),
|
|
119
|
+
items: z2.array(UINodeSchema),
|
|
120
|
+
ordered: z2.boolean().optional()
|
|
121
|
+
}),
|
|
122
|
+
z2.object({
|
|
123
|
+
t: z2.literal("table"),
|
|
124
|
+
columns: z2.array(z2.string()),
|
|
125
|
+
rows: z2.array(z2.array(z2.string()))
|
|
126
|
+
}),
|
|
127
|
+
z2.object({
|
|
128
|
+
t: z2.literal("section"),
|
|
129
|
+
title: z2.string().optional(),
|
|
130
|
+
collapsible: z2.boolean().optional(),
|
|
131
|
+
children: z2.array(UINodeSchema)
|
|
132
|
+
}),
|
|
133
|
+
z2.object({
|
|
134
|
+
t: z2.literal("tabs"),
|
|
135
|
+
tabs: z2.array(z2.object({ id: z2.string(), label: z2.string(), children: z2.array(UINodeSchema) }))
|
|
136
|
+
}),
|
|
137
|
+
z2.object({
|
|
138
|
+
t: z2.literal("progress"),
|
|
139
|
+
label: z2.string(),
|
|
140
|
+
value: z2.number().min(0).max(1).optional(),
|
|
141
|
+
status: z2.enum(["running", "ok", "error"]).optional()
|
|
142
|
+
}),
|
|
143
|
+
z2.object({ t: z2.literal("ref"), ref: RefSchema, label: z2.string() }),
|
|
144
|
+
z2.object({
|
|
145
|
+
t: z2.literal("form"),
|
|
146
|
+
formId: z2.string(),
|
|
147
|
+
fields: z2.array(FieldSchema),
|
|
148
|
+
submitLabel: z2.string(),
|
|
149
|
+
cancelLabel: z2.string().optional()
|
|
150
|
+
}),
|
|
151
|
+
z2.object({
|
|
152
|
+
t: z2.literal("confirm"),
|
|
153
|
+
message: z2.string(),
|
|
154
|
+
confirmLabel: z2.string(),
|
|
155
|
+
cancelLabel: z2.string(),
|
|
156
|
+
destructive: z2.boolean().optional()
|
|
157
|
+
}),
|
|
158
|
+
z2.object({
|
|
159
|
+
t: z2.literal("actions"),
|
|
160
|
+
actions: z2.array(z2.object({
|
|
161
|
+
id: z2.string(),
|
|
162
|
+
label: z2.string(),
|
|
163
|
+
tone: z2.enum(["default", "primary", "danger"]).optional()
|
|
164
|
+
}))
|
|
165
|
+
})
|
|
166
|
+
]));
|
|
167
|
+
var UI_MAX_DEPTH = 12;
|
|
168
|
+
var UI_MAX_NODES = 2e3;
|
|
169
|
+
function children(node) {
|
|
170
|
+
switch (node.t) {
|
|
171
|
+
case "list":
|
|
172
|
+
return node.items;
|
|
173
|
+
case "section":
|
|
174
|
+
return node.children;
|
|
175
|
+
case "tabs":
|
|
176
|
+
return node.tabs.flatMap((tab) => tab.children);
|
|
177
|
+
default:
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function validateUINode(input) {
|
|
182
|
+
const node = UINodeSchema.parse(input);
|
|
183
|
+
let count = 0;
|
|
184
|
+
const walk = (n, depth) => {
|
|
185
|
+
count++;
|
|
186
|
+
if (depth > UI_MAX_DEPTH) {
|
|
187
|
+
throw new SwitchyardError("ui_tree_too_large", `UI tree deeper than ${UI_MAX_DEPTH}`);
|
|
188
|
+
}
|
|
189
|
+
if (count > UI_MAX_NODES) {
|
|
190
|
+
throw new SwitchyardError("ui_tree_too_large", `UI tree has more than ${UI_MAX_NODES} nodes`);
|
|
191
|
+
}
|
|
192
|
+
for (const c of children(n))
|
|
193
|
+
walk(c, depth + 1);
|
|
194
|
+
};
|
|
195
|
+
walk(node, 1);
|
|
196
|
+
return node;
|
|
197
|
+
}
|
|
198
|
+
var FormValueSchema = z2.union([
|
|
199
|
+
z2.string(),
|
|
200
|
+
z2.array(z2.string()),
|
|
201
|
+
z2.object({ other: z2.string() })
|
|
202
|
+
]);
|
|
203
|
+
var InteractionResponseSchema = z2.discriminatedUnion("kind", [
|
|
204
|
+
z2.object({ kind: z2.literal("form"), values: z2.record(z2.string(), FormValueSchema) }),
|
|
205
|
+
z2.object({ kind: z2.literal("confirm"), confirmed: z2.boolean() }),
|
|
206
|
+
z2.object({ kind: z2.literal("action"), actionId: z2.string() }),
|
|
207
|
+
z2.object({ kind: z2.literal("cancel") })
|
|
208
|
+
]);
|
|
209
|
+
|
|
210
|
+
// packages/protocol/dist/contributions.js
|
|
211
|
+
var ContributionPlacement = z3.enum([
|
|
212
|
+
"sidebar.header",
|
|
213
|
+
"sidebar.footer",
|
|
214
|
+
"session.panel",
|
|
215
|
+
"composer.pill",
|
|
216
|
+
"palette.item",
|
|
217
|
+
"slash.command"
|
|
218
|
+
]);
|
|
219
|
+
var Id = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
220
|
+
var ActionId = z3.string().min(1).max(200);
|
|
221
|
+
var Keywords = z3.array(z3.string().min(1).max(80)).max(20);
|
|
222
|
+
var Common = {
|
|
223
|
+
placement: ContributionPlacement,
|
|
224
|
+
order: z3.number().int().min(-1e3).max(1e3).optional(),
|
|
225
|
+
actionId: ActionId.optional()
|
|
226
|
+
};
|
|
227
|
+
var ContributionDescriptor = z3.object({
|
|
228
|
+
id: Id,
|
|
229
|
+
...Common,
|
|
230
|
+
name: z3.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
|
|
231
|
+
keywords: Keywords.optional()
|
|
232
|
+
}).strict().superRefine((v, ctx) => {
|
|
233
|
+
if (v.placement === "slash.command" && (!v.name || !v.actionId)) {
|
|
234
|
+
ctx.addIssue({ code: "custom", message: "Slash commands need name and actionId" });
|
|
235
|
+
}
|
|
236
|
+
if (v.placement === "palette.item" && !v.actionId) {
|
|
237
|
+
ctx.addIssue({ code: "custom", message: "Palette items need actionId" });
|
|
238
|
+
}
|
|
239
|
+
if (v.placement !== "slash.command" && v.name !== void 0) {
|
|
240
|
+
ctx.addIssue({ code: "custom", message: "Only slash commands have names" });
|
|
241
|
+
}
|
|
242
|
+
if (v.placement !== "palette.item" && v.keywords !== void 0) {
|
|
243
|
+
ctx.addIssue({ code: "custom", message: "Only palette items have keywords" });
|
|
244
|
+
}
|
|
245
|
+
if (v.placement === "composer.pill" && v.actionId !== void 0) {
|
|
246
|
+
ctx.addIssue({ code: "custom", message: "Composer pills are not interactive" });
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
var ContributionInput = z3.object({
|
|
250
|
+
...Common,
|
|
251
|
+
title: z3.string().min(1).max(100),
|
|
252
|
+
node: z3.unknown(),
|
|
253
|
+
mobileFallback: z3.string().min(1).max(2e3),
|
|
254
|
+
state: z3.unknown().optional(),
|
|
255
|
+
name: z3.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
|
|
256
|
+
keywords: Keywords.optional()
|
|
257
|
+
}).strict();
|
|
258
|
+
function boundContributionJson(value, maxBytes = 256 * 1024) {
|
|
259
|
+
const stack = [{ value, depth: 0 }];
|
|
260
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
261
|
+
let count = 0;
|
|
262
|
+
let characterCount = 0;
|
|
263
|
+
while (stack.length) {
|
|
264
|
+
const { value: v, depth, leave } = stack.pop();
|
|
265
|
+
if (leave) {
|
|
266
|
+
ancestors.delete(v);
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (++count > 2e4 || depth > 32)
|
|
270
|
+
throw new Error("Contribution exceeds complexity limit");
|
|
271
|
+
if (typeof v === "string") {
|
|
272
|
+
characterCount += v.length;
|
|
273
|
+
if (characterCount > maxBytes)
|
|
274
|
+
throw new Error("Contribution exceeds size limit");
|
|
275
|
+
}
|
|
276
|
+
if (v === null || typeof v === "string" || typeof v === "boolean")
|
|
277
|
+
continue;
|
|
278
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
279
|
+
continue;
|
|
280
|
+
if (!v || typeof v !== "object")
|
|
281
|
+
throw new Error("Contribution contains a non-JSON value");
|
|
282
|
+
if (ancestors.has(v))
|
|
283
|
+
throw new Error("Contribution contains a cycle");
|
|
284
|
+
ancestors.add(v);
|
|
285
|
+
stack.push({ value: v, depth, leave: true });
|
|
286
|
+
if (Array.isArray(v)) {
|
|
287
|
+
for (const child of v)
|
|
288
|
+
stack.push({ value: child, depth: depth + 1 });
|
|
289
|
+
} else {
|
|
290
|
+
if (Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null) {
|
|
291
|
+
throw new Error("Contribution contains a non-plain object");
|
|
292
|
+
}
|
|
293
|
+
for (const [key, child] of Object.entries(v)) {
|
|
294
|
+
characterCount += key.length;
|
|
295
|
+
if (characterCount > maxBytes)
|
|
296
|
+
throw new Error("Contribution exceeds size limit");
|
|
297
|
+
stack.push({ value: child, depth: depth + 1 });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const json = JSON.stringify(value);
|
|
302
|
+
let bytes3 = 0;
|
|
303
|
+
for (const char of json) {
|
|
304
|
+
const code = char.codePointAt(0);
|
|
305
|
+
bytes3 += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
|
|
306
|
+
if (bytes3 > maxBytes)
|
|
307
|
+
throw new Error("Contribution exceeds size limit");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function hasInteractive(node) {
|
|
311
|
+
if (node.t === "form" || node.t === "confirm")
|
|
312
|
+
return true;
|
|
313
|
+
if (node.t === "section")
|
|
314
|
+
return node.children.some(hasInteractive);
|
|
315
|
+
if (node.t === "list")
|
|
316
|
+
return node.items.some(hasInteractive);
|
|
317
|
+
if (node.t === "tabs")
|
|
318
|
+
return node.tabs.some((t) => t.children.some(hasInteractive));
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
function validateContribution(id, input) {
|
|
322
|
+
Id.parse(id);
|
|
323
|
+
boundContributionJson(input);
|
|
324
|
+
const parsed = ContributionInput.parse(input);
|
|
325
|
+
const node = validateUINode(parsed.node);
|
|
326
|
+
const { title, mobileFallback, state, node: _node, ...meta } = parsed;
|
|
327
|
+
const descriptor = ContributionDescriptor.parse({ ...meta, id });
|
|
328
|
+
if (descriptor.placement === "slash.command" && node.t !== "form") {
|
|
329
|
+
throw new Error("Slash command content must be a form");
|
|
330
|
+
}
|
|
331
|
+
if (descriptor.placement === "composer.pill" && node.t !== "text" && node.t !== "progress") {
|
|
332
|
+
throw new Error("Composer pill content must be text or progress");
|
|
333
|
+
}
|
|
334
|
+
if (descriptor.placement !== "session.panel" && state !== void 0) {
|
|
335
|
+
throw new Error("Only session panels accept renderer state");
|
|
336
|
+
}
|
|
337
|
+
if (state !== void 0)
|
|
338
|
+
boundContributionJson(state, 64 * 1024);
|
|
339
|
+
if (hasInteractive(node) && !descriptor.actionId) {
|
|
340
|
+
throw new Error("Interactive content requires actionId");
|
|
341
|
+
}
|
|
342
|
+
return { descriptor, title, node, mobileFallback, ...state === void 0 ? {} : { state } };
|
|
343
|
+
}
|
|
344
|
+
function validateContributionCard(node) {
|
|
345
|
+
boundContributionJson(node);
|
|
346
|
+
const checked = validateUINode(node);
|
|
347
|
+
if (hasInteractive(checked))
|
|
348
|
+
throw new Error("Timeline cards cannot contain forms or confirms");
|
|
349
|
+
return checked;
|
|
350
|
+
}
|
|
351
|
+
function contributionSlot(id) {
|
|
352
|
+
return `@slot/${Id.parse(id)}`;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// packages/protocol/dist/entities.js
|
|
356
|
+
import { z as z7 } from "zod";
|
|
357
|
+
|
|
358
|
+
// packages/protocol/dist/github.js
|
|
359
|
+
import { z as z4 } from "zod";
|
|
360
|
+
var Id2 = z4.string().min(1).max(200);
|
|
361
|
+
var Instant = z4.string().refine((s) => {
|
|
362
|
+
try {
|
|
363
|
+
return new Date(s).toISOString() === s;
|
|
364
|
+
} catch {
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
var positive = z4.number().int().safe().positive();
|
|
369
|
+
var nonnegative = z4.number().int().safe().nonnegative();
|
|
370
|
+
var reason = z4.string().min(1).max(2e3);
|
|
371
|
+
var hash = z4.string().regex(/^[0-9a-f]{64}$/);
|
|
372
|
+
var actionsId = z4.string().regex(/^[1-9][0-9]{0,19}$/);
|
|
373
|
+
var bytes = (s) => new TextEncoder().encode(s).length;
|
|
374
|
+
var displayUrl = z4.string().max(4096).refine((s) => {
|
|
375
|
+
try {
|
|
376
|
+
const u = new URL(s);
|
|
377
|
+
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
378
|
+
} catch {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
var githubUrl = displayUrl.refine((s) => {
|
|
383
|
+
try {
|
|
384
|
+
const u = new URL(s);
|
|
385
|
+
return u.protocol === "https:" && u.hostname === "github.com" && !u.port && /^https:\/\/github\.com(?:[/?#]|$)/i.test(s);
|
|
386
|
+
} catch {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
var GitHubRepository = z4.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\/(?!\.{1,2}$)[A-Za-z0-9_.-]{1,100}$/);
|
|
391
|
+
var issuePath = /^[hH][tT][tT][pP][sS]:\/\/[gG][iI][tT][hH][uU][bB]\.[cC][oO][mM]\/([^/]+)\/([^/]+)\/issues\/([1-9][0-9]*)$/;
|
|
392
|
+
var GitHubIssueUrl = z4.string().trim().transform((raw, ctx) => {
|
|
393
|
+
const match = issuePath.exec(raw);
|
|
394
|
+
const number = match ? Number(match[3]) : NaN;
|
|
395
|
+
if (!match || !GitHubRepository.safeParse(`${match[1]}/${match[2]}`).success || !Number.isSafeInteger(number)) {
|
|
396
|
+
ctx.addIssue({ code: "custom", message: "Invalid GitHub issue URL" });
|
|
397
|
+
return z4.NEVER;
|
|
398
|
+
}
|
|
399
|
+
return `https://github.com/${match[1]}/${match[2]}/issues/${number}`;
|
|
400
|
+
});
|
|
401
|
+
function issueParts(url) {
|
|
402
|
+
const match = issuePath.exec(url);
|
|
403
|
+
return { repository: `${match[1]}/${match[2]}`, number: Number(match[3]) };
|
|
404
|
+
}
|
|
405
|
+
function issuePrompt(url) {
|
|
406
|
+
return `${url}
|
|
407
|
+
|
|
408
|
+
Read it with \`gh issue view ${url}\`.`;
|
|
409
|
+
}
|
|
410
|
+
var GitHubIssueIdentity = z4.object({
|
|
411
|
+
repository: GitHubRepository,
|
|
412
|
+
number: positive,
|
|
413
|
+
url: GitHubIssueUrl
|
|
414
|
+
}).strict().refine((v) => {
|
|
415
|
+
const parts = issueParts(v.url);
|
|
416
|
+
return v.repository === parts.repository && v.number === parts.number;
|
|
417
|
+
});
|
|
418
|
+
var GitHubIssue = z4.object({
|
|
419
|
+
repository: GitHubRepository,
|
|
420
|
+
number: positive,
|
|
421
|
+
url: GitHubIssueUrl,
|
|
422
|
+
launchPrompt: z4.string()
|
|
423
|
+
}).strict().refine((v) => {
|
|
424
|
+
const parts = issueParts(v.url);
|
|
425
|
+
return v.repository === parts.repository && v.number === parts.number && v.launchPrompt === issuePrompt(v.url);
|
|
426
|
+
});
|
|
427
|
+
function githubIssueFromUrl(raw) {
|
|
428
|
+
const url = GitHubIssueUrl.parse(raw);
|
|
429
|
+
return { ...issueParts(url), url, launchPrompt: issuePrompt(url) };
|
|
430
|
+
}
|
|
431
|
+
var GitHubSha = z4.string().regex(/^[0-9a-f]{40}$/);
|
|
432
|
+
var prUrl = githubUrl.refine((s) => {
|
|
433
|
+
try {
|
|
434
|
+
const u = new URL(s);
|
|
435
|
+
return /^\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*$/.test(u.pathname) && !u.search && !u.hash;
|
|
436
|
+
} catch {
|
|
437
|
+
return false;
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
function matchesPr(url, repository, number) {
|
|
441
|
+
try {
|
|
442
|
+
const u = new URL(url);
|
|
443
|
+
return u.pathname.toLowerCase() === `/${repository}/pull/${number}`.toLowerCase();
|
|
444
|
+
} catch {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
var HostGitHub = z4.object({ available: z4.boolean(), reason: reason.nullable() }).strict().refine((v) => v.available === (v.reason === null));
|
|
449
|
+
var GitHubCheck = z4.object({
|
|
450
|
+
id: hash,
|
|
451
|
+
name: z4.string().min(1).max(300),
|
|
452
|
+
state: z4.string().min(1).max(100),
|
|
453
|
+
bucket: z4.enum(["pass", "fail", "pending", "skipping", "cancel", "unknown"]),
|
|
454
|
+
link: displayUrl.nullable(),
|
|
455
|
+
workflow: z4.string().max(300).nullable(),
|
|
456
|
+
event: z4.string().max(100).nullable(),
|
|
457
|
+
startedAt: Instant.nullable(),
|
|
458
|
+
completedAt: Instant.nullable(),
|
|
459
|
+
description: z4.string().max(2e3).nullable(),
|
|
460
|
+
actionsJob: z4.object({ runId: actionsId, jobId: actionsId, attempt: positive }).strict().nullable()
|
|
461
|
+
}).strict();
|
|
462
|
+
var GitHubComment = z4.object({
|
|
463
|
+
id: Id2,
|
|
464
|
+
author: z4.string().min(1).max(200).nullable(),
|
|
465
|
+
body: z4.string().refine((v) => [...v].length <= 8e3),
|
|
466
|
+
bodyTruncated: z4.boolean(),
|
|
467
|
+
url: githubUrl,
|
|
468
|
+
createdAt: Instant.nullable()
|
|
469
|
+
}).strict();
|
|
470
|
+
var GitHubThread = z4.object({
|
|
471
|
+
id: Id2,
|
|
472
|
+
isResolved: z4.literal(false),
|
|
473
|
+
isOutdated: z4.boolean(),
|
|
474
|
+
path: z4.string().max(8192).nullable(),
|
|
475
|
+
line: positive.nullable(),
|
|
476
|
+
startLine: positive.nullable(),
|
|
477
|
+
side: z4.enum(["LEFT", "RIGHT"]).nullable(),
|
|
478
|
+
comments: z4.array(GitHubComment).max(10),
|
|
479
|
+
commentsComplete: z4.boolean()
|
|
480
|
+
}).strict();
|
|
481
|
+
var GitHubPullRequest = z4.object({
|
|
482
|
+
nodeId: z4.string().min(1).optional(),
|
|
483
|
+
number: positive,
|
|
484
|
+
url: prUrl,
|
|
485
|
+
title: z4.string().min(1).max(1e3),
|
|
486
|
+
state: z4.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
487
|
+
isDraft: z4.boolean(),
|
|
488
|
+
headRefName: z4.string().min(1).max(255),
|
|
489
|
+
headRefOid: GitHubSha,
|
|
490
|
+
headRepository: GitHubRepository.nullable(),
|
|
491
|
+
baseRefName: z4.string().min(1).max(255),
|
|
492
|
+
mergeable: z4.string().min(1).max(100),
|
|
493
|
+
mergeStateStatus: z4.string().min(1).max(100),
|
|
494
|
+
reviewDecision: z4.enum(["APPROVED", "REVIEW_REQUIRED", "CHANGES_REQUESTED"]).nullable(),
|
|
495
|
+
mergeQueueEnabled: z4.boolean(),
|
|
496
|
+
inMergeQueue: z4.boolean(),
|
|
497
|
+
autoMergeEnabled: z4.boolean(),
|
|
498
|
+
squashMergeAllowed: z4.boolean()
|
|
499
|
+
}).strict().refine((v) => {
|
|
500
|
+
try {
|
|
501
|
+
return new URL(v.url).pathname.endsWith(`/pull/${v.number}`);
|
|
502
|
+
} catch {
|
|
503
|
+
return false;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
var WorkspaceGitHub = z4.object({
|
|
507
|
+
repository: GitHubRepository.nullable(),
|
|
508
|
+
headRepository: GitHubRepository.nullable(),
|
|
509
|
+
branch: z4.string().min(1).max(255).nullable(),
|
|
510
|
+
fetchedAt: Instant.nullable(),
|
|
511
|
+
attemptedAt: Instant,
|
|
512
|
+
status: z4.enum(["ready", "unavailable", "error", "ambiguous"]),
|
|
513
|
+
reason: reason.nullable(),
|
|
514
|
+
pullRequest: GitHubPullRequest.nullable(),
|
|
515
|
+
checks: z4.array(GitHubCheck).max(500),
|
|
516
|
+
checksComplete: z4.boolean(),
|
|
517
|
+
threads: z4.array(GitHubThread).max(500),
|
|
518
|
+
threadsComplete: z4.boolean(),
|
|
519
|
+
truncated: z4.boolean()
|
|
520
|
+
}).strict().refine((v) => {
|
|
521
|
+
if (bytes(JSON.stringify(v)) > 512 * 1024 || new Set(v.checks.map((c) => c.id)).size !== v.checks.length)
|
|
522
|
+
return false;
|
|
523
|
+
if (v.pullRequest && (!v.repository || !matchesPr(v.pullRequest.url, v.repository, v.pullRequest.number)))
|
|
524
|
+
return false;
|
|
525
|
+
if (v.threads.some((t) => !t.commentsComplete || t.comments.some((c) => c.bodyTruncated)) && (v.threadsComplete || !v.truncated))
|
|
526
|
+
return false;
|
|
527
|
+
if (v.status !== "ready")
|
|
528
|
+
return v.reason !== null && !v.checksComplete && !v.threadsComplete;
|
|
529
|
+
return v.reason === null && v.fetchedAt !== null && v.repository !== null && v.headRepository !== null && v.branch !== null && (v.pullRequest !== null || v.checks.length === 0 && v.threads.length === 0 && v.checksComplete && v.threadsComplete);
|
|
530
|
+
});
|
|
531
|
+
var GitHubViewResult = z4.object({ github: HostGitHub, snapshot: WorkspaceGitHub }).strict();
|
|
532
|
+
var GitHubViewResponse = z4.object({ github: HostGitHub.nullable(), snapshot: WorkspaceGitHub.nullable() }).strict();
|
|
533
|
+
function lineCount(s) {
|
|
534
|
+
if (!s)
|
|
535
|
+
return 0;
|
|
536
|
+
const lines = s.replace(/\r\n/g, "\n").split("\n");
|
|
537
|
+
if (lines[lines.length - 1] === "")
|
|
538
|
+
lines.pop();
|
|
539
|
+
return lines.length;
|
|
540
|
+
}
|
|
541
|
+
var GitHubJobLog = z4.object({
|
|
542
|
+
checkId: hash,
|
|
543
|
+
name: z4.string().min(1).max(300),
|
|
544
|
+
url: displayUrl.nullable(),
|
|
545
|
+
runId: actionsId.nullable(),
|
|
546
|
+
jobId: actionsId.nullable(),
|
|
547
|
+
attempt: positive.nullable(),
|
|
548
|
+
status: z4.enum([
|
|
549
|
+
"available",
|
|
550
|
+
"unmapped",
|
|
551
|
+
"incomplete",
|
|
552
|
+
"expired",
|
|
553
|
+
"forbidden",
|
|
554
|
+
"timeout",
|
|
555
|
+
"error"
|
|
556
|
+
]),
|
|
557
|
+
outputTail: z4.string().nullable(),
|
|
558
|
+
lineCount: nonnegative.max(150),
|
|
559
|
+
truncated: z4.boolean(),
|
|
560
|
+
reason: reason.nullable()
|
|
561
|
+
}).strict().refine((v) => v.status === "available" ? v.runId !== null && v.jobId !== null && v.attempt !== null && v.outputTail !== null && bytes(v.outputTail) <= 65536 && lineCount(v.outputTail) === v.lineCount && v.reason === null : v.outputTail === null && v.lineCount === 0 && v.reason !== null);
|
|
562
|
+
var GitHubLogs = z4.object({
|
|
563
|
+
github: HostGitHub,
|
|
564
|
+
repository: GitHubRepository,
|
|
565
|
+
number: positive,
|
|
566
|
+
headOid: GitHubSha,
|
|
567
|
+
fetchedAt: Instant,
|
|
568
|
+
status: z4.enum(["ready", "unavailable", "error"]),
|
|
569
|
+
reason: reason.nullable(),
|
|
570
|
+
jobs: z4.array(GitHubJobLog).max(10),
|
|
571
|
+
complete: z4.boolean(),
|
|
572
|
+
truncated: z4.boolean(),
|
|
573
|
+
omittedJobs: nonnegative.nullable()
|
|
574
|
+
}).strict().refine((v) => bytes(JSON.stringify(v)) <= 1024 * 1024 && (v.status === "ready" ? v.github.available && v.reason === null && (!v.complete || v.omittedJobs === 0 && v.jobs.every((j) => j.status === "available")) : v.reason !== null && v.jobs.length === 0 && !v.complete));
|
|
575
|
+
var GitHubLogsRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
576
|
+
var GitHubMergeRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
577
|
+
var mergeFields = {
|
|
578
|
+
github: HostGitHub,
|
|
579
|
+
repository: GitHubRepository,
|
|
580
|
+
number: positive,
|
|
581
|
+
url: prUrl,
|
|
582
|
+
expectedHeadOid: GitHubSha
|
|
583
|
+
};
|
|
584
|
+
var GitHubMergeResult = z4.discriminatedUnion("status", [
|
|
585
|
+
z4.object({
|
|
586
|
+
status: z4.literal("merged"),
|
|
587
|
+
...mergeFields,
|
|
588
|
+
mergeCommitOid: GitHubSha.nullable(),
|
|
589
|
+
confirmedAt: Instant
|
|
590
|
+
}).strict(),
|
|
591
|
+
z4.object({
|
|
592
|
+
status: z4.literal("outcome_unknown"),
|
|
593
|
+
...mergeFields,
|
|
594
|
+
reason,
|
|
595
|
+
attemptedAt: Instant
|
|
596
|
+
}).strict()
|
|
597
|
+
]).refine((v) => matchesPr(v.url, v.repository, v.number));
|
|
598
|
+
var path = z4.string().min(1).max(8192);
|
|
599
|
+
var GitHubHostViewRequest = z4.object({ path }).strict();
|
|
600
|
+
var GitHubHostLogsRequest = z4.object({ path, repository: GitHubRepository, number: positive, expectedHeadOid: GitHubSha }).strict();
|
|
601
|
+
var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
|
|
602
|
+
expectedPullRequestNodeId: z4.string().min(1)
|
|
603
|
+
});
|
|
47
604
|
|
|
48
605
|
// packages/protocol/dist/policies.js
|
|
49
|
-
import { z as
|
|
50
|
-
var
|
|
51
|
-
var Revision =
|
|
52
|
-
var
|
|
606
|
+
import { z as z5 } from "zod";
|
|
607
|
+
var Id3 = z5.string().min(1).max(200);
|
|
608
|
+
var Revision = z5.number().int().safe().min(1);
|
|
609
|
+
var Instant2 = z5.string().refine((s) => {
|
|
53
610
|
try {
|
|
54
611
|
return new Date(s).toISOString() === s;
|
|
55
612
|
} catch {
|
|
56
613
|
return false;
|
|
57
614
|
}
|
|
58
615
|
});
|
|
59
|
-
var Text =
|
|
616
|
+
var Text = z5.string().max(4e3);
|
|
60
617
|
var Reason = Text.min(1);
|
|
61
|
-
var Fingerprint =
|
|
618
|
+
var Fingerprint = z5.string().regex(/^[0-9a-f]{64}$/);
|
|
62
619
|
var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
63
|
-
var
|
|
620
|
+
var bytes2 = (s) => new TextEncoder().encode(s).length;
|
|
64
621
|
function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
|
|
65
622
|
if (depth > 20)
|
|
66
623
|
return false;
|
|
@@ -95,43 +652,43 @@ function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
|
|
|
95
652
|
seen.delete(value);
|
|
96
653
|
}
|
|
97
654
|
}
|
|
98
|
-
var JsonObject =
|
|
99
|
-
var CompletedUsageWatermark =
|
|
100
|
-
var scopeShape = { scope:
|
|
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() };
|
|
101
658
|
var scopeValid = (v) => v.scope === "server" === (v.scopeId === null);
|
|
102
|
-
var PolicyPhase =
|
|
103
|
-
var PolicyVerdict =
|
|
104
|
-
var PolicyRequestAction =
|
|
659
|
+
var PolicyPhase = z5.enum(["tool_call", "request"]);
|
|
660
|
+
var PolicyVerdict = z5.enum(["ALLOW", "ASK", "DENY"]);
|
|
661
|
+
var PolicyRequestAction = z5.enum([
|
|
105
662
|
"task.create",
|
|
106
663
|
"message.send",
|
|
107
664
|
"inbox.read",
|
|
108
665
|
"run.continue"
|
|
109
666
|
]);
|
|
110
667
|
var PolicyScope = scopeShape.scope;
|
|
111
|
-
var PolicyCounterMap =
|
|
112
|
-
var phases =
|
|
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);
|
|
113
670
|
var ruleFields = {
|
|
114
|
-
priority:
|
|
115
|
-
enabled:
|
|
671
|
+
priority: z5.number().int().safe().min(-1e6).max(1e6),
|
|
672
|
+
enabled: z5.boolean(),
|
|
116
673
|
phases,
|
|
117
|
-
name:
|
|
118
|
-
expression:
|
|
674
|
+
name: z5.string().min(1).max(120),
|
|
675
|
+
expression: z5.string().min(1).max(8192)
|
|
119
676
|
};
|
|
120
|
-
var PolicyRule =
|
|
121
|
-
id:
|
|
677
|
+
var PolicyRule = z5.object({
|
|
678
|
+
id: Id3,
|
|
122
679
|
...scopeShape,
|
|
123
680
|
...ruleFields,
|
|
124
681
|
revision: Revision,
|
|
125
|
-
builtIn:
|
|
126
|
-
createdAt:
|
|
127
|
-
updatedAt:
|
|
682
|
+
builtIn: z5.boolean(),
|
|
683
|
+
createdAt: Instant2,
|
|
684
|
+
updatedAt: Instant2
|
|
128
685
|
}).strict().refine(scopeValid);
|
|
129
|
-
var PolicyToolSafety =
|
|
130
|
-
destructiveDelete:
|
|
131
|
-
forcePush:
|
|
132
|
-
defaultBranchPush:
|
|
133
|
-
uncertain:
|
|
134
|
-
reasons:
|
|
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)
|
|
135
692
|
}).strict();
|
|
136
693
|
function normalizePosixPath(value) {
|
|
137
694
|
const parts = [];
|
|
@@ -143,7 +700,7 @@ function normalizePosixPath(value) {
|
|
|
143
700
|
}
|
|
144
701
|
return `/${parts.join("/")}`;
|
|
145
702
|
}
|
|
146
|
-
var hostPath =
|
|
703
|
+
var hostPath = z5.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
|
|
147
704
|
function relativePosixPath(from, to) {
|
|
148
705
|
const fromParts = from.split("/").filter(Boolean);
|
|
149
706
|
const toParts = to.split("/").filter(Boolean);
|
|
@@ -152,7 +709,7 @@ function relativePosixPath(from, to) {
|
|
|
152
709
|
shared++;
|
|
153
710
|
return [...fromParts.slice(shared).map(() => ".."), ...toParts.slice(shared)].join("/");
|
|
154
711
|
}
|
|
155
|
-
var HostPolicyBoundary =
|
|
712
|
+
var HostPolicyBoundary = z5.object({
|
|
156
713
|
cwd: hostPath,
|
|
157
714
|
workspaceRoot: hostPath,
|
|
158
715
|
cwdReal: hostPath,
|
|
@@ -161,51 +718,51 @@ var HostPolicyBoundary = z2.object({
|
|
|
161
718
|
const relative = relativePosixPath(boundary.workspaceRootReal, boundary.cwdReal);
|
|
162
719
|
return relative !== ".." && !relative.startsWith("../");
|
|
163
720
|
}, "Real cwd must be within the real workspace boundary.");
|
|
164
|
-
var HostToolPolicyContext =
|
|
165
|
-
version:
|
|
166
|
-
toolCallId:
|
|
721
|
+
var HostToolPolicyContext = z5.object({
|
|
722
|
+
version: z5.literal(1),
|
|
723
|
+
toolCallId: Id3,
|
|
167
724
|
toolHash: Fingerprint,
|
|
168
725
|
boundary: HostPolicyBoundary,
|
|
169
|
-
defaultBranch:
|
|
726
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
170
727
|
safety: PolicyToolSafety
|
|
171
728
|
}).strict();
|
|
172
|
-
var PolicyToolContext =
|
|
173
|
-
var PolicyRequestContext =
|
|
174
|
-
var absolutePath =
|
|
175
|
-
var controlMode =
|
|
176
|
-
var PolicySessionContext =
|
|
177
|
-
id:
|
|
178
|
-
hostId:
|
|
179
|
-
nativeSessionId:
|
|
180
|
-
runtimeId:
|
|
181
|
-
profileId:
|
|
182
|
-
projectId:
|
|
183
|
-
taskId:
|
|
184
|
-
runId:
|
|
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(),
|
|
185
742
|
controlMode,
|
|
186
743
|
controlRevision: Revision,
|
|
187
744
|
cwd: absolutePath,
|
|
188
745
|
workspaceRoot: absolutePath,
|
|
189
|
-
repository:
|
|
190
|
-
defaultBranch:
|
|
191
|
-
readOnly:
|
|
746
|
+
repository: z5.string().min(1).max(2048).nullable(),
|
|
747
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
748
|
+
readOnly: z5.boolean()
|
|
192
749
|
}).strict();
|
|
193
|
-
var PolicyTaskContext =
|
|
194
|
-
id:
|
|
195
|
-
projectId:
|
|
196
|
-
rootTaskId:
|
|
197
|
-
parentTaskId:
|
|
198
|
-
title:
|
|
199
|
-
state:
|
|
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"])
|
|
200
757
|
}).strict();
|
|
201
|
-
var PolicyTargetContext =
|
|
202
|
-
id:
|
|
203
|
-
hostId:
|
|
204
|
-
projectId:
|
|
205
|
-
taskId:
|
|
758
|
+
var PolicyTargetContext = z5.object({
|
|
759
|
+
id: Id3,
|
|
760
|
+
hostId: Id3,
|
|
761
|
+
projectId: Id3.nullable(),
|
|
762
|
+
taskId: Id3.nullable(),
|
|
206
763
|
controlMode,
|
|
207
764
|
controlRevision: Revision,
|
|
208
|
-
runtime:
|
|
765
|
+
runtime: z5.enum([
|
|
209
766
|
"starting",
|
|
210
767
|
"idle",
|
|
211
768
|
"running",
|
|
@@ -214,24 +771,24 @@ var PolicyTargetContext = z2.object({
|
|
|
214
771
|
"failed",
|
|
215
772
|
"stopped"
|
|
216
773
|
]),
|
|
217
|
-
readOnly:
|
|
774
|
+
readOnly: z5.boolean()
|
|
218
775
|
}).strict();
|
|
219
|
-
var PolicyCostContext =
|
|
220
|
-
tokens:
|
|
221
|
-
costUsd:
|
|
222
|
-
maxTokens:
|
|
223
|
-
maxCostUsd:
|
|
224
|
-
accounting:
|
|
225
|
-
fresh:
|
|
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(),
|
|
226
783
|
watermark: CompletedUsageWatermark.nullable(),
|
|
227
|
-
provider:
|
|
228
|
-
modelId:
|
|
229
|
-
classification:
|
|
230
|
-
expensive:
|
|
784
|
+
provider: Id3.nullable(),
|
|
785
|
+
modelId: z5.string().min(1).max(512).nullable(),
|
|
786
|
+
classification: z5.enum(["cheap", "expensive", "unclassified"]),
|
|
787
|
+
expensive: z5.boolean()
|
|
231
788
|
}).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));
|
|
232
|
-
var PolicyContext =
|
|
789
|
+
var PolicyContext = z5.object({
|
|
233
790
|
phase: PolicyPhase,
|
|
234
|
-
action:
|
|
791
|
+
action: z5.union([z5.literal("tool.call"), PolicyRequestAction]),
|
|
235
792
|
tool: PolicyToolContext.nullable(),
|
|
236
793
|
request: PolicyRequestContext.nullable(),
|
|
237
794
|
session: PolicySessionContext,
|
|
@@ -239,12 +796,12 @@ var PolicyContext = z2.object({
|
|
|
239
796
|
target: PolicyTargetContext.nullable(),
|
|
240
797
|
cost: PolicyCostContext,
|
|
241
798
|
counters: PolicyCounterMap
|
|
242
|
-
}).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) =>
|
|
243
|
-
var PolicyRuleResult =
|
|
244
|
-
|
|
245
|
-
|
|
799
|
+
}).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)
|
|
246
803
|
]);
|
|
247
|
-
var webUrl =
|
|
804
|
+
var webUrl = z5.string().max(4096).refine((s) => {
|
|
248
805
|
try {
|
|
249
806
|
const u = new URL(s);
|
|
250
807
|
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
@@ -252,650 +809,233 @@ var webUrl = z2.string().max(4096).refine((s) => {
|
|
|
252
809
|
return false;
|
|
253
810
|
}
|
|
254
811
|
});
|
|
255
|
-
var PolicyEvaluation =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
verdict:
|
|
260
|
-
decisionId:
|
|
261
|
-
interactionId:
|
|
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,
|
|
262
819
|
interactionUrl: webUrl
|
|
263
820
|
}).strict()
|
|
264
821
|
]);
|
|
265
|
-
var PolicyPermission =
|
|
266
|
-
kind:
|
|
267
|
-
decisionId:
|
|
268
|
-
rootTaskId:
|
|
269
|
-
ruleId:
|
|
822
|
+
var PolicyPermission = z5.object({
|
|
823
|
+
kind: z5.literal("policy"),
|
|
824
|
+
decisionId: Id3,
|
|
825
|
+
rootTaskId: Id3.nullable(),
|
|
826
|
+
ruleId: Id3,
|
|
270
827
|
ruleRevision: Revision,
|
|
271
828
|
fingerprint: Fingerprint
|
|
272
829
|
}).strict();
|
|
273
|
-
var PolicyGrant =
|
|
274
|
-
id:
|
|
275
|
-
scope:
|
|
276
|
-
ruleId:
|
|
830
|
+
var PolicyGrant = z5.object({
|
|
831
|
+
id: Id3,
|
|
832
|
+
scope: z5.object({ kind: z5.enum(["task", "session"]), id: Id3 }).strict(),
|
|
833
|
+
ruleId: Id3,
|
|
277
834
|
ruleRevision: Revision,
|
|
278
835
|
fingerprint: Fingerprint,
|
|
279
|
-
approvedByDeviceId:
|
|
280
|
-
approvedAt:
|
|
836
|
+
approvedByDeviceId: Id3,
|
|
837
|
+
approvedAt: Instant2
|
|
281
838
|
}).strict();
|
|
282
|
-
var trimmed = (max) =>
|
|
283
|
-
var PolicyModelClassification =
|
|
839
|
+
var trimmed = (max) => z5.string().min(1).max(max).refine((s) => s.trim() === s);
|
|
840
|
+
var PolicyModelClassification = z5.object({
|
|
284
841
|
provider: trimmed(200),
|
|
285
842
|
modelId: trimmed(512),
|
|
286
|
-
classification:
|
|
843
|
+
classification: z5.enum(["cheap", "expensive"])
|
|
287
844
|
}).strict();
|
|
288
|
-
var classifications =
|
|
289
|
-
var PolicySettings =
|
|
290
|
-
var toolInput =
|
|
291
|
-
var sampleIdentity = { sessionId:
|
|
292
|
-
var HostPolicySampleRequest =
|
|
293
|
-
var HostPolicySampleResult =
|
|
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({
|
|
294
851
|
...sampleIdentity,
|
|
295
852
|
toolHash: Fingerprint,
|
|
296
853
|
boundary: HostPolicyBoundary,
|
|
297
|
-
defaultBranch:
|
|
854
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
298
855
|
safety: PolicyToolSafety
|
|
299
856
|
}).strict();
|
|
300
|
-
var PolicyEvaluateRequest =
|
|
301
|
-
var PolicyStatusRequest =
|
|
302
|
-
var PolicyStatusResult =
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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()
|
|
307
864
|
]);
|
|
308
|
-
var PolicyCancelRequest =
|
|
309
|
-
var PolicyCancelResult =
|
|
310
|
-
var PolicyTrace =
|
|
311
|
-
ruleId:
|
|
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,
|
|
312
869
|
ruleRevision: Revision,
|
|
313
870
|
...scopeShape,
|
|
314
871
|
verdict: PolicyVerdict.nullable(),
|
|
315
872
|
reason: Text.nullable(),
|
|
316
|
-
granted:
|
|
317
|
-
overridden:
|
|
873
|
+
granted: z5.boolean(),
|
|
874
|
+
overridden: z5.boolean(),
|
|
318
875
|
proposedStateUpdates: PolicyCounterMap
|
|
319
876
|
}).strict().refine(scopeValid);
|
|
320
|
-
var PolicyTestResult =
|
|
877
|
+
var PolicyTestResult = z5.object({
|
|
321
878
|
verdict: PolicyVerdict,
|
|
322
879
|
reason: Text.nullable(),
|
|
323
|
-
trace:
|
|
324
|
-
proposedStateUpdates:
|
|
325
|
-
enforcement:
|
|
326
|
-
phases:
|
|
327
|
-
modelRequest:
|
|
328
|
-
explanation:
|
|
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()
|
|
329
886
|
}).strict()
|
|
330
887
|
}).strict();
|
|
331
|
-
var CreatePolicyRuleRequest =
|
|
332
|
-
var UpdatePolicyRuleRequest =
|
|
888
|
+
var CreatePolicyRuleRequest = z5.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
|
|
889
|
+
var UpdatePolicyRuleRequest = z5.object({
|
|
333
890
|
expectedRevision: Revision,
|
|
334
891
|
name: ruleFields.name.optional(),
|
|
335
892
|
priority: ruleFields.priority.optional(),
|
|
336
|
-
enabled:
|
|
893
|
+
enabled: z5.boolean().optional(),
|
|
337
894
|
phases: phases.optional(),
|
|
338
895
|
expression: ruleFields.expression.optional()
|
|
339
896
|
}).strict().refine((v) => Object.keys(v).length > 1);
|
|
340
|
-
var DeletePolicyRuleQuery =
|
|
341
|
-
var UpdatePolicySettingsRequest =
|
|
342
|
-
var PolicyTestRequest =
|
|
343
|
-
sessionId:
|
|
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,
|
|
344
901
|
phase: PolicyPhase,
|
|
345
902
|
tool: toolInput.nullable(),
|
|
346
903
|
request: PolicyRequestContext.nullable()
|
|
347
904
|
}).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
|
|
348
905
|
|
|
349
|
-
// packages/protocol/dist/
|
|
350
|
-
var Id2 = z3.string().min(1).max(200);
|
|
351
|
-
var Instant2 = z3.string().refine((value) => {
|
|
352
|
-
const date = new Date(value);
|
|
353
|
-
return Number.isFinite(date.getTime()) && date.toISOString() === value;
|
|
354
|
-
}, "Expected canonical UTC timestamp");
|
|
355
|
-
var AGENT_FRAME_MAX_BYTES = 128 * 1024;
|
|
356
|
-
var AgentMethod = z3.enum([
|
|
357
|
-
"session.bind",
|
|
358
|
-
"task.create",
|
|
359
|
-
"message.send",
|
|
360
|
-
"inbox.read",
|
|
361
|
-
"receipt.peek",
|
|
362
|
-
"policy.evaluate",
|
|
363
|
-
"policy.status",
|
|
364
|
-
"policy.cancel"
|
|
365
|
-
]);
|
|
366
|
-
var AgentToolMethod = z3.enum(["task.create", "message.send", "inbox.read"]);
|
|
367
|
-
var RequestHash = z3.string().regex(/^[a-f0-9]{64}$/);
|
|
368
|
-
var AgentReceiptPeekRequest = z3.object({ method: AgentToolMethod, args: z3.record(z3.string(), z3.json()) }).strict();
|
|
369
|
-
var AgentReceiptPeekResult = z3.discriminatedUnion("found", [
|
|
370
|
-
z3.object({ found: z3.literal(false) }).strict(),
|
|
371
|
-
z3.object({ found: z3.literal(true), requestHash: RequestHash }).strict()
|
|
372
|
-
]);
|
|
373
|
-
var AgentReceiptReplay = z3.object({ requestHash: RequestHash }).strict();
|
|
374
|
-
var CreateAgentTask = z3.object({
|
|
375
|
-
objective: z3.string().min(1).max(16e3),
|
|
376
|
-
acceptance: z3.array(z3.string().min(1).max(2e3)).max(100).default([]),
|
|
377
|
-
dependencies: z3.array(Id2).max(100).default([]),
|
|
378
|
-
parentTaskId: Id2.nullable().optional(),
|
|
379
|
-
hostId: Id2.optional(),
|
|
380
|
-
profileId: Id2.optional(),
|
|
381
|
-
notifyOnFinish: z3.boolean().default(true)
|
|
382
|
-
});
|
|
383
|
-
var SendAgentMessage = z3.object({
|
|
384
|
-
sessionId: Id2,
|
|
385
|
-
body: z3.string().min(1).max(16e3),
|
|
386
|
-
mode: z3.enum(["steer", "queue"]),
|
|
387
|
-
replyTo: Id2.optional()
|
|
388
|
-
});
|
|
389
|
-
var ReadAgentInbox = z3.object({
|
|
390
|
-
after: z3.number().int().nonnegative().default(0),
|
|
391
|
-
limit: z3.number().int().min(1).max(100).default(20)
|
|
392
|
-
});
|
|
393
|
-
var DeliveryState = z3.enum([
|
|
394
|
-
"pending",
|
|
395
|
-
"held",
|
|
396
|
-
"deferred",
|
|
397
|
-
"accepted",
|
|
398
|
-
"queued",
|
|
399
|
-
"appended",
|
|
400
|
-
"uncertain",
|
|
401
|
-
"failed"
|
|
402
|
-
]);
|
|
403
|
-
var AgentMessageFields = {
|
|
404
|
-
seq: z3.number().int().positive(),
|
|
405
|
-
id: Id2,
|
|
406
|
-
recipientSessionId: Id2,
|
|
407
|
-
replyTo: Id2.nullable(),
|
|
408
|
-
chainId: Id2,
|
|
409
|
-
depth: z3.number().int().min(0).max(4),
|
|
410
|
-
body: z3.unknown(),
|
|
411
|
-
requestedMode: z3.enum(["steer", "queue"]),
|
|
412
|
-
deliveryState: DeliveryState,
|
|
413
|
-
holdUntil: z3.string(),
|
|
414
|
-
readAt: z3.string().nullable(),
|
|
415
|
-
createdAt: z3.string()
|
|
416
|
-
};
|
|
417
|
-
var AgentMessage = z3.discriminatedUnion("kind", [
|
|
418
|
-
z3.object({ ...AgentMessageFields, kind: z3.literal("message"), senderSessionId: Id2 }),
|
|
419
|
-
z3.object({
|
|
420
|
-
...AgentMessageFields,
|
|
421
|
-
kind: z3.literal("completion"),
|
|
422
|
-
senderSessionId: Id2.nullable()
|
|
423
|
-
})
|
|
424
|
-
]);
|
|
425
|
-
var AgentInbox = z3.object({
|
|
426
|
-
messages: z3.array(AgentMessage),
|
|
427
|
-
nextAfter: z3.number().int().nonnegative(),
|
|
428
|
-
hasMore: z3.boolean()
|
|
429
|
-
});
|
|
430
|
-
var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z3.literal("policy.required") }).strict();
|
|
431
|
-
var AgentRequestFrame = z3.object({
|
|
432
|
-
type: z3.literal("agent.request"),
|
|
433
|
-
requestId: Id2,
|
|
434
|
-
sessionId: Id2,
|
|
435
|
-
nativeSessionId: Id2,
|
|
436
|
-
runtimeId: Id2,
|
|
437
|
-
context: z3.object({ humanInputId: Id2.nullable(), causalMessageId: Id2.nullable() }).strict(),
|
|
438
|
-
toolCallId: Id2.optional(),
|
|
439
|
-
receiptReplay: AgentReceiptReplay.optional(),
|
|
440
|
-
// Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
|
|
441
|
-
deadlineAt: Instant2.optional(),
|
|
442
|
-
method: AgentMethod,
|
|
443
|
-
args: z3.unknown()
|
|
444
|
-
}).strict().superRefine((frame, ctx) => {
|
|
445
|
-
if (frame.method === "receipt.peek") {
|
|
446
|
-
if (!frame.toolCallId) {
|
|
447
|
-
ctx.addIssue({
|
|
448
|
-
code: "custom",
|
|
449
|
-
path: ["toolCallId"],
|
|
450
|
-
message: "Receipt lookup requires a tool call ID."
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (Object.hasOwn(frame, "receiptReplay") && !AgentToolMethod.safeParse(frame.method).success) {
|
|
455
|
-
ctx.addIssue({
|
|
456
|
-
code: "custom",
|
|
457
|
-
path: ["receiptReplay"],
|
|
458
|
-
message: "Receipt replay is only valid for tool methods."
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
var AgentResultFrame = z3.discriminatedUnion("ok", [
|
|
463
|
-
z3.object({
|
|
464
|
-
type: z3.literal("agent.result"),
|
|
465
|
-
requestId: Id2,
|
|
466
|
-
runtimeId: Id2,
|
|
467
|
-
ok: z3.literal(true),
|
|
468
|
-
result: z3.unknown()
|
|
469
|
-
}),
|
|
470
|
-
z3.object({
|
|
471
|
-
type: z3.literal("agent.result"),
|
|
472
|
-
requestId: Id2,
|
|
473
|
-
runtimeId: Id2,
|
|
474
|
-
ok: z3.literal(false),
|
|
475
|
-
error: ErrorBody
|
|
476
|
-
})
|
|
477
|
-
]);
|
|
478
|
-
|
|
479
|
-
// packages/protocol/dist/api.js
|
|
480
|
-
import { z as z11 } from "zod";
|
|
481
|
-
|
|
482
|
-
// packages/protocol/dist/entities.js
|
|
483
|
-
import { z as z7 } from "zod";
|
|
484
|
-
|
|
485
|
-
// packages/protocol/dist/contributions.js
|
|
486
|
-
import { z as z5 } from "zod";
|
|
487
|
-
|
|
488
|
-
// packages/protocol/dist/ui.js
|
|
489
|
-
import { z as z4 } from "zod";
|
|
490
|
-
var ToneSchema = z4.enum(["default", "muted", "success", "warning", "danger"]);
|
|
491
|
-
var ShowIfSchema = z4.object({ field: z4.string(), values: z4.array(z4.string()) });
|
|
492
|
-
var OptionSchema = z4.object({
|
|
493
|
-
value: z4.string(),
|
|
494
|
-
label: z4.string(),
|
|
495
|
-
description: z4.string().optional(),
|
|
496
|
-
preview: z4.string().optional()
|
|
497
|
-
});
|
|
498
|
-
var AllowOther = z4.object({ label: z4.string(), placeholder: z4.string().optional() });
|
|
499
|
-
var FieldSchema = z4.discriminatedUnion("kind", [
|
|
500
|
-
z4.object({
|
|
501
|
-
kind: z4.literal("select"),
|
|
502
|
-
name: z4.string(),
|
|
503
|
-
label: z4.string(),
|
|
504
|
-
options: z4.array(OptionSchema),
|
|
505
|
-
allowOther: AllowOther.optional(),
|
|
506
|
-
showIf: ShowIfSchema.optional()
|
|
507
|
-
}),
|
|
508
|
-
z4.object({
|
|
509
|
-
kind: z4.literal("multiselect"),
|
|
510
|
-
name: z4.string(),
|
|
511
|
-
label: z4.string(),
|
|
512
|
-
options: z4.array(OptionSchema),
|
|
513
|
-
allowOther: AllowOther.optional(),
|
|
514
|
-
min: z4.number().int().min(0).optional(),
|
|
515
|
-
max: z4.number().int().min(1).optional(),
|
|
516
|
-
showIf: ShowIfSchema.optional()
|
|
517
|
-
}),
|
|
518
|
-
z4.object({
|
|
519
|
-
kind: z4.literal("text"),
|
|
520
|
-
name: z4.string(),
|
|
521
|
-
label: z4.string(),
|
|
522
|
-
placeholder: z4.string().optional(),
|
|
523
|
-
multiline: z4.boolean().optional(),
|
|
524
|
-
prefill: z4.string().optional(),
|
|
525
|
-
showIf: ShowIfSchema.optional()
|
|
526
|
-
})
|
|
527
|
-
]);
|
|
528
|
-
var RefSchema = z4.discriminatedUnion("kind", [
|
|
529
|
-
z4.object({ kind: z4.literal("file"), path: z4.string() }),
|
|
530
|
-
z4.object({ kind: z4.literal("session"), sessionId: z4.string() }),
|
|
531
|
-
z4.object({ kind: z4.literal("task"), taskId: z4.string() }),
|
|
532
|
-
z4.object({ kind: z4.literal("native_session"), hostId: z4.string(), sessionFile: z4.string() })
|
|
533
|
-
]);
|
|
534
|
-
var UINodeSchema = z4.lazy(() => z4.discriminatedUnion("t", [
|
|
535
|
-
z4.object({ t: z4.literal("text"), text: z4.string(), tone: ToneSchema.optional() }),
|
|
536
|
-
z4.object({ t: z4.literal("markdown"), text: z4.string() }),
|
|
537
|
-
z4.object({ t: z4.literal("code"), text: z4.string(), lang: z4.string().optional() }),
|
|
538
|
-
z4.object({ t: z4.literal("diff"), patch: z4.string() }),
|
|
539
|
-
z4.object({
|
|
540
|
-
t: z4.literal("list"),
|
|
541
|
-
items: z4.array(UINodeSchema),
|
|
542
|
-
ordered: z4.boolean().optional()
|
|
543
|
-
}),
|
|
544
|
-
z4.object({
|
|
545
|
-
t: z4.literal("table"),
|
|
546
|
-
columns: z4.array(z4.string()),
|
|
547
|
-
rows: z4.array(z4.array(z4.string()))
|
|
548
|
-
}),
|
|
549
|
-
z4.object({
|
|
550
|
-
t: z4.literal("section"),
|
|
551
|
-
title: z4.string().optional(),
|
|
552
|
-
collapsible: z4.boolean().optional(),
|
|
553
|
-
children: z4.array(UINodeSchema)
|
|
554
|
-
}),
|
|
555
|
-
z4.object({
|
|
556
|
-
t: z4.literal("tabs"),
|
|
557
|
-
tabs: z4.array(z4.object({ id: z4.string(), label: z4.string(), children: z4.array(UINodeSchema) }))
|
|
558
|
-
}),
|
|
559
|
-
z4.object({
|
|
560
|
-
t: z4.literal("progress"),
|
|
561
|
-
label: z4.string(),
|
|
562
|
-
value: z4.number().min(0).max(1).optional(),
|
|
563
|
-
status: z4.enum(["running", "ok", "error"]).optional()
|
|
564
|
-
}),
|
|
565
|
-
z4.object({ t: z4.literal("ref"), ref: RefSchema, label: z4.string() }),
|
|
566
|
-
z4.object({
|
|
567
|
-
t: z4.literal("form"),
|
|
568
|
-
formId: z4.string(),
|
|
569
|
-
fields: z4.array(FieldSchema),
|
|
570
|
-
submitLabel: z4.string(),
|
|
571
|
-
cancelLabel: z4.string().optional()
|
|
572
|
-
}),
|
|
573
|
-
z4.object({
|
|
574
|
-
t: z4.literal("confirm"),
|
|
575
|
-
message: z4.string(),
|
|
576
|
-
confirmLabel: z4.string(),
|
|
577
|
-
cancelLabel: z4.string(),
|
|
578
|
-
destructive: z4.boolean().optional()
|
|
579
|
-
}),
|
|
580
|
-
z4.object({
|
|
581
|
-
t: z4.literal("actions"),
|
|
582
|
-
actions: z4.array(z4.object({
|
|
583
|
-
id: z4.string(),
|
|
584
|
-
label: z4.string(),
|
|
585
|
-
tone: z4.enum(["default", "primary", "danger"]).optional()
|
|
586
|
-
}))
|
|
587
|
-
})
|
|
588
|
-
]));
|
|
589
|
-
var FormValueSchema = z4.union([
|
|
590
|
-
z4.string(),
|
|
591
|
-
z4.array(z4.string()),
|
|
592
|
-
z4.object({ other: z4.string() })
|
|
593
|
-
]);
|
|
594
|
-
var InteractionResponseSchema = z4.discriminatedUnion("kind", [
|
|
595
|
-
z4.object({ kind: z4.literal("form"), values: z4.record(z4.string(), FormValueSchema) }),
|
|
596
|
-
z4.object({ kind: z4.literal("confirm"), confirmed: z4.boolean() }),
|
|
597
|
-
z4.object({ kind: z4.literal("action"), actionId: z4.string() }),
|
|
598
|
-
z4.object({ kind: z4.literal("cancel") })
|
|
599
|
-
]);
|
|
600
|
-
|
|
601
|
-
// packages/protocol/dist/contributions.js
|
|
602
|
-
var ContributionPlacement = z5.enum([
|
|
603
|
-
"sidebar.header",
|
|
604
|
-
"sidebar.footer",
|
|
605
|
-
"session.panel",
|
|
606
|
-
"composer.pill",
|
|
607
|
-
"palette.item",
|
|
608
|
-
"slash.command"
|
|
609
|
-
]);
|
|
610
|
-
var Id3 = z5.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
|
|
611
|
-
var ActionId = z5.string().min(1).max(200);
|
|
612
|
-
var Keywords = z5.array(z5.string().min(1).max(80)).max(20);
|
|
613
|
-
var Common = {
|
|
614
|
-
placement: ContributionPlacement,
|
|
615
|
-
order: z5.number().int().min(-1e3).max(1e3).optional(),
|
|
616
|
-
actionId: ActionId.optional()
|
|
617
|
-
};
|
|
618
|
-
var ContributionDescriptor = z5.object({
|
|
619
|
-
id: Id3,
|
|
620
|
-
...Common,
|
|
621
|
-
name: z5.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
|
|
622
|
-
keywords: Keywords.optional()
|
|
623
|
-
}).strict().superRefine((v, ctx) => {
|
|
624
|
-
if (v.placement === "slash.command" && (!v.name || !v.actionId)) {
|
|
625
|
-
ctx.addIssue({ code: "custom", message: "Slash commands need name and actionId" });
|
|
626
|
-
}
|
|
627
|
-
if (v.placement === "palette.item" && !v.actionId) {
|
|
628
|
-
ctx.addIssue({ code: "custom", message: "Palette items need actionId" });
|
|
629
|
-
}
|
|
630
|
-
if (v.placement !== "slash.command" && v.name !== void 0) {
|
|
631
|
-
ctx.addIssue({ code: "custom", message: "Only slash commands have names" });
|
|
632
|
-
}
|
|
633
|
-
if (v.placement !== "palette.item" && v.keywords !== void 0) {
|
|
634
|
-
ctx.addIssue({ code: "custom", message: "Only palette items have keywords" });
|
|
635
|
-
}
|
|
636
|
-
if (v.placement === "composer.pill" && v.actionId !== void 0) {
|
|
637
|
-
ctx.addIssue({ code: "custom", message: "Composer pills are not interactive" });
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
var ContributionInput = z5.object({
|
|
641
|
-
...Common,
|
|
642
|
-
title: z5.string().min(1).max(100),
|
|
643
|
-
node: z5.unknown(),
|
|
644
|
-
mobileFallback: z5.string().min(1).max(2e3),
|
|
645
|
-
state: z5.unknown().optional(),
|
|
646
|
-
name: z5.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
|
|
647
|
-
keywords: Keywords.optional()
|
|
648
|
-
}).strict();
|
|
649
|
-
|
|
650
|
-
// packages/protocol/dist/github.js
|
|
906
|
+
// packages/protocol/dist/trackers.js
|
|
651
907
|
import { z as z6 } from "zod";
|
|
652
|
-
var
|
|
653
|
-
var
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
const u = new URL(s);
|
|
669
|
-
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
670
|
-
} catch {
|
|
671
|
-
return false;
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
var githubUrl = displayUrl.refine((s) => {
|
|
675
|
-
try {
|
|
676
|
-
const u = new URL(s);
|
|
677
|
-
return u.protocol === "https:" && u.hostname === "github.com" && !u.port && /^https:\/\/github\.com(?:[/?#]|$)/i.test(s);
|
|
678
|
-
} catch {
|
|
679
|
-
return false;
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
var GitHubRepository = z6.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\/(?!\.{1,2}$)[A-Za-z0-9_.-]{1,100}$/);
|
|
683
|
-
var issuePath = /^[hH][tT][tT][pP][sS]:\/\/[gG][iI][tT][hH][uU][bB]\.[cC][oO][mM]\/([^/]+)\/([^/]+)\/issues\/([1-9][0-9]*)$/;
|
|
684
|
-
var GitHubIssueUrl = z6.string().trim().transform((raw, ctx) => {
|
|
685
|
-
const match = issuePath.exec(raw);
|
|
686
|
-
const number = match ? Number(match[3]) : NaN;
|
|
687
|
-
if (!match || !GitHubRepository.safeParse(`${match[1]}/${match[2]}`).success || !Number.isSafeInteger(number)) {
|
|
688
|
-
ctx.addIssue({ code: "custom", message: "Invalid GitHub issue URL" });
|
|
689
|
-
return z6.NEVER;
|
|
690
|
-
}
|
|
691
|
-
return `https://github.com/${match[1]}/${match[2]}/issues/${number}`;
|
|
692
|
-
});
|
|
693
|
-
function issueParts(url) {
|
|
694
|
-
const match = issuePath.exec(url);
|
|
695
|
-
return { repository: `${match[1]}/${match[2]}`, number: Number(match[3]) };
|
|
696
|
-
}
|
|
697
|
-
function issuePrompt(url) {
|
|
698
|
-
return `${url}
|
|
699
|
-
|
|
700
|
-
Read it with \`gh issue view ${url}\`.`;
|
|
701
|
-
}
|
|
702
|
-
var GitHubIssueIdentity = z6.object({
|
|
703
|
-
repository: GitHubRepository,
|
|
704
|
-
number: positive,
|
|
705
|
-
url: GitHubIssueUrl
|
|
706
|
-
}).strict().refine((v) => {
|
|
707
|
-
const parts = issueParts(v.url);
|
|
708
|
-
return v.repository === parts.repository && v.number === parts.number;
|
|
709
|
-
});
|
|
710
|
-
var GitHubIssue = z6.object({
|
|
711
|
-
repository: GitHubRepository,
|
|
712
|
-
number: positive,
|
|
713
|
-
url: GitHubIssueUrl,
|
|
714
|
-
launchPrompt: z6.string()
|
|
715
|
-
}).strict().refine((v) => {
|
|
716
|
-
const parts = issueParts(v.url);
|
|
717
|
-
return v.repository === parts.repository && v.number === parts.number && v.launchPrompt === issuePrompt(v.url);
|
|
718
|
-
});
|
|
719
|
-
function githubIssueFromUrl(raw) {
|
|
720
|
-
const url = GitHubIssueUrl.parse(raw);
|
|
721
|
-
return { ...issueParts(url), url, launchPrompt: issuePrompt(url) };
|
|
722
|
-
}
|
|
723
|
-
var GitHubSha = z6.string().regex(/^[0-9a-f]{40}$/);
|
|
724
|
-
var prUrl = githubUrl.refine((s) => {
|
|
725
|
-
try {
|
|
726
|
-
const u = new URL(s);
|
|
727
|
-
return /^\/[^/]+\/[^/]+\/pull\/[1-9][0-9]*$/.test(u.pathname) && !u.search && !u.hash;
|
|
728
|
-
} catch {
|
|
729
|
-
return false;
|
|
730
|
-
}
|
|
731
|
-
});
|
|
732
|
-
function matchesPr(url, repository, number) {
|
|
733
|
-
try {
|
|
734
|
-
const u = new URL(url);
|
|
735
|
-
return u.pathname.toLowerCase() === `/${repository}/pull/${number}`.toLowerCase();
|
|
736
|
-
} catch {
|
|
737
|
-
return false;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
var HostGitHub = z6.object({ available: z6.boolean(), reason: reason.nullable() }).strict().refine((v) => v.available === (v.reason === null));
|
|
741
|
-
var GitHubCheck = z6.object({
|
|
742
|
-
id: hash,
|
|
743
|
-
name: z6.string().min(1).max(300),
|
|
744
|
-
state: z6.string().min(1).max(100),
|
|
745
|
-
bucket: z6.enum(["pass", "fail", "pending", "skipping", "cancel", "unknown"]),
|
|
746
|
-
link: displayUrl.nullable(),
|
|
747
|
-
workflow: z6.string().max(300).nullable(),
|
|
748
|
-
event: z6.string().max(100).nullable(),
|
|
749
|
-
startedAt: Instant3.nullable(),
|
|
750
|
-
completedAt: Instant3.nullable(),
|
|
751
|
-
description: z6.string().max(2e3).nullable(),
|
|
752
|
-
actionsJob: z6.object({ runId: actionsId, jobId: actionsId, attempt: positive }).strict().nullable()
|
|
753
|
-
}).strict();
|
|
754
|
-
var GitHubComment = z6.object({
|
|
755
|
-
id: Id4,
|
|
756
|
-
author: z6.string().min(1).max(200).nullable(),
|
|
757
|
-
body: z6.string().refine((v) => [...v].length <= 8e3),
|
|
758
|
-
bodyTruncated: z6.boolean(),
|
|
759
|
-
url: githubUrl,
|
|
760
|
-
createdAt: Instant3.nullable()
|
|
761
|
-
}).strict();
|
|
762
|
-
var GitHubThread = z6.object({
|
|
908
|
+
var Iso = z6.string();
|
|
909
|
+
var Id4 = z6.string().min(1);
|
|
910
|
+
var GitHubLogin = z6.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/);
|
|
911
|
+
var TrackerStatusOption = z6.object({
|
|
912
|
+
id: z6.string().min(1),
|
|
913
|
+
name: z6.string().min(1).max(200)
|
|
914
|
+
});
|
|
915
|
+
var TrackerBoard = z6.object({
|
|
916
|
+
projectNumber: z6.number().int().positive(),
|
|
917
|
+
statusField: z6.string().min(1).max(100).default("Status"),
|
|
918
|
+
/** Column to move a card to once its worktree exists (write-back). */
|
|
919
|
+
onStart: z6.string().min(1).max(200).nullable().default(null),
|
|
920
|
+
/** Column to move a card to once a pull request is open (write-back). */
|
|
921
|
+
onReview: z6.string().min(1).max(200).nullable().default(null)
|
|
922
|
+
});
|
|
923
|
+
var Tracker = z6.object({
|
|
763
924
|
id: Id4,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
925
|
+
name: z6.string().min(1).max(60),
|
|
926
|
+
provider: z6.literal("github"),
|
|
927
|
+
hostId: Id4,
|
|
928
|
+
owner: GitHubLogin,
|
|
929
|
+
repositories: z6.array(GitHubRepository).min(1).max(50).nullable(),
|
|
930
|
+
board: TrackerBoard.nullable(),
|
|
931
|
+
writeBack: z6.boolean(),
|
|
932
|
+
moveShared: z6.boolean(),
|
|
933
|
+
enabled: z6.boolean(),
|
|
934
|
+
/** The host's `gh` user, from the last sync. */
|
|
935
|
+
login: z6.string().nullable(),
|
|
936
|
+
lastSyncedAt: Iso.nullable(),
|
|
937
|
+
lastError: z6.string().max(2e3).nullable(),
|
|
938
|
+
createdAt: Iso,
|
|
939
|
+
updatedAt: Iso
|
|
940
|
+
});
|
|
941
|
+
var TrackerInput = z6.object({
|
|
942
|
+
name: Tracker.shape.name,
|
|
943
|
+
hostId: Id4,
|
|
944
|
+
owner: GitHubLogin,
|
|
945
|
+
repositories: Tracker.shape.repositories.default(null),
|
|
946
|
+
board: TrackerBoard.nullable().default(null),
|
|
947
|
+
writeBack: z6.boolean().default(false),
|
|
948
|
+
moveShared: z6.boolean().default(true),
|
|
949
|
+
enabled: z6.boolean().default(true)
|
|
950
|
+
});
|
|
951
|
+
var TrackerPatch = z6.object({
|
|
952
|
+
name: Tracker.shape.name.optional(),
|
|
953
|
+
hostId: Id4.optional(),
|
|
954
|
+
owner: GitHubLogin.optional(),
|
|
955
|
+
repositories: Tracker.shape.repositories.optional(),
|
|
956
|
+
board: TrackerBoard.nullable().optional(),
|
|
957
|
+
writeBack: z6.boolean().optional(),
|
|
958
|
+
moveShared: z6.boolean().optional(),
|
|
959
|
+
enabled: z6.boolean().optional()
|
|
960
|
+
});
|
|
961
|
+
var TrackerItemBoard = z6.object({
|
|
962
|
+
projectId: z6.string().min(1),
|
|
963
|
+
projectItemId: z6.string().min(1),
|
|
964
|
+
fieldId: z6.string().min(1),
|
|
965
|
+
status: z6.string().nullable(),
|
|
966
|
+
statusOptionId: z6.string().nullable(),
|
|
967
|
+
options: z6.array(TrackerStatusOption).max(50)
|
|
968
|
+
});
|
|
969
|
+
var TrackerPullRequest = z6.object({
|
|
970
|
+
number: z6.number().int().positive(),
|
|
778
971
|
state: z6.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
779
|
-
|
|
780
|
-
headRefName: z6.string().min(1).max(255)
|
|
781
|
-
headRefOid: GitHubSha,
|
|
782
|
-
headRepository: GitHubRepository.nullable(),
|
|
783
|
-
baseRefName: z6.string().min(1).max(255),
|
|
784
|
-
mergeable: z6.string().min(1).max(100),
|
|
785
|
-
mergeStateStatus: z6.string().min(1).max(100),
|
|
786
|
-
reviewDecision: z6.enum(["APPROVED", "REVIEW_REQUIRED", "CHANGES_REQUESTED"]).nullable(),
|
|
787
|
-
mergeQueueEnabled: z6.boolean(),
|
|
788
|
-
inMergeQueue: z6.boolean(),
|
|
789
|
-
autoMergeEnabled: z6.boolean(),
|
|
790
|
-
squashMergeAllowed: z6.boolean()
|
|
791
|
-
}).strict().refine((v) => {
|
|
792
|
-
try {
|
|
793
|
-
return new URL(v.url).pathname.endsWith(`/pull/${v.number}`);
|
|
794
|
-
} catch {
|
|
795
|
-
return false;
|
|
796
|
-
}
|
|
972
|
+
url: z6.string().url(),
|
|
973
|
+
headRefName: z6.string().min(1).max(255)
|
|
797
974
|
});
|
|
798
|
-
var
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
pullRequest:
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
975
|
+
var TrackerItem = z6.object({
|
|
976
|
+
itemId: z6.string().min(1),
|
|
977
|
+
repository: GitHubRepository,
|
|
978
|
+
number: z6.number().int().positive(),
|
|
979
|
+
title: z6.string().min(1).max(1e3),
|
|
980
|
+
url: GitHubIssueUrl,
|
|
981
|
+
assignees: z6.array(z6.string()).max(20),
|
|
982
|
+
branches: z6.array(z6.string().min(1).max(255)).max(10),
|
|
983
|
+
pullRequest: TrackerPullRequest.nullable(),
|
|
984
|
+
board: TrackerItemBoard.nullable()
|
|
985
|
+
});
|
|
986
|
+
var TrackerSyncResult = z6.object({
|
|
987
|
+
login: z6.string().min(1),
|
|
988
|
+
items: z6.array(TrackerItem).max(200),
|
|
811
989
|
truncated: z6.boolean()
|
|
812
|
-
}).strict().refine((v) => {
|
|
813
|
-
if (bytes2(JSON.stringify(v)) > 512 * 1024 || new Set(v.checks.map((c) => c.id)).size !== v.checks.length)
|
|
814
|
-
return false;
|
|
815
|
-
if (v.pullRequest && (!v.repository || !matchesPr(v.pullRequest.url, v.repository, v.pullRequest.number)))
|
|
816
|
-
return false;
|
|
817
|
-
if (v.threads.some((t) => !t.commentsComplete || t.comments.some((c) => c.bodyTruncated)) && (v.threadsComplete || !v.truncated))
|
|
818
|
-
return false;
|
|
819
|
-
if (v.status !== "ready")
|
|
820
|
-
return v.reason !== null && !v.checksComplete && !v.threadsComplete;
|
|
821
|
-
return v.reason === null && v.fetchedAt !== null && v.repository !== null && v.headRepository !== null && v.branch !== null && (v.pullRequest !== null || v.checks.length === 0 && v.threads.length === 0 && v.checksComplete && v.threadsComplete);
|
|
822
990
|
});
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (!s)
|
|
827
|
-
return 0;
|
|
828
|
-
const lines = s.replace(/\r\n/g, "\n").split("\n");
|
|
829
|
-
if (lines[lines.length - 1] === "")
|
|
830
|
-
lines.pop();
|
|
831
|
-
return lines.length;
|
|
832
|
-
}
|
|
833
|
-
var GitHubJobLog = z6.object({
|
|
834
|
-
checkId: hash,
|
|
835
|
-
name: z6.string().min(1).max(300),
|
|
836
|
-
url: displayUrl.nullable(),
|
|
837
|
-
runId: actionsId.nullable(),
|
|
838
|
-
jobId: actionsId.nullable(),
|
|
839
|
-
attempt: positive.nullable(),
|
|
840
|
-
status: z6.enum([
|
|
841
|
-
"available",
|
|
842
|
-
"unmapped",
|
|
843
|
-
"incomplete",
|
|
844
|
-
"expired",
|
|
845
|
-
"forbidden",
|
|
846
|
-
"timeout",
|
|
847
|
-
"error"
|
|
848
|
-
]),
|
|
849
|
-
outputTail: z6.string().nullable(),
|
|
850
|
-
lineCount: nonnegative.max(150),
|
|
851
|
-
truncated: z6.boolean(),
|
|
852
|
-
reason: reason.nullable()
|
|
853
|
-
}).strict().refine((v) => v.status === "available" ? v.runId !== null && v.jobId !== null && v.attempt !== null && v.outputTail !== null && bytes2(v.outputTail) <= 65536 && lineCount(v.outputTail) === v.lineCount && v.reason === null : v.outputTail === null && v.lineCount === 0 && v.reason !== null);
|
|
854
|
-
var GitHubLogs = z6.object({
|
|
855
|
-
github: HostGitHub,
|
|
991
|
+
var TaskTracker = z6.object({
|
|
992
|
+
trackerId: Id4,
|
|
993
|
+
itemId: z6.string().min(1),
|
|
856
994
|
repository: GitHubRepository,
|
|
857
|
-
number: positive,
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
}).strict().refine((v) => bytes2(JSON.stringify(v)) <= 1024 * 1024 && (v.status === "ready" ? v.github.available && v.reason === null && (!v.complete || v.omittedJobs === 0 && v.jobs.every((j) => j.status === "available")) : v.reason !== null && v.jobs.length === 0 && !v.complete));
|
|
867
|
-
var GitHubLogsRequest = z6.object({ expectedHeadOid: GitHubSha }).strict();
|
|
868
|
-
var GitHubMergeRequest = z6.object({ expectedHeadOid: GitHubSha }).strict();
|
|
869
|
-
var mergeFields = {
|
|
870
|
-
github: HostGitHub,
|
|
871
|
-
repository: GitHubRepository,
|
|
872
|
-
number: positive,
|
|
873
|
-
url: prUrl,
|
|
874
|
-
expectedHeadOid: GitHubSha
|
|
875
|
-
};
|
|
876
|
-
var GitHubMergeResult = z6.discriminatedUnion("status", [
|
|
877
|
-
z6.object({
|
|
878
|
-
status: z6.literal("merged"),
|
|
879
|
-
...mergeFields,
|
|
880
|
-
mergeCommitOid: GitHubSha.nullable(),
|
|
881
|
-
confirmedAt: Instant3
|
|
882
|
-
}).strict(),
|
|
995
|
+
number: z6.number().int().positive(),
|
|
996
|
+
assignees: z6.array(z6.string()).max(20),
|
|
997
|
+
branch: z6.string().nullable(),
|
|
998
|
+
workspaceId: Id4.nullable(),
|
|
999
|
+
pullRequest: TrackerPullRequest.nullable(),
|
|
1000
|
+
board: TrackerItemBoard.nullable()
|
|
1001
|
+
});
|
|
1002
|
+
var TrackerSetStatusResult = z6.discriminatedUnion("status", [
|
|
1003
|
+
z6.object({ status: z6.literal("moved") }),
|
|
883
1004
|
z6.object({
|
|
884
|
-
status: z6.literal("
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1005
|
+
status: z6.literal("skipped"),
|
|
1006
|
+
reason: z6.enum(["not_assigned", "shared", "stale"])
|
|
1007
|
+
})
|
|
1008
|
+
]);
|
|
1009
|
+
var TrackerStatusRequest = z6.object({ status: z6.string().min(1).max(200) });
|
|
1010
|
+
var TrackerHostSyncRequest = z6.object({
|
|
1011
|
+
owner: GitHubLogin,
|
|
1012
|
+
repositories: z6.array(GitHubRepository).nullable(),
|
|
1013
|
+
board: z6.object({ projectNumber: z6.number().int().positive(), statusField: z6.string().min(1) }).nullable()
|
|
1014
|
+
});
|
|
1015
|
+
var TrackerHostPrepareBranchRequest = z6.object({
|
|
1016
|
+
checkoutPath: z6.string().min(1),
|
|
1017
|
+
branch: z6.string().min(1).max(255)
|
|
1018
|
+
});
|
|
1019
|
+
var TrackerHostStartIssueRequest = z6.object({
|
|
1020
|
+
checkoutPath: z6.string().min(1),
|
|
1021
|
+
repository: GitHubRepository,
|
|
1022
|
+
number: z6.number().int().positive(),
|
|
1023
|
+
branch: z6.string().min(1).max(255),
|
|
1024
|
+
base: z6.string().min(1)
|
|
1025
|
+
});
|
|
1026
|
+
var TrackerHostSetStatusRequest = z6.object({
|
|
1027
|
+
projectId: z6.string().min(1),
|
|
1028
|
+
projectItemId: z6.string().min(1),
|
|
1029
|
+
fieldId: z6.string().min(1),
|
|
1030
|
+
statusField: z6.string().min(1),
|
|
1031
|
+
optionId: z6.string().min(1),
|
|
1032
|
+
expectedOptionId: z6.string().nullable(),
|
|
1033
|
+
login: z6.string().min(1),
|
|
1034
|
+
allowShared: z6.boolean()
|
|
895
1035
|
});
|
|
896
1036
|
|
|
897
1037
|
// packages/protocol/dist/entities.js
|
|
898
|
-
var
|
|
1038
|
+
var Iso2 = z7.string();
|
|
899
1039
|
var Id5 = z7.string();
|
|
900
1040
|
var Connectivity = z7.enum(["connected", "reconnecting", "unreachable"]);
|
|
901
1041
|
var ControlMode = z7.enum(["automation", "human"]);
|
|
@@ -929,12 +1069,14 @@ var RuntimeCapabilities = CoreCapabilities.extend({
|
|
|
929
1069
|
agentRequests: z7.boolean().optional(),
|
|
930
1070
|
messageDelivery: z7.boolean().optional(),
|
|
931
1071
|
policies: z7.boolean().optional(),
|
|
1072
|
+
/** Session-scoped adapter inspection and safe reload. */
|
|
1073
|
+
adapterDevelopment: z7.boolean().optional(),
|
|
932
1074
|
unsupported: z7.array(z7.object({ capability: z7.string(), reason: z7.string() }))
|
|
933
1075
|
});
|
|
934
1076
|
var ProjectScan = z7.object({
|
|
935
1077
|
state: z7.enum(["running", "done", "failed"]),
|
|
936
|
-
startedAt:
|
|
937
|
-
finishedAt:
|
|
1078
|
+
startedAt: Iso2,
|
|
1079
|
+
finishedAt: Iso2.nullable(),
|
|
938
1080
|
/** Repositories found across all folders. */
|
|
939
1081
|
repositories: z7.number().int(),
|
|
940
1082
|
/** New projects created by this scan. */
|
|
@@ -947,14 +1089,14 @@ var ProjectScan = z7.object({
|
|
|
947
1089
|
var UsageWindow = z7.object({
|
|
948
1090
|
id: z7.enum(["five_hour", "weekly"]),
|
|
949
1091
|
usedPct: z7.number(),
|
|
950
|
-
resetsAt:
|
|
1092
|
+
resetsAt: Iso2.nullable()
|
|
951
1093
|
});
|
|
952
1094
|
var ProviderUsage = z7.object({
|
|
953
1095
|
provider: z7.enum(["anthropic", "openai-codex"]),
|
|
954
1096
|
status: z7.enum(["available", "expired", "rejected", "error"]),
|
|
955
1097
|
message: z7.string().nullable(),
|
|
956
1098
|
windows: z7.array(UsageWindow),
|
|
957
|
-
fetchedAt:
|
|
1099
|
+
fetchedAt: Iso2
|
|
958
1100
|
});
|
|
959
1101
|
var Host = z7.object({
|
|
960
1102
|
id: Id5,
|
|
@@ -965,9 +1107,9 @@ var Host = z7.object({
|
|
|
965
1107
|
piCompatible: z7.boolean(),
|
|
966
1108
|
capabilities: RuntimeCapabilities.nullable(),
|
|
967
1109
|
connectivity: Connectivity,
|
|
968
|
-
lastSeenAt:
|
|
969
|
-
revokedAt:
|
|
970
|
-
createdAt:
|
|
1110
|
+
lastSeenAt: Iso2.nullable(),
|
|
1111
|
+
revokedAt: Iso2.nullable(),
|
|
1112
|
+
createdAt: Iso2,
|
|
971
1113
|
/** Folders on the host whose git repositories become projects (absolute or ~/...). */
|
|
972
1114
|
projectFolders: z7.array(z7.string()).optional(),
|
|
973
1115
|
projectScan: ProjectScan.nullable().optional(),
|
|
@@ -988,8 +1130,12 @@ var Project = z7.object({
|
|
|
988
1130
|
checks: z7.array(z7.string()),
|
|
989
1131
|
workspaceSharing: z7.enum(["single_writer", "shared"]),
|
|
990
1132
|
worktreeDir: WorktreeDir.default(DEFAULT_WORKTREE_DIR),
|
|
991
|
-
|
|
992
|
-
|
|
1133
|
+
/** Start one session in every non-main worktree the first time it appears without one. */
|
|
1134
|
+
ensureSessions: z7.boolean().default(false),
|
|
1135
|
+
/** Archive sessions and remove a worktree (and its local branch) once its PR has merged. */
|
|
1136
|
+
removeLanded: z7.boolean().default(false),
|
|
1137
|
+
createdAt: Iso2,
|
|
1138
|
+
updatedAt: Iso2
|
|
993
1139
|
});
|
|
994
1140
|
var Checkout = z7.object({
|
|
995
1141
|
id: Id5,
|
|
@@ -998,14 +1144,16 @@ var Checkout = z7.object({
|
|
|
998
1144
|
path: z7.string(),
|
|
999
1145
|
commonDir: z7.string(),
|
|
1000
1146
|
defaultBranch: z7.string(),
|
|
1001
|
-
createdAt:
|
|
1147
|
+
createdAt: Iso2
|
|
1002
1148
|
});
|
|
1003
1149
|
var GitState = z7.object({
|
|
1004
1150
|
dirty: z7.boolean(),
|
|
1005
1151
|
changedFiles: z7.number().int(),
|
|
1006
1152
|
ahead: z7.number().int(),
|
|
1007
1153
|
behind: z7.number().int(),
|
|
1008
|
-
unmerged: z7.boolean()
|
|
1154
|
+
unmerged: z7.boolean(),
|
|
1155
|
+
/** HEAD commit; absent from older hosts. */
|
|
1156
|
+
head: z7.string().regex(/^[0-9a-f]{40}$/).optional()
|
|
1009
1157
|
});
|
|
1010
1158
|
var Workspace = z7.object({
|
|
1011
1159
|
id: Id5,
|
|
@@ -1021,8 +1169,8 @@ var Workspace = z7.object({
|
|
|
1021
1169
|
state: z7.enum(["none", "running", "succeeded", "failed"]),
|
|
1022
1170
|
log: z7.string()
|
|
1023
1171
|
}),
|
|
1024
|
-
archivedAt:
|
|
1025
|
-
updatedAt:
|
|
1172
|
+
archivedAt: Iso2.nullable(),
|
|
1173
|
+
updatedAt: Iso2,
|
|
1026
1174
|
github: WorkspaceGitHub.optional()
|
|
1027
1175
|
});
|
|
1028
1176
|
var ThinkingLevel = z7.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
@@ -1070,7 +1218,7 @@ var ViewClient = z7.object({
|
|
|
1070
1218
|
kind: z7.enum(["herdr", "tmux"]),
|
|
1071
1219
|
name: z7.string().min(1),
|
|
1072
1220
|
machine: z7.string().min(1),
|
|
1073
|
-
lastSeenAt:
|
|
1221
|
+
lastSeenAt: Iso2
|
|
1074
1222
|
});
|
|
1075
1223
|
var View = z7.object({
|
|
1076
1224
|
id: Id5,
|
|
@@ -1080,8 +1228,15 @@ var View = z7.object({
|
|
|
1080
1228
|
hostIds: z7.array(z7.string()).nullable(),
|
|
1081
1229
|
sessionIds: z7.array(z7.string()),
|
|
1082
1230
|
clients: z7.array(ViewClient),
|
|
1083
|
-
|
|
1084
|
-
|
|
1231
|
+
/** A tracker keeps this view's projects (see docs/trackers.md). */
|
|
1232
|
+
trackerId: z7.string().nullable().optional(),
|
|
1233
|
+
/**
|
|
1234
|
+
* A client as membership authority: sessions enrolled from this client (`ViewClient` id,
|
|
1235
|
+
* `herdr:<session>@<machine>`) are pinned here when they first appear.
|
|
1236
|
+
*/
|
|
1237
|
+
clientId: z7.string().min(1).max(200).nullable().optional(),
|
|
1238
|
+
createdAt: Iso2,
|
|
1239
|
+
updatedAt: Iso2
|
|
1085
1240
|
});
|
|
1086
1241
|
var RuntimeState = z7.enum([
|
|
1087
1242
|
"starting",
|
|
@@ -1101,7 +1256,7 @@ var SessionStats = z7.object({
|
|
|
1101
1256
|
context: ContextUsage.nullable().optional()
|
|
1102
1257
|
});
|
|
1103
1258
|
var PromptCacheInfo = z7.object({
|
|
1104
|
-
at:
|
|
1259
|
+
at: Iso2,
|
|
1105
1260
|
provider: z7.string(),
|
|
1106
1261
|
model: z7.string(),
|
|
1107
1262
|
cacheRead: z7.number(),
|
|
@@ -1125,8 +1280,8 @@ var Session = z7.object({
|
|
|
1125
1280
|
taskId: Id5.nullable(),
|
|
1126
1281
|
provenance: z7.enum(["created", "imported", "subagent"]),
|
|
1127
1282
|
readOnly: z7.boolean(),
|
|
1128
|
-
lastActivityAt:
|
|
1129
|
-
archivedAt:
|
|
1283
|
+
lastActivityAt: Iso2,
|
|
1284
|
+
archivedAt: Iso2.nullable(),
|
|
1130
1285
|
queue: z7.object({ steering: z7.array(z7.string()), followUp: z7.array(z7.string()) }),
|
|
1131
1286
|
stats: SessionStats.nullable(),
|
|
1132
1287
|
/** The live model (host-owned; last known when stopped). */
|
|
@@ -1136,11 +1291,18 @@ var Session = z7.object({
|
|
|
1136
1291
|
/** Pi is compacting the context. */
|
|
1137
1292
|
compacting: z7.boolean().optional(),
|
|
1138
1293
|
lastAssistantText: z7.string().nullable(),
|
|
1139
|
-
createdAt:
|
|
1294
|
+
createdAt: Iso2,
|
|
1140
1295
|
/** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
|
|
1141
1296
|
terminal: z7.boolean().optional(),
|
|
1297
|
+
/**
|
|
1298
|
+
* A Pi the user started in their own terminal and enrolled (`client`: the herdr session it runs
|
|
1299
|
+
* in, when known). Switchyard never shows or closes that terminal.
|
|
1300
|
+
*/
|
|
1301
|
+
external: z7.object({ client: z7.string().min(1).max(200).nullable() }).nullable().optional(),
|
|
1142
1302
|
/** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
|
|
1143
|
-
unreadSince:
|
|
1303
|
+
unreadSince: Iso2.nullable().optional(),
|
|
1304
|
+
/** Identity of the adapter presentation currently installed on the host. */
|
|
1305
|
+
adapterGeneration: z7.string().uuid().optional(),
|
|
1144
1306
|
/** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
|
|
1145
1307
|
transcriptEpoch: z7.number().int().min(0).optional(),
|
|
1146
1308
|
bridge: z7.object({
|
|
@@ -1157,7 +1319,7 @@ var Session = z7.object({
|
|
|
1157
1319
|
/** Last assistant message's cache usage (host-owned). */
|
|
1158
1320
|
promptCache: PromptCacheInfo.nullable().optional(),
|
|
1159
1321
|
/** Warn before the prompt cache expires; non-null means on (coordinator-owned). */
|
|
1160
|
-
cacheAlert: z7.object({ ttlSec: z7.number().int().min(60).max(86400).nullable(), warnedFor:
|
|
1322
|
+
cacheAlert: z7.object({ ttlSec: z7.number().int().min(60).max(86400).nullable(), warnedFor: Iso2.nullable() }).nullable().optional()
|
|
1161
1323
|
});
|
|
1162
1324
|
var ContinuationPolicy = z7.discriminatedUnion("enabled", [
|
|
1163
1325
|
z7.object({ enabled: z7.literal(false) }),
|
|
@@ -1211,20 +1373,22 @@ var Task = z7.object({
|
|
|
1211
1373
|
position: z7.number(),
|
|
1212
1374
|
state: TaskState,
|
|
1213
1375
|
blocked: z7.object({ reason: z7.string() }).nullable(),
|
|
1214
|
-
notBefore:
|
|
1376
|
+
notBefore: Iso2.nullable(),
|
|
1215
1377
|
policy: TaskPolicy,
|
|
1216
1378
|
origin: TaskOrigin,
|
|
1217
1379
|
groupingKey: z7.string().nullable(),
|
|
1218
1380
|
parentTaskId: Id5.nullable().optional(),
|
|
1219
1381
|
agentOrigin: z7.object({ sessionId: Id5, toolCallId: Id5 }).optional(),
|
|
1220
1382
|
githubIssue: GitHubIssue.optional(),
|
|
1383
|
+
/** Set while a tracker owns this task (server-owned). */
|
|
1384
|
+
tracker: TaskTracker.optional(),
|
|
1221
1385
|
currentRunId: Id5.nullable(),
|
|
1222
1386
|
sessionId: Id5.nullable(),
|
|
1223
1387
|
review: z7.object({ feedback: z7.array(z7.string()), changesRequested: z7.boolean() }),
|
|
1224
1388
|
hiddenFromBoard: z7.boolean(),
|
|
1225
|
-
lastActivityAt:
|
|
1226
|
-
createdAt:
|
|
1227
|
-
updatedAt:
|
|
1389
|
+
lastActivityAt: Iso2,
|
|
1390
|
+
createdAt: Iso2,
|
|
1391
|
+
updatedAt: Iso2
|
|
1228
1392
|
});
|
|
1229
1393
|
var RunState = z7.enum([
|
|
1230
1394
|
"queued",
|
|
@@ -1255,9 +1419,9 @@ var Run = z7.object({
|
|
|
1255
1419
|
controlRevision: z7.number().int().min(1),
|
|
1256
1420
|
continuationsUsed: z7.number().int().min(0),
|
|
1257
1421
|
infraRetries: z7.number().int().min(0),
|
|
1258
|
-
nextAttemptAt:
|
|
1259
|
-
startedAt:
|
|
1260
|
-
endedAt:
|
|
1422
|
+
nextAttemptAt: Iso2.nullable(),
|
|
1423
|
+
startedAt: Iso2.nullable(),
|
|
1424
|
+
endedAt: Iso2.nullable(),
|
|
1261
1425
|
outcome: z7.object({
|
|
1262
1426
|
kind: z7.enum(["review", "failed", "blocked", "no_change", "canceled"]),
|
|
1263
1427
|
summary: z7.string()
|
|
@@ -1270,12 +1434,12 @@ var Run = z7.object({
|
|
|
1270
1434
|
note: z7.string().nullable()
|
|
1271
1435
|
}),
|
|
1272
1436
|
checks: z7.array(CheckResult),
|
|
1273
|
-
createdAt:
|
|
1274
|
-
updatedAt:
|
|
1437
|
+
createdAt: Iso2,
|
|
1438
|
+
updatedAt: Iso2
|
|
1275
1439
|
});
|
|
1276
1440
|
var Trigger = z7.discriminatedUnion("kind", [
|
|
1277
1441
|
z7.object({ kind: z7.literal("manual") }),
|
|
1278
|
-
z7.object({ kind: z7.literal("once"), at:
|
|
1442
|
+
z7.object({ kind: z7.literal("once"), at: Iso2 }),
|
|
1279
1443
|
z7.object({ kind: z7.literal("cron"), expr: z7.string().min(1), timezone: z7.string().min(1) }),
|
|
1280
1444
|
z7.object({ kind: z7.literal("webhook") }),
|
|
1281
1445
|
z7.object({ kind: z7.literal("dependency"), taskId: Id5 })
|
|
@@ -1302,13 +1466,13 @@ var Automation = z7.object({
|
|
|
1302
1466
|
missed: z7.enum(["skip", "run_once"]),
|
|
1303
1467
|
continuation: ContinuationPolicy,
|
|
1304
1468
|
completion: CompletionPolicy,
|
|
1305
|
-
nextAt:
|
|
1306
|
-
lastEvaluatedAt:
|
|
1469
|
+
nextAt: Iso2.nullable(),
|
|
1470
|
+
lastEvaluatedAt: Iso2.nullable(),
|
|
1307
1471
|
lastOutcome: z7.string().nullable(),
|
|
1308
1472
|
failureCount: z7.number().int().min(0),
|
|
1309
1473
|
webhookTokenSet: z7.boolean(),
|
|
1310
|
-
createdAt:
|
|
1311
|
-
updatedAt:
|
|
1474
|
+
createdAt: Iso2,
|
|
1475
|
+
updatedAt: Iso2
|
|
1312
1476
|
});
|
|
1313
1477
|
var OccurrenceState = z7.enum([
|
|
1314
1478
|
"fired",
|
|
@@ -1323,12 +1487,12 @@ var Occurrence = z7.object({
|
|
|
1323
1487
|
id: Id5,
|
|
1324
1488
|
automationId: Id5,
|
|
1325
1489
|
key: z7.string(),
|
|
1326
|
-
scheduledFor:
|
|
1490
|
+
scheduledFor: Iso2.nullable(),
|
|
1327
1491
|
state: OccurrenceState,
|
|
1328
1492
|
taskId: Id5.nullable(),
|
|
1329
1493
|
reason: z7.string().nullable(),
|
|
1330
1494
|
outcome: z7.string().nullable(),
|
|
1331
|
-
createdAt:
|
|
1495
|
+
createdAt: Iso2
|
|
1332
1496
|
});
|
|
1333
1497
|
var InteractionState = z7.preprocess((v) => v === "cancelled" ? "canceled" : v, z7.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
|
|
1334
1498
|
var Interaction = z7.object({
|
|
@@ -1348,8 +1512,8 @@ var Interaction = z7.object({
|
|
|
1348
1512
|
title: z7.string(),
|
|
1349
1513
|
presentation: UINodeSchema,
|
|
1350
1514
|
state: InteractionState,
|
|
1351
|
-
resolution: z7.object({ by: z7.string(), summary: z7.string(), at:
|
|
1352
|
-
createdAt:
|
|
1515
|
+
resolution: z7.object({ by: z7.string(), summary: z7.string(), at: Iso2 }).nullable(),
|
|
1516
|
+
createdAt: Iso2
|
|
1353
1517
|
});
|
|
1354
1518
|
var AttentionReason = z7.enum([
|
|
1355
1519
|
"needs_input",
|
|
@@ -1369,17 +1533,17 @@ var AttentionItem = z7.object({
|
|
|
1369
1533
|
summary: z7.string(),
|
|
1370
1534
|
interactionId: Id5.nullable(),
|
|
1371
1535
|
deepLink: z7.string(),
|
|
1372
|
-
acknowledgedAt:
|
|
1373
|
-
resolvedAt:
|
|
1374
|
-
createdAt:
|
|
1536
|
+
acknowledgedAt: Iso2.nullable(),
|
|
1537
|
+
resolvedAt: Iso2.nullable(),
|
|
1538
|
+
createdAt: Iso2
|
|
1375
1539
|
});
|
|
1376
1540
|
var Device = z7.object({
|
|
1377
1541
|
id: Id5,
|
|
1378
1542
|
name: z7.string(),
|
|
1379
1543
|
kind: DeviceKind,
|
|
1380
|
-
createdAt:
|
|
1381
|
-
lastSeenAt:
|
|
1382
|
-
revokedAt:
|
|
1544
|
+
createdAt: Iso2,
|
|
1545
|
+
lastSeenAt: Iso2.nullable(),
|
|
1546
|
+
revokedAt: Iso2.nullable(),
|
|
1383
1547
|
push: z7.object({
|
|
1384
1548
|
subscribed: z7.boolean(),
|
|
1385
1549
|
permission: z7.enum(["granted", "denied", "default", "unknown"])
|
|
@@ -1394,17 +1558,18 @@ var ToolItemData = z7.object({
|
|
|
1394
1558
|
args: z7.unknown(),
|
|
1395
1559
|
summary: z7.string(),
|
|
1396
1560
|
output: z7.string(),
|
|
1397
|
-
startedAt:
|
|
1561
|
+
startedAt: Iso2,
|
|
1398
1562
|
durationMs: z7.number().nullable(),
|
|
1399
1563
|
card: UINodeSchema.nullable(),
|
|
1400
|
-
adapterId: z7.string().nullable()
|
|
1564
|
+
adapterId: z7.string().nullable(),
|
|
1565
|
+
adapterGeneration: z7.string().uuid().optional()
|
|
1401
1566
|
});
|
|
1402
1567
|
var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
1403
1568
|
z7.object({
|
|
1404
1569
|
id: Id5,
|
|
1405
1570
|
sessionId: Id5,
|
|
1406
1571
|
order: z7.number().int(),
|
|
1407
|
-
at:
|
|
1572
|
+
at: Iso2,
|
|
1408
1573
|
kind: z7.literal("user"),
|
|
1409
1574
|
data: z7.object({
|
|
1410
1575
|
text: z7.string(),
|
|
@@ -1417,7 +1582,7 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1417
1582
|
id: Id5,
|
|
1418
1583
|
sessionId: Id5,
|
|
1419
1584
|
order: z7.number().int(),
|
|
1420
|
-
at:
|
|
1585
|
+
at: Iso2,
|
|
1421
1586
|
kind: z7.literal("assistant"),
|
|
1422
1587
|
data: z7.object({ text: z7.string(), streaming: z7.boolean().optional() })
|
|
1423
1588
|
}),
|
|
@@ -1425,7 +1590,7 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1425
1590
|
id: Id5,
|
|
1426
1591
|
sessionId: Id5,
|
|
1427
1592
|
order: z7.number().int(),
|
|
1428
|
-
at:
|
|
1593
|
+
at: Iso2,
|
|
1429
1594
|
kind: z7.literal("thinking"),
|
|
1430
1595
|
data: z7.object({ text: z7.string() })
|
|
1431
1596
|
}),
|
|
@@ -1433,7 +1598,7 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1433
1598
|
id: Id5,
|
|
1434
1599
|
sessionId: Id5,
|
|
1435
1600
|
order: z7.number().int(),
|
|
1436
|
-
at:
|
|
1601
|
+
at: Iso2,
|
|
1437
1602
|
kind: z7.literal("tool"),
|
|
1438
1603
|
data: ToolItemData
|
|
1439
1604
|
}),
|
|
@@ -1441,21 +1606,22 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1441
1606
|
id: Id5,
|
|
1442
1607
|
sessionId: Id5,
|
|
1443
1608
|
order: z7.number().int(),
|
|
1444
|
-
at:
|
|
1609
|
+
at: Iso2,
|
|
1445
1610
|
kind: z7.literal("notice"),
|
|
1446
1611
|
data: z7.object({
|
|
1447
1612
|
level: DiagnosticLevel,
|
|
1448
1613
|
text: z7.string(),
|
|
1449
1614
|
customType: z7.string().min(1).max(200).optional(),
|
|
1450
1615
|
card: UINodeSchema.optional(),
|
|
1451
|
-
adapterId: z7.string().optional()
|
|
1616
|
+
adapterId: z7.string().optional(),
|
|
1617
|
+
adapterGeneration: z7.string().uuid().optional()
|
|
1452
1618
|
}).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
|
|
1453
1619
|
}),
|
|
1454
1620
|
z7.object({
|
|
1455
1621
|
id: Id5,
|
|
1456
1622
|
sessionId: Id5,
|
|
1457
1623
|
order: z7.number().int(),
|
|
1458
|
-
at:
|
|
1624
|
+
at: Iso2,
|
|
1459
1625
|
kind: z7.literal("interaction"),
|
|
1460
1626
|
data: z7.object({ interactionId: Id5 })
|
|
1461
1627
|
}),
|
|
@@ -1463,7 +1629,7 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1463
1629
|
id: Id5,
|
|
1464
1630
|
sessionId: Id5,
|
|
1465
1631
|
order: z7.number().int(),
|
|
1466
|
-
at:
|
|
1632
|
+
at: Iso2,
|
|
1467
1633
|
kind: z7.literal("subagent"),
|
|
1468
1634
|
data: z7.object({
|
|
1469
1635
|
runId: z7.string(),
|
|
@@ -1477,7 +1643,7 @@ var TranscriptItem = z7.discriminatedUnion("kind", [
|
|
|
1477
1643
|
id: Id5,
|
|
1478
1644
|
sessionId: Id5,
|
|
1479
1645
|
order: z7.number().int(),
|
|
1480
|
-
at:
|
|
1646
|
+
at: Iso2,
|
|
1481
1647
|
kind: z7.literal("system"),
|
|
1482
1648
|
data: z7.object({ text: z7.string(), suggestion: z7.boolean().optional() })
|
|
1483
1649
|
})
|
|
@@ -1492,14 +1658,15 @@ var Panel = z7.object({
|
|
|
1492
1658
|
mobileFallback: z7.string().nullable(),
|
|
1493
1659
|
contribution: ContributionDescriptor.optional(),
|
|
1494
1660
|
state: z7.unknown().optional(),
|
|
1495
|
-
|
|
1661
|
+
adapterGeneration: z7.string().uuid().optional(),
|
|
1662
|
+
updatedAt: Iso2
|
|
1496
1663
|
});
|
|
1497
1664
|
var Diagnostic = z7.object({
|
|
1498
1665
|
sessionId: Id5.nullable(),
|
|
1499
1666
|
adapterId: z7.string().nullable(),
|
|
1500
1667
|
level: DiagnosticLevel,
|
|
1501
1668
|
message: z7.string(),
|
|
1502
|
-
at:
|
|
1669
|
+
at: Iso2
|
|
1503
1670
|
});
|
|
1504
1671
|
var AdapterInfo = z7.object({
|
|
1505
1672
|
id: z7.string(),
|
|
@@ -1518,44 +1685,383 @@ var AdapterInfo = z7.object({
|
|
|
1518
1685
|
var Passkey = z7.object({
|
|
1519
1686
|
id: z7.string(),
|
|
1520
1687
|
name: z7.string(),
|
|
1521
|
-
createdAt:
|
|
1522
|
-
lastUsedAt:
|
|
1688
|
+
createdAt: Iso2,
|
|
1689
|
+
lastUsedAt: Iso2.nullable(),
|
|
1523
1690
|
transports: z7.array(z7.string())
|
|
1524
1691
|
});
|
|
1525
1692
|
|
|
1526
|
-
// packages/protocol/dist/
|
|
1693
|
+
// packages/protocol/dist/adapter-preview.js
|
|
1694
|
+
var ADAPTER_PREVIEW_MAX_BYTES = 1024 * 1024;
|
|
1695
|
+
var ADAPTER_PREVIEW_MAX_STEPS = 200;
|
|
1696
|
+
var ADAPTER_PREVIEW_SESSION_ID = "ses_adapter_preview";
|
|
1697
|
+
function bounded(input, ctx) {
|
|
1698
|
+
try {
|
|
1699
|
+
boundContributionJson(input, ADAPTER_PREVIEW_MAX_BYTES);
|
|
1700
|
+
return input;
|
|
1701
|
+
} catch (error) {
|
|
1702
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1703
|
+
return z8.NEVER;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
var Id6 = z8.string().min(1).max(200);
|
|
1707
|
+
var Text2 = z8.string().max(64 * 1024);
|
|
1708
|
+
var Tool = { toolCallId: Id6, name: Id6, args: z8.unknown() };
|
|
1709
|
+
var DialogCommon = { id: Id6, title: Text2 };
|
|
1710
|
+
var AdapterPreviewPiUiRequestSchema = z8.discriminatedUnion("method", [
|
|
1711
|
+
z8.object({
|
|
1712
|
+
...DialogCommon,
|
|
1713
|
+
method: z8.literal("select"),
|
|
1714
|
+
options: z8.array(Text2).max(200),
|
|
1715
|
+
timeout: z8.number().nonnegative().optional()
|
|
1716
|
+
}).strict(),
|
|
1717
|
+
z8.object({
|
|
1718
|
+
...DialogCommon,
|
|
1719
|
+
method: z8.literal("confirm"),
|
|
1720
|
+
message: Text2,
|
|
1721
|
+
timeout: z8.number().nonnegative().optional()
|
|
1722
|
+
}).strict(),
|
|
1723
|
+
z8.object({
|
|
1724
|
+
...DialogCommon,
|
|
1725
|
+
method: z8.literal("input"),
|
|
1726
|
+
placeholder: Text2.optional(),
|
|
1727
|
+
timeout: z8.number().nonnegative().optional()
|
|
1728
|
+
}).strict(),
|
|
1729
|
+
z8.object({ ...DialogCommon, method: z8.literal("editor"), prefill: Text2.optional() }).strict()
|
|
1730
|
+
]);
|
|
1731
|
+
var AdapterPreviewStepSchema = z8.discriminatedUnion("kind", [
|
|
1732
|
+
z8.object({ kind: z8.literal("restore") }).strict(),
|
|
1733
|
+
z8.object({ kind: z8.literal("toolStart"), data: z8.object(Tool).strict() }).strict(),
|
|
1734
|
+
z8.object({
|
|
1735
|
+
kind: z8.literal("toolUpdate"),
|
|
1736
|
+
data: z8.object({ ...Tool, partialResult: z8.unknown(), details: z8.unknown().optional() }).strict()
|
|
1737
|
+
}).strict(),
|
|
1738
|
+
z8.object({
|
|
1739
|
+
kind: z8.literal("toolEnd"),
|
|
1740
|
+
data: z8.object({
|
|
1741
|
+
...Tool,
|
|
1742
|
+
result: z8.unknown(),
|
|
1743
|
+
isError: z8.boolean(),
|
|
1744
|
+
details: z8.unknown().optional()
|
|
1745
|
+
}).strict()
|
|
1746
|
+
}).strict(),
|
|
1747
|
+
z8.object({
|
|
1748
|
+
kind: z8.literal("status"),
|
|
1749
|
+
data: z8.object({ key: Id6, text: Text2.optional() }).strict()
|
|
1750
|
+
}).strict(),
|
|
1751
|
+
z8.object({
|
|
1752
|
+
kind: z8.literal("widget"),
|
|
1753
|
+
data: z8.object({ key: Id6, lines: z8.array(Text2).max(200).optional() }).strict()
|
|
1754
|
+
}).strict(),
|
|
1755
|
+
z8.object({ kind: z8.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
|
|
1756
|
+
z8.object({
|
|
1757
|
+
kind: z8.literal("answer"),
|
|
1758
|
+
data: z8.object({ requestId: Id6, response: InteractionResponseSchema }).strict()
|
|
1759
|
+
}).strict(),
|
|
1760
|
+
z8.object({
|
|
1761
|
+
kind: z8.literal("customMessage"),
|
|
1762
|
+
data: z8.object({
|
|
1763
|
+
customType: Id6,
|
|
1764
|
+
content: z8.unknown(),
|
|
1765
|
+
display: z8.boolean().optional(),
|
|
1766
|
+
details: z8.unknown().optional()
|
|
1767
|
+
}).strict()
|
|
1768
|
+
}).strict(),
|
|
1769
|
+
z8.object({
|
|
1770
|
+
kind: z8.literal("action"),
|
|
1771
|
+
data: z8.object({ actionId: Id6, payload: z8.unknown() }).strict()
|
|
1772
|
+
}).strict()
|
|
1773
|
+
]);
|
|
1774
|
+
var AdapterPreviewFixtureSchema = z8.unknown().transform(bounded).pipe(z8.object({
|
|
1775
|
+
version: z8.literal(1),
|
|
1776
|
+
name: z8.string().min(1).max(200),
|
|
1777
|
+
initialState: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional(),
|
|
1778
|
+
steps: z8.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
|
|
1779
|
+
}).strict());
|
|
1780
|
+
var PortableNode = z8.unknown().transform((input, ctx) => {
|
|
1781
|
+
try {
|
|
1782
|
+
return validateUINode(input);
|
|
1783
|
+
} catch (error) {
|
|
1784
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1785
|
+
return z8.NEVER;
|
|
1786
|
+
}
|
|
1787
|
+
});
|
|
1788
|
+
var PreviewPanel = Panel.extend({ webRenderer: z8.literal(false) }).superRefine((panel, ctx) => {
|
|
1789
|
+
try {
|
|
1790
|
+
if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
|
|
1791
|
+
throw new Error("Preview panels must use the fake preview session");
|
|
1792
|
+
if (panel.node !== null)
|
|
1793
|
+
validateUINode(panel.node);
|
|
1794
|
+
if (panel.contribution) {
|
|
1795
|
+
const { id, ...descriptor } = panel.contribution;
|
|
1796
|
+
if (panel.slot !== contributionSlot(id))
|
|
1797
|
+
throw new Error("Contribution slot does not match its id");
|
|
1798
|
+
validateContribution(id, {
|
|
1799
|
+
...descriptor,
|
|
1800
|
+
title: panel.title,
|
|
1801
|
+
node: panel.node,
|
|
1802
|
+
mobileFallback: panel.mobileFallback,
|
|
1803
|
+
...panel.state === void 0 ? {} : { state: panel.state }
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
} catch (error) {
|
|
1807
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
var AdapterPreviewSchema = z8.unknown().transform(bounded).pipe(z8.object({
|
|
1811
|
+
version: z8.literal(1),
|
|
1812
|
+
name: z8.string().min(1).max(200),
|
|
1813
|
+
adapter: z8.object({ id: Id6, version: Id6 }).strict(),
|
|
1814
|
+
steps: z8.array(z8.object({
|
|
1815
|
+
index: z8.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
|
|
1816
|
+
kind: z8.enum([
|
|
1817
|
+
"restore",
|
|
1818
|
+
"toolStart",
|
|
1819
|
+
"toolUpdate",
|
|
1820
|
+
"toolEnd",
|
|
1821
|
+
"status",
|
|
1822
|
+
"widget",
|
|
1823
|
+
"dialog",
|
|
1824
|
+
"answer",
|
|
1825
|
+
"customMessage",
|
|
1826
|
+
"action"
|
|
1827
|
+
]),
|
|
1828
|
+
ok: z8.boolean(),
|
|
1829
|
+
error: z8.string().max(4e3).nullable()
|
|
1830
|
+
}).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
|
|
1831
|
+
panels: z8.array(PreviewPanel).max(256),
|
|
1832
|
+
interactions: z8.array(z8.object({
|
|
1833
|
+
request: AdapterPreviewPiUiRequestSchema,
|
|
1834
|
+
presentation: PortableNode,
|
|
1835
|
+
state: z8.enum(["pending", "resolved"])
|
|
1836
|
+
}).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
|
|
1837
|
+
cards: z8.array(z8.unknown().transform((input, ctx) => {
|
|
1838
|
+
try {
|
|
1839
|
+
return validateContributionCard(input);
|
|
1840
|
+
} catch (error) {
|
|
1841
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1842
|
+
return z8.NEVER;
|
|
1843
|
+
}
|
|
1844
|
+
})).max(ADAPTER_PREVIEW_MAX_STEPS * 3),
|
|
1845
|
+
diagnostics: z8.array(Diagnostic.extend({ message: z8.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
|
|
1846
|
+
}).strict().superRefine((preview, ctx) => {
|
|
1847
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1848
|
+
let contributions = 0;
|
|
1849
|
+
for (const panel of preview.panels) {
|
|
1850
|
+
if (panel.adapterId !== preview.adapter.id)
|
|
1851
|
+
ctx.addIssue({
|
|
1852
|
+
code: "custom",
|
|
1853
|
+
message: "Preview panel belongs to a different adapter"
|
|
1854
|
+
});
|
|
1855
|
+
const key = JSON.stringify([panel.adapterId, panel.slot]);
|
|
1856
|
+
if (slots.has(key))
|
|
1857
|
+
ctx.addIssue({ code: "custom", message: "Duplicate preview panel slot" });
|
|
1858
|
+
slots.add(key);
|
|
1859
|
+
if (panel.contribution && ++contributions > 64)
|
|
1860
|
+
ctx.addIssue({
|
|
1861
|
+
code: "custom",
|
|
1862
|
+
message: "At most 64 contributions per adapter/session"
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
const requests = /* @__PURE__ */ new Set();
|
|
1866
|
+
for (const interaction of preview.interactions) {
|
|
1867
|
+
if (requests.has(interaction.request.id))
|
|
1868
|
+
ctx.addIssue({ code: "custom", message: "Duplicate preview dialog" });
|
|
1869
|
+
requests.add(interaction.request.id);
|
|
1870
|
+
}
|
|
1871
|
+
}));
|
|
1872
|
+
|
|
1873
|
+
// packages/protocol/dist/adapters.js
|
|
1874
|
+
import { z as z9 } from "zod";
|
|
1875
|
+
var Path = z9.string().max(4096);
|
|
1876
|
+
var SessionAdapterInfo = AdapterInfo.extend({
|
|
1877
|
+
runtimeStatus: z9.enum(["active", "disabled", "unavailable"]),
|
|
1878
|
+
runtimeDetail: z9.string().max(4e3).nullable(),
|
|
1879
|
+
provenance: z9.object({
|
|
1880
|
+
scope: z9.enum(["user", "project", "explicit"]),
|
|
1881
|
+
source: Path.nullable(),
|
|
1882
|
+
packageDir: Path.nullable(),
|
|
1883
|
+
manifestPath: Path.nullable(),
|
|
1884
|
+
targetVersion: z9.string().nullable(),
|
|
1885
|
+
entrypoints: z9.array(Path).max(128),
|
|
1886
|
+
evidence: z9.enum(["runtime-reported", "package-level", "explicit"])
|
|
1887
|
+
})
|
|
1888
|
+
});
|
|
1889
|
+
var SessionAdaptersResult = z9.object({
|
|
1890
|
+
generation: z9.string().uuid().nullable(),
|
|
1891
|
+
runtimeId: z9.string().nullable(),
|
|
1892
|
+
reloadable: z9.boolean(),
|
|
1893
|
+
blockedReason: z9.string().nullable(),
|
|
1894
|
+
adapters: z9.array(SessionAdapterInfo).max(256),
|
|
1895
|
+
diagnostics: z9.array(Diagnostic).max(100)
|
|
1896
|
+
});
|
|
1897
|
+
|
|
1898
|
+
// packages/protocol/dist/agent-wire.js
|
|
1527
1899
|
import { z as z10 } from "zod";
|
|
1900
|
+
var Id7 = z10.string().min(1).max(200);
|
|
1901
|
+
var Instant3 = z10.string().refine((value) => {
|
|
1902
|
+
const date = new Date(value);
|
|
1903
|
+
return Number.isFinite(date.getTime()) && date.toISOString() === value;
|
|
1904
|
+
}, "Expected canonical UTC timestamp");
|
|
1905
|
+
var AGENT_FRAME_MAX_BYTES = 128 * 1024;
|
|
1906
|
+
var AgentMethod = z10.enum([
|
|
1907
|
+
"session.bind",
|
|
1908
|
+
"task.create",
|
|
1909
|
+
"message.send",
|
|
1910
|
+
"inbox.read",
|
|
1911
|
+
"receipt.peek",
|
|
1912
|
+
"policy.evaluate",
|
|
1913
|
+
"policy.status",
|
|
1914
|
+
"policy.cancel"
|
|
1915
|
+
]);
|
|
1916
|
+
var AgentToolMethod = z10.enum(["task.create", "message.send", "inbox.read"]);
|
|
1917
|
+
var RequestHash = z10.string().regex(/^[a-f0-9]{64}$/);
|
|
1918
|
+
var AgentReceiptPeekRequest = z10.object({ method: AgentToolMethod, args: z10.record(z10.string(), z10.json()) }).strict();
|
|
1919
|
+
var AgentReceiptPeekResult = z10.discriminatedUnion("found", [
|
|
1920
|
+
z10.object({ found: z10.literal(false) }).strict(),
|
|
1921
|
+
z10.object({ found: z10.literal(true), requestHash: RequestHash }).strict()
|
|
1922
|
+
]);
|
|
1923
|
+
var AgentReceiptReplay = z10.object({ requestHash: RequestHash }).strict();
|
|
1924
|
+
var CreateAgentTask = z10.object({
|
|
1925
|
+
objective: z10.string().min(1).max(16e3),
|
|
1926
|
+
acceptance: z10.array(z10.string().min(1).max(2e3)).max(100).default([]),
|
|
1927
|
+
dependencies: z10.array(Id7).max(100).default([]),
|
|
1928
|
+
parentTaskId: Id7.nullable().optional(),
|
|
1929
|
+
hostId: Id7.optional(),
|
|
1930
|
+
profileId: Id7.optional(),
|
|
1931
|
+
notifyOnFinish: z10.boolean().default(true)
|
|
1932
|
+
});
|
|
1933
|
+
var SendAgentMessage = z10.object({
|
|
1934
|
+
sessionId: Id7,
|
|
1935
|
+
body: z10.string().min(1).max(16e3),
|
|
1936
|
+
mode: z10.enum(["steer", "queue"]),
|
|
1937
|
+
replyTo: Id7.optional()
|
|
1938
|
+
});
|
|
1939
|
+
var ReadAgentInbox = z10.object({
|
|
1940
|
+
after: z10.number().int().nonnegative().default(0),
|
|
1941
|
+
limit: z10.number().int().min(1).max(100).default(20)
|
|
1942
|
+
});
|
|
1943
|
+
var DeliveryState = z10.enum([
|
|
1944
|
+
"pending",
|
|
1945
|
+
"held",
|
|
1946
|
+
"deferred",
|
|
1947
|
+
"accepted",
|
|
1948
|
+
"queued",
|
|
1949
|
+
"appended",
|
|
1950
|
+
"uncertain",
|
|
1951
|
+
"failed"
|
|
1952
|
+
]);
|
|
1953
|
+
var AgentMessageFields = {
|
|
1954
|
+
seq: z10.number().int().positive(),
|
|
1955
|
+
id: Id7,
|
|
1956
|
+
recipientSessionId: Id7,
|
|
1957
|
+
replyTo: Id7.nullable(),
|
|
1958
|
+
chainId: Id7,
|
|
1959
|
+
depth: z10.number().int().min(0).max(4),
|
|
1960
|
+
body: z10.unknown(),
|
|
1961
|
+
requestedMode: z10.enum(["steer", "queue"]),
|
|
1962
|
+
deliveryState: DeliveryState,
|
|
1963
|
+
holdUntil: z10.string(),
|
|
1964
|
+
readAt: z10.string().nullable(),
|
|
1965
|
+
createdAt: z10.string()
|
|
1966
|
+
};
|
|
1967
|
+
var AgentMessage = z10.discriminatedUnion("kind", [
|
|
1968
|
+
z10.object({ ...AgentMessageFields, kind: z10.literal("message"), senderSessionId: Id7 }),
|
|
1969
|
+
z10.object({
|
|
1970
|
+
...AgentMessageFields,
|
|
1971
|
+
kind: z10.literal("completion"),
|
|
1972
|
+
senderSessionId: Id7.nullable()
|
|
1973
|
+
})
|
|
1974
|
+
]);
|
|
1975
|
+
var AgentInbox = z10.object({
|
|
1976
|
+
messages: z10.array(AgentMessage),
|
|
1977
|
+
nextAfter: z10.number().int().nonnegative(),
|
|
1978
|
+
hasMore: z10.boolean()
|
|
1979
|
+
});
|
|
1980
|
+
var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z10.literal("policy.required") }).strict();
|
|
1981
|
+
var AgentRequestFrame = z10.object({
|
|
1982
|
+
type: z10.literal("agent.request"),
|
|
1983
|
+
requestId: Id7,
|
|
1984
|
+
sessionId: Id7,
|
|
1985
|
+
nativeSessionId: Id7,
|
|
1986
|
+
runtimeId: Id7,
|
|
1987
|
+
context: z10.object({ humanInputId: Id7.nullable(), causalMessageId: Id7.nullable() }).strict(),
|
|
1988
|
+
toolCallId: Id7.optional(),
|
|
1989
|
+
receiptReplay: AgentReceiptReplay.optional(),
|
|
1990
|
+
// Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
|
|
1991
|
+
deadlineAt: Instant3.optional(),
|
|
1992
|
+
method: AgentMethod,
|
|
1993
|
+
args: z10.unknown()
|
|
1994
|
+
}).strict().superRefine((frame, ctx) => {
|
|
1995
|
+
if (frame.method === "receipt.peek") {
|
|
1996
|
+
if (!frame.toolCallId) {
|
|
1997
|
+
ctx.addIssue({
|
|
1998
|
+
code: "custom",
|
|
1999
|
+
path: ["toolCallId"],
|
|
2000
|
+
message: "Receipt lookup requires a tool call ID."
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
if (Object.hasOwn(frame, "receiptReplay") && !AgentToolMethod.safeParse(frame.method).success) {
|
|
2005
|
+
ctx.addIssue({
|
|
2006
|
+
code: "custom",
|
|
2007
|
+
path: ["receiptReplay"],
|
|
2008
|
+
message: "Receipt replay is only valid for tool methods."
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
var AgentResultFrame = z10.discriminatedUnion("ok", [
|
|
2013
|
+
z10.object({
|
|
2014
|
+
type: z10.literal("agent.result"),
|
|
2015
|
+
requestId: Id7,
|
|
2016
|
+
runtimeId: Id7,
|
|
2017
|
+
ok: z10.literal(true),
|
|
2018
|
+
result: z10.unknown()
|
|
2019
|
+
}),
|
|
2020
|
+
z10.object({
|
|
2021
|
+
type: z10.literal("agent.result"),
|
|
2022
|
+
requestId: Id7,
|
|
2023
|
+
runtimeId: Id7,
|
|
2024
|
+
ok: z10.literal(false),
|
|
2025
|
+
error: ErrorBody
|
|
2026
|
+
})
|
|
2027
|
+
]);
|
|
2028
|
+
|
|
2029
|
+
// packages/protocol/dist/api.js
|
|
2030
|
+
import { z as z14 } from "zod";
|
|
2031
|
+
|
|
2032
|
+
// packages/protocol/dist/host-wire.js
|
|
2033
|
+
import { z as z13 } from "zod";
|
|
1528
2034
|
|
|
1529
2035
|
// packages/protocol/dist/events.js
|
|
1530
|
-
import { z as
|
|
2036
|
+
import { z as z11 } from "zod";
|
|
1531
2037
|
var EventDataSchemas = {
|
|
1532
2038
|
"host.updated": Host,
|
|
1533
2039
|
"project.updated": Project,
|
|
1534
|
-
"project.deleted":
|
|
2040
|
+
"project.deleted": z11.object({ id: z11.string() }),
|
|
1535
2041
|
"checkout.updated": Checkout,
|
|
1536
2042
|
"workspace.updated": Workspace,
|
|
1537
|
-
"workspace.deleted":
|
|
2043
|
+
"workspace.deleted": z11.object({ id: z11.string() }),
|
|
1538
2044
|
"profile.updated": Profile,
|
|
1539
|
-
"profile.deleted":
|
|
2045
|
+
"profile.deleted": z11.object({ id: z11.string() }),
|
|
1540
2046
|
"view.updated": View,
|
|
1541
|
-
"view.deleted":
|
|
2047
|
+
"view.deleted": z11.object({ id: z11.string() }),
|
|
1542
2048
|
"session.updated": Session,
|
|
1543
2049
|
"transcript.item": TranscriptItem,
|
|
1544
|
-
"transcript.reset":
|
|
2050
|
+
"transcript.reset": z11.object({ sessionId: z11.string(), epoch: z11.number().int() }),
|
|
1545
2051
|
"interaction.updated": Interaction,
|
|
1546
2052
|
"panel.updated": Panel,
|
|
1547
|
-
"adapters.updated":
|
|
2053
|
+
"adapters.updated": z11.object({ hostId: z11.string(), adapters: z11.array(AdapterInfo) }),
|
|
1548
2054
|
diagnostic: Diagnostic,
|
|
1549
2055
|
"task.updated": Task,
|
|
1550
|
-
"task.deleted":
|
|
2056
|
+
"task.deleted": z11.object({ id: z11.string() }),
|
|
1551
2057
|
"run.updated": Run,
|
|
1552
2058
|
"automation.updated": Automation,
|
|
1553
|
-
"automation.deleted":
|
|
2059
|
+
"automation.deleted": z11.object({ id: z11.string() }),
|
|
1554
2060
|
"occurrence.created": Occurrence,
|
|
1555
2061
|
"occurrence.updated": Occurrence,
|
|
1556
2062
|
"attention.updated": AttentionItem,
|
|
1557
2063
|
"device.updated": Device,
|
|
1558
|
-
"settings.updated":
|
|
2064
|
+
"settings.updated": z11.object({ dispatchPaused: z11.boolean() })
|
|
1559
2065
|
};
|
|
1560
2066
|
var EVENT_TYPES = Object.keys(EventDataSchemas);
|
|
1561
2067
|
var LEGACY_EVENT_TYPES = {
|
|
@@ -1565,19 +2071,19 @@ function canonicalEventType(type) {
|
|
|
1565
2071
|
return LEGACY_EVENT_TYPES[type] ?? type;
|
|
1566
2072
|
}
|
|
1567
2073
|
var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
|
|
1568
|
-
var EventTypeSchema =
|
|
1569
|
-
var EventScope =
|
|
1570
|
-
hostId:
|
|
1571
|
-
sessionId:
|
|
1572
|
-
taskId:
|
|
1573
|
-
projectId:
|
|
2074
|
+
var EventTypeSchema = z11.preprocess(canonical, z11.enum(EVENT_TYPES));
|
|
2075
|
+
var EventScope = z11.object({
|
|
2076
|
+
hostId: z11.string().optional(),
|
|
2077
|
+
sessionId: z11.string().optional(),
|
|
2078
|
+
taskId: z11.string().optional(),
|
|
2079
|
+
projectId: z11.string().optional()
|
|
1574
2080
|
});
|
|
1575
2081
|
var EventEnvelope = EventScope.extend({
|
|
1576
|
-
seq:
|
|
1577
|
-
id:
|
|
2082
|
+
seq: z11.number().int(),
|
|
2083
|
+
id: z11.string(),
|
|
1578
2084
|
type: EventTypeSchema,
|
|
1579
|
-
at:
|
|
1580
|
-
data:
|
|
2085
|
+
at: z11.string(),
|
|
2086
|
+
data: z11.unknown()
|
|
1581
2087
|
});
|
|
1582
2088
|
var HOST_EVENT_TYPES = [
|
|
1583
2089
|
"session.updated",
|
|
@@ -1590,318 +2096,327 @@ var HOST_EVENT_TYPES = [
|
|
|
1590
2096
|
"workspace.deleted"
|
|
1591
2097
|
];
|
|
1592
2098
|
var HostEvent = EventScope.extend({
|
|
1593
|
-
eventId:
|
|
1594
|
-
type:
|
|
1595
|
-
at:
|
|
1596
|
-
data:
|
|
1597
|
-
});
|
|
1598
|
-
var StreamDelta =
|
|
1599
|
-
sessionId:
|
|
1600
|
-
itemId:
|
|
1601
|
-
kind:
|
|
1602
|
-
delta:
|
|
1603
|
-
order:
|
|
2099
|
+
eventId: z11.string(),
|
|
2100
|
+
type: z11.preprocess(canonical, z11.enum(HOST_EVENT_TYPES)),
|
|
2101
|
+
at: z11.string(),
|
|
2102
|
+
data: z11.unknown()
|
|
2103
|
+
});
|
|
2104
|
+
var StreamDelta = z11.object({
|
|
2105
|
+
sessionId: z11.string(),
|
|
2106
|
+
itemId: z11.string(),
|
|
2107
|
+
kind: z11.enum(["text", "thinking", "tool_args", "tool_output"]),
|
|
2108
|
+
delta: z11.string(),
|
|
2109
|
+
order: z11.number().int().optional()
|
|
1604
2110
|
});
|
|
1605
2111
|
|
|
1606
2112
|
// packages/protocol/dist/terminal-wire.js
|
|
1607
|
-
import { z as
|
|
1608
|
-
var Cols =
|
|
1609
|
-
var Rows =
|
|
1610
|
-
var TermViewerToServer =
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
2113
|
+
import { z as z12 } from "zod";
|
|
2114
|
+
var Cols = z12.number().int().min(10).max(1e3);
|
|
2115
|
+
var Rows = z12.number().int().min(5).max(500);
|
|
2116
|
+
var TermViewerToServer = z12.discriminatedUnion("t", [
|
|
2117
|
+
z12.object({ t: z12.literal("in"), d: z12.string() }),
|
|
2118
|
+
z12.object({ t: z12.literal("resize"), cols: Cols, rows: Rows }),
|
|
2119
|
+
z12.object({ t: z12.literal("claim") })
|
|
1614
2120
|
]);
|
|
1615
|
-
var TermServerToViewer =
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
2121
|
+
var TermServerToViewer = z12.discriminatedUnion("t", [
|
|
2122
|
+
z12.object({ t: z12.literal("out"), d: z12.string() }),
|
|
2123
|
+
z12.object({ t: z12.literal("closed"), reason: z12.string() }),
|
|
2124
|
+
z12.object({ t: z12.literal("size"), cols: Cols, rows: Rows, owner: z12.boolean() })
|
|
1619
2125
|
]);
|
|
1620
|
-
var TermCoordinatorMsg =
|
|
1621
|
-
|
|
1622
|
-
t:
|
|
1623
|
-
sessionId:
|
|
2126
|
+
var TermCoordinatorMsg = z12.discriminatedUnion("t", [
|
|
2127
|
+
z12.object({
|
|
2128
|
+
t: z12.literal("open"),
|
|
2129
|
+
sessionId: z12.string(),
|
|
1624
2130
|
cols: Cols,
|
|
1625
2131
|
rows: Rows,
|
|
1626
|
-
passive:
|
|
2132
|
+
passive: z12.boolean().optional()
|
|
1627
2133
|
}),
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
2134
|
+
z12.object({ t: z12.literal("claim") }),
|
|
2135
|
+
z12.object({ t: z12.literal("in"), d: z12.string() }),
|
|
2136
|
+
z12.object({ t: z12.literal("resize"), cols: Cols, rows: Rows }),
|
|
2137
|
+
z12.object({ t: z12.literal("close") })
|
|
1632
2138
|
]);
|
|
1633
2139
|
|
|
1634
2140
|
// packages/protocol/dist/host-wire.js
|
|
1635
|
-
var Origin =
|
|
1636
|
-
var HostCommand =
|
|
1637
|
-
|
|
1638
|
-
type:
|
|
1639
|
-
sessionId:
|
|
1640
|
-
title:
|
|
1641
|
-
workspacePath:
|
|
1642
|
-
projectId:
|
|
2141
|
+
var Origin = z13.enum(["human", "automation"]);
|
|
2142
|
+
var HostCommand = z13.discriminatedUnion("type", [
|
|
2143
|
+
z13.object({
|
|
2144
|
+
type: z13.literal("session.start"),
|
|
2145
|
+
sessionId: z13.string(),
|
|
2146
|
+
title: z13.string(),
|
|
2147
|
+
workspacePath: z13.string(),
|
|
2148
|
+
projectId: z13.string().nullable(),
|
|
1643
2149
|
profile: Profile,
|
|
1644
2150
|
nativeHandle: NativeHandle.nullable(),
|
|
1645
|
-
initialPrompt:
|
|
1646
|
-
dispatchKey:
|
|
1647
|
-
controlRevision:
|
|
2151
|
+
initialPrompt: z13.string().nullable(),
|
|
2152
|
+
dispatchKey: z13.string().nullable(),
|
|
2153
|
+
controlRevision: z13.number().int(),
|
|
1648
2154
|
controlMode: ControlMode,
|
|
1649
2155
|
origin: Origin,
|
|
1650
|
-
readOnly:
|
|
1651
|
-
policyRequired:
|
|
2156
|
+
readOnly: z13.boolean().default(false),
|
|
2157
|
+
policyRequired: z13.boolean().optional()
|
|
1652
2158
|
}),
|
|
1653
|
-
|
|
1654
|
-
type:
|
|
1655
|
-
sessionId:
|
|
1656
|
-
messageId:
|
|
1657
|
-
payload:
|
|
1658
|
-
deliveryId:
|
|
1659
|
-
kind:
|
|
1660
|
-
text:
|
|
2159
|
+
z13.object({
|
|
2160
|
+
type: z13.literal("session.deliverMessage"),
|
|
2161
|
+
sessionId: z13.string(),
|
|
2162
|
+
messageId: z13.string(),
|
|
2163
|
+
payload: z13.object({
|
|
2164
|
+
deliveryId: z13.string(),
|
|
2165
|
+
kind: z13.enum(["message", "completion"]),
|
|
2166
|
+
text: z13.string()
|
|
1661
2167
|
}),
|
|
1662
|
-
mode:
|
|
1663
|
-
holdUntil:
|
|
2168
|
+
mode: z13.enum(["steer", "queue"]),
|
|
2169
|
+
holdUntil: z13.string()
|
|
1664
2170
|
}),
|
|
1665
|
-
HostPolicySampleRequest.extend({ type:
|
|
1666
|
-
|
|
1667
|
-
type:
|
|
1668
|
-
sessionId:
|
|
1669
|
-
messageIds:
|
|
2171
|
+
HostPolicySampleRequest.extend({ type: z13.literal("session.classifyPolicySample") }),
|
|
2172
|
+
z13.object({
|
|
2173
|
+
type: z13.literal("session.messageStatus"),
|
|
2174
|
+
sessionId: z13.string(),
|
|
2175
|
+
messageIds: z13.array(z13.string().min(1)).min(1).max(100)
|
|
1670
2176
|
}),
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
sessionId:
|
|
1674
|
-
text:
|
|
1675
|
-
images:
|
|
1676
|
-
mode:
|
|
2177
|
+
z13.object({
|
|
2178
|
+
type: z13.literal("session.prompt"),
|
|
2179
|
+
sessionId: z13.string(),
|
|
2180
|
+
text: z13.string(),
|
|
2181
|
+
images: z13.array(z13.object({ mimeType: z13.string(), data: z13.string() })).default([]),
|
|
2182
|
+
mode: z13.enum(["prompt", "steer", "followUp"]),
|
|
1677
2183
|
origin: Origin,
|
|
1678
|
-
controlRevision:
|
|
2184
|
+
controlRevision: z13.number().int()
|
|
1679
2185
|
}),
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
type:
|
|
1684
|
-
sessionId:
|
|
1685
|
-
interactionId:
|
|
1686
|
-
revision:
|
|
2186
|
+
z13.object({ type: z13.literal("session.abort"), sessionId: z13.string(), clearQueue: z13.boolean() }),
|
|
2187
|
+
z13.object({ type: z13.literal("session.stop"), sessionId: z13.string() }),
|
|
2188
|
+
z13.object({
|
|
2189
|
+
type: z13.literal("session.answer"),
|
|
2190
|
+
sessionId: z13.string(),
|
|
2191
|
+
interactionId: z13.string(),
|
|
2192
|
+
revision: z13.number().int(),
|
|
1687
2193
|
response: InteractionResponseSchema,
|
|
1688
|
-
deviceId:
|
|
2194
|
+
deviceId: z13.string()
|
|
1689
2195
|
}),
|
|
1690
|
-
|
|
1691
|
-
type:
|
|
1692
|
-
sessionId:
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
2196
|
+
z13.object({
|
|
2197
|
+
type: z13.literal("session.adapterAction"),
|
|
2198
|
+
sessionId: z13.string(),
|
|
2199
|
+
generation: z13.string().uuid().optional(),
|
|
2200
|
+
adapterId: z13.string(),
|
|
2201
|
+
actionId: z13.string(),
|
|
2202
|
+
payload: z13.unknown()
|
|
1696
2203
|
}),
|
|
1697
|
-
|
|
1698
|
-
type:
|
|
1699
|
-
sessionId:
|
|
1700
|
-
controlRevision:
|
|
2204
|
+
z13.object({
|
|
2205
|
+
type: z13.literal("session.setControl"),
|
|
2206
|
+
sessionId: z13.string(),
|
|
2207
|
+
controlRevision: z13.number().int(),
|
|
1701
2208
|
mode: ControlMode
|
|
1702
2209
|
}),
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
type:
|
|
1711
|
-
sessionId:
|
|
1712
|
-
text:
|
|
2210
|
+
z13.object({ type: z13.literal("session.rename"), sessionId: z13.string(), title: z13.string() }),
|
|
2211
|
+
z13.object({ type: z13.literal("session.importable") }),
|
|
2212
|
+
z13.object({ type: z13.literal("session.readNative"), sessionFile: z13.string() }),
|
|
2213
|
+
z13.object({ type: z13.literal("session.snapshot"), sessionId: z13.string() }),
|
|
2214
|
+
z13.object({ type: z13.literal("session.models"), sessionId: z13.string() }),
|
|
2215
|
+
z13.object({ type: z13.literal("session.commands"), sessionId: z13.string() }),
|
|
2216
|
+
z13.object({
|
|
2217
|
+
type: z13.literal("session.complete"),
|
|
2218
|
+
sessionId: z13.string(),
|
|
2219
|
+
text: z13.string().max(500)
|
|
1713
2220
|
}),
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
type:
|
|
1717
|
-
sessionId:
|
|
1718
|
-
entryId:
|
|
1719
|
-
fork:
|
|
2221
|
+
z13.object({ type: z13.literal("session.tree"), sessionId: z13.string() }),
|
|
2222
|
+
z13.object({
|
|
2223
|
+
type: z13.literal("session.branch"),
|
|
2224
|
+
sessionId: z13.string(),
|
|
2225
|
+
entryId: z13.string().nullable(),
|
|
2226
|
+
fork: z13.boolean()
|
|
1720
2227
|
}),
|
|
1721
|
-
|
|
1722
|
-
type:
|
|
1723
|
-
sessionId:
|
|
1724
|
-
entryId:
|
|
1725
|
-
summarize:
|
|
1726
|
-
instructions:
|
|
2228
|
+
z13.object({
|
|
2229
|
+
type: z13.literal("session.navigate"),
|
|
2230
|
+
sessionId: z13.string(),
|
|
2231
|
+
entryId: z13.string(),
|
|
2232
|
+
summarize: z13.boolean(),
|
|
2233
|
+
instructions: z13.string().max(2e3).nullable()
|
|
1727
2234
|
}),
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2235
|
+
z13.object({ type: z13.literal("session.reload"), sessionId: z13.string() }),
|
|
2236
|
+
z13.object({ type: z13.literal("session.adapters"), sessionId: z13.string() }),
|
|
2237
|
+
z13.object({ type: z13.literal("session.reloadAdapters"), sessionId: z13.string() }),
|
|
2238
|
+
z13.object({ type: z13.literal("session.export"), sessionId: z13.string() }),
|
|
2239
|
+
z13.object({
|
|
2240
|
+
type: z13.literal("session.setModel"),
|
|
2241
|
+
sessionId: z13.string(),
|
|
2242
|
+
provider: z13.string().min(1),
|
|
2243
|
+
modelId: z13.string().min(1)
|
|
1735
2244
|
}),
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
type:
|
|
1739
|
-
sessionId:
|
|
1740
|
-
instructions:
|
|
2245
|
+
z13.object({ type: z13.literal("session.setThinking"), sessionId: z13.string(), level: ThinkingLevel }),
|
|
2246
|
+
z13.object({
|
|
2247
|
+
type: z13.literal("session.compact"),
|
|
2248
|
+
sessionId: z13.string(),
|
|
2249
|
+
instructions: z13.string().nullable()
|
|
1741
2250
|
}),
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1746
|
-
days:
|
|
2251
|
+
z13.object({ type: z13.literal("checkout.inspect"), path: z13.string() }),
|
|
2252
|
+
z13.object({ type: z13.literal("projects.scan"), folder: z13.string().min(1) }),
|
|
2253
|
+
z13.object({
|
|
2254
|
+
type: z13.literal("projects.suggest"),
|
|
2255
|
+
days: z13.number().int().min(1).max(365).default(30)
|
|
1747
2256
|
}),
|
|
1748
|
-
|
|
1749
|
-
type:
|
|
1750
|
-
checkoutPath:
|
|
1751
|
-
worktreeDir:
|
|
2257
|
+
z13.object({
|
|
2258
|
+
type: z13.literal("workspace.discover"),
|
|
2259
|
+
checkoutPath: z13.string(),
|
|
2260
|
+
worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
|
|
1752
2261
|
}),
|
|
1753
|
-
|
|
1754
|
-
type:
|
|
1755
|
-
checkoutPath:
|
|
1756
|
-
branch:
|
|
1757
|
-
base:
|
|
1758
|
-
setupCommand:
|
|
1759
|
-
worktreeDir:
|
|
2262
|
+
z13.object({
|
|
2263
|
+
type: z13.literal("workspace.create"),
|
|
2264
|
+
checkoutPath: z13.string(),
|
|
2265
|
+
branch: z13.string(),
|
|
2266
|
+
base: z13.string(),
|
|
2267
|
+
setupCommand: z13.string().nullable(),
|
|
2268
|
+
worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
|
|
1760
2269
|
}),
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
type:
|
|
1764
|
-
path:
|
|
1765
|
-
checkoutPath:
|
|
1766
|
-
base:
|
|
1767
|
-
force:
|
|
2270
|
+
z13.object({ type: z13.literal("workspace.status"), path: z13.string(), base: z13.string().nullable() }),
|
|
2271
|
+
z13.object({
|
|
2272
|
+
type: z13.literal("workspace.remove"),
|
|
2273
|
+
path: z13.string(),
|
|
2274
|
+
checkoutPath: z13.string(),
|
|
2275
|
+
base: z13.string().nullable(),
|
|
2276
|
+
force: z13.object({ dirty: z13.boolean(), unmerged: z13.boolean() }),
|
|
2277
|
+
/** Also delete the worktree's local branch (hosts before trackers ignore it). */
|
|
2278
|
+
deleteBranch: z13.boolean().optional()
|
|
1768
2279
|
}),
|
|
1769
|
-
|
|
1770
|
-
type:
|
|
1771
|
-
path:
|
|
1772
|
-
base:
|
|
1773
|
-
file:
|
|
2280
|
+
z13.object({
|
|
2281
|
+
type: z13.literal("workspace.diff"),
|
|
2282
|
+
path: z13.string(),
|
|
2283
|
+
base: z13.string().nullable(),
|
|
2284
|
+
file: z13.string().nullable()
|
|
1774
2285
|
}),
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
GitHubHostViewRequest.extend({ type:
|
|
1778
|
-
GitHubHostLogsRequest.extend({ type:
|
|
1779
|
-
GitHubHostMergeRequest.extend({ type:
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
2286
|
+
z13.object({ type: z13.literal("workspace.files"), path: z13.string(), dir: z13.string() }),
|
|
2287
|
+
z13.object({ type: z13.literal("workspace.readFile"), path: z13.string(), file: z13.string() }),
|
|
2288
|
+
GitHubHostViewRequest.extend({ type: z13.literal("workspace.prView") }),
|
|
2289
|
+
GitHubHostLogsRequest.extend({ type: z13.literal("workspace.prFailedLogs") }),
|
|
2290
|
+
GitHubHostMergeRequest.extend({ type: z13.literal("workspace.prMerge") }),
|
|
2291
|
+
TrackerHostSyncRequest.extend({ type: z13.literal("tracker.sync") }),
|
|
2292
|
+
TrackerHostPrepareBranchRequest.extend({ type: z13.literal("tracker.prepareBranch") }),
|
|
2293
|
+
TrackerHostStartIssueRequest.extend({ type: z13.literal("tracker.startIssue") }),
|
|
2294
|
+
TrackerHostSetStatusRequest.extend({ type: z13.literal("tracker.setStatus") }),
|
|
2295
|
+
z13.object({
|
|
2296
|
+
type: z13.literal("dispatch.start"),
|
|
2297
|
+
dispatchKey: z13.string(),
|
|
2298
|
+
runId: z13.string(),
|
|
2299
|
+
taskId: z13.string(),
|
|
2300
|
+
sessionId: z13.string(),
|
|
2301
|
+
projectId: z13.string(),
|
|
2302
|
+
title: z13.string(),
|
|
2303
|
+
workspace: z13.union([
|
|
2304
|
+
z13.object({ path: z13.string() }),
|
|
2305
|
+
z13.object({
|
|
2306
|
+
createFrom: z13.object({
|
|
2307
|
+
checkoutPath: z13.string(),
|
|
2308
|
+
branch: z13.string(),
|
|
2309
|
+
base: z13.string(),
|
|
2310
|
+
setupCommand: z13.string().nullable(),
|
|
2311
|
+
worktreeDir: z13.string().default(DEFAULT_WORKTREE_DIR)
|
|
1797
2312
|
})
|
|
1798
2313
|
})
|
|
1799
2314
|
]),
|
|
1800
2315
|
nativeHandle: NativeHandle.nullable(),
|
|
1801
2316
|
profile: Profile,
|
|
1802
|
-
prompt:
|
|
2317
|
+
prompt: z13.string(),
|
|
1803
2318
|
/** The launch's own revision; a takeover always carries a newer one. */
|
|
1804
|
-
controlRevision:
|
|
2319
|
+
controlRevision: z13.number().int(),
|
|
1805
2320
|
controlMode: ControlMode.default("automation"),
|
|
1806
|
-
policyRequired:
|
|
2321
|
+
policyRequired: z13.boolean().optional()
|
|
1807
2322
|
}),
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
type:
|
|
1811
|
-
sessionId:
|
|
1812
|
-
path:
|
|
1813
|
-
commands:
|
|
2323
|
+
z13.object({ type: z13.literal("dispatch.reconcile"), dispatchKey: z13.string() }),
|
|
2324
|
+
z13.object({
|
|
2325
|
+
type: z13.literal("checks.run"),
|
|
2326
|
+
sessionId: z13.string(),
|
|
2327
|
+
path: z13.string(),
|
|
2328
|
+
commands: z13.array(z13.string())
|
|
1814
2329
|
})
|
|
1815
2330
|
]);
|
|
1816
|
-
var ImportableSession =
|
|
1817
|
-
sessionFile:
|
|
1818
|
-
sessionId:
|
|
1819
|
-
cwd:
|
|
1820
|
-
name:
|
|
1821
|
-
mtime:
|
|
1822
|
-
inactive:
|
|
1823
|
-
});
|
|
1824
|
-
var DiscoveredWorktree =
|
|
1825
|
-
path:
|
|
1826
|
-
head:
|
|
1827
|
-
branch:
|
|
1828
|
-
bare:
|
|
1829
|
-
detached:
|
|
1830
|
-
locked:
|
|
1831
|
-
prunable:
|
|
1832
|
-
provenance:
|
|
2331
|
+
var ImportableSession = z13.object({
|
|
2332
|
+
sessionFile: z13.string(),
|
|
2333
|
+
sessionId: z13.string(),
|
|
2334
|
+
cwd: z13.string(),
|
|
2335
|
+
name: z13.string().nullable(),
|
|
2336
|
+
mtime: z13.string(),
|
|
2337
|
+
inactive: z13.boolean()
|
|
2338
|
+
});
|
|
2339
|
+
var DiscoveredWorktree = z13.object({
|
|
2340
|
+
path: z13.string(),
|
|
2341
|
+
head: z13.string().nullable(),
|
|
2342
|
+
branch: z13.string().nullable(),
|
|
2343
|
+
bare: z13.boolean(),
|
|
2344
|
+
detached: z13.boolean(),
|
|
2345
|
+
locked: z13.boolean(),
|
|
2346
|
+
prunable: z13.boolean(),
|
|
2347
|
+
provenance: z13.enum(["managed", "discovered", "main"]),
|
|
1833
2348
|
git: GitState.nullable()
|
|
1834
2349
|
});
|
|
1835
|
-
var CheckoutInfo =
|
|
1836
|
-
root:
|
|
1837
|
-
commonDir:
|
|
1838
|
-
repoIdentity:
|
|
1839
|
-
defaultBranch:
|
|
2350
|
+
var CheckoutInfo = z13.object({
|
|
2351
|
+
root: z13.string(),
|
|
2352
|
+
commonDir: z13.string(),
|
|
2353
|
+
repoIdentity: z13.string(),
|
|
2354
|
+
defaultBranch: z13.string()
|
|
1840
2355
|
});
|
|
1841
|
-
var ScannedRepository = CheckoutInfo.extend({ name:
|
|
1842
|
-
var ProjectFolderScan =
|
|
2356
|
+
var ScannedRepository = CheckoutInfo.extend({ name: z13.string() });
|
|
2357
|
+
var ProjectFolderScan = z13.object({
|
|
1843
2358
|
/** The folder, ~ expanded and realpath'd. */
|
|
1844
|
-
folder:
|
|
1845
|
-
repositories:
|
|
1846
|
-
});
|
|
1847
|
-
var ProjectSuggestion =
|
|
1848
|
-
rootPath:
|
|
1849
|
-
sessionCount:
|
|
1850
|
-
lastActivityAt:
|
|
1851
|
-
});
|
|
1852
|
-
var ProjectSuggestions =
|
|
1853
|
-
var DiffFile =
|
|
1854
|
-
path:
|
|
1855
|
-
oldPath:
|
|
1856
|
-
added:
|
|
1857
|
-
deleted:
|
|
1858
|
-
status:
|
|
1859
|
-
});
|
|
1860
|
-
var DiffResult =
|
|
1861
|
-
base:
|
|
1862
|
-
files:
|
|
1863
|
-
patch:
|
|
1864
|
-
});
|
|
1865
|
-
var FileEntry =
|
|
1866
|
-
name:
|
|
1867
|
-
path:
|
|
1868
|
-
kind:
|
|
1869
|
-
size:
|
|
1870
|
-
});
|
|
1871
|
-
var ReconcileResult =
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
known:
|
|
1875
|
-
sessionId:
|
|
1876
|
-
state:
|
|
2359
|
+
folder: z13.string(),
|
|
2360
|
+
repositories: z13.array(ScannedRepository)
|
|
2361
|
+
});
|
|
2362
|
+
var ProjectSuggestion = z13.object({
|
|
2363
|
+
rootPath: z13.string(),
|
|
2364
|
+
sessionCount: z13.number().int(),
|
|
2365
|
+
lastActivityAt: z13.string()
|
|
2366
|
+
});
|
|
2367
|
+
var ProjectSuggestions = z13.object({ suggestions: z13.array(ProjectSuggestion) });
|
|
2368
|
+
var DiffFile = z13.object({
|
|
2369
|
+
path: z13.string(),
|
|
2370
|
+
oldPath: z13.string().nullable(),
|
|
2371
|
+
added: z13.number().int(),
|
|
2372
|
+
deleted: z13.number().int(),
|
|
2373
|
+
status: z13.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
|
|
2374
|
+
});
|
|
2375
|
+
var DiffResult = z13.object({
|
|
2376
|
+
base: z13.string(),
|
|
2377
|
+
files: z13.array(DiffFile),
|
|
2378
|
+
patch: z13.string().nullable()
|
|
2379
|
+
});
|
|
2380
|
+
var FileEntry = z13.object({
|
|
2381
|
+
name: z13.string(),
|
|
2382
|
+
path: z13.string(),
|
|
2383
|
+
kind: z13.enum(["file", "dir", "symlink"]),
|
|
2384
|
+
size: z13.number().int().nullable()
|
|
2385
|
+
});
|
|
2386
|
+
var ReconcileResult = z13.union([
|
|
2387
|
+
z13.object({ known: z13.literal(false) }),
|
|
2388
|
+
z13.object({
|
|
2389
|
+
known: z13.literal(true),
|
|
2390
|
+
sessionId: z13.string().nullable(),
|
|
2391
|
+
state: z13.enum(["accepted", "workspace_ready", "started", "failed"]),
|
|
1877
2392
|
runtime: RuntimeState.nullable(),
|
|
1878
|
-
workspacePath:
|
|
2393
|
+
workspacePath: z13.string().nullable(),
|
|
1879
2394
|
nativeHandle: NativeHandle.nullable(),
|
|
1880
|
-
error:
|
|
2395
|
+
error: z13.string().nullable(),
|
|
1881
2396
|
/** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
|
|
1882
|
-
errorDetails:
|
|
2397
|
+
errorDetails: z13.record(z13.string(), z13.unknown()).nullable().default(null)
|
|
1883
2398
|
})
|
|
1884
2399
|
]);
|
|
1885
|
-
var DispatchStartResult =
|
|
1886
|
-
sessionId:
|
|
1887
|
-
workspacePath:
|
|
2400
|
+
var DispatchStartResult = z13.object({
|
|
2401
|
+
sessionId: z13.string(),
|
|
2402
|
+
workspacePath: z13.string(),
|
|
1888
2403
|
nativeHandle: NativeHandle.nullable(),
|
|
1889
|
-
reused:
|
|
2404
|
+
reused: z13.boolean(),
|
|
1890
2405
|
/** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
|
|
1891
|
-
promptError:
|
|
2406
|
+
promptError: z13.string().nullable().optional()
|
|
1892
2407
|
});
|
|
1893
|
-
var AnswerResult =
|
|
1894
|
-
status:
|
|
2408
|
+
var AnswerResult = z13.object({
|
|
2409
|
+
status: z13.enum(["answered", "already_answered"]),
|
|
1895
2410
|
interaction: Interaction
|
|
1896
2411
|
});
|
|
1897
|
-
var SnapshotResult =
|
|
1898
|
-
partial:
|
|
1899
|
-
pendingInteractions:
|
|
2412
|
+
var SnapshotResult = z13.object({
|
|
2413
|
+
partial: z13.array(TranscriptItem),
|
|
2414
|
+
pendingInteractions: z13.array(Interaction)
|
|
1900
2415
|
});
|
|
1901
|
-
var ChecksResult =
|
|
1902
|
-
var Receipt =
|
|
1903
|
-
|
|
1904
|
-
|
|
2416
|
+
var ChecksResult = z13.object({ results: z13.array(CheckResult) });
|
|
2417
|
+
var Receipt = z13.union([
|
|
2418
|
+
z13.object({ commandId: z13.string(), ok: z13.literal(true), result: z13.unknown() }),
|
|
2419
|
+
z13.object({ commandId: z13.string(), ok: z13.literal(false), error: ErrorBody })
|
|
1905
2420
|
]);
|
|
1906
2421
|
var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
1907
2422
|
policyContext: HostToolPolicyContext.optional()
|
|
@@ -1920,278 +2435,281 @@ var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
|
1920
2435
|
}
|
|
1921
2436
|
ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
|
|
1922
2437
|
});
|
|
1923
|
-
var HostToCoordinator =
|
|
1924
|
-
|
|
1925
|
-
type:
|
|
1926
|
-
hostId:
|
|
1927
|
-
credential:
|
|
1928
|
-
name:
|
|
1929
|
-
agentVersion:
|
|
1930
|
-
piVersion:
|
|
1931
|
-
piCompatible:
|
|
2438
|
+
var HostToCoordinator = z13.discriminatedUnion("type", [
|
|
2439
|
+
z13.object({
|
|
2440
|
+
type: z13.literal("hello"),
|
|
2441
|
+
hostId: z13.string(),
|
|
2442
|
+
credential: z13.string(),
|
|
2443
|
+
name: z13.string(),
|
|
2444
|
+
agentVersion: z13.string(),
|
|
2445
|
+
piVersion: z13.string().nullable(),
|
|
2446
|
+
piCompatible: z13.boolean(),
|
|
1932
2447
|
platform: Platform,
|
|
1933
2448
|
capabilities: RuntimeCapabilities.nullable(),
|
|
1934
2449
|
github: HostGitHub.optional(),
|
|
1935
|
-
protocolVersion:
|
|
1936
|
-
features:
|
|
2450
|
+
protocolVersion: z13.number().int(),
|
|
2451
|
+
features: z13.array(z13.string()).optional()
|
|
1937
2452
|
}),
|
|
1938
2453
|
HostAgentRequestFrame,
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2454
|
+
z13.object({ type: z13.literal("event"), hostSeq: z13.number().int(), event: HostEvent }),
|
|
2455
|
+
z13.object({ type: z13.literal("stream"), delta: StreamDelta }),
|
|
2456
|
+
z13.object({ type: z13.literal("receipt"), receipt: Receipt }),
|
|
2457
|
+
z13.object({ type: z13.literal("pong") }),
|
|
2458
|
+
z13.object({ type: z13.literal("usage"), usage: z13.array(ProviderUsage) }),
|
|
2459
|
+
z13.object({ type: z13.literal("term"), streamId: z13.string(), msg: TermServerToViewer })
|
|
1945
2460
|
]);
|
|
1946
|
-
var CoordinatorToHost =
|
|
1947
|
-
|
|
1948
|
-
type:
|
|
1949
|
-
coordinatorVersion:
|
|
1950
|
-
ackedHostSeq:
|
|
1951
|
-
features:
|
|
2461
|
+
var CoordinatorToHost = z13.discriminatedUnion("type", [
|
|
2462
|
+
z13.object({
|
|
2463
|
+
type: z13.literal("welcome"),
|
|
2464
|
+
coordinatorVersion: z13.string(),
|
|
2465
|
+
ackedHostSeq: z13.number().int(),
|
|
2466
|
+
features: z13.array(z13.string()).optional()
|
|
1952
2467
|
}),
|
|
1953
2468
|
AgentResultFrame,
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2469
|
+
z13.object({ type: z13.literal("ack"), hostSeq: z13.number().int() }),
|
|
2470
|
+
z13.object({ type: z13.literal("command"), commandId: z13.string(), command: HostCommand }),
|
|
2471
|
+
z13.object({ type: z13.literal("ping") }),
|
|
2472
|
+
z13.object({ type: z13.literal("reject"), error: ErrorBody }),
|
|
2473
|
+
z13.object({ type: z13.literal("term"), streamId: z13.string(), msg: TermCoordinatorMsg })
|
|
1959
2474
|
]);
|
|
1960
2475
|
|
|
1961
2476
|
// packages/protocol/dist/api.js
|
|
1962
|
-
var EnrollRequest =
|
|
1963
|
-
token:
|
|
1964
|
-
name:
|
|
2477
|
+
var EnrollRequest = z14.object({
|
|
2478
|
+
token: z14.string().min(1),
|
|
2479
|
+
name: z14.string().min(1).max(80),
|
|
1965
2480
|
kind: DeviceKind
|
|
1966
2481
|
});
|
|
1967
|
-
var EnrollResponse =
|
|
1968
|
-
var CreateEnrollmentRequest =
|
|
1969
|
-
var CreateEnrollmentResponse =
|
|
1970
|
-
token:
|
|
1971
|
-
url:
|
|
1972
|
-
expiresAt:
|
|
1973
|
-
qrSvg:
|
|
1974
|
-
command:
|
|
1975
|
-
});
|
|
1976
|
-
var HostEnrollRequest =
|
|
1977
|
-
|
|
1978
|
-
token:
|
|
1979
|
-
name:
|
|
2482
|
+
var EnrollResponse = z14.object({ deviceId: z14.string(), credential: z14.string() });
|
|
2483
|
+
var CreateEnrollmentRequest = z14.object({ kind: z14.enum(["device", "host"]) });
|
|
2484
|
+
var CreateEnrollmentResponse = z14.object({
|
|
2485
|
+
token: z14.string(),
|
|
2486
|
+
url: z14.string(),
|
|
2487
|
+
expiresAt: z14.string(),
|
|
2488
|
+
qrSvg: z14.string(),
|
|
2489
|
+
command: z14.string().nullable()
|
|
2490
|
+
});
|
|
2491
|
+
var HostEnrollRequest = z14.union([
|
|
2492
|
+
z14.object({
|
|
2493
|
+
token: z14.string().min(1),
|
|
2494
|
+
name: z14.string().min(1).max(80),
|
|
1980
2495
|
platform: Platform
|
|
1981
2496
|
}),
|
|
1982
|
-
|
|
1983
|
-
secret:
|
|
1984
|
-
name:
|
|
2497
|
+
z14.object({
|
|
2498
|
+
secret: z14.string().min(1),
|
|
2499
|
+
name: z14.string().min(1).max(80),
|
|
1985
2500
|
platform: Platform
|
|
1986
2501
|
})
|
|
1987
2502
|
]);
|
|
1988
|
-
var HostEnrollResponse =
|
|
1989
|
-
var CreateProjectRequest =
|
|
1990
|
-
name:
|
|
1991
|
-
hostId:
|
|
1992
|
-
path:
|
|
1993
|
-
defaultProfileId:
|
|
1994
|
-
setupCommand:
|
|
1995
|
-
checks:
|
|
1996
|
-
maxConcurrentRuns:
|
|
1997
|
-
worktreeDir: WorktreeDir.optional()
|
|
1998
|
-
});
|
|
1999
|
-
var UpdateProjectRequest = z11.object({
|
|
2000
|
-
name: z11.string().min(1).optional(),
|
|
2001
|
-
defaultProfileId: z11.string().nullable().optional(),
|
|
2002
|
-
defaultHostId: z11.string().nullable().optional(),
|
|
2003
|
-
maxConcurrentRuns: z11.number().int().min(1).max(32).optional(),
|
|
2004
|
-
automationEnabled: z11.boolean().optional(),
|
|
2005
|
-
setupCommand: z11.string().nullable().optional(),
|
|
2006
|
-
checks: z11.array(z11.string()).optional(),
|
|
2007
|
-
workspaceSharing: z11.enum(["single_writer", "shared"]).optional(),
|
|
2503
|
+
var HostEnrollResponse = z14.object({ hostId: z14.string(), credential: z14.string() });
|
|
2504
|
+
var CreateProjectRequest = z14.object({
|
|
2505
|
+
name: z14.string().min(1),
|
|
2506
|
+
hostId: z14.string(),
|
|
2507
|
+
path: z14.string().min(1),
|
|
2508
|
+
defaultProfileId: z14.string().nullable().optional(),
|
|
2509
|
+
setupCommand: z14.string().nullable().optional(),
|
|
2510
|
+
checks: z14.array(z14.string()).optional(),
|
|
2511
|
+
maxConcurrentRuns: z14.number().int().min(1).max(32).optional(),
|
|
2008
2512
|
worktreeDir: WorktreeDir.optional()
|
|
2009
2513
|
});
|
|
2010
|
-
var
|
|
2514
|
+
var UpdateProjectRequest = z14.object({
|
|
2515
|
+
name: z14.string().min(1).optional(),
|
|
2516
|
+
defaultProfileId: z14.string().nullable().optional(),
|
|
2517
|
+
defaultHostId: z14.string().nullable().optional(),
|
|
2518
|
+
maxConcurrentRuns: z14.number().int().min(1).max(32).optional(),
|
|
2519
|
+
automationEnabled: z14.boolean().optional(),
|
|
2520
|
+
setupCommand: z14.string().nullable().optional(),
|
|
2521
|
+
checks: z14.array(z14.string()).optional(),
|
|
2522
|
+
workspaceSharing: z14.enum(["single_writer", "shared"]).optional(),
|
|
2523
|
+
worktreeDir: WorktreeDir.optional(),
|
|
2524
|
+
ensureSessions: z14.boolean().optional(),
|
|
2525
|
+
removeLanded: z14.boolean().optional()
|
|
2526
|
+
});
|
|
2527
|
+
var AddCheckoutRequest = z14.object({ hostId: z14.string(), path: z14.string().min(1) });
|
|
2011
2528
|
function isProjectFolderPath(s) {
|
|
2012
2529
|
if (s.includes("\0"))
|
|
2013
2530
|
return false;
|
|
2014
2531
|
return s === "~" || s.startsWith("~/") || s.startsWith("/");
|
|
2015
2532
|
}
|
|
2016
|
-
var ProjectFolder =
|
|
2017
|
-
var UpdateHostRequest =
|
|
2018
|
-
projectFolders:
|
|
2533
|
+
var ProjectFolder = z14.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
|
|
2534
|
+
var UpdateHostRequest = z14.object({
|
|
2535
|
+
projectFolders: z14.array(ProjectFolder).max(20).optional()
|
|
2019
2536
|
});
|
|
2020
2537
|
var ProjectScanResult = ProjectScan.extend({
|
|
2021
|
-
added:
|
|
2022
|
-
projectId:
|
|
2023
|
-
name:
|
|
2024
|
-
path:
|
|
2025
|
-
newProject:
|
|
2538
|
+
added: z14.array(z14.object({
|
|
2539
|
+
projectId: z14.string(),
|
|
2540
|
+
name: z14.string(),
|
|
2541
|
+
path: z14.string(),
|
|
2542
|
+
newProject: z14.boolean()
|
|
2026
2543
|
}))
|
|
2027
2544
|
});
|
|
2028
|
-
var ProfileInput =
|
|
2029
|
-
name:
|
|
2030
|
-
provider:
|
|
2031
|
-
model:
|
|
2545
|
+
var ProfileInput = z14.object({
|
|
2546
|
+
name: z14.string().min(1),
|
|
2547
|
+
provider: z14.string().nullable().default(null),
|
|
2548
|
+
model: z14.string().nullable().default(null),
|
|
2032
2549
|
thinking: ThinkingLevel.nullable().default(null),
|
|
2033
|
-
projectTrust:
|
|
2034
|
-
extraArgs:
|
|
2035
|
-
resources:
|
|
2036
|
-
});
|
|
2037
|
-
var CreateWorkspaceRequest =
|
|
2038
|
-
checkoutId:
|
|
2039
|
-
branch:
|
|
2040
|
-
base:
|
|
2041
|
-
});
|
|
2042
|
-
var RemoveWorkspaceRequest =
|
|
2043
|
-
force:
|
|
2044
|
-
});
|
|
2045
|
-
var CreateSessionRequest =
|
|
2046
|
-
projectId:
|
|
2047
|
-
workspace:
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
checkoutId:
|
|
2051
|
-
newBranch:
|
|
2052
|
-
base:
|
|
2550
|
+
projectTrust: z14.enum(["ask", "approve", "ignore"]).default("ask"),
|
|
2551
|
+
extraArgs: z14.array(ExtraArg).default([]),
|
|
2552
|
+
resources: z14.enum(["all", "vanilla"]).default("all")
|
|
2553
|
+
});
|
|
2554
|
+
var CreateWorkspaceRequest = z14.object({
|
|
2555
|
+
checkoutId: z14.string(),
|
|
2556
|
+
branch: z14.string().min(1),
|
|
2557
|
+
base: z14.string().nullable().optional()
|
|
2558
|
+
});
|
|
2559
|
+
var RemoveWorkspaceRequest = z14.object({
|
|
2560
|
+
force: z14.object({ dirty: z14.boolean(), unmerged: z14.boolean() }).default({ dirty: false, unmerged: false })
|
|
2561
|
+
});
|
|
2562
|
+
var CreateSessionRequest = z14.object({
|
|
2563
|
+
projectId: z14.string(),
|
|
2564
|
+
workspace: z14.union([
|
|
2565
|
+
z14.object({ existingId: z14.string() }),
|
|
2566
|
+
z14.object({
|
|
2567
|
+
checkoutId: z14.string(),
|
|
2568
|
+
newBranch: z14.string().min(1),
|
|
2569
|
+
base: z14.string().nullable().optional()
|
|
2053
2570
|
})
|
|
2054
2571
|
]),
|
|
2055
|
-
profileId:
|
|
2056
|
-
prompt:
|
|
2057
|
-
title:
|
|
2058
|
-
viewId:
|
|
2059
|
-
});
|
|
2060
|
-
var PromptRequest =
|
|
2061
|
-
text:
|
|
2062
|
-
mode:
|
|
2063
|
-
images:
|
|
2064
|
-
clientMessageId:
|
|
2065
|
-
});
|
|
2066
|
-
var CacheAlertRequest =
|
|
2067
|
-
enabled:
|
|
2068
|
-
ttlSec:
|
|
2069
|
-
});
|
|
2070
|
-
var RenameRequest =
|
|
2071
|
-
var SetModelRequest =
|
|
2072
|
-
provider:
|
|
2073
|
-
modelId:
|
|
2074
|
-
});
|
|
2075
|
-
var SetThinkingRequest =
|
|
2076
|
-
var CompactRequest =
|
|
2077
|
-
var SessionModelsResult =
|
|
2078
|
-
var SessionCommandsResult =
|
|
2079
|
-
var CompleteRequest =
|
|
2080
|
-
var CompletionItem =
|
|
2081
|
-
value:
|
|
2082
|
-
label:
|
|
2083
|
-
description:
|
|
2084
|
-
});
|
|
2085
|
-
var SessionCompleteResult =
|
|
2086
|
-
items:
|
|
2087
|
-
prefix:
|
|
2088
|
-
});
|
|
2089
|
-
var TreeRow =
|
|
2090
|
-
entryId:
|
|
2091
|
-
parentId:
|
|
2092
|
-
depth:
|
|
2093
|
-
role:
|
|
2094
|
-
text:
|
|
2095
|
-
activeBranch:
|
|
2096
|
-
leaf:
|
|
2097
|
-
label:
|
|
2098
|
-
at:
|
|
2099
|
-
});
|
|
2100
|
-
var SessionTreeResult =
|
|
2101
|
-
var BranchRequest =
|
|
2102
|
-
entryId:
|
|
2103
|
-
fork:
|
|
2104
|
-
});
|
|
2105
|
-
var HostBranchResult =
|
|
2106
|
-
sessionFile:
|
|
2107
|
-
prefill:
|
|
2108
|
-
});
|
|
2109
|
-
var TranscriptPage =
|
|
2110
|
-
items:
|
|
2111
|
-
hasMore:
|
|
2112
|
-
epoch:
|
|
2113
|
-
rev:
|
|
2114
|
-
delta:
|
|
2115
|
-
reset:
|
|
2116
|
-
});
|
|
2117
|
-
var NavigateRequest =
|
|
2118
|
-
entryId:
|
|
2119
|
-
summarize:
|
|
2120
|
-
instructions:
|
|
2121
|
-
});
|
|
2122
|
-
var HostNavigateResult =
|
|
2123
|
-
items:
|
|
2124
|
-
prefill:
|
|
2125
|
-
});
|
|
2126
|
-
var NavigateResult =
|
|
2127
|
-
prefill:
|
|
2128
|
-
epoch:
|
|
2129
|
-
});
|
|
2130
|
-
var BranchResult =
|
|
2572
|
+
profileId: z14.string().nullable().optional(),
|
|
2573
|
+
prompt: z14.string().default(""),
|
|
2574
|
+
title: z14.string().optional(),
|
|
2575
|
+
viewId: z14.string().optional()
|
|
2576
|
+
});
|
|
2577
|
+
var PromptRequest = z14.object({
|
|
2578
|
+
text: z14.string().min(1),
|
|
2579
|
+
mode: z14.enum(["prompt", "steer", "followUp"]).default("prompt"),
|
|
2580
|
+
images: z14.array(z14.object({ mimeType: z14.string(), data: z14.string() })).default([]),
|
|
2581
|
+
clientMessageId: z14.string().optional()
|
|
2582
|
+
});
|
|
2583
|
+
var CacheAlertRequest = z14.object({
|
|
2584
|
+
enabled: z14.boolean(),
|
|
2585
|
+
ttlSec: z14.number().int().min(60).max(86400).nullable().default(null)
|
|
2586
|
+
});
|
|
2587
|
+
var RenameRequest = z14.object({ title: z14.string().min(1).max(200) });
|
|
2588
|
+
var SetModelRequest = z14.object({
|
|
2589
|
+
provider: z14.string().min(1),
|
|
2590
|
+
modelId: z14.string().min(1)
|
|
2591
|
+
});
|
|
2592
|
+
var SetThinkingRequest = z14.object({ level: ThinkingLevel });
|
|
2593
|
+
var CompactRequest = z14.object({ instructions: z14.string().max(4e3).optional() });
|
|
2594
|
+
var SessionModelsResult = z14.object({ models: z14.array(SessionModel) });
|
|
2595
|
+
var SessionCommandsResult = z14.object({ commands: z14.array(SlashCommand) });
|
|
2596
|
+
var CompleteRequest = z14.object({ text: z14.string().min(1).max(500) });
|
|
2597
|
+
var CompletionItem = z14.object({
|
|
2598
|
+
value: z14.string(),
|
|
2599
|
+
label: z14.string(),
|
|
2600
|
+
description: z14.string().nullable()
|
|
2601
|
+
});
|
|
2602
|
+
var SessionCompleteResult = z14.object({
|
|
2603
|
+
items: z14.array(CompletionItem).max(50),
|
|
2604
|
+
prefix: z14.string()
|
|
2605
|
+
});
|
|
2606
|
+
var TreeRow = z14.object({
|
|
2607
|
+
entryId: z14.string(),
|
|
2608
|
+
parentId: z14.string().nullable(),
|
|
2609
|
+
depth: z14.number().int(),
|
|
2610
|
+
role: z14.enum(["user", "assistant"]),
|
|
2611
|
+
text: z14.string(),
|
|
2612
|
+
activeBranch: z14.boolean(),
|
|
2613
|
+
leaf: z14.boolean(),
|
|
2614
|
+
label: z14.string().nullable(),
|
|
2615
|
+
at: z14.string().nullable()
|
|
2616
|
+
});
|
|
2617
|
+
var SessionTreeResult = z14.object({ rows: z14.array(TreeRow) });
|
|
2618
|
+
var BranchRequest = z14.object({
|
|
2619
|
+
entryId: z14.string().nullable(),
|
|
2620
|
+
fork: z14.boolean().default(false)
|
|
2621
|
+
});
|
|
2622
|
+
var HostBranchResult = z14.object({
|
|
2623
|
+
sessionFile: z14.string().nullable(),
|
|
2624
|
+
prefill: z14.string().nullable()
|
|
2625
|
+
});
|
|
2626
|
+
var TranscriptPage = z14.object({
|
|
2627
|
+
items: z14.array(TranscriptItem),
|
|
2628
|
+
hasMore: z14.boolean(),
|
|
2629
|
+
epoch: z14.number().int().optional(),
|
|
2630
|
+
rev: z14.number().int().optional(),
|
|
2631
|
+
delta: z14.boolean().optional(),
|
|
2632
|
+
reset: z14.boolean().optional()
|
|
2633
|
+
});
|
|
2634
|
+
var NavigateRequest = z14.object({
|
|
2635
|
+
entryId: z14.string().min(1),
|
|
2636
|
+
summarize: z14.boolean().default(false),
|
|
2637
|
+
instructions: z14.string().max(2e3).nullable().default(null)
|
|
2638
|
+
});
|
|
2639
|
+
var HostNavigateResult = z14.object({
|
|
2640
|
+
items: z14.array(TranscriptItem),
|
|
2641
|
+
prefill: z14.string().nullable()
|
|
2642
|
+
});
|
|
2643
|
+
var NavigateResult = z14.object({
|
|
2644
|
+
prefill: z14.string().nullable(),
|
|
2645
|
+
epoch: z14.number().int()
|
|
2646
|
+
});
|
|
2647
|
+
var BranchResult = z14.object({
|
|
2131
2648
|
session: Session.nullable(),
|
|
2132
|
-
prefill:
|
|
2649
|
+
prefill: z14.string().nullable()
|
|
2133
2650
|
});
|
|
2134
|
-
var SessionExportResult =
|
|
2135
|
-
var CommandViewAction =
|
|
2136
|
-
label:
|
|
2137
|
-
command:
|
|
2138
|
-
tone:
|
|
2651
|
+
var SessionExportResult = z14.object({ fileName: z14.string(), content: z14.string() });
|
|
2652
|
+
var CommandViewAction = z14.object({
|
|
2653
|
+
label: z14.string().min(1).max(80),
|
|
2654
|
+
command: z14.string().startsWith("/").max(500),
|
|
2655
|
+
tone: z14.enum(["default", "primary", "danger"]).optional()
|
|
2139
2656
|
});
|
|
2140
|
-
var CommandView =
|
|
2141
|
-
title:
|
|
2657
|
+
var CommandView = z14.object({
|
|
2658
|
+
title: z14.string().min(1).max(200),
|
|
2142
2659
|
body: UINodeSchema,
|
|
2143
|
-
actions:
|
|
2660
|
+
actions: z14.array(CommandViewAction).max(30).default([])
|
|
2144
2661
|
});
|
|
2145
|
-
var ModelStateResult =
|
|
2662
|
+
var ModelStateResult = z14.object({
|
|
2146
2663
|
model: SessionModel.nullable(),
|
|
2147
2664
|
thinking: ThinkingLevel.nullable()
|
|
2148
2665
|
});
|
|
2149
|
-
var ImportSessionRequest =
|
|
2150
|
-
hostId:
|
|
2151
|
-
sessionFile:
|
|
2152
|
-
projectId:
|
|
2666
|
+
var ImportSessionRequest = z14.object({
|
|
2667
|
+
hostId: z14.string(),
|
|
2668
|
+
sessionFile: z14.string(),
|
|
2669
|
+
projectId: z14.string().nullable().optional()
|
|
2153
2670
|
});
|
|
2154
|
-
var AnswerRequest =
|
|
2155
|
-
revision:
|
|
2671
|
+
var AnswerRequest = z14.object({
|
|
2672
|
+
revision: z14.number().int(),
|
|
2156
2673
|
response: InteractionResponseSchema
|
|
2157
2674
|
});
|
|
2158
|
-
var AdapterActionRequest =
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2675
|
+
var AdapterActionRequest = z14.object({
|
|
2676
|
+
generation: z14.string().uuid().optional(),
|
|
2677
|
+
adapterId: z14.string(),
|
|
2678
|
+
actionId: z14.string(),
|
|
2679
|
+
payload: z14.unknown().optional()
|
|
2680
|
+
});
|
|
2681
|
+
var TaskPolicyPatch = z14.object({
|
|
2682
|
+
hostId: z14.string().nullable().optional(),
|
|
2683
|
+
profileId: z14.string().nullable().optional(),
|
|
2684
|
+
workspace: z14.object({
|
|
2685
|
+
mode: z14.enum(["new_worktree", "existing"]).optional(),
|
|
2686
|
+
branch: z14.string().nullable().optional(),
|
|
2687
|
+
base: z14.string().nullable().optional(),
|
|
2688
|
+
workspaceId: z14.string().optional()
|
|
2171
2689
|
}).optional(),
|
|
2172
|
-
continuation:
|
|
2173
|
-
enabled:
|
|
2174
|
-
objective:
|
|
2175
|
-
maxContinuations:
|
|
2176
|
-
maxElapsedMinutes:
|
|
2177
|
-
maxTokens:
|
|
2178
|
-
maxCostUsd:
|
|
2690
|
+
continuation: z14.object({
|
|
2691
|
+
enabled: z14.boolean().optional(),
|
|
2692
|
+
objective: z14.string().min(1).optional(),
|
|
2693
|
+
maxContinuations: z14.number().int().min(1).max(50).optional(),
|
|
2694
|
+
maxElapsedMinutes: z14.number().int().min(1).max(1440).optional(),
|
|
2695
|
+
maxTokens: z14.number().int().positive().nullable().optional(),
|
|
2696
|
+
maxCostUsd: z14.number().positive().nullable().optional()
|
|
2179
2697
|
}).optional(),
|
|
2180
2698
|
completion: CompletionPolicy.partial().optional()
|
|
2181
2699
|
});
|
|
2182
|
-
var CreateTaskRequest =
|
|
2183
|
-
projectId:
|
|
2184
|
-
title:
|
|
2700
|
+
var CreateTaskRequest = z14.object({
|
|
2701
|
+
projectId: z14.string(),
|
|
2702
|
+
title: z14.string().max(300).optional(),
|
|
2185
2703
|
githubIssueUrl: GitHubIssueUrl.optional(),
|
|
2186
|
-
githubIssue:
|
|
2187
|
-
launchPrompt:
|
|
2188
|
-
objective:
|
|
2189
|
-
acceptanceCriteria:
|
|
2190
|
-
dependencies:
|
|
2191
|
-
parentTaskId:
|
|
2704
|
+
githubIssue: z14.never().optional(),
|
|
2705
|
+
launchPrompt: z14.never().optional(),
|
|
2706
|
+
objective: z14.string().default(""),
|
|
2707
|
+
acceptanceCriteria: z14.array(z14.string()).default([]),
|
|
2708
|
+
dependencies: z14.array(z14.string()).default([]),
|
|
2709
|
+
parentTaskId: z14.string().nullable().optional(),
|
|
2192
2710
|
priority: Priority.default(2),
|
|
2193
|
-
state:
|
|
2194
|
-
notBefore:
|
|
2711
|
+
state: z14.enum(["backlog", "ready"]).default("backlog"),
|
|
2712
|
+
notBefore: z14.string().nullable().optional(),
|
|
2195
2713
|
policy: TaskPolicyPatch.optional()
|
|
2196
2714
|
}).superRefine((v, ctx) => {
|
|
2197
2715
|
if (v.githubIssueUrl === void 0) {
|
|
@@ -2229,32 +2747,33 @@ var CreateTaskRequest = z11.object({
|
|
|
2229
2747
|
const issue = githubIssueFromUrl(v.githubIssueUrl);
|
|
2230
2748
|
return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
|
|
2231
2749
|
});
|
|
2232
|
-
var UpdateTaskRequest =
|
|
2233
|
-
githubIssueUrl:
|
|
2234
|
-
githubIssue:
|
|
2235
|
-
launchPrompt:
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2750
|
+
var UpdateTaskRequest = z14.object({
|
|
2751
|
+
githubIssueUrl: z14.never().optional(),
|
|
2752
|
+
githubIssue: z14.never().optional(),
|
|
2753
|
+
launchPrompt: z14.never().optional(),
|
|
2754
|
+
tracker: z14.never().optional(),
|
|
2755
|
+
title: z14.string().min(1).max(300).optional(),
|
|
2756
|
+
objective: z14.string().optional(),
|
|
2757
|
+
acceptanceCriteria: z14.array(z14.string()).optional(),
|
|
2758
|
+
dependencies: z14.array(z14.string()).optional(),
|
|
2759
|
+
parentTaskId: z14.string().nullable().optional(),
|
|
2241
2760
|
priority: Priority.optional(),
|
|
2242
|
-
position:
|
|
2243
|
-
notBefore:
|
|
2761
|
+
position: z14.number().optional(),
|
|
2762
|
+
notBefore: z14.string().nullable().optional(),
|
|
2244
2763
|
policy: TaskPolicyPatch.optional()
|
|
2245
2764
|
});
|
|
2246
|
-
var MoveTaskRequest =
|
|
2765
|
+
var MoveTaskRequest = z14.object({
|
|
2247
2766
|
to: TaskState,
|
|
2248
|
-
confirm:
|
|
2249
|
-
onRunning:
|
|
2250
|
-
position:
|
|
2251
|
-
});
|
|
2252
|
-
var RequestChangesRequest =
|
|
2253
|
-
var Eligibility =
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
eligible:
|
|
2257
|
-
wait:
|
|
2767
|
+
confirm: z14.boolean().optional(),
|
|
2768
|
+
onRunning: z14.enum(["pause", "stop"]).optional(),
|
|
2769
|
+
position: z14.number().optional()
|
|
2770
|
+
});
|
|
2771
|
+
var RequestChangesRequest = z14.object({ feedback: z14.array(z14.string().min(1)).min(1) });
|
|
2772
|
+
var Eligibility = z14.union([
|
|
2773
|
+
z14.object({ eligible: z14.literal(true), hostId: z14.string(), hostName: z14.string() }),
|
|
2774
|
+
z14.object({
|
|
2775
|
+
eligible: z14.literal(false),
|
|
2776
|
+
wait: z14.enum([
|
|
2258
2777
|
"dependency",
|
|
2259
2778
|
"host_offline",
|
|
2260
2779
|
"project_limit",
|
|
@@ -2267,151 +2786,152 @@ var Eligibility = z11.union([
|
|
|
2267
2786
|
"already_dispatched",
|
|
2268
2787
|
"retry_backoff"
|
|
2269
2788
|
]),
|
|
2270
|
-
message:
|
|
2789
|
+
message: z14.string()
|
|
2271
2790
|
})
|
|
2272
2791
|
]);
|
|
2273
|
-
var NowResponse =
|
|
2274
|
-
running:
|
|
2275
|
-
queued:
|
|
2276
|
-
dispatchPaused:
|
|
2277
|
-
});
|
|
2278
|
-
var AutomationInput =
|
|
2279
|
-
name:
|
|
2280
|
-
enabled:
|
|
2281
|
-
projectId:
|
|
2792
|
+
var NowResponse = z14.object({
|
|
2793
|
+
running: z14.array(z14.object({ taskId: z14.string(), runId: z14.string(), sessionId: z14.string().nullable() })),
|
|
2794
|
+
queued: z14.array(z14.object({ taskId: z14.string(), eligibility: Eligibility })),
|
|
2795
|
+
dispatchPaused: z14.boolean()
|
|
2796
|
+
});
|
|
2797
|
+
var AutomationInput = z14.object({
|
|
2798
|
+
name: z14.string().min(1),
|
|
2799
|
+
enabled: z14.boolean().default(true),
|
|
2800
|
+
projectId: z14.string(),
|
|
2282
2801
|
trigger: Trigger,
|
|
2283
|
-
filters:
|
|
2802
|
+
filters: z14.array(z14.object({ path: z14.string(), equals: z14.string() })).default([]),
|
|
2284
2803
|
template: TaskTemplate,
|
|
2285
|
-
hostId:
|
|
2286
|
-
profileId:
|
|
2287
|
-
mode:
|
|
2288
|
-
groupingKey:
|
|
2289
|
-
overlap:
|
|
2290
|
-
missed:
|
|
2804
|
+
hostId: z14.string().nullable().default(null),
|
|
2805
|
+
profileId: z14.string().nullable().default(null),
|
|
2806
|
+
mode: z14.enum(["fresh", "continue", "watch"]).default("fresh"),
|
|
2807
|
+
groupingKey: z14.string().nullable().default(null),
|
|
2808
|
+
overlap: z14.enum(["skip", "queue_one", "append"]).default("skip"),
|
|
2809
|
+
missed: z14.enum(["skip", "run_once"]).default("skip"),
|
|
2291
2810
|
continuation: ContinuationPolicy.default({ enabled: false }),
|
|
2292
2811
|
completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
|
|
2293
2812
|
});
|
|
2294
|
-
var AutomationView = Automation.extend({ summary:
|
|
2295
|
-
var AutomationPreview =
|
|
2296
|
-
summary:
|
|
2813
|
+
var AutomationView = Automation.extend({ summary: z14.string() });
|
|
2814
|
+
var AutomationPreview = z14.object({
|
|
2815
|
+
summary: z14.string(),
|
|
2297
2816
|
task: TaskTemplate,
|
|
2298
|
-
next:
|
|
2299
|
-
});
|
|
2300
|
-
var WebhookTokenResponse =
|
|
2301
|
-
var PushSubscriptionRequest =
|
|
2302
|
-
endpoint:
|
|
2303
|
-
keys:
|
|
2304
|
-
permission:
|
|
2305
|
-
});
|
|
2306
|
-
var NotificationSettings =
|
|
2307
|
-
quietHours:
|
|
2308
|
-
start:
|
|
2309
|
-
end:
|
|
2310
|
-
timezone:
|
|
2817
|
+
next: z14.array(z14.string())
|
|
2818
|
+
});
|
|
2819
|
+
var WebhookTokenResponse = z14.object({ token: z14.string(), url: z14.string() });
|
|
2820
|
+
var PushSubscriptionRequest = z14.object({
|
|
2821
|
+
endpoint: z14.string().url(),
|
|
2822
|
+
keys: z14.object({ p256dh: z14.string(), auth: z14.string() }),
|
|
2823
|
+
permission: z14.enum(["granted", "denied", "default", "unknown"]).default("granted")
|
|
2824
|
+
});
|
|
2825
|
+
var NotificationSettings = z14.object({
|
|
2826
|
+
quietHours: z14.object({
|
|
2827
|
+
start: z14.string().regex(/^\d{2}:\d{2}$/),
|
|
2828
|
+
end: z14.string().regex(/^\d{2}:\d{2}$/),
|
|
2829
|
+
timezone: z14.string()
|
|
2311
2830
|
}).nullable(),
|
|
2312
|
-
privatePreviews:
|
|
2313
|
-
preferredDeviceId:
|
|
2314
|
-
});
|
|
2315
|
-
var PushPayload =
|
|
2316
|
-
|
|
2317
|
-
type:
|
|
2318
|
-
title:
|
|
2319
|
-
body:
|
|
2320
|
-
tag:
|
|
2321
|
-
url:
|
|
2322
|
-
renotify:
|
|
2831
|
+
privatePreviews: z14.boolean(),
|
|
2832
|
+
preferredDeviceId: z14.string().nullable()
|
|
2833
|
+
});
|
|
2834
|
+
var PushPayload = z14.union([
|
|
2835
|
+
z14.object({
|
|
2836
|
+
type: z14.literal("show"),
|
|
2837
|
+
title: z14.string(),
|
|
2838
|
+
body: z14.string(),
|
|
2839
|
+
tag: z14.string(),
|
|
2840
|
+
url: z14.string(),
|
|
2841
|
+
renotify: z14.boolean()
|
|
2323
2842
|
}),
|
|
2324
|
-
|
|
2843
|
+
z14.object({ type: z14.literal("clear"), tag: z14.string() })
|
|
2325
2844
|
]);
|
|
2326
|
-
var SetupState =
|
|
2327
|
-
passkey:
|
|
2328
|
-
available:
|
|
2329
|
-
registered:
|
|
2330
|
-
reason:
|
|
2845
|
+
var SetupState = z14.object({
|
|
2846
|
+
passkey: z14.object({
|
|
2847
|
+
available: z14.boolean(),
|
|
2848
|
+
registered: z14.boolean(),
|
|
2849
|
+
reason: z14.string().nullable()
|
|
2331
2850
|
}),
|
|
2332
|
-
oidc:
|
|
2851
|
+
oidc: z14.object({ label: z14.string() }).nullable()
|
|
2333
2852
|
});
|
|
2334
|
-
var PasskeyRegisterOptionsResponse =
|
|
2335
|
-
challengeId:
|
|
2336
|
-
options:
|
|
2853
|
+
var PasskeyRegisterOptionsResponse = z14.object({
|
|
2854
|
+
challengeId: z14.string(),
|
|
2855
|
+
options: z14.unknown()
|
|
2337
2856
|
});
|
|
2338
|
-
var PasskeyRegisterVerifyRequest =
|
|
2339
|
-
challengeId:
|
|
2340
|
-
name:
|
|
2341
|
-
response:
|
|
2857
|
+
var PasskeyRegisterVerifyRequest = z14.object({
|
|
2858
|
+
challengeId: z14.string(),
|
|
2859
|
+
name: z14.string().min(1).max(80),
|
|
2860
|
+
response: z14.unknown()
|
|
2342
2861
|
});
|
|
2343
|
-
var PasskeySignInOptionsResponse =
|
|
2344
|
-
challengeId:
|
|
2345
|
-
options:
|
|
2862
|
+
var PasskeySignInOptionsResponse = z14.object({
|
|
2863
|
+
challengeId: z14.string(),
|
|
2864
|
+
options: z14.unknown()
|
|
2346
2865
|
});
|
|
2347
|
-
var PasskeySignInVerifyRequest =
|
|
2348
|
-
challengeId:
|
|
2349
|
-
response:
|
|
2350
|
-
deviceName:
|
|
2866
|
+
var PasskeySignInVerifyRequest = z14.object({
|
|
2867
|
+
challengeId: z14.string(),
|
|
2868
|
+
response: z14.unknown(),
|
|
2869
|
+
deviceName: z14.string().min(1).max(80),
|
|
2351
2870
|
kind: DeviceKind.extract(["browser", "pwa"])
|
|
2352
2871
|
});
|
|
2353
|
-
var OidcBeginRequest =
|
|
2354
|
-
deviceName:
|
|
2872
|
+
var OidcBeginRequest = z14.object({
|
|
2873
|
+
deviceName: z14.string().min(1).max(80),
|
|
2355
2874
|
kind: DeviceKind.extract(["browser", "pwa"]),
|
|
2356
|
-
next:
|
|
2357
|
-
handoff:
|
|
2358
|
-
});
|
|
2359
|
-
var OidcBeginResponse =
|
|
2360
|
-
authorizeUrl:
|
|
2361
|
-
flowId:
|
|
2362
|
-
pollToken:
|
|
2363
|
-
});
|
|
2364
|
-
var OidcClaimRequest =
|
|
2365
|
-
var OidcClaimResponse =
|
|
2366
|
-
|
|
2367
|
-
|
|
2875
|
+
next: z14.string().default("/"),
|
|
2876
|
+
handoff: z14.boolean().default(false)
|
|
2877
|
+
});
|
|
2878
|
+
var OidcBeginResponse = z14.object({
|
|
2879
|
+
authorizeUrl: z14.string(),
|
|
2880
|
+
flowId: z14.string().nullable(),
|
|
2881
|
+
pollToken: z14.string().nullable()
|
|
2882
|
+
});
|
|
2883
|
+
var OidcClaimRequest = z14.object({ flowId: z14.string(), pollToken: z14.string() });
|
|
2884
|
+
var OidcClaimResponse = z14.union([
|
|
2885
|
+
z14.object({ status: z14.literal("pending") }),
|
|
2886
|
+
z14.object({ status: z14.literal("done"), deviceId: z14.string() })
|
|
2368
2887
|
]);
|
|
2369
|
-
var TerminalLoginStartRequest =
|
|
2370
|
-
var TerminalLoginStartResponse =
|
|
2371
|
-
userCode:
|
|
2372
|
-
pollToken:
|
|
2373
|
-
verifyUrl:
|
|
2374
|
-
expiresAt:
|
|
2375
|
-
intervalMs:
|
|
2376
|
-
});
|
|
2377
|
-
var TerminalLoginClaimRequest =
|
|
2378
|
-
userCode:
|
|
2379
|
-
pollToken:
|
|
2380
|
-
});
|
|
2381
|
-
var TerminalLoginClaimResponse =
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2888
|
+
var TerminalLoginStartRequest = z14.object({ name: z14.string().min(1).max(80) });
|
|
2889
|
+
var TerminalLoginStartResponse = z14.object({
|
|
2890
|
+
userCode: z14.string(),
|
|
2891
|
+
pollToken: z14.string(),
|
|
2892
|
+
verifyUrl: z14.string(),
|
|
2893
|
+
expiresAt: z14.string(),
|
|
2894
|
+
intervalMs: z14.number().int()
|
|
2895
|
+
});
|
|
2896
|
+
var TerminalLoginClaimRequest = z14.object({
|
|
2897
|
+
userCode: z14.string().min(1),
|
|
2898
|
+
pollToken: z14.string().min(1)
|
|
2899
|
+
});
|
|
2900
|
+
var TerminalLoginClaimResponse = z14.union([
|
|
2901
|
+
z14.object({ status: z14.literal("pending") }),
|
|
2902
|
+
z14.object({ status: z14.literal("denied") }),
|
|
2903
|
+
z14.object({ status: z14.literal("done"), deviceId: z14.string(), credential: z14.string() })
|
|
2385
2904
|
]);
|
|
2386
|
-
var TerminalLoginRequest =
|
|
2387
|
-
userCode:
|
|
2388
|
-
name:
|
|
2389
|
-
requestedFrom:
|
|
2390
|
-
createdAt:
|
|
2391
|
-
expiresAt:
|
|
2392
|
-
status:
|
|
2393
|
-
});
|
|
2394
|
-
var AuthMethods =
|
|
2395
|
-
passkeys:
|
|
2396
|
-
passkeyAvailability:
|
|
2397
|
-
oidc:
|
|
2398
|
-
issuer:
|
|
2399
|
-
label:
|
|
2400
|
-
ownerMatch:
|
|
2401
|
-
status:
|
|
2402
|
-
error:
|
|
2905
|
+
var TerminalLoginRequest = z14.object({
|
|
2906
|
+
userCode: z14.string(),
|
|
2907
|
+
name: z14.string(),
|
|
2908
|
+
requestedFrom: z14.string(),
|
|
2909
|
+
createdAt: z14.string(),
|
|
2910
|
+
expiresAt: z14.string(),
|
|
2911
|
+
status: z14.enum(["pending", "approved", "denied"])
|
|
2912
|
+
});
|
|
2913
|
+
var AuthMethods = z14.object({
|
|
2914
|
+
passkeys: z14.array(Passkey),
|
|
2915
|
+
passkeyAvailability: z14.object({ available: z14.boolean(), reason: z14.string().nullable() }),
|
|
2916
|
+
oidc: z14.object({
|
|
2917
|
+
issuer: z14.string(),
|
|
2918
|
+
label: z14.string(),
|
|
2919
|
+
ownerMatch: z14.string(),
|
|
2920
|
+
status: z14.enum(["ready", "error"]),
|
|
2921
|
+
error: z14.string().nullable()
|
|
2403
2922
|
}).nullable()
|
|
2404
2923
|
});
|
|
2405
|
-
var MeResponse =
|
|
2924
|
+
var MeResponse = z14.object({
|
|
2406
2925
|
device: Device,
|
|
2407
|
-
admin:
|
|
2408
|
-
publicUrl:
|
|
2926
|
+
admin: z14.boolean(),
|
|
2927
|
+
publicUrl: z14.string()
|
|
2409
2928
|
});
|
|
2410
2929
|
var ViewInput = View.pick({
|
|
2411
2930
|
name: true,
|
|
2412
2931
|
mode: true,
|
|
2413
2932
|
projectIds: true,
|
|
2414
|
-
hostIds: true
|
|
2933
|
+
hostIds: true,
|
|
2934
|
+
clientId: true
|
|
2415
2935
|
}).partial({
|
|
2416
2936
|
mode: true,
|
|
2417
2937
|
projectIds: true,
|
|
@@ -2419,65 +2939,65 @@ var ViewInput = View.pick({
|
|
|
2419
2939
|
});
|
|
2420
2940
|
var ViewPatch = ViewInput.partial();
|
|
2421
2941
|
var ViewClientReport = ViewClient.omit({ lastSeenAt: true });
|
|
2422
|
-
var ProjectSuggestionsResponse =
|
|
2423
|
-
suggestions:
|
|
2942
|
+
var ProjectSuggestionsResponse = z14.object({
|
|
2943
|
+
suggestions: z14.array(ProjectSuggestion.extend({ name: z14.string(), preselected: z14.boolean() }))
|
|
2424
2944
|
});
|
|
2425
2945
|
|
|
2426
2946
|
// packages/protocol/dist/client-wire.js
|
|
2427
|
-
import { z as
|
|
2428
|
-
var SyncState =
|
|
2429
|
-
hosts:
|
|
2430
|
-
projects:
|
|
2431
|
-
checkouts:
|
|
2432
|
-
workspaces:
|
|
2433
|
-
profiles:
|
|
2434
|
-
views:
|
|
2435
|
-
sessions:
|
|
2436
|
-
tasks:
|
|
2437
|
-
runs:
|
|
2438
|
-
automations:
|
|
2439
|
-
attention:
|
|
2440
|
-
interactions:
|
|
2441
|
-
panels:
|
|
2442
|
-
devices:
|
|
2443
|
-
adapters:
|
|
2444
|
-
dispatchPaused:
|
|
2445
|
-
});
|
|
2446
|
-
var Presence =
|
|
2447
|
-
foreground:
|
|
2448
|
-
interactedAt:
|
|
2449
|
-
viewing:
|
|
2947
|
+
import { z as z15 } from "zod";
|
|
2948
|
+
var SyncState = z15.object({
|
|
2949
|
+
hosts: z15.array(Host),
|
|
2950
|
+
projects: z15.array(Project),
|
|
2951
|
+
checkouts: z15.array(Checkout),
|
|
2952
|
+
workspaces: z15.array(Workspace),
|
|
2953
|
+
profiles: z15.array(Profile),
|
|
2954
|
+
views: z15.array(View),
|
|
2955
|
+
sessions: z15.array(Session),
|
|
2956
|
+
tasks: z15.array(Task),
|
|
2957
|
+
runs: z15.array(Run),
|
|
2958
|
+
automations: z15.array(Automation),
|
|
2959
|
+
attention: z15.array(AttentionItem),
|
|
2960
|
+
interactions: z15.array(Interaction),
|
|
2961
|
+
panels: z15.array(Panel),
|
|
2962
|
+
devices: z15.array(Device),
|
|
2963
|
+
adapters: z15.record(z15.string(), z15.array(AdapterInfo)),
|
|
2964
|
+
dispatchPaused: z15.boolean()
|
|
2965
|
+
});
|
|
2966
|
+
var Presence = z15.object({
|
|
2967
|
+
foreground: z15.boolean(),
|
|
2968
|
+
interactedAt: z15.string().nullable(),
|
|
2969
|
+
viewing: z15.object({ sessionId: z15.string() }).nullable()
|
|
2450
2970
|
});
|
|
2451
2971
|
var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
|
|
2452
|
-
var ClientToServer =
|
|
2453
|
-
|
|
2454
|
-
type:
|
|
2455
|
-
cursor:
|
|
2456
|
-
capabilities:
|
|
2457
|
-
projectionId:
|
|
2972
|
+
var ClientToServer = z15.discriminatedUnion("type", [
|
|
2973
|
+
z15.object({
|
|
2974
|
+
type: z15.literal("hello"),
|
|
2975
|
+
cursor: z15.number().int().nullable(),
|
|
2976
|
+
capabilities: z15.array(z15.string().min(1).max(80)).max(32).optional(),
|
|
2977
|
+
projectionId: z15.string().max(256).nullable().optional()
|
|
2458
2978
|
}),
|
|
2459
|
-
|
|
2460
|
-
|
|
2979
|
+
z15.object({ type: z15.literal("presence"), presence: Presence }),
|
|
2980
|
+
z15.object({ type: z15.literal("ping") })
|
|
2461
2981
|
]);
|
|
2462
|
-
var ServerToClient =
|
|
2463
|
-
|
|
2464
|
-
type:
|
|
2465
|
-
seq:
|
|
2466
|
-
events:
|
|
2467
|
-
capabilities:
|
|
2468
|
-
projectionId:
|
|
2982
|
+
var ServerToClient = z15.discriminatedUnion("type", [
|
|
2983
|
+
z15.object({
|
|
2984
|
+
type: z15.literal("replay"),
|
|
2985
|
+
seq: z15.number().int(),
|
|
2986
|
+
events: z15.array(EventEnvelope),
|
|
2987
|
+
capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
|
|
2988
|
+
projectionId: z15.string().optional()
|
|
2469
2989
|
}),
|
|
2470
|
-
|
|
2471
|
-
type:
|
|
2472
|
-
seq:
|
|
2990
|
+
z15.object({
|
|
2991
|
+
type: z15.literal("snapshot"),
|
|
2992
|
+
seq: z15.number().int(),
|
|
2473
2993
|
state: SyncState,
|
|
2474
|
-
capabilities:
|
|
2475
|
-
projectionId:
|
|
2994
|
+
capabilities: z15.array(z15.enum(CLIENT_CAPABILITIES)).optional(),
|
|
2995
|
+
projectionId: z15.string().optional()
|
|
2476
2996
|
}),
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2997
|
+
z15.object({ type: z15.literal("event"), event: EventEnvelope }),
|
|
2998
|
+
z15.object({ type: z15.literal("stream"), delta: StreamDelta }),
|
|
2999
|
+
z15.object({ type: z15.literal("pong") }),
|
|
3000
|
+
z15.object({ type: z15.literal("force_logout"), reason: z15.string() })
|
|
2481
3001
|
]);
|
|
2482
3002
|
|
|
2483
3003
|
// packages/protocol/dist/ids.js
|
|
@@ -2488,17 +3008,17 @@ var ulid = monotonicFactory();
|
|
|
2488
3008
|
var CLIENT_OPEN_MS = 10 * 6e4;
|
|
2489
3009
|
|
|
2490
3010
|
// packages/protocol/dist/web-bridge.js
|
|
2491
|
-
import { z as
|
|
3011
|
+
import { z as z16 } from "zod";
|
|
2492
3012
|
var FRAME_MAX_HEIGHT = 4e3;
|
|
2493
|
-
var FrameToParentMessageSchema =
|
|
2494
|
-
|
|
2495
|
-
type:
|
|
2496
|
-
actionId:
|
|
2497
|
-
payload:
|
|
3013
|
+
var FrameToParentMessageSchema = z16.discriminatedUnion("type", [
|
|
3014
|
+
z16.object({
|
|
3015
|
+
type: z16.literal("action"),
|
|
3016
|
+
actionId: z16.string().min(1).max(200),
|
|
3017
|
+
payload: z16.unknown().optional()
|
|
2498
3018
|
}),
|
|
2499
|
-
|
|
2500
|
-
type:
|
|
2501
|
-
height:
|
|
3019
|
+
z16.object({
|
|
3020
|
+
type: z16.literal("resize"),
|
|
3021
|
+
height: z16.number().finite().min(0).max(FRAME_MAX_HEIGHT)
|
|
2502
3022
|
})
|
|
2503
3023
|
]);
|
|
2504
3024
|
|