subagent-extension-for-codex 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +16 -13
  2. package/assets/icons/archive-view.svg +16 -0
  3. package/assets/icons/arrow-up-circle.svg +14 -0
  4. package/assets/icons/check-circle.svg +14 -0
  5. package/assets/icons/file-code.svg +17 -0
  6. package/assets/icons/file-diff.svg +17 -0
  7. package/assets/icons/file-text.svg +17 -0
  8. package/assets/icons/git-commit-off.svg +15 -0
  9. package/assets/icons/git-off.svg +17 -0
  10. package/assets/icons/note.svg +16 -0
  11. package/dist/THIRD_PARTY_LICENSES.txt +21 -1
  12. package/dist/app.html +811 -191
  13. package/dist/bundle/chunks/{chunk-KFBRPWLR.js → chunk-36LESPFG.js} +8467 -7970
  14. package/dist/bundle/chunks/chunk-36LESPFG.js.map +6 -0
  15. package/dist/bundle/chunks/{chunk-5TX3SEV2.js → chunk-FT2Y2DFZ.js} +137 -1
  16. package/dist/bundle/chunks/chunk-FT2Y2DFZ.js.map +6 -0
  17. package/dist/bundle/chunks/{chunk-LZFYKJ4Y.js → chunk-L5ILPS3O.js} +1796 -845
  18. package/dist/bundle/chunks/chunk-L5ILPS3O.js.map +6 -0
  19. package/dist/bundle/chunks/chunk-TPCNCQM7.js +970 -0
  20. package/dist/bundle/chunks/chunk-TPCNCQM7.js.map +6 -0
  21. package/dist/bundle/chunks/{v4-LDJUK5DU.js → v4-NCRHZ3K4.js} +2 -2
  22. package/dist/bundle/main.js +21868 -17076
  23. package/dist/bundle/main.js.map +3 -3
  24. package/dist/bundle/projects-cli.js +11 -8
  25. package/dist/bundle/projects-cli.js.map +1 -1
  26. package/dist/bundle/stdio.js +106 -8
  27. package/dist/bundle/stdio.js.map +2 -2
  28. package/migrations/20261107064009_claude-sdk-settings/migration.sql +39 -0
  29. package/migrations/20261107064009_claude-sdk-settings/snapshot.json +615 -0
  30. package/migrations/20261107203218_task-read-indexes/migration.sql +9 -0
  31. package/migrations/20261107203218_task-read-indexes/snapshot.json +762 -0
  32. package/migrations/20261107210532_chat-events-backfill/migration.sql +23 -0
  33. package/migrations/20261107210532_chat-events-backfill/snapshot.json +762 -0
  34. package/migrations/20261108005345_task-messages/migration.sql +9 -0
  35. package/migrations/20261108005345_task-messages/snapshot.json +841 -0
  36. package/migrations/20261108005348_task-messages-backfill/migration.sql +14 -0
  37. package/migrations/20261108005348_task-messages-backfill/snapshot.json +841 -0
  38. package/migrations/20261110025216_task-attachments/migration.sql +21 -0
  39. package/migrations/20261110025216_task-attachments/snapshot.json +1040 -0
  40. package/package.json +13 -1
  41. package/plugin.json +1 -1
  42. package/skills/delegation/SKILL.md +14 -7
  43. package/dist/bundle/chunks/chunk-5TX3SEV2.js.map +0 -6
  44. package/dist/bundle/chunks/chunk-KFBRPWLR.js.map +0 -6
  45. package/dist/bundle/chunks/chunk-L3PORPD3.js +0 -450
  46. package/dist/bundle/chunks/chunk-L3PORPD3.js.map +0 -6
  47. package/dist/bundle/chunks/chunk-LZFYKJ4Y.js.map +0 -6
  48. /package/dist/bundle/chunks/{v4-LDJUK5DU.js.map → v4-NCRHZ3K4.js.map} +0 -0
@@ -1,33 +1,50 @@
1
1
  import { createRequire as __bundleCreateRequire } from "node:module"; const require = __bundleCreateRequire(import.meta.url);
2
2
  import {
3
+ AttachmentError,
3
4
  JsonlWriter,
5
+ MESSAGE_EVENTS,
6
+ PolicyRejectedError,
7
+ WORKTREE_NEEDS_GIT,
4
8
  approvalDeciderSchema,
5
9
  approvalModeSchema,
10
+ archivedFilters,
11
+ assertPlainFolderAllowed,
6
12
  budgetRaiseSchema,
13
+ chatItems,
14
+ conversation,
7
15
  dataDirectory,
8
16
  deliveries,
9
17
  errorCategory,
18
+ eventPayload,
19
+ failureMessage,
10
20
  gitRepositoryRoot,
21
+ gitState,
22
+ gitWorkTreeRoot,
11
23
  installRoot,
24
+ isBudgetFailure,
12
25
  logCorrelation,
13
26
  logError,
14
27
  logEvent,
15
28
  modelNameSchema,
29
+ packagePath,
16
30
  packageVersion,
17
31
  readPackageFile,
18
32
  reasoningLevels,
19
33
  reasoningSchema,
20
34
  roles,
21
35
  startSchema,
22
- withLogContext
23
- } from "./chunk-L3PORPD3.js";
36
+ withLogContext,
37
+ within
38
+ } from "./chunk-36LESPFG.js";
24
39
  import {
25
40
  $ZodObject,
26
41
  $ZodType,
27
42
  $constructor,
28
43
  NEVER,
29
44
  ZodIssueCode,
45
+ __commonJS,
30
46
  __require,
47
+ __toESM,
31
48
  _enum,
32
49
  _null,
33
50
  any,
@@ -36,8 +53,10 @@ import {
36
53
  clone,
37
54
  coerce_exports,
38
55
  custom,
56
+ define_EXTENSION_BUILD_INFO_default,
39
57
  discriminatedUnion,
40
58
  external_exports,
59
+ init_define_EXTENSION_BUILD_INFO,
41
60
  installLazyProp,
42
61
  intersection,
43
62
  iso_exports,
@@ -60,9 +79,522 @@ import {
60
79
  union,
61
80
  unknown,
62
81
  url
63
- } from "./chunk-5TX3SEV2.js";
82
+ } from "./chunk-FT2Y2DFZ.js";
83
+
84
+ // node_modules/semver/internal/debug.js
85
+ var require_debug = __commonJS({
86
+ "node_modules/semver/internal/debug.js"(exports, module) {
87
+ "use strict";
88
+ init_define_EXTENSION_BUILD_INFO();
89
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
90
+ };
91
+ module.exports = debug;
92
+ }
93
+ });
94
+
95
+ // node_modules/semver/internal/constants.js
96
+ var require_constants = __commonJS({
97
+ "node_modules/semver/internal/constants.js"(exports, module) {
98
+ "use strict";
99
+ init_define_EXTENSION_BUILD_INFO();
100
+ var SEMVER_SPEC_VERSION = "2.0.0";
101
+ var MAX_LENGTH = 256;
102
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
103
+ 9007199254740991;
104
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
105
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
106
+ var WHITESPACE_CHARACTERS = [
107
+ " ",
108
+ "\n",
109
+ "\v",
110
+ "\f",
111
+ "\r",
112
+ " ",
113
+ "\xA0",
114
+ "\u1680",
115
+ "\u2000",
116
+ "\u2001",
117
+ "\u2002",
118
+ "\u2003",
119
+ "\u2004",
120
+ "\u2005",
121
+ "\u2006",
122
+ "\u2007",
123
+ "\u2008",
124
+ "\u2009",
125
+ "\u200A",
126
+ "\u2028",
127
+ "\u2029",
128
+ "\u202F",
129
+ "\u205F",
130
+ "\u3000",
131
+ "\uFEFF"
132
+ ];
133
+ var RELEASE_TYPES = [
134
+ "major",
135
+ "premajor",
136
+ "minor",
137
+ "preminor",
138
+ "patch",
139
+ "prepatch",
140
+ "prerelease"
141
+ ];
142
+ module.exports = {
143
+ MAX_LENGTH,
144
+ MAX_SAFE_COMPONENT_LENGTH,
145
+ MAX_SAFE_BUILD_LENGTH,
146
+ MAX_SAFE_INTEGER,
147
+ WHITESPACE_CHARACTERS,
148
+ RELEASE_TYPES,
149
+ SEMVER_SPEC_VERSION,
150
+ FLAG_INCLUDE_PRERELEASE: 1,
151
+ FLAG_LOOSE: 2
152
+ };
153
+ }
154
+ });
155
+
156
+ // node_modules/semver/internal/re.js
157
+ var require_re = __commonJS({
158
+ "node_modules/semver/internal/re.js"(exports, module) {
159
+ "use strict";
160
+ init_define_EXTENSION_BUILD_INFO();
161
+ var {
162
+ MAX_SAFE_COMPONENT_LENGTH,
163
+ MAX_SAFE_BUILD_LENGTH,
164
+ MAX_LENGTH
165
+ } = require_constants();
166
+ var debug = require_debug();
167
+ exports = module.exports = {};
168
+ var re = exports.re = [];
169
+ var safeRe = exports.safeRe = [];
170
+ var src = exports.src = [];
171
+ var safeSrc = exports.safeSrc = [];
172
+ var t = exports.t = {};
173
+ var R2 = 0;
174
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
175
+ var safeRegexReplacements = [
176
+ ["\\s", 1],
177
+ ["\\d", MAX_LENGTH],
178
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
179
+ ];
180
+ var makeSafeRegex = (value) => {
181
+ for (const [token, max] of safeRegexReplacements) {
182
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
183
+ }
184
+ return value;
185
+ };
186
+ var createToken = (name, value, isGlobal) => {
187
+ const safe = makeSafeRegex(value);
188
+ const index = R2++;
189
+ debug(name, index, value);
190
+ t[name] = index;
191
+ src[index] = value;
192
+ safeSrc[index] = safe;
193
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
194
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
195
+ };
196
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
197
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
198
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
199
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
200
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
201
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
202
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
203
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
204
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
205
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
206
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
207
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
208
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
209
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
210
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
211
+ createToken("GTLT", "((?:<|>)?=?)");
212
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
213
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
214
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
215
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
216
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
217
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
218
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
219
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
220
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
221
+ createToken("COERCERTL", src[t.COERCE], true);
222
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
223
+ createToken("LONETILDE", "(?:~>?)");
224
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
225
+ exports.tildeTrimReplace = "$1~";
226
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
227
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
228
+ createToken("LONECARET", "(?:\\^)");
229
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
230
+ exports.caretTrimReplace = "$1^";
231
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
232
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
233
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
234
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
235
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
236
+ exports.comparatorTrimReplace = "$1$2$3";
237
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
238
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
239
+ createToken("STAR", "(<|>)?=?\\s*\\*");
240
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
241
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
242
+ }
243
+ });
244
+
245
+ // node_modules/semver/internal/parse-options.js
246
+ var require_parse_options = __commonJS({
247
+ "node_modules/semver/internal/parse-options.js"(exports, module) {
248
+ "use strict";
249
+ init_define_EXTENSION_BUILD_INFO();
250
+ var looseOption = Object.freeze({ loose: true });
251
+ var emptyOpts = Object.freeze({});
252
+ var parseOptions = (options2) => {
253
+ if (!options2) {
254
+ return emptyOpts;
255
+ }
256
+ if (typeof options2 !== "object") {
257
+ return looseOption;
258
+ }
259
+ return options2;
260
+ };
261
+ module.exports = parseOptions;
262
+ }
263
+ });
264
+
265
+ // node_modules/semver/internal/identifiers.js
266
+ var require_identifiers = __commonJS({
267
+ "node_modules/semver/internal/identifiers.js"(exports, module) {
268
+ "use strict";
269
+ init_define_EXTENSION_BUILD_INFO();
270
+ var numeric = /^[0-9]+$/;
271
+ var compareIdentifiers = (a, b) => {
272
+ if (typeof a === "number" && typeof b === "number") {
273
+ return a === b ? 0 : a < b ? -1 : 1;
274
+ }
275
+ const anum = numeric.test(a);
276
+ const bnum = numeric.test(b);
277
+ if (anum && bnum) {
278
+ a = +a;
279
+ b = +b;
280
+ }
281
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
282
+ };
283
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
284
+ module.exports = {
285
+ compareIdentifiers,
286
+ rcompareIdentifiers
287
+ };
288
+ }
289
+ });
290
+
291
+ // node_modules/semver/classes/semver.js
292
+ var require_semver = __commonJS({
293
+ "node_modules/semver/classes/semver.js"(exports, module) {
294
+ "use strict";
295
+ init_define_EXTENSION_BUILD_INFO();
296
+ var debug = require_debug();
297
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
298
+ var { safeRe: re, t } = require_re();
299
+ var parseOptions = require_parse_options();
300
+ var { compareIdentifiers } = require_identifiers();
301
+ var isPrereleaseIdentifier = (prerelease, identifier) => {
302
+ const identifiers = identifier.split(".");
303
+ if (identifiers.length > prerelease.length) {
304
+ return false;
305
+ }
306
+ for (let i = 0; i < identifiers.length; i++) {
307
+ if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {
308
+ return false;
309
+ }
310
+ }
311
+ return true;
312
+ };
313
+ var SemVer = class _SemVer {
314
+ constructor(version, options2) {
315
+ options2 = parseOptions(options2);
316
+ if (version instanceof _SemVer) {
317
+ if (version.loose === !!options2.loose && version.includePrerelease === !!options2.includePrerelease) {
318
+ return version;
319
+ } else {
320
+ version = version.version;
321
+ }
322
+ } else if (typeof version !== "string") {
323
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
324
+ }
325
+ if (version.length > MAX_LENGTH) {
326
+ throw new TypeError(
327
+ `version is longer than ${MAX_LENGTH} characters`
328
+ );
329
+ }
330
+ debug("SemVer", version, options2);
331
+ this.options = options2;
332
+ this.loose = !!options2.loose;
333
+ this.includePrerelease = !!options2.includePrerelease;
334
+ const m2 = version.trim().match(options2.loose ? re[t.LOOSE] : re[t.FULL]);
335
+ if (!m2) {
336
+ throw new TypeError(`Invalid Version: ${version}`);
337
+ }
338
+ this.raw = version;
339
+ this.major = +m2[1];
340
+ this.minor = +m2[2];
341
+ this.patch = +m2[3];
342
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
343
+ throw new TypeError("Invalid major version");
344
+ }
345
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
346
+ throw new TypeError("Invalid minor version");
347
+ }
348
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
349
+ throw new TypeError("Invalid patch version");
350
+ }
351
+ if (!m2[4]) {
352
+ this.prerelease = [];
353
+ } else {
354
+ this.prerelease = m2[4].split(".").map((id) => {
355
+ if (/^[0-9]+$/.test(id)) {
356
+ const num = +id;
357
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
358
+ return num;
359
+ }
360
+ }
361
+ return id;
362
+ });
363
+ }
364
+ this.build = m2[5] ? m2[5].split(".") : [];
365
+ this.format();
366
+ }
367
+ format() {
368
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
369
+ if (this.prerelease.length) {
370
+ this.version += `-${this.prerelease.join(".")}`;
371
+ }
372
+ return this.version;
373
+ }
374
+ toString() {
375
+ return this.version;
376
+ }
377
+ compare(other) {
378
+ debug("SemVer.compare", this.version, this.options, other);
379
+ if (!(other instanceof _SemVer)) {
380
+ if (typeof other === "string" && other === this.version) {
381
+ return 0;
382
+ }
383
+ other = new _SemVer(other, this.options);
384
+ }
385
+ if (other.version === this.version) {
386
+ return 0;
387
+ }
388
+ return this.compareMain(other) || this.comparePre(other);
389
+ }
390
+ compareMain(other) {
391
+ if (!(other instanceof _SemVer)) {
392
+ other = new _SemVer(other, this.options);
393
+ }
394
+ if (this.major < other.major) {
395
+ return -1;
396
+ }
397
+ if (this.major > other.major) {
398
+ return 1;
399
+ }
400
+ if (this.minor < other.minor) {
401
+ return -1;
402
+ }
403
+ if (this.minor > other.minor) {
404
+ return 1;
405
+ }
406
+ if (this.patch < other.patch) {
407
+ return -1;
408
+ }
409
+ if (this.patch > other.patch) {
410
+ return 1;
411
+ }
412
+ return 0;
413
+ }
414
+ comparePre(other) {
415
+ if (!(other instanceof _SemVer)) {
416
+ other = new _SemVer(other, this.options);
417
+ }
418
+ if (this.prerelease.length && !other.prerelease.length) {
419
+ return -1;
420
+ } else if (!this.prerelease.length && other.prerelease.length) {
421
+ return 1;
422
+ } else if (!this.prerelease.length && !other.prerelease.length) {
423
+ return 0;
424
+ }
425
+ let i = 0;
426
+ do {
427
+ const a = this.prerelease[i];
428
+ const b = other.prerelease[i];
429
+ debug("prerelease compare", i, a, b);
430
+ if (a === void 0 && b === void 0) {
431
+ return 0;
432
+ } else if (b === void 0) {
433
+ return 1;
434
+ } else if (a === void 0) {
435
+ return -1;
436
+ } else if (a === b) {
437
+ continue;
438
+ } else {
439
+ return compareIdentifiers(a, b);
440
+ }
441
+ } while (++i);
442
+ }
443
+ compareBuild(other) {
444
+ if (!(other instanceof _SemVer)) {
445
+ other = new _SemVer(other, this.options);
446
+ }
447
+ let i = 0;
448
+ do {
449
+ const a = this.build[i];
450
+ const b = other.build[i];
451
+ debug("build compare", i, a, b);
452
+ if (a === void 0 && b === void 0) {
453
+ return 0;
454
+ } else if (b === void 0) {
455
+ return 1;
456
+ } else if (a === void 0) {
457
+ return -1;
458
+ } else if (a === b) {
459
+ continue;
460
+ } else {
461
+ return compareIdentifiers(a, b);
462
+ }
463
+ } while (++i);
464
+ }
465
+ // preminor will bump the version up to the next minor release, and immediately
466
+ // down to pre-release. premajor and prepatch work the same way.
467
+ inc(release, identifier, identifierBase) {
468
+ if (release.startsWith("pre")) {
469
+ if (!identifier && identifierBase === false) {
470
+ throw new Error("invalid increment argument: identifier is empty");
471
+ }
472
+ if (identifier) {
473
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
474
+ if (!match || match[1] !== identifier) {
475
+ throw new Error(`invalid identifier: ${identifier}`);
476
+ }
477
+ }
478
+ }
479
+ switch (release) {
480
+ case "premajor":
481
+ this.prerelease.length = 0;
482
+ this.patch = 0;
483
+ this.minor = 0;
484
+ this.major++;
485
+ this.inc("pre", identifier, identifierBase);
486
+ break;
487
+ case "preminor":
488
+ this.prerelease.length = 0;
489
+ this.patch = 0;
490
+ this.minor++;
491
+ this.inc("pre", identifier, identifierBase);
492
+ break;
493
+ case "prepatch":
494
+ this.prerelease.length = 0;
495
+ this.inc("patch", identifier, identifierBase);
496
+ this.inc("pre", identifier, identifierBase);
497
+ break;
498
+ // If the input is a non-prerelease version, this acts the same as
499
+ // prepatch.
500
+ case "prerelease":
501
+ if (this.prerelease.length === 0) {
502
+ this.inc("patch", identifier, identifierBase);
503
+ }
504
+ this.inc("pre", identifier, identifierBase);
505
+ break;
506
+ case "release":
507
+ if (this.prerelease.length === 0) {
508
+ throw new Error(`version ${this.raw} is not a prerelease`);
509
+ }
510
+ this.prerelease.length = 0;
511
+ break;
512
+ case "major":
513
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
514
+ this.major++;
515
+ }
516
+ this.minor = 0;
517
+ this.patch = 0;
518
+ this.prerelease = [];
519
+ break;
520
+ case "minor":
521
+ if (this.patch !== 0 || this.prerelease.length === 0) {
522
+ this.minor++;
523
+ }
524
+ this.patch = 0;
525
+ this.prerelease = [];
526
+ break;
527
+ case "patch":
528
+ if (this.prerelease.length === 0) {
529
+ this.patch++;
530
+ }
531
+ this.prerelease = [];
532
+ break;
533
+ // This probably shouldn't be used publicly.
534
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
535
+ case "pre": {
536
+ const base = Number(identifierBase) ? 1 : 0;
537
+ if (this.prerelease.length === 0) {
538
+ this.prerelease = [base];
539
+ } else {
540
+ let i = this.prerelease.length;
541
+ while (--i >= 0) {
542
+ if (typeof this.prerelease[i] === "number") {
543
+ this.prerelease[i]++;
544
+ i = -2;
545
+ }
546
+ }
547
+ if (i === -1) {
548
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
549
+ throw new Error("invalid increment argument: identifier already exists");
550
+ }
551
+ this.prerelease.push(base);
552
+ }
553
+ }
554
+ if (identifier) {
555
+ let prerelease = [identifier, base];
556
+ if (identifierBase === false) {
557
+ prerelease = [identifier];
558
+ }
559
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
560
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
561
+ if (isNaN(prereleaseBase)) {
562
+ this.prerelease = prerelease;
563
+ }
564
+ } else {
565
+ this.prerelease = prerelease;
566
+ }
567
+ }
568
+ break;
569
+ }
570
+ default:
571
+ throw new Error(`invalid increment argument: ${release}`);
572
+ }
573
+ this.raw = this.format();
574
+ if (this.build.length) {
575
+ this.raw += `+${this.build.join(".")}`;
576
+ }
577
+ return this;
578
+ }
579
+ };
580
+ module.exports = SemVer;
581
+ }
582
+ });
583
+
584
+ // node_modules/semver/functions/compare.js
585
+ var require_compare = __commonJS({
586
+ "node_modules/semver/functions/compare.js"(exports, module) {
587
+ "use strict";
588
+ init_define_EXTENSION_BUILD_INFO();
589
+ var SemVer = require_semver();
590
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
591
+ module.exports = compare;
592
+ }
593
+ });
64
594
 
65
595
  // src/service/platform/panel/host-context.ts
596
+ init_define_EXTENSION_BUILD_INFO();
597
+ import { realpath } from "node:fs/promises";
66
598
  import { isAbsolute } from "node:path";
67
599
  import { fileURLToPath } from "node:url";
68
600
  var codexContextCapability = {
@@ -74,27 +606,52 @@ async function withHostRepository(c, args, meta2) {
74
606
  const directory = args.host_directory ?? state?.sandboxCwd;
75
607
  if (typeof directory !== "string" || directory.length > 4096) return args;
76
608
  try {
77
- const cwd = fileURLToPath(directory);
78
- if (!isAbsolute(cwd)) return args;
79
- const root = await gitRepositoryRoot(cwd);
80
- const repository = c.projects ? await c.projects.resolve(root) : await c.workspaces.repository(root);
609
+ const candidate = await hostProjectCandidate(c, directory);
610
+ if (!candidate) return args;
611
+ const repository = c.projects ? await c.projects.resolve(candidate.repository) : await c.workspaces.repository(candidate.repository);
81
612
  return { ...args, repository };
82
613
  } catch {
83
614
  return args;
84
615
  }
85
616
  }
86
- async function hostProjectCandidate(directory) {
617
+ var isGitRoot = (candidate) => candidate.git === "ready" || candidate.git === "no_commits";
618
+ var permissionDenied = (error) => /Operation not permitted|Permission denied/.test(
619
+ String(error.stderr)
620
+ );
621
+ async function hostProjectCandidate(c, directory) {
87
622
  if (!directory) return void 0;
88
623
  try {
89
624
  const cwd = fileURLToPath(directory);
90
625
  if (!isAbsolute(cwd)) return void 0;
91
- return await gitRepositoryRoot(cwd);
626
+ let root;
627
+ try {
628
+ root = await gitWorkTreeRoot(cwd);
629
+ } catch (error) {
630
+ if (permissionDenied(error)) return { repository: cwd };
631
+ throw error;
632
+ }
633
+ if (root) {
634
+ return {
635
+ repository: root,
636
+ ...await gitState(root).then(
637
+ (git) => ({ git }),
638
+ () => ({})
639
+ )
640
+ };
641
+ }
642
+ const actual = await realpath(cwd);
643
+ const registered = c.projects?.list().filter(
644
+ (project) => project.kind === "repository" && within(project.repository, actual)
645
+ ).map((project) => project.repository).sort((a, b) => b.length - a.length)[0];
646
+ if (!registered) await assertPlainFolderAllowed(actual);
647
+ return { repository: registered ?? actual, git: "none" };
92
648
  } catch {
93
649
  return void 0;
94
650
  }
95
651
  }
96
652
 
97
653
  // src/service/platform/server/product-glyph.ts
654
+ init_define_EXTENSION_BUILD_INFO();
98
655
  var glyphs = [
99
656
  { theme: "light", file: "brand-glyph-black.svg" },
100
657
  { theme: "dark", file: "brand-glyph-white.svg" }
@@ -106,7 +663,29 @@ var productGlyphIcons = glyphs.map(({ theme, file }) => ({
106
663
  theme
107
664
  }));
108
665
 
666
+ // src/service/platform/panel/panel.ts
667
+ init_define_EXTENSION_BUILD_INFO();
668
+
669
+ // node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js
670
+ init_define_EXTENSION_BUILD_INFO();
671
+
672
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
673
+ init_define_EXTENSION_BUILD_INFO();
674
+
675
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
676
+ init_define_EXTENSION_BUILD_INFO();
677
+
678
+ // node_modules/zod/v3/errors.js
679
+ init_define_EXTENSION_BUILD_INFO();
680
+
681
+ // node_modules/zod/v3/locales/en.js
682
+ init_define_EXTENSION_BUILD_INFO();
683
+
684
+ // node_modules/zod/v3/ZodError.js
685
+ init_define_EXTENSION_BUILD_INFO();
686
+
109
687
  // node_modules/zod/v3/helpers/util.js
688
+ init_define_EXTENSION_BUILD_INFO();
110
689
  var util;
111
690
  (function(util2) {
112
691
  util2.assertEqual = (_2) => {
@@ -479,6 +1058,7 @@ function getErrorMap() {
479
1058
  }
480
1059
 
481
1060
  // node_modules/zod/v3/helpers/parseUtil.js
1061
+ init_define_EXTENSION_BUILD_INFO();
482
1062
  var makeIssue = (params) => {
483
1063
  const { data, path, errorMaps, issueData } = params;
484
1064
  const fullPath = [...path, ...issueData.path || []];
@@ -587,7 +1167,11 @@ var isDirty = (x) => x.status === "dirty";
587
1167
  var isValid = (x) => x.status === "valid";
588
1168
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
589
1169
 
1170
+ // node_modules/zod/v3/types.js
1171
+ init_define_EXTENSION_BUILD_INFO();
1172
+
590
1173
  // node_modules/zod/v3/helpers/errorUtil.js
1174
+ init_define_EXTENSION_BUILD_INFO();
591
1175
  var errorUtil;
592
1176
  (function(errorUtil2) {
593
1177
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
@@ -1367,48 +1951,48 @@ var ZodString = class _ZodString extends ZodType {
1367
1951
  ...errorUtil.errToObj(message)
1368
1952
  });
1369
1953
  }
1370
- jwt(options3) {
1371
- return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options3) });
1954
+ jwt(options2) {
1955
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options2) });
1372
1956
  }
1373
- ip(options3) {
1374
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options3) });
1957
+ ip(options2) {
1958
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options2) });
1375
1959
  }
