ente-cli 0.4.144 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -78,16 +78,16 @@ var require_lib = __commonJS({
78
78
  return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`;
79
79
  }
80
80
  }
81
- function plural2(n, singular, plural3) {
82
- return n === 1 ? singular : plural3;
81
+ function plural3(n, singular, plural4) {
82
+ return n === 1 ? singular : plural4;
83
83
  }
84
84
  var colorStringRegExp = /^#[0-9a-f]{6}$/i;
85
85
  var colorStringAlphaRegExp = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;
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 } = {}, message4) {
90
- errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message4}`);
89
+ function pushError({ errors, p } = {}, message3) {
90
+ errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message3}`);
91
91
  return false;
92
92
  }
93
93
  function makeSetter(target3, key) {
@@ -894,7 +894,7 @@ var require_lib = __commonJS({
894
894
  if (!check2(keys, key, value))
895
895
  problems.push(key);
896
896
  if (problems.length > 0)
897
- return pushError(state, `Missing required ${plural2(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
897
+ return pushError(state, `Missing required ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
898
898
  return true;
899
899
  }
900
900
  });
@@ -925,7 +925,7 @@ var require_lib = __commonJS({
925
925
  if (check2(keys, key, value))
926
926
  problems.push(key);
927
927
  if (problems.length > 0)
928
- return pushError(state, `Forbidden ${plural2(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
928
+ return pushError(state, `Forbidden ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
929
929
  return true;
930
930
  }
931
931
  });
@@ -978,7 +978,7 @@ var require_lib = __commonJS({
978
978
  if ((check2(keys, key, value) && !skipped.has(value[key])) !== spec.expect)
979
979
  problems.push(key);
980
980
  if (problems.length >= 1)
981
- return pushError(state, `Property "${subject}" ${spec.message} ${plural2(problems.length, `property`, `properties`)} ${getPrintableArray(problems, conjunction)}`);
981
+ return pushError(state, `Property "${subject}" ${spec.message} ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, conjunction)}`);
982
982
  return true;
983
983
  }
984
984
  });
@@ -3186,7 +3186,7 @@ var init_query_impl = __esm({
3186
3186
  const cursor2 = paginationOpts.cursor;
3187
3187
  const endCursor = paginationOpts?.endCursor ?? null;
3188
3188
  const maximumRowsRead = paginationOpts.maximumRowsRead ?? null;
3189
- const { page: page3, isDone, continueCursor, splitCursor, pageStatus } = await performAsyncSyscall("1.0/queryPage", {
3189
+ const { page: page2, isDone, continueCursor, splitCursor, pageStatus } = await performAsyncSyscall("1.0/queryPage", {
3190
3190
  query,
3191
3191
  cursor: cursor2,
3192
3192
  endCursor,
@@ -3196,7 +3196,7 @@ var init_query_impl = __esm({
3196
3196
  version
3197
3197
  });
3198
3198
  return {
3199
- page: page3.map((json3) => jsonToConvex(json3)),
3199
+ page: page2.map((json3) => jsonToConvex(json3)),
3200
3200
  isDone,
3201
3201
  continueCursor,
3202
3202
  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(message4) {
5246
- super(message4);
5245
+ constructor(message3) {
5246
+ super(message3);
5247
5247
  this.clipanion = { type: `usage` };
5248
5248
  this.name = `UsageError`;
5249
5249
  }
@@ -5323,8 +5323,8 @@ function rerouteArguments(a, b) {
5323
5323
  return [a, b];
5324
5324
  }
5325
5325
  }
5326
- function cleanValidationError(message4, { mergeName = false } = {}) {
5327
- const match = message4.match(/^([^:]+): (.*)$/m);
5326
+ function cleanValidationError(message3, { mergeName = false } = {}) {
5327
+ const match = message3.match(/^([^:]+): (.*)$/m);
5328
5328
  if (!match)
5329
5329
  return `validation failed`;
5330
5330
  let [, path12, line] = match;
@@ -5333,11 +5333,11 @@ function cleanValidationError(message4, { mergeName = false } = {}) {
5333
5333
  line = path12 !== `.` || !mergeName ? `${path12.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
5334
5334
  return line;
5335
5335
  }
5336
- function formatError(message4, errors) {
5336
+ function formatError(message3, errors) {
5337
5337
  if (errors.length === 1) {
5338
- return new UsageError(`${message4}${cleanValidationError(errors[0], { mergeName: true })}`);
5338
+ return new UsageError(`${message3}${cleanValidationError(errors[0], { mergeName: true })}`);
5339
5339
  } else {
5340
- return new UsageError(`${message4}:
5340
+ return new UsageError(`${message3}:
5341
5341
  ${errors.map((error62) => `
5342
5342
  - ${cleanValidationError(error62)}`).join(``)}`);
5343
5343
  }
@@ -6841,10 +6841,10 @@ function Rest(opts = {}) {
6841
6841
  return true;
6842
6842
  return false;
6843
6843
  };
6844
- let count = 0;
6845
- while (count < state.positionals.length && isRestPositional(count))
6846
- count += 1;
6847
- return state.positionals.splice(0, count).map(({ value }) => value);
6844
+ let count2 = 0;
6845
+ while (count2 < state.positionals.length && isRestPositional(count2))
6846
+ count2 += 1;
6847
+ return state.positionals.splice(0, count2).map(({ value }) => value);
6848
6848
  }
6849
6849
  });
6850
6850
  }
@@ -9269,8 +9269,8 @@ function prefixIssues(path12, issues) {
9269
9269
  return iss;
9270
9270
  });
9271
9271
  }
9272
- function unwrapMessage(message4) {
9273
- return typeof message4 === "string" ? message4 : message4?.message;
9272
+ function unwrapMessage(message3) {
9273
+ return typeof message3 === "string" ? message3 : message3?.message;
9274
9274
  }
9275
9275
  function sizeCaps(defChecks) {
9276
9276
  const caps = [];
@@ -9300,7 +9300,7 @@ function finalizeIssue(iss, ctx, config2) {
9300
9300
  iss.schema = iss.inst;
9301
9301
  }
9302
9302
  const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
9303
- 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";
9303
+ 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";
9304
9304
  const full = {};
9305
9305
  for (const k of Object.keys(iss)) {
9306
9306
  if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
@@ -9308,7 +9308,7 @@ function finalizeIssue(iss, ctx, config2) {
9308
9308
  full[k] = iss[k];
9309
9309
  }
9310
9310
  full.path ?? (full.path = []);
9311
- full.message = message4;
9311
+ full.message = message3;
9312
9312
  if (ctx?.reportInput) {
9313
9313
  full.input = iss.input;
9314
9314
  }
@@ -9328,14 +9328,14 @@ function codePointLength(str) {
9328
9328
  const units = str.length;
9329
9329
  if (!highSurrogate.test(str))
9330
9330
  return units;
9331
- let count = units;
9331
+ let count2 = units;
9332
9332
  for (let i = 0; i < units - 1; i++) {
9333
9333
  if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
9334
- count--;
9334
+ count2--;
9335
9335
  i++;
9336
9336
  }
9337
9337
  }
9338
- return count;
9338
+ return count2;
9339
9339
  }
9340
9340
  function getLengthableOrigin(input2) {
9341
9341
  if (Array.isArray(input2))
@@ -13718,8 +13718,8 @@ function az_default() {
13718
13718
  }
13719
13719
 
13720
13720
  // ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.js
13721
- function getBelarusianPlural(count, one, few, many) {
13722
- const absCount = Math.abs(count);
13721
+ function getBelarusianPlural(count2, one, few, many) {
13722
+ const absCount = Math.abs(count2);
13723
13723
  const lastDigit = absCount % 10;
13724
13724
  const lastTwoDigits = absCount % 100;
13725
13725
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -16366,8 +16366,8 @@ function hu_default() {
16366
16366
  }
16367
16367
 
16368
16368
  // ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.js
16369
- function getArmenianPlural(count, one, many) {
16370
- return Math.abs(count) === 1 ? one : many;
16369
+ function getArmenianPlural(count2, one, many) {
16370
+ return Math.abs(count2) === 1 ? one : many;
16371
16371
  }
16372
16372
  function withDefiniteArticle(word) {
16373
16373
  if (!word)
@@ -18812,8 +18812,8 @@ var error43 = () => {
18812
18812
  case "not_multiple_of":
18813
18813
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
18814
18814
  case "unrecognized_keys": {
18815
- const plural2 = issue2.keys.length > 1 ? "s" : "";
18816
- return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
18815
+ const plural3 = issue2.keys.length > 1 ? "s" : "";
18816
+ return `Chave${plural3} inv\xE1lida${plural3}: ${joinValues(issue2.keys, ", ")}`;
18817
18817
  }
18818
18818
  case "invalid_key":
18819
18819
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -18957,8 +18957,8 @@ var error44 = () => {
18957
18957
  case "not_multiple_of":
18958
18958
  return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
18959
18959
  case "unrecognized_keys": {
18960
- const plural2 = issue2.keys.length > 1 ? "s" : "";
18961
- return `Chave${plural2} inv\xE1lida${plural2}: ${joinValues(issue2.keys, ", ")}`;
18960
+ const plural3 = issue2.keys.length > 1 ? "s" : "";
18961
+ return `Chave${plural3} inv\xE1lida${plural3}: ${joinValues(issue2.keys, ", ")}`;
18962
18962
  }
18963
18963
  case "invalid_key":
18964
18964
  return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
@@ -19105,8 +19105,8 @@ function ro_default() {
19105
19105
  }
19106
19106
 
19107
19107
  // ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.js
19108
- function getRussianPlural(count, one, few, many) {
19109
- const absCount = Math.abs(count);
19108
+ function getRussianPlural(count2, one, few, many) {
19109
+ const absCount = Math.abs(count2);
19110
19110
  const lastDigit = absCount % 10;
19111
19111
  const lastTwoDigits = absCount % 100;
19112
19112
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -21047,8 +21047,8 @@ var globalRegistry = globalThis.__zod_globalRegistry;
21047
21047
  var INVALID = Symbol.for("zod.compile.invalid");
21048
21048
  var FALLBACK_FLAG = Symbol.for("zod.compile.fallback");
21049
21049
  var ZodCompileAsyncError = class extends Error {
21050
- constructor(message4 = "z.compile does not support async refinements, transforms, or checks") {
21051
- super(message4);
21050
+ constructor(message3 = "z.compile does not support async refinements, transforms, or checks") {
21051
+ super(message3);
21052
21052
  this.name = "ZodCompileAsyncError";
21053
21053
  }
21054
21054
  };
@@ -23748,12 +23748,12 @@ function initializeContext(params) {
23748
23748
  external: params?.external ?? void 0
23749
23749
  };
23750
23750
  }
23751
- function handleUnrepresentable(schema, ctx, json3, params, message4) {
23752
- const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message4 }) : ctx.unrepresentable;
23751
+ function handleUnrepresentable(schema, ctx, json3, params, message3) {
23752
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message3 }) : ctx.unrepresentable;
23753
23753
  if (result === "any")
23754
23754
  return false;
23755
23755
  if (result === void 0 || result === "throw")
23756
- throw new Error(message4);
23756
+ throw new Error(message3);
23757
23757
  Object.assign(json3, result);
23758
23758
  return true;
23759
23759
  }
@@ -28148,8 +28148,8 @@ var ValidationError = class extends Error {
28148
28148
  got;
28149
28149
  path;
28150
28150
  constructor(expected, got, path12) {
28151
- const message4 = `Validator error${path12 ? ` for ${path12}` : ""}: Expected \`${expected}\`, got \`${got}\``;
28152
- super(message4);
28151
+ const message3 = `Validator error${path12 ? ` for ${path12}` : ""}: Expected \`${expected}\`, got \`${got}\``;
28152
+ super(message3);
28153
28153
  this.expected = expected;
28154
28154
  this.got = got;
28155
28155
  this.path = path12;
@@ -28476,8 +28476,8 @@ function validateOperationResult(validator, raw) {
28476
28476
  return isJsonOperationValue(raw, /* @__PURE__ */ new Set()) && matchesResultShape(validator, raw);
28477
28477
  }
28478
28478
  var OperationResultError = class extends Error {
28479
- constructor(operation, message4 = `Invalid result for ${operation}`) {
28480
- super(message4);
28479
+ constructor(operation, message3 = `Invalid result for ${operation}`) {
28480
+ super(message3);
28481
28481
  this.operation = operation;
28482
28482
  this.name = "OperationResultError";
28483
28483
  }
@@ -28486,14 +28486,14 @@ var OperationResultError = class extends Error {
28486
28486
  return { code: this.code, operation: this.operation, message: this.message };
28487
28487
  }
28488
28488
  };
28489
- function parseOperationResult(operation, validator, raw, message4) {
28489
+ function parseOperationResult(operation, validator, raw, message3) {
28490
28490
  const candidate = forResult(validator, raw, describeConvex);
28491
- if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message4);
28491
+ if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message3);
28492
28492
  return candidate;
28493
28493
  }
28494
- function parseZodOperationResult(operation, schema, raw, message4) {
28494
+ function parseZodOperationResult(operation, schema, raw, message3) {
28495
28495
  const parsed = schema.safeParse(forResult(schema, raw, describeZod));
28496
- if (!parsed.success) throw new OperationResultError(operation, message4);
28496
+ if (!parsed.success) throw new OperationResultError(operation, message3);
28497
28497
  return parsed.data;
28498
28498
  }
28499
28499
 
@@ -28532,6 +28532,16 @@ function parseActivityReadRequest(operation, raw) {
28532
28532
  }
28533
28533
  }
28534
28534
 
28535
+ // ../packages/shared/src/entity-types.ts
28536
+ var ENTITY_TYPE_VALUES = [
28537
+ "person",
28538
+ "org",
28539
+ "project",
28540
+ "topic",
28541
+ "place",
28542
+ "object"
28543
+ ];
28544
+
28535
28545
  // ../packages/shared/src/entity-read-limits.ts
28536
28546
  var ENTITY_READ_LIMITS = {
28537
28547
  searchDefault: 5,
@@ -28546,7 +28556,10 @@ var ENTITY_READ_LIMITS = {
28546
28556
  activityContentCharacters: 1500,
28547
28557
  activityCountMaximum: 500,
28548
28558
  searchOpenTasksMaximum: 10,
28549
- listTaskEnrichmentEntities: 50
28559
+ listTaskEnrichmentEntities: 50,
28560
+ // One list page. Larger accepted limits return this many entities plus nextCursor.
28561
+ listPageMaximum: 100,
28562
+ listCursorCharacters: 1024
28550
28563
  };
28551
28564
 
28552
28565
  // ../packages/shared/src/entity-read-operations.ts
@@ -28562,7 +28575,15 @@ var entityReadInputs = {
28562
28575
  limit: external_exports.number().int().min(1).max(ENTITY_READ_LIMITS.activityMaximum).default(ENTITY_READ_LIMITS.activityDefault),
28563
28576
  projection: projection2
28564
28577
  }),
28565
- listEntities: external_exports.strictObject({ field: external_exports.strictObject({ label: fieldLabelSchema, value: external_exports.string().min(1).refine((value) => new TextEncoder().encode(value).length <= MAX_FIELD_VALUE_BYTES) }).optional(), spaceId: id3.optional(), limit: limit2.default(ENTITY_READ_LIMITS.listDefault), archived: external_exports.boolean().default(false), projection: projection2 })
28578
+ listEntities: external_exports.strictObject({
28579
+ field: external_exports.strictObject({ label: fieldLabelSchema, value: external_exports.string().min(1).refine((value) => new TextEncoder().encode(value).length <= MAX_FIELD_VALUE_BYTES) }).optional(),
28580
+ spaceId: id3.optional(),
28581
+ type: external_exports.enum(ENTITY_TYPE_VALUES).optional(),
28582
+ cursor: external_exports.string().min(1).max(ENTITY_READ_LIMITS.listCursorCharacters).refine((value) => value.trim() === value, "Copy cursor unchanged").optional(),
28583
+ limit: limit2.default(ENTITY_READ_LIMITS.listDefault),
28584
+ archived: external_exports.boolean().default(false),
28585
+ projection: projection2
28586
+ }).refine((input2) => input2.field === void 0 || input2.cursor === void 0, { path: ["cursor"], message: "Field lookups return one bounded page; remove cursor" })
28566
28587
  };
28567
28588
  function parseEntityReadRequest(operation, raw) {
28568
28589
  switch (operation) {
@@ -28579,11 +28600,11 @@ function parseEntityReadRequest(operation, raw) {
28579
28600
  var ApiError = class extends Error {
28580
28601
  statusCode;
28581
28602
  error;
28582
- constructor(statusCode, message4, error62) {
28583
- super(`HTTP ${statusCode}: ${message4}`);
28603
+ constructor(statusCode, message3, error62) {
28604
+ super(`HTTP ${statusCode}: ${message3}`);
28584
28605
  this.name = "ApiError";
28585
28606
  this.statusCode = statusCode;
28586
- this.detail = message4;
28607
+ this.detail = message3;
28587
28608
  this.error = error62 ?? {};
28588
28609
  }
28589
28610
  /** The backend's human message, without the `HTTP <code>:` prefix. */
@@ -28600,8 +28621,8 @@ var ExitWithCode = class extends Error {
28600
28621
  var UPGRADE_REQUIRED_EXIT_CODE = 3;
28601
28622
  var UpgradeRequiredError = class extends Error {
28602
28623
  data;
28603
- constructor(message4, data = {}) {
28604
- super(message4);
28624
+ constructor(message3, data = {}) {
28625
+ super(message3);
28605
28626
  this.name = "UpgradeRequiredError";
28606
28627
  this.data = data;
28607
28628
  }
@@ -28616,8 +28637,8 @@ async function upgradeRequiredFromResponse(resp, path12) {
28616
28637
  if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
28617
28638
  } catch {
28618
28639
  }
28619
- const message4 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path12} (426 Upgrade Required). Install the latest version.`;
28620
- return new UpgradeRequiredError(message4, data);
28640
+ const message3 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path12} (426 Upgrade Required). Install the latest version.`;
28641
+ return new UpgradeRequiredError(message3, data);
28621
28642
  }
28622
28643
 
28623
28644
  // core/output.ts
@@ -28636,9 +28657,9 @@ function errorMessage(err) {
28636
28657
  const data = err.data;
28637
28658
  if (typeof data === "string" && data.length > 0) return data;
28638
28659
  if (data && typeof data === "object") {
28639
- const { message: message4, code: code3 } = data;
28640
- if (typeof message4 === "string" && message4.length > 0) {
28641
- return typeof code3 === "string" ? `${message4} (${code3})` : message4;
28660
+ const { message: message3, code: code3 } = data;
28661
+ if (typeof message3 === "string" && message3.length > 0) {
28662
+ return typeof code3 === "string" ? `${message3} (${code3})` : message3;
28642
28663
  }
28643
28664
  return `${err.message}: ${JSON.stringify(data)}`;
28644
28665
  }
@@ -28655,10 +28676,15 @@ function renderTable(rows, headers) {
28655
28676
  }
28656
28677
 
28657
28678
  // core/errorOutput.ts
28658
- function writeCommandError(stdout, stderr, json3, error62) {
28659
- const message4 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
28679
+ var explainError = (error62) => error62;
28680
+ function setErrorExplainer(explain) {
28681
+ explainError = explain;
28682
+ }
28683
+ function writeCommandError(stdout, stderr, json3, raw) {
28684
+ const error62 = explainError(raw);
28685
+ const message3 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
28660
28686
  if (!json3) {
28661
- stderr.write(`Error: ${message4}
28687
+ stderr.write(`Error: ${message3}
28662
28688
  `);
28663
28689
  return;
28664
28690
  }
@@ -28666,7 +28692,7 @@ function writeCommandError(stdout, stderr, json3, error62) {
28666
28692
  const details = data && typeof data === "object" && !Array.isArray(data) ? withoutAgentFingerprint(data) : {};
28667
28693
  stdout.write(`${JSON.stringify({ error: {
28668
28694
  ...details,
28669
- message: message4,
28695
+ message: message3,
28670
28696
  ...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
28671
28697
  } }, null, 2)}
28672
28698
  `);
@@ -28751,7 +28777,7 @@ function parseOperationFieldPairs(operation, pairs) {
28751
28777
  }
28752
28778
 
28753
28779
  // ente/version.ts
28754
- var VERSION = "0.4.144";
28780
+ var VERSION = "0.5.0";
28755
28781
 
28756
28782
  // ente/branding.ts
28757
28783
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -28780,7 +28806,7 @@ var PLATFORM_CREDENTIAL = {
28780
28806
  };
28781
28807
 
28782
28808
  // ../packages/shared/src/cli-compatibility.ts
28783
- var CLI_COMPATIBILITY_LEVEL = 2;
28809
+ var CLI_COMPATIBILITY_LEVEL = 4;
28784
28810
  var CLI_VERSION_HEADER = "X-Ente-CLI-Version";
28785
28811
  var CLI_COMPATIBILITY_HEADER = "X-Ente-CLI-Compatibility";
28786
28812
  function cliCompatibilityHeaders(version5) {
@@ -28832,8 +28858,8 @@ function optionalBoolean(value) {
28832
28858
  function isActivityType(value) {
28833
28859
  return typeof value === "string" && ACTIVITY_TYPE_VALUES.some((type) => type === value);
28834
28860
  }
28835
- var invalid = (message4) => ({ ok: false, message: message4 });
28836
- function parseActivityCreateInput(args, name4 = "activities_create") {
28861
+ var invalid = (message3) => ({ ok: false, message: message3 });
28862
+ function parseActivityCreateInput(args, name4 = "createActivity") {
28837
28863
  if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
28838
28864
  if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
28839
28865
  if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
@@ -28865,7 +28891,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
28865
28891
  autoLinkPersonalSpace: optionalBoolean(args.autoLinkPersonalSpace)
28866
28892
  } };
28867
28893
  }
28868
- function parseActivityUpdateInput(args, name4 = "activities_update") {
28894
+ function parseActivityUpdateInput(args, name4 = "updateActivity") {
28869
28895
  if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
28870
28896
  if (typeof args.activityId !== "string") return invalid(`${name4} requires string activityId`);
28871
28897
  if ("deadline" in args && !isNullableDeadlineInput(args.deadline))
@@ -28928,7 +28954,6 @@ var activityWriteInputs = {
28928
28954
  restoreActivity: external_exports.strictObject({ activityId: id4 }),
28929
28955
  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) })
28930
28956
  };
28931
- var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
28932
28957
  function isActivityWriteOperationName(name4) {
28933
28958
  return Object.hasOwn(activityWriteInputs, name4);
28934
28959
  }
@@ -29018,11 +29043,6 @@ function projectActivityWriteResult(operation, raw) {
29018
29043
  }
29019
29044
  }
29020
29045
 
29021
- // ../packages/shared/src/operation-contract.ts
29022
- function operationAliases(mapping, name4, profile = "full") {
29023
- return Object.entries(mapping).filter(([, target3]) => target3 === name4).map(([alias]) => ({ name: alias, profile }));
29024
- }
29025
-
29026
29046
  // ../packages/shared/src/operation-schema.ts
29027
29047
  var operationErrorSchema = {
29028
29048
  type: "object",
@@ -29095,6 +29115,7 @@ function operationResultSchema(validator) {
29095
29115
 
29096
29116
  // ../packages/shared/src/activity-write-catalog.ts
29097
29117
  var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "toggleActivityCompleted", "batchUpdateTasks"]);
29118
+ var externalActivityWrites = /* @__PURE__ */ new Set(["createActivity", "updateActivity", "updateActivityAssignees", "addActivityMessage", "deleteActivityMessage", "deleteActivity", "restoreActivity"]);
29098
29119
  var descriptions = {
29099
29120
  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. A string list replaces a list field in submitted order (text, url, email, phone, address, multi-select). JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
29100
29121
  updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, a string list replaces a list field in submitted order (text, url, email, phone, postal-address, salutation, job-title, multi-select); give type when a new label holds a list, 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.",
@@ -29127,9 +29148,10 @@ function definition(name4) {
29127
29148
  { type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
29128
29149
  ] }] : void 0;
29129
29150
  const resultSchema3 = external_exports.toJSONSchema(activityWriteResults[name4]);
29151
+ const external = externalActivityWrites.has(name4);
29130
29152
  return {
29131
29153
  name: name4,
29132
- aliases: operationAliases(activityWriteAliases, name4),
29154
+ aliases: [],
29133
29155
  actor: "agent",
29134
29156
  description: descriptions[name4],
29135
29157
  inputSchema: { ...schema, type: "object", properties, additionalProperties: false, ...conditions ? { allOf: conditions } : {} },
@@ -29140,7 +29162,7 @@ function definition(name4) {
29140
29162
  environment: "content",
29141
29163
  executionProfile: "full",
29142
29164
  resultProjection: "commit-receipt",
29143
- 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" },
29165
+ availability: { hosted: true, external, browserHuman: false, agentConnection: external, executionProfiles: ["full", "public-cli"], runtime: composite.has(name4) ? "action" : "mutation" },
29144
29166
  limits: ACTIVITY_WRITE_LIMITS,
29145
29167
  profiles: {
29146
29168
  rest: { available: ["createActivity", "updateActivity", "updateActivityAssignees", "deleteActivity", "restoreActivity"].includes(name4), result: "commit-receipt" },
@@ -29148,7 +29170,6 @@ function definition(name4) {
29148
29170
  publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedFields: name4 === "updateActivity" },
29149
29171
  realtime: { primary: false, available: name4 === "createActivity", source: "verified-session-createTask", speechAndLeaseRequired: true, finishAndResultValidation: "same-transaction" }
29150
29172
  },
29151
- compatibilityAliases: Object.entries(activityWriteAliases).filter(([, operation]) => operation === name4).map(([alias]) => alias),
29152
29173
  resourcePolicy: { selector: name4 === "createActivity" ? "explicit-activity-space" : name4 === "batchUpdateTasks" ? "ordered-activity-ids" : "actual-activity-space", creation: "explicit-space-and-headless-owners", existing: "actual-activity-space", runBounds: "intersect-live-write-scope", humanGrants: "required-outside-accepted-owner-Personal-exception", resultValidation: "before-each-commit" }
29153
29174
  };
29154
29175
  }
@@ -29171,7 +29192,7 @@ var assignee = external_exports.enum(["all", "me", "meOrUnassigned", "unassigned
29171
29192
  var entityFilter = external_exports.strictObject({ coverage: external_exports.enum(["all", "tagged", "untagged"]).optional(), type: external_exports.enum(["person", "org", "project", "topic", "place", "object", "any"]).optional(), tags: tags.optional(), noParent: external_exports.boolean().optional() });
29172
29193
  var feedFilter = external_exports.strictObject({ activityType: external_exports.enum([...ACTIVITY_TYPE_VALUES, "all"]).optional(), deadlineFilter: text.optional(), sortOrder: external_exports.enum(["created-desc", "deadline-asc", "latest-desc", "latest-message-desc"]).optional(), assigneeFilter: assignee.optional(), assigneeUserId: id6.optional(), assigneeUserIds: external_exports.array(id6).max(100).optional(), entityIds: external_exports.array(id6).max(100).optional(), tags: tags.optional(), attributeFilters: external_exports.array(external_exports.strictObject({ key: text, value: text })).max(100).optional() });
29173
29194
  var activityFilter = feedFilter.omit({ assigneeUserId: true }).extend({ deadlineFilter: external_exports.enum(["due-now", "today", "this-week", "this-month", "all", "not-scheduled"]).optional(), taskStatus: external_exports.enum(["open", "completed", "all"]).optional(), search: text.optional() });
29174
- var tabs = (filters, entity5 = false) => external_exports.strictObject({ activeId: id6, tabs: external_exports.array(external_exports.strictObject({ id: id6, name: external_exports.string().max(80).optional(), filters, ...entity5 ? { view: external_exports.enum(["list", "tree"]).optional() } : {} })).min(1).max(30) }).refine((v3) => new Set(v3.tabs.map((t) => t.id)).size === v3.tabs.length && v3.tabs.some((t) => t.id === v3.activeId), "Invalid tab selection");
29195
+ var tabs = (filters, entity3 = false) => external_exports.strictObject({ activeId: id6, tabs: external_exports.array(external_exports.strictObject({ id: id6, name: external_exports.string().max(80).optional(), filters, ...entity3 ? { view: external_exports.enum(["list", "tree"]).optional() } : {} })).min(1).max(30) }).refine((v3) => new Set(v3.tabs.map((t) => t.id)).size === v3.tabs.length && v3.tabs.some((t) => t.id === v3.activeId), "Invalid tab selection");
29175
29196
  function setting(schema, defaultValue, description, examples, scope = "user", content = false) {
29176
29197
  return { schema, default: defaultValue, description, examples, scope, adminSettable: true, content };
29177
29198
  }
@@ -29237,14 +29258,6 @@ var workspaceResults = {
29237
29258
  ),
29238
29259
  removeSpaceMember: v2.union(v2.object({ kind: v2.literal("removed") }), v2.object({ kind: v2.literal("not-member") }))
29239
29260
  };
29240
- var workspaceAliases = {
29241
- spaces_list: "listSpaces",
29242
- space_members_list: "listSpaceMembers",
29243
- spaces_create: "createSpace",
29244
- spaces_rename: "updateSpace",
29245
- space_members_add: "addSpaceMember",
29246
- space_members_remove: "removeSpaceMember"
29247
- };
29248
29261
  function isWorkspaceOperationName(name4) {
29249
29262
  return Object.hasOwn(workspaceInputs, name4);
29250
29263
  }
@@ -29264,19 +29277,15 @@ function parseWorkspaceRequest(operation, raw) {
29264
29277
  return { operation, input: parseOperationInput(operation, workspaceInputs.removeSpaceMember, raw) };
29265
29278
  }
29266
29279
  }
29267
- var legacySpace = external_exports.object({ _id: id7, _creationTime: external_exports.number(), name: external_exports.string(), color: external_exports.string() }).catchall(external_exports.json().optional());
29268
- var legacyWorkspaceWireResults = {
29269
- listSpaces: external_exports.array(legacySpace.extend({ role: external_exports.enum(["owner", "admin", "member"]), memberEmails: external_exports.array(external_exports.string()) })),
29270
- updateSpace: legacySpace
29271
- };
29280
+ var spaceDocument = external_exports.object({ _id: id7, _creationTime: external_exports.number(), name: external_exports.string(), color: external_exports.string() }).catchall(external_exports.json().optional());
29272
29281
  var workspacePublicCliResults = {
29273
29282
  createSpaceSource: external_exports.strictObject({ createdSpaceId: id7, createdMembershipId: id7 }),
29274
29283
  listSpaces: external_exports.array(external_exports.strictObject({ _id: id7, name: external_exports.string().optional(), role: external_exports.enum(["owner", "admin", "member"]).optional(), memberEmails: external_exports.array(external_exports.string()).optional() })),
29275
- updateSpace: legacyWorkspaceWireResults.updateSpace,
29284
+ updateSpace: spaceDocument,
29276
29285
  listSpaceMembers: external_exports.array(external_exports.strictObject({ userId: id7.optional(), name: external_exports.string().optional(), email: external_exports.string().optional() }))
29277
29286
  };
29278
29287
  var descriptions2 = {
29279
- listSpaces: "List currently accessible active spaces. Native results contain spaceId, name, optional scope and isPersonal. The installed external profile retains full space documents with role and memberEmails.",
29288
+ listSpaces: "List currently accessible active spaces with spaceId, name, optional scope and isPersonal.",
29280
29289
  listSpaceMembers: "List visible coworker identities in a space. Unavailable to Personal-only agent connections.",
29281
29290
  createSpace: "Create a space without changing the active space. Requires spaces:manage and the existing inheriting Personal-agent authority. Color defaults to kale.",
29282
29291
  updateSpace: "Update name, color or scope with spaces:manage and current owner/admin authority.",
@@ -29288,7 +29297,7 @@ var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationN
29288
29297
  const resultSchema3 = operationResultSchema(workspaceResults[name4]);
29289
29298
  return {
29290
29299
  name: name4,
29291
- aliases: operationAliases(workspaceAliases, name4),
29300
+ aliases: [],
29292
29301
  actor: "agent",
29293
29302
  description: descriptions2[name4],
29294
29303
  inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false, ...name4 === "updateSpace" ? { anyOf: ["name", "color", "scope"].map((field) => ({ required: [field] })) } : {} },
@@ -29300,7 +29309,7 @@ var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationN
29300
29309
  executionProfile: "full",
29301
29310
  environment: "workspace",
29302
29311
  resultProjection: name4 === "listSpaces" ? "compact-space" : name4 === "updateSpace" ? "space-summary" : "full",
29303
- compatibilityProjections: name4 === "listSpaces" ? { "legacy-external": "full-space-document-with-role-and-member-emails", "public-cli": "membership-and-space-documents" } : name4 === "updateSpace" ? { "legacy-external": "full-space-document", "public-cli": "full-space-document" } : name4 === "listSpaceMembers" ? { "public-cli": "membership-and-visible-user-documents" } : name4 === "createSpace" ? { "public-cli": "created-space-and-membership-ids" } : {},
29312
+ compatibilityProjections: name4 === "listSpaces" ? { "public-cli": "membership-and-space-documents" } : name4 === "updateSpace" ? { "public-cli": "full-space-document" } : name4 === "listSpaceMembers" ? { "public-cli": "membership-and-visible-user-documents" } : name4 === "createSpace" ? { "public-cli": "created-space-and-membership-ids" } : {},
29304
29313
  availability: { hosted: name4 === "listSpaces" || name4 === "listSpaceMembers", external: true, browserHuman: false, agentConnection: name4 !== "listSpaceMembers", executionProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? ["full"] : ["full", "public-cli"] },
29305
29314
  compatibilityProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? {} : {
29306
29315
  "public-cli": { primary: false, transport: "public-jwt", memberListing: "verified-current-credential; unavailable-emails-omitted", footerMemberLimit: WORKSPACE_FOOTER_MEMBER_LIMIT, resultSchema: name4 === "createSpace" ? resultSchema3 : external_exports.toJSONSchema(workspacePublicCliResults[name4]) }
@@ -29978,11 +29987,11 @@ function mapPayloads(operation, raw, transform2) {
29978
29987
  if (operation !== "agent_thread_get") return raw;
29979
29988
  if (!matchesResultShape(operatorThreadDetailValidator, raw)) throw new OperationResultError(operation);
29980
29989
  if (!raw) return null;
29981
- return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message4) => ({
29982
- ...message4,
29983
- ...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
29984
- ...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
29985
- ...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
29990
+ return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message3) => ({
29991
+ ...message3,
29992
+ ...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
29993
+ ...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
29994
+ ...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
29986
29995
  })) } };
29987
29996
  }
29988
29997
  function checkPageBounds(operation, data) {
@@ -30411,10 +30420,9 @@ function parseNotificationRequest(raw) {
30411
30420
  }
30412
30421
  var inputSchema = { type: "object", properties: notificationEmailInputProperties, required: ["subject", "text"], additionalProperties: false };
30413
30422
  var resultSchema = operationResultSchema(notificationEmailResultValidator);
30414
- var notificationAliases = { notifications_email_send: "sendNotificationEmail" };
30415
30423
  var notificationDefinition = {
30416
30424
  name: "sendNotificationEmail",
30417
- aliases: [...operationAliases(notificationAliases, "sendNotificationEmail"), { name: "ente_notification_email_send", profile: "mounted-view" }],
30425
+ aliases: [{ name: "ente_notification_email_send", profile: "mounted-view" }],
30418
30426
  actor: "agent",
30419
30427
  title: "Email the current Ente user",
30420
30428
  description: "Send a notification email from Ente to the verified account email. The recipient cannot be overridden. Include a plain-text fallback and optionally HTML and bounded file attachments. Inline Content-ID attachments must be PNG, JPEG, GIF, or WebP images. The result records transport acceptance, not inbox delivery. There is no caller idempotency key: do not automatically retry an uncertain send.",
@@ -30574,10 +30582,9 @@ function parseSpaceChangeOperationResult(command, raw) {
30574
30582
  return parseZodOperationResult("spaceChange", spaceChangeResults[command], raw);
30575
30583
  }
30576
30584
  var resultSchema2 = { anyOf: Object.values(spaceChangeResults).map((schema) => external_exports.toJSONSchema(schema)) };
30577
- var spaceChangeAliases = { space_changes: "spaceChange", spaceChanges: "spaceChange" };
30578
30585
  var spaceChangeDefinition = {
30579
30586
  name: "spaceChange",
30580
- aliases: [...operationAliases(spaceChangeAliases, "spaceChange"), { name: "ente_space_change", profile: "mounted-view" }],
30587
+ aliases: [{ name: "ente_space_change", profile: "mounted-view" }],
30581
30588
  actor: "agent",
30582
30589
  title: "Review and apply space changes",
30583
30590
  description: SPACE_CHANGE_DESCRIPTION,
@@ -30621,16 +30628,6 @@ var spaceChangeBrowserSpec = {
30621
30628
  }
30622
30629
  };
30623
30630
 
30624
- // ../packages/shared/src/entity-types.ts
30625
- var ENTITY_TYPE_VALUES = [
30626
- "person",
30627
- "org",
30628
- "project",
30629
- "topic",
30630
- "place",
30631
- "object"
30632
- ];
30633
-
30634
30631
  // ../node_modules/.pnpm/pako@3.0.3/node_modules/pako/dist/pako.mjs
30635
30632
  var Z_FIXED$1 = 4;
30636
30633
  var Z_BINARY = 0;
@@ -30981,7 +30978,7 @@ var scan_tree = (s, tree, max_code) => {
30981
30978
  let prevlen = -1;
30982
30979
  let curlen;
30983
30980
  let nextlen = tree[1];
30984
- let count = 0;
30981
+ let count2 = 0;
30985
30982
  let max_count = 7;
30986
30983
  let min_count = 4;
30987
30984
  if (nextlen === 0) {
@@ -30992,14 +30989,14 @@ var scan_tree = (s, tree, max_code) => {
30992
30989
  for (n = 0; n <= max_code; n++) {
30993
30990
  curlen = nextlen;
30994
30991
  nextlen = tree[(n + 1) * 2 + 1];
30995
- if (++count < max_count && curlen === nextlen) continue;
30996
- else if (count < min_count) s.bl_tree[curlen * 2] += count;
30992
+ if (++count2 < max_count && curlen === nextlen) continue;
30993
+ else if (count2 < min_count) s.bl_tree[curlen * 2] += count2;
30997
30994
  else if (curlen !== 0) {
30998
30995
  if (curlen !== prevlen) s.bl_tree[curlen * 2]++;
30999
30996
  s.bl_tree[REP_3_6 * 2]++;
31000
- } else if (count <= 10) s.bl_tree[REPZ_3_10 * 2]++;
30997
+ } else if (count2 <= 10) s.bl_tree[REPZ_3_10 * 2]++;
31001
30998
  else s.bl_tree[REPZ_11_138 * 2]++;
31002
- count = 0;
30999
+ count2 = 0;
31003
31000
  prevlen = curlen;
31004
31001
  if (nextlen === 0) {
31005
31002
  max_count = 138;
@@ -31018,7 +31015,7 @@ var send_tree = (s, tree, max_code) => {
31018
31015
  let prevlen = -1;
31019
31016
  let curlen;
31020
31017
  let nextlen = tree[1];
31021
- let count = 0;
31018
+ let count2 = 0;
31022
31019
  let max_count = 7;
31023
31020
  let min_count = 4;
31024
31021
  if (nextlen === 0) {
@@ -31028,25 +31025,25 @@ var send_tree = (s, tree, max_code) => {
31028
31025
  for (n = 0; n <= max_code; n++) {
31029
31026
  curlen = nextlen;
31030
31027
  nextlen = tree[(n + 1) * 2 + 1];
31031
- if (++count < max_count && curlen === nextlen) continue;
31032
- else if (count < min_count) do
31028
+ if (++count2 < max_count && curlen === nextlen) continue;
31029
+ else if (count2 < min_count) do
31033
31030
  send_code(s, curlen, s.bl_tree);
31034
- while (--count !== 0);
31031
+ while (--count2 !== 0);
31035
31032
  else if (curlen !== 0) {
31036
31033
  if (curlen !== prevlen) {
31037
31034
  send_code(s, curlen, s.bl_tree);
31038
- count--;
31035
+ count2--;
31039
31036
  }
31040
31037
  send_code(s, REP_3_6, s.bl_tree);
31041
- send_bits(s, count - 3, 2);
31042
- } else if (count <= 10) {
31038
+ send_bits(s, count2 - 3, 2);
31039
+ } else if (count2 <= 10) {
31043
31040
  send_code(s, REPZ_3_10, s.bl_tree);
31044
- send_bits(s, count - 3, 3);
31041
+ send_bits(s, count2 - 3, 3);
31045
31042
  } else {
31046
31043
  send_code(s, REPZ_11_138, s.bl_tree);
31047
- send_bits(s, count - 11, 7);
31044
+ send_bits(s, count2 - 11, 7);
31048
31045
  }
31049
- count = 0;
31046
+ count2 = 0;
31050
31047
  prevlen = curlen;
31051
31048
  if (nextlen === 0) {
31052
31049
  max_count = 138;
@@ -31916,14 +31913,14 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
31916
31913
  let next;
31917
31914
  let base = null;
31918
31915
  let match;
31919
- const count = /* @__PURE__ */ new Uint16Array(16);
31916
+ const count2 = /* @__PURE__ */ new Uint16Array(16);
31920
31917
  const offs = /* @__PURE__ */ new Uint16Array(16);
31921
31918
  let extra = null;
31922
31919
  let here_bits, here_op, here_val;
31923
- for (len = 0; len <= MAXBITS; len++) count[len] = 0;
31924
- for (sym = 0; sym < codes; sym++) count[lens[lens_index + sym]]++;
31920
+ for (len = 0; len <= MAXBITS; len++) count2[len] = 0;
31921
+ for (sym = 0; sym < codes; sym++) count2[lens[lens_index + sym]]++;
31925
31922
  root = bits;
31926
- for (max = MAXBITS; max >= 1; max--) if (count[max] !== 0) break;
31923
+ for (max = MAXBITS; max >= 1; max--) if (count2[max] !== 0) break;
31927
31924
  if (root > max) root = max;
31928
31925
  if (max === 0) {
31929
31926
  table[table_index++] = 20971520;
@@ -31931,17 +31928,17 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
31931
31928
  opts.bits = 1;
31932
31929
  return 0;
31933
31930
  }
31934
- for (min = 1; min < max; min++) if (count[min] !== 0) break;
31931
+ for (min = 1; min < max; min++) if (count2[min] !== 0) break;
31935
31932
  if (root < min) root = min;
31936
31933
  left = 1;
31937
31934
  for (len = 1; len <= MAXBITS; len++) {
31938
31935
  left <<= 1;
31939
- left -= count[len];
31936
+ left -= count2[len];
31940
31937
  if (left < 0) return -1;
31941
31938
  }
31942
31939
  if (left > 0 && (type === CODES$1 || max !== 1)) return -1;
31943
31940
  offs[1] = 0;
31944
- for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count[len];
31941
+ for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count2[len];
31945
31942
  for (sym = 0; sym < codes; sym++) if (lens[lens_index + sym] !== 0) work[offs[lens[lens_index + sym]]++] = sym;
31946
31943
  if (type === CODES$1) {
31947
31944
  base = extra = work;
@@ -31991,7 +31988,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
31991
31988
  huff += incr;
31992
31989
  } else huff = 0;
31993
31990
  sym++;
31994
- if (--count[len] === 0) {
31991
+ if (--count2[len] === 0) {
31995
31992
  if (len === max) break;
31996
31993
  len = lens[lens_index + work[sym]];
31997
31994
  }
@@ -32001,7 +31998,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
32001
31998
  curr = len - drop;
32002
31999
  left = 1 << curr;
32003
32000
  while (curr + drop < max) {
32004
- left -= count[curr + drop];
32001
+ left -= count2[curr + drop];
32005
32002
  if (left <= 0) break;
32006
32003
  curr++;
32007
32004
  left <<= 1;
@@ -33261,8 +33258,9 @@ var selectPublicActivityRead = external_exports.object(activityReadFields);
33261
33258
 
33262
33259
  // ../packages/shared/src/entity-read-operation-results.ts
33263
33260
  var id11 = external_exports.string().min(1);
33264
- var entityReadDocument = publicEntityReadDto;
33265
- var entityReadRichDocument = external_exports.strictObject({ ...publicEntityReadDto.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
33261
+ var entityImage = { imageId: id11.optional() };
33262
+ var entityReadDocument = external_exports.strictObject({ ...publicEntityReadDto.shape, ...entityImage });
33263
+ var entityReadRichDocument = external_exports.strictObject({ ...entityReadDocument.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
33266
33264
  var entityReadActivity = publicActivityReadDto;
33267
33265
  var parentDetail = readParentDetail;
33268
33266
  var space = external_exports.strictObject({ spaceId: id11, spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
@@ -33271,15 +33269,17 @@ var task = external_exports.strictObject({ activityId: id11, title: external_exp
33271
33269
  var pin = external_exports.strictObject({ entityId: id11, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), role: external_exports.string().optional(), displayOrder: external_exports.number().optional(), includeInAggregation: external_exports.boolean() });
33272
33270
  var child = external_exports.strictObject({ entityId: id11, name: external_exports.string(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(parentDetail), type: external_exports.enum(ENTITY_TYPE_VALUES) });
33273
33271
  var matchFields = { spaceIds: external_exports.array(id11), openTasks: external_exports.array(task), descriptionPlainText: external_exports.string().optional(), activityCount: external_exports.number(), activityCountPartial: external_exports.boolean().optional(), lastActivityAt: external_exports.number().optional() };
33274
- var entityReadFullList = external_exports.strictObject({ entities: external_exports.array(external_exports.strictObject({ entity: entityReadDocument, ...matchFields })), spaces: external_exports.record(external_exports.string(), space), openTasksPartial: external_exports.boolean().optional(), truncated: external_exports.boolean().optional() });
33272
+ var listPageFields = { hasMore: external_exports.boolean().optional(), nextCursor: external_exports.string().min(1).optional() };
33273
+ var entityReadFullList = external_exports.strictObject({ entities: external_exports.array(external_exports.strictObject({ entity: entityReadDocument, ...matchFields })), spaces: external_exports.record(external_exports.string(), space), openTasksPartial: external_exports.boolean().optional(), truncated: external_exports.boolean().optional(), ...listPageFields });
33275
33274
  var entityReadFullSearch = external_exports.strictObject({ entities: external_exports.array(external_exports.strictObject({ entity: entityReadRichDocument, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), space) });
33276
33275
  var entityReadFullDetail = external_exports.strictObject({ entity: entityReadRichDocument, pins: external_exports.array(pin), children: external_exports.array(child), childrenTruncated: external_exports.boolean(), aggregationMode: external_exports.enum(["includeDirectChildren", "directOnly"]), activities: external_exports.array(entityReadActivity), openTasks: external_exports.array(task), spaces: external_exports.array(space), descriptionPlainText: external_exports.string().optional() }).nullable();
33277
33276
  var selectSpace = external_exports.object(space.shape);
33278
- var selectList = external_exports.object({ ...entityReadFullList.shape, entities: external_exports.array(external_exports.object({ entity: selectPublicEntityRead, ...matchFields })), spaces: external_exports.record(external_exports.string(), selectSpace) });
33279
- var selectRichEntity = external_exports.object({ ...selectPublicEntityRead.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
33277
+ var selectEntity = external_exports.object({ ...selectPublicEntityRead.shape, ...entityImage });
33278
+ var selectList = external_exports.object({ ...entityReadFullList.shape, entities: external_exports.array(external_exports.object({ entity: selectEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), selectSpace) });
33279
+ var selectRichEntity = external_exports.object({ ...selectEntity.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
33280
33280
  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) });
33281
33281
  var selectDetail = external_exports.object({ ...entityReadFullDetail.unwrap().shape, entity: selectRichEntity, activities: external_exports.array(selectPublicActivityRead), spaces: external_exports.array(selectSpace) }).nullable();
33282
- 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 });
33282
+ var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, imageId: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
33283
33283
  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 });
33284
33284
  var compactList = entityReadFullList.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), compactSpace) });
33285
33285
  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) });
@@ -33355,8 +33355,8 @@ var ENTITY_CREATE_INPUT_SCHEMA = {
33355
33355
  function isEntityType(value) {
33356
33356
  return typeof value === "string" && ENTITY_TYPE_VALUES.some((type) => type === value);
33357
33357
  }
33358
- var invalid2 = (message4) => ({ ok: false, message: message4 });
33359
- function parseEntityCreateInput(args, name4 = "entities_create") {
33358
+ var invalid2 = (message3) => ({ ok: false, message: message3 });
33359
+ function parseEntityCreateInput(args, name4 = "createEntity") {
33360
33360
  if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
33361
33361
  if (args.parentEntityId !== void 0 && (typeof args.parentEntityId !== "string" || !args.parentEntityId.trim()))
33362
33362
  return invalid2("parentEntityId must be a non-empty string");
@@ -33386,7 +33386,7 @@ function parseEntityCreateInput(args, name4 = "entities_create") {
33386
33386
  ...spaceIds?.length ? { spaceIds } : {}
33387
33387
  } };
33388
33388
  }
33389
- function parseEntityUpdateInput(args, name4 = "entities_update") {
33389
+ function parseEntityUpdateInput(args, name4 = "updateEntity") {
33390
33390
  if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
33391
33391
  if (args.allowNonExclusiveChildren !== void 0 && typeof args.allowNonExclusiveChildren !== "boolean") return invalid2("allowNonExclusiveChildren must be a boolean");
33392
33392
  if (typeof args.entityId !== "string") return invalid2(`${name4} requires string entityId`);
@@ -33411,8 +33411,8 @@ var ENTITY_IMAGE_MAX_DIMENSION = 256;
33411
33411
  var ENTITY_IMAGE_OUTPUT_SIZE = 192;
33412
33412
  var ENTITY_IMAGE_DATA_URI_MAX_LENGTH = 23 + Math.ceil(ENTITY_IMAGE_MAX_BYTES / 3) * 4;
33413
33413
  var EntityImageError = class extends Error {
33414
- constructor(message4) {
33415
- super(message4);
33414
+ constructor(message3) {
33415
+ super(message3);
33416
33416
  this.name = "EntityImageError";
33417
33417
  }
33418
33418
  };
@@ -33530,7 +33530,8 @@ var entityWriteInputs = {
33530
33530
  removeFieldValue: external_exports.strictObject({ valueId: id12 }),
33531
33531
  archiveEntity: external_exports.strictObject({ entityId: id12 }),
33532
33532
  restoreEntity: external_exports.strictObject({ entityId: id12, grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().trim().min(1).optional() }),
33533
- setEntityImage: external_exports.strictObject({ entityId: id12, spaceId: id12.optional(), image: external_exports.string().max(ENTITY_IMAGE_DATA_URI_MAX_LENGTH).nullable() })
33533
+ setEntityImage: external_exports.strictObject({ entityId: id12, spaceId: id12.optional(), image: external_exports.string().max(ENTITY_IMAGE_DATA_URI_MAX_LENGTH).nullable() }),
33534
+ mergeEntity: external_exports.strictObject({ sourceEntityId: id12, targetEntityId: id12, dryRun: external_exports.boolean().default(false), grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().trim().min(1).optional() })
33534
33535
  };
33535
33536
  function parserMismatch2(operation) {
33536
33537
  throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
@@ -33568,6 +33569,8 @@ function parseEntityWriteRequest(operation, raw) {
33568
33569
  return { operation, input: parseOperationInput(operation, entityWriteInputs.restoreEntity, raw) };
33569
33570
  case "setEntityImage":
33570
33571
  return { operation, input: parseOperationInput(operation, entityWriteInputs.setEntityImage, raw) };
33572
+ case "mergeEntity":
33573
+ return { operation, input: parseOperationInput(operation, entityWriteInputs.mergeEntity, raw) };
33571
33574
  }
33572
33575
  }
33573
33576
  function rejectLegacyEntityAttributes(operation, raw) {
@@ -33585,6 +33588,22 @@ var ENTITY_DUPLICATION_DESCRIPTION = `Duplicate an entity shell in a selected sp
33585
33588
  // ../packages/shared/src/entity-write-operation-results.ts
33586
33589
  var entityId = external_exports.string().min(1);
33587
33590
  var success2 = external_exports.strictObject({ success: external_exports.literal(true) });
33591
+ var count = external_exports.number().int().min(0);
33592
+ var spaceRef = external_exports.strictObject({ spaceId: entityId, name: external_exports.string() });
33593
+ var entityMergeSummary = external_exports.strictObject({
33594
+ dryRun: external_exports.boolean(),
33595
+ entityId,
33596
+ name: external_exports.string(),
33597
+ sourceEntityId: entityId,
33598
+ sourceName: external_exports.string(),
33599
+ moved: external_exports.strictObject({ activities: count, relationships: count, whiteboards: count, calendarEvents: count, fieldValues: count, tags: count, aliases: count, description: external_exports.boolean() }),
33600
+ image: external_exports.enum(["target", "source", "none"]),
33601
+ targetSpacesAdded: external_exports.array(spaceRef),
33602
+ sourceSpacesAdded: external_exports.array(spaceRef),
33603
+ parentSpaceGrants: external_exports.array(external_exports.strictObject({ entityId, name: external_exports.string(), missingSpaces: external_exports.array(spaceRef.extend({ memberCount: count, membersTruncated: external_exports.boolean() })) })),
33604
+ parentSpaceGrantFingerprint: external_exports.string().nullable(),
33605
+ requiresPerson: external_exports.boolean()
33606
+ });
33588
33607
  var entityWriteResults = {
33589
33608
  createEntity: external_exports.strictObject({ entityId }),
33590
33609
  updateEntity: success2,
@@ -33595,7 +33614,8 @@ var entityWriteResults = {
33595
33614
  addFieldValue: external_exports.strictObject({ valueId: entityId, added: external_exports.boolean() }),
33596
33615
  updateFieldValue: success2,
33597
33616
  removeFieldValue: success2,
33598
- setEntityImage: external_exports.strictObject({ entityId, imageId: external_exports.string().min(1).nullable() })
33617
+ setEntityImage: external_exports.strictObject({ entityId, imageId: external_exports.string().min(1).nullable() }),
33618
+ mergeEntity: entityMergeSummary
33599
33619
  };
33600
33620
  var nativeEntityWriteResults = {
33601
33621
  ...entityWriteResults,
@@ -33613,7 +33633,8 @@ var publicCliEntityWriteResults = {
33613
33633
  updateEntityName: success2.extend({ entityId, name: external_exports.string() }),
33614
33634
  archiveEntity: success2.extend({ entityId }),
33615
33635
  restoreEntity: success2.extend({ entityId }),
33616
- setEntityImage: entityWriteResults.setEntityImage
33636
+ setEntityImage: entityWriteResults.setEntityImage,
33637
+ mergeEntity: entityMergeSummary
33617
33638
  };
33618
33639
  function parsePublicCliEntityWriteResult(operation, raw) {
33619
33640
  return checked3(publicCliEntityWriteResults[operation], raw);
@@ -33634,6 +33655,8 @@ function projectEntityWriteResult(operation, raw) {
33634
33655
  return checked3(entityWriteResults.addFieldValue, raw);
33635
33656
  case "setEntityImage":
33636
33657
  return checked3(entityWriteResults.setEntityImage, raw);
33658
+ case "mergeEntity":
33659
+ return checked3(entityWriteResults.mergeEntity, raw);
33637
33660
  default:
33638
33661
  if (raw !== null) throw new OperationResultError(operation, "Invalid entity write result");
33639
33662
  return checked3(success2, { success: true });
@@ -33682,6 +33705,14 @@ var selectPage = external_exports.object({ activities: external_exports.array(se
33682
33705
  var fullPage = activityReadFullPage.extend({ projection: external_exports.literal("full") });
33683
33706
  var compactPage = activityReadFullPage.extend({ activities: external_exports.array(compactActivity2), projection: external_exports.literal("compact") });
33684
33707
  var pages = external_exports.discriminatedUnion("projection", [fullPage, compactPage]);
33708
+ var cliSpace = external_exports.strictObject({ spaceId: id13, spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
33709
+ var publicCliActivityListEnvelope = external_exports.strictObject({
33710
+ data: external_exports.array(external_exports.union([publicActivityRecordDto, compactActivity2])),
33711
+ hasMore: external_exports.boolean().optional(),
33712
+ nextCursor: external_exports.string().optional(),
33713
+ projection: external_exports.literal("compact").optional(),
33714
+ spaces: external_exports.record(external_exports.string(), cliSpace).optional()
33715
+ });
33685
33716
  var taskLookupTombstone = external_exports.strictObject({ projection: external_exports.literal("tombstone"), _id: id13, spaceId: id13, type: external_exports.literal("task"), completed: external_exports.boolean(), deletedAt: external_exports.number() });
33686
33717
  var activityReadResults = {
33687
33718
  getActivity: external_exports.union([taskLookupTombstone, publicActivityDetailDto.extend({ projection: external_exports.literal("full") }), compactDetail2.extend({ projection: external_exports.literal("compact") }), external_exports.null()]),
@@ -33700,6 +33731,33 @@ function parseActivityReadResult(name4, raw) {
33700
33731
  function checked4(schema, raw) {
33701
33732
  return parseZodOperationResult("activityRead", schema, raw, "Invalid activity read result");
33702
33733
  }
33734
+ var richAttachment = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
33735
+ var richUser = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
33736
+ var richAgent = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
33737
+ var richAgentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
33738
+ var richAgenda = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
33739
+ var richMessage = external_exports.object({
33740
+ ...publicActivityDetailDto.shape.messages.element.shape,
33741
+ createdByUser: richUser.nullable(),
33742
+ createdByAgent: richAgent.nullable().optional(),
33743
+ updatedByAgent: richAgent.nullable().optional()
33744
+ });
33745
+ var activityRichRecord = external_exports.object({
33746
+ ...publicActivityReadDto.shape,
33747
+ attachments: external_exports.array(richAttachment).optional(),
33748
+ entityIds: external_exports.array(external_exports.string()).optional(),
33749
+ entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
33750
+ agendaPoints: external_exports.array(richAgenda).optional(),
33751
+ messages: external_exports.array(richMessage).optional(),
33752
+ createdByUser: richUser.nullable().optional(),
33753
+ createdViaAgent: richAgent.nullable().optional(),
33754
+ updatedViaAgent: richAgent.nullable().optional(),
33755
+ createdByPersonalAgent: external_exports.boolean().optional(),
33756
+ createdByAgent: richAgent.nullable().optional(),
33757
+ updatedByAgent: richAgent.nullable().optional(),
33758
+ createdByAgentCreatorUser: richAgentCreator.nullable().optional(),
33759
+ assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
33760
+ });
33703
33761
 
33704
33762
  // ../packages/shared/src/agent-tasks.ts
33705
33763
  var AGENT_TASK_PAGE_MAX = 100;
@@ -33743,7 +33801,7 @@ var fields2 = {
33743
33801
  release: ["assignmentId", "claimToken"]
33744
33802
  };
33745
33803
  function validateAgentTaskInput(raw) {
33746
- const invalid5 = (message4) => ({ ok: false, message: message4 });
33804
+ const invalid5 = (message3) => ({ ok: false, message: message3 });
33747
33805
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return invalid5("Task input must be an object");
33748
33806
  const input2 = raw;
33749
33807
  if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return invalid5("Unknown task operation");
@@ -34085,6 +34143,26 @@ function parseAgentSelfTaskDiagnosticRequest(operation, raw) {
34085
34143
  }
34086
34144
  }
34087
34145
 
34146
+ // ../packages/shared/src/task-read-operations.ts
34147
+ var TASK_READ_LIMITS = { results: 200, children: 100, childLinks: 1e3, childSources: 400 };
34148
+ var id14 = external_exports.string().min(1).max(128);
34149
+ var list = { field: activityFieldFiltersSchema.optional(), spaceId: id14.optional(), entityId: id14.optional(), onlyOpen: external_exports.boolean().default(true), dueBy: activityWriteDeadline.optional(), assignee: external_exports.enum(["me", "meOrUnassigned", "unassigned"]).optional(), assigneeUserId: id14.optional(), assigneeEmail: external_exports.string().optional(), assigneeAgentId: id14.optional(), agentTaskDisplay: external_exports.enum(["show", "dim", "hideAgentOnly", "hideAllWithAgent"]).optional() };
34150
+ var taskReadInputs = {
34151
+ listTasks: external_exports.strictObject(list),
34152
+ getTaskByNumber: external_exports.strictObject({ number: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER), spaceId: id14.optional() }),
34153
+ listOpenTasks: external_exports.strictObject({ spaceId: id14 }),
34154
+ listTasksDueBy: external_exports.strictObject({ spaceId: id14, deadline: activityWriteDeadline, includeOverdue: external_exports.boolean().default(true) }),
34155
+ listOpenTasksForEntity: external_exports.strictObject({ entityId: id14 })
34156
+ };
34157
+
34158
+ // ../packages/shared/src/task-read-operation-results.ts
34159
+ var taskReadEntity = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
34160
+ var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(taskReadEntity) });
34161
+ var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
34162
+ var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(taskReadEntity.shape)) });
34163
+ var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
34164
+ var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
34165
+
34088
34166
  // ../packages/shared/src/agenda-operation-results.ts
34089
34167
  var AGENDA_TASK_RESULT_LIMIT = 20;
34090
34168
  var AGENDA_TASK_OWNER_LIMIT = 8;
@@ -34143,8 +34221,8 @@ function parseAgendaCreateResponse(raw) {
34143
34221
  }
34144
34222
 
34145
34223
  // ../packages/shared/src/agenda-operations.ts
34146
- var id14 = external_exports.string().min(1).max(128).refine((value) => value.trim() === value, "Copy IDs unchanged");
34147
- var activityId = id14.describe("Existing activity ID of any type; the legacy field name remains compatible.");
34224
+ var id15 = external_exports.string().min(1).max(128).refine((value) => value.trim() === value, "Copy IDs unchanged");
34225
+ var activityId = id15.describe("Existing activity ID of any type; the legacy field name remains compatible.");
34148
34226
  var title = external_exports.string().trim().min(1);
34149
34227
  var version4 = external_exports.number().int().nonnegative().nullable();
34150
34228
  var agendaInputs = {
@@ -34152,29 +34230,22 @@ var agendaInputs = {
34152
34230
  meetingActivityId: activityId,
34153
34231
  title: title.describe("Agenda title. Entity mentions use [entity](ente://entity/<entityId>)."),
34154
34232
  contentMarkdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(),
34155
- parentPointId: id14.optional(),
34156
- afterPointId: id14.optional()
34233
+ parentPointId: id15.optional(),
34234
+ afterPointId: id15.optional()
34157
34235
  }),
34158
34236
  getMeetingAgenda: external_exports.strictObject({ meetingActivityId: activityId }),
34159
34237
  updateAgendaPointTitle: external_exports.strictObject({
34160
- agendaPointId: id14,
34238
+ agendaPointId: id15,
34161
34239
  title,
34162
34240
  expectedUpdatedAt: external_exports.number().nonnegative()
34163
34241
  }),
34164
34242
  replaceAgendaPointContent: external_exports.strictObject({
34165
- agendaPointId: id14,
34243
+ agendaPointId: id15,
34166
34244
  contentMarkdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION),
34167
34245
  expectedContentVersion: version4
34168
34246
  }),
34169
34247
  searchMeetingTasks: external_exports.strictObject({ meetingActivityId: activityId, query: external_exports.string().trim().min(1) })
34170
34248
  };
34171
- var agendaAliases = {
34172
- agenda_points_create: "createAgendaPoint",
34173
- agenda_points_get: "getMeetingAgenda",
34174
- agenda_points_update_title: "updateAgendaPointTitle",
34175
- agenda_points_replace_content: "replaceAgendaPointContent",
34176
- meeting_tasks_search: "searchMeetingTasks"
34177
- };
34178
34249
  var descriptions3 = {
34179
34250
  createAgendaPoint: "Create a titled agenda point with optional Markdown on an existing activity of any type. Prefer agenda points for structured content unless the user's prompt requests another format.",
34180
34251
  getMeetingAgenda: "Read the ordered agenda of an existing activity of any type, including nested point IDs, plain and Markdown titles, markdown content, versions and timestamps. Read before updating a point.",
@@ -34189,7 +34260,7 @@ function buildAgendaDefinition(name4) {
34189
34260
  const schema = external_exports.toJSONSchema(agendaInputs[name4], { io: "input" });
34190
34261
  return {
34191
34262
  name: name4,
34192
- aliases: operationAliases(agendaAliases, name4),
34263
+ aliases: [],
34193
34264
  actor: "agent",
34194
34265
  description: descriptions3[name4],
34195
34266
  inputSchema: {
@@ -34223,7 +34294,7 @@ var HEALTH_SERIES_KEY_PATTERN = /^[a-z][a-z0-9_]{0,39}$/;
34223
34294
  var HEALTH_SERIES_LABEL_MAX_LENGTH = 60;
34224
34295
  var HEALTH_SERIES_UNIT_MAX_LENGTH = 16;
34225
34296
  var HEALTH_SERIES_DESCRIPTION_MAX_LENGTH = 160;
34226
- var HEALTH_SERIES_MAX_PER_USER = 20;
34297
+ var HEALTH_SERIES_MAX_PER_USER = 50;
34227
34298
  var HEALTH_RECORD_MAX_POINTS = 500;
34228
34299
  var HEALTH_RECORD_MAX_REMOVALS = 500;
34229
34300
  var HEALTH_READ_MAX_DAYS = 800;
@@ -34232,14 +34303,15 @@ var HEALTH_SERIES_REMOVE_MAX_POINTS = 4e3;
34232
34303
  var HEALTH_VALUE_ABS_MAX = 1e9;
34233
34304
  var HEALTH_INTRADAY_MAX_DAYS_PER_RECORD = 14;
34234
34305
  var HEALTH_INTRADAY_READ_MAX_VALUES = 2e4;
34306
+ var HEALTH_BETTER_VALUES = ["higher", "lower", "neutral"];
34235
34307
  var HealthMeasurementError = class extends Error {
34236
- constructor(message4) {
34237
- super(message4);
34308
+ constructor(message3) {
34309
+ super(message3);
34238
34310
  this.name = "HealthMeasurementError";
34239
34311
  }
34240
34312
  };
34241
- var fail = (message4) => {
34242
- throw new HealthMeasurementError(message4);
34313
+ var fail = (message3) => {
34314
+ throw new HealthMeasurementError(message3);
34243
34315
  };
34244
34316
  var DAY_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
34245
34317
  var DATE_TIME_PATTERN = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})?$/;
@@ -34311,12 +34383,13 @@ function parseHealthSeriesKey(value, field = "series") {
34311
34383
  }
34312
34384
  function parseHealthSeriesDefinition(value, field = "series") {
34313
34385
  const raw = record2(value, field);
34314
- onlyKeys(raw, ["key", "label", "unit", "description", "better", "scale", "bands", "resolution"], field);
34386
+ onlyKeys(raw, ["key", "label", "unit", "description", "better", "scale", "bands", "resolution", "hidden"], field);
34315
34387
  const key = parseHealthSeriesKey(raw.key, `${field}.key`);
34316
34388
  const label = text2(raw.label, `${field}.label`, HEALTH_SERIES_LABEL_MAX_LENGTH, true);
34317
34389
  const unit = text2(raw.unit, `${field}.unit`, HEALTH_SERIES_UNIT_MAX_LENGTH, false);
34318
34390
  const description = text2(raw.description, `${field}.description`, HEALTH_SERIES_DESCRIPTION_MAX_LENGTH, false);
34319
- if (raw.better !== "higher" && raw.better !== "lower") fail(`${field}.better must be "higher" or "lower"`);
34391
+ if (!HEALTH_BETTER_VALUES.includes(raw.better)) fail(`${field}.better must be "higher", "lower" or "neutral"`);
34392
+ if (raw.hidden !== void 0 && raw.hidden !== null && typeof raw.hidden !== "boolean") fail(`${field}.hidden must be true or false`);
34320
34393
  const better2 = raw.better;
34321
34394
  let scale;
34322
34395
  if (raw.scale !== void 0 && raw.scale !== null) {
@@ -34344,10 +34417,11 @@ function parseHealthSeriesDefinition(value, field = "series") {
34344
34417
  ...description ? { description } : {},
34345
34418
  ...scale ? { scale } : {},
34346
34419
  ...bands ? { bands } : {},
34347
- ...raw.resolution === "intraday" ? { resolution: "intraday" } : {}
34420
+ ...raw.resolution === "intraday" ? { resolution: "intraday" } : {},
34421
+ ...raw.hidden === true ? { hidden: true } : {}
34348
34422
  };
34349
34423
  }
34350
- function list(value, field, max) {
34424
+ function list2(value, field, max) {
34351
34425
  if (value === void 0 || value === null) return [];
34352
34426
  if (!Array.isArray(value)) return fail(`${field} must be a list`);
34353
34427
  if (value.length > max) fail(`${field} accepts at most ${max} items`);
@@ -34377,14 +34451,14 @@ var positionKey = (series, position) => `${series}|${position.day}|${position.mi
34377
34451
  function parseHealthRecordRequest(value) {
34378
34452
  const raw = record2(value, "request");
34379
34453
  onlyKeys(raw, ["series", "points", "intraday", "remove", "removeSeries"], "request");
34380
- const series = list(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesDefinition(item, `series[${index}]`));
34454
+ const series = list2(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesDefinition(item, `series[${index}]`));
34381
34455
  const seriesKeys = /* @__PURE__ */ new Set();
34382
34456
  for (const definition7 of series) {
34383
34457
  if (seriesKeys.has(definition7.key)) fail(`series ${definition7.key} is defined twice`);
34384
34458
  seriesKeys.add(definition7.key);
34385
34459
  }
34386
34460
  const seen = /* @__PURE__ */ new Set();
34387
- const points = list(raw.points, "points", HEALTH_RECORD_MAX_POINTS).map((item, index) => {
34461
+ const points = list2(raw.points, "points", HEALTH_RECORD_MAX_POINTS).map((item, index) => {
34388
34462
  const field = `points[${index}]`;
34389
34463
  const point2 = record2(item, field);
34390
34464
  onlyKeys(point2, ["series", "at", "value"], field);
@@ -34398,7 +34472,7 @@ function parseHealthRecordRequest(value) {
34398
34472
  seen.add(key);
34399
34473
  return parsed;
34400
34474
  });
34401
- const remove = list(raw.remove, "remove", HEALTH_RECORD_MAX_REMOVALS).map((item, index) => {
34475
+ const remove = list2(raw.remove, "remove", HEALTH_RECORD_MAX_REMOVALS).map((item, index) => {
34402
34476
  const field = `remove[${index}]`;
34403
34477
  const ref = record2(item, field);
34404
34478
  onlyKeys(ref, ["series", "at"], field);
@@ -34406,13 +34480,13 @@ function parseHealthRecordRequest(value) {
34406
34480
  if (seen.has(positionKey(parsed.series, parsed.position))) fail(`${field} also appears in points`);
34407
34481
  return parsed;
34408
34482
  });
34409
- const removeSeries = list(raw.removeSeries, "removeSeries", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `removeSeries[${index}]`));
34483
+ const removeSeries = list2(raw.removeSeries, "removeSeries", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `removeSeries[${index}]`));
34410
34484
  for (const key of removeSeries) {
34411
34485
  if (seriesKeys.has(key)) fail(`series ${key} cannot be defined and removed in one request`);
34412
34486
  if (points.some((point2) => point2.series === key)) fail(`series ${key} cannot receive points and be removed in one request`);
34413
34487
  }
34414
34488
  const intradaySeen = /* @__PURE__ */ new Set();
34415
- const intraday = list(raw.intraday, "intraday", HEALTH_INTRADAY_MAX_DAYS_PER_RECORD).map((item, index) => {
34489
+ const intraday = list2(raw.intraday, "intraday", HEALTH_INTRADAY_MAX_DAYS_PER_RECORD).map((item, index) => {
34416
34490
  const block = parseHealthIntradayDay(item, `intraday[${index}]`);
34417
34491
  const key = `${block.series}|${block.day}`;
34418
34492
  if (intradaySeen.has(key)) fail(`intraday[${index}] repeats ${block.series} on ${block.day}`);
@@ -34433,12 +34507,12 @@ function parseHealthListRequest(value) {
34433
34507
  const span = healthDayDiff(from, to);
34434
34508
  if (span < 0) fail("to must not be before from");
34435
34509
  if (span >= HEALTH_READ_MAX_DAYS) fail(`a read covers at most ${HEALTH_READ_MAX_DAYS} days`);
34436
- const series = raw.series === void 0 || raw.series === null ? void 0 : list(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `series[${index}]`));
34510
+ const series = raw.series === void 0 || raw.series === null ? void 0 : list2(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `series[${index}]`));
34437
34511
  return { from, to, ...series ? { series } : {} };
34438
34512
  }
34439
34513
 
34440
34514
  // ../packages/shared/src/health-measurement-operations.ts
34441
- var better = v2.union(v2.literal("higher"), v2.literal("lower"));
34515
+ var better = v2.union(v2.literal("higher"), v2.literal("lower"), v2.literal("neutral"));
34442
34516
  var healthSeriesViewValidator = v2.object({
34443
34517
  key: v2.string(),
34444
34518
  label: v2.string(),
@@ -34484,10 +34558,6 @@ var healthMeasurementResults = {
34484
34558
  recordHealthMeasurements: healthRecordResultValidator,
34485
34559
  listHealthMeasurements: healthListResultValidator
34486
34560
  };
34487
- var healthMeasurementAliases = {
34488
- health_measurements_record: "recordHealthMeasurements",
34489
- health_measurements_list: "listHealthMeasurements"
34490
- };
34491
34561
  function invalid3(operation, error62) {
34492
34562
  if (error62 instanceof HealthMeasurementError) throw new OperationInputError(operation, [{ path: [], reason: "custom" }], error62.message);
34493
34563
  throw error62;
@@ -34504,7 +34574,7 @@ function parseHealthMeasurementRequest(operation, raw) {
34504
34574
  }
34505
34575
  }
34506
34576
  var seriesRef = { type: "string" };
34507
- var at = { type: "string", description: "YYYY-MM-DD or local YYYY-MM-DDTHH:MM, kept as written" };
34577
+ var at = { type: "string", description: "YYYY-MM-DD or local YYYY-MM-DDTHH:MM" };
34508
34578
  var pair2 = (lower, upper) => ({
34509
34579
  type: "object",
34510
34580
  additionalProperties: false,
@@ -34527,10 +34597,11 @@ var recordInputSchema = {
34527
34597
  label: { type: "string", minLength: 1, maxLength: HEALTH_SERIES_LABEL_MAX_LENGTH },
34528
34598
  unit: { type: "string", maxLength: HEALTH_SERIES_UNIT_MAX_LENGTH },
34529
34599
  description: { type: "string", maxLength: HEALTH_SERIES_DESCRIPTION_MAX_LENGTH },
34530
- better: { enum: ["higher", "lower"] },
34600
+ better: { enum: ["higher", "lower", "neutral"] },
34531
34601
  scale: pair2("min", "max"),
34532
34602
  bands: { ...pair2("lower", "upper"), description: "Omit for personal bands" },
34533
- resolution: { enum: ["day", "intraday"] }
34603
+ resolution: { enum: ["day", "intraday"] },
34604
+ hidden: { type: "boolean" }
34534
34605
  }
34535
34606
  }
34536
34607
  },
@@ -34569,21 +34640,21 @@ var listInputSchema = {
34569
34640
  additionalProperties: false,
34570
34641
  properties: {
34571
34642
  from: day,
34572
- to: { ...day, description: `Inclusive; at most ${HEALTH_READ_MAX_DAYS} days after from` },
34643
+ to: { ...day, description: `Inclusive, at most ${HEALTH_READ_MAX_DAYS} days after from` },
34573
34644
  series: { type: "array", maxItems: HEALTH_SERIES_MAX_PER_USER, items: seriesRef }
34574
34645
  },
34575
34646
  required: ["from", "to"]
34576
34647
  };
34577
34648
  var ownerOnly = " Owner's own personal agent only.";
34578
34649
  var descriptions4 = {
34579
- recordHealthMeasurements: "Write the owner's health series for the calendar: define series, then send points or whole intraday days. Same series and at replace; remove, removeSeries delete." + ownerOnly,
34650
+ recordHealthMeasurements: "Write the owner's calendar health data: define series, then send points or intraday days. Same series+at replaces; remove/removeSeries delete." + ownerOnly,
34580
34651
  listHealthMeasurements: `Read the owner's health series, points and intraday days from..to (inclusive), max ${HEALTH_READ_MAX_POINTS} points.` + ownerOnly
34581
34652
  };
34582
34653
  function definition2(name4, inputSchema2) {
34583
34654
  const resultSchema3 = operationResultSchema(healthMeasurementResults[name4]);
34584
34655
  return {
34585
34656
  name: name4,
34586
- aliases: operationAliases(healthMeasurementAliases, name4),
34657
+ aliases: [],
34587
34658
  actor: "agent",
34588
34659
  description: descriptions4[name4],
34589
34660
  inputSchema: inputSchema2,
@@ -34773,7 +34844,7 @@ var RestClient = class {
34773
34844
  }
34774
34845
  };
34775
34846
  function toApiError(status2, statusText, text4) {
34776
- let message4 = statusText || "Unknown error";
34847
+ let message3 = statusText || "Unknown error";
34777
34848
  let structured = {};
34778
34849
  if (text4) {
34779
34850
  try {
@@ -34782,14 +34853,14 @@ function toApiError(status2, statusText, text4) {
34782
34853
  if (raw && typeof raw === "object") {
34783
34854
  structured = raw;
34784
34855
  const m = raw.message;
34785
- if (typeof m === "string") message4 = m;
34856
+ if (typeof m === "string") message3 = m;
34786
34857
  } else if (typeof raw === "string") {
34787
- message4 = raw;
34858
+ message3 = raw;
34788
34859
  }
34789
34860
  } catch {
34790
34861
  }
34791
34862
  }
34792
- return new ApiError(status2, message4, structured);
34863
+ return new ApiError(status2, message3, structured);
34793
34864
  }
34794
34865
 
34795
34866
  // core/config.ts
@@ -34837,10 +34908,10 @@ var TomlError = class _TomlError extends Error {
34837
34908
  line;
34838
34909
  column;
34839
34910
  codeblock;
34840
- constructor(message4, options) {
34911
+ constructor(message3, options) {
34841
34912
  const [line, column] = getLineColFromPtr(options.toml, options.ptr);
34842
34913
  const codeblock = makeCodeBlock(options.toml, line, column);
34843
- super(`Invalid TOML document: ${message4}
34914
+ super(`Invalid TOML document: ${message3}
34844
34915
 
34845
34916
  ${codeblock}`, options);
34846
34917
  this.line = line;
@@ -34848,8 +34919,8 @@ ${codeblock}`, options);
34848
34919
  this.codeblock = codeblock;
34849
34920
  }
34850
34921
  /** @internal */
34851
- static x(message4, ctx, ptr) {
34852
- throw new _TomlError(message4, { toml: ctx.s, ptr: ptr ?? ctx.p });
34922
+ static x(message3, ctx, ptr) {
34923
+ throw new _TomlError(message3, { toml: ctx.s, ptr: ptr ?? ctx.p });
34853
34924
  }
34854
34925
  };
34855
34926
 
@@ -35579,6 +35650,10 @@ function normalizeProfileName(value) {
35579
35650
  }
35580
35651
  return normalized2;
35581
35652
  }
35653
+ function nearestBinding(branding, cwd = process.cwd()) {
35654
+ const canonical = canonicalFolder(cwd);
35655
+ return listProfileBindings(branding).filter((entry) => canonical === entry.path || canonical.startsWith(entry.path.endsWith(path.sep) ? entry.path : entry.path + path.sep)).sort((a, b) => b.path.length - a.path.length)[0];
35656
+ }
35582
35657
  function bindingsPath(branding) {
35583
35658
  return path.join(configDir(branding), "bindings.json");
35584
35659
  }
@@ -35597,11 +35672,15 @@ function listProfileBindings(branding) {
35597
35672
  const seen = /* @__PURE__ */ new Set();
35598
35673
  const bindings = [];
35599
35674
  for (const value of data) {
35600
- if (!value || typeof value !== "object" || typeof value.path !== "string" || !path.isAbsolute(value.path) || typeof value.profile !== "string" || !value.profile.trim()) throw new Error("invalid binding");
35675
+ if (!value || typeof value !== "object" || typeof value.path !== "string" || !path.isAbsolute(value.path) || typeof value.profile !== "string" || !value.profile.trim() || value.currentTask !== void 0 && (typeof value.currentTask !== "string" || !value.currentTask.trim())) throw new Error("invalid binding");
35601
35676
  const folder = canonicalFolder(value.path);
35602
35677
  if (seen.has(folder)) throw new Error("duplicate binding");
35603
35678
  seen.add(folder);
35604
- bindings.push({ path: folder, profile: normalizeProfileName(value.profile) ?? "default" });
35679
+ bindings.push({
35680
+ path: folder,
35681
+ profile: normalizeProfileName(value.profile) ?? "default",
35682
+ ...value.currentTask === void 0 ? {} : { currentTask: value.currentTask }
35683
+ });
35605
35684
  }
35606
35685
  return bindings.sort((a, b) => a.path.localeCompare(b.path));
35607
35686
  } catch {
@@ -35619,14 +35698,17 @@ function saveProfileBindings(branding, bindings) {
35619
35698
  rmSync(temporary, { force: true });
35620
35699
  }
35621
35700
  }
35622
- function bindProfile(branding, folder, profile) {
35701
+ function bindProfile(branding, folder, profile, currentTask) {
35623
35702
  if (!profile.trim()) throw new Error("Profile cannot be empty");
35624
35703
  const name4 = normalizeProfileName(profile) ?? "default";
35625
35704
  if (!readStoredCredentials(branding, name4)) throw new Error(`Profile '${name4}' is not authenticated. Run auth login or auth pair first.`);
35626
35705
  const canonical = realpathSync(path.resolve(folder));
35627
35706
  if (!statSync(canonical).isDirectory()) throw new Error("Bind a directory, not a file");
35628
- const binding = { path: canonical, profile: name4 };
35629
- const bindings = listProfileBindings(branding).filter((entry) => entry.path !== canonical);
35707
+ const existing = listProfileBindings(branding);
35708
+ const rule = currentTask === void 0 ? existing.find((entry) => entry.path === canonical)?.currentTask : currentTask ?? void 0;
35709
+ if (rule !== void 0 && !rule.trim()) throw new Error("The current task rule cannot be empty");
35710
+ const binding = { path: canonical, profile: name4, ...rule === void 0 ? {} : { currentTask: rule } };
35711
+ const bindings = existing.filter((entry) => entry.path !== canonical);
35630
35712
  saveProfileBindings(branding, [...bindings, binding]);
35631
35713
  return binding;
35632
35714
  }
@@ -35643,8 +35725,7 @@ function resolveProfileSelection(branding, explicit, cwd = process.cwd()) {
35643
35725
  const env = process.env[branding.profileEnvVar];
35644
35726
  if (env !== void 0) return { profile: normalizeProfileName(env) ?? "default", source: "env" };
35645
35727
  if (branding.directoryBindings !== false) {
35646
- const canonical = canonicalFolder(cwd);
35647
- const nearest = listProfileBindings(branding).filter((entry) => canonical === entry.path || canonical.startsWith(entry.path.endsWith(path.sep) ? entry.path : entry.path + path.sep)).sort((a, b) => b.path.length - a.path.length)[0];
35728
+ const nearest = nearestBinding(branding, cwd);
35648
35729
  if (nearest) return { profile: nearest.profile, source: "directory", directory: nearest.path };
35649
35730
  }
35650
35731
  return { profile: "default", source: "default" };
@@ -35778,8 +35859,6 @@ function listStoredProfiles(branding) {
35778
35859
  }
35779
35860
 
35780
35861
  // ente/client.ts
35781
- var ASK_TIMEOUT_MS = 9e4;
35782
- var UPLOAD_TIMEOUT_MS = 3e5;
35783
35862
  var EnteClient = class _EnteClient {
35784
35863
  rest;
35785
35864
  constructor(rest) {
@@ -35791,12 +35870,7 @@ var EnteClient = class _EnteClient {
35791
35870
  return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey, defaultHeaders: CLI_REQUEST_HEADERS }));
35792
35871
  }
35793
35872
  // --- entities -----------------------------------------------------------
35794
- /** Installed full-record REST profile, used by internal resolvers/space metadata. */
35795
- listEntities(params) {
35796
- return this.rest.get("/api/external/entities", params);
35797
- }
35798
- /** Primary typed reads use the existing MCP route, including detail, which has
35799
- * no REST endpoint. Old installed REST helpers keep their declared profile. */
35873
+ /** Typed entity reads use the MCP route, including detail, which has no REST endpoint. */
35800
35874
  async entityRead(operation, input2) {
35801
35875
  const request = parseEntityReadRequest(operation, input2);
35802
35876
  return { data: parseEntityReadResult(operation, await this.operationData(operation, request.input)) };
@@ -35840,87 +35914,22 @@ var EnteClient = class _EnteClient {
35840
35914
  if (!record3(rpc) || !record3(rpc.result) || rpc.result.isError === true || !record3(rpc.result.structuredContent)) throw new OperationResultError(operation);
35841
35915
  return rpc.result.structuredContent.data;
35842
35916
  }
35843
- createEntity(body) {
35844
- return this.rest.post("/api/external/entities", body);
35845
- }
35846
- updateEntity(id21, body) {
35847
- const input2 = parseEntityWriteRequest("updateEntity", body !== null && typeof body === "object" && !Array.isArray(body) ? { ...body, entityId: id21 } : body).input;
35848
- return this.rest.patch("/api/external/entities", input2);
35849
- }
35850
- archiveEntity(id21) {
35851
- return this.rest.delete("/api/external/entities", { id: id21 });
35852
- }
35853
- restoreEntity(id21) {
35854
- return this.rest.post("/api/external/entities/restore", void 0, { id: id21 });
35855
- }
35856
- removeFromSpace(entityId2, spaceId2) {
35857
- return this.rest.delete("/api/external/entity-spaces", { entityId: entityId2, spaceId: spaceId2 });
35858
- }
35859
- /** Spaces map (id → {spaceName, memberEmails}) via a minimal entities call. */
35917
+ /** Spaces map (id → {spaceName, memberEmails}) via a minimal full entity list. */
35860
35918
  async listSpaces() {
35861
- const res = await this.listEntities({ limit: "1" });
35862
- return res.data?.spaces ?? {};
35863
- }
35864
- /** Installed MCP full-space profile with the caller's role and member emails. */
35865
- async listSpacesFull() {
35866
- return { data: parseZodOperationResult("listSpaces", legacyWorkspaceWireResults.listSpaces, await this.operationData("spaces_list", {})) };
35867
- }
35868
- createSpace(body) {
35869
- return this.workspaceOperation("createSpace", { ...body, color: body.color ?? "kale" });
35870
- }
35871
- async renameSpace(spaceId2, name4) {
35872
- const request = parseWorkspaceRequest("updateSpace", { spaceId: spaceId2, name: name4 });
35873
- return { data: parseZodOperationResult("updateSpace", legacyWorkspaceWireResults.updateSpace, await this.operationData("spaces_rename", request.input)) };
35919
+ const { data } = await this.entityRead("listEntities", { limit: 1, projection: "full" });
35920
+ return data.spaces;
35874
35921
  }
35875
35922
  // --- pins ---------------------------------------------------------------
35876
- createPin(sourceEntityId, targetEntityId, spaceId2) {
35877
- return this.rest.post("/api/external/pins", {
35878
- sourceEntityId,
35879
- targetEntityId,
35880
- ...spaceId2 ? { spaceId: spaceId2 } : {}
35881
- });
35882
- }
35883
- deletePin(sourceEntityId, targetEntityId, spaceId2) {
35884
- return this.rest.delete("/api/external/pins", {
35885
- sourceEntityId,
35886
- targetEntityId,
35887
- ...spaceId2 ? { spaceId: spaceId2 } : {}
35888
- });
35889
- }
35890
- listPins(entityId2) {
35891
- return this.rest.get("/api/external/pins", { entityId: entityId2 });
35892
- }
35893
35923
  // --- activities ---------------------------------------------------------
35894
- listActivities(params) {
35895
- return this.rest.get("/api/external/activities", params);
35896
- }
35897
- getActivity(id21) {
35898
- return this.rest.get("/api/external/activity", { id: id21 });
35899
- }
35900
- createActivity(body) {
35901
- return this.rest.post("/api/external/activities", body);
35902
- }
35903
- updateActivity(id21, body) {
35904
- return this.rest.patch("/api/external/activities", body, { id: id21 });
35905
- }
35906
- deleteActivity(id21) {
35907
- return this.rest.delete("/api/external/activities", { id: id21 });
35908
- }
35909
- restoreActivity(id21) {
35910
- return this.rest.post("/api/external/activities/restore", void 0, { id: id21 });
35911
- }
35912
- searchActivities(params) {
35913
- return this.rest.get("/api/external/activities/search", params);
35924
+ /** Global list or entity history; full records unless params select compact. */
35925
+ async listActivities(params) {
35926
+ const response = await this.rest.get("/api/external/activities", { projection: "full", ...params });
35927
+ return { data: parseActivityReadResult("listActivities", response.data) };
35914
35928
  }
35915
35929
  // --- tasks --------------------------------------------------------------
35916
- listTasks(params) {
35917
- return this.rest.get("/api/external/tasks", params);
35918
- }
35919
- taskByNumber(num, spaceId2) {
35920
- return this.rest.get("/api/external/tasks/number", {
35921
- number: String(num),
35922
- ...spaceId2 ? { spaceId: spaceId2 } : {}
35923
- });
35930
+ async listTasks(params) {
35931
+ const response = await this.rest.get("/api/external/tasks", params);
35932
+ return { data: parseZodOperationResult("listTasks", taskReadResults.listTasks, response.data) };
35924
35933
  }
35925
35934
  // --- activity agendas ---------------------------------------------------
35926
35935
  async createAgendaPoint(body) {
@@ -35928,21 +35937,7 @@ var EnteClient = class _EnteClient {
35928
35937
  const response = await this.rest.post("/api/external/agenda-points", input2);
35929
35938
  return parseAgendaCreateResponse(response);
35930
35939
  }
35931
- uploadAttachment(activityId2, bytes2, name4, mimeType) {
35932
- return this.rest.postRaw(
35933
- "/api/external/activities/upload",
35934
- bytes2,
35935
- mimeType,
35936
- { id: activityId2, name: name4 },
35937
- { timeoutMs: UPLOAD_TIMEOUT_MS }
35938
- );
35939
- }
35940
35940
  // --- ask / query (evidence retrieval) -----------------------------------
35941
- ask(body) {
35942
- return this.rest.post("/api/external/ask", body, void 0, {
35943
- timeoutMs: ASK_TIMEOUT_MS
35944
- });
35945
- }
35946
35941
  query(body) {
35947
35942
  return this.rest.post("/api/external/query", body);
35948
35943
  }
@@ -35990,11 +35985,10 @@ var EnteClient = class _EnteClient {
35990
35985
  getAgentConfiguration() {
35991
35986
  return this.rest.get("/api/external/agent");
35992
35987
  }
35993
- updateAgentPrompt(prompt) {
35994
- return this.rest.patch(
35995
- "/api/external/agent",
35996
- { prompt }
35997
- );
35988
+ /** Writes return a commit receipt; the configuration is read again afterwards. */
35989
+ async updateAgentPrompt(prompt) {
35990
+ await this.rest.patch("/api/external/agent", { prompt });
35991
+ return this.getAgentConfiguration();
35998
35992
  }
35999
35993
  listAgentThreads(params) {
36000
35994
  return this.rest.get("/api/external/agent/threads", params);
@@ -36018,11 +36012,9 @@ var EnteClient = class _EnteClient {
36018
36012
  replyAgentThread(body) {
36019
36013
  return this.rest.post("/api/external/agent/thread/reply", body);
36020
36014
  }
36021
- configureAgentSchedules(schedules) {
36022
- return this.rest.put(
36023
- "/api/external/agent/schedules",
36024
- { schedules }
36025
- );
36015
+ async configureAgentSchedules(schedules) {
36016
+ await this.rest.put("/api/external/agent/schedules", { schedules });
36017
+ return this.getAgentConfiguration();
36026
36018
  }
36027
36019
  // --- agent mail --------------------------------------------------------
36028
36020
  userMailbox(request) {
@@ -36164,17 +36156,18 @@ function jsonWithSpaces(data, spaces) {
36164
36156
  function formatEntityList(entities, spaces) {
36165
36157
  if (entities.length === 0) return "No entities found.";
36166
36158
  const rows = entities.map((e) => {
36167
- const entity5 = e.entity;
36159
+ const entity3 = e.entity;
36168
36160
  const spaceIds = e.spaceIds ?? [];
36169
36161
  const spaceNames = spaces && spaceIds.length ? spaceIds.map((sid) => spaces[sid]?.spaceName ?? sid).join(", ") : "";
36170
36162
  return {
36171
- name: entity5.displayName ?? entity5.name ?? "",
36172
- type: `(${entity5.type ?? ""})`,
36163
+ name: entity3.displayName ?? entity3.name ?? "",
36164
+ type: `(${entity3.type ?? ""})`,
36173
36165
  space: spaceNames,
36174
- id: entity5._id ?? "",
36166
+ id: entity3._id ?? "",
36175
36167
  descriptionPlainText: e.descriptionPlainText,
36176
- hiddenFromGraph: entity5.hiddenFromGraph,
36177
- aliases: entity5.aliases && entity5.aliases.length ? entity5.aliases : void 0,
36168
+ hiddenFromGraph: entity3.hiddenFromGraph,
36169
+ imageId: entity3.imageId,
36170
+ aliases: entity3.aliases && entity3.aliases.length ? entity3.aliases : void 0,
36178
36171
  activityCount: e.activityCount ?? 0,
36179
36172
  lastActivityAt: e.lastActivityAt,
36180
36173
  openTasks: e.openTasks ?? []
@@ -36193,6 +36186,7 @@ function formatEntityList(entities, spaces) {
36193
36186
  const parts = [];
36194
36187
  if (r.descriptionPlainText) parts.push(`description: ${truncate(r.descriptionPlainText, 120)}`);
36195
36188
  if (r.hiddenFromGraph) parts.push("hidden from graph");
36189
+ if (r.imageId) parts.push(`image: ${r.imageId}`);
36196
36190
  if (r.aliases) parts.push(`aka: ${r.aliases.join(", ")}`);
36197
36191
  if (r.activityCount > 0) parts.push(`${r.activityCount} activities`);
36198
36192
  if (r.lastActivityAt) parts.push(`last: ${formatRelativeDate(r.lastActivityAt)}`);
@@ -36212,6 +36206,7 @@ function formatEntityDetail(data) {
36212
36206
  if (data.aggregationMode === "directOnly")
36213
36207
  lines.push("Aggregation: direct only (more than 20 active direct children)");
36214
36208
  if (e.hiddenFromGraph) lines.push("Graph: hidden");
36209
+ if (e.imageId) lines.push(`Image: ${e.imageId}`);
36215
36210
  if (e.aliases && e.aliases.length) lines.push(`Aliases: ${e.aliases.join(", ")}`);
36216
36211
  if (e.tags && e.tags.length) lines.push(`Tags: ${e.tags.join(", ")}`);
36217
36212
  for (const field of e.fields ?? []) lines.push(` ${field.label} (${field.type}): ${field.value} [${field.valueId}]`);
@@ -36253,7 +36248,7 @@ function formatPinsList(pins) {
36253
36248
  return `${parentLabel} (${p.type ?? ""}) ${p.entityId ?? ""}`.trim();
36254
36249
  }).join("\n");
36255
36250
  }
36256
- function formatTaskList(tasks2, _users) {
36251
+ function formatTaskList(tasks2) {
36257
36252
  if (tasks2.length === 0) return "No tasks found.";
36258
36253
  const rows = tasks2.map((t) => {
36259
36254
  const a = t.activity ?? {};
@@ -36326,10 +36321,10 @@ function formatActivityDetail(a) {
36326
36321
  }
36327
36322
  if (a.attachments?.length) {
36328
36323
  lines.push("Attachments:");
36329
- for (const attachment4 of a.attachments) {
36330
- const size = attachment4.sizeBytes > 0 ? `, ${(attachment4.sizeBytes / 1024).toFixed(1)} KB` : "";
36331
- lines.push(` ${attachment4.name} (${attachment4.mimeType}${size})`);
36332
- if (attachment4.url) lines.push(` ${attachment4.url}`);
36324
+ for (const attachment3 of a.attachments) {
36325
+ const size = attachment3.sizeBytes > 0 ? `, ${(attachment3.sizeBytes / 1024).toFixed(1)} KB` : "";
36326
+ lines.push(` ${attachment3.name} (${attachment3.mimeType}${size})`);
36327
+ if (attachment3.url) lines.push(` ${attachment3.url}`);
36333
36328
  }
36334
36329
  }
36335
36330
  if (a.contentPlainText) {
@@ -36354,11 +36349,11 @@ function formatActivityDetail(a) {
36354
36349
  if (a.messages?.length) {
36355
36350
  lines.push("");
36356
36351
  lines.push(`Messages (${a.messages.length}):`);
36357
- for (const message4 of a.messages) {
36358
- const indent = " ".repeat(message4.depth ?? 0);
36359
- const author = message4.createdByUser?.name || message4.createdByUser?.email || message4.createdBy;
36360
- const contentLines = message4.contentPlainText.split("\n");
36361
- const replyTarget = message4.parentMessageId ? ` [reply to ${message4.parentMessageId}]` : "";
36352
+ for (const message3 of a.messages) {
36353
+ const indent = " ".repeat(message3.depth ?? 0);
36354
+ const author = message3.createdByUser?.name || message3.createdByUser?.email || message3.createdBy;
36355
+ const contentLines = message3.contentPlainText.split("\n");
36356
+ const replyTarget = message3.parentMessageId ? ` [reply to ${message3.parentMessageId}]` : "";
36362
36357
  lines.push(`${indent}${author}: ${contentLines[0] ?? ""}${replyTarget}`);
36363
36358
  for (const contentLine of contentLines.slice(1))
36364
36359
  lines.push(`${indent} ${contentLine}`);
@@ -36413,16 +36408,15 @@ function looksLikeConvexId(value) {
36413
36408
  }
36414
36409
  async function resolveEntity(client, nameOrId) {
36415
36410
  if (looksLikeConvexId(nameOrId)) return nameOrId;
36416
- const res = await client.listEntities({ q: nameOrId, limit: "10" });
36417
- const matches = res.data?.entities ?? [];
36418
- return resolveEntityCandidate(matches.map(({ entity: entity5 }) => entity5), nameOrId);
36411
+ const { data } = await client.entityRead("searchEntities", { query: nameOrId, limit: 10, projection: "full" });
36412
+ return resolveEntityCandidate(data.entities.map(({ entity: entity3 }) => entity3), nameOrId);
36419
36413
  }
36420
36414
  async function resolveSpaceByName(client, nameOrId) {
36421
36415
  if (looksLikeConvexId(nameOrId)) return nameOrId;
36422
36416
  const spaces = await client.listSpaces();
36423
36417
  const lower = nameOrId.toLowerCase();
36424
- for (const [spaceId2, space3] of Object.entries(spaces)) {
36425
- if ((space3.spaceName ?? "").toLowerCase() === lower) return spaceId2;
36418
+ for (const [spaceId2, space2] of Object.entries(spaces)) {
36419
+ if ((space2.spaceName ?? "").toLowerCase() === lower) return spaceId2;
36426
36420
  }
36427
36421
  const partial2 = Object.entries(spaces).filter(
36428
36422
  ([, s]) => (s.spaceName ?? "").toLowerCase().includes(lower)
@@ -36443,6 +36437,7 @@ Use the full space ID to be specific.`
36443
36437
  var VALID_SORT = /* @__PURE__ */ new Set(["deadline", "created"]);
36444
36438
  var MAX_PAGINATED_ITEMS = 1e4;
36445
36439
  var MAX_PAGES = 50;
36440
+ var MAX_ENTITY_LIST_PAGES = 1e3;
36446
36441
  var ProfileCommand = class extends BaseCommand {
36447
36442
  profile = options_exports.String("--profile", {
36448
36443
  description: "Use a named credential profile (or set ENTE_PROFILE)"
@@ -36480,20 +36475,45 @@ ${footer}` : body;
36480
36475
  if (separator < 1 || opts.query !== void 0) throw new Error("Use --field label=value without --query");
36481
36476
  field = { label: opts.field.slice(0, separator), value: opts.field.slice(separator + 1) };
36482
36477
  }
36483
- const request = opts.query !== void 0 && !opts.archived ? parseEntityReadRequest("searchEntities", { query: opts.query, limit: opts.limit, projection: opts.projection }) : parseEntityReadRequest("listEntities", { field, limit: opts.limit, archived: opts.archived, projection: opts.projection });
36478
+ const search = opts.query !== void 0 && !opts.archived;
36479
+ if (search && (opts.cursor !== void 0 || opts.all)) throw new Error("--cursor and --all page entity lists; remove --query");
36480
+ if (field && (opts.cursor !== void 0 || opts.all)) throw new Error("Field lookups return one bounded page; remove --cursor and --all");
36481
+ if (opts.all && opts.cursor !== void 0) throw new Error("Use either --all or --cursor");
36482
+ const request = search ? parseEntityReadRequest("searchEntities", { query: opts.query, limit: opts.limit, projection: opts.projection }) : parseEntityReadRequest("listEntities", { field, type: opts.typeFilter, cursor: opts.cursor, limit: opts.limit, archived: opts.archived, projection: opts.projection });
36484
36483
  if (opts.space !== void 0 && !opts.space.trim())
36485
36484
  throw new OperationInputError(request.operation, [{ path: ["spaceId"], reason: "too_small" }]);
36486
36485
  const client = this.client();
36487
36486
  const spaceId2 = opts.space ? await resolveSpaceByName(client, opts.space) : void 0;
36488
- const res = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
36489
- const data = res.data;
36490
- let entities = data.entities ?? [];
36491
- const spaces = data.spaces ?? {};
36492
- if (opts.typeFilter) entities = entities.filter((e) => e.entity.type === opts.typeFilter);
36493
- this.emitText(
36494
- jsonWithSpaces({ data: { ...data, entities } }, spaces),
36495
- () => this.withFooter(formatEntityList(entities, spaces), spaces)
36496
- );
36487
+ if (request.operation === "searchEntities") {
36488
+ const { data: data2 } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
36489
+ const entities = opts.typeFilter ? data2.entities.filter((e) => e.entity.type === opts.typeFilter) : data2.entities;
36490
+ this.emitText(jsonWithSpaces({ data: { ...data2, entities } }, data2.spaces), () => this.withFooter(formatEntityList(entities, data2.spaces), data2.spaces));
36491
+ return;
36492
+ }
36493
+ let { data } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
36494
+ if (opts.all) {
36495
+ const entities = [...data.entities];
36496
+ const spaces2 = { ...data.spaces };
36497
+ let openTasksPartial = data.openTasksPartial === true;
36498
+ const seen = /* @__PURE__ */ new Set();
36499
+ for (let pages2 = 1; data.hasMore; pages2++) {
36500
+ const cursor2 = data.nextCursor;
36501
+ if (cursor2 === void 0 || seen.has(cursor2) || pages2 >= MAX_ENTITY_LIST_PAGES)
36502
+ throw new Error("Entity list paging did not advance; rerun with --cursor from the last page");
36503
+ seen.add(cursor2);
36504
+ ({ data } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2, cursor: cursor2 }));
36505
+ entities.push(...data.entities);
36506
+ Object.assign(spaces2, data.spaces);
36507
+ openTasksPartial ||= data.openTasksPartial === true;
36508
+ }
36509
+ data = { ...data, entities, spaces: spaces2, hasMore: false, ...openTasksPartial ? { openTasksPartial } : {} };
36510
+ }
36511
+ const spaces = data.spaces;
36512
+ this.emitText(jsonWithSpaces({ data }, spaces), () => {
36513
+ const body = this.withFooter(formatEntityList(data.entities, spaces), spaces);
36514
+ return data.nextCursor ? `${body}
36515
+ More entities: add --cursor ${data.nextCursor} (or use --all)` : body;
36516
+ });
36497
36517
  }
36498
36518
  // --- shared: activity list (used by `activity list` and `tasks`) --------
36499
36519
  async runActivityList(opts) {
@@ -36529,11 +36549,11 @@ ${footer}` : body;
36529
36549
  const res = await client2.listTasks(params);
36530
36550
  let tasks2 = res.data ?? [];
36531
36551
  if (opts.limit) tasks2 = tasks2.slice(0, opts.limit);
36532
- this.emitText(jsonWithSpaces({ ...res, data: tasks2 }, spaces2), () => this.withFooter(formatTaskList(tasks2, res.users ?? {}), spaces2));
36552
+ this.emitText(jsonWithSpaces({ ...res, data: tasks2 }, spaces2), () => this.withFooter(formatTaskList(tasks2), spaces2));
36533
36553
  } else {
36534
36554
  for (const [key, value] of Object.entries(request.input)) if (key !== "field" && key !== "projection" && value !== void 0) params[key] = String(value);
36535
36555
  const res = await client2.listActivities(params);
36536
- this.emitText(jsonWithSpaces(res, spaces2), () => this.withFooter(formatActivityList(res.data ?? []), spaces2));
36556
+ this.emitText(jsonWithSpaces({ data: res.data.activities, hasMore: res.data.hasMore }, spaces2), () => this.withFooter(formatActivityList(res.data.activities), spaces2));
36537
36557
  }
36538
36558
  return;
36539
36559
  }
@@ -36572,8 +36592,7 @@ ${footer}` : body;
36572
36592
  if (entityId2) params.entityId = entityId2;
36573
36593
  applyAssignee(params, opts.assignee);
36574
36594
  const res = await client.listTasks(params);
36575
- let tasks2 = res.data ?? [];
36576
- const users = res.users ?? {};
36595
+ let tasks2 = res.data;
36577
36596
  if (opts.hours) {
36578
36597
  const cutoff = Date.now() - opts.hours * 36e5;
36579
36598
  tasks2 = tasks2.filter((t) => (t.activity?.createdAt ?? 0) >= cutoff);
@@ -36587,8 +36606,8 @@ ${footer}` : body;
36587
36606
  }
36588
36607
  if (opts.limit) tasks2 = tasks2.slice(0, opts.limit);
36589
36608
  this.emitText(
36590
- jsonWithSpaces({ data: tasks2, users }, spaces),
36591
- () => this.withFooter(formatTaskList(tasks2, users), spaces)
36609
+ jsonWithSpaces({ data: tasks2 }, spaces),
36610
+ () => this.withFooter(formatTaskList(tasks2), spaces)
36592
36611
  );
36593
36612
  return;
36594
36613
  }
@@ -36605,13 +36624,13 @@ ${footer}` : body;
36605
36624
  let pages2 = 0;
36606
36625
  let hitCap = false;
36607
36626
  for (; ; ) {
36608
- const page3 = { limit: "10" };
36609
- if (entityId2) page3.entityId = entityId2;
36610
- if (opaqueCursor !== void 0) page3.cursor = opaqueCursor;
36611
- else if (cursorBefore !== void 0) page3.before = String(cursorBefore);
36612
- if (opts.after !== void 0) page3.after = String(opts.after);
36613
- const res = await client.listActivities(page3);
36614
- let pageData = res.data ?? [];
36627
+ const page2 = { limit: "10" };
36628
+ if (entityId2) page2.entityId = entityId2;
36629
+ if (opaqueCursor !== void 0) page2.cursor = opaqueCursor;
36630
+ else if (cursorBefore !== void 0) page2.before = String(cursorBefore);
36631
+ if (opts.after !== void 0) page2.after = String(opts.after);
36632
+ const res = await client.listActivities(page2);
36633
+ let pageData = res.data.activities;
36615
36634
  if (hoursCutoff) {
36616
36635
  const filtered = pageData.filter((a) => (a.createdAt ?? 0) >= hoursCutoff);
36617
36636
  if (filtered.length < pageData.length) {
@@ -36622,12 +36641,12 @@ ${footer}` : body;
36622
36641
  }
36623
36642
  activities.push(...pageData);
36624
36643
  pages2 += 1;
36625
- if (!res.hasMore || pageData.length === 0) break;
36644
+ if (!res.data.hasMore || pageData.length === 0) break;
36626
36645
  if (activities.length >= MAX_PAGINATED_ITEMS || pages2 >= MAX_PAGES) {
36627
36646
  hitCap = true;
36628
36647
  break;
36629
36648
  }
36630
- if (res.nextCursor) opaqueCursor = res.nextCursor;
36649
+ if (res.data.nextCursor) opaqueCursor = res.data.nextCursor;
36631
36650
  else cursorBefore = pageData[pageData.length - 1].createdAt;
36632
36651
  }
36633
36652
  if (hitCap) {
@@ -36643,13 +36662,13 @@ ${footer}` : body;
36643
36662
  if (opts.before !== void 0) params.before = String(opts.before);
36644
36663
  if (opts.after !== void 0) params.after = String(opts.after);
36645
36664
  if (opts.cursor !== void 0) params.cursor = opts.cursor;
36646
- if (opts.compact) params.compact = "true";
36665
+ if (opts.compact) params.projection = "compact";
36647
36666
  if (opts.minCount !== void 0) params.minCount = String(opts.minCount);
36648
36667
  const res = await client.listActivities(params);
36649
- activities = res.data ?? [];
36650
- serverHasMore = res.hasMore;
36651
- nextCursor = res.nextCursor;
36652
- projection3 = res.projection;
36668
+ activities = res.data.activities;
36669
+ serverHasMore = res.data.hasMore;
36670
+ nextCursor = res.data.nextCursor;
36671
+ if (res.data.projection === "compact") projection3 = res.data.projection;
36653
36672
  }
36654
36673
  if (opts.typeFilter) activities = activities.filter((a) => a.type === opts.typeFilter);
36655
36674
  if (opts.onlyOpen) activities = activities.filter((a) => !a.completed);
@@ -36788,24 +36807,24 @@ function instantiateDefaultLogger(options) {
36788
36807
  function instantiateNoopLogger(options) {
36789
36808
  return new DefaultLogger(options);
36790
36809
  }
36791
- function logForFunction(logger, type, source2, udfPath, message4) {
36810
+ function logForFunction(logger, type, source2, udfPath, message3) {
36792
36811
  const prefix = prefix_for_source(source2);
36793
- if (typeof message4 === "object") {
36794
- message4 = `ConvexError ${JSON.stringify(message4.errorData, null, 2)}`;
36812
+ if (typeof message3 === "object") {
36813
+ message3 = `ConvexError ${JSON.stringify(message3.errorData, null, 2)}`;
36795
36814
  }
36796
36815
  if (type === "info") {
36797
- const match = message4.match(/^\[.*?\] /);
36816
+ const match = message3.match(/^\[.*?\] /);
36798
36817
  if (match === null) {
36799
36818
  logger.error(
36800
36819
  `[CONVEX ${prefix}(${udfPath})] Could not parse console.log`
36801
36820
  );
36802
36821
  return;
36803
36822
  }
36804
- const level = message4.slice(1, match[0].length - 2);
36805
- const args = message4.slice(match[0].length);
36823
+ const level = message3.slice(1, match[0].length - 2);
36824
+ const args = message3.slice(match[0].length);
36806
36825
  logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
36807
36826
  } else {
36808
- logger.error(`[CONVEX ${prefix}(${udfPath})] ${message4}`);
36827
+ logger.error(`[CONVEX ${prefix}(${udfPath})] ${message3}`);
36809
36828
  }
36810
36829
  }
36811
36830
 
@@ -38504,11 +38523,11 @@ var require_receiver = __commonJS2({
38504
38523
  * @return {(Error|RangeError)} The error
38505
38524
  * @private
38506
38525
  */
38507
- createError(ErrorCtor, message4, prefix, statusCode, errorCode) {
38526
+ createError(ErrorCtor, message3, prefix, statusCode, errorCode) {
38508
38527
  this._loop = false;
38509
38528
  this._errored = true;
38510
38529
  const err = new ErrorCtor(
38511
- prefix ? `Invalid WebSocket frame: ${message4}` : message4
38530
+ prefix ? `Invalid WebSocket frame: ${message3}` : message3
38512
38531
  );
38513
38532
  Error.captureStackTrace(err, this.createError);
38514
38533
  err.code = errorCode;
@@ -39170,10 +39189,10 @@ var require_event_target = __commonJS2({
39170
39189
  callListener(handler, this, event);
39171
39190
  };
39172
39191
  } else if (type === "close") {
39173
- wrapper = function onClose(code3, message4) {
39192
+ wrapper = function onClose(code3, message3) {
39174
39193
  const event = new CloseEvent("close", {
39175
39194
  code: code3,
39176
- reason: message4.toString(),
39195
+ reason: message3.toString(),
39177
39196
  wasClean: this._closeFrameReceived && this._closeFrameSent
39178
39197
  });
39179
39198
  event[kTarget] = this;
@@ -40088,29 +40107,29 @@ var require_websocket = __commonJS2({
40088
40107
  const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
40089
40108
  if (secWebSocketExtensions !== void 0) {
40090
40109
  if (!perMessageDeflate) {
40091
- const message4 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
40092
- abortHandshake(websocket, socket, message4);
40110
+ const message3 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
40111
+ abortHandshake(websocket, socket, message3);
40093
40112
  return;
40094
40113
  }
40095
40114
  let extensions;
40096
40115
  try {
40097
40116
  extensions = parse4(secWebSocketExtensions);
40098
40117
  } catch (err) {
40099
- const message4 = "Invalid Sec-WebSocket-Extensions header";
40100
- abortHandshake(websocket, socket, message4);
40118
+ const message3 = "Invalid Sec-WebSocket-Extensions header";
40119
+ abortHandshake(websocket, socket, message3);
40101
40120
  return;
40102
40121
  }
40103
40122
  const extensionNames = Object.keys(extensions);
40104
40123
  if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
40105
- const message4 = "Server indicated an extension that was not requested";
40106
- abortHandshake(websocket, socket, message4);
40124
+ const message3 = "Server indicated an extension that was not requested";
40125
+ abortHandshake(websocket, socket, message3);
40107
40126
  return;
40108
40127
  }
40109
40128
  try {
40110
40129
  perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
40111
40130
  } catch (err) {
40112
- const message4 = "Invalid Sec-WebSocket-Extensions header";
40113
- abortHandshake(websocket, socket, message4);
40131
+ const message3 = "Invalid Sec-WebSocket-Extensions header";
40132
+ abortHandshake(websocket, socket, message3);
40114
40133
  return;
40115
40134
  }
40116
40135
  websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
@@ -40147,9 +40166,9 @@ var require_websocket = __commonJS2({
40147
40166
  }
40148
40167
  return tls.connect(options);
40149
40168
  }
40150
- function abortHandshake(websocket, stream, message4) {
40169
+ function abortHandshake(websocket, stream, message3) {
40151
40170
  websocket._readyState = WebSocket2.CLOSING;
40152
- const err = new Error(message4);
40171
+ const err = new Error(message3);
40153
40172
  Error.captureStackTrace(err, abortHandshake);
40154
40173
  if (stream.setHeader) {
40155
40174
  stream[kAborted] = true;
@@ -40311,7 +40330,7 @@ var require_stream = __commonJS2({
40311
40330
  objectMode: false,
40312
40331
  writableObjectMode: false
40313
40332
  });
40314
- ws.on("message", function message4(msg, isBinary) {
40333
+ ws.on("message", function message3(msg, isBinary) {
40315
40334
  const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
40316
40335
  if (!duplex.push(data)) ws.pause();
40317
40336
  });
@@ -40630,23 +40649,23 @@ var require_websocket_server = __commonJS2({
40630
40649
  const upgrade = req.headers.upgrade;
40631
40650
  const version5 = +req.headers["sec-websocket-version"];
40632
40651
  if (req.method !== "GET") {
40633
- const message4 = "Invalid HTTP method";
40634
- abortHandshakeOrEmitwsClientError(this, req, socket, 405, message4);
40652
+ const message3 = "Invalid HTTP method";
40653
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message3);
40635
40654
  return;
40636
40655
  }
40637
40656
  if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
40638
- const message4 = "Invalid Upgrade header";
40639
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40657
+ const message3 = "Invalid Upgrade header";
40658
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40640
40659
  return;
40641
40660
  }
40642
40661
  if (key === void 0 || !keyRegex.test(key)) {
40643
- const message4 = "Missing or invalid Sec-WebSocket-Key header";
40644
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40662
+ const message3 = "Missing or invalid Sec-WebSocket-Key header";
40663
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40645
40664
  return;
40646
40665
  }
40647
40666
  if (version5 !== 13 && version5 !== 8) {
40648
- const message4 = "Missing or invalid Sec-WebSocket-Version header";
40649
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4, {
40667
+ const message3 = "Missing or invalid Sec-WebSocket-Version header";
40668
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3, {
40650
40669
  "Sec-WebSocket-Version": "13, 8"
40651
40670
  });
40652
40671
  return;
@@ -40661,8 +40680,8 @@ var require_websocket_server = __commonJS2({
40661
40680
  try {
40662
40681
  protocols = subprotocol2.parse(secWebSocketProtocol);
40663
40682
  } catch (err) {
40664
- const message4 = "Invalid Sec-WebSocket-Protocol header";
40665
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40683
+ const message3 = "Invalid Sec-WebSocket-Protocol header";
40684
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40666
40685
  return;
40667
40686
  }
40668
40687
  }
@@ -40681,8 +40700,8 @@ var require_websocket_server = __commonJS2({
40681
40700
  extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
40682
40701
  }
40683
40702
  } catch (err) {
40684
- const message4 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
40685
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, message4);
40703
+ const message3 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
40704
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
40686
40705
  return;
40687
40706
  }
40688
40707
  }
@@ -40693,9 +40712,9 @@ var require_websocket_server = __commonJS2({
40693
40712
  req
40694
40713
  };
40695
40714
  if (this.options.verifyClient.length === 2) {
40696
- this.options.verifyClient(info, (verified, code3, message4, headers) => {
40715
+ this.options.verifyClient(info, (verified, code3, message3, headers) => {
40697
40716
  if (!verified) {
40698
- return abortHandshake(socket, code3 || 401, message4, headers);
40717
+ return abortHandshake(socket, code3 || 401, message3, headers);
40699
40718
  }
40700
40719
  this.completeUpgrade(
40701
40720
  extensions,
@@ -40795,27 +40814,27 @@ var require_websocket_server = __commonJS2({
40795
40814
  function socketOnError() {
40796
40815
  this.destroy();
40797
40816
  }
40798
- function abortHandshake(socket, code3, message4, headers) {
40799
- message4 = message4 || http.STATUS_CODES[code3];
40817
+ function abortHandshake(socket, code3, message3, headers) {
40818
+ message3 = message3 || http.STATUS_CODES[code3];
40800
40819
  headers = {
40801
40820
  Connection: "close",
40802
40821
  "Content-Type": "text/html",
40803
- "Content-Length": Buffer.byteLength(message4),
40822
+ "Content-Length": Buffer.byteLength(message3),
40804
40823
  ...headers
40805
40824
  };
40806
40825
  socket.once("finish", socket.destroy);
40807
40826
  socket.end(
40808
40827
  `HTTP/1.1 ${code3} ${http.STATUS_CODES[code3]}\r
40809
- ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message4
40828
+ ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message3
40810
40829
  );
40811
40830
  }
40812
- function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message4, headers) {
40831
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message3, headers) {
40813
40832
  if (server.listenerCount("wsClientError")) {
40814
- const err = new Error(message4);
40833
+ const err = new Error(message3);
40815
40834
  Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
40816
40835
  server.emit("wsClientError", err, socket, req);
40817
40836
  } else {
40818
- abortHandshake(socket, code3, message4, headers);
40837
+ abortHandshake(socket, code3, message3, headers);
40819
40838
  }
40820
40839
  }
40821
40840
  }
@@ -41357,9 +41376,9 @@ function isAuthError(err, structuredOnly = false) {
41357
41376
  if (structuredOnly) return false;
41358
41377
  return /\b(401|403|unauthenticated|unauthorized|not authenticated)\b/i.test(msg);
41359
41378
  }
41360
- function convexHttpErrorCode(message4) {
41379
+ function convexHttpErrorCode(message3) {
41361
41380
  try {
41362
- const body = JSON.parse(message4);
41381
+ const body = JSON.parse(message3);
41363
41382
  return body && typeof body === "object" && "code" in body && typeof body.code === "string" ? body.code : null;
41364
41383
  } catch {
41365
41384
  return null;
@@ -41482,9 +41501,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
41482
41501
  const creds = allowAgentReads && selected ? void 0 : loadPlatformCredentials();
41483
41502
  if (!creds) {
41484
41503
  if (!allowAgentReads) throw new Error("These admin commands need a platform key. Agent Platform access covers tables, get and page only.");
41485
- const agent3 = await resolveCaller();
41504
+ const agent2 = await resolveCaller();
41486
41505
  return {
41487
- ...agent3,
41506
+ ...agent2,
41488
41507
  query: async (reference, args) => {
41489
41508
  const { getFunctionName: getFunctionName3 } = await Promise.resolve().then(() => (init_server(), server_exports));
41490
41509
  const name4 = getFunctionName3(reference);
@@ -41492,9 +41511,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
41492
41511
  if (!name4.startsWith("admin/inspect:") || !["tables", "get", "page"].includes(operation)) {
41493
41512
  throw new Error("Agent Platform access covers admin tables, get and page only");
41494
41513
  }
41495
- if (operation === "tables") return agent3.mutation(makeFunctionReference("admin/inspect:agentTables"), {});
41496
- if (operation === "get") return agent3.mutation(makeFunctionReference("admin/inspect:agentGet"), args);
41497
- return agent3.mutation(makeFunctionReference("admin/inspect:agentPage"), args);
41514
+ if (operation === "tables") return agent2.mutation(makeFunctionReference("admin/inspect:agentTables"), {});
41515
+ if (operation === "get") return agent2.mutation(makeFunctionReference("admin/inspect:agentGet"), args);
41516
+ return agent2.mutation(makeFunctionReference("admin/inspect:agentPage"), args);
41498
41517
  }
41499
41518
  };
41500
41519
  }
@@ -41595,6 +41614,7 @@ var activityFieldReadInput = v2.union(
41595
41614
  v2.object({ command: v2.literal("previewCopy"), ...copySelector })
41596
41615
  );
41597
41616
  var activityFieldConfigureInput = v2.union(
41617
+ v2.object({ command: v2.literal("setCardVisibility"), spaceId: v2.string(), activityType: v2.literal("task"), fieldId: v2.string(), shown: v2.boolean() }),
41598
41618
  v2.object({ command: v2.literal("create"), spaceId: v2.string(), label: v2.string(), type: activityFieldTypeValidator, options: v2.optional(v2.array(activityFieldOptionValidator)) }),
41599
41619
  v2.object({ command: v2.literal("setLayout"), ...selector, fieldIds: v2.array(v2.string()), hiddenFieldIds: v2.array(v2.string()), listFieldIds: v2.array(v2.string()), perFieldLine: v2.optional(v2.boolean()) }),
41600
41620
  v2.object({ command: v2.literal("copyLayout"), ...copySelector, sourceFingerprint: v2.string(), targetFingerprint: v2.string(), confirmOverwrite: v2.boolean() })
@@ -41606,11 +41626,11 @@ var activityFieldReadResult = v2.union(
41606
41626
  v2.object({ command: v2.literal("previewCopy"), sourceFingerprint: v2.string(), targetFingerprint: v2.string(), requiresConfirmation: v2.boolean(), conflicts: v2.array(conflict) })
41607
41627
  );
41608
41628
  var activityFieldConfigureResult = v2.union(
41629
+ v2.object({ command: v2.literal("setCardVisibility") }),
41609
41630
  v2.object({ command: v2.literal("create"), fieldId: v2.id("fields") }),
41610
41631
  v2.object({ command: v2.literal("setLayout") }),
41611
41632
  v2.object({ command: v2.literal("copyLayout"), copied: v2.number(), conflicts: v2.array(conflict) })
41612
41633
  );
41613
- var activityFieldAliases = { activity_fields_get: "getActivityFields", activity_fields_configure: "configureActivityFields" };
41614
41634
  function parseActivityFieldRequest(name4, validator, raw) {
41615
41635
  if (!validate2(validator, raw)) throw new OperationInputError(name4, [{ path: [], reason: "custom" }]);
41616
41636
  return raw;
@@ -41620,10 +41640,10 @@ function definition3(name4) {
41620
41640
  const resultSchema3 = operationResultSchema(read ? activityFieldReadResult : activityFieldConfigureResult);
41621
41641
  return {
41622
41642
  name: name4,
41623
- aliases: [...operationAliases(activityFieldAliases, name4), { name: read ? "ente_activity_fields_get" : "ente_activity_fields_configure", profile: "mounted-view" }],
41643
+ aliases: [{ name: read ? "ente_activity_fields_get" : "ente_activity_fields_configure", profile: "mounted-view" }],
41624
41644
  actor: "agent",
41625
41645
  title: read ? "Read activity fields and layouts" : "Configure activity fields and layouts",
41626
- description: read ? "Read space activity definitions and the ordered field layout for one activity type, or preview copying a layout. Hidden fields retain their values. Requires generic read scope; task-only credentials are excluded." : "Create an empty typed activity field, replace a per-space/activity-type field layout (fieldIds order; hiddenFieldIds controls editor visibility; listFieldIds enables list previews in fieldIds order; perFieldLine opts into one field per line, default false), or copy a reviewed layout with exact source/target fingerprints. Hidden fields retain values and stay readable by API. Requires generic write scope and space owner/admin; Personal requires its owner. Task-only credentials are excluded. Copy fails if either reviewed layout changed; confirmOverwrite is required for an existing destination.",
41646
+ description: read ? "Get activity definitions/layout or preview copy. Generic read scope and membership required; excludes task-only keys." : "Owner/admin with generic write scope required (Personal: owner); excludes task-only keys. Create field; setLayout orders pins, hides editor fields, lists card fields; perFieldLine defaults false. Task card fields may be unpinned. setCardVisibility changes only card visibility. Hidden values remain readable. Copy requires unchanged fingerprints and confirmOverwrite for existing layout.",
41627
41647
  inputSchema: operationInputObjectSchema(operationResultSchema(read ? activityFieldReadInput : activityFieldConfigureInput)),
41628
41648
  resultSchema: resultSchema3,
41629
41649
  outputSchema: operationDataOutputSchema(resultSchema3),
@@ -41681,7 +41701,7 @@ var ActivityFieldsGet = class extends ProfileCommand {
41681
41701
  };
41682
41702
  var ActivityFieldsConfigure = class extends ProfileCommand {
41683
41703
  static paths = [["activity", "fields", "configure"]];
41684
- static usage = Command.Usage({ category: "Activity", description: "Create definitions, replace layouts, or copy a reviewed layout using exact JSON input" });
41704
+ static usage = Command.Usage({ category: "Activity", description: "Create definitions, toggle task card fields, replace layouts, or copy a reviewed layout using exact JSON input" });
41685
41705
  space = options_exports.String("--space");
41686
41706
  input = options_exports.String("--input", { required: true });
41687
41707
  async run() {
@@ -41715,7 +41735,7 @@ var ActivityFieldsLayout = class extends ProfileCommand {
41715
41735
  return matches[0].fieldId;
41716
41736
  };
41717
41737
  const fieldIds = this.fields.map(resolve2), hiddenFieldIds = this.hidden.map(resolve2), listFieldIds = this.listed.map(resolve2);
41718
- for (const hidden of [...hiddenFieldIds, ...listFieldIds]) if (!fieldIds.includes(hidden)) fieldIds.push(hidden);
41738
+ for (const hidden of [...hiddenFieldIds, ...this.activityType === "task" ? [] : listFieldIds]) if (!fieldIds.includes(hidden)) fieldIds.push(hidden);
41719
41739
  const input2 = parseActivityFieldRequest("configureActivityFields", activityFieldConfigureInput, { command: "setLayout", spaceId: spaceId2, activityType: this.activityType, fieldIds, hiddenFieldIds, listFieldIds, perFieldLine: this.perFieldLine });
41720
41740
  const data = parseOperationResult("configureActivityFields", activityFieldConfigureResult, await caller.mutation(activityFieldConfigure, { input: input2 }));
41721
41741
  this.emitText({ data }, () => JSON.stringify(data, null, 2));
@@ -41988,20 +42008,20 @@ var AgentPermissions = class extends ClientCommand {
41988
42008
  if (this.check !== void 0) {
41989
42009
  const query = this.check.trim();
41990
42010
  if (!query) throw new Error("--check requires a non-empty space name or ID");
41991
- const matches = permissions.filter((space4) => space4.spaceId === query || space4.name.toLocaleLowerCase() === query.toLocaleLowerCase());
42011
+ const matches = permissions.filter((space3) => space3.spaceId === query || space3.name.toLocaleLowerCase() === query.toLocaleLowerCase());
41992
42012
  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.`);
41993
- const space3 = matches[0];
41994
- const allowed = this.action === "write" ? space3.canWrite : space3.canRead;
41995
- 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.`;
41996
- this.emitText({ ...selection2, allowed, action: this.action, ...space3, message: message4 }, () => message4);
42013
+ const space2 = matches[0];
42014
+ const allowed = this.action === "write" ? space2.canWrite : space2.canRead;
42015
+ const message3 = allowed ? `${this.action} allowed in '${space2.name}' for agent '${identity2.name}'.` : `${this.action} denied in '${space2.name}' for agent '${identity2.name}' (effective access: ${space2.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.`;
42016
+ this.emitText({ ...selection2, allowed, action: this.action, ...space2, message: message3 }, () => message3);
41997
42017
  return allowed ? 0 : 1;
41998
42018
  }
41999
- this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((space3) => ({
42000
- Space: space3.name,
42001
- ID: space3.spaceId,
42002
- "Agent actions": space3.access,
42003
- Read: space3.canRead ? "yes" : "no",
42004
- Write: space3.canWrite ? "yes" : "no",
42019
+ this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((space2) => ({
42020
+ Space: space2.name,
42021
+ ID: space2.spaceId,
42022
+ "Agent actions": space2.access,
42023
+ Read: space2.canRead ? "yes" : "no",
42024
+ Write: space2.canWrite ? "yes" : "no",
42005
42025
  "Panel access (account)": result.identity.panelAccess,
42006
42026
  "Platform access": result.identity.platformLevel ?? "none",
42007
42027
  "Platform expiry": result.identity.platformExpiresAt ? new Date(result.identity.platformExpiresAt).toISOString() : "none"
@@ -42010,6 +42030,109 @@ var AgentPermissions = class extends ClientCommand {
42010
42030
  };
42011
42031
  var IDENTITY_COMMANDS = [AuthWhoami, AgentPermissions];
42012
42032
 
42033
+ // ente/currentTask.ts
42034
+ var CURRENT_TASK_TOKEN = "@current";
42035
+ var CURRENT_TASK_ENV = "ENTE_CURRENT_TASK";
42036
+ var PLACEHOLDER = /\$\{([^}]*)\}/g;
42037
+ var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/u;
42038
+ var EXAMPLE = "t3_threads=t3code://threads/<installation>/${T3CODE_THREAD_ID}";
42039
+ function parseCurrentTaskRule(raw) {
42040
+ const rule = raw.trim();
42041
+ const split = rule.indexOf("=");
42042
+ if (split < 0) {
42043
+ if (!looksLikeConvexId2(rule)) throw new Error(`Current task rule '${rule}' is neither a task ID nor label=value (e.g. ${EXAMPLE}).`);
42044
+ return { kind: "task", activityId: rule };
42045
+ }
42046
+ const label = rule.slice(0, split).trim();
42047
+ const template = rule.slice(split + 1).trim();
42048
+ if (!label || !template) throw new Error(`A current task lookup needs label=value (e.g. ${EXAMPLE}).`);
42049
+ for (const [, name4] of template.matchAll(PLACEHOLDER)) {
42050
+ if (!VARIABLE.test(name4 ?? "")) throw new Error(`Invalid placeholder \${${name4}} in the current task rule; use \${NAME} with letters, digits and underscores.`);
42051
+ }
42052
+ if (template.replace(PLACEHOLDER, "").includes("${")) throw new Error("Unclosed ${ placeholder in the current task rule.");
42053
+ return { kind: "lookup", label, template };
42054
+ }
42055
+ function expandCurrentTaskValue(template, env = process.env) {
42056
+ const missing = [];
42057
+ const value = template.replace(PLACEHOLDER, (_, name4) => {
42058
+ const found = env[name4];
42059
+ if (!found) missing.push(name4);
42060
+ return found ?? "";
42061
+ });
42062
+ if (missing.length) {
42063
+ throw new Error(`@current: environment variable ${missing.join(", ")} is not set, so the rule '${template}' cannot identify this session. Pass the task ID instead.`);
42064
+ }
42065
+ return value;
42066
+ }
42067
+ function currentTaskSetting(env = process.env, cwd = process.cwd()) {
42068
+ const fromEnv = env[CURRENT_TASK_ENV]?.trim();
42069
+ if (fromEnv) return { rule: fromEnv, source: "env" };
42070
+ const binding = nearestBinding(ENTE_BRANDING, cwd);
42071
+ return binding?.currentTask ? { rule: binding.currentTask, source: "directory", directory: binding.path } : null;
42072
+ }
42073
+ async function resolveCurrentTask(lookup3, { env = process.env, cwd = process.cwd() } = {}) {
42074
+ const setting2 = currentTaskSetting(env, cwd);
42075
+ if (!setting2) {
42076
+ throw new Error(`${CURRENT_TASK_TOKEN} is not configured here. Pass the task ID, set ${CURRENT_TASK_ENV}, or bind a rule with 'ente auth bind <folder> <profile> --current-task <task-id | label=value>'.`);
42077
+ }
42078
+ const where = setting2.source === "env" ? CURRENT_TASK_ENV : `the binding of ${setting2.directory}`;
42079
+ let rule;
42080
+ try {
42081
+ rule = parseCurrentTaskRule(setting2.rule);
42082
+ } catch (error62) {
42083
+ throw new Error(`${where}: ${error62 instanceof Error ? error62.message : String(error62)}`);
42084
+ }
42085
+ const base = { source: setting2.source, ...setting2.directory ? { directory: setting2.directory } : {} };
42086
+ if (rule.kind === "task") return { activityId: rule.activityId, ...base };
42087
+ const field = { label: rule.label, value: expandCurrentTaskValue(rule.template, env) };
42088
+ const matches = await lookup3(field);
42089
+ if (!matches.length) {
42090
+ throw new Error(`@current: no task has ${field.label}=${field.value} (rule from ${where}). Nothing was changed; @current never creates a task.`);
42091
+ }
42092
+ const newest = matches.reduce((best, match) => match.createdAt > best.createdAt ? match : best);
42093
+ return { activityId: newest.activityId, ...base, field, matches: matches.length };
42094
+ }
42095
+ function profileFromArgv(argv) {
42096
+ for (let i = 0; i < argv.length; i++) {
42097
+ const arg = argv[i];
42098
+ if (arg === "--") return void 0;
42099
+ if (arg === "--profile") return argv[i + 1] || void 0;
42100
+ if (arg.startsWith("--profile=")) return arg.slice("--profile=".length) || void 0;
42101
+ }
42102
+ return void 0;
42103
+ }
42104
+ function isToken(arg) {
42105
+ return arg === CURRENT_TASK_TOKEN || /^--[^=]+=@current$/u.test(arg);
42106
+ }
42107
+ function usesCurrentTask(argv) {
42108
+ return argv.some(isToken);
42109
+ }
42110
+ function substituteCurrentTask(argv, activityId2) {
42111
+ return argv.map((arg) => arg === CURRENT_TASK_TOKEN ? activityId2 : isToken(arg) ? `${arg.slice(0, -CURRENT_TASK_TOKEN.length)}${activityId2}` : arg);
42112
+ }
42113
+ function restCurrentTaskLookup(client) {
42114
+ return async (field) => {
42115
+ const res = await client.listTasks({ onlyOpen: "false", field: JSON.stringify(field) });
42116
+ return (res.data ?? []).flatMap((row) => row.activity?._id ? [{ activityId: row.activity._id, createdAt: row.activity.createdAt ?? 0 }] : []);
42117
+ };
42118
+ }
42119
+ var ACTIVITY_GONE_MESSAGE = "Activity not found: it was deleted or merged into another activity, or this profile cannot access it. Look the task up again (for example with @current) instead of retrying this ID.";
42120
+ function explainActivityNotFound(error62) {
42121
+ if (!(error62 instanceof Error)) return error62;
42122
+ const status2 = error62.statusCode;
42123
+ const data = error62.data ?? error62.error;
42124
+ const code3 = data && typeof data === "object" ? data.code : void 0;
42125
+ const detail = error62.detail;
42126
+ const text4 = data && typeof data === "object" && typeof data.message === "string" ? data.message : typeof detail === "string" ? detail : error62.message;
42127
+ const match = /^Activity not found(?::\s*(\S+))?$/u.exec(text4.trim());
42128
+ if (status2 !== 404 && code3 !== "NOT_FOUND" || !match) return error62;
42129
+ const message3 = match[1] ? ACTIVITY_GONE_MESSAGE.replace("Activity not found", `Activity ${match[1]} not found`) : ACTIVITY_GONE_MESSAGE;
42130
+ return Object.assign(new Error(message3), {
42131
+ messageIsComplete: true,
42132
+ data: { ...data && typeof data === "object" ? data : {}, code: "NOT_FOUND", message: message3, ...typeof status2 === "number" ? { statusCode: status2 } : {} }
42133
+ });
42134
+ }
42135
+
42013
42136
  // ente/commands/authPair.ts
42014
42137
  import { createHash as createHash3, randomBytes, randomInt } from "node:crypto";
42015
42138
  import { existsSync as existsSync5, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "node:fs";
@@ -42293,6 +42416,12 @@ var AuthLogin = class extends BaseCommand {
42293
42416
  this.out(` Config saved to ${configPath(ENTE_BRANDING, this.profile)}`);
42294
42417
  }
42295
42418
  };
42419
+ function currentTaskStatus() {
42420
+ const setting2 = currentTaskSetting();
42421
+ if (!setting2) return null;
42422
+ const missingVariables = [...setting2.rule.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)].flatMap(([, name4]) => name4 && !process.env[name4] ? [name4] : []);
42423
+ return { rule: setting2.rule, source: setting2.source, directory: setting2.directory ?? null, missingVariables };
42424
+ }
42296
42425
  var AuthStatus = class extends BaseCommand {
42297
42426
  static paths = [["auth", "status"]];
42298
42427
  static usage = Command.Usage({
@@ -42313,11 +42442,14 @@ var AuthStatus = class extends BaseCommand {
42313
42442
  profileSource: selection2.source,
42314
42443
  boundDirectory: selection2.directory ?? null,
42315
42444
  source: credentials?.source ?? null,
42316
- url: credentials?.apiUrl ?? null
42445
+ url: credentials?.apiUrl ?? null,
42446
+ currentTask: currentTaskStatus()
42317
42447
  };
42448
+ const current = status2.currentTask ? `
42449
+ @current: ${status2.currentTask.rule} (${status2.currentTask.source})${status2.currentTask.missingVariables.length ? `; not set here: ${status2.currentTask.missingVariables.join(", ")}` : ""}` : "";
42318
42450
  this.emitText(status2, () => credentials ? `Profile: ${status2.profile} (${status2.profileSource})
42319
42451
  Source: ${status2.source}
42320
- URL: ${status2.url}
42452
+ URL: ${status2.url}${current}
42321
42453
  Credentials configured; run a read-only command to verify server access.` : `Profile '${status2.profile}' is not authenticated.
42322
42454
  Run 'ente auth bind <path> <profile>' to select an existing profile, or see https://ente.fast/cli.md for local login.`);
42323
42455
  }
@@ -42363,9 +42495,14 @@ var AuthBind = class extends BaseCommand {
42363
42495
  folder = options_exports.String({ name: "path" });
42364
42496
  profileName = options_exports.String({ name: "profile" });
42365
42497
  profile = options_exports.String("--profile", { description: "Accepted for consistency; the positional profile is bound" });
42498
+ currentTask = options_exports.String("--current-task", { description: "What @current means in this folder: a task ID, or label=value with ${VAR} placeholders (newest task whose field holds the value)" });
42499
+ clearCurrentTask = options_exports.Boolean("--clear-current-task", false, { description: "Remove the folder's @current rule" });
42366
42500
  async run() {
42367
- const binding = bindProfile(ENTE_BRANDING, this.folder, this.profileName);
42368
- this.emitText(binding, () => `Bound ${binding.path} to profile '${binding.profile}'`);
42501
+ if (this.currentTask !== void 0 && this.clearCurrentTask) throw new Error("Use either --current-task or --clear-current-task, not both.");
42502
+ if (this.currentTask !== void 0) parseCurrentTaskRule(this.currentTask);
42503
+ const binding = bindProfile(ENTE_BRANDING, this.folder, this.profileName, this.clearCurrentTask ? null : this.currentTask?.trim());
42504
+ this.emitText(binding, () => `Bound ${binding.path} to profile '${binding.profile}'${binding.currentTask ? `
42505
+ @current: ${binding.currentTask}` : ""}`);
42369
42506
  }
42370
42507
  };
42371
42508
  var AuthUnbind = class extends BaseCommand {
@@ -42384,7 +42521,7 @@ var AuthBindings = class extends BaseCommand {
42384
42521
  profile = options_exports.String("--profile", { description: "Accepted for consistency; bindings are machine-local" });
42385
42522
  async run() {
42386
42523
  const bindings = listProfileBindings(ENTE_BRANDING);
42387
- this.print(bindings, (data) => data.map((binding) => ({ Path: binding.path, Profile: binding.profile })));
42524
+ this.print(bindings, (data) => data.map((binding) => ({ Path: binding.path, Profile: binding.profile, "@current": binding.currentTask ?? "" })));
42388
42525
  }
42389
42526
  };
42390
42527
  var AuthPlatformLogin = class extends BaseCommand {
@@ -42456,22 +42593,22 @@ var AUTH_COMMANDS = [
42456
42593
  ];
42457
42594
 
42458
42595
  // ../packages/shared/src/relationship-operation-results.ts
42459
- var id15 = external_exports.string().min(1);
42460
- var relationshipSummary = external_exports.strictObject({ entityId: id15, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(), displayOrder: external_exports.number().finite().optional(), includeInAggregation: external_exports.boolean() });
42461
- var relationshipAddReceipt = external_exports.strictObject({ action: external_exports.literal("add"), pinId: id15, alreadyExists: external_exports.boolean() });
42596
+ var id16 = external_exports.string().min(1);
42597
+ var relationshipSummary = external_exports.strictObject({ entityId: id16, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(), displayOrder: external_exports.number().finite().optional(), includeInAggregation: external_exports.boolean() });
42598
+ var relationshipAddReceipt = external_exports.strictObject({ action: external_exports.literal("add"), pinId: id16, alreadyExists: external_exports.boolean() });
42462
42599
  var relationshipRemoveReceipt = external_exports.strictObject({ action: external_exports.literal("remove"), success: external_exports.literal(true) });
42463
42600
  var relationshipResults = { listPins: external_exports.array(relationshipSummary).max(RELATIONSHIP_LIMITS.rows), managePins: external_exports.discriminatedUnion("action", [relationshipAddReceipt, relationshipRemoveReceipt]) };
42464
42601
  function checkRelationshipResult(schema, raw) {
42465
42602
  return parseZodOperationResult("relationship", schema, raw, "Invalid relationship result");
42466
42603
  }
42467
- var relationshipCliSummary = external_exports.strictObject({ entityId: id15, name: external_exports.string().optional(), type: external_exports.enum(ENTITY_TYPE_VALUES).optional(), role: external_exports.string().optional() });
42604
+ var relationshipCliSummary = external_exports.strictObject({ entityId: id16, name: external_exports.string().optional(), type: external_exports.enum(ENTITY_TYPE_VALUES).optional(), role: external_exports.string().optional() });
42468
42605
  var relationshipPublicListRow = external_exports.strictObject({
42469
- _id: id15,
42470
- targetEntityId: id15,
42606
+ _id: id16,
42607
+ targetEntityId: id16,
42471
42608
  role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(),
42472
42609
  displayOrder: external_exports.number().finite().optional(),
42473
42610
  includeInAggregation: external_exports.boolean(),
42474
- targetEntity: external_exports.strictObject({ _id: id15, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), customIcon: entityReadFields.customIcon, customIconColor: entityReadFields.customIconColor, imageId: id15.optional(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) }).nullable()
42611
+ targetEntity: external_exports.strictObject({ _id: id16, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), customIcon: entityReadFields.customIcon, customIconColor: entityReadFields.customIconColor, imageId: id16.optional(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) }).nullable()
42475
42612
  });
42476
42613
  var relationshipPublicList = external_exports.array(relationshipPublicListRow).max(RELATIONSHIP_LIMITS.rows);
42477
42614
  function projectRelationshipCliList(raw) {
@@ -42502,78 +42639,6 @@ var uploadRetryInstructions = [
42502
42639
  "Use a validated storage ID only for a confirmed remaining link step; an unknown upload response may already have stored the file."
42503
42640
  ];
42504
42641
 
42505
- // ../packages/shared/src/task-read-operations.ts
42506
- var TASK_READ_LIMITS = { results: 200, children: 100, childLinks: 1e3, childSources: 400 };
42507
- var id16 = external_exports.string().min(1).max(128);
42508
- var list2 = { field: activityFieldFiltersSchema.optional(), spaceId: id16.optional(), entityId: id16.optional(), onlyOpen: external_exports.boolean().default(true), dueBy: activityWriteDeadline.optional(), assignee: external_exports.enum(["me", "meOrUnassigned", "unassigned"]).optional(), assigneeUserId: id16.optional(), assigneeEmail: external_exports.string().optional(), assigneeAgentId: id16.optional(), agentTaskDisplay: external_exports.enum(["show", "dim", "hideAgentOnly", "hideAllWithAgent"]).optional() };
42509
- var taskReadInputs = {
42510
- listTasks: external_exports.strictObject(list2),
42511
- getTaskByNumber: external_exports.strictObject({ number: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER), spaceId: id16.optional() }),
42512
- listOpenTasks: external_exports.strictObject({ spaceId: id16 }),
42513
- listTasksDueBy: external_exports.strictObject({ spaceId: id16, deadline: activityWriteDeadline, includeOverdue: external_exports.boolean().default(true) }),
42514
- listOpenTasksForEntity: external_exports.strictObject({ entityId: id16 })
42515
- };
42516
-
42517
- // ../packages/shared/src/activity-read-transport-results.ts
42518
- var attachment2 = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
42519
- var user2 = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
42520
- var agent2 = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
42521
- var agentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
42522
- var agenda2 = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
42523
- var message2 = external_exports.object({
42524
- ...publicActivityDetailDto.shape.messages.element.shape,
42525
- createdByUser: user2.nullable(),
42526
- createdByAgent: agent2.nullable().optional(),
42527
- updatedByAgent: agent2.nullable().optional()
42528
- });
42529
- var activityReadRecord = external_exports.object({
42530
- ...publicActivityReadDto.shape,
42531
- attachments: external_exports.array(attachment2).optional(),
42532
- entityIds: external_exports.array(external_exports.string()).optional(),
42533
- entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
42534
- agendaPoints: external_exports.array(agenda2).optional(),
42535
- messages: external_exports.array(message2).optional(),
42536
- createdByUser: user2.nullable().optional(),
42537
- createdViaAgent: agent2.nullable().optional(),
42538
- updatedViaAgent: agent2.nullable().optional(),
42539
- createdByPersonalAgent: external_exports.boolean().optional(),
42540
- createdByAgent: agent2.nullable().optional(),
42541
- updatedByAgent: agent2.nullable().optional(),
42542
- createdByAgentCreatorUser: agentCreator.nullable().optional(),
42543
- assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
42544
- });
42545
- 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() }) });
42546
- 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() });
42547
- 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() });
42548
- var activityReadTransportResults = { getActivity: activityReadRecord.nullable(), listActivities: page2, searchActivities: external_exports.array(activityReadRecord), listRecentActivities: page2 };
42549
- var historyFields = { hasMore: page2.shape.hasMore, nextCursor: page2.shape.nextCursor, projection: page2.shape.projection, spaces: page2.shape.spaces };
42550
- var activityMcpEnvelopes = {
42551
- getActivity: external_exports.strictObject({ data: activityReadRecord }),
42552
- listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), hasMore: external_exports.boolean() }),
42553
- searchActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord) }),
42554
- listRecentActivities: external_exports.strictObject({ activities: external_exports.array(activityReadRecord), ...historyFields })
42555
- };
42556
- var activityRestEnvelopes = {
42557
- getActivity: activityMcpEnvelopes.getActivity,
42558
- listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields }),
42559
- listRecentActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields })
42560
- };
42561
- var publicCliActivityListEnvelope = activityRestEnvelopes.listActivities.partial({ hasMore: true });
42562
-
42563
- // ../packages/shared/src/task-read-operation-results.ts
42564
- var entity2 = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
42565
- var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
42566
- var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
42567
- var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(entity2.shape)) });
42568
- var taskReadTransportItem = external_exports.strictObject({ activity: activityReadRecord.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
42569
- var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
42570
- var transportTasks = external_exports.array(taskReadTransportItem).max(TASK_READ_LIMITS.results);
42571
- var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
42572
- var taskReadTransportResults = { listTasks: transportTasks, getTaskByNumber: taskReadTransportItem.nullable(), listOpenTasks: transportTasks, listTasksDueBy: transportTasks, listOpenTasksForEntity: transportTasks };
42573
- var user3 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
42574
- var taskReadEnrichedItem = taskReadTransportItem.extend({ activity: taskReadTransportItem.shape.activity.extend({ assignees: external_exports.array(user3) }) });
42575
- var taskReadUsers = external_exports.record(external_exports.string(), user3);
42576
-
42577
42642
  // ../packages/shared/src/activity-content-operations.ts
42578
42643
  var ACTIVITY_CONTENT_LIMITS = { defaultBlocks: 20, maxBlocks: 50, defaultCharacters: 12e3, maxCharacters: 5e4, maxEditOperations: 20, maxEditCharacters: 1e5 };
42579
42644
  var safeInteger = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
@@ -42618,24 +42683,10 @@ var activityContentInputs = {
42618
42683
  readActivityContent: external_exports.strictObject({ ...readFields, maxBlocks: safeInteger.min(1).max(ACTIVITY_CONTENT_LIMITS.maxBlocks).default(ACTIVITY_CONTENT_LIMITS.defaultBlocks), maxCharacters: safeInteger.min(1).max(ACTIVITY_CONTENT_LIMITS.maxCharacters).default(ACTIVITY_CONTENT_LIMITS.defaultCharacters) }),
42619
42684
  editActivityContent: external_exports.strictObject({ activityId: readFields.activityId, expectedContentVersion: activityContentVersion, operations })
42620
42685
  };
42621
- var legacyActivityContentReadInput = external_exports.strictObject({ ...readFields, maxBlocks: safeInteger.min(1).optional(), maxCharacters: safeInteger.min(1).optional() });
42622
- var activityContentAliases = { activities_contentsRead: "readActivityContents", activities_contentRead: "readActivityContent", activities_contentEdit: "editActivityContent" };
42623
- function isActivityContentAlias(value) {
42624
- return Object.hasOwn(activityContentAliases, value);
42625
- }
42626
42686
  function parseActivityContentRequest(operation, raw) {
42627
42687
  if (operation === "readActivityContents") return { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContents, raw) };
42628
42688
  return operation === "readActivityContent" ? { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContent, raw) } : { operation, input: parseOperationInput(operation, activityContentInputs.editActivityContent, raw) };
42629
42689
  }
42630
- function parseLegacyActivityContentRequest(name4, raw) {
42631
- const operation = isActivityContentAlias(name4) ? activityContentAliases[name4] : name4;
42632
- if (operation === "readActivityContents") return parseActivityContentRequest(operation, raw);
42633
- if (!raw || typeof raw !== "object" || Array.isArray(raw)) return parseActivityContentRequest(operation, raw);
42634
- const input2 = Object.fromEntries(Object.entries(raw).filter(([key]) => Object.hasOwn(activityContentInputs[operation].shape, key)));
42635
- if (operation === "editActivityContent") return parseActivityContentRequest(operation, input2);
42636
- const parsed = parseOperationInput(operation, legacyActivityContentReadInput, input2);
42637
- return parseActivityContentRequest(operation, { ...parsed, maxBlocks: Math.min(parsed.maxBlocks ?? ACTIVITY_CONTENT_LIMITS.defaultBlocks, ACTIVITY_CONTENT_LIMITS.maxBlocks), maxCharacters: Math.min(parsed.maxCharacters ?? ACTIVITY_CONTENT_LIMITS.defaultCharacters, ACTIVITY_CONTENT_LIMITS.maxCharacters) });
42638
- }
42639
42690
  function parseActivityContentVersionText(raw) {
42640
42691
  if (raw === "null") return null;
42641
42692
  if (!/^\d+$/.test(raw)) return void 0;
@@ -42671,8 +42722,8 @@ function graphAck(raw) {
42671
42722
  var graphContextAck = activityWriteResults.updateActivity.extend({ activityId: graphId2, assigneeIds: external_exports.array(graphId2).optional(), changed: external_exports.literal(false).optional() });
42672
42723
  var graphCreated = external_exports.strictObject({ activityId: graphId2 });
42673
42724
  var graphMessage = activityWriteResults.addActivityMessage.extend({ activityId: graphId2 });
42674
- 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());
42675
- var graphPublicRich = taskReadTransportItem.shape.activity.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity3.nullable()) });
42725
+ var entity2 = external_exports.object({ _id: graphId2, name: taskReadEntity.shape.name, type: taskReadEntity.shape.type }).catchall(external_exports.json().optional());
42726
+ var graphPublicRich = activityRichRecord.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity2.nullable()) });
42676
42727
  var graphMembers = external_exports.array(external_exports.object({
42677
42728
  membership: external_exports.object({ _id: graphId2, userId: graphId2, spaceId: graphId2, role: external_exports.enum(["owner", "admin", "member"]) }).catchall(external_exports.json().optional()),
42678
42729
  user: external_exports.object({ _id: graphId2, name: external_exports.string().optional(), email: external_exports.string().optional() }).catchall(external_exports.json().optional()).nullable()
@@ -42759,6 +42810,7 @@ var GraphProgress = class {
42759
42810
  raw = await call();
42760
42811
  } catch (error62) {
42761
42812
  if (error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" && "code" in error62.data) this.outcome = "rejected";
42813
+ if (error62 instanceof ApiError && error62.statusCode === 404) this.outcome = "rejected";
42762
42814
  throw error62;
42763
42815
  }
42764
42816
  if (confirmsWrite) {
@@ -42880,12 +42932,6 @@ var htmlInputs = {
42880
42932
  updateHtmlBlock: external_exports.strictObject({ ...write, blockId: selector3, artifactId: selector3, expectedVersionId: selector3 })
42881
42933
  };
42882
42934
  var htmlCliUpdateInput = htmlInputs.updateHtmlBlock.omit({ artifactId: true, expectedVersionId: true }).partial({ title: true, height: true });
42883
- var htmlAliases = {
42884
- html_blocks_list: "listHtmlBlocks",
42885
- html_blocks_add: "addHtmlBlock",
42886
- html_blocks_get: "getHtmlBlock",
42887
- html_blocks_update: "updateHtmlBlock"
42888
- };
42889
42935
  function isHtmlOperationName(name4) {
42890
42936
  return Object.hasOwn(htmlInputs, name4);
42891
42937
  }
@@ -42899,7 +42945,7 @@ function definition4(name4) {
42899
42945
  const schema = external_exports.toJSONSchema(htmlInputs[name4], { io: "input" });
42900
42946
  return {
42901
42947
  name: name4,
42902
- aliases: operationAliases(htmlAliases, name4),
42948
+ aliases: [],
42903
42949
  actor: "agent",
42904
42950
  description: descriptions5[name4],
42905
42951
  inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
@@ -43114,7 +43160,9 @@ var EntityList = class extends ClientCommand {
43114
43160
  query = options_exports.String("--query", { description: "Fuzzy name search" });
43115
43161
  type = options_exports.String("--type", { description: `Filter by type (${ENTITY_TYPE_VALUES.join(", ")})` });
43116
43162
  space = options_exports.String("--space", { description: "Filter by space (name or ID)" });
43117
- limit = options_exports.String("--limit", { description: "Max results (default: 50)" });
43163
+ limit = options_exports.String("--limit", { description: "Max results per page (default: 50; list pages hold at most 100)" });
43164
+ cursor = options_exports.String("--cursor", { description: "Continue a list from the previous page's nextCursor (same --space, --type, --archived)" });
43165
+ all = options_exports.Boolean("--all", false, { description: "Read every list page; prints all entities at once" });
43118
43166
  projection = options_exports.String("--projection", { description: "compact or full public fields" });
43119
43167
  archived = options_exports.Boolean("--archived", false, {
43120
43168
  description: "Show archived (trashed) entities instead of active ones"
@@ -43127,7 +43175,9 @@ var EntityList = class extends ClientCommand {
43127
43175
  space: this.space,
43128
43176
  limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter(this.query !== void 0 && !this.archived ? "searchEntities" : "listEntities", "limit", this.limit),
43129
43177
  archived: this.archived,
43130
- projection: this.projection
43178
+ projection: this.projection,
43179
+ cursor: this.cursor,
43180
+ all: this.all
43131
43181
  });
43132
43182
  }
43133
43183
  };
@@ -43228,16 +43278,16 @@ var EntityGet = class extends ClientCommand {
43228
43278
  this.emitText({ data: null }, () => "Entity not found or not accessible");
43229
43279
  return;
43230
43280
  }
43231
- const spaces = Object.fromEntries(data.spaces.map((space3) => [space3.spaceId, space3]));
43232
- const textActivities = data.activities.map((activity2) => ({
43233
- _id: activity2._id,
43234
- type: activity2.type,
43235
- title: activity2.title,
43236
- contentPlainText: activity2.contentPlainText,
43237
- createdAt: activity2.createdAt,
43238
- deadline: activity2.deadline,
43239
- completed: activity2.completed,
43240
- shortId: activity2.shortId
43281
+ const spaces = Object.fromEntries(data.spaces.map((space2) => [space2.spaceId, space2]));
43282
+ const textActivities = data.activities.map((activity) => ({
43283
+ _id: activity._id,
43284
+ type: activity.type,
43285
+ title: activity.title,
43286
+ contentPlainText: activity.contentPlainText,
43287
+ createdAt: activity.createdAt,
43288
+ deadline: activity.deadline,
43289
+ completed: activity.completed,
43290
+ shortId: activity.shortId
43241
43291
  }));
43242
43292
  this.emitText(jsonWithSpaces({ data }, spaces), () => withFooter(formatEntityDetail({ ...data, activities: textActivities }), spaces));
43243
43293
  }
@@ -43694,6 +43744,64 @@ function requireEntitySelector(operation, value, field) {
43694
43744
  if (!value.trim()) throw new OperationInputError(operation, [{ path: [field], reason: "too_small" }]);
43695
43745
  }
43696
43746
 
43747
+ // ente/commands/entityMerge.ts
43748
+ function plural2(count2, word, many = `${word}s`) {
43749
+ return `${count2} ${count2 === 1 ? word : many}`;
43750
+ }
43751
+ function formatMergeSummary(summary) {
43752
+ const { moved } = summary;
43753
+ const lines = [
43754
+ summary.dryRun ? `Dry run: merging "${summary.sourceName}" (${summary.sourceEntityId}) into "${summary.name}" (${summary.entityId}) would move:` : `Merged "${summary.sourceName}" into "${summary.name}" (${summary.entityId}). Moved:`,
43755
+ ` ${plural2(moved.activities, "activity", "activities")}, ${plural2(moved.relationships, "relationship")}, ${plural2(moved.whiteboards, "whiteboard")}, ${plural2(moved.calendarEvents, "calendar event")}`,
43756
+ ` ${plural2(moved.fieldValues, "field value")}, ${plural2(moved.tags, "tag")}, ${plural2(moved.aliases, "alias", "aliases")}${moved.description ? ", description" : ""}`,
43757
+ ` Image: ${summary.image === "target" ? "target keeps its own" : summary.image === "source" ? "target adopts the source image" : "none"}`
43758
+ ];
43759
+ if (summary.targetSpacesAdded.length > 0) lines.push(` "${summary.name}" joins: ${summary.targetSpacesAdded.map((space2) => space2.name).join(", ")}`);
43760
+ if (summary.sourceSpacesAdded.length > 0) lines.push(` "${summary.sourceName}" content becomes visible in: ${summary.sourceSpacesAdded.map((space2) => space2.name).join(", ")}`);
43761
+ for (const grant of summary.parentSpaceGrants)
43762
+ lines.push(` Parent "${grant.name}" must be shared into: ${grant.missingSpaces.map((space2) => `${space2.name} (${space2.memberCount} members)`).join(", ")}`);
43763
+ if (summary.dryRun && summary.parentSpaceGrantFingerprint && !summary.requiresPerson)
43764
+ lines.push(` To confirm the parent grants: --share-parents --parent-space-grant-fingerprint ${summary.parentSpaceGrantFingerprint}`);
43765
+ if (summary.requiresPerson) lines.push(" A person must approve this sharing: merge in the Ente app (entity Settings \u2192 Merge into another entity).");
43766
+ if (!summary.dryRun) lines.push(` "${summary.sourceName}" was deleted; links to it now open "${summary.name}".`);
43767
+ return lines.join("\n");
43768
+ }
43769
+ var EntityMerge = class extends ClientCommand {
43770
+ static paths = [["entity", "merge"]];
43771
+ static usage = Command.Usage({
43772
+ category: "Entity",
43773
+ description: "Merge a source entity into a target entity (source is deleted)",
43774
+ details: "Same operation as the app's entity Settings \u2192 Merge into another entity. Activities, relationships, the description, whiteboards, calendar events, tags, aliases (including the source name) and field values move to the target. The target keeps its image and adopts the source image only when it has none. Run --dry-run first. Use IDs when both entities share a name.",
43775
+ examples: [
43776
+ ["Preview a merge", "$0 entity merge <sourceId> <targetId> --dry-run"],
43777
+ ["Merge", "$0 entity merge <sourceId> <targetId>"],
43778
+ ["Confirm the parent grants from the dry run", "$0 entity merge <sourceId> <targetId> --share-parents --parent-space-grant-fingerprint <fingerprint>"]
43779
+ ]
43780
+ });
43781
+ source = options_exports.String();
43782
+ target = options_exports.String();
43783
+ dryRun = options_exports.Boolean("--dry-run", false, { description: "Report what would move and which grants are needed, without writing" });
43784
+ shareParents = options_exports.Boolean("--share-parents", false, {
43785
+ description: "Confirm the parent grants the dry run listed (agent keys: only into spaces where you are the sole member)"
43786
+ });
43787
+ parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
43788
+ description: "Exact parentSpaceGrantFingerprint from the dry run; a changed grant set fails"
43789
+ });
43790
+ async run() {
43791
+ if (this.shareParents && !this.parentSpaceGrantFingerprint)
43792
+ throw new Error("--share-parents needs --parent-space-grant-fingerprint from `ente entity merge --dry-run`.");
43793
+ const confirmation = this.shareParents ? { grantMissingParentAccess: true, parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {};
43794
+ parseEntityWriteRequest("mergeEntity", { sourceEntityId: "pending-source", targetEntityId: "pending-target", dryRun: this.dryRun, ...confirmation });
43795
+ const client = this.client();
43796
+ const sourceEntityId = await resolveEntity(client, this.source);
43797
+ const targetEntityId = await resolveEntity(client, this.target);
43798
+ if (sourceEntityId === targetEntityId) throw new Error("Source and target resolve to the same entity; pass both IDs.");
43799
+ const { data } = await client.entityWrite("mergeEntity", { sourceEntityId, targetEntityId, dryRun: this.dryRun, ...confirmation });
43800
+ this.emitText({ data }, () => formatMergeSummary(data));
43801
+ }
43802
+ };
43803
+ var ENTITY_MERGE_COMMANDS = [EntityMerge];
43804
+
43697
43805
  // ente/activity-fields.ts
43698
43806
  function parseActivityFields(flags, pairs = []) {
43699
43807
  if (flags === void 0 && !pairs.length) return void 0;
@@ -44176,7 +44284,7 @@ Next: --id ${item.activityId} --cursor '${item.nextCursor}' --expected-version $
44176
44284
  return;
44177
44285
  }
44178
44286
  if (!this.id) throw new Error("Supply an activity ID or repeat --id for a bulk read");
44179
- const request = parseLegacyActivityContentRequest("readActivityContent", {
44287
+ const request = parseActivityContentRequest("readActivityContent", {
44180
44288
  activityId: this.id,
44181
44289
  cursor: this.cursor,
44182
44290
  expectedContentVersion: this.expectedVersion === void 0 ? void 0 : graphVersion(this.expectedVersion),
@@ -44582,8 +44690,8 @@ var ActivityList = class extends ClientCommand {
44582
44690
  const res = await client.listActivities(params);
44583
44691
  const spaces = await client.listSpaces();
44584
44692
  this.emitText(
44585
- jsonWithSpaces(res, spaces),
44586
- () => this.withFooter(formatActivityList(res.data ?? []), spaces)
44693
+ jsonWithSpaces({ data: res.data.activities, hasMore: res.data.hasMore }, spaces),
44694
+ () => this.withFooter(formatActivityList(res.data.activities), spaces)
44587
44695
  );
44588
44696
  return;
44589
44697
  }
@@ -44705,7 +44813,7 @@ var ActivityGet = class extends ClientCommand {
44705
44813
  this.emitText({ data: null }, () => "Activity not found or not accessible");
44706
44814
  return;
44707
44815
  }
44708
- if ("attachments" in data) for (const attachment4 of data.attachments ?? []) attachmentResult(attachment4);
44816
+ if ("attachments" in data) for (const attachment3 of data.attachments ?? []) attachmentResult(attachment3);
44709
44817
  const spaces = await client.listSpaces();
44710
44818
  this.emitText(jsonWithSpaces({ data }, spaces), () => {
44711
44819
  const detail = this.withFooter(formatActivityDetail(data), spaces);
@@ -44750,7 +44858,7 @@ var ActivityUpdate = class extends ClientCommand {
44750
44858
  if (hasEntityChange) {
44751
44859
  const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
44752
44860
  if (!rich) throw new Error("Activity not found or not accessible");
44753
- const current = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
44861
+ const current = rich.entityDetails.flatMap((entity3) => entity3 ? [entity3._id] : []);
44754
44862
  const removed = new Set(await resolveEntitiesC(caller, removeNames));
44755
44863
  entityIds = [.../* @__PURE__ */ new Set([...current.filter((id21) => !removed.has(id21)), ...await resolveEntitiesC(caller, addNames)])];
44756
44864
  }
@@ -44763,7 +44871,7 @@ var ActivityUpdate = class extends ClientCommand {
44763
44871
  if (hasEntityChange) await progress.observe("entityResolution", async () => {
44764
44872
  const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
44765
44873
  if (!rich) throw new Error("Activity not found or not accessible");
44766
- const currentIds = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
44874
+ const currentIds = rich.entityDetails.flatMap((entity3) => entity3 ? [entity3._id] : []);
44767
44875
  const addIds = await resolveEntitiesC(caller, addNames);
44768
44876
  const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
44769
44877
  const newIds = currentIds.filter((id21) => !removeSet.has(id21));
@@ -45033,15 +45141,14 @@ var TaskListCmd = class extends ClientCommand {
45033
45141
  throw new Error(`Unknown --due value: '${this.due}'. Use: today, overdue, or all.`);
45034
45142
  }
45035
45143
  const res = await client.listTasks(params);
45036
- const tasks2 = (res.data ?? []).slice();
45037
- const users = res.users ?? {};
45144
+ const tasks2 = res.data.slice();
45038
45145
  const spaces = await client.listSpaces();
45039
45146
  tasks2.sort(
45040
45147
  (a, b) => (a.activity?.deadline ?? Number.POSITIVE_INFINITY) - (b.activity?.deadline ?? Number.POSITIVE_INFINITY)
45041
45148
  );
45042
45149
  this.emitText(
45043
45150
  jsonWithSpaces(res, spaces),
45044
- () => this.withFooter(formatTaskList(tasks2, users), spaces)
45151
+ () => this.withFooter(formatTaskList(tasks2), spaces)
45045
45152
  );
45046
45153
  }
45047
45154
  };
@@ -45475,23 +45582,14 @@ function parseDatabaseProtocolInput(name4, validator, raw) {
45475
45582
  return raw;
45476
45583
  }
45477
45584
 
45478
- // ../packages/shared/src/entity-read-legacy-results.ts
45585
+ // ../packages/shared/src/entity-record-results.ts
45479
45586
  var json2 = external_exports.json().optional();
45480
- function legacyEntityRecord(raw) {
45587
+ function entityRecordWithoutFieldStorage(raw) {
45481
45588
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
45482
45589
  const { fieldValues: _fieldValues, layout: _layout, actingSpaceId: _acting, ...value } = raw;
45483
45590
  return value;
45484
45591
  }
45485
- var legacyEntityObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json2);
45486
- var entity4 = external_exports.preprocess(legacyEntityRecord, legacyEntityObject);
45487
- var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(json2);
45488
- var searchRow = entityReadFullSearch.shape.entities.element;
45489
- var listRow = entityReadFullList.shape.entities.element;
45490
- var legacyEntityReadResults = {
45491
- searchEntities: entityReadFullSearch.extend({ entities: external_exports.array(searchRow.extend({ entity: entity4 })) }),
45492
- listEntities: entityReadFullList.extend({ entities: external_exports.array(listRow.extend({ entity: entity4 })) }),
45493
- getEntity: entityReadFullDetail.unwrap().extend({ entity: entity4, activities: external_exports.array(activity) }).nullable()
45494
- };
45592
+ var entityRecordObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json2);
45495
45593
 
45496
45594
  // ../packages/shared/src/database-view-scalars.ts
45497
45595
  var customIconColorValidator = v2.union(
@@ -45522,22 +45620,22 @@ var databaseConfigurationContracts = createDatabaseConfigurationContracts({ tab:
45522
45620
  var readView = external_exports.unknown().transform((raw) => parseOperationResult("database read view", entityDatabaseViewConfigValidator, raw));
45523
45621
  var { fields: _externalFields, ...richDocument } = entityReadRichDocument.shape;
45524
45622
  var databaseListEntity = external_exports.preprocess(
45525
- legacyEntityRecord,
45526
- legacyEntityObject.omit({ fields: true }).extend({ ...richDocument, databaseView: readView.optional() })
45623
+ entityRecordWithoutFieldStorage,
45624
+ entityRecordObject.omit({ fields: true }).extend({ ...richDocument, databaseView: readView.optional() })
45527
45625
  );
45528
45626
  var readUser = graphMembers.element.shape.user.unwrap().extend({ _creationTime: external_exports.number(), avatarInitials: external_exports.string().optional(), image: external_exports.string().optional() });
45529
- var attachment3 = external_exports.unknown().transform((raw) => parseOperationResult("database row attachment", activityAttachmentViewValidator, raw));
45627
+ var attachment2 = external_exports.unknown().transform((raw) => parseOperationResult("database row attachment", activityAttachmentViewValidator, raw));
45530
45628
  var databaseListRow = graphPublicRich.extend({
45531
45629
  _id: graphId2,
45532
45630
  _creationTime: external_exports.number(),
45533
45631
  entityDetails: external_exports.array(databaseListEntity.nullable()),
45534
45632
  createdByUser: readUser.nullable(),
45535
- attachments: external_exports.array(attachment3).optional()
45633
+ attachments: external_exports.array(attachment2).optional()
45536
45634
  });
45537
45635
  function databaseListPage(raw) {
45538
45636
  const envelope = graphResult(external_exports.object({ page: external_exports.array(databaseListRow) }).catchall(external_exports.json().optional()), raw);
45539
- const { page: page3, ...metadata } = envelope;
45540
- return { ...parseOperationResult("database page metadata", databasePageMetadataValidator, metadata), page: page3 };
45637
+ const { page: page2, ...metadata } = envelope;
45638
+ return { ...parseOperationResult("database page metadata", databasePageMetadataValidator, metadata), page: page2 };
45541
45639
  }
45542
45640
  function parseDatabaseWriteView(raw) {
45543
45641
  const view = parseDatabaseView(raw);
@@ -45846,13 +45944,13 @@ function rowStages(ctx, step) {
45846
45944
  }
45847
45945
  async function loadList(caller, listNameOrId) {
45848
45946
  const entityId2 = await resolveEntityC(caller, listNameOrId);
45849
- const entity5 = graphResult(databaseListEntity.nullable(), await caller.query(findById, { id: graphInput(graphId2, entityId2) }));
45850
- if (!entity5) throw new Error(`List '${listNameOrId}' not found or not accessible.`);
45851
- if (entity5._id !== entityId2) throw new OperationResultError("database list", "Invalid entity result context");
45852
- const stored = entity5.databaseView;
45947
+ const entity3 = graphResult(databaseListEntity.nullable(), await caller.query(findById, { id: graphInput(graphId2, entityId2) }));
45948
+ if (!entity3) throw new Error(`List '${listNameOrId}' not found or not accessible.`);
45949
+ if (entity3._id !== entityId2) throw new OperationResultError("database list", "Invalid entity result context");
45950
+ const stored = entity3.databaseView;
45853
45951
  return {
45854
45952
  entityId: entityId2,
45855
- entity: entity5,
45953
+ entity: entity3,
45856
45954
  view: {
45857
45955
  version: 1,
45858
45956
  columns: stored?.columns ?? [],
@@ -45895,9 +45993,9 @@ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
45895
45993
  }
45896
45994
  return [...rows.values()];
45897
45995
  }
45898
- async function resolveOwnerSpace(caller, space3) {
45899
- if (!space3?.trim()) throw new Error("New list rows require --space (name or ID), including dry runs.");
45900
- return resolveSpaceByNameC(caller, space3);
45996
+ async function resolveOwnerSpace(caller, space2) {
45997
+ if (!space2?.trim()) throw new Error("New list rows require --space (name or ID), including dry runs.");
45998
+ return resolveSpaceByNameC(caller, space2);
45901
45999
  }
45902
46000
  function rowJson(row) {
45903
46001
  return {
@@ -45983,11 +46081,11 @@ var ListColumnAdd = class extends ProfileCommand {
45983
46081
  columns = options_exports.Rest({ required: 1 });
45984
46082
  async run() {
45985
46083
  const caller = await resolveCaller();
45986
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46084
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
45987
46085
  const added = this.columns.map(parseColumn);
45988
46086
  const taken = new Set(view.columns.map((c) => c.key));
45989
46087
  for (const col of added) {
45990
- if (taken.has(col.key)) throw new Error(`'${col.key}' is already a column of '${entity5.name}'.`);
46088
+ if (taken.has(col.key)) throw new Error(`'${col.key}' is already a column of '${entity3.name}'.`);
45991
46089
  taken.add(col.key);
45992
46090
  }
45993
46091
  const columns = [...view.columns, ...added];
@@ -45996,7 +46094,7 @@ var ListColumnAdd = class extends ProfileCommand {
45996
46094
  await progress.run(() => progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw)));
45997
46095
  this.emitText(
45998
46096
  { data: { entityId: entityId2, added, columns } },
45999
- () => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity5.name}': ${added.map((c) => c.key).join(", ")}.`
46097
+ () => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity3.name}': ${added.map((c) => c.key).join(", ")}.`
46000
46098
  );
46001
46099
  }
46002
46100
  };
@@ -46011,12 +46109,12 @@ var ListColumnRemove = class extends ProfileCommand {
46011
46109
  keys = options_exports.Rest({ required: 1 });
46012
46110
  async run() {
46013
46111
  const caller = await resolveCaller();
46014
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46112
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
46015
46113
  const present = new Set(view.columns.map((c) => c.key));
46016
46114
  const missing = this.keys.filter((key) => !present.has(key));
46017
46115
  if (missing.length > 0) {
46018
46116
  throw new Error(
46019
- `Not a column of '${entity5.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
46117
+ `Not a column of '${entity3.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
46020
46118
  );
46021
46119
  }
46022
46120
  let current = view;
@@ -46030,7 +46128,7 @@ var ListColumnRemove = class extends ProfileCommand {
46030
46128
  });
46031
46129
  this.emitText(
46032
46130
  { data: { entityId: entityId2, removed: this.keys, columns: current.columns } },
46033
- () => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity5.name}': ${this.keys.join(", ")}.`
46131
+ () => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity3.name}': ${this.keys.join(", ")}.`
46034
46132
  );
46035
46133
  }
46036
46134
  };
@@ -46074,8 +46172,8 @@ var ListAdd = class extends ProfileCommand {
46074
46172
  }
46075
46173
  if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
46076
46174
  const caller = await resolveCaller();
46077
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46078
- const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
46175
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
46176
+ const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity3.name);
46079
46177
  const content = readContentOption(this.content, this.contentFile);
46080
46178
  const input2 = {
46081
46179
  line: 1,
@@ -46083,7 +46181,7 @@ var ListAdd = class extends ProfileCommand {
46083
46181
  ...this.title !== void 0 ? { title: this.title } : {},
46084
46182
  ...content !== void 0 ? { content } : {}
46085
46183
  };
46086
- if (this.key !== void 0) columnOrThrow(view.columns, this.key, entity5.name);
46184
+ if (this.key !== void 0) columnOrThrow(view.columns, this.key, entity3.name);
46087
46185
  const existing = this.key !== void 0 ? (await fetchRowsForKeys(caller, entityId2, [input2], this.key)).map(({ row, match }) => toExisting(row, view.columns, match)) : [];
46088
46186
  const keyColumn = this.key ?? "";
46089
46187
  const step = this.key !== void 0 ? planUpsert(existing, [input2], keyColumn)[0] : { action: "create", input: input2, key: "" };
@@ -46095,7 +46193,7 @@ var ListAdd = class extends ProfileCommand {
46095
46193
  const result = stepResult(step, rowId);
46096
46194
  this.emitText(
46097
46195
  { data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null, fields: fields4 } },
46098
- () => 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.`
46196
+ () => result.action === "created" ? `Added row '${this.title ?? "(untitled)"}' (${rowId}) to '${entity3.name}'.` : result.action === "updated" ? `Updated row ${rowId} in '${entity3.name}': ${(result.changed ?? []).join(", ")}.${result.contentIgnored ? " (body left unchanged)" : ""}` : `Row ${rowId} in '${entity3.name}' is unchanged.`
46099
46197
  );
46100
46198
  }
46101
46199
  };
@@ -46116,13 +46214,13 @@ var ListUpdate = class extends ProfileCommand {
46116
46214
  async run() {
46117
46215
  if (!this.attr?.length && this.title === void 0) throw new Error("Nothing to update. Pass --attr and/or --title.");
46118
46216
  const caller = await resolveCaller();
46119
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46120
- const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity5.name);
46217
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
46218
+ const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity3.name);
46121
46219
  const row = graphResult(databaseListRow.nullable(), await caller.query(activitiesGetByIdRich3, { activityId: graphInput(graphId2, this.rowId) }));
46122
46220
  if (!row) throw new Error(`Row ${this.rowId} not found or not accessible.`);
46123
46221
  if (row._id !== this.rowId) throw new OperationResultError("database row", "Invalid row result context");
46124
46222
  if (!(row.entityDetails ?? []).some((e) => e?._id === entityId2))
46125
- throw new Error(`Activity ${this.rowId} is not a row of list '${entity5.name}'.`);
46223
+ throw new Error(`Activity ${this.rowId} is not a row of list '${entity3.name}'.`);
46126
46224
  const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(fields4).map((_, i) => `cell:${i + 1}`)];
46127
46225
  const progress = graphProgress(this, "list update", stages, { entityId: entityId2, activityId: row._id });
46128
46226
  await progress.run(async () => {
@@ -46137,7 +46235,7 @@ var ListUpdate = class extends ProfileCommand {
46137
46235
  });
46138
46236
  this.emitText(
46139
46237
  { data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {}, fields: fields4 } },
46140
- () => `Updated row ${this.rowId} in '${entity5.name}': ${[
46238
+ () => `Updated row ${this.rowId} in '${entity3.name}': ${[
46141
46239
  ...this.title !== void 0 ? ["title"] : [],
46142
46240
  ...Object.keys(fields4)
46143
46241
  ].join(", ")}.`
@@ -46174,13 +46272,13 @@ var ListImport = class extends ProfileCommand {
46174
46272
  const lines = parseImportLines(readFileSync11(this.file, "utf8"));
46175
46273
  if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
46176
46274
  const caller = await resolveCaller();
46177
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46178
- columnOrThrow(view.columns, this.key, entity5.name);
46275
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
46276
+ columnOrThrow(view.columns, this.key, entity3.name);
46179
46277
  const inputs = lines.map((l) => {
46180
46278
  try {
46181
46279
  return {
46182
46280
  line: l.line,
46183
- fields: coerceImportFields(view.columns, l.fields, entity5.name),
46281
+ fields: coerceImportFields(view.columns, l.fields, entity3.name),
46184
46282
  ...l.title !== void 0 ? { title: l.title } : {},
46185
46283
  ...l.content !== void 0 ? { content: l.content } : {}
46186
46284
  };
@@ -46237,7 +46335,7 @@ var ListImport = class extends ProfileCommand {
46237
46335
  this.emitText(
46238
46336
  failure2 ? { data: payload, error: { message: failure2, code: "IMPORT_FAILED" } } : { data: payload },
46239
46337
  () => {
46240
- const head = `${this.dryRun ? "Dry run \u2014 would be " : ""}${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchanged in '${entity5.name}'.`;
46338
+ const head = `${this.dryRun ? "Dry run \u2014 would be " : ""}${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchanged in '${entity3.name}'.`;
46241
46339
  const changed = written.filter((r) => r.action !== "unchanged").map((r) => ` ${r.action.padEnd(8)} ${r.key} ${r.rowId ?? ""}${r.changed ? ` (${r.changed.join(", ")})` : ""}`);
46242
46340
  return [head, ...changed].join("\n");
46243
46341
  }
@@ -46363,8 +46461,8 @@ var ListShow = class extends ProfileCommand {
46363
46461
  if (!Number.isInteger(numItems) || numItems < 1 || numItems > 200)
46364
46462
  throw new Error(`--limit must be an integer from 1 to 200 (got '${this.limit}').`);
46365
46463
  const caller = await resolveCaller();
46366
- const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
46367
- const clauses = parseWhere(view.columns, this.where ?? [], entity5.name);
46464
+ const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
46465
+ const clauses = parseWhere(view.columns, this.where ?? [], entity3.name);
46368
46466
  const rows = [];
46369
46467
  let cursor2 = this.cursor ?? null;
46370
46468
  let nextCursor = null;
@@ -46598,12 +46696,12 @@ var UsersSetAdminCommand = class extends BaseCommand {
46598
46696
  off = options_exports.Boolean("--off", { description: "Revoke admin instead of granting it" });
46599
46697
  async run() {
46600
46698
  const caller = await resolveAdminCaller();
46601
- const user4 = await resolveUserByEmail(caller, this.email);
46699
+ const user2 = await resolveUserByEmail(caller, this.email);
46602
46700
  const isAdmin = !this.off;
46603
- 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));
46701
+ await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId: user2.id, isAdmin })).then((raw) => parseOperationResult("admin/users:setAdmin", adminUserContracts.setAdmin.result, raw));
46604
46702
  this.emitText(
46605
- { data: { id: user4.id, email: user4.email, isAdmin } },
46606
- () => `${isAdmin ? "Granted" : "Revoked"} admin for ${user4.email}.`
46703
+ { data: { id: user2.id, email: user2.email, isAdmin } },
46704
+ () => `${isAdmin ? "Granted" : "Revoked"} admin for ${user2.email}.`
46607
46705
  );
46608
46706
  }
46609
46707
  };
@@ -46619,14 +46717,14 @@ var UsersResetPasswordCommand = class extends BaseCommand {
46619
46717
  });
46620
46718
  async run() {
46621
46719
  const caller = await resolveAdminCaller();
46622
- const user4 = await resolveUserByEmail(caller, this.email);
46720
+ const user2 = await resolveUserByEmail(caller, this.email);
46623
46721
  const res = await caller.action(resetPassword, parseHumanInput("admin/users:resetPassword", adminUserContracts.resetPassword.args, {
46624
- userId: user4.id,
46722
+ userId: user2.id,
46625
46723
  ...this.password !== void 0 ? { newPassword: this.password } : {}
46626
46724
  })).then((raw) => parseOperationResult("admin/users:resetPassword", adminUserContracts.resetPassword.result, raw));
46627
46725
  this.emitText(
46628
- { data: { id: user4.id, email: user4.email, password: res.password } },
46629
- () => `Reset password for ${user4.email}.
46726
+ { data: { id: user2.id, email: user2.email, password: res.password } },
46727
+ () => `Reset password for ${user2.email}.
46630
46728
  New password: ${res.password}`
46631
46729
  );
46632
46730
  }
@@ -46657,15 +46755,15 @@ var UsersSetPlanCommand = class extends BaseCommand {
46657
46755
  throw new Error("company_managed needs --company <billing account id>.");
46658
46756
  }
46659
46757
  const caller = await resolveAdminCaller();
46660
- const user4 = await resolveUserByEmail(caller, this.email);
46758
+ const user2 = await resolveUserByEmail(caller, this.email);
46661
46759
  const res = await caller.mutation(changeUserPlan, parseHumanInput("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.args, {
46662
- userId: user4.id,
46760
+ userId: user2.id,
46663
46761
  planKey,
46664
46762
  ...planKey === "company_managed" ? { companyBillingAccountId: this.company } : {}
46665
46763
  })).then((raw) => parseOperationResult("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.result, raw));
46666
46764
  this.emitText(
46667
- { data: { id: user4.id, email: user4.email, ...res } },
46668
- () => res.changed ? `Set plan for ${user4.email} to ${res.planKey}.` : `${user4.email} already has plan ${res.planKey}.`
46765
+ { data: { id: user2.id, email: user2.email, ...res } },
46766
+ () => res.changed ? `Set plan for ${user2.email} to ${res.planKey}.` : `${user2.email} already has plan ${res.planKey}.`
46669
46767
  );
46670
46768
  }
46671
46769
  };
@@ -47985,7 +48083,7 @@ var RecordingInspectCommand = class extends BaseCommand {
47985
48083
  if (container === "mp4") {
47986
48084
  lines.push(`fragmented: ${fragmented ? `yes (${counts.moof} moof boxes)` : "no"}`);
47987
48085
  lines.push(
47988
- `boxes: ${Object.entries(counts).map(([type, count]) => `${type}\xD7${count}`).join(", ")}`
48086
+ `boxes: ${Object.entries(counts).map(([type, count2]) => `${type}\xD7${count2}`).join(", ")}`
47989
48087
  );
47990
48088
  }
47991
48089
  return lines.join("\n");
@@ -48039,7 +48137,7 @@ var RecordingRerunCommand = class extends BaseCommand {
48039
48137
  rawReceipt = await caller.mutation(rerunRecording, args);
48040
48138
  } catch (error62) {
48041
48139
  if (error62 instanceof ConvexError) throw error62;
48042
- const message4 = errorMessage(error62);
48140
+ const message3 = errorMessage(error62);
48043
48141
  const checkStatusCommand = `ente recording show ${before.id}`;
48044
48142
  this.emitText(
48045
48143
  {
@@ -48048,9 +48146,9 @@ var RecordingRerunCommand = class extends BaseCommand {
48048
48146
  rerunStarted: null,
48049
48147
  outcome: "unknown",
48050
48148
  checkStatusCommand,
48051
- error: { message: message4 }
48149
+ error: { message: message3 }
48052
48150
  },
48053
- () => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message4}
48151
+ () => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message3}
48054
48152
  Check with: ${checkStatusCommand}. No rerun was retried.`
48055
48153
  );
48056
48154
  return 1;
@@ -48073,11 +48171,11 @@ Check with: ${checkStatusCommand}. No rerun was retried.`
48073
48171
  }
48074
48172
  });
48075
48173
  } catch (error62) {
48076
- const message4 = errorMessage(error62);
48174
+ const message3 = errorMessage(error62);
48077
48175
  const details = error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" ? error62.data : {};
48078
48176
  this.emitText(
48079
- { id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message4 } },
48080
- () => `Re-run started for ${before.id}; final outcome unknown: ${message4}
48177
+ { id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message3 } },
48178
+ () => `Re-run started for ${before.id}; final outcome unknown: ${message3}
48081
48179
  Check with: ente recording show ${before.id}. No rerun was retried.`
48082
48180
  );
48083
48181
  return 1;
@@ -48339,7 +48437,7 @@ var AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS = 200;
48339
48437
  var id17 = external_exports.string().min(1).regex(/\S/);
48340
48438
  var capped = (maximum) => external_exports.string().max(maximum).refine((value) => value.length <= maximum);
48341
48439
  var optionalTrimmed = (maximum) => capped(maximum).transform((value) => value.trim() || void 0).optional();
48342
- var message3 = {
48440
+ var message2 = {
48343
48441
  text: external_exports.string().trim().min(1).max(AGENT_THREAD_MESSAGE_MAX_CHARACTERS).refine((value) => value.length <= AGENT_THREAD_MESSAGE_MAX_CHARACTERS),
48344
48442
  html: capped(AGENT_THREAD_HTML_MAX_CHARACTERS).optional(),
48345
48443
  requestKind: external_exports.enum(["ack", "text"]).optional(),
@@ -48347,9 +48445,9 @@ var message3 = {
48347
48445
  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" })
48348
48446
  };
48349
48447
  var agentConversationInputs = {
48350
- agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message3 }),
48448
+ agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message2 }),
48351
48449
  agent_thread_claim: external_exports.strictObject({ threadId: id17, attentionVersion: external_exports.number().int().nonnegative() }),
48352
- agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message3 })
48450
+ agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message2 })
48353
48451
  };
48354
48452
  function parseAgentConversationInput(operation, raw) {
48355
48453
  switch (operation) {
@@ -48362,11 +48460,11 @@ function parseAgentConversationInput(operation, raw) {
48362
48460
  }
48363
48461
  }
48364
48462
  var browserMessage = {
48365
- text: message3.text,
48366
- html: message3.html,
48367
- request_kind: message3.requestKind,
48368
- request_prompt: message3.requestPrompt,
48369
- idempotency_key: message3.idempotencyKey
48463
+ text: message2.text,
48464
+ html: message2.html,
48465
+ request_kind: message2.requestKind,
48466
+ request_prompt: message2.requestPrompt,
48467
+ idempotency_key: message2.idempotencyKey
48370
48468
  };
48371
48469
  var agentConversationBrowserInputs = {
48372
48470
  agent_thread_create: external_exports.strictObject({ agent_id: id17, title: agentConversationInputs.agent_thread_create.shape.title, ...browserMessage }),
@@ -48387,12 +48485,12 @@ var agentConversationResponseValidator = v2.union(
48387
48485
  );
48388
48486
  function mapPayloads2(operation, raw, transform2) {
48389
48487
  if (operation === "agent_thread_claim" || !raw || !("message" in raw)) return raw;
48390
- const message4 = raw.message;
48488
+ const message3 = raw.message;
48391
48489
  return { ...raw, message: {
48392
- ...message4,
48393
- ...message4.toolCalls ? { toolCalls: message4.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
48394
- ...message4.toolResults ? { toolResults: message4.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
48395
- ...message4.serverToolCalls ? { serverToolCalls: message4.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
48490
+ ...message3,
48491
+ ...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
48492
+ ...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
48493
+ ...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
48396
48494
  } };
48397
48495
  }
48398
48496
  function parseAgentConversationResult(operation, raw) {
@@ -48452,26 +48550,26 @@ async function boundAgentClient(client, context) {
48452
48550
  limit: Number(wire.limit ?? 20)
48453
48551
  });
48454
48552
  if (request.operation !== "agent_threads_list") throw new Error("Invalid agent context operation");
48455
- const page3 = encodeAgentContextResult("agent_threads_list", await (await caller()).query(threads, {
48553
+ const page2 = encodeAgentContextResult("agent_threads_list", await (await caller()).query(threads, {
48456
48554
  includeArchived: request.input.includeArchived,
48457
48555
  attention: request.input.attention,
48458
48556
  paginationOpts: { cursor: request.input.cursor ?? null, numItems: request.input.limit }
48459
48557
  }));
48460
- return { data: page3.page, ...!page3.isDone ? { continueCursor: page3.continueCursor } : {} };
48558
+ return { data: page2.page, ...!page2.isDone ? { continueCursor: page2.continueCursor } : {} };
48461
48559
  },
48462
48560
  getAgentThread: async (threadId, cursor2, limit3 = 50) => {
48463
48561
  const request = parseAgentContextInput("agent_thread_get", { threadId, cursor: cursor2, limit: limit3 });
48464
48562
  if (request.operation !== "agent_thread_get") throw new Error("Invalid agent context operation");
48465
- const page3 = encodeAgentContextResult("agent_thread_get", await (await caller()).query(thread, {
48563
+ const page2 = encodeAgentContextResult("agent_thread_get", await (await caller()).query(thread, {
48466
48564
  threadId: request.input.threadId,
48467
48565
  paginationOpts: { cursor: request.input.cursor ?? null, numItems: request.input.limit }
48468
48566
  }));
48469
- if (!page3) throw new Error(`Thread not found or not accessible: ${threadId}`);
48567
+ if (!page2) throw new Error(`Thread not found or not accessible: ${threadId}`);
48470
48568
  return { data: {
48471
- thread: page3.thread,
48472
- messages: page3.messages.page,
48473
- requests: page3.requests,
48474
- ...!page3.messages.isDone ? { continueCursor: page3.messages.continueCursor } : {}
48569
+ thread: page2.thread,
48570
+ messages: page2.messages.page,
48571
+ requests: page2.requests,
48572
+ ...!page2.messages.isDone ? { continueCursor: page2.messages.continueCursor } : {}
48475
48573
  } };
48476
48574
  },
48477
48575
  createAgentThread: async (args) => {
@@ -48527,12 +48625,12 @@ function normalizeOperatorThread(thread2, agentId = "") {
48527
48625
  agentId
48528
48626
  };
48529
48627
  }
48530
- function normalizeOperatorMessage(message4) {
48628
+ function normalizeOperatorMessage(message3) {
48531
48629
  return {
48532
- ...message4,
48533
- _id: message4.messageId,
48534
- toolCalls: message4.toolCalls,
48535
- toolResults: message4.toolResults
48630
+ ...message3,
48631
+ _id: message3.messageId,
48632
+ toolCalls: message3.toolCalls,
48633
+ toolResults: message3.toolResults
48536
48634
  };
48537
48635
  }
48538
48636
  async function fetchOperatorThread(client, threadId, agentId = "") {
@@ -48547,18 +48645,18 @@ async function fetchOperatorThread(client, threadId, agentId = "") {
48547
48645
  } while (cursor2);
48548
48646
  return thread2 ? { thread: thread2, messages } : null;
48549
48647
  }
48550
- function renderAgentConfiguration(agent3) {
48648
+ function renderAgentConfiguration(agent2) {
48551
48649
  const lines = [
48552
- `${agent3.name} ${agent3.agentId}`,
48553
- `Space: ${agent3.spaceId}`,
48554
- `Mailbox: ${agent3.mailbox?.status === "active" ? agent3.mailbox.address : "not active"}`,
48650
+ `${agent2.name} ${agent2.agentId}`,
48651
+ `Space: ${agent2.spaceId}`,
48652
+ `Mailbox: ${agent2.mailbox?.status === "active" ? agent2.mailbox.address : "not active"}`,
48555
48653
  "",
48556
48654
  "Ente prompt configuration:",
48557
- agent3.prompt || "(empty)",
48655
+ agent2.prompt || "(empty)",
48558
48656
  "",
48559
- `Ente scheduled runs: ${agent3.schedules.length}`
48657
+ `Ente scheduled runs: ${agent2.schedules.length}`
48560
48658
  ];
48561
- for (const schedule of agent3.schedules) {
48659
+ for (const schedule of agent2.schedules) {
48562
48660
  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();
48563
48661
  const condition = schedule.runCondition ?? schedule.mailPurpose;
48564
48662
  lines.push(
@@ -48572,8 +48670,8 @@ var AgentList = class extends ClientCommand {
48572
48670
  static usage = Command.Usage({ category: "Agent", description: "Show the agent bound to this key" });
48573
48671
  async run() {
48574
48672
  const context = await this.client().getAuthContext();
48575
- const agent3 = await boundAgentIdentity(this.client(), context);
48576
- this.emitText({ data: [agent3] }, () => `${agent3.name} (bound agent) ${agent3.agentId}`);
48673
+ const agent2 = await boundAgentIdentity(this.client(), context);
48674
+ this.emitText({ data: [agent2] }, () => `${agent2.name} (bound agent) ${agent2.agentId}`);
48577
48675
  }
48578
48676
  };
48579
48677
  var AgentThreads = class extends ClientCommand {
@@ -48722,7 +48820,7 @@ var AgentAnalyze = class extends ClientCommand {
48722
48820
  for (const t of errorThreads) lines.push(` \u2717 ${t.id}${t.message ? ` \u2014 ${t.message}` : ""}`);
48723
48821
  lines.push("");
48724
48822
  lines.push(`Failed tool calls by tool: ${rankedToolErrors.length === 0 ? "(none)" : ""}`);
48725
- for (const [name4, count] of rankedToolErrors) lines.push(` ${count}\xD7 ${name4}`);
48823
+ for (const [name4, count2] of rankedToolErrors) lines.push(` ${count2}\xD7 ${name4}`);
48726
48824
  if (errorSamples.length) {
48727
48825
  lines.push("", "Sample failures:");
48728
48826
  for (const s of errorSamples) lines.push(` - ${s}`);
@@ -49265,10 +49363,10 @@ function parseDuration(raw) {
49265
49363
  if (!Number.isInteger(minutes) || minutes <= 0) throw new Error("--duration must be a positive number of minutes.");
49266
49364
  return minutes;
49267
49365
  }
49268
- async function meetingRequest(caller, space3, entities, title4) {
49269
- if (!space3) throw new Error("--meeting needs --space <name|id> (the space the meeting activity belongs to).");
49366
+ async function meetingRequest(caller, space2, entities, title4) {
49367
+ if (!space2) throw new Error("--meeting needs --space <name|id> (the space the meeting activity belongs to).");
49270
49368
  return {
49271
- spaceId: await resolveSpaceByNameC(caller, space3),
49369
+ spaceId: await resolveSpaceByNameC(caller, space2),
49272
49370
  entityIds: await resolveEntitiesC(caller, entities),
49273
49371
  ...title4 ? { title: title4 } : {}
49274
49372
  };
@@ -49790,7 +49888,7 @@ var MAX_PAGES2 = 50;
49790
49888
  async function collectColumn(caller, status2, text4, limit3, scope) {
49791
49889
  const items2 = [];
49792
49890
  let cursor2 = null;
49793
- for (let page3 = 0; page3 < MAX_PAGES2; page3 += 1) {
49891
+ for (let page2 = 0; page2 < MAX_PAGES2; page2 += 1) {
49794
49892
  const res = await caller.query(listColumn, parseHumanInput("feedback:listColumn", feedbackContracts.listColumn.args, {
49795
49893
  status: status2,
49796
49894
  paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor: cursor2 },
@@ -50013,7 +50111,7 @@ Commands:
50013
50111
  ente ask <question> Experimental opt-in beta answer (not general AI chat)
50014
50112
  ente query <question> Evidence; server-negotiated hybrid or lexical, no answer synthesis
50015
50113
  ente entity create|get|update|duplicate|rename|archive|restore|pin|unpin
50016
- ente entity list [--archived]
50114
+ ente entity list [--type <type>] [--space <name>] [--cursor <c> | --all] [--archived]
50017
50115
  ente pins list <entity> List pins for an entity
50018
50116
  ente task list|get|create|update|done|assign|unassign|set-assignees|clear-assignees
50019
50117
  ente space members
@@ -50262,9 +50360,12 @@ Cross-space activity linking \u2014 BOUNDED:
50262
50360
  has you as its sole member, retry with --auto-link --entity-space-grant-fingerprint
50263
50361
  <token>; otherwise a person shares the entities in the Ente app.
50264
50362
 
50265
- Merging duplicates \u2014 UI ONLY:
50266
- The external API has no merge endpoint. To merge two entities, do it in the web
50267
- UI. \`entity rename\` lets you fix the surviving entity's display name afterward.
50363
+ Merging duplicates \u2014 BOUNDED:
50364
+ \`entity merge <source> <target> --dry-run\` lists what would move and which
50365
+ spaces would gain access. Without --dry-run it merges, like the web UI: the
50366
+ source is deleted and its links redirect to the target. An agent key may only
50367
+ widen access into spaces where you are the sole member; otherwise the result
50368
+ says requiresPerson and a person merges in the web UI.
50268
50369
 
50269
50370
  Adding an entity to a shared space \u2014 UI ONLY:
50270
50371
  An agent key adds an existing entity only to a space whose sole member is you
@@ -50397,14 +50498,6 @@ var canvasHtmlInputs = {
50397
50498
  updateCanvasHtmlPanel: external_exports.strictObject({ ...mutation, title: title3, html, ...geometry }),
50398
50499
  deleteCanvasHtmlPanel: external_exports.strictObject(mutation)
50399
50500
  };
50400
- var canvasHtmlAliases = {
50401
- canvas_boards_list: "listCanvasBoards",
50402
- canvas_html_list: "listCanvasHtmlPanels",
50403
- canvas_html_get: "getCanvasHtmlPanel",
50404
- canvas_html_create: "createCanvasHtmlPanel",
50405
- canvas_html_update: "updateCanvasHtmlPanel",
50406
- canvas_html_delete: "deleteCanvasHtmlPanel"
50407
- };
50408
50501
  function isCanvasHtmlOperationName(name4) {
50409
50502
  return Object.hasOwn(canvasHtmlInputs, name4);
50410
50503
  }
@@ -50420,7 +50513,7 @@ function definition5(name4) {
50420
50513
  const schema = external_exports.toJSONSchema(canvasHtmlInputs[name4], { io: "input" });
50421
50514
  return {
50422
50515
  name: name4,
50423
- aliases: operationAliases(canvasHtmlAliases, name4),
50516
+ aliases: [],
50424
50517
  actor: "agent",
50425
50518
  description: descriptions6[name4],
50426
50519
  inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
@@ -50713,7 +50806,7 @@ var entityFileCitationValidator = v2.union(
50713
50806
  /** 1-based PDF pages where the quoted passage starts and ends. */
50714
50807
  page: v2.number(),
50715
50808
  endPage: v2.number(),
50716
- /** The passage in document offsets (entity_file_read's offsets). */
50809
+ /** The passage in document offsets (readEntityFile's offsets). */
50717
50810
  start: v2.number(),
50718
50811
  end: v2.number(),
50719
50812
  /** The printed page label (PDF page labels), else the PDF page number. */
@@ -50866,7 +50959,7 @@ var entityFileInputs = {
50866
50959
  }),
50867
50960
  readEntityFile: external_exports.strictObject({
50868
50961
  entityId: id19,
50869
- path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters).describe("File inside the linked folder, as entity_files_list or entity_files_search return it, for example 03 Unterlagen/Mietvertrag.pdf."),
50962
+ path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters).describe("File inside the linked folder, as listEntityFiles or searchEntityFiles return it, for example 03 Unterlagen/Mietvertrag.pdf."),
50870
50963
  offset: external_exports.number().int().min(0).optional().describe("Character offset to continue a truncated text; defaults to 0."),
50871
50964
  maxCharacters: external_exports.number().int().min(1).max(ENTITY_FILE_LIMITS.readCharacters).optional().describe(`Characters to return, at most ${ENTITY_FILE_LIMITS.readCharacters}; defaults to that maximum.`)
50872
50965
  }),
@@ -50903,15 +50996,6 @@ var entityFileInputs = {
50903
50996
  ctx.addIssue({ code: "custom", path: ["base64Content"], message: "Provide exactly one of base64Content or activityAttachment" });
50904
50997
  })
50905
50998
  };
50906
- var entityFileAliases = {
50907
- entity_folder_create: "createEntityFolder",
50908
- entity_folder_link: "linkEntityFolder",
50909
- entity_files_list: "listEntityFiles",
50910
- entity_files_search: "searchEntityFiles",
50911
- entity_file_read: "readEntityFile",
50912
- entity_file_cite: "citeEntityFile",
50913
- entity_file_upload: "uploadEntityFile"
50914
- };
50915
50999
  function isEntityFileOperationName(value) {
50916
51000
  return Object.hasOwn(entityFileInputs, value);
50917
51001
  }
@@ -50920,8 +51004,8 @@ var descriptions7 = {
50920
51004
  createEntityFolder: `Create a new folder in your Nextcloud below parentPath and link it as the entity's file folder. ${personalOnly}`,
50921
51005
  linkEntityFolder: `Link an existing folder of your Nextcloud, given by its path, as the entity's file folder. A folder can belong to one entity only. ${personalOnly}`,
50922
51006
  listEntityFiles: `List the files and folders in the entity's linked Nextcloud folder. status explains a missing link or connection instead of an empty list. Item paths are relative to the linked folder; linkedFolderPath is the linked folder's own path from your Nextcloud root, so join it with an item path to address that exact file in Nextcloud instead of searching by name. ${personalOnly}`,
50923
- searchEntityFiles: `Find files and folders by name anywhere below the entity's linked Nextcloud folder, also in subfolders. status explains a missing link or connection; truncated means more hits exist, so narrow the query. Item paths are relative to the linked folder and go unchanged into entity_file_read. ${personalOnly}`,
50924
- readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. PDF: offset + position in text = document offset; pages = label and offsets per page. To cite, call entity_file_cite; never build links. ${personalOnly}`,
51007
+ searchEntityFiles: `Find files and folders by name anywhere below the entity's linked Nextcloud folder, also in subfolders. status explains a missing link or connection; truncated means more hits exist, so narrow the query. Item paths are relative to the linked folder and go unchanged into readEntityFile. ${personalOnly}`,
51008
+ readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. PDF: offset + position in text = document offset; pages = label and offsets per page. To cite, call citeEntityFile; never build links. ${personalOnly}`,
50925
51009
  citeEntityFile: `Citation links for verbatim PDF quotes, all in one call. ok: paste quoteMarkdown unchanged. mismatch: no link; quote documentText, cite again. ambiguous: no link; quote more or pass candidate. notFound: not in the file. noText: scan, no link. Never build links. ${personalOnly}`,
50926
51010
  uploadEntityFile: `Upload a file into the entity's linked Nextcloud folder; a taken name gets a numbered suffix. Send exactly one of base64Content (at most 10 MiB decoded) or activityAttachment (an existing Ente activity attachment). ${personalOnly}`
50927
51011
  };
@@ -50933,7 +51017,7 @@ function definition6(operationName) {
50933
51017
  const schema = external_exports.toJSONSchema(entityFileInputs[operationName], { io: "input" });
50934
51018
  return {
50935
51019
  name: operationName,
50936
- aliases: operationAliases(entityFileAliases, operationName),
51020
+ aliases: [],
50937
51021
  actor: "agent",
50938
51022
  description: descriptions7[operationName],
50939
51023
  inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
@@ -51231,9 +51315,9 @@ function readBody(inline, file2, label) {
51231
51315
  return value;
51232
51316
  }
51233
51317
  function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = [], attachmentPaths = []) {
51234
- const count = imagePaths.length + inlineImageSpecs.length + attachmentPaths.length;
51235
- if (count === 0) return void 0;
51236
- if (count > CLI_LIMITS.maxAttachments) {
51318
+ const count2 = imagePaths.length + inlineImageSpecs.length + attachmentPaths.length;
51319
+ if (count2 === 0) return void 0;
51320
+ if (count2 > CLI_LIMITS.maxAttachments) {
51237
51321
  throw new Error(
51238
51322
  `notification send: at most ${CLI_LIMITS.maxAttachments} files may be attached.`
51239
51323
  );
@@ -51351,7 +51435,7 @@ var HealthDataRecord = class extends ClientCommand {
51351
51435
  static usage = Command.Usage({
51352
51436
  category: "Health data",
51353
51437
  description: "Define health series and write, replace or remove points for your calendar health graph",
51354
- details: "The JSON body has optional lists: series [{key,label,unit?,description?,better,scale?,bands?,resolution?}], points [{series,at,value}], intraday [{series,day,stepMinutes,values}] (a whole day of an intraday series; [] values remove it), remove [{series,at}] and removeSeries [key]. at is YYYY-MM-DD or a local YYYY-MM-DDTHH:MM[:SS][offset]; the wall-clock time is kept as written. Writing the same series and at again replaces the value, so resending a batch is safe. Only your own personal agent may write health data.",
51438
+ details: "The JSON body has optional lists: series [{key,label,unit?,description?,better (higher|lower|neutral),scale?,bands?,resolution?,hidden?}], points [{series,at,value}], intraday [{series,day,stepMinutes,values}] (a whole day of an intraday series; [] values remove it), remove [{series,at}] and removeSeries [key]. at is YYYY-MM-DD or a local YYYY-MM-DDTHH:MM[:SS][offset]; the wall-clock time is kept as written. hidden: true starts a new series unchecked in the graph menu. Writing the same series and at again replaces the value, so resending a batch is safe. Only your own personal agent may write health data.",
51355
51439
  examples: [
51356
51440
  ["Send a batch from a file", "$0 health-data record --file ./health.json"],
51357
51441
  ["Pipe a batch", "health-export | $0 health-data record --file - --json"]
@@ -51392,7 +51476,7 @@ var HealthDataList = class extends ClientCommand {
51392
51476
  this.emitText(response, () => {
51393
51477
  if (!series.length) return "No health series yet.";
51394
51478
  const units = new Map(series.map((item) => [item.key, item.unit]));
51395
- const lines = series.map((item) => `${item.key}: ${item.label}${item.unit ? ` (${item.unit})` : ""}, ${item.resolution === "intraday" ? "intraday" : `${item.better} is better`}${item.description ? ` \xB7 ${item.description}` : ""}`);
51479
+ const lines = series.map((item) => `${item.key}: ${item.label}${item.unit ? ` (${item.unit})` : ""}, ${item.resolution === "intraday" ? "intraday" : item.better === "neutral" ? "no better direction" : `${item.better} is better`}${item.description ? ` \xB7 ${item.description}` : ""}`);
51396
51480
  lines.push("", points.length ? `${points.length} points` : `No points from ${this.from} to ${this.to}.`);
51397
51481
  for (const point2 of points) {
51398
51482
  const unit = units.get(point2.series);
@@ -51748,7 +51832,7 @@ var AGENT_MAIL_CLI_SURFACE = {
51748
51832
  text: { flags: ["--text", "--text-file"] },
51749
51833
  html: { flags: ["--html", "--html-file"] },
51750
51834
  attachments: { flags: ["--attachment", "--inline-image"] },
51751
- idempotency_key: { flags: ["--idempotency-key"] }
51835
+ idempotencyKey: { flags: ["--idempotency-key"] }
51752
51836
  },
51753
51837
  replyInputProperties: {
51754
51838
  threadId: { source: "positional argument" },
@@ -51758,7 +51842,7 @@ var AGENT_MAIL_CLI_SURFACE = {
51758
51842
  text: { flags: ["--text", "--text-file"] },
51759
51843
  html: { flags: ["--html", "--html-file"] },
51760
51844
  attachments: { flags: ["--attachment", "--inline-image"] },
51761
- idempotency_key: { flags: ["--idempotency-key"] }
51845
+ idempotencyKey: { flags: ["--idempotency-key"] }
51762
51846
  },
51763
51847
  attachmentProperties: {
51764
51848
  filename: { source: "file basename" },
@@ -52021,16 +52105,16 @@ function renderThread(thread2) {
52021
52105
  const unread = thread2.hasUnread ? ` unread:${thread2.unreadCount}` : "";
52022
52106
  return `${fmtTime2(thread2.latestAt)} [${thread2.state}]${unread} ${thread2.subject} ${thread2.threadId}`;
52023
52107
  }
52024
- function renderMessage2(message4) {
52025
- const direction = message4.direction === "inbound" ? "\u2190" : "\u2192";
52026
- const date5 = message4.receivedAt ?? message4.sentAt;
52027
- const body = message4.text ? `
52028
- ${message4.text}` : "";
52029
- const cc = message4.cc?.length ? `
52030
- CC: ${message4.cc.join(", ")}` : "";
52031
- const files = (message4.attachments ?? []).map((file2) => `
52108
+ function renderMessage2(message3) {
52109
+ const direction = message3.direction === "inbound" ? "\u2190" : "\u2192";
52110
+ const date5 = message3.receivedAt ?? message3.sentAt;
52111
+ const body = message3.text ? `
52112
+ ${message3.text}` : "";
52113
+ const cc = message3.cc?.length ? `
52114
+ CC: ${message3.cc.join(", ")}` : "";
52115
+ const files = (message3.attachments ?? []).map((file2) => `
52032
52116
  Attachment: ${JSON.stringify(file2.filename)} ${file2.mimeType} ${file2.size} bytes ${file2.attachmentId}`).join("");
52033
- return `${direction} ${fmtTime2(date5)} ${message4.from ?? "unknown"} [${message4.deliveryStatus}] ${message4.messageId}${cc}${files}${body}`;
52117
+ return `${direction} ${fmtTime2(date5)} ${message3.from ?? "unknown"} [${message3.deliveryStatus}] ${message3.messageId}${cc}${files}${body}`;
52034
52118
  }
52035
52119
  var AgentMailAddress = class extends ClientCommand {
52036
52120
  static paths = [["agent", "mail", "address"]];
@@ -52625,6 +52709,7 @@ Continuing with your command.
52625
52709
 
52626
52710
  // cli.ts
52627
52711
  acceptUnknownResultFields();
52712
+ setErrorExplainer(explainActivityNotFound);
52628
52713
  var cli = new Cli({
52629
52714
  binaryLabel: "Ente knowledge-graph / relationship-manager CLI (ente.fast)",
52630
52715
  binaryName: "ente",
@@ -52636,6 +52721,7 @@ for (const Cmd of [
52636
52721
  ...AUTH_COMMANDS,
52637
52722
  ...IDENTITY_COMMANDS,
52638
52723
  ...ENTITY_COMMANDS,
52724
+ ...ENTITY_MERGE_COMMANDS,
52639
52725
  ...ACTIVITY_COMMANDS,
52640
52726
  ...ACTIVITY_FIELD_COMMANDS,
52641
52727
  ...ACTIVITY_MESSAGE_COMMANDS,
@@ -52677,9 +52763,9 @@ async function main() {
52677
52763
  stderr: process.stderr,
52678
52764
  cacheDir: configDir(ENTE_BRANDING)
52679
52765
  });
52680
- const profileIndex = argv.indexOf("--profile");
52766
+ const flagProfile = profileFromArgv(argv);
52681
52767
  const previousProfile = process.env.ENTE_PROFILE;
52682
- if (profileIndex >= 0 && argv[profileIndex + 1]) process.env.ENTE_PROFILE = argv[profileIndex + 1];
52768
+ if (flagProfile) process.env.ENTE_PROFILE = flagProfile;
52683
52769
  let adminSetup = false;
52684
52770
  try {
52685
52771
  if (!OFFLINE.has(argv[0] ?? "")) {
@@ -52708,7 +52794,22 @@ async function main() {
52708
52794
  upgradeCommand: ENTE_BRANDING.upgradeCommand
52709
52795
  });
52710
52796
  }
52711
- process.exitCode = await runCli(cli, argv, { stdout: process.stdout, stderr: process.stderr });
52797
+ let args = argv;
52798
+ if (usesCurrentTask(argv) && !argv.some((value) => ["--help", "-h"].includes(value))) {
52799
+ if (flagProfile) process.env.ENTE_PROFILE = flagProfile;
52800
+ try {
52801
+ const current = await resolveCurrentTask(restCurrentTaskLookup(EnteClient.fromConfig(ENTE_BRANDING)));
52802
+ args = substituteCurrentTask(argv, current.activityId);
52803
+ } catch (error62) {
52804
+ writeCommandError(process.stdout, process.stderr, argv.includes("--json"), error62);
52805
+ process.exitCode = 1;
52806
+ return;
52807
+ } finally {
52808
+ if (previousProfile === void 0) delete process.env.ENTE_PROFILE;
52809
+ else process.env.ENTE_PROFILE = previousProfile;
52810
+ }
52811
+ }
52812
+ process.exitCode = await runCli(cli, args, { stdout: process.stdout, stderr: process.stderr });
52712
52813
  }
52713
52814
  void main();
52714
52815
  /*! Bundled license information: