@spencerboucher/switchyard 0.12.0 → 0.14.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/resource-snapshot.js +47 -0
- package/dist/bridge/switchyard-bridge.js +11 -0
- package/dist/bridge/switchyard-terminal.js +39 -5
- package/dist/policies/worker.js +1657 -1224
- package/dist/switchyard.mjs +3986 -2017
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-CcxKiLxM.js +2 -0
- package/web-dist/assets/{AutomationView-BRVq9y-T.js.map → AutomationView-CcxKiLxM.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-BqrWFEYY.js.map → Card-WONLvqGM.js.map} +1 -1
- package/web-dist/assets/Checkbox-D18Ch0n4.js +2 -0
- package/web-dist/assets/{Checkbox-DExv3fUO.js.map → Checkbox-D18Ch0n4.js.map} +1 -1
- package/web-dist/assets/Copy-D6U5ewFc.js +2 -0
- package/web-dist/assets/{Copy-BuBbxEQI.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-Bd4Cr_Zi.js +4 -0
- package/web-dist/assets/InteractionCard-Bd4Cr_Zi.js.map +1 -0
- package/web-dist/assets/Menu-CDIEOsaM.js +2 -0
- package/web-dist/assets/Menu-CDIEOsaM.js.map +1 -0
- package/web-dist/assets/Overlay-QSBH5woa.js +2 -0
- package/web-dist/assets/Overlay-QSBH5woa.js.map +1 -0
- package/web-dist/assets/Priority-PUuNGK2s.js +2 -0
- package/web-dist/assets/{Priority-B2tdgI2D.js.map → Priority-PUuNGK2s.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-DZ-qJ_AO.js.map → Select-CpWLZnId.js.map} +1 -1
- package/web-dist/assets/Switch-DHX-YYPr.js +2 -0
- package/web-dist/assets/{Switch-DKiwAXXz.js.map → Switch-DHX-YYPr.js.map} +1 -1
- package/web-dist/assets/Tabs-BplxI0Eb.js +184 -0
- package/web-dist/assets/Tabs-BplxI0Eb.js.map +1 -0
- package/web-dist/assets/TextArea-BQPdfjO_.js +2 -0
- package/web-dist/assets/{TextArea-DK1uv3xX.js.map → TextArea-BQPdfjO_.js.map} +1 -1
- package/web-dist/assets/TextLink-CCc3WEdm.js +2 -0
- package/web-dist/assets/{TextLink-BoFPQuaH.js.map → TextLink-CCc3WEdm.js.map} +1 -1
- package/web-dist/assets/UINodeRenderer-Bxq4kPwg.js +4 -0
- package/web-dist/assets/UINodeRenderer-Bxq4kPwg.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-BwQ0PjVB.js +2 -0
- package/web-dist/assets/attention-BwQ0PjVB.js.map +1 -0
- package/web-dist/assets/automations-BSV9KuSH.js +2 -0
- package/web-dist/assets/automations-BSV9KuSH.js.map +1 -0
- package/web-dist/assets/board-C8N8_GS0.js +10 -0
- package/web-dist/assets/{board-tIuyEKO0.js.map → board-C8N8_GS0.js.map} +1 -1
- 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-BmxcCLin.js +25 -0
- package/web-dist/assets/code-BmxcCLin.js.map +1 -0
- package/web-dist/assets/{describe-BW5uUuvy.js → describe-Nw-EGTvb.js} +3 -3
- package/web-dist/assets/{describe-BW5uUuvy.js.map → describe-Nw-EGTvb.js.map} +1 -1
- package/web-dist/assets/drafts-CbBiiFKw.js +13 -0
- package/web-dist/assets/drafts-CbBiiFKw.js.map +1 -0
- package/web-dist/assets/enroll-2bd2qhh1.js +2 -0
- package/web-dist/assets/{enroll-CL0BGGhd.js.map → enroll-2bd2qhh1.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-5cSRL594.js +11 -0
- package/web-dist/assets/index-5cSRL594.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-tcGYFcpM.js +2 -0
- package/web-dist/assets/more-tcGYFcpM.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-BKSj6mhC.js → policyLogic-4ByNprLE.js} +2 -2
- package/web-dist/assets/{policyLogic-BKSj6mhC.js.map → policyLogic-4ByNprLE.js.map} +1 -1
- package/web-dist/assets/preload-helper-dybNq0aL.js +3 -0
- package/web-dist/assets/preload-helper-dybNq0aL.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-BH_AgQ1C.js +2 -0
- package/web-dist/assets/queue-BH_AgQ1C.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-CSQAnBaF.js → repo-Pn-s_Ggk.js} +2 -2
- package/web-dist/assets/{repo-CSQAnBaF.js.map → repo-Pn-s_Ggk.js.map} +1 -1
- package/web-dist/assets/settings-DjBmhTW8.js +9 -0
- package/web-dist/assets/settings-DjBmhTW8.js.map +1 -0
- package/web-dist/assets/states-f12WE0Zx.js +58 -0
- package/web-dist/assets/states-f12WE0Zx.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-M5orrPPe.js → terminal-login-BSJdzvzq.js} +2 -2
- package/web-dist/assets/{terminal-login-M5orrPPe.js.map → terminal-login-BSJdzvzq.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-CA0Mbmvv.js.map → useBreakpoint-kT0J1Dnk.js.map} +1 -1
- package/web-dist/assets/useNow-Cul-GfCg.js +2 -0
- package/web-dist/assets/useNow-Cul-GfCg.js.map +1 -0
- package/web-dist/assets/useResource-Bzqxz-K_.js +2 -0
- package/web-dist/assets/{useResource-BTjwa4tV.js.map → useResource-Bzqxz-K_.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-BRVq9y-T.js +0 -2
- package/web-dist/assets/Card-BqrWFEYY.js +0 -2
- package/web-dist/assets/Checkbox-DExv3fUO.js +0 -2
- package/web-dist/assets/Copy-BuBbxEQI.js +0 -2
- package/web-dist/assets/InteractionCard-0PH6pIkH.js +0 -6
- package/web-dist/assets/InteractionCard-0PH6pIkH.js.map +0 -1
- package/web-dist/assets/Menu-BJ3Gyh5V.js +0 -2
- package/web-dist/assets/Menu-BJ3Gyh5V.js.map +0 -1
- package/web-dist/assets/Overlay-BgqVqKc6.js +0 -2
- package/web-dist/assets/Overlay-BgqVqKc6.js.map +0 -1
- package/web-dist/assets/Priority-B2tdgI2D.js +0 -2
- package/web-dist/assets/SegmentedControl-DzwdZG6q.js +0 -2
- package/web-dist/assets/SegmentedControl-DzwdZG6q.js.map +0 -1
- package/web-dist/assets/Select-DZ-qJ_AO.js +0 -2
- package/web-dist/assets/Switch-DKiwAXXz.js +0 -2
- package/web-dist/assets/Tabs-HOeWNnHD.js +0 -184
- package/web-dist/assets/Tabs-HOeWNnHD.js.map +0 -1
- package/web-dist/assets/TextArea-DK1uv3xX.js +0 -2
- package/web-dist/assets/TextLink-BoFPQuaH.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-D1G0KCOr.js +0 -2
- package/web-dist/assets/attention-D1G0KCOr.js.map +0 -1
- package/web-dist/assets/automations-DUUAfMK8.js +0 -2
- package/web-dist/assets/automations-DUUAfMK8.js.map +0 -1
- package/web-dist/assets/board-tIuyEKO0.js +0 -10
- 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-O-DyPB50.js +0 -25
- package/web-dist/assets/code-O-DyPB50.js.map +0 -1
- package/web-dist/assets/enroll-CL0BGGhd.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-D-JHf__5.css +0 -2
- package/web-dist/assets/index-K0QOY1Li.js +0 -11
- package/web-dist/assets/index-K0QOY1Li.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-DNN_mtX8.js +0 -2
- package/web-dist/assets/more-DNN_mtX8.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-BudhqmWi.js +0 -13
- package/web-dist/assets/preload-helper-BudhqmWi.js.map +0 -1
- package/web-dist/assets/presence-05bJD5G3.js +0 -2
- package/web-dist/assets/queue-k4o-I9uY.js +0 -2
- package/web-dist/assets/queue-k4o-I9uY.js.map +0 -1
- package/web-dist/assets/settings-CrYZRJ7E.js +0 -7
- package/web-dist/assets/settings-CrYZRJ7E.js.map +0 -1
- package/web-dist/assets/shared-DIA598ns.js +0 -3
- package/web-dist/assets/shared-DIA598ns.js.map +0 -1
- package/web-dist/assets/states-C8oEFqek.js +0 -58
- package/web-dist/assets/states-C8oEFqek.js.map +0 -1
- package/web-dist/assets/terminal-BOV_MXPZ.js +0 -2
- package/web-dist/assets/timer-BCIucSXh.js +0 -2
- package/web-dist/assets/useBreakpoint-CA0Mbmvv.js +0 -2
- package/web-dist/assets/useNow-Dx0MCCez.js +0 -2
- package/web-dist/assets/useNow-Dx0MCCez.js.map +0 -1
- package/web-dist/assets/useResource-BTjwa4tV.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 z7 } 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,448 +50,315 @@ var ErrorBody = z.object({
|
|
|
44
50
|
details: z.unknown().optional()
|
|
45
51
|
});
|
|
46
52
|
var ApiError = z.object({ error: ErrorBody });
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} catch {
|
|
56
|
-
return false;
|
|
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;
|
|
57
61
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var Reason = Text.min(1);
|
|
61
|
-
var Fingerprint = z2.string().regex(/^[0-9a-f]{64}$/);
|
|
62
|
-
var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
63
|
-
var bytes = (s) => new TextEncoder().encode(s).length;
|
|
64
|
-
function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
|
|
65
|
-
if (depth > 20)
|
|
66
|
-
return false;
|
|
67
|
-
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
68
|
-
return true;
|
|
69
|
-
if (typeof value === "number")
|
|
70
|
-
return Number.isFinite(value) && (!Number.isInteger(value) || Number.isSafeInteger(value));
|
|
71
|
-
if (typeof value !== "object" || seen.has(value))
|
|
72
|
-
return false;
|
|
73
|
-
const prototype = Object.getPrototypeOf(value);
|
|
74
|
-
if (Array.isArray(value) ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
|
|
75
|
-
return false;
|
|
76
|
-
seen.add(value);
|
|
77
|
-
try {
|
|
78
|
-
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
79
|
-
const keys = Reflect.ownKeys(descriptors);
|
|
80
|
-
if (Array.isArray(value) && keys.length !== value.length + 1)
|
|
81
|
-
return false;
|
|
82
|
-
return keys.every((key) => {
|
|
83
|
-
if (typeof key !== "string" || forbidden.has(key))
|
|
84
|
-
return false;
|
|
85
|
-
if (Array.isArray(value)) {
|
|
86
|
-
if (key === "length")
|
|
87
|
-
return true;
|
|
88
|
-
if (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
const descriptor = descriptors[key];
|
|
92
|
-
return descriptor.enumerable === true && "value" in descriptor && validJson(descriptor.value, depth + 1, seen);
|
|
93
|
-
});
|
|
94
|
-
} finally {
|
|
95
|
-
seen.delete(value);
|
|
62
|
+
toBody() {
|
|
63
|
+
return this.details === void 0 ? { code: this.code, message: this.message } : { code: this.code, message: this.message, details: this.details };
|
|
96
64
|
}
|
|
97
|
-
}
|
|
98
|
-
var JsonObject = z2.custom((v) => !!v && typeof v === "object" && !Array.isArray(v) && validJson(v));
|
|
99
|
-
var CompletedUsageWatermark = z2.object({ runtimeId: Id, settleSeq: Revision }).strict();
|
|
100
|
-
var scopeShape = { scope: z2.enum(["session", "profile", "server"]), scopeId: Id.nullable() };
|
|
101
|
-
var scopeValid = (v) => v.scope === "server" === (v.scopeId === null);
|
|
102
|
-
var PolicyPhase = z2.enum(["tool_call", "request"]);
|
|
103
|
-
var PolicyVerdict = z2.enum(["ALLOW", "ASK", "DENY"]);
|
|
104
|
-
var PolicyRequestAction = z2.enum([
|
|
105
|
-
"task.create",
|
|
106
|
-
"message.send",
|
|
107
|
-
"inbox.read",
|
|
108
|
-
"run.continue"
|
|
109
|
-
]);
|
|
110
|
-
var PolicyScope = scopeShape.scope;
|
|
111
|
-
var PolicyCounterMap = z2.record(z2.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/).refine((k) => !forbidden.has(k)), z2.number().int().safe()).refine((v) => Object.keys(v).length <= 64);
|
|
112
|
-
var phases = z2.array(PolicyPhase).min(1).max(2).refine((v) => new Set(v).size === v.length);
|
|
113
|
-
var ruleFields = {
|
|
114
|
-
priority: z2.number().int().safe().min(-1e6).max(1e6),
|
|
115
|
-
enabled: z2.boolean(),
|
|
116
|
-
phases,
|
|
117
|
-
name: z2.string().min(1).max(120),
|
|
118
|
-
expression: z2.string().min(1).max(8192)
|
|
119
65
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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 [];
|
|
143
179
|
}
|
|
144
|
-
return `/${parts.join("/")}`;
|
|
145
180
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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;
|
|
154
197
|
}
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
workspaceRootReal: hostPath
|
|
160
|
-
}).strict().refine((boundary) => {
|
|
161
|
-
const relative = relativePosixPath(boundary.workspaceRootReal, boundary.cwdReal);
|
|
162
|
-
return relative !== ".." && !relative.startsWith("../");
|
|
163
|
-
}, "Real cwd must be within the real workspace boundary.");
|
|
164
|
-
var HostToolPolicyContext = z2.object({
|
|
165
|
-
version: z2.literal(1),
|
|
166
|
-
toolCallId: Id,
|
|
167
|
-
toolHash: Fingerprint,
|
|
168
|
-
boundary: HostPolicyBoundary,
|
|
169
|
-
defaultBranch: z2.string().min(1).max(255).nullable(),
|
|
170
|
-
safety: PolicyToolSafety
|
|
171
|
-
}).strict();
|
|
172
|
-
var PolicyToolContext = z2.object({ name: Id, args: JsonObject, safety: PolicyToolSafety }).strict();
|
|
173
|
-
var PolicyRequestContext = z2.object({ method: PolicyRequestAction, args: JsonObject }).strict();
|
|
174
|
-
var absolutePath = z2.string().min(1).max(8192).refine((v) => v.startsWith("/") || /^[A-Za-z]:[\\/]/.test(v));
|
|
175
|
-
var controlMode = z2.enum(["human", "automation"]);
|
|
176
|
-
var PolicySessionContext = z2.object({
|
|
177
|
-
id: Id,
|
|
178
|
-
hostId: Id,
|
|
179
|
-
nativeSessionId: Id.nullable(),
|
|
180
|
-
runtimeId: Id.nullable(),
|
|
181
|
-
profileId: Id,
|
|
182
|
-
projectId: Id.nullable(),
|
|
183
|
-
taskId: Id.nullable(),
|
|
184
|
-
runId: Id.nullable(),
|
|
185
|
-
controlMode,
|
|
186
|
-
controlRevision: Revision,
|
|
187
|
-
cwd: absolutePath,
|
|
188
|
-
workspaceRoot: absolutePath,
|
|
189
|
-
repository: z2.string().min(1).max(2048).nullable(),
|
|
190
|
-
defaultBranch: z2.string().min(1).max(255).nullable(),
|
|
191
|
-
readOnly: z2.boolean()
|
|
192
|
-
}).strict();
|
|
193
|
-
var PolicyTaskContext = z2.object({
|
|
194
|
-
id: Id,
|
|
195
|
-
projectId: Id,
|
|
196
|
-
rootTaskId: Id,
|
|
197
|
-
parentTaskId: Id.nullable(),
|
|
198
|
-
title: z2.string().min(1).max(300),
|
|
199
|
-
state: z2.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"])
|
|
200
|
-
}).strict();
|
|
201
|
-
var PolicyTargetContext = z2.object({
|
|
202
|
-
id: Id,
|
|
203
|
-
hostId: Id,
|
|
204
|
-
projectId: Id.nullable(),
|
|
205
|
-
taskId: Id.nullable(),
|
|
206
|
-
controlMode,
|
|
207
|
-
controlRevision: Revision,
|
|
208
|
-
runtime: z2.enum([
|
|
209
|
-
"starting",
|
|
210
|
-
"idle",
|
|
211
|
-
"running",
|
|
212
|
-
"waiting_input",
|
|
213
|
-
"interrupted",
|
|
214
|
-
"failed",
|
|
215
|
-
"stopped"
|
|
216
|
-
]),
|
|
217
|
-
readOnly: z2.boolean()
|
|
218
|
-
}).strict();
|
|
219
|
-
var PolicyCostContext = z2.object({
|
|
220
|
-
tokens: z2.number().int().safe().nonnegative().nullable(),
|
|
221
|
-
costUsd: z2.number().finite().nonnegative().nullable(),
|
|
222
|
-
maxTokens: z2.number().int().safe().positive().nullable(),
|
|
223
|
-
maxCostUsd: z2.number().finite().positive().nullable(),
|
|
224
|
-
accounting: z2.enum(["available", "unavailable"]),
|
|
225
|
-
fresh: z2.boolean(),
|
|
226
|
-
watermark: CompletedUsageWatermark.nullable(),
|
|
227
|
-
provider: Id.nullable(),
|
|
228
|
-
modelId: z2.string().min(1).max(512).nullable(),
|
|
229
|
-
classification: z2.enum(["cheap", "expensive", "unclassified"]),
|
|
230
|
-
expensive: z2.boolean()
|
|
231
|
-
}).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 = z2.object({
|
|
233
|
-
phase: PolicyPhase,
|
|
234
|
-
action: z2.union([z2.literal("tool.call"), PolicyRequestAction]),
|
|
235
|
-
tool: PolicyToolContext.nullable(),
|
|
236
|
-
request: PolicyRequestContext.nullable(),
|
|
237
|
-
session: PolicySessionContext,
|
|
238
|
-
task: PolicyTaskContext.nullable(),
|
|
239
|
-
target: PolicyTargetContext.nullable(),
|
|
240
|
-
cost: PolicyCostContext,
|
|
241
|
-
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) => bytes(JSON.stringify(v)) <= 65536, "Policy input is too large to evaluate.");
|
|
243
|
-
var PolicyRuleResult = z2.union([
|
|
244
|
-
z2.null(),
|
|
245
|
-
z2.object({ verdict: PolicyVerdict, reason: Text, state_updates: PolicyCounterMap.optional() }).strict().refine((v) => v.verdict === "ALLOW" || v.reason.length > 0)
|
|
198
|
+
var FormValueSchema = z2.union([
|
|
199
|
+
z2.string(),
|
|
200
|
+
z2.array(z2.string()),
|
|
201
|
+
z2.object({ other: z2.string() })
|
|
246
202
|
]);
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
var PolicyEvaluation = z2.discriminatedUnion("verdict", [
|
|
256
|
-
z2.object({ verdict: z2.literal("ALLOW") }).strict(),
|
|
257
|
-
z2.object({ verdict: z2.literal("DENY"), reason: Reason }).strict(),
|
|
258
|
-
z2.object({
|
|
259
|
-
verdict: z2.literal("ASK"),
|
|
260
|
-
decisionId: Id,
|
|
261
|
-
interactionId: Id,
|
|
262
|
-
interactionUrl: webUrl
|
|
263
|
-
}).strict()
|
|
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") })
|
|
264
208
|
]);
|
|
265
|
-
var PolicyPermission = z2.object({
|
|
266
|
-
kind: z2.literal("policy"),
|
|
267
|
-
decisionId: Id,
|
|
268
|
-
rootTaskId: Id.nullable(),
|
|
269
|
-
ruleId: Id,
|
|
270
|
-
ruleRevision: Revision,
|
|
271
|
-
fingerprint: Fingerprint
|
|
272
|
-
}).strict();
|
|
273
|
-
var PolicyGrant = z2.object({
|
|
274
|
-
id: Id,
|
|
275
|
-
scope: z2.object({ kind: z2.enum(["task", "session"]), id: Id }).strict(),
|
|
276
|
-
ruleId: Id,
|
|
277
|
-
ruleRevision: Revision,
|
|
278
|
-
fingerprint: Fingerprint,
|
|
279
|
-
approvedByDeviceId: Id,
|
|
280
|
-
approvedAt: Instant
|
|
281
|
-
}).strict();
|
|
282
|
-
var trimmed = (max) => z2.string().min(1).max(max).refine((s) => s.trim() === s);
|
|
283
|
-
var PolicyModelClassification = z2.object({
|
|
284
|
-
provider: trimmed(200),
|
|
285
|
-
modelId: trimmed(512),
|
|
286
|
-
classification: z2.enum(["cheap", "expensive"])
|
|
287
|
-
}).strict();
|
|
288
|
-
var classifications = z2.array(PolicyModelClassification).max(1e3).refine((v) => new Set(v.map((x) => JSON.stringify([x.provider, x.modelId]))).size === v.length);
|
|
289
|
-
var PolicySettings = z2.object({ revision: Revision, modelClassifications: classifications, updatedAt: Instant }).strict();
|
|
290
|
-
var toolInput = z2.object({ name: Id, args: JsonObject }).strict();
|
|
291
|
-
var sampleIdentity = { sessionId: Id, nativeSessionId: Id, runtimeId: Id, sampleId: Id };
|
|
292
|
-
var HostPolicySampleRequest = z2.object({ ...sampleIdentity, tool: toolInput }).strict();
|
|
293
|
-
var HostPolicySampleResult = z2.object({
|
|
294
|
-
...sampleIdentity,
|
|
295
|
-
toolHash: Fingerprint,
|
|
296
|
-
boundary: HostPolicyBoundary,
|
|
297
|
-
defaultBranch: z2.string().min(1).max(255).nullable(),
|
|
298
|
-
safety: PolicyToolSafety
|
|
299
|
-
}).strict();
|
|
300
|
-
var PolicyEvaluateRequest = z2.object({ evaluationId: Id, toolCallId: Id, tool: toolInput }).strict();
|
|
301
|
-
var PolicyStatusRequest = z2.object({ decisionId: Id, waitMs: z2.literal(25e3) }).strict();
|
|
302
|
-
var PolicyStatusResult = z2.discriminatedUnion("state", [
|
|
303
|
-
z2.object({ state: z2.literal("pending") }).strict(),
|
|
304
|
-
z2.object({ state: z2.literal("allowed") }).strict(),
|
|
305
|
-
z2.object({ state: z2.literal("denied"), reason: Reason }).strict(),
|
|
306
|
-
z2.object({ state: z2.literal("canceled"), reason: Reason }).strict()
|
|
307
|
-
]);
|
|
308
|
-
var PolicyCancelRequest = z2.object({ decisionId: Id }).strict();
|
|
309
|
-
var PolicyCancelResult = z2.object({ state: z2.enum(["canceled", "already_resolved"]) }).strict();
|
|
310
|
-
var PolicyTrace = z2.object({
|
|
311
|
-
ruleId: Id,
|
|
312
|
-
ruleRevision: Revision,
|
|
313
|
-
...scopeShape,
|
|
314
|
-
verdict: PolicyVerdict.nullable(),
|
|
315
|
-
reason: Text.nullable(),
|
|
316
|
-
granted: z2.boolean(),
|
|
317
|
-
overridden: z2.boolean(),
|
|
318
|
-
proposedStateUpdates: PolicyCounterMap
|
|
319
|
-
}).strict().refine(scopeValid);
|
|
320
|
-
var PolicyTestResult = z2.object({
|
|
321
|
-
verdict: PolicyVerdict,
|
|
322
|
-
reason: Text.nullable(),
|
|
323
|
-
trace: z2.array(PolicyTrace).max(128),
|
|
324
|
-
proposedStateUpdates: z2.record(Id, PolicyCounterMap),
|
|
325
|
-
enforcement: z2.object({
|
|
326
|
-
phases: z2.array(PolicyPhase),
|
|
327
|
-
modelRequest: z2.literal(false),
|
|
328
|
-
explanation: z2.string()
|
|
329
|
-
}).strict()
|
|
330
|
-
}).strict();
|
|
331
|
-
var CreatePolicyRuleRequest = z2.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
|
|
332
|
-
var UpdatePolicyRuleRequest = z2.object({
|
|
333
|
-
expectedRevision: Revision,
|
|
334
|
-
name: ruleFields.name.optional(),
|
|
335
|
-
priority: ruleFields.priority.optional(),
|
|
336
|
-
enabled: z2.boolean().optional(),
|
|
337
|
-
phases: phases.optional(),
|
|
338
|
-
expression: ruleFields.expression.optional()
|
|
339
|
-
}).strict().refine((v) => Object.keys(v).length > 1);
|
|
340
|
-
var DeletePolicyRuleQuery = z2.object({ expectedRevision: Revision }).strict();
|
|
341
|
-
var UpdatePolicySettingsRequest = z2.object({ expectedRevision: Revision, modelClassifications: classifications }).strict();
|
|
342
|
-
var PolicyTestRequest = z2.object({
|
|
343
|
-
sessionId: Id,
|
|
344
|
-
phase: PolicyPhase,
|
|
345
|
-
tool: toolInput.nullable(),
|
|
346
|
-
request: PolicyRequestContext.nullable()
|
|
347
|
-
}).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
|
|
348
209
|
|
|
349
|
-
// packages/protocol/dist/
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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()
|
|
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"
|
|
372
218
|
]);
|
|
373
|
-
var
|
|
374
|
-
var
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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()
|
|
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()
|
|
416
226
|
};
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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
|
-
}
|
|
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" });
|
|
453
235
|
}
|
|
454
|
-
if (
|
|
455
|
-
ctx.addIssue({
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
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" });
|
|
460
247
|
}
|
|
461
248
|
});
|
|
462
|
-
var
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
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
|
+
}
|
|
481
354
|
|
|
482
355
|
// packages/protocol/dist/entities.js
|
|
483
356
|
import { z as z6 } from "zod";
|
|
484
357
|
|
|
485
358
|
// packages/protocol/dist/github.js
|
|
486
359
|
import { z as z4 } from "zod";
|
|
487
|
-
var
|
|
488
|
-
var
|
|
360
|
+
var Id2 = z4.string().min(1).max(200);
|
|
361
|
+
var Instant = z4.string().refine((s) => {
|
|
489
362
|
try {
|
|
490
363
|
return new Date(s).toISOString() === s;
|
|
491
364
|
} catch {
|
|
@@ -497,7 +370,7 @@ var nonnegative = z4.number().int().safe().nonnegative();
|
|
|
497
370
|
var reason = z4.string().min(1).max(2e3);
|
|
498
371
|
var hash = z4.string().regex(/^[0-9a-f]{64}$/);
|
|
499
372
|
var actionsId = z4.string().regex(/^[1-9][0-9]{0,19}$/);
|
|
500
|
-
var
|
|
373
|
+
var bytes = (s) => new TextEncoder().encode(s).length;
|
|
501
374
|
var displayUrl = z4.string().max(4096).refine((s) => {
|
|
502
375
|
try {
|
|
503
376
|
const u = new URL(s);
|
|
@@ -581,21 +454,21 @@ var GitHubCheck = z4.object({
|
|
|
581
454
|
link: displayUrl.nullable(),
|
|
582
455
|
workflow: z4.string().max(300).nullable(),
|
|
583
456
|
event: z4.string().max(100).nullable(),
|
|
584
|
-
startedAt:
|
|
585
|
-
completedAt:
|
|
457
|
+
startedAt: Instant.nullable(),
|
|
458
|
+
completedAt: Instant.nullable(),
|
|
586
459
|
description: z4.string().max(2e3).nullable(),
|
|
587
460
|
actionsJob: z4.object({ runId: actionsId, jobId: actionsId, attempt: positive }).strict().nullable()
|
|
588
461
|
}).strict();
|
|
589
462
|
var GitHubComment = z4.object({
|
|
590
|
-
id:
|
|
463
|
+
id: Id2,
|
|
591
464
|
author: z4.string().min(1).max(200).nullable(),
|
|
592
465
|
body: z4.string().refine((v) => [...v].length <= 8e3),
|
|
593
466
|
bodyTruncated: z4.boolean(),
|
|
594
467
|
url: githubUrl,
|
|
595
|
-
createdAt:
|
|
468
|
+
createdAt: Instant.nullable()
|
|
596
469
|
}).strict();
|
|
597
470
|
var GitHubThread = z4.object({
|
|
598
|
-
id:
|
|
471
|
+
id: Id2,
|
|
599
472
|
isResolved: z4.literal(false),
|
|
600
473
|
isOutdated: z4.boolean(),
|
|
601
474
|
path: z4.string().max(8192).nullable(),
|
|
@@ -634,8 +507,8 @@ var WorkspaceGitHub = z4.object({
|
|
|
634
507
|
repository: GitHubRepository.nullable(),
|
|
635
508
|
headRepository: GitHubRepository.nullable(),
|
|
636
509
|
branch: z4.string().min(1).max(255).nullable(),
|
|
637
|
-
fetchedAt:
|
|
638
|
-
attemptedAt:
|
|
510
|
+
fetchedAt: Instant.nullable(),
|
|
511
|
+
attemptedAt: Instant,
|
|
639
512
|
status: z4.enum(["ready", "unavailable", "error", "ambiguous"]),
|
|
640
513
|
reason: reason.nullable(),
|
|
641
514
|
pullRequest: GitHubPullRequest.nullable(),
|
|
@@ -645,7 +518,7 @@ var WorkspaceGitHub = z4.object({
|
|
|
645
518
|
threadsComplete: z4.boolean(),
|
|
646
519
|
truncated: z4.boolean()
|
|
647
520
|
}).strict().refine((v) => {
|
|
648
|
-
if (
|
|
521
|
+
if (bytes(JSON.stringify(v)) > 512 * 1024 || new Set(v.checks.map((c) => c.id)).size !== v.checks.length)
|
|
649
522
|
return false;
|
|
650
523
|
if (v.pullRequest && (!v.repository || !matchesPr(v.pullRequest.url, v.repository, v.pullRequest.number)))
|
|
651
524
|
return false;
|
|
@@ -685,20 +558,20 @@ var GitHubJobLog = z4.object({
|
|
|
685
558
|
lineCount: nonnegative.max(150),
|
|
686
559
|
truncated: z4.boolean(),
|
|
687
560
|
reason: reason.nullable()
|
|
688
|
-
}).strict().refine((v) => v.status === "available" ? v.runId !== null && v.jobId !== null && v.attempt !== null && v.outputTail !== null &&
|
|
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);
|
|
689
562
|
var GitHubLogs = z4.object({
|
|
690
563
|
github: HostGitHub,
|
|
691
564
|
repository: GitHubRepository,
|
|
692
565
|
number: positive,
|
|
693
566
|
headOid: GitHubSha,
|
|
694
|
-
fetchedAt:
|
|
567
|
+
fetchedAt: Instant,
|
|
695
568
|
status: z4.enum(["ready", "unavailable", "error"]),
|
|
696
569
|
reason: reason.nullable(),
|
|
697
570
|
jobs: z4.array(GitHubJobLog).max(10),
|
|
698
571
|
complete: z4.boolean(),
|
|
699
572
|
truncated: z4.boolean(),
|
|
700
573
|
omittedJobs: nonnegative.nullable()
|
|
701
|
-
}).strict().refine((v) =>
|
|
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));
|
|
702
575
|
var GitHubLogsRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
703
576
|
var GitHubMergeRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
704
577
|
var mergeFields = {
|
|
@@ -713,13 +586,13 @@ var GitHubMergeResult = z4.discriminatedUnion("status", [
|
|
|
713
586
|
status: z4.literal("merged"),
|
|
714
587
|
...mergeFields,
|
|
715
588
|
mergeCommitOid: GitHubSha.nullable(),
|
|
716
|
-
confirmedAt:
|
|
589
|
+
confirmedAt: Instant
|
|
717
590
|
}).strict(),
|
|
718
591
|
z4.object({
|
|
719
592
|
status: z4.literal("outcome_unknown"),
|
|
720
593
|
...mergeFields,
|
|
721
594
|
reason,
|
|
722
|
-
attemptedAt:
|
|
595
|
+
attemptedAt: Instant
|
|
723
596
|
}).strict()
|
|
724
597
|
]).refine((v) => matchesPr(v.url, v.repository, v.number));
|
|
725
598
|
var path = z4.string().min(1).max(8192);
|
|
@@ -729,118 +602,306 @@ var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
|
|
|
729
602
|
expectedPullRequestNodeId: z4.string().min(1)
|
|
730
603
|
});
|
|
731
604
|
|
|
732
|
-
// packages/protocol/dist/
|
|
605
|
+
// packages/protocol/dist/policies.js
|
|
733
606
|
import { z as z5 } from "zod";
|
|
734
|
-
var
|
|
735
|
-
var
|
|
736
|
-
var
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
var
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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) => {
|
|
610
|
+
try {
|
|
611
|
+
return new Date(s).toISOString() === s;
|
|
612
|
+
} catch {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
var Text = z5.string().max(4e3);
|
|
617
|
+
var Reason = Text.min(1);
|
|
618
|
+
var Fingerprint = z5.string().regex(/^[0-9a-f]{64}$/);
|
|
619
|
+
var forbidden = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
620
|
+
var bytes2 = (s) => new TextEncoder().encode(s).length;
|
|
621
|
+
function validJson(value, depth = 0, seen = /* @__PURE__ */ new Set()) {
|
|
622
|
+
if (depth > 20)
|
|
623
|
+
return false;
|
|
624
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
625
|
+
return true;
|
|
626
|
+
if (typeof value === "number")
|
|
627
|
+
return Number.isFinite(value) && (!Number.isInteger(value) || Number.isSafeInteger(value));
|
|
628
|
+
if (typeof value !== "object" || seen.has(value))
|
|
629
|
+
return false;
|
|
630
|
+
const prototype = Object.getPrototypeOf(value);
|
|
631
|
+
if (Array.isArray(value) ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
|
|
632
|
+
return false;
|
|
633
|
+
seen.add(value);
|
|
634
|
+
try {
|
|
635
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
636
|
+
const keys = Reflect.ownKeys(descriptors);
|
|
637
|
+
if (Array.isArray(value) && keys.length !== value.length + 1)
|
|
638
|
+
return false;
|
|
639
|
+
return keys.every((key) => {
|
|
640
|
+
if (typeof key !== "string" || forbidden.has(key))
|
|
641
|
+
return false;
|
|
642
|
+
if (Array.isArray(value)) {
|
|
643
|
+
if (key === "length")
|
|
644
|
+
return true;
|
|
645
|
+
if (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
const descriptor = descriptors[key];
|
|
649
|
+
return descriptor.enumerable === true && "value" in descriptor && validJson(descriptor.value, depth + 1, seen);
|
|
650
|
+
});
|
|
651
|
+
} finally {
|
|
652
|
+
seen.delete(value);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
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() };
|
|
658
|
+
var scopeValid = (v) => v.scope === "server" === (v.scopeId === null);
|
|
659
|
+
var PolicyPhase = z5.enum(["tool_call", "request"]);
|
|
660
|
+
var PolicyVerdict = z5.enum(["ALLOW", "ASK", "DENY"]);
|
|
661
|
+
var PolicyRequestAction = z5.enum([
|
|
662
|
+
"task.create",
|
|
663
|
+
"message.send",
|
|
664
|
+
"inbox.read",
|
|
665
|
+
"run.continue"
|
|
771
666
|
]);
|
|
772
|
-
var
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
667
|
+
var PolicyScope = scopeShape.scope;
|
|
668
|
+
var PolicyCounterMap = z5.record(z5.string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}$/).refine((k) => !forbidden.has(k)), z5.number().int().safe()).refine((v) => Object.keys(v).length <= 64);
|
|
669
|
+
var phases = z5.array(PolicyPhase).min(1).max(2).refine((v) => new Set(v).size === v.length);
|
|
670
|
+
var ruleFields = {
|
|
671
|
+
priority: z5.number().int().safe().min(-1e6).max(1e6),
|
|
672
|
+
enabled: z5.boolean(),
|
|
673
|
+
phases,
|
|
674
|
+
name: z5.string().min(1).max(120),
|
|
675
|
+
expression: z5.string().min(1).max(8192)
|
|
676
|
+
};
|
|
677
|
+
var PolicyRule = z5.object({
|
|
678
|
+
id: Id3,
|
|
679
|
+
...scopeShape,
|
|
680
|
+
...ruleFields,
|
|
681
|
+
revision: Revision,
|
|
682
|
+
builtIn: z5.boolean(),
|
|
683
|
+
createdAt: Instant2,
|
|
684
|
+
updatedAt: Instant2
|
|
685
|
+
}).strict().refine(scopeValid);
|
|
686
|
+
var PolicyToolSafety = z5.object({
|
|
687
|
+
destructiveDelete: z5.boolean(),
|
|
688
|
+
forcePush: z5.boolean(),
|
|
689
|
+
defaultBranchPush: z5.boolean(),
|
|
690
|
+
uncertain: z5.boolean(),
|
|
691
|
+
reasons: z5.array(z5.string().min(1).max(1e3)).max(16)
|
|
692
|
+
}).strict();
|
|
693
|
+
function normalizePosixPath(value) {
|
|
694
|
+
const parts = [];
|
|
695
|
+
for (const part of value.split("/")) {
|
|
696
|
+
if (part === "..")
|
|
697
|
+
parts.pop();
|
|
698
|
+
else if (part && part !== ".")
|
|
699
|
+
parts.push(part);
|
|
700
|
+
}
|
|
701
|
+
return `/${parts.join("/")}`;
|
|
702
|
+
}
|
|
703
|
+
var hostPath = z5.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
|
|
704
|
+
function relativePosixPath(from, to) {
|
|
705
|
+
const fromParts = from.split("/").filter(Boolean);
|
|
706
|
+
const toParts = to.split("/").filter(Boolean);
|
|
707
|
+
let shared = 0;
|
|
708
|
+
while (shared < fromParts.length && fromParts[shared] === toParts[shared])
|
|
709
|
+
shared++;
|
|
710
|
+
return [...fromParts.slice(shared).map(() => ".."), ...toParts.slice(shared)].join("/");
|
|
711
|
+
}
|
|
712
|
+
var HostPolicyBoundary = z5.object({
|
|
713
|
+
cwd: hostPath,
|
|
714
|
+
workspaceRoot: hostPath,
|
|
715
|
+
cwdReal: hostPath,
|
|
716
|
+
workspaceRootReal: hostPath
|
|
717
|
+
}).strict().refine((boundary) => {
|
|
718
|
+
const relative = relativePosixPath(boundary.workspaceRootReal, boundary.cwdReal);
|
|
719
|
+
return relative !== ".." && !relative.startsWith("../");
|
|
720
|
+
}, "Real cwd must be within the real workspace boundary.");
|
|
721
|
+
var HostToolPolicyContext = z5.object({
|
|
722
|
+
version: z5.literal(1),
|
|
723
|
+
toolCallId: Id3,
|
|
724
|
+
toolHash: Fingerprint,
|
|
725
|
+
boundary: HostPolicyBoundary,
|
|
726
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
727
|
+
safety: PolicyToolSafety
|
|
728
|
+
}).strict();
|
|
729
|
+
var PolicyToolContext = z5.object({ name: Id3, args: JsonObject, safety: PolicyToolSafety }).strict();
|
|
730
|
+
var PolicyRequestContext = z5.object({ method: PolicyRequestAction, args: JsonObject }).strict();
|
|
731
|
+
var absolutePath = z5.string().min(1).max(8192).refine((v) => v.startsWith("/") || /^[A-Za-z]:[\\/]/.test(v));
|
|
732
|
+
var controlMode = z5.enum(["human", "automation"]);
|
|
733
|
+
var PolicySessionContext = z5.object({
|
|
734
|
+
id: Id3,
|
|
735
|
+
hostId: Id3,
|
|
736
|
+
nativeSessionId: Id3.nullable(),
|
|
737
|
+
runtimeId: Id3.nullable(),
|
|
738
|
+
profileId: Id3,
|
|
739
|
+
projectId: Id3.nullable(),
|
|
740
|
+
taskId: Id3.nullable(),
|
|
741
|
+
runId: Id3.nullable(),
|
|
742
|
+
controlMode,
|
|
743
|
+
controlRevision: Revision,
|
|
744
|
+
cwd: absolutePath,
|
|
745
|
+
workspaceRoot: absolutePath,
|
|
746
|
+
repository: z5.string().min(1).max(2048).nullable(),
|
|
747
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
748
|
+
readOnly: z5.boolean()
|
|
749
|
+
}).strict();
|
|
750
|
+
var PolicyTaskContext = z5.object({
|
|
751
|
+
id: Id3,
|
|
752
|
+
projectId: Id3,
|
|
753
|
+
rootTaskId: Id3,
|
|
754
|
+
parentTaskId: Id3.nullable(),
|
|
755
|
+
title: z5.string().min(1).max(300),
|
|
756
|
+
state: z5.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"])
|
|
757
|
+
}).strict();
|
|
758
|
+
var PolicyTargetContext = z5.object({
|
|
759
|
+
id: Id3,
|
|
760
|
+
hostId: Id3,
|
|
761
|
+
projectId: Id3.nullable(),
|
|
762
|
+
taskId: Id3.nullable(),
|
|
763
|
+
controlMode,
|
|
764
|
+
controlRevision: Revision,
|
|
765
|
+
runtime: z5.enum([
|
|
766
|
+
"starting",
|
|
767
|
+
"idle",
|
|
768
|
+
"running",
|
|
769
|
+
"waiting_input",
|
|
770
|
+
"interrupted",
|
|
771
|
+
"failed",
|
|
772
|
+
"stopped"
|
|
773
|
+
]),
|
|
774
|
+
readOnly: z5.boolean()
|
|
775
|
+
}).strict();
|
|
776
|
+
var PolicyCostContext = z5.object({
|
|
777
|
+
tokens: z5.number().int().safe().nonnegative().nullable(),
|
|
778
|
+
costUsd: z5.number().finite().nonnegative().nullable(),
|
|
779
|
+
maxTokens: z5.number().int().safe().positive().nullable(),
|
|
780
|
+
maxCostUsd: z5.number().finite().positive().nullable(),
|
|
781
|
+
accounting: z5.enum(["available", "unavailable"]),
|
|
782
|
+
fresh: z5.boolean(),
|
|
783
|
+
watermark: CompletedUsageWatermark.nullable(),
|
|
784
|
+
provider: Id3.nullable(),
|
|
785
|
+
modelId: z5.string().min(1).max(512).nullable(),
|
|
786
|
+
classification: z5.enum(["cheap", "expensive", "unclassified"]),
|
|
787
|
+
expensive: z5.boolean()
|
|
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));
|
|
789
|
+
var PolicyContext = z5.object({
|
|
790
|
+
phase: PolicyPhase,
|
|
791
|
+
action: z5.union([z5.literal("tool.call"), PolicyRequestAction]),
|
|
792
|
+
tool: PolicyToolContext.nullable(),
|
|
793
|
+
request: PolicyRequestContext.nullable(),
|
|
794
|
+
session: PolicySessionContext,
|
|
795
|
+
task: PolicyTaskContext.nullable(),
|
|
796
|
+
target: PolicyTargetContext.nullable(),
|
|
797
|
+
cost: PolicyCostContext,
|
|
798
|
+
counters: PolicyCounterMap
|
|
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)
|
|
777
803
|
]);
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}),
|
|
788
|
-
z5.object({
|
|
789
|
-
t: z5.literal("table"),
|
|
790
|
-
columns: z5.array(z5.string()),
|
|
791
|
-
rows: z5.array(z5.array(z5.string()))
|
|
792
|
-
}),
|
|
793
|
-
z5.object({
|
|
794
|
-
t: z5.literal("section"),
|
|
795
|
-
title: z5.string().optional(),
|
|
796
|
-
collapsible: z5.boolean().optional(),
|
|
797
|
-
children: z5.array(UINodeSchema)
|
|
798
|
-
}),
|
|
799
|
-
z5.object({
|
|
800
|
-
t: z5.literal("tabs"),
|
|
801
|
-
tabs: z5.array(z5.object({ id: z5.string(), label: z5.string(), children: z5.array(UINodeSchema) }))
|
|
802
|
-
}),
|
|
803
|
-
z5.object({
|
|
804
|
-
t: z5.literal("progress"),
|
|
805
|
-
label: z5.string(),
|
|
806
|
-
value: z5.number().min(0).max(1).optional(),
|
|
807
|
-
status: z5.enum(["running", "ok", "error"]).optional()
|
|
808
|
-
}),
|
|
809
|
-
z5.object({ t: z5.literal("ref"), ref: RefSchema, label: z5.string() }),
|
|
810
|
-
z5.object({
|
|
811
|
-
t: z5.literal("form"),
|
|
812
|
-
formId: z5.string(),
|
|
813
|
-
fields: z5.array(FieldSchema),
|
|
814
|
-
submitLabel: z5.string(),
|
|
815
|
-
cancelLabel: z5.string().optional()
|
|
816
|
-
}),
|
|
817
|
-
z5.object({
|
|
818
|
-
t: z5.literal("confirm"),
|
|
819
|
-
message: z5.string(),
|
|
820
|
-
confirmLabel: z5.string(),
|
|
821
|
-
cancelLabel: z5.string(),
|
|
822
|
-
destructive: z5.boolean().optional()
|
|
823
|
-
}),
|
|
804
|
+
var webUrl = z5.string().max(4096).refine((s) => {
|
|
805
|
+
try {
|
|
806
|
+
const u = new URL(s);
|
|
807
|
+
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
808
|
+
} catch {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
var PolicyEvaluation = z5.discriminatedUnion("verdict", [
|
|
813
|
+
z5.object({ verdict: z5.literal("ALLOW") }).strict(),
|
|
814
|
+
z5.object({ verdict: z5.literal("DENY"), reason: Reason }).strict(),
|
|
824
815
|
z5.object({
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}))
|
|
831
|
-
})
|
|
832
|
-
]));
|
|
833
|
-
var FormValueSchema = z5.union([
|
|
834
|
-
z5.string(),
|
|
835
|
-
z5.array(z5.string()),
|
|
836
|
-
z5.object({ other: z5.string() })
|
|
816
|
+
verdict: z5.literal("ASK"),
|
|
817
|
+
decisionId: Id3,
|
|
818
|
+
interactionId: Id3,
|
|
819
|
+
interactionUrl: webUrl
|
|
820
|
+
}).strict()
|
|
837
821
|
]);
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
822
|
+
var PolicyPermission = z5.object({
|
|
823
|
+
kind: z5.literal("policy"),
|
|
824
|
+
decisionId: Id3,
|
|
825
|
+
rootTaskId: Id3.nullable(),
|
|
826
|
+
ruleId: Id3,
|
|
827
|
+
ruleRevision: Revision,
|
|
828
|
+
fingerprint: Fingerprint
|
|
829
|
+
}).strict();
|
|
830
|
+
var PolicyGrant = z5.object({
|
|
831
|
+
id: Id3,
|
|
832
|
+
scope: z5.object({ kind: z5.enum(["task", "session"]), id: Id3 }).strict(),
|
|
833
|
+
ruleId: Id3,
|
|
834
|
+
ruleRevision: Revision,
|
|
835
|
+
fingerprint: Fingerprint,
|
|
836
|
+
approvedByDeviceId: Id3,
|
|
837
|
+
approvedAt: Instant2
|
|
838
|
+
}).strict();
|
|
839
|
+
var trimmed = (max) => z5.string().min(1).max(max).refine((s) => s.trim() === s);
|
|
840
|
+
var PolicyModelClassification = z5.object({
|
|
841
|
+
provider: trimmed(200),
|
|
842
|
+
modelId: trimmed(512),
|
|
843
|
+
classification: z5.enum(["cheap", "expensive"])
|
|
844
|
+
}).strict();
|
|
845
|
+
var classifications = z5.array(PolicyModelClassification).max(1e3).refine((v) => new Set(v.map((x) => JSON.stringify([x.provider, x.modelId]))).size === v.length);
|
|
846
|
+
var PolicySettings = z5.object({ revision: Revision, modelClassifications: classifications, updatedAt: Instant2 }).strict();
|
|
847
|
+
var toolInput = z5.object({ name: Id3, args: JsonObject }).strict();
|
|
848
|
+
var sampleIdentity = { sessionId: Id3, nativeSessionId: Id3, runtimeId: Id3, sampleId: Id3 };
|
|
849
|
+
var HostPolicySampleRequest = z5.object({ ...sampleIdentity, tool: toolInput }).strict();
|
|
850
|
+
var HostPolicySampleResult = z5.object({
|
|
851
|
+
...sampleIdentity,
|
|
852
|
+
toolHash: Fingerprint,
|
|
853
|
+
boundary: HostPolicyBoundary,
|
|
854
|
+
defaultBranch: z5.string().min(1).max(255).nullable(),
|
|
855
|
+
safety: PolicyToolSafety
|
|
856
|
+
}).strict();
|
|
857
|
+
var PolicyEvaluateRequest = z5.object({ evaluationId: Id3, toolCallId: Id3, tool: toolInput }).strict();
|
|
858
|
+
var PolicyStatusRequest = z5.object({ decisionId: Id3, waitMs: z5.literal(25e3) }).strict();
|
|
859
|
+
var PolicyStatusResult = z5.discriminatedUnion("state", [
|
|
860
|
+
z5.object({ state: z5.literal("pending") }).strict(),
|
|
861
|
+
z5.object({ state: z5.literal("allowed") }).strict(),
|
|
862
|
+
z5.object({ state: z5.literal("denied"), reason: Reason }).strict(),
|
|
863
|
+
z5.object({ state: z5.literal("canceled"), reason: Reason }).strict()
|
|
843
864
|
]);
|
|
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,
|
|
869
|
+
ruleRevision: Revision,
|
|
870
|
+
...scopeShape,
|
|
871
|
+
verdict: PolicyVerdict.nullable(),
|
|
872
|
+
reason: Text.nullable(),
|
|
873
|
+
granted: z5.boolean(),
|
|
874
|
+
overridden: z5.boolean(),
|
|
875
|
+
proposedStateUpdates: PolicyCounterMap
|
|
876
|
+
}).strict().refine(scopeValid);
|
|
877
|
+
var PolicyTestResult = z5.object({
|
|
878
|
+
verdict: PolicyVerdict,
|
|
879
|
+
reason: Text.nullable(),
|
|
880
|
+
trace: z5.array(PolicyTrace).max(128),
|
|
881
|
+
proposedStateUpdates: z5.record(Id3, PolicyCounterMap),
|
|
882
|
+
enforcement: z5.object({
|
|
883
|
+
phases: z5.array(PolicyPhase),
|
|
884
|
+
modelRequest: z5.literal(false),
|
|
885
|
+
explanation: z5.string()
|
|
886
|
+
}).strict()
|
|
887
|
+
}).strict();
|
|
888
|
+
var CreatePolicyRuleRequest = z5.object({ ...scopeShape, ...ruleFields }).strict().refine(scopeValid);
|
|
889
|
+
var UpdatePolicyRuleRequest = z5.object({
|
|
890
|
+
expectedRevision: Revision,
|
|
891
|
+
name: ruleFields.name.optional(),
|
|
892
|
+
priority: ruleFields.priority.optional(),
|
|
893
|
+
enabled: z5.boolean().optional(),
|
|
894
|
+
phases: phases.optional(),
|
|
895
|
+
expression: ruleFields.expression.optional()
|
|
896
|
+
}).strict().refine((v) => Object.keys(v).length > 1);
|
|
897
|
+
var DeletePolicyRuleQuery = z5.object({ expectedRevision: Revision }).strict();
|
|
898
|
+
var UpdatePolicySettingsRequest = z5.object({ expectedRevision: Revision, modelClassifications: classifications }).strict();
|
|
899
|
+
var PolicyTestRequest = z5.object({
|
|
900
|
+
sessionId: Id3,
|
|
901
|
+
phase: PolicyPhase,
|
|
902
|
+
tool: toolInput.nullable(),
|
|
903
|
+
request: PolicyRequestContext.nullable()
|
|
904
|
+
}).strict().refine((v) => v.phase === "tool_call" ? v.tool !== null && v.request === null : v.tool === null && v.request !== null);
|
|
844
905
|
|
|
845
906
|
// packages/protocol/dist/entities.js
|
|
846
907
|
var Iso = z6.string();
|
|
@@ -877,6 +938,8 @@ var RuntimeCapabilities = CoreCapabilities.extend({
|
|
|
877
938
|
agentRequests: z6.boolean().optional(),
|
|
878
939
|
messageDelivery: z6.boolean().optional(),
|
|
879
940
|
policies: z6.boolean().optional(),
|
|
941
|
+
/** Session-scoped adapter inspection and safe reload. */
|
|
942
|
+
adapterDevelopment: z6.boolean().optional(),
|
|
880
943
|
unsupported: z6.array(z6.object({ capability: z6.string(), reason: z6.string() }))
|
|
881
944
|
});
|
|
882
945
|
var ProjectScan = z6.object({
|
|
@@ -1089,6 +1152,8 @@ var Session = z6.object({
|
|
|
1089
1152
|
terminal: z6.boolean().optional(),
|
|
1090
1153
|
/** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
|
|
1091
1154
|
unreadSince: Iso.nullable().optional(),
|
|
1155
|
+
/** Identity of the adapter presentation currently installed on the host. */
|
|
1156
|
+
adapterGeneration: z6.string().uuid().optional(),
|
|
1092
1157
|
/** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
|
|
1093
1158
|
transcriptEpoch: z6.number().int().min(0).optional(),
|
|
1094
1159
|
bridge: z6.object({
|
|
@@ -1345,7 +1410,8 @@ var ToolItemData = z6.object({
|
|
|
1345
1410
|
startedAt: Iso,
|
|
1346
1411
|
durationMs: z6.number().nullable(),
|
|
1347
1412
|
card: UINodeSchema.nullable(),
|
|
1348
|
-
adapterId: z6.string().nullable()
|
|
1413
|
+
adapterId: z6.string().nullable(),
|
|
1414
|
+
adapterGeneration: z6.string().uuid().optional()
|
|
1349
1415
|
});
|
|
1350
1416
|
var TranscriptItem = z6.discriminatedUnion("kind", [
|
|
1351
1417
|
z6.object({
|
|
@@ -1391,7 +1457,14 @@ var TranscriptItem = z6.discriminatedUnion("kind", [
|
|
|
1391
1457
|
order: z6.number().int(),
|
|
1392
1458
|
at: Iso,
|
|
1393
1459
|
kind: z6.literal("notice"),
|
|
1394
|
-
data: z6.object({
|
|
1460
|
+
data: z6.object({
|
|
1461
|
+
level: DiagnosticLevel,
|
|
1462
|
+
text: z6.string(),
|
|
1463
|
+
customType: z6.string().min(1).max(200).optional(),
|
|
1464
|
+
card: UINodeSchema.optional(),
|
|
1465
|
+
adapterId: z6.string().optional(),
|
|
1466
|
+
adapterGeneration: z6.string().uuid().optional()
|
|
1467
|
+
}).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
|
|
1395
1468
|
}),
|
|
1396
1469
|
z6.object({
|
|
1397
1470
|
id: Id4,
|
|
@@ -1432,6 +1505,9 @@ var Panel = z6.object({
|
|
|
1432
1505
|
node: UINodeSchema.nullable(),
|
|
1433
1506
|
webRenderer: z6.boolean(),
|
|
1434
1507
|
mobileFallback: z6.string().nullable(),
|
|
1508
|
+
contribution: ContributionDescriptor.optional(),
|
|
1509
|
+
state: z6.unknown().optional(),
|
|
1510
|
+
adapterGeneration: z6.string().uuid().optional(),
|
|
1435
1511
|
updatedAt: Iso
|
|
1436
1512
|
});
|
|
1437
1513
|
var Diagnostic = z6.object({
|
|
@@ -1463,39 +1539,378 @@ var Passkey = z6.object({
|
|
|
1463
1539
|
transports: z6.array(z6.string())
|
|
1464
1540
|
});
|
|
1465
1541
|
|
|
1466
|
-
// packages/protocol/dist/
|
|
1542
|
+
// packages/protocol/dist/adapter-preview.js
|
|
1543
|
+
var ADAPTER_PREVIEW_MAX_BYTES = 1024 * 1024;
|
|
1544
|
+
var ADAPTER_PREVIEW_MAX_STEPS = 200;
|
|
1545
|
+
var ADAPTER_PREVIEW_SESSION_ID = "ses_adapter_preview";
|
|
1546
|
+
function bounded(input, ctx) {
|
|
1547
|
+
try {
|
|
1548
|
+
boundContributionJson(input, ADAPTER_PREVIEW_MAX_BYTES);
|
|
1549
|
+
return input;
|
|
1550
|
+
} catch (error) {
|
|
1551
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1552
|
+
return z7.NEVER;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
var Id5 = z7.string().min(1).max(200);
|
|
1556
|
+
var Text2 = z7.string().max(64 * 1024);
|
|
1557
|
+
var Tool = { toolCallId: Id5, name: Id5, args: z7.unknown() };
|
|
1558
|
+
var DialogCommon = { id: Id5, title: Text2 };
|
|
1559
|
+
var AdapterPreviewPiUiRequestSchema = z7.discriminatedUnion("method", [
|
|
1560
|
+
z7.object({
|
|
1561
|
+
...DialogCommon,
|
|
1562
|
+
method: z7.literal("select"),
|
|
1563
|
+
options: z7.array(Text2).max(200),
|
|
1564
|
+
timeout: z7.number().nonnegative().optional()
|
|
1565
|
+
}).strict(),
|
|
1566
|
+
z7.object({
|
|
1567
|
+
...DialogCommon,
|
|
1568
|
+
method: z7.literal("confirm"),
|
|
1569
|
+
message: Text2,
|
|
1570
|
+
timeout: z7.number().nonnegative().optional()
|
|
1571
|
+
}).strict(),
|
|
1572
|
+
z7.object({
|
|
1573
|
+
...DialogCommon,
|
|
1574
|
+
method: z7.literal("input"),
|
|
1575
|
+
placeholder: Text2.optional(),
|
|
1576
|
+
timeout: z7.number().nonnegative().optional()
|
|
1577
|
+
}).strict(),
|
|
1578
|
+
z7.object({ ...DialogCommon, method: z7.literal("editor"), prefill: Text2.optional() }).strict()
|
|
1579
|
+
]);
|
|
1580
|
+
var AdapterPreviewStepSchema = z7.discriminatedUnion("kind", [
|
|
1581
|
+
z7.object({ kind: z7.literal("restore") }).strict(),
|
|
1582
|
+
z7.object({ kind: z7.literal("toolStart"), data: z7.object(Tool).strict() }).strict(),
|
|
1583
|
+
z7.object({
|
|
1584
|
+
kind: z7.literal("toolUpdate"),
|
|
1585
|
+
data: z7.object({ ...Tool, partialResult: z7.unknown(), details: z7.unknown().optional() }).strict()
|
|
1586
|
+
}).strict(),
|
|
1587
|
+
z7.object({
|
|
1588
|
+
kind: z7.literal("toolEnd"),
|
|
1589
|
+
data: z7.object({
|
|
1590
|
+
...Tool,
|
|
1591
|
+
result: z7.unknown(),
|
|
1592
|
+
isError: z7.boolean(),
|
|
1593
|
+
details: z7.unknown().optional()
|
|
1594
|
+
}).strict()
|
|
1595
|
+
}).strict(),
|
|
1596
|
+
z7.object({
|
|
1597
|
+
kind: z7.literal("status"),
|
|
1598
|
+
data: z7.object({ key: Id5, text: Text2.optional() }).strict()
|
|
1599
|
+
}).strict(),
|
|
1600
|
+
z7.object({
|
|
1601
|
+
kind: z7.literal("widget"),
|
|
1602
|
+
data: z7.object({ key: Id5, lines: z7.array(Text2).max(200).optional() }).strict()
|
|
1603
|
+
}).strict(),
|
|
1604
|
+
z7.object({ kind: z7.literal("dialog"), data: AdapterPreviewPiUiRequestSchema }).strict(),
|
|
1605
|
+
z7.object({
|
|
1606
|
+
kind: z7.literal("answer"),
|
|
1607
|
+
data: z7.object({ requestId: Id5, response: InteractionResponseSchema }).strict()
|
|
1608
|
+
}).strict(),
|
|
1609
|
+
z7.object({
|
|
1610
|
+
kind: z7.literal("customMessage"),
|
|
1611
|
+
data: z7.object({
|
|
1612
|
+
customType: Id5,
|
|
1613
|
+
content: z7.unknown(),
|
|
1614
|
+
display: z7.boolean().optional(),
|
|
1615
|
+
details: z7.unknown().optional()
|
|
1616
|
+
}).strict()
|
|
1617
|
+
}).strict(),
|
|
1618
|
+
z7.object({
|
|
1619
|
+
kind: z7.literal("action"),
|
|
1620
|
+
data: z7.object({ actionId: Id5, payload: z7.unknown() }).strict()
|
|
1621
|
+
}).strict()
|
|
1622
|
+
]);
|
|
1623
|
+
var AdapterPreviewFixtureSchema = z7.unknown().transform(bounded).pipe(z7.object({
|
|
1624
|
+
version: z7.literal(1),
|
|
1625
|
+
name: z7.string().min(1).max(200),
|
|
1626
|
+
initialState: z7.record(z7.string(), z7.record(z7.string(), z7.unknown())).optional(),
|
|
1627
|
+
steps: z7.array(AdapterPreviewStepSchema).max(ADAPTER_PREVIEW_MAX_STEPS)
|
|
1628
|
+
}).strict());
|
|
1629
|
+
var PortableNode = z7.unknown().transform((input, ctx) => {
|
|
1630
|
+
try {
|
|
1631
|
+
return validateUINode(input);
|
|
1632
|
+
} catch (error) {
|
|
1633
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1634
|
+
return z7.NEVER;
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
var PreviewPanel = Panel.extend({ webRenderer: z7.literal(false) }).superRefine((panel, ctx) => {
|
|
1638
|
+
try {
|
|
1639
|
+
if (panel.sessionId !== ADAPTER_PREVIEW_SESSION_ID)
|
|
1640
|
+
throw new Error("Preview panels must use the fake preview session");
|
|
1641
|
+
if (panel.node !== null)
|
|
1642
|
+
validateUINode(panel.node);
|
|
1643
|
+
if (panel.contribution) {
|
|
1644
|
+
const { id, ...descriptor } = panel.contribution;
|
|
1645
|
+
if (panel.slot !== contributionSlot(id))
|
|
1646
|
+
throw new Error("Contribution slot does not match its id");
|
|
1647
|
+
validateContribution(id, {
|
|
1648
|
+
...descriptor,
|
|
1649
|
+
title: panel.title,
|
|
1650
|
+
node: panel.node,
|
|
1651
|
+
mobileFallback: panel.mobileFallback,
|
|
1652
|
+
...panel.state === void 0 ? {} : { state: panel.state }
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
} catch (error) {
|
|
1656
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1657
|
+
}
|
|
1658
|
+
});
|
|
1659
|
+
var AdapterPreviewSchema = z7.unknown().transform(bounded).pipe(z7.object({
|
|
1660
|
+
version: z7.literal(1),
|
|
1661
|
+
name: z7.string().min(1).max(200),
|
|
1662
|
+
adapter: z7.object({ id: Id5, version: Id5 }).strict(),
|
|
1663
|
+
steps: z7.array(z7.object({
|
|
1664
|
+
index: z7.number().int().min(0).max(ADAPTER_PREVIEW_MAX_STEPS - 1),
|
|
1665
|
+
kind: z7.enum([
|
|
1666
|
+
"restore",
|
|
1667
|
+
"toolStart",
|
|
1668
|
+
"toolUpdate",
|
|
1669
|
+
"toolEnd",
|
|
1670
|
+
"status",
|
|
1671
|
+
"widget",
|
|
1672
|
+
"dialog",
|
|
1673
|
+
"answer",
|
|
1674
|
+
"customMessage",
|
|
1675
|
+
"action"
|
|
1676
|
+
]),
|
|
1677
|
+
ok: z7.boolean(),
|
|
1678
|
+
error: z7.string().max(4e3).nullable()
|
|
1679
|
+
}).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
|
|
1680
|
+
panels: z7.array(PreviewPanel).max(256),
|
|
1681
|
+
interactions: z7.array(z7.object({
|
|
1682
|
+
request: AdapterPreviewPiUiRequestSchema,
|
|
1683
|
+
presentation: PortableNode,
|
|
1684
|
+
state: z7.enum(["pending", "resolved"])
|
|
1685
|
+
}).strict()).max(ADAPTER_PREVIEW_MAX_STEPS),
|
|
1686
|
+
cards: z7.array(z7.unknown().transform((input, ctx) => {
|
|
1687
|
+
try {
|
|
1688
|
+
return validateContributionCard(input);
|
|
1689
|
+
} catch (error) {
|
|
1690
|
+
ctx.addIssue({ code: "custom", message: error.message });
|
|
1691
|
+
return z7.NEVER;
|
|
1692
|
+
}
|
|
1693
|
+
})).max(ADAPTER_PREVIEW_MAX_STEPS * 3),
|
|
1694
|
+
diagnostics: z7.array(Diagnostic.extend({ message: z7.string().max(4e3) }).refine((d) => d.sessionId === null || d.sessionId === ADAPTER_PREVIEW_SESSION_ID, "Preview diagnostics must use the fake preview session")).max(200)
|
|
1695
|
+
}).strict().superRefine((preview, ctx) => {
|
|
1696
|
+
const slots = /* @__PURE__ */ new Set();
|
|
1697
|
+
let contributions = 0;
|
|
1698
|
+
for (const panel of preview.panels) {
|
|
1699
|
+
if (panel.adapterId !== preview.adapter.id)
|
|
1700
|
+
ctx.addIssue({
|
|
1701
|
+
code: "custom",
|
|
1702
|
+
message: "Preview panel belongs to a different adapter"
|
|
1703
|
+
});
|
|
1704
|
+
const key = JSON.stringify([panel.adapterId, panel.slot]);
|
|
1705
|
+
if (slots.has(key))
|
|
1706
|
+
ctx.addIssue({ code: "custom", message: "Duplicate preview panel slot" });
|
|
1707
|
+
slots.add(key);
|
|
1708
|
+
if (panel.contribution && ++contributions > 64)
|
|
1709
|
+
ctx.addIssue({
|
|
1710
|
+
code: "custom",
|
|
1711
|
+
message: "At most 64 contributions per adapter/session"
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
const requests = /* @__PURE__ */ new Set();
|
|
1715
|
+
for (const interaction of preview.interactions) {
|
|
1716
|
+
if (requests.has(interaction.request.id))
|
|
1717
|
+
ctx.addIssue({ code: "custom", message: "Duplicate preview dialog" });
|
|
1718
|
+
requests.add(interaction.request.id);
|
|
1719
|
+
}
|
|
1720
|
+
}));
|
|
1721
|
+
|
|
1722
|
+
// packages/protocol/dist/adapters.js
|
|
1723
|
+
import { z as z8 } from "zod";
|
|
1724
|
+
var Path = z8.string().max(4096);
|
|
1725
|
+
var SessionAdapterInfo = AdapterInfo.extend({
|
|
1726
|
+
runtimeStatus: z8.enum(["active", "disabled", "unavailable"]),
|
|
1727
|
+
runtimeDetail: z8.string().max(4e3).nullable(),
|
|
1728
|
+
provenance: z8.object({
|
|
1729
|
+
scope: z8.enum(["user", "project", "explicit"]),
|
|
1730
|
+
source: Path.nullable(),
|
|
1731
|
+
packageDir: Path.nullable(),
|
|
1732
|
+
manifestPath: Path.nullable(),
|
|
1733
|
+
targetVersion: z8.string().nullable(),
|
|
1734
|
+
entrypoints: z8.array(Path).max(128),
|
|
1735
|
+
evidence: z8.enum(["runtime-reported", "package-level", "explicit"])
|
|
1736
|
+
})
|
|
1737
|
+
});
|
|
1738
|
+
var SessionAdaptersResult = z8.object({
|
|
1739
|
+
generation: z8.string().uuid().nullable(),
|
|
1740
|
+
runtimeId: z8.string().nullable(),
|
|
1741
|
+
reloadable: z8.boolean(),
|
|
1742
|
+
blockedReason: z8.string().nullable(),
|
|
1743
|
+
adapters: z8.array(SessionAdapterInfo).max(256),
|
|
1744
|
+
diagnostics: z8.array(Diagnostic).max(100)
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1747
|
+
// packages/protocol/dist/agent-wire.js
|
|
1467
1748
|
import { z as z9 } from "zod";
|
|
1749
|
+
var Id6 = z9.string().min(1).max(200);
|
|
1750
|
+
var Instant3 = z9.string().refine((value) => {
|
|
1751
|
+
const date = new Date(value);
|
|
1752
|
+
return Number.isFinite(date.getTime()) && date.toISOString() === value;
|
|
1753
|
+
}, "Expected canonical UTC timestamp");
|
|
1754
|
+
var AGENT_FRAME_MAX_BYTES = 128 * 1024;
|
|
1755
|
+
var AgentMethod = z9.enum([
|
|
1756
|
+
"session.bind",
|
|
1757
|
+
"task.create",
|
|
1758
|
+
"message.send",
|
|
1759
|
+
"inbox.read",
|
|
1760
|
+
"receipt.peek",
|
|
1761
|
+
"policy.evaluate",
|
|
1762
|
+
"policy.status",
|
|
1763
|
+
"policy.cancel"
|
|
1764
|
+
]);
|
|
1765
|
+
var AgentToolMethod = z9.enum(["task.create", "message.send", "inbox.read"]);
|
|
1766
|
+
var RequestHash = z9.string().regex(/^[a-f0-9]{64}$/);
|
|
1767
|
+
var AgentReceiptPeekRequest = z9.object({ method: AgentToolMethod, args: z9.record(z9.string(), z9.json()) }).strict();
|
|
1768
|
+
var AgentReceiptPeekResult = z9.discriminatedUnion("found", [
|
|
1769
|
+
z9.object({ found: z9.literal(false) }).strict(),
|
|
1770
|
+
z9.object({ found: z9.literal(true), requestHash: RequestHash }).strict()
|
|
1771
|
+
]);
|
|
1772
|
+
var AgentReceiptReplay = z9.object({ requestHash: RequestHash }).strict();
|
|
1773
|
+
var CreateAgentTask = z9.object({
|
|
1774
|
+
objective: z9.string().min(1).max(16e3),
|
|
1775
|
+
acceptance: z9.array(z9.string().min(1).max(2e3)).max(100).default([]),
|
|
1776
|
+
dependencies: z9.array(Id6).max(100).default([]),
|
|
1777
|
+
parentTaskId: Id6.nullable().optional(),
|
|
1778
|
+
hostId: Id6.optional(),
|
|
1779
|
+
profileId: Id6.optional(),
|
|
1780
|
+
notifyOnFinish: z9.boolean().default(true)
|
|
1781
|
+
});
|
|
1782
|
+
var SendAgentMessage = z9.object({
|
|
1783
|
+
sessionId: Id6,
|
|
1784
|
+
body: z9.string().min(1).max(16e3),
|
|
1785
|
+
mode: z9.enum(["steer", "queue"]),
|
|
1786
|
+
replyTo: Id6.optional()
|
|
1787
|
+
});
|
|
1788
|
+
var ReadAgentInbox = z9.object({
|
|
1789
|
+
after: z9.number().int().nonnegative().default(0),
|
|
1790
|
+
limit: z9.number().int().min(1).max(100).default(20)
|
|
1791
|
+
});
|
|
1792
|
+
var DeliveryState = z9.enum([
|
|
1793
|
+
"pending",
|
|
1794
|
+
"held",
|
|
1795
|
+
"deferred",
|
|
1796
|
+
"accepted",
|
|
1797
|
+
"queued",
|
|
1798
|
+
"appended",
|
|
1799
|
+
"uncertain",
|
|
1800
|
+
"failed"
|
|
1801
|
+
]);
|
|
1802
|
+
var AgentMessageFields = {
|
|
1803
|
+
seq: z9.number().int().positive(),
|
|
1804
|
+
id: Id6,
|
|
1805
|
+
recipientSessionId: Id6,
|
|
1806
|
+
replyTo: Id6.nullable(),
|
|
1807
|
+
chainId: Id6,
|
|
1808
|
+
depth: z9.number().int().min(0).max(4),
|
|
1809
|
+
body: z9.unknown(),
|
|
1810
|
+
requestedMode: z9.enum(["steer", "queue"]),
|
|
1811
|
+
deliveryState: DeliveryState,
|
|
1812
|
+
holdUntil: z9.string(),
|
|
1813
|
+
readAt: z9.string().nullable(),
|
|
1814
|
+
createdAt: z9.string()
|
|
1815
|
+
};
|
|
1816
|
+
var AgentMessage = z9.discriminatedUnion("kind", [
|
|
1817
|
+
z9.object({ ...AgentMessageFields, kind: z9.literal("message"), senderSessionId: Id6 }),
|
|
1818
|
+
z9.object({
|
|
1819
|
+
...AgentMessageFields,
|
|
1820
|
+
kind: z9.literal("completion"),
|
|
1821
|
+
senderSessionId: Id6.nullable()
|
|
1822
|
+
})
|
|
1823
|
+
]);
|
|
1824
|
+
var AgentInbox = z9.object({
|
|
1825
|
+
messages: z9.array(AgentMessage),
|
|
1826
|
+
nextAfter: z9.number().int().nonnegative(),
|
|
1827
|
+
hasMore: z9.boolean()
|
|
1828
|
+
});
|
|
1829
|
+
var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z9.literal("policy.required") }).strict();
|
|
1830
|
+
var AgentRequestFrame = z9.object({
|
|
1831
|
+
type: z9.literal("agent.request"),
|
|
1832
|
+
requestId: Id6,
|
|
1833
|
+
sessionId: Id6,
|
|
1834
|
+
nativeSessionId: Id6,
|
|
1835
|
+
runtimeId: Id6,
|
|
1836
|
+
context: z9.object({ humanInputId: Id6.nullable(), causalMessageId: Id6.nullable() }).strict(),
|
|
1837
|
+
toolCallId: Id6.optional(),
|
|
1838
|
+
receiptReplay: AgentReceiptReplay.optional(),
|
|
1839
|
+
// Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
|
|
1840
|
+
deadlineAt: Instant3.optional(),
|
|
1841
|
+
method: AgentMethod,
|
|
1842
|
+
args: z9.unknown()
|
|
1843
|
+
}).strict().superRefine((frame, ctx) => {
|
|
1844
|
+
if (frame.method === "receipt.peek") {
|
|
1845
|
+
if (!frame.toolCallId) {
|
|
1846
|
+
ctx.addIssue({
|
|
1847
|
+
code: "custom",
|
|
1848
|
+
path: ["toolCallId"],
|
|
1849
|
+
message: "Receipt lookup requires a tool call ID."
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
if (Object.hasOwn(frame, "receiptReplay") && !AgentToolMethod.safeParse(frame.method).success) {
|
|
1854
|
+
ctx.addIssue({
|
|
1855
|
+
code: "custom",
|
|
1856
|
+
path: ["receiptReplay"],
|
|
1857
|
+
message: "Receipt replay is only valid for tool methods."
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
var AgentResultFrame = z9.discriminatedUnion("ok", [
|
|
1862
|
+
z9.object({
|
|
1863
|
+
type: z9.literal("agent.result"),
|
|
1864
|
+
requestId: Id6,
|
|
1865
|
+
runtimeId: Id6,
|
|
1866
|
+
ok: z9.literal(true),
|
|
1867
|
+
result: z9.unknown()
|
|
1868
|
+
}),
|
|
1869
|
+
z9.object({
|
|
1870
|
+
type: z9.literal("agent.result"),
|
|
1871
|
+
requestId: Id6,
|
|
1872
|
+
runtimeId: Id6,
|
|
1873
|
+
ok: z9.literal(false),
|
|
1874
|
+
error: ErrorBody
|
|
1875
|
+
})
|
|
1876
|
+
]);
|
|
1877
|
+
|
|
1878
|
+
// packages/protocol/dist/api.js
|
|
1879
|
+
import { z as z13 } from "zod";
|
|
1880
|
+
|
|
1881
|
+
// packages/protocol/dist/host-wire.js
|
|
1882
|
+
import { z as z12 } from "zod";
|
|
1468
1883
|
|
|
1469
1884
|
// packages/protocol/dist/events.js
|
|
1470
|
-
import { z as
|
|
1885
|
+
import { z as z10 } from "zod";
|
|
1471
1886
|
var EventDataSchemas = {
|
|
1472
1887
|
"host.updated": Host,
|
|
1473
1888
|
"project.updated": Project,
|
|
1474
|
-
"project.deleted":
|
|
1889
|
+
"project.deleted": z10.object({ id: z10.string() }),
|
|
1475
1890
|
"checkout.updated": Checkout,
|
|
1476
1891
|
"workspace.updated": Workspace,
|
|
1477
|
-
"workspace.deleted":
|
|
1892
|
+
"workspace.deleted": z10.object({ id: z10.string() }),
|
|
1478
1893
|
"profile.updated": Profile,
|
|
1479
|
-
"profile.deleted":
|
|
1894
|
+
"profile.deleted": z10.object({ id: z10.string() }),
|
|
1480
1895
|
"view.updated": View,
|
|
1481
|
-
"view.deleted":
|
|
1896
|
+
"view.deleted": z10.object({ id: z10.string() }),
|
|
1482
1897
|
"session.updated": Session,
|
|
1483
1898
|
"transcript.item": TranscriptItem,
|
|
1484
|
-
"transcript.reset":
|
|
1899
|
+
"transcript.reset": z10.object({ sessionId: z10.string(), epoch: z10.number().int() }),
|
|
1485
1900
|
"interaction.updated": Interaction,
|
|
1486
1901
|
"panel.updated": Panel,
|
|
1487
|
-
"adapters.updated":
|
|
1902
|
+
"adapters.updated": z10.object({ hostId: z10.string(), adapters: z10.array(AdapterInfo) }),
|
|
1488
1903
|
diagnostic: Diagnostic,
|
|
1489
1904
|
"task.updated": Task,
|
|
1490
|
-
"task.deleted":
|
|
1905
|
+
"task.deleted": z10.object({ id: z10.string() }),
|
|
1491
1906
|
"run.updated": Run,
|
|
1492
1907
|
"automation.updated": Automation,
|
|
1493
|
-
"automation.deleted":
|
|
1908
|
+
"automation.deleted": z10.object({ id: z10.string() }),
|
|
1494
1909
|
"occurrence.created": Occurrence,
|
|
1495
1910
|
"occurrence.updated": Occurrence,
|
|
1496
1911
|
"attention.updated": AttentionItem,
|
|
1497
1912
|
"device.updated": Device,
|
|
1498
|
-
"settings.updated":
|
|
1913
|
+
"settings.updated": z10.object({ dispatchPaused: z10.boolean() })
|
|
1499
1914
|
};
|
|
1500
1915
|
var EVENT_TYPES = Object.keys(EventDataSchemas);
|
|
1501
1916
|
var LEGACY_EVENT_TYPES = {
|
|
@@ -1505,19 +1920,19 @@ function canonicalEventType(type) {
|
|
|
1505
1920
|
return LEGACY_EVENT_TYPES[type] ?? type;
|
|
1506
1921
|
}
|
|
1507
1922
|
var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
|
|
1508
|
-
var EventTypeSchema =
|
|
1509
|
-
var EventScope =
|
|
1510
|
-
hostId:
|
|
1511
|
-
sessionId:
|
|
1512
|
-
taskId:
|
|
1513
|
-
projectId:
|
|
1923
|
+
var EventTypeSchema = z10.preprocess(canonical, z10.enum(EVENT_TYPES));
|
|
1924
|
+
var EventScope = z10.object({
|
|
1925
|
+
hostId: z10.string().optional(),
|
|
1926
|
+
sessionId: z10.string().optional(),
|
|
1927
|
+
taskId: z10.string().optional(),
|
|
1928
|
+
projectId: z10.string().optional()
|
|
1514
1929
|
});
|
|
1515
1930
|
var EventEnvelope = EventScope.extend({
|
|
1516
|
-
seq:
|
|
1517
|
-
id:
|
|
1931
|
+
seq: z10.number().int(),
|
|
1932
|
+
id: z10.string(),
|
|
1518
1933
|
type: EventTypeSchema,
|
|
1519
|
-
at:
|
|
1520
|
-
data:
|
|
1934
|
+
at: z10.string(),
|
|
1935
|
+
data: z10.unknown()
|
|
1521
1936
|
});
|
|
1522
1937
|
var HOST_EVENT_TYPES = [
|
|
1523
1938
|
"session.updated",
|
|
@@ -1530,318 +1945,321 @@ var HOST_EVENT_TYPES = [
|
|
|
1530
1945
|
"workspace.deleted"
|
|
1531
1946
|
];
|
|
1532
1947
|
var HostEvent = EventScope.extend({
|
|
1533
|
-
eventId:
|
|
1534
|
-
type:
|
|
1535
|
-
at:
|
|
1536
|
-
data:
|
|
1537
|
-
});
|
|
1538
|
-
var StreamDelta =
|
|
1539
|
-
sessionId:
|
|
1540
|
-
itemId:
|
|
1541
|
-
kind:
|
|
1542
|
-
delta:
|
|
1543
|
-
order:
|
|
1948
|
+
eventId: z10.string(),
|
|
1949
|
+
type: z10.preprocess(canonical, z10.enum(HOST_EVENT_TYPES)),
|
|
1950
|
+
at: z10.string(),
|
|
1951
|
+
data: z10.unknown()
|
|
1952
|
+
});
|
|
1953
|
+
var StreamDelta = z10.object({
|
|
1954
|
+
sessionId: z10.string(),
|
|
1955
|
+
itemId: z10.string(),
|
|
1956
|
+
kind: z10.enum(["text", "thinking", "tool_args", "tool_output"]),
|
|
1957
|
+
delta: z10.string(),
|
|
1958
|
+
order: z10.number().int().optional()
|
|
1544
1959
|
});
|
|
1545
1960
|
|
|
1546
1961
|
// packages/protocol/dist/terminal-wire.js
|
|
1547
|
-
import { z as
|
|
1548
|
-
var Cols =
|
|
1549
|
-
var Rows =
|
|
1550
|
-
var TermViewerToServer =
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1962
|
+
import { z as z11 } from "zod";
|
|
1963
|
+
var Cols = z11.number().int().min(10).max(1e3);
|
|
1964
|
+
var Rows = z11.number().int().min(5).max(500);
|
|
1965
|
+
var TermViewerToServer = z11.discriminatedUnion("t", [
|
|
1966
|
+
z11.object({ t: z11.literal("in"), d: z11.string() }),
|
|
1967
|
+
z11.object({ t: z11.literal("resize"), cols: Cols, rows: Rows }),
|
|
1968
|
+
z11.object({ t: z11.literal("claim") })
|
|
1554
1969
|
]);
|
|
1555
|
-
var TermServerToViewer =
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1970
|
+
var TermServerToViewer = z11.discriminatedUnion("t", [
|
|
1971
|
+
z11.object({ t: z11.literal("out"), d: z11.string() }),
|
|
1972
|
+
z11.object({ t: z11.literal("closed"), reason: z11.string() }),
|
|
1973
|
+
z11.object({ t: z11.literal("size"), cols: Cols, rows: Rows, owner: z11.boolean() })
|
|
1559
1974
|
]);
|
|
1560
|
-
var TermCoordinatorMsg =
|
|
1561
|
-
|
|
1562
|
-
t:
|
|
1563
|
-
sessionId:
|
|
1975
|
+
var TermCoordinatorMsg = z11.discriminatedUnion("t", [
|
|
1976
|
+
z11.object({
|
|
1977
|
+
t: z11.literal("open"),
|
|
1978
|
+
sessionId: z11.string(),
|
|
1564
1979
|
cols: Cols,
|
|
1565
1980
|
rows: Rows,
|
|
1566
|
-
passive:
|
|
1981
|
+
passive: z11.boolean().optional()
|
|
1567
1982
|
}),
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1983
|
+
z11.object({ t: z11.literal("claim") }),
|
|
1984
|
+
z11.object({ t: z11.literal("in"), d: z11.string() }),
|
|
1985
|
+
z11.object({ t: z11.literal("resize"), cols: Cols, rows: Rows }),
|
|
1986
|
+
z11.object({ t: z11.literal("close") })
|
|
1572
1987
|
]);
|
|
1573
1988
|
|
|
1574
1989
|
// packages/protocol/dist/host-wire.js
|
|
1575
|
-
var Origin =
|
|
1576
|
-
var HostCommand =
|
|
1577
|
-
|
|
1578
|
-
type:
|
|
1579
|
-
sessionId:
|
|
1580
|
-
title:
|
|
1581
|
-
workspacePath:
|
|
1582
|
-
projectId:
|
|
1990
|
+
var Origin = z12.enum(["human", "automation"]);
|
|
1991
|
+
var HostCommand = z12.discriminatedUnion("type", [
|
|
1992
|
+
z12.object({
|
|
1993
|
+
type: z12.literal("session.start"),
|
|
1994
|
+
sessionId: z12.string(),
|
|
1995
|
+
title: z12.string(),
|
|
1996
|
+
workspacePath: z12.string(),
|
|
1997
|
+
projectId: z12.string().nullable(),
|
|
1583
1998
|
profile: Profile,
|
|
1584
1999
|
nativeHandle: NativeHandle.nullable(),
|
|
1585
|
-
initialPrompt:
|
|
1586
|
-
dispatchKey:
|
|
1587
|
-
controlRevision:
|
|
2000
|
+
initialPrompt: z12.string().nullable(),
|
|
2001
|
+
dispatchKey: z12.string().nullable(),
|
|
2002
|
+
controlRevision: z12.number().int(),
|
|
1588
2003
|
controlMode: ControlMode,
|
|
1589
2004
|
origin: Origin,
|
|
1590
|
-
readOnly:
|
|
1591
|
-
policyRequired:
|
|
2005
|
+
readOnly: z12.boolean().default(false),
|
|
2006
|
+
policyRequired: z12.boolean().optional()
|
|
1592
2007
|
}),
|
|
1593
|
-
|
|
1594
|
-
type:
|
|
1595
|
-
sessionId:
|
|
1596
|
-
messageId:
|
|
1597
|
-
payload:
|
|
1598
|
-
deliveryId:
|
|
1599
|
-
kind:
|
|
1600
|
-
text:
|
|
2008
|
+
z12.object({
|
|
2009
|
+
type: z12.literal("session.deliverMessage"),
|
|
2010
|
+
sessionId: z12.string(),
|
|
2011
|
+
messageId: z12.string(),
|
|
2012
|
+
payload: z12.object({
|
|
2013
|
+
deliveryId: z12.string(),
|
|
2014
|
+
kind: z12.enum(["message", "completion"]),
|
|
2015
|
+
text: z12.string()
|
|
1601
2016
|
}),
|
|
1602
|
-
mode:
|
|
1603
|
-
holdUntil:
|
|
2017
|
+
mode: z12.enum(["steer", "queue"]),
|
|
2018
|
+
holdUntil: z12.string()
|
|
1604
2019
|
}),
|
|
1605
|
-
HostPolicySampleRequest.extend({ type:
|
|
1606
|
-
|
|
1607
|
-
type:
|
|
1608
|
-
sessionId:
|
|
1609
|
-
messageIds:
|
|
2020
|
+
HostPolicySampleRequest.extend({ type: z12.literal("session.classifyPolicySample") }),
|
|
2021
|
+
z12.object({
|
|
2022
|
+
type: z12.literal("session.messageStatus"),
|
|
2023
|
+
sessionId: z12.string(),
|
|
2024
|
+
messageIds: z12.array(z12.string().min(1)).min(1).max(100)
|
|
1610
2025
|
}),
|
|
1611
|
-
|
|
1612
|
-
type:
|
|
1613
|
-
sessionId:
|
|
1614
|
-
text:
|
|
1615
|
-
images:
|
|
1616
|
-
mode:
|
|
2026
|
+
z12.object({
|
|
2027
|
+
type: z12.literal("session.prompt"),
|
|
2028
|
+
sessionId: z12.string(),
|
|
2029
|
+
text: z12.string(),
|
|
2030
|
+
images: z12.array(z12.object({ mimeType: z12.string(), data: z12.string() })).default([]),
|
|
2031
|
+
mode: z12.enum(["prompt", "steer", "followUp"]),
|
|
1617
2032
|
origin: Origin,
|
|
1618
|
-
controlRevision:
|
|
2033
|
+
controlRevision: z12.number().int()
|
|
1619
2034
|
}),
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
type:
|
|
1624
|
-
sessionId:
|
|
1625
|
-
interactionId:
|
|
1626
|
-
revision:
|
|
2035
|
+
z12.object({ type: z12.literal("session.abort"), sessionId: z12.string(), clearQueue: z12.boolean() }),
|
|
2036
|
+
z12.object({ type: z12.literal("session.stop"), sessionId: z12.string() }),
|
|
2037
|
+
z12.object({
|
|
2038
|
+
type: z12.literal("session.answer"),
|
|
2039
|
+
sessionId: z12.string(),
|
|
2040
|
+
interactionId: z12.string(),
|
|
2041
|
+
revision: z12.number().int(),
|
|
1627
2042
|
response: InteractionResponseSchema,
|
|
1628
|
-
deviceId:
|
|
2043
|
+
deviceId: z12.string()
|
|
1629
2044
|
}),
|
|
1630
|
-
|
|
1631
|
-
type:
|
|
1632
|
-
sessionId:
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
2045
|
+
z12.object({
|
|
2046
|
+
type: z12.literal("session.adapterAction"),
|
|
2047
|
+
sessionId: z12.string(),
|
|
2048
|
+
generation: z12.string().uuid().optional(),
|
|
2049
|
+
adapterId: z12.string(),
|
|
2050
|
+
actionId: z12.string(),
|
|
2051
|
+
payload: z12.unknown()
|
|
1636
2052
|
}),
|
|
1637
|
-
|
|
1638
|
-
type:
|
|
1639
|
-
sessionId:
|
|
1640
|
-
controlRevision:
|
|
2053
|
+
z12.object({
|
|
2054
|
+
type: z12.literal("session.setControl"),
|
|
2055
|
+
sessionId: z12.string(),
|
|
2056
|
+
controlRevision: z12.number().int(),
|
|
1641
2057
|
mode: ControlMode
|
|
1642
2058
|
}),
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
type:
|
|
1651
|
-
sessionId:
|
|
1652
|
-
text:
|
|
2059
|
+
z12.object({ type: z12.literal("session.rename"), sessionId: z12.string(), title: z12.string() }),
|
|
2060
|
+
z12.object({ type: z12.literal("session.importable") }),
|
|
2061
|
+
z12.object({ type: z12.literal("session.readNative"), sessionFile: z12.string() }),
|
|
2062
|
+
z12.object({ type: z12.literal("session.snapshot"), sessionId: z12.string() }),
|
|
2063
|
+
z12.object({ type: z12.literal("session.models"), sessionId: z12.string() }),
|
|
2064
|
+
z12.object({ type: z12.literal("session.commands"), sessionId: z12.string() }),
|
|
2065
|
+
z12.object({
|
|
2066
|
+
type: z12.literal("session.complete"),
|
|
2067
|
+
sessionId: z12.string(),
|
|
2068
|
+
text: z12.string().max(500)
|
|
1653
2069
|
}),
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
type:
|
|
1657
|
-
sessionId:
|
|
1658
|
-
entryId:
|
|
1659
|
-
fork:
|
|
2070
|
+
z12.object({ type: z12.literal("session.tree"), sessionId: z12.string() }),
|
|
2071
|
+
z12.object({
|
|
2072
|
+
type: z12.literal("session.branch"),
|
|
2073
|
+
sessionId: z12.string(),
|
|
2074
|
+
entryId: z12.string().nullable(),
|
|
2075
|
+
fork: z12.boolean()
|
|
1660
2076
|
}),
|
|
1661
|
-
|
|
1662
|
-
type:
|
|
1663
|
-
sessionId:
|
|
1664
|
-
entryId:
|
|
1665
|
-
summarize:
|
|
1666
|
-
instructions:
|
|
2077
|
+
z12.object({
|
|
2078
|
+
type: z12.literal("session.navigate"),
|
|
2079
|
+
sessionId: z12.string(),
|
|
2080
|
+
entryId: z12.string(),
|
|
2081
|
+
summarize: z12.boolean(),
|
|
2082
|
+
instructions: z12.string().max(2e3).nullable()
|
|
1667
2083
|
}),
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
2084
|
+
z12.object({ type: z12.literal("session.reload"), sessionId: z12.string() }),
|
|
2085
|
+
z12.object({ type: z12.literal("session.adapters"), sessionId: z12.string() }),
|
|
2086
|
+
z12.object({ type: z12.literal("session.reloadAdapters"), sessionId: z12.string() }),
|
|
2087
|
+
z12.object({ type: z12.literal("session.export"), sessionId: z12.string() }),
|
|
2088
|
+
z12.object({
|
|
2089
|
+
type: z12.literal("session.setModel"),
|
|
2090
|
+
sessionId: z12.string(),
|
|
2091
|
+
provider: z12.string().min(1),
|
|
2092
|
+
modelId: z12.string().min(1)
|
|
1675
2093
|
}),
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
type:
|
|
1679
|
-
sessionId:
|
|
1680
|
-
instructions:
|
|
2094
|
+
z12.object({ type: z12.literal("session.setThinking"), sessionId: z12.string(), level: ThinkingLevel }),
|
|
2095
|
+
z12.object({
|
|
2096
|
+
type: z12.literal("session.compact"),
|
|
2097
|
+
sessionId: z12.string(),
|
|
2098
|
+
instructions: z12.string().nullable()
|
|
1681
2099
|
}),
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
type:
|
|
1686
|
-
days:
|
|
2100
|
+
z12.object({ type: z12.literal("checkout.inspect"), path: z12.string() }),
|
|
2101
|
+
z12.object({ type: z12.literal("projects.scan"), folder: z12.string().min(1) }),
|
|
2102
|
+
z12.object({
|
|
2103
|
+
type: z12.literal("projects.suggest"),
|
|
2104
|
+
days: z12.number().int().min(1).max(365).default(30)
|
|
1687
2105
|
}),
|
|
1688
|
-
|
|
1689
|
-
type:
|
|
1690
|
-
checkoutPath:
|
|
1691
|
-
worktreeDir:
|
|
2106
|
+
z12.object({
|
|
2107
|
+
type: z12.literal("workspace.discover"),
|
|
2108
|
+
checkoutPath: z12.string(),
|
|
2109
|
+
worktreeDir: z12.string().default(DEFAULT_WORKTREE_DIR)
|
|
1692
2110
|
}),
|
|
1693
|
-
|
|
1694
|
-
type:
|
|
1695
|
-
checkoutPath:
|
|
1696
|
-
branch:
|
|
1697
|
-
base:
|
|
1698
|
-
setupCommand:
|
|
1699
|
-
worktreeDir:
|
|
2111
|
+
z12.object({
|
|
2112
|
+
type: z12.literal("workspace.create"),
|
|
2113
|
+
checkoutPath: z12.string(),
|
|
2114
|
+
branch: z12.string(),
|
|
2115
|
+
base: z12.string(),
|
|
2116
|
+
setupCommand: z12.string().nullable(),
|
|
2117
|
+
worktreeDir: z12.string().default(DEFAULT_WORKTREE_DIR)
|
|
1700
2118
|
}),
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
type:
|
|
1704
|
-
path:
|
|
1705
|
-
checkoutPath:
|
|
1706
|
-
base:
|
|
1707
|
-
force:
|
|
2119
|
+
z12.object({ type: z12.literal("workspace.status"), path: z12.string(), base: z12.string().nullable() }),
|
|
2120
|
+
z12.object({
|
|
2121
|
+
type: z12.literal("workspace.remove"),
|
|
2122
|
+
path: z12.string(),
|
|
2123
|
+
checkoutPath: z12.string(),
|
|
2124
|
+
base: z12.string().nullable(),
|
|
2125
|
+
force: z12.object({ dirty: z12.boolean(), unmerged: z12.boolean() })
|
|
1708
2126
|
}),
|
|
1709
|
-
|
|
1710
|
-
type:
|
|
1711
|
-
path:
|
|
1712
|
-
base:
|
|
1713
|
-
file:
|
|
2127
|
+
z12.object({
|
|
2128
|
+
type: z12.literal("workspace.diff"),
|
|
2129
|
+
path: z12.string(),
|
|
2130
|
+
base: z12.string().nullable(),
|
|
2131
|
+
file: z12.string().nullable()
|
|
1714
2132
|
}),
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
GitHubHostViewRequest.extend({ type:
|
|
1718
|
-
GitHubHostLogsRequest.extend({ type:
|
|
1719
|
-
GitHubHostMergeRequest.extend({ type:
|
|
1720
|
-
|
|
1721
|
-
type:
|
|
1722
|
-
dispatchKey:
|
|
1723
|
-
runId:
|
|
1724
|
-
taskId:
|
|
1725
|
-
sessionId:
|
|
1726
|
-
projectId:
|
|
1727
|
-
title:
|
|
1728
|
-
workspace:
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
createFrom:
|
|
1732
|
-
checkoutPath:
|
|
1733
|
-
branch:
|
|
1734
|
-
base:
|
|
1735
|
-
setupCommand:
|
|
1736
|
-
worktreeDir:
|
|
2133
|
+
z12.object({ type: z12.literal("workspace.files"), path: z12.string(), dir: z12.string() }),
|
|
2134
|
+
z12.object({ type: z12.literal("workspace.readFile"), path: z12.string(), file: z12.string() }),
|
|
2135
|
+
GitHubHostViewRequest.extend({ type: z12.literal("workspace.prView") }),
|
|
2136
|
+
GitHubHostLogsRequest.extend({ type: z12.literal("workspace.prFailedLogs") }),
|
|
2137
|
+
GitHubHostMergeRequest.extend({ type: z12.literal("workspace.prMerge") }),
|
|
2138
|
+
z12.object({
|
|
2139
|
+
type: z12.literal("dispatch.start"),
|
|
2140
|
+
dispatchKey: z12.string(),
|
|
2141
|
+
runId: z12.string(),
|
|
2142
|
+
taskId: z12.string(),
|
|
2143
|
+
sessionId: z12.string(),
|
|
2144
|
+
projectId: z12.string(),
|
|
2145
|
+
title: z12.string(),
|
|
2146
|
+
workspace: z12.union([
|
|
2147
|
+
z12.object({ path: z12.string() }),
|
|
2148
|
+
z12.object({
|
|
2149
|
+
createFrom: z12.object({
|
|
2150
|
+
checkoutPath: z12.string(),
|
|
2151
|
+
branch: z12.string(),
|
|
2152
|
+
base: z12.string(),
|
|
2153
|
+
setupCommand: z12.string().nullable(),
|
|
2154
|
+
worktreeDir: z12.string().default(DEFAULT_WORKTREE_DIR)
|
|
1737
2155
|
})
|
|
1738
2156
|
})
|
|
1739
2157
|
]),
|
|
1740
2158
|
nativeHandle: NativeHandle.nullable(),
|
|
1741
2159
|
profile: Profile,
|
|
1742
|
-
prompt:
|
|
2160
|
+
prompt: z12.string(),
|
|
1743
2161
|
/** The launch's own revision; a takeover always carries a newer one. */
|
|
1744
|
-
controlRevision:
|
|
2162
|
+
controlRevision: z12.number().int(),
|
|
1745
2163
|
controlMode: ControlMode.default("automation"),
|
|
1746
|
-
policyRequired:
|
|
2164
|
+
policyRequired: z12.boolean().optional()
|
|
1747
2165
|
}),
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
type:
|
|
1751
|
-
sessionId:
|
|
1752
|
-
path:
|
|
1753
|
-
commands:
|
|
2166
|
+
z12.object({ type: z12.literal("dispatch.reconcile"), dispatchKey: z12.string() }),
|
|
2167
|
+
z12.object({
|
|
2168
|
+
type: z12.literal("checks.run"),
|
|
2169
|
+
sessionId: z12.string(),
|
|
2170
|
+
path: z12.string(),
|
|
2171
|
+
commands: z12.array(z12.string())
|
|
1754
2172
|
})
|
|
1755
2173
|
]);
|
|
1756
|
-
var ImportableSession =
|
|
1757
|
-
sessionFile:
|
|
1758
|
-
sessionId:
|
|
1759
|
-
cwd:
|
|
1760
|
-
name:
|
|
1761
|
-
mtime:
|
|
1762
|
-
inactive:
|
|
1763
|
-
});
|
|
1764
|
-
var DiscoveredWorktree =
|
|
1765
|
-
path:
|
|
1766
|
-
head:
|
|
1767
|
-
branch:
|
|
1768
|
-
bare:
|
|
1769
|
-
detached:
|
|
1770
|
-
locked:
|
|
1771
|
-
prunable:
|
|
1772
|
-
provenance:
|
|
2174
|
+
var ImportableSession = z12.object({
|
|
2175
|
+
sessionFile: z12.string(),
|
|
2176
|
+
sessionId: z12.string(),
|
|
2177
|
+
cwd: z12.string(),
|
|
2178
|
+
name: z12.string().nullable(),
|
|
2179
|
+
mtime: z12.string(),
|
|
2180
|
+
inactive: z12.boolean()
|
|
2181
|
+
});
|
|
2182
|
+
var DiscoveredWorktree = z12.object({
|
|
2183
|
+
path: z12.string(),
|
|
2184
|
+
head: z12.string().nullable(),
|
|
2185
|
+
branch: z12.string().nullable(),
|
|
2186
|
+
bare: z12.boolean(),
|
|
2187
|
+
detached: z12.boolean(),
|
|
2188
|
+
locked: z12.boolean(),
|
|
2189
|
+
prunable: z12.boolean(),
|
|
2190
|
+
provenance: z12.enum(["managed", "discovered", "main"]),
|
|
1773
2191
|
git: GitState.nullable()
|
|
1774
2192
|
});
|
|
1775
|
-
var CheckoutInfo =
|
|
1776
|
-
root:
|
|
1777
|
-
commonDir:
|
|
1778
|
-
repoIdentity:
|
|
1779
|
-
defaultBranch:
|
|
2193
|
+
var CheckoutInfo = z12.object({
|
|
2194
|
+
root: z12.string(),
|
|
2195
|
+
commonDir: z12.string(),
|
|
2196
|
+
repoIdentity: z12.string(),
|
|
2197
|
+
defaultBranch: z12.string()
|
|
1780
2198
|
});
|
|
1781
|
-
var ScannedRepository = CheckoutInfo.extend({ name:
|
|
1782
|
-
var ProjectFolderScan =
|
|
2199
|
+
var ScannedRepository = CheckoutInfo.extend({ name: z12.string() });
|
|
2200
|
+
var ProjectFolderScan = z12.object({
|
|
1783
2201
|
/** The folder, ~ expanded and realpath'd. */
|
|
1784
|
-
folder:
|
|
1785
|
-
repositories:
|
|
1786
|
-
});
|
|
1787
|
-
var ProjectSuggestion =
|
|
1788
|
-
rootPath:
|
|
1789
|
-
sessionCount:
|
|
1790
|
-
lastActivityAt:
|
|
1791
|
-
});
|
|
1792
|
-
var ProjectSuggestions =
|
|
1793
|
-
var DiffFile =
|
|
1794
|
-
path:
|
|
1795
|
-
oldPath:
|
|
1796
|
-
added:
|
|
1797
|
-
deleted:
|
|
1798
|
-
status:
|
|
1799
|
-
});
|
|
1800
|
-
var DiffResult =
|
|
1801
|
-
base:
|
|
1802
|
-
files:
|
|
1803
|
-
patch:
|
|
1804
|
-
});
|
|
1805
|
-
var FileEntry =
|
|
1806
|
-
name:
|
|
1807
|
-
path:
|
|
1808
|
-
kind:
|
|
1809
|
-
size:
|
|
1810
|
-
});
|
|
1811
|
-
var ReconcileResult =
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
known:
|
|
1815
|
-
sessionId:
|
|
1816
|
-
state:
|
|
2202
|
+
folder: z12.string(),
|
|
2203
|
+
repositories: z12.array(ScannedRepository)
|
|
2204
|
+
});
|
|
2205
|
+
var ProjectSuggestion = z12.object({
|
|
2206
|
+
rootPath: z12.string(),
|
|
2207
|
+
sessionCount: z12.number().int(),
|
|
2208
|
+
lastActivityAt: z12.string()
|
|
2209
|
+
});
|
|
2210
|
+
var ProjectSuggestions = z12.object({ suggestions: z12.array(ProjectSuggestion) });
|
|
2211
|
+
var DiffFile = z12.object({
|
|
2212
|
+
path: z12.string(),
|
|
2213
|
+
oldPath: z12.string().nullable(),
|
|
2214
|
+
added: z12.number().int(),
|
|
2215
|
+
deleted: z12.number().int(),
|
|
2216
|
+
status: z12.enum(["added", "modified", "deleted", "renamed", "untracked", "binary"])
|
|
2217
|
+
});
|
|
2218
|
+
var DiffResult = z12.object({
|
|
2219
|
+
base: z12.string(),
|
|
2220
|
+
files: z12.array(DiffFile),
|
|
2221
|
+
patch: z12.string().nullable()
|
|
2222
|
+
});
|
|
2223
|
+
var FileEntry = z12.object({
|
|
2224
|
+
name: z12.string(),
|
|
2225
|
+
path: z12.string(),
|
|
2226
|
+
kind: z12.enum(["file", "dir", "symlink"]),
|
|
2227
|
+
size: z12.number().int().nullable()
|
|
2228
|
+
});
|
|
2229
|
+
var ReconcileResult = z12.union([
|
|
2230
|
+
z12.object({ known: z12.literal(false) }),
|
|
2231
|
+
z12.object({
|
|
2232
|
+
known: z12.literal(true),
|
|
2233
|
+
sessionId: z12.string().nullable(),
|
|
2234
|
+
state: z12.enum(["accepted", "workspace_ready", "started", "failed"]),
|
|
1817
2235
|
runtime: RuntimeState.nullable(),
|
|
1818
|
-
workspacePath:
|
|
2236
|
+
workspacePath: z12.string().nullable(),
|
|
1819
2237
|
nativeHandle: NativeHandle.nullable(),
|
|
1820
|
-
error:
|
|
2238
|
+
error: z12.string().nullable(),
|
|
1821
2239
|
/** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
|
|
1822
|
-
errorDetails:
|
|
2240
|
+
errorDetails: z12.record(z12.string(), z12.unknown()).nullable().default(null)
|
|
1823
2241
|
})
|
|
1824
2242
|
]);
|
|
1825
|
-
var DispatchStartResult =
|
|
1826
|
-
sessionId:
|
|
1827
|
-
workspacePath:
|
|
2243
|
+
var DispatchStartResult = z12.object({
|
|
2244
|
+
sessionId: z12.string(),
|
|
2245
|
+
workspacePath: z12.string(),
|
|
1828
2246
|
nativeHandle: NativeHandle.nullable(),
|
|
1829
|
-
reused:
|
|
2247
|
+
reused: z12.boolean(),
|
|
1830
2248
|
/** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
|
|
1831
|
-
promptError:
|
|
2249
|
+
promptError: z12.string().nullable().optional()
|
|
1832
2250
|
});
|
|
1833
|
-
var AnswerResult =
|
|
1834
|
-
status:
|
|
2251
|
+
var AnswerResult = z12.object({
|
|
2252
|
+
status: z12.enum(["answered", "already_answered"]),
|
|
1835
2253
|
interaction: Interaction
|
|
1836
2254
|
});
|
|
1837
|
-
var SnapshotResult =
|
|
1838
|
-
partial:
|
|
1839
|
-
pendingInteractions:
|
|
2255
|
+
var SnapshotResult = z12.object({
|
|
2256
|
+
partial: z12.array(TranscriptItem),
|
|
2257
|
+
pendingInteractions: z12.array(Interaction)
|
|
1840
2258
|
});
|
|
1841
|
-
var ChecksResult =
|
|
1842
|
-
var Receipt =
|
|
1843
|
-
|
|
1844
|
-
|
|
2259
|
+
var ChecksResult = z12.object({ results: z12.array(CheckResult) });
|
|
2260
|
+
var Receipt = z12.union([
|
|
2261
|
+
z12.object({ commandId: z12.string(), ok: z12.literal(true), result: z12.unknown() }),
|
|
2262
|
+
z12.object({ commandId: z12.string(), ok: z12.literal(false), error: ErrorBody })
|
|
1845
2263
|
]);
|
|
1846
2264
|
var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
1847
2265
|
policyContext: HostToolPolicyContext.optional()
|
|
@@ -1860,278 +2278,279 @@ var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
|
1860
2278
|
}
|
|
1861
2279
|
ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
|
|
1862
2280
|
});
|
|
1863
|
-
var HostToCoordinator =
|
|
1864
|
-
|
|
1865
|
-
type:
|
|
1866
|
-
hostId:
|
|
1867
|
-
credential:
|
|
1868
|
-
name:
|
|
1869
|
-
agentVersion:
|
|
1870
|
-
piVersion:
|
|
1871
|
-
piCompatible:
|
|
2281
|
+
var HostToCoordinator = z12.discriminatedUnion("type", [
|
|
2282
|
+
z12.object({
|
|
2283
|
+
type: z12.literal("hello"),
|
|
2284
|
+
hostId: z12.string(),
|
|
2285
|
+
credential: z12.string(),
|
|
2286
|
+
name: z12.string(),
|
|
2287
|
+
agentVersion: z12.string(),
|
|
2288
|
+
piVersion: z12.string().nullable(),
|
|
2289
|
+
piCompatible: z12.boolean(),
|
|
1872
2290
|
platform: Platform,
|
|
1873
2291
|
capabilities: RuntimeCapabilities.nullable(),
|
|
1874
2292
|
github: HostGitHub.optional(),
|
|
1875
|
-
protocolVersion:
|
|
1876
|
-
features:
|
|
2293
|
+
protocolVersion: z12.number().int(),
|
|
2294
|
+
features: z12.array(z12.string()).optional()
|
|
1877
2295
|
}),
|
|
1878
2296
|
HostAgentRequestFrame,
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2297
|
+
z12.object({ type: z12.literal("event"), hostSeq: z12.number().int(), event: HostEvent }),
|
|
2298
|
+
z12.object({ type: z12.literal("stream"), delta: StreamDelta }),
|
|
2299
|
+
z12.object({ type: z12.literal("receipt"), receipt: Receipt }),
|
|
2300
|
+
z12.object({ type: z12.literal("pong") }),
|
|
2301
|
+
z12.object({ type: z12.literal("usage"), usage: z12.array(ProviderUsage) }),
|
|
2302
|
+
z12.object({ type: z12.literal("term"), streamId: z12.string(), msg: TermServerToViewer })
|
|
1885
2303
|
]);
|
|
1886
|
-
var CoordinatorToHost =
|
|
1887
|
-
|
|
1888
|
-
type:
|
|
1889
|
-
coordinatorVersion:
|
|
1890
|
-
ackedHostSeq:
|
|
1891
|
-
features:
|
|
2304
|
+
var CoordinatorToHost = z12.discriminatedUnion("type", [
|
|
2305
|
+
z12.object({
|
|
2306
|
+
type: z12.literal("welcome"),
|
|
2307
|
+
coordinatorVersion: z12.string(),
|
|
2308
|
+
ackedHostSeq: z12.number().int(),
|
|
2309
|
+
features: z12.array(z12.string()).optional()
|
|
1892
2310
|
}),
|
|
1893
2311
|
AgentResultFrame,
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
2312
|
+
z12.object({ type: z12.literal("ack"), hostSeq: z12.number().int() }),
|
|
2313
|
+
z12.object({ type: z12.literal("command"), commandId: z12.string(), command: HostCommand }),
|
|
2314
|
+
z12.object({ type: z12.literal("ping") }),
|
|
2315
|
+
z12.object({ type: z12.literal("reject"), error: ErrorBody }),
|
|
2316
|
+
z12.object({ type: z12.literal("term"), streamId: z12.string(), msg: TermCoordinatorMsg })
|
|
1899
2317
|
]);
|
|
1900
2318
|
|
|
1901
2319
|
// packages/protocol/dist/api.js
|
|
1902
|
-
var EnrollRequest =
|
|
1903
|
-
token:
|
|
1904
|
-
name:
|
|
2320
|
+
var EnrollRequest = z13.object({
|
|
2321
|
+
token: z13.string().min(1),
|
|
2322
|
+
name: z13.string().min(1).max(80),
|
|
1905
2323
|
kind: DeviceKind
|
|
1906
2324
|
});
|
|
1907
|
-
var EnrollResponse =
|
|
1908
|
-
var CreateEnrollmentRequest =
|
|
1909
|
-
var CreateEnrollmentResponse =
|
|
1910
|
-
token:
|
|
1911
|
-
url:
|
|
1912
|
-
expiresAt:
|
|
1913
|
-
qrSvg:
|
|
1914
|
-
command:
|
|
1915
|
-
});
|
|
1916
|
-
var HostEnrollRequest =
|
|
1917
|
-
|
|
1918
|
-
token:
|
|
1919
|
-
name:
|
|
2325
|
+
var EnrollResponse = z13.object({ deviceId: z13.string(), credential: z13.string() });
|
|
2326
|
+
var CreateEnrollmentRequest = z13.object({ kind: z13.enum(["device", "host"]) });
|
|
2327
|
+
var CreateEnrollmentResponse = z13.object({
|
|
2328
|
+
token: z13.string(),
|
|
2329
|
+
url: z13.string(),
|
|
2330
|
+
expiresAt: z13.string(),
|
|
2331
|
+
qrSvg: z13.string(),
|
|
2332
|
+
command: z13.string().nullable()
|
|
2333
|
+
});
|
|
2334
|
+
var HostEnrollRequest = z13.union([
|
|
2335
|
+
z13.object({
|
|
2336
|
+
token: z13.string().min(1),
|
|
2337
|
+
name: z13.string().min(1).max(80),
|
|
1920
2338
|
platform: Platform
|
|
1921
2339
|
}),
|
|
1922
|
-
|
|
1923
|
-
secret:
|
|
1924
|
-
name:
|
|
2340
|
+
z13.object({
|
|
2341
|
+
secret: z13.string().min(1),
|
|
2342
|
+
name: z13.string().min(1).max(80),
|
|
1925
2343
|
platform: Platform
|
|
1926
2344
|
})
|
|
1927
2345
|
]);
|
|
1928
|
-
var HostEnrollResponse =
|
|
1929
|
-
var CreateProjectRequest =
|
|
1930
|
-
name:
|
|
1931
|
-
hostId:
|
|
1932
|
-
path:
|
|
1933
|
-
defaultProfileId:
|
|
1934
|
-
setupCommand:
|
|
1935
|
-
checks:
|
|
1936
|
-
maxConcurrentRuns:
|
|
2346
|
+
var HostEnrollResponse = z13.object({ hostId: z13.string(), credential: z13.string() });
|
|
2347
|
+
var CreateProjectRequest = z13.object({
|
|
2348
|
+
name: z13.string().min(1),
|
|
2349
|
+
hostId: z13.string(),
|
|
2350
|
+
path: z13.string().min(1),
|
|
2351
|
+
defaultProfileId: z13.string().nullable().optional(),
|
|
2352
|
+
setupCommand: z13.string().nullable().optional(),
|
|
2353
|
+
checks: z13.array(z13.string()).optional(),
|
|
2354
|
+
maxConcurrentRuns: z13.number().int().min(1).max(32).optional(),
|
|
1937
2355
|
worktreeDir: WorktreeDir.optional()
|
|
1938
2356
|
});
|
|
1939
|
-
var UpdateProjectRequest =
|
|
1940
|
-
name:
|
|
1941
|
-
defaultProfileId:
|
|
1942
|
-
defaultHostId:
|
|
1943
|
-
maxConcurrentRuns:
|
|
1944
|
-
automationEnabled:
|
|
1945
|
-
setupCommand:
|
|
1946
|
-
checks:
|
|
1947
|
-
workspaceSharing:
|
|
2357
|
+
var UpdateProjectRequest = z13.object({
|
|
2358
|
+
name: z13.string().min(1).optional(),
|
|
2359
|
+
defaultProfileId: z13.string().nullable().optional(),
|
|
2360
|
+
defaultHostId: z13.string().nullable().optional(),
|
|
2361
|
+
maxConcurrentRuns: z13.number().int().min(1).max(32).optional(),
|
|
2362
|
+
automationEnabled: z13.boolean().optional(),
|
|
2363
|
+
setupCommand: z13.string().nullable().optional(),
|
|
2364
|
+
checks: z13.array(z13.string()).optional(),
|
|
2365
|
+
workspaceSharing: z13.enum(["single_writer", "shared"]).optional(),
|
|
1948
2366
|
worktreeDir: WorktreeDir.optional()
|
|
1949
2367
|
});
|
|
1950
|
-
var AddCheckoutRequest =
|
|
2368
|
+
var AddCheckoutRequest = z13.object({ hostId: z13.string(), path: z13.string().min(1) });
|
|
1951
2369
|
function isProjectFolderPath(s) {
|
|
1952
2370
|
if (s.includes("\0"))
|
|
1953
2371
|
return false;
|
|
1954
2372
|
return s === "~" || s.startsWith("~/") || s.startsWith("/");
|
|
1955
2373
|
}
|
|
1956
|
-
var ProjectFolder =
|
|
1957
|
-
var UpdateHostRequest =
|
|
1958
|
-
projectFolders:
|
|
2374
|
+
var ProjectFolder = z13.string().trim().min(1).max(1024).refine(isProjectFolderPath, "must be an absolute path or start with ~/");
|
|
2375
|
+
var UpdateHostRequest = z13.object({
|
|
2376
|
+
projectFolders: z13.array(ProjectFolder).max(20).optional()
|
|
1959
2377
|
});
|
|
1960
2378
|
var ProjectScanResult = ProjectScan.extend({
|
|
1961
|
-
added:
|
|
1962
|
-
projectId:
|
|
1963
|
-
name:
|
|
1964
|
-
path:
|
|
1965
|
-
newProject:
|
|
2379
|
+
added: z13.array(z13.object({
|
|
2380
|
+
projectId: z13.string(),
|
|
2381
|
+
name: z13.string(),
|
|
2382
|
+
path: z13.string(),
|
|
2383
|
+
newProject: z13.boolean()
|
|
1966
2384
|
}))
|
|
1967
2385
|
});
|
|
1968
|
-
var ProfileInput =
|
|
1969
|
-
name:
|
|
1970
|
-
provider:
|
|
1971
|
-
model:
|
|
2386
|
+
var ProfileInput = z13.object({
|
|
2387
|
+
name: z13.string().min(1),
|
|
2388
|
+
provider: z13.string().nullable().default(null),
|
|
2389
|
+
model: z13.string().nullable().default(null),
|
|
1972
2390
|
thinking: ThinkingLevel.nullable().default(null),
|
|
1973
|
-
projectTrust:
|
|
1974
|
-
extraArgs:
|
|
1975
|
-
resources:
|
|
1976
|
-
});
|
|
1977
|
-
var CreateWorkspaceRequest =
|
|
1978
|
-
checkoutId:
|
|
1979
|
-
branch:
|
|
1980
|
-
base:
|
|
1981
|
-
});
|
|
1982
|
-
var RemoveWorkspaceRequest =
|
|
1983
|
-
force:
|
|
1984
|
-
});
|
|
1985
|
-
var CreateSessionRequest =
|
|
1986
|
-
projectId:
|
|
1987
|
-
workspace:
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
checkoutId:
|
|
1991
|
-
newBranch:
|
|
1992
|
-
base:
|
|
2391
|
+
projectTrust: z13.enum(["ask", "approve", "ignore"]).default("ask"),
|
|
2392
|
+
extraArgs: z13.array(ExtraArg).default([]),
|
|
2393
|
+
resources: z13.enum(["all", "vanilla"]).default("all")
|
|
2394
|
+
});
|
|
2395
|
+
var CreateWorkspaceRequest = z13.object({
|
|
2396
|
+
checkoutId: z13.string(),
|
|
2397
|
+
branch: z13.string().min(1),
|
|
2398
|
+
base: z13.string().nullable().optional()
|
|
2399
|
+
});
|
|
2400
|
+
var RemoveWorkspaceRequest = z13.object({
|
|
2401
|
+
force: z13.object({ dirty: z13.boolean(), unmerged: z13.boolean() }).default({ dirty: false, unmerged: false })
|
|
2402
|
+
});
|
|
2403
|
+
var CreateSessionRequest = z13.object({
|
|
2404
|
+
projectId: z13.string(),
|
|
2405
|
+
workspace: z13.union([
|
|
2406
|
+
z13.object({ existingId: z13.string() }),
|
|
2407
|
+
z13.object({
|
|
2408
|
+
checkoutId: z13.string(),
|
|
2409
|
+
newBranch: z13.string().min(1),
|
|
2410
|
+
base: z13.string().nullable().optional()
|
|
1993
2411
|
})
|
|
1994
2412
|
]),
|
|
1995
|
-
profileId:
|
|
1996
|
-
prompt:
|
|
1997
|
-
title:
|
|
1998
|
-
viewId:
|
|
1999
|
-
});
|
|
2000
|
-
var PromptRequest =
|
|
2001
|
-
text:
|
|
2002
|
-
mode:
|
|
2003
|
-
images:
|
|
2004
|
-
clientMessageId:
|
|
2005
|
-
});
|
|
2006
|
-
var CacheAlertRequest =
|
|
2007
|
-
enabled:
|
|
2008
|
-
ttlSec:
|
|
2009
|
-
});
|
|
2010
|
-
var RenameRequest =
|
|
2011
|
-
var SetModelRequest =
|
|
2012
|
-
provider:
|
|
2013
|
-
modelId:
|
|
2014
|
-
});
|
|
2015
|
-
var SetThinkingRequest =
|
|
2016
|
-
var CompactRequest =
|
|
2017
|
-
var SessionModelsResult =
|
|
2018
|
-
var SessionCommandsResult =
|
|
2019
|
-
var CompleteRequest =
|
|
2020
|
-
var CompletionItem =
|
|
2021
|
-
value:
|
|
2022
|
-
label:
|
|
2023
|
-
description:
|
|
2024
|
-
});
|
|
2025
|
-
var SessionCompleteResult =
|
|
2026
|
-
items:
|
|
2027
|
-
prefix:
|
|
2028
|
-
});
|
|
2029
|
-
var TreeRow =
|
|
2030
|
-
entryId:
|
|
2031
|
-
parentId:
|
|
2032
|
-
depth:
|
|
2033
|
-
role:
|
|
2034
|
-
text:
|
|
2035
|
-
activeBranch:
|
|
2036
|
-
leaf:
|
|
2037
|
-
label:
|
|
2038
|
-
at:
|
|
2039
|
-
});
|
|
2040
|
-
var SessionTreeResult =
|
|
2041
|
-
var BranchRequest =
|
|
2042
|
-
entryId:
|
|
2043
|
-
fork:
|
|
2044
|
-
});
|
|
2045
|
-
var HostBranchResult =
|
|
2046
|
-
sessionFile:
|
|
2047
|
-
prefill:
|
|
2048
|
-
});
|
|
2049
|
-
var TranscriptPage =
|
|
2050
|
-
items:
|
|
2051
|
-
hasMore:
|
|
2052
|
-
epoch:
|
|
2053
|
-
rev:
|
|
2054
|
-
delta:
|
|
2055
|
-
reset:
|
|
2056
|
-
});
|
|
2057
|
-
var NavigateRequest =
|
|
2058
|
-
entryId:
|
|
2059
|
-
summarize:
|
|
2060
|
-
instructions:
|
|
2061
|
-
});
|
|
2062
|
-
var HostNavigateResult =
|
|
2063
|
-
items:
|
|
2064
|
-
prefill:
|
|
2065
|
-
});
|
|
2066
|
-
var NavigateResult =
|
|
2067
|
-
prefill:
|
|
2068
|
-
epoch:
|
|
2069
|
-
});
|
|
2070
|
-
var BranchResult =
|
|
2413
|
+
profileId: z13.string().nullable().optional(),
|
|
2414
|
+
prompt: z13.string().default(""),
|
|
2415
|
+
title: z13.string().optional(),
|
|
2416
|
+
viewId: z13.string().optional()
|
|
2417
|
+
});
|
|
2418
|
+
var PromptRequest = z13.object({
|
|
2419
|
+
text: z13.string().min(1),
|
|
2420
|
+
mode: z13.enum(["prompt", "steer", "followUp"]).default("prompt"),
|
|
2421
|
+
images: z13.array(z13.object({ mimeType: z13.string(), data: z13.string() })).default([]),
|
|
2422
|
+
clientMessageId: z13.string().optional()
|
|
2423
|
+
});
|
|
2424
|
+
var CacheAlertRequest = z13.object({
|
|
2425
|
+
enabled: z13.boolean(),
|
|
2426
|
+
ttlSec: z13.number().int().min(60).max(86400).nullable().default(null)
|
|
2427
|
+
});
|
|
2428
|
+
var RenameRequest = z13.object({ title: z13.string().min(1).max(200) });
|
|
2429
|
+
var SetModelRequest = z13.object({
|
|
2430
|
+
provider: z13.string().min(1),
|
|
2431
|
+
modelId: z13.string().min(1)
|
|
2432
|
+
});
|
|
2433
|
+
var SetThinkingRequest = z13.object({ level: ThinkingLevel });
|
|
2434
|
+
var CompactRequest = z13.object({ instructions: z13.string().max(4e3).optional() });
|
|
2435
|
+
var SessionModelsResult = z13.object({ models: z13.array(SessionModel) });
|
|
2436
|
+
var SessionCommandsResult = z13.object({ commands: z13.array(SlashCommand) });
|
|
2437
|
+
var CompleteRequest = z13.object({ text: z13.string().min(1).max(500) });
|
|
2438
|
+
var CompletionItem = z13.object({
|
|
2439
|
+
value: z13.string(),
|
|
2440
|
+
label: z13.string(),
|
|
2441
|
+
description: z13.string().nullable()
|
|
2442
|
+
});
|
|
2443
|
+
var SessionCompleteResult = z13.object({
|
|
2444
|
+
items: z13.array(CompletionItem).max(50),
|
|
2445
|
+
prefix: z13.string()
|
|
2446
|
+
});
|
|
2447
|
+
var TreeRow = z13.object({
|
|
2448
|
+
entryId: z13.string(),
|
|
2449
|
+
parentId: z13.string().nullable(),
|
|
2450
|
+
depth: z13.number().int(),
|
|
2451
|
+
role: z13.enum(["user", "assistant"]),
|
|
2452
|
+
text: z13.string(),
|
|
2453
|
+
activeBranch: z13.boolean(),
|
|
2454
|
+
leaf: z13.boolean(),
|
|
2455
|
+
label: z13.string().nullable(),
|
|
2456
|
+
at: z13.string().nullable()
|
|
2457
|
+
});
|
|
2458
|
+
var SessionTreeResult = z13.object({ rows: z13.array(TreeRow) });
|
|
2459
|
+
var BranchRequest = z13.object({
|
|
2460
|
+
entryId: z13.string().nullable(),
|
|
2461
|
+
fork: z13.boolean().default(false)
|
|
2462
|
+
});
|
|
2463
|
+
var HostBranchResult = z13.object({
|
|
2464
|
+
sessionFile: z13.string().nullable(),
|
|
2465
|
+
prefill: z13.string().nullable()
|
|
2466
|
+
});
|
|
2467
|
+
var TranscriptPage = z13.object({
|
|
2468
|
+
items: z13.array(TranscriptItem),
|
|
2469
|
+
hasMore: z13.boolean(),
|
|
2470
|
+
epoch: z13.number().int().optional(),
|
|
2471
|
+
rev: z13.number().int().optional(),
|
|
2472
|
+
delta: z13.boolean().optional(),
|
|
2473
|
+
reset: z13.boolean().optional()
|
|
2474
|
+
});
|
|
2475
|
+
var NavigateRequest = z13.object({
|
|
2476
|
+
entryId: z13.string().min(1),
|
|
2477
|
+
summarize: z13.boolean().default(false),
|
|
2478
|
+
instructions: z13.string().max(2e3).nullable().default(null)
|
|
2479
|
+
});
|
|
2480
|
+
var HostNavigateResult = z13.object({
|
|
2481
|
+
items: z13.array(TranscriptItem),
|
|
2482
|
+
prefill: z13.string().nullable()
|
|
2483
|
+
});
|
|
2484
|
+
var NavigateResult = z13.object({
|
|
2485
|
+
prefill: z13.string().nullable(),
|
|
2486
|
+
epoch: z13.number().int()
|
|
2487
|
+
});
|
|
2488
|
+
var BranchResult = z13.object({
|
|
2071
2489
|
session: Session.nullable(),
|
|
2072
|
-
prefill:
|
|
2490
|
+
prefill: z13.string().nullable()
|
|
2073
2491
|
});
|
|
2074
|
-
var SessionExportResult =
|
|
2075
|
-
var CommandViewAction =
|
|
2076
|
-
label:
|
|
2077
|
-
command:
|
|
2078
|
-
tone:
|
|
2492
|
+
var SessionExportResult = z13.object({ fileName: z13.string(), content: z13.string() });
|
|
2493
|
+
var CommandViewAction = z13.object({
|
|
2494
|
+
label: z13.string().min(1).max(80),
|
|
2495
|
+
command: z13.string().startsWith("/").max(500),
|
|
2496
|
+
tone: z13.enum(["default", "primary", "danger"]).optional()
|
|
2079
2497
|
});
|
|
2080
|
-
var CommandView =
|
|
2081
|
-
title:
|
|
2498
|
+
var CommandView = z13.object({
|
|
2499
|
+
title: z13.string().min(1).max(200),
|
|
2082
2500
|
body: UINodeSchema,
|
|
2083
|
-
actions:
|
|
2501
|
+
actions: z13.array(CommandViewAction).max(30).default([])
|
|
2084
2502
|
});
|
|
2085
|
-
var ModelStateResult =
|
|
2503
|
+
var ModelStateResult = z13.object({
|
|
2086
2504
|
model: SessionModel.nullable(),
|
|
2087
2505
|
thinking: ThinkingLevel.nullable()
|
|
2088
2506
|
});
|
|
2089
|
-
var ImportSessionRequest =
|
|
2090
|
-
hostId:
|
|
2091
|
-
sessionFile:
|
|
2092
|
-
projectId:
|
|
2507
|
+
var ImportSessionRequest = z13.object({
|
|
2508
|
+
hostId: z13.string(),
|
|
2509
|
+
sessionFile: z13.string(),
|
|
2510
|
+
projectId: z13.string().nullable().optional()
|
|
2093
2511
|
});
|
|
2094
|
-
var AnswerRequest =
|
|
2095
|
-
revision:
|
|
2512
|
+
var AnswerRequest = z13.object({
|
|
2513
|
+
revision: z13.number().int(),
|
|
2096
2514
|
response: InteractionResponseSchema
|
|
2097
2515
|
});
|
|
2098
|
-
var AdapterActionRequest =
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2516
|
+
var AdapterActionRequest = z13.object({
|
|
2517
|
+
generation: z13.string().uuid().optional(),
|
|
2518
|
+
adapterId: z13.string(),
|
|
2519
|
+
actionId: z13.string(),
|
|
2520
|
+
payload: z13.unknown().optional()
|
|
2521
|
+
});
|
|
2522
|
+
var TaskPolicyPatch = z13.object({
|
|
2523
|
+
hostId: z13.string().nullable().optional(),
|
|
2524
|
+
profileId: z13.string().nullable().optional(),
|
|
2525
|
+
workspace: z13.object({
|
|
2526
|
+
mode: z13.enum(["new_worktree", "existing"]).optional(),
|
|
2527
|
+
branch: z13.string().nullable().optional(),
|
|
2528
|
+
base: z13.string().nullable().optional(),
|
|
2529
|
+
workspaceId: z13.string().optional()
|
|
2111
2530
|
}).optional(),
|
|
2112
|
-
continuation:
|
|
2113
|
-
enabled:
|
|
2114
|
-
objective:
|
|
2115
|
-
maxContinuations:
|
|
2116
|
-
maxElapsedMinutes:
|
|
2117
|
-
maxTokens:
|
|
2118
|
-
maxCostUsd:
|
|
2531
|
+
continuation: z13.object({
|
|
2532
|
+
enabled: z13.boolean().optional(),
|
|
2533
|
+
objective: z13.string().min(1).optional(),
|
|
2534
|
+
maxContinuations: z13.number().int().min(1).max(50).optional(),
|
|
2535
|
+
maxElapsedMinutes: z13.number().int().min(1).max(1440).optional(),
|
|
2536
|
+
maxTokens: z13.number().int().positive().nullable().optional(),
|
|
2537
|
+
maxCostUsd: z13.number().positive().nullable().optional()
|
|
2119
2538
|
}).optional(),
|
|
2120
2539
|
completion: CompletionPolicy.partial().optional()
|
|
2121
2540
|
});
|
|
2122
|
-
var CreateTaskRequest =
|
|
2123
|
-
projectId:
|
|
2124
|
-
title:
|
|
2541
|
+
var CreateTaskRequest = z13.object({
|
|
2542
|
+
projectId: z13.string(),
|
|
2543
|
+
title: z13.string().max(300).optional(),
|
|
2125
2544
|
githubIssueUrl: GitHubIssueUrl.optional(),
|
|
2126
|
-
githubIssue:
|
|
2127
|
-
launchPrompt:
|
|
2128
|
-
objective:
|
|
2129
|
-
acceptanceCriteria:
|
|
2130
|
-
dependencies:
|
|
2131
|
-
parentTaskId:
|
|
2545
|
+
githubIssue: z13.never().optional(),
|
|
2546
|
+
launchPrompt: z13.never().optional(),
|
|
2547
|
+
objective: z13.string().default(""),
|
|
2548
|
+
acceptanceCriteria: z13.array(z13.string()).default([]),
|
|
2549
|
+
dependencies: z13.array(z13.string()).default([]),
|
|
2550
|
+
parentTaskId: z13.string().nullable().optional(),
|
|
2132
2551
|
priority: Priority.default(2),
|
|
2133
|
-
state:
|
|
2134
|
-
notBefore:
|
|
2552
|
+
state: z13.enum(["backlog", "ready"]).default("backlog"),
|
|
2553
|
+
notBefore: z13.string().nullable().optional(),
|
|
2135
2554
|
policy: TaskPolicyPatch.optional()
|
|
2136
2555
|
}).superRefine((v, ctx) => {
|
|
2137
2556
|
if (v.githubIssueUrl === void 0) {
|
|
@@ -2169,32 +2588,32 @@ var CreateTaskRequest = z10.object({
|
|
|
2169
2588
|
const issue = githubIssueFromUrl(v.githubIssueUrl);
|
|
2170
2589
|
return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
|
|
2171
2590
|
});
|
|
2172
|
-
var UpdateTaskRequest =
|
|
2173
|
-
githubIssueUrl:
|
|
2174
|
-
githubIssue:
|
|
2175
|
-
launchPrompt:
|
|
2176
|
-
title:
|
|
2177
|
-
objective:
|
|
2178
|
-
acceptanceCriteria:
|
|
2179
|
-
dependencies:
|
|
2180
|
-
parentTaskId:
|
|
2591
|
+
var UpdateTaskRequest = z13.object({
|
|
2592
|
+
githubIssueUrl: z13.never().optional(),
|
|
2593
|
+
githubIssue: z13.never().optional(),
|
|
2594
|
+
launchPrompt: z13.never().optional(),
|
|
2595
|
+
title: z13.string().min(1).max(300).optional(),
|
|
2596
|
+
objective: z13.string().optional(),
|
|
2597
|
+
acceptanceCriteria: z13.array(z13.string()).optional(),
|
|
2598
|
+
dependencies: z13.array(z13.string()).optional(),
|
|
2599
|
+
parentTaskId: z13.string().nullable().optional(),
|
|
2181
2600
|
priority: Priority.optional(),
|
|
2182
|
-
position:
|
|
2183
|
-
notBefore:
|
|
2601
|
+
position: z13.number().optional(),
|
|
2602
|
+
notBefore: z13.string().nullable().optional(),
|
|
2184
2603
|
policy: TaskPolicyPatch.optional()
|
|
2185
2604
|
});
|
|
2186
|
-
var MoveTaskRequest =
|
|
2605
|
+
var MoveTaskRequest = z13.object({
|
|
2187
2606
|
to: TaskState,
|
|
2188
|
-
confirm:
|
|
2189
|
-
onRunning:
|
|
2190
|
-
position:
|
|
2191
|
-
});
|
|
2192
|
-
var RequestChangesRequest =
|
|
2193
|
-
var Eligibility =
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
eligible:
|
|
2197
|
-
wait:
|
|
2607
|
+
confirm: z13.boolean().optional(),
|
|
2608
|
+
onRunning: z13.enum(["pause", "stop"]).optional(),
|
|
2609
|
+
position: z13.number().optional()
|
|
2610
|
+
});
|
|
2611
|
+
var RequestChangesRequest = z13.object({ feedback: z13.array(z13.string().min(1)).min(1) });
|
|
2612
|
+
var Eligibility = z13.union([
|
|
2613
|
+
z13.object({ eligible: z13.literal(true), hostId: z13.string(), hostName: z13.string() }),
|
|
2614
|
+
z13.object({
|
|
2615
|
+
eligible: z13.literal(false),
|
|
2616
|
+
wait: z13.enum([
|
|
2198
2617
|
"dependency",
|
|
2199
2618
|
"host_offline",
|
|
2200
2619
|
"project_limit",
|
|
@@ -2207,145 +2626,145 @@ var Eligibility = z10.union([
|
|
|
2207
2626
|
"already_dispatched",
|
|
2208
2627
|
"retry_backoff"
|
|
2209
2628
|
]),
|
|
2210
|
-
message:
|
|
2629
|
+
message: z13.string()
|
|
2211
2630
|
})
|
|
2212
2631
|
]);
|
|
2213
|
-
var NowResponse =
|
|
2214
|
-
running:
|
|
2215
|
-
queued:
|
|
2216
|
-
dispatchPaused:
|
|
2217
|
-
});
|
|
2218
|
-
var AutomationInput =
|
|
2219
|
-
name:
|
|
2220
|
-
enabled:
|
|
2221
|
-
projectId:
|
|
2632
|
+
var NowResponse = z13.object({
|
|
2633
|
+
running: z13.array(z13.object({ taskId: z13.string(), runId: z13.string(), sessionId: z13.string().nullable() })),
|
|
2634
|
+
queued: z13.array(z13.object({ taskId: z13.string(), eligibility: Eligibility })),
|
|
2635
|
+
dispatchPaused: z13.boolean()
|
|
2636
|
+
});
|
|
2637
|
+
var AutomationInput = z13.object({
|
|
2638
|
+
name: z13.string().min(1),
|
|
2639
|
+
enabled: z13.boolean().default(true),
|
|
2640
|
+
projectId: z13.string(),
|
|
2222
2641
|
trigger: Trigger,
|
|
2223
|
-
filters:
|
|
2642
|
+
filters: z13.array(z13.object({ path: z13.string(), equals: z13.string() })).default([]),
|
|
2224
2643
|
template: TaskTemplate,
|
|
2225
|
-
hostId:
|
|
2226
|
-
profileId:
|
|
2227
|
-
mode:
|
|
2228
|
-
groupingKey:
|
|
2229
|
-
overlap:
|
|
2230
|
-
missed:
|
|
2644
|
+
hostId: z13.string().nullable().default(null),
|
|
2645
|
+
profileId: z13.string().nullable().default(null),
|
|
2646
|
+
mode: z13.enum(["fresh", "continue", "watch"]).default("fresh"),
|
|
2647
|
+
groupingKey: z13.string().nullable().default(null),
|
|
2648
|
+
overlap: z13.enum(["skip", "queue_one", "append"]).default("skip"),
|
|
2649
|
+
missed: z13.enum(["skip", "run_once"]).default("skip"),
|
|
2231
2650
|
continuation: ContinuationPolicy.default({ enabled: false }),
|
|
2232
2651
|
completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
|
|
2233
2652
|
});
|
|
2234
|
-
var AutomationView = Automation.extend({ summary:
|
|
2235
|
-
var AutomationPreview =
|
|
2236
|
-
summary:
|
|
2653
|
+
var AutomationView = Automation.extend({ summary: z13.string() });
|
|
2654
|
+
var AutomationPreview = z13.object({
|
|
2655
|
+
summary: z13.string(),
|
|
2237
2656
|
task: TaskTemplate,
|
|
2238
|
-
next:
|
|
2239
|
-
});
|
|
2240
|
-
var WebhookTokenResponse =
|
|
2241
|
-
var PushSubscriptionRequest =
|
|
2242
|
-
endpoint:
|
|
2243
|
-
keys:
|
|
2244
|
-
permission:
|
|
2245
|
-
});
|
|
2246
|
-
var NotificationSettings =
|
|
2247
|
-
quietHours:
|
|
2248
|
-
start:
|
|
2249
|
-
end:
|
|
2250
|
-
timezone:
|
|
2657
|
+
next: z13.array(z13.string())
|
|
2658
|
+
});
|
|
2659
|
+
var WebhookTokenResponse = z13.object({ token: z13.string(), url: z13.string() });
|
|
2660
|
+
var PushSubscriptionRequest = z13.object({
|
|
2661
|
+
endpoint: z13.string().url(),
|
|
2662
|
+
keys: z13.object({ p256dh: z13.string(), auth: z13.string() }),
|
|
2663
|
+
permission: z13.enum(["granted", "denied", "default", "unknown"]).default("granted")
|
|
2664
|
+
});
|
|
2665
|
+
var NotificationSettings = z13.object({
|
|
2666
|
+
quietHours: z13.object({
|
|
2667
|
+
start: z13.string().regex(/^\d{2}:\d{2}$/),
|
|
2668
|
+
end: z13.string().regex(/^\d{2}:\d{2}$/),
|
|
2669
|
+
timezone: z13.string()
|
|
2251
2670
|
}).nullable(),
|
|
2252
|
-
privatePreviews:
|
|
2253
|
-
preferredDeviceId:
|
|
2254
|
-
});
|
|
2255
|
-
var PushPayload =
|
|
2256
|
-
|
|
2257
|
-
type:
|
|
2258
|
-
title:
|
|
2259
|
-
body:
|
|
2260
|
-
tag:
|
|
2261
|
-
url:
|
|
2262
|
-
renotify:
|
|
2671
|
+
privatePreviews: z13.boolean(),
|
|
2672
|
+
preferredDeviceId: z13.string().nullable()
|
|
2673
|
+
});
|
|
2674
|
+
var PushPayload = z13.union([
|
|
2675
|
+
z13.object({
|
|
2676
|
+
type: z13.literal("show"),
|
|
2677
|
+
title: z13.string(),
|
|
2678
|
+
body: z13.string(),
|
|
2679
|
+
tag: z13.string(),
|
|
2680
|
+
url: z13.string(),
|
|
2681
|
+
renotify: z13.boolean()
|
|
2263
2682
|
}),
|
|
2264
|
-
|
|
2683
|
+
z13.object({ type: z13.literal("clear"), tag: z13.string() })
|
|
2265
2684
|
]);
|
|
2266
|
-
var SetupState =
|
|
2267
|
-
passkey:
|
|
2268
|
-
available:
|
|
2269
|
-
registered:
|
|
2270
|
-
reason:
|
|
2685
|
+
var SetupState = z13.object({
|
|
2686
|
+
passkey: z13.object({
|
|
2687
|
+
available: z13.boolean(),
|
|
2688
|
+
registered: z13.boolean(),
|
|
2689
|
+
reason: z13.string().nullable()
|
|
2271
2690
|
}),
|
|
2272
|
-
oidc:
|
|
2691
|
+
oidc: z13.object({ label: z13.string() }).nullable()
|
|
2273
2692
|
});
|
|
2274
|
-
var PasskeyRegisterOptionsResponse =
|
|
2275
|
-
challengeId:
|
|
2276
|
-
options:
|
|
2693
|
+
var PasskeyRegisterOptionsResponse = z13.object({
|
|
2694
|
+
challengeId: z13.string(),
|
|
2695
|
+
options: z13.unknown()
|
|
2277
2696
|
});
|
|
2278
|
-
var PasskeyRegisterVerifyRequest =
|
|
2279
|
-
challengeId:
|
|
2280
|
-
name:
|
|
2281
|
-
response:
|
|
2697
|
+
var PasskeyRegisterVerifyRequest = z13.object({
|
|
2698
|
+
challengeId: z13.string(),
|
|
2699
|
+
name: z13.string().min(1).max(80),
|
|
2700
|
+
response: z13.unknown()
|
|
2282
2701
|
});
|
|
2283
|
-
var PasskeySignInOptionsResponse =
|
|
2284
|
-
challengeId:
|
|
2285
|
-
options:
|
|
2702
|
+
var PasskeySignInOptionsResponse = z13.object({
|
|
2703
|
+
challengeId: z13.string(),
|
|
2704
|
+
options: z13.unknown()
|
|
2286
2705
|
});
|
|
2287
|
-
var PasskeySignInVerifyRequest =
|
|
2288
|
-
challengeId:
|
|
2289
|
-
response:
|
|
2290
|
-
deviceName:
|
|
2706
|
+
var PasskeySignInVerifyRequest = z13.object({
|
|
2707
|
+
challengeId: z13.string(),
|
|
2708
|
+
response: z13.unknown(),
|
|
2709
|
+
deviceName: z13.string().min(1).max(80),
|
|
2291
2710
|
kind: DeviceKind.extract(["browser", "pwa"])
|
|
2292
2711
|
});
|
|
2293
|
-
var OidcBeginRequest =
|
|
2294
|
-
deviceName:
|
|
2712
|
+
var OidcBeginRequest = z13.object({
|
|
2713
|
+
deviceName: z13.string().min(1).max(80),
|
|
2295
2714
|
kind: DeviceKind.extract(["browser", "pwa"]),
|
|
2296
|
-
next:
|
|
2297
|
-
handoff:
|
|
2298
|
-
});
|
|
2299
|
-
var OidcBeginResponse =
|
|
2300
|
-
authorizeUrl:
|
|
2301
|
-
flowId:
|
|
2302
|
-
pollToken:
|
|
2303
|
-
});
|
|
2304
|
-
var OidcClaimRequest =
|
|
2305
|
-
var OidcClaimResponse =
|
|
2306
|
-
|
|
2307
|
-
|
|
2715
|
+
next: z13.string().default("/"),
|
|
2716
|
+
handoff: z13.boolean().default(false)
|
|
2717
|
+
});
|
|
2718
|
+
var OidcBeginResponse = z13.object({
|
|
2719
|
+
authorizeUrl: z13.string(),
|
|
2720
|
+
flowId: z13.string().nullable(),
|
|
2721
|
+
pollToken: z13.string().nullable()
|
|
2722
|
+
});
|
|
2723
|
+
var OidcClaimRequest = z13.object({ flowId: z13.string(), pollToken: z13.string() });
|
|
2724
|
+
var OidcClaimResponse = z13.union([
|
|
2725
|
+
z13.object({ status: z13.literal("pending") }),
|
|
2726
|
+
z13.object({ status: z13.literal("done"), deviceId: z13.string() })
|
|
2308
2727
|
]);
|
|
2309
|
-
var TerminalLoginStartRequest =
|
|
2310
|
-
var TerminalLoginStartResponse =
|
|
2311
|
-
userCode:
|
|
2312
|
-
pollToken:
|
|
2313
|
-
verifyUrl:
|
|
2314
|
-
expiresAt:
|
|
2315
|
-
intervalMs:
|
|
2316
|
-
});
|
|
2317
|
-
var TerminalLoginClaimRequest =
|
|
2318
|
-
userCode:
|
|
2319
|
-
pollToken:
|
|
2320
|
-
});
|
|
2321
|
-
var TerminalLoginClaimResponse =
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2728
|
+
var TerminalLoginStartRequest = z13.object({ name: z13.string().min(1).max(80) });
|
|
2729
|
+
var TerminalLoginStartResponse = z13.object({
|
|
2730
|
+
userCode: z13.string(),
|
|
2731
|
+
pollToken: z13.string(),
|
|
2732
|
+
verifyUrl: z13.string(),
|
|
2733
|
+
expiresAt: z13.string(),
|
|
2734
|
+
intervalMs: z13.number().int()
|
|
2735
|
+
});
|
|
2736
|
+
var TerminalLoginClaimRequest = z13.object({
|
|
2737
|
+
userCode: z13.string().min(1),
|
|
2738
|
+
pollToken: z13.string().min(1)
|
|
2739
|
+
});
|
|
2740
|
+
var TerminalLoginClaimResponse = z13.union([
|
|
2741
|
+
z13.object({ status: z13.literal("pending") }),
|
|
2742
|
+
z13.object({ status: z13.literal("denied") }),
|
|
2743
|
+
z13.object({ status: z13.literal("done"), deviceId: z13.string(), credential: z13.string() })
|
|
2325
2744
|
]);
|
|
2326
|
-
var TerminalLoginRequest =
|
|
2327
|
-
userCode:
|
|
2328
|
-
name:
|
|
2329
|
-
requestedFrom:
|
|
2330
|
-
createdAt:
|
|
2331
|
-
expiresAt:
|
|
2332
|
-
status:
|
|
2333
|
-
});
|
|
2334
|
-
var AuthMethods =
|
|
2335
|
-
passkeys:
|
|
2336
|
-
passkeyAvailability:
|
|
2337
|
-
oidc:
|
|
2338
|
-
issuer:
|
|
2339
|
-
label:
|
|
2340
|
-
ownerMatch:
|
|
2341
|
-
status:
|
|
2342
|
-
error:
|
|
2745
|
+
var TerminalLoginRequest = z13.object({
|
|
2746
|
+
userCode: z13.string(),
|
|
2747
|
+
name: z13.string(),
|
|
2748
|
+
requestedFrom: z13.string(),
|
|
2749
|
+
createdAt: z13.string(),
|
|
2750
|
+
expiresAt: z13.string(),
|
|
2751
|
+
status: z13.enum(["pending", "approved", "denied"])
|
|
2752
|
+
});
|
|
2753
|
+
var AuthMethods = z13.object({
|
|
2754
|
+
passkeys: z13.array(Passkey),
|
|
2755
|
+
passkeyAvailability: z13.object({ available: z13.boolean(), reason: z13.string().nullable() }),
|
|
2756
|
+
oidc: z13.object({
|
|
2757
|
+
issuer: z13.string(),
|
|
2758
|
+
label: z13.string(),
|
|
2759
|
+
ownerMatch: z13.string(),
|
|
2760
|
+
status: z13.enum(["ready", "error"]),
|
|
2761
|
+
error: z13.string().nullable()
|
|
2343
2762
|
}).nullable()
|
|
2344
2763
|
});
|
|
2345
|
-
var MeResponse =
|
|
2764
|
+
var MeResponse = z13.object({
|
|
2346
2765
|
device: Device,
|
|
2347
|
-
admin:
|
|
2348
|
-
publicUrl:
|
|
2766
|
+
admin: z13.boolean(),
|
|
2767
|
+
publicUrl: z13.string()
|
|
2349
2768
|
});
|
|
2350
2769
|
var ViewInput = View.pick({
|
|
2351
2770
|
name: true,
|
|
@@ -2359,51 +2778,65 @@ var ViewInput = View.pick({
|
|
|
2359
2778
|
});
|
|
2360
2779
|
var ViewPatch = ViewInput.partial();
|
|
2361
2780
|
var ViewClientReport = ViewClient.omit({ lastSeenAt: true });
|
|
2362
|
-
var ProjectSuggestionsResponse =
|
|
2363
|
-
suggestions:
|
|
2781
|
+
var ProjectSuggestionsResponse = z13.object({
|
|
2782
|
+
suggestions: z13.array(ProjectSuggestion.extend({ name: z13.string(), preselected: z13.boolean() }))
|
|
2364
2783
|
});
|
|
2365
2784
|
|
|
2366
2785
|
// packages/protocol/dist/client-wire.js
|
|
2367
|
-
import { z as
|
|
2368
|
-
var SyncState =
|
|
2369
|
-
hosts:
|
|
2370
|
-
projects:
|
|
2371
|
-
checkouts:
|
|
2372
|
-
workspaces:
|
|
2373
|
-
profiles:
|
|
2374
|
-
views:
|
|
2375
|
-
sessions:
|
|
2376
|
-
tasks:
|
|
2377
|
-
runs:
|
|
2378
|
-
automations:
|
|
2379
|
-
attention:
|
|
2380
|
-
interactions:
|
|
2381
|
-
panels:
|
|
2382
|
-
devices:
|
|
2383
|
-
adapters:
|
|
2384
|
-
dispatchPaused:
|
|
2385
|
-
});
|
|
2386
|
-
var Presence =
|
|
2387
|
-
foreground:
|
|
2388
|
-
interactedAt:
|
|
2389
|
-
viewing:
|
|
2390
|
-
});
|
|
2391
|
-
var
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2786
|
+
import { z as z14 } from "zod";
|
|
2787
|
+
var SyncState = z14.object({
|
|
2788
|
+
hosts: z14.array(Host),
|
|
2789
|
+
projects: z14.array(Project),
|
|
2790
|
+
checkouts: z14.array(Checkout),
|
|
2791
|
+
workspaces: z14.array(Workspace),
|
|
2792
|
+
profiles: z14.array(Profile),
|
|
2793
|
+
views: z14.array(View),
|
|
2794
|
+
sessions: z14.array(Session),
|
|
2795
|
+
tasks: z14.array(Task),
|
|
2796
|
+
runs: z14.array(Run),
|
|
2797
|
+
automations: z14.array(Automation),
|
|
2798
|
+
attention: z14.array(AttentionItem),
|
|
2799
|
+
interactions: z14.array(Interaction),
|
|
2800
|
+
panels: z14.array(Panel),
|
|
2801
|
+
devices: z14.array(Device),
|
|
2802
|
+
adapters: z14.record(z14.string(), z14.array(AdapterInfo)),
|
|
2803
|
+
dispatchPaused: z14.boolean()
|
|
2804
|
+
});
|
|
2805
|
+
var Presence = z14.object({
|
|
2806
|
+
foreground: z14.boolean(),
|
|
2807
|
+
interactedAt: z14.string().nullable(),
|
|
2808
|
+
viewing: z14.object({ sessionId: z14.string() }).nullable()
|
|
2809
|
+
});
|
|
2810
|
+
var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
|
|
2811
|
+
var ClientToServer = z14.discriminatedUnion("type", [
|
|
2812
|
+
z14.object({
|
|
2813
|
+
type: z14.literal("hello"),
|
|
2814
|
+
cursor: z14.number().int().nullable(),
|
|
2815
|
+
capabilities: z14.array(z14.string().min(1).max(80)).max(32).optional(),
|
|
2816
|
+
projectionId: z14.string().max(256).nullable().optional()
|
|
2817
|
+
}),
|
|
2818
|
+
z14.object({ type: z14.literal("presence"), presence: Presence }),
|
|
2819
|
+
z14.object({ type: z14.literal("ping") })
|
|
2395
2820
|
]);
|
|
2396
|
-
var ServerToClient =
|
|
2397
|
-
|
|
2398
|
-
type:
|
|
2399
|
-
seq:
|
|
2400
|
-
events:
|
|
2821
|
+
var ServerToClient = z14.discriminatedUnion("type", [
|
|
2822
|
+
z14.object({
|
|
2823
|
+
type: z14.literal("replay"),
|
|
2824
|
+
seq: z14.number().int(),
|
|
2825
|
+
events: z14.array(EventEnvelope),
|
|
2826
|
+
capabilities: z14.array(z14.enum(CLIENT_CAPABILITIES)).optional(),
|
|
2827
|
+
projectionId: z14.string().optional()
|
|
2401
2828
|
}),
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2829
|
+
z14.object({
|
|
2830
|
+
type: z14.literal("snapshot"),
|
|
2831
|
+
seq: z14.number().int(),
|
|
2832
|
+
state: SyncState,
|
|
2833
|
+
capabilities: z14.array(z14.enum(CLIENT_CAPABILITIES)).optional(),
|
|
2834
|
+
projectionId: z14.string().optional()
|
|
2835
|
+
}),
|
|
2836
|
+
z14.object({ type: z14.literal("event"), event: EventEnvelope }),
|
|
2837
|
+
z14.object({ type: z14.literal("stream"), delta: StreamDelta }),
|
|
2838
|
+
z14.object({ type: z14.literal("pong") }),
|
|
2839
|
+
z14.object({ type: z14.literal("force_logout"), reason: z14.string() })
|
|
2407
2840
|
]);
|
|
2408
2841
|
|
|
2409
2842
|
// packages/protocol/dist/ids.js
|
|
@@ -2414,17 +2847,17 @@ var ulid = monotonicFactory();
|
|
|
2414
2847
|
var CLIENT_OPEN_MS = 10 * 6e4;
|
|
2415
2848
|
|
|
2416
2849
|
// packages/protocol/dist/web-bridge.js
|
|
2417
|
-
import { z as
|
|
2850
|
+
import { z as z15 } from "zod";
|
|
2418
2851
|
var FRAME_MAX_HEIGHT = 4e3;
|
|
2419
|
-
var FrameToParentMessageSchema =
|
|
2420
|
-
|
|
2421
|
-
type:
|
|
2422
|
-
actionId:
|
|
2423
|
-
payload:
|
|
2852
|
+
var FrameToParentMessageSchema = z15.discriminatedUnion("type", [
|
|
2853
|
+
z15.object({
|
|
2854
|
+
type: z15.literal("action"),
|
|
2855
|
+
actionId: z15.string().min(1).max(200),
|
|
2856
|
+
payload: z15.unknown().optional()
|
|
2424
2857
|
}),
|
|
2425
|
-
|
|
2426
|
-
type:
|
|
2427
|
-
height:
|
|
2858
|
+
z15.object({
|
|
2859
|
+
type: z15.literal("resize"),
|
|
2860
|
+
height: z15.number().finite().min(0).max(FRAME_MAX_HEIGHT)
|
|
2428
2861
|
})
|
|
2429
2862
|
]);
|
|
2430
2863
|
|