1376
- cidr(options3) {
1377
- return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options3) });
1960
+ cidr(options2) {
1961
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options2) });
1378
1962
  }
1379
- datetime(options3) {
1380
- if (typeof options3 === "string") {
1963
+ datetime(options2) {
1964
+ if (typeof options2 === "string") {
1381
1965
  return this._addCheck({
1382
1966
  kind: "datetime",
1383
1967
  precision: null,
1384
1968
  offset: false,
1385
1969
  local: false,
1386
- message: options3
1970
+ message: options2
1387
1971
  });
1388
1972
  }
1389
1973
  return this._addCheck({
1390
1974
  kind: "datetime",
1391
- precision: typeof options3?.precision === "undefined" ? null : options3?.precision,
1392
- offset: options3?.offset ?? false,
1393
- local: options3?.local ?? false,
1394
- ...errorUtil.errToObj(options3?.message)
1975
+ precision: typeof options2?.precision === "undefined" ? null : options2?.precision,
1976
+ offset: options2?.offset ?? false,
1977
+ local: options2?.local ?? false,
1978
+ ...errorUtil.errToObj(options2?.message)
1395
1979
  });
1396
1980
  }
1397
1981
  date(message) {
1398
1982
  return this._addCheck({ kind: "date", message });
1399
1983
  }
1400
- time(options3) {
1401
- if (typeof options3 === "string") {
1984
+ time(options2) {
1985
+ if (typeof options2 === "string") {
1402
1986
  return this._addCheck({
1403
1987
  kind: "time",
1404
1988
  precision: null,
1405
- message: options3
1989
+ message: options2
1406
1990
  });
1407
1991
  }
1408
1992
  return this._addCheck({
1409
1993
  kind: "time",
1410
- precision: typeof options3?.precision === "undefined" ? null : options3?.precision,
1411
- ...errorUtil.errToObj(options3?.message)
1994
+ precision: typeof options2?.precision === "undefined" ? null : options2?.precision,
1995
+ ...errorUtil.errToObj(options2?.message)
1412
1996
  });
1413
1997
  }
1414
1998
  duration(message) {
@@ -1421,12 +2005,12 @@ var ZodString = class _ZodString extends ZodType {
1421
2005
  ...errorUtil.errToObj(message)
1422
2006
  });
1423
2007
  }
1424
- includes(value, options3) {
2008
+ includes(value, options2) {
1425
2009
  return this._addCheck({
1426
2010
  kind: "includes",
1427
2011
  value,
1428
- position: options3?.position,
1429
- ...errorUtil.errToObj(options3?.message)
2012
+ position: options2?.position,
2013
+ ...errorUtil.errToObj(options2?.message)
1430
2014
  });
1431
2015
  }
1432
2016
  startsWith(value, message) {
@@ -2710,7 +3294,7 @@ ZodObject.lazycreate = (shape, params) => {
2710
3294
  var ZodUnion = class extends ZodType {
2711
3295
  _parse(input) {
2712
3296
  const { ctx } = this._processInputParams(input);
2713
- const options3 = this._def.options;
3297
+ const options2 = this._def.options;
2714
3298
  function handleResults(results) {
2715
3299
  for (const result of results) {
2716
3300
  if (result.result.status === "valid") {
@@ -2731,7 +3315,7 @@ var ZodUnion = class extends ZodType {
2731
3315
  return INVALID;
2732
3316
  }
2733
3317
  if (ctx.common.async) {
2734
- return Promise.all(options3.map(async (option) => {
3318
+ return Promise.all(options2.map(async (option) => {
2735
3319
  const childCtx = {
2736
3320
  ...ctx,
2737
3321
  common: {
@@ -2752,7 +3336,7 @@ var ZodUnion = class extends ZodType {
2752
3336
  } else {
2753
3337
  let dirty = void 0;
2754
3338
  const issues = [];
2755
- for (const option of options3) {
3339
+ for (const option of options2) {
2756
3340
  const childCtx = {
2757
3341
  ...ctx,
2758
3342
  common: {
@@ -2882,9 +3466,9 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2882
3466
  * @param types an array of object schemas
2883
3467
  * @param params
2884
3468
  */
2885
- static create(discriminator, options3, params) {
3469
+ static create(discriminator, options2, params) {
2886
3470
  const optionsMap = /* @__PURE__ */ new Map();
2887
- for (const type of options3) {
3471
+ for (const type of options2) {
2888
3472
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2889
3473
  if (!discriminatorValues.length) {
2890
3474
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
@@ -2899,7 +3483,7 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2899
3483
  return new _ZodDiscriminatedUnion({
2900
3484
  typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2901
3485
  discriminator,
2902
- options: options3,
3486
+ options: options2,
2903
3487
  optionsMap,
2904
3488
  ...processCreateParams(params)
2905
3489
  });
@@ -4001,7 +4585,14 @@ var nullableType = ZodNullable.create;
4001
4585
  var preprocessType = ZodEffects.createWithPreprocess;
4002
4586
  var pipelineType = ZodPipeline.create;
4003
4587
 
4588
+ // node_modules/zod/v4/mini/external.js
4589
+ init_define_EXTENSION_BUILD_INFO();
4590
+
4591
+ // node_modules/zod/v4/mini/parse.js
4592
+ init_define_EXTENSION_BUILD_INFO();
4593
+
4004
4594
  // node_modules/zod/v4/mini/schemas.js
4595
+ init_define_EXTENSION_BUILD_INFO();
4005
4596
  var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
4006
4597
  if (!inst._zod)
4007
4598
  throw new Error("Uninitialized schema in ZodMiniType.");
@@ -4228,6 +4819,7 @@ function getLiteralValue(schema) {
4228
4819
  }
4229
4820
 
4230
4821
  // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
4822
+ init_define_EXTENSION_BUILD_INFO();
4231
4823
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
4232
4824
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
4233
4825
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -5759,11 +6351,19 @@ var UrlElicitationRequiredError = class extends McpError {
5759
6351
  };
5760
6352
 
5761
6353
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
6354
+ init_define_EXTENSION_BUILD_INFO();
5762
6355
  function isTerminal(status) {
5763
6356
  return status === "completed" || status === "failed" || status === "cancelled";
5764
6357
  }
5765
6358
 
6359
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
6360
+ init_define_EXTENSION_BUILD_INFO();
6361
+
6362
+ // node_modules/zod-to-json-schema/dist/esm/index.js
6363
+ init_define_EXTENSION_BUILD_INFO();
6364
+
5766
6365
  // node_modules/zod-to-json-schema/dist/esm/Options.js
6366
+ init_define_EXTENSION_BUILD_INFO();
5767
6367
  var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
5768
6368
  var defaultOptions = {
5769
6369
  name: void 0,
@@ -5789,17 +6389,18 @@ var defaultOptions = {
5789
6389
  nameStrategy: "ref",
5790
6390
  openAiAnyTypeName: "OpenAiAnyType"
5791
6391
  };
5792
- var getDefaultOptions = (options3) => typeof options3 === "string" ? {
6392
+ var getDefaultOptions = (options2) => typeof options2 === "string" ? {
5793
6393
  ...defaultOptions,
5794
- name: options3
6394
+ name: options2
5795
6395
  } : {
5796
6396
  ...defaultOptions,
5797
- ...options3
6397
+ ...options2
5798
6398
  };
5799
6399
 
5800
6400
  // node_modules/zod-to-json-schema/dist/esm/Refs.js
5801
- var getRefs = (options3) => {
5802
- const _options = getDefaultOptions(options3);
6401
+ init_define_EXTENSION_BUILD_INFO();
6402
+ var getRefs = (options2) => {
6403
+ const _options = getDefaultOptions(options2);
5803
6404
  const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
5804
6405
  return {
5805
6406
  ..._options,
@@ -5819,6 +6420,7 @@ var getRefs = (options3) => {
5819
6420
  };
5820
6421
 
5821
6422
  // node_modules/zod-to-json-schema/dist/esm/errorMessages.js
6423
+ init_define_EXTENSION_BUILD_INFO();
5822
6424
  function addErrorMessage(res, key, errorMessage, refs) {
5823
6425
  if (!refs?.errorMessages)
5824
6426
  return;
@@ -5835,6 +6437,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
5835
6437
  }
5836
6438
 
5837
6439
  // node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
6440
+ init_define_EXTENSION_BUILD_INFO();
5838
6441
  var getRelativePath = (pathA, pathB) => {
5839
6442
  let i = 0;
5840
6443
  for (; i < pathA.length && i < pathB.length; i++) {
@@ -5844,7 +6447,14 @@ var getRelativePath = (pathA, pathB) => {
5844
6447
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
5845
6448
  };
5846
6449
 
6450
+ // node_modules/zod-to-json-schema/dist/esm/parseDef.js
6451
+ init_define_EXTENSION_BUILD_INFO();
6452
+
6453
+ // node_modules/zod-to-json-schema/dist/esm/selectParser.js
6454
+ init_define_EXTENSION_BUILD_INFO();
6455
+
5847
6456
  // node_modules/zod-to-json-schema/dist/esm/parsers/any.js
6457
+ init_define_EXTENSION_BUILD_INFO();
5848
6458
  function parseAnyDef(refs) {
5849
6459
  if (refs.target !== "openAi") {
5850
6460
  return {};
@@ -5861,6 +6471,7 @@ function parseAnyDef(refs) {
5861
6471
  }
5862
6472
 
5863
6473
  // node_modules/zod-to-json-schema/dist/esm/parsers/array.js
6474
+ init_define_EXTENSION_BUILD_INFO();
5864
6475
  function parseArrayDef(def, refs) {
5865
6476
  const res = {
5866
6477
  type: "array"
@@ -5885,6 +6496,7 @@ function parseArrayDef(def, refs) {
5885
6496
  }
5886
6497
 
5887
6498
  // node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
6499
+ init_define_EXTENSION_BUILD_INFO();
5888
6500
  function parseBigintDef(def, refs) {
5889
6501
  const res = {
5890
6502
  type: "integer",
@@ -5931,6 +6543,7 @@ function parseBigintDef(def, refs) {
5931
6543
  }
5932
6544
 
5933
6545
  // node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
6546
+ init_define_EXTENSION_BUILD_INFO();
5934
6547
  function parseBooleanDef() {
5935
6548
  return {
5936
6549
  type: "boolean"
@@ -5938,16 +6551,19 @@ function parseBooleanDef() {
5938
6551
  }
5939
6552
 
5940
6553
  // node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
6554
+ init_define_EXTENSION_BUILD_INFO();
5941
6555
  function parseBrandedDef(_def, refs) {
5942
6556
  return parseDef(_def.type._def, refs);
5943
6557
  }
5944
6558
 
5945
6559
  // node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
6560
+ init_define_EXTENSION_BUILD_INFO();
5946
6561
  var parseCatchDef = (def, refs) => {
5947
6562
  return parseDef(def.innerType._def, refs);
5948
6563
  };
5949
6564
 
5950
6565
  // node_modules/zod-to-json-schema/dist/esm/parsers/date.js
6566
+ init_define_EXTENSION_BUILD_INFO();
5951
6567
  function parseDateDef(def, refs, overrideDateStrategy) {
5952
6568
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
5953
6569
  if (Array.isArray(strategy)) {
@@ -6007,6 +6623,7 @@ var integerDateParser = (def, refs) => {
6007
6623
  };
6008
6624
 
6009
6625
  // node_modules/zod-to-json-schema/dist/esm/parsers/default.js
6626
+ init_define_EXTENSION_BUILD_INFO();
6010
6627
  function parseDefaultDef(_def, refs) {
6011
6628
  return {
6012
6629
  ...parseDef(_def.innerType._def, refs),
@@ -6015,11 +6632,13 @@ function parseDefaultDef(_def, refs) {
6015
6632
  }
6016
6633
 
6017
6634
  // node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
6635
+ init_define_EXTENSION_BUILD_INFO();
6018
6636
  function parseEffectsDef(_def, refs) {
6019
6637
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
6020
6638
  }
6021
6639
 
6022
6640
  // node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
6641
+ init_define_EXTENSION_BUILD_INFO();
6023
6642
  function parseEnumDef(def) {
6024
6643
  return {
6025
6644
  type: "string",
@@ -6028,6 +6647,7 @@ function parseEnumDef(def) {
6028
6647
  }
6029
6648
 
6030
6649
  // node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
6650
+ init_define_EXTENSION_BUILD_INFO();
6031
6651
  var isJsonSchema7AllOfType = (type) => {
6032
6652
  if ("type" in type && type.type === "string")
6033
6653
  return false;
@@ -6070,6 +6690,7 @@ function parseIntersectionDef(def, refs) {
6070
6690
  }
6071
6691
 
6072
6692
  // node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
6693
+ init_define_EXTENSION_BUILD_INFO();
6073
6694
  function parseLiteralDef(def, refs) {
6074
6695
  const parsedType = typeof def.value;
6075
6696
  if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
@@ -6089,7 +6710,14 @@ function parseLiteralDef(def, refs) {
6089
6710
  };
6090
6711
  }
6091
6712
 
6713
+ // node_modules/zod-to-json-schema/dist/esm/parsers/map.js
6714
+ init_define_EXTENSION_BUILD_INFO();
6715
+
6716
+ // node_modules/zod-to-json-schema/dist/esm/parsers/record.js
6717
+ init_define_EXTENSION_BUILD_INFO();
6718
+
6092
6719
  // node_modules/zod-to-json-schema/dist/esm/parsers/string.js
6720
+ init_define_EXTENSION_BUILD_INFO();
6093
6721
  var emojiRegex2 = void 0;
6094
6722
  var zodPatterns = {
6095
6723
  /**
@@ -6492,6 +7120,7 @@ function parseMapDef(def, refs) {
6492
7120
  }
6493
7121
 
6494
7122
  // node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
7123
+ init_define_EXTENSION_BUILD_INFO();
6495
7124
  function parseNativeEnumDef(def) {
6496
7125
  const object3 = def.values;
6497
7126
  const actualKeys = Object.keys(def.values).filter((key) => {
@@ -6506,6 +7135,7 @@ function parseNativeEnumDef(def) {
6506
7135
  }
6507
7136
 
6508
7137
  // node_modules/zod-to-json-schema/dist/esm/parsers/never.js
7138
+ init_define_EXTENSION_BUILD_INFO();
6509
7139
  function parseNeverDef(refs) {
6510
7140
  return refs.target === "openAi" ? void 0 : {
6511
7141
  not: parseAnyDef({
@@ -6516,6 +7146,7 @@ function parseNeverDef(refs) {
6516
7146
  }
6517
7147
 
6518
7148
  // node_modules/zod-to-json-schema/dist/esm/parsers/null.js
7149
+ init_define_EXTENSION_BUILD_INFO();
6519
7150
  function parseNullDef(refs) {
6520
7151
  return refs.target === "openApi3" ? {
6521
7152
  enum: ["null"],
@@ -6525,7 +7156,11 @@ function parseNullDef(refs) {
6525
7156
  };
6526
7157
  }
6527
7158
 
7159
+ // node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
7160
+ init_define_EXTENSION_BUILD_INFO();
7161
+
6528
7162
  // node_modules/zod-to-json-schema/dist/esm/parsers/union.js
7163
+ init_define_EXTENSION_BUILD_INFO();
6529
7164
  var primitiveMappings = {
6530
7165
  ZodString: "string",
6531
7166
  ZodNumber: "number",
@@ -6536,17 +7171,17 @@ var primitiveMappings = {
6536
7171
  function parseUnionDef(def, refs) {
6537
7172
  if (refs.target === "openApi3")
6538
7173
  return asAnyOf(def, refs);
6539
- const options3 = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
6540
- if (options3.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
6541
- const types = options3.reduce((types2, x) => {
7174
+ const options2 = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
7175
+ if (options2.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
7176
+ const types = options2.reduce((types2, x) => {
6542
7177
  const type = primitiveMappings[x._def.typeName];
6543
7178
  return type && !types2.includes(type) ? [...types2, type] : types2;
6544
7179
  }, []);
6545
7180
  return {
6546
7181
  type: types.length > 1 ? types : types[0]
6547
7182
  };
6548
- } else if (options3.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
6549
- const types = options3.reduce((acc, x) => {
7183
+ } else if (options2.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
7184
+ const types = options2.reduce((acc, x) => {
6550
7185
  const type = typeof x._def.value;
6551
7186
  switch (type) {
6552
7187
  case "string":
@@ -6565,19 +7200,19 @@ function parseUnionDef(def, refs) {
6565
7200
  return acc;
6566
7201
  }
6567
7202
  }, []);
6568
- if (types.length === options3.length) {
7203
+ if (types.length === options2.length) {
6569
7204
  const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
6570
7205
  return {
6571
7206
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
6572
- enum: options3.reduce((acc, x) => {
7207
+ enum: options2.reduce((acc, x) => {
6573
7208
  return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
6574
7209
  }, [])
6575
7210
  };
6576
7211
  }
6577
- } else if (options3.every((x) => x._def.typeName === "ZodEnum")) {
7212
+ } else if (options2.every((x) => x._def.typeName === "ZodEnum")) {
6578
7213
  return {
6579
7214
  type: "string",
6580
- enum: options3.reduce((acc, x) => [
7215
+ enum: options2.reduce((acc, x) => [
6581
7216
  ...acc,
6582
7217
  ...x._def.values.filter((x2) => !acc.includes(x2))
6583
7218
  ], [])
@@ -6626,6 +7261,7 @@ function parseNullableDef(def, refs) {
6626
7261
  }
6627
7262
 
6628
7263
  // node_modules/zod-to-json-schema/dist/esm/parsers/number.js
7264
+ init_define_EXTENSION_BUILD_INFO();
6629
7265
  function parseNumberDef(def, refs) {
6630
7266
  const res = {
6631
7267
  type: "number"
@@ -6675,6 +7311,7 @@ function parseNumberDef(def, refs) {
6675
7311
  }
6676
7312
 
6677
7313
  // node_modules/zod-to-json-schema/dist/esm/parsers/object.js
7314
+ init_define_EXTENSION_BUILD_INFO();
6678
7315
  function parseObjectDef(def, refs) {
6679
7316
  const forceOptionalIntoNullable = refs.target === "openAi";
6680
7317
  const result = {
@@ -6745,6 +7382,7 @@ function safeIsOptional(schema) {
6745
7382
  }
6746
7383
 
6747
7384
  // node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
7385
+ init_define_EXTENSION_BUILD_INFO();
6748
7386
  var parseOptionalDef = (def, refs) => {
6749
7387
  if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
6750
7388
  return parseDef(def.innerType._def, refs);
@@ -6764,6 +7402,7 @@ var parseOptionalDef = (def, refs) => {
6764
7402
  };
6765
7403
 
6766
7404
  // node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
7405
+ init_define_EXTENSION_BUILD_INFO();
6767
7406
  var parsePipelineDef = (def, refs) => {
6768
7407
  if (refs.pipeStrategy === "input") {
6769
7408
  return parseDef(def.in._def, refs);
@@ -6784,11 +7423,13 @@ var parsePipelineDef = (def, refs) => {
6784
7423
  };
6785
7424
 
6786
7425
  // node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
7426
+ init_define_EXTENSION_BUILD_INFO();
6787
7427
  function parsePromiseDef(def, refs) {
6788
7428
  return parseDef(def.type._def, refs);
6789
7429
  }
6790
7430
 
6791
7431
  // node_modules/zod-to-json-schema/dist/esm/parsers/set.js
7432
+ init_define_EXTENSION_BUILD_INFO();
6792
7433
  function parseSetDef(def, refs) {
6793
7434
  const items = parseDef(def.valueType._def, {
6794
7435
  ...refs,
@@ -6809,6 +7450,7 @@ function parseSetDef(def, refs) {
6809
7450
  }
6810
7451
 
6811
7452
  // node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
7453
+ init_define_EXTENSION_BUILD_INFO();
6812
7454
  function parseTupleDef(def, refs) {
6813
7455
  if (def.rest) {
6814
7456
  return {
@@ -6837,6 +7479,7 @@ function parseTupleDef(def, refs) {
6837
7479
  }
6838
7480
 
6839
7481
  // node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
7482
+ init_define_EXTENSION_BUILD_INFO();
6840
7483
  function parseUndefinedDef(refs) {
6841
7484
  return {
6842
7485
  not: parseAnyDef(refs)
@@ -6844,11 +7487,13 @@ function parseUndefinedDef(refs) {
6844
7487
  }
6845
7488
 
6846
7489
  // node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
7490
+ init_define_EXTENSION_BUILD_INFO();
6847
7491
  function parseUnknownDef(refs) {
6848
7492
  return parseAnyDef(refs);
6849
7493
  }
6850
7494
 
6851
7495
  // node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
7496
+ init_define_EXTENSION_BUILD_INFO();
6852
7497
  var parseReadonlyDef = (def, refs) => {
6853
7498
  return parseDef(def.innerType._def, refs);
6854
7499
  };
@@ -6985,22 +7630,26 @@ var addMeta = (def, refs, jsonSchema) => {
6985
7630
  return jsonSchema;
6986
7631
  };
6987
7632
 
7633
+ // node_modules/zod-to-json-schema/dist/esm/parseTypes.js
7634
+ init_define_EXTENSION_BUILD_INFO();
7635
+
6988
7636
  // node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
6989
- var zodToJsonSchema = (schema, options3) => {
6990
- const refs = getRefs(options3);
6991
- let definitions2 = typeof options3 === "object" && options3.definitions ? Object.entries(options3.definitions).reduce((acc, [name2, schema2]) => ({
7637
+ init_define_EXTENSION_BUILD_INFO();
7638
+ var zodToJsonSchema = (schema, options2) => {
7639
+ const refs = getRefs(options2);
7640
+ let definitions2 = typeof options2 === "object" && options2.definitions ? Object.entries(options2.definitions).reduce((acc, [name2, schema2]) => ({
6992
7641
  ...acc,
6993
7642
  [name2]: parseDef(schema2._def, {
6994
7643
  ...refs,
6995
7644
  currentPath: [...refs.basePath, refs.definitionPath, name2]
6996
7645
  }, true) ?? parseAnyDef(refs)
6997
7646
  }), {}) : void 0;
6998
- const name = typeof options3 === "string" ? options3 : options3?.nameStrategy === "title" ? void 0 : options3?.name;
7647
+ const name = typeof options2 === "string" ? options2 : options2?.nameStrategy === "title" ? void 0 : options2?.name;
6999
7648
  const main = parseDef(schema._def, name === void 0 ? refs : {
7000
7649
  ...refs,
7001
7650
  currentPath: [...refs.basePath, refs.definitionPath, name]
7002
7651
  }, false) ?? parseAnyDef(refs);
7003
- const title = typeof options3 === "object" && options3.name !== void 0 && options3.nameStrategy === "title" ? options3.name : void 0;
7652
+ const title = typeof options2 === "object" && options2.name !== void 0 && options2.nameStrategy === "title" ? options2.name : void 0;
7004
7653
  if (title !== void 0) {
7005
7654
  main.title = title;
7006
7655
  }
@@ -7386,11 +8035,11 @@ var Protocol = class {
7386
8035
  }
7387
8036
  await this.notification(notification, notificationOptions);
7388
8037
  },
7389
- sendRequest: async (r2, resultSchema, options3) => {
8038
+ sendRequest: async (r2, resultSchema, options2) => {
7390
8039
  if (abortController.signal.aborted) {
7391
8040
  throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
7392
8041
  }
7393
- const requestOptions = { ...options3, relatedRequestId: request.id };
8042
+ const requestOptions = { ...options2, relatedRequestId: request.id };
7394
8043
  if (relatedTaskId && !requestOptions.relatedTask) {
7395
8044
  requestOptions.relatedTask = { taskId: relatedTaskId };
7396
8045
  }
@@ -7562,11 +8211,11 @@ var Protocol = class {
7562
8211
  *
7563
8212
  * @experimental Use `client.experimental.tasks.requestStream()` to access this method.
7564
8213
  */
7565
- async *requestStream(request, resultSchema, options3) {
7566
- const { task } = options3 ?? {};
8214
+ async *requestStream(request, resultSchema, options2) {
8215
+ const { task } = options2 ?? {};
7567
8216
  if (!task) {
7568
8217
  try {
7569
- const result = await this.request(request, resultSchema, options3);
8218
+ const result = await this.request(request, resultSchema, options2);
7570
8219
  yield { type: "result", result };
7571
8220
  } catch (error) {
7572
8221
  yield {
@@ -7578,7 +8227,7 @@ var Protocol = class {
7578
8227
  }
7579
8228
  let taskId2;
7580
8229
  try {
7581
- const createResult = await this.request(request, CreateTaskResultSchema, options3);
8230
+ const createResult = await this.request(request, CreateTaskResultSchema, options2);
7582
8231
  if (createResult.task) {
7583
8232
  taskId2 = createResult.task.taskId;
7584
8233
  yield { type: "taskCreated", task: createResult.task };
@@ -7586,11 +8235,11 @@ var Protocol = class {
7586
8235
  throw new McpError(ErrorCode.InternalError, "Task creation did not return a task");
7587
8236
  }
7588
8237
  while (true) {
7589
- const task2 = await this.getTask({ taskId: taskId2 }, options3);
8238
+ const task2 = await this.getTask({ taskId: taskId2 }, options2);
7590
8239
  yield { type: "taskStatus", task: task2 };
7591
8240
  if (isTerminal(task2.status)) {
7592
8241
  if (task2.status === "completed") {
7593
- const result = await this.getTaskResult({ taskId: taskId2 }, resultSchema, options3);
8242
+ const result = await this.getTaskResult({ taskId: taskId2 }, resultSchema, options2);
7594
8243
  yield { type: "result", result };
7595
8244
  } else if (task2.status === "failed") {
7596
8245
  yield {
@@ -7606,13 +8255,13 @@ var Protocol = class {
7606
8255
  return;
7607
8256
  }
7608
8257
  if (task2.status === "input_required") {
7609
- const result = await this.getTaskResult({ taskId: taskId2 }, resultSchema, options3);
8258
+ const result = await this.getTaskResult({ taskId: taskId2 }, resultSchema, options2);
7610
8259
  yield { type: "result", result };
7611
8260
  return;
7612
8261
  }
7613
8262
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
7614
- await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
7615
- options3?.signal?.throwIfAborted();
8263
+ await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
8264
+ options2?.signal?.throwIfAborted();
7616
8265
  }
7617
8266
  } catch (error) {
7618
8267
  yield {
@@ -7626,9 +8275,9 @@ var Protocol = class {
7626
8275
  *
7627
8276
  * Do not use this method to emit notifications! Use notification() instead.
7628
8277
  */
7629
- request(request, resultSchema, options3) {
7630
- const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options3 ?? {};
7631
- return new Promise((resolve2, reject) => {
8278
+ request(request, resultSchema, options2) {
8279
+ const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options2 ?? {};
8280
+ return new Promise((resolve3, reject) => {
7632
8281
  const earlyReject = (error) => {
7633
8282
  reject(error);
7634
8283
  };
@@ -7647,15 +8296,15 @@ var Protocol = class {
7647
8296
  return;
7648
8297
  }
7649
8298
  }
7650
- options3?.signal?.throwIfAborted();
8299
+ options2?.signal?.throwIfAborted();
7651
8300
  const messageId = this._requestMessageId++;
7652
8301
  const jsonrpcRequest = {
7653
8302
  ...request,
7654
8303
  jsonrpc: "2.0",
7655
8304
  id: messageId
7656
8305
  };
7657
- if (options3?.onprogress) {
7658
- this._progressHandlers.set(messageId, options3.onprogress);
8306
+ if (options2?.onprogress) {
8307
+ this._progressHandlers.set(messageId, options2.onprogress);
7659
8308
  jsonrpcRequest.params = {
7660
8309
  ...request.params,
7661
8310
  _meta: {
@@ -7695,7 +8344,7 @@ var Protocol = class {
7695
8344
  reject(error);
7696
8345
  };
7697
8346
  this._responseHandlers.set(messageId, (response) => {
7698
- if (options3?.signal?.aborted) {
8347
+ if (options2?.signal?.aborted) {
7699
8348
  return;
7700
8349
  }
7701
8350
  if (response instanceof Error) {
@@ -7706,18 +8355,18 @@ var Protocol = class {
7706
8355
  if (!parseResult.success) {
7707
8356
  reject(parseResult.error);
7708
8357
  } else {
7709
- resolve2(parseResult.data);
8358
+ resolve3(parseResult.data);
7710
8359
  }
7711
8360
  } catch (error) {
7712
8361
  reject(error);
7713
8362
  }
7714
8363
  });
7715
- options3?.signal?.addEventListener("abort", () => {
7716
- cancel(options3?.signal?.reason);
8364
+ options2?.signal?.addEventListener("abort", () => {
8365
+ cancel(options2?.signal?.reason);
7717
8366
  });
7718
- const timeout = options3?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
8367
+ const timeout = options2?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
7719
8368
  const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
7720
- this._setupTimeout(messageId, timeout, options3?.maxTotalTimeout, timeoutHandler, options3?.resetTimeoutOnProgress ?? false);
8369
+ this._setupTimeout(messageId, timeout, options2?.maxTotalTimeout, timeoutHandler, options2?.resetTimeoutOnProgress ?? false);
7721
8370
  const relatedTaskId = relatedTask?.taskId;
7722
8371
  if (relatedTaskId) {
7723
8372
  const responseResolver = (response) => {
@@ -7750,42 +8399,42 @@ var Protocol = class {
7750
8399
  *
7751
8400
  * @experimental Use `client.experimental.tasks.getTask()` to access this method.
7752
8401
  */
7753
- async getTask(params, options3) {
7754
- return this.request({ method: "tasks/get", params }, GetTaskResultSchema, options3);
8402
+ async getTask(params, options2) {
8403
+ return this.request({ method: "tasks/get", params }, GetTaskResultSchema, options2);
7755
8404
  }
7756
8405
  /**
7757
8406
  * Retrieves the result of a completed task.
7758
8407
  *
7759
8408
  * @experimental Use `client.experimental.tasks.getTaskResult()` to access this method.
7760
8409
  */
7761
- async getTaskResult(params, resultSchema, options3) {
7762
- return this.request({ method: "tasks/result", params }, resultSchema, options3);
8410
+ async getTaskResult(params, resultSchema, options2) {
8411
+ return this.request({ method: "tasks/result", params }, resultSchema, options2);
7763
8412
  }
7764
8413
  /**
7765
8414
  * Lists tasks, optionally starting from a pagination cursor.
7766
8415
  *
7767
8416
  * @experimental Use `client.experimental.tasks.listTasks()` to access this method.
7768
8417
  */
7769
- async listTasks(params, options3) {
7770
- return this.request({ method: "tasks/list", params }, ListTasksResultSchema, options3);
8418
+ async listTasks(params, options2) {
8419
+ return this.request({ method: "tasks/list", params }, ListTasksResultSchema, options2);
7771
8420
  }
7772
8421
  /**
7773
8422
  * Cancels a specific task.
7774
8423
  *
7775
8424
  * @experimental Use `client.experimental.tasks.cancelTask()` to access this method.
7776
8425
  */
7777
- async cancelTask(params, options3) {
7778
- return this.request({ method: "tasks/cancel", params }, CancelTaskResultSchema, options3);
8426
+ async cancelTask(params, options2) {
8427
+ return this.request({ method: "tasks/cancel", params }, CancelTaskResultSchema, options2);
7779
8428
  }
7780
8429
  /**
7781
8430
  * Emits a notification, which is a one-way message that does not expect a response.
7782
8431
  */
7783
- async notification(notification, options3) {
8432
+ async notification(notification, options2) {
7784
8433
  if (!this._transport) {
7785
8434
  throw new Error("Not connected");
7786
8435
  }
7787
8436
  this.assertNotificationCapability(notification.method);
7788
- const relatedTaskId = options3?.relatedTask?.taskId;
8437
+ const relatedTaskId = options2?.relatedTask?.taskId;
7789
8438
  if (relatedTaskId) {
7790
8439
  const jsonrpcNotification2 = {
7791
8440
  ...notification,
@@ -7794,7 +8443,7 @@ var Protocol = class {
7794
8443
  ...notification.params,
7795
8444
  _meta: {
7796
8445
  ...notification.params?._meta || {},
7797
- [RELATED_TASK_META_KEY]: options3.relatedTask
8446
+ [RELATED_TASK_META_KEY]: options2.relatedTask
7798
8447
  }
7799
8448
  }
7800
8449
  };
@@ -7806,7 +8455,7 @@ var Protocol = class {
7806
8455
  return;
7807
8456
  }
7808
8457
  const debouncedMethods = this._options?.debouncedNotificationMethods ?? [];
7809
- const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options3?.relatedRequestId && !options3?.relatedTask;
8458
+ const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options2?.relatedRequestId && !options2?.relatedTask;
7810
8459
  if (canDebounce) {
7811
8460
  if (this._pendingDebouncedNotifications.has(notification.method)) {
7812
8461
  return;
@@ -7821,19 +8470,19 @@ var Protocol = class {
7821
8470
  ...notification,
7822
8471
  jsonrpc: "2.0"
7823
8472
  };
7824
- if (options3?.relatedTask) {
8473
+ if (options2?.relatedTask) {
7825
8474
  jsonrpcNotification2 = {
7826
8475
  ...jsonrpcNotification2,
7827
8476
  params: {
7828
8477
  ...jsonrpcNotification2.params,
7829
8478
  _meta: {
7830
8479
  ...jsonrpcNotification2.params?._meta || {},
7831
- [RELATED_TASK_META_KEY]: options3.relatedTask
8480
+ [RELATED_TASK_META_KEY]: options2.relatedTask
7832
8481
  }
7833
8482
  }
7834
8483
  };
7835
8484
  }
7836
- this._transport?.send(jsonrpcNotification2, options3).catch((error) => this._onerror(error));
8485
+ this._transport?.send(jsonrpcNotification2, options2).catch((error) => this._onerror(error));
7837
8486
  });
7838
8487
  return;
7839
8488
  }
@@ -7841,19 +8490,19 @@ var Protocol = class {
7841
8490
  ...notification,
7842
8491
  jsonrpc: "2.0"
7843
8492
  };
7844
- if (options3?.relatedTask) {
8493
+ if (options2?.relatedTask) {
7845
8494
  jsonrpcNotification = {
7846
8495
  ...jsonrpcNotification,
7847
8496
  params: {
7848
8497
  ...jsonrpcNotification.params,
7849
8498
  _meta: {
7850
8499
  ...jsonrpcNotification.params?._meta || {},
7851
- [RELATED_TASK_META_KEY]: options3.relatedTask
8500
+ [RELATED_TASK_META_KEY]: options2.relatedTask
7852
8501
  }
7853
8502
  }
7854
8503
  };
7855
8504
  }
7856
- await this._transport.send(jsonrpcNotification, options3);
8505
+ await this._transport.send(jsonrpcNotification, options2);
7857
8506
  }
7858
8507
  /**
7859
8508
  * Registers a handler to invoke when this protocol object receives a request with the given method.
@@ -7968,12 +8617,12 @@ var Protocol = class {
7968
8617
  }
7969
8618
  } catch {
7970
8619
  }
7971
- return new Promise((resolve2, reject) => {
8620
+ return new Promise((resolve3, reject) => {
7972
8621
  if (signal.aborted) {
7973
8622
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
7974
8623
  return;
7975
8624
  }
7976
- const timeoutId = setTimeout(resolve2, interval);
8625
+ const timeoutId = setTimeout(resolve3, interval);
7977
8626
  signal.addEventListener("abort", () => {
7978
8627
  clearTimeout(timeoutId);
7979
8628
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -8151,6 +8800,7 @@ var M = external_exports.object({ protocolVersion: external_exports.string().des
8151
8800
  var p = "text/html;profile=mcp-app";
8152
8801
 
8153
8802
  // src/shared/panel/panel-contract.generated.ts
8803
+ init_define_EXTENSION_BUILD_INFO();
8154
8804
  var panelOutputSchema = external_exports.object({
8155
8805
  conversation_id: external_exports.string().optional().nullable(),
8156
8806
  panel_scope: external_exports.object({
@@ -8160,28 +8810,37 @@ var panelOutputSchema = external_exports.object({
8160
8810
  }),
8161
8811
  panel_project_candidate: external_exports.object({
8162
8812
  repository: external_exports.string(),
8813
+ git: external_exports.union([external_exports.literal("ready"), external_exports.literal("no_commits"), external_exports.literal("none")]).optional(),
8163
8814
  auto_register: external_exports.boolean()
8164
8815
  }).optional(),
8165
8816
  panel_selection: external_exports.object({
8166
8817
  task_id: external_exports.string(),
8167
8818
  tab: external_exports.literal("chat")
8168
8819
  }).optional(),
8169
- tasks: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional()
8820
+ tasks: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
8821
+ read_completed: external_exports.record(external_exports.string(), external_exports.number()).optional()
8170
8822
  });
8171
8823
 
8172
- // src/shared/events/payload.ts
8173
- function eventPayload(event, type) {
8174
- const view = event.view;
8175
- if (view.kind !== "known" || view.type !== type) return void 0;
8176
- return view.data;
8177
- }
8824
+ // src/service/platform/panel/panel-context.ts
8825
+ init_define_EXTENSION_BUILD_INFO();
8826
+
8827
+ // src/shared/tasks/task-list.ts
8828
+ init_define_EXTENSION_BUILD_INFO();
8829
+
8830
+ // src/shared/tasks/activity/activity-status.ts
8831
+ init_define_EXTENSION_BUILD_INFO();
8178
8832
 
8179
8833
  // src/shared/providers/activity/presentation.ts
8834
+ init_define_EXTENSION_BUILD_INFO();
8180
8835
  function activityPresentation(event) {
8181
8836
  return event.presentation ?? {};
8182
8837
  }
8183
8838
 
8839
+ // src/shared/tasks/activity/activity-events.ts
8840
+ init_define_EXTENSION_BUILD_INFO();
8841
+
8184
8842
  // src/shared/providers/activity/content-text.ts
8843
+ init_define_EXTENSION_BUILD_INFO();
8185
8844
  function contentText(content) {
8186
8845
  if (typeof content === "string") return content;
8187
8846
  if (!Array.isArray(content)) return void 0;
@@ -8191,6 +8850,7 @@ function contentText(content) {
8191
8850
  }
8192
8851
 
8193
8852
  // src/shared/text.ts
8853
+ init_define_EXTENSION_BUILD_INFO();
8194
8854
  function scalarText(value, fallback = "") {
8195
8855
  return typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : fallback;
8196
8856
  }
@@ -8234,6 +8894,8 @@ function serviceSummary(e) {
8234
8894
  if (turnEnded) {
8235
8895
  return `Turn ${turnEnded.turn} ${turnEnded.outcome}`;
8236
8896
  }
8897
+ const limited = eventPayload(e, "agent.limited");
8898
+ if (limited) return limited.reason;
8237
8899
  const queueChanged = eventPayload(e, "task.queue_changed");
8238
8900
  if (queueChanged) {
8239
8901
  const count = queueChanged.queue.length;
@@ -8243,6 +8905,7 @@ function serviceSummary(e) {
8243
8905
  }
8244
8906
  var eventTitles = {
8245
8907
  "agent.completed": "Turn completed",
8908
+ "agent.limited": "Session limited",
8246
8909
  "agent.reply": "Reply",
8247
8910
  "task.completed": "Task completed",
8248
8911
  "task.instruction": "Message",
@@ -8299,7 +8962,7 @@ function failureSummary(event) {
8299
8962
  const agent = eventPayload(event, "agent.completed");
8300
8963
  const textOutput = contentText(tool2?.content ?? opaqueData.content);
8301
8964
  return [
8302
- taskFailure?.error,
8965
+ taskFailure ? failureMessage(taskFailure) : void 0,
8303
8966
  interrupted?.error,
8304
8967
  taskCompleted?.error,
8305
8968
  agent?.result,
@@ -8323,6 +8986,7 @@ function eventRowTitle(e, key, presentationTitle) {
8323
8986
  }
8324
8987
 
8325
8988
  // src/shared/tasks/activity/activity-timeline.ts
8989
+ init_define_EXTENSION_BUILD_INFO();
8326
8990
  function onlyThinkingSignals(group) {
8327
8991
  return group.events.length > 0 && group.events.every(thinkingSignal);
8328
8992
  }
@@ -8487,7 +9151,7 @@ function groupActivity(events) {
8487
9151
  eventRowTitle(e, key, presentation.title),
8488
9152
  activityFailed(e) ? "failed" : "info"
8489
9153
  );
8490
- group.summary = presentation.summary ?? (activityFailed(e) ? failureSummary(e) : void 0) ?? serviceSummary(e) ?? eventPayload(e, "agent.completed")?.result ?? eventPayload(e, "task.instruction")?.message ?? eventPayload(e, "task.waiting")?.reason ?? (toolCompleted ? contentText(toolCompleted.content) : void 0) ?? string2(
9154
+ group.summary = presentation.summary ?? (activityFailed(e) ? failureSummary(e) : void 0) ?? serviceSummary(e) ?? eventPayload(e, "agent.completed")?.result ?? eventPayload(e, "task.instruction")?.message ?? (toolCompleted ? contentText(toolCompleted.content) : void 0) ?? string2(
8491
9155
  d2.text ?? d2.summary ?? d2.description ?? d2.message ?? d2.error ?? d2.result
8492
9156
  ) ?? (Array.isArray(d2.errors) ? d2.errors.map(String).join("; ") : void 0);
8493
9157
  if (replyText(e) !== void 0 || thinkingSignal(e)) {
@@ -8609,6 +9273,7 @@ function currentActivityStatus(events, task) {
8609
9273
  }
8610
9274
 
8611
9275
  // src/shared/tasks/conversation/reply.ts
9276
+ init_define_EXTENSION_BUILD_INFO();
8612
9277
  var REPLY_EXCERPT_CHARS = 1500;
8613
9278
  function replyExcerpt(text, max = REPLY_EXCERPT_CHARS) {
8614
9279
  return text.length > max ? `${text.slice(0, max)}\u2026 (truncated)` : text;
@@ -8627,10 +9292,30 @@ function replyFrom(event) {
8627
9292
  function readFields(read2) {
8628
9293
  return read2?.unread ? { unread: true, read_through: read2.through } : {};
8629
9294
  }
8630
- function listedTask(task, events, reply, draft, read2, archivedAt) {
9295
+ function taskSummary(task, reply, archivedAt) {
9296
+ const excerpt = replyFrom(reply);
9297
+ return {
9298
+ id: task.id,
9299
+ title: task.title,
9300
+ status: task.status,
9301
+ repository: task.repository,
9302
+ ...task.conversation_id ? { conversation_id: task.conversation_id } : {},
9303
+ worker_profile: task.worker_profile,
9304
+ turn: task.turn,
9305
+ ...task.error ? { error: task.error } : {},
9306
+ ...task.error_code ? { error_code: task.error_code } : {},
9307
+ ...task.pending_input ? { pending_input: task.pending_input.kind } : {},
9308
+ ...excerpt ? { reply: excerpt } : {},
9309
+ queued_messages: task.queue.length,
9310
+ ...archivedAt ? { archived_at: archivedAt } : {}
9311
+ };
9312
+ }
9313
+ var unsent = { context: void 0 };
9314
+ function panelTask(task, events, reply, draft, read2, archivedAt) {
8631
9315
  const excerpt = replyFrom(reply);
8632
9316
  return {
8633
9317
  ...task,
9318
+ ...unsent,
8634
9319
  ...task.status === "running" ? { live_activity: currentActivityStatus(events, task) } : {},
8635
9320
  ...excerpt ? { reply: excerpt } : {},
8636
9321
  ...draft ? { draft } : {},
@@ -8667,7 +9352,7 @@ async function resolvePanelContext(c, owner, args) {
8667
9352
  throw new Error("Task belongs to a different conversation");
8668
9353
  }
8669
9354
  const conversationId = args.conversation_id === null ? null : args.conversation_id ?? target?.conversation_id ?? null;
8670
- const latest = conversationId ? c.store.all(owner).find((t) => t.conversation_id === conversationId) : void 0;
9355
+ const latest = conversationId ? c.store.latestInConversation(owner, conversationId) : void 0;
8671
9356
  const source = target ?? latest;
8672
9357
  let repository = args.repository ?? source?.repository;
8673
9358
  if (repository) {
@@ -8684,13 +9369,13 @@ async function resolvePanelContext(c, owner, args) {
8684
9369
  if (target && args.revision && args.revision !== target.revision) {
8685
9370
  throw new Error("Task uses a different revision");
8686
9371
  }
8687
- const candidate = !args.repository && !target && args.conversation_id !== null ? await hostProjectCandidate(args.host_directory) : void 0;
9372
+ const candidate = !args.repository && !target && args.conversation_id !== null ? await hostProjectCandidate(c, args.host_directory) : void 0;
8688
9373
  return {
8689
- ...candidate && candidate !== repository ? {
9374
+ ...candidate && candidate.repository !== repository ? {
8690
9375
  panel_project_candidate: {
8691
- repository: candidate,
9376
+ ...candidate,
8692
9377
  // New task may offer it; starting that task adds it with the user's choice.
8693
- auto_register: !!c.projects && c.settings.values(owner).projects.auto_register_chat
9378
+ auto_register: isGitRoot(candidate) && !!c.projects && c.settings.values(owner).projects.auto_register_chat
8694
9379
  }
8695
9380
  } : {},
8696
9381
  panel_scope: {
@@ -8708,19 +9393,45 @@ async function resolvePanelContext(c, owner, args) {
8708
9393
  } : {}
8709
9394
  };
8710
9395
  }
8711
- function openingTasks(c, owner, conversationId) {
8712
- const archived = c.archive.times(owner);
8713
- return c.store.all(owner).filter((t) => !conversationId || t.conversation_id === conversationId).map((t) => {
8714
- const archivedAt = archived.get(t.id);
8715
- return {
8716
- ...t,
8717
- ...readFields(c.store.readState(t.id)),
8718
- ...archivedAt ? { archived_at: archivedAt } : {}
8719
- };
9396
+ function panelTaskList(c, owner, filters, includeReadCompleted) {
9397
+ if (includeReadCompleted) return { tasks: panelTasks(c, owner, filters) };
9398
+ const rows = c.store.readCompletedFlags(owner, {
9399
+ ...filters,
9400
+ include: void 0
8720
9401
  });
9402
+ const listed = new Set(filters.include);
9403
+ if (rows[0]) listed.add(rows[0].id);
9404
+ const counts = {};
9405
+ for (const row2 of rows) {
9406
+ if (!row2.readCompleted) {
9407
+ listed.add(row2.id);
9408
+ } else if (!listed.has(row2.id)) {
9409
+ counts[row2.repository] = (counts[row2.repository] ?? 0) + 1;
9410
+ }
9411
+ }
9412
+ return {
9413
+ tasks: panelTasks(c, owner, { ids: [...listed] }),
9414
+ read_completed: counts
9415
+ };
9416
+ }
9417
+ function panelTasks(c, owner, filters) {
9418
+ const archived = c.archive.times(owner, filters);
9419
+ const replies = c.store.latestEvents(owner, "agent.reply", filters);
9420
+ const reads = c.store.readStates(owner, filters);
9421
+ return c.store.list(owner, filters).map(
9422
+ (t) => panelTask(
9423
+ t,
9424
+ t.status === "running" ? c.store.recentEvents(t.id, owner) : [],
9425
+ replies.get(t.id),
9426
+ c.drafts.get(t.id),
9427
+ reads.get(t.id),
9428
+ archived.get(t.id)
9429
+ )
9430
+ );
8721
9431
  }
8722
9432
 
8723
9433
  // src/service/platform/panel/panel-html.ts
9434
+ init_define_EXTENSION_BUILD_INFO();
8724
9435
  import { readFileSync } from "node:fs";
8725
9436
  import { readFile } from "node:fs/promises";
8726
9437
  var copies = /* @__PURE__ */ new Map();
@@ -8781,6 +9492,7 @@ function delegationPanel(htmlPath, initialTasks, context) {
8781
9492
  },
8782
9493
  open: async (args) => {
8783
9494
  const resolved = context ? await context(args) : { panel_scope: { conversation_id: args.conversation_id ?? null } };
9495
+ const selected = resolved.panel_selection?.task_id;
8784
9496
  return {
8785
9497
  content: [
8786
9498
  {
@@ -8791,13 +9503,12 @@ function delegationPanel(htmlPath, initialTasks, context) {
8791
9503
  structuredContent: {
8792
9504
  conversation_id: resolved.panel_scope.conversation_id,
8793
9505
  ...resolved,
8794
- ...initialTasks ? {
8795
- tasks: initialTasks(
8796
- resolved.panel_scope.conversation_id ?? void 0
8797
- ).filter(
8798
- (t) => !resolved.panel_scope.repository || t.repository === resolved.panel_scope.repository
8799
- )
8800
- } : {}
9506
+ ...initialTasks ? initialTasks({
9507
+ conversation: resolved.panel_scope.conversation_id ?? void 0,
9508
+ repository: resolved.panel_scope.repository,
9509
+ archived: "exclude",
9510
+ include: selected ? [selected] : []
9511
+ }) : {}
8801
9512
  },
8802
9513
  _meta: { conversation_id: resolved.panel_scope.conversation_id }
8803
9514
  };
@@ -8844,18 +9555,27 @@ function delegationPanel(htmlPath, initialTasks, context) {
8844
9555
  }
8845
9556
 
8846
9557
  // src/service/platform/server/instructions.ts
9558
+ init_define_EXTENSION_BUILD_INFO();
8847
9559
  var SERVER_INSTRUCTIONS = `Delegate work to background workers.
8848
9560
  1. Resolve the repository with get_current_project or list_projects and pass it to start_task as an explicit absolute path. Never guess a path. Tool arguments never grant access. For an unregistered project, follow next_step.
8849
9561
  2. Call list_workers. If a provider is not ready, report readiness.message to the user instead of retrying. Use the reviewer profile for review requests.
8850
- 3. Call start_task with the user's full request in description. Tasks use the current checkout by default, including uncommitted changes. Use workspace_strategy worktree for isolated or parallel edits from a committed revision.
9562
+ 3. Call start_task with the user's full request in description. Tasks use the current checkout by default, including uncommitted changes. Use workspace_strategy worktree for isolated or parallel edits from a committed revision, only on a project whose git is ready.
8851
9563
  4. Supervise with list_messages as its description explains. Read what the worker changed with get_changes, never from its own reply.
8852
9564
  5. A finished task stays open. Continue it with send_message. Reopen its panel with open_subagent_extension_for_codex(task_id), never another start_task.`;
8853
9565
 
8854
9566
  // src/service/platform/server/mentions.ts
9567
+ init_define_EXTENSION_BUILD_INFO();
8855
9568
  import { mkdir, open } from "node:fs/promises";
8856
9569
  import { join, resolve } from "node:path";
8857
9570
 
9571
+ // node_modules/@openai/mcp-extensions/dist/index.js
9572
+ init_define_EXTENSION_BUILD_INFO();
9573
+
9574
+ // node_modules/@modelcontextprotocol/core/dist/index.mjs
9575
+ init_define_EXTENSION_BUILD_INFO();
9576
+
8858
9577
  // node_modules/@modelcontextprotocol/core/dist/schemas-DscsoNZN.mjs
9578
+ init_define_EXTENSION_BUILD_INFO();
8859
9579
  var LATEST_PROTOCOL_VERSION2 = "2025-11-25";
8860
9580
  var DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
8861
9581
  var SUPPORTED_PROTOCOL_VERSIONS2 = [
@@ -9646,6 +10366,7 @@ var ServerResultSchema2 = union([
9646
10366
  ]);
9647
10367
 
9648
10368
  // node_modules/@modelcontextprotocol/core/dist/auth-UMQCo-ad.mjs
10369
+ init_define_EXTENSION_BUILD_INFO();
9649
10370
  var SafeUrlSchema = url().superRefine((val, ctx) => {
9650
10371
  if (!URL.canParse(val)) {
9651
10372
  ctx.addIssue({
@@ -9800,9 +10521,11 @@ var OAuthTokenRevocationRequestSchema = object({
9800
10521
  }).strip();
9801
10522
 
9802
10523
  // node_modules/@openai/mcp-extensions/dist/shared/strings.js
10524
+ init_define_EXTENSION_BUILD_INFO();
9803
10525
  var NonBlankStringSchema = external_exports.string().regex(/\S/);
9804
10526
 
9805
10527
  // node_modules/@openai/mcp-extensions/dist/shared/mentions.js
10528
+ init_define_EXTENSION_BUILD_INFO();
9806
10529
  var OpenAIMentionsCapabilitySchema = external_exports.object({
9807
10530
  searchTool: NonBlankStringSchema
9808
10531
  });
@@ -9941,6 +10664,7 @@ async function logMentionSearch(query, workers, resultNames, env) {
9941
10664
  }
9942
10665
 
9943
10666
  // src/service/features/projects/chat-project.ts
10667
+ init_define_EXTENSION_BUILD_INFO();
9944
10668
  import { isAbsolute as isAbsolute2 } from "node:path";
9945
10669
  function hostDirectoryFromMeta(meta2) {
9946
10670
  const state = meta2?.["codex/sandbox-state-meta"];
@@ -9967,8 +10691,12 @@ async function autoRegisterChatProject(c, owner, meta2, repository) {
9967
10691
  if (!c.projects || !c.settings.values(owner).projects.auto_register_chat) {
9968
10692
  return void 0;
9969
10693
  }
9970
- const root = await hostProjectCandidate(hostDirectoryFromMeta(meta2));
9971
- if (!root) return void 0;
10694
+ const candidate = await hostProjectCandidate(
10695
+ c,
10696
+ hostDirectoryFromMeta(meta2)
10697
+ );
10698
+ if (!candidate || !isGitRoot(candidate)) return void 0;
10699
+ const root = candidate.repository;
9972
10700
  if (repository !== void 0 && (!isAbsolute2(repository) || await gitRoot(repository) !== root)) {
9973
10701
  return void 0;
9974
10702
  }
@@ -9979,26 +10707,35 @@ async function autoRegisterChatProject(c, owner, meta2, repository) {
9979
10707
  }
9980
10708
  }
9981
10709
  async function currentChatProject(c, owner, meta2) {
9982
- const root = await hostProjectCandidate(hostDirectoryFromMeta(meta2));
9983
- if (!root) {
10710
+ const candidate = await hostProjectCandidate(c, hostDirectoryFromMeta(meta2));
10711
+ if (!candidate) {
9984
10712
  throw new Error(
9985
10713
  "The host supplied no usable local project directory. Use the actual absolute repository from the task context, and ask the user to use Add project in the panel if it is not registered."
9986
10714
  );
9987
10715
  }
10716
+ const { repository: root, git } = candidate;
9988
10717
  const registered = await isApproved(c, root);
9989
- const auto = !!c.projects && c.settings.values(owner).projects.auto_register_chat;
10718
+ const auto = isGitRoot(candidate) && !!c.projects && c.settings.values(owner).projects.auto_register_chat;
9990
10719
  return {
9991
10720
  repository: root,
10721
+ ...git ? { git } : {},
9992
10722
  registered,
9993
10723
  auto_register_on_task_start: auto,
9994
10724
  // Read-only callers never register; they hand the decision to the user.
9995
10725
  ...registered ? {} : {
9996
- next_step: auto ? "Starting a task for this repository from this chat adds it automatically. Otherwise ask the user to use Add project in the panel." : "Ask the user to use Add project in the panel before delegating to this project."
10726
+ next_step: auto ? "Starting a task for this repository from this chat adds it automatically. Otherwise ask the user to use Allow tasks here in the panel." : "Ask the user to use Allow tasks here in the panel before delegating to this project."
9997
10727
  }
9998
10728
  };
9999
10729
  }
10000
10730
 
10731
+ // src/service/platform/server/tools.ts
10732
+ init_define_EXTENSION_BUILD_INFO();
10733
+
10734
+ // src/service/platform/server/tool-logging.ts
10735
+ init_define_EXTENSION_BUILD_INFO();
10736
+
10001
10737
  // src/shared/tasks/conversation/send-errors.ts
10738
+ init_define_EXTENSION_BUILD_INFO();
10002
10739
  var SendRejectedError = class extends Error {
10003
10740
  name = "SendRejectedError";
10004
10741
  };
@@ -10011,10 +10748,11 @@ var rejectionMessages = /* @__PURE__ */ new Set([
10011
10748
  "Task not found",
10012
10749
  "Repository outside allowed roots (register this repository or approve its parent)",
10013
10750
  "Task belongs to a different conversation",
10014
- "Task belongs to a different repository"
10751
+ "Task belongs to a different repository",
10752
+ WORKTREE_NEEDS_GIT
10015
10753
  ]);
10016
10754
  function rejected(error) {
10017
- return error instanceof SendRejectedError || error instanceof Error && (error.name === "ZodError" || rejectionMessages.has(error.message));
10755
+ return error instanceof SendRejectedError || error instanceof PolicyRejectedError || error instanceof AttachmentError || error instanceof Error && (error.name === "ZodError" || rejectionMessages.has(error.message));
10018
10756
  }
10019
10757
  async function observeTool(name, run2, readOnly = false) {
10020
10758
  return withLogContext({ tool: name }, async () => {
@@ -10046,115 +10784,33 @@ async function observeTool(name, run2, readOnly = false) {
10046
10784
  });
10047
10785
  }
10048
10786
 
10049
- // src/shared/tasks/conversation/messages.ts
10050
- var MESSAGE_EVENTS = [
10051
- "task.started",
10052
- "task.instruction",
10053
- "agent.message",
10054
- "agent.reply"
10055
- ];
10056
- function workerMessageId(e) {
10057
- return eventPayload(e, "agent.message")?.message_id ?? `evt_${e.id}`;
10058
- }
10059
- function workerText(e) {
10060
- const message = eventPayload(e, "agent.message");
10061
- if (!message || message.parent_tool_use_id) return void 0;
10062
- return message.text.trim() ? message.text : void 0;
10063
- }
10064
- var same = (message, reply) => {
10065
- const a = message.trim(), b = reply.trim();
10066
- return a === b || a.endsWith(b);
10067
- };
10068
- function queueState(id, pending2, queued) {
10069
- if (pending2.has(id)) return { state: "pending_steer" };
10070
- if (queued.has(id)) return { state: "queued" };
10071
- return {};
10072
- }
10073
- function conversation(task, events) {
10074
- const pending2 = new Set(task.pending_steers.map((m2) => m2.id));
10075
- const queued = new Set(task.queue.map((m2) => m2.id));
10076
- let turn = 1;
10077
- const messages = [
10078
- {
10079
- id: "request",
10080
- event_id: 0,
10081
- timestamp: task.created_at,
10082
- turn,
10083
- from: task.created_by,
10084
- kind: "request",
10085
- text: task.description
10086
- }
10087
- ];
10088
- for (const e of [...events].sort((a, b) => a.id - b.id)) {
10089
- const started = eventPayload(e, "task.started");
10090
- if (started) turn = started.turn;
10091
- const instruction = eventPayload(e, "task.instruction");
10092
- if (instruction) {
10093
- const id = instruction.message_id;
10094
- messages.push({
10095
- id,
10096
- event_id: e.id,
10097
- timestamp: e.timestamp,
10098
- turn,
10099
- from: instruction.from,
10100
- kind: "message",
10101
- text: instruction.message,
10102
- delivery: instruction.delivery,
10103
- ...queueState(id, pending2, queued)
10104
- });
10105
- }
10106
- if (eventPayload(e, "agent.message")) {
10107
- const text = workerText(e);
10108
- if (text === void 0) continue;
10109
- const id = workerMessageId(e);
10110
- const previous = messages.at(-1);
10111
- if (previous?.id === id && previous.from === "worker") {
10112
- previous.text = `${previous.text}
10113
-
10114
- ${text}`;
10115
- previous.event_id = e.id;
10116
- continue;
10117
- }
10118
- messages.push({
10119
- id,
10120
- event_id: e.id,
10121
- timestamp: e.timestamp,
10122
- turn,
10123
- from: "worker",
10124
- kind: "message",
10125
- text
10126
- });
10127
- }
10128
- const reply = eventPayload(e, "agent.reply");
10129
- if (reply) {
10130
- const text = reply.text;
10131
- const replyTurn = reply.turn;
10132
- const last = messages.findLast(
10133
- (m2) => m2.from === "worker" && m2.turn === replyTurn
10134
- );
10135
- if (last && last.kind === "message" && same(last.text, text)) {
10136
- last.kind = "reply";
10137
- last.event_id = e.id;
10138
- continue;
10139
- }
10140
- messages.push({
10141
- id: `reply_${e.id}`,
10142
- event_id: e.id,
10143
- timestamp: e.timestamp,
10144
- turn: replyTurn,
10145
- from: "worker",
10146
- kind: "reply",
10147
- text
10148
- });
10149
- }
10150
- }
10151
- return messages.sort((a, b) => a.event_id - b.event_id);
10152
- }
10787
+ // src/service/platform/server/tools/agent-tools.ts
10788
+ init_define_EXTENSION_BUILD_INFO();
10153
10789
 
10154
10790
  // src/shared/tasks/conversation/parent-protocol.ts
10791
+ init_define_EXTENSION_BUILD_INFO();
10155
10792
  var PARENT_SUPERVISION_PROTOCOL = "While delegated work runs, continue your own work and keep polling. A timeout or empty result does not mean the task finished. Handle pending_input, failures and interruptions explicitly. Report success only after reading the final reply. A queued follow-up is still pending work. If you lose the cursor, read again from after: 0.";
10156
10793
 
10794
+ // src/service/features/settings/settings-tool-schemas.ts
10795
+ init_define_EXTENSION_BUILD_INFO();
10796
+
10797
+ // src/shared/settings/settings-document.ts
10798
+ init_define_EXTENSION_BUILD_INFO();
10799
+
10800
+ // src/shared/providers/claude/settings-policy.ts
10801
+ init_define_EXTENSION_BUILD_INFO();
10802
+
10803
+ // src/shared/settings/settings-schema.ts
10804
+ init_define_EXTENSION_BUILD_INFO();
10805
+
10806
+ // src/shared/providers/settings.ts
10807
+ init_define_EXTENSION_BUILD_INFO();
10808
+
10809
+ // src/shared/providers/claude/settings.ts
10810
+ init_define_EXTENSION_BUILD_INFO();
10811
+
10157
10812
  // src/shared/settings/setting-text.ts
10813
+ init_define_EXTENSION_BUILD_INFO();
10158
10814
  function unwrapped(schema) {
10159
10815
  let current = schema;
10160
10816
  while (current instanceof external_exports.ZodDefault || current instanceof external_exports.ZodPrefault || current instanceof external_exports.ZodOptional) {
@@ -10177,6 +10833,7 @@ function settingText(schema) {
10177
10833
  }
10178
10834
 
10179
10835
  // src/shared/providers/claude/permissions.ts
10836
+ init_define_EXTENSION_BUILD_INFO();
10180
10837
  var claudePermissionModes = [
10181
10838
  "default",
10182
10839
  "acceptEdits",
@@ -10190,38 +10847,12 @@ var permissionModeSchema = external_exports.enum([
10190
10847
  "inherit",
10191
10848
  ...claudePermissionModes
10192
10849
  ]);
10193
- var claudeSandboxSchema = external_exports.enum([
10194
- "user_config",
10195
- "extension",
10196
- "extension_locked"
10197
- ]);
10198
- var claudeToolsSchema = external_exports.enum(["profile", "all", "restricted"]);
10199
- var claudePathGuardSchema = external_exports.enum(["profile", "on", "off"]);
10200
10850
  var claudeOverrideDefaults = {
10201
- sandbox: "user_config",
10202
- tools: "profile",
10203
- path_guard: "profile",
10851
+ sandbox: false,
10204
10852
  subagents: true,
10205
10853
  settings_files: true,
10206
10854
  user_mcp: true
10207
10855
  };
10208
- var claudeOverrideLabels = {
10209
- sandbox: {
10210
- user_config: "Your Claude Code settings",
10211
- extension: "Extension sandbox",
10212
- extension_locked: "Extension sandbox with locked network"
10213
- },
10214
- tools: {
10215
- profile: "By worker profile",
10216
- all: "All tools",
10217
- restricted: "Restricted set"
10218
- },
10219
- path_guard: {
10220
- profile: "By worker profile",
10221
- on: "On",
10222
- off: "Off"
10223
- }
10224
- };
10225
10856
  var permissionLabels = {
10226
10857
  inherit: "Use extension setting",
10227
10858
  default: "Default \u2014 ask for approval",
@@ -10231,9 +10862,16 @@ var permissionLabels = {
10231
10862
  auto: "Auto \u2014 Claude Code decides",
10232
10863
  bypassPermissions: "Bypass permission prompts"
10233
10864
  };
10865
+ var MODE_TURNED_OFF_BY_ORG = "Turned off by your organization";
10234
10866
  function permissionLabel(mode) {
10235
10867
  return permissionLabels[mode] ?? mode;
10236
10868
  }
10869
+ var permissionModeName = (mode) => shortPermissionLabel(permissionLabel(mode));
10870
+ function shortPermissionLabel(label) {
10871
+ if (label === "Use extension setting") return "Extension setting";
10872
+ const [name = label, detail] = label.split(" \u2014 ");
10873
+ return name === "Default" && detail ? titleCase(detail) : name;
10874
+ }
10237
10875
  var permissionRank = {
10238
10876
  plan: 0,
10239
10877
  dontAsk: 1,
@@ -10243,10 +10881,13 @@ var permissionRank = {
10243
10881
  bypassPermissions: 5
10244
10882
  };
10245
10883
  var readOnlyProfile = (role) => ["researcher", "reviewer", "security_reviewer"].includes(role);
10246
- function resolveClaudePermission(input, configured) {
10884
+ function resolveClaudePermission(input, configured, workerProfile) {
10247
10885
  if (input.permission_mode && input.permission_mode !== "inherit") {
10248
10886
  return { mode: input.permission_mode, source: "task" };
10249
10887
  }
10888
+ if (readOnlyProfile(workerProfile)) {
10889
+ return { mode: "plan", source: "profile" };
10890
+ }
10250
10891
  return { mode: configured, source: "setting" };
10251
10892
  }
10252
10893
  function exceedsPermission(requested, baseline) {
@@ -10256,52 +10897,36 @@ function exceedsPermission(requested, baseline) {
10256
10897
  return requestedRank > baselineRank;
10257
10898
  }
10258
10899
  var claudePolicySchema = external_exports.object({
10259
- sandbox: claudeSandboxSchema,
10260
- tools: external_exports.enum(["all", "restricted"]),
10261
- path_guard: external_exports.boolean(),
10900
+ sandbox: external_exports.boolean(),
10262
10901
  subagents: external_exports.boolean(),
10263
10902
  /** Load the user's, project's and local Claude Code settings. */
10264
10903
  settings_files: external_exports.boolean(),
10265
10904
  /** Offer MCP servers from the user's Claude Code configuration alongside the extension's own. */
10266
10905
  user_mcp: external_exports.boolean()
10267
10906
  });
10268
- function resolveTools(setting, readOnly) {
10269
- if (setting !== "profile") return setting;
10270
- return readOnly ? "restricted" : "all";
10271
- }
10272
- function resolveClaudePolicy(overrides, workerProfile) {
10273
- const readOnly = readOnlyProfile(workerProfile);
10274
- return {
10275
- sandbox: overrides.sandbox,
10276
- tools: resolveTools(overrides.tools, readOnly),
10277
- path_guard: overrides.path_guard === "profile" ? readOnly : overrides.path_guard === "on",
10278
- subagents: overrides.subagents,
10279
- settings_files: overrides.settings_files,
10280
- user_mcp: overrides.user_mcp
10281
- };
10282
- }
10907
+ var resolveClaudePolicy = (overrides, sandbox = overrides.sandbox) => ({
10908
+ sandbox,
10909
+ subagents: overrides.subagents,
10910
+ settings_files: overrides.settings_files,
10911
+ user_mcp: overrides.user_mcp
10912
+ });
10283
10913
 
10284
10914
  // src/shared/providers/claude/settings.ts
10285
10915
  var help = {
10286
10916
  permission_mode: "Tasks use this mode unless you choose another. Your other Claude Code settings still apply while Load Claude Code settings is on.",
10287
- sandbox: "Your Claude Code settings decide the sandbox by default. The extension sandbox allows writes only in the workspace and blocks home and sibling reads and the network. Locking its network also ignores domains your Claude Code settings allow.",
10288
- tools: "All tools offers every Claude Code tool. The restricted set offers file, search, Bash, question, skill and MCP tools, and only read, question and skill tools to read-only work. By worker profile restricts only read-only profiles.",
10289
- path_guard: "Keeps file tools inside the task workspace and out of Git metadata. By worker profile applies it only to read-only profiles.",
10917
+ sandbox: "Runs Bash commands in Claude Code's sandbox, and stops a task when the sandbox can't run. Your Claude Code settings and your organization's policy decide the rest. Off leaves the sandbox to your Claude Code settings. Codex can turn it on for a task, and only you can turn it off.",
10290
10918
  subagents: "Delegated sessions may start subagents with the Agent tool.",
10291
10919
  settings_files: "Sessions load your user, project and local Claude Code settings, including instructions, skills, hooks, permission rules, sandbox settings and MCP servers. Off ignores all of them, including your deny rules and sandbox.",
10292
10920
  user_mcp: "Sessions may use MCP servers from your Claude Code configuration, such as project, user and plugin servers. This also requires Load Claude Code settings. Off leaves only the extension's own server."
10293
10921
  };
10294
10922
  var userOnly = "Only you can change these settings.";
10295
- var options = (labels) => Object.entries(labels).map(([value, label]) => ({ value, label }));
10296
10923
  var claudeSettingsSchema = external_exports.strictObject({
10297
10924
  permission_mode: claudePermissionModeSchema.meta({
10298
10925
  title: "Claude permission mode",
10299
10926
  description: help.permission_mode
10300
10927
  }).default("default"),
10301
10928
  // Restriction titles drop "Claude": their settings group already names it.
10302
- sandbox: claudeSandboxSchema.meta({ title: "Bash sandbox", description: help.sandbox }).default(claudeOverrideDefaults.sandbox),
10303
- tools: claudeToolsSchema.meta({ title: "Tools", description: help.tools }).default(claudeOverrideDefaults.tools),
10304
- path_guard: claudePathGuardSchema.meta({ title: "Workspace path guard", description: help.path_guard }).default(claudeOverrideDefaults.path_guard),
10929
+ sandbox: external_exports.boolean().meta({ title: "Bash sandbox", description: help.sandbox }).default(claudeOverrideDefaults.sandbox),
10305
10930
  subagents: external_exports.boolean().meta({ title: "Allow subagents", description: help.subagents }).default(claudeOverrideDefaults.subagents),
10306
10931
  settings_files: external_exports.boolean().meta({
10307
10932
  title: "Load Claude Code settings",
@@ -10331,21 +10956,7 @@ var claudeRestrictionsSection = {
10331
10956
  `Limits on delegated Claude sessions, in every permission mode. ${userOnly}`
10332
10957
  ],
10333
10958
  rows: [
10334
- {
10335
- kind: "select",
10336
- ...row("sandbox"),
10337
- options: options(claudeOverrideLabels.sandbox)
10338
- },
10339
- {
10340
- kind: "select",
10341
- ...row("tools"),
10342
- options: options(claudeOverrideLabels.tools)
10343
- },
10344
- {
10345
- kind: "select",
10346
- ...row("path_guard"),
10347
- options: options(claudeOverrideLabels.path_guard)
10348
- },
10959
+ { kind: "switch", ...row("sandbox") },
10349
10960
  { kind: "switch", ...row("subagents") },
10350
10961
  { kind: "switch", ...row("settings_files") },
10351
10962
  { kind: "switch", ...row("user_mcp") }
@@ -10359,80 +10970,6 @@ var providerRestrictionSections = [claudeRestrictionsSection];
10359
10970
  var preferredSettingsProvider = (providers) => providers.includes("claude") ? "claude" : providers[0];
10360
10971
  var providerModelSettingScopes = ["claude", "fixture"];
10361
10972
 
10362
- // src/shared/settings/document-contract.generated.ts
10363
- var helpPartSchema = external_exports.union([
10364
- external_exports.string(),
10365
- external_exports.object({
10366
- text: external_exports.string(),
10367
- setting: external_exports.string()
10368
- })
10369
- ]);
10370
- var settingOptionSchema = external_exports.object({
10371
- value: external_exports.string(),
10372
- label: external_exports.string(),
10373
- description: external_exports.string().optional()
10374
- });
10375
- var settingRowBaseSchema = external_exports.object({
10376
- path: external_exports.string(),
10377
- label: external_exports.string(),
10378
- help: external_exports.array(helpPartSchema).optional(),
10379
- keywords: external_exports.array(external_exports.string()).optional()
10380
- });
10381
- var selectSettingRowSchema = settingRowBaseSchema.extend({
10382
- kind: external_exports.literal("select"),
10383
- options: external_exports.array(settingOptionSchema)
10384
- });
10385
- var switchSettingRowSchema = settingRowBaseSchema.extend({
10386
- kind: external_exports.literal("switch")
10387
- });
10388
- var textSettingRowSchema = settingRowBaseSchema.extend({
10389
- kind: external_exports.literal("text"),
10390
- maxLength: external_exports.number(),
10391
- pattern: external_exports.string()
10392
- });
10393
- var budgetSettingRowSchema = settingRowBaseSchema.extend({
10394
- kind: external_exports.literal("budget"),
10395
- unit: external_exports.string(),
10396
- min: external_exports.number(),
10397
- max: external_exports.number().optional()
10398
- });
10399
- var proseSettingSchema = settingRowBaseSchema.extend({
10400
- maxLength: external_exports.number()
10401
- });
10402
- var modelScopeSchema = external_exports.object({
10403
- id: external_exports.string(),
10404
- label: external_exports.string(),
10405
- model: external_exports.object({
10406
- path: external_exports.string(),
10407
- label: external_exports.string(),
10408
- options: external_exports.array(settingOptionSchema).optional()
10409
- }),
10410
- effort: external_exports.object({
10411
- path: external_exports.string(),
10412
- label: external_exports.string(),
10413
- options: external_exports.array(settingOptionSchema),
10414
- unsupported: external_exports.boolean()
10415
- }),
10416
- instructions: proseSettingSchema.optional()
10417
- });
10418
- var modelsSettingRowSchema = external_exports.object({
10419
- kind: external_exports.literal("models"),
10420
- scopes: external_exports.array(modelScopeSchema)
10421
- });
10422
- var settingRowSchema = external_exports.discriminatedUnion("kind", [
10423
- selectSettingRowSchema,
10424
- switchSettingRowSchema,
10425
- textSettingRowSchema,
10426
- budgetSettingRowSchema,
10427
- modelsSettingRowSchema
10428
- ]);
10429
- var settingSectionSchema = external_exports.object({
10430
- id: external_exports.string(),
10431
- title: external_exports.string(),
10432
- help: external_exports.array(helpPartSchema).optional(),
10433
- rows: external_exports.array(settingRowSchema)
10434
- });
10435
-
10436
10973
  // src/shared/settings/settings-schema.ts
10437
10974
  var branchPrefixPattern = "[\\w./-]*";
10438
10975
  var settingHelp = {
@@ -10448,7 +10985,7 @@ var budget = (title, unit, amount, keywords) => external_exports.strictObject({
10448
10985
  }).meta({ title, keywords }).prefault({});
10449
10986
  var modelScope = (label) => external_exports.strictObject({
10450
10987
  model: modelNameSchema.meta({ title: `${label} model` }).default(""),
10451
- reasoning_effort: reasoningSchema.meta({ title: `${label} reasoning effort` }).default("default")
10988
+ reasoning_effort: reasoningSchema.meta({ title: `${label} reasoning` }).default("default")
10452
10989
  }).prefault({});
10453
10990
  var scopes = (ids) => external_exports.strictObject(
10454
10991
  Object.fromEntries(
@@ -10468,7 +11005,10 @@ var settingsSchema = external_exports.strictObject({
10468
11005
  // enabled provider, and reads replace one that's no longer enabled.
10469
11006
  provider: external_exports.string().meta({ title: "Provider" }),
10470
11007
  worker_profile: external_exports.enum(roles).meta({ title: "Worker profile" }).default("reviewer"),
10471
- workspace_strategy: external_exports.enum(["worktree", "current_repo"]).meta({ title: "Workspace" }).default("current_repo"),
11008
+ workspace_strategy: external_exports.enum(["worktree", "current_repo"]).meta({
11009
+ title: "Workspace",
11010
+ description: "A project with no Git commit always uses the project folder, because worktrees need a commit."
11011
+ }).default("current_repo"),
10472
11012
  // Git checks the whole name when a worktree is created.
10473
11013
  worktree_branch_prefix: external_exports.string().max(100).regex(
10474
11014
  new RegExp(`^${branchPrefixPattern}$`),
@@ -10508,7 +11048,7 @@ var settingsSchema = external_exports.strictObject({
10508
11048
  }).default("user"),
10509
11049
  execution_mode: approvalModeSchema.meta({
10510
11050
  title: "Execution approval mode",
10511
- description: "Default for execution providers: ask user, delegate to the parent agent, auto-approve within the sandbox, or deny execution requests. Native permission settings are independent. Read-only profiles and sandbox limits remain enforced."
11051
+ description: "Default for execution providers: ask user, delegate to the parent agent, auto-approve within the sandbox, or deny execution requests. Native permission settings are independent."
10512
11052
  }).default("ask_user")
10513
11053
  }).meta({ userOnly: true }).prefault({}),
10514
11054
  projects: external_exports.strictObject({
@@ -10587,7 +11127,178 @@ function deepPartial(schema) {
10587
11127
  }
10588
11128
  var settingsPatchSchema = deepPartial(settingsSchema);
10589
11129
 
11130
+ // src/shared/providers/policy.ts
11131
+ init_define_EXTENSION_BUILD_INFO();
11132
+ var FAMILY_ALIASES = ["opus", "sonnet", "haiku", "fable"];
11133
+ var isModelVariant = (model, base) => model.startsWith(base) && /^(-\d{8}|-fast)+$/.test(model.slice(base.length));
11134
+ function entryAllows(entry, model, exact) {
11135
+ if (model === entry) return true;
11136
+ if (FAMILY_ALIASES.includes(entry)) return model.includes(`-${entry}-`);
11137
+ if (!model.startsWith(entry)) return false;
11138
+ return !exact || isModelVariant(model, entry);
11139
+ }
11140
+ function modelAllowed(policy, models, value) {
11141
+ const entries = policy?.available_models;
11142
+ const exact = policy?.available_models_match === "exact";
11143
+ const model = value.replace(/\[.*\]$/, "");
11144
+ if (!entries || !model || model === "default") return true;
11145
+ return models.some(
11146
+ (choice) => choice.value === value || choice.value === model || choice.resolvedModel === model
11147
+ ) || entries.some((entry) => entryAllows(entry, model, exact));
11148
+ }
11149
+ var blockedReason = (policy, mode) => policy?.blocked.find((item) => item.value === mode)?.reason;
11150
+ function withBlockedOptions(options2, policy) {
11151
+ return options2.map((option) => {
11152
+ const reason = blockedReason(policy, option.value);
11153
+ return reason ? { ...option, disabled: true, description: reason } : option;
11154
+ });
11155
+ }
11156
+
11157
+ // src/shared/providers/claude/settings-policy.ts
11158
+ function withPolicy(row2, policy, values) {
11159
+ if (row2.kind !== "select" || row2.path !== "providers.claude.permission_mode") {
11160
+ return row2;
11161
+ }
11162
+ const saved = String(settingAt(values, row2.path));
11163
+ const reason = blockedReason(policy, saved);
11164
+ return {
11165
+ ...row2,
11166
+ options: withBlockedOptions(row2.options, policy),
11167
+ ...reason ? {
11168
+ warning: reason === MODE_TURNED_OFF_BY_ORG ? `Your saved mode, ${permissionModeName(saved)}, is turned off by your organization. New tasks ask for approval.` : `Your saved mode, ${permissionModeName(saved)}, isn't available. New tasks ask for approval.`
11169
+ } : {}
11170
+ };
11171
+ }
11172
+ var SOURCE_HELP = {
11173
+ console: "Your organization's admin console sets these limits.",
11174
+ device: "A policy on this computer sets these limits."
11175
+ };
11176
+ function policyFacts(policy) {
11177
+ const modes = policy.blocked.filter(({ reason }) => reason === MODE_TURNED_OFF_BY_ORG).map(({ value }) => permissionModeName(value));
11178
+ return [
11179
+ ...modes.length ? [
11180
+ {
11181
+ label: "Permission modes",
11182
+ detail: `Turned off: ${modes.join(", ")}.`
11183
+ }
11184
+ ] : [],
11185
+ ...policy.available_models ? [
11186
+ {
11187
+ label: "Models",
11188
+ detail: policy.available_models.length ? `Limited to ${policy.available_models.join(", ")}.` : "Limited to the default model."
11189
+ }
11190
+ ] : [],
11191
+ ...policy.notes
11192
+ ];
11193
+ }
11194
+ function withClaudePolicy(sections, policy, values) {
11195
+ if (!policy) return sections;
11196
+ const applied = sections.map((section) => ({
11197
+ ...section,
11198
+ rows: section.rows.map((row2) => withPolicy(row2, policy, values))
11199
+ }));
11200
+ if (!policy.managed) return applied;
11201
+ const after = applied.findIndex(
11202
+ ({ id }) => id === claudeRestrictionsSection.id
11203
+ );
11204
+ applied.splice(after + 1, 0, {
11205
+ id: "organization-policy",
11206
+ title: "Organization policy",
11207
+ help: [
11208
+ `${policy.source ? SOURCE_HELP[policy.source] : "Your organization sets these limits."} Claude Code enforces them, along with any others your organization sets.`
11209
+ ],
11210
+ facts: policyFacts(policy),
11211
+ rows: []
11212
+ });
11213
+ return applied;
11214
+ }
11215
+
11216
+ // src/shared/settings/document-contract.generated.ts
11217
+ init_define_EXTENSION_BUILD_INFO();
11218
+ var helpPartSchema = external_exports.union([
11219
+ external_exports.string(),
11220
+ external_exports.object({
11221
+ text: external_exports.string(),
11222
+ setting: external_exports.string()
11223
+ })
11224
+ ]);
11225
+ var settingOptionSchema = external_exports.object({
11226
+ value: external_exports.string(),
11227
+ label: external_exports.string(),
11228
+ description: external_exports.string().optional(),
11229
+ disabled: external_exports.boolean().optional()
11230
+ });
11231
+ var settingRowBaseSchema = external_exports.object({
11232
+ path: external_exports.string(),
11233
+ label: external_exports.string(),
11234
+ help: external_exports.array(helpPartSchema).optional(),
11235
+ keywords: external_exports.array(external_exports.string()).optional()
11236
+ });
11237
+ var selectSettingRowSchema = settingRowBaseSchema.extend({
11238
+ kind: external_exports.literal("select"),
11239
+ options: external_exports.array(settingOptionSchema),
11240
+ warning: external_exports.string().optional()
11241
+ });
11242
+ var switchSettingRowSchema = settingRowBaseSchema.extend({
11243
+ kind: external_exports.literal("switch")
11244
+ });
11245
+ var textSettingRowSchema = settingRowBaseSchema.extend({
11246
+ kind: external_exports.literal("text"),
11247
+ maxLength: external_exports.number(),
11248
+ pattern: external_exports.string()
11249
+ });
11250
+ var budgetSettingRowSchema = settingRowBaseSchema.extend({
11251
+ kind: external_exports.literal("budget"),
11252
+ unit: external_exports.string(),
11253
+ min: external_exports.number(),
11254
+ max: external_exports.number().optional()
11255
+ });
11256
+ var proseSettingSchema = settingRowBaseSchema.extend({
11257
+ maxLength: external_exports.number()
11258
+ });
11259
+ var modelScopeSchema = external_exports.object({
11260
+ id: external_exports.string(),
11261
+ label: external_exports.string(),
11262
+ model: external_exports.object({
11263
+ path: external_exports.string(),
11264
+ label: external_exports.string(),
11265
+ options: external_exports.array(settingOptionSchema).optional(),
11266
+ warning: external_exports.string().optional()
11267
+ }),
11268
+ effort: external_exports.object({
11269
+ path: external_exports.string(),
11270
+ label: external_exports.string(),
11271
+ options: external_exports.array(settingOptionSchema),
11272
+ unsupported: external_exports.boolean()
11273
+ }),
11274
+ instructions: proseSettingSchema.optional()
11275
+ });
11276
+ var modelsSettingRowSchema = external_exports.object({
11277
+ kind: external_exports.literal("models"),
11278
+ scopes: external_exports.array(modelScopeSchema)
11279
+ });
11280
+ var settingRowSchema = external_exports.discriminatedUnion("kind", [
11281
+ selectSettingRowSchema,
11282
+ switchSettingRowSchema,
11283
+ textSettingRowSchema,
11284
+ budgetSettingRowSchema,
11285
+ modelsSettingRowSchema
11286
+ ]);
11287
+ var settingSectionSchema = external_exports.object({
11288
+ id: external_exports.string(),
11289
+ title: external_exports.string(),
11290
+ help: external_exports.array(helpPartSchema).optional(),
11291
+ facts: external_exports.array(
11292
+ external_exports.object({
11293
+ label: external_exports.string(),
11294
+ detail: external_exports.string()
11295
+ })
11296
+ ).optional(),
11297
+ rows: external_exports.array(settingRowSchema)
11298
+ });
11299
+
10590
11300
  // src/shared/settings/model-defaults.ts
11301
+ init_define_EXTENSION_BUILD_INFO();
10591
11302
  function modelScopePath(scope) {
10592
11303
  if (scope === "global") return "models.global";
10593
11304
  return roles.includes(scope) ? `models.profiles.${scope}` : `models.providers.${scope}`;
@@ -10606,7 +11317,7 @@ function resolveModelDefaults(values, { provider, profile }) {
10606
11317
 
10607
11318
  // src/shared/settings/settings-document.ts
10608
11319
  var sectionSchema = settingSectionSchema;
10609
- var unsupportedEffortWarning = "The saved effort is not supported by this model.";
11320
+ var unsupportedEffortWarning = "The saved reasoning is not supported by this model.";
10610
11321
  var withHelp = (parts, shown) => parts.map(
10611
11322
  (part) => typeof part === "string" || settingAt(shown, part.setting) !== void 0 ? part : part.text
10612
11323
  );
@@ -10615,14 +11326,17 @@ function described(path) {
10615
11326
  if (!schema) throw new Error(`Unknown setting ${path}`);
10616
11327
  return { path, ...settingText(schema) };
10617
11328
  }
10618
- var options2 = (labels) => Object.entries(labels).map(([value, label]) => ({ value, label }));
11329
+ var options = (labels) => Object.entries(labels).map(([value, label]) => ({ value, label }));
10619
11330
  function modelScope2(scope, { values, providers, catalogs }) {
10620
11331
  const scopePath = modelScopePath(scope), modelPath = `${scopePath}.model`, effortPath = `${scopePath}.reasoning_effort`, providerScope = providers.includes(scope), provider = providerScope ? scope : scalarText(settingAt(values, "task.provider"));
10621
- const choices = catalogs.filter((catalog) => !providerScope || catalog.provider === scope).flatMap((catalog) => catalog.models ?? []);
11332
+ const choices = catalogs.filter((catalog2) => !providerScope || catalog2.provider === scope).flatMap((catalog2) => catalog2.models ?? []);
10622
11333
  const saved = scalarText(settingAt(values, modelPath)), savedEffort = scalarText(settingAt(values, effortPath), "default");
10623
11334
  const chain = scope === "global" ? {} : { provider, profile: providerScope ? void 0 : scope };
10624
11335
  const effectiveModel = resolveModelDefaults(values, chain).model ?? "default";
10625
- const metadata = catalogs.find((catalog) => catalog.provider === provider)?.models?.find((model) => model.value === effectiveModel);
11336
+ const catalog = catalogs.find((item) => item.provider === provider);
11337
+ const metadata = catalog?.models?.find(
11338
+ (model) => model.value === effectiveModel
11339
+ );
10626
11340
  const levels = metadata?.supportsEffort === false ? [] : metadata?.supportedEffortLevels;
10627
11341
  const modelChoices = choices.length ? [
10628
11342
  { value: "", label: "Inherit" },
@@ -10652,6 +11366,7 @@ function modelScope2(scope, { values, providers, catalogs }) {
10652
11366
  effectiveModel,
10653
11367
  levels,
10654
11368
  modelChoices,
11369
+ modelExcluded: !modelAllowed(catalog?.policy, choices, saved),
10655
11370
  effortChoices: [
10656
11371
  { value: "default", label: "Inherit" },
10657
11372
  ...effortLevels.map((level) => ({ value: level, label: level }))
@@ -10669,11 +11384,14 @@ function settingsSections(input) {
10669
11384
  model: {
10670
11385
  path: info.modelPath,
10671
11386
  label: `${label} model`,
10672
- options: info.modelChoices
11387
+ options: info.modelChoices,
11388
+ ...info.modelExcluded ? {
11389
+ warning: "Your organization doesn't allow this model. New tasks use the default."
11390
+ } : {}
10673
11391
  },
10674
11392
  effort: {
10675
11393
  path: info.effortPath,
10676
- label: `${label} reasoning effort`,
11394
+ label: `${label} reasoning`,
10677
11395
  options: info.effortChoices,
10678
11396
  unsupported: info.unsupported
10679
11397
  }
@@ -10686,7 +11404,7 @@ function settingsSections(input) {
10686
11404
  { text: "worker profile", setting: profileModel },
10687
11405
  " defaults override these. Inherit uses ",
10688
11406
  { text: "Global", setting: "models.global.model" },
10689
- ", then the worker's own default. This applies to model and reasoning effort. Task choices override all defaults."
11407
+ ", then the worker's own default. This applies to model and reasoning. Task choices override all defaults."
10690
11408
  ],
10691
11409
  values
10692
11410
  );
@@ -10696,12 +11414,12 @@ function settingsSections(input) {
10696
11414
  { text: "provider", setting: providerModel },
10697
11415
  " default, then ",
10698
11416
  { text: "Global", setting: "models.global.model" },
10699
- ", then the worker's own default. This applies to model and reasoning effort. Task choices override profile defaults."
11417
+ ", then the worker's own default. This applies to model and reasoning. Task choices override profile defaults."
10700
11418
  ],
10701
11419
  values
10702
11420
  );
10703
11421
  const userOnly2 = "Only you can change these settings.";
10704
- return [
11422
+ const sections = [
10705
11423
  {
10706
11424
  id: "task",
10707
11425
  title: "Task defaults",
@@ -10722,8 +11440,8 @@ function settingsSections(input) {
10722
11440
  {
10723
11441
  kind: "select",
10724
11442
  ...described("task.workspace_strategy"),
10725
- options: options2({
10726
- current_repo: "Current repository",
11443
+ options: options({
11444
+ current_repo: "Project folder",
10727
11445
  worktree: "Isolated worktree"
10728
11446
  })
10729
11447
  },
@@ -10756,7 +11474,7 @@ function settingsSections(input) {
10756
11474
  {
10757
11475
  kind: "select",
10758
11476
  ...described("approvals.decider"),
10759
- options: options2({ user: "User", parent_agent: "Parent agent" })
11477
+ options: options({ user: "User", parent_agent: "Parent agent" })
10760
11478
  },
10761
11479
  { kind: "switch", ...described("projects.auto_register_chat") }
10762
11480
  ]
@@ -10797,6 +11515,11 @@ function settingsSections(input) {
10797
11515
  ]
10798
11516
  }
10799
11517
  ];
11518
+ return withClaudePolicy(
11519
+ sections,
11520
+ input.catalogs.find(({ provider }) => provider === "claude")?.policy,
11521
+ values
11522
+ );
10800
11523
  }
10801
11524
 
10802
11525
  // src/service/features/settings/settings-tool-schemas.ts
@@ -10826,6 +11549,7 @@ var settingsUpdateSchema = external_exports.strictObject({
10826
11549
  });
10827
11550
 
10828
11551
  // src/service/features/tasks/conversation/message-poll.ts
11552
+ init_define_EXTENSION_BUILD_INFO();
10829
11553
  var MAX_MESSAGE_WAIT_SECONDS = 50;
10830
11554
  var WAKE = /* @__PURE__ */ new Set([
10831
11555
  "task.instruction",
@@ -10837,7 +11561,7 @@ var WAKE = /* @__PURE__ */ new Set([
10837
11561
  async function pollMessages(store, drafts, owner, id, after, waitSeconds) {
10838
11562
  store.get(id, owner);
10839
11563
  let wake;
10840
- const woken = new Promise((resolve2) => wake = resolve2);
11564
+ const woken = new Promise((resolve3) => wake = resolve3);
10841
11565
  const onEvent = (e, eventOwner) => {
10842
11566
  if (eventOwner === owner && e.task_id === id && WAKE.has(e.type)) wake();
10843
11567
  };
@@ -10870,7 +11594,7 @@ async function pollMessages(store, drafts, owner, id, after, waitSeconds) {
10870
11594
  }
10871
11595
  function read(store, owner, id, after) {
10872
11596
  const task = store.get(id, owner);
10873
- const events = store.eventsOfTypes(id, [
11597
+ const events = store.conversationEvents(id, [
10874
11598
  ...MESSAGE_EVENTS,
10875
11599
  "task.turn_ended",
10876
11600
  "agent.input_required"
@@ -10888,7 +11612,11 @@ function read(store, owner, id, after) {
10888
11612
  }
10889
11613
 
10890
11614
  // src/service/platform/server/tools/definition.ts
11615
+ init_define_EXTENSION_BUILD_INFO();
10891
11616
  var taskId = external_exports.object({ task_id: external_exports.string() });
11617
+ var archivedFilter = external_exports.enum(archivedFilters).default("exclude").describe(
11618
+ "exclude (default) leaves archived tasks out, include lists them too and only lists just them. Archived tasks carry archived_at."
11619
+ );
10892
11620
  var queuedMessage = taskId.extend({ message_id: external_exports.string().max(200) });
10893
11621
  var messageInput = taskId.extend({
10894
11622
  request_id: external_exports.string().min(1).max(200).optional().describe(
@@ -10910,19 +11638,19 @@ function agentTools({ c, owner, authority, hostMeta }) {
10910
11638
  get_panel_context: tool({
10911
11639
  readOnly: true,
10912
11640
  conversation: "panel",
10913
- description: "Resolve panel defaults for repository, revision and conversation from explicit arguments, host_directory or this conversation's latest task. task_id selects an owned task. null conversation_id means all conversations. Never registers a project or starts work. For a returned panel_project_candidate, ask the user to use Add project in the panel.",
11641
+ description: "Resolve panel defaults for repository, revision and conversation from explicit arguments, host_directory or this conversation's latest task. task_id selects an owned task. null conversation_id means all conversations. Never registers a project or starts work. For a returned panel_project_candidate, ask the user to use Allow tasks here in the panel.",
10914
11642
  schema: panelContextInput,
10915
11643
  run: (a) => resolvePanelContext(c, owner, a)
10916
11644
  }),
10917
11645
  list_projects: tool({
10918
11646
  readOnly: true,
10919
- description: "List registered project roots. Pass one to start_task as the explicit absolute repository. Never registers. If the chat's project is missing, ask the user to use Add project in the panel.",
11647
+ description: "List registered project roots. Pass one to start_task as the explicit absolute repository. git is ready, no_commits or none when known, and only ready supports worktrees. Never registers. If the chat's project is missing, ask the user to use Allow tasks here or Add project in the panel.",
10920
11648
  schema: external_exports.strictObject({}),
10921
- run: () => c.projects?.list() ?? []
11649
+ run: () => c.projects?.listWithGit() ?? []
10922
11650
  }),
10923
11651
  get_current_project: tool({
10924
11652
  readOnly: true,
10925
- description: "Find the current chat's local Git root from host directory metadata and report whether it is registered. Never registers. For an unregistered project, follow next_step.",
11653
+ description: "Find the current chat's project from host directory metadata: its Git root, a registered folder containing it, or the directory itself. Reports whether it is registered and its Git state. Never registers. For an unregistered project, follow next_step.",
10926
11654
  schema: external_exports.strictObject({}),
10927
11655
  run: () => currentChatProject(c, owner, hostMeta)
10928
11656
  }),
@@ -10943,7 +11671,7 @@ function agentTools({ c, owner, authority, hostMeta }) {
10943
11671
  openWorld: true,
10944
11672
  panel: true,
10945
11673
  conversation: "chat",
10946
- description: "Start asynchronous work on the full request in description. The service generates the title. Work runs in the current checkout by default, including uncommitted changes. Reopen existing work with open_subagent_extension_for_codex(task_id), never another start_task.",
11674
+ description: "Start a background task from the user's full request in description. Use attachments for material the worker wouldn't find on its own. If the result has workspace_fallback, tell the user the task runs directly in the project folder without an isolated worktree. To show an existing task, call open_subagent_extension_for_codex(task_id) instead of starting another.",
10947
11675
  schema: startSchema.extend({
10948
11676
  conversation_id: startSchema.shape.conversation_id.nullable(),
10949
11677
  provider: startSchema.shape.provider.unwrap().optional(),
@@ -10953,7 +11681,7 @@ function agentTools({ c, owner, authority, hostMeta }) {
10953
11681
  max_runtime_minutes: startSchema.shape.budget.unwrap().shape.max_runtime_minutes.unwrap().optional(),
10954
11682
  max_cost_usd: startSchema.shape.budget.unwrap().shape.max_cost_usd.unwrap().optional()
10955
11683
  }).optional()
10956
- }),
11684
+ }).loose(),
10957
11685
  // Null opts out of host correlation; persisted tasks keep the optional string contract.
10958
11686
  run: async (a) => {
10959
11687
  await autoRegisterChatProject(c, owner, hostMeta, a.repository);
@@ -10966,7 +11694,7 @@ function agentTools({ c, owner, authority, hostMeta }) {
10966
11694
  }),
10967
11695
  get_task: tool({
10968
11696
  readOnly: true,
10969
- description: "Read a task's full state: status, turn (the number of turns started), pending input, draft (the message being written), pending steers not yet taken, queue (messages waiting for their own turn, and whether an interrupt paused it), branch for worktree tasks and an excerpt of the latest reply.",
11697
+ description: "Read a task's full state: status, turn (the number of turns started), pending input, draft (the message being written), pending steers not yet taken, queue (messages waiting for their own turn, and whether an interrupt paused it), branch for worktree tasks and an excerpt of the latest reply. Read the conversation with list_messages.",
10970
11698
  schema: taskId,
10971
11699
  run: (a) => {
10972
11700
  const t = c.store.get(a.task_id, owner);
@@ -10981,30 +11709,26 @@ function agentTools({ c, owner, authority, hostMeta }) {
10981
11709
  list_tasks: tool({
10982
11710
  readOnly: true,
10983
11711
  conversation: "chat",
10984
- description: "List your tasks, optionally filtered by conversation and repository. null conversation_id means all conversations. Each task includes an excerpt of its latest reply, its queued message count, unread: true when the user hasn't seen its latest update in the panel, read_through (the newest event they read) and archived_at when archived.",
11712
+ description: "List your tasks as summaries, newest first, optionally filtered by conversation and repository. null conversation_id means all conversations. Each summary has the task's status, turn, the kind of any pending_input, error, queued message count and an excerpt of its latest reply. Read a task's full state with get_task and its conversation with list_messages.",
10985
11713
  schema: external_exports.object({
10986
11714
  conversation_id: external_exports.string().nullable().optional(),
10987
- repository: external_exports.string().optional()
11715
+ repository: external_exports.string().optional(),
11716
+ archived: archivedFilter
10988
11717
  }),
10989
11718
  run: (a) => {
10990
- const archived = c.archive.times(owner);
10991
- return c.store.all(owner).filter(
10992
- (t) => (!a.conversation_id || t.conversation_id === a.conversation_id) && (!a.repository || t.repository === a.repository)
10993
- ).map(
10994
- (t) => listedTask(
10995
- t,
10996
- t.status === "running" ? c.store.recentEvents(t.id, owner) : [],
10997
- c.store.latestEvent(t.id, "agent.reply"),
10998
- c.drafts.get(t.id),
10999
- c.store.readState(t.id),
11000
- archived.get(t.id)
11001
- )
11002
- );
11719
+ const filters = {
11720
+ conversation: a.conversation_id || void 0,
11721
+ repository: a.repository || void 0,
11722
+ archived: a.archived
11723
+ };
11724
+ const archived = c.archive.times(owner, filters);
11725
+ const replies = c.store.latestEvents(owner, "agent.reply", filters);
11726
+ return c.store.list(owner, filters).map((t) => taskSummary(t, replies.get(t.id), archived.get(t.id)));
11003
11727
  }
11004
11728
  }),
11005
11729
  list_workers: tool({
11006
11730
  readOnly: true,
11007
- description: "List installed providers with their profiles, capabilities and readiness. When readiness.ready is false, report readiness.message to the user instead of retrying.",
11731
+ description: "List installed providers with their profiles, capabilities, readiness and any org policy limits. When readiness.ready is false, report readiness.message to the user instead of retrying. When policy is present, its blocked choices fail at start_task; absent policy doesn't mean everything is allowed.",
11008
11732
  schema: external_exports.object({}),
11009
11733
  run: () => c.availableWorkers(owner)
11010
11734
  }),
@@ -11080,7 +11804,7 @@ function agentTools({ c, owner, authority, hostMeta }) {
11080
11804
  const task = c.store.get(a.task_id, owner);
11081
11805
  const message = conversation(
11082
11806
  task,
11083
- c.store.eventsOfTypes(task.id, MESSAGE_EVENTS)
11807
+ c.store.conversationEvents(task.id, MESSAGE_EVENTS)
11084
11808
  ).find((m2) => m2.id === a.message_id);
11085
11809
  if (!message) throw new Error("Message not found");
11086
11810
  if (message.kind === "reply") {
@@ -11091,7 +11815,7 @@ function agentTools({ c, owner, authority, hostMeta }) {
11091
11815
  }),
11092
11816
  get_changes: tool({
11093
11817
  readOnly: true,
11094
- description: "Read the worker's recorded edits for the whole task or the latest turn as a unified diff with per-file stats. Prefer this to the worker's own account of its changes. Every page lists every file. Pass next_cursor to read more diffs. Incomplete files have no diff, and unrecorded_commands means a command changed files without recorded edits. Inspect those files directly. Commits and worktree removal leave these diffs unchanged. Worktree commits are on task.branch.",
11818
+ description: "Read the worker's recorded edits for the whole task or the latest turn as a unified diff with per-file stats. Prefer this to the worker's own account of its changes. Every page lists every file. Pass next_cursor to read more diffs. Incomplete files have no diff, and unrecorded_commands means a command changed or, in a folder without Git, may have changed files without recorded edits. Inspect those files directly. Commits and worktree removal leave these diffs unchanged. Worktree commits are on task.branch.",
11095
11819
  schema: taskId.extend({
11096
11820
  scope: external_exports.enum(["task", "turn"]).default("task"),
11097
11821
  cursor: external_exports.string().max(300).optional()
@@ -11118,157 +11842,385 @@ function agentTools({ c, owner, authority, hostMeta }) {
11118
11842
  };
11119
11843
  }
11120
11844
 
11121
- // src/shared/tasks/conversation/chat.ts
11122
- var CHAT_EVENTS = [
11123
- "task.started",
11124
- "task.instruction",
11125
- "agent.message",
11126
- "agent.reply",
11127
- "task.turn_ended",
11128
- "task.failed",
11129
- "task.session_started",
11130
- "task.worktree_recreated",
11131
- "agent.input_required"
11132
- ];
11133
- var isCompaction = (e) => {
11134
- return e.presentation?.kind === "compact_boundary";
11845
+ // src/service/platform/server/tools/user-tools.ts
11846
+ init_define_EXTENSION_BUILD_INFO();
11847
+
11848
+ // src/service/platform/service/about.ts
11849
+ init_define_EXTENSION_BUILD_INFO();
11850
+ var import_compare3 = __toESM(require_compare(), 1);
11851
+ import { existsSync as existsSync2 } from "node:fs";
11852
+
11853
+ // src/service/features/providers/claude/configuration/executable.ts
11854
+ init_define_EXTENSION_BUILD_INFO();
11855
+ var import_compare = __toESM(require_compare(), 1);
11856
+ import { execFile } from "node:child_process";
11857
+ import { constants } from "node:fs";
11858
+ import { access, realpath as realpath2, stat } from "node:fs/promises";
11859
+ import { isAbsolute as isAbsolute3, join as join2, win32 } from "node:path";
11860
+ import { promisify } from "node:util";
11861
+ var claudeCliSupport = {
11862
+ sdk: "0.3.319",
11863
+ minimum: "2.1.300",
11864
+ paired: "2.1.319"
11865
+ };
11866
+ var claudePathVariable = "SUBAGENT_EXTENSION_FOR_CODEX_CLAUDE_PATH";
11867
+ var supportedRange = `${claudeCliSupport.minimum}+`;
11868
+ var setupDocs = "https://code.claude.com/docs/en/setup";
11869
+ var FRESH_MS = 5 * 60 * 1e3;
11870
+ var FAILED_FRESH_MS = 30 * 1e3;
11871
+ var VERSION_TIMEOUT_MS = 1e4;
11872
+ var VERSION_OUTPUT_BYTES = 4096;
11873
+ var execFileAsync = promisify(execFile);
11874
+ var failure = (problem, message, facts = {}) => ({
11875
+ ready: false,
11876
+ problem,
11877
+ message,
11878
+ ...facts,
11879
+ supported: supportedRange
11880
+ });
11881
+ async function isFile(path, mode = constants.F_OK) {
11882
+ try {
11883
+ await access(path, mode);
11884
+ return (await stat(path)).isFile();
11885
+ } catch {
11886
+ return false;
11887
+ }
11888
+ }
11889
+ function pathVariable({ env, platform }) {
11890
+ if (platform !== "win32") return env.PATH ?? "";
11891
+ const name = Object.keys(env).find((key) => key.toUpperCase() === "PATH");
11892
+ return name ? env[name] ?? "" : "";
11893
+ }
11894
+ async function inDirectory(directory, platform) {
11895
+ if (platform !== "win32") {
11896
+ const candidate = join2(directory, "claude");
11897
+ return await isFile(candidate, constants.X_OK) ? candidate : void 0;
11898
+ }
11899
+ const native = join2(directory, "claude.exe");
11900
+ if (await isFile(native)) return native;
11901
+ for (const launcher of ["claude.cmd", "claude.ps1", "claude"]) {
11902
+ if (!await isFile(join2(directory, launcher))) continue;
11903
+ const target = join2(
11904
+ directory,
11905
+ "node_modules",
11906
+ "@anthropic-ai",
11907
+ "claude-code",
11908
+ "bin",
11909
+ "claude.exe"
11910
+ );
11911
+ if (await isFile(target)) return target;
11912
+ }
11913
+ return void 0;
11914
+ }
11915
+ async function locateClaudeCli(environment) {
11916
+ const override = environment.env[claudePathVariable];
11917
+ const absolute = (path) => environment.platform === "win32" ? win32.isAbsolute(path) : isAbsolute3(path);
11918
+ if (override) {
11919
+ if (!absolute(override)) {
11920
+ return {
11921
+ problem: "invalid_override",
11922
+ message: `${claudePathVariable} must be an absolute path to the Claude Code executable; it is "${override}".`
11923
+ };
11924
+ }
11925
+ try {
11926
+ return { path: await realpath2(override), launcher: override };
11927
+ } catch {
11928
+ return {
11929
+ problem: "invalid_override",
11930
+ message: `${claudePathVariable} points to ${override}, which does not exist. Fix or unset it; the service does not fall back to PATH while it is set.`
11931
+ };
11932
+ }
11933
+ }
11934
+ const separator = environment.platform === "win32" ? ";" : ":";
11935
+ for (const directory of pathVariable(environment).split(separator)) {
11936
+ if (!directory || !absolute(directory)) continue;
11937
+ const found = await inDirectory(directory, environment.platform);
11938
+ if (!found) continue;
11939
+ try {
11940
+ return { path: await realpath2(found), launcher: found };
11941
+ } catch {
11942
+ }
11943
+ }
11944
+ return {
11945
+ problem: "missing",
11946
+ message: `Claude Code was not found on the service's PATH. Install a supported version (${supportedRange}) from ${setupDocs}: the stable channel is the Homebrew claude-code cask or npm's @anthropic-ai/claude-code@stable. Or set ${claudePathVariable} to its absolute path.`
11947
+ };
11948
+ }
11949
+ function parseClaudeVersion(output) {
11950
+ return /^(\d+\.\d+\.\d+) \(Claude Code\)$/.exec(output.trim())?.[1];
11951
+ }
11952
+ async function versionOutput(path, timeout) {
11953
+ const { stdout } = await execFileAsync(path, ["--version"], {
11954
+ timeout,
11955
+ maxBuffer: VERSION_OUTPUT_BYTES,
11956
+ windowsHide: true
11957
+ });
11958
+ return stdout;
11959
+ }
11960
+ function unlaunchableReason(error, timeout) {
11961
+ if (error.killed) {
11962
+ return `\`--version\` did not finish within ${timeout / 1e3} seconds`;
11963
+ }
11964
+ return error instanceof Error ? error.message : String(error);
11965
+ }
11966
+ async function validateClaudeCli(path, timeout = VERSION_TIMEOUT_MS) {
11967
+ let output;
11968
+ try {
11969
+ output = await versionOutput(path, timeout);
11970
+ } catch (error) {
11971
+ const reason = unlaunchableReason(error, timeout);
11972
+ return failure(
11973
+ "unlaunchable",
11974
+ `Claude Code at ${path} could not be run: ${reason}. Reinstall it from ${setupDocs}, or set ${claudePathVariable} to a working copy.`,
11975
+ { path }
11976
+ );
11977
+ }
11978
+ const version = parseClaudeVersion(output);
11979
+ if (!version) {
11980
+ return failure(
11981
+ "unrecognized",
11982
+ `${path} --version printed "${output.trim().slice(0, 200)}", not a Claude Code release version. Install a supported release (${supportedRange}); prereleases aren't supported.`,
11983
+ { path }
11984
+ );
11985
+ }
11986
+ if ((0, import_compare.default)(version, claudeCliSupport.minimum) < 0) {
11987
+ return failure(
11988
+ "too_old",
11989
+ `Claude Code ${version} at ${path} is older than the supported ${supportedRange}. Update it using its original installer (see ${setupDocs}), or set ${claudePathVariable} to a supported copy.`,
11990
+ { path, version }
11991
+ );
11992
+ }
11993
+ return { ready: true, path, version, supported: supportedRange };
11994
+ }
11995
+ var ClaudeCli = class {
11996
+ constructor(environment = () => ({
11997
+ env: process.env,
11998
+ platform: process.platform
11999
+ }), validate2 = validateClaudeCli) {
12000
+ this.environment = environment;
12001
+ this.validate = validate2;
12002
+ }
12003
+ environment;
12004
+ validate;
12005
+ cache;
12006
+ async status({ refresh = false } = {}) {
12007
+ const located = await locateClaudeCli(this.environment());
12008
+ if (!("path" in located)) {
12009
+ return failure(located.problem, located.message);
12010
+ }
12011
+ let identity;
12012
+ try {
12013
+ const file = await stat(located.path);
12014
+ identity = [located.path, file.dev, file.ino, file.mtimeMs].join("\0");
12015
+ } catch (error) {
12016
+ return failure(
12017
+ "unlaunchable",
12018
+ `Claude Code at ${located.path} could not be read: ${error instanceof Error ? error.message : String(error)}.`,
12019
+ { path: located.path }
12020
+ );
12021
+ }
12022
+ const now = Date.now();
12023
+ if (!refresh && this.cache?.identity === identity && this.cache.expires > now) {
12024
+ return this.cache.status;
12025
+ }
12026
+ const status = this.validate(located.path);
12027
+ const entry = { identity, expires: now + FRESH_MS, status };
12028
+ this.cache = entry;
12029
+ const shorten = () => {
12030
+ entry.expires = now + FAILED_FRESH_MS;
12031
+ };
12032
+ status.then((result) => !result.ready && shorten(), shorten);
12033
+ return status;
12034
+ }
12035
+ /** The validated executable's path; throws the readiness message when unsupported. */
12036
+ async executable() {
12037
+ const status = await this.status();
12038
+ if (!status.ready) throw new Error(status.message);
12039
+ return status.path;
12040
+ }
11135
12041
  };
11136
- function note(e) {
11137
- const base = {
11138
- kind: "note",
11139
- id: `evt_${e.id}`,
11140
- event_id: e.id,
11141
- timestamp: e.timestamp
12042
+
12043
+ // src/service/features/providers/claude/configuration/upgrade.ts
12044
+ init_define_EXTENSION_BUILD_INFO();
12045
+ import { constants as constants2 } from "node:fs";
12046
+ import { access as access2, stat as stat2 } from "node:fs/promises";
12047
+ import { homedir } from "node:os";
12048
+ import { dirname, join as join3, resolve as resolve2 } from "node:path";
12049
+ var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
12050
+ async function executable(path) {
12051
+ try {
12052
+ await access2(path, constants2.X_OK);
12053
+ return (await stat2(path)).isFile();
12054
+ } catch {
12055
+ return false;
12056
+ }
12057
+ }
12058
+ async function claudeUpgradeInfo(selected, environment = {
12059
+ env: process.env,
12060
+ platform: process.platform
12061
+ }, home = homedir()) {
12062
+ const unknown2 = {
12063
+ installation: "Unidentified",
12064
+ note: "Use the installer or package manager that provided this executable. The service cannot determine a command that targets this installation."
11142
12065
  };
11143
- const session = eventPayload(e, "task.session_started");
11144
- if (session) {
12066
+ if (!selected) {
11145
12067
  return {
11146
- ...base,
11147
- note: "session",
11148
- text: session.reason === "no_session" ? "New session: the task had none to continue" : "New session: the earlier one couldn't continue"
12068
+ ...unknown2,
12069
+ note: "Fix the CLI readiness issue, then recheck to identify its installation."
11149
12070
  };
11150
12071
  }
11151
- const worktree = eventPayload(e, "task.worktree_recreated");
11152
- if (worktree) {
12072
+ if (environment.platform === "win32") return unknown2;
12073
+ const located = await locateClaudeCli(environment);
12074
+ if (!("path" in located) || located.path !== selected) {
11153
12075
  return {
11154
- ...base,
11155
- note: "worktree",
11156
- text: worktree.from === "base" ? "Worktree recreated from the base commit, since its branch was deleted" : "Worktree recreated from its branch"
12076
+ ...unknown2,
12077
+ note: "The selected executable changed while checking. Recheck its version before choosing an upgrade command."
11157
12078
  };
11158
12079
  }
11159
- const failed = eventPayload(e, "task.failed");
11160
- if (failed) {
12080
+ const pinned = "This uses a custom launcher or a version-specific path. Updating may leave that path on the old version. Use the installer's launcher, update the configured path if needed, then restart the service.";
12081
+ const brew = /^(.*)\/Caskroom\/(claude-code(?:@latest)?)\/[^/]+\/claude$/.exec(selected);
12082
+ if (brew) {
12083
+ const prefix = brew[1], cask = brew[2], manager = join3(prefix, "bin", "brew");
12084
+ const installation = cask === "claude-code@latest" ? "Homebrew (latest)" : "Homebrew (stable)";
12085
+ if (resolve2(located.launcher) !== join3(prefix, "bin", "claude")) {
12086
+ return { installation, note: pinned };
12087
+ }
12088
+ if (!await executable(manager)) {
12089
+ return {
12090
+ installation,
12091
+ note: "The matching Homebrew executable is unavailable. Restore Homebrew for this prefix, or use its installation guidance."
12092
+ };
12093
+ }
11161
12094
  return {
11162
- ...base,
11163
- note: "failure",
11164
- text: `Task failed: ${scalarText(failed.error, "Unknown error")}`
12095
+ installation,
12096
+ command: `${quote(manager)} upgrade --cask ${cask}`,
12097
+ note: "Run in a terminal after delegated turns finish. This keeps the installed cask and release channel."
11165
12098
  };
11166
12099
  }
11167
- if (isCompaction(e)) {
11168
- return { ...base, note: "compaction", text: "Context compacted" };
12100
+ const versions = join3(home, ".local", "share", "claude", "versions"), launcher = join3(home, ".local", "bin", "claude");
12101
+ if (dirname(selected) === versions && /^\d+\.\d+\.\d+$/.test(selected.slice(versions.length + 1))) {
12102
+ if (resolve2(located.launcher) !== launcher) {
12103
+ return { installation: "Native installer", note: pinned };
12104
+ }
12105
+ return {
12106
+ installation: "Native installer",
12107
+ command: `${quote(launcher)} update`,
12108
+ note: "Run in a terminal after delegated turns finish. Claude's updater follows its configured release channel and policy."
12109
+ };
11169
12110
  }
11170
- if (e.type === "claude.activity" && e.presentation?.statusTitle === "Context compaction failed") {
11171
- return { ...base, note: "failure", text: "Context compaction failed" };
12111
+ if (/\/node_modules\/@anthropic-ai\/claude-code(?:-[^/]+)?\//.test(selected)) {
12112
+ return {
12113
+ installation: "Node package",
12114
+ note: "Use the original package manager, installation prefix and release channel. The executable path alone cannot establish whether this is a global npm install or a project dependency."
12115
+ };
11172
12116
  }
11173
- return void 0;
12117
+ return unknown2;
11174
12118
  }
11175
- function chatItems(task, events) {
11176
- const sorted = [...events].sort((a, b) => a.id - b.id);
11177
- const messages = conversation(task, sorted);
11178
- const items = [];
11179
- let next = 0;
11180
- let failedOutcome;
11181
- const flush = (until) => {
11182
- for (let message = messages[next]; message && message.event_id <= until; message = messages[++next]) {
11183
- items.push({
11184
- kind: "message",
11185
- id: message.id,
11186
- event_id: message.event_id,
11187
- message
11188
- });
11189
- }
12119
+
12120
+ // src/service/platform/service/build-info.ts
12121
+ init_define_EXTENSION_BUILD_INFO();
12122
+ import { execFileSync } from "node:child_process";
12123
+ import { existsSync, readFileSync as readFileSync2 } from "node:fs";
12124
+ import { join as join4 } from "node:path";
12125
+ function collectBuildInfo(root) {
12126
+ const version = (path) => JSON.parse(readFileSync2(path, "utf8")).version;
12127
+ const info = {
12128
+ version: version(join4(root, "package.json")),
12129
+ sdks: [
12130
+ "@anthropic-ai/claude-agent-sdk",
12131
+ "@modelcontextprotocol/sdk",
12132
+ "@modelcontextprotocol/ext-apps"
12133
+ ].map((name) => ({
12134
+ name,
12135
+ version: version(join4(root, "node_modules", name, "package.json"))
12136
+ }))
11190
12137
  };
11191
- for (const e of sorted) {
11192
- const turnEnded = eventPayload(e, "task.turn_ended");
11193
- if (turnEnded) {
11194
- flush(e.id);
11195
- const outcome = {
11196
- kind: "outcome",
11197
- id: `turn_${turnEnded.turn}_${e.id}`,
11198
- event_id: e.id,
11199
- timestamp: e.timestamp,
11200
- turn: turnEnded.turn,
11201
- outcome: turnEnded.outcome,
11202
- runtime_ms: turnEnded.runtime_ms,
11203
- cost_usd: turnEnded.cost_usd
11204
- };
11205
- items.push(outcome);
11206
- failedOutcome = outcome.outcome === "failed" ? outcome : void 0;
11207
- } else if (eventPayload(e, "task.failed")) {
11208
- if (failedOutcome) {
11209
- failedOutcome.error = scalarText(eventPayload(e, "task.failed")?.error);
11210
- failedOutcome.event_id = e.id;
11211
- } else {
11212
- flush(e.id);
11213
- items.push(note(e));
11214
- }
11215
- failedOutcome = void 0;
11216
- } else {
11217
- if (eventPayload(e, "task.instruction") !== void 0 || eventPayload(e, "task.queued") !== void 0 || eventPayload(e, "task.started") !== void 0) {
11218
- failedOutcome = void 0;
11219
- }
11220
- const marker = note(e);
11221
- if (marker) {
11222
- flush(e.id);
11223
- items.push(marker);
11224
- }
12138
+ if (existsSync(join4(root, ".git"))) {
12139
+ const git = (...args) => execFileSync("git", ["-C", root, ...args], {
12140
+ encoding: "utf8",
12141
+ timeout: 2e3,
12142
+ maxBuffer: 1024 * 1024,
12143
+ stdio: ["ignore", "pipe", "ignore"]
12144
+ }).trim();
12145
+ try {
12146
+ info.commit = git("rev-parse", "HEAD");
12147
+ info.dirty = Boolean(
12148
+ git("status", "--porcelain", "--untracked-files=normal")
12149
+ );
12150
+ } catch {
11225
12151
  }
11226
12152
  }
11227
- flush(Infinity);
11228
- return items;
12153
+ return info;
11229
12154
  }
11230
12155
 
11231
- // src/shared/tasks/conversation/drafts.ts
11232
- var MAX_UPDATE_WAIT_MS = 25e3;
11233
-
11234
- // src/service/features/tasks/conversation/updates.ts
11235
- import { setTimeout as sleep } from "node:timers/promises";
11236
- var RUNNING = ["queued", "starting", "running", "waiting"];
11237
- async function waitForUpdates(store, drafts, owner, { after, draft: target, wait_ms }) {
11238
- const changed = new AbortController();
11239
- const onChange = (changedOwner) => {
11240
- if (changedOwner === void 0 || changedOwner === owner) changed.abort();
12156
+ // src/service/platform/service/identity.ts
12157
+ init_define_EXTENSION_BUILD_INFO();
12158
+ var import_compare2 = __toESM(require_compare(), 1);
12159
+ var serviceApiVersion = 2;
12160
+ var launcherEnv = "SUBAGENT_EXTENSION_FOR_CODEX_LAUNCHER";
12161
+ function serviceIdentity(env = process.env) {
12162
+ return {
12163
+ version: packageVersion,
12164
+ apiVersion: serviceApiVersion,
12165
+ launcher: env[launcherEnv] === "stdio" ? "stdio" : "foreground",
12166
+ installRoot
11241
12167
  };
11242
- store.bus.on("change", onChange);
11243
- try {
11244
- const waitMs = after === store.revision(owner) ? wait_ms : 0;
11245
- if (!target) {
11246
- await sleep(waitMs, void 0, { signal: changed.signal }).catch(
11247
- () => {
11248
- }
11249
- // A change ended the wait.
11250
- );
11251
- return { revision: store.revision(owner) };
11252
- }
11253
- const draft = store.find(target.task_id, owner) && await drafts.wait(
11254
- target.task_id,
11255
- { message_id: target.message_id, length: target.after_length },
11256
- waitMs,
11257
- // A turn's end commits events, which change the revision and end this.
11258
- changed.signal
11259
- );
11260
- const task = store.find(target.task_id, owner);
11261
- return {
11262
- revision: store.revision(owner),
11263
- draft: task && draft || null,
11264
- running: task ? RUNNING.includes(task.status) : false
12168
+ }
12169
+ function handoff(running, own2, origin) {
12170
+ const compatible = running.apiVersion === own2.apiVersion;
12171
+ const described2 = `version ${running.version ?? "unknown"}`;
12172
+ if (running.launcher !== "stdio") {
12173
+ return compatible ? { action: "use" } : {
12174
+ action: "refuse",
12175
+ message: `A different extension service (${described2}, not started by the plugin) is running at ${origin}. Stop it, or give development its own SUBAGENT_EXTENSION_FOR_CODEX_DATA and PORT.`
11265
12176
  };
11266
- } finally {
11267
- store.bus.off("change", onChange);
11268
12177
  }
12178
+ const order = running.version ? (0, import_compare2.default)(running.version, own2.version) : -1;
12179
+ if (order > 0) {
12180
+ return compatible ? { action: "use" } : {
12181
+ action: "refuse",
12182
+ message: `A newer extension service (${described2}) is running at ${origin}; update the plugin to ${running.version} or later.`
12183
+ };
12184
+ }
12185
+ if (order < 0 || !running.installed || !compatible) {
12186
+ return { action: "replace", forward: compatible };
12187
+ }
12188
+ return { action: "use" };
12189
+ }
12190
+
12191
+ // src/service/platform/service/about.ts
12192
+ var build = typeof define_EXTENSION_BUILD_INFO_default === "undefined" ? collectBuildInfo(installRoot) : define_EXTENSION_BUILD_INFO_default;
12193
+ async function aboutInfo(c, refresh = false) {
12194
+ const claude = await c.providers.get("claude")?.readiness?.({ refresh }), version = claude?.details.version, upgrade = claude ? await claudeUpgradeInfo(version ? claude.details.executable : void 0) : void 0;
12195
+ if (refresh) {
12196
+ logEvent("info", "about.claude_rechecked", {
12197
+ ready: claude?.ready,
12198
+ problem: claude?.details.problem,
12199
+ version,
12200
+ executable: claude?.details.executable,
12201
+ installation: upgrade?.installation
12202
+ });
12203
+ }
12204
+ return {
12205
+ build,
12206
+ installation: existsSync2(packagePath("src", "service", "main.ts")) ? "checkout" : "package",
12207
+ runtime: {
12208
+ node: process.versions.node,
12209
+ platform: process.platform,
12210
+ arch: process.arch,
12211
+ launcher: serviceIdentity().launcher
12212
+ },
12213
+ claude,
12214
+ claude_recommended: version ? {
12215
+ version: claudeCliSupport.paired,
12216
+ behind: (0, import_compare3.default)(version, claudeCliSupport.paired) < 0
12217
+ } : void 0,
12218
+ claude_upgrade: upgrade
12219
+ };
11269
12220
  }
11270
12221
 
11271
12222
  // src/service/platform/server/tools/activity-tools.ts
12223
+ init_define_EXTENSION_BUILD_INFO();
11272
12224
  function activityTools(c, owner) {
11273
12225
  return {
11274
12226
  app_get_change_counts: tool({
@@ -11290,20 +12242,9 @@ function activityTools(c, owner) {
11290
12242
  return original === void 0 ? { available: false } : { available: true, original };
11291
12243
  }
11292
12244
  }),
11293
- app_get_activity: tool({
11294
- readOnly: true,
11295
- description: "User interface only: a task's activity for the panel's Activity tab: its newest events after a cursor, and a tally of the older events outside the window (the summary's count, timestamps, tool calls, messages, failures and retries).",
11296
- schema: taskId.extend({
11297
- after: external_exports.number().int().nonnegative().default(0)
11298
- }),
11299
- run: (a) => {
11300
- c.store.get(a.task_id, owner);
11301
- return c.activity.page(a.task_id, a.after);
11302
- }
11303
- }),
11304
12245
  app_get_turn_activity: tool({
11305
12246
  readOnly: true,
11306
- description: "User interface only: one turn's activity for the panel's Activity tab: the events after the previous turn's closing status event through this turn's, or to the newest event while the turn runs. Its newest events come with a tally of the older ones, as app_get_activity gives them.",
12247
+ description: "User interface only: one turn's activity for the panel's Activity tab: the events after the previous turn's closing status event through this turn's, or to the newest event while the turn runs. Its newest events come with a tally of the older ones, as a view's Activity gives them.",
11307
12248
  schema: taskId.extend({ turn: external_exports.number().int().positive() }),
11308
12249
  run: (a) => {
11309
12250
  c.store.get(a.task_id, owner);
@@ -11313,7 +12254,11 @@ function activityTools(c, owner) {
11313
12254
  };
11314
12255
  }
11315
12256
 
12257
+ // src/service/platform/server/tools/panel-timing-tool.ts
12258
+ init_define_EXTENSION_BUILD_INFO();
12259
+
11316
12260
  // src/shared/tasks/panel-timing.ts
12261
+ init_define_EXTENSION_BUILD_INFO();
11317
12262
  var timedOperations = ["app_send_message", "interrupt_task"];
11318
12263
  var taskIdPattern = /^task_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
11319
12264
  var panelRequestIdPattern = /^[0-9a-f]{32}$/;
@@ -11332,8 +12277,8 @@ var PANEL_TIMING_MAX_DURATION_MS = 1e12;
11332
12277
  var workCount = external_exports.number().int().nonnegative().max(PANEL_TIMING_MAX_COUNT);
11333
12278
  var elapsed = external_exports.number().nonnegative().max(PANEL_TIMING_MAX_DURATION_MS);
11334
12279
  var panelLoadTimingRecordSchema = external_exports.strictObject({
11335
- operation: external_exports.enum(["task_list", "chat", "activity_latest", "activity_turn"]),
11336
- phase: external_exports.enum(["fetch", "decode", "merge", "group"]),
12280
+ operation: external_exports.enum(["view", "task_list", "activity_latest", "activity_turn"]),
12281
+ phase: external_exports.enum(["fetch", "deliver", "decode", "merge", "group"]),
11337
12282
  count: workCount.positive(),
11338
12283
  total_ms: elapsed,
11339
12284
  max_ms: elapsed,
@@ -11352,6 +12297,7 @@ var panelTimingBatchSchema = external_exports.strictObject({
11352
12297
  });
11353
12298
 
11354
12299
  // src/service/features/tasks/runtime/timing.ts
12300
+ init_define_EXTENSION_BUILD_INFO();
11355
12301
  import { createHash } from "node:crypto";
11356
12302
  var writer;
11357
12303
  var previousWrites = Promise.resolve();
@@ -11455,7 +12401,33 @@ function panelTimingTool() {
11455
12401
  });
11456
12402
  }
11457
12403
 
12404
+ // src/service/platform/server/tools/panel-view-tools.ts
12405
+ init_define_EXTENSION_BUILD_INFO();
12406
+
12407
+ // src/shared/tasks/conversation/drafts.ts
12408
+ init_define_EXTENSION_BUILD_INFO();
12409
+ var MAX_UPDATE_WAIT_MS = 25e3;
12410
+
12411
+ // src/service/features/tasks/conversation/chat-read.ts
12412
+ init_define_EXTENSION_BUILD_INFO();
12413
+ function chatRead(store, attachments, task, after) {
12414
+ const events = store.chatEvents(task.id, after);
12415
+ const items = chatItems(task, events).filter(
12416
+ (item) => item.event_id > after || after === 0 && item.event_id === 0
12417
+ );
12418
+ const request = items[0];
12419
+ if (after === 0 && request?.kind === "message") {
12420
+ const attached = attachments.list(task.id).map(({ file: _2, ...a }) => a);
12421
+ if (attached.length) request.message.attachments = attached;
12422
+ }
12423
+ return { items, next_cursor: Math.max(after, events.at(-1)?.id ?? 0) };
12424
+ }
12425
+
12426
+ // src/service/features/tasks/conversation/parent-updates.ts
12427
+ init_define_EXTENSION_BUILD_INFO();
12428
+
11458
12429
  // src/shared/tasks/conversation/parent-updates.ts
12430
+ init_define_EXTENSION_BUILD_INFO();
11459
12431
  var PARENT_UPDATE_EVENTS = [
11460
12432
  "agent.reply",
11461
12433
  "task.failed",
@@ -11482,11 +12454,13 @@ function parentUpdate(task, e, parentDecides) {
11482
12454
  }
11483
12455
  const failed = eventPayload(e, "task.failed");
11484
12456
  if (failed) {
11485
- const error = failed.error ?? "The task failed.";
11486
12457
  return {
11487
12458
  ...base,
11488
- kind: /budget/i.test(error) ? "budget" : "failed",
11489
- text: replyExcerpt(error, SNIPPET_CHARS)
12459
+ kind: isBudgetFailure(failed.error_code) ? "budget" : "failed",
12460
+ text: replyExcerpt(
12461
+ failureMessage(failed) ?? "The task failed.",
12462
+ SNIPPET_CHARS
12463
+ )
11490
12464
  };
11491
12465
  }
11492
12466
  const request = eventPayload(e, "agent.input_required")?.request;
@@ -11526,23 +12500,154 @@ function pendingUpdates(store, seen, parentDecides, owner, conversation2) {
11526
12500
  return [...byTask.values()];
11527
12501
  }
11528
12502
 
11529
- // src/service/platform/server/tools/pending-update-tools.ts
11530
- function pendingUpdateTools(c, owner) {
12503
+ // src/service/features/tasks/conversation/updates.ts
12504
+ init_define_EXTENSION_BUILD_INFO();
12505
+ import { setTimeout as sleep } from "node:timers/promises";
12506
+ var RUNNING = ["queued", "starting", "running", "waiting"];
12507
+ async function waitForUpdates(store, drafts, owner, { after, draft: target, wait_ms }, view) {
12508
+ const changed = new AbortController();
12509
+ const known = target && {
12510
+ task_id: target.task_id,
12511
+ message_id: target.message_id,
12512
+ length: target.after_length
12513
+ };
12514
+ const onChange = (changedOwner) => {
12515
+ if (changedOwner === void 0 || changedOwner === owner) changed.abort();
12516
+ };
12517
+ store.bus.on("change", onChange);
12518
+ try {
12519
+ const waitMs = after === store.revision(owner) ? wait_ms : 0;
12520
+ if (!known) {
12521
+ await sleep(waitMs, void 0, { signal: changed.signal }).catch(
12522
+ () => {
12523
+ }
12524
+ // A change ended the wait.
12525
+ );
12526
+ } else if (store.find(known.task_id, owner)) {
12527
+ await drafts.wait(known.task_id, known, waitMs, changed.signal);
12528
+ }
12529
+ } finally {
12530
+ store.bus.off("change", onChange);
12531
+ }
12532
+ const readView = await view?.();
12533
+ const revision = store.revision(owner);
12534
+ if (!known) return { revision, ...readView && { view: readView() } };
12535
+ const task = store.find(known.task_id, owner);
12536
+ const draftOnly = revision === after && !!task && drafts.differs(task.id, known);
11531
12537
  return {
11532
- app_list_pending_updates: tool({
12538
+ revision,
12539
+ draft: (task && drafts.get(task.id)) ?? null,
12540
+ running: task ? RUNNING.includes(task.status) : false,
12541
+ ...readView && !draftOnly && { view: readView() }
12542
+ };
12543
+ }
12544
+
12545
+ // src/service/platform/server/tools/panel-view-tools.ts
12546
+ function panelViewTools(c, owner) {
12547
+ const list = tool({
12548
+ readOnly: true,
12549
+ description: "User interface only: { tasks, read_completed }, the tasks the panel lists, newest first. Each has its full state except the conversation, with its latest reply excerpt, live activity, draft, read state and archive time. include names tasks to list whatever the filters say. Unless include_read_completed is true, completed tasks the user has read are left out, except included ones and the newest, and read_completed counts them by repository.",
12550
+ schema: external_exports.object({
12551
+ conversation_id: external_exports.string().nullable().optional(),
12552
+ repository: external_exports.string().optional(),
12553
+ archived: archivedFilter,
12554
+ include: external_exports.array(external_exports.string()).max(10).optional(),
12555
+ include_read_completed: external_exports.boolean().default(false)
12556
+ }),
12557
+ run: (a) => panelTaskList(
12558
+ c,
12559
+ owner,
12560
+ {
12561
+ conversation: a.conversation_id || void 0,
12562
+ repository: a.repository || void 0,
12563
+ archived: a.archived,
12564
+ include: a.include
12565
+ },
12566
+ a.include_read_completed
12567
+ )
12568
+ });
12569
+ const cursor = taskId.extend({
12570
+ after: external_exports.number().int().nonnegative().default(0)
12571
+ });
12572
+ const view = external_exports.strictObject({
12573
+ list: list.schema,
12574
+ chat: cursor.optional(),
12575
+ activity: cursor.optional(),
12576
+ pending: external_exports.strictObject({ conversation_id: external_exports.string().min(1) }).optional()
12577
+ });
12578
+ const readView = async (parts) => {
12579
+ const known = await c.projects?.listWithGit() ?? [];
12580
+ const { chat, activity, pending: pending2 } = parts;
12581
+ return () => c.store.reads.measure("view", (work) => {
12582
+ const chatTask = chat && c.store.find(chat.task_id, owner);
12583
+ const activityTask = activity && c.store.find(activity.task_id, owner);
12584
+ const read2 = {
12585
+ projects: c.projects?.withKnownGit(known) ?? [],
12586
+ list: list.run(parts.list),
12587
+ ...chat && chatTask && {
12588
+ chat: chatRead(c.store, c.attachments, chatTask, chat.after)
12589
+ },
12590
+ ...activity && activityTask && {
12591
+ activity: c.activity.page(activityTask.id, activity.after)
12592
+ },
12593
+ ...pending2 && {
12594
+ pending: {
12595
+ tasks: pendingUpdates(
12596
+ c.store,
12597
+ c.parentSeen,
12598
+ (t) => c.providers.get(t.provider)?.taskPolicy.parentMayApprove(t) ?? false,
12599
+ owner,
12600
+ pending2.conversation_id
12601
+ )
12602
+ }
12603
+ }
12604
+ };
12605
+ work.rows = read2.list.tasks.length;
12606
+ return { ...read2, built_at: Date.now() };
12607
+ });
12608
+ };
12609
+ return {
12610
+ app_list_tasks: list,
12611
+ app_get_attachment: tool({
11533
12612
  readOnly: true,
11534
- description: "User interface only: the worker updates Codex hasn't seen in a conversation, grouped by task: turn replies, failures, budget stops and requests Codex may answer. Tasks and their updates are newest first. Archived tasks are left out.",
11535
- schema: external_exports.strictObject({ conversation_id: external_exports.string().min(1) }),
11536
- run: (a) => ({
11537
- tasks: pendingUpdates(
11538
- c.store,
11539
- c.parentSeen,
11540
- (t) => c.providers.get(t.provider)?.taskPolicy.parentMayApprove(t) ?? false,
11541
- owner,
11542
- a.conversation_id
11543
- )
11544
- })
12613
+ description: "User interface only: a page of a task's attachment, by its position in the request, with the attachment's metadata. state is unavailable when its stored file is missing, too large or not UTF-8 text. Pass next_cursor for more content.",
12614
+ schema: taskId.extend({
12615
+ position: external_exports.number().int().positive(),
12616
+ cursor: external_exports.string().max(100).optional()
12617
+ }),
12618
+ run: (a) => c.attachments.page(
12619
+ c.store.get(a.task_id, owner).id,
12620
+ a.position,
12621
+ a.cursor
12622
+ )
11545
12623
  }),
12624
+ app_wait_for_updates: tool({
12625
+ readOnly: true,
12626
+ description: `User interface only: waits for something the panel should show. It returns the owner's current revision as soon as it differs from after, and with a draft target, as soon as that task's draft grows past after_length, becomes another message or clears; otherwise after wait_ms (at most ${MAX_UPDATE_WAIT_MS}). Without after, or with wait_ms 0, it returns at once, so it also reads a draft. A revision is boot:count, and the count only grows within a boot. With view, it also returns view as of the returned revision, with built_at in epoch milliseconds. Its projects are as list_projects returns them, and its list takes app_list_tasks arguments and returns that shape. chat { items, next_cursor } is a task's Chat after a cursor: its messages, an outcome row for each turn's end, and notes for a new session, a recreated worktree and compaction. Cursor 0 also returns the request with its attachments. An item read again replaces the earlier one with its id. activity { events, dropped } holds a task's newest Activity events after a cursor, with a tally of the older events outside the window. pending { tasks } lists the worker updates Codex hasn't seen in a conversation, grouped by task and newest first: turn replies, failures, budget stops and requests Codex may answer, leaving out archived tasks. The wait leaves view out when only the draft changed, and leaves out chat and activity for a task the owner doesn't have.`,
12627
+ schema: external_exports.strictObject({
12628
+ after: external_exports.string().max(200).optional(),
12629
+ draft: taskId.extend({
12630
+ message_id: external_exports.string().max(200).optional(),
12631
+ after_length: external_exports.number().int().nonnegative().default(0)
12632
+ }).strict().optional(),
12633
+ wait_ms: external_exports.number().int().min(0).max(MAX_UPDATE_WAIT_MS).default(0),
12634
+ view: view.optional()
12635
+ }),
12636
+ run: ({ view: parts, ...a }) => waitForUpdates(
12637
+ c.store,
12638
+ c.drafts,
12639
+ owner,
12640
+ a,
12641
+ parts && (() => readView(parts))
12642
+ )
12643
+ })
12644
+ };
12645
+ }
12646
+
12647
+ // src/service/platform/server/tools/pending-update-tools.ts
12648
+ init_define_EXTENSION_BUILD_INFO();
12649
+ function pendingUpdateTools(c, owner) {
12650
+ return {
11546
12651
  app_mark_updates_seen: tool({
11547
12652
  description: "User interface only: record worker updates as seen by Codex, by event, so they no longer count as pending.",
11548
12653
  schema: external_exports.strictObject({
@@ -11556,21 +12661,25 @@ function pendingUpdateTools(c, owner) {
11556
12661
  };
11557
12662
  }
11558
12663
 
12664
+ // src/service/platform/server/tools/project-tools.ts
12665
+ init_define_EXTENSION_BUILD_INFO();
12666
+
11559
12667
  // src/service/features/projects/project-picker.ts
11560
- import { execFile } from "node:child_process";
11561
- import { promisify } from "node:util";
11562
- var execute = promisify(execFile);
12668
+ init_define_EXTENSION_BUILD_INFO();
12669
+ import { execFile as execFile2 } from "node:child_process";
12670
+ import { promisify as promisify2 } from "node:util";
12671
+ var execute = promisify2(execFile2);
11563
12672
  var script = `try
11564
- set selectedFolder to choose folder with prompt "Choose a Git repository to add to Delegated Work"
12673
+ set selectedFolder to choose folder with prompt "Choose a folder to add to Delegated Work"
11565
12674
  return POSIX path of selectedFolder
11566
12675
  on error number -128
11567
12676
  return ""
11568
12677
  end try`;
11569
12678
  var pending = false;
11570
- async function browseProject(options3 = { platform: process.platform, execute }) {
11571
- if (options3.platform !== "darwin") {
12679
+ async function browseProject(options2 = { platform: process.platform, execute }) {
12680
+ if (options2.platform !== "darwin") {
11572
12681
  throw new Error(
11573
- "Folder browsing is available on macOS. Enter an absolute repository path instead."
12682
+ "Folder browsing is available on macOS. Enter an absolute folder path instead."
11574
12683
  );
11575
12684
  }
11576
12685
  if (pending) {
@@ -11578,7 +12687,7 @@ async function browseProject(options3 = { platform: process.platform, execute })
11578
12687
  }
11579
12688
  pending = true;
11580
12689
  try {
11581
- const { stdout } = await options3.execute(
12690
+ const { stdout } = await options2.execute(
11582
12691
  "/usr/bin/osascript",
11583
12692
  ["-e", script],
11584
12693
  {
@@ -11597,7 +12706,7 @@ async function browseProject(options3 = { platform: process.platform, execute })
11597
12706
  function projectTools(c, owner) {
11598
12707
  return {
11599
12708
  app_register_project: tool({
11600
- description: "User interface only: approve and persist a Git repository selected by the user. Does not approve its parent or nested repositories.",
12709
+ description: "User interface only: approve and persist a folder selected by the user, with or without Git. Does not approve its parent or nested repositories.",
11601
12710
  schema: external_exports.strictObject({ repository: external_exports.string().min(1).max(4096) }),
11602
12711
  run: async (a) => {
11603
12712
  if (!c.projects) {
@@ -11627,22 +12736,37 @@ function projectTools(c, owner) {
11627
12736
  }
11628
12737
  }),
11629
12738
  app_remove_project: tool({
11630
- description: "User interface only: remove a saved project approval. Optionally stop and delete this user's project tasks, history and task worktrees/branches; checkout files and provider sessions stay intact. External dependent tasks block deletion.",
12739
+ description: "User interface only: remove a saved project approval. Optionally stop and delete this user's project tasks, history and task worktrees and local branches, and with delete_agent_task their provider sessions. Checkout files stay intact.",
11631
12740
  schema: external_exports.strictObject({
11632
12741
  repository: external_exports.string().min(1).max(4096),
11633
- delete_tasks: external_exports.boolean().default(false)
11634
- }),
12742
+ delete_tasks: external_exports.boolean().default(false),
12743
+ delete_agent_task: external_exports.boolean().default(false),
12744
+ confirmation: external_exports.string().regex(/^[0-9a-f]{64}$/).optional()
12745
+ }).refine(
12746
+ (a) => !a.delete_tasks || !!a.confirmation,
12747
+ "Review the task removal list before deleting project task data."
12748
+ ).refine(
12749
+ (a) => a.delete_tasks || !a.delete_agent_task,
12750
+ "Provider sessions are removed only with project task data."
12751
+ ),
11635
12752
  run: (a) => {
11636
12753
  if (!c.projects) {
11637
12754
  throw new Error("Project management is unavailable in this service.");
11638
12755
  }
11639
- return c.removeProject(owner, a.repository, a.delete_tasks);
12756
+ return c.removeProject(
12757
+ owner,
12758
+ a.repository,
12759
+ a.delete_tasks,
12760
+ a.confirmation,
12761
+ a.delete_agent_task
12762
+ );
11640
12763
  }
11641
12764
  })
11642
12765
  };
11643
12766
  }
11644
12767
 
11645
12768
  // src/service/platform/server/tools/queue-tools.ts
12769
+ init_define_EXTENSION_BUILD_INFO();
11646
12770
  function queueTools(c, owner) {
11647
12771
  return {
11648
12772
  app_steer_queued_message: tool({
@@ -11694,130 +12818,17 @@ function queueTools(c, owner) {
11694
12818
  };
11695
12819
  }
11696
12820
 
11697
- // src/service/features/settings/settings-file.ts
11698
- import { randomUUID } from "node:crypto";
11699
- import { mkdir as mkdir2, writeFile } from "node:fs/promises";
11700
- import { join as join3 } from "node:path";
12821
+ // src/service/platform/server/tools/settings-transfer-tools.ts
12822
+ init_define_EXTENSION_BUILD_INFO();
11701
12823
 
11702
- // src/service/features/settings/downloads-directory.ts
11703
- import { execFile as execFile2 } from "node:child_process";
11704
- import { readFile as readFile2 } from "node:fs/promises";
11705
- import { homedir } from "node:os";
11706
- import { isAbsolute as isAbsolute3, join as join2, win32 } from "node:path";
11707
- import { promisify as promisify2 } from "node:util";
11708
- var executeFile = promisify2(execFile2);
11709
- var windowsDownloads = `
11710
- $ErrorActionPreference = 'Stop'
11711
- [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding
11712
- Add-Type @'
11713
- using System;
11714
- using System.Runtime.InteropServices;
11715
- public static class DownloadsFolder {
11716
- [DllImport("shell32.dll")]
11717
- public static extern int SHGetKnownFolderPath(
11718
- [MarshalAs(UnmanagedType.LPStruct)] Guid id, uint flags,
11719
- IntPtr token, out IntPtr path);
11720
- }
11721
- '@
11722
- $path = [IntPtr]::Zero
11723
- try {
11724
- # KF_FLAG_DONT_VERIFY returns the configured path even before the folder exists.
11725
- $result = [DownloadsFolder]::SHGetKnownFolderPath(
11726
- [Guid]'374DE290-123F-4565-9164-39C4925E467B', 0x4000, [IntPtr]::Zero, [ref]$path)
11727
- [Runtime.InteropServices.Marshal]::ThrowExceptionForHR($result)
11728
- [Runtime.InteropServices.Marshal]::PtrToStringUni($path)
11729
- } finally {
11730
- [Runtime.InteropServices.Marshal]::FreeCoTaskMem($path)
11731
- }
11732
- `;
11733
- async function execute2(command, args) {
11734
- try {
11735
- const { stdout } = await executeFile(command, args, {
11736
- encoding: "utf8",
11737
- timeout: 1e4,
11738
- maxBuffer: 16384,
11739
- windowsHide: true
11740
- });
11741
- return stdout;
11742
- } catch (error) {
11743
- throw new Error("The system couldn't locate the Downloads folder.", {
11744
- cause: error
11745
- });
11746
- }
11747
- }
11748
- function xdgDownloadPath(text, home) {
11749
- const entry = text.split(/\r?\n/).findLast((line) => /^\s*XDG_DOWNLOAD_DIR\s*=/.test(line));
11750
- if (entry === void 0) return join2(home, "Downloads");
11751
- const match = /^\s*XDG_DOWNLOAD_DIR="((?:\\.|[^"\\])*)"\s*(?:#.*)?$/.exec(
11752
- entry
11753
- );
11754
- if (!match) throw new Error("The Downloads folder setting is invalid.");
11755
- let raw = match[1], path = "";
11756
- if (raw === "$HOME" || raw.startsWith("$HOME/")) {
11757
- path = home;
11758
- raw = raw.slice(5);
11759
- }
11760
- for (let index = 0; index < raw.length; index++) {
11761
- const character = raw[index];
11762
- if (character === "\\" && /[\\"$`]/.test(raw[index + 1] ?? "")) {
11763
- path += raw[++index];
11764
- } else if (character === "$" || character === "`") {
11765
- throw new Error(
11766
- "The Downloads folder setting uses an unsupported variable or command."
11767
- );
11768
- } else {
11769
- path += character;
11770
- }
11771
- }
11772
- return path;
11773
- }
11774
- async function downloadsDirectory(options3 = {}) {
11775
- const {
11776
- platform = process.platform,
11777
- home = homedir(),
11778
- env = process.env,
11779
- execute: run2 = execute2
11780
- } = options3;
11781
- let path;
11782
- if (platform === "darwin") {
11783
- path = await run2("/usr/bin/osascript", [
11784
- "-e",
11785
- "POSIX path of (path to downloads folder)"
11786
- ]);
11787
- } else if (platform === "win32") {
11788
- path = await run2(
11789
- win32.join(
11790
- env.SystemRoot ?? "C:\\Windows",
11791
- "System32",
11792
- "WindowsPowerShell",
11793
- "v1.0",
11794
- "powershell.exe"
11795
- ),
11796
- ["-NoProfile", "-NonInteractive", "-Command", windowsDownloads]
11797
- );
11798
- } else if (platform === "linux") {
11799
- const config = env.XDG_CONFIG_HOME && isAbsolute3(env.XDG_CONFIG_HOME) ? env.XDG_CONFIG_HOME : join2(home, ".config");
11800
- let text = "";
11801
- try {
11802
- text = await readFile2(join2(config, "user-dirs.dirs"), "utf8");
11803
- } catch (error) {
11804
- if (error.code !== "ENOENT") throw error;
11805
- }
11806
- path = xdgDownloadPath(text, home);
11807
- } else {
11808
- throw new Error(
11809
- "Saving settings files is unavailable on this operating system."
11810
- );
11811
- }
11812
- if (platform !== "linux") path = path.replace(/\r?\n$/, "");
11813
- const absolute = platform === "win32" ? /^(?:[a-z]:[\\/]|[\\/]{2}[^\\/]+[\\/][^\\/]+)/i.test(path) : isAbsolute3(path);
11814
- if (!absolute) {
11815
- throw new Error("Downloads must be an absolute folder path.");
11816
- }
11817
- return path;
11818
- }
12824
+ // src/service/features/settings/settings-file.ts
12825
+ init_define_EXTENSION_BUILD_INFO();
12826
+ import { writeFile } from "node:fs/promises";
12827
+ import { homedir as homedir2 } from "node:os";
12828
+ import { join as join5 } from "node:path";
11819
12829
 
11820
12830
  // src/service/features/settings/settings-transfer.ts
12831
+ init_define_EXTENSION_BUILD_INFO();
11821
12832
  var SETTINGS_FORMAT = 2;
11822
12833
  var settingsTransferInputSchema = external_exports.strictObject({
11823
12834
  document: external_exports.string().min(1).meta({
@@ -11883,15 +12894,10 @@ function importSettings(settings, owner, input) {
11883
12894
 
11884
12895
  // src/service/features/settings/settings-file.ts
11885
12896
  var settingsFileOutputSchema = external_exports.object({ path: external_exports.string() });
11886
- async function saveSettingsFile(settings, owner, directory = downloadsDirectory) {
12897
+ async function saveSettingsFile(settings, owner) {
11887
12898
  const { document: document2 } = exportSettings(settings, owner);
11888
- const folder = await directory();
11889
- await mkdir2(folder, { recursive: true, mode: 448 });
11890
- const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
11891
- const path = join3(
11892
- folder,
11893
- `delegated-work-settings-${timestamp}-${randomUUID()}.json`
11894
- );
12899
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/:/g, "-");
12900
+ const path = join5(homedir2(), `delegated-work-settings-${timestamp}Z.json`);
11895
12901
  await writeFile(path, `${document2}
11896
12902
  `, {
11897
12903
  encoding: "utf8",
@@ -11918,7 +12924,7 @@ function settingsTransferTools(settings, owner) {
11918
12924
  run: (a) => importSettings(settings, owner, a)
11919
12925
  }),
11920
12926
  app_save_settings_file: tool({
11921
- description: "User interface only: save the user's defaults as a new JSON file in Downloads on the service computer and return its path.",
12927
+ description: "User interface only: save the user's defaults as a new JSON file in the home folder on the service computer and return its path.",
11922
12928
  schema: external_exports.strictObject({}),
11923
12929
  outputSchema: settingsFileOutputSchema,
11924
12930
  run: () => saveSettingsFile(settings, owner)
@@ -11927,6 +12933,7 @@ function settingsTransferTools(settings, owner) {
11927
12933
  }
11928
12934
 
11929
12935
  // src/service/platform/server/tools/task-lifecycle-tools.ts
12936
+ init_define_EXTENSION_BUILD_INFO();
11930
12937
  function taskLifecycleTools(c, owner) {
11931
12938
  return {
11932
12939
  app_remove_worktree: tool({
@@ -11983,18 +12990,38 @@ function taskLifecycleTools(c, owner) {
11983
12990
  }),
11984
12991
  run: (a) => c.archive.setArchived(owner, a.task_ids, a.archived)
11985
12992
  }),
12993
+ app_preview_task_deletion: tool({
12994
+ readOnly: true,
12995
+ description: "User interface only: list the exact task records, worktrees, branches and optional provider session files selected for deletion. Returns a confirmation tied to those resources. Show the resources to the user before app_delete_tasks.",
12996
+ // Keep an object root so the MCP SDK preserves the tool's input metadata.
12997
+ schema: external_exports.strictObject({
12998
+ task_ids: external_exports.array(external_exports.string()).min(1).max(1e3).optional(),
12999
+ repository: external_exports.string().min(1).max(4096).optional(),
13000
+ delete_agent_task: external_exports.boolean().default(false)
13001
+ }).refine(
13002
+ (a) => !!a.task_ids !== !!a.repository,
13003
+ "Choose task IDs or a project, not both."
13004
+ ),
13005
+ run: (a) => c.taskDeletionPreview(
13006
+ owner,
13007
+ a.task_ids ?? [],
13008
+ a.delete_agent_task,
13009
+ a.repository
13010
+ )
13011
+ }),
11986
13012
  app_delete_tasks: tool({
11987
13013
  destructive: true,
11988
- description: "User interface only: delete stopped tasks with their events, requests, worktrees and branches, dependents first. With delete_agent_task it also deletes each provider session. A task outside them that depends on one stops the whole deletion. This can't be undone.",
13014
+ description: "User interface only: delete the tasks and resources reviewed with app_preview_task_deletion. Requires its confirmation and the same task IDs and delete_agent_task choice. Changed resources require a new preview. Running work stops first. This can't be undone.",
11989
13015
  schema: external_exports.strictObject({
11990
13016
  task_ids: external_exports.array(external_exports.string()).min(1).max(1e3),
11991
- delete_agent_task: external_exports.boolean().default(false)
13017
+ delete_agent_task: external_exports.boolean().default(false),
13018
+ confirmation: external_exports.string().regex(/^[0-9a-f]{64}$/)
11992
13019
  }),
11993
- run: (a) => c.delete(owner, a.task_ids, a.delete_agent_task)
13020
+ run: (a) => c.delete(owner, a.task_ids, a.delete_agent_task, a.confirmation)
11994
13021
  }),
11995
13022
  app_delete_branch: tool({
11996
13023
  destructive: true,
11997
- description: "User interface only: delete a stopped worktree task's branch once its worktree is removed.",
13024
+ description: "User interface only: delete a stopped worktree task's local branch once its worktree is removed. Remote branches are not changed.",
11998
13025
  schema: taskId,
11999
13026
  run: (a) => c.deleteBranch(owner, a.task_id)
12000
13027
  })
@@ -12004,6 +13031,12 @@ function taskLifecycleTools(c, owner) {
12004
13031
  // src/service/platform/server/tools/user-tools.ts
12005
13032
  function userTools({ c, owner, hostMeta }, tools) {
12006
13033
  return {
13034
+ app_get_about: tool({
13035
+ readOnly: true,
13036
+ description: "User interface only: extension build, SDK versions and local runtime diagnostics.",
13037
+ schema: external_exports.object({ refresh: external_exports.boolean().default(false) }),
13038
+ run: ({ refresh }) => aboutInfo(c, refresh)
13039
+ }),
12007
13040
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Temporary feature gate.
12008
13041
  ...composerMentionsEnabled ? {
12009
13042
  // The host's composer calls this. The HTTP and stdio servers register it
@@ -12054,36 +13087,7 @@ function userTools({ c, owner, hostMeta }, tools) {
12054
13087
  return { budget: task.budget, status: task.status };
12055
13088
  }
12056
13089
  }),
12057
- app_get_chat: tool({
12058
- readOnly: true,
12059
- description: "User interface only: a task's Chat after a cursor: its messages, an outcome row for each turn's end, and notes for a new session, a recreated worktree and compaction. An item read again replaces the earlier one with its id.",
12060
- schema: taskId.extend({
12061
- after: external_exports.number().int().nonnegative().default(0)
12062
- }),
12063
- run: (a) => {
12064
- const t = c.store.get(a.task_id, owner);
12065
- const events = c.store.chatEvents(t.id, CHAT_EVENTS);
12066
- return {
12067
- items: chatItems(t, events).filter(
12068
- (item) => item.event_id > a.after || a.after === 0 && item.event_id === 0
12069
- ),
12070
- next_cursor: Math.max(a.after, events.at(-1)?.id ?? 0)
12071
- };
12072
- }
12073
- }),
12074
- app_wait_for_updates: tool({
12075
- readOnly: true,
12076
- description: `User interface only: waits for something the panel should show. It returns the owner's current revision as soon as it differs from after, and with a draft target, as soon as that task's draft grows past after_length, becomes another message or clears; otherwise after wait_ms (at most ${MAX_UPDATE_WAIT_MS}). Without after, or with wait_ms 0, it returns at once, so it also reads a draft. The revision is opaque: compare it only for equality.`,
12077
- schema: external_exports.strictObject({
12078
- after: external_exports.string().max(200).optional(),
12079
- draft: taskId.extend({
12080
- message_id: external_exports.string().max(200).optional(),
12081
- after_length: external_exports.number().int().nonnegative().default(0)
12082
- }).strict().optional(),
12083
- wait_ms: external_exports.number().int().min(0).max(MAX_UPDATE_WAIT_MS).default(0)
12084
- }),
12085
- run: (a) => waitForUpdates(c.store, c.drafts, owner, a)
12086
- }),
13090
+ ...panelViewTools(c, owner),
12087
13091
  ...queueTools(c, owner),
12088
13092
  app_submit_input: tool({
12089
13093
  ...tools.submit_input,
@@ -12187,9 +13191,10 @@ async function callTool(c, owner, name, args, authority = "parent", hostMeta) {
12187
13191
  }
12188
13192
 
12189
13193
  // src/service/platform/service/process-info.ts
12190
- import { execFileSync } from "node:child_process";
12191
- import { readFileSync as readFileSync2, readlinkSync } from "node:fs";
12192
- import { basename, dirname, join as join4 } from "node:path";
13194
+ init_define_EXTENSION_BUILD_INFO();
13195
+ import { execFileSync as execFileSync2 } from "node:child_process";
13196
+ import { readFileSync as readFileSync3, readlinkSync } from "node:fs";
13197
+ import { basename, dirname as dirname2, join as join6 } from "node:path";
12193
13198
  function inspectProcess(pid) {
12194
13199
  try {
12195
13200
  if (process.platform === "linux") return inspectLinuxProcess(pid);
@@ -12219,13 +13224,13 @@ function inspectProcessIdentity(pid) {
12219
13224
  return void 0;
12220
13225
  }
12221
13226
  function isProcessRunning(pid) {
12222
- let permissionDenied = false;
13227
+ let permissionDenied2 = false;
12223
13228
  try {
12224
13229
  process.kill(pid, 0);
12225
13230
  } catch (error) {
12226
13231
  const code = error.code;
12227
13232
  if (code === "ESRCH") return false;
12228
- if (code === "EPERM") permissionDenied = true;
13233
+ if (code === "EPERM") permissionDenied2 = true;
12229
13234
  else return true;
12230
13235
  }
12231
13236
  if (process.platform === "linux") {
@@ -12234,7 +13239,7 @@ function isProcessRunning(pid) {
12234
13239
  return state !== "Z" && state !== "X";
12235
13240
  } catch (error) {
12236
13241
  if (error.code === "ENOENT") {
12237
- return permissionDenied;
13242
+ return permissionDenied2;
12238
13243
  }
12239
13244
  }
12240
13245
  }
@@ -12250,7 +13255,7 @@ function isExtensionService(owner, lockFile) {
12250
13255
  let metadata;
12251
13256
  try {
12252
13257
  metadata = JSON.parse(
12253
- readFileSync2(join4(dirname(lockFile), "service.json"), "utf8")
13258
+ readFileSync3(join6(dirname2(lockFile), "service.json"), "utf8")
12254
13259
  );
12255
13260
  } catch {
12256
13261
  return false;
@@ -12281,17 +13286,17 @@ function inspectLinuxProcess(pid) {
12281
13286
  };
12282
13287
  }
12283
13288
  function readLinuxCommandLine(pid) {
12284
- return readFileSync2(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean).join(" ");
13289
+ return readFileSync3(`/proc/${pid}/cmdline`, "utf8").split("\0").filter(Boolean).join(" ");
12285
13290
  }
12286
13291
  function readLinuxFields(pid) {
12287
- const stat = readFileSync2(`/proc/${pid}/stat`, "utf8");
12288
- return stat.slice(stat.lastIndexOf(")") + 2).trim().split(/\s+/);
13292
+ const stat3 = readFileSync3(`/proc/${pid}/stat`, "utf8");
13293
+ return stat3.slice(stat3.lastIndexOf(")") + 2).trim().split(/\s+/);
12289
13294
  }
12290
13295
  function linuxStartedAt(fields) {
12291
13296
  const ticks = fields[19];
12292
13297
  if (!ticks) return;
12293
13298
  try {
12294
- const bootId = readFileSync2(
13299
+ const bootId = readFileSync3(
12295
13300
  "/proc/sys/kernel/random/boot_id",
12296
13301
  "utf8"
12297
13302
  ).trim();
@@ -12347,7 +13352,7 @@ function inspectWindowsProcess(pid) {
12347
13352
  };
12348
13353
  }
12349
13354
  function run(command, args) {
12350
- return execFileSync(command, args, {
13355
+ return execFileSync2(command, args, {
12351
13356
  encoding: "utf8",
12352
13357
  stdio: ["ignore", "pipe", "ignore"],
12353
13358
  timeout: 2e3
@@ -12355,12 +13360,13 @@ function run(command, args) {
12355
13360
  }
12356
13361
 
12357
13362
  // src/service/platform/service/port.ts
13363
+ init_define_EXTENSION_BUILD_INFO();
12358
13364
  import { createServer } from "node:net";
12359
13365
  var PortInUseError = class extends Error {
12360
- constructor(port, options3) {
13366
+ constructor(port, options2) {
12361
13367
  super(
12362
13368
  `Port ${port} is already in use by another program. Stop that program, or set PORT to a free port.`,
12363
- options3
13369
+ options2
12364
13370
  );
12365
13371
  this.port = port;
12366
13372
  this.name = "PortInUseError";
@@ -12369,27 +13375,28 @@ var PortInUseError = class extends Error {
12369
13375
  };
12370
13376
  var nearbyPorts = 10;
12371
13377
  function available(port) {
12372
- return new Promise((resolve2) => {
13378
+ return new Promise((resolve3) => {
12373
13379
  const server = createServer();
12374
- server.once("error", () => resolve2(false));
12375
- server.listen(port, "127.0.0.1", () => server.close(() => resolve2(true)));
13380
+ server.once("error", () => resolve3(false));
13381
+ server.listen(port, "127.0.0.1", () => server.close(() => resolve3(true)));
12376
13382
  });
12377
13383
  }
12378
13384
  async function freeLoopbackPort(start, skip) {
12379
13385
  for (let port = start; port < start + nearbyPorts; port++) {
12380
13386
  if (port !== skip && await available(port)) return port;
12381
13387
  }
12382
- return new Promise((resolve2, reject) => {
13388
+ return new Promise((resolve3, reject) => {
12383
13389
  const server = createServer();
12384
13390
  server.once("error", reject);
12385
13391
  server.listen(0, "127.0.0.1", () => {
12386
13392
  const { port } = server.address();
12387
- server.close(() => resolve2(port));
13393
+ server.close(() => resolve3(port));
12388
13394
  });
12389
13395
  });
12390
13396
  }
12391
13397
 
12392
13398
  // src/service/platform/service/health-proof.ts
13399
+ init_define_EXTENSION_BUILD_INFO();
12393
13400
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
12394
13401
  var challengeHeader = "x-subagent-extension-for-codex-challenge";
12395
13402
  var challengePattern = /^[A-Za-z0-9_-]{32,128}$/;
@@ -12407,68 +13414,6 @@ function provesToken(token, challenge, proof) {
12407
13414
  return actual.length === expected.length && timingSafeEqual(actual, expected);
12408
13415
  }
12409
13416
 
12410
- // src/service/platform/service/identity.ts
12411
- var serviceApiVersion = 1;
12412
- var launcherEnv = "SUBAGENT_EXTENSION_FOR_CODEX_LAUNCHER";
12413
- function serviceIdentity(env = process.env) {
12414
- return {
12415
- version: packageVersion,
12416
- apiVersion: serviceApiVersion,
12417
- launcher: env[launcherEnv] === "stdio" ? "stdio" : "foreground",
12418
- installRoot
12419
- };
12420
- }
12421
- function compareVersions(a, b) {
12422
- const parse2 = (version) => {
12423
- const [core = "", ...pre] = version.replace(/\+.*/, "").split("-");
12424
- const prerelease = pre.join("-");
12425
- return {
12426
- core: core.split(".").map((part) => Number(part) || 0),
12427
- prerelease: prerelease ? prerelease.split(".") : []
12428
- };
12429
- };
12430
- const [left, right] = [parse2(a), parse2(b)];
12431
- for (let i = 0; i < Math.max(left.core.length, right.core.length); i++) {
12432
- const difference = (left.core[i] ?? 0) - (right.core[i] ?? 0);
12433
- if (difference) return Math.sign(difference);
12434
- }
12435
- if (!left.prerelease.length || !right.prerelease.length) {
12436
- return Math.sign(right.prerelease.length - left.prerelease.length);
12437
- }
12438
- for (let i = 0; i < Math.max(left.prerelease.length, right.prerelease.length); i++) {
12439
- const [x, y] = [left.prerelease[i], right.prerelease[i]];
12440
- if (x === y) continue;
12441
- if (x === void 0) return -1;
12442
- if (y === void 0) return 1;
12443
- const [xNumeric, yNumeric] = [/^\d+$/.test(x), /^\d+$/.test(y)];
12444
- if (xNumeric && yNumeric) return Math.sign(Number(x) - Number(y));
12445
- if (xNumeric !== yNumeric) return xNumeric ? -1 : 1;
12446
- return x < y ? -1 : 1;
12447
- }
12448
- return 0;
12449
- }
12450
- function handoff(running, own2, origin) {
12451
- const compatible = running.apiVersion === own2.apiVersion;
12452
- const described2 = `version ${running.version ?? "unknown"}`;
12453
- if (running.launcher !== "stdio") {
12454
- return compatible ? { action: "use" } : {
12455
- action: "refuse",
12456
- message: `A different extension service (${described2}, not started by the plugin) is running at ${origin}. Stop it, or give development its own SUBAGENT_EXTENSION_FOR_CODEX_DATA and PORT.`
12457
- };
12458
- }
12459
- const order = running.version ? compareVersions(running.version, own2.version) : -1;
12460
- if (order > 0) {
12461
- return compatible ? { action: "use" } : {
12462
- action: "refuse",
12463
- message: `A newer extension service (${described2}) is running at ${origin}; update the plugin to ${running.version} or later.`
12464
- };
12465
- }
12466
- if (order < 0 || !running.installed || !compatible) {
12467
- return { action: "replace", forward: compatible };
12468
- }
12469
- return { action: "use" };
12470
- }
12471
-
12472
13417
  export {
12473
13418
  inspectProcess,
12474
13419
  inspectProcessIdentity,
@@ -12477,19 +13422,25 @@ export {
12477
13422
  isExtensionService,
12478
13423
  PortInUseError,
12479
13424
  freeLoopbackPort,
13425
+ scalarText,
12480
13426
  claudePermissionModes,
12481
13427
  claudePermissionModeSchema,
12482
13428
  permissionModeSchema,
12483
13429
  claudeOverrideDefaults,
13430
+ MODE_TURNED_OFF_BY_ORG,
12484
13431
  permissionLabel,
13432
+ permissionModeName,
12485
13433
  readOnlyProfile,
12486
13434
  resolveClaudePermission,
12487
13435
  exceedsPermission,
12488
13436
  claudePolicySchema,
12489
13437
  resolveClaudePolicy,
13438
+ ClaudeCli,
12490
13439
  contentText,
12491
- scalarText,
12492
- eventPayload,
13440
+ FAMILY_ALIASES,
13441
+ isModelVariant,
13442
+ modelAllowed,
13443
+ blockedReason,
12493
13444
  settingText,
12494
13445
  preferredSettingsProvider,
12495
13446
  providerModelSettingScopes,
@@ -12756,7 +13707,7 @@ export {
12756
13707
  mergeCapabilities,
12757
13708
  productGlyphIcons,
12758
13709
  resolvePanelContext,
12759
- openingTasks,
13710
+ panelTaskList,
12760
13711
  delegationPanel,
12761
13712
  SERVER_INSTRUCTIONS,
12762
13713
  composerMentionsEnabled,
@@ -12777,4 +13728,4 @@ export {
12777
13728
  toolStructuredContent,
12778
13729
  callTool
12779
13730
  };
12780
- //# sourceMappingURL=chunk-LZFYKJ4Y.js.map
13731
+ //# sourceMappingURL=chunk-L5ILPS3O.js.map