ente-cli 0.4.122 → 0.4.124

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/SKILL.md CHANGED
@@ -237,6 +237,9 @@ ente list add "<list>" [--space "<space>"] --title "…" [--attr k=v ...] [--key
237
237
  ente list update "<list>" <rowId> [--attr k=v ...] [--title "…"] [--json] # empty value clears a cell
238
238
  ente list import "<list>" [--space "<space>"] --file rows.jsonl --key <textColumn> [--dry-run] [--concurrency 4] [--json] # {"title","attrs","content"} per line → created/updated/unchanged
239
239
  ente list show "<list>" [--all | --cursor <nextCursor>] [--limit 100] [--where k=v ...] [--view] [--json] # all rows by default; --view = table's saved filters
240
+ # --where and --key run on the server; key imports probe submitted keys, independent of saved filters.
241
+ # Columns bind space-wide field IDs/types/options. Text and JSON match exactly; typed values match normalized.
242
+ # Refresh pagination after ACTIVITY_FIELD_CURSOR_INVALID. Ordered consumers fall back until their metadata migration is ready.
240
243
  # Rows are activities: trash with `ente activity delete <rowId>`, promote with `ente activity update <rowId> --entity-add "<entity>"`. Guide: playbooks/database-list-sync.md
241
244
 
242
245
  # Activity agendas (all activity types)
@@ -989,7 +992,7 @@ Entity exact-value lookup: `ente entity list --field "External ID=Case=ID"`. The
989
992
 
990
993
  Activity field lookup uses the server index: `ente activity list --type task --field "t3_thread=t3code://threads/<env>/<id>" --profile ente-operator`. For the credential's own agent queue, use `ente agent tasks list --field "t3_thread=t3code://threads/<env>/<id>" --profile ente-operator`. `--attr` is an alias for `--field` on these two commands. Repeat the option for AND matching (at most ten filters). The first `=` separates label and value, preserving subsequent equals signs. Activity list also accepts `--space` and `--entity` to narrow the indexed result. History cursors and `--min-count` cannot be combined with a field lookup.
991
994
 
992
- Activity definitions are shared across a space. Writers create definitions implicitly through the compatibility `attributes` write. Before first verified readiness, legacy attributes retain their existing write behavior; incompatible provisional projections defer and keep lookup closed. After first readiness, existing definitions validate subsequent values, including during later re-verification. Invalid typed writes reject atomically with `ACTIVITY_FIELD_VALUE_INVALID` (`FAILED_PRECONDITION`); vocabulary/byte caps use `ACTIVITY_FIELD_LIMIT_EXCEEDED` (`LIMIT_EXCEEDED`). Historical select options remain valid even if the current board omits them. See `docs/activity-fields-migration.md` for the bounds and bridge procedure. Types include text, JSON, email, phone, URL, date, postal-address, salutation, job-title, number, boolean, single-select and multi-select. Text and JSON match the stored string exactly, including case and whitespace. All other types match their normalized value; `Foo@X.com` finds `foo@x.com`. JSON lookup values use serialized JSON, so a JSON string is written as `"value"`.
995
+ Activity definitions are shared across a space. Writers create definitions implicitly through the compatibility `attributes` write. Before first verified readiness, legacy attributes retain their existing write behavior; incompatible provisional projections defer and keep lookup closed. After first readiness, existing definitions validate subsequent values, including during later re-verification. Invalid typed writes reject atomically with `ACTIVITY_FIELD_VALUE_INVALID` (`FAILED_PRECONDITION`); vocabulary/byte caps use `ACTIVITY_FIELD_LIMIT_EXCEEDED` (`LIMIT_EXCEEDED`). Empty or whitespace-only strings clear a canonical value while preserving the legacy cell. A string in a multi-select field is one literal selection, never delimiter-split, and adds its option implicitly within existing limits. Unknown single-select values also add an option implicitly for every writer within the same limits. This does not create a Kanban column. Renaming, merging and removing options remain manager-only. Case/separator aliases share a definition; the compatibility attributes view retains the original stored key spelling. Historical select options remain valid even if the current board omits them. See `docs/activity-fields-migration.md` for the bounds and bridge procedure. Types include text, JSON, email, phone, URL, date, postal-address, salutation, job-title, number, boolean, single-select and multi-select. Text and JSON match the stored string exactly, including case and whitespace. All other types match their normalized value; `Foo@X.com` finds `foo@x.com`. JSON lookup values use serialized JSON, so a JSON string is written as `"value"`.
993
996
 
994
997
  REST `GET /api/external/activities` and `/api/external/tasks` accept URL-encoded JSON `field={"label":"t3_thread","value":"Case=ID"}`, or an array for AND. MCP `listActivities`/`activities_list`, `listTasks`/`tasks_list`, and `agent_tasks` (`operation: "list"`) use the same field shape. List/get results include `fields` (value ID, definition ID, label, type and stored string) once verification completes. `fieldIndexReady: false` withholds this array before verification. Indexed lookups fail with `ACTIVITY_FIELD_INDEX_NOT_READY` until the deployment's backfill is verified; do not replace this failure with a client scan. Candidate and output budgets fail explicitly instead of returning an incomplete field result. Legacy `attributes` remains the read/write compatibility view through phase 4.
995
998
 
package/dist/cli.mjs CHANGED
@@ -27854,7 +27854,22 @@ var activityFieldFilterSchema = external_exports.strictObject({ label: external_
27854
27854
  var activityFieldFiltersSchema = external_exports.union([activityFieldFilterSchema, external_exports.array(activityFieldFilterSchema).min(1).max(10)]);
27855
27855
  var activityFieldFilterValidator = v.object({ label: v.string(), value: v.string() });
27856
27856
  var activityFieldFiltersValidator = v.union(activityFieldFilterValidator, v.array(activityFieldFilterValidator));
27857
- var activityFieldReadFields = { fields: v.optional(v.array(externalActivityFieldValueValidator)), fieldIndexReady: v.optional(v.boolean()) };
27857
+ var activityFieldReadFields = { fields: v.optional(v.array(externalActivityFieldValueValidator)), fieldIndexReady: v.optional(v.boolean()), fieldConsumerReady: v.optional(v.boolean()) };
27858
+ var labelEvidenceValidator = v.object({ label: v.string(), count: v.number(), at: v.number(), id: v.string() });
27859
+ var activityFieldPlanSummaryValidator = v.object({
27860
+ variants: v.array(labelEvidenceValidator),
27861
+ types: v.array(activityFieldTypeValidator),
27862
+ textBoolean: v.boolean(),
27863
+ textNumeric: v.boolean(),
27864
+ // Retained for saved pre-v3 planning rows; new generations use the separate votes below.
27865
+ configured: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator, at: v.number(), id: v.string() })),
27866
+ configuredLabels: v.optional(v.array(labelEvidenceValidator)),
27867
+ configuredTypes: v.optional(v.array(activityFieldTypeValidator)),
27868
+ canonical: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
27869
+ existing: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
27870
+ options: v.optional(v.array(activityFieldOptionValidator)),
27871
+ resolvedLabel: v.optional(v.string())
27872
+ });
27858
27873
  var MAX_ACTIVITY_FIELD_DEFINITION_READ_BYTES = 6 * 1024 * 1024;
