ente-cli 0.4.129 → 0.4.131

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/cli.mjs CHANGED
@@ -86,8 +86,8 @@ var require_lib = __commonJS({
86
86
  var base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
87
87
  var uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i;
88
88
  var iso8601RegExp = /^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;
89
- function pushError({ errors, p } = {}, message3) {
90
- errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message3}`);
89
+ function pushError({ errors, p } = {}, message4) {
90
+ errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message4}`);
91
91
  return false;
92
92
  }
93
93
  function makeSetter(target3, key) {
@@ -3265,7 +3265,7 @@ var init_query_impl = __esm({
3265
3265
  version: version4
3266
3266
  });
3267
3267
  return {
3268
- page: page3.map((json4) => jsonToConvex2(json4)),
3268
+ page: page3.map((json3) => jsonToConvex2(json3)),
3269
3269
  isDone,
3270
3270
  continueCursor,
3271
3271
  splitCursor,
@@ -5242,8 +5242,8 @@ var IS_DEBUG = process.env.DEBUG_CLI === `1`;
5242
5242
 
5243
5243
  // node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/errors.mjs
5244
5244
  var UsageError = class extends Error {
5245
- constructor(message3) {
5246
- super(message3);
5245
+ constructor(message4) {
5246
+ super(message4);
5247
5247
  this.clipanion = { type: `usage` };
5248
5248
  this.name = `UsageError`;
5249
5249
  }
@@ -5301,9 +5301,9 @@ ${whileRunning(input2)}`;
5301
5301
  var whileRunning = (input2) => `While running ${input2.filter((token) => {
5302
5302
  return token !== SpecialToken.EndOfInput && token !== SpecialToken.EndOfPartialInput;
5303
5303
  }).map((token) => {
5304
- const json4 = JSON.stringify(token);
5305
- if (token.match(/\s/) || token.length === 0 || json4 !== `"${token}"`) {
5306
- return json4;
5304
+ const json3 = JSON.stringify(token);
5305
+ if (token.match(/\s/) || token.length === 0 || json3 !== `"${token}"`) {
5306
+ return json3;
5307
5307
  } else {
5308
5308
  return token;
5309
5309
  }
@@ -5323,8 +5323,8 @@ function rerouteArguments(a, b) {
5323
5323
  return [a, b];
5324
5324
  }
5325
5325
  }
5326
- function cleanValidationError(message3, { mergeName = false } = {}) {
5327
- const match = message3.match(/^([^:]+): (.*)$/m);
5326
+ function cleanValidationError(message4, { mergeName = false } = {}) {
5327
+ const match = message4.match(/^([^:]+): (.*)$/m);
5328
5328
  if (!match)
5329
5329
  return `validation failed`;
5330
5330
  let [, path11, line] = match;
@@ -5333,11 +5333,11 @@ function cleanValidationError(message3, { mergeName = false } = {}) {
5333
5333
  line = path11 !== `.` || !mergeName ? `${path11.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
5334
5334
  return line;
5335
5335
  }
5336
- function formatError(message3, errors) {
5336
+ function formatError(message4, errors) {
5337
5337
  if (errors.length === 1) {
5338
- return new UsageError(`${message3}${cleanValidationError(errors[0], { mergeName: true })}`);
5338
+ return new UsageError(`${message4}${cleanValidationError(errors[0], { mergeName: true })}`);
5339
5339
  } else {
5340
- return new UsageError(`${message3}:
5340
+ return new UsageError(`${message4}:
5341
5341
  ${errors.map((error62) => `
5342
5342
  - ${cleanValidationError(error62)}`).join(``)}`);
5343
5343
  }
@@ -9266,8 +9266,8 @@ function prefixIssues(path11, issues) {
9266
9266
  return iss;
9267
9267
  });
9268
9268
  }
9269
- function unwrapMessage(message3) {
9270
- return typeof message3 === "string" ? message3 : message3?.message;
9269
+ function unwrapMessage(message4) {
9270
+ return typeof message4 === "string" ? message4 : message4?.message;
9271
9271
  }
9272
9272
  function sizeCaps(defChecks) {
9273
9273
  const caps = [];
@@ -9297,7 +9297,7 @@ function finalizeIssue(iss, ctx, config2) {
9297
9297
  iss.schema = iss.inst;
9298
9298
  }
9299
9299
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
9300
- const message3 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
9300
+ const message4 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
9301
9301
  const full = {};
9302
9302
  for (const k of Object.keys(iss)) {
9303
9303
  if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
@@ -9305,7 +9305,7 @@ function finalizeIssue(iss, ctx, config2) {
9305
9305
  full[k] = iss[k];
9306
9306
  }
9307
9307
  full.path ?? (full.path = []);
9308
- full.message = message3;
9308
+ full.message = message4;
9309
9309
  if (ctx?.reportInput) {
9310
9310
  full.input = iss.input;
9311
9311
  }
@@ -21044,8 +21044,8 @@ var globalRegistry = globalThis.__zod_globalRegistry;
21044
21044
  var INVALID = Symbol.for("zod.compile.invalid");
21045
21045
  var FALLBACK_FLAG = Symbol.for("zod.compile.fallback");
21046
21046
  var ZodCompileAsyncError = class extends Error {
21047
- constructor(message3 = "z.compile does not support async refinements, transforms, or checks") {
21048
- super(message3);
21047
+ constructor(message4 = "z.compile does not support async refinements, transforms, or checks") {
21048
+ super(message4);
21049
21049
  this.name = "ZodCompileAsyncError";
21050
21050
  }
21051
21051
  };
@@ -23745,13 +23745,13 @@ function initializeContext(params) {
23745
23745
  external: params?.external ?? void 0
23746
23746
  };
23747
23747
  }
23748
- function handleUnrepresentable(schema, ctx, json4, params, message3) {
23749
- const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message3 }) : ctx.unrepresentable;
23748
+ function handleUnrepresentable(schema, ctx, json3, params, message4) {
23749
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message4 }) : ctx.unrepresentable;
23750
23750
  if (result === "any")
23751
23751
  return false;
23752
23752
  if (result === void 0 || result === "throw")
23753
- throw new Error(message3);
23754
- Object.assign(json4, result);
23753
+ throw new Error(message4);
23754
+ Object.assign(json3, result);
23755
23755
  return true;
23756
23756
  }
23757
23757
  function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
@@ -23987,12 +23987,12 @@ function foldObjects(members2) {
23987
23987
  }
23988
23988
  return folded;
23989
23989
  }
23990
- function foldIntersection(json4) {
23991
- const allOf = json4.allOf;
23990
+ function foldIntersection(json3) {
23991
+ const allOf = json3.allOf;
23992
23992
  if (!Array.isArray(allOf) || allOf.length < 2)
23993
23993
  return;
23994
23994
  for (const key of FOLDABLE_KEYS)
23995
- if (key in json4)
23995
+ if (key in json3)
23996
23996
  return;
23997
23997
  const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
23998
23998
  let folded = null;
@@ -24011,8 +24011,8 @@ function foldIntersection(json4) {
24011
24011
  }
24012
24012
  if (!folded)
24013
24013
  return;
24014
- delete json4.allOf;
24015
- assignProps(json4, folded);
24014
+ delete json3.allOf;
24015
+ assignProps(json3, folded);
24016
24016
  }
24017
24017
  function finalize(ctx, schema) {
24018
24018
  const root = ctx.seen.get(schema);
@@ -24094,20 +24094,20 @@ function finalize(ctx, schema) {
24094
24094
  if (ctx.intersections.length) {
24095
24095
  const carriers = /* @__PURE__ */ new Map();
24096
24096
  for (const seen of ctx.seen.values()) {
24097
- for (const json4 of [seen.schema, seen.def]) {
24098
- const allOf = json4?.allOf;
24097
+ for (const json3 of [seen.schema, seen.def]) {
24098
+ const allOf = json3?.allOf;
24099
24099
  if (!Array.isArray(allOf))
24100
24100
  continue;
24101
24101
  const existing = carriers.get(allOf);
24102
24102
  if (existing)
24103
- existing.push(json4);
24103
+ existing.push(json3);
24104
24104
  else
24105
- carriers.set(allOf, [json4]);
24105
+ carriers.set(allOf, [json3]);
24106
24106
  }
24107
24107
  }
24108
24108
  for (const allOf of ctx.intersections) {
24109
- for (const json4 of carriers.get(allOf) ?? [])
24110
- foldIntersection(json4);
24109
+ for (const json3 of carriers.get(allOf) ?? [])
24110
+ foldIntersection(json3);
24111
24111
  }
24112
24112
  }
24113
24113
  }
@@ -24342,29 +24342,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
24342
24342
  ]);
24343
24343
  var exactPattern = (p) => exactPatterns.get(p) ?? p;
24344
24344
  var stringProcessor = (schema, ctx, _json, _params) => {
24345
- const json4 = _json;
24346
- json4.type = "string";
24345
+ const json3 = _json;
24346
+ json3.type = "string";
24347
24347
  const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
24348
24348
  if (typeof minimum === "number")
24349
- json4.minLength = minimum;
24349
+ json3.minLength = minimum;
24350
24350
  if (typeof maximum === "number")
24351
- json4.maxLength = maximum;
24351
+ json3.maxLength = maximum;
24352
24352
  if (format) {
24353
- json4.format = formatMap[format] ?? format;
24354
- if (json4.format === "")
24355
- delete json4.format;
24353
+ json3.format = formatMap[format] ?? format;
24354
+ if (json3.format === "")
24355
+ delete json3.format;
24356
24356
  if (format === "time" || laxFormat) {
24357
- delete json4.format;
24357
+ delete json3.format;
24358
24358
  }
24359
24359
  }
24360
24360
  if (contentEncoding)
24361
- json4.contentEncoding = contentEncoding;
24361
+ json3.contentEncoding = contentEncoding;
24362
24362
  if (patterns && patterns.size > 0) {
24363
24363
  const patternList = [...patterns].map(exactPattern);
24364
24364
  if (patternList.length === 1)
24365
- json4.pattern = patternList[0].source;
24365
+ json3.pattern = patternList[0].source;
24366
24366
  else if (patternList.length > 1) {
24367
- json4.allOf = [
24367
+ json3.allOf = [
24368
24368
  ...patternList.map((regex) => ({
24369
24369
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
24370
24370
  pattern: regex.source
@@ -24374,31 +24374,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
24374
24374
  }
24375
24375
  };
24376
24376
  var numberProcessor = (schema, ctx, _json, params) => {
24377
- const json4 = _json;
24377
+ const json3 = _json;
24378
24378
  const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
24379
- json4.type = isInt ? "integer" : "number";
24379
+ json3.type = isInt ? "integer" : "number";
24380
24380
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
24381
24381
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
24382
24382
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
24383
24383
  if (exMin) {
24384
24384
  if (legacy) {
24385
- json4.minimum = exclusiveMinimum;
24386
- json4.exclusiveMinimum = true;
24385
+ json3.minimum = exclusiveMinimum;
24386
+ json3.exclusiveMinimum = true;
24387
24387
  } else {
24388
- json4.exclusiveMinimum = exclusiveMinimum;
24388
+ json3.exclusiveMinimum = exclusiveMinimum;
24389
24389
  }
24390
24390
  } else if (typeof minimum === "number") {
24391
- json4.minimum = minimum;
24391
+ json3.minimum = minimum;
24392
24392
  }
24393
24393
  if (exMax) {
24394
24394
  if (legacy) {
24395
- json4.maximum = exclusiveMaximum;
24396
- json4.exclusiveMaximum = true;
24395
+ json3.maximum = exclusiveMaximum;
24396
+ json3.exclusiveMaximum = true;
24397
24397
  } else {
24398
- json4.exclusiveMaximum = exclusiveMaximum;
24398
+ json3.exclusiveMaximum = exclusiveMaximum;
24399
24399
  }
24400
24400
  } else if (typeof maximum === "number") {
24401
- json4.maximum = maximum;
24401
+ json3.maximum = maximum;
24402
24402
  }
24403
24403
  if (multipleOf) {
24404
24404
  const divisors = /* @__PURE__ */ new Set();
@@ -24406,75 +24406,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
24406
24406
  if (Number.isFinite(divisor) && divisor !== 0)
24407
24407
  divisors.add(Math.abs(divisor));
24408
24408
  else
24409
- handleUnrepresentable(schema, ctx, json4, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
24409
+ handleUnrepresentable(schema, ctx, json3, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
24410
24410
  }
24411
24411
  const [first, ...rest] = divisors;
24412
24412
  if (first !== void 0)
24413
- json4.multipleOf = first;
24413
+ json3.multipleOf = first;
24414
24414
  if (rest.length)
24415
- json4.allOf = [...json4.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
24415
+ json3.allOf = [...json3.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
24416
24416
  }
24417
24417
  };
24418
- var booleanProcessor = (_schema2, _ctx, json4, _params) => {
24419
- json4.type = "boolean";
24418
+ var booleanProcessor = (_schema2, _ctx, json3, _params) => {
24419
+ json3.type = "boolean";
24420
24420
  };
24421
- var bigintProcessor = (schema, ctx, json4, params) => {
24422
- handleUnrepresentable(schema, ctx, json4, params, "BigInt cannot be represented in JSON Schema");
24421
+ var bigintProcessor = (schema, ctx, json3, params) => {
24422
+ handleUnrepresentable(schema, ctx, json3, params, "BigInt cannot be represented in JSON Schema");
24423
24423
  };
24424
- var symbolProcessor = (schema, ctx, json4, params) => {
24425
- handleUnrepresentable(schema, ctx, json4, params, "Symbols cannot be represented in JSON Schema");
24424
+ var symbolProcessor = (schema, ctx, json3, params) => {
24425
+ handleUnrepresentable(schema, ctx, json3, params, "Symbols cannot be represented in JSON Schema");
24426
24426
  };
24427
- var nullProcessor = (_schema2, ctx, json4, _params) => {
24427
+ var nullProcessor = (_schema2, ctx, json3, _params) => {
24428
24428
  if (ctx.target === "openapi-3.0") {
24429
- json4.type = "string";
24430
- json4.nullable = true;
24431
- json4.enum = [null];
24429
+ json3.type = "string";
24430
+ json3.nullable = true;
24431
+ json3.enum = [null];
24432
24432
  } else {
24433
- json4.type = "null";
24433
+ json3.type = "null";
24434
24434
  }
24435
24435
  };
24436
- var undefinedProcessor = (schema, ctx, json4, params) => {
24437
- handleUnrepresentable(schema, ctx, json4, params, "Undefined cannot be represented in JSON Schema");
24436
+ var undefinedProcessor = (schema, ctx, json3, params) => {
24437
+ handleUnrepresentable(schema, ctx, json3, params, "Undefined cannot be represented in JSON Schema");
24438
24438
  };
24439
- var voidProcessor = (schema, ctx, json4, params) => {
24440
- handleUnrepresentable(schema, ctx, json4, params, "Void cannot be represented in JSON Schema");
24439
+ var voidProcessor = (schema, ctx, json3, params) => {
24440
+ handleUnrepresentable(schema, ctx, json3, params, "Void cannot be represented in JSON Schema");
24441
24441
  };
24442
- var neverProcessor = (_schema2, _ctx, json4, _params) => {
24443
- json4.not = {};
24442
+ var neverProcessor = (_schema2, _ctx, json3, _params) => {
24443
+ json3.not = {};
24444
24444
  };
24445
24445
  var anyProcessor = (_schema2, _ctx, _json, _params) => {
24446
24446
  };
24447
24447
  var unknownProcessor = (_schema2, _ctx, _json, _params) => {
24448
24448
  };
24449
- var dateProcessor = (schema, ctx, json4, params) => {
24450
- handleUnrepresentable(schema, ctx, json4, params, "Date cannot be represented in JSON Schema");
24449
+ var dateProcessor = (schema, ctx, json3, params) => {
24450
+ handleUnrepresentable(schema, ctx, json3, params, "Date cannot be represented in JSON Schema");
24451
24451
  };
24452
- var enumProcessor = (schema, _ctx, json4, _params) => {
24452
+ var enumProcessor = (schema, _ctx, json3, _params) => {
24453
24453
  const def = schema._zod.def;
24454
24454
  const values = getEnumValues(def.entries);
24455
24455
  if (values.length === 0) {
24456
- json4.not = {};
24456
+ json3.not = {};
24457
24457
  return;
24458
24458
  }
24459
24459
  if (values.every((v3) => typeof v3 === "number"))
24460
- json4.type = "number";
24460
+ json3.type = "number";
24461
24461
  if (values.every((v3) => typeof v3 === "string"))
24462
- json4.type = "string";
24463
- json4.enum = values;
24462
+ json3.type = "string";
24463
+ json3.enum = values;
24464
24464
  };
24465
- var literalProcessor = (schema, ctx, json4, params) => {
24465
+ var literalProcessor = (schema, ctx, json3, params) => {
24466
24466
  const def = schema._zod.def;
24467
24467
  if (def.values.length === 0) {
24468
- json4.not = {};
24468
+ json3.not = {};
24469
24469
  return;
24470
24470
  }
24471
24471
  const vals = [];
24472
24472
  for (const val of def.values) {
24473
24473
  if (val === void 0) {
24474
- if (handleUnrepresentable(schema, ctx, json4, params, "Literal `undefined` cannot be represented in JSON Schema"))
24474
+ if (handleUnrepresentable(schema, ctx, json3, params, "Literal `undefined` cannot be represented in JSON Schema"))
24475
24475
  return;
24476
24476
  } else if (typeof val === "bigint") {
24477
- if (handleUnrepresentable(schema, ctx, json4, params, "BigInt literals cannot be represented in JSON Schema"))
24477
+ if (handleUnrepresentable(schema, ctx, json3, params, "BigInt literals cannot be represented in JSON Schema"))
24478
24478
  return;
24479
24479
  vals.push(Number(val));
24480
24480
  } else {
@@ -24484,37 +24484,37 @@ var literalProcessor = (schema, ctx, json4, params) => {
24484
24484
  if (vals.length === 0) {
24485
24485
  } else if (vals.length === 1) {
24486
24486
  const val = vals[0];
24487
- json4.type = val === null ? "null" : typeof val;
24487
+ json3.type = val === null ? "null" : typeof val;
24488
24488
  if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
24489
- json4.enum = [val];
24489
+ json3.enum = [val];
24490
24490
  } else {
24491
- json4.const = val;
24491
+ json3.const = val;
24492
24492
  }
24493
24493
  } else {
24494
24494
  if (vals.every((v3) => typeof v3 === "number"))
24495
- json4.type = "number";
24495
+ json3.type = "number";
24496
24496
  if (vals.every((v3) => typeof v3 === "string"))
24497
- json4.type = "string";
24497
+ json3.type = "string";
24498
24498
  if (vals.every((v3) => typeof v3 === "boolean"))
24499
- json4.type = "boolean";
24499
+ json3.type = "boolean";
24500
24500
  if (vals.every((v3) => v3 === null))
24501
- json4.type = "null";
24502
- json4.enum = vals;
24501
+ json3.type = "null";
24502
+ json3.enum = vals;
24503
24503
  }
24504
24504
  };
24505
- var nanProcessor = (schema, ctx, json4, params) => {
24506
- handleUnrepresentable(schema, ctx, json4, params, "NaN cannot be represented in JSON Schema");
24505
+ var nanProcessor = (schema, ctx, json3, params) => {
24506
+ handleUnrepresentable(schema, ctx, json3, params, "NaN cannot be represented in JSON Schema");
24507
24507
  };
24508
- var templateLiteralProcessor = (schema, _ctx, json4, _params) => {
24509
- const _json = json4;
24508
+ var templateLiteralProcessor = (schema, _ctx, json3, _params) => {
24509
+ const _json = json3;
24510
24510
  const pattern = schema._zod.pattern;
24511
24511
  if (!pattern)
24512
24512
  throw new Error("Pattern not found in template literal");
24513
24513
  _json.type = "string";
24514
24514
  _json.pattern = pattern.source;
24515
24515
  };
24516
- var fileProcessor = (schema, _ctx, json4, _params) => {
24517
- const _json = json4;
24516
+ var fileProcessor = (schema, _ctx, json3, _params) => {
24517
+ const _json = json3;
24518
24518
  _json.type = "string";
24519
24519
  _json.format = "binary";
24520
24520
  _json.contentEncoding = "binary";
@@ -24532,34 +24532,34 @@ var fileProcessor = (schema, _ctx, json4, _params) => {
24532
24532
  else
24533
24533
  _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
24534
24534
  };
24535
- var successProcessor = (_schema2, _ctx, json4, _params) => {
24536
- json4.type = "boolean";
24535
+ var successProcessor = (_schema2, _ctx, json3, _params) => {
24536
+ json3.type = "boolean";
24537
24537
  };
24538
- var customProcessor = (schema, ctx, json4, params) => {
24539
- handleUnrepresentable(schema, ctx, json4, params, "Custom types cannot be represented in JSON Schema");
24538
+ var customProcessor = (schema, ctx, json3, params) => {
24539
+ handleUnrepresentable(schema, ctx, json3, params, "Custom types cannot be represented in JSON Schema");
24540
24540
  };
24541
- var functionProcessor = (schema, ctx, json4, params) => {
24542
- handleUnrepresentable(schema, ctx, json4, params, "Function types cannot be represented in JSON Schema");
24541
+ var functionProcessor = (schema, ctx, json3, params) => {
24542
+ handleUnrepresentable(schema, ctx, json3, params, "Function types cannot be represented in JSON Schema");
24543
24543
  };
24544
- var transformProcessor = (schema, ctx, json4, params) => {
24545
- handleUnrepresentable(schema, ctx, json4, params, "Transforms cannot be represented in JSON Schema");
24544
+ var transformProcessor = (schema, ctx, json3, params) => {
24545
+ handleUnrepresentable(schema, ctx, json3, params, "Transforms cannot be represented in JSON Schema");
24546
24546
  };
24547
- var mapProcessor = (schema, ctx, json4, params) => {
24548
- handleUnrepresentable(schema, ctx, json4, params, "Map cannot be represented in JSON Schema");
24547
+ var mapProcessor = (schema, ctx, json3, params) => {
24548
+ handleUnrepresentable(schema, ctx, json3, params, "Map cannot be represented in JSON Schema");
24549
24549
  };
24550
- var setProcessor = (schema, ctx, json4, params) => {
24551
- handleUnrepresentable(schema, ctx, json4, params, "Set cannot be represented in JSON Schema");
24550
+ var setProcessor = (schema, ctx, json3, params) => {
24551
+ handleUnrepresentable(schema, ctx, json3, params, "Set cannot be represented in JSON Schema");
24552
24552
  };
24553
24553
  var arrayProcessor = (schema, ctx, _json, params) => {
24554
- const json4 = _json;
24554
+ const json3 = _json;
24555
24555
  const def = schema._zod.def;
24556
24556
  const { minimum, maximum } = aggregateChecks(schema);
24557
24557
  if (typeof minimum === "number")
24558
- json4.minItems = minimum;
24558
+ json3.minItems = minimum;
24559
24559
  if (typeof maximum === "number")
24560
- json4.maxItems = maximum;
24561
- json4.type = "array";
24562
- json4.items = processSchema(def.element, ctx, {
24560
+ json3.maxItems = maximum;
24561
+ json3.type = "array";
24562
+ json3.items = processSchema(def.element, ctx, {
24563
24563
  ...params,
24564
24564
  path: [...params.path, "items"]
24565
24565
  });
@@ -24575,17 +24575,17 @@ function inputOptin(schema) {
24575
24575
  return schema._zod.optin;
24576
24576
  }
24577
24577
  var objectProcessor = (schema, ctx, _json, params) => {
24578
- const json4 = _json;
24578
+ const json3 = _json;
24579
24579
  const def = schema._zod.def;
24580
24580
  const shape = def.shape;
24581
24581
  const symbolKeys = Object.getOwnPropertySymbols(shape);
24582
- if (symbolKeys.length && handleUnrepresentable(schema, ctx, json4, params, "Symbol keys cannot be represented in JSON Schema")) {
24582
+ if (symbolKeys.length && handleUnrepresentable(schema, ctx, json3, params, "Symbol keys cannot be represented in JSON Schema")) {
24583
24583
  return;
24584
24584
  }
24585
- json4.type = "object";
24586
- json4.properties = {};
24585
+ json3.type = "object";
24586
+ json3.properties = {};
24587
24587
  for (const key in shape) {
24588
- assignProp(json4.properties, key, processSchema(shape[key], ctx, {
24588
+ assignProp(json3.properties, key, processSchema(shape[key], ctx, {
24589
24589
  ...params,
24590
24590
  path: [...params.path, "properties", key]
24591
24591
  }));
@@ -24598,21 +24598,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
24598
24598
  }
24599
24599
  }
24600
24600
  if (requiredKeys.length > 0) {
24601
- json4.required = requiredKeys;
24601
+ json3.required = requiredKeys;
24602
24602
  }
24603
24603
  if (def.catchall?._zod.def.type === "never") {
24604
- json4.additionalProperties = false;
24604
+ json3.additionalProperties = false;
24605
24605
  } else if (!def.catchall) {
24606
24606
  if (ctx.io === "output")
24607
- json4.additionalProperties = false;
24607
+ json3.additionalProperties = false;
24608
24608
  } else if (def.catchall) {
24609
- json4.additionalProperties = processSchema(def.catchall, ctx, {
24609
+ json3.additionalProperties = processSchema(def.catchall, ctx, {
24610
24610
  ...params,
24611
24611
  path: [...params.path, "additionalProperties"]
24612
24612
  });
24613
24613
  }
24614
24614
  };
24615
- var unionProcessor = (schema, ctx, json4, params) => {
24615
+ var unionProcessor = (schema, ctx, json3, params) => {
24616
24616
  const def = schema._zod.def;
24617
24617
  const isExclusive = def.inclusive === false;
24618
24618
  const options = def.options.map((x, i) => processSchema(x, ctx, {
@@ -24620,12 +24620,12 @@ var unionProcessor = (schema, ctx, json4, params) => {
24620
24620
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
24621
24621
  }));
24622
24622
  if (isExclusive) {
24623
- json4.oneOf = options;
24623
+ json3.oneOf = options;
24624
24624
  } else {
24625
- json4.anyOf = options;
24625
+ json3.anyOf = options;
24626
24626
  }
24627
24627
  };
24628
- var intersectionProcessor = (schema, ctx, json4, params) => {
24628
+ var intersectionProcessor = (schema, ctx, json3, params) => {
24629
24629
  const def = schema._zod.def;
24630
24630
  const a = processSchema(def.left, ctx, {
24631
24631
  ...params,
@@ -24640,13 +24640,13 @@ var intersectionProcessor = (schema, ctx, json4, params) => {
24640
24640
  ...isSimpleIntersection(a) ? a.allOf : [a],
24641
24641
  ...isSimpleIntersection(b) ? b.allOf : [b]
24642
24642
  ];
24643
- json4.allOf = allOf;
24643
+ json3.allOf = allOf;
24644
24644
  ctx.intersections.push(allOf);
24645
24645
  };
24646
24646
  var tupleProcessor = (schema, ctx, _json, params) => {
24647
- const json4 = _json;
24647
+ const json3 = _json;
24648
24648
  const def = schema._zod.def;
24649
- json4.type = "array";
24649
+ json3.type = "array";
24650
24650
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
24651
24651
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
24652
24652
  const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
@@ -24668,70 +24668,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
24668
24668
  const maxItems = def.items.length;
24669
24669
  const isClosed = !def.rest;
24670
24670
  if (ctx.target === "draft-2020-12") {
24671
- json4.prefixItems = prefixItems;
24671
+ json3.prefixItems = prefixItems;
24672
24672
  if (isClosed) {
24673
- json4.items = false;
24673
+ json3.items = false;
24674
24674
  } else if (rest) {
24675
- json4.items = rest;
24675
+ json3.items = rest;
24676
24676
  }
24677
24677
  if (minItems > 0)
24678
- json4.minItems = minItems;
24678
+ json3.minItems = minItems;
24679
24679
  if (isClosed)
24680
- json4.maxItems = maxItems;
24680
+ json3.maxItems = maxItems;
24681
24681
  } else if (ctx.target === "openapi-3.0") {
24682
- json4.items = {
24682
+ json3.items = {
24683
24683
  anyOf: prefixItems
24684
24684
  };
24685
24685
  if (rest) {
24686
- json4.items.anyOf.push(rest);
24686
+ json3.items.anyOf.push(rest);
24687
24687
  }
24688
24688
  if (minItems > 0)
24689
- json4.minItems = minItems;
24689
+ json3.minItems = minItems;
24690
24690
  if (isClosed)
24691
- json4.maxItems = maxItems;
24691
+ json3.maxItems = maxItems;
24692
24692
  } else {
24693
- json4.items = prefixItems;
24693
+ json3.items = prefixItems;
24694
24694
  if (isClosed) {
24695
- json4.additionalItems = false;
24695
+ json3.additionalItems = false;
24696
24696
  } else if (rest) {
24697
- json4.additionalItems = rest;
24697
+ json3.additionalItems = rest;
24698
24698
  }
24699
24699
  if (minItems > 0)
24700
- json4.minItems = minItems;
24700
+ json3.minItems = minItems;
24701
24701
  if (isClosed)
24702
- json4.maxItems = maxItems;
24702
+ json3.maxItems = maxItems;
24703
24703
  }
24704
24704
  const { minimum, maximum } = aggregateChecks(schema);
24705
24705
  if (typeof minimum === "number")
24706
- json4.minItems = minimum;
24706
+ json3.minItems = minimum;
24707
24707
  if (typeof maximum === "number")
24708
- json4.maxItems = maximum;
24709
- };
24710
- function stringifyKeyNames(bySchema, json4, visited) {
24711
- if (json4.$ref) {
24712
- if (visited.has(json4))
24713
- return json4;
24714
- visited.add(json4);
24715
- const def = bySchema.get(json4)?.def;
24708
+ json3.maxItems = maximum;
24709
+ };
24710
+ function stringifyKeyNames(bySchema, json3, visited) {
24711
+ if (json3.$ref) {
24712
+ if (visited.has(json3))
24713
+ return json3;
24714
+ visited.add(json3);
24715
+ const def = bySchema.get(json3)?.def;
24716
24716
  if (!def)
24717
- return json4;
24717
+ return json3;
24718
24718
  const inlined = stringifyKeyNames(bySchema, def, visited);
24719
- return inlined === def ? json4 : inlined;
24719
+ return inlined === def ? json3 : inlined;
24720
24720
  }
24721
24721
  for (const keyword of ["anyOf", "oneOf"]) {
24722
- const branches = json4[keyword];
24722
+ const branches = json3[keyword];
24723
24723
  if (!Array.isArray(branches))
24724
24724
  continue;
24725
24725
  const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
24726
24726
  if (mapped.some((branch, i) => branch !== branches[i]))
24727
- json4 = { ...json4, [keyword]: mapped };
24727
+ json3 = { ...json3, [keyword]: mapped };
24728
24728
  }
24729
- const types = Array.isArray(json4.type) ? json4.type : [json4.type];
24729
+ const types = Array.isArray(json3.type) ? json3.type : [json3.type];
24730
24730
  const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
24731
- const values = json4.enum ?? (json4.const !== void 0 ? [json4.const] : void 0);
24731
+ const values = json3.enum ?? (json3.const !== void 0 ? [json3.const] : void 0);
24732
24732
  if (!numericType && !values?.some((v3) => typeof v3 === "number"))
24733
- return json4;
24734
- const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id21, ...rest } = json4;
24733
+ return json3;
24734
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id21, ...rest } = json3;
24735
24735
  if (rest.enum)
24736
24736
  rest.enum = rest.enum.map((v3) => typeof v3 === "number" ? String(v3) : v3);
24737
24737
  else if (typeof rest.const === "number")
@@ -24771,9 +24771,9 @@ function rewriteKeyNames(ctx) {
24771
24771
  }
24772
24772
  }
24773
24773
  var recordProcessor = (schema, ctx, _json, params) => {
24774
- const json4 = _json;
24774
+ const json3 = _json;
24775
24775
  const def = schema._zod.def;
24776
- json4.type = "object";
24776
+ json3.type = "object";
24777
24777
  const keyType = def.keyType;
24778
24778
  const patterns = aggregateChecks(keyType).patterns;
24779
24779
  if (def.mode === "loose" && patterns && patterns.size > 0) {
@@ -24781,13 +24781,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
24781
24781
  ...params,
24782
24782
  path: [...params.path, "patternProperties", "*"]
24783
24783
  });
24784
- json4.patternProperties = {};
24784
+ json3.patternProperties = {};
24785
24785
  for (const pattern of patterns) {
24786
- assignProp(json4.patternProperties, exactPattern(pattern).source, valueSchema);
24786
+ assignProp(json3.patternProperties, exactPattern(pattern).source, valueSchema);
24787
24787
  }
24788
24788
  } else {
24789
24789
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
24790
- json4.propertyNames = processSchema(def.keyType, ctx, {
24790
+ json3.propertyNames = processSchema(def.keyType, ctx, {
24791
24791
  ...params,
24792
24792
  path: [...params.path, "propertyNames"]
24793
24793
  });
@@ -24799,7 +24799,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
24799
24799
  }
24800
24800
  pending.push(schema);
24801
24801
  }
24802
- json4.additionalProperties = processSchema(def.valueType, ctx, {
24802
+ json3.additionalProperties = processSchema(def.valueType, ctx, {
24803
24803
  ...params,
24804
24804
  path: [...params.path, "additionalProperties"]
24805
24805
  });
@@ -24809,19 +24809,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
24809
24809
  if (keyValues && !def.partial && !omittableOnInput) {
24810
24810
  const validKeyValues = [...keyValues].filter((v3) => typeof v3 === "string" || typeof v3 === "number");
24811
24811
  if (validKeyValues.length > 0) {
24812
- json4.required = validKeyValues.map(String);
24812
+ json3.required = validKeyValues.map(String);
24813
24813
  }
24814
24814
  }
24815
24815
  };
24816
- var nullableProcessor = (schema, ctx, json4, params) => {
24816
+ var nullableProcessor = (schema, ctx, json3, params) => {
24817
24817
  const def = schema._zod.def;
24818
24818
  const inner = processSchema(def.innerType, ctx, params);
24819
24819
  const seen = ctx.seen.get(schema);
24820
24820
  if (ctx.target === "openapi-3.0") {
24821
24821
  seen.ref = def.innerType;
24822
- json4.nullable = true;
24822
+ json3.nullable = true;
24823
24823
  } else {
24824
- json4.anyOf = [inner, { type: "null" }];
24824
+ json3.anyOf = [inner, { type: "null" }];
24825
24825
  }
24826
24826
  };
24827
24827
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
@@ -24831,7 +24831,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
24831
24831
  seen.ref = def.innerType;
24832
24832
  };
24833
24833
  var UNREPRESENTABLE_DEFAULT = Symbol();
24834
- function serializeDefaultValue(value, schema, ctx, json4, params) {
24834
+ function serializeDefaultValue(value, schema, ctx, json3, params) {
24835
24835
  let unrepresentable = false;
24836
24836
  const serialized = JSON.stringify(value, (_, val) => {
24837
24837
  if (typeof val !== "bigint")
@@ -24841,30 +24841,30 @@ function serializeDefaultValue(value, schema, ctx, json4, params) {
24841
24841
  });
24842
24842
  if (!unrepresentable)
24843
24843
  return JSON.parse(serialized);
24844
- handleUnrepresentable(schema, ctx, json4, params, "BigInt defaults cannot be represented in JSON Schema");
24844
+ handleUnrepresentable(schema, ctx, json3, params, "BigInt defaults cannot be represented in JSON Schema");
24845
24845
  return UNREPRESENTABLE_DEFAULT;
24846
24846
  }
24847
- var defaultProcessor = (schema, ctx, json4, params) => {
24847
+ var defaultProcessor = (schema, ctx, json3, params) => {
24848
24848
  const def = schema._zod.def;
24849
24849
  processSchema(def.innerType, ctx, params);
24850
24850
  const seen = ctx.seen.get(schema);
24851
24851
  seen.ref = def.innerType;
24852
- const value = serializeDefaultValue(def.defaultValue, schema, ctx, json4, params);
24852
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
24853
24853
  if (value !== UNREPRESENTABLE_DEFAULT)
24854
- json4.default = value;
24854
+ json3.default = value;
24855
24855
  };
24856
- var prefaultProcessor = (schema, ctx, json4, params) => {
24856
+ var prefaultProcessor = (schema, ctx, json3, params) => {
24857
24857
  const def = schema._zod.def;
24858
24858
  processSchema(def.innerType, ctx, params);
24859
24859
  const seen = ctx.seen.get(schema);
24860
24860
  seen.ref = def.innerType;
24861
24861
  if (ctx.io !== "input")
24862
24862
  return;
24863
- const value = serializeDefaultValue(def.defaultValue, schema, ctx, json4, params);
24863
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
24864
24864
  if (value !== UNREPRESENTABLE_DEFAULT)
24865
- json4._prefault = value;
24865
+ json3._prefault = value;
24866
24866
  };
24867
- var catchProcessor = (schema, ctx, json4, params) => {
24867
+ var catchProcessor = (schema, ctx, json3, params) => {
24868
24868
  const def = schema._zod.def;
24869
24869
  processSchema(def.innerType, ctx, params);
24870
24870
  const seen = ctx.seen.get(schema);
@@ -24873,10 +24873,10 @@ var catchProcessor = (schema, ctx, json4, params) => {
24873
24873
  try {
24874
24874
  catchValue = def.catchValue(void 0);
24875
24875
  } catch {
24876
- handleUnrepresentable(schema, ctx, json4, params, "Dynamic catch values are not supported in JSON Schema");
24876
+ handleUnrepresentable(schema, ctx, json3, params, "Dynamic catch values are not supported in JSON Schema");
24877
24877
  return;
24878
24878
  }
24879
- json4.default = catchValue;
24879
+ json3.default = catchValue;
24880
24880
  };
24881
24881
  var pipeProcessor = (schema, ctx, _json, params) => {
24882
24882
  const def = schema._zod.def;
@@ -24886,12 +24886,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
24886
24886
  const seen = ctx.seen.get(schema);
24887
24887
  seen.ref = innerType;
24888
24888
  };
24889
- var readonlyProcessor = (schema, ctx, json4, params) => {
24889
+ var readonlyProcessor = (schema, ctx, json3, params) => {
24890
24890
  const def = schema._zod.def;
24891
24891
  processSchema(def.innerType, ctx, params);
24892
24892
  const seen = ctx.seen.get(schema);
24893
24893
  seen.ref = def.innerType;
24894
- json4.readOnly = true;
24894
+ json3.readOnly = true;
24895
24895
  };
24896
24896
  var promiseProcessor = (schema, ctx, _json, params) => {
24897
24897
  const def = schema._zod.def;
@@ -25533,7 +25533,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
25533
25533
  (inst, def) => {
25534
25534
  $ZodString.init(inst, def);
25535
25535
  ZodType.init(inst, def);
25536
- inst._zod.processJSONSchema = (ctx, json4, params) => stringProcessor(inst, ctx, json4, params);
25536
+ inst._zod.processJSONSchema = (ctx, json3, params) => stringProcessor(inst, ctx, json3, params);
25537
25537
  },
25538
25538
  /* @__PURE__ */ util_exports.derived({
25539
25539
  format: (inst) => aggregateChecks(inst).format ?? null,
@@ -25892,7 +25892,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
25892
25892
  (inst, def) => {
25893
25893
  $ZodNumber.init(inst, def);
25894
25894
  ZodType.init(inst, def);
25895
- inst._zod.processJSONSchema = (ctx, json4, params) => numberProcessor(inst, ctx, json4, params);
25895
+ inst._zod.processJSONSchema = (ctx, json3, params) => numberProcessor(inst, ctx, json3, params);
25896
25896
  inst.isFinite = true;
25897
25897
  },
25898
25898
  /* @__PURE__ */ util_exports.derived({
@@ -25982,7 +25982,7 @@ function uint32(params) {
25982
25982
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
25983
25983
  $ZodBoolean.init(inst, def);
25984
25984
  ZodType.init(inst, def);
25985
- inst._zod.processJSONSchema = (ctx, json4, params) => booleanProcessor(inst, ctx, json4, params);
25985
+ inst._zod.processJSONSchema = (ctx, json3, params) => booleanProcessor(inst, ctx, json3, params);
25986
25986
  });
25987
25987
  function boolean2(params) {
25988
25988
  return _boolean(ZodBoolean, params);
@@ -25992,7 +25992,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
25992
25992
  (inst, def) => {
25993
25993
  $ZodBigInt.init(inst, def);
25994
25994
  ZodType.init(inst, def);
25995
- inst._zod.processJSONSchema = (ctx, json4, params) => bigintProcessor(inst, ctx, json4, params);
25995
+ inst._zod.processJSONSchema = (ctx, json3, params) => bigintProcessor(inst, ctx, json3, params);
25996
25996
  },
25997
25997
  /* @__PURE__ */ util_exports.derived({
25998
25998
  minValue: (inst) => aggregateChecks(inst).minimum ?? null,
@@ -26050,7 +26050,7 @@ function uint64(params) {
26050
26050
  var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
26051
26051
  $ZodSymbol.init(inst, def);
26052
26052
  ZodType.init(inst, def);
26053
- inst._zod.processJSONSchema = (ctx, json4, params) => symbolProcessor(inst, ctx, json4, params);
26053
+ inst._zod.processJSONSchema = (ctx, json3, params) => symbolProcessor(inst, ctx, json3, params);
26054
26054
  });
26055
26055
  function symbol(params) {
26056
26056
  return _symbol(ZodSymbol, params);
@@ -26058,7 +26058,7 @@ function symbol(params) {
26058
26058
  var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
26059
26059
  $ZodUndefined.init(inst, def);
26060
26060
  ZodType.init(inst, def);
26061
- inst._zod.processJSONSchema = (ctx, json4, params) => undefinedProcessor(inst, ctx, json4, params);
26061
+ inst._zod.processJSONSchema = (ctx, json3, params) => undefinedProcessor(inst, ctx, json3, params);
26062
26062
  });
26063
26063
  function _undefined3(params) {
26064
26064
  return _undefined2(ZodUndefined, params);
@@ -26066,7 +26066,7 @@ function _undefined3(params) {
26066
26066
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
26067
26067
  $ZodNull.init(inst, def);
26068
26068
  ZodType.init(inst, def);
26069
- inst._zod.processJSONSchema = (ctx, json4, params) => nullProcessor(inst, ctx, json4, params);
26069
+ inst._zod.processJSONSchema = (ctx, json3, params) => nullProcessor(inst, ctx, json3, params);
26070
26070
  });
26071
26071
  function _null3(params) {
26072
26072
  return _null2(ZodNull, params);
@@ -26074,7 +26074,7 @@ function _null3(params) {
26074
26074
  var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
26075
26075
  $ZodAny.init(inst, def);
26076
26076
  ZodType.init(inst, def);
26077
- inst._zod.processJSONSchema = (ctx, json4, params) => anyProcessor(inst, ctx, json4, params);
26077
+ inst._zod.processJSONSchema = (ctx, json3, params) => anyProcessor(inst, ctx, json3, params);
26078
26078
  });
26079
26079
  function any() {
26080
26080
  return _any(ZodAny);
@@ -26082,7 +26082,7 @@ function any() {
26082
26082
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
26083
26083
  $ZodUnknown.init(inst, def);
26084
26084
  ZodType.init(inst, def);
26085
- inst._zod.processJSONSchema = (ctx, json4, params) => unknownProcessor(inst, ctx, json4, params);
26085
+ inst._zod.processJSONSchema = (ctx, json3, params) => unknownProcessor(inst, ctx, json3, params);
26086
26086
  });
26087
26087
  function unknown() {
26088
26088
  return _unknown(ZodUnknown);
@@ -26090,7 +26090,7 @@ function unknown() {
26090
26090
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
26091
26091
  $ZodNever.init(inst, def);
26092
26092
  ZodType.init(inst, def);
26093
- inst._zod.processJSONSchema = (ctx, json4, params) => neverProcessor(inst, ctx, json4, params);
26093
+ inst._zod.processJSONSchema = (ctx, json3, params) => neverProcessor(inst, ctx, json3, params);
26094
26094
  });
26095
26095
  function never(params) {
26096
26096
  return _never(ZodNever, params);
@@ -26098,7 +26098,7 @@ function never(params) {
26098
26098
  var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
26099
26099
  $ZodVoid.init(inst, def);
26100
26100
  ZodType.init(inst, def);
26101
- inst._zod.processJSONSchema = (ctx, json4, params) => voidProcessor(inst, ctx, json4, params);
26101
+ inst._zod.processJSONSchema = (ctx, json3, params) => voidProcessor(inst, ctx, json3, params);
26102
26102
  });
26103
26103
  function _void2(params) {
26104
26104
  return _void(ZodVoid, params);
@@ -26108,7 +26108,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
26108
26108
  (inst, def) => {
26109
26109
  $ZodDate.init(inst, def);
26110
26110
  ZodType.init(inst, def);
26111
- inst._zod.processJSONSchema = (ctx, json4, params) => dateProcessor(inst, ctx, json4, params);
26111
+ inst._zod.processJSONSchema = (ctx, json3, params) => dateProcessor(inst, ctx, json3, params);
26112
26112
  inst.min = (value, params) => inst.check(_gte(value, params));
26113
26113
  inst.max = (value, params) => inst.check(_lte(value, params));
26114
26114
  },
@@ -26130,7 +26130,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
26130
26130
  _ensureDefaultMemoizer();
26131
26131
  $ZodArray.init(inst, def);
26132
26132
  ZodType.init(inst, def);
26133
- inst._zod.processJSONSchema = (ctx, json4, params) => arrayProcessor(inst, ctx, json4, params);
26133
+ inst._zod.processJSONSchema = (ctx, json3, params) => arrayProcessor(inst, ctx, json3, params);
26134
26134
  inst.element = def.element;
26135
26135
  }, {
26136
26136
  min(n, params) {
@@ -26160,7 +26160,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
26160
26160
  _ensureDefaultMemoizer();
26161
26161
  $ZodObjectJIT.init(inst, def);
26162
26162
  ZodType.init(inst, def);
26163
- inst._zod.processJSONSchema = (ctx, json4, params) => objectProcessor(inst, ctx, json4, params);
26163
+ inst._zod.processJSONSchema = (ctx, json3, params) => objectProcessor(inst, ctx, json3, params);
26164
26164
  util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
26165
26165
  }, {
26166
26166
  keyof() {
@@ -26233,7 +26233,7 @@ function looseObject(shape, params) {
26233
26233
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
26234
26234
  $ZodUnion.init(inst, def);
26235
26235
  ZodType.init(inst, def);
26236
- inst._zod.processJSONSchema = (ctx, json4, params) => unionProcessor(inst, ctx, json4, params);
26236
+ inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
26237
26237
  inst.options = def.options;
26238
26238
  });
26239
26239
  function union(options, params) {
@@ -26246,7 +26246,7 @@ function union(options, params) {
26246
26246
  var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
26247
26247
  ZodUnion.init(inst, def);
26248
26248
  $ZodXor.init(inst, def);
26249
- inst._zod.processJSONSchema = (ctx, json4, params) => unionProcessor(inst, ctx, json4, params);
26249
+ inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
26250
26250
  inst.options = def.options;
26251
26251
  });
26252
26252
  function xor(options, params) {
@@ -26272,7 +26272,7 @@ function discriminatedUnion(discriminator, options, params) {
26272
26272
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
26273
26273
  $ZodIntersection.init(inst, def);
26274
26274
  ZodType.init(inst, def);
26275
- inst._zod.processJSONSchema = (ctx, json4, params) => intersectionProcessor(inst, ctx, json4, params);
26275
+ inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor(inst, ctx, json3, params);
26276
26276
  });
26277
26277
  function intersection(left, right) {
26278
26278
  return new ZodIntersection({
@@ -26285,7 +26285,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
26285
26285
  _ensureDefaultMemoizer();
26286
26286
  $ZodTuple.init(inst, def);
26287
26287
  ZodType.init(inst, def);
26288
- inst._zod.processJSONSchema = (ctx, json4, params) => tupleProcessor(inst, ctx, json4, params);
26288
+ inst._zod.processJSONSchema = (ctx, json3, params) => tupleProcessor(inst, ctx, json3, params);
26289
26289
  }, {
26290
26290
  rest(rest) {
26291
26291
  return this.clone({
@@ -26318,7 +26318,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
26318
26318
  _ensureDefaultMemoizer();
26319
26319
  $ZodRecord.init(inst, def);
26320
26320
  ZodType.init(inst, def);
26321
- inst._zod.processJSONSchema = (ctx, json4, params) => recordProcessor(inst, ctx, json4, params);
26321
+ inst._zod.processJSONSchema = (ctx, json3, params) => recordProcessor(inst, ctx, json3, params);
26322
26322
  inst.keyType = def.keyType;
26323
26323
  inst.valueType = def.valueType;
26324
26324
  });
@@ -26360,7 +26360,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
26360
26360
  _ensureDefaultMemoizer();
26361
26361
  $ZodMap.init(inst, def);
26362
26362
  ZodType.init(inst, def);
26363
- inst._zod.processJSONSchema = (ctx, json4, params) => mapProcessor(inst, ctx, json4, params);
26363
+ inst._zod.processJSONSchema = (ctx, json3, params) => mapProcessor(inst, ctx, json3, params);
26364
26364
  inst.keyType = def.keyType;
26365
26365
  inst.valueType = def.valueType;
26366
26366
  inst.min = (...args) => inst.check(_minSize(...args));
@@ -26380,7 +26380,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
26380
26380
  _ensureDefaultMemoizer();
26381
26381
  $ZodSet.init(inst, def);
26382
26382
  ZodType.init(inst, def);
26383
- inst._zod.processJSONSchema = (ctx, json4, params) => setProcessor(inst, ctx, json4, params);
26383
+ inst._zod.processJSONSchema = (ctx, json3, params) => setProcessor(inst, ctx, json3, params);
26384
26384
  inst.min = (...args) => inst.check(_minSize(...args));
26385
26385
  inst.nonempty = (params) => inst.check(_minSize(1, params));
26386
26386
  inst.max = (...args) => inst.check(_maxSize(...args));
@@ -26396,7 +26396,7 @@ function set(valueType, params) {
26396
26396
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
26397
26397
  $ZodEnum.init(inst, def);
26398
26398
  ZodType.init(inst, def);
26399
- inst._zod.processJSONSchema = (ctx, json4, params) => enumProcessor(inst, ctx, json4, params);
26399
+ inst._zod.processJSONSchema = (ctx, json3, params) => enumProcessor(inst, ctx, json3, params);
26400
26400
  inst.enum = def.entries;
26401
26401
  inst.options = [...inst._zod.values];
26402
26402
  const keys = new Set(Object.keys(def.entries));
@@ -26449,7 +26449,7 @@ function nativeEnum(entries, params) {
26449
26449
  var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
26450
26450
  $ZodLiteral.init(inst, def);
26451
26451
  ZodType.init(inst, def);
26452
- inst._zod.processJSONSchema = (ctx, json4, params) => literalProcessor(inst, ctx, json4, params);
26452
+ inst._zod.processJSONSchema = (ctx, json3, params) => literalProcessor(inst, ctx, json3, params);
26453
26453
  inst.values = new Set(def.values);
26454
26454
  Object.defineProperty(inst, "value", {
26455
26455
  get() {
@@ -26470,7 +26470,7 @@ function literal(value, params) {
26470
26470
  var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
26471
26471
  $ZodFile.init(inst, def);
26472
26472
  ZodType.init(inst, def);
26473
- inst._zod.processJSONSchema = (ctx, json4, params) => fileProcessor(inst, ctx, json4, params);
26473
+ inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
26474
26474
  inst.min = (size, params) => inst.check(_minSize(size, params));
26475
26475
  inst.max = (size, params) => inst.check(_maxSize(size, params));
26476
26476
  inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
@@ -26482,7 +26482,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
26482
26482
  _ensureDefaultMemoizer();
26483
26483
  $ZodTransform.init(inst, def);
26484
26484
  ZodType.init(inst, def);
26485
- inst._zod.processJSONSchema = (ctx, json4, params) => transformProcessor(inst, ctx, json4, params);
26485
+ inst._zod.processJSONSchema = (ctx, json3, params) => transformProcessor(inst, ctx, json3, params);
26486
26486
  inst._zod.parse = (payload, _ctx) => {
26487
26487
  if (_ctx.direction === "backward") {
26488
26488
  throw new $ZodEncodeError(inst.constructor.name);
@@ -26521,7 +26521,7 @@ function transform(fn) {
26521
26521
  var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
26522
26522
  $ZodOptional.init(inst, def);
26523
26523
  ZodType.init(inst, def);
26524
- inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
26524
+ inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
26525
26525
  inst.unwrap = () => inst._zod.def.innerType;
26526
26526
  });
26527
26527
  function optional(innerType) {
@@ -26533,7 +26533,7 @@ function optional(innerType) {
26533
26533
  var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
26534
26534
  $ZodExactOptional.init(inst, def);
26535
26535
  ZodType.init(inst, def);
26536
- inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
26536
+ inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
26537
26537
  inst.unwrap = () => inst._zod.def.innerType;
26538
26538
  });
26539
26539
  function exactOptional(innerType) {
@@ -26545,7 +26545,7 @@ function exactOptional(innerType) {
26545
26545
  var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
26546
26546
  $ZodNullable.init(inst, def);
26547
26547
  ZodType.init(inst, def);
26548
- inst._zod.processJSONSchema = (ctx, json4, params) => nullableProcessor(inst, ctx, json4, params);
26548
+ inst._zod.processJSONSchema = (ctx, json3, params) => nullableProcessor(inst, ctx, json3, params);
26549
26549
  inst.unwrap = () => inst._zod.def.innerType;
26550
26550
  });
26551
26551
  function nullable(innerType) {
@@ -26560,7 +26560,7 @@ function nullish2(innerType) {
26560
26560
  var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
26561
26561
  $ZodDefault.init(inst, def);
26562
26562
  ZodType.init(inst, def);
26563
- inst._zod.processJSONSchema = (ctx, json4, params) => defaultProcessor(inst, ctx, json4, params);
26563
+ inst._zod.processJSONSchema = (ctx, json3, params) => defaultProcessor(inst, ctx, json3, params);
26564
26564
  inst.unwrap = () => inst._zod.def.innerType;
26565
26565
  inst.removeDefault = inst.unwrap;
26566
26566
  });
@@ -26576,7 +26576,7 @@ function _default2(innerType, defaultValue) {
26576
26576
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
26577
26577
  $ZodPrefault.init(inst, def);
26578
26578
  ZodType.init(inst, def);
26579
- inst._zod.processJSONSchema = (ctx, json4, params) => prefaultProcessor(inst, ctx, json4, params);
26579
+ inst._zod.processJSONSchema = (ctx, json3, params) => prefaultProcessor(inst, ctx, json3, params);
26580
26580
  inst.unwrap = () => inst._zod.def.innerType;
26581
26581
  });
26582
26582
  function prefault(innerType, defaultValue) {
@@ -26591,7 +26591,7 @@ function prefault(innerType, defaultValue) {
26591
26591
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
26592
26592
  $ZodNonOptional.init(inst, def);
26593
26593
  ZodType.init(inst, def);
26594
- inst._zod.processJSONSchema = (ctx, json4, params) => nonoptionalProcessor(inst, ctx, json4, params);
26594
+ inst._zod.processJSONSchema = (ctx, json3, params) => nonoptionalProcessor(inst, ctx, json3, params);
26595
26595
  inst.unwrap = () => inst._zod.def.innerType;
26596
26596
  });
26597
26597
  function nonoptional(innerType, params) {
@@ -26604,7 +26604,7 @@ function nonoptional(innerType, params) {
26604
26604
  var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
26605
26605
  $ZodSuccess.init(inst, def);
26606
26606
  ZodType.init(inst, def);
26607
- inst._zod.processJSONSchema = (ctx, json4, params) => successProcessor(inst, ctx, json4, params);
26607
+ inst._zod.processJSONSchema = (ctx, json3, params) => successProcessor(inst, ctx, json3, params);
26608
26608
  inst.unwrap = () => inst._zod.def.innerType;
26609
26609
  });
26610
26610
  function success(innerType) {
@@ -26616,7 +26616,7 @@ function success(innerType) {
26616
26616
  var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
26617
26617
  $ZodCatch.init(inst, def);
26618
26618
  ZodType.init(inst, def);
26619
- inst._zod.processJSONSchema = (ctx, json4, params) => catchProcessor(inst, ctx, json4, params);
26619
+ inst._zod.processJSONSchema = (ctx, json3, params) => catchProcessor(inst, ctx, json3, params);
26620
26620
  inst.unwrap = () => inst._zod.def.innerType;
26621
26621
  inst.removeCatch = inst.unwrap;
26622
26622
  });
@@ -26630,7 +26630,7 @@ function _catch2(innerType, catchValue) {
26630
26630
  var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
26631
26631
  $ZodNaN.init(inst, def);
26632
26632
  ZodType.init(inst, def);
26633
- inst._zod.processJSONSchema = (ctx, json4, params) => nanProcessor(inst, ctx, json4, params);
26633
+ inst._zod.processJSONSchema = (ctx, json3, params) => nanProcessor(inst, ctx, json3, params);
26634
26634
  });
26635
26635
  function nan(params) {
26636
26636
  return _nan(ZodNaN, params);
@@ -26638,7 +26638,7 @@ function nan(params) {
26638
26638
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
26639
26639
  $ZodPipe.init(inst, def);
26640
26640
  ZodType.init(inst, def);
26641
- inst._zod.processJSONSchema = (ctx, json4, params) => pipeProcessor(inst, ctx, json4, params);
26641
+ inst._zod.processJSONSchema = (ctx, json3, params) => pipeProcessor(inst, ctx, json3, params);
26642
26642
  inst.in = def.in;
26643
26643
  inst.out = def.out;
26644
26644
  });
@@ -26680,7 +26680,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
26680
26680
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
26681
26681
  $ZodReadonly.init(inst, def);
26682
26682
  ZodType.init(inst, def);
26683
- inst._zod.processJSONSchema = (ctx, json4, params) => readonlyProcessor(inst, ctx, json4, params);
26683
+ inst._zod.processJSONSchema = (ctx, json3, params) => readonlyProcessor(inst, ctx, json3, params);
26684
26684
  inst.unwrap = () => inst._zod.def.innerType;
26685
26685
  });
26686
26686
  function readonly(innerType) {
@@ -26692,7 +26692,7 @@ function readonly(innerType) {
26692
26692
  var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
26693
26693
  $ZodTemplateLiteral.init(inst, def);
26694
26694
  ZodType.init(inst, def);
26695
- inst._zod.processJSONSchema = (ctx, json4, params) => templateLiteralProcessor(inst, ctx, json4, params);
26695
+ inst._zod.processJSONSchema = (ctx, json3, params) => templateLiteralProcessor(inst, ctx, json3, params);
26696
26696
  });
26697
26697
  function templateLiteral(parts, params) {
26698
26698
  return new ZodTemplateLiteral({
@@ -26704,7 +26704,7 @@ function templateLiteral(parts, params) {
26704
26704
  var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
26705
26705
  $ZodLazy.init(inst, def);
26706
26706
  ZodType.init(inst, def);
26707
- inst._zod.processJSONSchema = (ctx, json4, params) => lazyProcessor(inst, ctx, json4, params);
26707
+ inst._zod.processJSONSchema = (ctx, json3, params) => lazyProcessor(inst, ctx, json3, params);
26708
26708
  inst.unwrap = () => inst._zod.def.getter();
26709
26709
  });
26710
26710
  function lazy(getter) {
@@ -26716,7 +26716,7 @@ function lazy(getter) {
26716
26716
  var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
26717
26717
  $ZodPromise.init(inst, def);
26718
26718
  ZodType.init(inst, def);
26719
- inst._zod.processJSONSchema = (ctx, json4, params) => promiseProcessor(inst, ctx, json4, params);
26719
+ inst._zod.processJSONSchema = (ctx, json3, params) => promiseProcessor(inst, ctx, json3, params);
26720
26720
  inst.unwrap = () => inst._zod.def.innerType;
26721
26721
  });
26722
26722
  function promise(innerType) {
@@ -26728,7 +26728,7 @@ function promise(innerType) {
26728
26728
  var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
26729
26729
  $ZodFunction.init(inst, def);
26730
26730
  ZodType.init(inst, def);
26731
- inst._zod.processJSONSchema = (ctx, json4, params) => functionProcessor(inst, ctx, json4, params);
26731
+ inst._zod.processJSONSchema = (ctx, json3, params) => functionProcessor(inst, ctx, json3, params);
26732
26732
  });
26733
26733
  function _function(params) {
26734
26734
  return new ZodFunction({
@@ -26740,7 +26740,7 @@ function _function(params) {
26740
26740
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
26741
26741
  $ZodCustom.init(inst, def);
26742
26742
  ZodType.init(inst, def);
26743
- inst._zod.processJSONSchema = (ctx, json4, params) => customProcessor(inst, ctx, json4, params);
26743
+ inst._zod.processJSONSchema = (ctx, json3, params) => customProcessor(inst, ctx, json3, params);
26744
26744
  });
26745
26745
  function check(fn) {
26746
26746
  const ch = new $ZodCheck({
@@ -27851,38 +27851,22 @@ var activityFieldOptionValidator = v.object({ value: v.string(), label: v.option
27851
27851
  var MAX_ACTIVITY_FIELD_VALUES = 1e3;
27852
27852
  var externalActivityFieldValueSchema = external_exports.strictObject({ valueId: external_exports.string(), fieldId: external_exports.string(), label: external_exports.string(), type: activityFieldTypeSchema, value: external_exports.string() });
27853
27853
  function activityFieldDisplayEntries(source2) {
27854
- if (source2.fields === void 0) return Object.entries(source2.attributes ?? {}).map(([label, value]) => ({ id: label, label, value, type: void 0 }));
27855
27854
  const groups = /* @__PURE__ */ new Map();
27856
- for (const field of source2.fields) {
27855
+ for (const field of source2.fields ?? []) {
27857
27856
  const group = groups.get(field.fieldId) ?? { fieldId: field.fieldId, label: field.label, type: field.type, values: [] };
27858
27857
  group.values.push(field);
27859
27858
  groups.set(field.fieldId, group);
27860
27859
  }
27861
- return [...groups.values()].flatMap(({ values, ...field }) => field.type === "multi-select" ? [{ ...field, id: field.fieldId, value: activityFieldLegacyValue(field.type, values.map((row) => row.value)) }] : values.map((row) => ({ ...field, id: row.valueId, value: activityFieldLegacyValue(field.type, [row.value]) })));
27860
+ return [...groups.values()].flatMap(({ values, ...field }) => field.type === "multi-select" ? [{ ...field, id: field.fieldId, value: activityFieldValue(field.type, values.map((row) => row.value)) }] : values.map((row) => ({ ...field, id: row.valueId, value: activityFieldValue(field.type, [row.value]) })));
27862
27861
  }
27863
27862
  var externalActivityFieldValueValidator = v.object({ valueId: v.string(), fieldId: v.string(), label: v.string(), type: activityFieldTypeValidator, value: v.string() });
27864
27863
  var activityFieldFilterSchema = external_exports.strictObject({ label: external_exports.string().trim().min(1).max(100), value: external_exports.string().min(1).max(16384) });
27865
27864
  var activityFieldFiltersSchema = external_exports.union([activityFieldFilterSchema, external_exports.array(activityFieldFilterSchema).min(1).max(10)]);
27866
27865
  var activityFieldFilterValidator = v.object({ label: v.string(), value: v.string() });
27867
27866
  var activityFieldFiltersValidator = v.union(activityFieldFilterValidator, v.array(activityFieldFilterValidator));
27868
- var activityFieldReadFields = { fields: v.optional(v.array(externalActivityFieldValueValidator)), fieldIndexReady: v.optional(v.boolean()), fieldConsumerReady: v.optional(v.boolean()) };
27869
- var labelEvidenceValidator = v.object({ label: v.string(), count: v.number(), at: v.number(), id: v.string() });
27870
- var activityFieldPlanSummaryValidator = v.object({
27871
- variants: v.array(labelEvidenceValidator),
27872
- types: v.array(activityFieldTypeValidator),
27873
- textBoolean: v.boolean(),
27874
- textNumeric: v.boolean(),
27875
- // Retained for saved pre-v3 planning rows; new generations use the separate votes below.
27876
- configured: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator, at: v.number(), id: v.string() })),
27877
- configuredLabels: v.optional(v.array(labelEvidenceValidator)),
27878
- configuredTypes: v.optional(v.array(activityFieldTypeValidator)),
27879
- canonical: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
27880
- existing: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
27881
- options: v.optional(v.array(activityFieldOptionValidator)),
27882
- resolvedLabel: v.optional(v.string())
27883
- });
27867
+ var activityFieldReadFields = { fields: v.array(externalActivityFieldValueValidator) };
27884
27868
  var MAX_ACTIVITY_FIELD_DEFINITION_READ_BYTES = 6 * 1024 * 1024;
27885
- function activityFieldLegacyValue(type, values) {
27869
+ function activityFieldValue(type, values) {
27886
27870
  const first = values[0];
27887
27871
  if (first === void 0) return void 0;
27888
27872
  return type === "multi-select" ? values : type === "number" ? Number(first) : type === "boolean" ? first.trim().toLowerCase() === "true" : type === "json" ? JSON.parse(first) : first;
@@ -28017,6 +28001,36 @@ function isSourceCreatedAtInput(value) {
28017
28001
  return true;
28018
28002
  }
28019
28003
 
28004
+ // ../packages/shared/src/activity-contracts.ts
28005
+ var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
28006
+ var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
28007
+ var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
28008
+ var ACTIVITY_BODY_MARKDOWN_DESCRIPTION = "Activity body in Markdown. Mention an entity with [entity](ente://entity/<entityId>) using an exact ID returned by searchEntities; this creates a body reference and does not change activity ownership. Mention another activity with [activity](ente://activity/<activityId>?display=inline) or display=card using an exact activity ID returned by Ente. Newly introduced malformed or wrong-table activity mention IDs are rejected with INVALID_INPUT; copy IDs unchanged, never retype or infer them. Self-contained ente-html fences with JSON title/height metadata are also supported.";
28009
+
28010
+ // ../packages/shared/src/operation-errors.ts
28011
+ var APP_ERROR_CODES = {
28012
+ unauthenticated: "UNAUTHENTICATED",
28013
+ userNotFound: "USER_NOT_FOUND",
28014
+ invalidInput: "INVALID_INPUT",
28015
+ notFound: "NOT_FOUND",
28016
+ forbidden: "FORBIDDEN",
28017
+ failedPrecondition: "FAILED_PRECONDITION",
28018
+ limitExceeded: "LIMIT_EXCEEDED",
28019
+ paymentRequired: "PAYMENT_REQUIRED",
28020
+ ownModelRequired: "OWN_MODEL_REQUIRED",
28021
+ internal: "INTERNAL",
28022
+ spaceEntityMismatch: "SPACE_ENTITY_MISMATCH",
28023
+ invalidAssignee: "INVALID_ASSIGNEE",
28024
+ activityChangedDuringSummary: "ACTIVITY_CHANGED_DURING_SUMMARY",
28025
+ contentVersionConflict: "CONTENT_VERSION_CONFLICT",
28026
+ missingEntitySpaceAccessConfirmationRequired: "MISSING_ENTITY_SPACE_ACCESS_CONFIRMATION_REQUIRED",
28027
+ missingParentSpaceAccessConfirmationRequired: "MISSING_PARENT_SPACE_ACCESS_CONFIRMATION_REQUIRED",
28028
+ parentSpaceRequiredByChildren: "PARENT_SPACE_REQUIRED_BY_CHILDREN",
28029
+ entitySpaceRequiredByActivities: "ENTITY_SPACE_REQUIRED_BY_ACTIVITIES",
28030
+ agentAuthAccountMismatch: "AGENT_AUTH_ACCOUNT_MISMATCH"
28031
+ };
28032
+ var OPERATION_ERROR_CODES = { ...APP_ERROR_CODES, notAvailableHere: "NOT_AVAILABLE_HERE" };
28033
+
28020
28034
  // ../packages/shared/src/attribute-names.ts
28021
28035
  var STORABLE_ATTRIBUTE_KEY = /^[\x20-\x23\x25-\x7E][\x20-\x7E]{0,1023}$/;
28022
28036
  var ENCODED_PREFIX = "~";
@@ -28078,80 +28092,6 @@ var attributeStringPatch = external_exports.record(external_exports.string(), ex
28078
28092
  if (!isStorableAttributeKey(key)) ctx.addIssue({ code: "custom", path: [key], message: attributeKeyError(key) });
28079
28093
  }).meta({ patternProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.patternProperties, additionalProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.additionalProperties });
28080
28094
 
28081
- // ../packages/shared/src/activity-contracts.ts
28082
- var ACTIVITY_FIELD_TYPE_VALUES2 = ["text", "email", "phone", "url", "postal-address", "date", "salutation", "job-title", "json", "number", "boolean", "single-select", "multi-select"];
28083
- var fieldsJsonSchema = { type: "array", maxItems: 1e3, items: {
28084
- type: "object",
28085
- additionalProperties: false,
28086
- required: ["value"],
28087
- properties: {
28088
- label: { type: "string", minLength: 1, maxLength: 100 },
28089
- fieldId: { type: "string", minLength: 1, maxLength: 128 },
28090
- type: { type: "string", enum: ACTIVITY_FIELD_TYPE_VALUES2 },
28091
- value: { anyOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }, { type: "array", maxItems: 1e3, items: { type: "string" } }, { type: "null" }] }
28092
- },
28093
- oneOf: [{ required: ["label"] }, { required: ["fieldId"] }]
28094
- } };
28095
- var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
28096
- var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
28097
- var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
28098
- var ACTIVITY_BODY_MARKDOWN_DESCRIPTION = "Activity body in Markdown. Mention an entity with [entity](ente://entity/<entityId>) using an exact ID returned by searchEntities; this creates a body reference and does not change activity ownership. Mention another activity with [activity](ente://activity/<activityId>?display=inline) or display=card using an exact activity ID returned by Ente. Newly introduced malformed or wrong-table activity mention IDs are rejected with INVALID_INPUT; copy IDs unchanged, never retype or infer them. Self-contained ente-html fences with JSON title/height metadata are also supported.";
28099
- var activityUpdateInputProperties = {
28100
- title: { type: "string", description: "Optional headline." },
28101
- content: {
28102
- type: "string",
28103
- description: ACTIVITY_BODY_MARKDOWN_DESCRIPTION
28104
- },
28105
- completed: { type: "boolean", description: "Task completion state." },
28106
- deadline: nullableDeadlineJsonSchema,
28107
- entityIds: {
28108
- type: "array",
28109
- items: { type: "string" },
28110
- description: "Replace linked entities with this non-empty set."
28111
- },
28112
- type: { type: "string", enum: ACTIVITY_TYPE_VALUES },
28113
- fields: fieldsJsonSchema,
28114
- attributes: {
28115
- ...ATTRIBUTE_STRING_PATCH_JSON_SCHEMA,
28116
- description: "Activity attributes. Set a value to null to remove it."
28117
- },
28118
- assigneeIds: {
28119
- type: "array",
28120
- items: { type: "string" },
28121
- description: "Task assignee user IDs."
28122
- },
28123
- agentAssigneeIds: { type: "array", items: { type: "string" }, maxItems: MAX_ACTIVITY_AGENT_ASSIGNEES, description: "Task assignee agent IDs. Agents must have write access to the target space; assignment grants no access." },
28124
- assigneeEmails: {
28125
- type: "array",
28126
- items: { type: "string" },
28127
- description: "Task assignee emails resolved in the target space."
28128
- }
28129
- };
28130
-
28131
- // ../packages/shared/src/operation-errors.ts
28132
- var APP_ERROR_CODES = {
28133
- unauthenticated: "UNAUTHENTICATED",
28134
- userNotFound: "USER_NOT_FOUND",
28135
- invalidInput: "INVALID_INPUT",
28136
- notFound: "NOT_FOUND",
28137
- forbidden: "FORBIDDEN",
28138
- failedPrecondition: "FAILED_PRECONDITION",
28139
- limitExceeded: "LIMIT_EXCEEDED",
28140
- paymentRequired: "PAYMENT_REQUIRED",
28141
- ownModelRequired: "OWN_MODEL_REQUIRED",
28142
- internal: "INTERNAL",
28143
- spaceEntityMismatch: "SPACE_ENTITY_MISMATCH",
28144
- invalidAssignee: "INVALID_ASSIGNEE",
28145
- activityChangedDuringSummary: "ACTIVITY_CHANGED_DURING_SUMMARY",
28146
- contentVersionConflict: "CONTENT_VERSION_CONFLICT",
28147
- missingEntitySpaceAccessConfirmationRequired: "MISSING_ENTITY_SPACE_ACCESS_CONFIRMATION_REQUIRED",
28148
- missingParentSpaceAccessConfirmationRequired: "MISSING_PARENT_SPACE_ACCESS_CONFIRMATION_REQUIRED",
28149
- parentSpaceRequiredByChildren: "PARENT_SPACE_REQUIRED_BY_CHILDREN",
28150
- entitySpaceRequiredByActivities: "ENTITY_SPACE_REQUIRED_BY_ACTIVITIES",
28151
- agentAuthAccountMismatch: "AGENT_AUTH_ACCOUNT_MISMATCH"
28152
- };
28153
- var OPERATION_ERROR_CODES = { ...APP_ERROR_CODES, notAvailableHere: "NOT_AVAILABLE_HERE" };
28154
-
28155
28095
  // ../node_modules/.pnpm/convex-helpers@0.1.120_@standard-schema+spec@1.1.0_convex@1.46.0_react@19.2.8__react@19.2.8_typescript@5.9.3_zod@4.6.7/node_modules/convex-helpers/index.js
28156
28096
  var _error = Symbol();
28157
28097
 
@@ -28172,8 +28112,8 @@ var ValidationError = class extends Error {
28172
28112
  got;
28173
28113
  path;
28174
28114
  constructor(expected, got, path11) {
28175
- const message3 = `Validator error${path11 ? ` for ${path11}` : ""}: Expected \`${expected}\`, got \`${got}\``;
28176
- super(message3);
28115
+ const message4 = `Validator error${path11 ? ` for ${path11}` : ""}: Expected \`${expected}\`, got \`${got}\``;
28116
+ super(message4);
28177
28117
  this.expected = expected;
28178
28118
  this.got = got;
28179
28119
  this.path = path11;
@@ -28500,8 +28440,8 @@ function validateOperationResult(validator, raw) {
28500
28440
  return isJsonOperationValue(raw, /* @__PURE__ */ new Set()) && matchesResultShape(validator, raw);
28501
28441
  }
28502
28442
  var OperationResultError = class extends Error {
28503
- constructor(operation, message3 = `Invalid result for ${operation}`) {
28504
- super(message3);
28443
+ constructor(operation, message4 = `Invalid result for ${operation}`) {
28444
+ super(message4);
28505
28445
  this.operation = operation;
28506
28446
  this.name = "OperationResultError";
28507
28447
  }
@@ -28510,14 +28450,14 @@ var OperationResultError = class extends Error {
28510
28450
  return { code: this.code, operation: this.operation, message: this.message };
28511
28451
  }
28512
28452
  };
28513
- function parseOperationResult(operation, validator, raw, message3) {
28453
+ function parseOperationResult(operation, validator, raw, message4) {
28514
28454
  const candidate = forResult(validator, raw, describeConvex);
28515
- if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message3);
28455
+ if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message4);
28516
28456
  return candidate;
28517
28457
  }
28518
- function parseZodOperationResult(operation, schema, raw, message3) {
28458
+ function parseZodOperationResult(operation, schema, raw, message4) {
28519
28459
  const parsed = schema.safeParse(forResult(schema, raw, describeZod));
28520
- if (!parsed.success) throw new OperationResultError(operation, message3);
28460
+ if (!parsed.success) throw new OperationResultError(operation, message4);
28521
28461
  return parsed.data;
28522
28462
  }
28523
28463
 
@@ -28603,11 +28543,11 @@ function parseEntityReadRequest(operation, raw) {
28603
28543
  var ApiError = class extends Error {
28604
28544
  statusCode;
28605
28545
  error;
28606
- constructor(statusCode, message3, error62) {
28607
- super(`HTTP ${statusCode}: ${message3}`);
28546
+ constructor(statusCode, message4, error62) {
28547
+ super(`HTTP ${statusCode}: ${message4}`);
28608
28548
  this.name = "ApiError";
28609
28549
  this.statusCode = statusCode;
28610
- this.detail = message3;
28550
+ this.detail = message4;
28611
28551
  this.error = error62 ?? {};
28612
28552
  }
28613
28553
  /** The backend's human message, without the `HTTP <code>:` prefix. */
@@ -28624,8 +28564,8 @@ var ExitWithCode = class extends Error {
28624
28564
  var UPGRADE_REQUIRED_EXIT_CODE = 3;
28625
28565
  var UpgradeRequiredError = class extends Error {
28626
28566
  data;
28627
- constructor(message3, data = {}) {
28628
- super(message3);
28567
+ constructor(message4, data = {}) {
28568
+ super(message4);
28629
28569
  this.name = "UpgradeRequiredError";
28630
28570
  this.data = data;
28631
28571
  }
@@ -28640,13 +28580,13 @@ async function upgradeRequiredFromResponse(resp, path11) {
28640
28580
  if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
28641
28581
  } catch {
28642
28582
  }
28643
- const message3 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path11} (426 Upgrade Required). Install the latest version.`;
28644
- return new UpgradeRequiredError(message3, data);
28583
+ const message4 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path11} (426 Upgrade Required). Install the latest version.`;
28584
+ return new UpgradeRequiredError(message4, data);
28645
28585
  }
28646
28586
 
28647
28587
  // core/output.ts
28648
- function emit(stdout, data, json4, rowsFn, headers) {
28649
- if (json4 || !rowsFn) {
28588
+ function emit(stdout, data, json3, rowsFn, headers) {
28589
+ if (json3 || !rowsFn) {
28650
28590
  stdout.write(`${JSON.stringify(data, null, 2)}
28651
28591
  `);
28652
28592
  return;
@@ -28656,12 +28596,13 @@ function emit(stdout, data, json4, rowsFn, headers) {
28656
28596
  }
28657
28597
  function errorMessage(err) {
28658
28598
  if (!(err instanceof Error)) return String(err);
28599
+ if ("messageIsComplete" in err && err.messageIsComplete === true) return err.message;
28659
28600
  const data = err.data;
28660
28601
  if (typeof data === "string" && data.length > 0) return data;
28661
28602
  if (data && typeof data === "object") {
28662
- const { message: message3, code: code3 } = data;
28663
- if (typeof message3 === "string" && message3.length > 0) {
28664
- return typeof code3 === "string" ? `${message3} (${code3})` : message3;
28603
+ const { message: message4, code: code3 } = data;
28604
+ if (typeof message4 === "string" && message4.length > 0) {
28605
+ return typeof code3 === "string" ? `${message4} (${code3})` : message4;
28665
28606
  }
28666
28607
  return `${err.message}: ${JSON.stringify(data)}`;
28667
28608
  }
@@ -28678,10 +28619,10 @@ function renderTable(rows, headers) {
28678
28619
  }
28679
28620
 
28680
28621
  // core/errorOutput.ts
28681
- function writeCommandError(stdout, stderr, json4, error62) {
28682
- const message3 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
28683
- if (!json4) {
28684
- stderr.write(`Error: ${message3}
28622
+ function writeCommandError(stdout, stderr, json3, error62) {
28623
+ const message4 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
28624
+ if (!json3) {
28625
+ stderr.write(`Error: ${message4}
28685
28626
  `);
28686
28627
  return;
28687
28628
  }
@@ -28689,7 +28630,7 @@ function writeCommandError(stdout, stderr, json4, error62) {
28689
28630
  const details = data && typeof data === "object" && !Array.isArray(data) ? data : {};
28690
28631
  stdout.write(`${JSON.stringify({ error: {
28691
28632
  ...details,
28692
- message: message3,
28633
+ message: message4,
28693
28634
  ...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
28694
28635
  } }, null, 2)}
28695
28636
  `);
@@ -28742,27 +28683,27 @@ var BaseCommand = class extends Command {
28742
28683
  }
28743
28684
  };
28744
28685
 
28745
- // ente/attrs.ts
28746
- function parseAttrs(pairs) {
28686
+ // ente/field-pairs.ts
28687
+ function parseFieldPairs(pairs) {
28747
28688
  const result = {};
28748
28689
  if (!pairs) return result;
28749
28690
  for (const pair2 of pairs) {
28750
28691
  const eq = pair2.indexOf("=");
28751
- if (eq === -1) throw new Error(`Invalid attribute format: '${pair2}'. Use key=value.`);
28692
+ if (eq === -1) throw new Error(`Invalid field format: '${pair2}'. Use key=value.`);
28752
28693
  result[pair2.slice(0, eq)] = pair2.slice(eq + 1);
28753
28694
  }
28754
28695
  return result;
28755
28696
  }
28756
- function parseOperationAttrs(operation, pairs) {
28697
+ function parseOperationFieldPairs(operation, pairs) {
28757
28698
  try {
28758
- return parseAttrs(pairs);
28699
+ return parseFieldPairs(pairs);
28759
28700
  } catch {
28760
- throw new OperationInputError(operation, [{ path: ["attributes"], reason: "custom" }]);
28701
+ throw new OperationInputError(operation, [{ path: ["field"], reason: "custom" }]);
28761
28702
  }
28762
28703
  }
28763
28704
 
28764
28705
  // ente/version.ts
28765
- var VERSION = "0.4.129";
28706
+ var VERSION = "0.4.131";
28766
28707
 
28767
28708
  // ente/branding.ts
28768
28709
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -28791,7 +28732,7 @@ var PLATFORM_CREDENTIAL = {
28791
28732
  };
28792
28733
 
28793
28734
  // ../packages/shared/src/cli-compatibility.ts
28794
- var CLI_COMPATIBILITY_LEVEL = 1;
28735
+ var CLI_COMPATIBILITY_LEVEL = 2;
28795
28736
  var CLI_VERSION_HEADER = "X-Ente-CLI-Version";
28796
28737
  var CLI_COMPATIBILITY_HEADER = "X-Ente-CLI-Compatibility";
28797
28738
  function cliCompatibilityHeaders(version5) {
@@ -28819,10 +28760,16 @@ var activityFieldInputValidator = v.object({
28819
28760
  value: v.union(v.string(), v.number(), v.boolean(), v.array(v.string()), v.null())
28820
28761
  });
28821
28762
 
28822
- // ../packages/shared/src/input-fields.ts
28823
- function isInputRecord(value) {
28824
- return value !== null && typeof value === "object" && !Array.isArray(value);
28763
+ // ../packages/shared/src/activity-field-errors.ts
28764
+ var ACTIVITY_ATTRIBUTES_RETIRED = 'ACTIVITY_ATTRIBUTES_RETIRED: Activity attributes are now typed fields. REST/MCP: replace "attributes": {"<key>": "\u2026"} with "fields": [{"label": "<key>", "value": "\u2026"}]. Native callers: use activityFields.setValues or activityFields.setCell; value: null removes a value. CLI: run ente update, then use --field key=value. See docs/activity-fields.md for examples.';
28765
+ function hasRetiredActivityAttributes(operation, input2) {
28766
+ if (!input2 || typeof input2 !== "object" || Array.isArray(input2)) return false;
28767
+ if (Object.hasOwn(input2, "attributes")) return true;
28768
+ if (operation !== "batchUpdateTasks" || !("updates" in input2) || !Array.isArray(input2.updates)) return false;
28769
+ return input2.updates.slice(0, 8192).some((item) => item && typeof item === "object" && Object.hasOwn(item, "attributes"));
28825
28770
  }
28771
+
28772
+ // ../packages/shared/src/input-fields.ts
28826
28773
  function optionalStringArray(value) {
28827
28774
  return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : void 0;
28828
28775
  }
@@ -28837,24 +28784,9 @@ function optionalBoolean(value) {
28837
28784
  function isActivityType(value) {
28838
28785
  return typeof value === "string" && ACTIVITY_TYPE_VALUES.some((type) => type === value);
28839
28786
  }
28840
- function stringAttributes(value) {
28841
- const result = {};
28842
- for (const [key, entry] of Object.entries(value)) {
28843
- if (typeof entry !== "string") return void 0;
28844
- result[key] = entry;
28845
- }
28846
- return result;
28847
- }
28848
- function updateAttributes(value) {
28849
- const result = {};
28850
- for (const [key, entry] of Object.entries(value)) {
28851
- if (typeof entry !== "string" && entry !== null) return void 0;
28852
- result[key] = entry;
28853
- }
28854
- return result;
28855
- }
28856
- var invalid = (message3) => ({ ok: false, message: message3 });
28787
+ var invalid = (message4) => ({ ok: false, message: message4 });
28857
28788
  function parseActivityCreateInput(args, name4 = "activities_create") {
28789
+ if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
28858
28790
  if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
28859
28791
  if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
28860
28792
  return invalid(`${name4} sourceCreatedAt must be an object: { date: "YYYY-MM-DD", time?: "HH:mm" | null, timezone?: string }`);
@@ -28867,9 +28799,6 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
28867
28799
  return invalid(`${name4} deadline must be a readable deadline object or number`);
28868
28800
  if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
28869
28801
  return invalid(`${name4} agentAssigneeIds must be an array of at most ${MAX_ACTIVITY_AGENT_ASSIGNEES} non-empty IDs`);
28870
- const attributes2 = isInputRecord(args.attributes) ? stringAttributes(args.attributes) : void 0;
28871
- if (args.attributes === null || isInputRecord(args.attributes) && attributes2 === void 0)
28872
- return invalid(`${name4} attributes must contain string values`);
28873
28802
  return { ok: true, value: {
28874
28803
  entityIds,
28875
28804
  type: args.type,
@@ -28879,7 +28808,6 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
28879
28808
  spaceId: typeof args.spaceId === "string" ? args.spaceId : void 0,
28880
28809
  deadline: isDeadlineInput(args.deadline) ? args.deadline : void 0,
28881
28810
  completed: optionalBoolean(args.completed),
28882
- attributes: attributes2,
28883
28811
  fields: fields4,
28884
28812
  sourceCreatedAt: isSourceCreatedAtInput(args.sourceCreatedAt) ? args.sourceCreatedAt : void 0,
28885
28813
  tags: optionalStringArray(args.tags),
@@ -28890,6 +28818,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
28890
28818
  } };
28891
28819
  }
28892
28820
  function parseActivityUpdateInput(args, name4 = "activities_update") {
28821
+ if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
28893
28822
  if (typeof args.activityId !== "string") return invalid(`${name4} requires string activityId`);
28894
28823
  if ("deadline" in args && !isNullableDeadlineInput(args.deadline))
28895
28824
  return invalid(`${name4} deadline must be a readable deadline object, number, or null`);
@@ -28899,9 +28828,6 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
28899
28828
  const fields4 = args.fields === void 0 ? void 0 : activityFieldInputsSchema.parse(args.fields);
28900
28829
  const entityIds = optionalStringArray(args.entityIds);
28901
28830
  if (args.entityIds !== void 0 && !entityIds?.length) return invalid(`${name4} entityIds must be a non-empty string array`);
28902
- if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid(`${name4} attributes must be an object`);
28903
- const attributes2 = isInputRecord(args.attributes) ? updateAttributes(args.attributes) : void 0;
28904
- if (isInputRecord(args.attributes) && attributes2 === void 0) return invalid(`${name4} attributes must contain string or null values`);
28905
28831
  for (const key of ["assigneeIds", "assigneeEmails"])
28906
28832
  if (args[key] !== void 0 && !optionalStringArray(args[key])) return invalid(`${name4} ${key} must be an array of strings`);
28907
28833
  if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
@@ -28914,7 +28840,6 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
28914
28840
  deadline: isNullableDeadlineInput(args.deadline) ? args.deadline : void 0,
28915
28841
  entityIds,
28916
28842
  type: isActivityType(args.type) ? args.type : void 0,
28917
- attributes: attributes2,
28918
28843
  fields: fields4,
28919
28844
  assigneeIds: optionalStringArray(args.assigneeIds),
28920
28845
  assigneeEmails: optionalStringArray(args.assigneeEmails),
@@ -28939,25 +28864,21 @@ function validDate(value) {
28939
28864
  var activityWriteDeadline = external_exports.union([external_exports.number(), readableActivityDate]);
28940
28865
  var nullableDeadline = activityWriteDeadline.nullable();
28941
28866
  var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
28942
- var stringAttributes2 = external_exports.record(attributeKey, external_exports.string()).describe("Legacy input: ACTIVITY_ATTRIBUTES_RETIRED when server retirement is on (default off); use fields.");
28943
- var patchAttributes = attributeStringPatch.describe("Legacy input: ACTIVITY_ATTRIBUTES_RETIRED when server retirement is on (default off); use fields.");
28944
- var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
28867
+ var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
28945
28868
  var assignment = external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, action: external_exports.enum(["replace", "add", "remove", "clear"]), assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.describe("At most 20 IDs for replace. Add/remove/clear retain the installed bounded wire array; add deduplicates before enforcing at most 20 assigned agents in the resulting task. Assignment grants no access.").optional() }).refine((value) => value.action !== "replace" || value.agentAssigneeIds === void 0 || value.agentAssigneeIds.length <= MAX_ACTIVITY_AGENT_ASSIGNEES, { path: ["agentAssigneeIds"], message: "Too many replacement agent assignees" });
28946
- var attributes = external_exports.strictObject({ activityId: id4, action: external_exports.enum(["set", "remove", "replace", "clear"]), attributes: stringAttributes2.optional(), keys: strings.optional() }).refine((value) => value.action !== "set" || value.attributes !== void 0 && Object.keys(value.attributes).length > 0, { path: ["attributes"], message: "set requires attributes" }).refine((value) => value.action !== "remove" || value.keys !== void 0 && value.keys.length > 0, { path: ["keys"], message: "remove requires keys" });
28947
28869
  var activityWriteInputs = {
28948
- createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), attributes: stringAttributes2.optional(), fields: activityFieldInputsSchema.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
28870
+ createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), fields: activityFieldInputsSchema.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
28949
28871
  updateActivity: external_exports.strictObject(updateFields),
28950
28872
  updateActivityTitle: external_exports.strictObject({ activityId: id4, title: external_exports.string() }),
28951
28873
  updateActivityDeadline: external_exports.strictObject({ activityId: id4, deadline: nullableDeadline.optional() }),
28952
28874
  updateActivityContent: external_exports.strictObject({ activityId: id4, markdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION) }),
28953
- updateActivityAttributes: attributes,
28954
28875
  updateActivityAssignees: assignment,
28955
28876
  toggleActivityCompleted: external_exports.strictObject({ activityId: id4 }),
28956
28877
  addActivityMessage: external_exports.strictObject({ activityId: id4, content: external_exports.string().regex(/\S/, "Message content is required") }),
28957
28878
  deleteActivityMessage: external_exports.strictObject({ messageId: id4 }),
28958
28879
  deleteActivity: external_exports.strictObject({ activityId: id4 }),
28959
28880
  restoreActivity: external_exports.strictObject({ activityId: id4 }),
28960
- batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
28881
+ batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), fields: activityFieldInputsSchema.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
28961
28882
  };
28962
28883
  var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
28963
28884
  function isActivityWriteOperationName(name4) {
@@ -28967,6 +28888,7 @@ function parserMismatch(operation) {
28967
28888
  throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
28968
28889
  }
28969
28890
  function parseActivityWriteRequest(operation, raw) {
28891
+ rejectActivityAttributesInput(operation, raw);
28970
28892
  if (raw && typeof raw === "object" && !Array.isArray(raw)) raw = Object.fromEntries(Object.entries(raw).filter(([key, value]) => value !== void 0 || !Object.hasOwn(activityWriteInputs[operation].shape, key)));
28971
28893
  switch (operation) {
28972
28894
  case "createActivity": {
@@ -28985,8 +28907,6 @@ function parseActivityWriteRequest(operation, raw) {
28985
28907
  return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityDeadline, raw) };
28986
28908
  case "updateActivityContent":
28987
28909
  return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityContent, raw) };
28988
- case "updateActivityAttributes":
28989
- return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityAttributes, raw) };
28990
28910
  case "updateActivityAssignees":
28991
28911
  return { operation, input: parseOperationInput(operation, activityWriteInputs.updateActivityAssignees, raw) };
28992
28912
  case "toggleActivityCompleted":
@@ -29003,6 +28923,13 @@ function parseActivityWriteRequest(operation, raw) {
29003
28923
  return { operation, input: parseOperationInput(operation, activityWriteInputs.batchUpdateTasks, raw) };
29004
28924
  }
29005
28925
  }
28926
+ function rejectActivityAttributesInput(operation, raw) {
28927
+ if (!hasRetiredActivityAttributes(operation, raw)) return;
28928
+ const error62 = new OperationInputError(operation, [{ path: ["attributes"], reason: "unrecognized_keys" }]);
28929
+ error62.message = ACTIVITY_ATTRIBUTES_RETIRED;
28930
+ Object.assign(error62, { messageIsComplete: true });
28931
+ throw error62;
28932
+ }
29006
28933
 
29007
28934
  // ../packages/shared/src/activity-write-operation-results.ts
29008
28935
  var id5 = external_exports.string().min(1);
@@ -29013,7 +28940,6 @@ var activityWriteResults = {
29013
28940
  updateActivityTitle: ack,
29014
28941
  updateActivityDeadline: ack,
29015
28942
  updateActivityContent: ack,
29016
- updateActivityAttributes: ack,
29017
28943
  updateActivityAssignees: ack,
29018
28944
  toggleActivityCompleted: external_exports.strictObject({ completed: external_exports.boolean() }),
29019
28945
  addActivityMessage: external_exports.strictObject({ messageId: id5 }),
@@ -29109,15 +29035,14 @@ function operationResultSchema(validator) {
29109
29035
  }
29110
29036
 
29111
29037
  // ../packages/shared/src/activity-write-catalog.ts
29112
- var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "updateActivityAttributes", "toggleActivityCompleted", "batchUpdateTasks"]);
29038
+ var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "toggleActivityCompleted", "batchUpdateTasks"]);
29113
29039
  var descriptions = {
29114
29040
  createActivity: "Create in an explicit space with existing owners. externalKey reserves an agent-and-space task key atomically; retries return the first ID without applying changed fields, including completed/deleted tasks. sourceCreatedAt is for imports. fields use label or fieldId, optional type and typed value; null clears. JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
29115
- updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped; overlap with attributes is rejected. Attributes remain a compatibility alias: strings merge and null removes, with canonical-only storage after cutover and original key spelling in reads. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
29041
+ updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped. The removed attributes input is rejected; use fields. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
29116
29042
  updateActivityTitle: "Set or clear an activity title. Existing revision and verified updater bookkeeping stay in the same transaction.",
29117
29043
  updateActivityDeadline: "Set a readable or finite epoch deadline; null clears it and omission leaves it unchanged in this profile.",
29118
29044
  updateActivityContent: "Replace the ordinary activity body with markdown, preserving revisions and read-only provider-email policy. Version-window editing is a separate operation family.",
29119
- updateActivityAttributes: "Compatibility alias over canonical fields; original key spellings round-trip. Set merges strings, remove deletes selected keys, replace deletes previously observed keys and applies strings, clear deletes previously observed keys. Uses the existing authorized read then write profile; concurrent unseen keys may survive replace/clear. Receipt acknowledges the committing mutation; legacy enrichment is a later observation.",
29120
- updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports commit; legacy enrichment is later.",
29045
+ updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports the committed mutation.",
29121
29046
  toggleActivityCompleted: "Toggle using the native read-then-set profile. The inverse is selected before the write, so concurrent toggles are not serialized as repeated atomic flips. Receipt reports the completed value committed by this write. Explicit updateActivity.completed remains idempotent.",
29122
29047
  addActivityMessage: "Append an ordinary activity discussion message with verified author and agent identity. This is separate from human-only Native Messenger and from edits to the parent activity body.",
29123
29048
  deleteActivityMessage: "Permanently delete an activity message you authored. Agents delete only their own agent's messages.",
@@ -29141,10 +29066,6 @@ function definition(name4) {
29141
29066
  const conditions = name4 === "updateActivityAssignees" ? [{ anyOf: [
29142
29067
  { type: "object", properties: { action: { enum: ["add", "remove", "clear"] } } },
29143
29068
  { type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
29144
- ] }] : name4 === "updateActivityAttributes" ? [{ anyOf: [
29145
- { type: "object", properties: { ...properties, action: { enum: ["replace", "clear"] } }, additionalProperties: false },
29146
- { type: "object", properties: { ...properties, action: { const: "set" }, attributes: { ...propertySchema(properties.attributes), minProperties: 1 } }, required: ["attributes"], additionalProperties: false },
29147
- { type: "object", properties: { ...properties, action: { const: "remove" }, keys: { ...propertySchema(properties.keys), minItems: 1 } }, required: ["keys"], additionalProperties: false }
29148
29069
  ] }] : void 0;
29149
29070
  const resultSchema3 = external_exports.toJSONSchema(activityWriteResults[name4]);
29150
29071
  return {
@@ -29160,14 +29081,12 @@ function definition(name4) {
29160
29081
  environment: "content",
29161
29082
  executionProfile: "full",
29162
29083
  resultProjection: "commit-receipt",
29163
- availability: { hosted: name4 !== "updateActivity", external: Object.values(activityWriteAliases).some((operation) => operation === name4), browserHuman: false, agentConnection: Object.values(activityWriteAliases).some((operation) => operation === name4), executionProfiles: ["full", "public-cli"], runtime: composite.has(name4) ? "action" : "mutation" },
29084
+ availability: { hosted: true, external: Object.values(activityWriteAliases).some((operation) => operation === name4), browserHuman: false, agentConnection: Object.values(activityWriteAliases).some((operation) => operation === name4), executionProfiles: ["full", "public-cli"], runtime: composite.has(name4) ? "action" : "mutation" },
29164
29085
  limits: ACTIVITY_WRITE_LIMITS,
29165
29086
  profiles: {
29166
29087
  rest: { available: ["createActivity", "updateActivity", "updateActivityAssignees", "deleteActivity", "restoreActivity"].includes(name4), result: "commit-receipt" },
29167
29088
  canonical: { result: "commit-receipt", wholeActionRollback: !composite.has(name4), concurrency: composite.has(name4) ? "existing-native-stages" : "protected-transaction" },
29168
- legacyNative: { primary: false, result: name4 === "updateActivityAssignees" || name4 === "updateActivityAttributes" ? "later-enrichment-observation" : "legacy-wrapper", wholeActionRollback: false },
29169
- legacyMcp: { primary: false, result: "installed-alias-wrapper", createEmptyAutoLinks: "omitted", messageSuccessFlag: false },
29170
- publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedDatabaseAttributes: name4 === "updateActivity" || name4 === "updateActivityAttributes" },
29089
+ publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedFields: name4 === "updateActivity" },
29171
29090
  realtime: { primary: false, available: name4 === "createActivity", source: "verified-session-createTask", speechAndLeaseRequired: true, finishAndResultValidation: "same-transaction" }
29172
29091
  },
29173
29092
  compatibilityAliases: Object.entries(activityWriteAliases).filter(([, operation]) => operation === name4).map(([alias]) => alias),
@@ -29999,11 +29918,11 @@ function mapPayloads(operation, raw, transform2) {
29999
29918
  if (operation !== "agent_thread_get") return raw;
30000
29919
  if (!matchesResultShape(operatorThreadDetailValidator, raw)) throw new OperationResultError(operation);
30001
29920
  if (!raw) return null;
30002
- return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message3) => ({
30003
- ...message3,
30004
- ...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
30005
- ...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
30006
- ...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
29921
+ return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message4) => ({
29922
+ ...message4,
29923
+ ...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
29924
+ ...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
29925
+ ...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
30007
29926
  })) } };
30008
29927
  }
30009
29928
  function checkPageBounds(operation, data) {
@@ -30017,9 +29936,9 @@ function checkPageBounds(operation, data) {
30017
29936
  }
30018
29937
  function parseAgentContextResult(operation, raw) {
30019
29938
  if (!matchesResultShape(agentContextResults[operation], raw)) throw new OperationResultError(operation);
30020
- const json4 = mapPayloads(operation, raw, encodeAgentContextPayload);
30021
- parseOperationResult(operation, agentContextResults[operation], json4);
30022
- checkPageBounds(operation, json4);
29939
+ const json3 = mapPayloads(operation, raw, encodeAgentContextPayload);
29940
+ parseOperationResult(operation, agentContextResults[operation], json3);
29941
+ checkPageBounds(operation, json3);
30023
29942
  return raw;
30024
29943
  }
30025
29944
  function parseAgentContextJsonResult(operation, raw) {
@@ -33252,9 +33171,7 @@ var activityReadFields = {
33252
33171
  tags: external_exports.array(external_exports.string()).optional(),
33253
33172
  assigneeIds: external_exports.array(id10).optional(),
33254
33173
  agentAssigneeIds: external_exports.array(id10).optional(),
33255
- attributes: external_exports.record(external_exports.string(), external_exports.json()).optional(),
33256
- fields: external_exports.array(externalActivityFieldValueSchema).optional(),
33257
- fieldIndexReady: external_exports.boolean().optional(),
33174
+ fields: external_exports.array(externalActivityFieldValueSchema),
33258
33175
  createdAt: external_exports.number(),
33259
33176
  updatedAt: external_exports.number(),
33260
33177
  spaceId: id10,
@@ -33289,7 +33206,7 @@ var selectRichEntity = external_exports.object({ ...selectPublicEntityRead.shape
33289
33206
  var selectSearch = external_exports.object({ ...entityReadFullSearch.shape, entities: external_exports.array(external_exports.object({ entity: selectRichEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), selectSpace) });
33290
33207
  var selectDetail = external_exports.object({ ...entityReadFullDetail.unwrap().shape, entity: selectRichEntity, activities: external_exports.array(selectPublicActivityRead), spaces: external_exports.array(selectSpace) }).nullable();
33291
33208
  var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
33292
- var compactActivity = entityReadActivity.pick({ fields: true, fieldIndexReady: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true });
33209
+ var compactActivity = entityReadActivity.pick({ fields: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true });
33293
33210
  var compactList = entityReadFullList.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), compactSpace) });
33294
33211
  var compactSearch = entityReadFullSearch.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), compactSpace) });
33295
33212
  var compactDetail = entityReadFullDetail.unwrap().extend({ entity: compactEntity, activities: external_exports.array(compactActivity), spaces: external_exports.array(compactSpace) }).nullable();
@@ -33364,7 +33281,7 @@ var ENTITY_CREATE_INPUT_SCHEMA = {
33364
33281
  function isEntityType(value) {
33365
33282
  return typeof value === "string" && ENTITY_TYPE_VALUES.some((type) => type === value);
33366
33283
  }
33367
- var invalid2 = (message3) => ({ ok: false, message: message3 });
33284
+ var invalid2 = (message4) => ({ ok: false, message: message4 });
33368
33285
  function parseEntityCreateInput(args, name4 = "entities_create") {
33369
33286
  if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
33370
33287
  if (args.parentEntityId !== void 0 && (typeof args.parentEntityId !== "string" || !args.parentEntityId.trim()))
@@ -33573,8 +33490,8 @@ var selectDetail2 = external_exports.object({
33573
33490
  agendaPoints: external_exports.array(external_exports.object(agenda.shape)),
33574
33491
  messages: external_exports.array(external_exports.object({ ...message.shape, createdByUser: selectUser.nullable(), createdByAgent: selectAgent.nullable().optional(), updatedByAgent: selectAgent.nullable().optional() }))
33575
33492
  }).nullable();
33576
- var compactActivity2 = publicActivityRecordDto.pick({ fields: true, fieldIndexReady: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true, createdBy: true, deletedAt: true });
33577
- var compactDetail2 = publicActivityDetailDto.omit({ attributes: true, attachments: true }).extend({
33493
+ var compactActivity2 = publicActivityRecordDto.pick({ fields: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true, createdBy: true, deletedAt: true });
33494
+ var compactDetail2 = publicActivityDetailDto.omit({ attachments: true }).extend({
33578
33495
  entityDetails: external_exports.array(external_exports.strictObject(publicEntityReadDto.shape).pick({ _id: true, name: true, type: true, displayName: true, parentNames: true, parentDetails: true }).nullable())
33579
33496
  });
33580
33497
  var pageFields = { hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional() };
@@ -33644,7 +33561,7 @@ var fields2 = {
33644
33561
  release: ["assignmentId", "claimToken"]
33645
33562
  };
33646
33563
  function validateAgentTaskInput(raw) {
33647
- const invalid4 = (message3) => ({ ok: false, message: message3 });
33564
+ const invalid4 = (message4) => ({ ok: false, message: message4 });
33648
33565
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return invalid4("Task input must be an object");
33649
33566
  const input2 = raw;
33650
33567
  if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return invalid4("Unknown task operation");
@@ -33832,8 +33749,7 @@ var queueItemValidator = v.object({
33832
33749
  assignmentId: v.id("taskAgentAssignments"),
33833
33750
  activityId: v.id("activities"),
33834
33751
  spaceId: v.id("spaces"),
33835
- fields: v.optional(v.array(externalActivityFieldValueValidator)),
33836
- fieldIndexReady: v.optional(v.boolean()),
33752
+ fields: v.array(externalActivityFieldValueValidator),
33837
33753
  title: v.optional(v.string()),
33838
33754
  deadline: v.optional(v.number()),
33839
33755
  completed: v.boolean(),
@@ -34267,7 +34183,7 @@ var RestClient = class {
34267
34183
  }
34268
34184
  };
34269
34185
  function toApiError(status2, statusText, text3) {
34270
- let message3 = statusText || "Unknown error";
34186
+ let message4 = statusText || "Unknown error";
34271
34187
  let structured = {};
34272
34188
  if (text3) {
34273
34189
  try {
@@ -34276,14 +34192,14 @@ function toApiError(status2, statusText, text3) {
34276
34192
  if (raw && typeof raw === "object") {
34277
34193
  structured = raw;
34278
34194
  const m = raw.message;
34279
- if (typeof m === "string") message3 = m;
34195
+ if (typeof m === "string") message4 = m;
34280
34196
  } else if (typeof raw === "string") {
34281
- message3 = raw;
34197
+ message4 = raw;
34282
34198
  }
34283
34199
  } catch {
34284
34200
  }
34285
34201
  }
34286
- return new ApiError(status2, message3, structured);
34202
+ return new ApiError(status2, message4, structured);
34287
34203
  }
34288
34204
 
34289
34205
  // core/config.ts
@@ -34331,10 +34247,10 @@ var TomlError = class _TomlError extends Error {
34331
34247
  line;
34332
34248
  column;
34333
34249
  codeblock;
34334
- constructor(message3, options) {
34250
+ constructor(message4, options) {
34335
34251
  const [line, column] = getLineColFromPtr(options.toml, options.ptr);
34336
34252
  const codeblock = makeCodeBlock(options.toml, line, column);
34337
- super(`Invalid TOML document: ${message3}
34253
+ super(`Invalid TOML document: ${message4}
34338
34254
 
34339
34255
  ${codeblock}`, options);
34340
34256
  this.line = line;
@@ -34342,8 +34258,8 @@ ${codeblock}`, options);
34342
34258
  this.codeblock = codeblock;
34343
34259
  }
34344
34260
  /** @internal */
34345
- static x(message3, ctx, ptr) {
34346
- throw new _TomlError(message3, { toml: ctx.s, ptr: ptr ?? ctx.p });
34261
+ static x(message4, ctx, ptr) {
34262
+ throw new _TomlError(message4, { toml: ctx.s, ptr: ptr ?? ctx.p });
34347
34263
  }
34348
34264
  };
34349
34265
 
@@ -35303,7 +35219,10 @@ var EnteClient = class _EnteClient {
35303
35219
  const request = parseActivityWriteRequest(operation, input2);
35304
35220
  const binding = activityWriteRestBindings.find((item) => item.operation === operation);
35305
35221
  if (!binding) throw new Error("Operation has no REST binding");
35306
- const response = await this.rest.sendJson(binding.method, binding.path, request.input);
35222
+ const response = await this.rest.sendJson(binding.method, binding.path, request.input).catch((error62) => {
35223
+ if (error62 instanceof ApiError && error62.detail.startsWith("ACTIVITY_ATTRIBUTES_RETIRED:")) error62.message = error62.detail;
35224
+ throw error62;
35225
+ });
35307
35226
  return { data: parseZodOperationResult(operation, activityWriteResults[operation], response.data) };
35308
35227
  }
35309
35228
  async activityRead(operation, input2) {
@@ -35832,11 +35751,11 @@ function formatActivityDetail(a) {
35832
35751
  if (a.messages?.length) {
35833
35752
  lines.push("");
35834
35753
  lines.push(`Messages (${a.messages.length}):`);
35835
- for (const message3 of a.messages) {
35836
- const indent = " ".repeat(message3.depth ?? 0);
35837
- const author = message3.createdByUser?.name || message3.createdByUser?.email || message3.createdBy;
35838
- const contentLines = message3.contentPlainText.split("\n");
35839
- const replyTarget = message3.parentMessageId ? ` [reply to ${message3.parentMessageId}]` : "";
35754
+ for (const message4 of a.messages) {
35755
+ const indent = " ".repeat(message4.depth ?? 0);
35756
+ const author = message4.createdByUser?.name || message4.createdByUser?.email || message4.createdBy;
35757
+ const contentLines = message4.contentPlainText.split("\n");
35758
+ const replyTarget = message4.parentMessageId ? ` [reply to ${message4.parentMessageId}]` : "";
35840
35759
  lines.push(`${indent}${author}: ${contentLines[0] ?? ""}${replyTarget}`);
35841
35760
  for (const contentLine of contentLines.slice(1))
35842
35761
  lines.push(`${indent} ${contentLine}`);
@@ -35975,7 +35894,7 @@ ${footer}` : body;
35975
35894
  }
35976
35895
  // --- shared: activity list (used by `activity list` and `tasks`) --------
35977
35896
  async runActivityList(opts) {
35978
- const attrDict = parseOperationAttrs("listActivities", opts.attrFilter);
35897
+ const attrDict = parseOperationFieldPairs("listActivities", opts.attrFilter);
35979
35898
  if (Object.keys(attrDict).length) {
35980
35899
  if (opts.compact || opts.cursor !== void 0 || opts.minCount !== void 0) throw new Error("Indexed field filters do not accept history cursors or minimum counts");
35981
35900
  const filters = (opts.attrFilter ?? []).map((raw) => {
@@ -36440,8 +36359,8 @@ var AgentPermissions = class extends ClientCommand {
36440
36359
  if (matches.length !== 1) throw new Error(matches.length ? `Space '${query}' is ambiguous; use its ID.` : `Space '${query}' was not found in this account; check its ID and account membership.`);
36441
36360
  const space3 = matches[0];
36442
36361
  const allowed = this.action === "write" ? space3.canWrite : space3.canRead;
36443
- const message3 = allowed ? `${this.action} allowed in '${space3.name}' for agent '${identity2.name}'.` : `${this.action} denied in '${space3.name}' for agent '${identity2.name}' (effective access: ${space3.access}). In the web app, check this agent's per-space 'Agent actions' setting and this key's read/write scopes in Connections. Connection and OAuth consent limits also apply.`;
36444
- this.emitText({ ...selection2, allowed, action: this.action, ...space3, message: message3 }, () => message3);
36362
+ const message4 = allowed ? `${this.action} allowed in '${space3.name}' for agent '${identity2.name}'.` : `${this.action} denied in '${space3.name}' for agent '${identity2.name}' (effective access: ${space3.access}). In the web app, check this agent's per-space 'Agent actions' setting and this key's read/write scopes in Connections. Connection and OAuth consent limits also apply.`;
36363
+ this.emitText({ ...selection2, allowed, action: this.action, ...space3, message: message4 }, () => message4);
36445
36364
  return allowed ? 0 : 1;
36446
36365
  }
36447
36366
  this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((space3) => ({
@@ -36549,24 +36468,24 @@ function instantiateDefaultLogger(options) {
36549
36468
  function instantiateNoopLogger(options) {
36550
36469
  return new DefaultLogger(options);
36551
36470
  }
36552
- function logForFunction(logger, type, source2, udfPath, message3) {
36471
+ function logForFunction(logger, type, source2, udfPath, message4) {
36553
36472
  const prefix = prefix_for_source(source2);
36554
- if (typeof message3 === "object") {
36555
- message3 = `ConvexError ${JSON.stringify(message3.errorData, null, 2)}`;
36473
+ if (typeof message4 === "object") {
36474
+ message4 = `ConvexError ${JSON.stringify(message4.errorData, null, 2)}`;
36556
36475
  }
36557
36476
  if (type === "info") {
36558
- const match = message3.match(/^\[.*?\] /);
36477
+ const match = message4.match(/^\[.*?\] /);
36559
36478
  if (match === null) {
36560
36479
  logger.error(
36561
36480
  `[CONVEX ${prefix}(${udfPath})] Could not parse console.log`
36562
36481
  );
36563
36482
  return;
36564
36483
  }
36565
- const level = message3.slice(1, match[0].length - 2);
36566
- const args = message3.slice(match[0].length);
36484
+ const level = message4.slice(1, match[0].length - 2);
36485
+ const args = message4.slice(match[0].length);
36567
36486
  logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
36568
36487
  } else {
36569
- logger.error(`[CONVEX ${prefix}(${udfPath})] ${message3}`);
36488
+ logger.error(`[CONVEX ${prefix}(${udfPath})] ${message4}`);
36570
36489
  }
36571
36490
  }
36572
36491
 
@@ -38265,11 +38184,11 @@ var require_receiver = __commonJS2({
38265
38184
  * @return {(Error|RangeError)} The error
38266
38185
  * @private
38267
38186
  */
38268
- createError(ErrorCtor, message3, prefix, statusCode, errorCode) {
38187
+ createError(ErrorCtor, message4, prefix, statusCode, errorCode) {
38269
38188
  this._loop = false;
38270
38189
  this._errored = true;
38271
38190
  const err = new ErrorCtor(
38272
- prefix ? `Invalid WebSocket frame: ${message3}` : message3
38191
+ prefix ? `Invalid WebSocket frame: ${message4}` : message4
38273
38192
  );
38274
38193
  Error.captureStackTrace(err, this.createError);
38275
38194
  err.code = errorCode;
@@ -38931,10 +38850,10 @@ var require_event_target = __commonJS2({
38931
38850
  callListener(handler, this, event);
38932
38851
  };
38933
38852
  } else if (type === "close") {
38934
- wrapper = function onClose(code3, message3) {
38853
+ wrapper = function onClose(code3, message4) {
38935
38854
  const event = new CloseEvent("close", {
38936
38855
  code: code3,
38937
- reason: message3.toString(),
38856
+ reason: message4.toString(),
38938
38857
  wasClean: this._closeFrameReceived && this._closeFrameSent
38939
38858
  });
38940
38859
  event[kTarget] = this;
@@ -39849,29 +39768,29 @@ var require_websocket = __commonJS2({
39849
39768
  const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
39850
39769
  if (secWebSocketExtensions !== void 0) {
39851
39770
  if (!perMessageDeflate) {
39852
- const message3 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
39853
- abortHandshake(websocket, socket, message3);
39771
+ const message4 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
39772
+ abortHandshake(websocket, socket, message4);
39854
39773
  return;
39855
39774
  }
39856
39775
  let extensions;
39857
39776
  try {
39858
39777
  extensions = parse4(secWebSocketExtensions);
39859
39778
  } catch (err) {
39860
- const message3 = "Invalid Sec-WebSocket-Extensions header";
39861
- abortHandshake(websocket, socket, message3);
39779
+ const message4 = "Invalid Sec-WebSocket-Extensions header";
39780
+ abortHandshake(websocket, socket, message4);
39862
39781
  return;
39863
39782
  }
39864
39783
  const extensionNames = Object.keys(extensions);
39865
39784
  if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
39866
- const message3 = "Server indicated an extension that was not requested";
39867
- abortHandshake(websocket, socket, message3);
39785
+ const message4 = "Server indicated an extension that was not requested";
39786
+ abortHandshake(websocket, socket, message4);
39868
39787
  return;
39869
39788
  }
39870
39789
  try {
39871
39790
  perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
39872
39791
  } catch (err) {
39873
- const message3 = "Invalid Sec-WebSocket-Extensions header";
39874
- abortHandshake(websocket, socket, message3);
39792
+ const message4 = "Invalid Sec-WebSocket-Extensions header";
39793
+ abortHandshake(websocket, socket, message4);
39875
39794
  return;
39876
39795
  }
39877
39796
  websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
@@ -39908,9 +39827,9 @@ var require_websocket = __commonJS2({
39908
39827
  }
39909
39828
  return tls.connect(options);
39910
39829
  }
39911
- function abortHandshake(websocket, stream, message3) {
39830
+ function abortHandshake(websocket, stream, message4) {
39912
39831
  websocket._readyState = WebSocket2.CLOSING;
39913
- const err = new Error(message3);
39832
+ const err = new Error(message4);
39914
39833
  Error.captureStackTrace(err, abortHandshake);
39915
39834
  if (stream.setHeader) {
39916
39835
  stream[kAborted] = true;
@@ -40072,7 +39991,7 @@ var require_stream = __commonJS2({
40072
39991
  objectMode: false,
40073
39992
  writableObjectMode: false
40074
39993
  });
40075
- ws.on("message", function message3(msg, isBinary) {
39994
+ ws.on("message", function message4(msg, isBinary) {
40076
39995
  const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
40077
39996
  if (!duplex.push(data)) ws.pause();
40078
39997
  });
@@ -40391,23 +40310,23 @@ var require_websocket_server = __commonJS2({
40391
40310
  const upgrade = req.headers.upgrade;
40392
40311
  const version5 = +req.headers["sec-websocket-version"];
40393
40312
  if (req.method !== "GET") {
40394
- const message3 = "Invalid HTTP method";
40395
- abortHandshakeOrEmitwsClientError(this, req, socket, 405, message3);
40313
+ const message4 = "Invalid HTTP method";
40314
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message4);
40396
40315
  return;
40397
40316
  }
40398
40317
  if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
40399
- const message3 = "Invalid Upgrade header";
40400
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40318
+ const message4 = "Invalid Upgrade header";
40319
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40401
40320
  return;
40402
40321
  }
40403
40322
  if (key === void 0 || !keyRegex.test(key)) {
40404
- const message3 = "Missing or invalid Sec-WebSocket-Key header";
40405
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40323
+ const message4 = "Missing or invalid Sec-WebSocket-Key header";
40324
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40406
40325
  return;
40407
40326
  }
40408
40327
  if (version5 !== 13 && version5 !== 8) {
40409
- const message3 = "Missing or invalid Sec-WebSocket-Version header";
40410
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3, {
40328
+ const message4 = "Missing or invalid Sec-WebSocket-Version header";
40329
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4, {
40411
40330
  "Sec-WebSocket-Version": "13, 8"
40412
40331
  });
40413
40332
  return;
@@ -40422,8 +40341,8 @@ var require_websocket_server = __commonJS2({
40422
40341
  try {
40423
40342
  protocols = subprotocol2.parse(secWebSocketProtocol);
40424
40343
  } catch (err) {
40425
- const message3 = "Invalid Sec-WebSocket-Protocol header";
40426
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40344
+ const message4 = "Invalid Sec-WebSocket-Protocol header";
40345
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40427
40346
  return;
40428
40347
  }
40429
40348
  }
@@ -40442,8 +40361,8 @@ var require_websocket_server = __commonJS2({
40442
40361
  extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
40443
40362
  }
40444
40363
  } catch (err) {
40445
- const message3 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
40446
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40364
+ const message4 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
40365
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40447
40366
  return;
40448
40367
  }
40449
40368
  }
@@ -40454,9 +40373,9 @@ var require_websocket_server = __commonJS2({
40454
40373
  req
40455
40374
  };
40456
40375
  if (this.options.verifyClient.length === 2) {
40457
- this.options.verifyClient(info, (verified, code3, message3, headers) => {
40376
+ this.options.verifyClient(info, (verified, code3, message4, headers) => {
40458
40377
  if (!verified) {
40459
- return abortHandshake(socket, code3 || 401, message3, headers);
40378
+ return abortHandshake(socket, code3 || 401, message4, headers);
40460
40379
  }
40461
40380
  this.completeUpgrade(
40462
40381
  extensions,
@@ -40556,27 +40475,27 @@ var require_websocket_server = __commonJS2({
40556
40475
  function socketOnError() {
40557
40476
  this.destroy();
40558
40477
  }
40559
- function abortHandshake(socket, code3, message3, headers) {
40560
- message3 = message3 || http.STATUS_CODES[code3];
40478
+ function abortHandshake(socket, code3, message4, headers) {
40479
+ message4 = message4 || http.STATUS_CODES[code3];
40561
40480
  headers = {
40562
40481
  Connection: "close",
40563
40482
  "Content-Type": "text/html",
40564
- "Content-Length": Buffer.byteLength(message3),
40483
+ "Content-Length": Buffer.byteLength(message4),
40565
40484
  ...headers
40566
40485
  };
40567
40486
  socket.once("finish", socket.destroy);
40568
40487
  socket.end(
40569
40488
  `HTTP/1.1 ${code3} ${http.STATUS_CODES[code3]}\r
40570
- ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message3
40489
+ ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message4
40571
40490
  );
40572
40491
  }
40573
- function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message3, headers) {
40492
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message4, headers) {
40574
40493
  if (server.listenerCount("wsClientError")) {
40575
- const err = new Error(message3);
40494
+ const err = new Error(message4);
40576
40495
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
40577
40496
  server.emit("wsClientError", err, socket, req);
40578
40497
  } else {
40579
- abortHandshake(socket, code3, message3, headers);
40498
+ abortHandshake(socket, code3, message4, headers);
40580
40499
  }
40581
40500
  }
40582
40501
  }
@@ -41118,9 +41037,9 @@ function isAuthError(err, structuredOnly = false) {
41118
41037
  if (structuredOnly) return false;
41119
41038
  return /\b(401|403|unauthenticated|unauthorized|not authenticated)\b/i.test(msg);
41120
41039
  }
41121
- function convexHttpErrorCode(message3) {
41040
+ function convexHttpErrorCode(message4) {
41122
41041
  try {
41123
- const body = JSON.parse(message3);
41042
+ const body = JSON.parse(message4);
41124
41043
  return body && typeof body === "object" && "code" in body && typeof body.code === "string" ? body.code : null;
41125
41044
  } catch {
41126
41045
  return null;
@@ -41245,9 +41164,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
41245
41164
  const creds = allowAgentReads && selected ? void 0 : loadPlatformCredentials();
41246
41165
  if (!creds) {
41247
41166
  if (!allowAgentReads) throw new Error("These admin commands need a platform key. Agent Platform access covers tables, get and page only.");
41248
- const agent2 = await resolveCaller();
41167
+ const agent3 = await resolveCaller();
41249
41168
  return {
41250
- ...agent2,
41169
+ ...agent3,
41251
41170
  query: async (reference, args) => {
41252
41171
  const { getFunctionName: getFunctionName3 } = await Promise.resolve().then(() => (init_server(), server_exports));
41253
41172
  const name4 = getFunctionName3(reference);
@@ -41255,9 +41174,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
41255
41174
  if (!name4.startsWith("admin/inspect:") || !["tables", "get", "page"].includes(operation)) {
41256
41175
  throw new Error("Agent Platform access covers admin tables, get and page only");
41257
41176
  }
41258
- if (operation === "tables") return agent2.mutation(makeFunctionReference2("admin/inspect:agentTables"), {});
41259
- if (operation === "get") return agent2.mutation(makeFunctionReference2("admin/inspect:agentGet"), args);
41260
- return agent2.mutation(makeFunctionReference2("admin/inspect:agentPage"), args);
41177
+ if (operation === "tables") return agent3.mutation(makeFunctionReference2("admin/inspect:agentTables"), {});
41178
+ if (operation === "get") return agent3.mutation(makeFunctionReference2("admin/inspect:agentGet"), args);
41179
+ return agent3.mutation(makeFunctionReference2("admin/inspect:agentPage"), args);
41261
41180
  }
41262
41181
  };
41263
41182
  }
@@ -41777,41 +41696,65 @@ var taskReadInputs = {
41777
41696
  listOpenTasksForEntity: external_exports.strictObject({ entityId: id16 })
41778
41697
  };
41779
41698
 
41780
- // ../packages/shared/src/activity-read-legacy-results.ts
41781
- var json2 = external_exports.json().optional();
41782
- var attachment2 = external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape).catchall(json2);
41783
- var legacyActivityRecord = external_exports.object({ ...publicActivityReadDto.shape, attachments: external_exports.array(attachment2).optional(), _creationTime: external_exports.number() }).catchall(json2);
41699
+ // ../packages/shared/src/activity-read-transport-results.ts
41700
+ var attachment2 = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
41701
+ var user2 = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
41702
+ var agent2 = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
41703
+ var agentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
41704
+ var agenda2 = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
41705
+ var message2 = external_exports.object({
41706
+ ...publicActivityDetailDto.shape.messages.element.shape,
41707
+ createdByUser: user2.nullable(),
41708
+ createdByAgent: agent2.nullable().optional(),
41709
+ updatedByAgent: agent2.nullable().optional()
41710
+ });
41711
+ var activityReadRecord = external_exports.object({
41712
+ ...publicActivityReadDto.shape,
41713
+ attachments: external_exports.array(attachment2).optional(),
41714
+ entityIds: external_exports.array(external_exports.string()).optional(),
41715
+ entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
41716
+ agendaPoints: external_exports.array(agenda2).optional(),
41717
+ messages: external_exports.array(message2).optional(),
41718
+ createdByUser: user2.nullable().optional(),
41719
+ createdViaAgent: agent2.nullable().optional(),
41720
+ updatedViaAgent: agent2.nullable().optional(),
41721
+ createdByPersonalAgent: external_exports.boolean().optional(),
41722
+ createdByAgent: agent2.nullable().optional(),
41723
+ updatedByAgent: agent2.nullable().optional(),
41724
+ createdByAgentCreatorUser: agentCreator.nullable().optional(),
41725
+ assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
41726
+ });
41784
41727
  var compactMetadata = external_exports.strictObject({ mode: external_exports.literal("compact"), contentExcerptChars: external_exports.number(), omittedFields: external_exports.array(external_exports.string()), fullDetail: external_exports.strictObject({ cli: external_exports.string(), mcp: external_exports.string(), agent: external_exports.string() }) });
41785
41728
  var space2 = external_exports.strictObject({ spaceId: external_exports.string(), spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
41786
- var page2 = external_exports.strictObject({ activities: external_exports.array(legacyActivityRecord), hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional(), projection: compactMetadata.optional(), spaces: external_exports.record(external_exports.string(), space2).optional() });
41787
- var legacyActivityReadResults = { getActivity: legacyActivityRecord.nullable(), listActivities: page2, searchActivities: external_exports.array(legacyActivityRecord), listRecentActivities: page2 };
41729
+ var page2 = external_exports.strictObject({ activities: external_exports.array(activityReadRecord), hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional(), projection: compactMetadata.optional(), spaces: external_exports.record(external_exports.string(), space2).optional() });
41730
+ var activityReadTransportResults = { getActivity: activityReadRecord.nullable(), listActivities: page2, searchActivities: external_exports.array(activityReadRecord), listRecentActivities: page2 };
41788
41731
  var historyFields = { hasMore: page2.shape.hasMore, nextCursor: page2.shape.nextCursor, projection: page2.shape.projection, spaces: page2.shape.spaces };
41789
- var legacyActivityMcpEnvelopes = {
41790
- getActivity: external_exports.strictObject({ data: legacyActivityRecord }),
41791
- listActivities: external_exports.strictObject({ data: external_exports.array(legacyActivityRecord), hasMore: external_exports.boolean() }),
41792
- searchActivities: external_exports.strictObject({ data: external_exports.array(legacyActivityRecord) }),
41793
- listRecentActivities: external_exports.strictObject({ activities: external_exports.array(legacyActivityRecord), ...historyFields })
41732
+ var activityMcpEnvelopes = {
41733
+ getActivity: external_exports.strictObject({ data: activityReadRecord }),
41734
+ listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), hasMore: external_exports.boolean() }),
41735
+ searchActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord) }),
41736
+ listRecentActivities: external_exports.strictObject({ activities: external_exports.array(activityReadRecord), ...historyFields })
41794
41737
  };
41795
- var legacyActivityRestEnvelopes = {
41796
- getActivity: legacyActivityMcpEnvelopes.getActivity,
41797
- listActivities: external_exports.strictObject({ data: external_exports.array(legacyActivityRecord), ...historyFields }),
41798
- listRecentActivities: external_exports.strictObject({ data: external_exports.array(legacyActivityRecord), ...historyFields })
41738
+ var activityRestEnvelopes = {
41739
+ getActivity: activityMcpEnvelopes.getActivity,
41740
+ listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields }),
41741
+ listRecentActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields })
41799
41742
  };
41800
- var publicCliActivityListEnvelope = legacyActivityRestEnvelopes.listActivities.partial({ hasMore: true });
41743
+ var publicCliActivityListEnvelope = activityRestEnvelopes.listActivities.partial({ hasMore: true });
41801
41744
 
41802
41745
  // ../packages/shared/src/task-read-operation-results.ts
41803
41746
  var entity2 = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
41804
41747
  var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
41805
41748
  var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
41806
41749
  var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(entity2.shape)) });
41807
- var legacyTaskReadItem = external_exports.strictObject({ activity: legacyActivityRecord.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
41750
+ var taskReadTransportItem = external_exports.strictObject({ activity: activityReadRecord.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
41808
41751
  var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
41809
- var legacyTasks = external_exports.array(legacyTaskReadItem).max(TASK_READ_LIMITS.results);
41752
+ var transportTasks = external_exports.array(taskReadTransportItem).max(TASK_READ_LIMITS.results);
41810
41753
  var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
41811
- var legacyTaskReadResults = { listTasks: legacyTasks, getTaskByNumber: legacyTaskReadItem.nullable(), listOpenTasks: legacyTasks, listTasksDueBy: legacyTasks, listOpenTasksForEntity: legacyTasks };
41812
- var user2 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
41813
- var taskReadLegacyEnrichedItem = legacyTaskReadItem.extend({ activity: legacyTaskReadItem.shape.activity.extend({ attributes: external_exports.record(external_exports.string(), external_exports.json()).optional(), assignees: external_exports.array(user2) }) });
41814
- var taskReadLegacyUsers = external_exports.record(external_exports.string(), user2);
41754
+ var taskReadTransportResults = { listTasks: transportTasks, getTaskByNumber: taskReadTransportItem.nullable(), listOpenTasks: transportTasks, listTasksDueBy: transportTasks, listOpenTasksForEntity: transportTasks };
41755
+ var user3 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
41756
+ var taskReadEnrichedItem = taskReadTransportItem.extend({ activity: taskReadTransportItem.shape.activity.extend({ assignees: external_exports.array(user3) }) });
41757
+ var taskReadUsers = external_exports.record(external_exports.string(), user3);
41815
41758
 
41816
41759
  // ../packages/shared/src/activity-content-operations.ts
41817
41760
  var ACTIVITY_CONTENT_LIMITS = { defaultBlocks: 20, maxBlocks: 50, defaultCharacters: 12e3, maxCharacters: 5e4, maxEditOperations: 20, maxEditCharacters: 1e5 };
@@ -41904,14 +41847,14 @@ function graphAck(raw) {
41904
41847
  var graphContextAck = activityWriteResults.updateActivity.extend({ activityId: graphId2, assigneeIds: external_exports.array(graphId2).optional(), changed: external_exports.literal(false).optional() });
41905
41848
  var graphCreated = external_exports.strictObject({ activityId: graphId2 });
41906
41849
  var graphMessage = activityWriteResults.addActivityMessage.extend({ activityId: graphId2 });
41907
- var entity3 = external_exports.object({ _id: graphId2, name: legacyTaskReadItem.shape.entities.element.shape.name, type: legacyTaskReadItem.shape.entities.element.shape.type }).catchall(external_exports.json().optional());
41908
- var graphPublicRich = legacyTaskReadItem.shape.activity.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity3.nullable()) });
41850
+ var entity3 = external_exports.object({ _id: graphId2, name: taskReadTransportItem.shape.entities.element.shape.name, type: taskReadTransportItem.shape.entities.element.shape.type }).catchall(external_exports.json().optional());
41851
+ var graphPublicRich = taskReadTransportItem.shape.activity.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity3.nullable()) });
41909
41852
  var graphMembers = external_exports.array(external_exports.object({
41910
41853
  membership: external_exports.object({ _id: graphId2, userId: graphId2, spaceId: graphId2, role: external_exports.enum(["owner", "admin", "member"]) }).catchall(external_exports.json().optional()),
41911
41854
  user: external_exports.object({ _id: graphId2, name: external_exports.string().optional(), email: external_exports.string().optional() }).catchall(external_exports.json().optional()).nullable()
41912
41855
  }).catchall(external_exports.json().optional()));
41913
- var legacyTaskActivity = graphPublicRich.pick({ _id: true, type: true, title: true, contentPlainText: true, createdAt: true, deadline: true, completed: true, shortId: true, attributes: true, fields: true, fieldIndexReady: true, tags: true, assigneeIds: true }).extend({ type: external_exports.literal("task"), entityIds: external_exports.array(graphId2) });
41914
- var graphTaskItem = external_exports.strictObject({ activity: legacyTaskActivity.strict(), entities: external_exports.array(external_exports.strictObject({ _id: graphId2, name: external_exports.string() })) });
41856
+ var taskActivity = graphPublicRich.pick({ _id: true, type: true, title: true, contentPlainText: true, createdAt: true, deadline: true, completed: true, shortId: true, fields: true, tags: true, assigneeIds: true }).extend({ type: external_exports.literal("task"), entityIds: external_exports.array(graphId2) });
41857
+ var graphTaskItem = external_exports.strictObject({ activity: taskActivity.strict(), entities: external_exports.array(external_exports.strictObject({ _id: graphId2, name: external_exports.string() })) });
41915
41858
  var spacesSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()).optional() }));
41916
41859
  var usersSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ name: external_exports.string().optional(), email: external_exports.string().optional() }));
41917
41860
  function graphEnvelope(schema, data, spaces, users) {
@@ -42966,11 +42909,16 @@ function requireEntitySelector(operation, value, field) {
42966
42909
  }
42967
42910
 
42968
42911
  // ente/activity-fields.ts
42969
- init_server();
42970
42912
  function parseActivityFields(flags) {
42971
42913
  if (flags === void 0) return void 0;
42972
42914
  const inputs = flags.map((flag, index) => {
42973
42915
  try {
42916
+ const first = flag.trimStart()[0];
42917
+ if (first !== "{" && first !== "[" && first !== '"') {
42918
+ const equals = flag.indexOf("=");
42919
+ if (equals <= 0) throw Error("Invalid field shorthand");
42920
+ return { label: flag.slice(0, equals), value: flag.slice(equals + 1) || null };
42921
+ }
42974
42922
  return JSON.parse(flag);
42975
42923
  } catch {
42976
42924
  throw new OperationInputError("activityFields", [{ path: ["fields", String(index)], reason: "invalid_type" }]);
@@ -42986,10 +42934,6 @@ function fieldCreateReceipt(raw) {
42986
42934
  function fieldUpdateReceipt(raw) {
42987
42935
  return parseZodOperationResult("updateActivity", updated, raw, "Invalid activity update receipt").data;
42988
42936
  }
42989
- var legacyWritePreflight = makeFunctionReference2("activityFields:assertLegacyWriteAllowed");
42990
- async function assertLegacyActivityWriteAllowed(caller) {
42991
- await caller.mutation(legacyWritePreflight, {});
42992
- }
42993
42937
 
42994
42938
  // ../packages/shared/src/cli-protocol-dtos.ts
42995
42939
  var agentIdentity = v.object({ agentId: v.id("agents"), icon: v.optional(v.string()), name: v.string(), color: v.string(), archived: v.boolean() });
@@ -43167,12 +43111,12 @@ function parseDeadline(input2) {
43167
43111
  const second = iso[6] ? Number(iso[6]) : 0;
43168
43112
  validateDate(year, month, day, input2);
43169
43113
  if (hour > 23 || minute > 59 || second > 59) throw new Error(`Invalid time in deadline: '${input2}'.`);
43170
- let offsetMs = 0;
43114
+ let offsetMs2 = 0;
43171
43115
  if (iso[7]) {
43172
43116
  const sign = iso[7] === "-" ? -1 : 1;
43173
- offsetMs = sign * (Number(iso[8]) * 60 + Number(iso[9])) * 6e4;
43117
+ offsetMs2 = sign * (Number(iso[8]) * 60 + Number(iso[9])) * 6e4;
43174
43118
  }
43175
- return Date.UTC(year, month - 1, day, hour, minute, second) - offsetMs;
43119
+ return Date.UTC(year, month - 1, day, hour, minute, second) - offsetMs2;
43176
43120
  }
43177
43121
  const date5 = /^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{1,2}):(\d{2}))?$/.exec(trimmed);
43178
43122
  if (date5) {
@@ -43478,13 +43422,13 @@ var ActivityAttachmentUpload = class extends ProfileCommand {
43478
43422
  return response;
43479
43423
  }, async (raw) => {
43480
43424
  if (!(raw instanceof Response)) throw new OperationResultError("activityUpload");
43481
- let json4;
43425
+ let json3;
43482
43426
  try {
43483
- json4 = await raw.json();
43427
+ json3 = await raw.json();
43484
43428
  } catch {
43485
43429
  throw new OperationResultError("activityUpload");
43486
43430
  }
43487
- return uploadedFileResult(json4);
43431
+ return uploadedFileResult(json3);
43488
43432
  });
43489
43433
  progress.identifyStorage(storageId);
43490
43434
  await progress.write("attach", () => caller.mutation(activitiesAddAttachment, { activityId: this.id, storageId, name: name4, mimeType }), (raw) => {
@@ -43850,7 +43794,7 @@ var ActivityCreate = class extends ClientCommand {
43850
43794
  entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
43851
43795
  description: "Exact grant fingerprint returned by the confirmation-required error"
43852
43796
  });
43853
- field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
43797
+ field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeatable, empty/null removes" });
43854
43798
  async run() {
43855
43799
  const fields4 = parseActivityFields(this.field);
43856
43800
  if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
@@ -43952,7 +43896,7 @@ var ActivityUpdate = class extends ClientCommand {
43952
43896
  clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
43953
43897
  entityAdd = options_exports.Array("--entity-add", { description: "Link additional entities" });
43954
43898
  entityRemove = options_exports.Array("--entity-remove", { description: "Unlink entities" });
43955
- field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
43899
+ field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeatable, empty/null removes" });
43956
43900
  async run() {
43957
43901
  const fields4 = parseActivityFields(this.field);
43958
43902
  const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
@@ -44192,9 +44136,7 @@ function toTaskItem(rich) {
44192
44136
  deadline: rich.deadline,
44193
44137
  completed: rich.completed,
44194
44138
  shortId: rich.shortId,
44195
- attributes: rich.attributes,
44196
44139
  fields: rich.fields,
44197
- fieldIndexReady: rich.fieldIndexReady,
44198
44140
  tags: rich.tags,
44199
44141
  entityIds: rich.entityDetails.map((e) => e?._id).filter((id21) => !!id21),
44200
44142
  assigneeIds: rich.assigneeIds
@@ -44216,7 +44158,6 @@ var activitiesFindTaskByShortId = makeFunctionReference2(
44216
44158
  );
44217
44159
  var activitiesGetByIdRich2 = makeFunctionReference2("activities:getByIdRich");
44218
44160
  var activitiesCreate2 = makeFunctionReference2("activities:create");
44219
- var activitiesSetAttribute = makeFunctionReference2("activities:setAttribute");
44220
44161
  var activitiesUpdateCreatedAt2 = makeFunctionReference2("activities:updateCreatedAt");
44221
44162
  var activitiesUpdateTitle2 = makeFunctionReference2("activities:updateTitle");
44222
44163
  var activitiesSetContentFromMarkdown2 = makeFunctionReference2("activities:setContentFromMarkdown");
@@ -44311,7 +44252,7 @@ var TaskCreate = class extends ClientCommand {
44311
44252
  description: "Create the task with no deadline (skip the default of tomorrow 22:00)"
44312
44253
  });
44313
44254
  tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
44314
- attr = options_exports.Array("--attr", { description: "Legacy key=value writes; server retirement rejects with ACTIVITY_ATTRIBUTES_RETIRED; use --field" });
44255
+ attr = options_exports.Array("--attr", { description: "Canonical key=value shorthand for --field" });
44315
44256
  content = options_exports.String("--content", { description: "Task content/description" });
44316
44257
  sourceCreatedAt = options_exports.String("--source-created-at", {
44317
44258
  description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
@@ -44325,28 +44266,26 @@ var TaskCreate = class extends ClientCommand {
44325
44266
  entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
44326
44267
  description: "Exact grant fingerprint returned by the confirmation-required error"
44327
44268
  });
44328
- field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
44269
+ field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeatable, empty/null removes" });
44329
44270
  async run() {
44330
- const fields4 = parseActivityFields(this.field);
44271
+ const aliases = graphConvert("fields", () => Object.entries(parseFieldPairs(this.attr)).map(([label, value]) => JSON.stringify({ label, value: value || null })));
44272
+ const fields4 = parseActivityFields(this.field === void 0 && !aliases.length ? void 0 : [...this.field ?? [], ...aliases]);
44331
44273
  if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
44332
44274
  if (this.noDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --no-deadline, not both.");
44333
44275
  const deadline = this.noDeadline ? void 0 : graphConvert("deadline", () => this.deadline === void 0 ? defaultDeadline() : parseDeadline(this.deadline));
44334
- const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
44335
44276
  const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
44336
44277
  const directAssigneeIds = (this.assignee ?? []).filter((value) => !value.includes("@"));
44337
44278
  const emailAssignees = [...(this.assignee ?? []).filter((value) => value.includes("@")), ...this.assigneeEmail ?? []];
44338
- const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline, attributes: attributes2, fields: fields4, content: this.content, tags: this.tag, assigneeIds: directAssigneeIds, assigneeEmails: emailAssignees, sourceCreatedAt, autoLinkPersonalSpace: this.autoLink, entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint });
44339
- const entries = Object.entries(attributes2);
44340
- const progress = graphProgress(this, "task.create", ["create", ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : [], ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
44279
+ const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline, fields: fields4, content: this.content, tags: this.tag, assigneeIds: directAssigneeIds, assigneeEmails: emailAssignees, sourceCreatedAt, autoLinkPersonalSpace: this.autoLink, entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint });
44280
+ const progress = graphProgress(this, "task.create", ["create", ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
44341
44281
  return progress.run(async () => {
44342
44282
  const caller = await resolveCaller();
44343
- if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
44344
44283
  const entityIds = await resolveEntitiesC(caller, intent.entities);
44345
44284
  const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
44346
44285
  const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
44347
44286
  const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
44348
44287
  parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
44349
- const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, ...entries.length ? { attributes: attributes2 } : {}, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
44288
+ const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
44350
44289
  entityId: entityIds[0],
44351
44290
  additionalEntities: entityIds.slice(1),
44352
44291
  ownerSpaceId: spaceId2,
@@ -44359,7 +44298,6 @@ var TaskCreate = class extends ClientCommand {
44359
44298
  ...this.tag?.length ? { tags: this.tag } : {},
44360
44299
  ...this.content !== void 0 ? { contentMarkdown: this.content } : {}
44361
44300
  }), (raw) => graphResult(graphId2, raw), "activityId");
44362
- if (fields4 === void 0) for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
44363
44301
  if (sourceCreatedAt && fields4 === void 0) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt2, { activityId: activityId2, sourceCreatedAt }), graphAck);
44364
44302
  const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
44365
44303
  await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created task '${this.title}' (${activityId2})`, spaces)));
@@ -44372,32 +44310,29 @@ var TaskUpdate = class extends ClientCommand {
44372
44310
  id = options_exports.String();
44373
44311
  title = options_exports.String("--title", { description: "Update title" });
44374
44312
  content = options_exports.String("--content", { description: "Update content" });
44375
- attr = options_exports.Array("--attr", { description: "Legacy key=value writes; server retirement rejects with ACTIVITY_ATTRIBUTES_RETIRED; use --field" });
44313
+ attr = options_exports.Array("--attr", { description: "Canonical key=value shorthand for --field" });
44376
44314
  deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
44377
44315
  clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
44378
- field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
44316
+ field = options_exports.Array("--field", { description: "Field key=value or typed JSON: {label or fieldId, optional type, value}; repeatable, empty/null removes" });
44379
44317
  async run() {
44380
- const fields4 = parseActivityFields(this.field);
44318
+ const aliases = graphConvert("fields", () => Object.entries(parseFieldPairs(this.attr)).map(([label, value]) => JSON.stringify({ label, value: value || null })));
44319
+ const fields4 = parseActivityFields(this.field === void 0 && !aliases.length ? void 0 : [...this.field ?? [], ...aliases]);
44381
44320
  graphTaskNumber(this.id);
44382
- const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
44383
44321
  if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
44384
44322
  const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
44385
- parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2, fields: fields4 });
44386
- if (this.title === void 0 && this.content === void 0 && deadline === null && Object.keys(attributes2).length === 0 && fields4 === void 0) throw new Error("Nothing to update. Specify --title, --content, --attr, --field, --deadline, or --clear-deadline.");
44387
- const entries = Object.entries(attributes2);
44388
- const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : [], ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : []]);
44323
+ parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, fields: fields4 });
44324
+ if (this.title === void 0 && this.content === void 0 && deadline === null && fields4 === void 0) throw new Error("Nothing to update. Specify --title, --content, --attr, --field, --deadline, or --clear-deadline.");
44325
+ const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : []]);
44389
44326
  return progress.run(async () => {
44390
44327
  const caller = await resolveCaller();
44391
- if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
44392
44328
  const activityId2 = await resolveTaskIdC(caller, this.id);
44393
44329
  progress.identify(activityId2);
44394
44330
  if (fields4 !== void 0) {
44395
- await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, ...entries.length ? { attributes: attributes2 } : {}, fields: fields4 }), fieldUpdateReceipt);
44331
+ await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, fields: fields4 }), fieldUpdateReceipt);
44396
44332
  } else {
44397
44333
  if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle2, { activityId: activityId2, title: this.title }), graphAck);
44398
44334
  if (this.content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown2, { activityId: activityId2, markdown: this.content }), graphAck);
44399
44335
  if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline2, { activityId: activityId2, ...deadline }), graphAck);
44400
- for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
44401
44336
  }
44402
44337
  const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
44403
44338
  await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2 }, spaces), () => withFooter(`Updated task ${this.id}`, spaces)));
@@ -44705,15 +44640,15 @@ function parseDatabaseProtocolInput(name4, validator, raw) {
44705
44640
  }
44706
44641
 
44707
44642
  // ../packages/shared/src/entity-read-legacy-results.ts
44708
- var json3 = external_exports.json().optional();
44643
+ var json2 = external_exports.json().optional();
44709
44644
  function legacyEntityRecord(raw) {
44710
44645
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
44711
44646
  const { fieldValues: _fieldValues, layout: _layout, actingSpaceId: _acting, ...value } = raw;
44712
44647
  return value;
44713
44648
  }
44714
- var legacyEntityObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json3);
44649
+ var legacyEntityObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json2);
44715
44650
  var entity4 = external_exports.preprocess(legacyEntityRecord, legacyEntityObject);
44716
- var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(json3);
44651
+ var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(json2);
44717
44652
  var searchRow = entityReadFullSearch.shape.entities.element;
44718
44653
  var listRow = entityReadFullList.shape.entities.element;
44719
44654
  var legacyEntityReadResults = {
@@ -44861,7 +44796,7 @@ function columnFor(columns, key, listName) {
44861
44796
  );
44862
44797
  return col;
44863
44798
  }
44864
- function coerceAttributes(columns, raw, listName) {
44799
+ function coerceFields(columns, raw, listName) {
44865
44800
  const out = {};
44866
44801
  for (const [key, value] of Object.entries(raw)) out[key] = coerceValue(columnFor(columns, key, listName), value);
44867
44802
  return out;
@@ -44887,7 +44822,7 @@ function parseWhere(columns, specs, listName) {
44887
44822
  function planUpsert(existing, inputs, keyColumn) {
44888
44823
  const byKey = /* @__PURE__ */ new Map();
44889
44824
  for (const row of existing) {
44890
- const raw = row.attributes?.[keyColumn];
44825
+ const raw = row.fields?.[keyColumn];
44891
44826
  if (typeof raw !== "string" || raw === "") continue;
44892
44827
  const other = byKey.get(raw);
44893
44828
  if (other)
@@ -44898,12 +44833,12 @@ function planUpsert(existing, inputs, keyColumn) {
44898
44833
  }
44899
44834
  const keyless = /* @__PURE__ */ new Map();
44900
44835
  for (const row of existing) {
44901
- const raw = row.attributes?.[keyColumn];
44836
+ const raw = row.fields?.[keyColumn];
44902
44837
  if ((typeof raw !== "string" || raw === "") && row.title) keyless.set(row.title, row.rowId);
44903
44838
  }
44904
44839
  const seen = /* @__PURE__ */ new Map();
44905
44840
  const steps = inputs.map((input2) => {
44906
- const key = input2.attributes[keyColumn];
44841
+ const key = input2.fields[keyColumn];
44907
44842
  if (typeof key !== "string" || key.trim() === "")
44908
44843
  throw new Error(`Line ${input2.line}: missing a text value for key column '${keyColumn}'.`);
44909
44844
  const firstLine = seen.get(key);
@@ -44912,9 +44847,9 @@ function planUpsert(existing, inputs, keyColumn) {
44912
44847
  seen.set(key, input2.line);
44913
44848
  const row = byKey.get(key);
44914
44849
  if (!row) return { action: "create", input: input2, key };
44915
- const stored = row.attributes ?? {};
44850
+ const stored = row.fields ?? {};
44916
44851
  const changes = {};
44917
- for (const [k, v3] of Object.entries(input2.attributes)) {
44852
+ for (const [k, v3] of Object.entries(input2.fields)) {
44918
44853
  if (!sameValue(stored[k], v3)) changes[k] = v3;
44919
44854
  }
44920
44855
  const title4 = input2.title !== void 0 && input2.title !== (row.title ?? "") ? input2.title : void 0;
@@ -44933,36 +44868,42 @@ function planUpsert(existing, inputs, keyColumn) {
44933
44868
  }
44934
44869
  function parseImportLines(text3) {
44935
44870
  const rows = [];
44936
- const lines = text3.split(/\r?\n/);
44937
- for (let i = 0; i < lines.length; i++) {
44938
- const source2 = lines[i].trim();
44939
- if (!source2) continue;
44940
- const line = i + 1;
44871
+ for (const [index, source2] of text3.split(/\r?\n/).entries()) {
44872
+ if (!source2.trim()) continue;
44873
+ const line = index + 1;
44941
44874
  let parsed;
44942
44875
  try {
44943
44876
  parsed = JSON.parse(source2);
44944
- } catch (err) {
44945
- throw new Error(`Line ${line}: not valid JSON (${err instanceof Error ? err.message : String(err)}).`);
44877
+ } catch (error62) {
44878
+ throw new Error(`Line ${line}: not valid JSON (${error62 instanceof Error ? error62.message : String(error62)}).`);
44946
44879
  }
44947
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
44948
- throw new Error(`Line ${line}: expected a JSON object.`);
44880
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error(`Line ${line}: expected a JSON object.`);
44949
44881
  const obj = parsed;
44950
- const unknownKeys = Object.keys(obj).filter((k) => !["title", "attrs", "content"].includes(k));
44951
- if (unknownKeys.length > 0)
44952
- throw new Error(`Line ${line}: unknown field(s) ${unknownKeys.join(", ")}; allowed: title, attrs, content.`);
44882
+ if (Object.hasOwn(obj, "attributes")) throw new Error(ACTIVITY_ATTRIBUTES_RETIRED);
44883
+ const unknownKeys = Object.keys(obj).filter((key) => !["title", "fields", "content"].includes(key));
44884
+ if (unknownKeys.length) throw new Error(`Line ${line}: unknown field(s) ${unknownKeys.join(", ")}; allowed: title, fields, content.`);
44953
44885
  if (obj.title !== void 0 && typeof obj.title !== "string") throw new Error(`Line ${line}: "title" must be a string.`);
44954
44886
  if (obj.content !== void 0 && typeof obj.content !== "string") throw new Error(`Line ${line}: "content" must be a string.`);
44955
- const attrs = obj.attrs ?? {};
44956
- if (!attrs || typeof attrs !== "object" || Array.isArray(attrs)) throw new Error(`Line ${line}: "attrs" must be an object.`);
44957
- rows.push({
44958
- line,
44959
- attrs,
44960
- ...obj.title !== void 0 ? { title: obj.title } : {},
44961
- ...obj.content !== void 0 ? { content: obj.content } : {}
44962
- });
44887
+ const fields4 = activityFieldInputsSchema.safeParse(obj.fields ?? []);
44888
+ if (!fields4.success) throw new Error(`Line ${line}: "fields" must be typed field inputs with exactly one label or fieldId and a value.`);
44889
+ rows.push({ line, fields: fields4.data, ...obj.title !== void 0 ? { title: obj.title } : {}, ...obj.content !== void 0 ? { content: obj.content } : {} });
44963
44890
  }
44964
44891
  return rows;
44965
44892
  }
44893
+ function coerceImportFields(columns, inputs, listName) {
44894
+ const cells = {};
44895
+ for (const input2 of inputs) {
44896
+ const labelKey = input2.label === void 0 ? void 0 : fieldLabelKey(input2.label);
44897
+ const keyMatches = labelKey === void 0 ? [] : columns.filter((column2) => fieldLabelKey(column2.key) === labelKey);
44898
+ const matches = input2.fieldId ? columns.filter((column2) => column2.fieldIds?.some((fieldId) => fieldId === input2.fieldId)) : keyMatches.length ? keyMatches : columns.filter((column2) => fieldLabelKey(column2.label ?? column2.key) === labelKey);
44899
+ if (matches.length !== 1) throw new Error(`Field '${input2.fieldId ?? input2.label}' must match exactly one column of list '${listName}'.`);
44900
+ const column = matches[0];
44901
+ if (Object.hasOwn(cells, column.key)) throw new Error(`Field '${column.key}' is repeated in one import row.`);
44902
+ if (input2.type !== void 0 && input2.type !== column.type) throw new Error(`Field '${column.key}' has column type '${column.type}', not '${input2.type}'.`);
44903
+ cells[column.key] = coerceValue(column, input2.value);
44904
+ }
44905
+ return cells;
44906
+ }
44966
44907
  async function runPool(items2, limit3, work) {
44967
44908
  let next = 0;
44968
44909
  const failures = [];
@@ -45062,7 +45003,7 @@ function titleArgs(activityId2, title4) {
45062
45003
  function orderedCells(ctx, step) {
45063
45004
  if (step.action === "unchanged") return [];
45064
45005
  if (step.action === "update") return Object.entries(step.changes);
45065
- return Object.entries(step.input.attributes).sort(([a], [b]) => a === ctx.keyColumn ? -1 : b === ctx.keyColumn ? 1 : 0).filter(([, value]) => value !== null && !(Array.isArray(value) && value.length === 0));
45006
+ return Object.entries(step.input.fields).sort(([a], [b]) => a === ctx.keyColumn ? -1 : b === ctx.keyColumn ? 1 : 0).filter(([, value]) => value !== null && !(Array.isArray(value) && value.length === 0));
45066
45007
  }
45067
45008
  function rowStages(ctx, step) {
45068
45009
  return [...step.action === "create" ? ["create"] : step.action === "update" && step.title !== void 0 ? ["title"] : [], ...orderedCells(ctx, step).map((_, index) => `cell:${index + 1}`)];
@@ -45102,7 +45043,7 @@ async function fetchMatchingRows(caller, entityId2, where) {
45102
45043
  async function fetchRowsForKeys(caller, entityId2, inputs, key) {
45103
45044
  const rows = /* @__PURE__ */ new Map();
45104
45045
  const matchedKeys = /* @__PURE__ */ new Map();
45105
- const values = new Map(inputs.map((input2) => [JSON.stringify(input2.attributes[key]), input2.attributes[key]]));
45046
+ const values = new Map(inputs.map((input2) => [JSON.stringify(input2.fields[key]), input2.fields[key]]));
45106
45047
  for (const value of values.values()) {
45107
45048
  if (typeof value !== "string" || !value.trim()) continue;
45108
45049
  const matches = await fetchMatchingRows(caller, entityId2, [{ key, value }]);
@@ -45112,7 +45053,7 @@ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
45112
45053
  rows.set(row._id, { row, match: { key, value } });
45113
45054
  }
45114
45055
  if (!matches.length) {
45115
- const titles = new Set(inputs.filter((input2) => input2.attributes[key] === value && input2.title !== void 0).map((input2) => input2.title));
45056
+ const titles = new Set(inputs.filter((input2) => input2.fields[key] === value && input2.title !== void 0).map((input2) => input2.title));
45116
45057
  for (const title4 of titles) for (const row of await fetchMatchingRows(caller, entityId2, [{ key, value: null }, { key: "title", value: title4 }])) rows.set(row._id, { row });
45117
45058
  }
45118
45059
  }
@@ -45129,7 +45070,7 @@ function rowJson(row) {
45129
45070
  type: row.type,
45130
45071
  completed: row.completed ?? false,
45131
45072
  createdAt: row._creationTime,
45132
- ...row.fields !== void 0 ? { fields: row.fields, fieldIndexReady: row.fieldIndexReady } : { attributes: row.attributes ?? {} },
45073
+ fields: row.fields,
45133
45074
  entities: (row.entityDetails ?? []).filter((e) => e !== null).map((e) => ({ entityId: e._id, name: e.name }))
45134
45075
  };
45135
45076
  }
@@ -45186,13 +45127,12 @@ function columnOrThrow(columns, key, listName) {
45186
45127
  return col;
45187
45128
  }
45188
45129
  function toExisting(row, columns = [], match) {
45189
- if (row.fields === void 0) return { rowId: row._id, title: row.title ?? null, attributes: { ...row.attributes, ...match ? { [match.key]: match.value } : {} } };
45190
45130
  const cells = {};
45191
45131
  for (const column of columns) {
45192
45132
  const values = row.fields.filter((field) => column.fieldIds?.length ? column.fieldIds.some((id21) => id21 === field.fieldId) : fieldLabelKey(field.label) === fieldLabelKey(column.key));
45193
- if (values.length) cells[column.key] = activityFieldLegacyValue(values[0].type, values.map((field) => field.value));
45133
+ if (values.length) cells[column.key] = activityFieldValue(values[0].type, values.map((field) => field.value));
45194
45134
  }
45195
- return { rowId: row._id, title: row.title ?? null, attributes: { ...cells, ...match ? { [match.key]: match.value } : {} } };
45135
+ return { rowId: row._id, title: row.title ?? null, fields: { ...cells, ...match ? { [match.key]: match.value } : {} } };
45196
45136
  }
45197
45137
 
45198
45138
  // ente/commands/listColumns.ts
@@ -45284,7 +45224,7 @@ var ListAdd = class extends ProfileCommand {
45284
45224
  list = options_exports.String();
45285
45225
  title = options_exports.String("--title", { description: "Row title" });
45286
45226
  type = options_exports.String("--type", "note", { description: "Row activity type: note (default) or task" });
45287
- attr = options_exports.Array("--attr", { description: "Column values as key=value (coerced to the column type)" });
45227
+ attr = options_exports.Array("--field,--attr", { description: "Column values as key=value (coerced to the column type)" });
45288
45228
  key = options_exports.String("--key", {
45289
45229
  description: "Upsert: update the row whose <key> cell equals this row's --attr <key>=\u2026 instead of adding one"
45290
45230
  });
@@ -45299,11 +45239,11 @@ var ListAdd = class extends ProfileCommand {
45299
45239
  if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
45300
45240
  const caller = await resolveCaller();
45301
45241
  const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
45302
- const attributes2 = coerceAttributes(view.columns, parseAttrs(this.attr), entity5.name);
45242
+ const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
45303
45243
  const content = readContentOption(this.content, this.contentFile);
45304
45244
  const input2 = {
45305
45245
  line: 1,
45306
- attributes: attributes2,
45246
+ fields: fields4,
45307
45247
  ...this.title !== void 0 ? { title: this.title } : {},
45308
45248
  ...content !== void 0 ? { content } : {}
45309
45249
  };
@@ -45318,7 +45258,7 @@ var ListAdd = class extends ProfileCommand {
45318
45258
  const rowId = await applyStep(ctx, step, progress);
45319
45259
  const result = stepResult(step, rowId);
45320
45260
  this.emitText(
45321
- { data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null, attributes: attributes2 } },
45261
+ { data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null, fields: fields4 } },
45322
45262
  () => result.action === "created" ? `Added row '${this.title ?? "(untitled)"}' (${rowId}) to '${entity5.name}'.` : result.action === "updated" ? `Updated row ${rowId} in '${entity5.name}': ${(result.changed ?? []).join(", ")}.${result.contentIgnored ? " (body left unchanged)" : ""}` : `Row ${rowId} in '${entity5.name}' is unchanged.`
45323
45263
  );
45324
45264
  }
@@ -45335,35 +45275,35 @@ var ListUpdate = class extends ProfileCommand {
45335
45275
  });
45336
45276
  list = options_exports.String();
45337
45277
  rowId = options_exports.String();
45338
- attr = options_exports.Array("--attr", { description: "Column values as key=value (coerced; empty value clears the cell)" });
45278
+ attr = options_exports.Array("--field,--attr", { description: "Column values as key=value (coerced; empty value clears the cell)" });
45339
45279
  title = options_exports.String("--title", { description: "New row title" });
45340
45280
  async run() {
45341
45281
  if (!this.attr?.length && this.title === void 0) throw new Error("Nothing to update. Pass --attr and/or --title.");
45342
45282
  const caller = await resolveCaller();
45343
45283
  const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
45344
- const attributes2 = coerceAttributes(view.columns, parseAttrs(this.attr), entity5.name);
45284
+ const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
45345
45285
  const row = graphResult(databaseListRow.nullable(), await caller.query(activitiesGetByIdRich3, { activityId: graphInput(graphId2, this.rowId) }));
45346
45286
  if (!row) throw new Error(`Row ${this.rowId} not found or not accessible.`);
45347
45287
  if (row._id !== this.rowId) throw new OperationResultError("database row", "Invalid row result context");
45348
45288
  if (!(row.entityDetails ?? []).some((e) => e?._id === entityId2))
45349
45289
  throw new Error(`Activity ${this.rowId} is not a row of list '${entity5.name}'.`);
45350
- const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(attributes2).map((_, i) => `cell:${i + 1}`)];
45290
+ const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(fields4).map((_, i) => `cell:${i + 1}`)];
45351
45291
  const progress = graphProgress(this, "list update", stages, { entityId: entityId2, activityId: row._id });
45352
45292
  await progress.run(async () => {
45353
45293
  if (this.title !== void 0) {
45354
45294
  const args = titleArgs(row._id, this.title);
45355
45295
  await progress.write("title", () => databaseWrite(() => caller.mutation(activitiesUpdateTitle3, args)), graphAck);
45356
45296
  }
45357
- for (const [index, [key, value]] of Object.entries(attributes2).entries()) {
45297
+ for (const [index, [key, value]] of Object.entries(fields4).entries()) {
45358
45298
  const args = cellArgs(row._id, key, value, view.columns.find((column) => column.key === key));
45359
45299
  await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutation(setFieldCell, args)), (raw) => parseOperationResult("activityFields:setCell", databaseCellWriteContract.result, raw));
45360
45300
  }
45361
45301
  });
45362
45302
  this.emitText(
45363
- { data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {}, attributes: attributes2 } },
45303
+ { data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {}, fields: fields4 } },
45364
45304
  () => `Updated row ${this.rowId} in '${entity5.name}': ${[
45365
45305
  ...this.title !== void 0 ? ["title"] : [],
45366
- ...Object.keys(attributes2)
45306
+ ...Object.keys(fields4)
45367
45307
  ].join(", ")}.`
45368
45308
  );
45369
45309
  }
@@ -45374,7 +45314,7 @@ var ListImport = class extends ProfileCommand {
45374
45314
  category: "List",
45375
45315
  description: "Upsert rows from a JSONL file by a key column (created / updated / unchanged per row)",
45376
45316
  details: `
45377
- One JSON object per line: {"title": "\u2026", "attrs": {"<key>": "\u2026", \u2026}, "content": "\u2026markdown\u2026"}.
45317
+ One JSON object per line: {"title": "\u2026", "fields": [{"label": "<key>", "value": "\u2026"}], "content": "\u2026markdown\u2026"}.
45378
45318
  Values are coerced to each column's type like --attr. The whole file is checked before the
45379
45319
  first write: an unknown column, a bad value, a missing key or a key repeated in the file (or
45380
45320
  held by two existing rows) fails the run. "content" is only written when a row is created.
@@ -45404,7 +45344,7 @@ var ListImport = class extends ProfileCommand {
45404
45344
  try {
45405
45345
  return {
45406
45346
  line: l.line,
45407
- attributes: coerceAttributes(view.columns, l.attrs, entity5.name),
45347
+ fields: coerceImportFields(view.columns, l.fields, entity5.name),
45408
45348
  ...l.title !== void 0 ? { title: l.title } : {},
45409
45349
  ...l.content !== void 0 ? { content: l.content } : {}
45410
45350
  };
@@ -45626,9 +45566,9 @@ var CostPreview = class extends ProfileCommand {
45626
45566
  static usage = Command.Usage({ category: "Admin", description: "Validate a cost JSON file with the authenticated admin importer" });
45627
45567
  file = options_exports.String("--file", { required: true });
45628
45568
  async run() {
45629
- const json4 = await readFile(this.file, "utf8");
45630
- if (Buffer.byteLength(json4) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
45631
- const result = await (await resolveAdminCaller()).query(previewCostImport, { json: json4 });
45569
+ const json3 = await readFile(this.file, "utf8");
45570
+ if (Buffer.byteLength(json3) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
45571
+ const result = await (await resolveAdminCaller()).query(previewCostImport, { json: json3 });
45632
45572
  this.emitText(result, () => JSON.stringify(result));
45633
45573
  return ["ready", "unchanged"].includes(result.status) ? 0 : 1;
45634
45574
  }
@@ -45639,9 +45579,9 @@ var CostImport = class extends ProfileCommand {
45639
45579
  file = options_exports.String("--file", { required: true });
45640
45580
  expected = options_exports.String("--expected-current-id", { required: true, description: "Exact preview currentId, or none for a new stream" });
45641
45581
  async run() {
45642
- const json4 = await readFile(this.file, "utf8");
45643
- if (Buffer.byteLength(json4) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
45644
- const result = await (await resolveAdminCaller()).mutation(importCostSnapshot, { json: json4, expectedCurrentId: this.expected === "none" ? null : this.expected });
45582
+ const json3 = await readFile(this.file, "utf8");
45583
+ if (Buffer.byteLength(json3) > 256 * 1024) throw new Error("Cost snapshot exceeds 256 KiB");
45584
+ const result = await (await resolveAdminCaller()).mutation(importCostSnapshot, { json: json3, expectedCurrentId: this.expected === "none" ? null : this.expected });
45645
45585
  this.emitText(result, () => JSON.stringify(result));
45646
45586
  return ["imported", "unchanged"].includes(result.status) ? 0 : 1;
45647
45587
  }
@@ -45821,12 +45761,12 @@ var UsersSetAdminCommand = class extends BaseCommand {
45821
45761
  off = options_exports.Boolean("--off", { description: "Revoke admin instead of granting it" });
45822
45762
  async run() {
45823
45763
  const caller = await resolveAdminCaller();
45824
- const user3 = await resolveUserByEmail(caller, this.email);
45764
+ const user4 = await resolveUserByEmail(caller, this.email);
45825
45765
  const isAdmin = !this.off;
45826
- await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId: user3.id, isAdmin })).then((raw) => parseOperationResult("admin/users:setAdmin", adminUserContracts.setAdmin.result, raw));
45766
+ await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId: user4.id, isAdmin })).then((raw) => parseOperationResult("admin/users:setAdmin", adminUserContracts.setAdmin.result, raw));
45827
45767
  this.emitText(
45828
- { data: { id: user3.id, email: user3.email, isAdmin } },
45829
- () => `${isAdmin ? "Granted" : "Revoked"} admin for ${user3.email}.`
45768
+ { data: { id: user4.id, email: user4.email, isAdmin } },
45769
+ () => `${isAdmin ? "Granted" : "Revoked"} admin for ${user4.email}.`
45830
45770
  );
45831
45771
  }
45832
45772
  };
@@ -45842,14 +45782,14 @@ var UsersResetPasswordCommand = class extends BaseCommand {
45842
45782
  });
45843
45783
  async run() {
45844
45784
  const caller = await resolveAdminCaller();
45845
- const user3 = await resolveUserByEmail(caller, this.email);
45785
+ const user4 = await resolveUserByEmail(caller, this.email);
45846
45786
  const res = await caller.action(resetPassword, parseHumanInput("admin/users:resetPassword", adminUserContracts.resetPassword.args, {
45847
- userId: user3.id,
45787
+ userId: user4.id,
45848
45788
  ...this.password !== void 0 ? { newPassword: this.password } : {}
45849
45789
  })).then((raw) => parseOperationResult("admin/users:resetPassword", adminUserContracts.resetPassword.result, raw));
45850
45790
  this.emitText(
45851
- { data: { id: user3.id, email: user3.email, password: res.password } },
45852
- () => `Reset password for ${user3.email}.
45791
+ { data: { id: user4.id, email: user4.email, password: res.password } },
45792
+ () => `Reset password for ${user4.email}.
45853
45793
  New password: ${res.password}`
45854
45794
  );
45855
45795
  }
@@ -45880,15 +45820,15 @@ var UsersSetPlanCommand = class extends BaseCommand {
45880
45820
  throw new Error("company_managed needs --company <billing account id>.");
45881
45821
  }
45882
45822
  const caller = await resolveAdminCaller();
45883
- const user3 = await resolveUserByEmail(caller, this.email);
45823
+ const user4 = await resolveUserByEmail(caller, this.email);
45884
45824
  const res = await caller.mutation(changeUserPlan, parseHumanInput("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.args, {
45885
- userId: user3.id,
45825
+ userId: user4.id,
45886
45826
  planKey,
45887
45827
  ...planKey === "company_managed" ? { companyBillingAccountId: this.company } : {}
45888
45828
  })).then((raw) => parseOperationResult("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.result, raw));
45889
45829
  this.emitText(
45890
- { data: { id: user3.id, email: user3.email, ...res } },
45891
- () => res.changed ? `Set plan for ${user3.email} to ${res.planKey}.` : `${user3.email} already has plan ${res.planKey}.`
45830
+ { data: { id: user4.id, email: user4.email, ...res } },
45831
+ () => res.changed ? `Set plan for ${user4.email} to ${res.planKey}.` : `${user4.email} already has plan ${res.planKey}.`
45892
45832
  );
45893
45833
  }
45894
45834
  };
@@ -47150,7 +47090,7 @@ var RecordingRerunCommand = class extends BaseCommand {
47150
47090
  rawReceipt = await caller.mutation(rerunRecording, args);
47151
47091
  } catch (error62) {
47152
47092
  if (error62 instanceof ConvexError2) throw error62;
47153
- const message3 = errorMessage(error62);
47093
+ const message4 = errorMessage(error62);
47154
47094
  const checkStatusCommand = `ente recording show ${before.id}`;
47155
47095
  this.emitText(
47156
47096
  {
@@ -47159,9 +47099,9 @@ var RecordingRerunCommand = class extends BaseCommand {
47159
47099
  rerunStarted: null,
47160
47100
  outcome: "unknown",
47161
47101
  checkStatusCommand,
47162
- error: { message: message3 }
47102
+ error: { message: message4 }
47163
47103
  },
47164
- () => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message3}
47104
+ () => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message4}
47165
47105
  Check with: ${checkStatusCommand}. No rerun was retried.`
47166
47106
  );
47167
47107
  return 1;
@@ -47184,11 +47124,11 @@ Check with: ${checkStatusCommand}. No rerun was retried.`
47184
47124
  }
47185
47125
  });
47186
47126
  } catch (error62) {
47187
- const message3 = errorMessage(error62);
47127
+ const message4 = errorMessage(error62);
47188
47128
  const details = error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" ? error62.data : {};
47189
47129
  this.emitText(
47190
- { id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message3 } },
47191
- () => `Re-run started for ${before.id}; final outcome unknown: ${message3}
47130
+ { id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message4 } },
47131
+ () => `Re-run started for ${before.id}; final outcome unknown: ${message4}
47192
47132
  Check with: ente recording show ${before.id}. No rerun was retried.`
47193
47133
  );
47194
47134
  return 1;
@@ -47450,7 +47390,7 @@ var AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS = 200;
47450
47390
  var id17 = external_exports.string().min(1).regex(/\S/);
47451
47391
  var capped = (maximum) => external_exports.string().max(maximum).refine((value) => value.length <= maximum);
47452
47392
  var optionalTrimmed = (maximum) => capped(maximum).transform((value) => value.trim() || void 0).optional();
47453
- var message2 = {
47393
+ var message3 = {
47454
47394
  text: external_exports.string().trim().min(1).max(AGENT_THREAD_MESSAGE_MAX_CHARACTERS).refine((value) => value.length <= AGENT_THREAD_MESSAGE_MAX_CHARACTERS),
47455
47395
  html: capped(AGENT_THREAD_HTML_MAX_CHARACTERS).optional(),
47456
47396
  requestKind: external_exports.enum(["ack", "text"]).optional(),
@@ -47458,9 +47398,9 @@ var message2 = {
47458
47398
  idempotencyKey: capped(AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS).refine((value) => value.length >= AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS).meta({ minLength: AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS, "x-ente-length-unit": "utf16-code-units" })
47459
47399
  };
47460
47400
  var agentConversationInputs = {
47461
- agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message2 }),
47401
+ agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message3 }),
47462
47402
  agent_thread_claim: external_exports.strictObject({ threadId: id17, attentionVersion: external_exports.number().int().nonnegative() }),
47463
- agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message2 })
47403
+ agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message3 })
47464
47404
  };
47465
47405
  function parseAgentConversationInput(operation, raw) {
47466
47406
  switch (operation) {
@@ -47473,11 +47413,11 @@ function parseAgentConversationInput(operation, raw) {
47473
47413
  }
47474
47414
  }
47475
47415
  var browserMessage = {
47476
- text: message2.text,
47477
- html: message2.html,
47478
- request_kind: message2.requestKind,
47479
- request_prompt: message2.requestPrompt,
47480
- idempotency_key: message2.idempotencyKey
47416
+ text: message3.text,
47417
+ html: message3.html,
47418
+ request_kind: message3.requestKind,
47419
+ request_prompt: message3.requestPrompt,
47420
+ idempotency_key: message3.idempotencyKey
47481
47421
  };
47482
47422
  var agentConversationBrowserInputs = {
47483
47423
  agent_thread_create: external_exports.strictObject({ agent_id: id17, title: agentConversationInputs.agent_thread_create.shape.title, ...browserMessage }),
@@ -47498,12 +47438,12 @@ var agentConversationResponseValidator = v.union(
47498
47438
  );
47499
47439
  function mapPayloads2(operation, raw, transform2) {
47500
47440
  if (operation === "agent_thread_claim" || !raw || !("message" in raw)) return raw;
47501
- const message3 = raw.message;
47441
+ const message4 = raw.message;
47502
47442
  return { ...raw, message: {
47503
- ...message3,
47504
- ...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
47505
- ...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
47506
- ...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
47443
+ ...message4,
47444
+ ...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
47445
+ ...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
47446
+ ...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
47507
47447
  } };
47508
47448
  }
47509
47449
  function parseAgentConversationResult(operation, raw) {
@@ -47513,9 +47453,9 @@ function parseAgentConversationResult(operation, raw) {
47513
47453
  }
47514
47454
  function encodeAgentConversationResult(operation, raw) {
47515
47455
  const data = parseAgentConversationResult(operation, raw);
47516
- const json4 = parseOperationResult(operation, agentConversationResults[operation], mapPayloads2(operation, data, encodeAgentContextPayload));
47517
- mapPayloads2(operation, json4, decodeAgentContextPayload);
47518
- return json4;
47456
+ const json3 = parseOperationResult(operation, agentConversationResults[operation], mapPayloads2(operation, data, encodeAgentContextPayload));
47457
+ mapPayloads2(operation, json3, decodeAgentContextPayload);
47458
+ return json3;
47519
47459
  }
47520
47460
 
47521
47461
  // ../packages/shared/src/agent-cli-results.ts
@@ -47638,12 +47578,12 @@ function normalizeOperatorThread(thread2, agentId = "") {
47638
47578
  agentId
47639
47579
  };
47640
47580
  }
47641
- function normalizeOperatorMessage(message3) {
47581
+ function normalizeOperatorMessage(message4) {
47642
47582
  return {
47643
- ...message3,
47644
- _id: message3.messageId,
47645
- toolCalls: message3.toolCalls,
47646
- toolResults: message3.toolResults
47583
+ ...message4,
47584
+ _id: message4.messageId,
47585
+ toolCalls: message4.toolCalls,
47586
+ toolResults: message4.toolResults
47647
47587
  };
47648
47588
  }
47649
47589
  async function fetchOperatorThread(client, threadId, agentId = "") {
@@ -47658,18 +47598,18 @@ async function fetchOperatorThread(client, threadId, agentId = "") {
47658
47598
  } while (cursor3);
47659
47599
  return thread2 ? { thread: thread2, messages } : null;
47660
47600
  }
47661
- function renderAgentConfiguration(agent2) {
47601
+ function renderAgentConfiguration(agent3) {
47662
47602
  const lines = [
47663
- `${agent2.name} ${agent2.agentId}`,
47664
- `Space: ${agent2.spaceId}`,
47665
- `Mailbox: ${agent2.mailbox?.status === "active" ? agent2.mailbox.address : "not active"}`,
47603
+ `${agent3.name} ${agent3.agentId}`,
47604
+ `Space: ${agent3.spaceId}`,
47605
+ `Mailbox: ${agent3.mailbox?.status === "active" ? agent3.mailbox.address : "not active"}`,
47666
47606
  "",
47667
47607
  "Ente prompt configuration:",
47668
- agent2.prompt || "(empty)",
47608
+ agent3.prompt || "(empty)",
47669
47609
  "",
47670
- `Ente scheduled runs: ${agent2.schedules.length}`
47610
+ `Ente scheduled runs: ${agent3.schedules.length}`
47671
47611
  ];
47672
- for (const schedule of agent2.schedules) {
47612
+ for (const schedule of agent3.schedules) {
47673
47613
  const time3 = schedule.timeMinutes === void 0 ? schedule.scheduleType : `${String(Math.floor(schedule.timeMinutes / 60)).padStart(2, "0")}:${String(schedule.timeMinutes % 60).padStart(2, "0")} ${schedule.timezone ?? ""}`.trim();
47674
47614
  const condition = schedule.runCondition ?? schedule.mailPurpose;
47675
47615
  lines.push(
@@ -47683,8 +47623,8 @@ var AgentList = class extends ClientCommand {
47683
47623
  static usage = Command.Usage({ category: "Agent", description: "Show the agent bound to this key" });
47684
47624
  async run() {
47685
47625
  const context = await this.client().getAuthContext();
47686
- const agent2 = await boundAgentIdentity(this.client(), context);
47687
- this.emitText({ data: [agent2] }, () => `${agent2.name} (bound agent) ${agent2.agentId}`);
47626
+ const agent3 = await boundAgentIdentity(this.client(), context);
47627
+ this.emitText({ data: [agent3] }, () => `${agent3.name} (bound agent) ${agent3.agentId}`);
47688
47628
  }
47689
47629
  };
47690
47630
  var AgentThreads = class extends ClientCommand {
@@ -48130,6 +48070,645 @@ var AGENDA_COMMANDS = [
48130
48070
  AgendaHtmlUpdate
48131
48071
  ];
48132
48072
 
48073
+ // ente/calendar.ts
48074
+ init_server();
48075
+ var calendarRefs = {
48076
+ connections: makeFunctionReference2("calendarExternal:connectionStatusesForAgent"),
48077
+ list: makeFunctionReference2("calendarExternal:listEventsForAgent"),
48078
+ get: makeFunctionReference2("calendarExternal:getEventForAgent"),
48079
+ create: makeFunctionReference2("calendarExternal:createEventForAgent"),
48080
+ update: makeFunctionReference2("calendarExternal:updateEventForAgent"),
48081
+ remove: makeFunctionReference2("calendarExternal:deleteEventForAgent"),
48082
+ meeting: makeFunctionReference2("calendarExternal:ensureMeetingForAgent"),
48083
+ localList: makeFunctionReference2("calendar:listEventsForAgent"),
48084
+ localGet: makeFunctionReference2("calendar:getLocalEventForAgent"),
48085
+ localCreate: makeFunctionReference2("calendar:createLocalEventForAgent"),
48086
+ localUpdate: makeFunctionReference2("calendar:updateLocalEventForAgent"),
48087
+ localDelete: makeFunctionReference2("calendar:deleteLocalEventForAgent")
48088
+ };
48089
+ function formatEventRef(ref) {
48090
+ const e = encodeURIComponent;
48091
+ switch (ref.kind) {
48092
+ case "google":
48093
+ return `google:${e(ref.connectionId)}:${e(ref.calendarId)}:${e(ref.eventId)}`;
48094
+ case "caldav":
48095
+ return `caldav:${e(ref.calendarId)}:${e(ref.eventId)}`;
48096
+ case "local":
48097
+ return `local:${e(ref.eventId)}`;
48098
+ }
48099
+ }
48100
+ function externalEventRef(event) {
48101
+ if (event.provider === "google" && event.connectionId && event.calendarId)
48102
+ return formatEventRef({ kind: "google", connectionId: event.connectionId, calendarId: event.calendarId, eventId: event.eventId });
48103
+ if (event.provider === "caldav" && event.calendarId)
48104
+ return formatEventRef({ kind: "caldav", calendarId: event.calendarId, eventId: event.eventId });
48105
+ return null;
48106
+ }
48107
+ function parseEventRef(value) {
48108
+ const parts = value.split(":");
48109
+ const d = (part) => {
48110
+ if (!part) throw new Error(`Invalid event reference "${value}".`);
48111
+ return decodeURIComponent(part);
48112
+ };
48113
+ if (parts[0] === "google" && parts.length === 4)
48114
+ return { kind: "google", connectionId: d(parts[1]), calendarId: d(parts[2]), eventId: d(parts[3]) };
48115
+ if (parts[0] === "caldav" && parts.length === 3) return { kind: "caldav", calendarId: d(parts[1]), eventId: d(parts[2]) };
48116
+ if (parts[0] === "local" && parts.length === 2) return { kind: "local", eventId: d(parts[1]) };
48117
+ throw new Error(`Invalid event reference "${value}". Use the ref printed by \`ente calendar list\` (google:\u2026, caldav:\u2026 or local:\u2026).`);
48118
+ }
48119
+ var DEFAULT_TIME_ZONE = "Europe/Berlin";
48120
+ var DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
48121
+ var WALL_RE = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{1,2}):(\d{2})(?::(\d{2}))?$/;
48122
+ var ZONED_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/;
48123
+ function assertTimeZone(timeZone) {
48124
+ try {
48125
+ new Intl.DateTimeFormat("en-US", { timeZone }).format(0);
48126
+ } catch {
48127
+ throw new Error(`Unknown time zone "${timeZone}". Use an IANA name such as Europe/Berlin.`);
48128
+ }
48129
+ return timeZone;
48130
+ }
48131
+ function offsetMs(utcMs, timeZone) {
48132
+ const parts = new Intl.DateTimeFormat("en-US", {
48133
+ timeZone,
48134
+ hour12: false,
48135
+ year: "numeric",
48136
+ month: "2-digit",
48137
+ day: "2-digit",
48138
+ hour: "2-digit",
48139
+ minute: "2-digit",
48140
+ second: "2-digit"
48141
+ }).formatToParts(new Date(utcMs));
48142
+ const get2 = (type) => Number(parts.find((part) => part.type === type)?.value ?? 0);
48143
+ const hour = get2("hour") === 24 ? 0 : get2("hour");
48144
+ return Date.UTC(get2("year"), get2("month") - 1, get2("day"), hour, get2("minute"), get2("second")) - utcMs;
48145
+ }
48146
+ function zonedWallTimeToMs({ year, month, day, hour, minute, second = 0 }, timeZone) {
48147
+ const naive = Date.UTC(year, month - 1, day, hour, minute, second);
48148
+ const first = offsetMs(naive, timeZone);
48149
+ let ms = naive - first;
48150
+ const second2 = offsetMs(ms, timeZone);
48151
+ if (second2 !== first) ms = naive - second2;
48152
+ if (ms + offsetMs(ms, timeZone) !== naive)
48153
+ throw new Error(`${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")} ${hour}:${String(minute).padStart(2, "0")} does not exist in ${timeZone} (clock change); pick another time or give an explicit offset.`);
48154
+ return ms;
48155
+ }
48156
+ function checkedDate(year, month, day, raw) {
48157
+ const date5 = new Date(Date.UTC(year, month - 1, day));
48158
+ if (date5.getUTCFullYear() !== year || date5.getUTCMonth() !== month - 1 || date5.getUTCDate() !== day)
48159
+ throw new Error(`Invalid date "${raw}".`);
48160
+ }
48161
+ function parseInstant(raw, timeZone, flag) {
48162
+ const value = raw.trim().replace(/^(\d{4}-\d{2}-\d{2}) (?=\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$)/, "$1T");
48163
+ if (ZONED_RE.test(value)) {
48164
+ const ms = Date.parse(value);
48165
+ if (Number.isFinite(ms)) return ms;
48166
+ }
48167
+ const match = WALL_RE.exec(value);
48168
+ if (match) {
48169
+ const [year, month, day, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
48170
+ checkedDate(year, month, day, raw);
48171
+ if (hour > 23 || minute > 59 || second > 59) throw new Error(`Invalid time in ${flag} "${raw}".`);
48172
+ return zonedWallTimeToMs({ year, month, day, hour, minute, second }, timeZone);
48173
+ }
48174
+ if (DATE_RE.test(value)) throw new Error(`${flag} "${raw}" is a date; add a time (YYYY-MM-DD HH:MM) or use --all-day.`);
48175
+ throw new Error(`Invalid ${flag} "${raw}". Use YYYY-MM-DD HH:MM (in --tz), or ISO 8601 with Z/offset.`);
48176
+ }
48177
+ function parseDay(raw, flag) {
48178
+ const match = DATE_RE.exec(raw.trim());
48179
+ if (!match) throw new Error(`Invalid ${flag} "${raw}" for an all-day event. Use YYYY-MM-DD.`);
48180
+ checkedDate(Number(match[1]), Number(match[2]), Number(match[3]), raw);
48181
+ return raw.trim();
48182
+ }
48183
+ function addDays(day, days) {
48184
+ const [year, month, date5] = day.split("-").map(Number);
48185
+ return new Date(Date.UTC(year, month - 1, date5 + days)).toISOString().slice(0, 10);
48186
+ }
48187
+ function dayToUtcMs(day) {
48188
+ const [year, month, date5] = day.split("-").map(Number);
48189
+ return Date.UTC(year, month - 1, date5);
48190
+ }
48191
+ function todayIn(timeZone) {
48192
+ const parts = new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" }).format(/* @__PURE__ */ new Date());
48193
+ return parts;
48194
+ }
48195
+ function formatInZone(iso, allDay, timeZone) {
48196
+ if (allDay) return iso.slice(0, 10);
48197
+ const ms = Date.parse(iso);
48198
+ if (!Number.isFinite(ms)) return iso;
48199
+ return new Intl.DateTimeFormat("sv-SE", { timeZone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }).format(new Date(ms));
48200
+ }
48201
+ function resolveTiming({ start, end, durationMinutes, allDay, timeZone }) {
48202
+ if (end !== void 0 && durationMinutes !== void 0) throw new Error("Use either --end or --duration, not both.");
48203
+ if (allDay) {
48204
+ if (durationMinutes !== void 0) throw new Error("--duration does not apply to all-day events; use --end with the last day.");
48205
+ const startDay = parseDay(start, "--start");
48206
+ const lastDay = end === void 0 ? startDay : parseDay(end, "--end");
48207
+ if (lastDay < startDay) throw new Error("--end must not be before --start.");
48208
+ const endDayExclusive = addDays(lastDay, 1);
48209
+ return { allDay: true, startMs: dayToUtcMs(startDay), endMs: dayToUtcMs(endDayExclusive), startDay, endDayExclusive };
48210
+ }
48211
+ const startMs = parseInstant(start, timeZone, "--start");
48212
+ const endMs = end !== void 0 ? parseInstant(end, timeZone, "--end") : startMs + (durationMinutes ?? 60) * 6e4;
48213
+ if (durationMinutes !== void 0 && (!Number.isInteger(durationMinutes) || durationMinutes <= 0))
48214
+ throw new Error("--duration must be a positive number of minutes.");
48215
+ if (endMs <= startMs) throw new Error("The event must end after it starts.");
48216
+ return { allDay: false, startMs, endMs };
48217
+ }
48218
+ function externalTimes(timing) {
48219
+ return timing.allDay ? { start: timing.startDay, end: timing.endDayExclusive, allDay: true } : { start: new Date(timing.startMs).toISOString(), end: new Date(timing.endMs).toISOString(), allDay: false };
48220
+ }
48221
+ var EMAIL_RE = /^[^\s@,;<>]+@[^\s@,;<>]+\.[^\s@,;<>]+$/;
48222
+ function normalizeAttendees(values) {
48223
+ const emails = values.flatMap((value) => value.split(",")).map((value) => value.trim()).filter(Boolean);
48224
+ for (const email3 of emails) if (!EMAIL_RE.test(email3)) throw new Error(`Invalid attendee email "${email3}".`);
48225
+ return [...new Map(emails.map((email3) => [email3.toLowerCase(), email3])).values()];
48226
+ }
48227
+ function resolveCreateTarget(statuses, { account, calendar, caldav }) {
48228
+ if (caldav !== void 0) {
48229
+ if (account !== void 0 || calendar !== void 0) throw new Error("--caldav cannot be combined with --account or --calendar.");
48230
+ const match = statuses.caldavCalendars.filter((row2) => row2.calendarId === caldav || row2.calendarName.toLowerCase() === caldav.toLowerCase());
48231
+ if (match.length !== 1) throw new Error(match.length === 0 ? `No connected CalDAV calendar "${caldav}". Run \`ente calendar connections\`.` : `CalDAV calendar name "${caldav}" is ambiguous; pass its URL.`);
48232
+ return { kind: "caldav", calendarId: match[0].calendarId, label: `${match[0].calendarName} (CalDAV)` };
48233
+ }
48234
+ const accounts = account === void 0 ? statuses.google : statuses.google.filter((row2) => row2.email.toLowerCase() === account.toLowerCase() || row2.connectionId === account);
48235
+ if (account !== void 0 && accounts.length === 0)
48236
+ throw new Error(`No connected Google account "${account}". Connected: ${statuses.google.map((row2) => row2.email).join(", ") || "none"}.`);
48237
+ if (accounts.length === 0)
48238
+ throw new Error("No Google Calendar is connected. Connect one in ente (Settings \u2192 Calendar), or use --local --space <space>.");
48239
+ const candidates = accounts.flatMap((row2) => row2.calendars.map((cal2) => ({ row: row2, cal: cal2 })));
48240
+ let chosen;
48241
+ if (calendar !== void 0) {
48242
+ chosen = candidates.filter(({ cal: cal2 }) => cal2.calendarId === calendar || cal2.name.toLowerCase() === calendar.toLowerCase());
48243
+ if (chosen.length === 0) throw new Error(`No calendar "${calendar}"${account ? ` in ${account}` : ""}. Run \`ente calendar connections\`.`);
48244
+ } else {
48245
+ chosen = candidates.filter(({ cal: cal2 }) => cal2.defaultWrite);
48246
+ if (chosen.length === 0 && accounts.length === 1) chosen = candidates.filter(({ cal: cal2 }) => cal2.primary);
48247
+ if (chosen.length === 0) throw new Error("No default calendar is set; pass --account and/or --calendar.");
48248
+ }
48249
+ if (chosen.length > 1) throw new Error(`Several calendars match (${chosen.map(({ row: row2, cal: cal2 }) => `${row2.email}: ${cal2.name}`).join("; ")}); pass --account and --calendar.`);
48250
+ const { row, cal } = chosen[0];
48251
+ if (!cal.editable) throw new Error(`Calendar "${cal.name}" in ${row.email} is read-only (${cal.accessRole}).`);
48252
+ return { kind: "google", connectionId: row.connectionId, calendarId: cal.calendarId, label: `${cal.name} (${row.email})` };
48253
+ }
48254
+ function assertSuccess(result, verb) {
48255
+ if (!result.success) {
48256
+ const ref = result.event ? externalEventRef(result.event) : null;
48257
+ throw new Error(`Calendar ${verb} failed: ${result.error}${ref ? ` (event ${ref})` : ""}`);
48258
+ }
48259
+ return result;
48260
+ }
48261
+ async function getConnections(caller) {
48262
+ return await caller.action(calendarRefs.connections, {});
48263
+ }
48264
+ async function getEvent(caller, ref) {
48265
+ if (ref.kind === "local") {
48266
+ const event2 = await caller.query(calendarRefs.localGet, { eventId: ref.eventId });
48267
+ if (!event2) throw new Error(`Local calendar event ${ref.eventId} not found.`);
48268
+ return event2;
48269
+ }
48270
+ const event = await caller.action(calendarRefs.get, ref.kind === "google" ? { provider: "google", connectionId: ref.connectionId, calendarId: ref.calendarId, eventId: ref.eventId } : { provider: "caldav", calendarId: ref.calendarId, eventId: ref.eventId });
48271
+ if (!event) throw new Error(`Calendar event ${formatEventRef(ref)} not found or not readable.`);
48272
+ return event;
48273
+ }
48274
+
48275
+ // ente/commands/calendar.ts
48276
+ var CATEGORY = "Calendar";
48277
+ function isExternal(event) {
48278
+ return "provider" in event;
48279
+ }
48280
+ function eventRef(event) {
48281
+ if (isExternal(event)) return externalEventRef(event) ?? `${event.provider}:${event.eventId}`;
48282
+ return event.localEventId ? formatEventRef({ kind: "local", eventId: event.localEventId }) : event.id;
48283
+ }
48284
+ function meetingUri(event) {
48285
+ if (event.meetingLink) return event.meetingLink;
48286
+ if (isExternal(event)) return event.conference?.uri;
48287
+ return void 0;
48288
+ }
48289
+ function eventLine(event, timeZone) {
48290
+ const when = `${formatInZone(event.start, event.allDay, timeZone)}${event.end ? ` \u2192 ${formatInZone(event.end, event.allDay, timeZone)}` : ""}`;
48291
+ const where = isExternal(event) ? event.provider === "google" ? `${event.calendarName ?? event.calendarId ?? "Google"}${event.accountEmail ? ` <${event.accountEmail}>` : ""}` : `${event.calendarName ?? "CalDAV"}` : event.source === "task" ? "task" : "ente";
48292
+ return `${when} ${event.title} [${where}]
48293
+ ref: ${eventRef(event)}`;
48294
+ }
48295
+ function eventDetails(event, timeZone) {
48296
+ const lines = [eventLine(event, timeZone)];
48297
+ if (event.timeZone) lines.push(` time zone: ${event.timeZone}`);
48298
+ if (event.location) lines.push(` location: ${event.location}`);
48299
+ const uri = meetingUri(event);
48300
+ if (uri) lines.push(` video: ${uri}`);
48301
+ if (isExternal(event) && event.attendees?.length)
48302
+ lines.push(` attendees: ${event.attendees.map((guest) => `${guest.email}${guest.responseStatus ? ` (${guest.responseStatus})` : ""}${guest.organizer ? " [organizer]" : ""}`).join(", ")}`);
48303
+ if (event.recurrence?.length) lines.push(` recurrence: ${event.recurrence.join(" ")}`);
48304
+ if (!isExternal(event)) {
48305
+ lines.push(` space: ${event.spaceId}`);
48306
+ if (event.entityId) lines.push(` entity: ${event.entityId}`);
48307
+ if (event.activityId) lines.push(` activity: ${event.activityId}`);
48308
+ }
48309
+ if (event.href) lines.push(` link: ${event.href}`);
48310
+ if (event.description) lines.push(` description: ${event.description.replace(/\n/g, "\n ")}`);
48311
+ return lines.join("\n");
48312
+ }
48313
+ function parseDuration(raw) {
48314
+ if (raw === void 0) return void 0;
48315
+ const minutes = Number(raw);
48316
+ if (!Number.isInteger(minutes) || minutes <= 0) throw new Error("--duration must be a positive number of minutes.");
48317
+ return minutes;
48318
+ }
48319
+ async function meetingRequest(caller, space3, entities, title4) {
48320
+ if (!space3) throw new Error("--meeting needs --space <name|id> (the space the meeting activity belongs to).");
48321
+ return {
48322
+ spaceId: await resolveSpaceByNameC(caller, space3),
48323
+ entityIds: await resolveEntitiesC(caller, entities),
48324
+ ...title4 ? { title: title4 } : {}
48325
+ };
48326
+ }
48327
+ var CalendarConnectionsCmd = class extends ProfileCommand {
48328
+ static paths = [["calendar", "connections"]];
48329
+ static usage = Command.Usage({
48330
+ category: CATEGORY,
48331
+ description: "Show connected calendar accounts and calendars, and which one `create` writes to by default"
48332
+ });
48333
+ async run() {
48334
+ const data = await getConnections(await resolveCaller());
48335
+ this.emitText(data, () => {
48336
+ const lines = [];
48337
+ for (const account of data.google) {
48338
+ lines.push(`Google ${account.email} (connection ${account.connectionId})`);
48339
+ for (const cal of account.calendars)
48340
+ lines.push(` ${cal.defaultWrite ? "*" : " "} ${cal.name} id=${cal.calendarId} ${cal.accessRole}${cal.editable ? "" : " (read-only)"}${cal.selected ? "" : " (hidden)"}${cal.primary ? " (primary)" : ""}`);
48341
+ }
48342
+ for (const cal of data.caldavCalendars) lines.push(`CalDAV ${cal.calendarName} ${cal.username}@${cal.serverUrl} id=${cal.calendarId}`);
48343
+ if (!lines.length) return "No external calendars connected. Local ente events: `ente calendar create --local --space <space>`.";
48344
+ lines.push("", "* = default target of `ente calendar create` (override with --account/--calendar, --caldav or --local).");
48345
+ return lines.join("\n");
48346
+ });
48347
+ }
48348
+ };
48349
+ var CalendarListCmd = class extends ProfileCommand {
48350
+ static paths = [["calendar", "list"]];
48351
+ static usage = Command.Usage({
48352
+ category: CATEGORY,
48353
+ description: "List events of the connected calendars (and ente events of a space or entity) in a date range",
48354
+ examples: [
48355
+ ["Next 7 days", "ente calendar list"],
48356
+ ["One week, one search term", "ente calendar list --from 2026-11-16 --to 2026-11-22 --query Steuer"],
48357
+ ["Including ente events of a space", "ente calendar list --space Kanzlei --days 14"]
48358
+ ]
48359
+ });
48360
+ from = options_exports.String("--from", { description: "First day YYYY-MM-DD (default: today in --tz)" });
48361
+ to = options_exports.String("--to", { description: "Last day YYYY-MM-DD, inclusive (default: --from + --days \u2212 1)" });
48362
+ days = options_exports.String("--days", { description: "Number of days when --to is absent (default 7)" });
48363
+ query = options_exports.String("--query", { description: "Only events whose title, description or location contain this text" });
48364
+ space = options_exports.String("--space", { description: "Also list ente (local) events and task dates of this space" });
48365
+ entity = options_exports.String("--entity", { description: "Also list ente (local) events and task dates linked to this entity" });
48366
+ tasks = options_exports.Boolean("--tasks", false, { description: "With --space/--entity: include task due dates" });
48367
+ externalOnly = options_exports.Boolean("--external-only", false, { description: "Skip ente events even with --space/--entity" });
48368
+ localOnly = options_exports.Boolean("--local-only", false, { description: "With --space/--entity: only ente events (works with keys of shared agents)" });
48369
+ max = options_exports.String("--max", { description: "Maximum events per external calendar page (1\u2013250)" });
48370
+ tz = options_exports.String("--tz", DEFAULT_TIME_ZONE, { description: "Time zone for bare dates and output" });
48371
+ async run() {
48372
+ const timeZone = assertTimeZone(this.tz);
48373
+ if (this.space && this.entity) throw new Error("Use either --space or --entity, not both.");
48374
+ const fromDay = this.from === void 0 ? todayIn(timeZone) : parseDay(this.from, "--from");
48375
+ const days = this.days === void 0 ? 7 : Number(this.days);
48376
+ if (!Number.isInteger(days) || days <= 0) throw new Error("--days must be a positive integer.");
48377
+ const toDay = this.to === void 0 ? addDays(fromDay, days - 1) : parseDay(this.to, "--to");
48378
+ if (toDay < fromDay) throw new Error("--to must not be before --from.");
48379
+ const endExclusive = addDays(toDay, 1);
48380
+ const max = this.max === void 0 ? void 0 : Number(this.max);
48381
+ if (max !== void 0 && (!Number.isInteger(max) || max < 1 || max > 250)) throw new Error("--max must be 1\u2013250.");
48382
+ if (this.localOnly && this.externalOnly) throw new Error("Use either --local-only or --external-only.");
48383
+ if (this.localOnly && !this.space && !this.entity) throw new Error("--local-only needs --space or --entity.");
48384
+ const caller = await resolveCaller();
48385
+ const external = this.localOnly ? { events: [], errors: [] } : await caller.action(calendarRefs.list, {
48386
+ timeMin: new Date(resolveTiming({ start: `${fromDay} 00:00`, allDay: false, timeZone }).startMs).toISOString(),
48387
+ timeMax: new Date(resolveTiming({ start: `${endExclusive} 00:00`, allDay: false, timeZone }).startMs).toISOString(),
48388
+ timeZone,
48389
+ ...max === void 0 ? {} : { maxResults: max },
48390
+ ...this.query ? { query: this.query } : {}
48391
+ });
48392
+ let local = [];
48393
+ if ((this.space || this.entity) && !this.externalOnly) {
48394
+ const scope = this.space ? { kind: "dashboard", spaceId: await resolveSpaceByNameC(caller, this.space) } : { kind: "entity", entityId: (await resolveEntitiesC(caller, [this.entity]))[0] };
48395
+ const needle = this.query?.toLocaleLowerCase();
48396
+ local = (await caller.query(calendarRefs.localList, { scope, start: fromDay, end: endExclusive })).filter((event) => event.source !== "google" && (this.tasks || event.source !== "task")).filter((event) => !needle || [event.title, event.description, event.location].some((value) => value?.toLocaleLowerCase().includes(needle)));
48397
+ }
48398
+ const events = [...external.events, ...local].sort((a, b) => Date.parse(a.start) - Date.parse(b.start) || a.title.localeCompare(b.title));
48399
+ this.emitText({ from: fromDay, to: toDay, timeZone, events: events.map((event) => ({ ref: eventRef(event), ...event })), errors: external.errors }, () => [
48400
+ ...events.length ? events.map((event) => eventLine(event, timeZone)) : [`No events ${fromDay} \u2026 ${toDay}.`],
48401
+ ...external.errors.map((error62) => `warning (${error62.provider}): ${error62.message}`)
48402
+ ].join("\n"));
48403
+ return external.errors.length && !external.events.length ? 1 : void 0;
48404
+ }
48405
+ };
48406
+ var CalendarGetCmd = class extends ProfileCommand {
48407
+ static paths = [["calendar", "get"]];
48408
+ static usage = Command.Usage({ category: CATEGORY, description: "Show one event (attendees, video link, recurrence) by its ref from `ente calendar list`" });
48409
+ ref = options_exports.String({ required: true, name: "ref" });
48410
+ tz = options_exports.String("--tz", DEFAULT_TIME_ZONE, { description: "Time zone for output" });
48411
+ async run() {
48412
+ const timeZone = assertTimeZone(this.tz);
48413
+ const event = await getEvent(await resolveCaller(), parseEventRef(this.ref));
48414
+ this.emitText({ ref: eventRef(event), ...event }, () => eventDetails(event, timeZone));
48415
+ }
48416
+ };
48417
+ var EventFieldsCommand = class extends ProfileCommand {
48418
+ title = options_exports.String("--title", { description: "Event title" });
48419
+ start = options_exports.String("--start", { description: "Start: YYYY-MM-DD HH:MM in --tz, ISO 8601 with offset, or YYYY-MM-DD with --all-day" });
48420
+ end = options_exports.String("--end", { description: "End (same formats); for --all-day the last day, inclusive" });
48421
+ duration = options_exports.String("--duration", { description: "Length in minutes instead of --end (timed events)" });
48422
+ tz = options_exports.String("--tz", DEFAULT_TIME_ZONE, { description: "IANA time zone of bare times and of the event" });
48423
+ location = options_exports.String("--location", { description: "Location" });
48424
+ description = options_exports.String("--description", { description: "Description (plain text)" });
48425
+ attendees = options_exports.Array("--attendee", [], { description: "Guest email; repeatable or comma-separated (Google only)" });
48426
+ sendInvites = options_exports.Boolean("--send-invites", false, {
48427
+ description: "Mail guests (invitation / update / cancellation). Default: no mail to anyone"
48428
+ });
48429
+ meet = options_exports.Boolean("--meet", false, { description: "Add a Google Meet video conference (Google only)" });
48430
+ recurrence = options_exports.Array("--recurrence", [], { description: "RFC 5545 line, e.g. RRULE:FREQ=WEEKLY;COUNT=4; repeatable" });
48431
+ color = options_exports.String("--color", { description: "Google colorId (1\u201311) or, for local events, a color name" });
48432
+ meetingLink = options_exports.String("--meeting-link", { description: "Video link stored on a local ente event (external: use --meet or --location)" });
48433
+ };
48434
+ var CalendarCreateCmd = class extends EventFieldsCommand {
48435
+ static paths = [["calendar", "create"]];
48436
+ static usage = Command.Usage({
48437
+ category: CATEGORY,
48438
+ description: "Create an event in a connected calendar (default target: see `ente calendar connections`) or as a local ente event",
48439
+ details: `
48440
+ Target: the default Google calendar unless --account/--calendar, --caldav or --local choose another.
48441
+ Guests: --attendee adds them to the event; they are only mailed with --send-invites.
48442
+ Video: --meet creates a Google Meet link. Reminders follow the calendar's defaults.
48443
+ Graph: --meeting --space S [--entity E \u2026] creates the event's meeting activity in ente;
48444
+ local events take --space plus at most one --entity and an optional --activity.
48445
+ `,
48446
+ examples: [
48447
+ ["Meeting in the default calendar, no mail", "ente calendar create --title 'Steuer Q4' --start '2026-11-20 14:00' --duration 45 --meet"],
48448
+ ["In a specific account, with guests and invitations", "ente calendar create --account me@example.org --title Kickoff --start '2026-11-24 10:00' --attendee a@example.org --attendee b@example.org --send-invites --meet"],
48449
+ ["All-day, two days", "ente calendar create --title Messe --start 2026-12-01 --end 2026-12-02 --all-day"],
48450
+ ["Local ente event linked to an entity", "ente calendar create --local --space Kanzlei --entity 'Muster GmbH' --title Frist --start '2026-11-30 09:00'"],
48451
+ ["With meeting activity in the graph", "ente calendar create --title 'Jour fixe' --start '2026-11-21 09:00' --meeting --space Kanzlei --entity 'Muster GmbH'"]
48452
+ ]
48453
+ });
48454
+ allDay = options_exports.Boolean("--all-day", false, { description: "All-day event; --start/--end are days" });
48455
+ account = options_exports.String("--account", { description: "Google account email (or connection id) to write to" });
48456
+ calendar = options_exports.String("--calendar", { description: "Google calendar id or name (default: the account's default calendar)" });
48457
+ caldav = options_exports.String("--caldav", { description: "CalDAV calendar URL or name" });
48458
+ local = options_exports.Boolean("--local", false, { description: "Create a local ente event (needs --space)" });
48459
+ space = options_exports.String("--space", { description: "Space of a local event, or of the --meeting activity" });
48460
+ entities = options_exports.Array("--entity", [], { description: "Entity name or id; repeatable (local events: at most one)" });
48461
+ activity = options_exports.String("--activity", { description: "Local events: link an existing activity id" });
48462
+ meeting = options_exports.Boolean("--meeting", false, { description: "External events: create the meeting activity in ente (needs --space)" });
48463
+ async run() {
48464
+ if (!this.title?.trim()) throw new Error("--title is required.");
48465
+ if (!this.start) throw new Error("--start is required.");
48466
+ const timeZone = assertTimeZone(this.tz);
48467
+ const timing = resolveTiming({ start: this.start, end: this.end, durationMinutes: parseDuration(this.duration), allDay: this.allDay, timeZone });
48468
+ const attendees = normalizeAttendees(this.attendees);
48469
+ if (this.sendInvites && !attendees.length) throw new Error("--send-invites needs at least one --attendee.");
48470
+ const caller = await resolveCaller();
48471
+ if (this.local) {
48472
+ if (this.account || this.calendar || this.caldav) throw new Error("--local cannot be combined with --account, --calendar or --caldav.");
48473
+ if (attendees.length || this.sendInvites || this.meet) throw new Error("Local ente events have no guests or Google Meet; use a Google calendar for those.");
48474
+ if (this.meeting) throw new Error("--meeting applies to external events; link a local event with --activity.");
48475
+ if (!this.space) throw new Error("--local needs --space <name|id>.");
48476
+ if (this.entities.length > 1) throw new Error("A local event links at most one --entity.");
48477
+ const input2 = {
48478
+ title: this.title.trim(),
48479
+ startMs: timing.startMs,
48480
+ endMs: timing.endMs,
48481
+ allDay: timing.allDay,
48482
+ timeZone: timing.allDay ? null : timeZone,
48483
+ spaceId: await resolveSpaceByNameC(caller, this.space),
48484
+ ...this.entities.length ? { entityId: (await resolveEntitiesC(caller, this.entities))[0] } : {},
48485
+ ...this.activity ? { activityId: this.activity } : {},
48486
+ ...this.location ? { location: this.location } : {},
48487
+ ...this.description ? { description: this.description } : {},
48488
+ ...this.meetingLink ? { meetingLink: this.meetingLink } : {},
48489
+ ...this.color ? { color: this.color } : {},
48490
+ ...this.recurrence.length ? { recurrence: this.recurrence } : {}
48491
+ };
48492
+ const event2 = await caller.mutation(calendarRefs.localCreate, input2);
48493
+ this.emitText({ ref: eventRef(event2), event: event2 }, () => `Created local event
48494
+ ${eventDetails(event2, timeZone)}`);
48495
+ return;
48496
+ }
48497
+ if (this.activity) throw new Error("--activity links local events; for external events use --meeting.");
48498
+ if (this.meetingLink) throw new Error("--meeting-link is for local events; use --meet or --location for external ones.");
48499
+ if (!this.meeting && (this.space || this.entities.length)) throw new Error("--space/--entity on an external event need --meeting (create the meeting activity).");
48500
+ const target3 = resolveCreateTarget(await getConnections(caller), { account: this.account, calendar: this.calendar, caldav: this.caldav });
48501
+ if (target3.kind === "local") throw new Error("Unexpected local target.");
48502
+ const meeting = this.meeting ? await meetingRequest(caller, this.space, this.entities, this.title.trim()) : void 0;
48503
+ const result = await caller.action(calendarRefs.create, {
48504
+ provider: target3.kind,
48505
+ ...target3.kind === "google" ? { connectionId: target3.connectionId } : {},
48506
+ calendarId: target3.calendarId,
48507
+ title: this.title.trim(),
48508
+ ...externalTimes(timing),
48509
+ ...timing.allDay ? {} : { timeZone },
48510
+ ...this.location ? { location: this.location } : {},
48511
+ ...this.description ? { description: this.description } : {},
48512
+ ...attendees.length ? { attendees } : {},
48513
+ ...this.meet ? { createConference: true } : {},
48514
+ ...this.recurrence.length ? { recurrence: this.recurrence } : {},
48515
+ ...this.color ? { colorId: this.color } : {},
48516
+ notifyAttendees: this.sendInvites,
48517
+ ...meeting ? { meeting } : {}
48518
+ });
48519
+ const { event, meeting: linked } = assertSuccess(result, "create");
48520
+ this.emitText({ ref: eventRef(event), event, ...linked ? { meeting: linked } : {}, invitationsSent: this.sendInvites && attendees.length > 0 }, () => [
48521
+ `Created in ${target3.label}`,
48522
+ eventDetails(event, timeZone),
48523
+ ...attendees.length ? [this.sendInvites ? " invitations: sent" : " invitations: not sent (add --send-invites to mail guests)"] : [],
48524
+ ...linked ? [` meeting activity: ${linked.meetingActivityId}${linked.created ? " (created)" : " (existing)"}`] : []
48525
+ ].join("\n"));
48526
+ }
48527
+ };
48528
+ var CalendarUpdateCmd = class extends EventFieldsCommand {
48529
+ static paths = [["calendar", "update"]];
48530
+ static usage = Command.Usage({
48531
+ category: CATEGORY,
48532
+ description: "Change an event by its ref; only the given fields change",
48533
+ details: `
48534
+ --attendee replaces the whole guest list; --clear-attendees removes all guests.
48535
+ Guests are mailed about the change only with --send-invites.
48536
+ Times: give --start (and optionally --end/--duration); a new --start alone keeps the event's length.
48537
+ `,
48538
+ examples: [
48539
+ ["Move by an hour, no mail", "ente calendar update google:\u2026 --start '2026-11-20 15:00'"],
48540
+ ["Add a guest and invite", "ente calendar update google:\u2026 --attendee a@example.org --attendee new@example.org --send-invites"]
48541
+ ]
48542
+ });
48543
+ ref = options_exports.String({ required: true, name: "ref" });
48544
+ allDay = options_exports.Boolean("--all-day", { description: "Make the event all-day (--no-all-day: timed)" });
48545
+ clearAttendees = options_exports.Boolean("--clear-attendees", false, { description: "Remove all guests" });
48546
+ series = options_exports.Boolean("--series", false, { description: "Local recurring events: confirm that the change applies to the whole series" });
48547
+ clearRecurrence = options_exports.Boolean("--clear-recurrence", false, { description: "Local events: make the event non-recurring" });
48548
+ clearMeetingLink = options_exports.Boolean("--clear-meeting-link", false, { description: "Local events: remove the stored meeting link" });
48549
+ moveToCalendar = options_exports.String("--move-to-calendar", { description: "Google: move to another calendar id (same or --move-to-account)" });
48550
+ moveToAccount = options_exports.String("--move-to-account", { description: "Google: connection id of the destination calendar" });
48551
+ space = options_exports.String("--space", { description: "Local events: move to this space" });
48552
+ entity = options_exports.String("--entity", { description: "Local events: link this entity ('' to unlink)" });
48553
+ activity = options_exports.String("--activity", { description: "Local events: link this activity id ('' to unlink)" });
48554
+ async run() {
48555
+ const timeZone = assertTimeZone(this.tz);
48556
+ const ref = parseEventRef(this.ref);
48557
+ const caller = await resolveCaller();
48558
+ if (this.clearAttendees && this.attendees.length) throw new Error("Use either --attendee or --clear-attendees.");
48559
+ const attendees = this.clearAttendees ? [] : this.attendees.length ? normalizeAttendees(this.attendees) : void 0;
48560
+ const current = await getEvent(caller, ref);
48561
+ const timeFlags = this.start !== void 0 || this.end !== void 0 || this.duration !== void 0 || this.allDay !== void 0;
48562
+ let timing;
48563
+ if (timeFlags) {
48564
+ const allDay = this.allDay ?? current.allDay;
48565
+ if (allDay !== current.allDay && this.start === void 0) throw new Error("Changing --all-day needs a new --start.");
48566
+ const start = this.start ?? (allDay ? current.start.slice(0, 10) : current.start);
48567
+ let end = this.end;
48568
+ let duration3 = parseDuration(this.duration);
48569
+ if (end === void 0 && duration3 === void 0 && current.end) {
48570
+ if (allDay) {
48571
+ const spanDays = Math.max(1, (dayToUtcMs(current.end.slice(0, 10)) - dayToUtcMs(current.start.slice(0, 10))) / 864e5);
48572
+ end = addDays(parseDay(start, "--start"), spanDays - 1);
48573
+ } else if (!current.allDay) {
48574
+ duration3 = Math.round((Date.parse(current.end) - Date.parse(current.start)) / 6e4);
48575
+ }
48576
+ }
48577
+ timing = resolveTiming({ start, end, durationMinutes: duration3, allDay, timeZone });
48578
+ }
48579
+ if (ref.kind === "local") {
48580
+ if (isExternal(current)) throw new Error("Unexpected external event for a local ref.");
48581
+ if (attendees !== void 0 || this.sendInvites || this.meet || this.moveToCalendar || this.moveToAccount)
48582
+ throw new Error("Local ente events have no guests, Google Meet or calendar moves.");
48583
+ if (current.recurrence?.length && !this.series)
48584
+ throw new Error("This local event repeats; a change applies to the whole series (a new --start moves the series start). Repeat with --series to confirm.");
48585
+ if (this.clearRecurrence && this.recurrence.length) throw new Error("Use either --recurrence or --clear-recurrence.");
48586
+ const startMs = timing?.startMs ?? (current.allDay ? dayToUtcMs(current.seriesStart?.slice(0, 10) ?? current.start.slice(0, 10)) : Date.parse(current.seriesStart ?? current.start));
48587
+ const currentEnd = current.seriesEnd ?? current.end;
48588
+ const endMs = timing?.endMs ?? (currentEnd ? current.allDay ? dayToUtcMs(currentEnd.slice(0, 10)) : Date.parse(currentEnd) : null);
48589
+ const pick2 = (flag, existing) => flag === void 0 ? existing ?? null : flag || null;
48590
+ const input2 = {
48591
+ eventId: ref.eventId,
48592
+ title: this.title?.trim() || current.title,
48593
+ startMs,
48594
+ endMs,
48595
+ allDay: timing?.allDay ?? current.allDay,
48596
+ timeZone: timing?.allDay ?? current.allDay ? null : this.tz !== DEFAULT_TIME_ZONE || timing ? timeZone : current.timeZone ?? null,
48597
+ location: pick2(this.location, current.location),
48598
+ description: pick2(this.description, current.description),
48599
+ href: current.href ?? null,
48600
+ meetingLink: this.clearMeetingLink ? null : pick2(this.meetingLink, current.meetingLink),
48601
+ color: pick2(this.color, current.color),
48602
+ recurrence: this.clearRecurrence ? null : this.recurrence.length ? this.recurrence : current.recurrence ?? null,
48603
+ spaceId: this.space ? await resolveSpaceByNameC(caller, this.space) : current.spaceId,
48604
+ entityId: this.entity === void 0 ? current.entityId ?? null : this.entity ? (await resolveEntitiesC(caller, [this.entity]))[0] : null,
48605
+ activityId: pick2(this.activity, current.activityId)
48606
+ };
48607
+ const event2 = await caller.mutation(calendarRefs.localUpdate, input2);
48608
+ this.emitText({ ref: eventRef(event2), event: event2 }, () => `Updated local event
48609
+ ${eventDetails(event2, timeZone)}`);
48610
+ return;
48611
+ }
48612
+ if (this.space || this.entity !== void 0 || this.activity !== void 0 || this.meetingLink || this.clearMeetingLink)
48613
+ throw new Error("--space/--entity/--activity/--meeting-link/--clear-meeting-link apply to local events; use `ente calendar link` for a meeting activity.");
48614
+ if (this.sendInvites && !(attendees?.length || isExternal(current) && current.attendees?.length))
48615
+ throw new Error("--send-invites needs guests on the event.");
48616
+ const patch2 = {
48617
+ ...this.title?.trim() ? { title: this.title.trim() } : {},
48618
+ ...timing ? { ...externalTimes(timing), ...timing.allDay ? {} : { timeZone } } : {},
48619
+ ...this.location !== void 0 ? { location: this.location } : {},
48620
+ ...this.description !== void 0 ? { description: this.description } : {},
48621
+ ...attendees !== void 0 ? { attendees } : {},
48622
+ ...this.meet ? { createConference: true } : {},
48623
+ ...this.recurrence.length ? { recurrence: this.recurrence } : {},
48624
+ ...this.color !== void 0 ? { colorId: this.color || null } : {}
48625
+ };
48626
+ const move = this.moveToCalendar || this.moveToAccount;
48627
+ if (!Object.keys(patch2).length && !move) throw new Error("Nothing to change; pass at least one field (--send-invites only mails guests about a change).");
48628
+ if (this.moveToAccount && !this.moveToCalendar) throw new Error("--move-to-account needs --move-to-calendar.");
48629
+ const result = await caller.action(calendarRefs.update, {
48630
+ provider: ref.kind,
48631
+ ...ref.kind === "google" ? { connectionId: ref.connectionId } : {},
48632
+ calendarId: ref.calendarId,
48633
+ eventId: ref.eventId,
48634
+ ...this.moveToCalendar ? { destinationCalendarId: this.moveToCalendar } : {},
48635
+ ...this.moveToAccount ? { destinationConnectionId: this.moveToAccount } : {},
48636
+ ...patch2,
48637
+ notifyAttendees: this.sendInvites
48638
+ });
48639
+ const { event } = assertSuccess(result, "update");
48640
+ this.emitText({ ref: eventRef(event), event, guestsNotified: this.sendInvites }, () => `Updated${this.sendInvites ? " (guests notified)" : " (no mail sent)"}
48641
+ ${eventDetails(event, timeZone)}`);
48642
+ }
48643
+ };
48644
+ var CalendarDeleteCmd = class extends ProfileCommand {
48645
+ static paths = [["calendar", "delete"]];
48646
+ static usage = Command.Usage({
48647
+ category: CATEGORY,
48648
+ description: "Delete an event by its ref; guests get a cancellation mail only with --send-invites"
48649
+ });
48650
+ ref = options_exports.String({ required: true, name: "ref" });
48651
+ sendInvites = options_exports.Boolean("--send-invites", false, { description: "Mail guests a cancellation" });
48652
+ series = options_exports.Boolean("--series", false, { description: "Local recurring events: confirm deleting the whole series" });
48653
+ async run() {
48654
+ const ref = parseEventRef(this.ref);
48655
+ const caller = await resolveCaller();
48656
+ if (ref.kind === "local") {
48657
+ if (this.sendInvites) throw new Error("Local ente events have no guests.");
48658
+ const current = await getEvent(caller, ref);
48659
+ if (current.recurrence?.length && !this.series)
48660
+ throw new Error("This local event repeats; delete removes the whole series. Repeat with --series to confirm.");
48661
+ await caller.mutation(calendarRefs.localDelete, { eventId: ref.eventId });
48662
+ this.emitText({ deleted: formatEventRef(ref) }, () => `Deleted ${formatEventRef(ref)}`);
48663
+ return;
48664
+ }
48665
+ const result = await caller.action(calendarRefs.remove, {
48666
+ provider: ref.kind,
48667
+ ...ref.kind === "google" ? { connectionId: ref.connectionId } : {},
48668
+ calendarId: ref.calendarId,
48669
+ eventId: ref.eventId,
48670
+ notifyAttendees: this.sendInvites
48671
+ });
48672
+ if (!result.success) throw new Error(`Calendar delete failed: ${result.error}`);
48673
+ this.emitText({ deleted: formatEventRef(ref), guestsNotified: this.sendInvites }, () => `Deleted ${formatEventRef(ref)}${this.sendInvites ? " (guests notified)" : " (no mail sent)"}`);
48674
+ }
48675
+ };
48676
+ var CalendarLinkCmd = class extends ProfileCommand {
48677
+ static paths = [["calendar", "link"]];
48678
+ static usage = Command.Usage({
48679
+ category: CATEGORY,
48680
+ description: "Create (or find) the ente meeting activity of an external event and link it to entities",
48681
+ examples: [["Link to a person and an organisation", "ente calendar link google:\u2026 --space Kanzlei --entity 'Anna Muster' --entity 'Muster GmbH'"]]
48682
+ });
48683
+ ref = options_exports.String({ required: true, name: "ref" });
48684
+ space = options_exports.String("--space", { required: true, description: "Space of the meeting activity" });
48685
+ entities = options_exports.Array("--entity", [], { description: "Entity name or id; repeatable" });
48686
+ title = options_exports.String("--title", { description: "Meeting title (default: the event title)" });
48687
+ async run() {
48688
+ const ref = parseEventRef(this.ref);
48689
+ if (ref.kind === "local") throw new Error("Local events link an activity directly: `ente calendar update local:\u2026 --activity <id>`.");
48690
+ const caller = await resolveCaller();
48691
+ const meeting = await meetingRequest(caller, this.space, this.entities, this.title);
48692
+ const result = await caller.action(calendarRefs.meeting, {
48693
+ provider: ref.kind,
48694
+ ...ref.kind === "google" ? { connectionId: ref.connectionId } : {},
48695
+ calendarId: ref.calendarId,
48696
+ eventId: ref.eventId,
48697
+ meeting
48698
+ });
48699
+ this.emitText(result, () => `Meeting activity ${result.meetingActivityId}${result.created ? " created" : " already existed"}`);
48700
+ }
48701
+ };
48702
+ var CALENDAR_COMMANDS = [
48703
+ CalendarConnectionsCmd,
48704
+ CalendarListCmd,
48705
+ CalendarGetCmd,
48706
+ CalendarCreateCmd,
48707
+ CalendarUpdateCmd,
48708
+ CalendarDeleteCmd,
48709
+ CalendarLinkCmd
48710
+ ];
48711
+
48133
48712
  // ente/commands/feedback.ts
48134
48713
  init_server();
48135
48714
 
@@ -50393,16 +50972,16 @@ function renderThread(thread2) {
50393
50972
  const unread = thread2.hasUnread ? ` unread:${thread2.unreadCount}` : "";
50394
50973
  return `${fmtTime2(thread2.latestAt)} [${thread2.state}]${unread} ${thread2.subject} ${thread2.threadId}`;
50395
50974
  }
50396
- function renderMessage2(message3) {
50397
- const direction = message3.direction === "inbound" ? "\u2190" : "\u2192";
50398
- const date5 = message3.receivedAt ?? message3.sentAt;
50399
- const body = message3.text ? `
50400
- ${message3.text}` : "";
50401
- const cc = message3.cc?.length ? `
50402
- CC: ${message3.cc.join(", ")}` : "";
50403
- const files = (message3.attachments ?? []).map((file2) => `
50975
+ function renderMessage2(message4) {
50976
+ const direction = message4.direction === "inbound" ? "\u2190" : "\u2192";
50977
+ const date5 = message4.receivedAt ?? message4.sentAt;
50978
+ const body = message4.text ? `
50979
+ ${message4.text}` : "";
50980
+ const cc = message4.cc?.length ? `
50981
+ CC: ${message4.cc.join(", ")}` : "";
50982
+ const files = (message4.attachments ?? []).map((file2) => `
50404
50983
  Attachment: ${JSON.stringify(file2.filename)} ${file2.mimeType} ${file2.size} bytes ${file2.attachmentId}`).join("");
50405
- return `${direction} ${fmtTime2(date5)} ${message3.from ?? "unknown"} [${message3.deliveryStatus}] ${message3.messageId}${cc}${files}${body}`;
50984
+ return `${direction} ${fmtTime2(date5)} ${message4.from ?? "unknown"} [${message4.deliveryStatus}] ${message4.messageId}${cc}${files}${body}`;
50406
50985
  }
50407
50986
  var AgentMailAddress = class extends ClientCommand {
50408
50987
  static paths = [["agent", "mail", "address"]];
@@ -50809,9 +51388,9 @@ function updateCommandArgs() {
50809
51388
  var UPDATE_SHELL_COMMAND = ["npm", ...updateCommandArgs()].join(" ");
50810
51389
  var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from Ivo's Gitea registry; installing it from npm (registry.npmjs.org) instead.";
50811
51390
  var updateRunner = {
50812
- run(command, args, json4) {
51391
+ run(command, args, json3) {
50813
51392
  return spawnSync2(command, args, {
50814
- stdio: json4 ? ["ignore", 2, 2] : "inherit",
51393
+ stdio: json3 ? ["ignore", 2, 2] : "inherit",
50815
51394
  shell: process.platform === "win32"
50816
51395
  });
50817
51396
  },
@@ -50844,13 +51423,13 @@ var updateRunner = {
50844
51423
  }
50845
51424
  }
50846
51425
  };
50847
- function installLatestFromNpm(stderr, json4, options = {}) {
51426
+ function installLatestFromNpm(stderr, json3, options = {}) {
50848
51427
  const installSource = updateRunner.installSource();
50849
51428
  if (installSource === "gitea" && options.announceMove !== false) stderr.write(`${MOVING_TO_NPM_NOTICE}
50850
51429
  `);
50851
- if (!json4) stderr.write(`Running: ${UPDATE_SHELL_COMMAND}
51430
+ if (!json3) stderr.write(`Running: ${UPDATE_SHELL_COMMAND}
50852
51431
  `);
50853
- const result = updateRunner.run("npm", updateCommandArgs(), json4);
51432
+ const result = updateRunner.run("npm", updateCommandArgs(), json3);
50854
51433
  if (result.error || result.status !== 0) {
50855
51434
  const reason = result.error ? result.error.message : `npm exited with ${result.status ?? "a signal"}`;
50856
51435
  throw new Error(`Could not update ente-cli (${reason}). Run it yourself: ${UPDATE_SHELL_COMMAND}`);
@@ -50994,6 +51573,7 @@ for (const Cmd of [
50994
51573
  ...RECORDING_PIPELINE_COMMANDS,
50995
51574
  ...AGENT_COMMANDS,
50996
51575
  ...AGENDA_COMMANDS,
51576
+ ...CALENDAR_COMMANDS,
50997
51577
  ...FEEDBACK_COMMANDS,
50998
51578
  ...GUIDE_COMMANDS,
50999
51579
  ...CANVAS_COMMANDS,