@lichao0223/lobehub-cli 0.0.102 → 0.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ var init_escapeRegExp = __esmMin((() => {}));
110
110
 
111
111
  //#endregion
112
112
  //#region ../../packages/utils/src/object.ts
113
- var isObjectLike$1, isRecord$8, isPlainRecord, toRecord, pickString$1;
113
+ var isObjectLike$1, isRecord$8, isPlainRecord, toRecord$1, pickString$1;
114
114
  var init_object$1 = __esmMin((() => {
115
115
  isObjectLike$1 = (value) => typeof value === "object" && value !== null;
116
116
  isRecord$8 = (value) => isObjectLike$1(value) && !Array.isArray(value);
@@ -119,7 +119,7 @@ var init_object$1 = __esmMin((() => {
119
119
  const prototype = Object.getPrototypeOf(value);
120
120
  return prototype === Object.prototype || prototype === null;
121
121
  };
122
- toRecord = (value) => isRecord$8(value) ? value : void 0;
122
+ toRecord$1 = (value) => isRecord$8(value) ? value : void 0;
123
123
  pickString$1 = (value) => typeof value === "string" ? value : void 0;
124
124
  }));
125
125
 
@@ -413,7 +413,7 @@ var init_heteroCliArgs = __esmMin((() => {
413
413
  }));
414
414
 
415
415
  //#endregion
416
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
416
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/util.js
417
417
  function getEnumValues(entries) {
418
418
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
419
419
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -460,7 +460,7 @@ function defineLazy(object, key, getter) {
460
460
  configurable: true
461
461
  });
462
462
  }
463
- function assignProp$1(target, prop, value) {
463
+ function assignProp(target, prop, value) {
464
464
  Object.defineProperty(target, prop, {
465
465
  value,
466
466
  writable: true,
@@ -484,7 +484,7 @@ function deferProp(target, key, getter) {
484
484
  Object.defineProperty(target, key, {
485
485
  get() {
486
486
  const value = getter();
487
- assignProp$1(this, key, value);
487
+ assignProp(this, key, value);
488
488
  return value;
489
489
  },
490
490
  enumerable: true,
@@ -492,7 +492,7 @@ function deferProp(target, key, getter) {
492
492
  });
493
493
  }
494
494
  function putProp(target, key, value) {
495
- if (key in target) assignProp$1(target, key, value);
495
+ if (key in target) assignProp(target, key, value);
496
496
  else target[key] = value;
497
497
  }
498
498
  /**
@@ -534,7 +534,7 @@ function slugify$1(input) {
534
534
  function isObject$4(data) {
535
535
  return typeof data === "object" && data !== null && !Array.isArray(data);
536
536
  }
537
- function isPlainObject$12(o) {
537
+ function isPlainObject$11(o) {
538
538
  if (isObject$4(o) === false) return false;
539
539
  const ctor = o.constructor;
540
540
  if (ctor === void 0) return true;
@@ -545,7 +545,7 @@ function isPlainObject$12(o) {
545
545
  return true;
546
546
  }
547
547
  function shallowClone(o) {
548
- if (isPlainObject$12(o)) return { ...o };
548
+ if (isPlainObject$11(o)) return { ...o };
549
549
  if (Array.isArray(o)) return [...o];
550
550
  if (o instanceof Map) return new Map(o);
551
551
  if (o instanceof Set) return new Set(o);
@@ -617,7 +617,7 @@ function omit(schema, mask) {
617
617
  }));
618
618
  }
619
619
  function extend(schema, shape) {
620
- if (!isPlainObject$12(shape)) throw new Error("Invalid input to extend: expected a plain object");
620
+ if (!isPlainObject$11(shape)) throw new Error("Invalid input to extend: expected a plain object");
621
621
  const checks = schema._zod.def.checks;
622
622
  if (checks && checks.length > 0) {
623
623
  const existingShape = sourceShape(schema);
@@ -632,7 +632,7 @@ function extended(schema, shape) {
632
632
  return newShape;
633
633
  }
634
634
  function safeExtend(schema, shape) {
635
- if (!isPlainObject$12(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
635
+ if (!isPlainObject$11(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
636
636
  return clone$1(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
637
637
  }
638
638
  function merge$1(a, b) {
@@ -693,17 +693,6 @@ function prefixIssues(path, issues) {
693
693
  function unwrapMessage(message) {
694
694
  return typeof message === "string" ? message : message?.message;
695
695
  }
696
- /** The leading size checks of `defChecks` that set an upper bound, each paired with it. */
697
- function sizeCaps(defChecks) {
698
- const caps = [];
699
- for (const ch of defChecks ?? []) {
700
- const d = ch._zod.def;
701
- if (!/_(length|size)$|_equals$/.test(d.check)) break;
702
- const max = d.maximum ?? d.length ?? d.size;
703
- if (max >= 0) caps.push([max, ch]);
704
- }
705
- return caps;
706
- }
707
696
  function attachSchema(issues, start, inst) {
708
697
  var _a;
709
698
  for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
@@ -964,7 +953,7 @@ var init_util$3 = __esmMin((() => {
964
953
  }));
965
954
 
966
955
  //#endregion
967
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
956
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/core.js
968
957
  function newError(Definition) {
969
958
  const E = _E;
970
959
  if (E) {
@@ -1076,7 +1065,7 @@ var init_core$3 = __esmMin((() => {
1076
1065
  }));
1077
1066
 
1078
1067
  //#endregion
1079
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js
1068
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/errors.js
1080
1069
  function _getMessage() {
1081
1070
  const internals = this._zod;
1082
1071
  internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
@@ -1196,7 +1185,7 @@ var init_errors$3 = __esmMin((() => {
1196
1185
  }));
1197
1186
 
1198
1187
  //#endregion
1199
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/parse.js
1188
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js
1200
1189
  function finalizeParams(callee, params) {
1201
1190
  return {
1202
1191
  callee: params?.callee ?? callee,
@@ -1403,7 +1392,7 @@ var init_parse$1 = __esmMin((() => {
1403
1392
  }));
1404
1393
 
1405
1394
  //#endregion
1406
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/regexes.js
1395
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/regexes.js
1407
1396
  function nanoidOfLength(length) {
1408
1397
  return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
1409
1398
  }
@@ -1470,7 +1459,7 @@ var init_regexes = __esmMin((() => {
1470
1459
  }));
1471
1460
 
1472
1461
  //#endregion
1473
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/checks.js
1462
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/checks.js
1474
1463
  var $ZodCheck, _whenHasLength, numericOriginMap, $ZodCheckLessThan, $ZodCheckGreaterThan, $ZodCheckMultipleOf, $ZodCheckNumberFormat, $ZodCheckMaxLength, $ZodCheckMinLength, $ZodCheckLengthEquals, $ZodCheckStringFormat, $ZodCheckRegex, $ZodCheckLowerCase, $ZodCheckUpperCase, $ZodCheckIncludes, $ZodCheckStartsWith, $ZodCheckEndsWith, $ZodCheckOverwrite;
1475
1464
  var init_checks$1 = __esmMin((() => {
1476
1465
  init_core$3();
@@ -1772,7 +1761,7 @@ var init_checks$1 = __esmMin((() => {
1772
1761
  }));
1773
1762
 
1774
1763
  //#endregion
1775
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/doc.js
1764
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/doc.js
1776
1765
  var Doc;
1777
1766
  var init_doc$1 = __esmMin((() => {
1778
1767
  Doc = class {
@@ -1810,18 +1799,18 @@ var init_doc$1 = __esmMin((() => {
1810
1799
  }));
1811
1800
 
1812
1801
  //#endregion
1813
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/versions.js
1802
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/versions.js
1814
1803
  var version$3;
1815
1804
  var init_versions = __esmMin((() => {
1816
1805
  version$3 = {
1817
1806
  major: 4,
1818
1807
  minor: 6,
1819
- patch: 7
1808
+ patch: 5
1820
1809
  };
1821
1810
  }));
1822
1811
 
1823
1812
  //#endregion
1824
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/schemas.js
1813
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/schemas.js
1825
1814
  async function validateAsync(inst, value) {
1826
1815
  const ctx = { async: true };
1827
1816
  return toStandardResult(await inst._zod.run({
@@ -1929,25 +1918,6 @@ function isValidJWT$1(token, algorithm = null) {
1929
1918
  return false;
1930
1919
  }
1931
1920
  }
1932
- function capSize(inst, size) {
1933
- const caps = sizeCaps(inst._zod.def.checks);
1934
- if (!caps.length) return;
1935
- const cap = Math.min(...caps.map((c) => c[0]));
1936
- const parse = inst._zod.parse;
1937
- inst._zod.parse = (payload, ctx) => {
1938
- const n = size(payload.value);
1939
- if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
1940
- for (const [max, ch] of sizeCaps(inst._zod.def.checks)) if (n > max && ch._zod.def.when(payload)) {
1941
- const start = payload.issues.length;
1942
- ch._zod.check(payload);
1943
- payload.issues[start].continue = false;
1944
- attachSchema(payload.issues, start, inst);
1945
- return payload;
1946
- }
1947
- }
1948
- return parse(payload, ctx);
1949
- };
1950
- }
1951
1921
  function handleArrayResult(result, final, index) {
1952
1922
  if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1953
1923
  final.value[index] = result.value;
@@ -2069,7 +2039,7 @@ function mergeValues$1(a, b) {
2069
2039
  valid: true,
2070
2040
  data: a
2071
2041
  };
2072
- if (isPlainObject$12(a) && isPlainObject$12(b)) {
2042
+ if (isPlainObject$11(a) && isPlainObject$11(b)) {
2073
2043
  const bKeys = Object.keys(b);
2074
2044
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
2075
2045
  const newObj = {
@@ -2214,7 +2184,7 @@ function handleRefineResult(result, payload, input, inst) {
2214
2184
  payload.issues.push(issue(_iss));
2215
2185
  }
2216
2186
  }
2217
- var $ZodType, toStandardResult, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT, URL_UNPARSEABLE, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, arraySize, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
2187
+ var $ZodType, toStandardResult, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, URL_BAD_FORMAT, URL_UNPARSEABLE, asciiTabOrNewline, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, ipv6Alphabet, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, base64Charset, $ZodBase64, base64urlCharset, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodUndefined, $ZodNull, $ZodAny, $ZodUnknown, $ZodNever, $ZodDate, $ZodArray, NO_SYMBOL_KEYS, $ZodObject, $ZodObjectJIT, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodExactOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodPreprocess, $ZodReadonly, $ZodLazy, $ZodCustom;
2218
2188
  var init_schemas$1 = __esmMin((() => {
2219
2189
  init_checks$1();
2220
2190
  init_core$3();
@@ -2661,7 +2631,6 @@ var init_schemas$1 = __esmMin((() => {
2661
2631
  return payload;
2662
2632
  };
2663
2633
  });
2664
- arraySize = (input) => Array.isArray(input) ? input.length : -1;
2665
2634
  $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
2666
2635
  $ZodType.init(inst, def);
2667
2636
  const memo = globalConfig.memoizer;
@@ -2695,7 +2664,6 @@ var init_schemas$1 = __esmMin((() => {
2695
2664
  if (proms.length) return Promise.all(proms).then(() => payload);
2696
2665
  return payload;
2697
2666
  };
2698
- capSize(inst, arraySize);
2699
2667
  });
2700
2668
  NO_SYMBOL_KEYS = [];
2701
2669
  $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
@@ -2719,7 +2687,7 @@ var init_schemas$1 = __esmMin((() => {
2719
2687
  for (const key in shape) {
2720
2688
  const field = shape[key]._zod;
2721
2689
  if (field.values) {
2722
- if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp$1(propValues, key, /* @__PURE__ */ new Set());
2690
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
2723
2691
  for (const v of field.values) propValues[key].add(v);
2724
2692
  if (field.optin !== void 0) propValues[key].add(void 0);
2725
2693
  }
@@ -2940,7 +2908,7 @@ var init_schemas$1 = __esmMin((() => {
2940
2908
  if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2941
2909
  if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
2942
2910
  for (const [k, v] of Object.entries(pv)) {
2943
- if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp$1(propValues, k, /* @__PURE__ */ new Set());
2911
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
2944
2912
  for (const val of v) propValues[k].add(val);
2945
2913
  }
2946
2914
  }
@@ -3004,7 +2972,7 @@ var init_schemas$1 = __esmMin((() => {
3004
2972
  memo?.attach(inst);
3005
2973
  inst._zod.parse = (payload, ctx) => {
3006
2974
  const input = payload.value;
3007
- if (!isPlainObject$12(input)) {
2975
+ if (!isPlainObject$11(input)) {
3008
2976
  payload.issues.push({
3009
2977
  expected: "record",
3010
2978
  code: "invalid_type",
@@ -3353,7 +3321,7 @@ var init_schemas$1 = __esmMin((() => {
3353
3321
  }));
3354
3322
 
3355
3323
  //#endregion
3356
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/memoizer.js
3324
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/memoizer.js
3357
3325
  function isRef$1(value) {
3358
3326
  return value !== null && typeof value === "object";
3359
3327
  }
@@ -3609,7 +3577,7 @@ var init_memoizer = __esmMin((() => {
3609
3577
  }));
3610
3578
 
3611
3579
  //#endregion
3612
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/en.js
3580
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/en.js
3613
3581
  function en_default() {
3614
3582
  return { localeError: error() };
3615
3583
  }
@@ -3722,7 +3690,7 @@ var init_en$1 = __esmMin((() => {
3722
3690
  }));
3723
3691
 
3724
3692
  //#endregion
3725
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/registries.js
3693
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/registries.js
3726
3694
  function registry$1() {
3727
3695
  return new $ZodRegistry();
3728
3696
  }
@@ -3773,11 +3741,11 @@ var init_registries = __esmMin((() => {
3773
3741
  }));
3774
3742
 
3775
3743
  //#endregion
3776
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/compile.js
3744
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/compile.js
3777
3745
  var init_compile = __esmMin((() => {}));
3778
3746
 
3779
3747
  //#endregion
3780
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js
3748
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/api.js
3781
3749
  function snapshotChecks(def) {
3782
3750
  if (def.checks) def.checks = [...def.checks];
3783
3751
  return def;
@@ -4337,9 +4305,9 @@ var init_api = __esmMin((() => {
4337
4305
  }));
4338
4306
 
4339
4307
  //#endregion
4340
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/to-json-schema.js
4308
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/to-json-schema.js
4341
4309
  function assignProps(target, ...sources) {
4342
- for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp$1(target, key, source[key]);
4310
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
4343
4311
  return target;
4344
4312
  }
4345
4313
  function initializeContext(params) {
@@ -4558,7 +4526,7 @@ function foldObjects(members) {
4558
4526
  if (part === null || part === void 0) continue;
4559
4527
  if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
4560
4528
  }
4561
- assignProp$1(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
4529
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
4562
4530
  }
4563
4531
  for (const key of object.required ?? []) required.add(key);
4564
4532
  }
@@ -4688,7 +4656,7 @@ function finalize(ctx, schema) {
4688
4656
  const seen = entry[1];
4689
4657
  if (seen.def && seen.defId) {
4690
4658
  if (seen.def.id === seen.defId) delete seen.def.id;
4691
- assignProp$1(defs, seen.defId, seen.def);
4659
+ assignProp(defs, seen.defId, seen.def);
4692
4660
  }
4693
4661
  }
4694
4662
  if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
@@ -4778,7 +4746,7 @@ var init_to_json_schema = __esmMin((() => {
4778
4746
  }));
4779
4747
 
4780
4748
  //#endregion
4781
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/json-schema-processors.js
4749
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/json-schema-processors.js
4782
4750
  function aggregateChecks(schema) {
4783
4751
  const agg = {};
4784
4752
  const def = schema._zod.def;
@@ -4892,7 +4860,7 @@ function toJSONSchema(input, params) {
4892
4860
  for (const entry of registry._idmap.entries()) {
4893
4861
  const [key, schema] = entry;
4894
4862
  extractDefs(ctx, schema);
4895
- assignProp$1(schemas, key, finalize(ctx, schema));
4863
+ assignProp(schemas, key, finalize(ctx, schema));
4896
4864
  }
4897
4865
  if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4898
4866
  return { schemas };
@@ -5147,7 +5115,7 @@ var init_json_schema_processors = __esmMin((() => {
5147
5115
  if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
5148
5116
  json.type = "object";
5149
5117
  json.properties = {};
5150
- for (const key in shape) assignProp$1(json.properties, key, processSchema(shape[key], ctx, {
5118
+ for (const key in shape) assignProp(json.properties, key, processSchema(shape[key], ctx, {
5151
5119
  ...params,
5152
5120
  path: [
5153
5121
  ...params.path,
@@ -5275,7 +5243,7 @@ var init_json_schema_processors = __esmMin((() => {
5275
5243
  ]
5276
5244
  });
5277
5245
  json.patternProperties = {};
5278
- for (const pattern of patterns) assignProp$1(json.patternProperties, exactPattern(pattern).source, valueSchema);
5246
+ for (const pattern of patterns) assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
5279
5247
  } else {
5280
5248
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
5281
5249
  json.propertyNames = processSchema(def.keyType, ctx, {
@@ -5426,7 +5394,7 @@ var init_json_schema_processors = __esmMin((() => {
5426
5394
  }));
5427
5395
 
5428
5396
  //#endregion
5429
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/index.js
5397
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/index.js
5430
5398
  var init_core$2 = __esmMin((() => {
5431
5399
  init_core$3();
5432
5400
  init_parse$1();
@@ -5448,13 +5416,13 @@ var init_core$2 = __esmMin((() => {
5448
5416
  }));
5449
5417
 
5450
5418
  //#endregion
5451
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/checks.js
5419
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/checks.js
5452
5420
  var init_checks = __esmMin((() => {
5453
5421
  init_core$2();
5454
5422
  }));
5455
5423
 
5456
5424
  //#endregion
5457
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/errors.js
5425
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/errors.js
5458
5426
  function _lazyMethod(proto, key, make) {
5459
5427
  Object.defineProperty(proto, key, {
5460
5428
  configurable: true,
@@ -5510,7 +5478,7 @@ var init_errors$2 = __esmMin((() => {
5510
5478
  }));
5511
5479
 
5512
5480
  //#endregion
5513
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/parse.js
5481
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/parse.js
5514
5482
  var parse$3, parseAsync, safeParse, safeParseAsync, encode$3, decode$2, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync;
5515
5483
  var init_parse = __esmMin((() => {
5516
5484
  init_core$2();
@@ -5530,7 +5498,7 @@ var init_parse = __esmMin((() => {
5530
5498
  }));
5531
5499
 
5532
5500
  //#endregion
5533
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/schemas.js
5501
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/schemas.js
5534
5502
  function _ensureDefaultLocale() {
5535
5503
  if (!globalConfig.localeError) config$1(en_default());
5536
5504
  }
@@ -6519,7 +6487,7 @@ var init_schemas = __esmMin((() => {
6519
6487
  }));
6520
6488
 
6521
6489
  //#endregion
6522
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/compat.js
6490
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/compat.js
6523
6491
  var ZodIssueCode$1, ZodFirstPartyTypeKind$1;
6524
6492
  var init_compat = __esmMin((() => {
6525
6493
  init_core$2();
@@ -6541,7 +6509,7 @@ var init_compat = __esmMin((() => {
6541
6509
  }));
6542
6510
 
6543
6511
  //#endregion
6544
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
6512
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/iso.js
6545
6513
  function datetime(params) {
6546
6514
  return _isoDateTime(ZodISODateTime, params);
6547
6515
  }
@@ -6554,7 +6522,7 @@ var init_iso = __esmMin((() => {
6554
6522
  }));
6555
6523
 
6556
6524
  //#endregion
6557
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/coerce.js
6525
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/coerce.js
6558
6526
  function number(params) {
6559
6527
  return _coercedNumber(ZodNumber$1, params);
6560
6528
  }
@@ -6567,7 +6535,7 @@ var init_coerce = __esmMin((() => {
6567
6535
  }));
6568
6536
 
6569
6537
  //#endregion
6570
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
6538
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
6571
6539
  var init_external$1 = __esmMin((() => {
6572
6540
  init_core$2();
6573
6541
  init_schemas();
@@ -6587,7 +6555,7 @@ var init_external$1 = __esmMin((() => {
6587
6555
  }));
6588
6556
 
6589
6557
  //#endregion
6590
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/index.js
6558
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/index.js
6591
6559
  var init_zod$1 = __esmMin((() => {
6592
6560
  init_external$1();
6593
6561
  init_external$1();
@@ -7018,7 +6986,7 @@ var init_heterogeneousAgent = __esmMin((() => {
7018
6986
 
7019
6987
  //#endregion
7020
6988
  //#region ../../packages/types/src/agent/heteroSelectorCapabilities.ts
7021
- var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, parseModelTuple, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
6989
+ var HETEROGENEOUS_AGENT_DEFAULT_SELECTION, AMP_AGENT_MODES, CLAUDE_CODE_REASONING_EFFORT_LEVELS, ANTIGRAVITY_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_LEVELS, GROK_BUILD_REASONING_EFFORT_FLAGS, CODEX_COMMON_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_LEVELS, CODEX_REASONING_EFFORT_CONFIG_KEY$1, CODEX_DEEPSEEK_V4_REASONING_EFFORT_LEVELS, CODEX_GLM_5_2_REASONING_EFFORT_LEVELS, CODEX_MAX_REASONING_EFFORT_LEVELS, CODEX_ULTRA_REASONING_MODELS, CODEX_MAX_REASONING_MODELS, QODER_REASONING_EFFORT_LEVELS, QODER_REASONING_EFFORT_FLAG, COPILOT_REASONING_EFFORT_LEVELS, COPILOT_REASONING_EFFORT_FLAG, CODEX_SERVICE_TIER_CONFIG_KEY$1, toCodexServiceTier, CODEX_FAST_SERVICE_TIER_VALUES, isAmpAgentMode, isClaudeCodeReasoningEffort, isCodexReasoningEffort, isGrokBuildReasoningEffort, isQoderReasoningEffort, isCopilotReasoningEffort, isCodexFastServiceTier, getCodexReasoningEffortLevels, resolveAmpAgentMode, CODEX_MODEL_FLAGS$2, resolveClaudeCodeModel, resolveClaudeCodeReasoningEffort, resolveCodexModel, resolveCodexReasoningEffort, resolveCodexSpeedMode, resolveGrokBuildReasoningEffort, resolveQoderReasoningEffort, resolveCopilotReasoningEffort, resolvePersistedModel, parseModelTuple, MODEL_FLAGS_ENCODING, HETERO_SELECTOR_CAPABILITIES, modelFlagsOf, COPILOT_MODEL_FLAGS, GROK_BUILD_MODEL_FLAGS, KIMI_CODE_MODEL_FLAGS, OPENCODE_MODEL_FLAGS, PI_MODEL_FLAGS, QODER_MODEL_FLAGS;
7022
6990
  var init_heteroSelectorCapabilities = __esmMin((() => {
7023
6991
  init_heteroCliArgs();
7024
6992
  HETEROGENEOUS_AGENT_DEFAULT_SELECTION = "default";
@@ -7035,6 +7003,13 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7035
7003
  "xhigh",
7036
7004
  "max"
7037
7005
  ];
7006
+ ANTIGRAVITY_REASONING_EFFORT_LEVELS = [
7007
+ "low",
7008
+ "medium",
7009
+ "high",
7010
+ "xhigh",
7011
+ "max"
7012
+ ];
7038
7013
  GROK_BUILD_REASONING_EFFORT_LEVELS = [
7039
7014
  "low",
7040
7015
  "medium",
@@ -7158,14 +7133,24 @@ var init_heteroSelectorCapabilities = __esmMin((() => {
7158
7133
  kind: "flag"
7159
7134
  };
7160
7135
  HETERO_SELECTOR_CAPABILITIES = {
7161
- "antigravity": { model: {
7162
- encodings: [{
7163
- flags: ["--model"],
7164
- kind: "flag"
7165
- }],
7166
- resolve: resolvePersistedModel,
7167
- source: "catalog"
7168
- } },
7136
+ "antigravity": {
7137
+ effort: {
7138
+ encodings: [{
7139
+ flags: ["--effort"],
7140
+ kind: "flag"
7141
+ }],
7142
+ levels: (model, models) => models ? models.find((entry) => entry.id === model)?.effortLevels ?? [] : ANTIGRAVITY_REASONING_EFFORT_LEVELS,
7143
+ resolve: resolveClaudeCodeReasoningEffort
7144
+ },
7145
+ model: {
7146
+ encodings: [{
7147
+ flags: ["--model"],
7148
+ kind: "flag"
7149
+ }],
7150
+ resolve: resolveClaudeCodeModel,
7151
+ source: "catalog"
7152
+ }
7153
+ },
7169
7154
  "amp": { mode: {
7170
7155
  encodings: [{
7171
7156
  flags: ["--mode"],
@@ -8001,6 +7986,11 @@ var init_agentExecution = __esmMin((() => {
8001
7986
  * Experience); the topic's first dispatched run starts in it.
8002
7987
  */
8003
7988
  heteroPermissionMode: _enum(HETERO_PERMISSION_MODES).optional(),
7989
+ /**
7990
+ * Codex Plan switch the composer showed (Better Coding Experience); the
7991
+ * topic's first native turn sends `plan` / `default` from it.
7992
+ */
7993
+ heteroPlanMode: boolean().optional(),
8004
7994
  repos: array(string()).optional(),
8005
7995
  /**
8006
7996
  * Cloud-sandbox placement the composer chose before any topic existed — an
@@ -11159,6 +11149,11 @@ var init_topic$1 = __esmMin((() => {
11159
11149
  heteroSessionIdByWorkingDirectory: record(string(), string()).optional(),
11160
11150
  heteroPermissionMode: _enum(HETERO_PERMISSION_MODES).optional(),
11161
11151
  heteroPermissionModeFallback: _enum(["outdatedCli", "root"]).nullable().optional(),
11152
+ heteroPlanMode: boolean().optional(),
11153
+ codexPlanDecision: object$1({
11154
+ dismissed: boolean(),
11155
+ itemId: string().min(1)
11156
+ }).nullable().optional(),
11162
11157
  heteroSpeed: _enum([
11163
11158
  "default",
11164
11159
  "normal",
@@ -12438,6 +12433,19 @@ var init_connector = __esmMin((() => {}));
12438
12433
  //#region ../../packages/types/src/connectorToolIdentifier.ts
12439
12434
  var init_connectorToolIdentifier = __esmMin((() => {}));
12440
12435
 
12436
+ //#endregion
12437
+ //#region ../../packages/types/src/worktreeMode.ts
12438
+ var init_worktreeMode = __esmMin((() => {}));
12439
+
12440
+ //#endregion
12441
+ //#region ../../packages/types/src/heteroPlanMode.ts
12442
+ var CODEX_COLLABORATION_MODES, isCodexCollaborationMode, CODEX_COLLABORATION_MODE_RUNTIME;
12443
+ var init_heteroPlanMode = __esmMin((() => {
12444
+ CODEX_COLLABORATION_MODES = ["plan", "default"];
12445
+ isCodexCollaborationMode = (value) => typeof value === "string" && CODEX_COLLABORATION_MODES.includes(value);
12446
+ CODEX_COLLABORATION_MODE_RUNTIME = "codex-collaboration-mode-v1";
12447
+ }));
12448
+
12441
12449
  //#endregion
12442
12450
  //#region ../../packages/types/src/inboundWebhook.ts
12443
12451
  var GENERIC_WEBHOOK_TOPIC_MODES, GENERIC_WEBHOOK_IDENTIFIER_PATTERN, InboundWebhookChannelDeliverySchema, McpEventsWebhookConfigSchema, McpEventsWebhookStateSchema, McpEventsWebhookVerificationSchema, GenericWebhookConfigSchema, GenericWebhookStateSchema, GenericWebhookVerificationSchema, InboundWebhookDataSchema;
@@ -12535,10 +12543,6 @@ var init_trace = __esmMin((() => {
12535
12543
  //#region ../../packages/types/src/util.ts
12536
12544
  var init_util$2 = __esmMin((() => {}));
12537
12545
 
12538
- //#endregion
12539
- //#region ../../packages/types/src/worktreeMode.ts
12540
- var init_worktreeMode = __esmMin((() => {}));
12541
-
12542
12546
  //#endregion
12543
12547
  //#region ../../packages/types/src/zustand.ts
12544
12548
  var init_zustand = __esmMin((() => {}));
@@ -12652,6 +12656,7 @@ var init_src$2 = __esmMin((() => {
12652
12656
  init_connector();
12653
12657
  init_connectorToolIdentifier();
12654
12658
  init_heteroPermissionMode();
12659
+ init_heteroPlanMode();
12655
12660
  init_inboundWebhook();
12656
12661
  init_oauthApp();
12657
12662
  init_chat();
@@ -18423,6 +18428,8 @@ const API_KEY_FULL_ACCESS_SCOPE = "*";
18423
18428
  /**
18424
18429
  * The selectable scope catalog. `model:invoke` is its own tier because it is
18425
18430
  * the one that burns money (chat/completions, image, video, music, asr).
18431
+ * On the public REST API, text / JSON / image / video generation, speech and
18432
+ * transcription spend credits under `generation:write` instead.
18426
18433
  *
18427
18434
  * Deliberately absent (a restricted key can never obtain them):
18428
18435
  * - `api_key:*` — keys must not mint keys (self-provisioning)
@@ -18445,6 +18452,8 @@ const API_KEY_SCOPES = [
18445
18452
  "file:write",
18446
18453
  "knowledge:read",
18447
18454
  "knowledge:write",
18455
+ "generation:read",
18456
+ "generation:write",
18448
18457
  "mcp:read",
18449
18458
  "mcp:write",
18450
18459
  "usage:read",
@@ -19284,7 +19293,7 @@ const PLUGIN_SCHEMA_SEPARATOR = "____";
19284
19293
  * console.log(isPlainObject(Object.create(null))); // true
19285
19294
  * console.log(isPlainObject(new Map())); // false
19286
19295
  */
19287
- function isPlainObject$11(object) {
19296
+ function isPlainObject$10(object) {
19288
19297
  if (typeof object !== "object") return false;
19289
19298
  if (object == null) return false;
19290
19299
  if (Object.getPrototypeOf(object) === null) return true;
@@ -19977,8 +19986,8 @@ function mergeWithDeep(target, source, merge, stack) {
19977
19986
  const merged = merge(targetValue, sourceValue, key, target, source, stack);
19978
19987
  if (merged !== void 0) target[key] = merged;
19979
19988
  else if (Array.isArray(sourceValue)) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
19980
- else if (isObjectLike(targetValue) && isObjectLike(sourceValue) && (isPlainObject$11(targetValue) || isPlainObject$11(sourceValue) || isTypedArray$2(targetValue) || isTypedArray$2(sourceValue))) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
19981
- else if (targetValue == null && isPlainObject$11(sourceValue)) target[key] = mergeWithDeep({}, sourceValue, merge, stack);
19989
+ else if (isObjectLike(targetValue) && isObjectLike(sourceValue) && (isPlainObject$10(targetValue) || isPlainObject$10(sourceValue) || isTypedArray$2(targetValue) || isTypedArray$2(sourceValue))) target[key] = mergeWithDeep(targetValue, sourceValue, merge, stack);
19990
+ else if (targetValue == null && isPlainObject$10(sourceValue)) target[key] = mergeWithDeep({}, sourceValue, merge, stack);
19982
19991
  else if (targetValue == null && isTypedArray$2(sourceValue)) target[key] = cloneDeep(sourceValue);
19983
19992
  else if (targetValue === void 0 || sourceValue !== void 0) target[key] = sourceValue;
19984
19993
  }
@@ -20458,7 +20467,7 @@ function resolveWorkspaceScope(explicit) {
20458
20467
  * their personal space.
20459
20468
  */
20460
20469
  function describeScopedNotFound(error) {
20461
- if (toRecord(toRecord(error)?.data)?.code !== "NOT_FOUND") return;
20470
+ if (toRecord$1(toRecord$1(error)?.data)?.code !== "NOT_FOUND") return;
20462
20471
  const { workspaceId } = resolveWorkspaceScope();
20463
20472
  if (!workspaceId) return;
20464
20473
  return `Looked in workspace ${workspaceId}. If it is in your personal space, rerun with LOBEHUB_WORKSPACE_ID=${PERSONAL_SCOPE_ENV_VALUE}; for another workspace, set LOBEHUB_WORKSPACE_ID=<id>.`;
@@ -24443,7 +24452,7 @@ const GOMS_KLM_TIMING_SECONDS = {
24443
24452
  };
24444
24453
 
24445
24454
  //#endregion
24446
- //#region node_modules/.pnpm/@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
24455
+ //#region node_modules/.pnpm/@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
24447
24456
  /**
24448
24457
  * Creates an observable. `subscribe` runs for each subscriber, and can
24449
24458
  * return a function that cleans up when it unsubscribes.
@@ -24669,7 +24678,7 @@ function observableToAsyncIterable(observable, signal) {
24669
24678
  }
24670
24679
 
24671
24680
  //#endregion
24672
- //#region node_modules/.pnpm/@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-BjUZYMQq.mjs
24681
+ //#region node_modules/.pnpm/@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/observable-BjUZYMQq.mjs
24673
24682
  /**
24674
24683
  * Shares one subscription to the source between all subscribers. It
24675
24684
  * starts with the first subscriber and ends when the last unsubscribes.
@@ -24795,7 +24804,7 @@ function behaviorSubject(initialValue) {
24795
24804
  }
24796
24805
 
24797
24806
  //#endregion
24798
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/splitLink-PFsRy7Mf.mjs
24807
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/splitLink-PFsRy7Mf.mjs
24799
24808
  /** @internal */
24800
24809
  function createChain(opts) {
24801
24810
  return observable$1((observer) => {
@@ -24814,7 +24823,7 @@ function createChain(opts) {
24814
24823
  }
24815
24824
 
24816
24825
  //#endregion
24817
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/objectSpread2-pyA4QVO4.mjs
24826
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/objectSpread2-pyA4QVO4.mjs
24818
24827
  function _typeof$1(o) {
24819
24828
  "@babel/helpers - typeof";
24820
24829
  return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -24868,7 +24877,7 @@ function _objectSpread2$1(e) {
24868
24877
  }
24869
24878
 
24870
24879
  //#endregion
24871
- //#region node_modules/.pnpm/@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/codes-BCsCCyMj.mjs
24880
+ //#region node_modules/.pnpm/@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/codes-BCsCCyMj.mjs
24872
24881
  /**
24873
24882
  * Check that value is object
24874
24883
  * @internal
@@ -24931,7 +24940,7 @@ const retryableRpcCodes = [
24931
24940
  ];
24932
24941
 
24933
24942
  //#endregion
24934
- //#region node_modules/.pnpm/@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-CVrl8_-w.mjs
24943
+ //#region node_modules/.pnpm/@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/getErrorShape-CVrl8_-w.mjs
24935
24944
  const noop$4 = () => {};
24936
24945
  const freezeIfAvailable = (obj) => {
24937
24946
  if (Object.freeze) Object.freeze(obj);
@@ -25036,7 +25045,7 @@ function _objectSpread2(e) {
25036
25045
  }
25037
25046
 
25038
25047
  //#endregion
25039
- //#region node_modules/.pnpm/@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/asyncGeneratorDelegate-Bmz6asKS.mjs
25048
+ //#region node_modules/.pnpm/@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3/node_modules/@trpc/server/dist/asyncGeneratorDelegate-Bmz6asKS.mjs
25040
25049
  /** @internal */
25041
25050
  function transformResultInner(response, transformer) {
25042
25051
  if ("error" in response) {
@@ -25142,7 +25151,7 @@ AsyncGenerator$1.prototype["function" == typeof Symbol && Symbol.asyncIterator |
25142
25151
  };
25143
25152
 
25144
25153
  //#endregion
25145
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/TRPCClientError-DE6-fd1n.mjs
25154
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/TRPCClientError-DE6-fd1n.mjs
25146
25155
  /**
25147
25156
  * Whether a value is a `TRPCClientError`, typed for a router or procedure.
25148
25157
  * @see https://trpc.io/docs/client/vanilla/error-handling#catching-a-thrown-error
@@ -25198,7 +25207,7 @@ var TRPCClientError = class TRPCClientError extends Error {
25198
25207
  };
25199
25208
 
25200
25209
  //#endregion
25201
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/unstable-internals.mjs
25210
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/unstable-internals.mjs
25202
25211
  /**
25203
25212
  * @internal
25204
25213
  */
@@ -25225,7 +25234,7 @@ function getTransformer(transformer) {
25225
25234
  }
25226
25235
 
25227
25236
  //#endregion
25228
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
25237
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpUtils-CtMuyl9j.mjs
25229
25238
  const isFunction$1 = (fn) => typeof fn === "function";
25230
25239
  /**
25231
25240
  * The `fetch` to use: `customFetchImpl` if given, or else the global one.
@@ -25361,7 +25370,7 @@ async function httpRequest(opts) {
25361
25370
  }
25362
25371
 
25363
25372
  //#endregion
25364
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpLink-B4UwXApa.mjs
25373
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/httpLink-B4UwXApa.mjs
25365
25374
  /** Whether an input is binary: a `Uint8Array`, `Blob` or `File`. */
25366
25375
  function isOctetType(input) {
25367
25376
  return input instanceof Uint8Array || input instanceof Blob;
@@ -25454,7 +25463,7 @@ function httpLink(opts) {
25454
25463
  }
25455
25464
 
25456
25465
  //#endregion
25457
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/wsLink-DYx-NUSN.mjs
25466
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/wsLink-DYx-NUSN.mjs
25458
25467
  /**
25459
25468
  * Get the result of a value or function that returns a value
25460
25469
  * It also optionally accepts typesafe arguments for the function
@@ -25644,7 +25653,7 @@ var WsConnection = class WsConnection {
25644
25653
  _defineProperty$1(WsConnection, "connectCount", 0);
25645
25654
 
25646
25655
  //#endregion
25647
- //#region node_modules/.pnpm/@trpc+client@11.29.5_@trpc+server@11.29.5_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/index.mjs
25656
+ //#region node_modules/.pnpm/@trpc+client@11.29.7_@trpc+server@11.29.7_@types+ws@8.18.2_typescript@6.0.3__typescript@6.0.3/node_modules/@trpc/client/dist/index.mjs
25648
25657
  const observerKeys = [
25649
25658
  "onStarted",
25650
25659
  "onData",
@@ -25857,7 +25866,7 @@ AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator ||
25857
25866
  };
25858
25867
 
25859
25868
  //#endregion
25860
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/double-indexed-kv.js
25869
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/double-indexed-kv.js
25861
25870
  var DoubleIndexedKV = class {
25862
25871
  constructor() {
25863
25872
  this.keyToValue = /* @__PURE__ */ new Map();
@@ -25880,7 +25889,7 @@ var DoubleIndexedKV = class {
25880
25889
  };
25881
25890
 
25882
25891
  //#endregion
25883
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/registry.js
25892
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/registry.js
25884
25893
  var Registry = class {
25885
25894
  constructor(generateIdentifier) {
25886
25895
  this.generateIdentifier = generateIdentifier;
@@ -25894,6 +25903,9 @@ var Registry = class {
25894
25903
  clear() {
25895
25904
  this.kv.clear();
25896
25905
  }
25906
+ get size() {
25907
+ return this.kv.valueToKey.size;
25908
+ }
25897
25909
  getIdentifier(value) {
25898
25910
  return this.kv.getByValue(value);
25899
25911
  }
@@ -25903,7 +25915,7 @@ var Registry = class {
25903
25915
  };
25904
25916
 
25905
25917
  //#endregion
25906
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/class-registry.js
25918
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/class-registry.js
25907
25919
  var ClassRegistry = class extends Registry {
25908
25920
  constructor() {
25909
25921
  super((c) => c.name);
@@ -25921,46 +25933,22 @@ var ClassRegistry = class extends Registry {
25921
25933
  };
25922
25934
 
25923
25935
  //#endregion
25924
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/util.js
25925
- function valuesOfObj(record) {
25926
- if ("values" in Object) return Object.values(record);
25927
- const values = [];
25928
- for (const key in record) if (record.hasOwnProperty(key)) values.push(record[key]);
25929
- return values;
25930
- }
25931
- function find$2(record, predicate) {
25932
- const values = valuesOfObj(record);
25933
- if ("find" in values) return values.find(predicate);
25934
- const valuesNotNever = values;
25935
- for (let i = 0; i < valuesNotNever.length; i++) {
25936
- const value = valuesNotNever[i];
25937
- if (predicate(value)) return value;
25938
- }
25939
- }
25940
- function forEach(record, run) {
25941
- Object.entries(record).forEach(([key, value]) => run(value, key));
25942
- }
25943
- function includes(arr, value) {
25944
- return arr.indexOf(value) !== -1;
25945
- }
25946
- function findArr(record, predicate) {
25947
- for (let i = 0; i < record.length; i++) {
25948
- const value = record[i];
25949
- if (predicate(value)) return value;
25950
- }
25951
- }
25952
-
25953
- //#endregion
25954
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/custom-transformer-registry.js
25936
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/custom-transformer-registry.js
25955
25937
  var CustomTransformerRegistry = class {
25956
25938
  constructor() {
25957
25939
  this.transfomers = {};
25940
+ this.ordered = [];
25958
25941
  }
25959
25942
  register(transformer) {
25960
25943
  this.transfomers[transformer.name] = transformer;
25944
+ this.ordered = Object.values(this.transfomers);
25945
+ }
25946
+ get size() {
25947
+ return this.ordered.length;
25961
25948
  }
25962
25949
  findApplicable(v) {
25963
- return find$2(this.transfomers, (transformer) => transformer.isApplicable(v));
25950
+ const transformers = this.ordered;
25951
+ for (let i = 0; i < transformers.length; i++) if (transformers[i].isApplicable(v)) return transformers[i];
25964
25952
  }
25965
25953
  findByName(name) {
25966
25954
  return this.transfomers[name];
@@ -25968,39 +25956,60 @@ var CustomTransformerRegistry = class {
25968
25956
  };
25969
25957
 
25970
25958
  //#endregion
25971
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/is.js
25972
- const getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
25959
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/is.js
25973
25960
  const isUndefined$1 = (payload) => typeof payload === "undefined";
25974
- const isNull$1 = (payload) => payload === null;
25975
- const isPlainObject$10 = (payload) => {
25961
+ const isPlainObject$9 = (payload) => {
25976
25962
  if (typeof payload !== "object" || payload === null) return false;
25977
25963
  if (payload === Object.prototype) return false;
25978
- if (Object.getPrototypeOf(payload) === null) return true;
25979
- return Object.getPrototypeOf(payload) === Object.prototype;
25964
+ const prototype = Object.getPrototypeOf(payload);
25965
+ return prototype === null || prototype === Object.prototype;
25980
25966
  };
25981
- const isEmptyObject = (payload) => isPlainObject$10(payload) && Object.keys(payload).length === 0;
25967
+ const isEmptyObject = (payload) => isPlainObject$9(payload) && Object.keys(payload).length === 0;
25982
25968
  const isArray = (payload) => Array.isArray(payload);
25983
- const isString = (payload) => typeof payload === "string";
25984
- const isNumber = (payload) => typeof payload === "number" && !isNaN(payload);
25985
- const isBoolean$1 = (payload) => typeof payload === "boolean";
25986
25969
  const isRegExp = (payload) => payload instanceof RegExp;
25987
25970
  const isMap = (payload) => payload instanceof Map;
25988
25971
  const isSet = (payload) => payload instanceof Set;
25989
- const isSymbol = (payload) => getType(payload) === "Symbol";
25972
+ const hasSymbolTag = (payload) => (typeof payload === "object" && payload !== null || typeof payload === "function") && payload[Symbol.toStringTag] === "Symbol";
25973
+ const isSymbol = (payload) => typeof payload === "symbol" || hasSymbolTag(payload);
25990
25974
  const isDate = (payload) => payload instanceof Date && !isNaN(payload.valueOf());
25991
25975
  const isError$1 = (payload) => payload instanceof Error;
25992
25976
  const isNaNValue = (payload) => typeof payload === "number" && isNaN(payload);
25993
- const isPrimitive = (payload) => isBoolean$1(payload) || isNull$1(payload) || isUndefined$1(payload) || isNumber(payload) || isString(payload) || isSymbol(payload);
25977
+ const isPrimitive = (payload) => {
25978
+ switch (typeof payload) {
25979
+ case "boolean":
25980
+ case "string":
25981
+ case "undefined":
25982
+ case "symbol": return true;
25983
+ case "number": return !isNaN(payload);
25984
+ case "object": return payload === null || hasSymbolTag(payload);
25985
+ case "function": return hasSymbolTag(payload);
25986
+ default: return false;
25987
+ }
25988
+ };
25994
25989
  const isBigint = (payload) => typeof payload === "bigint";
25995
25990
  const isInfinite = (payload) => payload === Infinity || payload === -Infinity;
25996
25991
  const isTypedArray$1 = (payload) => ArrayBuffer.isView(payload) && !(payload instanceof DataView);
25997
- const isURL = (payload) => payload instanceof URL;
25992
+ const isURL = (payload) => typeof URL !== "undefined" && payload instanceof URL;
25998
25993
 
25999
25994
  //#endregion
26000
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/pathstringifier.js
26001
- const escapeKey = (key) => key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
25995
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/pathstringifier.js
25996
+ const escapeKey = (key) => key.indexOf("\\") === -1 && key.indexOf(".") === -1 ? key : key.replace(/\\/g, "\\\\").replace(/\./g, "\\.");
26002
25997
  const stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
25998
+ const splitOnDots = (string) => {
25999
+ const result = [];
26000
+ let start = 0;
26001
+ for (;;) {
26002
+ const dot = string.indexOf(".", start);
26003
+ if (dot === -1) {
26004
+ result.push(start === 0 ? string : string.slice(start));
26005
+ return result;
26006
+ }
26007
+ result.push(string.slice(start, dot));
26008
+ start = dot + 1;
26009
+ }
26010
+ };
26003
26011
  const parsePath = (string, legacyPaths) => {
26012
+ if (typeof string === "string" && string.indexOf("\\") === -1) return splitOnDots(string);
26004
26013
  const result = [];
26005
26014
  let segment = "";
26006
26015
  for (let i = 0; i < string.length; i++) {
@@ -26031,7 +26040,42 @@ const parsePath = (string, legacyPaths) => {
26031
26040
  };
26032
26041
 
26033
26042
  //#endregion
26034
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/transformer.js
26043
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/date.js
26044
+ const pad2 = (n) => n < 10 ? "0" + n : "" + n;
26045
+ const pad3 = (n) => n < 10 ? "00" + n : n < 100 ? "0" + n : "" + n;
26046
+ function toISOString(date) {
26047
+ const year = date.getUTCFullYear();
26048
+ if (year < 1e3 || year > 9999) return date.toISOString();
26049
+ return year + "-" + pad2(date.getUTCMonth() + 1) + "-" + pad2(date.getUTCDate()) + "T" + pad2(date.getUTCHours()) + ":" + pad2(date.getUTCMinutes()) + ":" + pad2(date.getUTCSeconds()) + "." + pad3(date.getUTCMilliseconds()) + "Z";
26050
+ }
26051
+ const digits = (s, from, count) => {
26052
+ let n = 0;
26053
+ for (let i = from; i < from + count; i++) {
26054
+ const d = s.charCodeAt(i) - 48;
26055
+ if (d < 0 || d > 9) return -1;
26056
+ n = n * 10 + d;
26057
+ }
26058
+ return n;
26059
+ };
26060
+ function parseISOString(value) {
26061
+ if (typeof value === "string" && value.length === 24 && value.charCodeAt(4) === 45 && value.charCodeAt(7) === 45 && value.charCodeAt(10) === 84 && value.charCodeAt(13) === 58 && value.charCodeAt(16) === 58 && value.charCodeAt(19) === 46 && value.charCodeAt(23) === 90) {
26062
+ const year = digits(value, 0, 4);
26063
+ const month = digits(value, 5, 2);
26064
+ const day = digits(value, 8, 2);
26065
+ const hours = digits(value, 11, 2);
26066
+ const minutes = digits(value, 14, 2);
26067
+ const seconds = digits(value, 17, 2);
26068
+ const ms = digits(value, 20, 3);
26069
+ if (year >= 1e3 && month >= 1 && month <= 12 && day >= 1 && hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59 && seconds >= 0 && seconds <= 59 && ms >= 0) {
26070
+ const date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds, ms));
26071
+ if (date.getUTCDate() === day) return date;
26072
+ }
26073
+ }
26074
+ return new Date(value);
26075
+ }
26076
+
26077
+ //#endregion
26078
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/transformer.js
26035
26079
  function simpleTransformation(isApplicable, annotation, transform, untransform) {
26036
26080
  return {
26037
26081
  isApplicable,
@@ -26047,7 +26091,7 @@ const simpleRules = [
26047
26091
  console.error("Please add a BigInt polyfill.");
26048
26092
  return v;
26049
26093
  }),
26050
- simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
26094
+ simpleTransformation(isDate, "Date", toISOString, parseISOString),
26051
26095
  simpleTransformation(isError$1, "Error", (v, superJson) => {
26052
26096
  const baseError = {
26053
26097
  name: v.name,
@@ -26059,7 +26103,7 @@ const simpleRules = [
26059
26103
  });
26060
26104
  return baseError;
26061
26105
  }, (v, superJson) => {
26062
- const e = new Error(v.message, { cause: v.cause });
26106
+ const e = "cause" in v ? new Error(v.message, { cause: v.cause }) : new Error(v.message);
26063
26107
  e.name = v.name;
26064
26108
  e.stack = v.stack;
26065
26109
  superJson.allowedErrorProps.forEach((prop) => {
@@ -26093,7 +26137,7 @@ function compositeTransformation(isApplicable, annotation, transform, untransfor
26093
26137
  };
26094
26138
  }
26095
26139
  const symbolRule = compositeTransformation((s, superJson) => {
26096
- if (isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
26140
+ if (superJson.symbolRegistry.size > 0 && isSymbol(s)) return !!superJson.symbolRegistry.getIdentifier(s);
26097
26141
  return false;
26098
26142
  }, (s, superJson) => {
26099
26143
  return ["symbol", superJson.symbolRegistry.getIdentifier(s)];
@@ -26116,13 +26160,33 @@ const constructorToName = [
26116
26160
  obj[ctor.name] = ctor;
26117
26161
  return obj;
26118
26162
  }, {});
26119
- const typedArrayRule = compositeTransformation(isTypedArray$1, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
26163
+ const bigIntConstructorToName = {};
26164
+ if (typeof BigInt64Array !== "undefined") bigIntConstructorToName[BigInt64Array.name] = BigInt64Array;
26165
+ if (typeof BigUint64Array !== "undefined") bigIntConstructorToName[BigUint64Array.name] = BigUint64Array;
26166
+ const typedArrayRule = compositeTransformation(isTypedArray$1, (v) => ["typed-array", v.constructor.name], (v) => [...v].map((n) => {
26167
+ if (typeof n === "bigint") return n.toString();
26168
+ if (typeof n === "number") {
26169
+ if (Number.isNaN(n)) return "NaN";
26170
+ if (n === Infinity) return "Infinity";
26171
+ if (n === -Infinity) return "-Infinity";
26172
+ if (n === 0 && 1 / n === -Infinity) return "-0";
26173
+ }
26174
+ return n;
26175
+ }), (v, a) => {
26176
+ const bigIntCtor = bigIntConstructorToName[a[1]];
26177
+ if (bigIntCtor) return new bigIntCtor(v.map((n) => BigInt(n)));
26120
26178
  const ctor = constructorToName[a[1]];
26121
26179
  if (!ctor) throw new Error("Trying to deserialize unknown typed array");
26122
- return new ctor(v);
26180
+ return new ctor(v.map((n) => {
26181
+ if (n === "NaN") return NaN;
26182
+ if (n === "Infinity") return Infinity;
26183
+ if (n === "-Infinity") return -Infinity;
26184
+ if (n === "-0") return -0;
26185
+ return n;
26186
+ }));
26123
26187
  });
26124
26188
  function isInstanceOfRegisteredClass(potentialClass, superJson) {
26125
- if (potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
26189
+ if (superJson.classRegistry.size > 0 && potentialClass?.constructor) return !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
26126
26190
  return false;
26127
26191
  }
26128
26192
  const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
@@ -26151,23 +26215,58 @@ const customRule = compositeTransformation((value, superJson) => {
26151
26215
  if (!transformer) throw new Error("Trying to deserialize unknown custom value");
26152
26216
  return transformer.deserialize(v);
26153
26217
  });
26154
- const compositeRules = [
26155
- classRule,
26156
- symbolRule,
26157
- customRule,
26158
- typedArrayRule
26218
+ const [undefinedRule, bigintRule, dateRule, errorRule, regexpRule, setRule, mapRule, nonFiniteRule, negativeZeroRule, urlRule] = simpleRules;
26219
+ const objectRules = [
26220
+ dateRule,
26221
+ errorRule,
26222
+ regexpRule,
26223
+ setRule,
26224
+ mapRule,
26225
+ urlRule
26159
26226
  ];
26160
- const transformValue = (value, superJson) => {
26161
- const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
26162
- if (applicableCompositeRule) return {
26163
- value: applicableCompositeRule.transform(value, superJson),
26164
- type: applicableCompositeRule.annotation(value, superJson)
26227
+ const applySimple = (rule, value, superJson) => ({
26228
+ value: rule.transform(value, superJson),
26229
+ type: rule.annotation
26230
+ });
26231
+ /** Class, symbol and custom rules only. */
26232
+ const transformRegisteredValue = (value, superJson) => {
26233
+ if (classRule.isApplicable(value, superJson)) return {
26234
+ value: classRule.transform(value, superJson),
26235
+ type: classRule.annotation(value, superJson)
26165
26236
  };
26166
- const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
26167
- if (applicableSimpleRule) return {
26168
- value: applicableSimpleRule.transform(value, superJson),
26169
- type: applicableSimpleRule.annotation
26237
+ if (symbolRule.isApplicable(value, superJson)) return {
26238
+ value: symbolRule.transform(value, superJson),
26239
+ type: symbolRule.annotation(value, superJson)
26170
26240
  };
26241
+ if (superJson.customTransformerRegistry.size > 0) {
26242
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
26243
+ if (transformer) return {
26244
+ value: transformer.serialize(value),
26245
+ type: ["custom", transformer.name]
26246
+ };
26247
+ }
26248
+ };
26249
+ const transformValue = (value, superJson) => {
26250
+ const registered = transformRegisteredValue(value, superJson);
26251
+ if (registered) return registered;
26252
+ switch (typeof value) {
26253
+ case "undefined": return applySimple(undefinedRule, value, superJson);
26254
+ case "bigint": return applySimple(bigintRule, value, superJson);
26255
+ case "number":
26256
+ if (nonFiniteRule.isApplicable(value, superJson)) return applySimple(nonFiniteRule, value, superJson);
26257
+ if (negativeZeroRule.isApplicable(value, superJson)) return applySimple(negativeZeroRule, value, superJson);
26258
+ return;
26259
+ case "object":
26260
+ case "function":
26261
+ if (value === null) return;
26262
+ if (typedArrayRule.isApplicable(value, superJson)) return {
26263
+ value: typedArrayRule.transform(value, superJson),
26264
+ type: typedArrayRule.annotation(value, superJson)
26265
+ };
26266
+ for (let i = 0; i < objectRules.length; i++) if (objectRules[i].isApplicable(value, superJson)) return applySimple(objectRules[i], value, superJson);
26267
+ return;
26268
+ default: return;
26269
+ }
26171
26270
  };
26172
26271
  const simpleRulesByAnnotation = {};
26173
26272
  simpleRules.forEach((rule) => {
@@ -26189,7 +26288,41 @@ const untransformValue = (json, type, superJson) => {
26189
26288
  };
26190
26289
 
26191
26290
  //#endregion
26192
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/accessDeep.js
26291
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/util.js
26292
+ function forEach(record, run) {
26293
+ const keys = Object.keys(record);
26294
+ for (let i = 0; i < keys.length; i++) run(record[keys[i]], keys[i]);
26295
+ }
26296
+ function includes(arr, value) {
26297
+ return arr.indexOf(value) !== -1;
26298
+ }
26299
+ const getType = (payload) => Object.prototype.toString.call(payload).slice(8, -1);
26300
+ function copy(target) {
26301
+ if (typeof target !== "object" || target === null) return target;
26302
+ if (Symbol.toStringTag in target) {
26303
+ const type = getType(target);
26304
+ if (type === "Array") return target.map(copy);
26305
+ return type === "Object" ? copyObject(target) : target;
26306
+ }
26307
+ if (isArray(target)) return target.map(copy);
26308
+ return copyObject(target);
26309
+ }
26310
+ function copyObject(target) {
26311
+ const prototype = Object.getPrototypeOf(target);
26312
+ if (prototype !== Object.prototype || prototype.constructor !== Object) return target;
26313
+ const result = {};
26314
+ const keys = Object.keys(target);
26315
+ for (let i = 0; i < keys.length; i++) {
26316
+ const key = keys[i];
26317
+ if (key !== "__proto__") result[key] = copy(target[key]);
26318
+ }
26319
+ const symbols = Object.getOwnPropertySymbols(target);
26320
+ for (let i = 0; i < symbols.length; i++) if (Object.prototype.propertyIsEnumerable.call(target, symbols[i])) result[symbols[i]] = copy(target[symbols[i]]);
26321
+ return result;
26322
+ }
26323
+
26324
+ //#endregion
26325
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/accessDeep.js
26193
26326
  const getNthKey = (value, n) => {
26194
26327
  if (n > value.size) throw new Error("index out of bounds");
26195
26328
  const keys = value.keys();
@@ -26200,6 +26333,15 @@ const getNthKey = (value, n) => {
26200
26333
  return keys.next().value;
26201
26334
  };
26202
26335
  function validatePath(path) {
26336
+ let suspicious = false;
26337
+ for (let i = 0; i < path.length; i++) {
26338
+ const key = path[i];
26339
+ if (key === "__proto__" || key === "prototype" || key === "constructor") {
26340
+ suspicious = true;
26341
+ break;
26342
+ }
26343
+ }
26344
+ if (!suspicious) return;
26203
26345
  if (includes(path, "__proto__")) throw new Error("__proto__ is not allowed as a property");
26204
26346
  if (includes(path, "prototype")) throw new Error("prototype is not allowed as a property");
26205
26347
  if (includes(path, "constructor")) throw new Error("constructor is not allowed as a property");
@@ -26225,16 +26367,14 @@ const getDeep = (object, path) => {
26225
26367
  }
26226
26368
  return object;
26227
26369
  };
26228
- const setDeep = (object, path, mapper) => {
26229
- validatePath(path);
26230
- if (path.length === 0) return mapper(object);
26231
- let parent = object;
26232
- for (let i = 0; i < path.length - 1; i++) {
26370
+ const walk$1 = (parent, path) => {
26371
+ let i = 0;
26372
+ for (; i < path.length - 1; i++) {
26233
26373
  const key = path[i];
26234
26374
  if (isArray(parent)) {
26235
26375
  const index = +key;
26236
26376
  parent = parent[index];
26237
- } else if (isPlainObject$10(parent)) parent = parent[key];
26377
+ } else if (isPlainObject$9(parent)) parent = parent[key];
26238
26378
  else if (isSet(parent)) {
26239
26379
  const row = +key;
26240
26380
  parent = getNthKey(parent, row);
@@ -26253,25 +26393,41 @@ const setDeep = (object, path, mapper) => {
26253
26393
  }
26254
26394
  }
26255
26395
  }
26396
+ return [parent, i];
26397
+ };
26398
+ const walkDeep = (object, path) => {
26399
+ validatePath(path);
26400
+ const [parent, rest] = walk$1(object, path);
26401
+ return [parent, path.slice(rest)];
26402
+ };
26403
+ const setDeep = (object, path, mapper) => {
26404
+ validatePath(path);
26405
+ if (path.length === 0) return mapper(object);
26406
+ const [parent] = walk$1(object, path);
26256
26407
  const lastKey = path[path.length - 1];
26257
26408
  if (isArray(parent)) parent[+lastKey] = mapper(parent[+lastKey]);
26258
- else if (isPlainObject$10(parent)) parent[lastKey] = mapper(parent[lastKey]);
26409
+ else if (isPlainObject$9(parent)) parent[lastKey] = mapper(parent[lastKey]);
26259
26410
  if (isSet(parent)) {
26260
- const oldValue = getNthKey(parent, +lastKey);
26411
+ const index = +lastKey;
26412
+ const oldValue = getNthKey(parent, index);
26261
26413
  const newValue = mapper(oldValue);
26262
26414
  if (oldValue !== newValue) {
26263
- parent.delete(oldValue);
26264
- parent.add(newValue);
26415
+ const values = [...parent];
26416
+ values[index] = newValue;
26417
+ parent.clear();
26418
+ values.forEach((value) => parent.add(value));
26265
26419
  }
26266
26420
  }
26267
26421
  if (isMap(parent)) {
26268
- const row = +path[path.length - 2];
26269
- const keyToRow = getNthKey(parent, row);
26422
+ const keyToRow = getNthKey(parent, +path[path.length - 2]);
26270
26423
  switch (+lastKey === 0 ? "key" : "value") {
26271
26424
  case "key": {
26272
26425
  const newKey = mapper(keyToRow);
26273
- parent.set(newKey, parent.get(keyToRow));
26274
- if (newKey !== keyToRow) parent.delete(keyToRow);
26426
+ if (newKey !== keyToRow) {
26427
+ const entries = [...parent];
26428
+ parent.clear();
26429
+ entries.forEach(([k, v]) => parent.set(k === keyToRow ? newKey : k, v));
26430
+ }
26275
26431
  break;
26276
26432
  }
26277
26433
  case "value":
@@ -26283,26 +26439,28 @@ const setDeep = (object, path, mapper) => {
26283
26439
  };
26284
26440
 
26285
26441
  //#endregion
26286
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/plainer.js
26442
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/plainer.js
26287
26443
  const enableLegacyPaths = (version) => version < 1;
26288
- function traverse(tree, walker, version, origin = []) {
26289
- if (!tree) return;
26290
- const legacyPaths = enableLegacyPaths(version);
26291
- if (!isArray(tree)) {
26292
- forEach(tree, (subtree, key) => traverse(subtree, walker, version, [...origin, ...parsePath(key, legacyPaths)]));
26293
- return;
26294
- }
26295
- const [nodeValue, children] = tree;
26296
- if (children) forEach(children, (child, key) => {
26297
- traverse(child, walker, version, [...origin, ...parsePath(key, legacyPaths)]);
26298
- });
26299
- walker(nodeValue, origin);
26300
- }
26301
26444
  function applyValueAnnotations(plain, annotations, version, superJson) {
26302
- traverse(annotations, (type, path) => {
26303
- plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
26304
- }, version);
26305
- return plain;
26445
+ const legacyPaths = enableLegacyPaths(version);
26446
+ const apply = (node, path, tree, error) => {
26447
+ if (!tree) return node;
26448
+ const children = isArray(tree) ? tree[1] : tree;
26449
+ if (children) {
26450
+ let parent;
26451
+ let rest = [];
26452
+ if (!error) try {
26453
+ [parent, rest] = walkDeep(node, path);
26454
+ } catch (e) {
26455
+ error = e;
26456
+ }
26457
+ for (const key of Object.keys(children)) apply(parent, [...rest, ...parsePath(key, legacyPaths)], children[key], error);
26458
+ }
26459
+ if (!isArray(tree)) return node;
26460
+ if (error) throw error;
26461
+ return setDeep(node, path, (v) => untransformValue(v, tree[0], superJson));
26462
+ };
26463
+ return apply(plain, [], annotations);
26306
26464
  }
26307
26465
  function applyReferentialEqualityAnnotations(plain, annotations, version) {
26308
26466
  const legacyPaths = enableLegacyPaths(version);
@@ -26321,12 +26479,7 @@ function applyReferentialEqualityAnnotations(plain, annotations, version) {
26321
26479
  } else forEach(annotations, apply);
26322
26480
  return plain;
26323
26481
  }
26324
- const isDeep = (object, superJson) => isPlainObject$10(object) || isArray(object) || isMap(object) || isSet(object) || isError$1(object) || isInstanceOfRegisteredClass(object, superJson);
26325
- function addIdentity(object, path, identities) {
26326
- const existingSet = identities.get(object);
26327
- if (existingSet) existingSet.push(path);
26328
- else identities.set(object, [path]);
26329
- }
26482
+ const isDeep = (object, superJson) => isPlainObject$9(object) || isArray(object) || isMap(object) || isSet(object) || isError$1(object) || isInstanceOfRegisteredClass(object, superJson);
26330
26483
  function generateReferentialEqualityAnnotations(identitites, dedupe) {
26331
26484
  const result = {};
26332
26485
  let rootEqualityPaths = void 0;
@@ -26341,151 +26494,147 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
26341
26494
  else return [rootEqualityPaths, result];
26342
26495
  else return isEmptyObject(result) ? void 0 : result;
26343
26496
  }
26344
- const walker = (object, identities, superJson, dedupe, path = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
26497
+ var PathNode = class {
26498
+ /** `key` is null only for the root. */
26499
+ constructor(parent, key) {
26500
+ this.parent = parent;
26501
+ this.key = key;
26502
+ }
26503
+ };
26504
+ /** The first visit of a non-primitive, which is also the path node of its children. */
26505
+ var Seen = class extends PathNode {
26506
+ constructor() {
26507
+ super(...arguments);
26508
+ this.more = void 0;
26509
+ this.done = false;
26510
+ this.value = void 0;
26511
+ this.annotations = void 0;
26512
+ }
26513
+ };
26514
+ const toPath$3 = (node) => {
26515
+ const path = [];
26516
+ for (; node; node = node.parent) if (node.key !== null) path.push(node.key);
26517
+ return path.reverse();
26518
+ };
26519
+ const pathsOf = (seen) => {
26520
+ const paths = [toPath$3(seen)];
26521
+ seen.more?.forEach((node) => paths.push(toPath$3(node)));
26522
+ return paths;
26523
+ };
26524
+ /**
26525
+ * The annotation record of a plain container, built lazily so each flattened key is joined once.
26526
+ * Keys are kept as an object would order them: array indices ascending, then insertion order.
26527
+ */
26528
+ var PendingAnnotations = class {
26529
+ constructor() {
26530
+ /** Pairs: escaped array-index key, tree. */
26531
+ this.indices = [];
26532
+ /** Pairs: escaped key and tree, or `key.` prefix and a nested PendingAnnotations. */
26533
+ this.rest = [];
26534
+ }
26535
+ };
26536
+ const isArrayIndex = (key) => {
26537
+ const length = key.length;
26538
+ if (length === 0 || length > 10) return false;
26539
+ for (let i = 0; i < length; i++) {
26540
+ const code = key.charCodeAt(i);
26541
+ if (code < 48 || code > 57) return false;
26542
+ }
26543
+ if (key.charCodeAt(0) === 48) return length === 1;
26544
+ return length < 10 || +key < 4294967295;
26545
+ };
26546
+ function materialize(pending, prefix, out) {
26547
+ const { indices, rest } = pending;
26548
+ for (let i = 0; i < indices.length; i += 2) out[prefix + indices[i]] = indices[i + 1];
26549
+ for (let i = 0; i < rest.length; i += 2) {
26550
+ const value = rest[i + 1];
26551
+ if (value instanceof PendingAnnotations) materialize(value, prefix + rest[i], out);
26552
+ else out[prefix + rest[i]] = value;
26553
+ }
26554
+ return out;
26555
+ }
26556
+ const toRecord = (annotations) => annotations instanceof PendingAnnotations ? materialize(annotations, "", {}) : annotations;
26557
+ const isPlainContainer = (object) => isPlainObject$9(object) || isArray(object) && Object.getPrototypeOf(object) === Array.prototype;
26558
+ function walk(object, ctx, parent, key) {
26345
26559
  const primitive = isPrimitive(object);
26560
+ let seen;
26346
26561
  if (!primitive) {
26347
- addIdentity(object, path, identities);
26348
- const seen = seenObjects.get(object);
26349
- if (seen) return dedupe ? { transformedValue: null } : seen;
26350
- }
26351
- if (!isDeep(object, superJson)) {
26352
- const transformed = transformValue(object, superJson);
26353
- const result = transformed ? {
26354
- transformedValue: transformed.value,
26355
- annotations: [transformed.type]
26356
- } : { transformedValue: object };
26357
- if (!primitive) seenObjects.set(object, result);
26358
- return result;
26562
+ seen = ctx.seen.get(object);
26563
+ if (seen) {
26564
+ (seen.more ?? (seen.more = [])).push(new PathNode(parent, key));
26565
+ if (seen.done) {
26566
+ if (ctx.dedupe) {
26567
+ ctx.annotations = void 0;
26568
+ return null;
26569
+ }
26570
+ ctx.annotations = seen.annotations;
26571
+ return seen.value;
26572
+ }
26573
+ ctx.annotations = void 0;
26574
+ return isDeep(object, ctx.superJson) ? null : leaf(object, ctx, seen);
26575
+ }
26576
+ seen = new Seen(parent, key);
26577
+ ctx.seen.set(object, seen);
26578
+ parent = seen;
26359
26579
  }
26360
- if (includes(objectsInThisPath, object)) return { transformedValue: null };
26361
- const transformationResult = transformValue(object, superJson);
26580
+ const plainContainer = !primitive && isPlainContainer(object);
26581
+ if (!plainContainer && !isDeep(object, ctx.superJson)) return leaf(object, ctx, seen);
26582
+ if (primitive && key !== null) parent = new PathNode(parent, key);
26583
+ const transformationResult = plainContainer ? transformRegisteredValue(object, ctx.superJson) : transformValue(object, ctx.superJson);
26362
26584
  const transformed = transformationResult?.value ?? object;
26363
26585
  const transformedValue = isArray(transformed) ? [] : {};
26364
- const innerAnnotations = {};
26365
- forEach(transformed, (value, index) => {
26586
+ let inner;
26587
+ const keys = Object.keys(transformed);
26588
+ for (let i = 0; i < keys.length; i++) {
26589
+ const index = keys[i];
26366
26590
  if (index === "__proto__" || index === "constructor" || index === "prototype") throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
26367
- const recursiveResult = walker(value, identities, superJson, dedupe, [...path, index], [...objectsInThisPath, object], seenObjects);
26368
- transformedValue[index] = recursiveResult.transformedValue;
26369
- if (isArray(recursiveResult.annotations)) innerAnnotations[escapeKey(index)] = recursiveResult.annotations;
26370
- else if (isPlainObject$10(recursiveResult.annotations)) forEach(recursiveResult.annotations, (tree, key) => {
26371
- innerAnnotations[escapeKey(index) + "." + key] = tree;
26372
- });
26373
- });
26374
- const result = isEmptyObject(innerAnnotations) ? {
26375
- transformedValue,
26376
- annotations: !!transformationResult ? [transformationResult.type] : void 0
26377
- } : {
26378
- transformedValue,
26379
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
26380
- };
26381
- if (!primitive) seenObjects.set(object, result);
26382
- return result;
26383
- };
26384
-
26385
- //#endregion
26386
- //#region node_modules/.pnpm/copy-anything@4.1.5/node_modules/copy-anything/dist/index.js
26387
- /**
26388
- * Assigns a prop the copy is keeping, preserving whether it was enumerable. Callers decide
26389
- * _whether_ to keep a non-enumerable prop before getting here, so by this point the answer is
26390
- * always yes.
26391
- */
26392
- function assignProp(carry, key, newVal, originalObject) {
26393
- if (Object.prototype.propertyIsEnumerable.call(originalObject, key)) {
26394
- carry[key] = newVal;
26395
- return;
26591
+ transformedValue[index] = walk(transformed[index], ctx, parent, index);
26592
+ const childAnnotations = ctx.annotations;
26593
+ if (childAnnotations !== void 0) {
26594
+ inner ?? (inner = new PendingAnnotations());
26595
+ const escaped = escapeKey(index);
26596
+ if (childAnnotations instanceof PendingAnnotations) inner.rest.push(escaped + ".", childAnnotations);
26597
+ else if (isArrayIndex(escaped)) inner.indices.push(escaped, childAnnotations);
26598
+ else inner.rest.push(escaped, childAnnotations);
26599
+ }
26396
26600
  }
26397
- Object.defineProperty(carry, key, {
26398
- value: newVal,
26399
- enumerable: false,
26400
- writable: true,
26401
- configurable: true
26402
- });
26601
+ const annotations = inner ? transformationResult ? [transformationResult.type, materialize(inner, "", {})] : inner : transformationResult ? [transformationResult.type] : void 0;
26602
+ return finish(ctx, seen, transformedValue, annotations);
26403
26603
  }
26404
- /**
26405
- * Whether `value` is an object literal, as opposed to a class instance, a built-in like `Date`, an
26406
- * `arguments` object, or an object with a null prototype.
26407
- *
26408
- * The prototype check comes first because it is cheap and rejects almost everything; the tag check
26409
- * is only reached by values that are about to be cloned anyway.
26410
- */
26411
- function isPlainObject$9(value) {
26412
- return Object.getPrototypeOf(value) === Object.prototype && Object.prototype.toString.call(value) === "[object Object]";
26604
+ function leaf(object, ctx, seen) {
26605
+ const transformed = transformValue(object, ctx.superJson);
26606
+ return transformed ? finish(ctx, seen, transformed.value, [transformed.type]) : finish(ctx, seen, object, void 0);
26413
26607
  }
26414
- /**
26415
- * Returns the clone that `value` should be replaced with, and queues it to be filled in later.
26416
- * Anything that isn't an array or a plain object is returned untouched.
26417
- *
26418
- * Reusing the clone already registered in `clones` is what makes circular and shared references
26419
- * work: the placeholder is registered before its contents exist, so a reference back to an ancestor
26420
- * resolves to it rather than walking forever.
26421
- */
26422
- function cloneRef(value, clones, sources, dests) {
26423
- if (typeof value !== "object" || value === null) return value;
26424
- const array = Array.isArray(value);
26425
- if (!array && !isPlainObject$9(value)) return value;
26426
- const existing = clones.get(value);
26427
- if (existing !== void 0) return existing;
26428
- const clone = array ? new Array(value.length) : {};
26429
- clones.set(value, clone);
26430
- sources.push(value);
26431
- dests.push(clone);
26432
- return clone;
26433
- }
26434
- /**
26435
- * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the
26436
- * original object. Arrays and the objects inside them are cloned as well.
26437
- *
26438
- * Nesting depth is limited only by available memory, and circular references are reproduced in the
26439
- * copy rather than followed forever. Two props pointing at the same object still point at one
26440
- * shared copy afterwards.
26441
- *
26442
- * @param target Target can be anything
26443
- * @param [options={}] See type {@link Options} for more details.
26444
- *
26445
- * - `{ props: ['key1'] }` will only copy the `key1` property. When using this you will need to cast
26446
- * the return type manually (in order to keep the TS implementation in here simple I didn't
26447
- * built a complex auto resolved type for those few cases people want to use this option)
26448
- * - `{ nonenumerable: true }` will copy all non-enumerable properties. Default is `{}`
26449
- *
26450
- * @returns The target with replaced values
26451
- */
26452
- function copy(target, options = {}) {
26453
- if (typeof target !== "object" || target === null) return target;
26454
- const clones = /* @__PURE__ */ new Map();
26455
- const sources = [];
26456
- const dests = [];
26457
- const result = cloneRef(target, clones, sources, dests);
26458
- const onlyProps = Array.isArray(options.props) ? options.props : void 0;
26459
- const nonenumerable = options.nonenumerable === true;
26460
- while (sources.length) {
26461
- const source = sources.pop();
26462
- const dest = dests.pop();
26463
- if (Array.isArray(source)) {
26464
- for (let i = 0; i < source.length; i++) if (i in source) dest[i] = cloneRef(source[i], clones, sources, dests);
26465
- continue;
26466
- }
26467
- if (nonenumerable) for (const key of Object.getOwnPropertyNames(source)) {
26468
- if (key === "__proto__") continue;
26469
- if (onlyProps && !onlyProps.includes(key)) continue;
26470
- assignProp(dest, key, cloneRef(source[key], clones, sources, dests), source);
26471
- }
26472
- else for (const key in source) {
26473
- if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
26474
- if (key === "__proto__") continue;
26475
- if (onlyProps && !onlyProps.includes(key)) continue;
26476
- dest[key] = cloneRef(source[key], clones, sources, dests);
26477
- }
26478
- for (const key of Object.getOwnPropertySymbols(source)) {
26479
- if (onlyProps && !onlyProps.includes(key)) continue;
26480
- if (!nonenumerable && !Object.prototype.propertyIsEnumerable.call(source, key)) continue;
26481
- assignProp(dest, key, cloneRef(source[key], clones, sources, dests), source);
26482
- }
26608
+ function finish(ctx, seen, value, annotations) {
26609
+ if (seen) {
26610
+ seen.done = true;
26611
+ seen.value = value;
26612
+ seen.annotations = annotations;
26483
26613
  }
26484
- return result;
26614
+ ctx.annotations = annotations;
26615
+ return value;
26616
+ }
26617
+ function walkRoot(object, superJson, dedupe) {
26618
+ const ctx = {
26619
+ superJson,
26620
+ dedupe,
26621
+ seen: /* @__PURE__ */ new Map(),
26622
+ annotations: void 0
26623
+ };
26624
+ const transformedValue = walk(object, ctx, null, null);
26625
+ const identities = /* @__PURE__ */ new Map();
26626
+ ctx.seen.forEach((seen, value) => {
26627
+ if (seen.more) identities.set(value, pathsOf(seen));
26628
+ });
26629
+ return {
26630
+ transformedValue,
26631
+ annotations: toRecord(ctx.annotations),
26632
+ identities
26633
+ };
26485
26634
  }
26486
26635
 
26487
26636
  //#endregion
26488
- //#region node_modules/.pnpm/superjson@2.2.6/node_modules/superjson/dist/index.js
26637
+ //#region node_modules/.pnpm/superjson@2.2.7/node_modules/superjson/dist/index.js
26489
26638
  var SuperJSON = class {
26490
26639
  /**
26491
26640
  * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
@@ -26498,14 +26647,13 @@ var SuperJSON = class {
26498
26647
  this.dedupe = dedupe;
26499
26648
  }
26500
26649
  serialize(object) {
26501
- const identities = /* @__PURE__ */ new Map();
26502
- const output = walker(object, identities, this, this.dedupe);
26650
+ const output = walkRoot(object, this, this.dedupe);
26503
26651
  const res = { json: output.transformedValue };
26504
26652
  if (output.annotations) res.meta = {
26505
26653
  ...res.meta,
26506
26654
  values: output.annotations
26507
26655
  };
26508
- const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
26656
+ const equalityAnnotations = generateReferentialEqualityAnnotations(output.identities, this.dedupe);
26509
26657
  if (equalityAnnotations) res.meta = {
26510
26658
  ...res.meta,
26511
26659
  referentialEqualities: equalityAnnotations
@@ -26789,7 +26937,7 @@ const cliVersion = pkg.version;
26789
26937
  const cliNodeEngine = pkg.engines?.node;
26790
26938
 
26791
26939
  //#endregion
26792
- //#region ../../node_modules/.pnpm/@trpc+server@11.29.5_@types+aws-lambda@8.10.164_@types+express@5.0.6_@types+ws@8.18.2_n_d0ee0c058429d0f6dbf2db4bfd1f1e09/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
26940
+ //#region ../../node_modules/.pnpm/@trpc+server@11.29.7_@types+aws-lambda@8.10.164_@types+express@5.0.6_@types+ws@8.18.2_n_4a5bbc7e05a0f03e83d6e27192082686/node_modules/@trpc/server/dist/observable-CodTG6Sf.mjs
26793
26941
  /**
26794
26942
  * Creates an observable. `subscribe` runs for each subscriber, and can
26795
26943
  * return a function that cleans up when it unsubscribes.
@@ -49323,14 +49471,14 @@ const TRANSIENT_NETWORK_ERROR_CODES = new Set([
49323
49471
  "UND_ERR_SOCKET"
49324
49472
  ]);
49325
49473
  function getErrorCause(error) {
49326
- return errorCauseFrom(error) ?? toRecord(error)?.cause;
49474
+ return errorCauseFrom(error) ?? toRecord$1(error)?.cause;
49327
49475
  }
49328
49476
  function getErrorCode(error) {
49329
- const code = toRecord(error)?.code;
49477
+ const code = toRecord$1(error)?.code;
49330
49478
  return typeof code === "string" ? code : void 0;
49331
49479
  }
49332
49480
  function getErrorMessage(error) {
49333
- const message = errorMessageFrom(error) ?? toRecord(error)?.message;
49481
+ const message = errorMessageFrom(error) ?? toRecord$1(error)?.message;
49334
49482
  return typeof message === "string" ? message : void 0;
49335
49483
  }
49336
49484
  function getErrorChain(error) {
@@ -49369,7 +49517,7 @@ function isTransientNetworkError(error) {
49369
49517
  * NOT_FOUND; callers use this to fall back to an older endpoint.
49370
49518
  */
49371
49519
  function isMissingProcedure$2(error) {
49372
- return toRecord(toRecord(error)?.data)?.code === "NOT_FOUND" && /procedure/i.test(getErrorMessage(error) ?? "");
49520
+ return toRecord$1(toRecord$1(error)?.data)?.code === "NOT_FOUND" && /procedure/i.test(getErrorMessage(error) ?? "");
49373
49521
  }
49374
49522
 
49375
49523
  //#endregion
@@ -57914,7 +58062,7 @@ const publishCanvasArtifact = async (client, params) => {
57914
58062
  title
57915
58063
  });
57916
58064
  } catch (error) {
57917
- const code = toRecord(toRecord(error)?.data)?.code;
58065
+ const code = toRecord$1(toRecord$1(error)?.data)?.code;
57918
58066
  if (code === "BAD_REQUEST" || code === "CONFLICT" || code === "FORBIDDEN" || code === "NOT_FOUND") {
57919
58067
  const previous = pending.previous;
57920
58068
  writeBinding(manifest, previous.canvasId || previous.deploymentId ? previous : {
@@ -57937,7 +58085,7 @@ const publishCanvasArtifact = async (client, params) => {
57937
58085
  requestedSlug: params.slug,
57938
58086
  version: saved.version
57939
58087
  }).catch((error) => {
57940
- if (toRecord(toRecord(error)?.data)?.code === "BAD_REQUEST") writeBinding(manifest, {
58088
+ if (toRecord$1(toRecord$1(error)?.data)?.code === "BAD_REQUEST") writeBinding(manifest, {
57941
58089
  ...activeBinding,
57942
58090
  pendingCanvas: {
57943
58091
  ...pending,
@@ -58034,7 +58182,7 @@ const fingerprintCreate = (entries, requestedSlug, title) => {
58034
58182
  * Rejections such as quota, size or an expired upload carry other codes.
58035
58183
  */
58036
58184
  const isUnknownCommitOutcome = (error) => {
58037
- const code = toRecord(toRecord(error)?.data)?.code;
58185
+ const code = toRecord$1(toRecord$1(error)?.data)?.code;
58038
58186
  return code === void 0 || code === "INTERNAL_SERVER_ERROR";
58039
58187
  };
58040
58188
  /** Market's answer when a reused key carries a different request. */
@@ -58973,7 +59121,7 @@ function registerBotMessengersCommands(bot) {
58973
59121
  }
58974
59122
  if (installations.length === 0) {
58975
59123
  console.log("No System Bot installations connected.");
58976
- console.log(`\nRun ${import_picocolors.default.dim("lh bot messengers platforms")} to see what's available, then install via ${import_picocolors.default.dim("Settings → Messenger")} (OAuth requires a browser).`);
59124
+ console.log(`\nRun ${import_picocolors.default.dim("lh bot messengers platforms")} to see what's available, then install via ${import_picocolors.default.dim("Marketplace → Apps")} (OAuth requires a browser).`);
58977
59125
  return;
58978
59126
  }
58979
59127
  printTable(installations.map((i) => [
@@ -59047,7 +59195,7 @@ function registerBotMessengersCommands(bot) {
59047
59195
  "APP ID",
59048
59196
  "BOT USERNAME"
59049
59197
  ]);
59050
- console.log(`\nInstalls are initiated via ${import_picocolors.default.dim("Settings → Messenger")} in the web UI (OAuth needs a browser).`);
59198
+ console.log(`\nInstalls are initiated via ${import_picocolors.default.dim("Marketplace → Apps")} in the web UI (OAuth needs a browser).`);
59051
59199
  });
59052
59200
  const links = messengers.command("links").description("Manage per-user account links — routing of inbound IM to your agents");
59053
59201
  links.command("list").description("List all your account links across platforms and tenants.").option("--json", "Output JSON").action(async (options) => {
@@ -60193,10 +60341,288 @@ var init_config = __esmMin((() => {
60193
60341
  QODER_CLI_INSTALL_DOCS_URL = qoderDescriptor.install.docsUrl;
60194
60342
  }));
60195
60343
 
60344
+ //#endregion
60345
+ //#region ../../packages/heterogeneous-agents/src/spawn/antigravity.ts
60346
+ /** agy reads a single JSONL user message, then finishes the turn when stdin closes. */
60347
+ const ANTIGRAVITY_BASE_ARGS = [
60348
+ "--input-format",
60349
+ "stream-json",
60350
+ "--output-format",
60351
+ "stream-json",
60352
+ "--dangerously-skip-permissions"
60353
+ ];
60354
+ /** A Connect service can inherit an old SSH session that makes agy skip the desktop keyring. */
60355
+ const getAntigravitySpawnEnv = (env) => {
60356
+ if (env.LOBEHUB_CONNECT_SERVICE !== "1") return env;
60357
+ const childEnv = { ...env };
60358
+ delete childEnv.SSH_CLIENT;
60359
+ delete childEnv.SSH_CONNECTION;
60360
+ delete childEnv.SSH_TTY;
60361
+ return childEnv;
60362
+ };
60363
+ const FULL_ACCESS_SETTINGS = JSON.stringify({
60364
+ agentMode: "",
60365
+ allowNonWorkspaceAccess: true,
60366
+ enableTerminalSandbox: false
60367
+ });
60368
+ const MANAGED_FLAGS = new Set([
60369
+ "--",
60370
+ "--input-format",
60371
+ "--output-format",
60372
+ "--print",
60373
+ "--prompt",
60374
+ "--prompt-interactive",
60375
+ "--remote-control",
60376
+ "-i",
60377
+ "-p",
60378
+ "--continue",
60379
+ "-c",
60380
+ "--conversation"
60381
+ ]);
60382
+ const buildAntigravityArgs = ({ extraArgs = [], resumeSessionId }) => {
60383
+ const conflicting = extraArgs.find((arg) => MANAGED_FLAGS.has(arg.split("=")[0]));
60384
+ if (conflicting) throw new Error(`LobeHub manages Antigravity's prompt, output and session flags: ${conflicting}`);
60385
+ const hasCustomPermissionSettings = extraArgs.some((arg) => [
60386
+ "--mode",
60387
+ "--sandbox",
60388
+ "--settings"
60389
+ ].includes(arg.split("=")[0]));
60390
+ return [
60391
+ ...ANTIGRAVITY_BASE_ARGS,
60392
+ ...hasCustomPermissionSettings ? [] : ["--settings", FULL_ACCESS_SETTINGS],
60393
+ ...resumeSessionId ? ["--conversation", resumeSessionId] : [],
60394
+ ...extraArgs
60395
+ ];
60396
+ };
60397
+
60398
+ //#endregion
60399
+ //#region ../../packages/heterogeneous-agents/src/spawn/wsl.ts
60400
+ var WSL_COMMAND_PREFIX, isWslCommand, parseWslCommand, formatWslCommand, getWslExecutable, toWslPath, toWslArg, NEVER_FORWARDED, FORWARDED_PREFIXES, FORWARDED_PROXY, ENV_NAME, collectForwardedEnvNames, mergeWslEnv, buildWslSpawnPlan, WSL_PROBE_TIMEOUT_MS, WSL_LIST_TIMEOUT_MS, PATH_MARKER, COMMAND_MARKER, WSL_PROBED_COMMANDS, PROBE_SCRIPT, runWsl, decodeWslOutput, parseWslDistroList, parseWslProbeOutput, distrosPromise, distroProbes, settledPathEnv, listWslDistros, probeWslDistro, invalidateWslCache, findWslCommandCandidates, getWslPathEnv;
60401
+ var init_wsl = __esmMin((() => {
60402
+ init_config();
60403
+ WSL_COMMAND_PREFIX = "wsl://";
60404
+ isWslCommand = (command) => command.trim().toLowerCase().startsWith(WSL_COMMAND_PREFIX);
60405
+ parseWslCommand = (command) => {
60406
+ const trimmed = command.trim();
60407
+ if (!isWslCommand(trimmed)) return;
60408
+ const rest = trimmed.slice(6);
60409
+ const slash = rest.indexOf("/");
60410
+ if (slash <= 0) return;
60411
+ const linuxPath = rest.slice(slash);
60412
+ if (linuxPath.length < 2) return;
60413
+ return {
60414
+ distro: rest.slice(0, slash),
60415
+ linuxPath
60416
+ };
60417
+ };
60418
+ formatWslCommand = ({ distro, linuxPath }) => `${WSL_COMMAND_PREFIX}${distro}${linuxPath}`;
60419
+ getWslExecutable = (env = process.env) => `${(env.SystemRoot || env.SYSTEMROOT || "C:\\Windows").replace(/[\\/]+$/, "")}\\System32\\wsl.exe`;
60420
+ toWslPath = (value) => {
60421
+ const drive = value.match(/^([A-Za-z]):[\\/](.*)$/s);
60422
+ if (drive) {
60423
+ const rest = drive[2].replaceAll("\\", "/");
60424
+ return `/mnt/${drive[1].toLowerCase()}${rest ? `/${rest}` : ""}`;
60425
+ }
60426
+ const unc = value.match(/^\\\\wsl(?:\$|\.localhost)\\[^\\]+(\\.*)?$/i);
60427
+ if (unc) return (unc[1] ?? "\\").replaceAll("\\", "/");
60428
+ return value;
60429
+ };
60430
+ toWslArg = (arg) => {
60431
+ const translated = toWslPath(arg);
60432
+ if (translated !== arg) return translated;
60433
+ const flag = arg.match(/^(--?[\w-]+=)(.+)$/s);
60434
+ if (!flag) return arg;
60435
+ const value = toWslPath(flag[2]);
60436
+ return value === flag[2] ? arg : `${flag[1]}${value}`;
60437
+ };
60438
+ NEVER_FORWARDED = new Set([
60439
+ "appdata",
60440
+ "comspec",
60441
+ "home",
60442
+ "homedrive",
60443
+ "homepath",
60444
+ "localappdata",
60445
+ "path",
60446
+ "pathext",
60447
+ "programdata",
60448
+ "programfiles",
60449
+ "programfiles(x86)",
60450
+ "pwd",
60451
+ "shell",
60452
+ "systemroot",
60453
+ "temp",
60454
+ "tmp",
60455
+ "userprofile",
60456
+ "windir",
60457
+ "wslenv"
60458
+ ]);
60459
+ FORWARDED_PREFIXES = [
60460
+ "ANTHROPIC_",
60461
+ "CLAUDE_",
60462
+ "CODEX_",
60463
+ "CURSOR_",
60464
+ "DEEPSEEK_",
60465
+ "DSH_",
60466
+ "LOBEHUB_",
60467
+ "OPENAI_"
60468
+ ];
60469
+ FORWARDED_PROXY = /^(?:all|http|https|no)_proxy$/i;
60470
+ ENV_NAME = /^[A-Za-z_]\w*$/;
60471
+ collectForwardedEnvNames = (env) => Object.keys(env).filter((name) => {
60472
+ if (!ENV_NAME.test(name) || NEVER_FORWARDED.has(name.toLowerCase())) return false;
60473
+ if (env[name] === void 0) return false;
60474
+ return env[name] !== process.env[name] || FORWARDED_PREFIXES.some((prefix) => name.toUpperCase().startsWith(prefix)) || FORWARDED_PROXY.test(name);
60475
+ });
60476
+ mergeWslEnv = (current, names) => {
60477
+ const entries = (current ?? "").split(":").filter(Boolean);
60478
+ const present = new Set(entries.map((entry) => entry.split("/")[0].toLowerCase()));
60479
+ for (const name of names) if (!present.has(name.toLowerCase())) entries.push(`${name}/u`);
60480
+ return entries.join(":");
60481
+ };
60482
+ buildWslSpawnPlan = ({ distro, linuxPath }, args, env, pathEnv) => {
60483
+ const forwarded = env ? collectForwardedEnvNames(env) : [];
60484
+ return {
60485
+ args: [
60486
+ "--distribution",
60487
+ distro,
60488
+ "--exec",
60489
+ ...pathEnv ? ["env", `PATH=${pathEnv}`] : [],
60490
+ linuxPath,
60491
+ ...args.map(toWslArg)
60492
+ ],
60493
+ command: getWslExecutable(env),
60494
+ env: env && forwarded.length > 0 ? {
60495
+ ...env,
60496
+ WSLENV: mergeWslEnv(env.WSLENV, forwarded)
60497
+ } : env
60498
+ };
60499
+ };
60500
+ WSL_PROBE_TIMEOUT_MS = 2e4;
60501
+ WSL_LIST_TIMEOUT_MS = 5e3;
60502
+ PATH_MARKER = "__LOBEHUB_WSL_PATH__=";
60503
+ COMMAND_MARKER = "__LOBEHUB_WSL_CMD__=";
60504
+ WSL_PROBED_COMMANDS = [...new Set([
60505
+ ...HETEROGENEOUS_AGENT_CONFIGS.map((config) => config.defaultCommand),
60506
+ "cursor-agent",
60507
+ "dsh"
60508
+ ])].filter((name) => /^[\w.-]+$/.test(name));
60509
+ PROBE_SCRIPT = `lobehub_shell="\${SHELL:-/bin/sh}"
60510
+ case "\${lobehub_shell##*/}" in bash|zsh|ksh|sh|dash) ;; *) lobehub_shell=/bin/sh ;; esac
60511
+ "$lobehub_shell" -ilc 'printf "\\n${PATH_MARKER}%s\\n" "$PATH"; for c in "$@"; do p=$(command -v "$c" 2>/dev/null) || continue; case "$p" in /*) printf "${COMMAND_MARKER}%s=%s\\n" "$c" "$p" ;; esac; done' lobehub "$@" </dev/null
60512
+ `;
60513
+ runWsl = (args, { env, input, timeout }) => new Promise((resolve, reject) => {
60514
+ let settled = false;
60515
+ const finish = (error, output) => {
60516
+ if (settled) return;
60517
+ settled = true;
60518
+ clearTimeout(timer);
60519
+ if (error) reject(error);
60520
+ else resolve(output);
60521
+ };
60522
+ const child = spawn(getWslExecutable(env), args, {
60523
+ env: {
60524
+ ...env ?? process.env,
60525
+ WSL_UTF8: "1"
60526
+ },
60527
+ stdio: [
60528
+ "pipe",
60529
+ "pipe",
60530
+ "ignore"
60531
+ ],
60532
+ windowsHide: true
60533
+ });
60534
+ const chunks = [];
60535
+ const timer = setTimeout(() => {
60536
+ child.kill();
60537
+ finish(/* @__PURE__ */ new Error("Timed out waiting for WSL"));
60538
+ }, timeout);
60539
+ child.stdout?.on("data", (chunk) => chunks.push(chunk));
60540
+ child.on("error", (error) => finish(error));
60541
+ child.on("close", (code) => {
60542
+ if (code === 0) finish(void 0, Buffer.concat(chunks));
60543
+ else finish(/* @__PURE__ */ new Error(`wsl.exe exited with code ${code}`));
60544
+ });
60545
+ child.stdin?.on("error", () => {});
60546
+ child.stdin?.end(input ?? "");
60547
+ });
60548
+ decodeWslOutput = (output) => (output.includes(0) ? output.toString("utf16le") : output.toString("utf8")).replace(/^\uFEFF/, "");
60549
+ parseWslDistroList = (output) => output.split(/\r?\n/).map((line) => line.replaceAll("\0", "").trim()).filter((name) => name && !/^docker-desktop/i.test(name));
60550
+ parseWslProbeOutput = (output) => {
60551
+ const commands = /* @__PURE__ */ new Map();
60552
+ let pathEnv;
60553
+ for (const rawLine of output.split(/\r?\n/)) {
60554
+ const line = rawLine.trim();
60555
+ if (line.startsWith(PATH_MARKER)) pathEnv = line.slice(21) || void 0;
60556
+ else if (line.startsWith(COMMAND_MARKER)) {
60557
+ const entry = line.slice(20);
60558
+ const separator = entry.indexOf("=");
60559
+ const name = entry.slice(0, separator);
60560
+ const linuxPath = entry.slice(separator + 1);
60561
+ if (separator > 0 && linuxPath.startsWith("/")) commands.set(name, linuxPath);
60562
+ }
60563
+ }
60564
+ return {
60565
+ commands,
60566
+ pathEnv
60567
+ };
60568
+ };
60569
+ ;
60570
+ distroProbes = /* @__PURE__ */ new Map();
60571
+ settledPathEnv = /* @__PURE__ */ new Map();
60572
+ listWslDistros = () => {
60573
+ distrosPromise ??= runWsl(["--list", "--quiet"], { timeout: WSL_LIST_TIMEOUT_MS }).then((output) => parseWslDistroList(decodeWslOutput(output))).catch(() => []);
60574
+ return distrosPromise;
60575
+ };
60576
+ probeWslDistro = (distro) => {
60577
+ let probe = distroProbes.get(distro);
60578
+ if (!probe) {
60579
+ probe = runWsl([
60580
+ "--distribution",
60581
+ distro,
60582
+ "--exec",
60583
+ "sh",
60584
+ "-s",
60585
+ "--",
60586
+ ...WSL_PROBED_COMMANDS
60587
+ ], {
60588
+ input: PROBE_SCRIPT,
60589
+ timeout: WSL_PROBE_TIMEOUT_MS
60590
+ }).then((output) => {
60591
+ const result = parseWslProbeOutput(decodeWslOutput(output));
60592
+ settledPathEnv.set(distro, result.pathEnv);
60593
+ return result;
60594
+ }).catch(() => {
60595
+ distroProbes.delete(distro);
60596
+ });
60597
+ distroProbes.set(distro, probe);
60598
+ }
60599
+ return probe;
60600
+ };
60601
+ invalidateWslCache = () => {
60602
+ distrosPromise = void 0;
60603
+ distroProbes.clear();
60604
+ settledPathEnv.clear();
60605
+ };
60606
+ findWslCommandCandidates = async (command) => {
60607
+ if (platform() !== "win32") return [];
60608
+ const distros = await listWslDistros();
60609
+ const probes = await Promise.all(distros.map((distro) => probeWslDistro(distro)));
60610
+ return distros.flatMap((distro, index) => {
60611
+ const linuxPath = probes[index]?.commands.get(command);
60612
+ return linuxPath ? [formatWslCommand({
60613
+ distro,
60614
+ linuxPath
60615
+ })] : [];
60616
+ });
60617
+ };
60618
+ getWslPathEnv = async (distro) => (await probeWslDistro(distro))?.pathEnv;
60619
+ }));
60620
+
60196
60621
  //#endregion
60197
60622
  //#region ../../packages/heterogeneous-agents/src/spawn/cliSpawn.ts
60198
- var WINDOWS_EXE_EXT_PATTERN, WINDOWS_MAX_COMMAND_LINE_LENGTH, WINDOWS_NODE_EXE_PATTERN, isWindows$1, quoteWindowsCommandLineArgument, assertWindowsCommandLineFits, isPathLikeCommand$1, fileExists$1, execFileString, pickWindowsNodeExecutable, joinShimRelativePath, resolveShimPathToken, getExistingShimPathToken, resolveWindowsNodeCommand, getNodeCommand, getNodeScriptTarget, inferWindowsNodeScriptFromShim, inferWindowsExecutableFromShim, inferWindowsNpmShimTarget, resolveWindowsBareCommand, resolveCliSpawnPlan;
60623
+ var WINDOWS_EXE_EXT_PATTERN, WINDOWS_MAX_COMMAND_LINE_LENGTH, WINDOWS_NODE_EXE_PATTERN, isWindows$1, quoteWindowsCommandLineArgument, assertWindowsCommandLineFits, isPathLikeCommand$1, fileExists$1, execFileString, pickWindowsNodeExecutable, joinShimRelativePath, resolveShimPathToken, getExistingShimPathToken, resolveWindowsNodeCommand, getNodeCommand, getNodeScriptTarget, inferWindowsNodeScriptFromShim, inferWindowsExecutableFromShim, inferWindowsPowerShellShimTarget, inferWindowsNpmShimTarget, resolveWindowsBareCommand, resolveCliSpawnPlan;
60199
60624
  var init_cliSpawn = __esmMin((() => {
60625
+ init_wsl();
60200
60626
  WINDOWS_EXE_EXT_PATTERN = /\.exe$/i;
60201
60627
  WINDOWS_MAX_COMMAND_LINE_LENGTH = 32767;
60202
60628
  WINDOWS_NODE_EXE_PATTERN = /(?:^|[\\/])node(?:\.exe)?$/i;
@@ -60312,12 +60738,33 @@ var init_cliSpawn = __esmMin((() => {
60312
60738
  if (await fileExists$1(command)) return { command };
60313
60739
  }
60314
60740
  };
60741
+ inferWindowsPowerShellShimTarget = async (shimPath, source, env) => {
60742
+ const match = source.match(/\b(powershell|pwsh)(?:\.exe)?\b[^\r\n]*?-File\s+"?(%(?:~dp0|dp0%))?\\?([^"\r\n]+?\.ps1)"?/i);
60743
+ if (!match) return;
60744
+ const [, host, relativeToShim, scriptToken] = match;
60745
+ const script = relativeToShim ? joinShimRelativePath(shimPath, scriptToken) : scriptToken.replaceAll("/", "\\");
60746
+ if (!path.win32.isAbsolute(script) || !await fileExists$1(script)) return;
60747
+ const systemRoot = env?.SystemRoot || process.env.SystemRoot || "C:\\Windows";
60748
+ const command = host.toLowerCase() === "pwsh" ? "pwsh.exe" : path.win32.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
60749
+ return {
60750
+ argsPrefix: [
60751
+ "-NoLogo",
60752
+ "-NoProfile",
60753
+ "-NonInteractive",
60754
+ "-ExecutionPolicy",
60755
+ "Bypass",
60756
+ "-File",
60757
+ script
60758
+ ],
60759
+ command
60760
+ };
60761
+ };
60315
60762
  inferWindowsNpmShimTarget = async (shimPath, env) => {
60316
60763
  if (WINDOWS_EXE_EXT_PATTERN.test(shimPath)) return { command: shimPath };
60317
60764
  if (!await fileExists$1(shimPath)) return;
60318
60765
  try {
60319
60766
  const source = await readFile(shimPath, "utf8");
60320
- return await inferWindowsNodeScriptFromShim(shimPath, source, env) ?? await inferWindowsExecutableFromShim(shimPath, source);
60767
+ return await inferWindowsNodeScriptFromShim(shimPath, source, env) ?? await inferWindowsExecutableFromShim(shimPath, source) ?? await inferWindowsPowerShellShimTarget(shimPath, source, env);
60321
60768
  } catch {
60322
60769
  return;
60323
60770
  }
@@ -60336,6 +60783,13 @@ var init_cliSpawn = __esmMin((() => {
60336
60783
  };
60337
60784
  resolveCliSpawnPlan = async (command, args, env) => {
60338
60785
  const trimmedCommand = command.trim();
60786
+ const wslCommand = parseWslCommand(trimmedCommand);
60787
+ if (wslCommand) {
60788
+ if (!isWindows$1()) throw new Error(`A WSL command only runs on Windows: ${trimmedCommand}`);
60789
+ const wslPlan = buildWslSpawnPlan(wslCommand, args, env, await getWslPathEnv(wslCommand.distro));
60790
+ assertWindowsCommandLineFits(wslPlan);
60791
+ return wslPlan;
60792
+ }
60339
60793
  if (!isWindows$1() || !trimmedCommand) return {
60340
60794
  args,
60341
60795
  command
@@ -60360,6 +60814,7 @@ var resolveCliCommand_exports = /* @__PURE__ */ __exportAll$2({
60360
60814
  LOGIN_SHELL_TIMEOUT_STATUS_ERROR: () => LOGIN_SHELL_TIMEOUT_STATUS_ERROR,
60361
60815
  LoginShellPathTimeoutError: () => LoginShellPathTimeoutError,
60362
60816
  detectHeterogeneousCliCommand: () => detectHeterogeneousCliCommand,
60817
+ detectInWslWhenMissing: () => detectInWslWhenMissing,
60363
60818
  detectValidatedCommand: () => detectValidatedCommand,
60364
60819
  detectValidatedCommandCandidates: () => detectValidatedCommandCandidates,
60365
60820
  invalidateLoginShellPathCache: () => invalidateLoginShellPathCache,
@@ -60367,10 +60822,11 @@ var resolveCliCommand_exports = /* @__PURE__ */ __exportAll$2({
60367
60822
  resolveHeteroSpawnCommand: () => resolveHeteroSpawnCommand,
60368
60823
  resolveUserSpawnPath: () => resolveUserSpawnPath
60369
60824
  });
60370
- var execFilePromise$2, VERSION_PATTERN, extractVersion, isWindows, shellPathPromise, registryPathPromise, WINDOWS_SHELL_METAS, WINDOWS_RUNNABLE_EXTS, WINDOWS_SHIM_EXTS, WINDOWS_SHELL_MAX_COMMAND_LINE_LENGTH, isWindowsRunnablePath, isWindowsShimPath, pickWindowsRunnables, isPathLikeCommand, LOGIN_SHELL_PATH_TIMEOUT_MS, LOGIN_SHELL_TIMEOUT_STATUS_ERROR, isLoginShellTimeoutStatus, LoginShellPathTimeoutError, getLoginShellPath, cachedShellPath, shellPathGeneration, getCurrentLoginShellPath, invalidateLoginShellPathCache, WINDOWS_REGISTRY_PATH_KEYS, WINDOWS_REGISTRY_PATH_VALUE, expandWindowsEnvRefs$1, readWindowsRegistryPathValue, readMergedWindowsRegistryPath, getWindowsRegistryPath, mergePathValues, resolveUserSpawnPath, recoverProbeEnvironment, getCommandPathLines, resolveCommandCandidates, quoteWindowsShellToken, buildWindowsShellProbe, UNRESOLVED_SHIM, execProbe, detectValidatedCommandInEnvironment, isProbeableCommand, detectValidatedCommandCandidates, detectValidatedCommand, HETEROGENEOUS_CLI_AGENT_OPTIONS, DEFAULT_HETERO_COMMAND, getWellKnownCommandPaths, detectHeterogeneousCliCommand, resolveHeteroSpawnCommand;
60825
+ var execFilePromise$2, VERSION_PATTERN, extractVersion, isWindows, shellPathPromise, registryPathPromise, WINDOWS_SHELL_METAS, WINDOWS_RUNNABLE_EXTS, WINDOWS_SHIM_EXTS, WINDOWS_SHELL_MAX_COMMAND_LINE_LENGTH, isWindowsRunnablePath, isWindowsShimPath, pickWindowsRunnables, isPathLikeCommand, LOGIN_SHELL_PATH_TIMEOUT_MS, LOGIN_SHELL_TIMEOUT_STATUS_ERROR, isLoginShellTimeoutStatus, LoginShellPathTimeoutError, getLoginShellPath, cachedShellPath, shellPathGeneration, getCurrentLoginShellPath, invalidateLoginShellPathCache, WINDOWS_REGISTRY_PATH_KEYS, WINDOWS_REGISTRY_PATH_VALUE, expandWindowsEnvRefs$1, readWindowsRegistryPathValue, readMergedWindowsRegistryPath, getWindowsRegistryPath, mergePathValues, resolveUserSpawnPath, recoverProbeEnvironment, getCommandPathLines, resolveCommandCandidates, quoteWindowsShellToken, buildWindowsShellProbe, UNRESOLVED_SHIM, execProbe, detectValidatedCommandInEnvironment, isProbeableCommand, detectValidatedCommandCandidates, detectValidatedCommand, HETEROGENEOUS_CLI_AGENT_OPTIONS, DEFAULT_HETERO_COMMAND, getWellKnownCommandPaths, detectHeterogeneousCliCommand, WSL_COMMAND_NAMES, detectInWslWhenMissing, resolveHeteroSpawnCommand;
60371
60826
  var init_resolveCliCommand = __esmMin((() => {
60372
60827
  init_config();
60373
60828
  init_cliSpawn();
60829
+ init_wsl();
60374
60830
  execFilePromise$2 = promisify(execFile);
60375
60831
  VERSION_PATTERN = /v?(\d+\.\d+\.\d+(?:-[\dA-Za-z.-]+)?(?:\+[\dA-Za-z.-]+)?)/;
60376
60832
  extractVersion = (versionBanner) => versionBanner.match(VERSION_PATTERN)?.[1];
@@ -60435,6 +60891,7 @@ var init_resolveCliCommand = __esmMin((() => {
60435
60891
  return shellPathPromise;
60436
60892
  };
60437
60893
  invalidateLoginShellPathCache = () => {
60894
+ invalidateWslCache();
60438
60895
  cachedShellPath = void 0;
60439
60896
  shellPathGeneration += 1;
60440
60897
  shellPathPromise = void 0;
@@ -60566,7 +61023,7 @@ var init_resolveCliCommand = __esmMin((() => {
60566
61023
  const spawnPlan = await resolveCliSpawnPlan(command, args, env);
60567
61024
  if (isWindows() && spawnPlan.command === command && isWindowsShimPath(command)) return UNRESOLVED_SHIM;
60568
61025
  return execFilePromise$2(spawnPlan.command, spawnPlan.args, {
60569
- env,
61026
+ env: spawnPlan.env ?? env,
60570
61027
  timeout: 5e3,
60571
61028
  windowsHide: true
60572
61029
  });
@@ -60651,7 +61108,7 @@ var init_resolveCliCommand = __esmMin((() => {
60651
61108
  const inheritedStatus = await detectValidatedCommandInEnvironment(command, options, probeEnv);
60652
61109
  if (inheritedStatus.available) return inheritedStatus;
60653
61110
  lastStatus = inheritedStatus;
60654
- if (!isProbeableCommand(command)) continue;
61111
+ if (!isProbeableCommand(command) || isWslCommand(command)) continue;
60655
61112
  if (!recoveryAttempted) {
60656
61113
  recoveryAttempted = true;
60657
61114
  try {
@@ -60788,6 +61245,11 @@ var init_resolveCliCommand = __esmMin((() => {
60788
61245
  path.join(homedir(), "Library", "pnpm", "copilot")
60789
61246
  ];
60790
61247
  case "cursor":
61248
+ if (platform() === "win32") {
61249
+ const localAppData = process.env.LOCALAPPDATA;
61250
+ if (!localAppData) return [];
61251
+ return [path.win32.join(localAppData, "cursor-agent", "agent.cmd")];
61252
+ }
60791
61253
  if (platform() !== "darwin" && platform() !== "linux") return [];
60792
61254
  return [path.join(homedir(), ".local", "bin", "agent"), path.join(homedir(), ".local", "bin", "cursor-agent")];
60793
61255
  case "droid":
@@ -60859,7 +61321,19 @@ var init_resolveCliCommand = __esmMin((() => {
60859
61321
  detectHeterogeneousCliCommand = async (agentType, command, probeEnv) => {
60860
61322
  const validator = HETEROGENEOUS_CLI_AGENT_OPTIONS[agentType];
60861
61323
  if (!validator) return { available: false };
60862
- return detectValidatedCommandCandidates(command.trim() === DEFAULT_HETERO_COMMAND[agentType] ? [command, ...getWellKnownCommandPaths(agentType)] : [command], validator, probeEnv);
61324
+ const isDefaultCommand = command.trim() === DEFAULT_HETERO_COMMAND[agentType];
61325
+ const status = await detectValidatedCommandCandidates(isDefaultCommand ? [command, ...getWellKnownCommandPaths(agentType)] : [command], validator, probeEnv);
61326
+ if (!isDefaultCommand) return status;
61327
+ return detectInWslWhenMissing(status, WSL_COMMAND_NAMES[agentType] ?? [command], validator);
61328
+ };
61329
+ WSL_COMMAND_NAMES = { cursor: ["agent", "cursor-agent"] };
61330
+ detectInWslWhenMissing = async (status, commandNames, options) => {
61331
+ if (status.available || !isWindows()) return status;
61332
+ const candidates = [];
61333
+ for (const name of commandNames) candidates.push(...await findWslCommandCandidates(name));
61334
+ if (candidates.length === 0) return status;
61335
+ const wslStatus = await detectValidatedCommandCandidates(candidates, options);
61336
+ return wslStatus.available ? wslStatus : status;
60863
61337
  };
60864
61338
  resolveHeteroSpawnCommand = async (agentType, command) => {
60865
61339
  const requested = command?.trim();
@@ -60926,11 +61400,11 @@ const fetchAntigravityQuota = async (params = {}) => {
60926
61400
  });
60927
61401
  try {
60928
61402
  const resolved = await resolveHeteroSpawnCommand("antigravity", params.command);
60929
- const env = {
61403
+ const env = getAntigravitySpawnEnv({
60930
61404
  ...process.env,
60931
61405
  ...resolved.pathEnv ? { PATH: resolved.pathEnv } : {},
60932
61406
  ...params.env
60933
- };
61407
+ });
60934
61408
  const plan = await resolveCliSpawnPlan(resolved.command, [
60935
61409
  "-p",
60936
61410
  "/usage",
@@ -60939,15 +61413,19 @@ const fetchAntigravityQuota = async (params = {}) => {
60939
61413
  "--print-timeout",
60940
61414
  "15s"
60941
61415
  ], env);
60942
- const { stdout } = await execFilePromise$1(plan.command, plan.args, {
61416
+ const query = execFilePromise$1(plan.command, plan.args, {
60943
61417
  cwd: tmpdir(),
60944
61418
  encoding: "utf8",
60945
- env,
61419
+ env: plan.env ?? env,
60946
61420
  killSignal: "SIGKILL",
60947
61421
  maxBuffer: 1024 * 1024,
60948
61422
  timeout: 2e4,
60949
61423
  windowsHide: true
60950
61424
  });
61425
+ query.child?.stderr?.on("data", (chunk) => {
61426
+ if (String(chunk).includes("Authentication required. Please visit the URL to log in:")) query.child.kill("SIGKILL");
61427
+ });
61428
+ const { stdout } = await query;
60951
61429
  let payload;
60952
61430
  try {
60953
61431
  payload = JSON.parse(stdout);
@@ -60969,7 +61447,7 @@ const fetchAntigravityQuota = async (params = {}) => {
60969
61447
  } catch (error) {
60970
61448
  const record = isRecord$8(error) ? error : {};
60971
61449
  const detail = `${record.stderr ?? ""} ${record.message ?? ""}`;
60972
- return failure(record.code === "ENOENT" ? "cli_not_found" : record.killed || record.code === "ETIMEDOUT" ? "timeout" : isHeterogeneousAgentAuthRequired("antigravity", detail) ? "auth_required" : "command_failed");
61450
+ return failure(record.code === "ENOENT" ? "cli_not_found" : isHeterogeneousAgentAuthRequired("antigravity", detail) ? "auth_required" : record.killed || record.code === "ETIMEDOUT" ? "timeout" : "command_failed");
60973
61451
  }
60974
61452
  };
60975
61453
 
@@ -61462,7 +61940,7 @@ const codexQuotaReadings = (limits, capturedAt) => limits.flatMap((limit) => {
61462
61940
  });
61463
61941
 
61464
61942
  //#endregion
61465
- //#region ../../packages/heterogeneous-agents/src/codex/appServerParams.ts
61943
+ //#region ../../packages/heterogeneous-agents/src/codex/appServerArgs.ts
61466
61944
  const CODEX_DANGEROUS_BYPASS_FLAG = "--dangerously-bypass-approvals-and-sandbox";
61467
61945
  const CODEX_FULL_AUTO_FLAG = "--full-auto";
61468
61946
  const CODEX_APPROVAL_FLAGS = ["-a", "--ask-for-approval"];
@@ -61509,15 +61987,15 @@ const getCodexAppServerUnsupportedArgs = (args, options = {}) => {
61509
61987
  const hasSandboxFlag = args.some((arg) => CODEX_SANDBOX_FLAGS.includes(arg) || getFlagValue(arg, CODEX_SANDBOX_FLAGS) !== void 0);
61510
61988
  for (let index = 0; index < args.length; index += 1) {
61511
61989
  const arg = args[index];
61512
- if (arg === CODEX_DANGEROUS_BYPASS_FLAG) {
61990
+ if (arg === "--dangerously-bypass-approvals-and-sandbox") {
61513
61991
  if (hasSandboxFlag) unsupported.push(arg);
61514
61992
  continue;
61515
61993
  }
61516
- if (arg === CODEX_EPHEMERAL_FLAG) {
61994
+ if (arg === "--ephemeral") {
61517
61995
  if (options.resume) unsupported.push(arg);
61518
61996
  continue;
61519
61997
  }
61520
- if (arg === CODEX_FULL_AUTO_FLAG || arg === CODEX_IGNORE_USER_CONFIG_FLAG) {
61998
+ if (arg === "--full-auto" || arg === "--ignore-user-config") {
61521
61999
  unsupported.push(arg);
61522
62000
  continue;
61523
62001
  }
@@ -61554,6 +62032,9 @@ const getCodexAppServerUnsupportedArgs = (args, options = {}) => {
61554
62032
  }
61555
62033
  return unsupported;
61556
62034
  };
62035
+
62036
+ //#endregion
62037
+ //#region ../../packages/heterogeneous-agents/src/codex/appServerParams.ts
61557
62038
  const buildCodexAppServerThreadParams = (args, cwd, initialModel) => {
61558
62039
  const config = { "features.default_mode_request_user_input": true };
61559
62040
  let effectiveCwd = cwd;
@@ -61564,15 +62045,15 @@ const buildCodexAppServerThreadParams = (args, cwd, initialModel) => {
61564
62045
  let serviceTier;
61565
62046
  for (let index = 0; index < args.length; index += 1) {
61566
62047
  const arg = args[index];
61567
- if (arg === CODEX_DANGEROUS_BYPASS_FLAG) {
62048
+ if (arg === "--dangerously-bypass-approvals-and-sandbox") {
61568
62049
  sandbox = "danger-full-access";
61569
62050
  continue;
61570
62051
  }
61571
- if (arg === CODEX_FULL_AUTO_FLAG) {
62052
+ if (arg === "--full-auto") {
61572
62053
  sandbox = "workspace-write";
61573
62054
  continue;
61574
62055
  }
61575
- if (arg === CODEX_EPHEMERAL_FLAG) {
62056
+ if (arg === "--ephemeral") {
61576
62057
  ephemeral = true;
61577
62058
  continue;
61578
62059
  }
@@ -62060,17 +62541,19 @@ const buildHeterogeneousPrompt = (input) => new HeterogeneousPromptEngine(input)
62060
62541
  *
62061
62542
  * `permissionMode` (Claude Code, Better Coding Experience lab) rides the same
62062
62543
  * envelope for the same reason: an `lh` that predates it unwraps `content` and
62063
- * keeps allowing everything, rather than failing on an unknown flag.
62544
+ * keeps allowing everything, rather than failing on an unknown flag. The
62545
+ * Codex Plan switch (`collaborationMode`) rides it for the same reason.
62064
62546
  */
62065
62547
  const buildHeteroExecStdinPayload = (params) => {
62066
- const { imageList = [], isNewSession, permissionMode, prompt, resumeFallbackSystemContext, systemContext } = params;
62548
+ const { collaborationMode, imageList = [], isNewSession, permissionMode, prompt, resumeFallbackSystemContext, systemContext } = params;
62067
62549
  const blocks = buildHeterogeneousPrompt({
62068
62550
  imageList,
62069
62551
  isNewSession,
62070
62552
  prompt,
62071
62553
  systemContext
62072
62554
  });
62073
- if (resumeFallbackSystemContext !== void 0 || permissionMode) return JSON.stringify({
62555
+ if (resumeFallbackSystemContext !== void 0 || permissionMode || collaborationMode) return JSON.stringify({
62556
+ ...collaborationMode && { collaborationMode },
62074
62557
  content: blocks,
62075
62558
  ...permissionMode && { permissionMode },
62076
62559
  resumeFallback: resumeFallbackSystemContext === void 0 ? void 0 : buildHeterogeneousPrompt({
@@ -62263,7 +62746,7 @@ const materializeImageToPath = async (image, cacheDir) => {
62263
62746
  if (image.path) return image.path;
62264
62747
  const ext = EXT_BY_MEDIA_TYPE[normalizeMediaType(image.mediaType)] || EXT_BY_MEDIA_TYPE[guessMediaTypeFromBuffer(image.buffer) ?? ""];
62265
62748
  if (!ext) throw new Error(`Unsupported image media type for path materialization: ${image.mediaType}`);
62266
- const key = sha256Hex(`${image.mediaType}:${image.buffer.length}:${image.buffer.subarray(0, 64).toString("hex")}`);
62749
+ const key = sha256Hex(image.buffer);
62267
62750
  const filePath = path.join(cacheDir, `${key}${ext}`);
62268
62751
  try {
62269
62752
  await access(filePath);
@@ -62376,6 +62859,7 @@ const buildQoderInput = async (blocks, options) => {
62376
62859
  * extra CLI args required to attach images. The single source of truth for
62377
62860
  * how each external agent CLI receives multimodal input.
62378
62861
  *
62862
+ * - `antigravity`: stream-json text on stdin with local paths for the built-in image reader
62379
62863
  * - `amp` / `claude-code` / `codebuddy`: stream-json on stdin with text + base64 image content blocks
62380
62864
  * - `codex`: raw text on stdin + repeatable `--image <path>` flags
62381
62865
  * - `kimi-code`: `--prompt <text>` with materialized image paths referenced in the text
@@ -62389,15 +62873,18 @@ const buildQoderInput = async (blocks, options) => {
62389
62873
  const buildAgentInput = async (agentType, prompt, options = {}) => {
62390
62874
  const blocks = toBlocks$1(prompt);
62391
62875
  switch (agentType) {
62392
- case "antigravity":
62393
- if (blocks.some(isImageBlock)) throw new Error("Antigravity CLI stream input does not support image attachments.");
62876
+ case "antigravity": {
62877
+ const imagePaths = await resolvePathInputImagePaths(blocks, options);
62878
+ const attachments = imagePaths.length ? ["Use your built-in image-reading tool to inspect the attached images before answering:", ...imagePaths.map((imagePath) => `- ${JSON.stringify(path.resolve(imagePath))}`)].join("\n") : "";
62879
+ const content = [collectText(blocks), attachments].filter(Boolean).join("\n\n");
62394
62880
  return {
62395
62881
  args: [],
62396
62882
  stdin: `${JSON.stringify({
62397
62883
  event: "user",
62398
- message: { content: collectText(blocks) }
62884
+ message: { content }
62399
62885
  })}\n`
62400
62886
  };
62887
+ }
62401
62888
  case "amp":
62402
62889
  case "claude-code":
62403
62890
  case "codebuddy": return buildClaudeCompatibleStdin(blocks, options);
@@ -62745,7 +63232,7 @@ var CodexAppServerClient = class {
62745
63232
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
62746
63233
  cwd: this.options.cwd,
62747
63234
  detached: process.platform !== "win32",
62748
- env: this.options.env,
63235
+ env: spawnPlan.env ?? this.options.env,
62749
63236
  stdio: [
62750
63237
  "pipe",
62751
63238
  "pipe",
@@ -63687,6 +64174,13 @@ function splitLines(text) {
63687
64174
  return result;
63688
64175
  }
63689
64176
 
64177
+ //#endregion
64178
+ //#region ../../packages/heterogeneous-agents/src/codexPlanMode/index.ts
64179
+ /** `step_complete` phase carrying what a native Codex run reports about its collaboration mode. */
64180
+ const COLLABORATION_MODE_PHASE = "collaboration_mode";
64181
+ /** Tool api name of a completed Codex plan (`ThreadItem { type: 'plan' }`). */
64182
+ const CODEX_PROPOSED_PLAN_API_NAME = "proposed_plan";
64183
+
63690
64184
  //#endregion
63691
64185
  //#region ../../packages/heterogeneous-agents/src/utils/codexCommandOutput.ts
63692
64186
  const CODEX_COMMAND_OUTPUT_MAX_LENGTH = 25e3;
@@ -63995,6 +64489,8 @@ var CodexAppServerAdapter = class {
63995
64489
  pendingTools = /* @__PURE__ */ new Map();
63996
64490
  streamedAgentText = /* @__PURE__ */ new Map();
63997
64491
  streamedCommandOutput = /* @__PURE__ */ new Map();
64492
+ /** Plan-mode plans (`item/plan/delta`) streamed so far, by item id. */
64493
+ streamedPlans = /* @__PURE__ */ new Map();
63998
64494
  streamedReasoning = /* @__PURE__ */ new Set();
63999
64495
  toolStateSequence = /* @__PURE__ */ new Map();
64000
64496
  stepToolCalls = [];
@@ -64057,6 +64553,7 @@ var CodexAppServerAdapter = class {
64057
64553
  case "item/fileChange/patchUpdated": return this.handleFileChangeUpdate(rawParams);
64058
64554
  case "item/mcpToolCall/progress": return this.handleMcpProgress(rawParams);
64059
64555
  case "turn/plan/updated": return this.handlePlanUpdated(rawParams);
64556
+ case "item/plan/delta": return this.handleProposedPlanDelta(rawParams);
64060
64557
  case "thread/tokenUsage/updated": {
64061
64558
  const { tokenUsage } = rawParams;
64062
64559
  const cumulativeUsage = toUsage(tokenUsage.total);
@@ -64087,6 +64584,7 @@ var CodexAppServerAdapter = class {
64087
64584
  }
64088
64585
  handleItemStarted({ item }) {
64089
64586
  if (item.type === "userMessage") return this.handleSteeredUserMessage(item);
64587
+ if (item.type === "plan") return this.startProposedPlan(item);
64090
64588
  if (!isToolItem(item)) return [];
64091
64589
  const opening = this.openStepAfterSteer();
64092
64590
  this.hasToolActivity = true;
@@ -64133,6 +64631,7 @@ var CodexAppServerAdapter = class {
64133
64631
  }
64134
64632
  return message.text ? this.emitText(message.id, message.text) : [];
64135
64633
  }
64634
+ if (item.type === "plan") return this.completeProposedPlan(item);
64136
64635
  if (item.type === "reasoning") {
64137
64636
  const reasoningItem = item;
64138
64637
  if (this.streamedReasoning.delete(reasoningItem.id)) return [];
@@ -64200,6 +64699,75 @@ var CodexAppServerAdapter = class {
64200
64699
  status: "inProgress"
64201
64700
  })] : [];
64202
64701
  }
64702
+ /**
64703
+ * A plan-mode plan (`ThreadItem { type: 'plan' }`) shows as a `proposed_plan`
64704
+ * tool: `item/plan/delta` only streams its text, the completed item is the
64705
+ * plan of record (Codex does not promise the deltas add up to it).
64706
+ */
64707
+ startProposedPlan(item) {
64708
+ if (this.pendingTools.has(item.id)) return [];
64709
+ const opening = this.openStepAfterSteer();
64710
+ const payload = {
64711
+ apiName: CODEX_PROPOSED_PLAN_API_NAME,
64712
+ arguments: "{}",
64713
+ id: item.id,
64714
+ identifier: CODEX_IDENTIFIER$1,
64715
+ type: "default"
64716
+ };
64717
+ this.hasToolActivity = true;
64718
+ this.pendingTools.set(item.id, payload);
64719
+ this.stepToolCalls.push(payload);
64720
+ this.streamedPlans.set(item.id, item.text ?? "");
64721
+ return [
64722
+ ...opening,
64723
+ this.makeEvent("stream_chunk", {
64724
+ chunkType: "tools_calling",
64725
+ toolsCalling: [...this.stepToolCalls]
64726
+ }),
64727
+ this.makeEvent("tool_start", { toolCallId: item.id })
64728
+ ];
64729
+ }
64730
+ handleProposedPlanDelta(params) {
64731
+ if (!params.delta || !this.pendingTools.has(params.itemId)) return [];
64732
+ const text = `${this.streamedPlans.get(params.itemId) ?? ""}${params.delta}`;
64733
+ this.streamedPlans.set(params.itemId, text);
64734
+ return [this.toolState(params.itemId, { plan: {
64735
+ completed: false,
64736
+ text
64737
+ } })];
64738
+ }
64739
+ completeProposedPlan(item) {
64740
+ this.streamedPlans.delete(item.id);
64741
+ const payload = this.pendingTools.get(item.id) ?? {
64742
+ apiName: "proposed_plan",
64743
+ arguments: "{}",
64744
+ id: item.id,
64745
+ identifier: CODEX_IDENTIFIER$1,
64746
+ type: "default"
64747
+ };
64748
+ const events = this.pendingTools.has(item.id) ? [] : this.startLateTool(payload);
64749
+ this.pendingTools.delete(item.id);
64750
+ const pluginState = { plan: {
64751
+ completed: true,
64752
+ text: item.text
64753
+ } };
64754
+ events.push(this.makeEvent("tool_result", {
64755
+ content: item.text,
64756
+ isError: false,
64757
+ pluginState,
64758
+ toolCallId: item.id
64759
+ }), this.makeEvent("tool_end", {
64760
+ isSuccess: true,
64761
+ payload: { toolCalling: payload },
64762
+ result: {
64763
+ content: item.text,
64764
+ state: pluginState,
64765
+ success: true
64766
+ },
64767
+ toolCallId: item.id
64768
+ }));
64769
+ return events;
64770
+ }
64203
64771
  handlePlanUpdated(params) {
64204
64772
  const id = `turn-plan-${params.turnId}`;
64205
64773
  let foundProcessing = false;
@@ -64518,6 +65086,7 @@ const formatCodexAsyncReplies = (replies) => `<send_user_message_question_reply>
64518
65086
 
64519
65087
  //#endregion
64520
65088
  //#region ../../packages/heterogeneous-agents/src/codex/CodexThreadSession.ts
65089
+ init_src$2();
64521
65090
  init_object$1();
64522
65091
  const CODEX_APP_SERVER_TRANSPORT = "codex-app-server";
64523
65092
  /** An interrupted turn settled within 250 ms in probes; this bounds slow tool teardown. */
@@ -64547,6 +65116,15 @@ var CodexThreadSession = class {
64547
65116
  interruptRequested = false;
64548
65117
  lastOperationId;
64549
65118
  model;
65119
+ effort;
65120
+ /** The mode this run's turns send; a mid-run switch changes it for the next turn. */
65121
+ collaborationMode;
65122
+ /**
65123
+ * Modes sent since the last `turn/start`, oldest first, that Codex has not
65124
+ * acknowledged yet. A `thread/settings/updated` naming one of them answers
65125
+ * that request (and supersedes the older ones), not the latest pick.
65126
+ */
65127
+ pendingModeRequests = [];
64550
65128
  running = false;
64551
65129
  sessionUnsubscribers = [];
64552
65130
  threadId;
@@ -64569,6 +65147,7 @@ var CodexThreadSession = class {
64569
65147
  this.running = true;
64570
65148
  this.interruptRequested = false;
64571
65149
  this.lastOperationId = options.operationId;
65150
+ this.collaborationMode = options.collaborationMode;
64572
65151
  this.emitStatus("starting", options.operationId);
64573
65152
  const traceUnsubscribers = [];
64574
65153
  try {
@@ -64640,9 +65219,12 @@ var CodexThreadSession = class {
64640
65219
  transportInterrupted: false
64641
65220
  };
64642
65221
  this.activeTurn = activeTurn;
65222
+ const collaborationMode = this.collaborationModeParams(this.collaborationMode);
65223
+ this.pendingModeRequests = collaborationMode ? [collaborationMode.mode] : [];
64643
65224
  const turnParams = {
64644
65225
  input,
64645
- threadId
65226
+ threadId,
65227
+ ...collaborationMode && { collaborationMode }
64646
65228
  };
64647
65229
  this.canFallback = false;
64648
65230
  activeTurn.turnId = (await this.options.client.request("turn/start", turnParams))?.turn?.id;
@@ -64731,14 +65313,14 @@ var CodexThreadSession = class {
64731
65313
  this.releaseThread ??= this.options.client.acquireThread(this.threadId);
64732
65314
  const response = this.provenance ? await this.resumeWithShellEnv(this.threadId) : await this.options.client.request("thread/resume", toThreadResumeParams(this.threadId, this.threadParams));
64733
65315
  if (!response || this.closedByHost) return;
64734
- await this.attachThread(response.thread.id, response.model);
65316
+ await this.attachThread(response.thread.id, response.model, response.reasoningEffort);
64735
65317
  return;
64736
65318
  }
64737
65319
  const response = await this.options.client.request("thread/start", this.threadParams);
64738
65320
  if (this.closedByHost) return;
64739
65321
  const threadId = response?.thread?.id;
64740
65322
  if (!threadId) throw new CodexAppServerConnectionError("Codex app-server returned an incompatible thread/start response", { phase: "thread-start" });
64741
- await this.attachThread(threadId, response.model);
65323
+ await this.attachThread(threadId, response.model, response.reasoningEffort);
64742
65324
  if (!this.options.threadParams.ephemeral) {
64743
65325
  await this.setThreadName(threadId);
64744
65326
  this.options.onSessionId(threadId);
@@ -64783,12 +65365,13 @@ var CodexThreadSession = class {
64783
65365
  });
64784
65366
  }
64785
65367
  }
64786
- async attachThread(threadId, model) {
65368
+ async attachThread(threadId, model, effort) {
64787
65369
  this.releaseThread ??= this.options.client.acquireThread(threadId);
64788
65370
  this.threadId = threadId;
64789
65371
  this.attached = true;
64790
65372
  this.canFallback = false;
64791
65373
  if (model) this.updateModel(model);
65374
+ if (effort !== void 0) this.effort = effort;
64792
65375
  if (this.threadUnsubscribers.length > 0) return;
64793
65376
  this.threadUnsubscribers.push(this.options.client.subscribe(threadId, (method, params) => this.enqueueNotification(method, params)), this.options.client.subscribeServerRequests(threadId, (method, params) => {
64794
65377
  if (method === "item/commandExecution/requestApproval" || method === "item/fileChange/requestApproval") return { decision: "cancel" };
@@ -64801,10 +65384,73 @@ var CodexThreadSession = class {
64801
65384
  }
64802
65385
  }));
64803
65386
  }
65387
+ /**
65388
+ * The Plan switch flipped while this run goes: Codex takes the mode from its
65389
+ * next turn (`thread/settings/update` never changes the turn in flight), and
65390
+ * this run's own next turn — a continuation after async answers — sends it too.
65391
+ */
65392
+ async setCollaborationMode(mode) {
65393
+ this.collaborationMode = mode;
65394
+ if (!this.running || !this.attached || !this.threadId || this.closedByHost) return;
65395
+ const collaborationMode = this.collaborationModeParams(mode);
65396
+ if (!collaborationMode) return;
65397
+ this.pendingModeRequests.push(mode);
65398
+ await this.options.client.request("thread/settings/update", {
65399
+ collaborationMode,
65400
+ threadId: this.threadId
65401
+ });
65402
+ }
65403
+ /**
65404
+ * The `collaborationMode` for `mode`, carrying the thread's own model and
65405
+ * effort (`developer_instructions: null` keeps the mode's built-in
65406
+ * instructions; the thread's developer instructions stay in force, verified
65407
+ * on codex-cli 0.169.0). Undefined without a mode, or before the thread
65408
+ * reported its model.
65409
+ */
65410
+ collaborationModeParams(mode) {
65411
+ if (!mode || !this.model) return;
65412
+ return {
65413
+ mode,
65414
+ settings: {
65415
+ developer_instructions: null,
65416
+ model: this.model,
65417
+ reasoning_effort: this.effort ?? null
65418
+ }
65419
+ };
65420
+ }
65421
+ /**
65422
+ * Codex reports the thread's mode after `turn/start` set it, or after a
65423
+ * mid-run switch (it only reports a change). The report carries the request
65424
+ * it answers, so the topic follows Codex only where the two disagree. A
65425
+ * notification naming a pending request acknowledges that one: with Plan
65426
+ * flipped on and back off before Codex answered, its `plan` answers the
65427
+ * first flip and must not read as Codex refusing the second.
65428
+ */
65429
+ handleThreadSettingsUpdated(activeTurn, params) {
65430
+ const mode = params?.threadSettings?.collaborationMode?.mode;
65431
+ if (params?.threadId !== this.threadId || !this.collaborationMode) return Promise.resolve();
65432
+ if (!isCodexCollaborationMode(mode)) return Promise.resolve();
65433
+ const acknowledged = this.pendingModeRequests.indexOf(mode);
65434
+ const requested = acknowledged >= 0 ? mode : this.collaborationMode;
65435
+ if (acknowledged >= 0) this.pendingModeRequests.splice(0, acknowledged + 1);
65436
+ const data = {
65437
+ collaborationMode: mode,
65438
+ phase: COLLABORATION_MODE_PHASE,
65439
+ requested
65440
+ };
65441
+ activeTurn.notificationQueue = activeTurn.notificationQueue.then(() => this.options.onEvents([toStreamEvent({
65442
+ data,
65443
+ stepIndex: 0,
65444
+ timestamp: Date.now(),
65445
+ type: "step_complete"
65446
+ }, activeTurn.operationId)]));
65447
+ return activeTurn.notificationQueue;
65448
+ }
64804
65449
  async handleReconnect(response) {
64805
65450
  if (this.closedByHost) return;
64806
65451
  this.attached = true;
64807
65452
  if (response.model) this.updateModel(response.model);
65453
+ if (response.reasoningEffort !== void 0) this.effort = response.reasoningEffort;
64808
65454
  }
64809
65455
  async requestUserInput(params) {
64810
65456
  const request = parseCodexUserInput(params);
@@ -64851,6 +65497,7 @@ var CodexThreadSession = class {
64851
65497
  enqueueNotification(method, params) {
64852
65498
  const activeTurn = this.activeTurn;
64853
65499
  if (!activeTurn || !this.isCurrentTurnNotification(method, params, activeTurn)) return Promise.resolve();
65500
+ if (method === "thread/settings/updated") return this.handleThreadSettingsUpdated(activeTurn, params);
64854
65501
  if (method === "turn/completed") {
64855
65502
  if (params.turn.status !== "inProgress") {
64856
65503
  activeTurn.terminalNotificationReceived = true;
@@ -65043,6 +65690,7 @@ const createCodexAgentHandle = async (options) => {
65043
65690
  options.onStartupControl?.({ cancel });
65044
65691
  const turnOptions = {
65045
65692
  askUserBridge: options.askUserBridge,
65693
+ collaborationMode: options.collaborationMode,
65046
65694
  input: buildCodexAppServerInput(input),
65047
65695
  onRawMessage: (line) => options.onRawStdout?.(Buffer.from(line)),
65048
65696
  operationId: options.operationId,
@@ -65102,6 +65750,8 @@ const createCodexAgentHandle = async (options) => {
65102
65750
  get sessionId() {
65103
65751
  return nativeSessionId;
65104
65752
  },
65753
+ /** The Plan switch flipped mid-run: Codex takes it from the next turn. */
65754
+ setCollaborationMode: (mode) => session.setCollaborationMode(mode),
65105
65755
  stderr,
65106
65756
  supportsSteerImageAttachments: true
65107
65757
  };
@@ -65152,13 +65802,13 @@ var AcpStdioClient = class {
65152
65802
  async start() {
65153
65803
  if (this.child) return;
65154
65804
  if (this.closed) throw new Error("ACP stdio client is closed");
65155
- const spawnPlan = await resolveCliSpawnPlan(this.options.commandPath, this.options.args);
65805
+ const spawnPlan = await resolveCliSpawnPlan(this.options.commandPath, this.options.args, this.options.env);
65156
65806
  if (this.closed) throw new Error("ACP stdio client is closed");
65157
65807
  const detached = process.platform !== "win32" && (this.options.detached ?? true);
65158
65808
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
65159
65809
  cwd: this.options.cwd,
65160
65810
  detached,
65161
- env: this.options.env,
65811
+ env: spawnPlan.env ?? this.options.env,
65162
65812
  stdio: [
65163
65813
  "pipe",
65164
65814
  "pipe",
@@ -65942,29 +66592,38 @@ const stringifyOutput = (value) => typeof value === "string" ? value : value ===
65942
66592
  /**
65943
66593
  * Native agy NDJSON protocol, not the Gemini/Claude stream-json protocol.
65944
66594
  * https://antigravity.google/docs/cli/headless/
65945
- * LobeHub uses one process per turn and --conversation to resume. The native
65946
- * protocol also supports multiple turns while stdin remains open.
66595
+ * Supports both one-shot turns and multi-turn liveInput steering while stdin remains open.
65947
66596
  */
65948
66597
  var AntigravityAdapter = class {
65949
66598
  sessionId;
65950
66599
  completedSteps = /* @__PURE__ */ new Set();
65951
66600
  flushed = false;
65952
66601
  hasResponseText = false;
66602
+ latestTurnCompleted = false;
65953
66603
  model;
65954
66604
  pendingTools = /* @__PURE__ */ new Map();
65955
66605
  resultReceived = false;
65956
66606
  completionValidated = false;
65957
66607
  responseStep;
66608
+ runtimeEndStrategy;
66609
+ seenInitialUserInput = false;
66610
+ seenUserInputSteps = /* @__PURE__ */ new Set();
65958
66611
  stepIndex = 0;
65959
66612
  stepTools = [];
65960
66613
  streamOpen = false;
66614
+ takeNextSteerUuid;
65961
66615
  toolSinceResponse = false;
65962
66616
  usageByStep = /* @__PURE__ */ new Map();
66617
+ constructor(options = {}) {
66618
+ this.runtimeEndStrategy = options.runtimeEndStrategy ?? "on-result";
66619
+ this.takeNextSteerUuid = options.takeNextSteerUuid;
66620
+ }
65963
66621
  adapt(raw) {
65964
66622
  if (this.flushed || this.resultReceived || !isRecord$8(raw)) return [];
65965
66623
  if (raw.event === "init") {
66624
+ this.latestTurnCompleted = false;
65966
66625
  this.sessionId = pickString$1(raw.conversation_id);
65967
- this.model = pickString$1(toRecord(raw.init)?.model);
66626
+ this.model = pickString$1(toRecord$1(raw.init)?.model);
65968
66627
  return this.openStream();
65969
66628
  }
65970
66629
  if (raw.event === "result" && isRecord$8(raw.result)) return this.handleResult(raw.result);
@@ -65976,8 +66635,24 @@ var AntigravityAdapter = class {
65976
66635
  if (this.sessionId && conversationId && conversationId !== this.sessionId) return [];
65977
66636
  this.sessionId ??= conversationId;
65978
66637
  if (this.completedSteps.has(index)) return [];
66638
+ this.latestTurnCompleted = false;
65979
66639
  const events = [];
65980
- if (step.step_type === "agent_response") {
66640
+ if (step.step_type === "user_input") {
66641
+ if (!this.seenUserInputSteps.has(index)) {
66642
+ this.seenUserInputSteps.add(index);
66643
+ if (!this.seenInitialUserInput) this.seenInitialUserInput = true;
66644
+ else {
66645
+ const uuid = this.takeNextSteerUuid?.();
66646
+ if (uuid) {
66647
+ events.push(...this.closeStream());
66648
+ events.push(this.event("step_complete", {
66649
+ phase: "user_message",
66650
+ uuid
66651
+ }));
66652
+ }
66653
+ }
66654
+ }
66655
+ } else if (step.step_type === "agent_response") {
65981
66656
  if (this.toolSinceResponse || this.responseStep !== void 0 && this.responseStep !== index) {
65982
66657
  events.push(...this.closeStream());
65983
66658
  this.stepIndex += 1;
@@ -66008,7 +66683,7 @@ var AntigravityAdapter = class {
66008
66683
  return [...this.settlePendingTools("Antigravity ended before this tool returned a result."), ...this.closeStream()];
66009
66684
  }
66010
66685
  validateCompletion() {
66011
- if (this.resultReceived || this.completionValidated) return [];
66686
+ if (this.resultReceived || this.latestTurnCompleted || this.completionValidated) return [];
66012
66687
  this.completionValidated = true;
66013
66688
  return [this.event("error", {
66014
66689
  agentType: IDENTIFIER,
@@ -66053,8 +66728,8 @@ var AntigravityAdapter = class {
66053
66728
  return events;
66054
66729
  }
66055
66730
  handleTool(index, step) {
66056
- const info = toRecord(step.tool_info);
66057
- const subagents = toRecord(step.subagent_info);
66731
+ const info = toRecord$1(step.tool_info);
66732
+ const subagents = toRecord$1(step.subagent_info);
66058
66733
  const name = pickString$1(info?.name) ?? pickString$1(step.tool_name);
66059
66734
  if (!name && !subagents) return [];
66060
66735
  const events = this.openStream();
@@ -66076,7 +66751,7 @@ var AntigravityAdapter = class {
66076
66751
  } else if (info?.parameters !== void 0) pending.payload.arguments = args;
66077
66752
  if (info?.parameters !== void 0 || step.state === "DONE") events.push(...this.startTool(pending));
66078
66753
  if (step.state === "DONE") {
66079
- const error = toRecord(info?.error);
66754
+ const error = toRecord$1(info?.error);
66080
66755
  const content = [stringifyOutput(info?.output ?? subagents), pickString$1(error?.message) ?? stringifyOutput(info?.error)].filter(Boolean).join("\n");
66081
66756
  events.push(...this.toolResult(pending, content, info?.error != null));
66082
66757
  this.pendingTools.delete(index);
@@ -66120,7 +66795,9 @@ var AntigravityAdapter = class {
66120
66795
  return events;
66121
66796
  }
66122
66797
  handleResult(result) {
66123
- this.resultReceived = true;
66798
+ const keepOpenForMoreTurns = this.runtimeEndStrategy === "on-transport-close" && result.status === "SUCCESS";
66799
+ if (!keepOpenForMoreTurns) this.resultReceived = true;
66800
+ this.latestTurnCompleted = true;
66124
66801
  this.sessionId ??= pickString$1(result.conversation_id);
66125
66802
  const hasPendingTools = this.pendingTools.size > 0;
66126
66803
  const events = this.settlePendingTools("Antigravity ended before this tool returned a result.");
@@ -66152,6 +66829,13 @@ var AntigravityAdapter = class {
66152
66829
  }));
66153
66830
  }
66154
66831
  events.push(...this.closeStream());
66832
+ if (keepOpenForMoreTurns) {
66833
+ this.hasResponseText = false;
66834
+ this.responseStep = void 0;
66835
+ this.toolSinceResponse = false;
66836
+ this.stepTools = [];
66837
+ this.stepIndex += 1;
66838
+ }
66155
66839
  return events;
66156
66840
  }
66157
66841
  event(type, data, stepIndex = this.stepIndex) {
@@ -68750,13 +69434,13 @@ const acpContentBlockText = (value) => {
68750
69434
  * notification `params` or the nested `update`.
68751
69435
  */
68752
69436
  const isAcpReplayMessage = (raw) => {
68753
- const params = toRecord(toRecord(raw)?.params);
68754
- const update = toRecord(params?.update);
68755
- return toRecord(params?._meta)?.isReplay === true || toRecord(update?._meta)?.isReplay === true;
69437
+ const params = toRecord$1(toRecord$1(raw)?.params);
69438
+ const update = toRecord$1(params?.update);
69439
+ return toRecord$1(params?._meta)?.isReplay === true || toRecord$1(update?._meta)?.isReplay === true;
68756
69440
  };
68757
69441
  /** ACP extension dedup marker: `_meta.eventId` on the notification `params`. */
68758
69442
  const acpEventIdOf = (raw) => {
68759
- const meta = toRecord(toRecord(toRecord(raw)?.params)?._meta);
69443
+ const meta = toRecord$1(toRecord$1(toRecord$1(raw)?.params)?._meta);
68760
69444
  return typeof meta?.eventId === "string" ? meta.eventId : void 0;
68761
69445
  };
68762
69446
 
@@ -71637,37 +72321,159 @@ var AcpAgentSession = class {
71637
72321
  };
71638
72322
 
71639
72323
  //#endregion
71640
- //#region ../../packages/heterogeneous-agents/src/spawn/antigravity.ts
71641
- /** agy reads a single JSONL user message, then finishes the turn when stdin closes. */
71642
- const ANTIGRAVITY_BASE_ARGS = [
71643
- "--input-format",
71644
- "stream-json",
71645
- "--output-format",
71646
- "stream-json",
71647
- "--dangerously-skip-permissions"
71648
- ];
71649
- const MANAGED_FLAGS = new Set([
71650
- "--",
71651
- "--input-format",
71652
- "--output-format",
71653
- "--print",
71654
- "--prompt",
71655
- "--prompt-interactive",
71656
- "--remote-control",
71657
- "-i",
71658
- "-p",
71659
- "--continue",
71660
- "-c",
71661
- "--conversation"
71662
- ]);
71663
- const buildAntigravityArgs = ({ extraArgs = [], resumeSessionId }) => {
71664
- const conflicting = extraArgs.find((arg) => MANAGED_FLAGS.has(arg.split("=")[0]));
71665
- if (conflicting) throw new Error(`LobeHub manages Antigravity's prompt, output and session flags: ${conflicting}`);
71666
- return [
71667
- ...ANTIGRAVITY_BASE_ARGS,
71668
- ...resumeSessionId ? ["--conversation", resumeSessionId] : [],
71669
- ...extraArgs
71670
- ];
72324
+ //#region ../../packages/heterogeneous-agents/src/spawn/antigravityLiveInput.ts
72325
+ /**
72326
+ * How long a live Antigravity session may sit between turns with no stdout
72327
+ * before stdin is closed anyway.
72328
+ */
72329
+ const DEFAULT_IDLE_CLOSE_MS$1 = 1800 * 1e3;
72330
+ const readIdleCloseMs$1 = () => {
72331
+ const value = Number(process.env.LOBE_ANTIGRAVITY_LIVE_INPUT_IDLE_MS);
72332
+ return Number.isFinite(value) && value > 0 ? value : DEFAULT_IDLE_CLOSE_MS$1;
72333
+ };
72334
+ /**
72335
+ * The runtime end a live Antigravity session (stdin kept open, see
72336
+ * `AntigravityLiveInput`) reports once, at process exit.
72337
+ */
72338
+ const resolveAntigravityLiveRuntimeEnd = (lastTurn, exit) => {
72339
+ if (!lastTurn?.ok || exit.killedByHost || exit.sawError) return;
72340
+ if (exit.code !== 0) return;
72341
+ return {
72342
+ reason: "complete",
72343
+ transport: "cli-live"
72344
+ };
72345
+ };
72346
+ /**
72347
+ * Keeps an Antigravity (`--input-format stream-json --output-format stream-json`)
72348
+ * stdin open while a turn is active or steered follow-ups remain unconsumed,
72349
+ * then closes stdin as soon as the session becomes idle so the process exits cleanly.
72350
+ */
72351
+ var AntigravityLiveInput = class {
72352
+ closed = false;
72353
+ idleCloseMs;
72354
+ idleTimer;
72355
+ initialUserInputSeen = false;
72356
+ lastOutcome;
72357
+ lineBuffer = "";
72358
+ pendingAdapterUuids = [];
72359
+ seenUserInputSteps = /* @__PURE__ */ new Set();
72360
+ sessionId;
72361
+ turnOpen = false;
72362
+ unconsumed = [];
72363
+ constructor(stdin, options = {}) {
72364
+ this.stdin = stdin;
72365
+ this.idleCloseMs = options.idleCloseMs ?? readIdleCloseMs$1();
72366
+ stdin.on?.("close", () => this.markClosed());
72367
+ stdin.on?.("error", () => this.markClosed());
72368
+ }
72369
+ get isOpen() {
72370
+ return !this.closed && !this.stdin.destroyed && !this.stdin.writableEnded;
72371
+ }
72372
+ get lastTurn() {
72373
+ return this.lastOutcome;
72374
+ }
72375
+ /**
72376
+ * Write one stream-json `user` line into the session. When `uuid` is given
72377
+ * (a steered follow-up), stdin stays open across turn boundaries until `agy`
72378
+ * picks up that message and finishes its turn.
72379
+ */
72380
+ send(stdinLine, uuid) {
72381
+ if (!this.isOpen) return false;
72382
+ if (uuid) {
72383
+ this.unconsumed.push(uuid);
72384
+ this.pendingAdapterUuids.push(uuid);
72385
+ }
72386
+ this.stdin.write(stdinLine);
72387
+ this.clearIdleTimer();
72388
+ return true;
72389
+ }
72390
+ /** Pop the next steered message UUID for `AntigravityAdapter` to confirm. */
72391
+ takeSteerUuid() {
72392
+ return this.pendingAdapterUuids.shift();
72393
+ }
72394
+ /** Feed raw stdout bytes from the child process. */
72395
+ observe(chunk) {
72396
+ this.lineBuffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
72397
+ for (;;) {
72398
+ const newline = this.lineBuffer.indexOf("\n");
72399
+ if (newline === -1) break;
72400
+ const line = this.lineBuffer.slice(0, newline).trim();
72401
+ this.lineBuffer = this.lineBuffer.slice(newline + 1);
72402
+ if (!line) continue;
72403
+ try {
72404
+ this.observeMessage(JSON.parse(line));
72405
+ } catch {}
72406
+ }
72407
+ if (this.closed) return;
72408
+ if (this.turnOpen) this.clearIdleTimer();
72409
+ else this.armIdleTimer();
72410
+ }
72411
+ /** stdout ended: flush any trailing partial line and close stdin. */
72412
+ finish() {
72413
+ if (this.lineBuffer.trim()) this.observe("\n");
72414
+ this.close();
72415
+ }
72416
+ close() {
72417
+ if (this.closed) return;
72418
+ this.markClosed();
72419
+ this.stdin.end();
72420
+ }
72421
+ observeMessage(message) {
72422
+ if (!message || typeof message !== "object") return;
72423
+ if (message.event === "init") {
72424
+ if (typeof message.conversation_id === "string" && message.conversation_id) this.sessionId = message.conversation_id;
72425
+ this.openTurn();
72426
+ return;
72427
+ }
72428
+ if (message.event === "step_update" && message.step_update && typeof message.step_update === "object") {
72429
+ const step = message.step_update;
72430
+ const conversationId = typeof step.conversation_id === "string" && step.conversation_id ? step.conversation_id : void 0;
72431
+ if (this.sessionId && conversationId && conversationId !== this.sessionId) return;
72432
+ this.sessionId ??= conversationId;
72433
+ if (step.step_type === "user_input") {
72434
+ const index = typeof step.step_index === "number" ? step.step_index : void 0;
72435
+ if (index === void 0 || !this.seenUserInputSteps.has(index)) {
72436
+ if (index !== void 0) this.seenUserInputSteps.add(index);
72437
+ if (this.initialUserInputSeen) this.unconsumed.shift();
72438
+ else this.initialUserInputSeen = true;
72439
+ }
72440
+ }
72441
+ this.openTurn();
72442
+ return;
72443
+ }
72444
+ if (message.event === "result" && message.result && typeof message.result === "object") {
72445
+ this.turnOpen = false;
72446
+ const status = typeof message.result.status === "string" ? message.result.status : void 0;
72447
+ this.lastOutcome = {
72448
+ ok: status === "SUCCESS",
72449
+ status
72450
+ };
72451
+ if (status !== "SUCCESS") this.close();
72452
+ else this.closeIfIdle();
72453
+ }
72454
+ }
72455
+ openTurn() {
72456
+ this.turnOpen = true;
72457
+ this.lastOutcome = void 0;
72458
+ }
72459
+ closeIfIdle() {
72460
+ if (this.turnOpen || this.unconsumed.length > 0) return;
72461
+ this.close();
72462
+ }
72463
+ armIdleTimer() {
72464
+ this.clearIdleTimer();
72465
+ this.idleTimer = setTimeout(() => this.close(), this.idleCloseMs);
72466
+ this.idleTimer.unref?.();
72467
+ }
72468
+ clearIdleTimer() {
72469
+ if (!this.idleTimer) return;
72470
+ clearTimeout(this.idleTimer);
72471
+ this.idleTimer = void 0;
72472
+ }
72473
+ markClosed() {
72474
+ this.closed = true;
72475
+ this.clearIdleTimer();
72476
+ }
71671
72477
  };
71672
72478
 
71673
72479
  //#endregion
@@ -74536,8 +75342,17 @@ const isSupportedDshVersion = (version) => {
74536
75342
  * `--version` but has no `acp` profile, so it is reported unavailable here
74537
75343
  * rather than failing every turn after the agent was created.
74538
75344
  */
75345
+ /**
75346
+ * `dsh` is installed with `npm i -g`. On Windows that drops `dsh.cmd` in npm's
75347
+ * global prefix (`%APPDATA%\npm`), a directory npm's installer only adds to the
75348
+ * registry User PATH, so an app started before it never sees it.
75349
+ */
75350
+ const getDshWellKnownPaths = () => platform() === "win32" ? [path.win32.join(process.env.APPDATA || path.win32.join(homedir(), "AppData", "Roaming"), "npm", "dsh.cmd")] : [];
74539
75351
  const detectDshCommand = async (command = "dsh", env) => {
74540
- const status = await detectValidatedCommand(command, { validatePattern: DSH_VERSION_PATTERN }, env);
75352
+ const isDefaultCommand = command.trim() === "dsh";
75353
+ const validation = { validatePattern: DSH_VERSION_PATTERN };
75354
+ const nativeStatus = await detectValidatedCommandCandidates(isDefaultCommand ? [command, ...getDshWellKnownPaths()] : [command], validation, env);
75355
+ const status = isDefaultCommand ? await detectInWslWhenMissing(nativeStatus, ["dsh"], validation) : nativeStatus;
74541
75356
  if (!status.available || isSupportedDshVersion(status.version)) return status;
74542
75357
  return {
74543
75358
  ...status,
@@ -74545,6 +75360,22 @@ const detectDshCommand = async (command = "dsh", env) => {
74545
75360
  error: `DeepSeek Harness CLI ${status.version} is too old; LobeHub needs ${DSH_MIN_VERSION} or newer. Update it with: npm i -g @deepseek-ai/dsh`
74546
75361
  };
74547
75362
  };
75363
+ /**
75364
+ * The `dsh` binary a session should spawn, with the PATH that validated it.
75365
+ * A custom command is used verbatim; the default one is re-detected so a CLI
75366
+ * installed after the host started (a fresh registry PATH on Windows, a new
75367
+ * login-shell PATH elsewhere) still launches instead of failing with ENOENT.
75368
+ */
75369
+ const resolveDshSpawnCommand = async (command, env) => {
75370
+ const requested = command?.trim();
75371
+ if (requested && requested !== "dsh") return { command: requested };
75372
+ const detected = await detectDshCommand("dsh", env).catch(() => void 0);
75373
+ return detected?.available && detected.path ? {
75374
+ command: detected.path,
75375
+ pathEnv: detected.resolvedPathEnv,
75376
+ version: detected.version
75377
+ } : { command: "dsh" };
75378
+ };
74548
75379
  /** Select the CLI's shipped ACP profile, served on stdio until disconnect. */
74549
75380
  const DSH_ACP_PROFILE_ARGS = ["--profile", "acp"];
74550
75381
  /** The profile boots its plugin tree before answering `initialize`. */
@@ -75297,11 +76128,14 @@ const getHeterogeneousAgentPresetEnv = (agentType, agentEnv) => {
75297
76128
  * presets, then the agent's own `env` on top. An entrypoint the agent cleared
75298
76129
  * is removed from the result, so an inherited one does not stand in for it.
75299
76130
  */
75300
- const getHeterogeneousAgentSpawnEnv = (agentType, agentEnv, inheritedEnv) => dropClearedClaudeCodeEntrypoint({
75301
- ...inheritedEnv,
75302
- ...getHeterogeneousAgentPresetEnv(agentType, agentEnv),
75303
- ...agentEnv
75304
- });
76131
+ const getHeterogeneousAgentSpawnEnv = (agentType, agentEnv, inheritedEnv) => {
76132
+ const env = dropClearedClaudeCodeEntrypoint({
76133
+ ...inheritedEnv,
76134
+ ...getHeterogeneousAgentPresetEnv(agentType, agentEnv),
76135
+ ...agentEnv
76136
+ });
76137
+ return agentType === "antigravity" ? getAntigravitySpawnEnv(env) : env;
76138
+ };
75305
76139
 
75306
76140
  //#endregion
75307
76141
  //#region ../../packages/heterogeneous-agents/src/spawn/workingDirectory.ts
@@ -75912,16 +76746,17 @@ const spawnAgent = async (options) => {
75912
76746
  };
75913
76747
  /** One-shot JSONL CLI spawn; `spawnAgent` owns the Codex JWT file around it. */
75914
76748
  const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJwtFile) => {
75915
- const liveInput = options.agentType === "claude-code" && options.liveInput === true;
76749
+ const claudeLiveInput = options.agentType === "claude-code" && options.liveInput === true;
76750
+ const antigravityLiveInput = options.agentType === "antigravity" && options.liveInput === true;
75916
76751
  const permissionMode = options.agentType === "claude-code" ? options.permissionMode : void 0;
75917
- const permissionPrompts = liveInput && !!options.askUserBridge;
76752
+ const permissionPrompts = claudeLiveInput && !!options.askUserBridge;
75918
76753
  const args = buildSpawnArgs({
75919
76754
  agentType: options.agentType,
75920
76755
  configArgs: options.agentType === "codex" ? [...buildCodexLobeHubContextArgs(childEnv), ...codexJwtFile?.args ?? []] : void 0,
75921
76756
  extraArgs: options.extraArgs ?? [],
75922
76757
  includePartialMessages: options.includePartialMessages ?? false,
75923
76758
  inputArgs: inputPlan.args,
75924
- liveInput,
76759
+ liveInput: claudeLiveInput,
75925
76760
  permissionMode,
75926
76761
  permissionPrompts,
75927
76762
  resumeSessionId: options.resumeSessionId
@@ -75937,23 +76772,29 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
75937
76772
  home: childEnv.HOME,
75938
76773
  sessionId: options.resumeSessionId
75939
76774
  }) : void 0;
75940
- const cliSpawnPlan = await resolveCliSpawnPlan(command, args);
76775
+ const cliSpawnPlan = await resolveCliSpawnPlan(command, args, childEnv);
75941
76776
  const detached = platform() !== "win32" && (options.detached ?? true);
75942
76777
  const startedAt = Date.now();
75943
76778
  const proc = spawnManaged(cliSpawnPlan.command, cliSpawnPlan.args, {
75944
76779
  cwd,
75945
76780
  detached,
75946
- env: childEnv,
76781
+ env: cliSpawnPlan.env ?? childEnv,
75947
76782
  stdio: [
75948
76783
  "pipe",
75949
76784
  "pipe",
75950
76785
  "pipe"
75951
76786
  ]
75952
76787
  });
76788
+ const claudeLive = claudeLiveInput && proc.stdin ? new ClaudeCodeLiveInput(proc.stdin) : void 0;
76789
+ const antigravityLive = antigravityLiveInput && proc.stdin ? new AntigravityLiveInput(proc.stdin) : void 0;
76790
+ const live = claudeLive ?? antigravityLive;
75953
76791
  const pipeline = new AgentStreamPipeline({
75954
- adapter: liveInput ? new ClaudeCodeAdapter({
76792
+ adapter: claudeLive ? new ClaudeCodeAdapter({
75955
76793
  runtimeEndStrategy: "on-transport-close",
75956
76794
  signalBackgroundTaskCompletion: true
76795
+ }) : antigravityLive ? new AntigravityAdapter({
76796
+ runtimeEndStrategy: "on-transport-close",
76797
+ takeNextSteerUuid: () => antigravityLive.takeSteerUuid()
75957
76798
  }) : void 0,
75958
76799
  agentType: options.agentType,
75959
76800
  cwd,
@@ -75999,21 +76840,20 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
75999
76840
  const removeJwtFile = () => codexJwtFile.cleanup();
76000
76841
  exit.then(removeJwtFile, removeJwtFile);
76001
76842
  }
76002
- const live = liveInput && proc.stdin ? new ClaudeCodeLiveInput(proc.stdin) : void 0;
76003
- if (live && permissionMode && permissionPrompts && options.askUserBridge) {
76843
+ if (claudeLive && permissionMode && permissionPrompts && options.askUserBridge) {
76004
76844
  const bridge = options.askUserBridge;
76005
76845
  const isRoot = isRunningAsRoot();
76006
- attachClaudeCodePermissionResponder(live, {
76846
+ attachClaudeCodePermissionResponder(claudeLive, {
76007
76847
  ask: askThroughBridge(bridge),
76008
76848
  cancel: (toolCallId) => bridge.cancel(toolCallId, "session_ended"),
76009
76849
  isRoot
76010
76850
  });
76011
76851
  const reporter = new PermissionModeReporter(options.operationId, resolveClaudeCodePermissionMode(permissionMode, isRoot).fallback);
76012
- live.onControlRequestSent((request, meta) => {
76852
+ claudeLive.onControlRequestSent((request, meta) => {
76013
76853
  const requestedMode = meta?.requestedMode;
76014
76854
  if (request.subtype === "set_permission_mode" && isHeteroPermissionMode(requestedMode)) reporter.requested(requestedMode, isRoot);
76015
76855
  });
76016
- live.subscribe((message) => {
76856
+ claudeLive.subscribe((message) => {
76017
76857
  const event = reporter.observe(message);
76018
76858
  if (!event) return;
76019
76859
  queue.push(event);
@@ -76048,12 +76888,17 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
76048
76888
  if (code === 0 && !killedByUs) events.push(...pipeline.validateCompletion());
76049
76889
  sawErrorEvent ||= events.some((event) => event.type === "error");
76050
76890
  for (const event of events) queue.push(event);
76051
- const liveEnd = resolveClaudeCodeLiveRuntimeEnd(live?.lastTurn, {
76891
+ const liveEnd = claudeLive ? resolveClaudeCodeLiveRuntimeEnd(claudeLive.lastTurn, {
76052
76892
  code,
76053
76893
  killedByHost: killedByUs,
76054
76894
  sawError: sawErrorEvent,
76055
76895
  signal
76056
- });
76896
+ }) : antigravityLive ? resolveAntigravityLiveRuntimeEnd(antigravityLive.lastTurn, {
76897
+ code,
76898
+ killedByHost: killedByUs,
76899
+ sawError: sawErrorEvent,
76900
+ signal
76901
+ }) : void 0;
76057
76902
  if (liveEnd) for (const event of pipeline.completeRuntime(liveEnd)) queue.push(event);
76058
76903
  for (const event of await pipeline.collectPostRunUsage({ env: childEnv })) queue.push(event);
76059
76904
  } catch (err) {
@@ -76099,16 +76944,21 @@ const spawnCliAgent = async (options, command, cwd, inputPlan, childEnv, codexJw
76099
76944
  } };
76100
76945
  } },
76101
76946
  exit,
76102
- ...live && {
76103
- interruptTurn: () => live.interrupt(),
76104
- sendControlRequest: (request) => live.sendControlRequest(request),
76947
+ ...claudeLive && {
76948
+ interruptTurn: () => claudeLive.interrupt(),
76949
+ sendControlRequest: (request) => claudeLive.sendControlRequest(request),
76105
76950
  sendUserMessage: async (prompt, sendOptions) => {
76106
- if (!live.isOpen) return false;
76951
+ if (!claudeLive.isOpen) return false;
76107
76952
  const plan = await buildAgentInput("claude-code", prompt, options.inputOptions);
76108
- return live.send(plan.stdin, sendOptions?.uuid);
76953
+ return claudeLive.send(plan.stdin, sendOptions?.uuid);
76109
76954
  },
76110
76955
  supportsSteerImageAttachments: true
76111
76956
  },
76957
+ ...antigravityLive && { sendUserMessage: async (prompt, sendOptions) => {
76958
+ if (!antigravityLive.isOpen) return false;
76959
+ const plan = await buildAgentInput("antigravity", prompt, options.inputOptions);
76960
+ return antigravityLive.send(plan.stdin, sendOptions?.uuid);
76961
+ } },
76112
76962
  kill: (signal = "SIGINT") => {
76113
76963
  killedByUs = true;
76114
76964
  live?.close();
@@ -76369,14 +77219,15 @@ const requestViaRpc = async (options, { failureMessage, method, params, timeoutM
76369
77219
  timeout = setTimeout(() => {
76370
77220
  settleError(/* @__PURE__ */ new Error(`${failureMessage}: RPC timed out`), true);
76371
77221
  }, timeoutMs);
76372
- resolveCliSpawnPlan(options.command ?? "codex", rpcArgs).then((spawnPlan) => {
77222
+ const childEnv = {
77223
+ ...process.env,
77224
+ ...options.env,
77225
+ ...options.codexHomePath ? { CODEX_HOME: options.codexHomePath } : {}
77226
+ };
77227
+ resolveCliSpawnPlan(options.command ?? "codex", rpcArgs, childEnv).then((spawnPlan) => {
76373
77228
  if (finished) return;
76374
77229
  child = spawn(spawnPlan.command, spawnPlan.args, {
76375
- env: {
76376
- ...process.env,
76377
- ...options.env,
76378
- ...options.codexHomePath ? { CODEX_HOME: options.codexHomePath } : {}
76379
- },
77230
+ env: spawnPlan.env ?? childEnv,
76380
77231
  stdio: [
76381
77232
  "pipe",
76382
77233
  "pipe",
@@ -305735,6 +306586,7 @@ const listCodexModels = async ({ args = [], commandPath, cwd, env, timeoutMs })
305735
306586
  //#endregion
305736
306587
  //#region ../../packages/heterogeneous-agents/src/models/listHeterogeneousAgentModels.ts
305737
306588
  init_object$1();
306589
+ init_config();
305738
306590
  init_cliSpawn();
305739
306591
  init_resolveCliCommand();
305740
306592
  const execFilePromise = promisify(execFile);
@@ -305956,6 +306808,7 @@ const classifyCatalogError = (error) => {
305956
306808
  };
305957
306809
  const getCatalogErrorMessage = (code, type) => {
305958
306810
  const name = getHeterogeneousTypeLabel(type) ?? type;
306811
+ if (code === "auth_required") return `Sign in to the ${name} CLI on the execution device`;
305959
306812
  if (code === "cli_not_found") return `${name} CLI was not found`;
305960
306813
  if (code === "timeout") return `${name} model discovery timed out`;
305961
306814
  return `${name} model discovery failed`;
@@ -305989,10 +306842,11 @@ const listHeterogeneousAgentModels = async (params) => {
305989
306842
  const callerEnv = params.env ?? process.env;
305990
306843
  const resolved = await resolveCatalogCommand(params, callerEnv);
305991
306844
  const mergedPath = [...new Set([callerEnv.PATH, resolved.pathEnv].filter(Boolean).join(path.delimiter).split(path.delimiter))].filter(Boolean).join(path.delimiter);
305992
- const env = {
306845
+ const mergedEnv = {
305993
306846
  ...callerEnv,
305994
306847
  ...mergedPath ? { PATH: mergedPath } : {}
305995
306848
  };
306849
+ const env = params.type === "antigravity" ? getAntigravitySpawnEnv(mergedEnv) : mergedEnv;
305996
306850
  try {
305997
306851
  if (params.type === "codex") return {
305998
306852
  models: await listCodexModels({
@@ -306060,11 +306914,11 @@ const listHeterogeneousAgentModels = async (params) => {
306060
306914
  "list",
306061
306915
  "--json"
306062
306916
  ] : params.type === "pi" ? buildPiCatalogArgs(params.args) : ["--list-models"];
306063
- const spawnPlan = await resolveCliSpawnPlan(resolved.command, args);
306917
+ const spawnPlan = await resolveCliSpawnPlan(resolved.command, args, env);
306064
306918
  const { stderr, stdout } = await execFilePromise(spawnPlan.command, spawnPlan.args, {
306065
306919
  cwd,
306066
306920
  encoding: "utf8",
306067
- env,
306921
+ env: spawnPlan.env ?? env,
306068
306922
  maxBuffer: MODEL_CATALOG_MAX_BUFFER,
306069
306923
  timeout: MODEL_CATALOG_TIMEOUT_MS,
306070
306924
  windowsHide: true
@@ -306091,7 +306945,8 @@ const listHeterogeneousAgentModels = async (params) => {
306091
306945
  updatedAt
306092
306946
  };
306093
306947
  } catch (error) {
306094
- const code = classifyCatalogError(error);
306948
+ const { stderr } = getErrorRecord(error);
306949
+ const code = params.type === "antigravity" && isHeterogeneousAgentAuthRequired(params.type, String(stderr ?? "")) ? "auth_required" : classifyCatalogError(error);
306095
306950
  return {
306096
306951
  error: {
306097
306952
  code,
@@ -309859,13 +310714,13 @@ var init_dialects_BAIiebX0 = __esmMin((() => {
309859
310714
  }));
309860
310715
 
309861
310716
  //#endregion
309862
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/index.js
310717
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/index.js
309863
310718
  var init_classic = __esmMin((() => {
309864
310719
  init_external$1();
309865
310720
  }));
309866
310721
 
309867
310722
  //#endregion
309868
- //#region node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/index.js
310723
+ //#region node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/index.js
309869
310724
  var init_v4 = __esmMin((() => {
309870
310725
  init_classic();
309871
310726
  }));
@@ -324951,7 +325806,7 @@ var init_shimsNode = __esmMin((() => {
324951
325806
  }));
324952
325807
 
324953
325808
  //#endregion
324954
- //#region node_modules/.pnpm/pkce-challenge@5.0.1/node_modules/pkce-challenge/dist/index.node.js
325809
+ //#region node_modules/.pnpm/pkce-challenge@5.0.2/node_modules/pkce-challenge/dist/index.node.js
324955
325810
  /**
324956
325811
  * Creates an array of length `size` of random bytes
324957
325812
  * @param size
@@ -335129,7 +335984,7 @@ var init_client = __esmMin((() => {
335129
335984
  name: toolName
335130
335985
  }, timeout === void 0 ? void 0 : { timeout });
335131
335986
  } catch (error) {
335132
- if (SdkError$1.isInstance(error) && error.code === SdkErrorCode$2.UnsupportedResultType && toRecord(error.data)?.resultType === "input_required") return {
335987
+ if (SdkError$1.isInstance(error) && error.code === SdkErrorCode$2.UnsupportedResultType && toRecord$1(error.data)?.resultType === "input_required") return {
335133
335988
  content: [{
335134
335989
  type: "text",
335135
335990
  text: "This MCP tool requires user input that LobeHub does not support yet. Use a tool that does not require additional input."
@@ -344899,6 +345754,7 @@ const createFileSearchModule = (toolDetector) => {
344899
345754
  //#endregion
344900
345755
  //#region src/device/systemInfo.ts
344901
345756
  init_resolveCliCommand();
345757
+ init_src$2();
344902
345758
  /**
344903
345759
  * Checks the currently resolved Codex binary without creating a conversation.
344904
345760
  *
@@ -344953,9 +345809,12 @@ async function supportsNativeCodex() {
344953
345809
  client?.close();
344954
345810
  }
344955
345811
  }
344956
- /** Native agent runtimes the resolved binaries support; one handshake per call. */
345812
+ /**
345813
+ * Native agent runtimes the resolved binaries support; one handshake per call.
345814
+ * `codex-collaboration-mode-v1` says this `lh` also takes the Codex Plan switch.
345815
+ */
344957
345816
  async function probeNativeRuntimes() {
344958
- return await supportsNativeCodex() ? ["codex-app-server-v1"] : [];
345817
+ return await supportsNativeCodex() ? ["codex-app-server-v1", CODEX_COLLABORATION_MODE_RUNTIME] : [];
344959
345818
  }
344960
345819
  /**
344961
345820
  * The answer to a gateway `system_info_request`: host paths and live native capabilities.
@@ -555151,6 +556010,7 @@ function startHeteroAgentRun(params, accountEnv, logger) {
555151
556010
  ...extraArgs ?? []
555152
556011
  ];
555153
556012
  const stdinPayload = buildHeteroExecStdinPayload({
556013
+ collaborationMode: params.collaborationMode,
555154
556014
  imageList,
555155
556015
  isNewSession: !resumeSessionId,
555156
556016
  permissionMode: params.permissionMode,
@@ -555320,10 +556180,13 @@ const resolveRemotePlatformRuntime = async (type, baseEnv = process.env) => {
555320
556180
  };
555321
556181
  const validatedPath = status.path;
555322
556182
  const env = buildRemotePlatformEnvironment(status, baseEnv);
555323
- const prepareSpawn = async (args) => ({
555324
- ...await resolveCliSpawnPlan(validatedPath, args, env),
555325
- env
555326
- });
556183
+ const prepareSpawn = async (args) => {
556184
+ const plan = await resolveCliSpawnPlan(validatedPath, args, env);
556185
+ return {
556186
+ ...plan,
556187
+ env: plan.env ?? env
556188
+ };
556189
+ };
555327
556190
  return {
555328
556191
  available: true,
555329
556192
  execute: async (args, options) => executeSpawnPlan(await prepareSpawn(args), options?.timeout),
@@ -557524,6 +558387,7 @@ function bindGatewayClientHandlers(client, ctx, connectionWorkspaceId) {
557524
558387
  args: request.args,
557525
558388
  claudeAccountRouting: request.claudeAccountRouting,
557526
558389
  claudeCodeEntrypoint: request.claudeCodeEntrypoint,
558390
+ collaborationMode: request.collaborationMode,
557527
558391
  cwd: request.cwd,
557528
558392
  imageList: request.imageList,
557529
558393
  jwt: request.jwt,
@@ -557645,6 +558509,7 @@ function registerConnectCommand(program) {
557645
558509
  }
557646
558510
  if (options.daemon) return handleDaemonStart(options);
557647
558511
  const isServiceChild = options.serviceChild || process.env.LOBEHUB_CONNECT_SERVICE === "1";
558512
+ if (isServiceChild) process.env.LOBEHUB_CONNECT_SERVICE = "1";
557648
558513
  await runConnect(options, options.daemonChild || isServiceChild || process.env.LOBEHUB_DAEMON === "1");
557649
558514
  });
557650
558515
  connectCmd.command("capabilities").description("Report native agent runtimes supported by this CLI and installed binaries").action(async () => {
@@ -581152,7 +582017,7 @@ var WebStandardStreamableHTTPServerTransport = class {
581152
582017
  };
581153
582018
 
581154
582019
  //#endregion
581155
- //#region node_modules/.pnpm/@hono+node-server@2.1.9_hono@4.13.19/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
582020
+ //#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.19/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
581156
582021
  const X_ALREADY_SENT = "x-hono-already-sent";
581157
582022
 
581158
582023
  //#endregion
@@ -581181,7 +582046,7 @@ const defineWebSocketHelper = (handler) => {
581181
582046
  };
581182
582047
 
581183
582048
  //#endregion
581184
- //#region node_modules/.pnpm/@hono+node-server@2.1.9_hono@4.13.19/node_modules/@hono/node-server/dist/index.mjs
582049
+ //#region node_modules/.pnpm/@hono+node-server@2.1.11_hono@4.13.19/node_modules/@hono/node-server/dist/index.mjs
581185
582050
  var RequestError = class extends Error {
581186
582051
  constructor(message, options) {
581187
582052
  super(message, options);
@@ -583047,12 +583912,12 @@ var RpcStdioClient = class {
583047
583912
  */
583048
583913
  async start() {
583049
583914
  if (this.child || this.closed) return;
583050
- const spawnPlan = await resolveCliSpawnPlan(this.options.commandPath, this.options.args);
583915
+ const spawnPlan = await resolveCliSpawnPlan(this.options.commandPath, this.options.args, this.options.env);
583051
583916
  if (this.closed) return;
583052
583917
  const child = spawnManaged(spawnPlan.command, spawnPlan.args, {
583053
583918
  cwd: this.options.cwd,
583054
583919
  detached: process.platform !== "win32" && (this.options.detached ?? true),
583055
- env: this.options.env,
583920
+ env: spawnPlan.env ?? this.options.env,
583056
583921
  stdio: [
583057
583922
  "pipe",
583058
583923
  "pipe",
@@ -583447,7 +584312,7 @@ var PiRpcClient = class {
583447
584312
  version = await new Promise((resolve, reject) => {
583448
584313
  const probe = execFile(plan.command, plan.args, {
583449
584314
  cwd: this.options.cwd,
583450
- env: this.options.env,
584315
+ env: plan.env ?? this.options.env,
583451
584316
  killSignal: "SIGKILL",
583452
584317
  signal: this.probeAbort.signal,
583453
584318
  timeout: 5e3,
@@ -584325,6 +585190,25 @@ const dispatchHeteroControl = async (message, context) => {
584325
585190
  }
584326
585191
  };
584327
585192
 
585193
+ //#endregion
585194
+ //#region src/utils/heteroCollaborationMode.ts
585195
+ init_src$2();
585196
+ /** The control command the server queues when the Codex Plan switch flips mid-run. */
585197
+ const HETERO_SET_COLLABORATION_MODE_COMMAND = "set_collaboration_mode";
585198
+ /**
585199
+ * Switch a running native Codex thread's collaboration mode (the composer's
585200
+ * Plan switch). Codex takes it from the next turn: `thread/settings/update`
585201
+ * never changes the turn in flight. Reports the mode that was set.
585202
+ */
585203
+ const setCollaborationModeHandler = async ({ params, setCollaborationMode }) => {
585204
+ const mode = params?.mode;
585205
+ if (!isCodexCollaborationMode(mode)) throw new Error("set_collaboration_mode needs a valid mode");
585206
+ if (!setCollaborationMode) throw new Error("This run is not a native Codex thread");
585207
+ await setCollaborationMode(mode);
585208
+ return { mode };
585209
+ };
585210
+ registerHeteroControlHandler(HETERO_SET_COLLABORATION_MODE_COMMAND, setCollaborationModeHandler);
585211
+
584328
585212
  //#endregion
584329
585213
  //#region src/utils/heteroPermissionMode.ts
584330
585214
  init_src$2();
@@ -584421,6 +585305,7 @@ async function* withHeteroSteer(handle, context) {
584421
585305
  }
584422
585306
  const { operationId } = context;
584423
585307
  const sendControlRequest = handle.sendControlRequest;
585308
+ const setCollaborationMode = handle.setCollaborationMode;
584424
585309
  const delivered = /* @__PURE__ */ new Set();
584425
585310
  const abort = new AbortController();
584426
585311
  const handling = /* @__PURE__ */ new Set();
@@ -584451,7 +585336,8 @@ async function* withHeteroSteer(handle, context) {
584451
585336
  log$15.debug("Control %s: %s", control.id, control.command);
584452
585337
  await report(client, control, await dispatchHeteroControl(control, {
584453
585338
  operationId,
584454
- sendControlRequest,
585339
+ sendControlRequest: sendControlRequest ?? (() => void 0),
585340
+ setCollaborationMode,
584455
585341
  signal: abort.signal
584456
585342
  }));
584457
585343
  })().catch((error) => log$15.debug("Control %s failed: %s", control.id, String(error))).finally(() => handling.delete(task));
@@ -584459,14 +585345,14 @@ async function* withHeteroSteer(handle, context) {
584459
585345
  };
584460
585346
  const poll = async () => {
584461
585347
  const client = await context.getTrpcClient();
584462
- const acceptsControl = !!sendControlRequest && !!client.aiAgent.reportHeteroControlResult;
585348
+ const acceptsControl = (!!sendControlRequest || !!setCollaborationMode) && !!client.aiAgent.reportHeteroControlResult;
584463
585349
  while (!abort.signal.aborted) {
584464
585350
  let message;
584465
585351
  try {
584466
585352
  const res = await client.aiAgent.waitHeteroSteer.mutate({
584467
585353
  ...acceptsControl && { acceptsControl: true },
584468
585354
  ...handle.supportsSteerImageAttachments && { acceptsImageAttachments: true },
584469
- acceptsImages: true,
585355
+ ...handle.supportsSteerImages !== false && { acceptsImages: true },
584470
585356
  ...!answered && { blockMs: 1 },
584471
585357
  ...waitingForUser() && { holdSteer: true },
584472
585358
  operationId
@@ -584747,6 +585633,18 @@ const buildExtraArgs = (options) => {
584747
585633
  return extraArgs.length > 0 ? extraArgs : void 0;
584748
585634
  };
584749
585635
 
585636
+ //#endregion
585637
+ //#region src/commands/hetero/dispatchedModes.ts
585638
+ /**
585639
+ * The Better Coding Experience modes the dispatch envelope carried, as spawn
585640
+ * options for the agent they belong to: Claude Code's permission mode, and the
585641
+ * Codex Plan switch (collaboration mode).
585642
+ */
585643
+ const dispatchedModeSpawnOptions = (agentType, resolved) => ({
585644
+ ...agentType === "claude-code" && resolved.permissionMode && { permissionMode: resolved.permissionMode },
585645
+ ...agentType === "codex" && resolved.collaborationMode && { collaborationMode: resolved.collaborationMode }
585646
+ });
585647
+
584750
585648
  //#endregion
584751
585649
  //#region src/commands/hetero/prompt.ts
584752
585650
  init_src$2();
@@ -584796,9 +585694,10 @@ const parseImageArg = (value) => {
584796
585694
  * Accepts:
584797
585695
  * - `'plain text'` → single text block
584798
585696
  * - `[{ type: 'text', text }, { type: 'image', source }]` → content blocks
584799
- * - `{ content: [...], resumeFallback?: [...], permissionMode? }` → unwraps the
584800
- * primary prompt, reserves the fallback for a retry without native resume,
584801
- * and takes the Claude Code permission mode the run was dispatched with
585697
+ * - `{ content: [...], resumeFallback?: [...], permissionMode?, collaborationMode? }`
585698
+ * → unwraps the primary prompt, reserves the fallback for a retry without
585699
+ * native resume, and takes the Claude Code permission mode / Codex Plan
585700
+ * switch the run was dispatched with
584802
585701
  * - `{ type: 'text', ... } | { type: 'image', ... }` → single block
584803
585702
  */
584804
585703
  const coerceJsonPrompt = (parsed) => {
@@ -584808,6 +585707,7 @@ const coerceJsonPrompt = (parsed) => {
584808
585707
  const obj = parsed;
584809
585708
  if (Array.isArray(obj.content)) return {
584810
585709
  ...isHeteroPermissionMode(obj.permissionMode) && { permissionMode: obj.permissionMode },
585710
+ ...isCodexCollaborationMode(obj.collaborationMode) && { collaborationMode: obj.collaborationMode },
584811
585711
  prompt: obj.content,
584812
585712
  ...Array.isArray(obj.resumeFallback) ? { resumeFallbackPrompt: obj.resumeFallback } : {}
584813
585713
  };
@@ -584920,6 +585820,7 @@ const spawnAgentOrRuntime = (spawnOpts, onRawStdout, onStartupControl, nativeCod
584920
585820
  askUserBridge: spawnOpts.askUserBridge,
584921
585821
  clientVersion: cliVersion,
584922
585822
  args: spawnOpts.extraArgs ?? [],
585823
+ collaborationMode: spawnOpts.collaborationMode,
584923
585824
  commandPath: spawnOpts.command,
584924
585825
  cwd: spawnOpts.cwd ?? process.cwd(),
584925
585826
  env: {
@@ -584945,20 +585846,16 @@ const spawnAgentOrRuntime = (spawnOpts, onRawStdout, onStartupControl, nativeCod
584945
585846
  /**
584946
585847
  * Patterns that indicate a `--resume <sessionId>` run should be retried
584947
585848
  * without `--resume`. Two classes of failure:
584948
- *
584949
585849
  * 1. Session file missing (sandbox recycled): the container is ephemeral
584950
585850
  * (~1 h idle TTL), so a new sandbox has an empty `~/.claude/projects/`
584951
585851
  * and the stored session id is stale.
584952
- *
584953
585852
  * 2. Context overflow (long conversation): the resumed session carries all
584954
- * accumulated history; when the combined token count exceeds the model's
584955
- * context window the API rejects the request immediately after CC
584956
- * initialises. Starting fresh (no `--resume`) drops the old history and
584957
- * lets CC respond to the new prompt alone.
585853
+ * accumulated history past the model's context window, so the API rejects
585854
+ * the request right after CC initialises. Starting fresh (no `--resume`)
585855
+ * drops the old history and lets CC respond to the new prompt alone.
584958
585856
  *
584959
- * Checked against:
584960
- * - `error` stream events emitted by the CC adapter from CC's result event
584961
- * - Accumulated stderr output (fallback when CC exits without a result event)
585857
+ * Checked against `error` stream events (from CC's result event) and, when CC
585858
+ * exits without a result event, the accumulated stderr output.
584962
585859
  */
584963
585860
  const RESUME_RETRY_PATTERNS = [
584964
585861
  /no conversation found/i,
@@ -585115,13 +586012,15 @@ const exec = async (options) => {
585115
586012
  session?.dispose().catch(() => {});
585116
586013
  };
585117
586014
  try {
586015
+ const dshCommand = await resolveDshSpawnCommand(options.command);
585118
586016
  session = spawnDshAcpSession({
585119
586017
  args: options.agentArg,
585120
586018
  clientVersion: "lobehub-cli",
585121
- command: options.command,
586019
+ command: dshCommand.command,
585122
586020
  cwd: options.cwd || process.cwd(),
585123
586021
  env: buildAgentProcessEnv({
585124
586022
  operationId: serverIngest ? operationId : void 0,
586023
+ pathEnv: dshCommand.pathEnv,
585125
586024
  topicId: options.topic
585126
586025
  }),
585127
586026
  model: options.model,
@@ -585514,9 +586413,9 @@ const exec = async (options) => {
585514
586413
  extraArgs,
585515
586414
  includePartialMessages: options.type === "claude-code",
585516
586415
  initialModel: usesHeterogeneousSessionInitialModel(options.type) ? options.model : void 0,
585517
- liveInput: options.type === "claude-code",
586416
+ liveInput: options.type === "claude-code" || options.type === "antigravity",
585518
586417
  operationId,
585519
- ...options.type === "claude-code" && resolved.permissionMode && { permissionMode: resolved.permissionMode },
586418
+ ...dispatchedModeSpawnOptions(options.type, resolved),
585520
586419
  uploadImage
585521
586420
  };
585522
586421
  const first = await runOneAgent({
@@ -591043,6 +591942,38 @@ function registerTopicCommands(task) {
591043
591942
  });
591044
591943
  }
591045
591944
 
591945
+ //#endregion
591946
+ //#region src/commands/task/visibility.ts
591947
+ const TASK_VISIBILITIES = ["private", "public"];
591948
+ const VISIBILITY_OPTION_DESCRIPTION = "Task visibility: private (only you) or public (the whole workspace)";
591949
+ /** Validate `--visibility`; throws a message listing the accepted values. */
591950
+ const parseVisibility = (value) => {
591951
+ if (value === void 0) return void 0;
591952
+ const normalized = value.trim().toLowerCase();
591953
+ if (TASK_VISIBILITIES.includes(normalized)) return normalized;
591954
+ throw new Error(`Invalid visibility "${value}". Must be one of: ${TASK_VISIBILITIES.join(", ")}`);
591955
+ };
591956
+ const PRIVATE_AGENT_ON_PUBLIC_TASK = /public task cannot be assigned to a private agent/i;
591957
+ /**
591958
+ * Append how to fix a failed create / edit when the server's message has a
591959
+ * CLI-side remedy. The server message itself is kept verbatim; other errors
591960
+ * pass through unchanged so the global handler still recognizes them.
591961
+ */
591962
+ const withVisibilityHint = (error, context) => {
591963
+ const message = formatError(error);
591964
+ if (!PRIVATE_AGENT_ON_PUBLIC_TASK.test(message)) return error;
591965
+ const hint = context.command === "create" ? "Create it with `--visibility private` instead." : `Add \`--visibility private\` to this command, or run \`lh task edit ${context.id} --visibility private\` first (only the task creator can make it private).`;
591966
+ return /* @__PURE__ */ new Error(`${message}\nHint: ${hint}`);
591967
+ };
591968
+ /**
591969
+ * Prefix a failed `updateVisibility` call with what was being attempted; the
591970
+ * server's reason (e.g. only the creator can make a task private) stays
591971
+ * verbatim. `appliedOtherEdits` notes that the rest of the edit already landed.
591972
+ */
591973
+ const describeVisibilityError = (error, id, visibility, appliedOtherEdits = false) => {
591974
+ return /* @__PURE__ */ new Error(`Could not make ${id} ${visibility}${appliedOtherEdits ? " (the other changes in this command were applied)" : ""}: ${formatError(error)}`);
591975
+ };
591976
+
591046
591977
  //#endregion
591047
591978
  //#region src/commands/task/index.ts
591048
591979
  init_src$2();
@@ -591370,10 +592301,12 @@ function registerTaskCommand(program) {
591370
592301
  }
591371
592302
  console.log();
591372
592303
  });
591373
- task.command("create").description("Create a new task").requiredOption("-i, --instruction <text>", "Task instruction").option("-n, --name <name>", "Task name").option("--agent <id>", "Assign to agent").option("--user <idOrEmail>", "Assign to a workspace member (user id, email or username)").option("--parent <id>", "Parent task ID").option("--priority <n>", "Priority (0=none, 1=urgent, 2=high, 3=normal, 4=low)", "0").option("--label <name>", "Attach an existing label (repeatable or comma-separated; \"Group/Label\" also works)", collectLabels).option("--model <model>", "Model to run with (default: the assignee agent's model)").option("--provider <provider>", "Provider for --model (default: resolved from the agent)").option("--origin-agent <id>", "Agent to notify when the task finishes (requires --origin-topic)").option("--origin-topic <id>", "Your conversation (topic) that receives the result card (requires --origin-agent)").option("--origin-message <id>", "Message in the origin topic the task was created from").option("--origin-operation <id>", "Operation that created the task").option("--origin-tool-call <id>", "Tool call that created the task").option("--json [fields]", "Output JSON").action(async (options) => {
592304
+ task.command("create").description("Create a new task").requiredOption("-i, --instruction <text>", "Task instruction").option("-n, --name <name>", "Task name").option("--agent <id>", "Assign to agent").option("--user <idOrEmail>", "Assign to a workspace member (user id, email or username)").option("--parent <id>", "Parent task ID").option("--priority <n>", "Priority (0=none, 1=urgent, 2=high, 3=normal, 4=low)", "0").option("--visibility <visibility>", `${VISIBILITY_OPTION_DESCRIPTION}. Default: inherited from --parent, private for a private --agent, otherwise public`).option("--label <name>", "Attach an existing label (repeatable or comma-separated; \"Group/Label\" also works)", collectLabels).option("--model <model>", "Model to run with (default: the assignee agent's model)").option("--provider <provider>", "Provider for --model (default: resolved from the agent)").option("--origin-agent <id>", "Agent to notify when the task finishes (requires --origin-topic)").option("--origin-topic <id>", "Your conversation (topic) that receives the result card (requires --origin-agent)").option("--origin-message <id>", "Message in the origin topic the task was created from").option("--origin-operation <id>", "Operation that created the task").option("--origin-tool-call <id>", "Tool call that created the task").option("--json [fields]", "Output JSON").action(async (options) => {
591374
592305
  let origin;
592306
+ let visibility;
591375
592307
  try {
591376
592308
  origin = toCreateOrigin(options);
592309
+ visibility = parseVisibility(options.visibility);
591377
592310
  } catch (error) {
591378
592311
  log$15.error(error.message);
591379
592312
  process.exitCode = 1;
@@ -591395,7 +592328,10 @@ function registerTaskCommand(program) {
591395
592328
  const modelConfig = toCreateModelConfig(options);
591396
592329
  if (modelConfig) input.config = modelConfig;
591397
592330
  if (origin) input.context = { origin };
591398
- const result = await client.task.create.mutate(input);
592331
+ if (visibility) input.visibility = visibility;
592332
+ const result = await client.task.create.mutate(input).catch((error) => {
592333
+ throw withVisibilityHint(error, { command: "create" });
592334
+ });
591399
592335
  const url = buildUrl(taskPath(result.data.identifier, result.data.name));
591400
592336
  if (options.json !== void 0) {
591401
592337
  outputJson({
@@ -591408,7 +592344,15 @@ function registerTaskCommand(program) {
591408
592344
  console.log(`ID: ${result.data.id}`);
591409
592345
  console.log(`${import_picocolors.default.bold("task")}: ${url}`);
591410
592346
  });
591411
- task.command("edit <id>").description("Update a task").option("-n, --name <name>", "Task name").option("-i, --instruction <text>", "Task instruction").option("--agent <id>", "Assign to agent").option("--user <idOrEmail>", "Assign to a workspace member (user id, email or username)").option("--priority <n>", "Priority (0-4)").option("--project <id>", "Move to a project (\"null\" to remove it from its project)").option("--label <name>", "Add a label (repeatable or comma-separated; replaces the task's other label of the same group)", collectLabels).option("--remove-label <name>", "Remove a label (repeatable or comma-separated)", collectLabels).option("--heartbeat-interval <n>", "Heartbeat interval in seconds").option("--heartbeat-timeout <n>", "Heartbeat timeout in seconds (0 to disable)").option("--description <text>", "Task description").option("--model <model>", "Model to run with (\"null\" to follow the assignee agent again)").option("--provider <provider>", "Provider for the model (default: resolved from the agent)").option("--status <status>", "Set status (backlog, running, paused, completed, failed, canceled)").option("--json [fields]", "Output JSON").action(async (id, options) => {
592347
+ task.command("edit <id>").description("Update a task").option("-n, --name <name>", "Task name").option("-i, --instruction <text>", "Task instruction").option("--agent <id>", "Assign to agent").option("--user <idOrEmail>", "Assign to a workspace member (user id, email or username)").option("--priority <n>", "Priority (0-4)").option("--visibility <visibility>", `${VISIBILITY_OPTION_DESCRIPTION}. Only the task creator can make a task private`).option("--project <id>", "Move to a project (\"null\" to remove it from its project)").option("--label <name>", "Add a label (repeatable or comma-separated; replaces the task's other label of the same group)", collectLabels).option("--remove-label <name>", "Remove a label (repeatable or comma-separated)", collectLabels).option("--heartbeat-interval <n>", "Heartbeat interval in seconds").option("--heartbeat-timeout <n>", "Heartbeat timeout in seconds (0 to disable)").option("--description <text>", "Task description").option("--model <model>", "Model to run with (\"null\" to follow the assignee agent again)").option("--provider <provider>", "Provider for the model (default: resolved from the agent)").option("--status <status>", "Set status (backlog, running, paused, completed, failed, canceled)").option("--json [fields]", "Output JSON").action(async (id, options) => {
592348
+ let visibility;
592349
+ try {
592350
+ visibility = parseVisibility(options.visibility);
592351
+ } catch (error) {
592352
+ log$15.error(error.message);
592353
+ process.exitCode = 1;
592354
+ return;
592355
+ }
591412
592356
  const client = await getTrpcClient();
591413
592357
  const assigneeUserId = await resolveUserOption(client, options.user);
591414
592358
  if (assigneeUserId === false) return;
@@ -591446,6 +592390,27 @@ function registerTaskCommand(program) {
591446
592390
  process.exitCode = 1;
591447
592391
  return;
591448
592392
  }
592393
+ const changeVisibility = (target, appliedOtherEdits) => client.task.updateVisibility.mutate({
592394
+ id,
592395
+ visibility: target
592396
+ }).catch((error) => {
592397
+ throw describeVisibilityError(error, id, target, appliedOtherEdits);
592398
+ });
592399
+ const applyPublic = async () => visibility === "public" ? (await changeVisibility("public", true)).data : {};
592400
+ const afterPrivate = (error) => {
592401
+ if (visibility !== "private") throw error;
592402
+ throw new Error(`${formatError(error)} (${id} was already made private)`);
592403
+ };
592404
+ if (visibility && !(hasLabelEdits || hasFieldEdits || options.status)) {
592405
+ const result = await changeVisibility(visibility, false);
592406
+ if (options.json !== void 0) outputJson(withUrl(result.data, await resolveUrlBuilder(client), resourcePath.task(result.data)), typeof options.json === "string" ? options.json : void 0);
592407
+ else {
592408
+ log$15.info(`${import_picocolors.default.bold(result.data.identifier)} is now ${visibility}`);
592409
+ console.log(`ID: ${result.data.id}`);
592410
+ }
592411
+ return;
592412
+ }
592413
+ if (visibility === "private") await changeVisibility("private", false);
591449
592414
  const hasOtherEdits = hasFieldEdits || !!options.status;
591450
592415
  const readLabels = async () => (await client.task.detail.query({ id })).data?.labels ?? [];
591451
592416
  const previousLabels = hasLabelEdits && hasOtherEdits ? await readLabels() : void 0;
@@ -591469,8 +592434,9 @@ function registerTaskCommand(program) {
591469
592434
  add: addLabelIds,
591470
592435
  remove: removeLabelIds,
591471
592436
  taskId: id
591472
- });
592437
+ }).catch(afterPrivate);
591473
592438
  if (hasLabelEdits && !hasOtherEdits) {
592439
+ await applyPublic();
591474
592440
  if (options.json !== void 0) {
591475
592441
  const { data } = await client.task.find.query({ id });
591476
592442
  outputJson(withUrl({
@@ -591485,8 +592451,12 @@ function registerTaskCommand(program) {
591485
592451
  const result = await client.task.updateStatus.mutate({
591486
592452
  id,
591487
592453
  status: options.status
591488
- }).catch(restoreLabelsOnFailure);
591489
- if (options.json !== void 0) outputJson(withUrl(result.data, await resolveUrlBuilder(client), resourcePath.task(result.data)), typeof options.json === "string" ? options.json : void 0);
592454
+ }).catch(restoreLabelsOnFailure).catch(afterPrivate);
592455
+ const promoted = await applyPublic();
592456
+ if (options.json !== void 0) outputJson(withUrl({
592457
+ ...result.data,
592458
+ ...promoted
592459
+ }, await resolveUrlBuilder(client), resourcePath.task(result.data)), typeof options.json === "string" ? options.json : void 0);
591490
592460
  else {
591491
592461
  log$15.info(`${import_picocolors.default.bold(result.data.identifier)} → ${options.status}`);
591492
592462
  console.log(`ID: ${result.data.id}`);
@@ -591495,12 +592465,19 @@ function registerTaskCommand(program) {
591495
592465
  }
591496
592466
  input.status = options.status;
591497
592467
  }
591498
- const result = await client.task.update.mutate(input).catch(restoreLabelsOnFailure);
592468
+ const result = await client.task.update.mutate(input).catch(restoreLabelsOnFailure).catch((error) => {
592469
+ throw withVisibilityHint(error, {
592470
+ command: "edit",
592471
+ id
592472
+ });
592473
+ }).catch(afterPrivate);
592474
+ const promoted = await applyPublic();
591499
592475
  if (options.json !== void 0) {
591500
- outputJson(withUrl(labels ? {
592476
+ outputJson(withUrl({
591501
592477
  ...result.data,
591502
- labels
591503
- } : result.data, await resolveUrlBuilder(client), resourcePath.task(result.data)), typeof options.json === "string" ? options.json : void 0);
592478
+ ...promoted,
592479
+ ...labels ? { labels } : {}
592480
+ }, await resolveUrlBuilder(client), resourcePath.task(result.data)), typeof options.json === "string" ? options.json : void 0);
591504
592481
  return;
591505
592482
  }
591506
592483
  const statusSuffix = options.status ? ` → ${options.status}` : "";