27859
27874
 
27860
27875
  // ../packages/shared/src/activity-dates.ts
@@ -28690,7 +28705,7 @@ function parseOperationAttrs(operation, pairs) {
28690
28705
  }
28691
28706
 
28692
28707
  // ente/version.ts
28693
- var VERSION = "0.4.122";
28708
+ var VERSION = "0.4.124";
28694
28709
 
28695
28710
  // ente/branding.ts
28696
28711
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -44395,6 +44410,7 @@ var databaseSelectOptionValidator = v.object({
44395
44410
  color: v.optional(v.string())
44396
44411
  });
44397
44412
  var entityDatabaseColumnValidator = v.object({
44413
+ fieldIds: v.optional(v.array(v.id("fields"))),
44398
44414
  key: v.string(),
44399
44415
  label: v.optional(v.string()),
44400
44416
  type: databaseAttributeTypeValidator,
@@ -44461,14 +44477,15 @@ var databaseViewContracts = {
44461
44477
  }
44462
44478
  };
44463
44479
  var databaseCellWriteContract = {
44464
- args: v.object({ activityId: v.id("activities"), key: v.string(), value: databaseAttributeValueValidator }),
44480
+ args: v.object({ activityId: v.id("activities"), fieldId: v.optional(v.id("fields")), fieldIds: v.optional(v.array(v.id("fields"))), key: v.string(), value: databaseAttributeValueValidator }),
44465
44481
  result: v.null()
44466
44482
  };
44467
44483
  var databaseRowsArgs = v.object({
44468
44484
  entityId: v.id("entities"),
44469
44485
  lensSpaceId: v.optional(v.id("spaces")),
44470
44486
  paginationOpts: paginationOptsValidator,
44471
- ignoreViewFilters: v.optional(v.boolean())
44487
+ ignoreViewFilters: v.optional(v.boolean()),
44488
+ where: v.optional(v.array(v.object({ key: v.string(), value: databaseAttributeValueValidator })))
44472
44489
  });
44473
44490
  function createDatabaseConfigurationContracts(owning) {
44474
44491
  return {
@@ -44668,16 +44685,6 @@ function parseWhere(columns, specs, listName) {
44668
44685
  return { key, value: coerceValue(column, spec.slice(eq + 1)) };
44669
44686
  });
44670
44687
  }
44671
- function matchesWhere(attributes2, clauses) {
44672
- const attrs = attributes2 ?? {};
44673
- return clauses.every(({ key, value }) => {
44674
- const cell = attrs[key];
44675
- if (Array.isArray(value) && value.length > 0) {
44676
- return Array.isArray(cell) && value.every((v3) => cell.includes(v3));
44677
- }
44678
- return sameValue(cell, value);
44679
- });
44680
- }
44681
44688
  function planUpsert(existing, inputs, keyColumn) {
44682
44689
  const byKey = /* @__PURE__ */ new Map();
44683
44690
  for (const row of existing) {
@@ -44844,8 +44851,8 @@ async function databaseWrite(call) {
44844
44851
  throw safe;
44845
44852
  }
44846
44853
  }
44847
- function cellArgs(activityId2, key, value) {
44848
- return parseDatabaseProtocolInput("activities:setAttributeValue", databaseCellWriteContract.args, { activityId: activityId2, key, value });
44854
+ function cellArgs(activityId2, key, value, column) {
44855
+ return parseDatabaseProtocolInput("activities:setAttributeValue", databaseCellWriteContract.args, { activityId: activityId2, key, value, ...column?.fieldIds?.length ? { fieldIds: column.fieldIds } : {} });
44849
44856
  }
44850
44857
  function titleArgs(activityId2, title4) {
44851
44858
  const request = parseActivityWriteRequest("updateActivityTitle", { activityId: activityId2, title: title4 });
@@ -44877,13 +44884,14 @@ async function loadList(caller, listNameOrId) {
44877
44884
  }
44878
44885
  };
44879
44886
  }
44880
- async function fetchAllRows(caller, entityId2) {
44887
+ async function fetchMatchingRows(caller, entityId2, where) {
44881
44888
  const rows = [];
44882
44889
  let cursor3 = null;
44883
44890
  for (; ; ) {
44884
44891
  const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
44885
44892
  entityId: entityId2,
44886
44893
  ignoreViewFilters: true,
44894
+ where,
44887
44895
  paginationOpts: { numItems: ROW_PAGE_SIZE, cursor: cursor3 }
44888
44896
  })));
44889
44897
  rows.push(...res.page);
@@ -44891,6 +44899,27 @@ async function fetchAllRows(caller, entityId2) {
44891
44899
  cursor3 = res.continueCursor;
44892
44900
  }
44893
44901
  }
