@spencerboucher/switchyard 0.13.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 +2084 -1725
- package/dist/switchyard.mjs +3670 -2388
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-CcxKiLxM.js +2 -0
- package/web-dist/assets/{AutomationView-Cg7yk8nb.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-sHm0eI2Q.js.map → Card-WONLvqGM.js.map} +1 -1
- package/web-dist/assets/Checkbox-D18Ch0n4.js +2 -0
- package/web-dist/assets/{Checkbox-CEvKyfJz.js.map → Checkbox-D18Ch0n4.js.map} +1 -1
- package/web-dist/assets/Copy-D6U5ewFc.js +2 -0
- package/web-dist/assets/{Copy-BHOLVthK.js.map → Copy-D6U5ewFc.js.map} +1 -1
- package/web-dist/assets/{DangerZone-og55TRug.js → DangerZone-Ch2KNmob.js} +2 -2
- package/web-dist/assets/{DangerZone-og55TRug.js.map → DangerZone-Ch2KNmob.js.map} +1 -1
- package/web-dist/assets/InteractionCard-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-xSUsxoXm.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-C5xlhWYb.js.map → Select-CpWLZnId.js.map} +1 -1
- package/web-dist/assets/Switch-DHX-YYPr.js +2 -0
- package/web-dist/assets/{Switch-dVcf-7Je.js.map → Switch-DHX-YYPr.js.map} +1 -1
- package/web-dist/assets/Tabs-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-D8WB5GD8.js.map → TextArea-BQPdfjO_.js.map} +1 -1
- package/web-dist/assets/TextLink-CCc3WEdm.js +2 -0
- package/web-dist/assets/{TextLink-CrfA8AeH.js.map → TextLink-CCc3WEdm.js.map} +1 -1
- package/web-dist/assets/UINodeRenderer-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-aS6ooJpx.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-w4KmQFfU.js → describe-Nw-EGTvb.js} +3 -3
- package/web-dist/assets/{describe-w4KmQFfU.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-DPKdD0en.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-7OOzM_xa.js → policyLogic-4ByNprLE.js} +2 -2
- package/web-dist/assets/{policyLogic-7OOzM_xa.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-BA_bnCvu.js → repo-Pn-s_Ggk.js} +2 -2
- package/web-dist/assets/{repo-BA_bnCvu.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-BSJdzvzq.js +2 -0
- package/web-dist/assets/{terminal-login-C0n8cXqn.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-CYDIV-KM.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-DHtFcID5.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-Cg7yk8nb.js +0 -2
- package/web-dist/assets/Card-sHm0eI2Q.js +0 -2
- package/web-dist/assets/Checkbox-CEvKyfJz.js +0 -2
- package/web-dist/assets/Copy-BHOLVthK.js +0 -2
- package/web-dist/assets/InteractionCard-B-yhxwKs.js +0 -6
- package/web-dist/assets/InteractionCard-B-yhxwKs.js.map +0 -1
- package/web-dist/assets/Menu-Cyt18mF2.js +0 -2
- package/web-dist/assets/Menu-Cyt18mF2.js.map +0 -1
- package/web-dist/assets/Overlay-BPNYBq3V.js +0 -2
- package/web-dist/assets/Overlay-BPNYBq3V.js.map +0 -1
- package/web-dist/assets/Priority-xSUsxoXm.js +0 -2
- package/web-dist/assets/SegmentedControl-DaBwumC0.js +0 -2
- package/web-dist/assets/SegmentedControl-DaBwumC0.js.map +0 -1
- package/web-dist/assets/Select-C5xlhWYb.js +0 -2
- package/web-dist/assets/Switch-dVcf-7Je.js +0 -2
- package/web-dist/assets/Tabs-93APobOB.js +0 -184
- package/web-dist/assets/Tabs-93APobOB.js.map +0 -1
- package/web-dist/assets/TextArea-D8WB5GD8.js +0 -2
- package/web-dist/assets/TextLink-CrfA8AeH.js +0 -2
- package/web-dist/assets/arrow-down-C-iLrN8I.js +0 -2
- package/web-dist/assets/arrow-up-Dj-VTKx4.js +0 -2
- package/web-dist/assets/attention-C8rfu6Uw.js +0 -2
- package/web-dist/assets/attention-C8rfu6Uw.js.map +0 -1
- package/web-dist/assets/automations-DQxUzi5Q.js +0 -2
- package/web-dist/assets/automations-DQxUzi5Q.js.map +0 -1
- package/web-dist/assets/board-aS6ooJpx.js +0 -10
- package/web-dist/assets/calendar-clock-B8zE4JsX.js +0 -2
- package/web-dist/assets/chevron-right-evVLS6hq.js +0 -2
- package/web-dist/assets/code-Zr5DqwWI.js +0 -25
- package/web-dist/assets/code-Zr5DqwWI.js.map +0 -1
- package/web-dist/assets/enroll-DPKdD0en.js +0 -2
- package/web-dist/assets/external-link-3jjTxo92.js +0 -2
- package/web-dist/assets/hand-UPoHamrn.js +0 -2
- package/web-dist/assets/index-DFNY2EUd.css +0 -2
- package/web-dist/assets/index-DPScWz2I.js +0 -11
- package/web-dist/assets/index-DPScWz2I.js.map +0 -1
- package/web-dist/assets/jsx-runtime-D13aM9HY.js.map +0 -1
- package/web-dist/assets/key-round-VDbE9E4X.js +0 -2
- package/web-dist/assets/link-2-CaMlUDRG.js +0 -2
- package/web-dist/assets/logic-B46fwD-8.js +0 -2
- package/web-dist/assets/more-CiyGP5GD.js +0 -2
- package/web-dist/assets/more-CiyGP5GD.js.map +0 -1
- package/web-dist/assets/pencil-DI8QbCN8.js +0 -2
- package/web-dist/assets/play-CjoDg3ws.js +0 -2
- package/web-dist/assets/plus-BLP-wIYD.js +0 -2
- package/web-dist/assets/preload-helper-B2m1UyXR.js +0 -13
- package/web-dist/assets/preload-helper-B2m1UyXR.js.map +0 -1
- package/web-dist/assets/presence-05bJD5G3.js +0 -2
- package/web-dist/assets/queue-BcbJqzTY.js +0 -2
- package/web-dist/assets/queue-BcbJqzTY.js.map +0 -1
- package/web-dist/assets/settings-D03MF_Kx.js +0 -7
- package/web-dist/assets/settings-D03MF_Kx.js.map +0 -1
- package/web-dist/assets/shared-Bxc2JM1K.js +0 -3
- package/web-dist/assets/shared-Bxc2JM1K.js.map +0 -1
- package/web-dist/assets/states-DynH8-o6.js +0 -58
- package/web-dist/assets/states-DynH8-o6.js.map +0 -1
- package/web-dist/assets/terminal-BOV_MXPZ.js +0 -2
- package/web-dist/assets/terminal-login-C0n8cXqn.js +0 -2
- package/web-dist/assets/timer-BCIucSXh.js +0 -2
- package/web-dist/assets/useBreakpoint-CYDIV-KM.js +0 -2
- package/web-dist/assets/useNow-0tMsLHnB.js +0 -2
- package/web-dist/assets/useNow-0tMsLHnB.js.map +0 -1
- package/web-dist/assets/useResource-DHtFcID5.js +0 -2
package/dist/policies/worker.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
import { parentPort } from "node:worker_threads";
|
|
3
3
|
import { Environment } from "@marcbachmann/cel-js";
|
|
4
4
|
|
|
5
|
-
// packages/protocol/dist/
|
|
5
|
+
// packages/protocol/dist/adapter-preview.js
|
|
6
|
+
import { z as 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,562 +50,165 @@ 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);
|
|
96
|
-
}
|
|
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
|
-
};
|
|
120
|
-
var PolicyRule = z2.object({
|
|
121
|
-
id: Id,
|
|
122
|
-
...scopeShape,
|
|
123
|
-
...ruleFields,
|
|
124
|
-
revision: Revision,
|
|
125
|
-
builtIn: z2.boolean(),
|
|
126
|
-
createdAt: Instant,
|
|
127
|
-
updatedAt: Instant
|
|
128
|
-
}).strict().refine(scopeValid);
|
|
129
|
-
var PolicyToolSafety = z2.object({
|
|
130
|
-
destructiveDelete: z2.boolean(),
|
|
131
|
-
forcePush: z2.boolean(),
|
|
132
|
-
defaultBranchPush: z2.boolean(),
|
|
133
|
-
uncertain: z2.boolean(),
|
|
134
|
-
reasons: z2.array(z2.string().min(1).max(1e3)).max(16)
|
|
135
|
-
}).strict();
|
|
136
|
-
function normalizePosixPath(value) {
|
|
137
|
-
const parts = [];
|
|
138
|
-
for (const part of value.split("/")) {
|
|
139
|
-
if (part === "..")
|
|
140
|
-
parts.pop();
|
|
141
|
-
else if (part && part !== ".")
|
|
142
|
-
parts.push(part);
|
|
143
|
-
}
|
|
144
|
-
return `/${parts.join("/")}`;
|
|
145
|
-
}
|
|
146
|
-
var hostPath = z2.string().min(1).max(8192).refine((value) => value.startsWith("/") && !value.includes("\0"), "Expected absolute POSIX path").transform(normalizePosixPath);
|
|
147
|
-
function relativePosixPath(from, to) {
|
|
148
|
-
const fromParts = from.split("/").filter(Boolean);
|
|
149
|
-
const toParts = to.split("/").filter(Boolean);
|
|
150
|
-
let shared = 0;
|
|
151
|
-
while (shared < fromParts.length && fromParts[shared] === toParts[shared])
|
|
152
|
-
shared++;
|
|
153
|
-
return [...fromParts.slice(shared).map(() => ".."), ...toParts.slice(shared)].join("/");
|
|
154
|
-
}
|
|
155
|
-
var HostPolicyBoundary = z2.object({
|
|
156
|
-
cwd: hostPath,
|
|
157
|
-
workspaceRoot: hostPath,
|
|
158
|
-
cwdReal: hostPath,
|
|
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)
|
|
246
|
-
]);
|
|
247
|
-
var webUrl = z2.string().max(4096).refine((s) => {
|
|
248
|
-
try {
|
|
249
|
-
const u = new URL(s);
|
|
250
|
-
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
251
|
-
} catch {
|
|
252
|
-
return false;
|
|
62
|
+
toBody() {
|
|
63
|
+
return this.details === void 0 ? { code: this.code, message: this.message } : { code: this.code, message: this.message, details: this.details };
|
|
253
64
|
}
|
|
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()
|
|
264
|
-
]);
|
|
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
|
-
|
|
349
|
-
// packages/protocol/dist/agent-wire.js
|
|
350
|
-
var Id2 = z3.string().min(1).max(200);
|
|
351
|
-
var Instant2 = z3.string().refine((value) => {
|
|
352
|
-
const date = new Date(value);
|
|
353
|
-
return Number.isFinite(date.getTime()) && date.toISOString() === value;
|
|
354
|
-
}, "Expected canonical UTC timestamp");
|
|
355
|
-
var AGENT_FRAME_MAX_BYTES = 128 * 1024;
|
|
356
|
-
var AgentMethod = z3.enum([
|
|
357
|
-
"session.bind",
|
|
358
|
-
"task.create",
|
|
359
|
-
"message.send",
|
|
360
|
-
"inbox.read",
|
|
361
|
-
"receipt.peek",
|
|
362
|
-
"policy.evaluate",
|
|
363
|
-
"policy.status",
|
|
364
|
-
"policy.cancel"
|
|
365
|
-
]);
|
|
366
|
-
var AgentToolMethod = z3.enum(["task.create", "message.send", "inbox.read"]);
|
|
367
|
-
var RequestHash = z3.string().regex(/^[a-f0-9]{64}$/);
|
|
368
|
-
var AgentReceiptPeekRequest = z3.object({ method: AgentToolMethod, args: z3.record(z3.string(), z3.json()) }).strict();
|
|
369
|
-
var AgentReceiptPeekResult = z3.discriminatedUnion("found", [
|
|
370
|
-
z3.object({ found: z3.literal(false) }).strict(),
|
|
371
|
-
z3.object({ found: z3.literal(true), requestHash: RequestHash }).strict()
|
|
372
|
-
]);
|
|
373
|
-
var AgentReceiptReplay = z3.object({ requestHash: RequestHash }).strict();
|
|
374
|
-
var CreateAgentTask = z3.object({
|
|
375
|
-
objective: z3.string().min(1).max(16e3),
|
|
376
|
-
acceptance: z3.array(z3.string().min(1).max(2e3)).max(100).default([]),
|
|
377
|
-
dependencies: z3.array(Id2).max(100).default([]),
|
|
378
|
-
parentTaskId: Id2.nullable().optional(),
|
|
379
|
-
hostId: Id2.optional(),
|
|
380
|
-
profileId: Id2.optional(),
|
|
381
|
-
notifyOnFinish: z3.boolean().default(true)
|
|
382
|
-
});
|
|
383
|
-
var SendAgentMessage = z3.object({
|
|
384
|
-
sessionId: Id2,
|
|
385
|
-
body: z3.string().min(1).max(16e3),
|
|
386
|
-
mode: z3.enum(["steer", "queue"]),
|
|
387
|
-
replyTo: Id2.optional()
|
|
388
|
-
});
|
|
389
|
-
var ReadAgentInbox = z3.object({
|
|
390
|
-
after: z3.number().int().nonnegative().default(0),
|
|
391
|
-
limit: z3.number().int().min(1).max(100).default(20)
|
|
392
|
-
});
|
|
393
|
-
var DeliveryState = z3.enum([
|
|
394
|
-
"pending",
|
|
395
|
-
"held",
|
|
396
|
-
"deferred",
|
|
397
|
-
"accepted",
|
|
398
|
-
"queued",
|
|
399
|
-
"appended",
|
|
400
|
-
"uncertain",
|
|
401
|
-
"failed"
|
|
402
|
-
]);
|
|
403
|
-
var AgentMessageFields = {
|
|
404
|
-
seq: z3.number().int().positive(),
|
|
405
|
-
id: Id2,
|
|
406
|
-
recipientSessionId: Id2,
|
|
407
|
-
replyTo: Id2.nullable(),
|
|
408
|
-
chainId: Id2,
|
|
409
|
-
depth: z3.number().int().min(0).max(4),
|
|
410
|
-
body: z3.unknown(),
|
|
411
|
-
requestedMode: z3.enum(["steer", "queue"]),
|
|
412
|
-
deliveryState: DeliveryState,
|
|
413
|
-
holdUntil: z3.string(),
|
|
414
|
-
readAt: z3.string().nullable(),
|
|
415
|
-
createdAt: z3.string()
|
|
416
65
|
};
|
|
417
|
-
var AgentMessage = z3.discriminatedUnion("kind", [
|
|
418
|
-
z3.object({ ...AgentMessageFields, kind: z3.literal("message"), senderSessionId: Id2 }),
|
|
419
|
-
z3.object({
|
|
420
|
-
...AgentMessageFields,
|
|
421
|
-
kind: z3.literal("completion"),
|
|
422
|
-
senderSessionId: Id2.nullable()
|
|
423
|
-
})
|
|
424
|
-
]);
|
|
425
|
-
var AgentInbox = z3.object({
|
|
426
|
-
messages: z3.array(AgentMessage),
|
|
427
|
-
nextAfter: z3.number().int().nonnegative(),
|
|
428
|
-
hasMore: z3.boolean()
|
|
429
|
-
});
|
|
430
|
-
var AgentToolPolicyWait = PolicyEvaluation.options[2].omit({ verdict: true }).extend({ type: z3.literal("policy.required") }).strict();
|
|
431
|
-
var AgentRequestFrame = z3.object({
|
|
432
|
-
type: z3.literal("agent.request"),
|
|
433
|
-
requestId: Id2,
|
|
434
|
-
sessionId: Id2,
|
|
435
|
-
nativeSessionId: Id2,
|
|
436
|
-
runtimeId: Id2,
|
|
437
|
-
context: z3.object({ humanInputId: Id2.nullable(), causalMessageId: Id2.nullable() }).strict(),
|
|
438
|
-
toolCallId: Id2.optional(),
|
|
439
|
-
receiptReplay: AgentReceiptReplay.optional(),
|
|
440
|
-
// Tool-method ingress requires this separately; legacy/non-tool frames remain compatible.
|
|
441
|
-
deadlineAt: Instant2.optional(),
|
|
442
|
-
method: AgentMethod,
|
|
443
|
-
args: z3.unknown()
|
|
444
|
-
}).strict().superRefine((frame, ctx) => {
|
|
445
|
-
if (frame.method === "receipt.peek") {
|
|
446
|
-
if (!frame.toolCallId) {
|
|
447
|
-
ctx.addIssue({
|
|
448
|
-
code: "custom",
|
|
449
|
-
path: ["toolCallId"],
|
|
450
|
-
message: "Receipt lookup requires a tool call ID."
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
if (Object.hasOwn(frame, "receiptReplay") && !AgentToolMethod.safeParse(frame.method).success) {
|
|
455
|
-
ctx.addIssue({
|
|
456
|
-
code: "custom",
|
|
457
|
-
path: ["receiptReplay"],
|
|
458
|
-
message: "Receipt replay is only valid for tool methods."
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
var AgentResultFrame = z3.discriminatedUnion("ok", [
|
|
463
|
-
z3.object({
|
|
464
|
-
type: z3.literal("agent.result"),
|
|
465
|
-
requestId: Id2,
|
|
466
|
-
runtimeId: Id2,
|
|
467
|
-
ok: z3.literal(true),
|
|
468
|
-
result: z3.unknown()
|
|
469
|
-
}),
|
|
470
|
-
z3.object({
|
|
471
|
-
type: z3.literal("agent.result"),
|
|
472
|
-
requestId: Id2,
|
|
473
|
-
runtimeId: Id2,
|
|
474
|
-
ok: z3.literal(false),
|
|
475
|
-
error: ErrorBody
|
|
476
|
-
})
|
|
477
|
-
]);
|
|
478
|
-
|
|
479
|
-
// packages/protocol/dist/api.js
|
|
480
|
-
import { z as z11 } from "zod";
|
|
481
|
-
|
|
482
|
-
// packages/protocol/dist/entities.js
|
|
483
|
-
import { z as z7 } from "zod";
|
|
484
|
-
|
|
485
|
-
// packages/protocol/dist/contributions.js
|
|
486
|
-
import { z as z5 } from "zod";
|
|
487
66
|
|
|
488
67
|
// packages/protocol/dist/ui.js
|
|
489
|
-
|
|
490
|
-
var
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
});
|
|
498
|
-
var
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
options: z4.array(OptionSchema),
|
|
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),
|
|
505
83
|
allowOther: AllowOther.optional(),
|
|
506
84
|
showIf: ShowIfSchema.optional()
|
|
507
85
|
}),
|
|
508
|
-
|
|
509
|
-
kind:
|
|
510
|
-
name:
|
|
511
|
-
label:
|
|
512
|
-
options:
|
|
86
|
+
z2.object({
|
|
87
|
+
kind: z2.literal("multiselect"),
|
|
88
|
+
name: z2.string(),
|
|
89
|
+
label: z2.string(),
|
|
90
|
+
options: z2.array(OptionSchema),
|
|
513
91
|
allowOther: AllowOther.optional(),
|
|
514
|
-
min:
|
|
515
|
-
max:
|
|
92
|
+
min: z2.number().int().min(0).optional(),
|
|
93
|
+
max: z2.number().int().min(1).optional(),
|
|
516
94
|
showIf: ShowIfSchema.optional()
|
|
517
95
|
}),
|
|
518
|
-
|
|
519
|
-
kind:
|
|
520
|
-
name:
|
|
521
|
-
label:
|
|
522
|
-
placeholder:
|
|
523
|
-
multiline:
|
|
524
|
-
prefill:
|
|
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(),
|
|
525
103
|
showIf: ShowIfSchema.optional()
|
|
526
104
|
})
|
|
527
105
|
]);
|
|
528
|
-
var RefSchema =
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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() })
|
|
533
111
|
]);
|
|
534
|
-
var UINodeSchema =
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
t:
|
|
541
|
-
items:
|
|
542
|
-
ordered:
|
|
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()
|
|
543
121
|
}),
|
|
544
|
-
|
|
545
|
-
t:
|
|
546
|
-
columns:
|
|
547
|
-
rows:
|
|
122
|
+
z2.object({
|
|
123
|
+
t: z2.literal("table"),
|
|
124
|
+
columns: z2.array(z2.string()),
|
|
125
|
+
rows: z2.array(z2.array(z2.string()))
|
|
548
126
|
}),
|
|
549
|
-
|
|
550
|
-
t:
|
|
551
|
-
title:
|
|
552
|
-
collapsible:
|
|
553
|
-
children:
|
|
127
|
+
z2.object({
|
|
128
|
+
t: z2.literal("section"),
|
|
129
|
+
title: z2.string().optional(),
|
|
130
|
+
collapsible: z2.boolean().optional(),
|
|
131
|
+
children: z2.array(UINodeSchema)
|
|
554
132
|
}),
|
|
555
|
-
|
|
556
|
-
t:
|
|
557
|
-
tabs:
|
|
133
|
+
z2.object({
|
|
134
|
+
t: z2.literal("tabs"),
|
|
135
|
+
tabs: z2.array(z2.object({ id: z2.string(), label: z2.string(), children: z2.array(UINodeSchema) }))
|
|
558
136
|
}),
|
|
559
|
-
|
|
560
|
-
t:
|
|
561
|
-
label:
|
|
562
|
-
value:
|
|
563
|
-
status:
|
|
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()
|
|
564
142
|
}),
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
t:
|
|
568
|
-
formId:
|
|
569
|
-
fields:
|
|
570
|
-
submitLabel:
|
|
571
|
-
cancelLabel:
|
|
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()
|
|
572
150
|
}),
|
|
573
|
-
|
|
574
|
-
t:
|
|
575
|
-
message:
|
|
576
|
-
confirmLabel:
|
|
577
|
-
cancelLabel:
|
|
578
|
-
destructive:
|
|
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()
|
|
579
157
|
}),
|
|
580
|
-
|
|
581
|
-
t:
|
|
582
|
-
actions:
|
|
583
|
-
id:
|
|
584
|
-
label:
|
|
585
|
-
tone:
|
|
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()
|
|
586
164
|
}))
|
|
587
165
|
})
|
|
588
166
|
]));
|
|
589
|
-
var
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
167
|
+
var UI_MAX_DEPTH = 12;
|
|
168
|
+
var UI_MAX_NODES = 2e3;
|
|
169
|
+
function children(node) {
|
|
170
|
+
switch (node.t) {
|
|
171
|
+
case "list":
|
|
172
|
+
return node.items;
|
|
173
|
+
case "section":
|
|
174
|
+
return node.children;
|
|
175
|
+
case "tabs":
|
|
176
|
+
return node.tabs.flatMap((tab) => tab.children);
|
|
177
|
+
default:
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function validateUINode(input) {
|
|
182
|
+
const node = UINodeSchema.parse(input);
|
|
183
|
+
let count = 0;
|
|
184
|
+
const walk = (n, depth) => {
|
|
185
|
+
count++;
|
|
186
|
+
if (depth > UI_MAX_DEPTH) {
|
|
187
|
+
throw new SwitchyardError("ui_tree_too_large", `UI tree deeper than ${UI_MAX_DEPTH}`);
|
|
188
|
+
}
|
|
189
|
+
if (count > UI_MAX_NODES) {
|
|
190
|
+
throw new SwitchyardError("ui_tree_too_large", `UI tree has more than ${UI_MAX_NODES} nodes`);
|
|
191
|
+
}
|
|
192
|
+
for (const c of children(n))
|
|
193
|
+
walk(c, depth + 1);
|
|
194
|
+
};
|
|
195
|
+
walk(node, 1);
|
|
196
|
+
return node;
|
|
197
|
+
}
|
|
198
|
+
var FormValueSchema = z2.union([
|
|
199
|
+
z2.string(),
|
|
200
|
+
z2.array(z2.string()),
|
|
201
|
+
z2.object({ other: z2.string() })
|
|
593
202
|
]);
|
|
594
|
-
var InteractionResponseSchema =
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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") })
|
|
599
208
|
]);
|
|
600
209
|
|
|
601
210
|
// packages/protocol/dist/contributions.js
|
|
602
|
-
var ContributionPlacement =
|
|
211
|
+
var ContributionPlacement = z3.enum([
|
|
603
212
|
"sidebar.header",
|
|
604
213
|
"sidebar.footer",
|
|
605
214
|
"session.panel",
|
|
@@ -607,18 +216,18 @@ var ContributionPlacement = z5.enum([
|
|
|
607
216
|
"palette.item",
|
|
608
217
|
"slash.command"
|
|
609
218
|
]);
|
|
610
|
-
var
|
|
611
|
-
var ActionId =
|
|
612
|
-
var Keywords =
|
|
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);
|
|
613
222
|
var Common = {
|
|
614
223
|
placement: ContributionPlacement,
|
|
615
|
-
order:
|
|
224
|
+
order: z3.number().int().min(-1e3).max(1e3).optional(),
|
|
616
225
|
actionId: ActionId.optional()
|
|
617
226
|
};
|
|
618
|
-
var ContributionDescriptor =
|
|
619
|
-
id:
|
|
227
|
+
var ContributionDescriptor = z3.object({
|
|
228
|
+
id: Id,
|
|
620
229
|
...Common,
|
|
621
|
-
name:
|
|
230
|
+
name: z3.string().regex(/^[a-z][a-z0-9-]{0,39}$/).optional(),
|
|
622
231
|
keywords: Keywords.optional()
|
|
623
232
|
}).strict().superRefine((v, ctx) => {
|
|
624
233
|
if (v.placement === "slash.command" && (!v.name || !v.actionId)) {
|
|
@@ -637,33 +246,132 @@ var ContributionDescriptor = z5.object({
|
|
|
637
246
|
ctx.addIssue({ code: "custom", message: "Composer pills are not interactive" });
|
|
638
247
|
}
|
|
639
248
|
});
|
|
640
|
-
var ContributionInput =
|
|
249
|
+
var ContributionInput = z3.object({
|
|
641
250
|
...Common,
|
|
642
|
-
title:
|
|
643
|
-
node:
|
|
644
|
-
mobileFallback:
|
|
645
|
-
state:
|
|
646
|
-
name:
|
|
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(),
|
|
647
256
|
keywords: Keywords.optional()
|
|
648
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
|
+
}
|
|
649
354
|
|
|
650
|
-
// packages/protocol/dist/
|
|
355
|
+
// packages/protocol/dist/entities.js
|
|
651
356
|
import { z as z6 } from "zod";
|
|
652
|
-
|
|
653
|
-
|
|
357
|
+
|
|
358
|
+
// packages/protocol/dist/github.js
|
|
359
|
+
import { z as z4 } from "zod";
|
|
360
|
+
var Id2 = z4.string().min(1).max(200);
|
|
361
|
+
var Instant = z4.string().refine((s) => {
|
|
654
362
|
try {
|
|
655
363
|
return new Date(s).toISOString() === s;
|
|
656
364
|
} catch {
|
|
657
365
|
return false;
|
|
658
366
|
}
|
|
659
367
|
});
|
|
660
|
-
var positive =
|
|
661
|
-
var nonnegative =
|
|
662
|
-
var reason =
|
|
663
|
-
var hash =
|
|
664
|
-
var actionsId =
|
|
665
|
-
var
|
|
666
|
-
var displayUrl =
|
|
368
|
+
var positive = z4.number().int().safe().positive();
|
|
369
|
+
var nonnegative = z4.number().int().safe().nonnegative();
|
|
370
|
+
var reason = z4.string().min(1).max(2e3);
|
|
371
|
+
var hash = z4.string().regex(/^[0-9a-f]{64}$/);
|
|
372
|
+
var actionsId = z4.string().regex(/^[1-9][0-9]{0,19}$/);
|
|
373
|
+
var bytes = (s) => new TextEncoder().encode(s).length;
|
|
374
|
+
var displayUrl = z4.string().max(4096).refine((s) => {
|
|
667
375
|
try {
|
|
668
376
|
const u = new URL(s);
|
|
669
377
|
return ["http:", "https:"].includes(u.protocol) && !u.username && !u.password;
|
|
@@ -679,14 +387,14 @@ var githubUrl = displayUrl.refine((s) => {
|
|
|
679
387
|
return false;
|
|
680
388
|
}
|
|
681
389
|
});
|
|
682
|
-
var GitHubRepository =
|
|
390
|
+
var GitHubRepository = z4.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?\/(?!\.{1,2}$)[A-Za-z0-9_.-]{1,100}$/);
|
|
683
391
|
var issuePath = /^[hH][tT][tT][pP][sS]:\/\/[gG][iI][tT][hH][uU][bB]\.[cC][oO][mM]\/([^/]+)\/([^/]+)\/issues\/([1-9][0-9]*)$/;
|
|
684
|
-
var GitHubIssueUrl =
|
|
392
|
+
var GitHubIssueUrl = z4.string().trim().transform((raw, ctx) => {
|
|
685
393
|
const match = issuePath.exec(raw);
|
|
686
394
|
const number = match ? Number(match[3]) : NaN;
|
|
687
395
|
if (!match || !GitHubRepository.safeParse(`${match[1]}/${match[2]}`).success || !Number.isSafeInteger(number)) {
|
|
688
396
|
ctx.addIssue({ code: "custom", message: "Invalid GitHub issue URL" });
|
|
689
|
-
return
|
|
397
|
+
return z4.NEVER;
|
|
690
398
|
}
|
|
691
399
|
return `https://github.com/${match[1]}/${match[2]}/issues/${number}`;
|
|
692
400
|
});
|
|
@@ -699,7 +407,7 @@ function issuePrompt(url) {
|
|
|
699
407
|
|
|
700
408
|
Read it with \`gh issue view ${url}\`.`;
|
|
701
409
|
}
|
|
702
|
-
var GitHubIssueIdentity =
|
|
410
|
+
var GitHubIssueIdentity = z4.object({
|
|
703
411
|
repository: GitHubRepository,
|
|
704
412
|
number: positive,
|
|
705
413
|
url: GitHubIssueUrl
|
|
@@ -707,11 +415,11 @@ var GitHubIssueIdentity = z6.object({
|
|
|
707
415
|
const parts = issueParts(v.url);
|
|
708
416
|
return v.repository === parts.repository && v.number === parts.number;
|
|
709
417
|
});
|
|
710
|
-
var GitHubIssue =
|
|
418
|
+
var GitHubIssue = z4.object({
|
|
711
419
|
repository: GitHubRepository,
|
|
712
420
|
number: positive,
|
|
713
421
|
url: GitHubIssueUrl,
|
|
714
|
-
launchPrompt:
|
|
422
|
+
launchPrompt: z4.string()
|
|
715
423
|
}).strict().refine((v) => {
|
|
716
424
|
const parts = issueParts(v.url);
|
|
717
425
|
return v.repository === parts.repository && v.number === parts.number && v.launchPrompt === issuePrompt(v.url);
|
|
@@ -720,7 +428,7 @@ function githubIssueFromUrl(raw) {
|
|
|
720
428
|
const url = GitHubIssueUrl.parse(raw);
|
|
721
429
|
return { ...issueParts(url), url, launchPrompt: issuePrompt(url) };
|
|
722
430
|
}
|
|
723
|
-
var GitHubSha =
|
|
431
|
+
var GitHubSha = z4.string().regex(/^[0-9a-f]{40}$/);
|
|
724
432
|
var prUrl = githubUrl.refine((s) => {
|
|
725
433
|
try {
|
|
726
434
|
const u = new URL(s);
|
|
@@ -737,57 +445,57 @@ function matchesPr(url, repository, number) {
|
|
|
737
445
|
return false;
|
|
738
446
|
}
|
|
739
447
|
}
|
|
740
|
-
var HostGitHub =
|
|
741
|
-
var GitHubCheck =
|
|
448
|
+
var HostGitHub = z4.object({ available: z4.boolean(), reason: reason.nullable() }).strict().refine((v) => v.available === (v.reason === null));
|
|
449
|
+
var GitHubCheck = z4.object({
|
|
742
450
|
id: hash,
|
|
743
|
-
name:
|
|
744
|
-
state:
|
|
745
|
-
bucket:
|
|
451
|
+
name: z4.string().min(1).max(300),
|
|
452
|
+
state: z4.string().min(1).max(100),
|
|
453
|
+
bucket: z4.enum(["pass", "fail", "pending", "skipping", "cancel", "unknown"]),
|
|
746
454
|
link: displayUrl.nullable(),
|
|
747
|
-
workflow:
|
|
748
|
-
event:
|
|
749
|
-
startedAt:
|
|
750
|
-
completedAt:
|
|
751
|
-
description:
|
|
752
|
-
actionsJob:
|
|
455
|
+
workflow: z4.string().max(300).nullable(),
|
|
456
|
+
event: z4.string().max(100).nullable(),
|
|
457
|
+
startedAt: Instant.nullable(),
|
|
458
|
+
completedAt: Instant.nullable(),
|
|
459
|
+
description: z4.string().max(2e3).nullable(),
|
|
460
|
+
actionsJob: z4.object({ runId: actionsId, jobId: actionsId, attempt: positive }).strict().nullable()
|
|
753
461
|
}).strict();
|
|
754
|
-
var GitHubComment =
|
|
755
|
-
id:
|
|
756
|
-
author:
|
|
757
|
-
body:
|
|
758
|
-
bodyTruncated:
|
|
462
|
+
var GitHubComment = z4.object({
|
|
463
|
+
id: Id2,
|
|
464
|
+
author: z4.string().min(1).max(200).nullable(),
|
|
465
|
+
body: z4.string().refine((v) => [...v].length <= 8e3),
|
|
466
|
+
bodyTruncated: z4.boolean(),
|
|
759
467
|
url: githubUrl,
|
|
760
|
-
createdAt:
|
|
468
|
+
createdAt: Instant.nullable()
|
|
761
469
|
}).strict();
|
|
762
|
-
var GitHubThread =
|
|
763
|
-
id:
|
|
764
|
-
isResolved:
|
|
765
|
-
isOutdated:
|
|
766
|
-
path:
|
|
470
|
+
var GitHubThread = z4.object({
|
|
471
|
+
id: Id2,
|
|
472
|
+
isResolved: z4.literal(false),
|
|
473
|
+
isOutdated: z4.boolean(),
|
|
474
|
+
path: z4.string().max(8192).nullable(),
|
|
767
475
|
line: positive.nullable(),
|
|
768
476
|
startLine: positive.nullable(),
|
|
769
|
-
side:
|
|
770
|
-
comments:
|
|
771
|
-
commentsComplete:
|
|
477
|
+
side: z4.enum(["LEFT", "RIGHT"]).nullable(),
|
|
478
|
+
comments: z4.array(GitHubComment).max(10),
|
|
479
|
+
commentsComplete: z4.boolean()
|
|
772
480
|
}).strict();
|
|
773
|
-
var GitHubPullRequest =
|
|
774
|
-
nodeId:
|
|
481
|
+
var GitHubPullRequest = z4.object({
|
|
482
|
+
nodeId: z4.string().min(1).optional(),
|
|
775
483
|
number: positive,
|
|
776
484
|
url: prUrl,
|
|
777
|
-
title:
|
|
778
|
-
state:
|
|
779
|
-
isDraft:
|
|
780
|
-
headRefName:
|
|
485
|
+
title: z4.string().min(1).max(1e3),
|
|
486
|
+
state: z4.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
487
|
+
isDraft: z4.boolean(),
|
|
488
|
+
headRefName: z4.string().min(1).max(255),
|
|
781
489
|
headRefOid: GitHubSha,
|
|
782
490
|
headRepository: GitHubRepository.nullable(),
|
|
783
|
-
baseRefName:
|
|
784
|
-
mergeable:
|
|
785
|
-
mergeStateStatus:
|
|
786
|
-
reviewDecision:
|
|
787
|
-
mergeQueueEnabled:
|
|
788
|
-
inMergeQueue:
|
|
789
|
-
autoMergeEnabled:
|
|
790
|
-
squashMergeAllowed:
|
|
491
|
+
baseRefName: z4.string().min(1).max(255),
|
|
492
|
+
mergeable: z4.string().min(1).max(100),
|
|
493
|
+
mergeStateStatus: z4.string().min(1).max(100),
|
|
494
|
+
reviewDecision: z4.enum(["APPROVED", "REVIEW_REQUIRED", "CHANGES_REQUESTED"]).nullable(),
|
|
495
|
+
mergeQueueEnabled: z4.boolean(),
|
|
496
|
+
inMergeQueue: z4.boolean(),
|
|
497
|
+
autoMergeEnabled: z4.boolean(),
|
|
498
|
+
squashMergeAllowed: z4.boolean()
|
|
791
499
|
}).strict().refine((v) => {
|
|
792
500
|
try {
|
|
793
501
|
return new URL(v.url).pathname.endsWith(`/pull/${v.number}`);
|
|
@@ -795,22 +503,22 @@ var GitHubPullRequest = z6.object({
|
|
|
795
503
|
return false;
|
|
796
504
|
}
|
|
797
505
|
});
|
|
798
|
-
var WorkspaceGitHub =
|
|
506
|
+
var WorkspaceGitHub = z4.object({
|
|
799
507
|
repository: GitHubRepository.nullable(),
|
|
800
508
|
headRepository: GitHubRepository.nullable(),
|
|
801
|
-
branch:
|
|
802
|
-
fetchedAt:
|
|
803
|
-
attemptedAt:
|
|
804
|
-
status:
|
|
509
|
+
branch: z4.string().min(1).max(255).nullable(),
|
|
510
|
+
fetchedAt: Instant.nullable(),
|
|
511
|
+
attemptedAt: Instant,
|
|
512
|
+
status: z4.enum(["ready", "unavailable", "error", "ambiguous"]),
|
|
805
513
|
reason: reason.nullable(),
|
|
806
514
|
pullRequest: GitHubPullRequest.nullable(),
|
|
807
|
-
checks:
|
|
808
|
-
checksComplete:
|
|
809
|
-
threads:
|
|
810
|
-
threadsComplete:
|
|
811
|
-
truncated:
|
|
515
|
+
checks: z4.array(GitHubCheck).max(500),
|
|
516
|
+
checksComplete: z4.boolean(),
|
|
517
|
+
threads: z4.array(GitHubThread).max(500),
|
|
518
|
+
threadsComplete: z4.boolean(),
|
|
519
|
+
truncated: z4.boolean()
|
|
812
520
|
}).strict().refine((v) => {
|
|
813
|
-
if (
|
|
521
|
+
if (bytes(JSON.stringify(v)) > 512 * 1024 || new Set(v.checks.map((c) => c.id)).size !== v.checks.length)
|
|
814
522
|
return false;
|
|
815
523
|
if (v.pullRequest && (!v.repository || !matchesPr(v.pullRequest.url, v.repository, v.pullRequest.number)))
|
|
816
524
|
return false;
|
|
@@ -820,8 +528,8 @@ var WorkspaceGitHub = z6.object({
|
|
|
820
528
|
return v.reason !== null && !v.checksComplete && !v.threadsComplete;
|
|
821
529
|
return v.reason === null && v.fetchedAt !== null && v.repository !== null && v.headRepository !== null && v.branch !== null && (v.pullRequest !== null || v.checks.length === 0 && v.threads.length === 0 && v.checksComplete && v.threadsComplete);
|
|
822
530
|
});
|
|
823
|
-
var GitHubViewResult =
|
|
824
|
-
var GitHubViewResponse =
|
|
531
|
+
var GitHubViewResult = z4.object({ github: HostGitHub, snapshot: WorkspaceGitHub }).strict();
|
|
532
|
+
var GitHubViewResponse = z4.object({ github: HostGitHub.nullable(), snapshot: WorkspaceGitHub.nullable() }).strict();
|
|
825
533
|
function lineCount(s) {
|
|
826
534
|
if (!s)
|
|
827
535
|
return 0;
|
|
@@ -830,14 +538,14 @@ function lineCount(s) {
|
|
|
830
538
|
lines.pop();
|
|
831
539
|
return lines.length;
|
|
832
540
|
}
|
|
833
|
-
var GitHubJobLog =
|
|
541
|
+
var GitHubJobLog = z4.object({
|
|
834
542
|
checkId: hash,
|
|
835
|
-
name:
|
|
543
|
+
name: z4.string().min(1).max(300),
|
|
836
544
|
url: displayUrl.nullable(),
|
|
837
545
|
runId: actionsId.nullable(),
|
|
838
546
|
jobId: actionsId.nullable(),
|
|
839
547
|
attempt: positive.nullable(),
|
|
840
|
-
status:
|
|
548
|
+
status: z4.enum([
|
|
841
549
|
"available",
|
|
842
550
|
"unmapped",
|
|
843
551
|
"incomplete",
|
|
@@ -846,26 +554,26 @@ var GitHubJobLog = z6.object({
|
|
|
846
554
|
"timeout",
|
|
847
555
|
"error"
|
|
848
556
|
]),
|
|
849
|
-
outputTail:
|
|
557
|
+
outputTail: z4.string().nullable(),
|
|
850
558
|
lineCount: nonnegative.max(150),
|
|
851
|
-
truncated:
|
|
559
|
+
truncated: z4.boolean(),
|
|
852
560
|
reason: reason.nullable()
|
|
853
|
-
}).strict().refine((v) => v.status === "available" ? v.runId !== null && v.jobId !== null && v.attempt !== null && v.outputTail !== null &&
|
|
854
|
-
var GitHubLogs =
|
|
561
|
+
}).strict().refine((v) => v.status === "available" ? v.runId !== null && v.jobId !== null && v.attempt !== null && v.outputTail !== null && bytes(v.outputTail) <= 65536 && lineCount(v.outputTail) === v.lineCount && v.reason === null : v.outputTail === null && v.lineCount === 0 && v.reason !== null);
|
|
562
|
+
var GitHubLogs = z4.object({
|
|
855
563
|
github: HostGitHub,
|
|
856
564
|
repository: GitHubRepository,
|
|
857
565
|
number: positive,
|
|
858
566
|
headOid: GitHubSha,
|
|
859
|
-
fetchedAt:
|
|
860
|
-
status:
|
|
567
|
+
fetchedAt: Instant,
|
|
568
|
+
status: z4.enum(["ready", "unavailable", "error"]),
|
|
861
569
|
reason: reason.nullable(),
|
|
862
|
-
jobs:
|
|
863
|
-
complete:
|
|
864
|
-
truncated:
|
|
570
|
+
jobs: z4.array(GitHubJobLog).max(10),
|
|
571
|
+
complete: z4.boolean(),
|
|
572
|
+
truncated: z4.boolean(),
|
|
865
573
|
omittedJobs: nonnegative.nullable()
|
|
866
|
-
}).strict().refine((v) =>
|
|
867
|
-
var GitHubLogsRequest =
|
|
868
|
-
var GitHubMergeRequest =
|
|
574
|
+
}).strict().refine((v) => bytes(JSON.stringify(v)) <= 1024 * 1024 && (v.status === "ready" ? v.github.available && v.reason === null && (!v.complete || v.omittedJobs === 0 && v.jobs.every((j) => j.status === "available")) : v.reason !== null && v.jobs.length === 0 && !v.complete));
|
|
575
|
+
var GitHubLogsRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
576
|
+
var GitHubMergeRequest = z4.object({ expectedHeadOid: GitHubSha }).strict();
|
|
869
577
|
var mergeFields = {
|
|
870
578
|
github: HostGitHub,
|
|
871
579
|
repository: GitHubRepository,
|
|
@@ -873,217 +581,520 @@ var mergeFields = {
|
|
|
873
581
|
url: prUrl,
|
|
874
582
|
expectedHeadOid: GitHubSha
|
|
875
583
|
};
|
|
876
|
-
var GitHubMergeResult =
|
|
877
|
-
|
|
878
|
-
status:
|
|
584
|
+
var GitHubMergeResult = z4.discriminatedUnion("status", [
|
|
585
|
+
z4.object({
|
|
586
|
+
status: z4.literal("merged"),
|
|
879
587
|
...mergeFields,
|
|
880
588
|
mergeCommitOid: GitHubSha.nullable(),
|
|
881
|
-
confirmedAt:
|
|
589
|
+
confirmedAt: Instant
|
|
882
590
|
}).strict(),
|
|
883
|
-
|
|
884
|
-
status:
|
|
591
|
+
z4.object({
|
|
592
|
+
status: z4.literal("outcome_unknown"),
|
|
885
593
|
...mergeFields,
|
|
886
594
|
reason,
|
|
887
|
-
attemptedAt:
|
|
595
|
+
attemptedAt: Instant
|
|
888
596
|
}).strict()
|
|
889
597
|
]).refine((v) => matchesPr(v.url, v.repository, v.number));
|
|
890
|
-
var path =
|
|
891
|
-
var GitHubHostViewRequest =
|
|
892
|
-
var GitHubHostLogsRequest =
|
|
598
|
+
var path = z4.string().min(1).max(8192);
|
|
599
|
+
var GitHubHostViewRequest = z4.object({ path }).strict();
|
|
600
|
+
var GitHubHostLogsRequest = z4.object({ path, repository: GitHubRepository, number: positive, expectedHeadOid: GitHubSha }).strict();
|
|
893
601
|
var GitHubHostMergeRequest = GitHubHostLogsRequest.extend({
|
|
894
|
-
expectedPullRequestNodeId:
|
|
602
|
+
expectedPullRequestNodeId: z4.string().min(1)
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
// packages/protocol/dist/policies.js
|
|
606
|
+
import { z as z5 } from "zod";
|
|
607
|
+
var Id3 = z5.string().min(1).max(200);
|
|
608
|
+
var Revision = z5.number().int().safe().min(1);
|
|
609
|
+
var Instant2 = z5.string().refine((s) => {
|
|
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"
|
|
666
|
+
]);
|
|
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)
|
|
803
|
+
]);
|
|
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
|
+
}
|
|
895
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(),
|
|
815
|
+
z5.object({
|
|
816
|
+
verdict: z5.literal("ASK"),
|
|
817
|
+
decisionId: Id3,
|
|
818
|
+
interactionId: Id3,
|
|
819
|
+
interactionUrl: webUrl
|
|
820
|
+
}).strict()
|
|
821
|
+
]);
|
|
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()
|
|
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);
|
|
896
905
|
|
|
897
906
|
// packages/protocol/dist/entities.js
|
|
898
|
-
var Iso =
|
|
899
|
-
var
|
|
900
|
-
var Connectivity =
|
|
901
|
-
var ControlMode =
|
|
902
|
-
var Platform =
|
|
903
|
-
var DeviceKind =
|
|
904
|
-
var DiagnosticLevel =
|
|
907
|
+
var Iso = z6.string();
|
|
908
|
+
var Id4 = z6.string();
|
|
909
|
+
var Connectivity = z6.enum(["connected", "reconnecting", "unreachable"]);
|
|
910
|
+
var ControlMode = z6.enum(["automation", "human"]);
|
|
911
|
+
var Platform = z6.enum(["darwin", "linux"]);
|
|
912
|
+
var DeviceKind = z6.enum(["browser", "pwa", "terminal", "cli"]);
|
|
913
|
+
var DiagnosticLevel = z6.enum(["info", "warning", "error"]);
|
|
905
914
|
var DEFAULT_WORKTREE_DIR = ".worktrees";
|
|
906
|
-
var CoreCapabilities =
|
|
907
|
-
prompt:
|
|
908
|
-
steer:
|
|
909
|
-
followUp:
|
|
910
|
-
abort:
|
|
911
|
-
resume:
|
|
912
|
-
rename:
|
|
913
|
-
importInactive:
|
|
914
|
-
extensionDialogs:
|
|
915
|
-
customUi:
|
|
916
|
-
widgetsText:
|
|
917
|
-
widgetsComponent:
|
|
918
|
-
tokenAccounting:
|
|
919
|
-
costAccounting:
|
|
915
|
+
var CoreCapabilities = z6.object({
|
|
916
|
+
prompt: z6.boolean(),
|
|
917
|
+
steer: z6.boolean(),
|
|
918
|
+
followUp: z6.boolean(),
|
|
919
|
+
abort: z6.boolean(),
|
|
920
|
+
resume: z6.boolean(),
|
|
921
|
+
rename: z6.boolean(),
|
|
922
|
+
importInactive: z6.boolean(),
|
|
923
|
+
extensionDialogs: z6.boolean(),
|
|
924
|
+
customUi: z6.boolean(),
|
|
925
|
+
widgetsText: z6.boolean(),
|
|
926
|
+
widgetsComponent: z6.boolean(),
|
|
927
|
+
tokenAccounting: z6.boolean(),
|
|
928
|
+
costAccounting: z6.boolean()
|
|
920
929
|
});
|
|
921
930
|
var CAPABILITY_KEYS = CoreCapabilities.keyof().options;
|
|
922
931
|
var RuntimeCapabilities = CoreCapabilities.extend({
|
|
923
932
|
/** The host runs sessions as interactive Pi in a terminal that clients can attach to. */
|
|
924
|
-
terminal:
|
|
933
|
+
terminal: z6.boolean().optional(),
|
|
925
934
|
/** The host answers session.models, session.commands, session.setModel, session.setThinking and session.compact. */
|
|
926
|
-
sessionControls:
|
|
935
|
+
sessionControls: z6.boolean().optional(),
|
|
927
936
|
/** The host answers session.navigate for terminal sessions. */
|
|
928
|
-
treeNavigation:
|
|
929
|
-
agentRequests:
|
|
930
|
-
messageDelivery:
|
|
931
|
-
policies:
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
937
|
+
treeNavigation: z6.boolean().optional(),
|
|
938
|
+
agentRequests: z6.boolean().optional(),
|
|
939
|
+
messageDelivery: z6.boolean().optional(),
|
|
940
|
+
policies: z6.boolean().optional(),
|
|
941
|
+
/** Session-scoped adapter inspection and safe reload. */
|
|
942
|
+
adapterDevelopment: z6.boolean().optional(),
|
|
943
|
+
unsupported: z6.array(z6.object({ capability: z6.string(), reason: z6.string() }))
|
|
944
|
+
});
|
|
945
|
+
var ProjectScan = z6.object({
|
|
946
|
+
state: z6.enum(["running", "done", "failed"]),
|
|
936
947
|
startedAt: Iso,
|
|
937
948
|
finishedAt: Iso.nullable(),
|
|
938
949
|
/** Repositories found across all folders. */
|
|
939
|
-
repositories:
|
|
950
|
+
repositories: z6.number().int(),
|
|
940
951
|
/** New projects created by this scan. */
|
|
941
|
-
projectsCreated:
|
|
952
|
+
projectsCreated: z6.number().int(),
|
|
942
953
|
/** New checkouts (including the ones of new projects). */
|
|
943
|
-
checkoutsAdded:
|
|
954
|
+
checkoutsAdded: z6.number().int(),
|
|
944
955
|
/** "<folder>: <message>" per folder that failed; for state "failed", the reason last. */
|
|
945
|
-
errors:
|
|
956
|
+
errors: z6.array(z6.string())
|
|
946
957
|
});
|
|
947
|
-
var UsageWindow =
|
|
948
|
-
id:
|
|
949
|
-
usedPct:
|
|
958
|
+
var UsageWindow = z6.object({
|
|
959
|
+
id: z6.enum(["five_hour", "weekly"]),
|
|
960
|
+
usedPct: z6.number(),
|
|
950
961
|
resetsAt: Iso.nullable()
|
|
951
962
|
});
|
|
952
|
-
var ProviderUsage =
|
|
953
|
-
provider:
|
|
954
|
-
status:
|
|
955
|
-
message:
|
|
956
|
-
windows:
|
|
963
|
+
var ProviderUsage = z6.object({
|
|
964
|
+
provider: z6.enum(["anthropic", "openai-codex"]),
|
|
965
|
+
status: z6.enum(["available", "expired", "rejected", "error"]),
|
|
966
|
+
message: z6.string().nullable(),
|
|
967
|
+
windows: z6.array(UsageWindow),
|
|
957
968
|
fetchedAt: Iso
|
|
958
969
|
});
|
|
959
|
-
var Host =
|
|
960
|
-
id:
|
|
961
|
-
name:
|
|
970
|
+
var Host = z6.object({
|
|
971
|
+
id: Id4,
|
|
972
|
+
name: z6.string(),
|
|
962
973
|
platform: Platform,
|
|
963
|
-
agentVersion:
|
|
964
|
-
piVersion:
|
|
965
|
-
piCompatible:
|
|
974
|
+
agentVersion: z6.string(),
|
|
975
|
+
piVersion: z6.string().nullable(),
|
|
976
|
+
piCompatible: z6.boolean(),
|
|
966
977
|
capabilities: RuntimeCapabilities.nullable(),
|
|
967
978
|
connectivity: Connectivity,
|
|
968
979
|
lastSeenAt: Iso.nullable(),
|
|
969
980
|
revokedAt: Iso.nullable(),
|
|
970
981
|
createdAt: Iso,
|
|
971
982
|
/** Folders on the host whose git repositories become projects (absolute or ~/...). */
|
|
972
|
-
projectFolders:
|
|
983
|
+
projectFolders: z6.array(z6.string()).optional(),
|
|
973
984
|
projectScan: ProjectScan.nullable().optional(),
|
|
974
985
|
/** Subscription limits (host-reported, refreshed every few minutes). */
|
|
975
|
-
usage:
|
|
986
|
+
usage: z6.array(ProviderUsage).optional(),
|
|
976
987
|
github: HostGitHub.optional()
|
|
977
988
|
});
|
|
978
|
-
var WorktreeDir =
|
|
979
|
-
var Project =
|
|
980
|
-
id:
|
|
981
|
-
name:
|
|
982
|
-
repoIdentity:
|
|
983
|
-
defaultProfileId:
|
|
984
|
-
defaultHostId:
|
|
985
|
-
maxConcurrentRuns:
|
|
986
|
-
automationEnabled:
|
|
987
|
-
setupCommand:
|
|
988
|
-
checks:
|
|
989
|
-
workspaceSharing:
|
|
989
|
+
var WorktreeDir = z6.string().min(1).refine((d) => !d.startsWith("/") && !d.includes("\\"), "must be a relative path").refine((d) => !d.split("/").includes(".."), "must stay inside the repository").refine((d) => d.split("/").every((s) => s.length > 0 && s !== "."), "must be a plain relative path");
|
|
990
|
+
var Project = z6.object({
|
|
991
|
+
id: Id4,
|
|
992
|
+
name: z6.string().min(1),
|
|
993
|
+
repoIdentity: z6.string(),
|
|
994
|
+
defaultProfileId: Id4.nullable(),
|
|
995
|
+
defaultHostId: Id4.nullable(),
|
|
996
|
+
maxConcurrentRuns: z6.number().int().min(1).max(32),
|
|
997
|
+
automationEnabled: z6.boolean(),
|
|
998
|
+
setupCommand: z6.string().nullable(),
|
|
999
|
+
checks: z6.array(z6.string()),
|
|
1000
|
+
workspaceSharing: z6.enum(["single_writer", "shared"]),
|
|
990
1001
|
worktreeDir: WorktreeDir.default(DEFAULT_WORKTREE_DIR),
|
|
991
1002
|
createdAt: Iso,
|
|
992
1003
|
updatedAt: Iso
|
|
993
1004
|
});
|
|
994
|
-
var Checkout =
|
|
995
|
-
id:
|
|
996
|
-
projectId:
|
|
997
|
-
hostId:
|
|
998
|
-
path:
|
|
999
|
-
commonDir:
|
|
1000
|
-
defaultBranch:
|
|
1005
|
+
var Checkout = z6.object({
|
|
1006
|
+
id: Id4,
|
|
1007
|
+
projectId: Id4,
|
|
1008
|
+
hostId: Id4,
|
|
1009
|
+
path: z6.string(),
|
|
1010
|
+
commonDir: z6.string(),
|
|
1011
|
+
defaultBranch: z6.string(),
|
|
1001
1012
|
createdAt: Iso
|
|
1002
1013
|
});
|
|
1003
|
-
var GitState =
|
|
1004
|
-
dirty:
|
|
1005
|
-
changedFiles:
|
|
1006
|
-
ahead:
|
|
1007
|
-
behind:
|
|
1008
|
-
unmerged:
|
|
1009
|
-
});
|
|
1010
|
-
var Workspace =
|
|
1011
|
-
id:
|
|
1012
|
-
checkoutId:
|
|
1013
|
-
projectId:
|
|
1014
|
-
hostId:
|
|
1015
|
-
path:
|
|
1016
|
-
branch:
|
|
1017
|
-
baseBranch:
|
|
1018
|
-
provenance:
|
|
1014
|
+
var GitState = z6.object({
|
|
1015
|
+
dirty: z6.boolean(),
|
|
1016
|
+
changedFiles: z6.number().int(),
|
|
1017
|
+
ahead: z6.number().int(),
|
|
1018
|
+
behind: z6.number().int(),
|
|
1019
|
+
unmerged: z6.boolean()
|
|
1020
|
+
});
|
|
1021
|
+
var Workspace = z6.object({
|
|
1022
|
+
id: Id4,
|
|
1023
|
+
checkoutId: Id4,
|
|
1024
|
+
projectId: Id4,
|
|
1025
|
+
hostId: Id4,
|
|
1026
|
+
path: z6.string(),
|
|
1027
|
+
branch: z6.string().nullable(),
|
|
1028
|
+
baseBranch: z6.string().nullable(),
|
|
1029
|
+
provenance: z6.enum(["managed", "discovered", "main"]),
|
|
1019
1030
|
git: GitState,
|
|
1020
|
-
setup:
|
|
1021
|
-
state:
|
|
1022
|
-
log:
|
|
1031
|
+
setup: z6.object({
|
|
1032
|
+
state: z6.enum(["none", "running", "succeeded", "failed"]),
|
|
1033
|
+
log: z6.string()
|
|
1023
1034
|
}),
|
|
1024
1035
|
archivedAt: Iso.nullable(),
|
|
1025
1036
|
updatedAt: Iso,
|
|
1026
1037
|
github: WorkspaceGitHub.optional()
|
|
1027
1038
|
});
|
|
1028
|
-
var ThinkingLevel =
|
|
1029
|
-
var SessionModel =
|
|
1030
|
-
provider:
|
|
1031
|
-
id:
|
|
1032
|
-
name:
|
|
1033
|
-
contextWindow:
|
|
1034
|
-
reasoning:
|
|
1039
|
+
var ThinkingLevel = z6.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
1040
|
+
var SessionModel = z6.object({
|
|
1041
|
+
provider: z6.string(),
|
|
1042
|
+
id: z6.string(),
|
|
1043
|
+
name: z6.string().nullable(),
|
|
1044
|
+
contextWindow: z6.number().nullable(),
|
|
1045
|
+
reasoning: z6.boolean(),
|
|
1035
1046
|
/** In Pi's scoped (favorite) model list; set only when Pi has one. */
|
|
1036
|
-
scoped:
|
|
1047
|
+
scoped: z6.boolean().optional(),
|
|
1037
1048
|
/** Effort levels this model accepts, in Pi's order; ["off"] without reasoning. */
|
|
1038
|
-
thinkingLevels:
|
|
1049
|
+
thinkingLevels: z6.array(ThinkingLevel),
|
|
1039
1050
|
/** Prompt-cache lifetimes in seconds from Pi's model metadata. */
|
|
1040
|
-
promptCache:
|
|
1051
|
+
promptCache: z6.object({ short: z6.number().optional(), long: z6.number().optional() }).nullable().optional()
|
|
1041
1052
|
});
|
|
1042
|
-
var SlashCommand =
|
|
1043
|
-
name:
|
|
1044
|
-
description:
|
|
1045
|
-
source:
|
|
1046
|
-
argumentHint:
|
|
1053
|
+
var SlashCommand = z6.object({
|
|
1054
|
+
name: z6.string().min(1),
|
|
1055
|
+
description: z6.string().nullable(),
|
|
1056
|
+
source: z6.enum(["extension", "prompt", "skill"]),
|
|
1057
|
+
argumentHint: z6.string().nullable().optional()
|
|
1047
1058
|
});
|
|
1048
|
-
var ContextUsage =
|
|
1059
|
+
var ContextUsage = z6.object({
|
|
1049
1060
|
/** Estimated tokens in context; null right after compaction until the next reply. */
|
|
1050
|
-
tokens:
|
|
1051
|
-
window:
|
|
1052
|
-
percent:
|
|
1061
|
+
tokens: z6.number().nullable(),
|
|
1062
|
+
window: z6.number(),
|
|
1063
|
+
percent: z6.number().nullable()
|
|
1053
1064
|
});
|
|
1054
1065
|
var FORBIDDEN_EXTRA_ARGS = ["--mode", "--fork", "--no-session", "-e", "--extension"];
|
|
1055
|
-
var ExtraArg =
|
|
1056
|
-
var Profile =
|
|
1057
|
-
id:
|
|
1058
|
-
name:
|
|
1059
|
-
provider:
|
|
1060
|
-
model:
|
|
1066
|
+
var ExtraArg = z6.string().refine((a) => a.startsWith("--") || !a.startsWith("-"), "extra args must be long flags").refine((a) => !FORBIDDEN_EXTRA_ARGS.includes(a.split("=")[0]) && !a.startsWith("--session"), "this flag is managed by Switchyard");
|
|
1067
|
+
var Profile = z6.object({
|
|
1068
|
+
id: Id4,
|
|
1069
|
+
name: z6.string().min(1),
|
|
1070
|
+
provider: z6.string().nullable(),
|
|
1071
|
+
model: z6.string().nullable(),
|
|
1061
1072
|
thinking: ThinkingLevel.nullable(),
|
|
1062
|
-
projectTrust:
|
|
1063
|
-
extraArgs:
|
|
1073
|
+
projectTrust: z6.enum(["ask", "approve", "ignore"]),
|
|
1074
|
+
extraArgs: z6.array(ExtraArg),
|
|
1064
1075
|
/** "vanilla": --no-extensions --no-skills --no-prompt-templates. Undefined means "all". */
|
|
1065
|
-
resources:
|
|
1076
|
+
resources: z6.enum(["all", "vanilla"]).optional()
|
|
1066
1077
|
});
|
|
1067
|
-
var ViewClient =
|
|
1078
|
+
var ViewClient = z6.object({
|
|
1068
1079
|
/** `${kind}:${name}@${machine}` */
|
|
1069
|
-
id:
|
|
1070
|
-
kind:
|
|
1071
|
-
name:
|
|
1072
|
-
machine:
|
|
1080
|
+
id: z6.string().min(1),
|
|
1081
|
+
kind: z6.enum(["herdr", "tmux"]),
|
|
1082
|
+
name: z6.string().min(1),
|
|
1083
|
+
machine: z6.string().min(1),
|
|
1073
1084
|
lastSeenAt: Iso
|
|
1074
1085
|
});
|
|
1075
|
-
var View =
|
|
1076
|
-
id:
|
|
1077
|
-
name:
|
|
1078
|
-
mode:
|
|
1079
|
-
projectIds:
|
|
1080
|
-
hostIds:
|
|
1081
|
-
sessionIds:
|
|
1082
|
-
clients:
|
|
1086
|
+
var View = z6.object({
|
|
1087
|
+
id: Id4,
|
|
1088
|
+
name: z6.string().min(1).max(60),
|
|
1089
|
+
mode: z6.enum(["all", "pinned"]),
|
|
1090
|
+
projectIds: z6.array(z6.string()).nullable(),
|
|
1091
|
+
hostIds: z6.array(z6.string()).nullable(),
|
|
1092
|
+
sessionIds: z6.array(z6.string()),
|
|
1093
|
+
clients: z6.array(ViewClient),
|
|
1083
1094
|
createdAt: Iso,
|
|
1084
1095
|
updatedAt: Iso
|
|
1085
1096
|
});
|
|
1086
|
-
var RuntimeState =
|
|
1097
|
+
var RuntimeState = z6.enum([
|
|
1087
1098
|
"starting",
|
|
1088
1099
|
"idle",
|
|
1089
1100
|
"running",
|
|
@@ -1092,141 +1103,143 @@ var RuntimeState = z7.enum([
|
|
|
1092
1103
|
"failed",
|
|
1093
1104
|
"stopped"
|
|
1094
1105
|
]);
|
|
1095
|
-
var NativeHandle =
|
|
1096
|
-
var SessionStats =
|
|
1097
|
-
tokens:
|
|
1098
|
-
costUsd:
|
|
1106
|
+
var NativeHandle = z6.object({ sessionId: z6.string(), sessionFile: z6.string() });
|
|
1107
|
+
var SessionStats = z6.object({
|
|
1108
|
+
tokens: z6.number().nullable(),
|
|
1109
|
+
costUsd: z6.number().nullable(),
|
|
1099
1110
|
/** Completed usage, refreshed for this exact settlement; absent on older hosts or failure. */
|
|
1100
1111
|
watermark: CompletedUsageWatermark.optional(),
|
|
1101
1112
|
context: ContextUsage.nullable().optional()
|
|
1102
1113
|
});
|
|
1103
|
-
var PromptCacheInfo =
|
|
1114
|
+
var PromptCacheInfo = z6.object({
|
|
1104
1115
|
at: Iso,
|
|
1105
|
-
provider:
|
|
1106
|
-
model:
|
|
1107
|
-
cacheRead:
|
|
1108
|
-
cacheWrite:
|
|
1109
|
-
cacheWrite1h:
|
|
1110
|
-
});
|
|
1111
|
-
var Session =
|
|
1112
|
-
id:
|
|
1113
|
-
title:
|
|
1114
|
-
subtitle:
|
|
1115
|
-
hostId:
|
|
1116
|
-
workspaceId:
|
|
1117
|
-
projectId:
|
|
1118
|
-
cwd:
|
|
1116
|
+
provider: z6.string(),
|
|
1117
|
+
model: z6.string(),
|
|
1118
|
+
cacheRead: z6.number(),
|
|
1119
|
+
cacheWrite: z6.number(),
|
|
1120
|
+
cacheWrite1h: z6.number()
|
|
1121
|
+
});
|
|
1122
|
+
var Session = z6.object({
|
|
1123
|
+
id: Id4,
|
|
1124
|
+
title: z6.string(),
|
|
1125
|
+
subtitle: z6.string().nullable(),
|
|
1126
|
+
hostId: Id4,
|
|
1127
|
+
workspaceId: Id4.nullable(),
|
|
1128
|
+
projectId: Id4.nullable(),
|
|
1129
|
+
cwd: z6.string(),
|
|
1119
1130
|
nativeHandle: NativeHandle.nullable(),
|
|
1120
1131
|
profileSnapshot: Profile,
|
|
1121
1132
|
runtime: RuntimeState,
|
|
1122
|
-
runtimeDetail:
|
|
1133
|
+
runtimeDetail: z6.string().nullable(),
|
|
1123
1134
|
connectivity: Connectivity,
|
|
1124
|
-
runId:
|
|
1125
|
-
taskId:
|
|
1126
|
-
provenance:
|
|
1127
|
-
readOnly:
|
|
1135
|
+
runId: Id4.nullable(),
|
|
1136
|
+
taskId: Id4.nullable(),
|
|
1137
|
+
provenance: z6.enum(["created", "imported", "subagent"]),
|
|
1138
|
+
readOnly: z6.boolean(),
|
|
1128
1139
|
lastActivityAt: Iso,
|
|
1129
1140
|
archivedAt: Iso.nullable(),
|
|
1130
|
-
queue:
|
|
1141
|
+
queue: z6.object({ steering: z6.array(z6.string()), followUp: z6.array(z6.string()) }),
|
|
1131
1142
|
stats: SessionStats.nullable(),
|
|
1132
1143
|
/** The live model (host-owned; last known when stopped). */
|
|
1133
1144
|
model: SessionModel.nullable().optional(),
|
|
1134
1145
|
/** The live effort (Pi's thinking level). */
|
|
1135
1146
|
thinking: ThinkingLevel.nullable().optional(),
|
|
1136
1147
|
/** Pi is compacting the context. */
|
|
1137
|
-
compacting:
|
|
1138
|
-
lastAssistantText:
|
|
1148
|
+
compacting: z6.boolean().optional(),
|
|
1149
|
+
lastAssistantText: z6.string().nullable(),
|
|
1139
1150
|
createdAt: Iso,
|
|
1140
1151
|
/** A live terminal session: `switchyard tui` can attach to its Pi terminal. */
|
|
1141
|
-
terminal:
|
|
1152
|
+
terminal: z6.boolean().optional(),
|
|
1142
1153
|
/** Set when the session finished or failed with nobody viewing it; cleared when viewed (coordinator-owned). */
|
|
1143
1154
|
unreadSince: Iso.nullable().optional(),
|
|
1155
|
+
/** Identity of the adapter presentation currently installed on the host. */
|
|
1156
|
+
adapterGeneration: z6.string().uuid().optional(),
|
|
1144
1157
|
/** Bumped when the transcript is rebuilt (rewind); clients drop cached copies (coordinator-owned). */
|
|
1145
|
-
transcriptEpoch:
|
|
1146
|
-
bridge:
|
|
1147
|
-
version:
|
|
1148
|
-
runtimeId:
|
|
1149
|
-
nativeSessionId:
|
|
1158
|
+
transcriptEpoch: z6.number().int().min(0).optional(),
|
|
1159
|
+
bridge: z6.object({
|
|
1160
|
+
version: z6.literal(1),
|
|
1161
|
+
runtimeId: Id4,
|
|
1162
|
+
nativeSessionId: Id4,
|
|
1150
1163
|
/** Host-generated local-controller identity, not Pi's private binding credential. */
|
|
1151
|
-
controllerEpoch:
|
|
1152
|
-
agentTools:
|
|
1153
|
-
messageDelivery:
|
|
1154
|
-
policyState:
|
|
1155
|
-
policyPhases:
|
|
1164
|
+
controllerEpoch: Id4.optional(),
|
|
1165
|
+
agentTools: z6.boolean(),
|
|
1166
|
+
messageDelivery: z6.boolean(),
|
|
1167
|
+
policyState: z6.enum(["initializing", "active", "unsupported", "lost"]),
|
|
1168
|
+
policyPhases: z6.array(PolicyPhase)
|
|
1156
1169
|
}).optional(),
|
|
1157
1170
|
/** Last assistant message's cache usage (host-owned). */
|
|
1158
1171
|
promptCache: PromptCacheInfo.nullable().optional(),
|
|
1159
1172
|
/** Warn before the prompt cache expires; non-null means on (coordinator-owned). */
|
|
1160
|
-
cacheAlert:
|
|
1173
|
+
cacheAlert: z6.object({ ttlSec: z6.number().int().min(60).max(86400).nullable(), warnedFor: Iso.nullable() }).nullable().optional()
|
|
1161
1174
|
});
|
|
1162
|
-
var ContinuationPolicy =
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
enabled:
|
|
1166
|
-
objective:
|
|
1167
|
-
maxContinuations:
|
|
1168
|
-
maxElapsedMinutes:
|
|
1169
|
-
maxTokens:
|
|
1170
|
-
maxCostUsd:
|
|
1175
|
+
var ContinuationPolicy = z6.discriminatedUnion("enabled", [
|
|
1176
|
+
z6.object({ enabled: z6.literal(false) }),
|
|
1177
|
+
z6.object({
|
|
1178
|
+
enabled: z6.literal(true),
|
|
1179
|
+
objective: z6.string().min(1),
|
|
1180
|
+
maxContinuations: z6.number().int().min(1).max(50),
|
|
1181
|
+
maxElapsedMinutes: z6.number().int().min(1).max(1440),
|
|
1182
|
+
maxTokens: z6.number().int().positive().nullable(),
|
|
1183
|
+
maxCostUsd: z6.number().positive().nullable()
|
|
1171
1184
|
})
|
|
1172
1185
|
]);
|
|
1173
|
-
var CompletionPolicy =
|
|
1174
|
-
checks:
|
|
1175
|
-
requireHumanReview:
|
|
1186
|
+
var CompletionPolicy = z6.object({
|
|
1187
|
+
checks: z6.array(z6.string()).nullable(),
|
|
1188
|
+
requireHumanReview: z6.boolean()
|
|
1176
1189
|
});
|
|
1177
|
-
var WorkspacePolicy =
|
|
1178
|
-
|
|
1179
|
-
mode:
|
|
1180
|
-
branch:
|
|
1181
|
-
base:
|
|
1190
|
+
var WorkspacePolicy = z6.discriminatedUnion("mode", [
|
|
1191
|
+
z6.object({
|
|
1192
|
+
mode: z6.literal("new_worktree"),
|
|
1193
|
+
branch: z6.string().nullable(),
|
|
1194
|
+
base: z6.string().nullable()
|
|
1182
1195
|
}),
|
|
1183
|
-
|
|
1196
|
+
z6.object({ mode: z6.literal("existing"), workspaceId: Id4 })
|
|
1184
1197
|
]);
|
|
1185
|
-
var TaskPolicy =
|
|
1186
|
-
hostId:
|
|
1187
|
-
profileId:
|
|
1198
|
+
var TaskPolicy = z6.object({
|
|
1199
|
+
hostId: Id4.nullable(),
|
|
1200
|
+
profileId: Id4.nullable(),
|
|
1188
1201
|
workspace: WorkspacePolicy,
|
|
1189
1202
|
continuation: ContinuationPolicy,
|
|
1190
1203
|
completion: CompletionPolicy
|
|
1191
1204
|
});
|
|
1192
|
-
var TaskState =
|
|
1193
|
-
var Priority =
|
|
1194
|
-
var TaskOrigin =
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
kind:
|
|
1198
|
-
automationId:
|
|
1199
|
-
occurrenceId:
|
|
1200
|
-
routine:
|
|
1205
|
+
var TaskState = z6.enum(["backlog", "ready", "in_progress", "review", "done", "canceled"]);
|
|
1206
|
+
var Priority = z6.union([z6.literal(0), z6.literal(1), z6.literal(2), z6.literal(3)]);
|
|
1207
|
+
var TaskOrigin = z6.discriminatedUnion("kind", [
|
|
1208
|
+
z6.object({ kind: z6.literal("manual") }),
|
|
1209
|
+
z6.object({
|
|
1210
|
+
kind: z6.literal("automation"),
|
|
1211
|
+
automationId: Id4,
|
|
1212
|
+
occurrenceId: Id4,
|
|
1213
|
+
routine: z6.boolean()
|
|
1201
1214
|
})
|
|
1202
1215
|
]);
|
|
1203
|
-
var Task =
|
|
1204
|
-
id:
|
|
1205
|
-
projectId:
|
|
1206
|
-
title:
|
|
1207
|
-
objective:
|
|
1208
|
-
acceptanceCriteria:
|
|
1209
|
-
dependencies:
|
|
1216
|
+
var Task = z6.object({
|
|
1217
|
+
id: Id4,
|
|
1218
|
+
projectId: Id4,
|
|
1219
|
+
title: z6.string().min(1),
|
|
1220
|
+
objective: z6.string(),
|
|
1221
|
+
acceptanceCriteria: z6.array(z6.string()),
|
|
1222
|
+
dependencies: z6.array(Id4),
|
|
1210
1223
|
priority: Priority,
|
|
1211
|
-
position:
|
|
1224
|
+
position: z6.number(),
|
|
1212
1225
|
state: TaskState,
|
|
1213
|
-
blocked:
|
|
1226
|
+
blocked: z6.object({ reason: z6.string() }).nullable(),
|
|
1214
1227
|
notBefore: Iso.nullable(),
|
|
1215
1228
|
policy: TaskPolicy,
|
|
1216
1229
|
origin: TaskOrigin,
|
|
1217
|
-
groupingKey:
|
|
1218
|
-
parentTaskId:
|
|
1219
|
-
agentOrigin:
|
|
1230
|
+
groupingKey: z6.string().nullable(),
|
|
1231
|
+
parentTaskId: Id4.nullable().optional(),
|
|
1232
|
+
agentOrigin: z6.object({ sessionId: Id4, toolCallId: Id4 }).optional(),
|
|
1220
1233
|
githubIssue: GitHubIssue.optional(),
|
|
1221
|
-
currentRunId:
|
|
1222
|
-
sessionId:
|
|
1223
|
-
review:
|
|
1224
|
-
hiddenFromBoard:
|
|
1234
|
+
currentRunId: Id4.nullable(),
|
|
1235
|
+
sessionId: Id4.nullable(),
|
|
1236
|
+
review: z6.object({ feedback: z6.array(z6.string()), changesRequested: z6.boolean() }),
|
|
1237
|
+
hiddenFromBoard: z6.boolean(),
|
|
1225
1238
|
lastActivityAt: Iso,
|
|
1226
1239
|
createdAt: Iso,
|
|
1227
1240
|
updatedAt: Iso
|
|
1228
1241
|
});
|
|
1229
|
-
var RunState =
|
|
1242
|
+
var RunState = z6.enum([
|
|
1230
1243
|
"queued",
|
|
1231
1244
|
"dispatching",
|
|
1232
1245
|
"uncertain",
|
|
@@ -1238,79 +1251,79 @@ var RunState = z7.enum([
|
|
|
1238
1251
|
"interrupted",
|
|
1239
1252
|
"canceled"
|
|
1240
1253
|
]);
|
|
1241
|
-
var CheckResult =
|
|
1242
|
-
command:
|
|
1243
|
-
exitCode:
|
|
1244
|
-
outputTail:
|
|
1245
|
-
});
|
|
1246
|
-
var Run =
|
|
1247
|
-
id:
|
|
1248
|
-
taskId:
|
|
1249
|
-
sessionId:
|
|
1250
|
-
hostId:
|
|
1251
|
-
dispatchKey:
|
|
1252
|
-
attempt:
|
|
1254
|
+
var CheckResult = z6.object({
|
|
1255
|
+
command: z6.string(),
|
|
1256
|
+
exitCode: z6.number().int().nullable(),
|
|
1257
|
+
outputTail: z6.string()
|
|
1258
|
+
});
|
|
1259
|
+
var Run = z6.object({
|
|
1260
|
+
id: Id4,
|
|
1261
|
+
taskId: Id4,
|
|
1262
|
+
sessionId: Id4.nullable(),
|
|
1263
|
+
hostId: Id4.nullable(),
|
|
1264
|
+
dispatchKey: z6.string(),
|
|
1265
|
+
attempt: z6.number().int().min(1),
|
|
1253
1266
|
state: RunState,
|
|
1254
1267
|
controlMode: ControlMode,
|
|
1255
|
-
controlRevision:
|
|
1256
|
-
continuationsUsed:
|
|
1257
|
-
infraRetries:
|
|
1268
|
+
controlRevision: z6.number().int().min(1),
|
|
1269
|
+
continuationsUsed: z6.number().int().min(0),
|
|
1270
|
+
infraRetries: z6.number().int().min(0),
|
|
1258
1271
|
nextAttemptAt: Iso.nullable(),
|
|
1259
1272
|
startedAt: Iso.nullable(),
|
|
1260
1273
|
endedAt: Iso.nullable(),
|
|
1261
|
-
outcome:
|
|
1262
|
-
kind:
|
|
1263
|
-
summary:
|
|
1274
|
+
outcome: z6.object({
|
|
1275
|
+
kind: z6.enum(["review", "failed", "blocked", "no_change", "canceled"]),
|
|
1276
|
+
summary: z6.string()
|
|
1264
1277
|
}).nullable(),
|
|
1265
1278
|
limits: ContinuationPolicy,
|
|
1266
|
-
usage:
|
|
1267
|
-
tokens:
|
|
1268
|
-
costUsd:
|
|
1269
|
-
accounting:
|
|
1270
|
-
note:
|
|
1279
|
+
usage: z6.object({
|
|
1280
|
+
tokens: z6.number().nullable(),
|
|
1281
|
+
costUsd: z6.number().nullable(),
|
|
1282
|
+
accounting: z6.enum(["available", "unavailable"]),
|
|
1283
|
+
note: z6.string().nullable()
|
|
1271
1284
|
}),
|
|
1272
|
-
checks:
|
|
1285
|
+
checks: z6.array(CheckResult),
|
|
1273
1286
|
createdAt: Iso,
|
|
1274
1287
|
updatedAt: Iso
|
|
1275
1288
|
});
|
|
1276
|
-
var Trigger =
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1289
|
+
var Trigger = z6.discriminatedUnion("kind", [
|
|
1290
|
+
z6.object({ kind: z6.literal("manual") }),
|
|
1291
|
+
z6.object({ kind: z6.literal("once"), at: Iso }),
|
|
1292
|
+
z6.object({ kind: z6.literal("cron"), expr: z6.string().min(1), timezone: z6.string().min(1) }),
|
|
1293
|
+
z6.object({ kind: z6.literal("webhook") }),
|
|
1294
|
+
z6.object({ kind: z6.literal("dependency"), taskId: Id4 })
|
|
1282
1295
|
]);
|
|
1283
|
-
var TaskTemplate =
|
|
1284
|
-
title:
|
|
1285
|
-
objective:
|
|
1286
|
-
acceptanceCriteria:
|
|
1296
|
+
var TaskTemplate = z6.object({
|
|
1297
|
+
title: z6.string().min(1),
|
|
1298
|
+
objective: z6.string(),
|
|
1299
|
+
acceptanceCriteria: z6.array(z6.string()),
|
|
1287
1300
|
priority: Priority
|
|
1288
1301
|
});
|
|
1289
|
-
var Automation =
|
|
1290
|
-
id:
|
|
1291
|
-
name:
|
|
1292
|
-
enabled:
|
|
1293
|
-
projectId:
|
|
1302
|
+
var Automation = z6.object({
|
|
1303
|
+
id: Id4,
|
|
1304
|
+
name: z6.string().min(1),
|
|
1305
|
+
enabled: z6.boolean(),
|
|
1306
|
+
projectId: Id4,
|
|
1294
1307
|
trigger: Trigger,
|
|
1295
|
-
filters:
|
|
1308
|
+
filters: z6.array(z6.object({ path: z6.string(), equals: z6.string() })),
|
|
1296
1309
|
template: TaskTemplate,
|
|
1297
|
-
hostId:
|
|
1298
|
-
profileId:
|
|
1299
|
-
mode:
|
|
1300
|
-
groupingKey:
|
|
1301
|
-
overlap:
|
|
1302
|
-
missed:
|
|
1310
|
+
hostId: Id4.nullable(),
|
|
1311
|
+
profileId: Id4.nullable(),
|
|
1312
|
+
mode: z6.enum(["fresh", "continue", "watch"]),
|
|
1313
|
+
groupingKey: z6.string().nullable(),
|
|
1314
|
+
overlap: z6.enum(["skip", "queue_one", "append"]),
|
|
1315
|
+
missed: z6.enum(["skip", "run_once"]),
|
|
1303
1316
|
continuation: ContinuationPolicy,
|
|
1304
1317
|
completion: CompletionPolicy,
|
|
1305
1318
|
nextAt: Iso.nullable(),
|
|
1306
1319
|
lastEvaluatedAt: Iso.nullable(),
|
|
1307
|
-
lastOutcome:
|
|
1308
|
-
failureCount:
|
|
1309
|
-
webhookTokenSet:
|
|
1320
|
+
lastOutcome: z6.string().nullable(),
|
|
1321
|
+
failureCount: z6.number().int().min(0),
|
|
1322
|
+
webhookTokenSet: z6.boolean(),
|
|
1310
1323
|
createdAt: Iso,
|
|
1311
1324
|
updatedAt: Iso
|
|
1312
1325
|
});
|
|
1313
|
-
var OccurrenceState =
|
|
1326
|
+
var OccurrenceState = z6.enum([
|
|
1314
1327
|
"fired",
|
|
1315
1328
|
"skipped_overlap",
|
|
1316
1329
|
"skipped_missed",
|
|
@@ -1319,39 +1332,39 @@ var OccurrenceState = z7.enum([
|
|
|
1319
1332
|
"failed",
|
|
1320
1333
|
"filtered"
|
|
1321
1334
|
]);
|
|
1322
|
-
var Occurrence =
|
|
1323
|
-
id:
|
|
1324
|
-
automationId:
|
|
1325
|
-
key:
|
|
1335
|
+
var Occurrence = z6.object({
|
|
1336
|
+
id: Id4,
|
|
1337
|
+
automationId: Id4,
|
|
1338
|
+
key: z6.string(),
|
|
1326
1339
|
scheduledFor: Iso.nullable(),
|
|
1327
1340
|
state: OccurrenceState,
|
|
1328
|
-
taskId:
|
|
1329
|
-
reason:
|
|
1330
|
-
outcome:
|
|
1341
|
+
taskId: Id4.nullable(),
|
|
1342
|
+
reason: z6.string().nullable(),
|
|
1343
|
+
outcome: z6.string().nullable(),
|
|
1331
1344
|
createdAt: Iso
|
|
1332
1345
|
});
|
|
1333
|
-
var InteractionState =
|
|
1334
|
-
var Interaction =
|
|
1335
|
-
id:
|
|
1336
|
-
sessionId:
|
|
1337
|
-
revision:
|
|
1338
|
-
source:
|
|
1339
|
-
|
|
1340
|
-
kind:
|
|
1341
|
-
method:
|
|
1342
|
-
piRequestIds:
|
|
1346
|
+
var InteractionState = z6.preprocess((v) => v === "cancelled" ? "canceled" : v, z6.enum(["pending", "resolved", "expired", "canceled", "unsupported"]));
|
|
1347
|
+
var Interaction = z6.object({
|
|
1348
|
+
id: Id4,
|
|
1349
|
+
sessionId: Id4,
|
|
1350
|
+
revision: z6.number().int().min(1),
|
|
1351
|
+
source: z6.discriminatedUnion("kind", [
|
|
1352
|
+
z6.object({
|
|
1353
|
+
kind: z6.literal("extension_ui"),
|
|
1354
|
+
method: z6.enum(["select", "confirm", "input", "editor"]),
|
|
1355
|
+
piRequestIds: z6.array(z6.string())
|
|
1343
1356
|
}),
|
|
1344
|
-
|
|
1357
|
+
z6.object({ kind: z6.literal("unsupported_custom"), title: z6.string().nullable() })
|
|
1345
1358
|
]),
|
|
1346
|
-
adapterId:
|
|
1359
|
+
adapterId: z6.string().nullable(),
|
|
1347
1360
|
permission: PolicyPermission.optional(),
|
|
1348
|
-
title:
|
|
1361
|
+
title: z6.string(),
|
|
1349
1362
|
presentation: UINodeSchema,
|
|
1350
1363
|
state: InteractionState,
|
|
1351
|
-
resolution:
|
|
1364
|
+
resolution: z6.object({ by: z6.string(), summary: z6.string(), at: Iso }).nullable(),
|
|
1352
1365
|
createdAt: Iso
|
|
1353
1366
|
});
|
|
1354
|
-
var AttentionReason =
|
|
1367
|
+
var AttentionReason = z6.enum([
|
|
1355
1368
|
"needs_input",
|
|
1356
1369
|
"failed",
|
|
1357
1370
|
"ready_for_review",
|
|
@@ -1359,203 +1372,545 @@ var AttentionReason = z7.enum([
|
|
|
1359
1372
|
"host_unreachable",
|
|
1360
1373
|
"cache_expiring"
|
|
1361
1374
|
]);
|
|
1362
|
-
var AttentionItem =
|
|
1363
|
-
id:
|
|
1364
|
-
sessionId:
|
|
1365
|
-
taskId:
|
|
1366
|
-
projectId:
|
|
1375
|
+
var AttentionItem = z6.object({
|
|
1376
|
+
id: Id4,
|
|
1377
|
+
sessionId: Id4.nullable(),
|
|
1378
|
+
taskId: Id4.nullable(),
|
|
1379
|
+
projectId: Id4.nullable(),
|
|
1367
1380
|
reason: AttentionReason,
|
|
1368
|
-
severity:
|
|
1369
|
-
summary:
|
|
1370
|
-
interactionId:
|
|
1371
|
-
deepLink:
|
|
1381
|
+
severity: z6.enum(["info", "warning", "critical"]),
|
|
1382
|
+
summary: z6.string(),
|
|
1383
|
+
interactionId: Id4.nullable(),
|
|
1384
|
+
deepLink: z6.string(),
|
|
1372
1385
|
acknowledgedAt: Iso.nullable(),
|
|
1373
1386
|
resolvedAt: Iso.nullable(),
|
|
1374
1387
|
createdAt: Iso
|
|
1375
1388
|
});
|
|
1376
|
-
var Device =
|
|
1377
|
-
id:
|
|
1378
|
-
name:
|
|
1389
|
+
var Device = z6.object({
|
|
1390
|
+
id: Id4,
|
|
1391
|
+
name: z6.string(),
|
|
1379
1392
|
kind: DeviceKind,
|
|
1380
1393
|
createdAt: Iso,
|
|
1381
1394
|
lastSeenAt: Iso.nullable(),
|
|
1382
1395
|
revokedAt: Iso.nullable(),
|
|
1383
|
-
push:
|
|
1384
|
-
subscribed:
|
|
1385
|
-
permission:
|
|
1396
|
+
push: z6.object({
|
|
1397
|
+
subscribed: z6.boolean(),
|
|
1398
|
+
permission: z6.enum(["granted", "denied", "default", "unknown"])
|
|
1386
1399
|
}),
|
|
1387
|
-
preferredMobile:
|
|
1388
|
-
enrolledVia:
|
|
1389
|
-
});
|
|
1390
|
-
var ToolItemData =
|
|
1391
|
-
toolCallId:
|
|
1392
|
-
name:
|
|
1393
|
-
status:
|
|
1394
|
-
args:
|
|
1395
|
-
summary:
|
|
1396
|
-
output:
|
|
1400
|
+
preferredMobile: z6.boolean(),
|
|
1401
|
+
enrolledVia: z6.enum(["enrollment", "passkey", "oidc", "admin", "approval"]).default("enrollment")
|
|
1402
|
+
});
|
|
1403
|
+
var ToolItemData = z6.object({
|
|
1404
|
+
toolCallId: z6.string(),
|
|
1405
|
+
name: z6.string(),
|
|
1406
|
+
status: z6.enum(["running", "ok", "error"]),
|
|
1407
|
+
args: z6.unknown(),
|
|
1408
|
+
summary: z6.string(),
|
|
1409
|
+
output: z6.string(),
|
|
1397
1410
|
startedAt: Iso,
|
|
1398
|
-
durationMs:
|
|
1411
|
+
durationMs: z6.number().nullable(),
|
|
1399
1412
|
card: UINodeSchema.nullable(),
|
|
1400
|
-
adapterId:
|
|
1413
|
+
adapterId: z6.string().nullable(),
|
|
1414
|
+
adapterGeneration: z6.string().uuid().optional()
|
|
1401
1415
|
});
|
|
1402
|
-
var TranscriptItem =
|
|
1403
|
-
|
|
1404
|
-
id:
|
|
1405
|
-
sessionId:
|
|
1406
|
-
order:
|
|
1416
|
+
var TranscriptItem = z6.discriminatedUnion("kind", [
|
|
1417
|
+
z6.object({
|
|
1418
|
+
id: Id4,
|
|
1419
|
+
sessionId: Id4,
|
|
1420
|
+
order: z6.number().int(),
|
|
1407
1421
|
at: Iso,
|
|
1408
|
-
kind:
|
|
1409
|
-
data:
|
|
1410
|
-
text:
|
|
1411
|
-
images:
|
|
1422
|
+
kind: z6.literal("user"),
|
|
1423
|
+
data: z6.object({
|
|
1424
|
+
text: z6.string(),
|
|
1425
|
+
images: z6.number().int().optional(),
|
|
1412
1426
|
/** Pi session entry id, for rewind and fork from this message. */
|
|
1413
|
-
entryId:
|
|
1427
|
+
entryId: z6.string().optional()
|
|
1414
1428
|
})
|
|
1415
1429
|
}),
|
|
1416
|
-
|
|
1417
|
-
id:
|
|
1418
|
-
sessionId:
|
|
1419
|
-
order:
|
|
1430
|
+
z6.object({
|
|
1431
|
+
id: Id4,
|
|
1432
|
+
sessionId: Id4,
|
|
1433
|
+
order: z6.number().int(),
|
|
1420
1434
|
at: Iso,
|
|
1421
|
-
kind:
|
|
1422
|
-
data:
|
|
1435
|
+
kind: z6.literal("assistant"),
|
|
1436
|
+
data: z6.object({ text: z6.string(), streaming: z6.boolean().optional() })
|
|
1423
1437
|
}),
|
|
1424
|
-
|
|
1425
|
-
id:
|
|
1426
|
-
sessionId:
|
|
1427
|
-
order:
|
|
1438
|
+
z6.object({
|
|
1439
|
+
id: Id4,
|
|
1440
|
+
sessionId: Id4,
|
|
1441
|
+
order: z6.number().int(),
|
|
1428
1442
|
at: Iso,
|
|
1429
|
-
kind:
|
|
1430
|
-
data:
|
|
1443
|
+
kind: z6.literal("thinking"),
|
|
1444
|
+
data: z6.object({ text: z6.string() })
|
|
1431
1445
|
}),
|
|
1432
|
-
|
|
1433
|
-
id:
|
|
1434
|
-
sessionId:
|
|
1435
|
-
order:
|
|
1446
|
+
z6.object({
|
|
1447
|
+
id: Id4,
|
|
1448
|
+
sessionId: Id4,
|
|
1449
|
+
order: z6.number().int(),
|
|
1436
1450
|
at: Iso,
|
|
1437
|
-
kind:
|
|
1451
|
+
kind: z6.literal("tool"),
|
|
1438
1452
|
data: ToolItemData
|
|
1439
1453
|
}),
|
|
1440
|
-
|
|
1441
|
-
id:
|
|
1442
|
-
sessionId:
|
|
1443
|
-
order:
|
|
1454
|
+
z6.object({
|
|
1455
|
+
id: Id4,
|
|
1456
|
+
sessionId: Id4,
|
|
1457
|
+
order: z6.number().int(),
|
|
1444
1458
|
at: Iso,
|
|
1445
|
-
kind:
|
|
1446
|
-
data:
|
|
1459
|
+
kind: z6.literal("notice"),
|
|
1460
|
+
data: z6.object({
|
|
1447
1461
|
level: DiagnosticLevel,
|
|
1448
|
-
text:
|
|
1449
|
-
customType:
|
|
1462
|
+
text: z6.string(),
|
|
1463
|
+
customType: z6.string().min(1).max(200).optional(),
|
|
1450
1464
|
card: UINodeSchema.optional(),
|
|
1451
|
-
adapterId:
|
|
1465
|
+
adapterId: z6.string().optional(),
|
|
1466
|
+
adapterGeneration: z6.string().uuid().optional()
|
|
1452
1467
|
}).refine((data) => !data.card || !!data.adapterId, "Card requires adapterId")
|
|
1453
1468
|
}),
|
|
1454
|
-
|
|
1455
|
-
id:
|
|
1456
|
-
sessionId:
|
|
1457
|
-
order:
|
|
1469
|
+
z6.object({
|
|
1470
|
+
id: Id4,
|
|
1471
|
+
sessionId: Id4,
|
|
1472
|
+
order: z6.number().int(),
|
|
1458
1473
|
at: Iso,
|
|
1459
|
-
kind:
|
|
1460
|
-
data:
|
|
1474
|
+
kind: z6.literal("interaction"),
|
|
1475
|
+
data: z6.object({ interactionId: Id4 })
|
|
1461
1476
|
}),
|
|
1462
|
-
|
|
1463
|
-
id:
|
|
1464
|
-
sessionId:
|
|
1465
|
-
order:
|
|
1477
|
+
z6.object({
|
|
1478
|
+
id: Id4,
|
|
1479
|
+
sessionId: Id4,
|
|
1480
|
+
order: z6.number().int(),
|
|
1466
1481
|
at: Iso,
|
|
1467
|
-
kind:
|
|
1468
|
-
data:
|
|
1469
|
-
runId:
|
|
1470
|
-
label:
|
|
1471
|
-
status:
|
|
1472
|
-
sessionFile:
|
|
1473
|
-
linkedSessionId:
|
|
1482
|
+
kind: z6.literal("subagent"),
|
|
1483
|
+
data: z6.object({
|
|
1484
|
+
runId: z6.string(),
|
|
1485
|
+
label: z6.string(),
|
|
1486
|
+
status: z6.string(),
|
|
1487
|
+
sessionFile: z6.string().nullable(),
|
|
1488
|
+
linkedSessionId: Id4.nullable()
|
|
1474
1489
|
})
|
|
1475
1490
|
}),
|
|
1476
|
-
|
|
1477
|
-
id:
|
|
1478
|
-
sessionId:
|
|
1479
|
-
order:
|
|
1491
|
+
z6.object({
|
|
1492
|
+
id: Id4,
|
|
1493
|
+
sessionId: Id4,
|
|
1494
|
+
order: z6.number().int(),
|
|
1480
1495
|
at: Iso,
|
|
1481
|
-
kind:
|
|
1482
|
-
data:
|
|
1496
|
+
kind: z6.literal("system"),
|
|
1497
|
+
data: z6.object({ text: z6.string(), suggestion: z6.boolean().optional() })
|
|
1483
1498
|
})
|
|
1484
1499
|
]);
|
|
1485
|
-
var Panel =
|
|
1486
|
-
sessionId:
|
|
1487
|
-
adapterId:
|
|
1488
|
-
slot:
|
|
1489
|
-
title:
|
|
1500
|
+
var Panel = z6.object({
|
|
1501
|
+
sessionId: Id4,
|
|
1502
|
+
adapterId: z6.string(),
|
|
1503
|
+
slot: z6.string(),
|
|
1504
|
+
title: z6.string(),
|
|
1490
1505
|
node: UINodeSchema.nullable(),
|
|
1491
|
-
webRenderer:
|
|
1492
|
-
mobileFallback:
|
|
1506
|
+
webRenderer: z6.boolean(),
|
|
1507
|
+
mobileFallback: z6.string().nullable(),
|
|
1493
1508
|
contribution: ContributionDescriptor.optional(),
|
|
1494
|
-
state:
|
|
1509
|
+
state: z6.unknown().optional(),
|
|
1510
|
+
adapterGeneration: z6.string().uuid().optional(),
|
|
1495
1511
|
updatedAt: Iso
|
|
1496
1512
|
});
|
|
1497
|
-
var Diagnostic =
|
|
1498
|
-
sessionId:
|
|
1499
|
-
adapterId:
|
|
1513
|
+
var Diagnostic = z6.object({
|
|
1514
|
+
sessionId: Id4.nullable(),
|
|
1515
|
+
adapterId: z6.string().nullable(),
|
|
1500
1516
|
level: DiagnosticLevel,
|
|
1501
|
-
message:
|
|
1517
|
+
message: z6.string(),
|
|
1502
1518
|
at: Iso
|
|
1503
1519
|
});
|
|
1504
|
-
var AdapterInfo =
|
|
1505
|
-
id:
|
|
1506
|
-
version:
|
|
1507
|
-
tier:
|
|
1508
|
-
target:
|
|
1509
|
-
extension:
|
|
1510
|
-
versionRange:
|
|
1511
|
-
testedVersions:
|
|
1520
|
+
var AdapterInfo = z6.object({
|
|
1521
|
+
id: z6.string(),
|
|
1522
|
+
version: z6.string(),
|
|
1523
|
+
tier: z6.enum(["project", "owner", "plugin", "bundled"]),
|
|
1524
|
+
target: z6.object({
|
|
1525
|
+
extension: z6.string(),
|
|
1526
|
+
versionRange: z6.string(),
|
|
1527
|
+
testedVersions: z6.array(z6.string())
|
|
1512
1528
|
}),
|
|
1513
|
-
capabilities:
|
|
1514
|
-
webRenderer:
|
|
1515
|
-
status:
|
|
1516
|
-
detail:
|
|
1517
|
-
});
|
|
1518
|
-
var Passkey =
|
|
1519
|
-
id:
|
|
1520
|
-
name:
|
|
1529
|
+
capabilities: z6.array(z6.string()),
|
|
1530
|
+
webRenderer: z6.boolean(),
|
|
1531
|
+
status: z6.enum(["active", "disabled", "error"]),
|
|
1532
|
+
detail: z6.string().nullable()
|
|
1533
|
+
});
|
|
1534
|
+
var Passkey = z6.object({
|
|
1535
|
+
id: z6.string(),
|
|
1536
|
+
name: z6.string(),
|
|
1521
1537
|
createdAt: Iso,
|
|
1522
1538
|
lastUsedAt: Iso.nullable(),
|
|
1523
|
-
transports:
|
|
1539
|
+
transports: z6.array(z6.string())
|
|
1540
|
+
});
|
|
1541
|
+
|
|
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
|
|
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
|
+
}
|
|
1524
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";
|
|
1525
1880
|
|
|
1526
1881
|
// packages/protocol/dist/host-wire.js
|
|
1527
|
-
import { z as
|
|
1882
|
+
import { z as z12 } from "zod";
|
|
1528
1883
|
|
|
1529
1884
|
// packages/protocol/dist/events.js
|
|
1530
|
-
import { z as
|
|
1885
|
+
import { z as z10 } from "zod";
|
|
1531
1886
|
var EventDataSchemas = {
|
|
1532
1887
|
"host.updated": Host,
|
|
1533
1888
|
"project.updated": Project,
|
|
1534
|
-
"project.deleted":
|
|
1889
|
+
"project.deleted": z10.object({ id: z10.string() }),
|
|
1535
1890
|
"checkout.updated": Checkout,
|
|
1536
1891
|
"workspace.updated": Workspace,
|
|
1537
|
-
"workspace.deleted":
|
|
1892
|
+
"workspace.deleted": z10.object({ id: z10.string() }),
|
|
1538
1893
|
"profile.updated": Profile,
|
|
1539
|
-
"profile.deleted":
|
|
1894
|
+
"profile.deleted": z10.object({ id: z10.string() }),
|
|
1540
1895
|
"view.updated": View,
|
|
1541
|
-
"view.deleted":
|
|
1896
|
+
"view.deleted": z10.object({ id: z10.string() }),
|
|
1542
1897
|
"session.updated": Session,
|
|
1543
1898
|
"transcript.item": TranscriptItem,
|
|
1544
|
-
"transcript.reset":
|
|
1899
|
+
"transcript.reset": z10.object({ sessionId: z10.string(), epoch: z10.number().int() }),
|
|
1545
1900
|
"interaction.updated": Interaction,
|
|
1546
1901
|
"panel.updated": Panel,
|
|
1547
|
-
"adapters.updated":
|
|
1902
|
+
"adapters.updated": z10.object({ hostId: z10.string(), adapters: z10.array(AdapterInfo) }),
|
|
1548
1903
|
diagnostic: Diagnostic,
|
|
1549
1904
|
"task.updated": Task,
|
|
1550
|
-
"task.deleted":
|
|
1905
|
+
"task.deleted": z10.object({ id: z10.string() }),
|
|
1551
1906
|
"run.updated": Run,
|
|
1552
1907
|
"automation.updated": Automation,
|
|
1553
|
-
"automation.deleted":
|
|
1908
|
+
"automation.deleted": z10.object({ id: z10.string() }),
|
|
1554
1909
|
"occurrence.created": Occurrence,
|
|
1555
1910
|
"occurrence.updated": Occurrence,
|
|
1556
1911
|
"attention.updated": AttentionItem,
|
|
1557
1912
|
"device.updated": Device,
|
|
1558
|
-
"settings.updated":
|
|
1913
|
+
"settings.updated": z10.object({ dispatchPaused: z10.boolean() })
|
|
1559
1914
|
};
|
|
1560
1915
|
var EVENT_TYPES = Object.keys(EventDataSchemas);
|
|
1561
1916
|
var LEGACY_EVENT_TYPES = {
|
|
@@ -1565,19 +1920,19 @@ function canonicalEventType(type) {
|
|
|
1565
1920
|
return LEGACY_EVENT_TYPES[type] ?? type;
|
|
1566
1921
|
}
|
|
1567
1922
|
var canonical = (v) => typeof v === "string" ? canonicalEventType(v) : v;
|
|
1568
|
-
var EventTypeSchema =
|
|
1569
|
-
var EventScope =
|
|
1570
|
-
hostId:
|
|
1571
|
-
sessionId:
|
|
1572
|
-
taskId:
|
|
1573
|
-
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()
|
|
1574
1929
|
});
|
|
1575
1930
|
var EventEnvelope = EventScope.extend({
|
|
1576
|
-
seq:
|
|
1577
|
-
id:
|
|
1931
|
+
seq: z10.number().int(),
|
|
1932
|
+
id: z10.string(),
|
|
1578
1933
|
type: EventTypeSchema,
|
|
1579
|
-
at:
|
|
1580
|
-
data:
|
|
1934
|
+
at: z10.string(),
|
|
1935
|
+
data: z10.unknown()
|
|
1581
1936
|
});
|
|
1582
1937
|
var HOST_EVENT_TYPES = [
|
|
1583
1938
|
"session.updated",
|
|
@@ -1590,318 +1945,321 @@ var HOST_EVENT_TYPES = [
|
|
|
1590
1945
|
"workspace.deleted"
|
|
1591
1946
|
];
|
|
1592
1947
|
var HostEvent = EventScope.extend({
|
|
1593
|
-
eventId:
|
|
1594
|
-
type:
|
|
1595
|
-
at:
|
|
1596
|
-
data:
|
|
1597
|
-
});
|
|
1598
|
-
var StreamDelta =
|
|
1599
|
-
sessionId:
|
|
1600
|
-
itemId:
|
|
1601
|
-
kind:
|
|
1602
|
-
delta:
|
|
1603
|
-
order:
|
|
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()
|
|
1604
1959
|
});
|
|
1605
1960
|
|
|
1606
1961
|
// packages/protocol/dist/terminal-wire.js
|
|
1607
|
-
import { z as
|
|
1608
|
-
var Cols =
|
|
1609
|
-
var Rows =
|
|
1610
|
-
var TermViewerToServer =
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
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") })
|
|
1614
1969
|
]);
|
|
1615
|
-
var TermServerToViewer =
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
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() })
|
|
1619
1974
|
]);
|
|
1620
|
-
var TermCoordinatorMsg =
|
|
1621
|
-
|
|
1622
|
-
t:
|
|
1623
|
-
sessionId:
|
|
1975
|
+
var TermCoordinatorMsg = z11.discriminatedUnion("t", [
|
|
1976
|
+
z11.object({
|
|
1977
|
+
t: z11.literal("open"),
|
|
1978
|
+
sessionId: z11.string(),
|
|
1624
1979
|
cols: Cols,
|
|
1625
1980
|
rows: Rows,
|
|
1626
|
-
passive:
|
|
1981
|
+
passive: z11.boolean().optional()
|
|
1627
1982
|
}),
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
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") })
|
|
1632
1987
|
]);
|
|
1633
1988
|
|
|
1634
1989
|
// packages/protocol/dist/host-wire.js
|
|
1635
|
-
var Origin =
|
|
1636
|
-
var HostCommand =
|
|
1637
|
-
|
|
1638
|
-
type:
|
|
1639
|
-
sessionId:
|
|
1640
|
-
title:
|
|
1641
|
-
workspacePath:
|
|
1642
|
-
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(),
|
|
1643
1998
|
profile: Profile,
|
|
1644
1999
|
nativeHandle: NativeHandle.nullable(),
|
|
1645
|
-
initialPrompt:
|
|
1646
|
-
dispatchKey:
|
|
1647
|
-
controlRevision:
|
|
2000
|
+
initialPrompt: z12.string().nullable(),
|
|
2001
|
+
dispatchKey: z12.string().nullable(),
|
|
2002
|
+
controlRevision: z12.number().int(),
|
|
1648
2003
|
controlMode: ControlMode,
|
|
1649
2004
|
origin: Origin,
|
|
1650
|
-
readOnly:
|
|
1651
|
-
policyRequired:
|
|
2005
|
+
readOnly: z12.boolean().default(false),
|
|
2006
|
+
policyRequired: z12.boolean().optional()
|
|
1652
2007
|
}),
|
|
1653
|
-
|
|
1654
|
-
type:
|
|
1655
|
-
sessionId:
|
|
1656
|
-
messageId:
|
|
1657
|
-
payload:
|
|
1658
|
-
deliveryId:
|
|
1659
|
-
kind:
|
|
1660
|
-
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()
|
|
1661
2016
|
}),
|
|
1662
|
-
mode:
|
|
1663
|
-
holdUntil:
|
|
2017
|
+
mode: z12.enum(["steer", "queue"]),
|
|
2018
|
+
holdUntil: z12.string()
|
|
1664
2019
|
}),
|
|
1665
|
-
HostPolicySampleRequest.extend({ type:
|
|
1666
|
-
|
|
1667
|
-
type:
|
|
1668
|
-
sessionId:
|
|
1669
|
-
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)
|
|
1670
2025
|
}),
|
|
1671
|
-
|
|
1672
|
-
type:
|
|
1673
|
-
sessionId:
|
|
1674
|
-
text:
|
|
1675
|
-
images:
|
|
1676
|
-
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"]),
|
|
1677
2032
|
origin: Origin,
|
|
1678
|
-
controlRevision:
|
|
2033
|
+
controlRevision: z12.number().int()
|
|
1679
2034
|
}),
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
type:
|
|
1684
|
-
sessionId:
|
|
1685
|
-
interactionId:
|
|
1686
|
-
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(),
|
|
1687
2042
|
response: InteractionResponseSchema,
|
|
1688
|
-
deviceId:
|
|
2043
|
+
deviceId: z12.string()
|
|
1689
2044
|
}),
|
|
1690
|
-
|
|
1691
|
-
type:
|
|
1692
|
-
sessionId:
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
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()
|
|
1696
2052
|
}),
|
|
1697
|
-
|
|
1698
|
-
type:
|
|
1699
|
-
sessionId:
|
|
1700
|
-
controlRevision:
|
|
2053
|
+
z12.object({
|
|
2054
|
+
type: z12.literal("session.setControl"),
|
|
2055
|
+
sessionId: z12.string(),
|
|
2056
|
+
controlRevision: z12.number().int(),
|
|
1701
2057
|
mode: ControlMode
|
|
1702
2058
|
}),
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
type:
|
|
1711
|
-
sessionId:
|
|
1712
|
-
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)
|
|
1713
2069
|
}),
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
type:
|
|
1717
|
-
sessionId:
|
|
1718
|
-
entryId:
|
|
1719
|
-
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()
|
|
1720
2076
|
}),
|
|
1721
|
-
|
|
1722
|
-
type:
|
|
1723
|
-
sessionId:
|
|
1724
|
-
entryId:
|
|
1725
|
-
summarize:
|
|
1726
|
-
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()
|
|
1727
2083
|
}),
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
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)
|
|
1735
2093
|
}),
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
type:
|
|
1739
|
-
sessionId:
|
|
1740
|
-
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()
|
|
1741
2099
|
}),
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
type:
|
|
1746
|
-
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)
|
|
1747
2105
|
}),
|
|
1748
|
-
|
|
1749
|
-
type:
|
|
1750
|
-
checkoutPath:
|
|
1751
|
-
worktreeDir:
|
|
2106
|
+
z12.object({
|
|
2107
|
+
type: z12.literal("workspace.discover"),
|
|
2108
|
+
checkoutPath: z12.string(),
|
|
2109
|
+
worktreeDir: z12.string().default(DEFAULT_WORKTREE_DIR)
|
|
1752
2110
|
}),
|
|
1753
|
-
|
|
1754
|
-
type:
|
|
1755
|
-
checkoutPath:
|
|
1756
|
-
branch:
|
|
1757
|
-
base:
|
|
1758
|
-
setupCommand:
|
|
1759
|
-
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)
|
|
1760
2118
|
}),
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
type:
|
|
1764
|
-
path:
|
|
1765
|
-
checkoutPath:
|
|
1766
|
-
base:
|
|
1767
|
-
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() })
|
|
1768
2126
|
}),
|
|
1769
|
-
|
|
1770
|
-
type:
|
|
1771
|
-
path:
|
|
1772
|
-
base:
|
|
1773
|
-
file:
|
|
2127
|
+
z12.object({
|
|
2128
|
+
type: z12.literal("workspace.diff"),
|
|
2129
|
+
path: z12.string(),
|
|
2130
|
+
base: z12.string().nullable(),
|
|
2131
|
+
file: z12.string().nullable()
|
|
1774
2132
|
}),
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
GitHubHostViewRequest.extend({ type:
|
|
1778
|
-
GitHubHostLogsRequest.extend({ type:
|
|
1779
|
-
GitHubHostMergeRequest.extend({ type:
|
|
1780
|
-
|
|
1781
|
-
type:
|
|
1782
|
-
dispatchKey:
|
|
1783
|
-
runId:
|
|
1784
|
-
taskId:
|
|
1785
|
-
sessionId:
|
|
1786
|
-
projectId:
|
|
1787
|
-
title:
|
|
1788
|
-
workspace:
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
createFrom:
|
|
1792
|
-
checkoutPath:
|
|
1793
|
-
branch:
|
|
1794
|
-
base:
|
|
1795
|
-
setupCommand:
|
|
1796
|
-
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)
|
|
1797
2155
|
})
|
|
1798
2156
|
})
|
|
1799
2157
|
]),
|
|
1800
2158
|
nativeHandle: NativeHandle.nullable(),
|
|
1801
2159
|
profile: Profile,
|
|
1802
|
-
prompt:
|
|
2160
|
+
prompt: z12.string(),
|
|
1803
2161
|
/** The launch's own revision; a takeover always carries a newer one. */
|
|
1804
|
-
controlRevision:
|
|
2162
|
+
controlRevision: z12.number().int(),
|
|
1805
2163
|
controlMode: ControlMode.default("automation"),
|
|
1806
|
-
policyRequired:
|
|
2164
|
+
policyRequired: z12.boolean().optional()
|
|
1807
2165
|
}),
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
type:
|
|
1811
|
-
sessionId:
|
|
1812
|
-
path:
|
|
1813
|
-
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())
|
|
1814
2172
|
})
|
|
1815
2173
|
]);
|
|
1816
|
-
var ImportableSession =
|
|
1817
|
-
sessionFile:
|
|
1818
|
-
sessionId:
|
|
1819
|
-
cwd:
|
|
1820
|
-
name:
|
|
1821
|
-
mtime:
|
|
1822
|
-
inactive:
|
|
1823
|
-
});
|
|
1824
|
-
var DiscoveredWorktree =
|
|
1825
|
-
path:
|
|
1826
|
-
head:
|
|
1827
|
-
branch:
|
|
1828
|
-
bare:
|
|
1829
|
-
detached:
|
|
1830
|
-
locked:
|
|
1831
|
-
prunable:
|
|
1832
|
-
provenance:
|
|
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"]),
|
|
1833
2191
|
git: GitState.nullable()
|
|
1834
2192
|
});
|
|
1835
|
-
var CheckoutInfo =
|
|
1836
|
-
root:
|
|
1837
|
-
commonDir:
|
|
1838
|
-
repoIdentity:
|
|
1839
|
-
defaultBranch:
|
|
2193
|
+
var CheckoutInfo = z12.object({
|
|
2194
|
+
root: z12.string(),
|
|
2195
|
+
commonDir: z12.string(),
|
|
2196
|
+
repoIdentity: z12.string(),
|
|
2197
|
+
defaultBranch: z12.string()
|
|
1840
2198
|
});
|
|
1841
|
-
var ScannedRepository = CheckoutInfo.extend({ name:
|
|
1842
|
-
var ProjectFolderScan =
|
|
2199
|
+
var ScannedRepository = CheckoutInfo.extend({ name: z12.string() });
|
|
2200
|
+
var ProjectFolderScan = z12.object({
|
|
1843
2201
|
/** The folder, ~ expanded and realpath'd. */
|
|
1844
|
-
folder:
|
|
1845
|
-
repositories:
|
|
1846
|
-
});
|
|
1847
|
-
var ProjectSuggestion =
|
|
1848
|
-
rootPath:
|
|
1849
|
-
sessionCount:
|
|
1850
|
-
lastActivityAt:
|
|
1851
|
-
});
|
|
1852
|
-
var ProjectSuggestions =
|
|
1853
|
-
var DiffFile =
|
|
1854
|
-
path:
|
|
1855
|
-
oldPath:
|
|
1856
|
-
added:
|
|
1857
|
-
deleted:
|
|
1858
|
-
status:
|
|
1859
|
-
});
|
|
1860
|
-
var DiffResult =
|
|
1861
|
-
base:
|
|
1862
|
-
files:
|
|
1863
|
-
patch:
|
|
1864
|
-
});
|
|
1865
|
-
var FileEntry =
|
|
1866
|
-
name:
|
|
1867
|
-
path:
|
|
1868
|
-
kind:
|
|
1869
|
-
size:
|
|
1870
|
-
});
|
|
1871
|
-
var ReconcileResult =
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
known:
|
|
1875
|
-
sessionId:
|
|
1876
|
-
state:
|
|
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"]),
|
|
1877
2235
|
runtime: RuntimeState.nullable(),
|
|
1878
|
-
workspacePath:
|
|
2236
|
+
workspacePath: z12.string().nullable(),
|
|
1879
2237
|
nativeHandle: NativeHandle.nullable(),
|
|
1880
|
-
error:
|
|
2238
|
+
error: z12.string().nullable(),
|
|
1881
2239
|
/** `{started: "unknown"}` when the host restarted after Pi may have been spawned. */
|
|
1882
|
-
errorDetails:
|
|
2240
|
+
errorDetails: z12.record(z12.string(), z12.unknown()).nullable().default(null)
|
|
1883
2241
|
})
|
|
1884
2242
|
]);
|
|
1885
|
-
var DispatchStartResult =
|
|
1886
|
-
sessionId:
|
|
1887
|
-
workspacePath:
|
|
2243
|
+
var DispatchStartResult = z12.object({
|
|
2244
|
+
sessionId: z12.string(),
|
|
2245
|
+
workspacePath: z12.string(),
|
|
1888
2246
|
nativeHandle: NativeHandle.nullable(),
|
|
1889
|
-
reused:
|
|
2247
|
+
reused: z12.boolean(),
|
|
1890
2248
|
/** Why the launch prompt was not delivered to Pi (the session itself started), if it was not. */
|
|
1891
|
-
promptError:
|
|
2249
|
+
promptError: z12.string().nullable().optional()
|
|
1892
2250
|
});
|
|
1893
|
-
var AnswerResult =
|
|
1894
|
-
status:
|
|
2251
|
+
var AnswerResult = z12.object({
|
|
2252
|
+
status: z12.enum(["answered", "already_answered"]),
|
|
1895
2253
|
interaction: Interaction
|
|
1896
2254
|
});
|
|
1897
|
-
var SnapshotResult =
|
|
1898
|
-
partial:
|
|
1899
|
-
pendingInteractions:
|
|
2255
|
+
var SnapshotResult = z12.object({
|
|
2256
|
+
partial: z12.array(TranscriptItem),
|
|
2257
|
+
pendingInteractions: z12.array(Interaction)
|
|
1900
2258
|
});
|
|
1901
|
-
var ChecksResult =
|
|
1902
|
-
var Receipt =
|
|
1903
|
-
|
|
1904
|
-
|
|
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 })
|
|
1905
2263
|
]);
|
|
1906
2264
|
var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
1907
2265
|
policyContext: HostToolPolicyContext.optional()
|
|
@@ -1920,278 +2278,279 @@ var HostAgentRequestFrame = AgentRequestFrame.safeExtend({
|
|
|
1920
2278
|
}
|
|
1921
2279
|
ctx.addIssue({ code: "custom", message: "Host agent frame exceeds 128 KiB or is not JSON." });
|
|
1922
2280
|
});
|
|
1923
|
-
var HostToCoordinator =
|
|
1924
|
-
|
|
1925
|
-
type:
|
|
1926
|
-
hostId:
|
|
1927
|
-
credential:
|
|
1928
|
-
name:
|
|
1929
|
-
agentVersion:
|
|
1930
|
-
piVersion:
|
|
1931
|
-
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(),
|
|
1932
2290
|
platform: Platform,
|
|
1933
2291
|
capabilities: RuntimeCapabilities.nullable(),
|
|
1934
2292
|
github: HostGitHub.optional(),
|
|
1935
|
-
protocolVersion:
|
|
1936
|
-
features:
|
|
2293
|
+
protocolVersion: z12.number().int(),
|
|
2294
|
+
features: z12.array(z12.string()).optional()
|
|
1937
2295
|
}),
|
|
1938
2296
|
HostAgentRequestFrame,
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
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 })
|
|
1945
2303
|
]);
|
|
1946
|
-
var CoordinatorToHost =
|
|
1947
|
-
|
|
1948
|
-
type:
|
|
1949
|
-
coordinatorVersion:
|
|
1950
|
-
ackedHostSeq:
|
|
1951
|
-
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()
|
|
1952
2310
|
}),
|
|
1953
2311
|
AgentResultFrame,
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
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 })
|
|
1959
2317
|
]);
|
|
1960
2318
|
|
|
1961
2319
|
// packages/protocol/dist/api.js
|
|
1962
|
-
var EnrollRequest =
|
|
1963
|
-
token:
|
|
1964
|
-
name:
|
|
2320
|
+
var EnrollRequest = z13.object({
|
|
2321
|
+
token: z13.string().min(1),
|
|
2322
|
+
name: z13.string().min(1).max(80),
|
|
1965
2323
|
kind: DeviceKind
|
|
1966
2324
|
});
|
|
1967
|
-
var EnrollResponse =
|
|
1968
|
-
var CreateEnrollmentRequest =
|
|
1969
|
-
var CreateEnrollmentResponse =
|
|
1970
|
-
token:
|
|
1971
|
-
url:
|
|
1972
|
-
expiresAt:
|
|
1973
|
-
qrSvg:
|
|
1974
|
-
command:
|
|
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()
|
|
1975
2333
|
});
|
|
1976
|
-
var HostEnrollRequest =
|
|
1977
|
-
|
|
1978
|
-
token:
|
|
1979
|
-
name:
|
|
2334
|
+
var HostEnrollRequest = z13.union([
|
|
2335
|
+
z13.object({
|
|
2336
|
+
token: z13.string().min(1),
|
|
2337
|
+
name: z13.string().min(1).max(80),
|
|
1980
2338
|
platform: Platform
|
|
1981
2339
|
}),
|
|
1982
|
-
|
|
1983
|
-
secret:
|
|
1984
|
-
name:
|
|
2340
|
+
z13.object({
|
|
2341
|
+
secret: z13.string().min(1),
|
|
2342
|
+
name: z13.string().min(1).max(80),
|
|
1985
2343
|
platform: Platform
|
|
1986
2344
|
})
|
|
1987
2345
|
]);
|
|
1988
|
-
var HostEnrollResponse =
|
|
1989
|
-
var CreateProjectRequest =
|
|
1990
|
-
name:
|
|
1991
|
-
hostId:
|
|
1992
|
-
path:
|
|
1993
|
-
defaultProfileId:
|
|
1994
|
-
setupCommand:
|
|
1995
|
-
checks:
|
|
1996
|
-
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(),
|
|
1997
2355
|
worktreeDir: WorktreeDir.optional()
|
|
1998
2356
|
});
|
|
1999
|
-
var UpdateProjectRequest =
|
|
2000
|
-
name:
|
|
2001
|
-
defaultProfileId:
|
|
2002
|
-
defaultHostId:
|
|
2003
|
-
maxConcurrentRuns:
|
|
2004
|
-
automationEnabled:
|
|
2005
|
-
setupCommand:
|
|
2006
|
-
checks:
|
|
2007
|
-
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(),
|
|
2008
2366
|
worktreeDir: WorktreeDir.optional()
|
|
2009
2367
|
});
|
|
2010
|
-
var AddCheckoutRequest =
|
|
2368
|
+
var AddCheckoutRequest = z13.object({ hostId: z13.string(), path: z13.string().min(1) });
|
|
2011
2369
|
function isProjectFolderPath(s) {
|
|
2012
2370
|
if (s.includes("\0"))
|
|
2013
2371
|
return false;
|
|
2014
2372
|
return s === "~" || s.startsWith("~/") || s.startsWith("/");
|
|
2015
2373
|
}
|
|
2016
|
-
var ProjectFolder =
|
|
2017
|
-
var UpdateHostRequest =
|
|
2018
|
-
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()
|
|
2019
2377
|
});
|
|
2020
2378
|
var ProjectScanResult = ProjectScan.extend({
|
|
2021
|
-
added:
|
|
2022
|
-
projectId:
|
|
2023
|
-
name:
|
|
2024
|
-
path:
|
|
2025
|
-
newProject:
|
|
2379
|
+
added: z13.array(z13.object({
|
|
2380
|
+
projectId: z13.string(),
|
|
2381
|
+
name: z13.string(),
|
|
2382
|
+
path: z13.string(),
|
|
2383
|
+
newProject: z13.boolean()
|
|
2026
2384
|
}))
|
|
2027
2385
|
});
|
|
2028
|
-
var ProfileInput =
|
|
2029
|
-
name:
|
|
2030
|
-
provider:
|
|
2031
|
-
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),
|
|
2032
2390
|
thinking: ThinkingLevel.nullable().default(null),
|
|
2033
|
-
projectTrust:
|
|
2034
|
-
extraArgs:
|
|
2035
|
-
resources:
|
|
2036
|
-
});
|
|
2037
|
-
var CreateWorkspaceRequest =
|
|
2038
|
-
checkoutId:
|
|
2039
|
-
branch:
|
|
2040
|
-
base:
|
|
2041
|
-
});
|
|
2042
|
-
var RemoveWorkspaceRequest =
|
|
2043
|
-
force:
|
|
2044
|
-
});
|
|
2045
|
-
var CreateSessionRequest =
|
|
2046
|
-
projectId:
|
|
2047
|
-
workspace:
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
checkoutId:
|
|
2051
|
-
newBranch:
|
|
2052
|
-
base:
|
|
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()
|
|
2053
2411
|
})
|
|
2054
2412
|
]),
|
|
2055
|
-
profileId:
|
|
2056
|
-
prompt:
|
|
2057
|
-
title:
|
|
2058
|
-
viewId:
|
|
2059
|
-
});
|
|
2060
|
-
var PromptRequest =
|
|
2061
|
-
text:
|
|
2062
|
-
mode:
|
|
2063
|
-
images:
|
|
2064
|
-
clientMessageId:
|
|
2065
|
-
});
|
|
2066
|
-
var CacheAlertRequest =
|
|
2067
|
-
enabled:
|
|
2068
|
-
ttlSec:
|
|
2069
|
-
});
|
|
2070
|
-
var RenameRequest =
|
|
2071
|
-
var SetModelRequest =
|
|
2072
|
-
provider:
|
|
2073
|
-
modelId:
|
|
2074
|
-
});
|
|
2075
|
-
var SetThinkingRequest =
|
|
2076
|
-
var CompactRequest =
|
|
2077
|
-
var SessionModelsResult =
|
|
2078
|
-
var SessionCommandsResult =
|
|
2079
|
-
var CompleteRequest =
|
|
2080
|
-
var CompletionItem =
|
|
2081
|
-
value:
|
|
2082
|
-
label:
|
|
2083
|
-
description:
|
|
2084
|
-
});
|
|
2085
|
-
var SessionCompleteResult =
|
|
2086
|
-
items:
|
|
2087
|
-
prefix:
|
|
2088
|
-
});
|
|
2089
|
-
var TreeRow =
|
|
2090
|
-
entryId:
|
|
2091
|
-
parentId:
|
|
2092
|
-
depth:
|
|
2093
|
-
role:
|
|
2094
|
-
text:
|
|
2095
|
-
activeBranch:
|
|
2096
|
-
leaf:
|
|
2097
|
-
label:
|
|
2098
|
-
at:
|
|
2099
|
-
});
|
|
2100
|
-
var SessionTreeResult =
|
|
2101
|
-
var BranchRequest =
|
|
2102
|
-
entryId:
|
|
2103
|
-
fork:
|
|
2104
|
-
});
|
|
2105
|
-
var HostBranchResult =
|
|
2106
|
-
sessionFile:
|
|
2107
|
-
prefill:
|
|
2108
|
-
});
|
|
2109
|
-
var TranscriptPage =
|
|
2110
|
-
items:
|
|
2111
|
-
hasMore:
|
|
2112
|
-
epoch:
|
|
2113
|
-
rev:
|
|
2114
|
-
delta:
|
|
2115
|
-
reset:
|
|
2116
|
-
});
|
|
2117
|
-
var NavigateRequest =
|
|
2118
|
-
entryId:
|
|
2119
|
-
summarize:
|
|
2120
|
-
instructions:
|
|
2121
|
-
});
|
|
2122
|
-
var HostNavigateResult =
|
|
2123
|
-
items:
|
|
2124
|
-
prefill:
|
|
2125
|
-
});
|
|
2126
|
-
var NavigateResult =
|
|
2127
|
-
prefill:
|
|
2128
|
-
epoch:
|
|
2129
|
-
});
|
|
2130
|
-
var BranchResult =
|
|
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({
|
|
2131
2489
|
session: Session.nullable(),
|
|
2132
|
-
prefill:
|
|
2490
|
+
prefill: z13.string().nullable()
|
|
2133
2491
|
});
|
|
2134
|
-
var SessionExportResult =
|
|
2135
|
-
var CommandViewAction =
|
|
2136
|
-
label:
|
|
2137
|
-
command:
|
|
2138
|
-
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()
|
|
2139
2497
|
});
|
|
2140
|
-
var CommandView =
|
|
2141
|
-
title:
|
|
2498
|
+
var CommandView = z13.object({
|
|
2499
|
+
title: z13.string().min(1).max(200),
|
|
2142
2500
|
body: UINodeSchema,
|
|
2143
|
-
actions:
|
|
2501
|
+
actions: z13.array(CommandViewAction).max(30).default([])
|
|
2144
2502
|
});
|
|
2145
|
-
var ModelStateResult =
|
|
2503
|
+
var ModelStateResult = z13.object({
|
|
2146
2504
|
model: SessionModel.nullable(),
|
|
2147
2505
|
thinking: ThinkingLevel.nullable()
|
|
2148
2506
|
});
|
|
2149
|
-
var ImportSessionRequest =
|
|
2150
|
-
hostId:
|
|
2151
|
-
sessionFile:
|
|
2152
|
-
projectId:
|
|
2507
|
+
var ImportSessionRequest = z13.object({
|
|
2508
|
+
hostId: z13.string(),
|
|
2509
|
+
sessionFile: z13.string(),
|
|
2510
|
+
projectId: z13.string().nullable().optional()
|
|
2153
2511
|
});
|
|
2154
|
-
var AnswerRequest =
|
|
2155
|
-
revision:
|
|
2512
|
+
var AnswerRequest = z13.object({
|
|
2513
|
+
revision: z13.number().int(),
|
|
2156
2514
|
response: InteractionResponseSchema
|
|
2157
2515
|
});
|
|
2158
|
-
var AdapterActionRequest =
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
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()
|
|
2171
2530
|
}).optional(),
|
|
2172
|
-
continuation:
|
|
2173
|
-
enabled:
|
|
2174
|
-
objective:
|
|
2175
|
-
maxContinuations:
|
|
2176
|
-
maxElapsedMinutes:
|
|
2177
|
-
maxTokens:
|
|
2178
|
-
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()
|
|
2179
2538
|
}).optional(),
|
|
2180
2539
|
completion: CompletionPolicy.partial().optional()
|
|
2181
2540
|
});
|
|
2182
|
-
var CreateTaskRequest =
|
|
2183
|
-
projectId:
|
|
2184
|
-
title:
|
|
2541
|
+
var CreateTaskRequest = z13.object({
|
|
2542
|
+
projectId: z13.string(),
|
|
2543
|
+
title: z13.string().max(300).optional(),
|
|
2185
2544
|
githubIssueUrl: GitHubIssueUrl.optional(),
|
|
2186
|
-
githubIssue:
|
|
2187
|
-
launchPrompt:
|
|
2188
|
-
objective:
|
|
2189
|
-
acceptanceCriteria:
|
|
2190
|
-
dependencies:
|
|
2191
|
-
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(),
|
|
2192
2551
|
priority: Priority.default(2),
|
|
2193
|
-
state:
|
|
2194
|
-
notBefore:
|
|
2552
|
+
state: z13.enum(["backlog", "ready"]).default("backlog"),
|
|
2553
|
+
notBefore: z13.string().nullable().optional(),
|
|
2195
2554
|
policy: TaskPolicyPatch.optional()
|
|
2196
2555
|
}).superRefine((v, ctx) => {
|
|
2197
2556
|
if (v.githubIssueUrl === void 0) {
|
|
@@ -2229,32 +2588,32 @@ var CreateTaskRequest = z11.object({
|
|
|
2229
2588
|
const issue = githubIssueFromUrl(v.githubIssueUrl);
|
|
2230
2589
|
return { ...v, title: v.title?.trim() || `${issue.repository} #${issue.number}` };
|
|
2231
2590
|
});
|
|
2232
|
-
var UpdateTaskRequest =
|
|
2233
|
-
githubIssueUrl:
|
|
2234
|
-
githubIssue:
|
|
2235
|
-
launchPrompt:
|
|
2236
|
-
title:
|
|
2237
|
-
objective:
|
|
2238
|
-
acceptanceCriteria:
|
|
2239
|
-
dependencies:
|
|
2240
|
-
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(),
|
|
2241
2600
|
priority: Priority.optional(),
|
|
2242
|
-
position:
|
|
2243
|
-
notBefore:
|
|
2601
|
+
position: z13.number().optional(),
|
|
2602
|
+
notBefore: z13.string().nullable().optional(),
|
|
2244
2603
|
policy: TaskPolicyPatch.optional()
|
|
2245
2604
|
});
|
|
2246
|
-
var MoveTaskRequest =
|
|
2605
|
+
var MoveTaskRequest = z13.object({
|
|
2247
2606
|
to: TaskState,
|
|
2248
|
-
confirm:
|
|
2249
|
-
onRunning:
|
|
2250
|
-
position:
|
|
2607
|
+
confirm: z13.boolean().optional(),
|
|
2608
|
+
onRunning: z13.enum(["pause", "stop"]).optional(),
|
|
2609
|
+
position: z13.number().optional()
|
|
2251
2610
|
});
|
|
2252
|
-
var RequestChangesRequest =
|
|
2253
|
-
var Eligibility =
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
eligible:
|
|
2257
|
-
wait:
|
|
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([
|
|
2258
2617
|
"dependency",
|
|
2259
2618
|
"host_offline",
|
|
2260
2619
|
"project_limit",
|
|
@@ -2267,145 +2626,145 @@ var Eligibility = z11.union([
|
|
|
2267
2626
|
"already_dispatched",
|
|
2268
2627
|
"retry_backoff"
|
|
2269
2628
|
]),
|
|
2270
|
-
message:
|
|
2629
|
+
message: z13.string()
|
|
2271
2630
|
})
|
|
2272
2631
|
]);
|
|
2273
|
-
var NowResponse =
|
|
2274
|
-
running:
|
|
2275
|
-
queued:
|
|
2276
|
-
dispatchPaused:
|
|
2277
|
-
});
|
|
2278
|
-
var AutomationInput =
|
|
2279
|
-
name:
|
|
2280
|
-
enabled:
|
|
2281
|
-
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(),
|
|
2282
2641
|
trigger: Trigger,
|
|
2283
|
-
filters:
|
|
2642
|
+
filters: z13.array(z13.object({ path: z13.string(), equals: z13.string() })).default([]),
|
|
2284
2643
|
template: TaskTemplate,
|
|
2285
|
-
hostId:
|
|
2286
|
-
profileId:
|
|
2287
|
-
mode:
|
|
2288
|
-
groupingKey:
|
|
2289
|
-
overlap:
|
|
2290
|
-
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"),
|
|
2291
2650
|
continuation: ContinuationPolicy.default({ enabled: false }),
|
|
2292
2651
|
completion: CompletionPolicy.default({ checks: null, requireHumanReview: true })
|
|
2293
2652
|
});
|
|
2294
|
-
var AutomationView = Automation.extend({ summary:
|
|
2295
|
-
var AutomationPreview =
|
|
2296
|
-
summary:
|
|
2653
|
+
var AutomationView = Automation.extend({ summary: z13.string() });
|
|
2654
|
+
var AutomationPreview = z13.object({
|
|
2655
|
+
summary: z13.string(),
|
|
2297
2656
|
task: TaskTemplate,
|
|
2298
|
-
next:
|
|
2299
|
-
});
|
|
2300
|
-
var WebhookTokenResponse =
|
|
2301
|
-
var PushSubscriptionRequest =
|
|
2302
|
-
endpoint:
|
|
2303
|
-
keys:
|
|
2304
|
-
permission:
|
|
2305
|
-
});
|
|
2306
|
-
var NotificationSettings =
|
|
2307
|
-
quietHours:
|
|
2308
|
-
start:
|
|
2309
|
-
end:
|
|
2310
|
-
timezone:
|
|
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()
|
|
2311
2670
|
}).nullable(),
|
|
2312
|
-
privatePreviews:
|
|
2313
|
-
preferredDeviceId:
|
|
2671
|
+
privatePreviews: z13.boolean(),
|
|
2672
|
+
preferredDeviceId: z13.string().nullable()
|
|
2314
2673
|
});
|
|
2315
|
-
var PushPayload =
|
|
2316
|
-
|
|
2317
|
-
type:
|
|
2318
|
-
title:
|
|
2319
|
-
body:
|
|
2320
|
-
tag:
|
|
2321
|
-
url:
|
|
2322
|
-
renotify:
|
|
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()
|
|
2323
2682
|
}),
|
|
2324
|
-
|
|
2683
|
+
z13.object({ type: z13.literal("clear"), tag: z13.string() })
|
|
2325
2684
|
]);
|
|
2326
|
-
var SetupState =
|
|
2327
|
-
passkey:
|
|
2328
|
-
available:
|
|
2329
|
-
registered:
|
|
2330
|
-
reason:
|
|
2685
|
+
var SetupState = z13.object({
|
|
2686
|
+
passkey: z13.object({
|
|
2687
|
+
available: z13.boolean(),
|
|
2688
|
+
registered: z13.boolean(),
|
|
2689
|
+
reason: z13.string().nullable()
|
|
2331
2690
|
}),
|
|
2332
|
-
oidc:
|
|
2691
|
+
oidc: z13.object({ label: z13.string() }).nullable()
|
|
2333
2692
|
});
|
|
2334
|
-
var PasskeyRegisterOptionsResponse =
|
|
2335
|
-
challengeId:
|
|
2336
|
-
options:
|
|
2693
|
+
var PasskeyRegisterOptionsResponse = z13.object({
|
|
2694
|
+
challengeId: z13.string(),
|
|
2695
|
+
options: z13.unknown()
|
|
2337
2696
|
});
|
|
2338
|
-
var PasskeyRegisterVerifyRequest =
|
|
2339
|
-
challengeId:
|
|
2340
|
-
name:
|
|
2341
|
-
response:
|
|
2697
|
+
var PasskeyRegisterVerifyRequest = z13.object({
|
|
2698
|
+
challengeId: z13.string(),
|
|
2699
|
+
name: z13.string().min(1).max(80),
|
|
2700
|
+
response: z13.unknown()
|
|
2342
2701
|
});
|
|
2343
|
-
var PasskeySignInOptionsResponse =
|
|
2344
|
-
challengeId:
|
|
2345
|
-
options:
|
|
2702
|
+
var PasskeySignInOptionsResponse = z13.object({
|
|
2703
|
+
challengeId: z13.string(),
|
|
2704
|
+
options: z13.unknown()
|
|
2346
2705
|
});
|
|
2347
|
-
var PasskeySignInVerifyRequest =
|
|
2348
|
-
challengeId:
|
|
2349
|
-
response:
|
|
2350
|
-
deviceName:
|
|
2706
|
+
var PasskeySignInVerifyRequest = z13.object({
|
|
2707
|
+
challengeId: z13.string(),
|
|
2708
|
+
response: z13.unknown(),
|
|
2709
|
+
deviceName: z13.string().min(1).max(80),
|
|
2351
2710
|
kind: DeviceKind.extract(["browser", "pwa"])
|
|
2352
2711
|
});
|
|
2353
|
-
var OidcBeginRequest =
|
|
2354
|
-
deviceName:
|
|
2712
|
+
var OidcBeginRequest = z13.object({
|
|
2713
|
+
deviceName: z13.string().min(1).max(80),
|
|
2355
2714
|
kind: DeviceKind.extract(["browser", "pwa"]),
|
|
2356
|
-
next:
|
|
2357
|
-
handoff:
|
|
2358
|
-
});
|
|
2359
|
-
var OidcBeginResponse =
|
|
2360
|
-
authorizeUrl:
|
|
2361
|
-
flowId:
|
|
2362
|
-
pollToken:
|
|
2363
|
-
});
|
|
2364
|
-
var OidcClaimRequest =
|
|
2365
|
-
var OidcClaimResponse =
|
|
2366
|
-
|
|
2367
|
-
|
|
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() })
|
|
2368
2727
|
]);
|
|
2369
|
-
var TerminalLoginStartRequest =
|
|
2370
|
-
var TerminalLoginStartResponse =
|
|
2371
|
-
userCode:
|
|
2372
|
-
pollToken:
|
|
2373
|
-
verifyUrl:
|
|
2374
|
-
expiresAt:
|
|
2375
|
-
intervalMs:
|
|
2376
|
-
});
|
|
2377
|
-
var TerminalLoginClaimRequest =
|
|
2378
|
-
userCode:
|
|
2379
|
-
pollToken:
|
|
2380
|
-
});
|
|
2381
|
-
var TerminalLoginClaimResponse =
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
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() })
|
|
2385
2744
|
]);
|
|
2386
|
-
var TerminalLoginRequest =
|
|
2387
|
-
userCode:
|
|
2388
|
-
name:
|
|
2389
|
-
requestedFrom:
|
|
2390
|
-
createdAt:
|
|
2391
|
-
expiresAt:
|
|
2392
|
-
status:
|
|
2393
|
-
});
|
|
2394
|
-
var AuthMethods =
|
|
2395
|
-
passkeys:
|
|
2396
|
-
passkeyAvailability:
|
|
2397
|
-
oidc:
|
|
2398
|
-
issuer:
|
|
2399
|
-
label:
|
|
2400
|
-
ownerMatch:
|
|
2401
|
-
status:
|
|
2402
|
-
error:
|
|
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()
|
|
2403
2762
|
}).nullable()
|
|
2404
2763
|
});
|
|
2405
|
-
var MeResponse =
|
|
2764
|
+
var MeResponse = z13.object({
|
|
2406
2765
|
device: Device,
|
|
2407
|
-
admin:
|
|
2408
|
-
publicUrl:
|
|
2766
|
+
admin: z13.boolean(),
|
|
2767
|
+
publicUrl: z13.string()
|
|
2409
2768
|
});
|
|
2410
2769
|
var ViewInput = View.pick({
|
|
2411
2770
|
name: true,
|
|
@@ -2419,65 +2778,65 @@ var ViewInput = View.pick({
|
|
|
2419
2778
|
});
|
|
2420
2779
|
var ViewPatch = ViewInput.partial();
|
|
2421
2780
|
var ViewClientReport = ViewClient.omit({ lastSeenAt: true });
|
|
2422
|
-
var ProjectSuggestionsResponse =
|
|
2423
|
-
suggestions:
|
|
2781
|
+
var ProjectSuggestionsResponse = z13.object({
|
|
2782
|
+
suggestions: z13.array(ProjectSuggestion.extend({ name: z13.string(), preselected: z13.boolean() }))
|
|
2424
2783
|
});
|
|
2425
2784
|
|
|
2426
2785
|
// packages/protocol/dist/client-wire.js
|
|
2427
|
-
import { z as
|
|
2428
|
-
var SyncState =
|
|
2429
|
-
hosts:
|
|
2430
|
-
projects:
|
|
2431
|
-
checkouts:
|
|
2432
|
-
workspaces:
|
|
2433
|
-
profiles:
|
|
2434
|
-
views:
|
|
2435
|
-
sessions:
|
|
2436
|
-
tasks:
|
|
2437
|
-
runs:
|
|
2438
|
-
automations:
|
|
2439
|
-
attention:
|
|
2440
|
-
interactions:
|
|
2441
|
-
panels:
|
|
2442
|
-
devices:
|
|
2443
|
-
adapters:
|
|
2444
|
-
dispatchPaused:
|
|
2445
|
-
});
|
|
2446
|
-
var Presence =
|
|
2447
|
-
foreground:
|
|
2448
|
-
interactedAt:
|
|
2449
|
-
viewing:
|
|
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()
|
|
2450
2809
|
});
|
|
2451
2810
|
var CLIENT_CAPABILITIES = ["adapter.slots.v1", "timeline.cards.v1"];
|
|
2452
|
-
var ClientToServer =
|
|
2453
|
-
|
|
2454
|
-
type:
|
|
2455
|
-
cursor:
|
|
2456
|
-
capabilities:
|
|
2457
|
-
projectionId:
|
|
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()
|
|
2458
2817
|
}),
|
|
2459
|
-
|
|
2460
|
-
|
|
2818
|
+
z14.object({ type: z14.literal("presence"), presence: Presence }),
|
|
2819
|
+
z14.object({ type: z14.literal("ping") })
|
|
2461
2820
|
]);
|
|
2462
|
-
var ServerToClient =
|
|
2463
|
-
|
|
2464
|
-
type:
|
|
2465
|
-
seq:
|
|
2466
|
-
events:
|
|
2467
|
-
capabilities:
|
|
2468
|
-
projectionId:
|
|
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()
|
|
2469
2828
|
}),
|
|
2470
|
-
|
|
2471
|
-
type:
|
|
2472
|
-
seq:
|
|
2829
|
+
z14.object({
|
|
2830
|
+
type: z14.literal("snapshot"),
|
|
2831
|
+
seq: z14.number().int(),
|
|
2473
2832
|
state: SyncState,
|
|
2474
|
-
capabilities:
|
|
2475
|
-
projectionId:
|
|
2833
|
+
capabilities: z14.array(z14.enum(CLIENT_CAPABILITIES)).optional(),
|
|
2834
|
+
projectionId: z14.string().optional()
|
|
2476
2835
|
}),
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
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() })
|
|
2481
2840
|
]);
|
|
2482
2841
|
|
|
2483
2842
|
// packages/protocol/dist/ids.js
|
|
@@ -2488,17 +2847,17 @@ var ulid = monotonicFactory();
|
|
|
2488
2847
|
var CLIENT_OPEN_MS = 10 * 6e4;
|
|
2489
2848
|
|
|
2490
2849
|
// packages/protocol/dist/web-bridge.js
|
|
2491
|
-
import { z as
|
|
2850
|
+
import { z as z15 } from "zod";
|
|
2492
2851
|
var FRAME_MAX_HEIGHT = 4e3;
|
|
2493
|
-
var FrameToParentMessageSchema =
|
|
2494
|
-
|
|
2495
|
-
type:
|
|
2496
|
-
actionId:
|
|
2497
|
-
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()
|
|
2498
2857
|
}),
|
|
2499
|
-
|
|
2500
|
-
type:
|
|
2501
|
-
height:
|
|
2858
|
+
z15.object({
|
|
2859
|
+
type: z15.literal("resize"),
|
|
2860
|
+
height: z15.number().finite().min(0).max(FRAME_MAX_HEIGHT)
|
|
2502
2861
|
})
|
|
2503
2862
|
]);
|
|
2504
2863
|
|