@get-bb/plugin-sdk 0.4.94 → 0.4.99
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/bundled-types/bb-plugin-sdk-app.d.ts +55 -3
- package/bundled-types/bb-plugin-sdk-environment-provider.d.ts +1 -0
- package/bundled-types/bb-plugin-sdk-internal-host-policy.d.ts +18 -0
- package/bundled-types/bb-plugin-sdk-machine-provider.d.ts +2 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge-testing.d.ts +4 -0
- package/bundled-types/bb-plugin-sdk-provider-bridge.d.ts +5 -0
- package/bundled-types/bb-plugin-sdk-testing.d.ts +16 -0
- package/bundled-types/bb-plugin-sdk.d.ts +482 -3
- package/dist/internal/host-policy.js +117 -93
- package/dist/provider-bridge-acp.js +2121 -1562
- package/dist/provider-bridge-testing.js +1301 -1228
- package/dist/provider-bridge.js +1819 -1311
- package/dist/testing/app.js +17 -0
- package/dist/testing/index.js +118 -93
- package/package.json +1 -1
|
@@ -1,3 +1,544 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
try {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw mod = 0, e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
32
|
+
var require_debug = __commonJS({
|
|
33
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js"(exports, module) {
|
|
34
|
+
"use strict";
|
|
35
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
36
|
+
};
|
|
37
|
+
module.exports = debug;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
42
|
+
var require_constants = __commonJS({
|
|
43
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js"(exports, module) {
|
|
44
|
+
"use strict";
|
|
45
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
46
|
+
var MAX_LENGTH = 256;
|
|
47
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
48
|
+
9007199254740991;
|
|
49
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
50
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
51
|
+
var RELEASE_TYPES = [
|
|
52
|
+
"major",
|
|
53
|
+
"premajor",
|
|
54
|
+
"minor",
|
|
55
|
+
"preminor",
|
|
56
|
+
"patch",
|
|
57
|
+
"prepatch",
|
|
58
|
+
"prerelease"
|
|
59
|
+
];
|
|
60
|
+
module.exports = {
|
|
61
|
+
MAX_LENGTH,
|
|
62
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
63
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
64
|
+
MAX_SAFE_INTEGER,
|
|
65
|
+
RELEASE_TYPES,
|
|
66
|
+
SEMVER_SPEC_VERSION,
|
|
67
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
68
|
+
FLAG_LOOSE: 2
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
74
|
+
var require_re = __commonJS({
|
|
75
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js"(exports, module) {
|
|
76
|
+
"use strict";
|
|
77
|
+
var {
|
|
78
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
79
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
80
|
+
MAX_LENGTH
|
|
81
|
+
} = require_constants();
|
|
82
|
+
var debug = require_debug();
|
|
83
|
+
exports = module.exports = {};
|
|
84
|
+
var re = exports.re = [];
|
|
85
|
+
var safeRe = exports.safeRe = [];
|
|
86
|
+
var src = exports.src = [];
|
|
87
|
+
var safeSrc = exports.safeSrc = [];
|
|
88
|
+
var t = exports.t = {};
|
|
89
|
+
var R = 0;
|
|
90
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
91
|
+
var safeRegexReplacements = [
|
|
92
|
+
["\\s", 1],
|
|
93
|
+
["\\d", MAX_LENGTH],
|
|
94
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
95
|
+
];
|
|
96
|
+
var makeSafeRegex = (value) => {
|
|
97
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
98
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
99
|
+
}
|
|
100
|
+
return value;
|
|
101
|
+
};
|
|
102
|
+
var createToken = (name, value, isGlobal) => {
|
|
103
|
+
const safe = makeSafeRegex(value);
|
|
104
|
+
const index = R++;
|
|
105
|
+
debug(name, index, value);
|
|
106
|
+
t[name] = index;
|
|
107
|
+
src[index] = value;
|
|
108
|
+
safeSrc[index] = safe;
|
|
109
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
110
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
111
|
+
};
|
|
112
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
113
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
114
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
115
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
116
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
117
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
118
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
119
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
120
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
121
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
122
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
123
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
124
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
125
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
126
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
127
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
128
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
129
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
130
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
131
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
132
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
133
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
134
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
135
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
136
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
137
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
138
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
139
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
140
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
141
|
+
exports.tildeTrimReplace = "$1~";
|
|
142
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
143
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
144
|
+
createToken("LONECARET", "(?:\\^)");
|
|
145
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
146
|
+
exports.caretTrimReplace = "$1^";
|
|
147
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
148
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
149
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
150
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
151
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
152
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
153
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
154
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
155
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
156
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
157
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
162
|
+
var require_parse_options = __commonJS({
|
|
163
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js"(exports, module) {
|
|
164
|
+
"use strict";
|
|
165
|
+
var looseOption = Object.freeze({ loose: true });
|
|
166
|
+
var emptyOpts = Object.freeze({});
|
|
167
|
+
var parseOptions = (options) => {
|
|
168
|
+
if (!options) {
|
|
169
|
+
return emptyOpts;
|
|
170
|
+
}
|
|
171
|
+
if (typeof options !== "object") {
|
|
172
|
+
return looseOption;
|
|
173
|
+
}
|
|
174
|
+
return options;
|
|
175
|
+
};
|
|
176
|
+
module.exports = parseOptions;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
181
|
+
var require_identifiers = __commonJS({
|
|
182
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js"(exports, module) {
|
|
183
|
+
"use strict";
|
|
184
|
+
var numeric = /^[0-9]+$/;
|
|
185
|
+
var compareIdentifiers = (a, b) => {
|
|
186
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
187
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
188
|
+
}
|
|
189
|
+
const anum = numeric.test(a);
|
|
190
|
+
const bnum = numeric.test(b);
|
|
191
|
+
if (anum && bnum) {
|
|
192
|
+
a = +a;
|
|
193
|
+
b = +b;
|
|
194
|
+
}
|
|
195
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
196
|
+
};
|
|
197
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
198
|
+
module.exports = {
|
|
199
|
+
compareIdentifiers,
|
|
200
|
+
rcompareIdentifiers
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
206
|
+
var require_semver = __commonJS({
|
|
207
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js"(exports, module) {
|
|
208
|
+
"use strict";
|
|
209
|
+
var debug = require_debug();
|
|
210
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
211
|
+
var { safeRe: re, t } = require_re();
|
|
212
|
+
var parseOptions = require_parse_options();
|
|
213
|
+
var { compareIdentifiers } = require_identifiers();
|
|
214
|
+
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
215
|
+
const identifiers = identifier.split(".");
|
|
216
|
+
if (identifiers.length > prerelease.length) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
for (let i = 0; i < identifiers.length; i++) {
|
|
220
|
+
if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
};
|
|
226
|
+
var SemVer = class _SemVer {
|
|
227
|
+
constructor(version, options) {
|
|
228
|
+
options = parseOptions(options);
|
|
229
|
+
if (version instanceof _SemVer) {
|
|
230
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
231
|
+
return version;
|
|
232
|
+
} else {
|
|
233
|
+
version = version.version;
|
|
234
|
+
}
|
|
235
|
+
} else if (typeof version !== "string") {
|
|
236
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
237
|
+
}
|
|
238
|
+
if (version.length > MAX_LENGTH) {
|
|
239
|
+
throw new TypeError(
|
|
240
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
debug("SemVer", version, options);
|
|
244
|
+
this.options = options;
|
|
245
|
+
this.loose = !!options.loose;
|
|
246
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
247
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
248
|
+
if (!m) {
|
|
249
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
250
|
+
}
|
|
251
|
+
this.raw = version;
|
|
252
|
+
this.major = +m[1];
|
|
253
|
+
this.minor = +m[2];
|
|
254
|
+
this.patch = +m[3];
|
|
255
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
256
|
+
throw new TypeError("Invalid major version");
|
|
257
|
+
}
|
|
258
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
259
|
+
throw new TypeError("Invalid minor version");
|
|
260
|
+
}
|
|
261
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
262
|
+
throw new TypeError("Invalid patch version");
|
|
263
|
+
}
|
|
264
|
+
if (!m[4]) {
|
|
265
|
+
this.prerelease = [];
|
|
266
|
+
} else {
|
|
267
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
268
|
+
if (/^[0-9]+$/.test(id)) {
|
|
269
|
+
const num = +id;
|
|
270
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
271
|
+
return num;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return id;
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
278
|
+
this.format();
|
|
279
|
+
}
|
|
280
|
+
format() {
|
|
281
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
282
|
+
if (this.prerelease.length) {
|
|
283
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
284
|
+
}
|
|
285
|
+
return this.version;
|
|
286
|
+
}
|
|
287
|
+
toString() {
|
|
288
|
+
return this.version;
|
|
289
|
+
}
|
|
290
|
+
compare(other) {
|
|
291
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
292
|
+
if (!(other instanceof _SemVer)) {
|
|
293
|
+
if (typeof other === "string" && other === this.version) {
|
|
294
|
+
return 0;
|
|
295
|
+
}
|
|
296
|
+
other = new _SemVer(other, this.options);
|
|
297
|
+
}
|
|
298
|
+
if (other.version === this.version) {
|
|
299
|
+
return 0;
|
|
300
|
+
}
|
|
301
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
302
|
+
}
|
|
303
|
+
compareMain(other) {
|
|
304
|
+
if (!(other instanceof _SemVer)) {
|
|
305
|
+
other = new _SemVer(other, this.options);
|
|
306
|
+
}
|
|
307
|
+
if (this.major < other.major) {
|
|
308
|
+
return -1;
|
|
309
|
+
}
|
|
310
|
+
if (this.major > other.major) {
|
|
311
|
+
return 1;
|
|
312
|
+
}
|
|
313
|
+
if (this.minor < other.minor) {
|
|
314
|
+
return -1;
|
|
315
|
+
}
|
|
316
|
+
if (this.minor > other.minor) {
|
|
317
|
+
return 1;
|
|
318
|
+
}
|
|
319
|
+
if (this.patch < other.patch) {
|
|
320
|
+
return -1;
|
|
321
|
+
}
|
|
322
|
+
if (this.patch > other.patch) {
|
|
323
|
+
return 1;
|
|
324
|
+
}
|
|
325
|
+
return 0;
|
|
326
|
+
}
|
|
327
|
+
comparePre(other) {
|
|
328
|
+
if (!(other instanceof _SemVer)) {
|
|
329
|
+
other = new _SemVer(other, this.options);
|
|
330
|
+
}
|
|
331
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
332
|
+
return -1;
|
|
333
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
334
|
+
return 1;
|
|
335
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
336
|
+
return 0;
|
|
337
|
+
}
|
|
338
|
+
let i = 0;
|
|
339
|
+
do {
|
|
340
|
+
const a = this.prerelease[i];
|
|
341
|
+
const b = other.prerelease[i];
|
|
342
|
+
debug("prerelease compare", i, a, b);
|
|
343
|
+
if (a === void 0 && b === void 0) {
|
|
344
|
+
return 0;
|
|
345
|
+
} else if (b === void 0) {
|
|
346
|
+
return 1;
|
|
347
|
+
} else if (a === void 0) {
|
|
348
|
+
return -1;
|
|
349
|
+
} else if (a === b) {
|
|
350
|
+
continue;
|
|
351
|
+
} else {
|
|
352
|
+
return compareIdentifiers(a, b);
|
|
353
|
+
}
|
|
354
|
+
} while (++i);
|
|
355
|
+
}
|
|
356
|
+
compareBuild(other) {
|
|
357
|
+
if (!(other instanceof _SemVer)) {
|
|
358
|
+
other = new _SemVer(other, this.options);
|
|
359
|
+
}
|
|
360
|
+
let i = 0;
|
|
361
|
+
do {
|
|
362
|
+
const a = this.build[i];
|
|
363
|
+
const b = other.build[i];
|
|
364
|
+
debug("build compare", i, a, b);
|
|
365
|
+
if (a === void 0 && b === void 0) {
|
|
366
|
+
return 0;
|
|
367
|
+
} else if (b === void 0) {
|
|
368
|
+
return 1;
|
|
369
|
+
} else if (a === void 0) {
|
|
370
|
+
return -1;
|
|
371
|
+
} else if (a === b) {
|
|
372
|
+
continue;
|
|
373
|
+
} else {
|
|
374
|
+
return compareIdentifiers(a, b);
|
|
375
|
+
}
|
|
376
|
+
} while (++i);
|
|
377
|
+
}
|
|
378
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
379
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
380
|
+
inc(release, identifier, identifierBase) {
|
|
381
|
+
if (release.startsWith("pre")) {
|
|
382
|
+
if (!identifier && identifierBase === false) {
|
|
383
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
384
|
+
}
|
|
385
|
+
if (identifier) {
|
|
386
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
387
|
+
if (!match || match[1] !== identifier) {
|
|
388
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
switch (release) {
|
|
393
|
+
case "premajor":
|
|
394
|
+
this.prerelease.length = 0;
|
|
395
|
+
this.patch = 0;
|
|
396
|
+
this.minor = 0;
|
|
397
|
+
this.major++;
|
|
398
|
+
this.inc("pre", identifier, identifierBase);
|
|
399
|
+
break;
|
|
400
|
+
case "preminor":
|
|
401
|
+
this.prerelease.length = 0;
|
|
402
|
+
this.patch = 0;
|
|
403
|
+
this.minor++;
|
|
404
|
+
this.inc("pre", identifier, identifierBase);
|
|
405
|
+
break;
|
|
406
|
+
case "prepatch":
|
|
407
|
+
this.prerelease.length = 0;
|
|
408
|
+
this.inc("patch", identifier, identifierBase);
|
|
409
|
+
this.inc("pre", identifier, identifierBase);
|
|
410
|
+
break;
|
|
411
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
412
|
+
// prepatch.
|
|
413
|
+
case "prerelease":
|
|
414
|
+
if (this.prerelease.length === 0) {
|
|
415
|
+
this.inc("patch", identifier, identifierBase);
|
|
416
|
+
}
|
|
417
|
+
this.inc("pre", identifier, identifierBase);
|
|
418
|
+
break;
|
|
419
|
+
case "release":
|
|
420
|
+
if (this.prerelease.length === 0) {
|
|
421
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
422
|
+
}
|
|
423
|
+
this.prerelease.length = 0;
|
|
424
|
+
break;
|
|
425
|
+
case "major":
|
|
426
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
427
|
+
this.major++;
|
|
428
|
+
}
|
|
429
|
+
this.minor = 0;
|
|
430
|
+
this.patch = 0;
|
|
431
|
+
this.prerelease = [];
|
|
432
|
+
break;
|
|
433
|
+
case "minor":
|
|
434
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
435
|
+
this.minor++;
|
|
436
|
+
}
|
|
437
|
+
this.patch = 0;
|
|
438
|
+
this.prerelease = [];
|
|
439
|
+
break;
|
|
440
|
+
case "patch":
|
|
441
|
+
if (this.prerelease.length === 0) {
|
|
442
|
+
this.patch++;
|
|
443
|
+
}
|
|
444
|
+
this.prerelease = [];
|
|
445
|
+
break;
|
|
446
|
+
// This probably shouldn't be used publicly.
|
|
447
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
448
|
+
case "pre": {
|
|
449
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
450
|
+
if (this.prerelease.length === 0) {
|
|
451
|
+
this.prerelease = [base];
|
|
452
|
+
} else {
|
|
453
|
+
let i = this.prerelease.length;
|
|
454
|
+
while (--i >= 0) {
|
|
455
|
+
if (typeof this.prerelease[i] === "number") {
|
|
456
|
+
this.prerelease[i]++;
|
|
457
|
+
i = -2;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
if (i === -1) {
|
|
461
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
462
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
463
|
+
}
|
|
464
|
+
this.prerelease.push(base);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (identifier) {
|
|
468
|
+
let prerelease = [identifier, base];
|
|
469
|
+
if (identifierBase === false) {
|
|
470
|
+
prerelease = [identifier];
|
|
471
|
+
}
|
|
472
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
473
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
474
|
+
if (isNaN(prereleaseBase)) {
|
|
475
|
+
this.prerelease = prerelease;
|
|
476
|
+
}
|
|
477
|
+
} else {
|
|
478
|
+
this.prerelease = prerelease;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
default:
|
|
484
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
485
|
+
}
|
|
486
|
+
this.raw = this.format();
|
|
487
|
+
if (this.build.length) {
|
|
488
|
+
this.raw += `+${this.build.join(".")}`;
|
|
489
|
+
}
|
|
490
|
+
return this;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
module.exports = SemVer;
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
498
|
+
var require_compare = __commonJS({
|
|
499
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js"(exports, module) {
|
|
500
|
+
"use strict";
|
|
501
|
+
var SemVer = require_semver();
|
|
502
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
503
|
+
module.exports = compare;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
508
|
+
var require_parse = __commonJS({
|
|
509
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module) {
|
|
510
|
+
"use strict";
|
|
511
|
+
var SemVer = require_semver();
|
|
512
|
+
var parse = (version, options, throwErrors = false) => {
|
|
513
|
+
if (version instanceof SemVer) {
|
|
514
|
+
return version;
|
|
515
|
+
}
|
|
516
|
+
try {
|
|
517
|
+
return new SemVer(version, options);
|
|
518
|
+
} catch (er) {
|
|
519
|
+
if (!throwErrors) {
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
throw er;
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
module.exports = parse;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
530
|
+
var require_valid = __commonJS({
|
|
531
|
+
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module) {
|
|
532
|
+
"use strict";
|
|
533
|
+
var parse = require_parse();
|
|
534
|
+
var valid = (version, options) => {
|
|
535
|
+
const v = parse(version, options);
|
|
536
|
+
return v ? v.version : null;
|
|
537
|
+
};
|
|
538
|
+
module.exports = valid;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
1
542
|
// ../domain/src/context-snapshot.ts
|
|
2
543
|
import { z } from "zod";
|
|
3
544
|
var tokenCountSchema = z.number().int().nonnegative();
|
|
@@ -110,7 +651,7 @@ var promptMentionPathEntryKindValues = ["file", "directory"];
|
|
|
110
651
|
var promptMentionPathEntryKindSchema = z3.enum(
|
|
111
652
|
promptMentionPathEntryKindValues
|
|
112
653
|
);
|
|
113
|
-
var promptMentionCommandTriggerValues = ["/"];
|
|
654
|
+
var promptMentionCommandTriggerValues = ["/", "$"];
|
|
114
655
|
var promptMentionCommandTriggerSchema = z3.enum(
|
|
115
656
|
promptMentionCommandTriggerValues
|
|
116
657
|
);
|
|
@@ -625,8 +1166,13 @@ var providerNativeRootSetSchema = z5.object({
|
|
|
625
1166
|
resolved: providerResolvedNativeRootsSchema
|
|
626
1167
|
}).strict();
|
|
627
1168
|
|
|
628
|
-
// ../domain/src/
|
|
1169
|
+
// ../domain/src/completed-turn-display.ts
|
|
629
1170
|
import { z as z6 } from "zod";
|
|
1171
|
+
var COMPLETED_TURN_DISPLAY_VALUES = ["collapse", "flat"];
|
|
1172
|
+
var completedTurnDisplaySchema = z6.enum(COMPLETED_TURN_DISPLAY_VALUES);
|
|
1173
|
+
|
|
1174
|
+
// ../domain/src/background-task.ts
|
|
1175
|
+
import { z as z7 } from "zod";
|
|
630
1176
|
var backgroundTaskStatusValues = [
|
|
631
1177
|
"pending",
|
|
632
1178
|
"running",
|
|
@@ -636,7 +1182,7 @@ var backgroundTaskStatusValues = [
|
|
|
636
1182
|
"killed",
|
|
637
1183
|
"stopped"
|
|
638
1184
|
];
|
|
639
|
-
var backgroundTaskStatusSchema =
|
|
1185
|
+
var backgroundTaskStatusSchema = z7.enum(backgroundTaskStatusValues);
|
|
640
1186
|
var workflowAgentStateValues = [
|
|
641
1187
|
"queued",
|
|
642
1188
|
"running",
|
|
@@ -644,53 +1190,53 @@ var workflowAgentStateValues = [
|
|
|
644
1190
|
"failed",
|
|
645
1191
|
"skipped"
|
|
646
1192
|
];
|
|
647
|
-
var workflowAgentStateSchema =
|
|
648
|
-
var workflowAgentSnapshotSchema =
|
|
649
|
-
index:
|
|
650
|
-
label:
|
|
1193
|
+
var workflowAgentStateSchema = z7.enum(workflowAgentStateValues);
|
|
1194
|
+
var workflowAgentSnapshotSchema = z7.object({
|
|
1195
|
+
index: z7.number().int().positive(),
|
|
1196
|
+
label: z7.string(),
|
|
651
1197
|
state: workflowAgentStateSchema,
|
|
652
|
-
model:
|
|
653
|
-
attempt:
|
|
654
|
-
cached:
|
|
655
|
-
lastProgressAt:
|
|
656
|
-
phaseIndex:
|
|
657
|
-
phaseTitle:
|
|
658
|
-
agentType:
|
|
659
|
-
isolation:
|
|
660
|
-
queuedAt:
|
|
661
|
-
startedAt:
|
|
662
|
-
lastToolName:
|
|
663
|
-
lastToolSummary:
|
|
664
|
-
promptPreview:
|
|
665
|
-
resultPreview:
|
|
666
|
-
error:
|
|
667
|
-
tokens:
|
|
668
|
-
toolCalls:
|
|
669
|
-
durationMs:
|
|
670
|
-
});
|
|
671
|
-
var workflowPhaseSnapshotSchema =
|
|
672
|
-
index:
|
|
673
|
-
title:
|
|
674
|
-
kind:
|
|
675
|
-
});
|
|
676
|
-
var workflowProgressSnapshotSchema =
|
|
677
|
-
phases:
|
|
678
|
-
agents:
|
|
679
|
-
});
|
|
680
|
-
var backgroundTaskUsageSchema =
|
|
681
|
-
totalTokens:
|
|
682
|
-
toolUses:
|
|
683
|
-
durationMs:
|
|
1198
|
+
model: z7.string(),
|
|
1199
|
+
attempt: z7.number().int().positive(),
|
|
1200
|
+
cached: z7.boolean(),
|
|
1201
|
+
lastProgressAt: z7.number(),
|
|
1202
|
+
phaseIndex: z7.number().int().positive().optional(),
|
|
1203
|
+
phaseTitle: z7.string().optional(),
|
|
1204
|
+
agentType: z7.string().optional(),
|
|
1205
|
+
isolation: z7.string().optional(),
|
|
1206
|
+
queuedAt: z7.number().optional(),
|
|
1207
|
+
startedAt: z7.number().optional(),
|
|
1208
|
+
lastToolName: z7.string().optional(),
|
|
1209
|
+
lastToolSummary: z7.string().optional(),
|
|
1210
|
+
promptPreview: z7.string().optional(),
|
|
1211
|
+
resultPreview: z7.string().optional(),
|
|
1212
|
+
error: z7.string().optional(),
|
|
1213
|
+
tokens: z7.number().optional(),
|
|
1214
|
+
toolCalls: z7.number().optional(),
|
|
1215
|
+
durationMs: z7.number().optional()
|
|
1216
|
+
});
|
|
1217
|
+
var workflowPhaseSnapshotSchema = z7.object({
|
|
1218
|
+
index: z7.number().int().positive(),
|
|
1219
|
+
title: z7.string(),
|
|
1220
|
+
kind: z7.string().optional()
|
|
1221
|
+
});
|
|
1222
|
+
var workflowProgressSnapshotSchema = z7.object({
|
|
1223
|
+
phases: z7.array(workflowPhaseSnapshotSchema),
|
|
1224
|
+
agents: z7.array(workflowAgentSnapshotSchema)
|
|
1225
|
+
});
|
|
1226
|
+
var backgroundTaskUsageSchema = z7.object({
|
|
1227
|
+
totalTokens: z7.number(),
|
|
1228
|
+
toolUses: z7.number(),
|
|
1229
|
+
durationMs: z7.number()
|
|
684
1230
|
});
|
|
685
1231
|
|
|
686
1232
|
// ../domain/src/provider-event.ts
|
|
687
|
-
import { z as
|
|
1233
|
+
import { z as z16 } from "zod";
|
|
688
1234
|
|
|
689
1235
|
// ../domain/src/thread-events.ts
|
|
690
|
-
import { z as
|
|
1236
|
+
import { z as z13 } from "zod";
|
|
691
1237
|
|
|
692
1238
|
// ../domain/src/pending-interactions.ts
|
|
693
|
-
import { z as
|
|
1239
|
+
import { z as z10 } from "zod";
|
|
694
1240
|
|
|
695
1241
|
// ../domain/src/plugin-interaction-limits.ts
|
|
696
1242
|
var PLUGIN_INTERACTION_MAX_TITLE_LENGTH = 160;
|
|
@@ -700,223 +1246,223 @@ function jsonByteLength(value) {
|
|
|
700
1246
|
}
|
|
701
1247
|
|
|
702
1248
|
// ../domain/src/item-presentation.ts
|
|
703
|
-
import { z as
|
|
1249
|
+
import { z as z8 } from "zod";
|
|
704
1250
|
var THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH = 280;
|
|
705
|
-
var threadEventItemPresentationLabelSchema =
|
|
706
|
-
pending:
|
|
707
|
-
completed:
|
|
1251
|
+
var threadEventItemPresentationLabelSchema = z8.object({
|
|
1252
|
+
pending: z8.string().min(1),
|
|
1253
|
+
completed: z8.string().min(1)
|
|
708
1254
|
});
|
|
709
|
-
var threadEventItemPresentationIconSchema =
|
|
710
|
-
glyph:
|
|
1255
|
+
var threadEventItemPresentationIconSchema = z8.object({
|
|
1256
|
+
glyph: z8.string().min(1)
|
|
711
1257
|
});
|
|
712
|
-
var threadEventItemPresentationTintSchema =
|
|
713
|
-
light:
|
|
714
|
-
dark:
|
|
1258
|
+
var threadEventItemPresentationTintSchema = z8.object({
|
|
1259
|
+
light: z8.string().min(1),
|
|
1260
|
+
dark: z8.string().min(1)
|
|
715
1261
|
});
|
|
716
1262
|
var THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH = 80;
|
|
717
|
-
var threadEventItemPresentationBadgeSchema =
|
|
718
|
-
glyph:
|
|
719
|
-
label:
|
|
720
|
-
hint:
|
|
721
|
-
tone:
|
|
1263
|
+
var threadEventItemPresentationBadgeSchema = z8.object({
|
|
1264
|
+
glyph: z8.string().min(1),
|
|
1265
|
+
label: z8.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
1266
|
+
hint: z8.string().min(1).max(THREAD_EVENT_ITEM_PRESENTATION_BADGE_LABEL_MAX_LENGTH),
|
|
1267
|
+
tone: z8.enum(["neutral", "destructive"])
|
|
722
1268
|
});
|
|
723
|
-
var threadEventItemPresentationSchema =
|
|
1269
|
+
var threadEventItemPresentationSchema = z8.object({
|
|
724
1270
|
label: threadEventItemPresentationLabelSchema,
|
|
725
1271
|
icon: threadEventItemPresentationIconSchema,
|
|
726
|
-
title:
|
|
727
|
-
detail:
|
|
728
|
-
suppress:
|
|
1272
|
+
title: z8.string().optional(),
|
|
1273
|
+
detail: z8.string().max(THREAD_EVENT_ITEM_PRESENTATION_DETAIL_MAX_LENGTH).optional(),
|
|
1274
|
+
suppress: z8.boolean().optional(),
|
|
729
1275
|
tint: threadEventItemPresentationTintSchema.optional(),
|
|
730
1276
|
badge: threadEventItemPresentationBadgeSchema.optional()
|
|
731
1277
|
});
|
|
732
1278
|
|
|
733
1279
|
// ../domain/src/provider-extension-kind.ts
|
|
734
|
-
import { z as
|
|
1280
|
+
import { z as z9 } from "zod";
|
|
735
1281
|
var EXTENSION_KIND_PATTERN = /^[a-z0-9-]+\/[a-z0-9-]+$/u;
|
|
736
1282
|
function isExtensionKind(value) {
|
|
737
1283
|
return EXTENSION_KIND_PATTERN.test(value);
|
|
738
1284
|
}
|
|
739
|
-
var extensionKindSchema =
|
|
1285
|
+
var extensionKindSchema = z9.string().refine(isExtensionKind, {
|
|
740
1286
|
message: 'extension kinds are "<pluginId>/<name>" (lowercase letters, digits, and "-")'
|
|
741
1287
|
});
|
|
742
1288
|
|
|
743
1289
|
// ../domain/src/pending-interactions.ts
|
|
744
|
-
var pendingInteractionStatusSchema =
|
|
1290
|
+
var pendingInteractionStatusSchema = z10.enum([
|
|
745
1291
|
"pending",
|
|
746
1292
|
"resolving",
|
|
747
1293
|
"resolved",
|
|
748
1294
|
"interrupted"
|
|
749
1295
|
]);
|
|
750
|
-
var pendingInteractionCommandActionSchema =
|
|
1296
|
+
var pendingInteractionCommandActionSchema = z10.discriminatedUnion(
|
|
751
1297
|
"type",
|
|
752
1298
|
[
|
|
753
|
-
|
|
754
|
-
type:
|
|
755
|
-
command:
|
|
756
|
-
name:
|
|
757
|
-
path:
|
|
1299
|
+
z10.object({
|
|
1300
|
+
type: z10.literal("read"),
|
|
1301
|
+
command: z10.string(),
|
|
1302
|
+
name: z10.string(),
|
|
1303
|
+
path: z10.string()
|
|
758
1304
|
}),
|
|
759
|
-
|
|
760
|
-
type:
|
|
761
|
-
command:
|
|
762
|
-
path:
|
|
1305
|
+
z10.object({
|
|
1306
|
+
type: z10.literal("listFiles"),
|
|
1307
|
+
command: z10.string(),
|
|
1308
|
+
path: z10.string().nullable()
|
|
763
1309
|
}),
|
|
764
|
-
|
|
765
|
-
type:
|
|
766
|
-
command:
|
|
767
|
-
query:
|
|
768
|
-
path:
|
|
1310
|
+
z10.object({
|
|
1311
|
+
type: z10.literal("search"),
|
|
1312
|
+
command: z10.string(),
|
|
1313
|
+
query: z10.string().nullable(),
|
|
1314
|
+
path: z10.string().nullable()
|
|
769
1315
|
}),
|
|
770
|
-
|
|
771
|
-
type:
|
|
772
|
-
command:
|
|
1316
|
+
z10.object({
|
|
1317
|
+
type: z10.literal("unknown"),
|
|
1318
|
+
command: z10.string()
|
|
773
1319
|
})
|
|
774
1320
|
]
|
|
775
1321
|
);
|
|
776
|
-
var pendingInteractionNetworkPermissionsSchema =
|
|
777
|
-
enabled:
|
|
1322
|
+
var pendingInteractionNetworkPermissionsSchema = z10.object({
|
|
1323
|
+
enabled: z10.boolean().nullable()
|
|
778
1324
|
});
|
|
779
|
-
var pendingInteractionFileSystemPermissionsSchema =
|
|
780
|
-
read:
|
|
781
|
-
write:
|
|
1325
|
+
var pendingInteractionFileSystemPermissionsSchema = z10.object({
|
|
1326
|
+
read: z10.array(z10.string()),
|
|
1327
|
+
write: z10.array(z10.string())
|
|
782
1328
|
});
|
|
783
|
-
var pendingInteractionMacOsPreferencesPermissionSchema =
|
|
1329
|
+
var pendingInteractionMacOsPreferencesPermissionSchema = z10.enum([
|
|
784
1330
|
"none",
|
|
785
1331
|
"read_only",
|
|
786
1332
|
"read_write"
|
|
787
1333
|
]);
|
|
788
|
-
var pendingInteractionMacOsContactsPermissionSchema =
|
|
1334
|
+
var pendingInteractionMacOsContactsPermissionSchema = z10.enum([
|
|
789
1335
|
"none",
|
|
790
1336
|
"read_only",
|
|
791
1337
|
"read_write"
|
|
792
1338
|
]);
|
|
793
|
-
var pendingInteractionMacOsAutomationPermissionSchema =
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
kind:
|
|
798
|
-
bundleIds:
|
|
1339
|
+
var pendingInteractionMacOsAutomationPermissionSchema = z10.union([
|
|
1340
|
+
z10.literal("none"),
|
|
1341
|
+
z10.literal("all"),
|
|
1342
|
+
z10.object({
|
|
1343
|
+
kind: z10.literal("bundle_ids"),
|
|
1344
|
+
bundleIds: z10.array(z10.string())
|
|
799
1345
|
})
|
|
800
1346
|
]);
|
|
801
|
-
var pendingInteractionMacOsPermissionsSchema =
|
|
1347
|
+
var pendingInteractionMacOsPermissionsSchema = z10.object({
|
|
802
1348
|
preferences: pendingInteractionMacOsPreferencesPermissionSchema,
|
|
803
1349
|
automations: pendingInteractionMacOsAutomationPermissionSchema,
|
|
804
|
-
launchServices:
|
|
805
|
-
accessibility:
|
|
806
|
-
calendar:
|
|
807
|
-
reminders:
|
|
1350
|
+
launchServices: z10.boolean(),
|
|
1351
|
+
accessibility: z10.boolean(),
|
|
1352
|
+
calendar: z10.boolean(),
|
|
1353
|
+
reminders: z10.boolean(),
|
|
808
1354
|
contacts: pendingInteractionMacOsContactsPermissionSchema
|
|
809
1355
|
});
|
|
810
|
-
var pendingInteractionRequestedPermissionProfileSchema =
|
|
1356
|
+
var pendingInteractionRequestedPermissionProfileSchema = z10.object({
|
|
811
1357
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
812
1358
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable(),
|
|
813
1359
|
macos: pendingInteractionMacOsPermissionsSchema.nullable()
|
|
814
1360
|
});
|
|
815
|
-
var pendingInteractionGrantablePermissionProfileSchema =
|
|
1361
|
+
var pendingInteractionGrantablePermissionProfileSchema = z10.object({
|
|
816
1362
|
network: pendingInteractionNetworkPermissionsSchema.nullable(),
|
|
817
1363
|
fileSystem: pendingInteractionFileSystemPermissionsSchema.nullable()
|
|
818
1364
|
}).strict();
|
|
819
1365
|
var pendingInteractionGrantedPermissionProfileSchema = pendingInteractionGrantablePermissionProfileSchema;
|
|
820
|
-
var pendingInteractionApprovalDecisionSchema =
|
|
1366
|
+
var pendingInteractionApprovalDecisionSchema = z10.enum([
|
|
821
1367
|
"allow_once",
|
|
822
1368
|
"allow_for_session",
|
|
823
1369
|
"deny"
|
|
824
1370
|
]);
|
|
825
|
-
var pendingInteractionFileChangeWriteScopeSchema =
|
|
826
|
-
var pendingInteractionCommandApprovalSubjectSchema =
|
|
827
|
-
kind:
|
|
828
|
-
itemId:
|
|
829
|
-
command:
|
|
830
|
-
cwd:
|
|
831
|
-
actions:
|
|
1371
|
+
var pendingInteractionFileChangeWriteScopeSchema = z10.string().min(1);
|
|
1372
|
+
var pendingInteractionCommandApprovalSubjectSchema = z10.object({
|
|
1373
|
+
kind: z10.literal("command"),
|
|
1374
|
+
itemId: z10.string().min(1),
|
|
1375
|
+
command: z10.string().min(1),
|
|
1376
|
+
cwd: z10.string().nullable(),
|
|
1377
|
+
actions: z10.array(pendingInteractionCommandActionSchema),
|
|
832
1378
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
833
1379
|
});
|
|
834
|
-
var pendingInteractionFileChangeApprovalSubjectSchema =
|
|
835
|
-
kind:
|
|
836
|
-
itemId:
|
|
1380
|
+
var pendingInteractionFileChangeApprovalSubjectSchema = z10.object({
|
|
1381
|
+
kind: z10.literal("file_change"),
|
|
1382
|
+
itemId: z10.string().min(1),
|
|
837
1383
|
writeScope: pendingInteractionFileChangeWriteScopeSchema.nullable(),
|
|
838
1384
|
sessionGrant: pendingInteractionGrantablePermissionProfileSchema.nullable()
|
|
839
1385
|
});
|
|
840
|
-
var pendingInteractionPermissionGrantApprovalSubjectSchema =
|
|
841
|
-
kind:
|
|
842
|
-
itemId:
|
|
843
|
-
toolName:
|
|
1386
|
+
var pendingInteractionPermissionGrantApprovalSubjectSchema = z10.object({
|
|
1387
|
+
kind: z10.literal("permission_grant"),
|
|
1388
|
+
itemId: z10.string().min(1),
|
|
1389
|
+
toolName: z10.string().nullable(),
|
|
844
1390
|
permissions: pendingInteractionGrantablePermissionProfileSchema
|
|
845
1391
|
});
|
|
846
|
-
var pendingInteractionPlanApprovalSubjectSchema =
|
|
847
|
-
kind:
|
|
848
|
-
itemId:
|
|
849
|
-
plan:
|
|
850
|
-
planFilePath:
|
|
1392
|
+
var pendingInteractionPlanApprovalSubjectSchema = z10.object({
|
|
1393
|
+
kind: z10.literal("plan"),
|
|
1394
|
+
itemId: z10.string().min(1),
|
|
1395
|
+
plan: z10.string().min(1),
|
|
1396
|
+
planFilePath: z10.string().min(1).nullable()
|
|
851
1397
|
});
|
|
852
|
-
var pendingInteractionToolUseApprovalSubjectSchema =
|
|
853
|
-
kind:
|
|
854
|
-
itemId:
|
|
855
|
-
tool:
|
|
1398
|
+
var pendingInteractionToolUseApprovalSubjectSchema = z10.object({
|
|
1399
|
+
kind: z10.literal("tool_use"),
|
|
1400
|
+
itemId: z10.string().min(1),
|
|
1401
|
+
tool: z10.string().min(1),
|
|
856
1402
|
presentation: threadEventItemPresentationSchema
|
|
857
1403
|
});
|
|
858
|
-
var pendingInteractionApprovalSubjectSchema =
|
|
1404
|
+
var pendingInteractionApprovalSubjectSchema = z10.discriminatedUnion("kind", [
|
|
859
1405
|
pendingInteractionCommandApprovalSubjectSchema,
|
|
860
1406
|
pendingInteractionFileChangeApprovalSubjectSchema,
|
|
861
1407
|
pendingInteractionPermissionGrantApprovalSubjectSchema,
|
|
862
1408
|
pendingInteractionPlanApprovalSubjectSchema,
|
|
863
1409
|
pendingInteractionToolUseApprovalSubjectSchema
|
|
864
1410
|
]);
|
|
865
|
-
var approvalPendingInteractionPayloadSchema =
|
|
866
|
-
kind:
|
|
1411
|
+
var approvalPendingInteractionPayloadSchema = z10.object({
|
|
1412
|
+
kind: z10.literal("approval"),
|
|
867
1413
|
subject: pendingInteractionApprovalSubjectSchema,
|
|
868
|
-
reason:
|
|
869
|
-
availableDecisions:
|
|
1414
|
+
reason: z10.string().nullable(),
|
|
1415
|
+
availableDecisions: z10.array(pendingInteractionApprovalDecisionSchema).min(1)
|
|
870
1416
|
});
|
|
871
1417
|
var USER_QUESTION_MAX_QUESTIONS = 4;
|
|
872
1418
|
var USER_QUESTION_MAX_OPTIONS = 4;
|
|
873
1419
|
var USER_QUESTION_MAX_SELECTED = 4;
|
|
874
1420
|
var USER_QUESTION_MAX_FREE_TEXT_LENGTH = 4096;
|
|
875
|
-
var pendingInteractionUserQuestionIdSchema =
|
|
1421
|
+
var pendingInteractionUserQuestionIdSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
876
1422
|
message: "User question ids cannot be blank"
|
|
877
1423
|
});
|
|
878
|
-
var pendingInteractionUserQuestionPromptSchema =
|
|
1424
|
+
var pendingInteractionUserQuestionPromptSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
879
1425
|
message: "User question prompts cannot be blank"
|
|
880
1426
|
});
|
|
881
|
-
var pendingInteractionUserQuestionShortLabelSchema =
|
|
1427
|
+
var pendingInteractionUserQuestionShortLabelSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
882
1428
|
message: "User question short labels cannot be blank"
|
|
883
1429
|
});
|
|
884
|
-
var pendingInteractionUserQuestionOptionValueSchema =
|
|
1430
|
+
var pendingInteractionUserQuestionOptionValueSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
885
1431
|
message: "User question option values cannot be blank"
|
|
886
1432
|
});
|
|
887
|
-
var pendingInteractionUserQuestionOptionLabelSchema =
|
|
1433
|
+
var pendingInteractionUserQuestionOptionLabelSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
888
1434
|
message: "User question option labels cannot be blank"
|
|
889
1435
|
});
|
|
890
|
-
var pendingInteractionUserQuestionOptionDescriptionSchema =
|
|
1436
|
+
var pendingInteractionUserQuestionOptionDescriptionSchema = z10.string().min(1).refine((value) => value.trim().length > 0, {
|
|
891
1437
|
message: "User question option descriptions cannot be blank"
|
|
892
1438
|
});
|
|
893
|
-
var pendingInteractionUserQuestionFreeTextSchema =
|
|
1439
|
+
var pendingInteractionUserQuestionFreeTextSchema = z10.string().min(1).max(
|
|
894
1440
|
USER_QUESTION_MAX_FREE_TEXT_LENGTH,
|
|
895
1441
|
`User question free text cannot exceed ${USER_QUESTION_MAX_FREE_TEXT_LENGTH} characters`
|
|
896
1442
|
).refine((value) => value.trim().length > 0, {
|
|
897
1443
|
message: "User question free text cannot be blank"
|
|
898
1444
|
});
|
|
899
|
-
var pendingInteractionUserQuestionOptionSchema =
|
|
1445
|
+
var pendingInteractionUserQuestionOptionSchema = z10.object({
|
|
900
1446
|
value: pendingInteractionUserQuestionOptionValueSchema,
|
|
901
1447
|
label: pendingInteractionUserQuestionOptionLabelSchema,
|
|
902
1448
|
description: pendingInteractionUserQuestionOptionDescriptionSchema.optional()
|
|
903
1449
|
});
|
|
904
|
-
var pendingInteractionUserQuestionQuestionSchema =
|
|
1450
|
+
var pendingInteractionUserQuestionQuestionSchema = z10.object({
|
|
905
1451
|
id: pendingInteractionUserQuestionIdSchema,
|
|
906
1452
|
prompt: pendingInteractionUserQuestionPromptSchema,
|
|
907
1453
|
shortLabel: pendingInteractionUserQuestionShortLabelSchema.optional(),
|
|
908
|
-
multiSelect:
|
|
909
|
-
options:
|
|
1454
|
+
multiSelect: z10.boolean(),
|
|
1455
|
+
options: z10.array(pendingInteractionUserQuestionOptionSchema).max(
|
|
910
1456
|
USER_QUESTION_MAX_OPTIONS,
|
|
911
1457
|
`User questions cannot include more than ${USER_QUESTION_MAX_OPTIONS} options`
|
|
912
1458
|
).optional(),
|
|
913
|
-
allowFreeText:
|
|
1459
|
+
allowFreeText: z10.boolean()
|
|
914
1460
|
}).superRefine((question, context) => {
|
|
915
1461
|
const optionValues = /* @__PURE__ */ new Set();
|
|
916
1462
|
question.options?.forEach((option, index) => {
|
|
917
1463
|
if (optionValues.has(option.value)) {
|
|
918
1464
|
context.addIssue({
|
|
919
|
-
code:
|
|
1465
|
+
code: z10.ZodIssueCode.custom,
|
|
920
1466
|
message: "User question option values must be unique",
|
|
921
1467
|
path: ["options", index, "value"]
|
|
922
1468
|
});
|
|
@@ -931,9 +1477,9 @@ var pendingInteractionUserQuestionQuestionSchema = z9.object({
|
|
|
931
1477
|
path: ["options"]
|
|
932
1478
|
}
|
|
933
1479
|
);
|
|
934
|
-
var userQuestionPendingInteractionPayloadSchema =
|
|
935
|
-
kind:
|
|
936
|
-
questions:
|
|
1480
|
+
var userQuestionPendingInteractionPayloadSchema = z10.object({
|
|
1481
|
+
kind: z10.literal("user_question"),
|
|
1482
|
+
questions: z10.array(pendingInteractionUserQuestionQuestionSchema).min(1).max(
|
|
937
1483
|
USER_QUESTION_MAX_QUESTIONS,
|
|
938
1484
|
`User questions cannot include more than ${USER_QUESTION_MAX_QUESTIONS} questions`
|
|
939
1485
|
)
|
|
@@ -942,7 +1488,7 @@ var userQuestionPendingInteractionPayloadSchema = z9.object({
|
|
|
942
1488
|
payload.questions.forEach((question, index) => {
|
|
943
1489
|
if (questionIds.has(question.id)) {
|
|
944
1490
|
context.addIssue({
|
|
945
|
-
code:
|
|
1491
|
+
code: z10.ZodIssueCode.custom,
|
|
946
1492
|
message: "User question ids must be unique",
|
|
947
1493
|
path: ["questions", index, "id"]
|
|
948
1494
|
});
|
|
@@ -951,24 +1497,24 @@ var userQuestionPendingInteractionPayloadSchema = z9.object({
|
|
|
951
1497
|
questionIds.add(question.id);
|
|
952
1498
|
});
|
|
953
1499
|
});
|
|
954
|
-
var pluginPendingInteractionPayloadSchema =
|
|
955
|
-
kind:
|
|
956
|
-
title:
|
|
1500
|
+
var pluginPendingInteractionPayloadSchema = z10.object({
|
|
1501
|
+
kind: z10.literal("plugin"),
|
|
1502
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
957
1503
|
data: jsonValueSchema
|
|
958
1504
|
});
|
|
959
|
-
var pluginExtensionInteractionRequestPayloadSchema =
|
|
1505
|
+
var pluginExtensionInteractionRequestPayloadSchema = z10.object({
|
|
960
1506
|
kind: extensionKindSchema,
|
|
961
|
-
title:
|
|
1507
|
+
title: z10.string().trim().min(1).max(PLUGIN_INTERACTION_MAX_TITLE_LENGTH),
|
|
962
1508
|
data: jsonValueSchema.refine(
|
|
963
1509
|
(value) => jsonByteLength(value) <= PLUGIN_INTERACTION_MAX_PAYLOAD_BYTES,
|
|
964
1510
|
{ message: "Plugin request data exceeds 64 KiB" }
|
|
965
1511
|
)
|
|
966
1512
|
});
|
|
967
|
-
var interactionRequestPayloadSchema =
|
|
1513
|
+
var interactionRequestPayloadSchema = z10.union([
|
|
968
1514
|
userQuestionPendingInteractionPayloadSchema,
|
|
969
1515
|
pluginExtensionInteractionRequestPayloadSchema
|
|
970
1516
|
]);
|
|
971
|
-
var pendingInteractionPayloadSchema =
|
|
1517
|
+
var pendingInteractionPayloadSchema = z10.union([
|
|
972
1518
|
approvalPendingInteractionPayloadSchema,
|
|
973
1519
|
userQuestionPendingInteractionPayloadSchema,
|
|
974
1520
|
pluginExtensionInteractionRequestPayloadSchema
|
|
@@ -977,42 +1523,42 @@ function isApprovalPendingInteractionPayload(payload) {
|
|
|
977
1523
|
return payload.kind === "approval";
|
|
978
1524
|
}
|
|
979
1525
|
var approvalDecisionDiscriminatorError = "Invalid discriminator value. Expected 'allow_once' | 'allow_for_session' | 'deny'";
|
|
980
|
-
var approvalPendingInteractionResolutionSchema =
|
|
1526
|
+
var approvalPendingInteractionResolutionSchema = z10.discriminatedUnion(
|
|
981
1527
|
"decision",
|
|
982
1528
|
[
|
|
983
|
-
|
|
984
|
-
decision:
|
|
1529
|
+
z10.object({
|
|
1530
|
+
decision: z10.literal("allow_once"),
|
|
985
1531
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
986
1532
|
}),
|
|
987
|
-
|
|
988
|
-
decision:
|
|
1533
|
+
z10.object({
|
|
1534
|
+
decision: z10.literal("allow_for_session"),
|
|
989
1535
|
grantedPermissions: pendingInteractionGrantedPermissionProfileSchema.nullable()
|
|
990
1536
|
}),
|
|
991
|
-
|
|
992
|
-
decision:
|
|
1537
|
+
z10.object({
|
|
1538
|
+
decision: z10.literal("deny")
|
|
993
1539
|
})
|
|
994
1540
|
],
|
|
995
1541
|
approvalDecisionDiscriminatorError
|
|
996
1542
|
);
|
|
997
|
-
var pendingInteractionUserAnswerSchema =
|
|
998
|
-
selected:
|
|
1543
|
+
var pendingInteractionUserAnswerSchema = z10.object({
|
|
1544
|
+
selected: z10.array(z10.string().min(1)).max(
|
|
999
1545
|
USER_QUESTION_MAX_SELECTED,
|
|
1000
1546
|
`User question selected choices cannot exceed ${USER_QUESTION_MAX_SELECTED}`
|
|
1001
1547
|
),
|
|
1002
1548
|
freeText: pendingInteractionUserQuestionFreeTextSchema.optional()
|
|
1003
1549
|
});
|
|
1004
|
-
var userQuestionPendingInteractionResolutionSchema =
|
|
1005
|
-
kind:
|
|
1006
|
-
answers:
|
|
1550
|
+
var userQuestionPendingInteractionResolutionSchema = z10.object({
|
|
1551
|
+
kind: z10.literal("user_answer"),
|
|
1552
|
+
answers: z10.record(z10.string().min(1), pendingInteractionUserAnswerSchema)
|
|
1007
1553
|
});
|
|
1008
|
-
var pluginPendingInteractionResolutionSchema =
|
|
1009
|
-
kind:
|
|
1554
|
+
var pluginPendingInteractionResolutionSchema = z10.object({
|
|
1555
|
+
kind: z10.literal("plugin_submitted")
|
|
1010
1556
|
});
|
|
1011
|
-
var pluginExtensionInteractionResolutionSchema =
|
|
1012
|
-
kind:
|
|
1557
|
+
var pluginExtensionInteractionResolutionSchema = z10.object({
|
|
1558
|
+
kind: z10.literal("request_answer"),
|
|
1013
1559
|
value: jsonValueSchema
|
|
1014
1560
|
});
|
|
1015
|
-
var pendingInteractionResolutionSchema =
|
|
1561
|
+
var pendingInteractionResolutionSchema = z10.union(
|
|
1016
1562
|
[
|
|
1017
1563
|
approvalPendingInteractionResolutionSchema,
|
|
1018
1564
|
userQuestionPendingInteractionResolutionSchema,
|
|
@@ -1024,56 +1570,56 @@ var pendingInteractionResolutionSchema = z9.union(
|
|
|
1024
1570
|
function isApprovalPendingInteractionResolution(resolution) {
|
|
1025
1571
|
return "decision" in resolution;
|
|
1026
1572
|
}
|
|
1027
|
-
var approvalInteractionOutcomeSchema =
|
|
1573
|
+
var approvalInteractionOutcomeSchema = z10.object({
|
|
1028
1574
|
payload: approvalPendingInteractionPayloadSchema,
|
|
1029
1575
|
resolution: approvalPendingInteractionResolutionSchema
|
|
1030
1576
|
});
|
|
1031
|
-
var userQuestionInteractionOutcomeSchema =
|
|
1577
|
+
var userQuestionInteractionOutcomeSchema = z10.object({
|
|
1032
1578
|
payload: userQuestionPendingInteractionPayloadSchema,
|
|
1033
1579
|
resolution: userQuestionPendingInteractionResolutionSchema
|
|
1034
1580
|
});
|
|
1035
|
-
var pluginExtensionInteractionOutcomeSchema =
|
|
1581
|
+
var pluginExtensionInteractionOutcomeSchema = z10.object({
|
|
1036
1582
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
1037
1583
|
resolution: pluginExtensionInteractionResolutionSchema
|
|
1038
1584
|
});
|
|
1039
|
-
var providerInteractionOutcomeSchema =
|
|
1585
|
+
var providerInteractionOutcomeSchema = z10.union([
|
|
1040
1586
|
approvalInteractionOutcomeSchema,
|
|
1041
1587
|
userQuestionInteractionOutcomeSchema,
|
|
1042
1588
|
pluginExtensionInteractionOutcomeSchema
|
|
1043
1589
|
]);
|
|
1044
|
-
var pendingInteractionProviderOriginSchema =
|
|
1045
|
-
kind:
|
|
1046
|
-
providerId:
|
|
1047
|
-
providerThreadId:
|
|
1048
|
-
providerRequestId:
|
|
1049
|
-
});
|
|
1050
|
-
var pendingInteractionPluginOriginSchema =
|
|
1051
|
-
kind:
|
|
1052
|
-
pluginId:
|
|
1053
|
-
rendererId:
|
|
1054
|
-
});
|
|
1055
|
-
var pendingInteractionCreateSchema =
|
|
1056
|
-
threadId:
|
|
1057
|
-
turnId:
|
|
1058
|
-
providerId:
|
|
1059
|
-
providerThreadId:
|
|
1060
|
-
providerRequestId:
|
|
1590
|
+
var pendingInteractionProviderOriginSchema = z10.object({
|
|
1591
|
+
kind: z10.literal("provider"),
|
|
1592
|
+
providerId: z10.string().min(1),
|
|
1593
|
+
providerThreadId: z10.string().min(1),
|
|
1594
|
+
providerRequestId: z10.string().min(1)
|
|
1595
|
+
});
|
|
1596
|
+
var pendingInteractionPluginOriginSchema = z10.object({
|
|
1597
|
+
kind: z10.literal("plugin"),
|
|
1598
|
+
pluginId: z10.string().min(1),
|
|
1599
|
+
rendererId: z10.string().min(1)
|
|
1600
|
+
});
|
|
1601
|
+
var pendingInteractionCreateSchema = z10.object({
|
|
1602
|
+
threadId: z10.string().min(1),
|
|
1603
|
+
turnId: z10.string().min(1),
|
|
1604
|
+
providerId: z10.string().min(1),
|
|
1605
|
+
providerThreadId: z10.string().min(1),
|
|
1606
|
+
providerRequestId: z10.string().min(1),
|
|
1061
1607
|
payload: pendingInteractionPayloadSchema
|
|
1062
1608
|
});
|
|
1063
|
-
var pendingInteractionBaseSchema =
|
|
1064
|
-
id:
|
|
1065
|
-
threadId:
|
|
1609
|
+
var pendingInteractionBaseSchema = z10.object({
|
|
1610
|
+
id: z10.string().min(1),
|
|
1611
|
+
threadId: z10.string().min(1),
|
|
1066
1612
|
status: pendingInteractionStatusSchema,
|
|
1067
|
-
statusReason:
|
|
1068
|
-
createdAt:
|
|
1069
|
-
expiresAt:
|
|
1070
|
-
resolvedAt:
|
|
1613
|
+
statusReason: z10.string().nullable(),
|
|
1614
|
+
createdAt: z10.number().int().nonnegative(),
|
|
1615
|
+
expiresAt: z10.number().int().nonnegative().nullable().optional(),
|
|
1616
|
+
resolvedAt: z10.number().int().nonnegative().nullable()
|
|
1071
1617
|
});
|
|
1072
1618
|
var providerPendingInteractionBaseSchema = pendingInteractionBaseSchema.extend({
|
|
1073
|
-
turnId:
|
|
1074
|
-
providerId:
|
|
1075
|
-
providerThreadId:
|
|
1076
|
-
providerRequestId:
|
|
1619
|
+
turnId: z10.string().min(1),
|
|
1620
|
+
providerId: z10.string().min(1),
|
|
1621
|
+
providerThreadId: z10.string().min(1),
|
|
1622
|
+
providerRequestId: z10.string().min(1),
|
|
1077
1623
|
origin: pendingInteractionProviderOriginSchema.optional()
|
|
1078
1624
|
});
|
|
1079
1625
|
var approvalPendingInteractionSchema = providerPendingInteractionBaseSchema.extend({
|
|
@@ -1088,30 +1634,30 @@ var pluginExtensionPendingInteractionSchema = providerPendingInteractionBaseSche
|
|
|
1088
1634
|
payload: pluginExtensionInteractionRequestPayloadSchema,
|
|
1089
1635
|
resolution: pluginExtensionInteractionResolutionSchema.nullable()
|
|
1090
1636
|
});
|
|
1091
|
-
var providerPendingInteractionSchema =
|
|
1637
|
+
var providerPendingInteractionSchema = z10.union([
|
|
1092
1638
|
approvalPendingInteractionSchema,
|
|
1093
1639
|
userQuestionPendingInteractionSchema,
|
|
1094
1640
|
pluginExtensionPendingInteractionSchema
|
|
1095
1641
|
]);
|
|
1096
1642
|
var pluginPendingInteractionSchema = pendingInteractionBaseSchema.extend({
|
|
1097
|
-
turnId:
|
|
1643
|
+
turnId: z10.string().min(1).nullable(),
|
|
1098
1644
|
origin: pendingInteractionPluginOriginSchema,
|
|
1099
1645
|
payload: pluginPendingInteractionPayloadSchema,
|
|
1100
1646
|
resolution: pluginPendingInteractionResolutionSchema.nullable()
|
|
1101
1647
|
});
|
|
1102
|
-
var pendingInteractionSchema =
|
|
1648
|
+
var pendingInteractionSchema = z10.union([
|
|
1103
1649
|
providerPendingInteractionSchema,
|
|
1104
1650
|
pluginPendingInteractionSchema
|
|
1105
1651
|
]);
|
|
1106
|
-
var interactionLifecycleRecordBaseSchema =
|
|
1107
|
-
id:
|
|
1652
|
+
var interactionLifecycleRecordBaseSchema = z10.object({
|
|
1653
|
+
id: z10.string().min(1),
|
|
1108
1654
|
status: pendingInteractionStatusSchema,
|
|
1109
|
-
statusReason:
|
|
1655
|
+
statusReason: z10.string().nullable()
|
|
1110
1656
|
});
|
|
1111
|
-
var interactionLifecycleProviderOriginSchema =
|
|
1112
|
-
kind:
|
|
1113
|
-
providerId:
|
|
1114
|
-
providerRequestId:
|
|
1657
|
+
var interactionLifecycleProviderOriginSchema = z10.object({
|
|
1658
|
+
kind: z10.literal("provider"),
|
|
1659
|
+
providerId: z10.string().min(1),
|
|
1660
|
+
providerRequestId: z10.string().min(1)
|
|
1115
1661
|
});
|
|
1116
1662
|
var approvalInteractionLifecycleRecordPayloadSchema = approvalPendingInteractionPayloadSchema.omit({ availableDecisions: true });
|
|
1117
1663
|
var approvalInteractionLifecycleSchema = interactionLifecycleRecordBaseSchema.extend({
|
|
@@ -1136,7 +1682,7 @@ var pluginExtensionInteractionLifecycleSchema = interactionLifecycleRecordBaseSc
|
|
|
1136
1682
|
}),
|
|
1137
1683
|
resolution: pluginExtensionInteractionResolutionSchema.omit({ value: true }).nullable()
|
|
1138
1684
|
});
|
|
1139
|
-
var interactionLifecycleSchema =
|
|
1685
|
+
var interactionLifecycleSchema = z10.union([
|
|
1140
1686
|
approvalInteractionLifecycleSchema,
|
|
1141
1687
|
userQuestionInteractionLifecycleSchema,
|
|
1142
1688
|
pluginInteractionLifecycleSchema,
|
|
@@ -1144,11 +1690,11 @@ var interactionLifecycleSchema = z9.union([
|
|
|
1144
1690
|
]);
|
|
1145
1691
|
|
|
1146
1692
|
// ../domain/src/protocol-ids.ts
|
|
1147
|
-
import { z as
|
|
1148
|
-
var clientTurnRequestIdSchema =
|
|
1693
|
+
import { z as z11 } from "zod";
|
|
1694
|
+
var clientTurnRequestIdSchema = z11.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
|
|
1149
1695
|
|
|
1150
1696
|
// ../domain/src/system-message.ts
|
|
1151
|
-
import { z as
|
|
1697
|
+
import { z as z12 } from "zod";
|
|
1152
1698
|
var systemMessageKindValues = [
|
|
1153
1699
|
"ownership-assigned",
|
|
1154
1700
|
"ownership-removed",
|
|
@@ -1159,16 +1705,16 @@ var systemMessageKindValues = [
|
|
|
1159
1705
|
"child-outcome-batch",
|
|
1160
1706
|
"unlabeled"
|
|
1161
1707
|
];
|
|
1162
|
-
var systemMessageKindSchema =
|
|
1163
|
-
var systemMessageSubjectSchema =
|
|
1164
|
-
|
|
1165
|
-
kind:
|
|
1166
|
-
threadId:
|
|
1167
|
-
threadName:
|
|
1708
|
+
var systemMessageKindSchema = z12.enum(systemMessageKindValues);
|
|
1709
|
+
var systemMessageSubjectSchema = z12.discriminatedUnion("kind", [
|
|
1710
|
+
z12.object({
|
|
1711
|
+
kind: z12.literal("thread"),
|
|
1712
|
+
threadId: z12.string(),
|
|
1713
|
+
threadName: z12.string()
|
|
1168
1714
|
}),
|
|
1169
|
-
|
|
1170
|
-
kind:
|
|
1171
|
-
count:
|
|
1715
|
+
z12.object({
|
|
1716
|
+
kind: z12.literal("thread-batch"),
|
|
1717
|
+
count: z12.number()
|
|
1172
1718
|
})
|
|
1173
1719
|
]);
|
|
1174
1720
|
|
|
@@ -1191,31 +1737,31 @@ var systemEventTypeValues = [
|
|
|
1191
1737
|
"system/provider-turn-watchdog"
|
|
1192
1738
|
];
|
|
1193
1739
|
var threadTurnInitiatorValues = ["user", "agent", "system"];
|
|
1194
|
-
var threadTurnInitiatorSchema =
|
|
1740
|
+
var threadTurnInitiatorSchema = z13.enum(threadTurnInitiatorValues);
|
|
1195
1741
|
var turnRequestOptionsSchema = recordedThreadExecutionOptionsSchema;
|
|
1196
|
-
var turnRequestTargetSchema =
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
kind:
|
|
1201
|
-
expectedTurnId:
|
|
1742
|
+
var turnRequestTargetSchema = z13.discriminatedUnion("kind", [
|
|
1743
|
+
z13.object({ kind: z13.literal("thread-start") }),
|
|
1744
|
+
z13.object({ kind: z13.literal("new-turn") }),
|
|
1745
|
+
z13.object({
|
|
1746
|
+
kind: z13.literal("auto"),
|
|
1747
|
+
expectedTurnId: z13.string().nullable()
|
|
1202
1748
|
}),
|
|
1203
|
-
|
|
1204
|
-
kind:
|
|
1205
|
-
expectedTurnId:
|
|
1749
|
+
z13.object({
|
|
1750
|
+
kind: z13.literal("steer"),
|
|
1751
|
+
expectedTurnId: z13.string().nullable()
|
|
1206
1752
|
})
|
|
1207
1753
|
]);
|
|
1208
|
-
var clientTurnLifecycleEventDataSchema =
|
|
1209
|
-
direction:
|
|
1210
|
-
source:
|
|
1754
|
+
var clientTurnLifecycleEventDataSchema = z13.object({
|
|
1755
|
+
direction: z13.literal("outbound"),
|
|
1756
|
+
source: z13.enum(["spawn", "tell"]),
|
|
1211
1757
|
initiator: threadTurnInitiatorSchema,
|
|
1212
|
-
request:
|
|
1213
|
-
method:
|
|
1214
|
-
params:
|
|
1758
|
+
request: z13.object({
|
|
1759
|
+
method: z13.enum(["thread/start", "turn/start"]),
|
|
1760
|
+
params: z13.record(z13.string(), z13.unknown())
|
|
1215
1761
|
})
|
|
1216
1762
|
});
|
|
1217
|
-
var turnRequestEventDataSchema =
|
|
1218
|
-
direction:
|
|
1763
|
+
var turnRequestEventDataSchema = z13.object({
|
|
1764
|
+
direction: z13.literal("outbound"),
|
|
1219
1765
|
requestId: clientTurnRequestIdSchema,
|
|
1220
1766
|
// Retry provenance, written only when a `turn.failed` gate's retry row
|
|
1221
1767
|
// dispatches. Both fields are present together or not at all: absence means
|
|
@@ -1225,45 +1771,45 @@ var turnRequestEventDataSchema = z12.object({
|
|
|
1225
1771
|
/** The original request this attempt re-submits, unchanged across attempts. */
|
|
1226
1772
|
retryOfRequestId: clientTurnRequestIdSchema.optional(),
|
|
1227
1773
|
/** Which attempt this is: 2 is the first retry of the original request. */
|
|
1228
|
-
retryAttempt:
|
|
1229
|
-
source:
|
|
1774
|
+
retryAttempt: z13.number().int().min(2).optional(),
|
|
1775
|
+
source: z13.enum(["spawn", "tell"]),
|
|
1230
1776
|
initiator: threadTurnInitiatorSchema,
|
|
1231
|
-
senderThreadId:
|
|
1777
|
+
senderThreadId: z13.string().nullable(),
|
|
1232
1778
|
systemMessageKind: systemMessageKindSchema.optional(),
|
|
1233
1779
|
systemMessageSubject: systemMessageSubjectSchema.nullable().optional(),
|
|
1234
|
-
input:
|
|
1235
|
-
inputGroups:
|
|
1780
|
+
input: z13.array(promptInputSchema),
|
|
1781
|
+
inputGroups: z13.array(z13.array(promptInputSchema).min(1)).min(1).optional(),
|
|
1236
1782
|
target: turnRequestTargetSchema,
|
|
1237
|
-
request:
|
|
1238
|
-
method:
|
|
1239
|
-
params:
|
|
1783
|
+
request: z13.object({
|
|
1784
|
+
method: z13.enum(["thread/start", "turn/start"]),
|
|
1785
|
+
params: z13.record(z13.string(), z13.unknown())
|
|
1240
1786
|
}),
|
|
1241
1787
|
execution: turnRequestOptionsSchema
|
|
1242
1788
|
});
|
|
1243
|
-
var turnRequestRejectedEventDataSchema =
|
|
1789
|
+
var turnRequestRejectedEventDataSchema = z13.object({
|
|
1244
1790
|
requestId: clientTurnRequestIdSchema,
|
|
1245
|
-
reason:
|
|
1246
|
-
message:
|
|
1247
|
-
});
|
|
1248
|
-
var systemErrorEventDataSchema =
|
|
1249
|
-
code:
|
|
1250
|
-
message:
|
|
1251
|
-
detail:
|
|
1252
|
-
reconnectAttempt:
|
|
1253
|
-
reconnectTotal:
|
|
1791
|
+
reason: z13.string().min(1),
|
|
1792
|
+
message: z13.string().min(1)
|
|
1793
|
+
});
|
|
1794
|
+
var systemErrorEventDataSchema = z13.object({
|
|
1795
|
+
code: z13.string().optional(),
|
|
1796
|
+
message: z13.string(),
|
|
1797
|
+
detail: z13.string().optional(),
|
|
1798
|
+
reconnectAttempt: z13.number().int().positive().optional(),
|
|
1799
|
+
reconnectTotal: z13.number().int().positive().optional()
|
|
1254
1800
|
}).superRefine((value, ctx) => {
|
|
1255
1801
|
const hasReconnectAttempt = value.reconnectAttempt !== void 0;
|
|
1256
1802
|
const hasReconnectTotal = value.reconnectTotal !== void 0;
|
|
1257
1803
|
if (hasReconnectAttempt !== hasReconnectTotal) {
|
|
1258
1804
|
ctx.addIssue({
|
|
1259
|
-
code:
|
|
1805
|
+
code: z13.ZodIssueCode.custom,
|
|
1260
1806
|
message: "system/error reconnectAttempt and reconnectTotal must be provided together"
|
|
1261
1807
|
});
|
|
1262
1808
|
return;
|
|
1263
1809
|
}
|
|
1264
1810
|
if (value.reconnectAttempt !== void 0 && value.reconnectTotal !== void 0 && value.reconnectAttempt > value.reconnectTotal) {
|
|
1265
1811
|
ctx.addIssue({
|
|
1266
|
-
code:
|
|
1812
|
+
code: z13.ZodIssueCode.custom,
|
|
1267
1813
|
message: "system/error reconnectAttempt cannot be greater than reconnectTotal"
|
|
1268
1814
|
});
|
|
1269
1815
|
}
|
|
@@ -1273,42 +1819,42 @@ var ownershipChangeOperationActionValues = [
|
|
|
1273
1819
|
"release",
|
|
1274
1820
|
"transfer"
|
|
1275
1821
|
];
|
|
1276
|
-
var ownershipChangeOperationActionSchema =
|
|
1822
|
+
var ownershipChangeOperationActionSchema = z13.enum(
|
|
1277
1823
|
ownershipChangeOperationActionValues
|
|
1278
1824
|
);
|
|
1279
|
-
var ownershipChangeOperationMetadataSchema =
|
|
1825
|
+
var ownershipChangeOperationMetadataSchema = z13.object({
|
|
1280
1826
|
action: ownershipChangeOperationActionSchema,
|
|
1281
|
-
nextParentThreadId:
|
|
1282
|
-
nextParentThreadTitle:
|
|
1283
|
-
previousParentThreadId:
|
|
1284
|
-
previousParentThreadTitle:
|
|
1285
|
-
});
|
|
1286
|
-
var systemOperationEventDataSchema =
|
|
1287
|
-
operation:
|
|
1288
|
-
status:
|
|
1289
|
-
message:
|
|
1290
|
-
operationId:
|
|
1291
|
-
metadata:
|
|
1292
|
-
});
|
|
1293
|
-
var systemInteractionLifecycleEventDataSchema =
|
|
1827
|
+
nextParentThreadId: z13.string().nullable(),
|
|
1828
|
+
nextParentThreadTitle: z13.string().nullable(),
|
|
1829
|
+
previousParentThreadId: z13.string().nullable(),
|
|
1830
|
+
previousParentThreadTitle: z13.string().nullable()
|
|
1831
|
+
});
|
|
1832
|
+
var systemOperationEventDataSchema = z13.object({
|
|
1833
|
+
operation: z13.string(),
|
|
1834
|
+
status: z13.string(),
|
|
1835
|
+
message: z13.string(),
|
|
1836
|
+
operationId: z13.string(),
|
|
1837
|
+
metadata: z13.record(z13.string(), jsonValueSchema).optional()
|
|
1838
|
+
});
|
|
1839
|
+
var systemInteractionLifecycleEventDataSchema = z13.object({
|
|
1294
1840
|
interaction: interactionLifecycleSchema
|
|
1295
1841
|
});
|
|
1296
|
-
var systemPermissionGrantLifecycleEventDataSchema =
|
|
1297
|
-
interactionId:
|
|
1298
|
-
providerId:
|
|
1299
|
-
providerRequestId:
|
|
1842
|
+
var systemPermissionGrantLifecycleEventDataSchema = z13.object({
|
|
1843
|
+
interactionId: z13.string(),
|
|
1844
|
+
providerId: z13.string(),
|
|
1845
|
+
providerRequestId: z13.string(),
|
|
1300
1846
|
status: pendingInteractionStatusSchema,
|
|
1301
1847
|
resolution: approvalPendingInteractionResolutionSchema.nullable().default(null),
|
|
1302
|
-
statusReason:
|
|
1848
|
+
statusReason: z13.string().nullable().default(null),
|
|
1303
1849
|
subject: pendingInteractionPermissionGrantApprovalSubjectSchema
|
|
1304
1850
|
});
|
|
1305
|
-
var systemUserQuestionLifecycleEventDataSchema =
|
|
1306
|
-
interactionId:
|
|
1307
|
-
providerId:
|
|
1308
|
-
providerRequestId:
|
|
1851
|
+
var systemUserQuestionLifecycleEventDataSchema = z13.object({
|
|
1852
|
+
interactionId: z13.string(),
|
|
1853
|
+
providerId: z13.string(),
|
|
1854
|
+
providerRequestId: z13.string(),
|
|
1309
1855
|
status: pendingInteractionStatusSchema,
|
|
1310
1856
|
resolution: userQuestionPendingInteractionResolutionSchema.nullable().default(null),
|
|
1311
|
-
statusReason:
|
|
1857
|
+
statusReason: z13.string().nullable().default(null),
|
|
1312
1858
|
payload: userQuestionPendingInteractionPayloadSchema
|
|
1313
1859
|
});
|
|
1314
1860
|
var systemThreadInterruptedReasonValues = [
|
|
@@ -1316,20 +1862,20 @@ var systemThreadInterruptedReasonValues = [
|
|
|
1316
1862
|
"host-daemon-restarted",
|
|
1317
1863
|
"provider-turn-idle"
|
|
1318
1864
|
];
|
|
1319
|
-
var systemThreadInterruptedReasonSchema =
|
|
1865
|
+
var systemThreadInterruptedReasonSchema = z13.enum(
|
|
1320
1866
|
systemThreadInterruptedReasonValues
|
|
1321
1867
|
);
|
|
1322
|
-
var systemThreadInterruptedEventDataSchema =
|
|
1868
|
+
var systemThreadInterruptedEventDataSchema = z13.object({
|
|
1323
1869
|
reason: systemThreadInterruptedReasonSchema,
|
|
1324
|
-
cause:
|
|
1870
|
+
cause: z13.literal("host-connection-lost").optional()
|
|
1325
1871
|
});
|
|
1326
|
-
var provisioningTranscriptEntrySchema =
|
|
1327
|
-
type:
|
|
1328
|
-
key:
|
|
1329
|
-
text:
|
|
1330
|
-
startedAt:
|
|
1331
|
-
status:
|
|
1332
|
-
metadata:
|
|
1872
|
+
var provisioningTranscriptEntrySchema = z13.object({
|
|
1873
|
+
type: z13.enum(["step", "output"]),
|
|
1874
|
+
key: z13.string(),
|
|
1875
|
+
text: z13.string(),
|
|
1876
|
+
startedAt: z13.number().optional(),
|
|
1877
|
+
status: z13.enum(["started", "completed", "failed"]).optional(),
|
|
1878
|
+
metadata: z13.record(z13.string(), z13.unknown()).optional()
|
|
1333
1879
|
});
|
|
1334
1880
|
var systemThreadProvisioningStatusValues = [
|
|
1335
1881
|
"active",
|
|
@@ -1337,48 +1883,48 @@ var systemThreadProvisioningStatusValues = [
|
|
|
1337
1883
|
"failed",
|
|
1338
1884
|
"cancelled"
|
|
1339
1885
|
];
|
|
1340
|
-
var systemThreadProvisioningStatusSchema =
|
|
1886
|
+
var systemThreadProvisioningStatusSchema = z13.enum(
|
|
1341
1887
|
systemThreadProvisioningStatusValues
|
|
1342
1888
|
);
|
|
1343
|
-
var systemThreadProvisioningEventDataSchema =
|
|
1344
|
-
provisioningId:
|
|
1889
|
+
var systemThreadProvisioningEventDataSchema = z13.object({
|
|
1890
|
+
provisioningId: z13.string(),
|
|
1345
1891
|
status: systemThreadProvisioningStatusSchema,
|
|
1346
|
-
environmentId:
|
|
1347
|
-
entries:
|
|
1348
|
-
});
|
|
1349
|
-
var systemLegacyUserMessageEventDataSchema =
|
|
1350
|
-
text:
|
|
1351
|
-
toolCallId:
|
|
1352
|
-
turnId:
|
|
1353
|
-
});
|
|
1354
|
-
var systemProviderTurnWatchdogEventDataSchema =
|
|
1355
|
-
reason:
|
|
1356
|
-
thresholdMs:
|
|
1357
|
-
elapsedMs:
|
|
1358
|
-
activeTurnId:
|
|
1359
|
-
activeTurnStartedAt:
|
|
1360
|
-
lastActivityEventSequence:
|
|
1361
|
-
lastActivityEventType:
|
|
1362
|
-
lastActivityEventAt:
|
|
1363
|
-
providerId:
|
|
1364
|
-
providerThreadId:
|
|
1365
|
-
firedAt:
|
|
1892
|
+
environmentId: z13.string().nullable(),
|
|
1893
|
+
entries: z13.array(provisioningTranscriptEntrySchema)
|
|
1894
|
+
});
|
|
1895
|
+
var systemLegacyUserMessageEventDataSchema = z13.object({
|
|
1896
|
+
text: z13.string(),
|
|
1897
|
+
toolCallId: z13.string().optional(),
|
|
1898
|
+
turnId: z13.string().optional()
|
|
1899
|
+
});
|
|
1900
|
+
var systemProviderTurnWatchdogEventDataSchema = z13.object({
|
|
1901
|
+
reason: z13.literal("provider-turn-idle"),
|
|
1902
|
+
thresholdMs: z13.number().int().positive(),
|
|
1903
|
+
elapsedMs: z13.number().int().nonnegative(),
|
|
1904
|
+
activeTurnId: z13.string().min(1),
|
|
1905
|
+
activeTurnStartedAt: z13.number().int().nonnegative(),
|
|
1906
|
+
lastActivityEventSequence: z13.number().int().positive(),
|
|
1907
|
+
lastActivityEventType: z13.string().min(1),
|
|
1908
|
+
lastActivityEventAt: z13.number().int().nonnegative(),
|
|
1909
|
+
providerId: z13.string().min(1),
|
|
1910
|
+
providerThreadId: z13.string().min(1).nullable(),
|
|
1911
|
+
firedAt: z13.number().int().nonnegative()
|
|
1366
1912
|
});
|
|
1367
1913
|
|
|
1368
1914
|
// ../domain/src/thread-event-scope.ts
|
|
1369
|
-
import { z as
|
|
1915
|
+
import { z as z14 } from "zod";
|
|
1370
1916
|
var threadEventScopeKindValues = ["thread", "turn"];
|
|
1371
|
-
var threadEventScopeKindSchema =
|
|
1372
|
-
var threadEventScopeSchema =
|
|
1373
|
-
|
|
1374
|
-
|
|
1917
|
+
var threadEventScopeKindSchema = z14.enum(threadEventScopeKindValues);
|
|
1918
|
+
var threadEventScopeSchema = z14.discriminatedUnion("kind", [
|
|
1919
|
+
z14.object({ kind: z14.literal("thread") }),
|
|
1920
|
+
z14.object({ kind: z14.literal("turn"), turnId: z14.string().min(1) })
|
|
1375
1921
|
]);
|
|
1376
1922
|
var threadEventScopePolicyValues = [
|
|
1377
1923
|
"thread",
|
|
1378
1924
|
"turn",
|
|
1379
1925
|
"thread-or-turn"
|
|
1380
1926
|
];
|
|
1381
|
-
var threadEventScopePolicySchema =
|
|
1927
|
+
var threadEventScopePolicySchema = z14.enum(threadEventScopePolicyValues);
|
|
1382
1928
|
var threadEventScopeDefinitionByType = {
|
|
1383
1929
|
"thread/started": {
|
|
1384
1930
|
policy: "thread",
|
|
@@ -1544,32 +2090,32 @@ function validateThreadEventScope(args) {
|
|
|
1544
2090
|
}
|
|
1545
2091
|
|
|
1546
2092
|
// ../domain/src/thread-timeline-goal.ts
|
|
1547
|
-
import { z as
|
|
1548
|
-
var threadTimelineGoalStatusSchema =
|
|
2093
|
+
import { z as z15 } from "zod";
|
|
2094
|
+
var threadTimelineGoalStatusSchema = z15.enum([
|
|
1549
2095
|
"active",
|
|
1550
2096
|
"paused",
|
|
1551
2097
|
"budgetLimited",
|
|
1552
2098
|
"complete"
|
|
1553
2099
|
]);
|
|
1554
|
-
var threadTimelineGoalSchema =
|
|
1555
|
-
sourceSeq:
|
|
1556
|
-
updatedAt:
|
|
1557
|
-
objective:
|
|
2100
|
+
var threadTimelineGoalSchema = z15.object({
|
|
2101
|
+
sourceSeq: z15.number().int().nonnegative(),
|
|
2102
|
+
updatedAt: z15.number(),
|
|
2103
|
+
objective: z15.string(),
|
|
1558
2104
|
status: threadTimelineGoalStatusSchema,
|
|
1559
|
-
tokenBudget:
|
|
1560
|
-
tokensUsed:
|
|
1561
|
-
timeUsedSeconds:
|
|
2105
|
+
tokenBudget: z15.number().nullable(),
|
|
2106
|
+
tokensUsed: z15.number(),
|
|
2107
|
+
timeUsedSeconds: z15.number()
|
|
1562
2108
|
});
|
|
1563
2109
|
|
|
1564
2110
|
// ../domain/src/provider-event.ts
|
|
1565
|
-
var threadEventItemStatusSchema =
|
|
2111
|
+
var threadEventItemStatusSchema = z16.enum([
|
|
1566
2112
|
"pending",
|
|
1567
2113
|
"completed",
|
|
1568
2114
|
"failed",
|
|
1569
2115
|
"interrupted"
|
|
1570
2116
|
]);
|
|
1571
|
-
var threadEventItemApprovalStatusSchema =
|
|
1572
|
-
var threadEventTurnStatusSchema =
|
|
2117
|
+
var threadEventItemApprovalStatusSchema = z16.enum(["waiting_for_approval", "denied"]).nullable();
|
|
2118
|
+
var threadEventTurnStatusSchema = z16.enum([
|
|
1573
2119
|
"completed",
|
|
1574
2120
|
"failed",
|
|
1575
2121
|
"interrupted"
|
|
@@ -1595,262 +2141,262 @@ var providerErrorCategoryValues = [
|
|
|
1595
2141
|
"unauthorized",
|
|
1596
2142
|
"unknown"
|
|
1597
2143
|
];
|
|
1598
|
-
var providerErrorCategorySchema =
|
|
1599
|
-
var providerErrorInfoSchema =
|
|
2144
|
+
var providerErrorCategorySchema = z16.enum(providerErrorCategoryValues);
|
|
2145
|
+
var providerErrorInfoSchema = z16.object({
|
|
1600
2146
|
category: providerErrorCategorySchema,
|
|
1601
|
-
providerCode:
|
|
1602
|
-
httpStatusCode:
|
|
2147
|
+
providerCode: z16.string().nullable(),
|
|
2148
|
+
httpStatusCode: z16.number().nullable()
|
|
1603
2149
|
});
|
|
1604
|
-
var providerRateLimitStatusSchema =
|
|
2150
|
+
var providerRateLimitStatusSchema = z16.enum([
|
|
1605
2151
|
"allowed",
|
|
1606
2152
|
"warning",
|
|
1607
2153
|
"blocked",
|
|
1608
2154
|
"unknown"
|
|
1609
2155
|
]);
|
|
1610
|
-
var providerRateLimitWindowSchema =
|
|
1611
|
-
providerKey:
|
|
1612
|
-
label:
|
|
2156
|
+
var providerRateLimitWindowSchema = z16.object({
|
|
2157
|
+
providerKey: z16.string().min(1).nullable(),
|
|
2158
|
+
label: z16.string().min(1).nullable(),
|
|
1613
2159
|
status: providerRateLimitStatusSchema,
|
|
1614
|
-
resetsAtMs:
|
|
2160
|
+
resetsAtMs: z16.number().int().nonnegative().nullable()
|
|
1615
2161
|
});
|
|
1616
|
-
var providerRateLimitStateSchema =
|
|
1617
|
-
providerId:
|
|
2162
|
+
var providerRateLimitStateSchema = z16.object({
|
|
2163
|
+
providerId: z16.string().min(1),
|
|
1618
2164
|
status: providerRateLimitStatusSchema,
|
|
1619
|
-
kind:
|
|
1620
|
-
windows:
|
|
1621
|
-
reachedReason:
|
|
1622
|
-
overageStatus:
|
|
1623
|
-
overageReason:
|
|
1624
|
-
});
|
|
1625
|
-
var threadEventFileChangeKindSchema =
|
|
1626
|
-
var threadEventFileChangeSchema =
|
|
1627
|
-
path:
|
|
2165
|
+
kind: z16.enum(["subscription-window", "credits", "spend-control", "unknown"]),
|
|
2166
|
+
windows: z16.array(providerRateLimitWindowSchema),
|
|
2167
|
+
reachedReason: z16.string().min(1).nullable(),
|
|
2168
|
+
overageStatus: z16.enum(["allowed", "warning", "rejected", "unavailable"]).nullable(),
|
|
2169
|
+
overageReason: z16.string().min(1).nullable()
|
|
2170
|
+
});
|
|
2171
|
+
var threadEventFileChangeKindSchema = z16.enum(["add", "delete", "update"]);
|
|
2172
|
+
var threadEventFileChangeSchema = z16.object({
|
|
2173
|
+
path: z16.string(),
|
|
1628
2174
|
kind: threadEventFileChangeKindSchema,
|
|
1629
|
-
movePath:
|
|
1630
|
-
diff:
|
|
2175
|
+
movePath: z16.string().optional(),
|
|
2176
|
+
diff: z16.string().optional()
|
|
1631
2177
|
});
|
|
1632
|
-
var threadEventPlanStepStatusSchema =
|
|
2178
|
+
var threadEventPlanStepStatusSchema = z16.enum([
|
|
1633
2179
|
"pending",
|
|
1634
2180
|
"active",
|
|
1635
2181
|
"completed",
|
|
1636
2182
|
"failed"
|
|
1637
2183
|
]);
|
|
1638
|
-
var threadEventPlanStepSchema =
|
|
1639
|
-
step:
|
|
2184
|
+
var threadEventPlanStepSchema = z16.object({
|
|
2185
|
+
step: z16.string(),
|
|
1640
2186
|
status: threadEventPlanStepStatusSchema.optional()
|
|
1641
2187
|
});
|
|
1642
2188
|
var itemPresentationField = {
|
|
1643
2189
|
presentation: threadEventItemPresentationSchema.optional()
|
|
1644
2190
|
};
|
|
1645
|
-
var threadEventWebSearchItemSchema =
|
|
1646
|
-
type:
|
|
1647
|
-
id:
|
|
1648
|
-
queries:
|
|
1649
|
-
resultText:
|
|
2191
|
+
var threadEventWebSearchItemSchema = z16.object({
|
|
2192
|
+
type: z16.literal("webSearch"),
|
|
2193
|
+
id: z16.string(),
|
|
2194
|
+
queries: z16.array(z16.string()).min(1),
|
|
2195
|
+
resultText: z16.string().nullable(),
|
|
1650
2196
|
...itemPresentationField,
|
|
1651
|
-
parentToolCallId:
|
|
1652
|
-
});
|
|
1653
|
-
var threadEventWebFetchItemSchema =
|
|
1654
|
-
type:
|
|
1655
|
-
id:
|
|
1656
|
-
url:
|
|
1657
|
-
prompt:
|
|
1658
|
-
pattern:
|
|
1659
|
-
resultText:
|
|
2197
|
+
parentToolCallId: z16.string().optional()
|
|
2198
|
+
});
|
|
2199
|
+
var threadEventWebFetchItemSchema = z16.object({
|
|
2200
|
+
type: z16.literal("webFetch"),
|
|
2201
|
+
id: z16.string(),
|
|
2202
|
+
url: z16.string(),
|
|
2203
|
+
prompt: z16.string().nullable(),
|
|
2204
|
+
pattern: z16.string().nullable(),
|
|
2205
|
+
resultText: z16.string().nullable(),
|
|
1660
2206
|
...itemPresentationField,
|
|
1661
|
-
parentToolCallId:
|
|
2207
|
+
parentToolCallId: z16.string().optional()
|
|
1662
2208
|
});
|
|
1663
|
-
var threadEventImageViewItemSchema =
|
|
1664
|
-
type:
|
|
1665
|
-
id:
|
|
1666
|
-
path:
|
|
2209
|
+
var threadEventImageViewItemSchema = z16.object({
|
|
2210
|
+
type: z16.literal("imageView"),
|
|
2211
|
+
id: z16.string(),
|
|
2212
|
+
path: z16.string(),
|
|
1667
2213
|
...itemPresentationField,
|
|
1668
|
-
parentToolCallId:
|
|
2214
|
+
parentToolCallId: z16.string().optional()
|
|
1669
2215
|
});
|
|
1670
|
-
var threadEventFileReadItemSchema =
|
|
1671
|
-
type:
|
|
1672
|
-
id:
|
|
1673
|
-
path:
|
|
1674
|
-
cmd:
|
|
2216
|
+
var threadEventFileReadItemSchema = z16.object({
|
|
2217
|
+
type: z16.literal("fileRead"),
|
|
2218
|
+
id: z16.string(),
|
|
2219
|
+
path: z16.string(),
|
|
2220
|
+
cmd: z16.string().optional(),
|
|
1675
2221
|
status: threadEventItemStatusSchema,
|
|
1676
2222
|
...itemPresentationField,
|
|
1677
|
-
parentToolCallId:
|
|
2223
|
+
parentToolCallId: z16.string().optional()
|
|
1678
2224
|
});
|
|
1679
|
-
var threadEventSearchModeSchema =
|
|
1680
|
-
var threadEventSearchItemSchema =
|
|
1681
|
-
type:
|
|
1682
|
-
id:
|
|
2225
|
+
var threadEventSearchModeSchema = z16.enum(["content", "path", "list"]);
|
|
2226
|
+
var threadEventSearchItemSchema = z16.object({
|
|
2227
|
+
type: z16.literal("search"),
|
|
2228
|
+
id: z16.string(),
|
|
1683
2229
|
mode: threadEventSearchModeSchema,
|
|
1684
|
-
query:
|
|
1685
|
-
path:
|
|
1686
|
-
cmd:
|
|
2230
|
+
query: z16.string(),
|
|
2231
|
+
path: z16.string().optional(),
|
|
2232
|
+
cmd: z16.string().optional(),
|
|
1687
2233
|
status: threadEventItemStatusSchema,
|
|
1688
2234
|
...itemPresentationField,
|
|
1689
|
-
parentToolCallId:
|
|
2235
|
+
parentToolCallId: z16.string().optional()
|
|
1690
2236
|
});
|
|
1691
|
-
var threadEventDelegationItemSchema =
|
|
1692
|
-
type:
|
|
1693
|
-
id:
|
|
1694
|
-
childRef:
|
|
1695
|
-
label:
|
|
2237
|
+
var threadEventDelegationItemSchema = z16.object({
|
|
2238
|
+
type: z16.literal("delegation"),
|
|
2239
|
+
id: z16.string(),
|
|
2240
|
+
childRef: z16.string().min(1),
|
|
2241
|
+
label: z16.string(),
|
|
1696
2242
|
status: threadEventItemStatusSchema,
|
|
1697
|
-
background:
|
|
1698
|
-
summary:
|
|
2243
|
+
background: z16.boolean(),
|
|
2244
|
+
summary: z16.string().optional(),
|
|
1699
2245
|
...itemPresentationField,
|
|
1700
|
-
parentToolCallId:
|
|
2246
|
+
parentToolCallId: z16.string().optional()
|
|
1701
2247
|
});
|
|
1702
|
-
var threadEventPlanStepsItemSchema =
|
|
1703
|
-
type:
|
|
1704
|
-
id:
|
|
1705
|
-
steps:
|
|
1706
|
-
explanation:
|
|
2248
|
+
var threadEventPlanStepsItemSchema = z16.object({
|
|
2249
|
+
type: z16.literal("planSteps"),
|
|
2250
|
+
id: z16.string(),
|
|
2251
|
+
steps: z16.array(threadEventPlanStepSchema),
|
|
2252
|
+
explanation: z16.string().optional(),
|
|
1707
2253
|
status: threadEventItemStatusSchema,
|
|
1708
2254
|
...itemPresentationField,
|
|
1709
|
-
parentToolCallId:
|
|
2255
|
+
parentToolCallId: z16.string().optional()
|
|
1710
2256
|
});
|
|
1711
|
-
var threadEventExtensionItemSchema =
|
|
1712
|
-
type:
|
|
1713
|
-
id:
|
|
2257
|
+
var threadEventExtensionItemSchema = z16.object({
|
|
2258
|
+
type: z16.literal("extension"),
|
|
2259
|
+
id: z16.string(),
|
|
1714
2260
|
kind: extensionKindSchema,
|
|
1715
2261
|
payload: jsonValueSchema,
|
|
1716
2262
|
status: threadEventItemStatusSchema,
|
|
1717
2263
|
presentation: threadEventItemPresentationSchema,
|
|
1718
|
-
parentToolCallId:
|
|
2264
|
+
parentToolCallId: z16.string().optional()
|
|
1719
2265
|
});
|
|
1720
|
-
var threadEventTextTruncationSchema =
|
|
1721
|
-
originalLength:
|
|
1722
|
-
retainedHeadLength:
|
|
1723
|
-
retainedTailLength:
|
|
1724
|
-
truncatedAt:
|
|
2266
|
+
var threadEventTextTruncationSchema = z16.object({
|
|
2267
|
+
originalLength: z16.number(),
|
|
2268
|
+
retainedHeadLength: z16.number(),
|
|
2269
|
+
retainedTailLength: z16.number(),
|
|
2270
|
+
truncatedAt: z16.number()
|
|
1725
2271
|
});
|
|
1726
|
-
var threadEventItemTruncationSchema =
|
|
2272
|
+
var threadEventItemTruncationSchema = z16.object({
|
|
1727
2273
|
aggregatedOutput: threadEventTextTruncationSchema.optional(),
|
|
1728
2274
|
result: threadEventTextTruncationSchema.optional(),
|
|
1729
2275
|
resultText: threadEventTextTruncationSchema.optional()
|
|
1730
2276
|
});
|
|
1731
|
-
var threadEventImageGenerationItemSchema =
|
|
1732
|
-
type:
|
|
1733
|
-
id:
|
|
2277
|
+
var threadEventImageGenerationItemSchema = z16.object({
|
|
2278
|
+
type: z16.literal("imageGeneration"),
|
|
2279
|
+
id: z16.string(),
|
|
1734
2280
|
status: threadEventItemStatusSchema,
|
|
1735
|
-
prompt:
|
|
1736
|
-
path:
|
|
1737
|
-
result:
|
|
1738
|
-
error:
|
|
1739
|
-
transparentBackground:
|
|
2281
|
+
prompt: z16.string().nullable(),
|
|
2282
|
+
path: z16.string().nullable(),
|
|
2283
|
+
result: z16.string().optional(),
|
|
2284
|
+
error: z16.string().nullable(),
|
|
2285
|
+
transparentBackground: z16.boolean(),
|
|
1740
2286
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1741
2287
|
...itemPresentationField,
|
|
1742
|
-
parentToolCallId:
|
|
2288
|
+
parentToolCallId: z16.string().optional()
|
|
1743
2289
|
});
|
|
1744
|
-
var threadEventUserContentSchema =
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
2290
|
+
var threadEventUserContentSchema = z16.discriminatedUnion("type", [
|
|
2291
|
+
z16.object({ type: z16.literal("text"), text: z16.string() }),
|
|
2292
|
+
z16.object({ type: z16.literal("image"), url: z16.string() }),
|
|
2293
|
+
z16.object({ type: z16.literal("localImage"), path: z16.string() }),
|
|
2294
|
+
z16.object({ type: z16.literal("localFile"), path: z16.string() })
|
|
1749
2295
|
]);
|
|
1750
|
-
var threadEventTokenUsageBreakdownSchema =
|
|
1751
|
-
totalTokens:
|
|
1752
|
-
inputTokens:
|
|
1753
|
-
cachedInputTokens:
|
|
1754
|
-
cacheReadInputTokens:
|
|
1755
|
-
cacheWriteInputTokens:
|
|
1756
|
-
outputTokens:
|
|
1757
|
-
reasoningOutputTokens:
|
|
1758
|
-
});
|
|
1759
|
-
var threadEventContextWindowUsageSchema =
|
|
2296
|
+
var threadEventTokenUsageBreakdownSchema = z16.object({
|
|
2297
|
+
totalTokens: z16.number(),
|
|
2298
|
+
inputTokens: z16.number(),
|
|
2299
|
+
cachedInputTokens: z16.number(),
|
|
2300
|
+
cacheReadInputTokens: z16.number().nonnegative().optional(),
|
|
2301
|
+
cacheWriteInputTokens: z16.number().nonnegative().optional(),
|
|
2302
|
+
outputTokens: z16.number(),
|
|
2303
|
+
reasoningOutputTokens: z16.number()
|
|
2304
|
+
});
|
|
2305
|
+
var threadEventContextWindowUsageSchema = z16.object({
|
|
1760
2306
|
snapshot: contextSnapshotSchema.optional(),
|
|
1761
|
-
usedTokens:
|
|
1762
|
-
modelContextWindow:
|
|
1763
|
-
estimated:
|
|
2307
|
+
usedTokens: z16.number().nullable(),
|
|
2308
|
+
modelContextWindow: z16.number().nullable(),
|
|
2309
|
+
estimated: z16.boolean()
|
|
1764
2310
|
});
|
|
1765
|
-
var threadEventTokenUsageSchema =
|
|
2311
|
+
var threadEventTokenUsageSchema = z16.object({
|
|
1766
2312
|
total: threadEventTokenUsageBreakdownSchema,
|
|
1767
2313
|
last: threadEventTokenUsageBreakdownSchema,
|
|
1768
|
-
modelContextWindow:
|
|
2314
|
+
modelContextWindow: z16.number().nullable()
|
|
1769
2315
|
});
|
|
1770
|
-
var threadEventWarningCategorySchema =
|
|
2316
|
+
var threadEventWarningCategorySchema = z16.enum([
|
|
1771
2317
|
"deprecation",
|
|
1772
2318
|
"config",
|
|
1773
2319
|
"general",
|
|
1774
2320
|
"compaction-skipped"
|
|
1775
2321
|
]);
|
|
1776
|
-
var providerRawEventSchema =
|
|
1777
|
-
jsonrpc:
|
|
1778
|
-
id:
|
|
1779
|
-
method:
|
|
2322
|
+
var providerRawEventSchema = z16.object({
|
|
2323
|
+
jsonrpc: z16.literal("2.0"),
|
|
2324
|
+
id: z16.union([z16.string(), z16.number()]).optional(),
|
|
2325
|
+
method: z16.string(),
|
|
1780
2326
|
params: jsonValueSchema.optional()
|
|
1781
2327
|
});
|
|
1782
|
-
var providerUnhandledEventSchema =
|
|
1783
|
-
type:
|
|
1784
|
-
threadId:
|
|
1785
|
-
providerThreadId:
|
|
1786
|
-
providerId:
|
|
1787
|
-
rawType:
|
|
2328
|
+
var providerUnhandledEventSchema = z16.object({
|
|
2329
|
+
type: z16.literal("provider/unhandled"),
|
|
2330
|
+
threadId: z16.string(),
|
|
2331
|
+
providerThreadId: z16.string(),
|
|
2332
|
+
providerId: z16.string(),
|
|
2333
|
+
rawType: z16.string(),
|
|
1788
2334
|
rawEvent: providerRawEventSchema,
|
|
1789
|
-
parentToolCallId:
|
|
1790
|
-
});
|
|
1791
|
-
var toolCallProgressEventSchema =
|
|
1792
|
-
type:
|
|
1793
|
-
threadId:
|
|
1794
|
-
providerThreadId:
|
|
1795
|
-
itemId:
|
|
1796
|
-
message:
|
|
1797
|
-
parentToolCallId:
|
|
1798
|
-
});
|
|
1799
|
-
var threadEventBackgroundTaskItemSchema =
|
|
1800
|
-
type:
|
|
1801
|
-
id:
|
|
1802
|
-
familyId:
|
|
1803
|
-
taskType:
|
|
1804
|
-
description:
|
|
2335
|
+
parentToolCallId: z16.string().optional()
|
|
2336
|
+
});
|
|
2337
|
+
var toolCallProgressEventSchema = z16.object({
|
|
2338
|
+
type: z16.literal("item/toolCall/progress"),
|
|
2339
|
+
threadId: z16.string(),
|
|
2340
|
+
providerThreadId: z16.string(),
|
|
2341
|
+
itemId: z16.string(),
|
|
2342
|
+
message: z16.string().optional(),
|
|
2343
|
+
parentToolCallId: z16.string().optional()
|
|
2344
|
+
});
|
|
2345
|
+
var threadEventBackgroundTaskItemSchema = z16.object({
|
|
2346
|
+
type: z16.literal("backgroundTask"),
|
|
2347
|
+
id: z16.string(),
|
|
2348
|
+
familyId: z16.string().optional(),
|
|
2349
|
+
taskType: z16.string(),
|
|
2350
|
+
description: z16.string(),
|
|
1805
2351
|
status: threadEventItemStatusSchema,
|
|
1806
2352
|
taskStatus: backgroundTaskStatusSchema,
|
|
1807
|
-
skipTranscript:
|
|
1808
|
-
workflowName:
|
|
2353
|
+
skipTranscript: z16.boolean(),
|
|
2354
|
+
workflowName: z16.string().optional(),
|
|
1809
2355
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
1810
2356
|
usage: backgroundTaskUsageSchema.optional(),
|
|
1811
|
-
summary:
|
|
1812
|
-
error:
|
|
1813
|
-
outputFile:
|
|
2357
|
+
summary: z16.string().optional(),
|
|
2358
|
+
error: z16.string().optional(),
|
|
2359
|
+
outputFile: z16.string().optional(),
|
|
1814
2360
|
...itemPresentationField,
|
|
1815
|
-
parentToolCallId:
|
|
2361
|
+
parentToolCallId: z16.string().optional()
|
|
1816
2362
|
});
|
|
1817
|
-
var threadEventItemSchema =
|
|
1818
|
-
|
|
1819
|
-
type:
|
|
1820
|
-
id:
|
|
1821
|
-
content:
|
|
2363
|
+
var threadEventItemSchema = z16.discriminatedUnion("type", [
|
|
2364
|
+
z16.object({
|
|
2365
|
+
type: z16.literal("userMessage"),
|
|
2366
|
+
id: z16.string(),
|
|
2367
|
+
content: z16.array(threadEventUserContentSchema),
|
|
1822
2368
|
clientRequestId: clientTurnRequestIdSchema.optional(),
|
|
1823
|
-
parentToolCallId:
|
|
2369
|
+
parentToolCallId: z16.string().optional()
|
|
1824
2370
|
}).strict(),
|
|
1825
|
-
|
|
1826
|
-
type:
|
|
1827
|
-
id:
|
|
1828
|
-
text:
|
|
2371
|
+
z16.object({
|
|
2372
|
+
type: z16.literal("agentMessage"),
|
|
2373
|
+
id: z16.string(),
|
|
2374
|
+
text: z16.string(),
|
|
1829
2375
|
...itemPresentationField,
|
|
1830
|
-
parentToolCallId:
|
|
2376
|
+
parentToolCallId: z16.string().optional()
|
|
1831
2377
|
}),
|
|
1832
|
-
|
|
1833
|
-
type:
|
|
1834
|
-
id:
|
|
1835
|
-
command:
|
|
1836
|
-
cwd:
|
|
2378
|
+
z16.object({
|
|
2379
|
+
type: z16.literal("commandExecution"),
|
|
2380
|
+
id: z16.string(),
|
|
2381
|
+
command: z16.string(),
|
|
2382
|
+
cwd: z16.string(),
|
|
1837
2383
|
status: threadEventItemStatusSchema,
|
|
1838
2384
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1839
|
-
aggregatedOutput:
|
|
1840
|
-
exitCode:
|
|
1841
|
-
durationMs:
|
|
2385
|
+
aggregatedOutput: z16.string().optional(),
|
|
2386
|
+
exitCode: z16.number().optional(),
|
|
2387
|
+
durationMs: z16.number().optional(),
|
|
1842
2388
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1843
2389
|
...itemPresentationField,
|
|
1844
|
-
parentToolCallId:
|
|
2390
|
+
parentToolCallId: z16.string().optional()
|
|
1845
2391
|
}),
|
|
1846
|
-
|
|
1847
|
-
type:
|
|
1848
|
-
id:
|
|
1849
|
-
changes:
|
|
2392
|
+
z16.object({
|
|
2393
|
+
type: z16.literal("fileChange"),
|
|
2394
|
+
id: z16.string(),
|
|
2395
|
+
changes: z16.array(threadEventFileChangeSchema),
|
|
1850
2396
|
status: threadEventItemStatusSchema,
|
|
1851
2397
|
approvalStatus: threadEventItemApprovalStatusSchema,
|
|
1852
2398
|
...itemPresentationField,
|
|
1853
|
-
parentToolCallId:
|
|
2399
|
+
parentToolCallId: z16.string().optional()
|
|
1854
2400
|
}),
|
|
1855
2401
|
threadEventWebSearchItemSchema,
|
|
1856
2402
|
threadEventWebFetchItemSchema,
|
|
@@ -1858,264 +2404,270 @@ var threadEventItemSchema = z15.discriminatedUnion("type", [
|
|
|
1858
2404
|
threadEventImageGenerationItemSchema,
|
|
1859
2405
|
threadEventFileReadItemSchema,
|
|
1860
2406
|
threadEventSearchItemSchema,
|
|
1861
|
-
|
|
1862
|
-
type:
|
|
1863
|
-
id:
|
|
1864
|
-
server:
|
|
1865
|
-
tool:
|
|
1866
|
-
arguments:
|
|
2407
|
+
z16.object({
|
|
2408
|
+
type: z16.literal("toolCall"),
|
|
2409
|
+
id: z16.string(),
|
|
2410
|
+
server: z16.string().optional(),
|
|
2411
|
+
tool: z16.string(),
|
|
2412
|
+
arguments: z16.record(z16.string(), z16.unknown()).optional(),
|
|
1867
2413
|
status: threadEventItemStatusSchema,
|
|
1868
|
-
result:
|
|
1869
|
-
error:
|
|
1870
|
-
durationMs:
|
|
2414
|
+
result: z16.unknown().optional(),
|
|
2415
|
+
error: z16.string().optional(),
|
|
2416
|
+
durationMs: z16.number().optional(),
|
|
1871
2417
|
truncation: threadEventItemTruncationSchema.optional(),
|
|
1872
2418
|
...itemPresentationField,
|
|
1873
|
-
parentToolCallId:
|
|
2419
|
+
parentToolCallId: z16.string().optional()
|
|
1874
2420
|
}),
|
|
1875
|
-
|
|
1876
|
-
type:
|
|
1877
|
-
id:
|
|
1878
|
-
summary:
|
|
1879
|
-
content:
|
|
2421
|
+
z16.object({
|
|
2422
|
+
type: z16.literal("reasoning"),
|
|
2423
|
+
id: z16.string(),
|
|
2424
|
+
summary: z16.array(z16.string()),
|
|
2425
|
+
content: z16.array(z16.string()),
|
|
1880
2426
|
...itemPresentationField,
|
|
1881
|
-
parentToolCallId:
|
|
2427
|
+
parentToolCallId: z16.string().optional()
|
|
1882
2428
|
}),
|
|
1883
|
-
|
|
1884
|
-
type:
|
|
1885
|
-
id:
|
|
1886
|
-
text:
|
|
2429
|
+
z16.object({
|
|
2430
|
+
type: z16.literal("plan"),
|
|
2431
|
+
id: z16.string(),
|
|
2432
|
+
text: z16.string(),
|
|
1887
2433
|
...itemPresentationField,
|
|
1888
|
-
parentToolCallId:
|
|
2434
|
+
parentToolCallId: z16.string().optional()
|
|
1889
2435
|
}),
|
|
1890
2436
|
threadEventPlanStepsItemSchema,
|
|
1891
|
-
|
|
1892
|
-
type:
|
|
1893
|
-
id:
|
|
2437
|
+
z16.object({
|
|
2438
|
+
type: z16.literal("contextCompaction"),
|
|
2439
|
+
id: z16.string(),
|
|
1894
2440
|
...itemPresentationField,
|
|
1895
|
-
parentToolCallId:
|
|
2441
|
+
parentToolCallId: z16.string().optional()
|
|
1896
2442
|
}),
|
|
1897
2443
|
threadEventBackgroundTaskItemSchema,
|
|
1898
2444
|
threadEventDelegationItemSchema,
|
|
1899
2445
|
threadEventExtensionItemSchema
|
|
1900
2446
|
]);
|
|
1901
2447
|
function itemTextDeltaEventSchema(type) {
|
|
1902
|
-
return
|
|
1903
|
-
type:
|
|
1904
|
-
threadId:
|
|
1905
|
-
providerThreadId:
|
|
1906
|
-
itemId:
|
|
1907
|
-
delta:
|
|
1908
|
-
parentToolCallId:
|
|
2448
|
+
return z16.object({
|
|
2449
|
+
type: z16.literal(type),
|
|
2450
|
+
threadId: z16.string(),
|
|
2451
|
+
providerThreadId: z16.string(),
|
|
2452
|
+
itemId: z16.string(),
|
|
2453
|
+
delta: z16.string(),
|
|
2454
|
+
parentToolCallId: z16.string().optional()
|
|
1909
2455
|
});
|
|
1910
2456
|
}
|
|
1911
|
-
var unscopedProviderEventSchema =
|
|
1912
|
-
|
|
1913
|
-
type:
|
|
1914
|
-
threadId:
|
|
2457
|
+
var unscopedProviderEventSchema = z16.discriminatedUnion("type", [
|
|
2458
|
+
z16.object({
|
|
2459
|
+
type: z16.literal("thread/started"),
|
|
2460
|
+
threadId: z16.string()
|
|
1915
2461
|
}),
|
|
1916
|
-
|
|
1917
|
-
type:
|
|
1918
|
-
threadId:
|
|
1919
|
-
providerThreadId:
|
|
2462
|
+
z16.object({
|
|
2463
|
+
type: z16.literal("thread/identity"),
|
|
2464
|
+
threadId: z16.string(),
|
|
2465
|
+
providerThreadId: z16.string()
|
|
1920
2466
|
}),
|
|
1921
|
-
|
|
1922
|
-
type:
|
|
1923
|
-
threadId:
|
|
1924
|
-
providerThreadId:
|
|
1925
|
-
parentToolCallId:
|
|
2467
|
+
z16.object({
|
|
2468
|
+
type: z16.literal("turn/started"),
|
|
2469
|
+
threadId: z16.string(),
|
|
2470
|
+
providerThreadId: z16.string(),
|
|
2471
|
+
parentToolCallId: z16.string().optional()
|
|
1926
2472
|
}),
|
|
1927
|
-
|
|
1928
|
-
type:
|
|
1929
|
-
threadId:
|
|
1930
|
-
providerThreadId:
|
|
2473
|
+
z16.object({
|
|
2474
|
+
type: z16.literal("turn/completed"),
|
|
2475
|
+
threadId: z16.string(),
|
|
2476
|
+
providerThreadId: z16.string().nullable(),
|
|
1931
2477
|
status: threadEventTurnStatusSchema,
|
|
1932
|
-
error:
|
|
1933
|
-
providerCheckpointId:
|
|
2478
|
+
error: z16.object({ message: z16.string() }).optional(),
|
|
2479
|
+
providerCheckpointId: z16.string().min(1).optional()
|
|
1934
2480
|
}),
|
|
1935
|
-
|
|
1936
|
-
type:
|
|
1937
|
-
threadId:
|
|
1938
|
-
providerThreadId:
|
|
2481
|
+
z16.object({
|
|
2482
|
+
type: z16.literal("turn/input/accepted"),
|
|
2483
|
+
threadId: z16.string(),
|
|
2484
|
+
providerThreadId: z16.string(),
|
|
1939
2485
|
clientRequestId: clientTurnRequestIdSchema,
|
|
1940
2486
|
scope: threadEventScopeSchema
|
|
1941
2487
|
}).strict(),
|
|
1942
|
-
|
|
1943
|
-
type:
|
|
1944
|
-
threadId:
|
|
1945
|
-
providerThreadId:
|
|
1946
|
-
threadName:
|
|
2488
|
+
z16.object({
|
|
2489
|
+
type: z16.literal("thread/name/updated"),
|
|
2490
|
+
threadId: z16.string(),
|
|
2491
|
+
providerThreadId: z16.string(),
|
|
2492
|
+
threadName: z16.string()
|
|
1947
2493
|
}),
|
|
1948
|
-
|
|
1949
|
-
type:
|
|
1950
|
-
threadId:
|
|
1951
|
-
providerThreadId:
|
|
2494
|
+
z16.object({
|
|
2495
|
+
type: z16.literal("thread/compacted"),
|
|
2496
|
+
threadId: z16.string(),
|
|
2497
|
+
providerThreadId: z16.string()
|
|
1952
2498
|
}),
|
|
1953
|
-
|
|
1954
|
-
type:
|
|
1955
|
-
threadId:
|
|
1956
|
-
providerThreadId:
|
|
2499
|
+
z16.object({
|
|
2500
|
+
type: z16.literal("thread/context/cleared"),
|
|
2501
|
+
threadId: z16.string(),
|
|
2502
|
+
providerThreadId: z16.string()
|
|
1957
2503
|
}),
|
|
1958
|
-
|
|
1959
|
-
type:
|
|
1960
|
-
threadId:
|
|
1961
|
-
providerThreadId:
|
|
1962
|
-
objective:
|
|
2504
|
+
z16.object({
|
|
2505
|
+
type: z16.literal("thread/goal/updated"),
|
|
2506
|
+
threadId: z16.string(),
|
|
2507
|
+
providerThreadId: z16.string(),
|
|
2508
|
+
objective: z16.string(),
|
|
1963
2509
|
status: threadTimelineGoalStatusSchema,
|
|
1964
|
-
tokenBudget:
|
|
1965
|
-
tokensUsed:
|
|
1966
|
-
timeUsedSeconds:
|
|
2510
|
+
tokenBudget: z16.number().nullable(),
|
|
2511
|
+
tokensUsed: z16.number(),
|
|
2512
|
+
timeUsedSeconds: z16.number()
|
|
1967
2513
|
}),
|
|
1968
|
-
|
|
1969
|
-
type:
|
|
1970
|
-
threadId:
|
|
1971
|
-
providerThreadId:
|
|
2514
|
+
z16.object({
|
|
2515
|
+
type: z16.literal("thread/goal/cleared"),
|
|
2516
|
+
threadId: z16.string(),
|
|
2517
|
+
providerThreadId: z16.string()
|
|
1972
2518
|
}),
|
|
1973
|
-
|
|
1974
|
-
type:
|
|
1975
|
-
threadId:
|
|
1976
|
-
providerThreadId:
|
|
2519
|
+
z16.object({
|
|
2520
|
+
type: z16.literal("item/started"),
|
|
2521
|
+
threadId: z16.string(),
|
|
2522
|
+
providerThreadId: z16.string(),
|
|
1977
2523
|
item: threadEventItemSchema
|
|
1978
2524
|
}),
|
|
1979
|
-
|
|
1980
|
-
type:
|
|
1981
|
-
threadId:
|
|
1982
|
-
providerThreadId:
|
|
2525
|
+
z16.object({
|
|
2526
|
+
type: z16.literal("item/completed"),
|
|
2527
|
+
threadId: z16.string(),
|
|
2528
|
+
providerThreadId: z16.string(),
|
|
1983
2529
|
item: threadEventItemSchema
|
|
1984
2530
|
}),
|
|
1985
2531
|
itemTextDeltaEventSchema("item/agentMessage/delta"),
|
|
1986
|
-
|
|
1987
|
-
type:
|
|
1988
|
-
threadId:
|
|
1989
|
-
providerThreadId:
|
|
1990
|
-
itemId:
|
|
1991
|
-
delta:
|
|
1992
|
-
reset:
|
|
1993
|
-
parentToolCallId:
|
|
2532
|
+
z16.object({
|
|
2533
|
+
type: z16.literal("item/commandExecution/outputDelta"),
|
|
2534
|
+
threadId: z16.string(),
|
|
2535
|
+
providerThreadId: z16.string(),
|
|
2536
|
+
itemId: z16.string(),
|
|
2537
|
+
delta: z16.string(),
|
|
2538
|
+
reset: z16.boolean().optional(),
|
|
2539
|
+
parentToolCallId: z16.string().optional()
|
|
1994
2540
|
}),
|
|
1995
2541
|
itemTextDeltaEventSchema("item/fileChange/outputDelta"),
|
|
1996
2542
|
itemTextDeltaEventSchema("item/reasoning/summaryTextDelta"),
|
|
1997
2543
|
itemTextDeltaEventSchema("item/reasoning/textDelta"),
|
|
1998
2544
|
itemTextDeltaEventSchema("item/plan/delta"),
|
|
1999
|
-
|
|
2000
|
-
type:
|
|
2001
|
-
threadId:
|
|
2002
|
-
providerThreadId:
|
|
2003
|
-
itemId:
|
|
2004
|
-
message:
|
|
2005
|
-
parentToolCallId:
|
|
2545
|
+
z16.object({
|
|
2546
|
+
type: z16.literal("item/mcpToolCall/progress"),
|
|
2547
|
+
threadId: z16.string(),
|
|
2548
|
+
providerThreadId: z16.string(),
|
|
2549
|
+
itemId: z16.string(),
|
|
2550
|
+
message: z16.string().optional(),
|
|
2551
|
+
parentToolCallId: z16.string().optional()
|
|
2006
2552
|
}),
|
|
2007
2553
|
toolCallProgressEventSchema,
|
|
2008
|
-
|
|
2009
|
-
type:
|
|
2010
|
-
threadId:
|
|
2011
|
-
providerThreadId:
|
|
2554
|
+
z16.object({
|
|
2555
|
+
type: z16.literal("item/backgroundTask/progress"),
|
|
2556
|
+
threadId: z16.string(),
|
|
2557
|
+
providerThreadId: z16.string(),
|
|
2012
2558
|
item: threadEventBackgroundTaskItemSchema
|
|
2013
2559
|
}),
|
|
2014
|
-
|
|
2015
|
-
type:
|
|
2016
|
-
threadId:
|
|
2017
|
-
providerThreadId:
|
|
2560
|
+
z16.object({
|
|
2561
|
+
type: z16.literal("item/backgroundTask/completed"),
|
|
2562
|
+
threadId: z16.string(),
|
|
2563
|
+
providerThreadId: z16.string(),
|
|
2018
2564
|
item: threadEventBackgroundTaskItemSchema
|
|
2019
2565
|
}),
|
|
2020
|
-
|
|
2021
|
-
type:
|
|
2022
|
-
threadId:
|
|
2023
|
-
providerThreadId:
|
|
2566
|
+
z16.object({
|
|
2567
|
+
type: z16.literal("item/delegation/progress"),
|
|
2568
|
+
threadId: z16.string(),
|
|
2569
|
+
providerThreadId: z16.string(),
|
|
2024
2570
|
item: threadEventDelegationItemSchema
|
|
2025
2571
|
}),
|
|
2026
|
-
|
|
2027
|
-
type:
|
|
2028
|
-
threadId:
|
|
2029
|
-
providerThreadId:
|
|
2572
|
+
z16.object({
|
|
2573
|
+
type: z16.literal("item/delegation/completed"),
|
|
2574
|
+
threadId: z16.string(),
|
|
2575
|
+
providerThreadId: z16.string(),
|
|
2030
2576
|
item: threadEventDelegationItemSchema
|
|
2031
2577
|
}),
|
|
2032
|
-
|
|
2033
|
-
type:
|
|
2034
|
-
threadId:
|
|
2035
|
-
providerThreadId:
|
|
2578
|
+
z16.object({
|
|
2579
|
+
type: z16.literal("thread/tokenUsage/updated"),
|
|
2580
|
+
threadId: z16.string(),
|
|
2581
|
+
providerThreadId: z16.string(),
|
|
2036
2582
|
tokenUsage: threadEventTokenUsageSchema
|
|
2037
2583
|
}),
|
|
2038
|
-
|
|
2039
|
-
type:
|
|
2040
|
-
threadId:
|
|
2041
|
-
providerThreadId:
|
|
2584
|
+
z16.object({
|
|
2585
|
+
type: z16.literal("thread/contextWindowUsage/updated"),
|
|
2586
|
+
threadId: z16.string(),
|
|
2587
|
+
providerThreadId: z16.string(),
|
|
2042
2588
|
contextWindowUsage: threadEventContextWindowUsageSchema
|
|
2043
2589
|
}),
|
|
2044
|
-
|
|
2045
|
-
type:
|
|
2046
|
-
threadId:
|
|
2047
|
-
providerThreadId:
|
|
2048
|
-
plan:
|
|
2049
|
-
explanation:
|
|
2590
|
+
z16.object({
|
|
2591
|
+
type: z16.literal("turn/plan/updated"),
|
|
2592
|
+
threadId: z16.string(),
|
|
2593
|
+
providerThreadId: z16.string(),
|
|
2594
|
+
plan: z16.array(threadEventPlanStepSchema),
|
|
2595
|
+
explanation: z16.string().optional()
|
|
2050
2596
|
}),
|
|
2051
|
-
|
|
2052
|
-
type:
|
|
2053
|
-
threadId:
|
|
2054
|
-
providerThreadId:
|
|
2055
|
-
diff:
|
|
2597
|
+
z16.object({
|
|
2598
|
+
type: z16.literal("turn/diff/updated"),
|
|
2599
|
+
threadId: z16.string(),
|
|
2600
|
+
providerThreadId: z16.string(),
|
|
2601
|
+
diff: z16.string().optional()
|
|
2056
2602
|
}),
|
|
2057
|
-
|
|
2058
|
-
type:
|
|
2059
|
-
threadId:
|
|
2060
|
-
providerThreadId:
|
|
2061
|
-
message:
|
|
2062
|
-
detail:
|
|
2063
|
-
willRetry:
|
|
2603
|
+
z16.object({
|
|
2604
|
+
type: z16.literal("provider/error"),
|
|
2605
|
+
threadId: z16.string(),
|
|
2606
|
+
providerThreadId: z16.string(),
|
|
2607
|
+
message: z16.string(),
|
|
2608
|
+
detail: z16.string().optional(),
|
|
2609
|
+
willRetry: z16.boolean().optional(),
|
|
2064
2610
|
errorInfo: providerErrorInfoSchema.optional()
|
|
2065
2611
|
}),
|
|
2066
|
-
|
|
2067
|
-
type:
|
|
2068
|
-
threadId:
|
|
2069
|
-
providerThreadId:
|
|
2612
|
+
z16.object({
|
|
2613
|
+
type: z16.literal("provider/rateLimits/updated"),
|
|
2614
|
+
threadId: z16.string(),
|
|
2615
|
+
providerThreadId: z16.string(),
|
|
2070
2616
|
rateLimits: providerRateLimitStateSchema
|
|
2071
2617
|
}),
|
|
2072
|
-
|
|
2073
|
-
type:
|
|
2074
|
-
threadId:
|
|
2075
|
-
providerThreadId:
|
|
2076
|
-
entries:
|
|
2077
|
-
|
|
2078
|
-
name:
|
|
2079
|
-
source:
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2618
|
+
z16.object({
|
|
2619
|
+
type: z16.literal("provider.env-resolved"),
|
|
2620
|
+
threadId: z16.string(),
|
|
2621
|
+
providerThreadId: z16.string(),
|
|
2622
|
+
entries: z16.array(
|
|
2623
|
+
z16.object({
|
|
2624
|
+
name: z16.string(),
|
|
2625
|
+
source: z16.union([
|
|
2626
|
+
z16.literal("shell"),
|
|
2627
|
+
z16.object({ plugin: z16.string() }).strict(),
|
|
2628
|
+
z16.object({
|
|
2629
|
+
core: z16.enum([
|
|
2630
|
+
"machine-git",
|
|
2631
|
+
"machine-environment",
|
|
2632
|
+
"project-environment"
|
|
2633
|
+
])
|
|
2634
|
+
}).strict()
|
|
2083
2635
|
]),
|
|
2084
|
-
value:
|
|
2085
|
-
|
|
2086
|
-
|
|
2636
|
+
value: z16.union([
|
|
2637
|
+
z16.string(),
|
|
2638
|
+
z16.object({ masked: z16.literal(true) }).strict()
|
|
2087
2639
|
]),
|
|
2088
|
-
reason:
|
|
2640
|
+
reason: z16.string().optional()
|
|
2089
2641
|
}).strict()
|
|
2090
2642
|
)
|
|
2091
2643
|
}),
|
|
2092
|
-
|
|
2093
|
-
type:
|
|
2094
|
-
threadId:
|
|
2095
|
-
providerThreadId:
|
|
2644
|
+
z16.object({
|
|
2645
|
+
type: z16.literal("thread/extensionState/updated"),
|
|
2646
|
+
threadId: z16.string(),
|
|
2647
|
+
providerThreadId: z16.string(),
|
|
2096
2648
|
kind: extensionKindSchema,
|
|
2097
2649
|
payload: jsonValueSchema
|
|
2098
2650
|
}),
|
|
2099
|
-
|
|
2100
|
-
type:
|
|
2101
|
-
threadId:
|
|
2102
|
-
providerThreadId:
|
|
2651
|
+
z16.object({
|
|
2652
|
+
type: z16.literal("provider/warning"),
|
|
2653
|
+
threadId: z16.string(),
|
|
2654
|
+
providerThreadId: z16.string(),
|
|
2103
2655
|
category: threadEventWarningCategorySchema,
|
|
2104
|
-
summary:
|
|
2105
|
-
details:
|
|
2656
|
+
summary: z16.string().optional(),
|
|
2657
|
+
details: z16.string().optional()
|
|
2106
2658
|
}),
|
|
2107
|
-
|
|
2108
|
-
type:
|
|
2109
|
-
threadId:
|
|
2110
|
-
providerThreadId:
|
|
2111
|
-
originalModel:
|
|
2112
|
-
fallbackModel:
|
|
2113
|
-
reason:
|
|
2114
|
-
message:
|
|
2659
|
+
z16.object({
|
|
2660
|
+
type: z16.literal("provider/modelFallback"),
|
|
2661
|
+
threadId: z16.string(),
|
|
2662
|
+
providerThreadId: z16.string(),
|
|
2663
|
+
originalModel: z16.string().min(1),
|
|
2664
|
+
fallbackModel: z16.string().min(1),
|
|
2665
|
+
reason: z16.enum(["refusal", "provider"]),
|
|
2666
|
+
message: z16.string()
|
|
2115
2667
|
}),
|
|
2116
2668
|
providerUnhandledEventSchema
|
|
2117
2669
|
]);
|
|
2118
|
-
var scopedEventDataSchema =
|
|
2670
|
+
var scopedEventDataSchema = z16.object({
|
|
2119
2671
|
scope: threadEventScopeSchema
|
|
2120
2672
|
});
|
|
2121
2673
|
var providerEventSchema = unscopedProviderEventSchema.and(
|
|
@@ -2124,58 +2676,58 @@ var providerEventSchema = unscopedProviderEventSchema.and(
|
|
|
2124
2676
|
var providerEventTypeValues = unscopedProviderEventSchema.options.map(
|
|
2125
2677
|
(option) => option.shape.type.value
|
|
2126
2678
|
);
|
|
2127
|
-
var unscopedSystemEventSchema =
|
|
2128
|
-
|
|
2129
|
-
type:
|
|
2130
|
-
threadId:
|
|
2679
|
+
var unscopedSystemEventSchema = z16.discriminatedUnion("type", [
|
|
2680
|
+
z16.object({
|
|
2681
|
+
type: z16.literal("client/thread/start"),
|
|
2682
|
+
threadId: z16.string()
|
|
2131
2683
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
2132
|
-
|
|
2133
|
-
type:
|
|
2134
|
-
threadId:
|
|
2684
|
+
z16.object({
|
|
2685
|
+
type: z16.literal("client/turn/requested"),
|
|
2686
|
+
threadId: z16.string()
|
|
2135
2687
|
}).merge(turnRequestEventDataSchema),
|
|
2136
|
-
|
|
2137
|
-
type:
|
|
2138
|
-
threadId:
|
|
2688
|
+
z16.object({
|
|
2689
|
+
type: z16.literal("client/turn/rejected"),
|
|
2690
|
+
threadId: z16.string()
|
|
2139
2691
|
}).merge(turnRequestRejectedEventDataSchema),
|
|
2140
|
-
|
|
2141
|
-
type:
|
|
2142
|
-
threadId:
|
|
2692
|
+
z16.object({
|
|
2693
|
+
type: z16.literal("client/turn/start"),
|
|
2694
|
+
threadId: z16.string()
|
|
2143
2695
|
}).merge(clientTurnLifecycleEventDataSchema),
|
|
2144
|
-
|
|
2145
|
-
type:
|
|
2146
|
-
threadId:
|
|
2696
|
+
z16.object({
|
|
2697
|
+
type: z16.literal("system/error"),
|
|
2698
|
+
threadId: z16.string()
|
|
2147
2699
|
}).merge(systemErrorEventDataSchema),
|
|
2148
|
-
|
|
2149
|
-
type:
|
|
2150
|
-
threadId:
|
|
2700
|
+
z16.object({
|
|
2701
|
+
type: z16.literal("system/manager/user_message"),
|
|
2702
|
+
threadId: z16.string()
|
|
2151
2703
|
}).merge(systemLegacyUserMessageEventDataSchema),
|
|
2152
|
-
|
|
2153
|
-
type:
|
|
2154
|
-
threadId:
|
|
2704
|
+
z16.object({
|
|
2705
|
+
type: z16.literal("system/thread/interrupted"),
|
|
2706
|
+
threadId: z16.string()
|
|
2155
2707
|
}).merge(systemThreadInterruptedEventDataSchema),
|
|
2156
|
-
|
|
2157
|
-
type:
|
|
2158
|
-
threadId:
|
|
2708
|
+
z16.object({
|
|
2709
|
+
type: z16.literal("system/operation"),
|
|
2710
|
+
threadId: z16.string()
|
|
2159
2711
|
}).merge(systemOperationEventDataSchema),
|
|
2160
|
-
|
|
2161
|
-
type:
|
|
2162
|
-
threadId:
|
|
2712
|
+
z16.object({
|
|
2713
|
+
type: z16.literal("system/interaction/lifecycle"),
|
|
2714
|
+
threadId: z16.string()
|
|
2163
2715
|
}).merge(systemInteractionLifecycleEventDataSchema),
|
|
2164
|
-
|
|
2165
|
-
type:
|
|
2166
|
-
threadId:
|
|
2716
|
+
z16.object({
|
|
2717
|
+
type: z16.literal("system/permissionGrant/lifecycle"),
|
|
2718
|
+
threadId: z16.string()
|
|
2167
2719
|
}).merge(systemPermissionGrantLifecycleEventDataSchema),
|
|
2168
|
-
|
|
2169
|
-
type:
|
|
2170
|
-
threadId:
|
|
2720
|
+
z16.object({
|
|
2721
|
+
type: z16.literal("system/userQuestion/lifecycle"),
|
|
2722
|
+
threadId: z16.string()
|
|
2171
2723
|
}).merge(systemUserQuestionLifecycleEventDataSchema),
|
|
2172
|
-
|
|
2173
|
-
type:
|
|
2174
|
-
threadId:
|
|
2724
|
+
z16.object({
|
|
2725
|
+
type: z16.literal("system/thread-provisioning"),
|
|
2726
|
+
threadId: z16.string()
|
|
2175
2727
|
}).merge(systemThreadProvisioningEventDataSchema),
|
|
2176
|
-
|
|
2177
|
-
type:
|
|
2178
|
-
threadId:
|
|
2728
|
+
z16.object({
|
|
2729
|
+
type: z16.literal("system/provider-turn-watchdog"),
|
|
2730
|
+
threadId: z16.string()
|
|
2179
2731
|
}).merge(systemProviderTurnWatchdogEventDataSchema)
|
|
2180
2732
|
]);
|
|
2181
2733
|
var systemEventSchema = unscopedSystemEventSchema.and(scopedEventDataSchema);
|
|
@@ -2183,13 +2735,13 @@ var legacyClientRequestKey = ["clientRequest", "Sequence"].join("");
|
|
|
2183
2735
|
function isEventPropertyBag(value) {
|
|
2184
2736
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2185
2737
|
}
|
|
2186
|
-
var rejectLegacyClientRequestSequenceSchema =
|
|
2738
|
+
var rejectLegacyClientRequestSequenceSchema = z16.unknown().superRefine((value, ctx) => {
|
|
2187
2739
|
if (!isEventPropertyBag(value)) {
|
|
2188
2740
|
return;
|
|
2189
2741
|
}
|
|
2190
2742
|
if (Object.hasOwn(value, legacyClientRequestKey)) {
|
|
2191
2743
|
ctx.addIssue({
|
|
2192
|
-
code:
|
|
2744
|
+
code: z16.ZodIssueCode.custom,
|
|
2193
2745
|
message: "legacy request sequence field is no longer accepted",
|
|
2194
2746
|
path: [legacyClientRequestKey]
|
|
2195
2747
|
});
|
|
@@ -2197,21 +2749,21 @@ var rejectLegacyClientRequestSequenceSchema = z15.unknown().superRefine((value,
|
|
|
2197
2749
|
const item = value.item;
|
|
2198
2750
|
if (isEventPropertyBag(item) && item.type === "userMessage" && Object.hasOwn(item, legacyClientRequestKey)) {
|
|
2199
2751
|
ctx.addIssue({
|
|
2200
|
-
code:
|
|
2752
|
+
code: z16.ZodIssueCode.custom,
|
|
2201
2753
|
message: "legacy user-message request sequence field is no longer accepted",
|
|
2202
2754
|
path: ["item", legacyClientRequestKey]
|
|
2203
2755
|
});
|
|
2204
2756
|
}
|
|
2205
2757
|
});
|
|
2206
2758
|
var threadEventSchema = rejectLegacyClientRequestSequenceSchema.pipe(
|
|
2207
|
-
|
|
2759
|
+
z16.union([providerEventSchema, systemEventSchema]).superRefine((event, ctx) => {
|
|
2208
2760
|
const result = validateThreadEventScope({
|
|
2209
2761
|
type: event.type,
|
|
2210
2762
|
scope: event.scope
|
|
2211
2763
|
});
|
|
2212
2764
|
if (!result.valid) {
|
|
2213
2765
|
ctx.addIssue({
|
|
2214
|
-
code:
|
|
2766
|
+
code: z16.ZodIssueCode.custom,
|
|
2215
2767
|
message: result.message ?? "Invalid thread event scope",
|
|
2216
2768
|
path: ["scope"]
|
|
2217
2769
|
});
|
|
@@ -2224,101 +2776,102 @@ var threadEventTypeValues = [
|
|
|
2224
2776
|
...systemEventTypeValues
|
|
2225
2777
|
];
|
|
2226
2778
|
var threadEventTypeSet = new Set(threadEventTypeValues);
|
|
2227
|
-
var threadEventTypeSchema =
|
|
2779
|
+
var threadEventTypeSchema = z16.string().refine(
|
|
2228
2780
|
(value) => threadEventTypeSet.has(value),
|
|
2229
2781
|
"Invalid thread event type"
|
|
2230
2782
|
);
|
|
2231
2783
|
|
|
2232
2784
|
// ../domain/src/provider-fork.ts
|
|
2233
|
-
import { z as
|
|
2785
|
+
import { z as z17 } from "zod";
|
|
2234
2786
|
var PROVIDER_FORK_VALUES = ["none", "tip", "checkpoint"];
|
|
2235
|
-
var providerForkSchema =
|
|
2787
|
+
var providerForkSchema = z17.enum(PROVIDER_FORK_VALUES);
|
|
2236
2788
|
|
|
2237
2789
|
// ../domain/src/provider-types.ts
|
|
2238
|
-
import { z as
|
|
2239
|
-
var modelReasoningEffortSchema =
|
|
2790
|
+
import { z as z18 } from "zod";
|
|
2791
|
+
var modelReasoningEffortSchema = z18.object({
|
|
2240
2792
|
reasoningEffort: reasoningLevelSchema,
|
|
2241
|
-
description:
|
|
2242
|
-
});
|
|
2243
|
-
var availableModelSchema =
|
|
2244
|
-
id:
|
|
2245
|
-
model:
|
|
2246
|
-
displayName:
|
|
2247
|
-
routeProviderId:
|
|
2248
|
-
description:
|
|
2249
|
-
supportedReasoningEfforts:
|
|
2793
|
+
description: z18.string()
|
|
2794
|
+
});
|
|
2795
|
+
var availableModelSchema = z18.object({
|
|
2796
|
+
id: z18.string(),
|
|
2797
|
+
model: z18.string(),
|
|
2798
|
+
displayName: z18.string(),
|
|
2799
|
+
routeProviderId: z18.string().min(1).optional(),
|
|
2800
|
+
description: z18.string(),
|
|
2801
|
+
supportedReasoningEfforts: z18.array(modelReasoningEffortSchema),
|
|
2250
2802
|
defaultReasoningEffort: reasoningLevelSchema,
|
|
2251
|
-
isDefault:
|
|
2252
|
-
});
|
|
2253
|
-
var providerModelCatalogScopeSchema =
|
|
2254
|
-
var providerCapabilitiesSchema =
|
|
2255
|
-
supportsThreadArchive:
|
|
2256
|
-
supportsThreadRename:
|
|
2257
|
-
supportsServiceTier:
|
|
2258
|
-
supportsNativeUserQuestion:
|
|
2259
|
-
supportsFork:
|
|
2260
|
-
supportsSessionRewind:
|
|
2261
|
-
permissionModes:
|
|
2803
|
+
isDefault: z18.boolean()
|
|
2804
|
+
});
|
|
2805
|
+
var providerModelCatalogScopeSchema = z18.enum(["host", "workspace"]);
|
|
2806
|
+
var providerCapabilitiesSchema = z18.object({
|
|
2807
|
+
supportsThreadArchive: z18.boolean(),
|
|
2808
|
+
supportsThreadRename: z18.boolean(),
|
|
2809
|
+
supportsServiceTier: z18.boolean(),
|
|
2810
|
+
supportsNativeUserQuestion: z18.boolean(),
|
|
2811
|
+
supportsFork: z18.boolean(),
|
|
2812
|
+
supportsSessionRewind: z18.boolean(),
|
|
2813
|
+
permissionModes: z18.array(permissionModeSchema).min(1),
|
|
2262
2814
|
modelCatalogScope: providerModelCatalogScopeSchema
|
|
2263
2815
|
});
|
|
2264
|
-
var providerComposerCommandSchema =
|
|
2816
|
+
var providerComposerCommandSchema = z18.object({
|
|
2265
2817
|
trigger: promptMentionCommandTriggerSchema,
|
|
2266
|
-
name:
|
|
2267
|
-
trailingText:
|
|
2818
|
+
name: z18.string().min(1).regex(/^[^\s/$]+$/u),
|
|
2819
|
+
trailingText: z18.string().regex(/^\s*$/u)
|
|
2268
2820
|
});
|
|
2269
|
-
var providerComposerActionSchema =
|
|
2270
|
-
|
|
2271
|
-
kind:
|
|
2821
|
+
var providerComposerActionSchema = z18.discriminatedUnion("kind", [
|
|
2822
|
+
z18.object({
|
|
2823
|
+
kind: z18.literal("skills"),
|
|
2272
2824
|
trigger: promptMentionCommandTriggerSchema
|
|
2273
2825
|
}),
|
|
2274
|
-
|
|
2275
|
-
kind:
|
|
2826
|
+
z18.object({
|
|
2827
|
+
kind: z18.literal("plan"),
|
|
2276
2828
|
command: providerComposerCommandSchema
|
|
2277
2829
|
}),
|
|
2278
|
-
|
|
2279
|
-
kind:
|
|
2830
|
+
z18.object({
|
|
2831
|
+
kind: z18.literal("goal"),
|
|
2280
2832
|
command: providerComposerCommandSchema
|
|
2281
2833
|
})
|
|
2282
2834
|
]);
|
|
2283
|
-
var providerStringsSchema =
|
|
2284
|
-
signInHint:
|
|
2285
|
-
expiredHint:
|
|
2286
|
-
installUrl:
|
|
2287
|
-
brandPrefix:
|
|
2288
|
-
planModeCopy:
|
|
2289
|
-
iconTint:
|
|
2290
|
-
});
|
|
2291
|
-
var providerOptionDescriptorSchema =
|
|
2292
|
-
id:
|
|
2293
|
-
label:
|
|
2294
|
-
description:
|
|
2295
|
-
});
|
|
2296
|
-
var providerExtensionKindInfoSchema =
|
|
2297
|
-
item:
|
|
2298
|
-
state:
|
|
2299
|
-
});
|
|
2300
|
-
var providerExtensionKindsSchema =
|
|
2835
|
+
var providerStringsSchema = z18.object({
|
|
2836
|
+
signInHint: z18.string().min(1),
|
|
2837
|
+
expiredHint: z18.string().min(1),
|
|
2838
|
+
installUrl: z18.string().min(1),
|
|
2839
|
+
brandPrefix: z18.string().min(1).optional(),
|
|
2840
|
+
planModeCopy: z18.string().min(1).optional(),
|
|
2841
|
+
iconTint: z18.object({ light: z18.string().min(1), dark: z18.string().min(1) }).optional()
|
|
2842
|
+
});
|
|
2843
|
+
var providerOptionDescriptorSchema = z18.object({
|
|
2844
|
+
id: z18.string().min(1),
|
|
2845
|
+
label: z18.string().min(1),
|
|
2846
|
+
description: z18.string().min(1).optional()
|
|
2847
|
+
});
|
|
2848
|
+
var providerExtensionKindInfoSchema = z18.object({
|
|
2849
|
+
item: z18.boolean(),
|
|
2850
|
+
state: z18.boolean()
|
|
2851
|
+
});
|
|
2852
|
+
var providerExtensionKindsSchema = z18.record(
|
|
2301
2853
|
extensionKindSchema,
|
|
2302
2854
|
providerExtensionKindInfoSchema
|
|
2303
2855
|
);
|
|
2304
|
-
var providerInfoSchema =
|
|
2305
|
-
id:
|
|
2306
|
-
pluginId:
|
|
2307
|
-
displayName:
|
|
2308
|
-
family:
|
|
2309
|
-
icon:
|
|
2310
|
-
logoUrl:
|
|
2311
|
-
maintenance:
|
|
2312
|
-
health:
|
|
2313
|
-
usage:
|
|
2314
|
-
installation:
|
|
2856
|
+
var providerInfoSchema = z18.object({
|
|
2857
|
+
id: z18.string(),
|
|
2858
|
+
pluginId: z18.string().min(1),
|
|
2859
|
+
displayName: z18.string(),
|
|
2860
|
+
family: z18.string().min(1).optional(),
|
|
2861
|
+
icon: z18.object({ glyph: z18.string().min(1) }).optional(),
|
|
2862
|
+
logoUrl: z18.string().min(1).nullable(),
|
|
2863
|
+
maintenance: z18.object({
|
|
2864
|
+
health: z18.boolean(),
|
|
2865
|
+
usage: z18.boolean(),
|
|
2866
|
+
installation: z18.boolean()
|
|
2315
2867
|
}),
|
|
2316
2868
|
capabilities: providerCapabilitiesSchema,
|
|
2317
|
-
composerActions:
|
|
2318
|
-
|
|
2869
|
+
composerActions: z18.array(providerComposerActionSchema),
|
|
2870
|
+
completedTurnDisplay: completedTurnDisplaySchema,
|
|
2871
|
+
available: z18.boolean(),
|
|
2319
2872
|
strings: providerStringsSchema.optional(),
|
|
2320
|
-
serviceTiers:
|
|
2321
|
-
reasoningLevels:
|
|
2873
|
+
serviceTiers: z18.array(providerOptionDescriptorSchema).optional(),
|
|
2874
|
+
reasoningLevels: z18.array(providerOptionDescriptorSchema).optional(),
|
|
2322
2875
|
extensionKinds: providerExtensionKindsSchema.optional()
|
|
2323
2876
|
});
|
|
2324
2877
|
var providerRecoveryKindValues = [
|
|
@@ -2328,34 +2881,34 @@ var providerRecoveryKindValues = [
|
|
|
2328
2881
|
"staleTurn",
|
|
2329
2882
|
"rateLimited"
|
|
2330
2883
|
];
|
|
2331
|
-
var providerRecoveryKindSchema =
|
|
2332
|
-
var toolCallOutputItemSchema =
|
|
2333
|
-
|
|
2334
|
-
type:
|
|
2335
|
-
text:
|
|
2884
|
+
var providerRecoveryKindSchema = z18.enum(providerRecoveryKindValues);
|
|
2885
|
+
var toolCallOutputItemSchema = z18.discriminatedUnion("type", [
|
|
2886
|
+
z18.object({
|
|
2887
|
+
type: z18.literal("inputText"),
|
|
2888
|
+
text: z18.string()
|
|
2336
2889
|
}),
|
|
2337
|
-
|
|
2338
|
-
type:
|
|
2339
|
-
imageUrl:
|
|
2890
|
+
z18.object({
|
|
2891
|
+
type: z18.literal("inputImage"),
|
|
2892
|
+
imageUrl: z18.string()
|
|
2340
2893
|
})
|
|
2341
2894
|
]);
|
|
2342
|
-
var toolCallRequestSchema =
|
|
2343
|
-
requestId:
|
|
2344
|
-
threadId:
|
|
2345
|
-
providerThreadId:
|
|
2346
|
-
turnId:
|
|
2347
|
-
callId:
|
|
2348
|
-
tool:
|
|
2349
|
-
arguments:
|
|
2350
|
-
});
|
|
2351
|
-
var toolCallResponseSchema =
|
|
2352
|
-
contentItems:
|
|
2353
|
-
success:
|
|
2354
|
-
});
|
|
2355
|
-
var dynamicToolSchema =
|
|
2356
|
-
name:
|
|
2357
|
-
description:
|
|
2358
|
-
inputSchema:
|
|
2895
|
+
var toolCallRequestSchema = z18.object({
|
|
2896
|
+
requestId: z18.union([z18.string().min(1), z18.number()]),
|
|
2897
|
+
threadId: z18.string().min(1),
|
|
2898
|
+
providerThreadId: z18.string().min(1),
|
|
2899
|
+
turnId: z18.string().min(1),
|
|
2900
|
+
callId: z18.string().min(1),
|
|
2901
|
+
tool: z18.string().min(1),
|
|
2902
|
+
arguments: z18.unknown().optional()
|
|
2903
|
+
});
|
|
2904
|
+
var toolCallResponseSchema = z18.object({
|
|
2905
|
+
contentItems: z18.array(toolCallOutputItemSchema),
|
|
2906
|
+
success: z18.boolean()
|
|
2907
|
+
});
|
|
2908
|
+
var dynamicToolSchema = z18.object({
|
|
2909
|
+
name: z18.string(),
|
|
2910
|
+
description: z18.string(),
|
|
2911
|
+
inputSchema: z18.unknown(),
|
|
2359
2912
|
presentation: threadEventItemPresentationSchema.optional()
|
|
2360
2913
|
});
|
|
2361
2914
|
|
|
@@ -2407,10 +2960,10 @@ function reasoningEffortsForLevels(levels) {
|
|
|
2407
2960
|
}
|
|
2408
2961
|
|
|
2409
2962
|
// ../provider-bridge-acp/src/launch-spec.ts
|
|
2410
|
-
import { z as
|
|
2411
|
-
var acpNativeSkillRootsSchema =
|
|
2412
|
-
user:
|
|
2413
|
-
project:
|
|
2963
|
+
import { z as z19 } from "zod";
|
|
2964
|
+
var acpNativeSkillRootsSchema = z19.object({
|
|
2965
|
+
user: z19.array(providerNativeRootInputSchema).default([]),
|
|
2966
|
+
project: z19.array(providerNativeRootInputSchema).default([])
|
|
2414
2967
|
}).strict().superRefine((roots, context) => {
|
|
2415
2968
|
const normalized = providerNativeRootsSchema.safeParse(
|
|
2416
2969
|
normalizeProviderNativeRoots(roots)
|
|
@@ -2426,16 +2979,16 @@ var acpNativeSkillRootsSchema = z18.object({
|
|
|
2426
2979
|
});
|
|
2427
2980
|
}
|
|
2428
2981
|
});
|
|
2429
|
-
var acpLaunchSpecSchema =
|
|
2430
|
-
displayName:
|
|
2431
|
-
command:
|
|
2432
|
-
args:
|
|
2433
|
-
env:
|
|
2434
|
-
cwd:
|
|
2435
|
-
modelCli:
|
|
2436
|
-
listArgs:
|
|
2437
|
-
selectFlag:
|
|
2438
|
-
primaryModels:
|
|
2982
|
+
var acpLaunchSpecSchema = z19.object({
|
|
2983
|
+
displayName: z19.string().min(1),
|
|
2984
|
+
command: z19.string().min(1),
|
|
2985
|
+
args: z19.array(z19.string()),
|
|
2986
|
+
env: z19.record(z19.string().min(1), z19.string()),
|
|
2987
|
+
cwd: z19.string().min(1).optional(),
|
|
2988
|
+
modelCli: z19.object({
|
|
2989
|
+
listArgs: z19.array(z19.string()),
|
|
2990
|
+
selectFlag: z19.string().min(1).optional(),
|
|
2991
|
+
primaryModels: z19.array(z19.string())
|
|
2439
2992
|
}).strict().transform(
|
|
2440
2993
|
(modelCli) => modelCli.listArgs.length > 0 ? modelCli : void 0
|
|
2441
2994
|
).optional(),
|
|
@@ -2450,66 +3003,66 @@ var PROVIDER_BRIDGE_PROTOCOL_VERSION = 2;
|
|
|
2450
3003
|
var THREAD_DELTA_GRAMMAR_V3 = 3;
|
|
2451
3004
|
|
|
2452
3005
|
// ../provider-bridge-protocol/src/handshake.ts
|
|
2453
|
-
import { z as
|
|
2454
|
-
var bridgeGrammarVersionsSchema =
|
|
3006
|
+
import { z as z20 } from "zod";
|
|
3007
|
+
var bridgeGrammarVersionsSchema = z20.tuple([z20.number().int().positive(), z20.number().int().positive()]).refine(([min, max]) => min <= max, {
|
|
2455
3008
|
message: "grammarVersions must be an ascending [min, max] range"
|
|
2456
3009
|
});
|
|
2457
|
-
var bridgeSteerModeSchema =
|
|
2458
|
-
var bridgeCapabilitiesSchema =
|
|
2459
|
-
sessionRestore:
|
|
2460
|
-
threadArchive:
|
|
2461
|
-
threadRename:
|
|
2462
|
-
threadGoalClear:
|
|
3010
|
+
var bridgeSteerModeSchema = z20.enum(["inject", "queue"]);
|
|
3011
|
+
var bridgeCapabilitiesSchema = z20.object({
|
|
3012
|
+
sessionRestore: z20.boolean().default(false),
|
|
3013
|
+
threadArchive: z20.boolean().default(false),
|
|
3014
|
+
threadRename: z20.boolean().default(false),
|
|
3015
|
+
threadGoalClear: z20.boolean().default(false),
|
|
2463
3016
|
fork: providerForkSchema.default("none"),
|
|
2464
|
-
approvalEnforcedBy:
|
|
3017
|
+
approvalEnforcedBy: z20.enum(["runtime", "provider"]).default("runtime"),
|
|
2465
3018
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
2466
3019
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
2467
3020
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
2468
3021
|
]),
|
|
2469
3022
|
steerMode: bridgeSteerModeSchema.default("queue"),
|
|
2470
|
-
skills:
|
|
3023
|
+
skills: z20.object({ configure: z20.boolean().default(false) }).default({ configure: false })
|
|
2471
3024
|
}).passthrough();
|
|
2472
|
-
var initializeParamsSchema =
|
|
2473
|
-
protocolVersion:
|
|
2474
|
-
client:
|
|
3025
|
+
var initializeParamsSchema = z20.object({
|
|
3026
|
+
protocolVersion: z20.number().int().positive(),
|
|
3027
|
+
client: z20.object({ name: z20.string().min(1), version: z20.string().min(1) }),
|
|
2475
3028
|
grammarVersions: bridgeGrammarVersionsSchema.default([
|
|
2476
3029
|
PROVIDER_BRIDGE_PROTOCOL_VERSION,
|
|
2477
3030
|
PROVIDER_BRIDGE_PROTOCOL_VERSION
|
|
2478
3031
|
])
|
|
2479
3032
|
}).passthrough();
|
|
2480
|
-
var initializeResultSchema =
|
|
2481
|
-
protocolVersion:
|
|
2482
|
-
capabilities:
|
|
3033
|
+
var initializeResultSchema = z20.object({
|
|
3034
|
+
protocolVersion: z20.number().int().positive(),
|
|
3035
|
+
capabilities: z20.preprocess(
|
|
2483
3036
|
(value) => value ?? {},
|
|
2484
3037
|
bridgeCapabilitiesSchema
|
|
2485
3038
|
)
|
|
2486
3039
|
}).passthrough();
|
|
2487
3040
|
|
|
2488
3041
|
// ../provider-bridge-protocol/src/execution-options.ts
|
|
2489
|
-
import { z as
|
|
2490
|
-
var bridgeExecutionOptionsSchema =
|
|
2491
|
-
model:
|
|
3042
|
+
import { z as z21 } from "zod";
|
|
3043
|
+
var bridgeExecutionOptionsSchema = z21.object({
|
|
3044
|
+
model: z21.string().min(1).optional(),
|
|
2492
3045
|
serviceTier: serviceTierSchema.optional(),
|
|
2493
3046
|
reasoningLevel: reasoningLevelSchema.optional(),
|
|
2494
3047
|
promptMode: promptModeSchema.optional(),
|
|
2495
|
-
instructions:
|
|
2496
|
-
envVars:
|
|
2497
|
-
providerOptions:
|
|
3048
|
+
instructions: z21.string().optional(),
|
|
3049
|
+
envVars: z21.record(z21.string(), z21.string()).optional(),
|
|
3050
|
+
providerOptions: z21.record(z21.string(), z21.unknown()).optional()
|
|
2498
3051
|
}).and(runtimePermissionPolicySchema);
|
|
2499
3052
|
|
|
2500
3053
|
// ../provider-bridge-protocol/src/provider-maintenance.ts
|
|
2501
|
-
import { z as
|
|
2502
|
-
var providerMaintenanceParamsSchema =
|
|
2503
|
-
providerId:
|
|
2504
|
-
cwd:
|
|
2505
|
-
providerOptions:
|
|
3054
|
+
import { z as z22 } from "zod";
|
|
3055
|
+
var providerMaintenanceParamsSchema = z22.object({
|
|
3056
|
+
providerId: z22.string().min(1),
|
|
3057
|
+
cwd: z22.string().min(1).optional(),
|
|
3058
|
+
providerOptions: z22.record(z22.string(), z22.unknown()).optional()
|
|
2506
3059
|
}).passthrough();
|
|
2507
|
-
var providerInstallationRequirementSchema =
|
|
3060
|
+
var providerInstallationRequirementSchema = z22.enum(["thread_rewind"]);
|
|
2508
3061
|
var providerInstallationStatusParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
2509
3062
|
requirement: providerInstallationRequirementSchema.optional()
|
|
2510
3063
|
});
|
|
2511
|
-
var providerHealthSchema =
|
|
2512
|
-
status:
|
|
3064
|
+
var providerHealthSchema = z22.object({
|
|
3065
|
+
status: z22.enum([
|
|
2513
3066
|
"ready",
|
|
2514
3067
|
"not_installed",
|
|
2515
3068
|
"unauthenticated",
|
|
@@ -2517,114 +3070,114 @@ var providerHealthSchema = z21.object({
|
|
|
2517
3070
|
"unsupported_version",
|
|
2518
3071
|
"unknown"
|
|
2519
3072
|
]),
|
|
2520
|
-
statusMessage:
|
|
2521
|
-
accountEmail:
|
|
2522
|
-
planLabel:
|
|
2523
|
-
installedVersion:
|
|
2524
|
-
minimumSupportedVersion:
|
|
2525
|
-
canInstall:
|
|
2526
|
-
canUpdate:
|
|
2527
|
-
loginCommand:
|
|
3073
|
+
statusMessage: z22.string().min(1).nullable(),
|
|
3074
|
+
accountEmail: z22.string().nullable(),
|
|
3075
|
+
planLabel: z22.string().min(1).nullable(),
|
|
3076
|
+
installedVersion: z22.string().min(1).nullable(),
|
|
3077
|
+
minimumSupportedVersion: z22.string().min(1).nullable(),
|
|
3078
|
+
canInstall: z22.boolean(),
|
|
3079
|
+
canUpdate: z22.boolean(),
|
|
3080
|
+
loginCommand: z22.string().min(1).nullable()
|
|
2528
3081
|
}).passthrough();
|
|
2529
|
-
var providerUsageWindowSchema =
|
|
2530
|
-
label:
|
|
2531
|
-
usedPercent:
|
|
2532
|
-
resetsAt:
|
|
2533
|
-
cost:
|
|
2534
|
-
usedUsdCents:
|
|
2535
|
-
limitUsdCents:
|
|
3082
|
+
var providerUsageWindowSchema = z22.object({
|
|
3083
|
+
label: z22.string().min(1),
|
|
3084
|
+
usedPercent: z22.number().min(0).max(100),
|
|
3085
|
+
resetsAt: z22.string().min(1).nullable(),
|
|
3086
|
+
cost: z22.object({
|
|
3087
|
+
usedUsdCents: z22.number().int().nonnegative(),
|
|
3088
|
+
limitUsdCents: z22.number().int().positive()
|
|
2536
3089
|
}).optional()
|
|
2537
3090
|
}).passthrough();
|
|
2538
|
-
var providerUsageSchema =
|
|
2539
|
-
|
|
2540
|
-
status:
|
|
2541
|
-
accountEmail:
|
|
2542
|
-
planLabel:
|
|
2543
|
-
windows:
|
|
3091
|
+
var providerUsageSchema = z22.discriminatedUnion("status", [
|
|
3092
|
+
z22.object({
|
|
3093
|
+
status: z22.literal("ok"),
|
|
3094
|
+
accountEmail: z22.string().email().nullable(),
|
|
3095
|
+
planLabel: z22.string().min(1).nullable(),
|
|
3096
|
+
windows: z22.array(providerUsageWindowSchema)
|
|
2544
3097
|
}).passthrough(),
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
status:
|
|
2550
|
-
message:
|
|
2551
|
-
planLabel:
|
|
2552
|
-
accountEmail:
|
|
3098
|
+
z22.object({ status: z22.literal("not_installed") }).passthrough(),
|
|
3099
|
+
z22.object({ status: z22.literal("unauthenticated") }).passthrough(),
|
|
3100
|
+
z22.object({ status: z22.literal("expired") }).passthrough(),
|
|
3101
|
+
z22.object({
|
|
3102
|
+
status: z22.literal("error"),
|
|
3103
|
+
message: z22.string().min(1),
|
|
3104
|
+
planLabel: z22.string().min(1).nullable().default(null),
|
|
3105
|
+
accountEmail: z22.string().nullable().default(null)
|
|
2553
3106
|
}).passthrough()
|
|
2554
3107
|
]);
|
|
2555
|
-
var providerHealthResultSchema =
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
supported:
|
|
3108
|
+
var providerHealthResultSchema = z22.discriminatedUnion("supported", [
|
|
3109
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
3110
|
+
z22.object({
|
|
3111
|
+
supported: z22.literal(true),
|
|
2559
3112
|
health: providerHealthSchema
|
|
2560
3113
|
}).passthrough()
|
|
2561
3114
|
]);
|
|
2562
|
-
var providerUsageResultSchema =
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
supported:
|
|
3115
|
+
var providerUsageResultSchema = z22.discriminatedUnion("supported", [
|
|
3116
|
+
z22.object({ supported: z22.literal(false) }).passthrough(),
|
|
3117
|
+
z22.object({
|
|
3118
|
+
supported: z22.literal(true),
|
|
2566
3119
|
usage: providerUsageSchema
|
|
2567
3120
|
}).passthrough()
|
|
2568
3121
|
]);
|
|
2569
|
-
var providerInstallationActionKindSchema =
|
|
3122
|
+
var providerInstallationActionKindSchema = z22.enum([
|
|
2570
3123
|
"install",
|
|
2571
3124
|
"update"
|
|
2572
3125
|
]);
|
|
2573
|
-
var providerInstallationActionSchema =
|
|
3126
|
+
var providerInstallationActionSchema = z22.object({
|
|
2574
3127
|
kind: providerInstallationActionKindSchema,
|
|
2575
|
-
label:
|
|
2576
|
-
command:
|
|
3128
|
+
label: z22.enum(["Install", "Update"]),
|
|
3129
|
+
command: z22.string().min(1)
|
|
2577
3130
|
}).passthrough();
|
|
2578
|
-
var providerInstallationSourceSchema =
|
|
3131
|
+
var providerInstallationSourceSchema = z22.enum([
|
|
2579
3132
|
"notInstalled",
|
|
2580
3133
|
"npmGlobal",
|
|
2581
3134
|
"external"
|
|
2582
3135
|
]);
|
|
2583
|
-
var providerInstallationStatusSchema =
|
|
2584
|
-
executableName:
|
|
2585
|
-
executablePath:
|
|
2586
|
-
installed:
|
|
3136
|
+
var providerInstallationStatusSchema = z22.object({
|
|
3137
|
+
executableName: z22.string().min(1),
|
|
3138
|
+
executablePath: z22.string().min(1).nullable(),
|
|
3139
|
+
installed: z22.boolean(),
|
|
2587
3140
|
installSource: providerInstallationSourceSchema,
|
|
2588
|
-
currentVersion:
|
|
2589
|
-
latestVersion:
|
|
2590
|
-
minimumSupportedVersion:
|
|
2591
|
-
npmPackageName:
|
|
2592
|
-
npmGlobalPackageVersion:
|
|
3141
|
+
currentVersion: z22.string().min(1).nullable(),
|
|
3142
|
+
latestVersion: z22.string().min(1).nullable(),
|
|
3143
|
+
minimumSupportedVersion: z22.string().min(1).nullable(),
|
|
3144
|
+
npmPackageName: z22.string().min(1).nullable(),
|
|
3145
|
+
npmGlobalPackageVersion: z22.string().min(1).nullable(),
|
|
2593
3146
|
installAction: providerInstallationActionSchema.nullable(),
|
|
2594
|
-
needsUpdate:
|
|
2595
|
-
versionUnsupported:
|
|
3147
|
+
needsUpdate: z22.boolean(),
|
|
3148
|
+
versionUnsupported: z22.boolean()
|
|
2596
3149
|
}).passthrough();
|
|
2597
3150
|
var providerInstallationRunParamsSchema = providerMaintenanceParamsSchema.extend({
|
|
2598
3151
|
action: providerInstallationActionKindSchema
|
|
2599
3152
|
});
|
|
2600
|
-
var providerInstallationCommandSchema =
|
|
2601
|
-
command:
|
|
2602
|
-
args:
|
|
2603
|
-
displayCommand:
|
|
3153
|
+
var providerInstallationCommandSchema = z22.object({
|
|
3154
|
+
command: z22.string().min(1),
|
|
3155
|
+
args: z22.array(z22.string()).max(64),
|
|
3156
|
+
displayCommand: z22.string().min(1)
|
|
2604
3157
|
}).passthrough();
|
|
2605
|
-
var providerInstallationVerificationSchema =
|
|
3158
|
+
var providerInstallationVerificationSchema = z22.discriminatedUnion(
|
|
2606
3159
|
"kind",
|
|
2607
3160
|
[
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
kind:
|
|
2611
|
-
previousVersion:
|
|
3161
|
+
z22.object({ kind: z22.literal("installed") }).passthrough(),
|
|
3162
|
+
z22.object({
|
|
3163
|
+
kind: z22.literal("version_changed"),
|
|
3164
|
+
previousVersion: z22.string().min(1)
|
|
2612
3165
|
}).passthrough(),
|
|
2613
|
-
|
|
2614
|
-
kind:
|
|
2615
|
-
version:
|
|
3166
|
+
z22.object({
|
|
3167
|
+
kind: z22.literal("version_at_least"),
|
|
3168
|
+
version: z22.string().min(1)
|
|
2616
3169
|
}).passthrough()
|
|
2617
3170
|
]
|
|
2618
3171
|
);
|
|
2619
|
-
var providerInstallationRunResultSchema =
|
|
3172
|
+
var providerInstallationRunResultSchema = z22.discriminatedUnion(
|
|
2620
3173
|
"available",
|
|
2621
3174
|
[
|
|
2622
|
-
|
|
2623
|
-
available:
|
|
2624
|
-
message:
|
|
3175
|
+
z22.object({
|
|
3176
|
+
available: z22.literal(false),
|
|
3177
|
+
message: z22.string().min(1)
|
|
2625
3178
|
}).passthrough(),
|
|
2626
|
-
|
|
2627
|
-
available:
|
|
3179
|
+
z22.object({
|
|
3180
|
+
available: z22.literal(true),
|
|
2628
3181
|
command: providerInstallationCommandSchema,
|
|
2629
3182
|
verification: providerInstallationVerificationSchema
|
|
2630
3183
|
}).passthrough()
|
|
@@ -2632,80 +3185,80 @@ var providerInstallationRunResultSchema = z21.discriminatedUnion(
|
|
|
2632
3185
|
);
|
|
2633
3186
|
|
|
2634
3187
|
// ../provider-bridge-protocol/src/requests.ts
|
|
2635
|
-
import { z as
|
|
3188
|
+
import { z as z23 } from "zod";
|
|
2636
3189
|
var sessionConstructionFields = {
|
|
2637
|
-
threadId:
|
|
2638
|
-
cwd:
|
|
3190
|
+
threadId: z23.string().min(1),
|
|
3191
|
+
cwd: z23.string().min(1),
|
|
2639
3192
|
options: bridgeExecutionOptionsSchema,
|
|
2640
|
-
dynamicTools:
|
|
2641
|
-
disallowedTools:
|
|
3193
|
+
dynamicTools: z23.array(dynamicToolSchema).optional(),
|
|
3194
|
+
disallowedTools: z23.array(z23.string().min(1)).optional(),
|
|
2642
3195
|
instructionMode: instructionModeSchema
|
|
2643
3196
|
};
|
|
2644
|
-
var modelListParamsSchema =
|
|
2645
|
-
var threadStartParamsSchema =
|
|
3197
|
+
var modelListParamsSchema = z23.object({ cwd: z23.string().min(1).optional() }).passthrough();
|
|
3198
|
+
var threadStartParamsSchema = z23.object({
|
|
2646
3199
|
...sessionConstructionFields,
|
|
2647
|
-
input:
|
|
3200
|
+
input: z23.array(promptInputSchema).optional()
|
|
2648
3201
|
}).passthrough();
|
|
2649
|
-
var threadResumeParamsSchema =
|
|
3202
|
+
var threadResumeParamsSchema = z23.object({
|
|
2650
3203
|
...sessionConstructionFields,
|
|
2651
|
-
providerThreadId:
|
|
3204
|
+
providerThreadId: z23.string().min(1)
|
|
2652
3205
|
}).passthrough();
|
|
2653
|
-
var threadForkParamsSchema =
|
|
3206
|
+
var threadForkParamsSchema = z23.object({
|
|
2654
3207
|
...sessionConstructionFields,
|
|
2655
|
-
sourceProviderThreadId:
|
|
2656
|
-
sourceProviderCheckpointId:
|
|
3208
|
+
sourceProviderThreadId: z23.string().min(1),
|
|
3209
|
+
sourceProviderCheckpointId: z23.string().min(1).optional()
|
|
2657
3210
|
}).passthrough();
|
|
2658
|
-
var threadStopParamsSchema =
|
|
2659
|
-
threadId:
|
|
2660
|
-
providerThreadId:
|
|
2661
|
-
intent:
|
|
2662
|
-
activeTurnId:
|
|
3211
|
+
var threadStopParamsSchema = z23.object({
|
|
3212
|
+
threadId: z23.string().min(1),
|
|
3213
|
+
providerThreadId: z23.string().min(1),
|
|
3214
|
+
intent: z23.enum(["interrupt", "release"]),
|
|
3215
|
+
activeTurnId: z23.string().min(1).nullable()
|
|
2663
3216
|
}).passthrough();
|
|
2664
|
-
var threadRefParams =
|
|
2665
|
-
threadId:
|
|
2666
|
-
providerThreadId:
|
|
3217
|
+
var threadRefParams = z23.object({
|
|
3218
|
+
threadId: z23.string().min(1),
|
|
3219
|
+
providerThreadId: z23.string().min(1)
|
|
2667
3220
|
}).passthrough();
|
|
2668
3221
|
var threadDiscardParamsSchema = threadRefParams;
|
|
2669
|
-
var threadNameSetParamsSchema =
|
|
2670
|
-
threadId:
|
|
2671
|
-
providerThreadId:
|
|
2672
|
-
title:
|
|
3222
|
+
var threadNameSetParamsSchema = z23.object({
|
|
3223
|
+
threadId: z23.string().min(1),
|
|
3224
|
+
providerThreadId: z23.string().min(1),
|
|
3225
|
+
title: z23.string().min(1)
|
|
2673
3226
|
}).passthrough();
|
|
2674
3227
|
var turnInputFields = {
|
|
2675
|
-
threadId:
|
|
2676
|
-
providerThreadId:
|
|
2677
|
-
input:
|
|
3228
|
+
threadId: z23.string().min(1),
|
|
3229
|
+
providerThreadId: z23.string().min(1),
|
|
3230
|
+
input: z23.array(promptInputSchema),
|
|
2678
3231
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2679
3232
|
options: bridgeExecutionOptionsSchema
|
|
2680
3233
|
};
|
|
2681
|
-
var turnStartParamsSchema =
|
|
2682
|
-
var turnSteerParamsSchema =
|
|
3234
|
+
var turnStartParamsSchema = z23.object(turnInputFields).passthrough();
|
|
3235
|
+
var turnSteerParamsSchema = z23.object({
|
|
2683
3236
|
...turnInputFields,
|
|
2684
|
-
expectedTurnId:
|
|
3237
|
+
expectedTurnId: z23.string().min(1)
|
|
2685
3238
|
}).passthrough();
|
|
2686
|
-
var skillsConfigureRootSchema =
|
|
2687
|
-
id:
|
|
2688
|
-
path:
|
|
2689
|
-
skills:
|
|
2690
|
-
|
|
2691
|
-
name:
|
|
2692
|
-
description:
|
|
3239
|
+
var skillsConfigureRootSchema = z23.object({
|
|
3240
|
+
id: z23.string().min(1),
|
|
3241
|
+
path: z23.string().min(1),
|
|
3242
|
+
skills: z23.array(
|
|
3243
|
+
z23.object({
|
|
3244
|
+
name: z23.string().min(1),
|
|
3245
|
+
description: z23.string()
|
|
2693
3246
|
}).passthrough()
|
|
2694
3247
|
)
|
|
2695
3248
|
}).passthrough();
|
|
2696
|
-
var skillsConfigureParamsSchema =
|
|
2697
|
-
roots:
|
|
3249
|
+
var skillsConfigureParamsSchema = z23.object({
|
|
3250
|
+
roots: z23.array(skillsConfigureRootSchema)
|
|
2698
3251
|
}).passthrough();
|
|
2699
|
-
var threadIdentityResultSchema =
|
|
2700
|
-
providerThreadId:
|
|
2701
|
-
sessionRestorable:
|
|
3252
|
+
var threadIdentityResultSchema = z23.object({
|
|
3253
|
+
providerThreadId: z23.string().min(1),
|
|
3254
|
+
sessionRestorable: z23.boolean().optional()
|
|
2702
3255
|
}).passthrough();
|
|
2703
3256
|
|
|
2704
3257
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
2705
|
-
import { z as
|
|
3258
|
+
import { z as z25 } from "zod";
|
|
2706
3259
|
|
|
2707
3260
|
// ../provider-bridge-protocol/src/errors.ts
|
|
2708
|
-
import { z as
|
|
3261
|
+
import { z as z24 } from "zod";
|
|
2709
3262
|
var BRIDGE_JSON_RPC_ERRORS = {
|
|
2710
3263
|
INVALID_PARAMS: -32602,
|
|
2711
3264
|
METHOD_NOT_FOUND: -32601,
|
|
@@ -2714,12 +3267,12 @@ var BRIDGE_JSON_RPC_ERRORS = {
|
|
|
2714
3267
|
SESSION_NOT_RESTORABLE: -32002,
|
|
2715
3268
|
FORK_CHECKPOINT_UNSUPPORTED: -32003
|
|
2716
3269
|
};
|
|
2717
|
-
var providerRecoveryHintSchema =
|
|
3270
|
+
var providerRecoveryHintSchema = z24.object({
|
|
2718
3271
|
kind: providerRecoveryKindSchema,
|
|
2719
|
-
message:
|
|
2720
|
-
retryable:
|
|
3272
|
+
message: z24.string().min(1),
|
|
3273
|
+
retryable: z24.boolean()
|
|
2721
3274
|
});
|
|
2722
|
-
var bridgeErrorDataSchema =
|
|
3275
|
+
var bridgeErrorDataSchema = z24.object({ recovery: providerRecoveryHintSchema.optional() }).passthrough();
|
|
2723
3276
|
|
|
2724
3277
|
// ../provider-bridge-protocol/src/notifications.ts
|
|
2725
3278
|
var BRIDGE_NOTIFICATION_METHODS = {
|
|
@@ -2729,177 +3282,177 @@ var BRIDGE_NOTIFICATION_METHODS = {
|
|
|
2729
3282
|
providerRecovery: "provider/recovery",
|
|
2730
3283
|
error: "error"
|
|
2731
3284
|
};
|
|
2732
|
-
var threadIdentityNotificationSchema =
|
|
2733
|
-
threadId:
|
|
2734
|
-
providerThreadId:
|
|
2735
|
-
sessionRestorable:
|
|
3285
|
+
var threadIdentityNotificationSchema = z25.object({
|
|
3286
|
+
threadId: z25.string().min(1),
|
|
3287
|
+
providerThreadId: z25.string().min(1),
|
|
3288
|
+
sessionRestorable: z25.boolean().optional()
|
|
2736
3289
|
}).passthrough();
|
|
2737
|
-
var sessionReplacedNotificationSchema =
|
|
2738
|
-
threadId:
|
|
2739
|
-
providerThreadId:
|
|
2740
|
-
reason:
|
|
2741
|
-
contextLost:
|
|
2742
|
-
showRuntimeNote:
|
|
3290
|
+
var sessionReplacedNotificationSchema = z25.object({
|
|
3291
|
+
threadId: z25.string().min(1),
|
|
3292
|
+
providerThreadId: z25.string().min(1).nullable(),
|
|
3293
|
+
reason: z25.string().min(1),
|
|
3294
|
+
contextLost: z25.boolean().default(false),
|
|
3295
|
+
showRuntimeNote: z25.boolean().default(false)
|
|
2743
3296
|
}).passthrough();
|
|
2744
|
-
var providerRecoveryNotificationSchema =
|
|
2745
|
-
threadId:
|
|
3297
|
+
var providerRecoveryNotificationSchema = z25.object({
|
|
3298
|
+
threadId: z25.string().min(1).optional(),
|
|
2746
3299
|
...providerRecoveryHintSchema.shape
|
|
2747
3300
|
}).passthrough();
|
|
2748
|
-
var errorNotificationSchema =
|
|
2749
|
-
threadId:
|
|
2750
|
-
providerThreadId:
|
|
2751
|
-
message:
|
|
3301
|
+
var errorNotificationSchema = z25.object({
|
|
3302
|
+
threadId: z25.string().min(1).optional(),
|
|
3303
|
+
providerThreadId: z25.string().min(1).optional(),
|
|
3304
|
+
message: z25.string().min(1)
|
|
2752
3305
|
}).passthrough();
|
|
2753
3306
|
|
|
2754
3307
|
// ../provider-bridge-protocol/src/bridge-requests.ts
|
|
2755
|
-
import { z as
|
|
3308
|
+
import { z as z26 } from "zod";
|
|
2756
3309
|
var BRIDGE_INBOUND_REQUEST_METHODS = {
|
|
2757
3310
|
toolCall: "item/tool/call",
|
|
2758
3311
|
interactionRequest: "interaction/request"
|
|
2759
3312
|
};
|
|
2760
|
-
var toolCallRequestParamsSchema =
|
|
2761
|
-
providerThreadId:
|
|
2762
|
-
threadId:
|
|
2763
|
-
turnId:
|
|
2764
|
-
callId:
|
|
2765
|
-
tool:
|
|
2766
|
-
arguments:
|
|
2767
|
-
providerNativeIds:
|
|
3313
|
+
var toolCallRequestParamsSchema = z26.object({
|
|
3314
|
+
providerThreadId: z26.string().min(1),
|
|
3315
|
+
threadId: z26.string().min(1).optional(),
|
|
3316
|
+
turnId: z26.union([z26.string().min(1), z26.null()]),
|
|
3317
|
+
callId: z26.string().min(1),
|
|
3318
|
+
tool: z26.string().min(1),
|
|
3319
|
+
arguments: z26.unknown(),
|
|
3320
|
+
providerNativeIds: z26.boolean().optional()
|
|
2768
3321
|
}).passthrough();
|
|
2769
|
-
var toolCallResultSchema =
|
|
2770
|
-
success:
|
|
2771
|
-
contentItems:
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
type:
|
|
2776
|
-
imageUrl:
|
|
3322
|
+
var toolCallResultSchema = z26.object({
|
|
3323
|
+
success: z26.boolean(),
|
|
3324
|
+
contentItems: z26.array(
|
|
3325
|
+
z26.discriminatedUnion("type", [
|
|
3326
|
+
z26.object({ type: z26.literal("inputText"), text: z26.string() }),
|
|
3327
|
+
z26.object({
|
|
3328
|
+
type: z26.literal("inputImage"),
|
|
3329
|
+
imageUrl: z26.string().min(1)
|
|
2777
3330
|
})
|
|
2778
3331
|
])
|
|
2779
3332
|
)
|
|
2780
3333
|
}).passthrough();
|
|
2781
|
-
var interactionRequestParamsSchema =
|
|
2782
|
-
providerThreadId:
|
|
2783
|
-
threadId:
|
|
2784
|
-
turnId:
|
|
3334
|
+
var interactionRequestParamsSchema = z26.object({
|
|
3335
|
+
providerThreadId: z26.string().min(1),
|
|
3336
|
+
threadId: z26.string().min(1).optional(),
|
|
3337
|
+
turnId: z26.union([z26.string().min(1), z26.null()]),
|
|
2785
3338
|
payload: pendingInteractionPayloadSchema,
|
|
2786
|
-
providerNativeIds:
|
|
3339
|
+
providerNativeIds: z26.boolean().optional()
|
|
2787
3340
|
}).passthrough();
|
|
2788
3341
|
|
|
2789
3342
|
// ../provider-bridge-protocol/src/thread-delta.ts
|
|
2790
|
-
import { z as
|
|
3343
|
+
import { z as z27 } from "zod";
|
|
2791
3344
|
var THREAD_DELTA_NOTIFICATION_METHOD = "thread/delta";
|
|
2792
3345
|
var deltaPresentationSchema = threadEventItemPresentationSchema;
|
|
2793
3346
|
var THREAD_DELTA_KEY_SEPARATOR = "";
|
|
2794
|
-
var deltaKeyPartSchema =
|
|
3347
|
+
var deltaKeyPartSchema = z27.string().min(1).refine((value) => !value.includes(THREAD_DELTA_KEY_SEPARATOR), {
|
|
2795
3348
|
message: "provider keys must not contain the internal key separator (\\u001f)"
|
|
2796
3349
|
});
|
|
2797
|
-
var deltaItemKeySchema =
|
|
3350
|
+
var deltaItemKeySchema = z27.object({
|
|
2798
3351
|
providerItemId: deltaKeyPartSchema.optional(),
|
|
2799
3352
|
channel: deltaKeyPartSchema.optional(),
|
|
2800
3353
|
parentRef: deltaKeyPartSchema.optional()
|
|
2801
3354
|
});
|
|
2802
3355
|
var providerTurnIdSchema = deltaKeyPartSchema;
|
|
2803
|
-
var deltaFileChangeSchema =
|
|
2804
|
-
path:
|
|
2805
|
-
kind:
|
|
2806
|
-
movePath:
|
|
2807
|
-
diff:
|
|
2808
|
-
oldText:
|
|
2809
|
-
newText:
|
|
2810
|
-
});
|
|
2811
|
-
var deltaBackgroundTaskShapeSchema =
|
|
2812
|
-
type:
|
|
2813
|
-
familyId:
|
|
2814
|
-
taskType:
|
|
2815
|
-
description:
|
|
3356
|
+
var deltaFileChangeSchema = z27.object({
|
|
3357
|
+
path: z27.string(),
|
|
3358
|
+
kind: z27.enum(["add", "update", "delete"]),
|
|
3359
|
+
movePath: z27.string().optional(),
|
|
3360
|
+
diff: z27.string().optional(),
|
|
3361
|
+
oldText: z27.string().optional(),
|
|
3362
|
+
newText: z27.string().optional()
|
|
3363
|
+
});
|
|
3364
|
+
var deltaBackgroundTaskShapeSchema = z27.object({
|
|
3365
|
+
type: z27.literal("backgroundTask"),
|
|
3366
|
+
familyId: z27.string().min(1),
|
|
3367
|
+
taskType: z27.string(),
|
|
3368
|
+
description: z27.string(),
|
|
2816
3369
|
status: threadEventItemStatusSchema,
|
|
2817
3370
|
taskStatus: backgroundTaskStatusSchema,
|
|
2818
|
-
skipTranscript:
|
|
2819
|
-
workflowName:
|
|
3371
|
+
skipTranscript: z27.boolean(),
|
|
3372
|
+
workflowName: z27.string().optional(),
|
|
2820
3373
|
workflow: workflowProgressSnapshotSchema.optional(),
|
|
2821
3374
|
usage: backgroundTaskUsageSchema.optional(),
|
|
2822
|
-
summary:
|
|
2823
|
-
error:
|
|
2824
|
-
outputFile:
|
|
3375
|
+
summary: z27.string().optional(),
|
|
3376
|
+
error: z27.string().optional(),
|
|
3377
|
+
outputFile: z27.string().optional()
|
|
2825
3378
|
});
|
|
2826
|
-
var deltaFileReadShapeSchema =
|
|
2827
|
-
type:
|
|
2828
|
-
path:
|
|
2829
|
-
cmd:
|
|
3379
|
+
var deltaFileReadShapeSchema = z27.object({
|
|
3380
|
+
type: z27.literal("fileRead"),
|
|
3381
|
+
path: z27.string(),
|
|
3382
|
+
cmd: z27.string().optional()
|
|
2830
3383
|
});
|
|
2831
|
-
var deltaSearchShapeSchema =
|
|
2832
|
-
type:
|
|
3384
|
+
var deltaSearchShapeSchema = z27.object({
|
|
3385
|
+
type: z27.literal("search"),
|
|
2833
3386
|
mode: threadEventSearchModeSchema,
|
|
2834
|
-
query:
|
|
2835
|
-
path:
|
|
2836
|
-
cmd:
|
|
3387
|
+
query: z27.string(),
|
|
3388
|
+
path: z27.string().optional(),
|
|
3389
|
+
cmd: z27.string().optional()
|
|
2837
3390
|
});
|
|
2838
|
-
var deltaDelegationShapeSchema =
|
|
2839
|
-
type:
|
|
3391
|
+
var deltaDelegationShapeSchema = z27.object({
|
|
3392
|
+
type: z27.literal("delegation"),
|
|
2840
3393
|
childRef: deltaKeyPartSchema,
|
|
2841
|
-
label:
|
|
2842
|
-
background:
|
|
2843
|
-
summary:
|
|
3394
|
+
label: z27.string(),
|
|
3395
|
+
background: z27.boolean(),
|
|
3396
|
+
summary: z27.string().optional()
|
|
2844
3397
|
});
|
|
2845
|
-
var deltaPlanStepsShapeSchema =
|
|
2846
|
-
type:
|
|
2847
|
-
steps:
|
|
2848
|
-
explanation:
|
|
3398
|
+
var deltaPlanStepsShapeSchema = z27.object({
|
|
3399
|
+
type: z27.literal("planSteps"),
|
|
3400
|
+
steps: z27.array(threadEventPlanStepSchema),
|
|
3401
|
+
explanation: z27.string().optional()
|
|
2849
3402
|
});
|
|
2850
|
-
var deltaExtensionShapeSchema =
|
|
2851
|
-
type:
|
|
3403
|
+
var deltaExtensionShapeSchema = z27.object({
|
|
3404
|
+
type: z27.literal("extension"),
|
|
2852
3405
|
kind: extensionKindSchema,
|
|
2853
3406
|
payload: jsonValueSchema
|
|
2854
3407
|
});
|
|
2855
|
-
var deltaItemShapeSchema =
|
|
2856
|
-
|
|
2857
|
-
type:
|
|
2858
|
-
command:
|
|
2859
|
-
cwd:
|
|
2860
|
-
aggregatedOutput:
|
|
2861
|
-
exitCode:
|
|
2862
|
-
durationMs:
|
|
3408
|
+
var deltaItemShapeSchema = z27.discriminatedUnion("type", [
|
|
3409
|
+
z27.object({
|
|
3410
|
+
type: z27.literal("command"),
|
|
3411
|
+
command: z27.string(),
|
|
3412
|
+
cwd: z27.string(),
|
|
3413
|
+
aggregatedOutput: z27.string().optional(),
|
|
3414
|
+
exitCode: z27.number().optional(),
|
|
3415
|
+
durationMs: z27.number().optional()
|
|
2863
3416
|
}),
|
|
2864
|
-
|
|
2865
|
-
type:
|
|
2866
|
-
changes:
|
|
3417
|
+
z27.object({
|
|
3418
|
+
type: z27.literal("fileChange"),
|
|
3419
|
+
changes: z27.array(deltaFileChangeSchema)
|
|
2867
3420
|
}),
|
|
2868
|
-
|
|
2869
|
-
type:
|
|
2870
|
-
tool:
|
|
2871
|
-
server:
|
|
2872
|
-
args:
|
|
2873
|
-
result:
|
|
2874
|
-
error:
|
|
2875
|
-
durationMs:
|
|
3421
|
+
z27.object({
|
|
3422
|
+
type: z27.literal("tool"),
|
|
3423
|
+
tool: z27.string(),
|
|
3424
|
+
server: z27.string().optional(),
|
|
3425
|
+
args: z27.unknown().optional(),
|
|
3426
|
+
result: z27.unknown().optional(),
|
|
3427
|
+
error: z27.string().optional(),
|
|
3428
|
+
durationMs: z27.number().optional()
|
|
2876
3429
|
}),
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
type:
|
|
2881
|
-
summary:
|
|
2882
|
-
content:
|
|
3430
|
+
z27.object({ type: z27.literal("compaction") }),
|
|
3431
|
+
z27.object({ type: z27.literal("agentMessage"), text: z27.string() }),
|
|
3432
|
+
z27.object({
|
|
3433
|
+
type: z27.literal("reasoning"),
|
|
3434
|
+
summary: z27.array(z27.string()),
|
|
3435
|
+
content: z27.array(z27.string())
|
|
2883
3436
|
}),
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
queries:
|
|
3437
|
+
z27.object({ type: z27.literal("plan"), text: z27.string() }),
|
|
3438
|
+
z27.object({
|
|
3439
|
+
type: z27.literal("webSearch"),
|
|
3440
|
+
queries: z27.array(z27.string()).min(1)
|
|
2888
3441
|
}),
|
|
2889
|
-
|
|
2890
|
-
type:
|
|
2891
|
-
url:
|
|
2892
|
-
prompt:
|
|
2893
|
-
pattern:
|
|
3442
|
+
z27.object({
|
|
3443
|
+
type: z27.literal("webFetch"),
|
|
3444
|
+
url: z27.string(),
|
|
3445
|
+
prompt: z27.string().nullable().optional(),
|
|
3446
|
+
pattern: z27.string().nullable()
|
|
2894
3447
|
}),
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
type:
|
|
2898
|
-
prompt:
|
|
2899
|
-
path:
|
|
2900
|
-
result:
|
|
2901
|
-
error:
|
|
2902
|
-
transparentBackground:
|
|
3448
|
+
z27.object({ type: z27.literal("imageView"), path: z27.string() }),
|
|
3449
|
+
z27.object({
|
|
3450
|
+
type: z27.literal("imageGeneration"),
|
|
3451
|
+
prompt: z27.string().nullable(),
|
|
3452
|
+
path: z27.string().nullable(),
|
|
3453
|
+
result: z27.string().optional(),
|
|
3454
|
+
error: z27.string().nullable(),
|
|
3455
|
+
transparentBackground: z27.boolean()
|
|
2903
3456
|
}),
|
|
2904
3457
|
deltaBackgroundTaskShapeSchema,
|
|
2905
3458
|
deltaFileReadShapeSchema,
|
|
@@ -2908,22 +3461,22 @@ var deltaItemShapeSchema = z26.discriminatedUnion("type", [
|
|
|
2908
3461
|
deltaPlanStepsShapeSchema,
|
|
2909
3462
|
deltaExtensionShapeSchema
|
|
2910
3463
|
]);
|
|
2911
|
-
var deltaProgressSnapshotSchema =
|
|
3464
|
+
var deltaProgressSnapshotSchema = z27.discriminatedUnion("type", [
|
|
2912
3465
|
deltaBackgroundTaskShapeSchema,
|
|
2913
3466
|
deltaDelegationShapeSchema
|
|
2914
3467
|
]);
|
|
2915
|
-
var deltaTextChannelSchema =
|
|
3468
|
+
var deltaTextChannelSchema = z27.enum([
|
|
2916
3469
|
"agentMessage",
|
|
2917
3470
|
"reasoningSummary",
|
|
2918
3471
|
"reasoningText",
|
|
2919
3472
|
"plan"
|
|
2920
3473
|
]);
|
|
2921
|
-
var deltaOutputChannelSchema =
|
|
2922
|
-
var deltaErrorSchema =
|
|
2923
|
-
var deltaAttachSchema =
|
|
2924
|
-
var deltaNoTurnFallbackSchema =
|
|
3474
|
+
var deltaOutputChannelSchema = z27.enum(["command", "fileChange"]);
|
|
3475
|
+
var deltaErrorSchema = z27.object({ message: z27.string() });
|
|
3476
|
+
var deltaAttachSchema = z27.enum(["open", "currentOrLast"]);
|
|
3477
|
+
var deltaNoTurnFallbackSchema = z27.object({
|
|
2925
3478
|
raw: providerRawEventSchema,
|
|
2926
|
-
rawType:
|
|
3479
|
+
rawType: z27.string()
|
|
2927
3480
|
});
|
|
2928
3481
|
function requireExtensionPresentation(delta, ctx) {
|
|
2929
3482
|
if (delta.item.type === "extension" && delta.presentation === void 0) {
|
|
@@ -2934,32 +3487,32 @@ function requireExtensionPresentation(delta, ctx) {
|
|
|
2934
3487
|
});
|
|
2935
3488
|
}
|
|
2936
3489
|
}
|
|
2937
|
-
var threadDeltaSchema =
|
|
2938
|
-
|
|
2939
|
-
kind:
|
|
3490
|
+
var threadDeltaSchema = z27.discriminatedUnion("kind", [
|
|
3491
|
+
z27.object({
|
|
3492
|
+
kind: z27.literal("input.accepted"),
|
|
2940
3493
|
clientRequestId: clientTurnRequestIdSchema,
|
|
2941
3494
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2942
3495
|
}),
|
|
2943
|
-
|
|
2944
|
-
kind:
|
|
2945
|
-
text:
|
|
3496
|
+
z27.object({
|
|
3497
|
+
kind: z27.literal("input.provider"),
|
|
3498
|
+
text: z27.string().min(1),
|
|
2946
3499
|
parentRef: deltaKeyPartSchema.optional()
|
|
2947
3500
|
}),
|
|
2948
|
-
|
|
2949
|
-
kind:
|
|
3501
|
+
z27.object({
|
|
3502
|
+
kind: z27.literal("turn.open"),
|
|
2950
3503
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2951
3504
|
parentRef: deltaKeyPartSchema.optional()
|
|
2952
3505
|
}),
|
|
2953
|
-
|
|
2954
|
-
kind:
|
|
3506
|
+
z27.object({
|
|
3507
|
+
kind: z27.literal("turn.boundary"),
|
|
2955
3508
|
status: threadEventTurnStatusSchema,
|
|
2956
3509
|
error: deltaErrorSchema.optional(),
|
|
2957
|
-
providerCheckpointId:
|
|
2958
|
-
claimIfIdle:
|
|
3510
|
+
providerCheckpointId: z27.string().min(1).optional(),
|
|
3511
|
+
claimIfIdle: z27.boolean().optional(),
|
|
2959
3512
|
providerTurnId: providerTurnIdSchema.optional()
|
|
2960
3513
|
}),
|
|
2961
|
-
|
|
2962
|
-
kind:
|
|
3514
|
+
z27.object({
|
|
3515
|
+
kind: z27.literal("item.open"),
|
|
2963
3516
|
key: deltaItemKeySchema,
|
|
2964
3517
|
item: deltaItemShapeSchema,
|
|
2965
3518
|
presentation: deltaPresentationSchema.optional(),
|
|
@@ -2967,154 +3520,154 @@ var threadDeltaSchema = z26.discriminatedUnion("kind", [
|
|
|
2967
3520
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2968
3521
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2969
3522
|
}).superRefine(requireExtensionPresentation),
|
|
2970
|
-
|
|
2971
|
-
kind:
|
|
3523
|
+
z27.object({
|
|
3524
|
+
kind: z27.literal("item.close"),
|
|
2972
3525
|
key: deltaItemKeySchema,
|
|
2973
3526
|
status: threadEventItemStatusSchema,
|
|
2974
|
-
resultText:
|
|
2975
|
-
exitCode:
|
|
2976
|
-
aggregatedOutput:
|
|
2977
|
-
approvalStatus:
|
|
3527
|
+
resultText: z27.string().optional(),
|
|
3528
|
+
exitCode: z27.number().optional(),
|
|
3529
|
+
aggregatedOutput: z27.string().optional(),
|
|
3530
|
+
approvalStatus: z27.literal("denied").optional(),
|
|
2978
3531
|
item: deltaItemShapeSchema,
|
|
2979
3532
|
presentation: deltaPresentationSchema.optional(),
|
|
2980
3533
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2981
3534
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2982
3535
|
}).superRefine(requireExtensionPresentation),
|
|
2983
|
-
|
|
2984
|
-
kind:
|
|
3536
|
+
z27.object({
|
|
3537
|
+
kind: z27.literal("item.progress"),
|
|
2985
3538
|
key: deltaItemKeySchema,
|
|
2986
|
-
message:
|
|
3539
|
+
message: z27.string().optional(),
|
|
2987
3540
|
snapshot: deltaProgressSnapshotSchema.optional(),
|
|
2988
|
-
flush:
|
|
3541
|
+
flush: z27.boolean().optional(),
|
|
2989
3542
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2990
3543
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2991
3544
|
}),
|
|
2992
|
-
|
|
2993
|
-
kind:
|
|
3545
|
+
z27.object({
|
|
3546
|
+
kind: z27.literal("item.textDelta"),
|
|
2994
3547
|
key: deltaItemKeySchema,
|
|
2995
3548
|
channel: deltaTextChannelSchema,
|
|
2996
|
-
text:
|
|
3549
|
+
text: z27.string(),
|
|
2997
3550
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
2998
3551
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
2999
3552
|
}),
|
|
3000
|
-
|
|
3001
|
-
kind:
|
|
3553
|
+
z27.object({
|
|
3554
|
+
kind: z27.literal("item.textClose"),
|
|
3002
3555
|
key: deltaItemKeySchema,
|
|
3003
3556
|
channel: deltaTextChannelSchema,
|
|
3004
|
-
text:
|
|
3557
|
+
text: z27.string().optional(),
|
|
3005
3558
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3006
3559
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3007
3560
|
}),
|
|
3008
|
-
|
|
3009
|
-
kind:
|
|
3561
|
+
z27.object({
|
|
3562
|
+
kind: z27.literal("item.outputDelta"),
|
|
3010
3563
|
key: deltaItemKeySchema,
|
|
3011
3564
|
channel: deltaOutputChannelSchema,
|
|
3012
|
-
text:
|
|
3565
|
+
text: z27.string(),
|
|
3013
3566
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3014
3567
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3015
3568
|
}),
|
|
3016
|
-
|
|
3017
|
-
kind:
|
|
3569
|
+
z27.object({
|
|
3570
|
+
kind: z27.literal("command.outputSnapshot"),
|
|
3018
3571
|
key: deltaItemKeySchema,
|
|
3019
|
-
text:
|
|
3572
|
+
text: z27.string(),
|
|
3020
3573
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3021
3574
|
}),
|
|
3022
|
-
|
|
3023
|
-
kind:
|
|
3575
|
+
z27.object({
|
|
3576
|
+
kind: z27.literal("usage"),
|
|
3024
3577
|
total: threadEventTokenUsageBreakdownSchema,
|
|
3025
3578
|
last: threadEventTokenUsageBreakdownSchema,
|
|
3026
|
-
modelContextWindow:
|
|
3579
|
+
modelContextWindow: z27.number().nullable(),
|
|
3027
3580
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3028
3581
|
}),
|
|
3029
|
-
|
|
3030
|
-
kind:
|
|
3582
|
+
z27.object({
|
|
3583
|
+
kind: z27.literal("contextWindow"),
|
|
3031
3584
|
snapshot: contextSnapshotSchema.optional(),
|
|
3032
|
-
used:
|
|
3033
|
-
size:
|
|
3034
|
-
estimated:
|
|
3585
|
+
used: z27.number().nullable(),
|
|
3586
|
+
size: z27.number().nullable().optional(),
|
|
3587
|
+
estimated: z27.boolean(),
|
|
3035
3588
|
attach: deltaAttachSchema,
|
|
3036
3589
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3037
3590
|
}),
|
|
3038
|
-
|
|
3039
|
-
kind:
|
|
3591
|
+
z27.object({
|
|
3592
|
+
kind: z27.literal("context.compacted"),
|
|
3040
3593
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3041
3594
|
noTurnFallback: deltaNoTurnFallbackSchema.optional()
|
|
3042
3595
|
}),
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
kind:
|
|
3046
|
-
diff:
|
|
3596
|
+
z27.object({ kind: z27.literal("context.cleared") }),
|
|
3597
|
+
z27.object({
|
|
3598
|
+
kind: z27.literal("turn.diff"),
|
|
3599
|
+
diff: z27.string(),
|
|
3047
3600
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3048
3601
|
}),
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
kind:
|
|
3052
|
-
providerThreadId:
|
|
3602
|
+
z27.object({ kind: z27.literal("thread.started") }),
|
|
3603
|
+
z27.object({
|
|
3604
|
+
kind: z27.literal("thread.identity"),
|
|
3605
|
+
providerThreadId: z27.string().min(1)
|
|
3053
3606
|
}),
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
kind:
|
|
3607
|
+
z27.object({ kind: z27.literal("thread.name"), name: z27.string().min(1) }),
|
|
3608
|
+
z27.object({
|
|
3609
|
+
kind: z27.literal("extension.state"),
|
|
3057
3610
|
extensionKind: extensionKindSchema,
|
|
3058
3611
|
payload: jsonValueSchema
|
|
3059
3612
|
}),
|
|
3060
|
-
|
|
3061
|
-
kind:
|
|
3613
|
+
z27.object({
|
|
3614
|
+
kind: z27.literal("provider.rateLimits"),
|
|
3062
3615
|
rateLimits: providerRateLimitStateSchema
|
|
3063
3616
|
}),
|
|
3064
|
-
|
|
3065
|
-
kind:
|
|
3066
|
-
message:
|
|
3067
|
-
detail:
|
|
3068
|
-
willRetry:
|
|
3617
|
+
z27.object({
|
|
3618
|
+
kind: z27.literal("provider.error"),
|
|
3619
|
+
message: z27.string(),
|
|
3620
|
+
detail: z27.string().optional(),
|
|
3621
|
+
willRetry: z27.boolean().optional(),
|
|
3069
3622
|
category: providerErrorCategorySchema.optional(),
|
|
3070
3623
|
errorInfo: providerErrorInfoSchema.optional(),
|
|
3071
|
-
settlesTurn:
|
|
3624
|
+
settlesTurn: z27.boolean().optional(),
|
|
3072
3625
|
providerTurnId: providerTurnIdSchema.optional(),
|
|
3073
|
-
threadScoped:
|
|
3626
|
+
threadScoped: z27.boolean().optional()
|
|
3074
3627
|
}),
|
|
3075
|
-
|
|
3076
|
-
kind:
|
|
3077
|
-
originalModel:
|
|
3078
|
-
fallbackModel:
|
|
3079
|
-
reason:
|
|
3080
|
-
message:
|
|
3628
|
+
z27.object({
|
|
3629
|
+
kind: z27.literal("provider.modelFallback"),
|
|
3630
|
+
originalModel: z27.string().min(1),
|
|
3631
|
+
fallbackModel: z27.string().min(1),
|
|
3632
|
+
reason: z27.enum(["refusal", "provider"]),
|
|
3633
|
+
message: z27.string()
|
|
3081
3634
|
}),
|
|
3082
|
-
|
|
3083
|
-
kind:
|
|
3084
|
-
summary:
|
|
3085
|
-
details:
|
|
3635
|
+
z27.object({
|
|
3636
|
+
kind: z27.literal("provider.warning"),
|
|
3637
|
+
summary: z27.string().optional(),
|
|
3638
|
+
details: z27.string().optional(),
|
|
3086
3639
|
category: threadEventWarningCategorySchema.optional(),
|
|
3087
|
-
vouchedTurn:
|
|
3640
|
+
vouchedTurn: z27.boolean().optional()
|
|
3088
3641
|
}),
|
|
3089
|
-
|
|
3090
|
-
kind:
|
|
3642
|
+
z27.object({
|
|
3643
|
+
kind: z27.literal("unhandled"),
|
|
3091
3644
|
raw: providerRawEventSchema,
|
|
3092
|
-
rawType:
|
|
3093
|
-
vouchedTurn:
|
|
3094
|
-
onlyIfNoTurn:
|
|
3645
|
+
rawType: z27.string(),
|
|
3646
|
+
vouchedTurn: z27.boolean(),
|
|
3647
|
+
onlyIfNoTurn: z27.boolean().optional(),
|
|
3095
3648
|
parentRef: deltaKeyPartSchema.optional(),
|
|
3096
3649
|
providerTurnId: providerTurnIdSchema.optional()
|
|
3097
3650
|
}),
|
|
3098
|
-
|
|
3099
|
-
|
|
3651
|
+
z27.object({ kind: z27.literal("session.ended") }),
|
|
3652
|
+
z27.object({ kind: z27.literal("session.reset") })
|
|
3100
3653
|
]);
|
|
3101
|
-
var threadDeltaNotificationParamsSchema =
|
|
3102
|
-
threadId:
|
|
3103
|
-
deltas:
|
|
3654
|
+
var threadDeltaNotificationParamsSchema = z27.object({
|
|
3655
|
+
threadId: z27.string().min(1),
|
|
3656
|
+
deltas: z27.array(threadDeltaSchema)
|
|
3104
3657
|
}).passthrough();
|
|
3105
3658
|
|
|
3106
3659
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
3107
|
-
import { z as
|
|
3660
|
+
import { z as z29 } from "zod";
|
|
3108
3661
|
|
|
3109
3662
|
// ../provider-bridge-protocol/src/bridge-kit/tool-arg-schemas.ts
|
|
3110
|
-
import { z as
|
|
3111
|
-
var bashArgsSchema =
|
|
3112
|
-
command:
|
|
3113
|
-
cwd:
|
|
3663
|
+
import { z as z28 } from "zod";
|
|
3664
|
+
var bashArgsSchema = z28.object({
|
|
3665
|
+
command: z28.string().optional(),
|
|
3666
|
+
cwd: z28.string().optional()
|
|
3114
3667
|
}).passthrough();
|
|
3115
|
-
var textBlockSchema =
|
|
3116
|
-
type:
|
|
3117
|
-
text:
|
|
3668
|
+
var textBlockSchema = z28.object({
|
|
3669
|
+
type: z28.literal("text"),
|
|
3670
|
+
text: z28.string()
|
|
3118
3671
|
});
|
|
3119
3672
|
|
|
3120
3673
|
// ../provider-bridge-protocol/src/bridge-kit/provider-visibility-helpers.ts
|
|
@@ -3127,10 +3680,10 @@ function getStringProperty(value, key) {
|
|
|
3127
3680
|
}
|
|
3128
3681
|
|
|
3129
3682
|
// ../provider-bridge-protocol/src/bridge-kit/adapter-utils.ts
|
|
3130
|
-
var contentWrapperSchema =
|
|
3131
|
-
content:
|
|
3683
|
+
var contentWrapperSchema = z29.object({
|
|
3684
|
+
content: z29.array(z29.unknown())
|
|
3132
3685
|
}).passthrough();
|
|
3133
|
-
var shellEnvironmentVariableKeySchema =
|
|
3686
|
+
var shellEnvironmentVariableKeySchema = z29.string().regex(/^[A-Z_][A-Z0-9_]*$/i);
|
|
3134
3687
|
function toOptionalString(value) {
|
|
3135
3688
|
return typeof value === "string" ? value : void 0;
|
|
3136
3689
|
}
|
|
@@ -3484,26 +4037,26 @@ function withoutBridgeRuntimeEnv(env) {
|
|
|
3484
4037
|
}
|
|
3485
4038
|
|
|
3486
4039
|
// ../provider-bridge-protocol/src/bridge-kit/bridge-tool-calls.ts
|
|
3487
|
-
import { z as
|
|
3488
|
-
var bridgeRequestEnvelopeSchema =
|
|
3489
|
-
jsonrpc:
|
|
3490
|
-
id:
|
|
3491
|
-
method:
|
|
3492
|
-
params:
|
|
3493
|
-
});
|
|
3494
|
-
var jsonRpcErrorSchema =
|
|
3495
|
-
code:
|
|
3496
|
-
message:
|
|
3497
|
-
data:
|
|
3498
|
-
});
|
|
3499
|
-
var jsonRpcSuccessResponseSchema =
|
|
3500
|
-
jsonrpc:
|
|
3501
|
-
id:
|
|
3502
|
-
result:
|
|
3503
|
-
});
|
|
3504
|
-
var jsonRpcErrorResponseSchema =
|
|
3505
|
-
jsonrpc:
|
|
3506
|
-
id:
|
|
4040
|
+
import { z as z30 } from "zod";
|
|
4041
|
+
var bridgeRequestEnvelopeSchema = z30.object({
|
|
4042
|
+
jsonrpc: z30.literal("2.0"),
|
|
4043
|
+
id: z30.union([z30.string(), z30.number()]),
|
|
4044
|
+
method: z30.string(),
|
|
4045
|
+
params: z30.record(z30.string(), z30.unknown()).optional()
|
|
4046
|
+
});
|
|
4047
|
+
var jsonRpcErrorSchema = z30.object({
|
|
4048
|
+
code: z30.number(),
|
|
4049
|
+
message: z30.string().optional(),
|
|
4050
|
+
data: z30.unknown().optional()
|
|
4051
|
+
});
|
|
4052
|
+
var jsonRpcSuccessResponseSchema = z30.object({
|
|
4053
|
+
jsonrpc: z30.literal("2.0"),
|
|
4054
|
+
id: z30.union([z30.string(), z30.number()]),
|
|
4055
|
+
result: z30.unknown()
|
|
4056
|
+
});
|
|
4057
|
+
var jsonRpcErrorResponseSchema = z30.object({
|
|
4058
|
+
jsonrpc: z30.literal("2.0"),
|
|
4059
|
+
id: z30.union([z30.string(), z30.number()]),
|
|
3507
4060
|
error: jsonRpcErrorSchema
|
|
3508
4061
|
});
|
|
3509
4062
|
function isJsonRpcRequest(input) {
|
|
@@ -3591,47 +4144,47 @@ function buildBridgeToolCallContent(result) {
|
|
|
3591
4144
|
}
|
|
3592
4145
|
|
|
3593
4146
|
// ../provider-bridge-protocol/src/bridge-kit/json-rpc-envelope.ts
|
|
3594
|
-
import { z as
|
|
3595
|
-
var recordSchema =
|
|
3596
|
-
var jsonRpcEnvelopeSchema =
|
|
3597
|
-
jsonrpc:
|
|
3598
|
-
method:
|
|
4147
|
+
import { z as z31 } from "zod";
|
|
4148
|
+
var recordSchema = z31.record(z31.string(), z31.unknown());
|
|
4149
|
+
var jsonRpcEnvelopeSchema = z31.object({
|
|
4150
|
+
jsonrpc: z31.literal("2.0"),
|
|
4151
|
+
method: z31.string(),
|
|
3599
4152
|
params: recordSchema.optional()
|
|
3600
4153
|
}).passthrough();
|
|
3601
|
-
var sdkMessageEnvelopeSchema =
|
|
3602
|
-
jsonrpc:
|
|
3603
|
-
method:
|
|
3604
|
-
params:
|
|
3605
|
-
message:
|
|
3606
|
-
threadId:
|
|
3607
|
-
parent_tool_use_id:
|
|
4154
|
+
var sdkMessageEnvelopeSchema = z31.object({
|
|
4155
|
+
jsonrpc: z31.literal("2.0"),
|
|
4156
|
+
method: z31.literal("sdk/message"),
|
|
4157
|
+
params: z31.object({
|
|
4158
|
+
message: z31.unknown(),
|
|
4159
|
+
threadId: z31.string().optional(),
|
|
4160
|
+
parent_tool_use_id: z31.string().optional()
|
|
3608
4161
|
}).passthrough()
|
|
3609
4162
|
}).passthrough();
|
|
3610
|
-
var threadIdentityEnvelopeSchema =
|
|
3611
|
-
jsonrpc:
|
|
3612
|
-
method:
|
|
3613
|
-
params:
|
|
3614
|
-
threadId:
|
|
3615
|
-
providerThreadId:
|
|
4163
|
+
var threadIdentityEnvelopeSchema = z31.object({
|
|
4164
|
+
jsonrpc: z31.literal("2.0"),
|
|
4165
|
+
method: z31.literal("thread/identity"),
|
|
4166
|
+
params: z31.object({
|
|
4167
|
+
threadId: z31.string().optional(),
|
|
4168
|
+
providerThreadId: z31.string().optional()
|
|
3616
4169
|
}).passthrough()
|
|
3617
4170
|
}).passthrough();
|
|
3618
|
-
var threadContextWindowUsageEnvelopeSchema =
|
|
3619
|
-
jsonrpc:
|
|
3620
|
-
method:
|
|
3621
|
-
params:
|
|
3622
|
-
threadId:
|
|
3623
|
-
contextWindowUsage:
|
|
3624
|
-
usedTokens:
|
|
3625
|
-
modelContextWindow:
|
|
3626
|
-
estimated:
|
|
4171
|
+
var threadContextWindowUsageEnvelopeSchema = z31.object({
|
|
4172
|
+
jsonrpc: z31.literal("2.0"),
|
|
4173
|
+
method: z31.literal("thread/contextWindowUsage/updated"),
|
|
4174
|
+
params: z31.object({
|
|
4175
|
+
threadId: z31.string().optional(),
|
|
4176
|
+
contextWindowUsage: z31.object({
|
|
4177
|
+
usedTokens: z31.number().nullable(),
|
|
4178
|
+
modelContextWindow: z31.number().nullable(),
|
|
4179
|
+
estimated: z31.boolean()
|
|
3627
4180
|
})
|
|
3628
4181
|
}).passthrough()
|
|
3629
4182
|
}).passthrough();
|
|
3630
|
-
var errorEnvelopeSchema =
|
|
3631
|
-
jsonrpc:
|
|
3632
|
-
method:
|
|
3633
|
-
params:
|
|
3634
|
-
message:
|
|
4183
|
+
var errorEnvelopeSchema = z31.object({
|
|
4184
|
+
jsonrpc: z31.literal("2.0"),
|
|
4185
|
+
method: z31.literal("error"),
|
|
4186
|
+
params: z31.object({
|
|
4187
|
+
message: z31.string().optional()
|
|
3635
4188
|
}).passthrough().optional()
|
|
3636
4189
|
}).passthrough();
|
|
3637
4190
|
|
|
@@ -3733,12 +4286,14 @@ function experimental_defineProviderBridge(definition) {
|
|
|
3733
4286
|
}
|
|
3734
4287
|
|
|
3735
4288
|
// ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
|
|
4289
|
+
var import_compare = __toESM(require_compare(), 1);
|
|
4290
|
+
var import_valid = __toESM(require_valid(), 1);
|
|
3736
4291
|
import { execFile } from "node:child_process";
|
|
3737
4292
|
import { constants as fsConstants } from "node:fs";
|
|
3738
4293
|
import { access } from "node:fs/promises";
|
|
3739
4294
|
import path from "node:path";
|
|
3740
4295
|
import { promisify } from "node:util";
|
|
3741
|
-
import { z as
|
|
4296
|
+
import { z as z32 } from "zod";
|
|
3742
4297
|
var execFileAsync = promisify(execFile);
|
|
3743
4298
|
var CLI_PROBE_TIMEOUT_MS = 5e3;
|
|
3744
4299
|
async function resolveExecutablePath(command) {
|
|
@@ -3760,6 +4315,10 @@ async function resolveExecutablePath(command) {
|
|
|
3760
4315
|
return null;
|
|
3761
4316
|
}
|
|
3762
4317
|
}
|
|
4318
|
+
function versionFrom(value) {
|
|
4319
|
+
const candidate = value?.match(/\bv?(\d+\.\d+\.\d+[0-9A-Za-z.+-]*)/u)?.[1];
|
|
4320
|
+
return candidate !== void 0 && (0, import_valid.default)(candidate) !== null ? candidate : null;
|
|
4321
|
+
}
|
|
3763
4322
|
async function readCliVersion(command) {
|
|
3764
4323
|
try {
|
|
3765
4324
|
const probe = execFileAsync(command, ["--version"], {
|
|
@@ -3767,8 +4326,8 @@ async function readCliVersion(command) {
|
|
|
3767
4326
|
});
|
|
3768
4327
|
probe.child.stdin?.end();
|
|
3769
4328
|
const { stdout, stderr } = await probe;
|
|
3770
|
-
return `${stdout}
|
|
3771
|
-
${stderr}
|
|
4329
|
+
return versionFrom(`${stdout}
|
|
4330
|
+
${stderr}`);
|
|
3772
4331
|
} catch {
|
|
3773
4332
|
return null;
|
|
3774
4333
|
}
|
|
@@ -3790,9 +4349,9 @@ function clampPercent(value) {
|
|
|
3790
4349
|
}
|
|
3791
4350
|
|
|
3792
4351
|
// ../provider-bridge-protocol/src/bridge-kit/provider-tool-call-contract.ts
|
|
3793
|
-
import { z as
|
|
3794
|
-
var providerToolCallCancellationSchema =
|
|
3795
|
-
requestId:
|
|
4352
|
+
import { z as z33 } from "zod";
|
|
4353
|
+
var providerToolCallCancellationSchema = z33.object({
|
|
4354
|
+
requestId: z33.union([z33.string(), z33.number().int()])
|
|
3796
4355
|
});
|
|
3797
4356
|
var PROVIDER_TOOL_CALL_CANCELLED_METHOD = "notifications/cancelled";
|
|
3798
4357
|
|
|
@@ -3808,8 +4367,8 @@ function createProviderVisibilityMetadata(args) {
|
|
|
3808
4367
|
}
|
|
3809
4368
|
|
|
3810
4369
|
// ../provider-bridge-protocol/src/bridge-kit/runtime-json-rpc.ts
|
|
3811
|
-
import { z as
|
|
3812
|
-
var ignoredJsonRpcResultSchema =
|
|
4370
|
+
import { z as z34 } from "zod";
|
|
4371
|
+
var ignoredJsonRpcResultSchema = z34.unknown();
|
|
3813
4372
|
|
|
3814
4373
|
// ../provider-bridge-acp/src/bridge/bridge.ts
|
|
3815
4374
|
import { execFile as execFile4 } from "node:child_process";
|
|
@@ -3819,21 +4378,21 @@ import { createServer } from "node:net";
|
|
|
3819
4378
|
import { dirname as dirname2, isAbsolute, basename as basename3, relative, resolve as resolve3 } from "node:path";
|
|
3820
4379
|
import { fileURLToPath } from "node:url";
|
|
3821
4380
|
import { isDeepStrictEqual } from "node:util";
|
|
3822
|
-
import { z as
|
|
4381
|
+
import { z as z42 } from "zod";
|
|
3823
4382
|
|
|
3824
4383
|
// ../provider-bridge-acp/src/bridge-protocol.ts
|
|
3825
|
-
import { z as
|
|
4384
|
+
import { z as z36 } from "zod";
|
|
3826
4385
|
|
|
3827
4386
|
// ../provider-bridge-acp/src/wire.ts
|
|
3828
|
-
import { z as
|
|
3829
|
-
var acpTextContentBlockSchema =
|
|
3830
|
-
type:
|
|
3831
|
-
text:
|
|
4387
|
+
import { z as z35 } from "zod";
|
|
4388
|
+
var acpTextContentBlockSchema = z35.object({
|
|
4389
|
+
type: z35.literal("text"),
|
|
4390
|
+
text: z35.string()
|
|
3832
4391
|
}).passthrough();
|
|
3833
|
-
var acpOtherContentBlockSchema =
|
|
3834
|
-
type:
|
|
4392
|
+
var acpOtherContentBlockSchema = z35.object({
|
|
4393
|
+
type: z35.string()
|
|
3835
4394
|
}).passthrough();
|
|
3836
|
-
var acpContentBlockSchema =
|
|
4395
|
+
var acpContentBlockSchema = z35.union([
|
|
3837
4396
|
acpTextContentBlockSchema,
|
|
3838
4397
|
acpOtherContentBlockSchema
|
|
3839
4398
|
]);
|
|
@@ -3856,7 +4415,7 @@ var ACP_TOOL_KINDS = [
|
|
|
3856
4415
|
"switch_mode",
|
|
3857
4416
|
"other"
|
|
3858
4417
|
];
|
|
3859
|
-
var acpToolKindSchema =
|
|
4418
|
+
var acpToolKindSchema = z35.enum(ACP_TOOL_KINDS);
|
|
3860
4419
|
var ACP_TOOL_KIND_SET = new Set(ACP_TOOL_KINDS);
|
|
3861
4420
|
var ACP_TOOL_CALL_STATUSES = [
|
|
3862
4421
|
"pending",
|
|
@@ -3865,48 +4424,48 @@ var ACP_TOOL_CALL_STATUSES = [
|
|
|
3865
4424
|
"failed",
|
|
3866
4425
|
"cancelled"
|
|
3867
4426
|
];
|
|
3868
|
-
var acpToolCallStatusSchema =
|
|
4427
|
+
var acpToolCallStatusSchema = z35.enum(ACP_TOOL_CALL_STATUSES);
|
|
3869
4428
|
var ACP_TOOL_CALL_STATUS_SET = new Set(
|
|
3870
4429
|
ACP_TOOL_CALL_STATUSES
|
|
3871
4430
|
);
|
|
3872
|
-
var acpToolCallContentSchema =
|
|
3873
|
-
|
|
3874
|
-
type:
|
|
4431
|
+
var acpToolCallContentSchema = z35.union([
|
|
4432
|
+
z35.object({
|
|
4433
|
+
type: z35.literal("content"),
|
|
3875
4434
|
content: acpContentBlockSchema
|
|
3876
4435
|
}).passthrough(),
|
|
3877
|
-
|
|
3878
|
-
type:
|
|
3879
|
-
path:
|
|
3880
|
-
oldText:
|
|
3881
|
-
newText:
|
|
4436
|
+
z35.object({
|
|
4437
|
+
type: z35.literal("diff"),
|
|
4438
|
+
path: z35.string(),
|
|
4439
|
+
oldText: z35.string().nullable().optional(),
|
|
4440
|
+
newText: z35.string()
|
|
3882
4441
|
}).passthrough(),
|
|
3883
|
-
|
|
3884
|
-
type:
|
|
3885
|
-
terminalId:
|
|
4442
|
+
z35.object({
|
|
4443
|
+
type: z35.literal("terminal"),
|
|
4444
|
+
terminalId: z35.string()
|
|
3886
4445
|
}).passthrough()
|
|
3887
4446
|
]);
|
|
3888
|
-
var acpToolCallContentListSchema =
|
|
4447
|
+
var acpToolCallContentListSchema = z35.array(z35.unknown()).transform(
|
|
3889
4448
|
(entries) => entries.flatMap((entry) => {
|
|
3890
4449
|
const parsed = acpToolCallContentSchema.safeParse(entry);
|
|
3891
4450
|
return parsed.success ? [parsed.data] : [];
|
|
3892
4451
|
})
|
|
3893
4452
|
);
|
|
3894
|
-
var acpToolCallLocationSchema =
|
|
3895
|
-
path:
|
|
3896
|
-
line:
|
|
4453
|
+
var acpToolCallLocationSchema = z35.object({
|
|
4454
|
+
path: z35.string(),
|
|
4455
|
+
line: z35.number().optional().nullable()
|
|
3897
4456
|
}).passthrough();
|
|
3898
|
-
var acpToolCallNameSchema =
|
|
3899
|
-
var acpToolCallFieldsSchema =
|
|
3900
|
-
toolCallId:
|
|
3901
|
-
title:
|
|
4457
|
+
var acpToolCallNameSchema = z35.union([z35.string(), z35.null()]).transform((value) => value ?? void 0).optional();
|
|
4458
|
+
var acpToolCallFieldsSchema = z35.object({
|
|
4459
|
+
toolCallId: z35.string(),
|
|
4460
|
+
title: z35.string().optional(),
|
|
3902
4461
|
name: acpToolCallNameSchema,
|
|
3903
4462
|
kind: acpToolKindSchema.optional(),
|
|
3904
|
-
rawKind:
|
|
4463
|
+
rawKind: z35.string().optional(),
|
|
3905
4464
|
status: acpToolCallStatusSchema.optional(),
|
|
3906
4465
|
content: acpToolCallContentListSchema.optional(),
|
|
3907
|
-
locations:
|
|
3908
|
-
rawInput:
|
|
3909
|
-
rawOutput:
|
|
4466
|
+
locations: z35.array(acpToolCallLocationSchema).optional(),
|
|
4467
|
+
rawInput: z35.unknown().optional(),
|
|
4468
|
+
rawOutput: z35.unknown().optional()
|
|
3910
4469
|
});
|
|
3911
4470
|
function openAcpToolCallEnums(value) {
|
|
3912
4471
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
@@ -3932,43 +4491,43 @@ function openAcpToolCallEnums(value) {
|
|
|
3932
4491
|
}
|
|
3933
4492
|
return next;
|
|
3934
4493
|
}
|
|
3935
|
-
var acpAgentMessageChunkUpdateSchema =
|
|
3936
|
-
sessionUpdate:
|
|
4494
|
+
var acpAgentMessageChunkUpdateSchema = z35.object({
|
|
4495
|
+
sessionUpdate: z35.literal("agent_message_chunk"),
|
|
3937
4496
|
content: acpContentBlockSchema
|
|
3938
4497
|
}).passthrough();
|
|
3939
|
-
var acpAgentThoughtChunkUpdateSchema =
|
|
3940
|
-
sessionUpdate:
|
|
4498
|
+
var acpAgentThoughtChunkUpdateSchema = z35.object({
|
|
4499
|
+
sessionUpdate: z35.literal("agent_thought_chunk"),
|
|
3941
4500
|
content: acpContentBlockSchema
|
|
3942
4501
|
}).passthrough();
|
|
3943
|
-
var acpToolCallUpdateEventSchema =
|
|
4502
|
+
var acpToolCallUpdateEventSchema = z35.preprocess(
|
|
3944
4503
|
openAcpToolCallEnums,
|
|
3945
4504
|
acpToolCallFieldsSchema.extend({
|
|
3946
|
-
sessionUpdate:
|
|
4505
|
+
sessionUpdate: z35.enum(["tool_call", "tool_call_update"])
|
|
3947
4506
|
}).passthrough()
|
|
3948
4507
|
);
|
|
3949
|
-
var acpPlanEntryStatusSchema =
|
|
4508
|
+
var acpPlanEntryStatusSchema = z35.enum([
|
|
3950
4509
|
"pending",
|
|
3951
4510
|
"in_progress",
|
|
3952
4511
|
"completed"
|
|
3953
4512
|
]);
|
|
3954
|
-
var acpPlanUpdateSchema =
|
|
3955
|
-
sessionUpdate:
|
|
3956
|
-
entries:
|
|
3957
|
-
|
|
3958
|
-
content:
|
|
4513
|
+
var acpPlanUpdateSchema = z35.object({
|
|
4514
|
+
sessionUpdate: z35.literal("plan"),
|
|
4515
|
+
entries: z35.array(
|
|
4516
|
+
z35.object({
|
|
4517
|
+
content: z35.string(),
|
|
3959
4518
|
status: acpPlanEntryStatusSchema.optional()
|
|
3960
4519
|
}).passthrough()
|
|
3961
4520
|
)
|
|
3962
4521
|
}).passthrough();
|
|
3963
|
-
var acpUsageUpdateSchema =
|
|
3964
|
-
sessionUpdate:
|
|
3965
|
-
used:
|
|
3966
|
-
size:
|
|
4522
|
+
var acpUsageUpdateSchema = z35.object({
|
|
4523
|
+
sessionUpdate: z35.literal("usage_update"),
|
|
4524
|
+
used: z35.number().int().nonnegative(),
|
|
4525
|
+
size: z35.number().int().nonnegative()
|
|
3967
4526
|
}).passthrough();
|
|
3968
|
-
var acpOtherSessionUpdateSchema =
|
|
3969
|
-
sessionUpdate:
|
|
4527
|
+
var acpOtherSessionUpdateSchema = z35.object({
|
|
4528
|
+
sessionUpdate: z35.string()
|
|
3970
4529
|
}).passthrough();
|
|
3971
|
-
var acpSessionUpdateSchema =
|
|
4530
|
+
var acpSessionUpdateSchema = z35.union([
|
|
3972
4531
|
acpAgentMessageChunkUpdateSchema,
|
|
3973
4532
|
acpAgentThoughtChunkUpdateSchema,
|
|
3974
4533
|
acpToolCallUpdateEventSchema,
|
|
@@ -3976,55 +4535,55 @@ var acpSessionUpdateSchema = z34.union([
|
|
|
3976
4535
|
acpUsageUpdateSchema,
|
|
3977
4536
|
acpOtherSessionUpdateSchema
|
|
3978
4537
|
]);
|
|
3979
|
-
var acpSessionNotificationParamsSchema =
|
|
3980
|
-
sessionId:
|
|
4538
|
+
var acpSessionNotificationParamsSchema = z35.object({
|
|
4539
|
+
sessionId: z35.string(),
|
|
3981
4540
|
update: acpSessionUpdateSchema
|
|
3982
4541
|
}).passthrough();
|
|
3983
4542
|
var ACP_PROTOCOL_VERSION = 1;
|
|
3984
|
-
var acpInitializeResultSchema =
|
|
3985
|
-
protocolVersion:
|
|
3986
|
-
agentCapabilities:
|
|
3987
|
-
loadSession:
|
|
3988
|
-
sessionCapabilities:
|
|
3989
|
-
fork:
|
|
4543
|
+
var acpInitializeResultSchema = z35.object({
|
|
4544
|
+
protocolVersion: z35.number(),
|
|
4545
|
+
agentCapabilities: z35.object({
|
|
4546
|
+
loadSession: z35.boolean().optional(),
|
|
4547
|
+
sessionCapabilities: z35.object({
|
|
4548
|
+
fork: z35.object({}).passthrough().nullable().optional()
|
|
3990
4549
|
}).passthrough().optional(),
|
|
3991
|
-
promptCapabilities:
|
|
3992
|
-
image:
|
|
3993
|
-
audio:
|
|
3994
|
-
embeddedContext:
|
|
4550
|
+
promptCapabilities: z35.object({
|
|
4551
|
+
image: z35.boolean().optional(),
|
|
4552
|
+
audio: z35.boolean().optional(),
|
|
4553
|
+
embeddedContext: z35.boolean().optional()
|
|
3995
4554
|
}).passthrough().optional()
|
|
3996
4555
|
}).passthrough().optional(),
|
|
3997
|
-
authMethods:
|
|
4556
|
+
authMethods: z35.array(z35.object({ id: z35.string() }).passthrough()).optional()
|
|
3998
4557
|
}).passthrough();
|
|
3999
|
-
var acpOptionalString =
|
|
4000
|
-
var acpConfigOptionSelectOptionSchema =
|
|
4001
|
-
value:
|
|
4558
|
+
var acpOptionalString = z35.union([z35.string(), z35.null()]).transform((value) => value ?? void 0).optional();
|
|
4559
|
+
var acpConfigOptionSelectOptionSchema = z35.object({
|
|
4560
|
+
value: z35.string(),
|
|
4002
4561
|
name: acpOptionalString
|
|
4003
4562
|
}).passthrough();
|
|
4004
|
-
var acpConfigOptionSchema =
|
|
4005
|
-
id:
|
|
4563
|
+
var acpConfigOptionSchema = z35.object({
|
|
4564
|
+
id: z35.string(),
|
|
4006
4565
|
name: acpOptionalString,
|
|
4007
4566
|
category: acpOptionalString,
|
|
4008
|
-
type:
|
|
4567
|
+
type: z35.string(),
|
|
4009
4568
|
currentValue: acpOptionalString,
|
|
4010
|
-
options:
|
|
4569
|
+
options: z35.array(acpConfigOptionSelectOptionSchema).optional()
|
|
4011
4570
|
}).passthrough();
|
|
4012
|
-
var acpSessionModelSchema =
|
|
4013
|
-
modelId:
|
|
4571
|
+
var acpSessionModelSchema = z35.object({
|
|
4572
|
+
modelId: z35.string(),
|
|
4014
4573
|
name: acpOptionalString,
|
|
4015
4574
|
description: acpOptionalString
|
|
4016
4575
|
}).passthrough();
|
|
4017
|
-
var acpSessionModelsSchema =
|
|
4576
|
+
var acpSessionModelsSchema = z35.object({
|
|
4018
4577
|
currentModelId: acpOptionalString,
|
|
4019
|
-
availableModels:
|
|
4578
|
+
availableModels: z35.array(acpSessionModelSchema).optional()
|
|
4020
4579
|
}).passthrough();
|
|
4021
|
-
var acpLooseConfigOptionSchema =
|
|
4022
|
-
id:
|
|
4023
|
-
name:
|
|
4580
|
+
var acpLooseConfigOptionSchema = z35.object({
|
|
4581
|
+
id: z35.string().optional(),
|
|
4582
|
+
name: z35.unknown().optional(),
|
|
4024
4583
|
category: acpOptionalString,
|
|
4025
|
-
type:
|
|
4026
|
-
currentValue:
|
|
4027
|
-
options:
|
|
4584
|
+
type: z35.unknown().optional(),
|
|
4585
|
+
currentValue: z35.unknown().optional(),
|
|
4586
|
+
options: z35.unknown().optional()
|
|
4028
4587
|
}).passthrough();
|
|
4029
4588
|
function parseAcpConfigOptions(options, ctx) {
|
|
4030
4589
|
if (options == null) {
|
|
@@ -4068,119 +4627,119 @@ function parseAcpConfigOptions(options, ctx) {
|
|
|
4068
4627
|
}
|
|
4069
4628
|
return parsedOptions;
|
|
4070
4629
|
}
|
|
4071
|
-
var acpSessionNewResultSchema =
|
|
4072
|
-
sessionId:
|
|
4630
|
+
var acpSessionNewResultSchema = z35.object({
|
|
4631
|
+
sessionId: z35.string(),
|
|
4073
4632
|
models: acpSessionModelsSchema.optional(),
|
|
4074
|
-
configOptions:
|
|
4633
|
+
configOptions: z35.array(z35.unknown()).nullable().optional().transform((options, ctx) => parseAcpConfigOptions(options, ctx))
|
|
4075
4634
|
}).passthrough();
|
|
4076
|
-
var acpConfigStateResultSchema =
|
|
4635
|
+
var acpConfigStateResultSchema = z35.object({
|
|
4077
4636
|
models: acpSessionModelsSchema.optional(),
|
|
4078
|
-
configOptions:
|
|
4637
|
+
configOptions: z35.array(z35.unknown()).nullable().optional().transform((options, ctx) => parseAcpConfigOptions(options, ctx))
|
|
4079
4638
|
}).passthrough();
|
|
4080
4639
|
var acpSessionForkResultSchema = acpConfigStateResultSchema.extend({
|
|
4081
|
-
sessionId:
|
|
4640
|
+
sessionId: z35.string()
|
|
4082
4641
|
});
|
|
4083
|
-
var acpStopReasonSchema =
|
|
4642
|
+
var acpStopReasonSchema = z35.enum([
|
|
4084
4643
|
"end_turn",
|
|
4085
4644
|
"max_tokens",
|
|
4086
4645
|
"max_turn_requests",
|
|
4087
4646
|
"refusal",
|
|
4088
4647
|
"cancelled"
|
|
4089
4648
|
]);
|
|
4090
|
-
var acpPromptResultSchema =
|
|
4649
|
+
var acpPromptResultSchema = z35.object({
|
|
4091
4650
|
stopReason: acpStopReasonSchema
|
|
4092
4651
|
}).passthrough();
|
|
4093
|
-
var acpPermissionOptionKindSchema =
|
|
4652
|
+
var acpPermissionOptionKindSchema = z35.enum([
|
|
4094
4653
|
"allow_once",
|
|
4095
4654
|
"allow_always",
|
|
4096
4655
|
"reject_once",
|
|
4097
4656
|
"reject_always"
|
|
4098
4657
|
]);
|
|
4099
|
-
var acpPermissionOptionSchema =
|
|
4100
|
-
optionId:
|
|
4101
|
-
name:
|
|
4658
|
+
var acpPermissionOptionSchema = z35.object({
|
|
4659
|
+
optionId: z35.string(),
|
|
4660
|
+
name: z35.string(),
|
|
4102
4661
|
kind: acpPermissionOptionKindSchema
|
|
4103
4662
|
}).passthrough();
|
|
4104
|
-
var acpRequestPermissionParamsSchema =
|
|
4105
|
-
sessionId:
|
|
4106
|
-
toolCall:
|
|
4663
|
+
var acpRequestPermissionParamsSchema = z35.object({
|
|
4664
|
+
sessionId: z35.string(),
|
|
4665
|
+
toolCall: z35.preprocess(
|
|
4107
4666
|
openAcpToolCallEnums,
|
|
4108
4667
|
acpToolCallFieldsSchema.partial().passthrough()
|
|
4109
4668
|
).optional(),
|
|
4110
|
-
options:
|
|
4669
|
+
options: z35.array(acpPermissionOptionSchema).min(1)
|
|
4111
4670
|
}).passthrough();
|
|
4112
|
-
var acpReadTextFileParamsSchema =
|
|
4113
|
-
sessionId:
|
|
4114
|
-
path:
|
|
4115
|
-
line:
|
|
4116
|
-
limit:
|
|
4671
|
+
var acpReadTextFileParamsSchema = z35.object({
|
|
4672
|
+
sessionId: z35.string(),
|
|
4673
|
+
path: z35.string(),
|
|
4674
|
+
line: z35.number().nullable().optional(),
|
|
4675
|
+
limit: z35.number().nullable().optional()
|
|
4117
4676
|
}).passthrough();
|
|
4118
|
-
var acpWriteTextFileParamsSchema =
|
|
4119
|
-
sessionId:
|
|
4120
|
-
path:
|
|
4121
|
-
content:
|
|
4677
|
+
var acpWriteTextFileParamsSchema = z35.object({
|
|
4678
|
+
sessionId: z35.string(),
|
|
4679
|
+
path: z35.string(),
|
|
4680
|
+
content: z35.string()
|
|
4122
4681
|
}).passthrough();
|
|
4123
4682
|
|
|
4124
4683
|
// ../provider-bridge-acp/src/bridge-protocol.ts
|
|
4125
4684
|
var ACP_DEFAULT_MODEL_ID = "acp-default";
|
|
4126
4685
|
var acpModelListParamsSchema = modelListParamsSchema.extend({
|
|
4127
|
-
providerOptions:
|
|
4686
|
+
providerOptions: z36.record(z36.string(), z36.unknown()).optional()
|
|
4128
4687
|
});
|
|
4129
|
-
var acpBridgeCommandSchema =
|
|
4130
|
-
|
|
4131
|
-
method:
|
|
4688
|
+
var acpBridgeCommandSchema = z36.discriminatedUnion("method", [
|
|
4689
|
+
z36.object({
|
|
4690
|
+
method: z36.literal("initialize"),
|
|
4132
4691
|
params: initializeParamsSchema
|
|
4133
4692
|
}),
|
|
4134
|
-
|
|
4135
|
-
method:
|
|
4693
|
+
z36.object({
|
|
4694
|
+
method: z36.literal("model/list"),
|
|
4136
4695
|
params: acpModelListParamsSchema
|
|
4137
4696
|
}),
|
|
4138
|
-
|
|
4139
|
-
method:
|
|
4697
|
+
z36.object({
|
|
4698
|
+
method: z36.literal("provider/health"),
|
|
4140
4699
|
params: providerMaintenanceParamsSchema
|
|
4141
4700
|
}),
|
|
4142
|
-
|
|
4143
|
-
method:
|
|
4701
|
+
z36.object({
|
|
4702
|
+
method: z36.literal("provider/usage"),
|
|
4144
4703
|
params: providerMaintenanceParamsSchema
|
|
4145
4704
|
}),
|
|
4146
|
-
|
|
4147
|
-
method:
|
|
4705
|
+
z36.object({
|
|
4706
|
+
method: z36.literal("provider/installation/status"),
|
|
4148
4707
|
params: providerInstallationStatusParamsSchema
|
|
4149
4708
|
}),
|
|
4150
|
-
|
|
4151
|
-
method:
|
|
4709
|
+
z36.object({
|
|
4710
|
+
method: z36.literal("provider/installation/run"),
|
|
4152
4711
|
params: providerInstallationRunParamsSchema
|
|
4153
4712
|
}),
|
|
4154
|
-
|
|
4155
|
-
method:
|
|
4713
|
+
z36.object({
|
|
4714
|
+
method: z36.literal("thread/start"),
|
|
4156
4715
|
params: threadStartParamsSchema
|
|
4157
4716
|
}),
|
|
4158
|
-
|
|
4159
|
-
method:
|
|
4717
|
+
z36.object({
|
|
4718
|
+
method: z36.literal("thread/resume"),
|
|
4160
4719
|
params: threadResumeParamsSchema
|
|
4161
4720
|
}),
|
|
4162
|
-
|
|
4163
|
-
method:
|
|
4721
|
+
z36.object({
|
|
4722
|
+
method: z36.literal("thread/fork"),
|
|
4164
4723
|
params: threadForkParamsSchema
|
|
4165
4724
|
}),
|
|
4166
|
-
|
|
4167
|
-
method:
|
|
4725
|
+
z36.object({
|
|
4726
|
+
method: z36.literal("turn/start"),
|
|
4168
4727
|
params: turnStartParamsSchema
|
|
4169
4728
|
}),
|
|
4170
|
-
|
|
4171
|
-
method:
|
|
4729
|
+
z36.object({
|
|
4730
|
+
method: z36.literal("turn/steer"),
|
|
4172
4731
|
params: turnSteerParamsSchema
|
|
4173
4732
|
}),
|
|
4174
|
-
|
|
4175
|
-
method:
|
|
4733
|
+
z36.object({
|
|
4734
|
+
method: z36.literal("thread/stop"),
|
|
4176
4735
|
params: threadStopParamsSchema
|
|
4177
4736
|
}),
|
|
4178
|
-
|
|
4179
|
-
method:
|
|
4737
|
+
z36.object({
|
|
4738
|
+
method: z36.literal("thread/discard"),
|
|
4180
4739
|
params: threadDiscardParamsSchema
|
|
4181
4740
|
}),
|
|
4182
|
-
|
|
4183
|
-
method:
|
|
4741
|
+
z36.object({
|
|
4742
|
+
method: z36.literal("skills/configure"),
|
|
4184
4743
|
params: skillsConfigureParamsSchema
|
|
4185
4744
|
})
|
|
4186
4745
|
]);
|
|
@@ -4195,53 +4754,53 @@ var ACP_UPDATE_METHOD = "acp/update";
|
|
|
4195
4754
|
var ACP_FS_WRITE_METHOD = "acp/fs/write";
|
|
4196
4755
|
var ACP_WARNING_METHOD = "acp/warning";
|
|
4197
4756
|
var ACP_BRIDGE_NO_ACTIVE_TURN_ERROR_CODE = -32001;
|
|
4198
|
-
var acpTurnStartedNotificationParamsSchema =
|
|
4199
|
-
threadId:
|
|
4757
|
+
var acpTurnStartedNotificationParamsSchema = z36.object({
|
|
4758
|
+
threadId: z36.string().min(1)
|
|
4200
4759
|
}).passthrough();
|
|
4201
|
-
var acpTurnCompletedNotificationParamsSchema =
|
|
4202
|
-
threadId:
|
|
4760
|
+
var acpTurnCompletedNotificationParamsSchema = z36.object({
|
|
4761
|
+
threadId: z36.string().min(1),
|
|
4203
4762
|
stopReason: acpStopReasonSchema
|
|
4204
4763
|
}).passthrough();
|
|
4205
|
-
var acpCompactionCompletedNotificationParamsSchema =
|
|
4206
|
-
|
|
4207
|
-
threadId:
|
|
4208
|
-
status:
|
|
4764
|
+
var acpCompactionCompletedNotificationParamsSchema = z36.discriminatedUnion("status", [
|
|
4765
|
+
z36.object({
|
|
4766
|
+
threadId: z36.string().min(1),
|
|
4767
|
+
status: z36.literal("completed")
|
|
4209
4768
|
}).passthrough(),
|
|
4210
|
-
|
|
4211
|
-
threadId:
|
|
4212
|
-
status:
|
|
4769
|
+
z36.object({
|
|
4770
|
+
threadId: z36.string().min(1),
|
|
4771
|
+
status: z36.literal("interrupted")
|
|
4213
4772
|
}).passthrough(),
|
|
4214
|
-
|
|
4215
|
-
threadId:
|
|
4216
|
-
status:
|
|
4217
|
-
detail:
|
|
4773
|
+
z36.object({
|
|
4774
|
+
threadId: z36.string().min(1),
|
|
4775
|
+
status: z36.literal("skipped"),
|
|
4776
|
+
detail: z36.string().min(1)
|
|
4218
4777
|
}).passthrough(),
|
|
4219
|
-
|
|
4220
|
-
threadId:
|
|
4221
|
-
status:
|
|
4222
|
-
error:
|
|
4778
|
+
z36.object({
|
|
4779
|
+
threadId: z36.string().min(1),
|
|
4780
|
+
status: z36.literal("failed"),
|
|
4781
|
+
error: z36.string().min(1)
|
|
4223
4782
|
}).passthrough()
|
|
4224
4783
|
]);
|
|
4225
|
-
var acpUpdateNotificationParamsSchema =
|
|
4226
|
-
threadId:
|
|
4784
|
+
var acpUpdateNotificationParamsSchema = z36.object({
|
|
4785
|
+
threadId: z36.string().min(1),
|
|
4227
4786
|
update: acpSessionUpdateSchema
|
|
4228
4787
|
}).passthrough();
|
|
4229
|
-
var acpFsWriteNotificationParamsSchema =
|
|
4230
|
-
threadId:
|
|
4231
|
-
path:
|
|
4232
|
-
kind:
|
|
4233
|
-
oldText:
|
|
4234
|
-
content:
|
|
4788
|
+
var acpFsWriteNotificationParamsSchema = z36.object({
|
|
4789
|
+
threadId: z36.string().min(1),
|
|
4790
|
+
path: z36.string().min(1),
|
|
4791
|
+
kind: z36.enum(["add", "update"]),
|
|
4792
|
+
oldText: z36.string().optional(),
|
|
4793
|
+
content: z36.string()
|
|
4235
4794
|
}).passthrough();
|
|
4236
|
-
var acpWarningNotificationParamsSchema =
|
|
4237
|
-
threadId:
|
|
4238
|
-
summary:
|
|
4239
|
-
details:
|
|
4795
|
+
var acpWarningNotificationParamsSchema = z36.object({
|
|
4796
|
+
threadId: z36.string().min(1),
|
|
4797
|
+
summary: z36.string().min(1),
|
|
4798
|
+
details: z36.string().optional()
|
|
4240
4799
|
}).passthrough();
|
|
4241
4800
|
|
|
4242
4801
|
// ../provider-bridge-acp/src/dialect.ts
|
|
4243
4802
|
import { basename } from "node:path";
|
|
4244
|
-
import { z as
|
|
4803
|
+
import { z as z40 } from "zod";
|
|
4245
4804
|
|
|
4246
4805
|
// ../provider-bridge-acp/src/bridge/provider-maintenance.ts
|
|
4247
4806
|
import { execFile as execFile2 } from "node:child_process";
|
|
@@ -4251,7 +4810,7 @@ import os from "node:os";
|
|
|
4251
4810
|
import path2 from "node:path";
|
|
4252
4811
|
import { DatabaseSync } from "node:sqlite";
|
|
4253
4812
|
import { promisify as promisify2 } from "node:util";
|
|
4254
|
-
import { z as
|
|
4813
|
+
import { z as z37 } from "zod";
|
|
4255
4814
|
var execFileAsync2 = promisify2(execFile2);
|
|
4256
4815
|
var USAGE_FETCH_TIMEOUT_MS = 15e3;
|
|
4257
4816
|
var CURSOR_DASHBOARD_URL = "https://api2.cursor.sh/aiserver.v1.DashboardService";
|
|
@@ -4289,8 +4848,8 @@ async function readKeychainAccessToken() {
|
|
|
4289
4848
|
return null;
|
|
4290
4849
|
}
|
|
4291
4850
|
}
|
|
4292
|
-
var cursorFileCredentialsSchema =
|
|
4293
|
-
accessToken:
|
|
4851
|
+
var cursorFileCredentialsSchema = z37.object({
|
|
4852
|
+
accessToken: z37.string().min(1).nullish()
|
|
4294
4853
|
});
|
|
4295
4854
|
async function readAccessToken() {
|
|
4296
4855
|
const keychain = await readKeychainAccessToken();
|
|
@@ -4337,7 +4896,7 @@ function readAccountEmail() {
|
|
|
4337
4896
|
database = new DatabaseSync(databasePath);
|
|
4338
4897
|
database.exec("PRAGMA query_only = true");
|
|
4339
4898
|
const row = database.prepare("SELECT value FROM ItemTable WHERE key = ?").get("cursorAuth/cachedEmail");
|
|
4340
|
-
const parsed =
|
|
4899
|
+
const parsed = z37.object({ value: z37.string().email() }).safeParse(row);
|
|
4341
4900
|
return parsed.success ? parsed.data.value : null;
|
|
4342
4901
|
} catch {
|
|
4343
4902
|
return null;
|
|
@@ -4441,14 +5000,14 @@ function buildAcpProviderInstallationRun(status, args) {
|
|
|
4441
5000
|
verification: { kind: "installed" }
|
|
4442
5001
|
};
|
|
4443
5002
|
}
|
|
4444
|
-
var cursorNonNegativeIntegerSchema =
|
|
4445
|
-
|
|
4446
|
-
|
|
5003
|
+
var cursorNonNegativeIntegerSchema = z37.union([
|
|
5004
|
+
z37.number().int().nonnegative(),
|
|
5005
|
+
z37.string().regex(/^\d+$/u).transform(Number)
|
|
4447
5006
|
]).refine(Number.isSafeInteger);
|
|
4448
|
-
var cursorUsageResponseSchema =
|
|
5007
|
+
var cursorUsageResponseSchema = z37.object({
|
|
4449
5008
|
billingCycleEnd: cursorNonNegativeIntegerSchema.nullish(),
|
|
4450
|
-
planUsage:
|
|
4451
|
-
spendLimitUsage:
|
|
5009
|
+
planUsage: z37.object({ totalPercentUsed: z37.number().nonnegative().default(0) }).nullish(),
|
|
5010
|
+
spendLimitUsage: z37.object({
|
|
4452
5011
|
overallLimit: cursorNonNegativeIntegerSchema.nullish(),
|
|
4453
5012
|
overallUsed: cursorNonNegativeIntegerSchema.nullish(),
|
|
4454
5013
|
individualLimit: cursorNonNegativeIntegerSchema.nullish(),
|
|
@@ -4457,8 +5016,8 @@ var cursorUsageResponseSchema = z36.object({
|
|
|
4457
5016
|
pooledUsed: cursorNonNegativeIntegerSchema.nullish()
|
|
4458
5017
|
}).nullish()
|
|
4459
5018
|
}).passthrough();
|
|
4460
|
-
var cursorPlanResponseSchema =
|
|
4461
|
-
planInfo:
|
|
5019
|
+
var cursorPlanResponseSchema = z37.object({
|
|
5020
|
+
planInfo: z37.object({ planName: z37.string().min(1) }).nullish()
|
|
4462
5021
|
}).passthrough();
|
|
4463
5022
|
function normalizeUsage(rawUsage, rawPlan, accountEmail = null) {
|
|
4464
5023
|
const usage = cursorUsageResponseSchema.safeParse(rawUsage);
|
|
@@ -4670,17 +5229,17 @@ function toolKindPresentation(args) {
|
|
|
4670
5229
|
}
|
|
4671
5230
|
|
|
4672
5231
|
// ../provider-bridge-acp/src/tool-classification.ts
|
|
4673
|
-
import { z as
|
|
5232
|
+
import { z as z39 } from "zod";
|
|
4674
5233
|
|
|
4675
5234
|
// ../provider-bridge-acp/src/tool-call-operation.ts
|
|
4676
5235
|
import path3 from "node:path";
|
|
4677
|
-
import { z as
|
|
4678
|
-
var acpRawInputCommandSchema =
|
|
4679
|
-
var acpRawInputPathSchema =
|
|
4680
|
-
path:
|
|
4681
|
-
filePath:
|
|
4682
|
-
file_path:
|
|
4683
|
-
target_file:
|
|
5236
|
+
import { z as z38 } from "zod";
|
|
5237
|
+
var acpRawInputCommandSchema = z38.object({ command: z38.string() }).passthrough();
|
|
5238
|
+
var acpRawInputPathSchema = z38.object({
|
|
5239
|
+
path: z38.string().optional(),
|
|
5240
|
+
filePath: z38.string().optional(),
|
|
5241
|
+
file_path: z38.string().optional(),
|
|
5242
|
+
target_file: z38.string().optional()
|
|
4684
5243
|
}).passthrough();
|
|
4685
5244
|
function resolveAcpToolCallPath(value, options) {
|
|
4686
5245
|
const cwd = options?.cwd;
|
|
@@ -4857,14 +5416,14 @@ function extractAcpToolCallOutputText(event) {
|
|
|
4857
5416
|
).trim();
|
|
4858
5417
|
return rawOutputText.length > 0 ? rawOutputText : void 0;
|
|
4859
5418
|
}
|
|
4860
|
-
var commandRawOutputSchema =
|
|
4861
|
-
exitCode:
|
|
4862
|
-
exit_code:
|
|
4863
|
-
stdout:
|
|
4864
|
-
stderr:
|
|
4865
|
-
output_for_prompt:
|
|
4866
|
-
signal:
|
|
4867
|
-
timed_out:
|
|
5419
|
+
var commandRawOutputSchema = z39.object({
|
|
5420
|
+
exitCode: z39.number().int().nullable().optional(),
|
|
5421
|
+
exit_code: z39.number().int().nullable().optional(),
|
|
5422
|
+
stdout: z39.string().optional(),
|
|
5423
|
+
stderr: z39.string().optional(),
|
|
5424
|
+
output_for_prompt: z39.string().optional(),
|
|
5425
|
+
signal: z39.string().nullable().optional(),
|
|
5426
|
+
timed_out: z39.boolean().optional()
|
|
4868
5427
|
}).passthrough();
|
|
4869
5428
|
function emptyToUndefined(value) {
|
|
4870
5429
|
return value === void 0 || value.length === 0 ? void 0 : value;
|
|
@@ -4933,10 +5492,10 @@ function extractAcpCommandResult(event) {
|
|
|
4933
5492
|
...output === void 0 ? {} : { output: scrubInlineImageDataUrls(output) }
|
|
4934
5493
|
};
|
|
4935
5494
|
}
|
|
4936
|
-
var optionalNonBlank =
|
|
5495
|
+
var optionalNonBlank = z39.string().optional().transform(
|
|
4937
5496
|
(value) => value !== void 0 && value.trim().length > 0 ? value : void 0
|
|
4938
5497
|
);
|
|
4939
|
-
var searchRawInputSchema =
|
|
5498
|
+
var searchRawInputSchema = z39.object({
|
|
4940
5499
|
pattern: optionalNonBlank,
|
|
4941
5500
|
query: optionalNonBlank,
|
|
4942
5501
|
regex: optionalNonBlank,
|
|
@@ -4945,8 +5504,8 @@ var searchRawInputSchema = z38.object({
|
|
|
4945
5504
|
path: optionalNonBlank,
|
|
4946
5505
|
directory: optionalNonBlank
|
|
4947
5506
|
}).passthrough();
|
|
4948
|
-
var fetchRawInputSchema =
|
|
4949
|
-
var thinkRawInputSchema =
|
|
5507
|
+
var fetchRawInputSchema = z39.object({ url: optionalNonBlank, uri: optionalNonBlank }).passthrough();
|
|
5508
|
+
var thinkRawInputSchema = z39.object({ thought: optionalNonBlank, thinking: optionalNonBlank }).passthrough();
|
|
4950
5509
|
var SINGLE_TICKED_TOKEN_PATTERN = /^[^`]*`([^`\n]+)`[^`]*$/;
|
|
4951
5510
|
var URL_PATTERN = /https?:\/\/[^\s`'"<>]+/g;
|
|
4952
5511
|
function tickedTokenFromTitle(title) {
|
|
@@ -5139,10 +5698,10 @@ function classifyAcpToolCall2(event, injected, options) {
|
|
|
5139
5698
|
|
|
5140
5699
|
// ../provider-bridge-acp/src/dialect.ts
|
|
5141
5700
|
var GENERIC_ACP_DIALECT = { id: "acp" };
|
|
5142
|
-
var grokToolMetaSchema =
|
|
5143
|
-
"x.ai/tool":
|
|
5144
|
-
name:
|
|
5145
|
-
kind:
|
|
5701
|
+
var grokToolMetaSchema = z40.object({
|
|
5702
|
+
"x.ai/tool": z40.object({
|
|
5703
|
+
name: z40.string().optional(),
|
|
5704
|
+
kind: z40.string().optional()
|
|
5146
5705
|
}).passthrough()
|
|
5147
5706
|
}).passthrough();
|
|
5148
5707
|
function grokToolIdentity(event) {
|
|
@@ -5158,10 +5717,10 @@ function grokToolIdentity(event) {
|
|
|
5158
5717
|
};
|
|
5159
5718
|
}
|
|
5160
5719
|
var GROK_SPAWN_SUBAGENT_TOOL = "spawn_subagent";
|
|
5161
|
-
var grokSpawnSubagentInputSchema =
|
|
5162
|
-
description:
|
|
5163
|
-
prompt:
|
|
5164
|
-
subagent_type:
|
|
5720
|
+
var grokSpawnSubagentInputSchema = z40.object({
|
|
5721
|
+
description: z40.string().optional(),
|
|
5722
|
+
prompt: z40.string().optional(),
|
|
5723
|
+
subagent_type: z40.string().optional()
|
|
5165
5724
|
}).passthrough();
|
|
5166
5725
|
function grokClassifyToolCall(event) {
|
|
5167
5726
|
if (grokToolIdentity(event)?.name !== GROK_SPAWN_SUBAGENT_TOOL) {
|
|
@@ -5190,14 +5749,14 @@ var GROK_ACP_DIALECT = {
|
|
|
5190
5749
|
classifyToolCall: grokClassifyToolCall
|
|
5191
5750
|
};
|
|
5192
5751
|
var CURSOR_TASK_TOOL = "task";
|
|
5193
|
-
var cursorTaskRawInputSchema =
|
|
5752
|
+
var cursorTaskRawInputSchema = z40.object({ _toolName: z40.string().optional() }).passthrough();
|
|
5194
5753
|
var CURSOR_TASK_METHOD = "cursor/task";
|
|
5195
|
-
var cursorTaskParamsSchema =
|
|
5196
|
-
toolCallId:
|
|
5197
|
-
description:
|
|
5198
|
-
prompt:
|
|
5199
|
-
agentId:
|
|
5200
|
-
model:
|
|
5754
|
+
var cursorTaskParamsSchema = z40.object({
|
|
5755
|
+
toolCallId: z40.string(),
|
|
5756
|
+
description: z40.string().optional(),
|
|
5757
|
+
prompt: z40.string().optional(),
|
|
5758
|
+
agentId: z40.string().optional(),
|
|
5759
|
+
model: z40.string().optional()
|
|
5201
5760
|
}).passthrough();
|
|
5202
5761
|
function cursorClassifyToolCall(event) {
|
|
5203
5762
|
const parsed = cursorTaskRawInputSchema.safeParse(event.rawInput);
|
|
@@ -5245,23 +5804,23 @@ var CURSOR_ACP_DIALECT = {
|
|
|
5245
5804
|
handleClientRequest: cursorHandleClientRequest,
|
|
5246
5805
|
maintenance: CURSOR_ACP_MAINTENANCE
|
|
5247
5806
|
};
|
|
5248
|
-
var ompBashRawInputSchema =
|
|
5249
|
-
command:
|
|
5250
|
-
async:
|
|
5807
|
+
var ompBashRawInputSchema = z40.object({
|
|
5808
|
+
command: z40.string(),
|
|
5809
|
+
async: z40.boolean().optional()
|
|
5251
5810
|
}).passthrough();
|
|
5252
5811
|
var ompBashRawOutputSchema = commandRawOutputSchema.extend({
|
|
5253
|
-
content:
|
|
5254
|
-
|
|
5255
|
-
type:
|
|
5256
|
-
text:
|
|
5812
|
+
content: z40.array(
|
|
5813
|
+
z40.object({
|
|
5814
|
+
type: z40.literal("text"),
|
|
5815
|
+
text: z40.string()
|
|
5257
5816
|
}).passthrough()
|
|
5258
5817
|
),
|
|
5259
|
-
details:
|
|
5260
|
-
exitCode:
|
|
5261
|
-
wallTimeMs:
|
|
5262
|
-
timedOut:
|
|
5263
|
-
signal:
|
|
5264
|
-
async:
|
|
5818
|
+
details: z40.object({
|
|
5819
|
+
exitCode: z40.number().int().optional(),
|
|
5820
|
+
wallTimeMs: z40.number().nonnegative().optional(),
|
|
5821
|
+
timedOut: z40.boolean().optional(),
|
|
5822
|
+
signal: z40.unknown().optional(),
|
|
5823
|
+
async: z40.unknown().optional()
|
|
5265
5824
|
}).passthrough()
|
|
5266
5825
|
});
|
|
5267
5826
|
function stripOmpTrailingNotice(text, notice) {
|
|
@@ -5324,11 +5883,11 @@ var OMP_ACP_DIALECT = {
|
|
|
5324
5883
|
id: "omp",
|
|
5325
5884
|
commandResult: ompCommandResult
|
|
5326
5885
|
};
|
|
5327
|
-
var openCodeCommandRawOutputSchema =
|
|
5328
|
-
output:
|
|
5329
|
-
metadata:
|
|
5330
|
-
exit:
|
|
5331
|
-
output:
|
|
5886
|
+
var openCodeCommandRawOutputSchema = z40.object({
|
|
5887
|
+
output: z40.unknown().optional(),
|
|
5888
|
+
metadata: z40.object({
|
|
5889
|
+
exit: z40.number().int().nullable().optional(),
|
|
5890
|
+
output: z40.string().optional()
|
|
5332
5891
|
}).passthrough().optional()
|
|
5333
5892
|
}).passthrough();
|
|
5334
5893
|
function normalizeOpenCodeCommandEvent(event) {
|
|
@@ -7246,7 +7805,7 @@ import { basename as basename2, dirname, join as join2, resolve as resolve2 } fr
|
|
|
7246
7805
|
// ../provider-bridge-acp/src/bridge/tool-proxy-mcp.ts
|
|
7247
7806
|
import { createConnection } from "node:net";
|
|
7248
7807
|
import { createInterface as createInterface2 } from "node:readline";
|
|
7249
|
-
import { z as
|
|
7808
|
+
import { z as z41 } from "zod";
|
|
7250
7809
|
var ACP_BRIDGE_MCP_SERVER_NAME = "bb-bridge";
|
|
7251
7810
|
var ENV_HOST = "BB_ACP_DYNAMIC_TOOL_HOST";
|
|
7252
7811
|
var ENV_PORT = "BB_ACP_DYNAMIC_TOOL_PORT";
|
|
@@ -7254,45 +7813,45 @@ var ENV_TOKEN = "BB_ACP_DYNAMIC_TOOL_TOKEN";
|
|
|
7254
7813
|
var ENV_THREAD_ID = "BB_ACP_DYNAMIC_TOOL_THREAD_ID";
|
|
7255
7814
|
var ENV_TOOLS = "BB_ACP_DYNAMIC_TOOLS";
|
|
7256
7815
|
var ENV_PROGRESS_INTERVAL_MS = "BB_ACP_DYNAMIC_TOOL_PROGRESS_INTERVAL_MS";
|
|
7257
|
-
var dynamicToolBridgeRequestSchema =
|
|
7258
|
-
|
|
7259
|
-
kind:
|
|
7260
|
-
threadId:
|
|
7261
|
-
token:
|
|
7262
|
-
toolCount:
|
|
7816
|
+
var dynamicToolBridgeRequestSchema = z41.discriminatedUnion("kind", [
|
|
7817
|
+
z41.object({
|
|
7818
|
+
kind: z41.literal("initialized"),
|
|
7819
|
+
threadId: z41.string().min(1),
|
|
7820
|
+
token: z41.string().min(1),
|
|
7821
|
+
toolCount: z41.number().int().nonnegative()
|
|
7263
7822
|
}),
|
|
7264
|
-
|
|
7265
|
-
kind:
|
|
7266
|
-
arguments:
|
|
7267
|
-
callId:
|
|
7268
|
-
threadId:
|
|
7269
|
-
token:
|
|
7270
|
-
tool:
|
|
7823
|
+
z41.object({
|
|
7824
|
+
kind: z41.literal("toolCall"),
|
|
7825
|
+
arguments: z41.record(z41.string(), z41.unknown()).default({}),
|
|
7826
|
+
callId: z41.string().min(1),
|
|
7827
|
+
threadId: z41.string().min(1),
|
|
7828
|
+
token: z41.string().min(1),
|
|
7829
|
+
tool: z41.string().min(1)
|
|
7271
7830
|
})
|
|
7272
7831
|
]);
|
|
7273
|
-
var bridgeToolCallResponseSchema =
|
|
7274
|
-
|
|
7275
|
-
ok:
|
|
7276
|
-
content:
|
|
7277
|
-
contentBlocks:
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
type:
|
|
7282
|
-
data:
|
|
7283
|
-
mimeType:
|
|
7832
|
+
var bridgeToolCallResponseSchema = z41.union([
|
|
7833
|
+
z41.object({
|
|
7834
|
+
ok: z41.literal(true),
|
|
7835
|
+
content: z41.string(),
|
|
7836
|
+
contentBlocks: z41.array(
|
|
7837
|
+
z41.discriminatedUnion("type", [
|
|
7838
|
+
z41.object({ type: z41.literal("text"), text: z41.string() }),
|
|
7839
|
+
z41.object({
|
|
7840
|
+
type: z41.literal("image"),
|
|
7841
|
+
data: z41.string(),
|
|
7842
|
+
mimeType: z41.string()
|
|
7284
7843
|
})
|
|
7285
7844
|
])
|
|
7286
7845
|
).optional(),
|
|
7287
|
-
images:
|
|
7288
|
-
isError:
|
|
7846
|
+
images: z41.array(z41.object({ data: z41.string(), mimeType: z41.string() })).default([]),
|
|
7847
|
+
isError: z41.boolean().optional()
|
|
7289
7848
|
}),
|
|
7290
|
-
|
|
7849
|
+
z41.object({ ok: z41.literal(false), error: z41.string() })
|
|
7291
7850
|
]);
|
|
7292
|
-
var jsonRpcMessageSchema =
|
|
7293
|
-
id:
|
|
7294
|
-
method:
|
|
7295
|
-
params:
|
|
7851
|
+
var jsonRpcMessageSchema = z41.object({
|
|
7852
|
+
id: z41.union([z41.string(), z41.number().int()]).optional(),
|
|
7853
|
+
method: z41.string().optional(),
|
|
7854
|
+
params: z41.unknown().optional()
|
|
7296
7855
|
});
|
|
7297
7856
|
var nextMcpToolCallId = 0;
|
|
7298
7857
|
var TOOL_CALL_PROGRESS_INTERVAL_MS = 15e3;
|
|
@@ -8066,7 +8625,7 @@ async function authenticateAcpAgent(args) {
|
|
|
8066
8625
|
await args.connection.request({
|
|
8067
8626
|
method: "authenticate",
|
|
8068
8627
|
params: { methodId, _meta: { headless: true } },
|
|
8069
|
-
resultSchema:
|
|
8628
|
+
resultSchema: z42.unknown()
|
|
8070
8629
|
});
|
|
8071
8630
|
} catch (error) {
|
|
8072
8631
|
throw new AcpAuthRequiredError(
|
|
@@ -8396,7 +8955,7 @@ async function selectAcpNativeModel(args) {
|
|
|
8396
8955
|
configId: modelOption.id,
|
|
8397
8956
|
value: selection.modelId
|
|
8398
8957
|
},
|
|
8399
|
-
resultSchema:
|
|
8958
|
+
resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
|
|
8400
8959
|
});
|
|
8401
8960
|
setModel = false;
|
|
8402
8961
|
} catch {
|
|
@@ -8407,7 +8966,7 @@ async function selectAcpNativeModel(args) {
|
|
|
8407
8966
|
configState = await args.connection.request({
|
|
8408
8967
|
method: "session/set_model",
|
|
8409
8968
|
params: { sessionId: args.sessionId, modelId: selection.modelId },
|
|
8410
|
-
resultSchema:
|
|
8969
|
+
resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
|
|
8411
8970
|
});
|
|
8412
8971
|
}
|
|
8413
8972
|
configOptions = configState?.configOptions ?? configOptions;
|
|
@@ -8904,7 +9463,7 @@ async function startAgentSession(request) {
|
|
|
8904
9463
|
cwd: params.cwd,
|
|
8905
9464
|
mcpServers
|
|
8906
9465
|
},
|
|
8907
|
-
resultSchema:
|
|
9466
|
+
resultSchema: z42.union([acpConfigStateResultSchema, z42.null()])
|
|
8908
9467
|
});
|
|
8909
9468
|
loadedConfigOptions = configState?.configOptions;
|
|
8910
9469
|
loadedModels = configState?.models;
|
|
@@ -9350,12 +9909,12 @@ function decodeLaunchSpec(providerOptions) {
|
|
|
9350
9909
|
);
|
|
9351
9910
|
return launchSpec.success ? launchSpec.data : null;
|
|
9352
9911
|
}
|
|
9353
|
-
var acpProviderOptionsSchema =
|
|
9354
|
-
additionalWorkspaceWriteRoots:
|
|
9355
|
-
acpDialect:
|
|
9356
|
-
parameterizedModelPicker:
|
|
9357
|
-
primaryModels:
|
|
9358
|
-
reasoningProbePriorityModelIds:
|
|
9912
|
+
var acpProviderOptionsSchema = z42.object({
|
|
9913
|
+
additionalWorkspaceWriteRoots: z42.array(z42.string()).optional(),
|
|
9914
|
+
acpDialect: z42.string().min(1).optional(),
|
|
9915
|
+
parameterizedModelPicker: z42.boolean().optional(),
|
|
9916
|
+
primaryModels: z42.array(z42.string().min(1)).optional(),
|
|
9917
|
+
reasoningProbePriorityModelIds: z42.array(z42.string().min(1)).optional()
|
|
9359
9918
|
}).passthrough();
|
|
9360
9919
|
function decodeAcpModelPickerOptions(providerOptions) {
|
|
9361
9920
|
const parsed = acpProviderOptionsSchema.parse(providerOptions ?? {});
|
|
@@ -9672,7 +10231,7 @@ var experimental_providerBridge = experimental_defineProviderBridge({
|
|
|
9672
10231
|
});
|
|
9673
10232
|
|
|
9674
10233
|
// ../provider-bridge-acp/src/probe.ts
|
|
9675
|
-
import { z as
|
|
10234
|
+
import { z as z43 } from "zod";
|
|
9676
10235
|
var PROBE_TIMEOUT_MS = 1e4;
|
|
9677
10236
|
function describe(error) {
|
|
9678
10237
|
if (error instanceof AcpAgentExitedError) {
|
|
@@ -9730,9 +10289,9 @@ async function probeAcpAgent(request) {
|
|
|
9730
10289
|
connected.kill();
|
|
9731
10290
|
}
|
|
9732
10291
|
}
|
|
9733
|
-
var acpAgentProbeSchema =
|
|
9734
|
-
|
|
9735
|
-
|
|
10292
|
+
var acpAgentProbeSchema = z43.union([
|
|
10293
|
+
z43.object({ reachable: z43.literal(true), fork: z43.boolean() }),
|
|
10294
|
+
z43.object({ reachable: z43.literal(false), reason: z43.string() })
|
|
9736
10295
|
]);
|
|
9737
10296
|
export {
|
|
9738
10297
|
acpAgentProbeSchema as experimental_acpAgentProbeSchema,
|