44902
+ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
44903
+ const rows = /* @__PURE__ */ new Map();
44904
+ const matchedKeys = /* @__PURE__ */ new Map();
44905
+ const values = new Map(inputs.map((input2) => [JSON.stringify(input2.attributes[key]), input2.attributes[key]]));
44906
+ for (const value of values.values()) {
44907
+ if (typeof value !== "string" || !value.trim()) continue;
44908
+ const matches = await fetchMatchingRows(caller, entityId2, [{ key, value }]);
44909
+ for (const row of matches) {
44910
+ if (matchedKeys.has(row._id) && matchedKeys.get(row._id) !== value) throw new Error(`Multiple input keys resolve to row ${row._id}; use one key value before syncing.`);
44911
+ matchedKeys.set(row._id, value);
44912
+ const keyed = structuredClone(row);
44913
+ keyed.attributes = { ...row.attributes, [key]: value };
44914
+ rows.set(row._id, keyed);
44915
+ }
44916
+ if (!matches.length) {
44917
+ const titles = new Set(inputs.filter((input2) => input2.attributes[key] === value && input2.title !== void 0).map((input2) => input2.title));
44918
+ for (const title4 of titles) for (const row of await fetchMatchingRows(caller, entityId2, [{ key, value: null }, { key: "title", value: title4 }])) rows.set(row._id, row);
44919
+ }
44920
+ }
44921
+ return [...rows.values()];
44922
+ }
44894
44923
  async function resolveOwnerSpace(caller, space3) {
44895
44924
  if (!space3?.trim()) throw new Error("New list rows require --space (name or ID), including dry runs.");
44896
44925
  return resolveSpaceByNameC(caller, space3);
@@ -44903,6 +44932,7 @@ function rowJson(row) {
44903
44932
  completed: row.completed ?? false,
44904
44933
  createdAt: row._creationTime,
44905
44934
  attributes: row.attributes ?? {},
44935
+ ...row.fields ? { fields: row.fields, fieldIndexReady: row.fieldIndexReady } : {},
44906
44936
  entities: (row.entityDetails ?? []).filter((e) => e !== null).map((e) => ({ entityId: e._id, name: e.name }))
44907
44937
  };
44908
44938
  }
@@ -44926,7 +44956,7 @@ async function applyStep(ctx, step, progress) {
44926
44956
  rowId = await progress.write("create", () => databaseWrite(() => caller.mutationUnqueued(activitiesCreate3, args)), (raw) => graphResult(graphId2, raw), "activityId");
44927
44957
  }
44928
44958
  for (const [index, [key, value]] of orderedCells(ctx, step).entries()) {
44929
- const args = cellArgs(rowId, key, value);
44959
+ const args = cellArgs(rowId, key, value, ctx.columns.find((column) => column.key === key));
44930
44960
  await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutationUnqueued(setAttributeValue, args)), (raw) => parseOperationResult("activities:setAttributeValue", databaseCellWriteContract.result, raw));
44931
44961
  }
44932
44962
  return rowId;
@@ -45086,12 +45116,12 @@ var ListAdd = class extends ProfileCommand {
45086
45116
  ...content !== void 0 ? { content } : {}
45087
45117
  };
45088
45118
  if (this.key !== void 0) columnOrThrow(view.columns, this.key, entity5.name);
45089
- const existing = this.key !== void 0 ? (await fetchAllRows(caller, entityId2)).map(toExisting) : [];
45119
+ const existing = this.key !== void 0 ? (await fetchRowsForKeys(caller, entityId2, [input2], this.key)).map(toExisting) : [];
45090
45120
  const keyColumn = this.key ?? "";
45091
45121
  const step = this.key !== void 0 ? planUpsert(existing, [input2], keyColumn)[0] : { action: "create", input: input2, key: "" };
45092
45122
  const deadline = this.type === "task" && this.deadline ? parseDeadline(this.deadline) : void 0;
45093
45123
  const ownerSpaceId = step.action === "create" ? await resolveOwnerSpace(caller, this.space) : "";
45094
- const ctx = { caller, entityId: entityId2, ownerSpaceId, keyColumn, type: this.type, ...deadline !== void 0 ? { deadline } : {} };
45124
+ const ctx = { caller, entityId: entityId2, ownerSpaceId, keyColumn, columns: view.columns, type: this.type, ...deadline !== void 0 ? { deadline } : {} };
45095
45125
  const progress = graphProgress(this, "list add", rowStages(ctx, step), { entityId: entityId2, ...step.action !== "create" ? { activityId: step.rowId } : {} });
45096
45126
  const rowId = await applyStep(ctx, step, progress);
45097
45127
  const result = stepResult(step, rowId);
@@ -45142,7 +45172,7 @@ var ListUpdate = class extends ProfileCommand {
45142
45172
  await progress.write("title", () => databaseWrite(() => caller.mutation(activitiesUpdateTitle3, args)), graphAck);
45143
45173
  }
45144
45174
  for (const [index, [key, value]] of Object.entries(attributes2).entries()) {
45145
- const args = cellArgs(row._id, key, value);
45175
+ const args = cellArgs(row._id, key, value, view.columns.find((column) => column.key === key));
45146
45176
  await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutation(setAttributeValue, args)), (raw) => parseOperationResult("activities:setAttributeValue", databaseCellWriteContract.result, raw));
45147
45177
  }
45148
45178
  });
@@ -45199,7 +45229,7 @@ var ListImport = class extends ProfileCommand {
45199
45229
  throw new Error(`Line ${l.line}: ${errorMessage(exc)}`);
45200
45230
  }
45201
45231
  });
45202
- const existing = (await fetchAllRows(caller, entityId2)).map(toExisting);
45232
+ const existing = (await fetchRowsForKeys(caller, entityId2, inputs, this.key)).map(toExisting);
45203
45233
  const steps = planUpsert(existing, inputs, this.key);
45204
45234
  const needsSpace = steps.some((s) => s.action === "create");
45205
45235
  const ownerSpaceId = needsSpace ? await resolveOwnerSpace(caller, this.space) : "";
@@ -45209,7 +45239,7 @@ var ListImport = class extends ProfileCommand {
45209
45239
  if (this.dryRun) {
45210
45240
  steps.forEach((step, i) => results[i] = stepResult(step, step.action === "create" ? null : step.rowId));
45211
45241
  } else {
45212
- const ctx = { caller, entityId: entityId2, ownerSpaceId, keyColumn: this.key, type: "note" };
45242
+ const ctx = { caller, entityId: entityId2, ownerSpaceId, keyColumn: this.key, columns: view.columns, type: "note" };
45213
45243
  let done = 0;
45214
45244
  const writes = steps.map((step, index) => ({ step, index })).filter(({ step }) => step.action !== "unchanged");
45215
45245
  steps.forEach((step, i) => {
@@ -45355,6 +45385,7 @@ var ListShow = class extends ProfileCommand {
45355
45385
  const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
45356
45386
  entityId: entityId2,
45357
45387
  ...this.view ? {} : { ignoreViewFilters: true },
45388
+ where: clauses,
45358
45389
  paginationOpts: { numItems, cursor: cursor3 }
45359
45390
  })));
45360
45391
  rows.push(...res.page);
@@ -45362,7 +45393,7 @@ var ListShow = class extends ProfileCommand {
45362
45393
  if (!this.all || nextCursor === null) break;
45363
45394
  cursor3 = nextCursor;
45364
45395
  }
45365
- const kept = rows.filter((row) => matchesWhere(row.attributes, clauses));
45396
+ const kept = rows;
45366
45397
  this.emitText(
45367
45398
  { data: { entityId: entityId2, rows: kept.map(rowJson), count: kept.length, nextCursor, isDone: nextCursor === null } },
45368
45399
  () => {