ente-cli 0.4.126 → 0.4.128

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
@@ -846,7 +846,9 @@ Entity values use typed `fields`; entity `--attr` and attribute payloads are leg
846
846
  `entity update --field` merges only supplied labels. Repeat JSON objects to store
847
847
  several values under one label; use `"value":null` to remove that label's values.
848
848
  A field ID selects an existing definition; a new label is owned by the acting
849
- space. Activity, task and list `--attr` options keep their existing behavior.
849
+ space. Activity/task write `--attr` remains a legacy compatibility input. Prefer
850
+ typed `--field` writes. List `--attr` names a configured cell and writes canonical
851
+ fields; its spelling stays unchanged. Lookup `--attr` remains an indexed alias.
850
852
 
851
853
  Entity parent settings: each child can have one regular parent plus additional
852
854
  parents with `allowNonExclusiveChildren: true`. Missing means false. Create or
@@ -945,7 +947,7 @@ space, mail and agent-management commands remain unavailable.
945
947
  Use exact IDs with canonical JSON; these commands avoid broad name resolution:
946
948
 
947
949
  ```text
948
- ente task sync createActivity '{"type":"task","spaceId":"<personal-id>","entityIds":["<entity-id>"],"title":"Example","content":"[T3 thread](<thread-link>)","externalKey":"t3_thread_id:<thread-id>","agentAssigneeIds":["<operator-agent-id>","<sync-agent-id>"],"assigneeIds":["<human-user-id>"],"deadline":{"date":"2026-11-19","time":"20:30","timezone":"Europe/Berlin"},"attributes":{"t3_thread_id":"<thread-id>"}}' --profile ente-operator --json
950
+ ente task sync createActivity '{"type":"task","spaceId":"<personal-id>","entityIds":["<entity-id>"],"title":"Example","content":"[T3 thread](<thread-link>)","externalKey":"t3_thread_id:<thread-id>","agentAssigneeIds":["<operator-agent-id>","<sync-agent-id>"],"assigneeIds":["<human-user-id>"],"deadline":{"date":"2026-11-19","time":"20:30","timezone":"Europe/Berlin"},"fields":[{"label":"t3_thread_id","value":"<thread-id>"}]}' --profile ente-operator --json
949
951
  ente task sync getActivity '{"spaceId":"<personal-id>","externalKey":"t3_thread_id:<thread-id>","includeDeleted":true}' --profile ente-operator --json
950
952
  ente task sync updateActivity '{"activityId":"<activity-id>","completed":false,"deadline":null}' --profile ente-operator --json
951
953
  ente task sync updateActivityAssignees '{"activityId":"<activity-id>","action":"remove","assigneeIds":["<human-user-id>"]}' --profile ente-operator --json
@@ -1001,7 +1003,7 @@ Entity exact-value lookup: `ente entity list --field "External ID=Case=ID"`. The
1001
1003
 
1002
1004
  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.
1003
1005
 
1004
- Activity writes accept `fields: [{label | fieldId, type?, value}]` through REST/MCP and `task sync createActivity|updateActivity`. Exactly one selector is required. `value: null` removes; number/boolean use typed JSON values, multi-select accepts string arrays, JSON uses serialized JSON strings. Existing types cannot be changed by a value write; unknown labels and select options follow writer rules. Do not address one field in both `attributes` and `fields`, or repeat selectors. Writes preserve original legacy key spelling and existing delegation/idempotency rules. Typed writes require first verified readiness; later re-verification only closes indexed reads. Invalid typed fields use `ACTIVITY_FIELD_VALUE_INVALID` (`INVALID_INPUT`), caps use `ACTIVITY_FIELD_LIMIT_EXCEEDED`. Serialized JSON `null` and blank JSON strings reject explicitly because compatibility storage cannot retain them; transport `null` clears.
1006
+ Activity writes and each `batchUpdateTasks` item accept `fields: [{label | fieldId, type?, value}]` through REST/MCP and `task sync createActivity|updateActivity`. Exactly one selector is required. `value: null` removes; number/boolean use typed JSON values, multi-select accepts string arrays, JSON uses serialized JSON strings. Existing types cannot be changed by a value write; unknown labels and select options follow writer rules. Do not address one field in both `attributes` and `fields`, or repeat selectors. Writes preserve original legacy key spelling and existing delegation/idempotency rules. Typed writes require first verified readiness; later re-verification only closes indexed reads. Invalid typed fields use `ACTIVITY_FIELD_VALUE_INVALID` (`INVALID_INPUT`), caps use `ACTIVITY_FIELD_LIMIT_EXCEEDED`. Serialized JSON `null` and blank JSON strings reject explicitly because compatibility storage cannot retain them; transport `null` clears.
1005
1007
 
1006
1008
  ```sh
1007
1009
  ente activity update <id> --field '{"label":"estimate","type":"number","value":3}' --profile ente-operator --json
@@ -1016,3 +1018,17 @@ Activity definitions are shared across a space. Writers create definitions impli
1016
1018
  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.
1017
1019
 
1018
1020
  Canvas HTML panel commands negotiate `spaceOwned: true` for boards without entity associations. Older clients require an entity-linked board and receive a precondition error before any write.
1021
+
1022
+ CLI list upsert planning reads canonical field IDs through the list's bindings,
1023
+ including after a display-label change. Canonical list JSON output contains
1024
+ `fields`; it does not reconstruct `attributes` from retained source cells.
1025
+
1026
+
1027
+ Activity `attributes` remains a compatibility alias; the retirement flag stays
1028
+ off. After verified storage cutover, task `--attr`, task-sync `attributes`, REST,
1029
+ MCP and native legacy inputs write canonical fields only and do not recreate the
1030
+ raw column. Compatibility reads preserve original key spelling through a
1031
+ canonical carrier. Typed `--field` and task-sync `fields` remain available.
1032
+ Exact lookup `--attr` remains an alias for `--field label=value`. Database list
1033
+ cell shorthand writes canonical fields. Source clearing is a separate verified
1034
+ operation, not an API retirement.
package/dist/cli.mjs CHANGED
@@ -27850,6 +27850,16 @@ var activityFieldTypeSchema = external_exports.enum(ACTIVITY_FIELD_TYPE_VALUES);
27850
27850
  var activityFieldOptionValidator = v.object({ value: v.string(), label: v.optional(v.string()), color: v.optional(v.string()) });
27851
27851
  var MAX_ACTIVITY_FIELD_VALUES = 1e3;
27852
27852
  var externalActivityFieldValueSchema = external_exports.strictObject({ valueId: external_exports.string(), fieldId: external_exports.string(), label: external_exports.string(), type: activityFieldTypeSchema, value: external_exports.string() });
27853
+ function activityFieldDisplayEntries(source2) {
27854
+ if (source2.fields === void 0) return Object.entries(source2.attributes ?? {}).map(([label, value]) => ({ id: label, label, value, type: void 0 }));
27855
+ const groups = /* @__PURE__ */ new Map();
27856
+ for (const field of source2.fields) {
27857
+ const group = groups.get(field.fieldId) ?? { fieldId: field.fieldId, label: field.label, type: field.type, values: [] };
27858
+ group.values.push(field);
27859
+ groups.set(field.fieldId, group);
27860
+ }
27861
+ return [...groups.values()].flatMap(({ values, ...field }) => field.type === "multi-select" ? [{ ...field, id: field.fieldId, value: activityFieldLegacyValue(field.type, values.map((row) => row.value)) }] : values.map((row) => ({ ...field, id: row.valueId, value: activityFieldLegacyValue(field.type, [row.value]) })));
27862
+ }
27853
27863
  var externalActivityFieldValueValidator = v.object({ valueId: v.string(), fieldId: v.string(), label: v.string(), type: activityFieldTypeValidator, value: v.string() });
27854
27864
  var activityFieldFilterSchema = external_exports.strictObject({ label: external_exports.string().trim().min(1).max(100), value: external_exports.string().min(1).max(16384) });
27855
27865
  var activityFieldFiltersSchema = external_exports.union([activityFieldFilterSchema, external_exports.array(activityFieldFilterSchema).min(1).max(10)]);
@@ -27872,6 +27882,11 @@ var activityFieldPlanSummaryValidator = v.object({
27872
27882
  resolvedLabel: v.optional(v.string())
27873
27883
  });
27874
27884
  var MAX_ACTIVITY_FIELD_DEFINITION_READ_BYTES = 6 * 1024 * 1024;
27885
+ function activityFieldLegacyValue(type, values) {
27886
+ const first = values[0];
27887
+ if (first === void 0) return void 0;
27888
+ return type === "multi-select" ? values : type === "number" ? Number(first) : type === "boolean" ? first.trim().toLowerCase() === "true" : type === "json" ? JSON.parse(first) : first;
27889
+ }
27875
27890
 
27876
27891
  // ../packages/shared/src/activity-dates.ts
27877
27892
  var DEFAULT_DEADLINE_TIME_ZONE = "Europe/Berlin";
@@ -28747,7 +28762,7 @@ function parseOperationAttrs(operation, pairs) {
28747
28762
  }
28748
28763
 
28749
28764
  // ente/version.ts
28750
- var VERSION = "0.4.126";
28765
+ var VERSION = "0.4.128";
28751
28766
 
28752
28767
  // ente/branding.ts
28753
28768
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -28924,8 +28939,8 @@ function validDate(value) {
28924
28939
  var activityWriteDeadline = external_exports.union([external_exports.number(), readableActivityDate]);
28925
28940
  var nullableDeadline = activityWriteDeadline.nullable();
28926
28941
  var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
28927
- var stringAttributes2 = external_exports.record(attributeKey, external_exports.string());
28928
- var patchAttributes = attributeStringPatch;
28942
+ var stringAttributes2 = external_exports.record(attributeKey, external_exports.string()).describe("Legacy input: ACTIVITY_ATTRIBUTES_RETIRED when server retirement is on (default off); use fields.");
28943
+ var patchAttributes = attributeStringPatch.describe("Legacy input: ACTIVITY_ATTRIBUTES_RETIRED when server retirement is on (default off); use fields.");
28929
28944
  var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
28930
28945
  var assignment = external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, action: external_exports.enum(["replace", "add", "remove", "clear"]), assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.describe("At most 20 IDs for replace. Add/remove/clear retain the installed bounded wire array; add deduplicates before enforcing at most 20 assigned agents in the resulting task. Assignment grants no access.").optional() }).refine((value) => value.action !== "replace" || value.agentAssigneeIds === void 0 || value.agentAssigneeIds.length <= MAX_ACTIVITY_AGENT_ASSIGNEES, { path: ["agentAssigneeIds"], message: "Too many replacement agent assignees" });
28931
28946
  var attributes = external_exports.strictObject({ activityId: id4, action: external_exports.enum(["set", "remove", "replace", "clear"]), attributes: stringAttributes2.optional(), keys: strings.optional() }).refine((value) => value.action !== "set" || value.attributes !== void 0 && Object.keys(value.attributes).length > 0, { path: ["attributes"], message: "set requires attributes" }).refine((value) => value.action !== "remove" || value.keys !== void 0 && value.keys.length > 0, { path: ["keys"], message: "remove requires keys" });
@@ -28942,7 +28957,7 @@ var activityWriteInputs = {
28942
28957
  deleteActivityMessage: external_exports.strictObject({ messageId: id4 }),
28943
28958
  deleteActivity: external_exports.strictObject({ activityId: id4 }),
28944
28959
  restoreActivity: external_exports.strictObject({ activityId: id4 }),
28945
- batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), attributes: patchAttributes.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
28960
+ batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
28946
28961
  };
28947
28962
  var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
28948
28963
  function isActivityWriteOperationName(name4) {
@@ -29097,18 +29112,18 @@ function operationResultSchema(validator) {
29097
29112
  var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "updateActivityAttributes", "toggleActivityCompleted", "batchUpdateTasks"]);
29098
29113
  var descriptions = {
29099
29114
  createActivity: "Create in an explicit space with existing owners. externalKey reserves an agent-and-space task key atomically; retries return the first ID without applying changed fields, including completed/deleted tasks. sourceCreatedAt is for imports. fields use label or fieldId, optional type and typed value; null clears. JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
29100
- updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped; overlap with attributes is rejected. Attributes merge strings and delete null-valued keys. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
29115
+ updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped; overlap with attributes is rejected. Attributes remain a compatibility alias: strings merge and null removes, with canonical-only storage after cutover and original key spelling in reads. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
29101
29116
  updateActivityTitle: "Set or clear an activity title. Existing revision and verified updater bookkeeping stay in the same transaction.",
29102
29117
  updateActivityDeadline: "Set a readable or finite epoch deadline; null clears it and omission leaves it unchanged in this profile.",
29103
29118
  updateActivityContent: "Replace the ordinary activity body with markdown, preserving revisions and read-only provider-email policy. Version-window editing is a separate operation family.",
29104
- updateActivityAttributes: "Set merges strings, remove deletes selected keys, replace deletes previously observed keys and applies strings, clear deletes previously observed keys. Uses the existing authorized read then write profile; concurrent unseen keys may survive replace/clear. Receipt acknowledges the committing mutation; legacy enrichment is a later observation.",
29119
+ updateActivityAttributes: "Compatibility alias over canonical fields; original key spellings round-trip. Set merges strings, remove deletes selected keys, replace deletes previously observed keys and applies strings, clear deletes previously observed keys. Uses the existing authorized read then write profile; concurrent unseen keys may survive replace/clear. Receipt acknowledges the committing mutation; legacy enrichment is a later observation.",
29105
29120
  updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports commit; legacy enrichment is later.",
29106
29121
  toggleActivityCompleted: "Toggle using the native read-then-set profile. The inverse is selected before the write, so concurrent toggles are not serialized as repeated atomic flips. Receipt reports the completed value committed by this write. Explicit updateActivity.completed remains idempotent.",
29107
29122
  addActivityMessage: "Append an ordinary activity discussion message with verified author and agent identity. This is separate from human-only Native Messenger and from edits to the parent activity body.",
29108
29123
  deleteActivityMessage: "Permanently delete an activity message you authored. Agents delete only their own agent's messages.",
29109
29124
  deleteActivity: "Archive an activity through the existing lifecycle and task cleanup. Already archived records are unchanged.",
29110
29125
  restoreActivity: "Restore an activity through the existing lifecycle, ownership, actor and task index rules. Already active records are unchanged.",
29111
- batchUpdateTasks: "Validate the complete batch structure before dispatch, then commit each item sequentially through the ordinary activity update. Stop at the first failure and report committed IDs/count and failed index. Earlier commits remain; later items never run. No automatic retry or whole-batch rollback."
29126
+ batchUpdateTasks: "Validate the complete batch before dispatch; each item accepts typed fields like updateActivity. Commit items sequentially. Stop at the first failure and report committed IDs/count and failed index. Earlier commits remain; later items never run. No automatic retry or whole-batch rollback."
29112
29127
  };
29113
29128
  function propertySchema(schema) {
29114
29129
  if (typeof schema !== "object") throw new Error("Activity write property schema must be an object");
@@ -35749,6 +35764,11 @@ function formatTaskDetail(task2, users) {
35749
35764
  const names = assignees2.map((uid) => users[uid]?.name || users[uid]?.email || uid);
35750
35765
  lines.push(`Assignees: ${names.join(", ")}`);
35751
35766
  }
35767
+ const fields4 = activityFieldDisplayEntries(a);
35768
+ if (fields4.length) {
35769
+ lines.push("Fields:");
35770
+ for (const field of fields4) lines.push(` ${field.label}: ${String(field.value)}`);
35771
+ }
35752
35772
  if (a.contentPlainText) {
35753
35773
  lines.push("");
35754
35774
  lines.push(a.contentPlainText);
@@ -35777,9 +35797,10 @@ function formatActivityDetail(a) {
35777
35797
  lines.push(`Created: ${formatDatetime(a.createdAt)}`);
35778
35798
  if (a.deadline) lines.push(`Deadline: ${formatDatetime(a.deadline)}`);
35779
35799
  if (a.completed !== void 0) lines.push(`Status: ${a.completed ? "completed" : "open"}`);
35780
- if (a.attributes && Object.keys(a.attributes).length) {
35781
- lines.push("Attributes:");
35782
- for (const [k, v3] of Object.entries(a.attributes)) lines.push(` ${k}: ${String(v3)}`);
35800
+ const fields4 = activityFieldDisplayEntries(a);
35801
+ if (fields4.length) {
35802
+ lines.push("Fields:");
35803
+ for (const field of fields4) lines.push(` ${field.label}: ${String(field.value)}`);
35783
35804
  }
35784
35805
  if (a.attachments?.length) {
35785
35806
  lines.push("Attachments:");
@@ -36035,13 +36056,6 @@ ${footer}` : body;
36035
36056
  const cutoff = Date.now() - opts.hours * 36e5;
36036
36057
  tasks2 = tasks2.filter((t) => (t.activity?.createdAt ?? 0) >= cutoff);
36037
36058
  }
36038
- if (Object.keys(attrDict).length) {
36039
- tasks2 = tasks2.filter(
36040
- (t) => Object.entries(attrDict).every(
36041
- ([k, v3]) => String(t.activity?.attributes?.[k] ?? "") === v3
36042
- )
36043
- );
36044
- }
36045
36059
  if (opts.sort === "created") {
36046
36060
  tasks2.sort((a, b) => (b.activity?.createdAt ?? 0) - (a.activity?.createdAt ?? 0));
36047
36061
  } else {
@@ -36117,11 +36131,6 @@ ${footer}` : body;
36117
36131
  }
36118
36132
  if (opts.typeFilter) activities = activities.filter((a) => a.type === opts.typeFilter);
36119
36133
  if (opts.onlyOpen) activities = activities.filter((a) => !a.completed);
36120
- if (Object.keys(attrDict).length) {
36121
- activities = activities.filter(
36122
- (a) => Object.entries(attrDict).every(([k, v3]) => String(a.attributes?.[k] ?? "") === v3)
36123
- );
36124
- }
36125
36134
  if (opts.sort === "deadline") {
36126
36135
  activities.sort(
36127
36136
  (a, b) => (a.deadline ?? Number.POSITIVE_INFINITY) - (b.deadline ?? Number.POSITIVE_INFINITY)
@@ -41801,7 +41810,7 @@ var legacyTasks = external_exports.array(legacyTaskReadItem).max(TASK_READ_LIMIT
41801
41810
  var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
41802
41811
  var legacyTaskReadResults = { listTasks: legacyTasks, getTaskByNumber: legacyTaskReadItem.nullable(), listOpenTasks: legacyTasks, listTasksDueBy: legacyTasks, listOpenTasksForEntity: legacyTasks };
41803
41812
  var user2 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
41804
- var taskReadLegacyEnrichedItem = legacyTaskReadItem.extend({ activity: legacyTaskReadItem.shape.activity.extend({ attributes: external_exports.record(external_exports.string(), external_exports.json()), assignees: external_exports.array(user2) }) });
41813
+ var taskReadLegacyEnrichedItem = legacyTaskReadItem.extend({ activity: legacyTaskReadItem.shape.activity.extend({ attributes: external_exports.record(external_exports.string(), external_exports.json()).optional(), assignees: external_exports.array(user2) }) });
41805
41814
  var taskReadLegacyUsers = external_exports.record(external_exports.string(), user2);
41806
41815
 
41807
41816
  // ../packages/shared/src/activity-content-operations.ts
@@ -41901,7 +41910,7 @@ var graphMembers = external_exports.array(external_exports.object({
41901
41910
  membership: external_exports.object({ _id: graphId2, userId: graphId2, spaceId: graphId2, role: external_exports.enum(["owner", "admin", "member"]) }).catchall(external_exports.json().optional()),
41902
41911
  user: external_exports.object({ _id: graphId2, name: external_exports.string().optional(), email: external_exports.string().optional() }).catchall(external_exports.json().optional()).nullable()
41903
41912
  }).catchall(external_exports.json().optional()));
41904
- var legacyTaskActivity = graphPublicRich.pick({ _id: true, type: true, title: true, contentPlainText: true, createdAt: true, deadline: true, completed: true, shortId: true, attributes: true, tags: true, assigneeIds: true }).extend({ type: external_exports.literal("task"), entityIds: external_exports.array(graphId2) });
41913
+ var legacyTaskActivity = graphPublicRich.pick({ _id: true, type: true, title: true, contentPlainText: true, createdAt: true, deadline: true, completed: true, shortId: true, attributes: true, fields: true, fieldIndexReady: true, tags: true, assigneeIds: true }).extend({ type: external_exports.literal("task"), entityIds: external_exports.array(graphId2) });
41905
41914
  var graphTaskItem = external_exports.strictObject({ activity: legacyTaskActivity.strict(), entities: external_exports.array(external_exports.strictObject({ _id: graphId2, name: external_exports.string() })) });
41906
41915
  var spacesSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()).optional() }));
41907
41916
  var usersSchema = external_exports.record(external_exports.string(), external_exports.strictObject({ name: external_exports.string().optional(), email: external_exports.string().optional() }));
@@ -42957,6 +42966,7 @@ function requireEntitySelector(operation, value, field) {
42957
42966
  }
42958
42967
 
42959
42968
  // ente/activity-fields.ts
42969
+ init_server();
42960
42970
  function parseActivityFields(flags) {
42961
42971
  if (flags === void 0) return void 0;
42962
42972
  const inputs = flags.map((flag, index) => {
@@ -42976,6 +42986,10 @@ function fieldCreateReceipt(raw) {
42976
42986
  function fieldUpdateReceipt(raw) {
42977
42987
  return parseZodOperationResult("updateActivity", updated, raw, "Invalid activity update receipt").data;
42978
42988
  }
42989
+ var legacyWritePreflight = makeFunctionReference2("activityFields:assertLegacyWriteAllowed");
42990
+ async function assertLegacyActivityWriteAllowed(caller) {
42991
+ await caller.mutation(legacyWritePreflight, {});
42992
+ }
42979
42993
 
42980
42994
  // ../packages/shared/src/cli-protocol-dtos.ts
42981
42995
  var agentIdentity = v.object({ agentId: v.id("agents"), icon: v.optional(v.string()), name: v.string(), color: v.string(), archived: v.boolean() });
@@ -44179,6 +44193,8 @@ function toTaskItem(rich) {
44179
44193
  completed: rich.completed,
44180
44194
  shortId: rich.shortId,
44181
44195
  attributes: rich.attributes,
44196
+ fields: rich.fields,
44197
+ fieldIndexReady: rich.fieldIndexReady,
44182
44198
  tags: rich.tags,
44183
44199
  entityIds: rich.entityDetails.map((e) => e?._id).filter((id21) => !!id21),
44184
44200
  assigneeIds: rich.assigneeIds
@@ -44295,7 +44311,7 @@ var TaskCreate = class extends ClientCommand {
44295
44311
  description: "Create the task with no deadline (skip the default of tomorrow 22:00)"
44296
44312
  });
44297
44313
  tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
44298
- attr = options_exports.Array("--attr", { description: "Attributes as key=value pairs" });
44314
+ attr = options_exports.Array("--attr", { description: "Legacy key=value writes; server retirement rejects with ACTIVITY_ATTRIBUTES_RETIRED; use --field" });
44299
44315
  content = options_exports.String("--content", { description: "Task content/description" });
44300
44316
  sourceCreatedAt = options_exports.String("--source-created-at", {
44301
44317
  description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
@@ -44324,12 +44340,13 @@ var TaskCreate = class extends ClientCommand {
44324
44340
  const progress = graphProgress(this, "task.create", ["create", ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : [], ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
44325
44341
  return progress.run(async () => {
44326
44342
  const caller = await resolveCaller();
44343
+ if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
44327
44344
  const entityIds = await resolveEntitiesC(caller, intent.entities);
44328
44345
  const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
44329
44346
  const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
44330
44347
  const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
44331
44348
  parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
44332
- const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, attributes: attributes2, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
44349
+ const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, ...entries.length ? { attributes: attributes2 } : {}, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
44333
44350
  entityId: entityIds[0],
44334
44351
  additionalEntities: entityIds.slice(1),
44335
44352
  ownerSpaceId: spaceId2,
@@ -44355,7 +44372,7 @@ var TaskUpdate = class extends ClientCommand {
44355
44372
  id = options_exports.String();
44356
44373
  title = options_exports.String("--title", { description: "Update title" });
44357
44374
  content = options_exports.String("--content", { description: "Update content" });
44358
- attr = options_exports.Array("--attr", { description: "Set attributes as key=value pairs" });
44375
+ attr = options_exports.Array("--attr", { description: "Legacy key=value writes; server retirement rejects with ACTIVITY_ATTRIBUTES_RETIRED; use --field" });
44359
44376
  deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
44360
44377
  clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
44361
44378
  field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
@@ -44371,10 +44388,11 @@ var TaskUpdate = class extends ClientCommand {
44371
44388
  const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : [], ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : []]);
44372
44389
  return progress.run(async () => {
44373
44390
  const caller = await resolveCaller();
44391
+ if (fields4 === void 0 && entries.length) await assertLegacyActivityWriteAllowed(caller);
44374
44392
  const activityId2 = await resolveTaskIdC(caller, this.id);
44375
44393
  progress.identify(activityId2);
44376
44394
  if (fields4 !== void 0) {
44377
- await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2, fields: fields4 }), fieldUpdateReceipt);
44395
+ await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, ...entries.length ? { attributes: attributes2 } : {}, fields: fields4 }), fieldUpdateReceipt);
44378
44396
  } else {
44379
44397
  if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle2, { activityId: activityId2, title: this.title }), graphAck);
44380
44398
  if (this.content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown2, { activityId: activityId2, markdown: this.content }), graphAck);
@@ -44987,7 +45005,7 @@ var findById = makeFunctionReference2("entities:findById");
44987
45005
  var activitiesCreate3 = makeFunctionReference2("activities:create");
44988
45006
  var activitiesGetByIdRich3 = makeFunctionReference2("activities:getByIdRich");
44989
45007
  var activitiesUpdateTitle3 = makeFunctionReference2("activities:updateTitle");
44990
- var setAttributeValue = makeFunctionReference2("activities:setAttributeValue");
45008
+ var setFieldCell = makeFunctionReference2("activityFields:setCell");
44991
45009
  var listRows = makeFunctionReference2("activities:listEntityDatabaseRowsPaginated");
44992
45010
  function descriptionArgs(entityId2, markdown) {
44993
45011
  parseEntityWriteRequest("updateEntity", { entityId: entityId2, description: markdown });
@@ -45034,7 +45052,7 @@ async function databaseWrite(call) {
45034
45052
  }
45035
45053
  }
45036
45054
  function cellArgs(activityId2, key, value, column) {
45037
- return parseDatabaseProtocolInput("activities:setAttributeValue", databaseCellWriteContract.args, { activityId: activityId2, key, value, ...column?.fieldIds?.length ? { fieldIds: column.fieldIds } : {} });
45055
+ return parseDatabaseProtocolInput("activityFields:setCell", databaseCellWriteContract.args, { activityId: activityId2, key, value, ...column?.fieldIds?.length ? { fieldIds: column.fieldIds } : {} });
45038
45056
  }
45039
45057
  function titleArgs(activityId2, title4) {
45040
45058
  const request = parseActivityWriteRequest("updateActivityTitle", { activityId: activityId2, title: title4 });
@@ -45091,13 +45109,11 @@ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
45091
45109
  for (const row of matches) {
45092
45110
  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.`);
45093
45111
  matchedKeys.set(row._id, value);
45094
- const keyed = structuredClone(row);
45095
- keyed.attributes = { ...row.attributes, [key]: value };
45096
- rows.set(row._id, keyed);
45112
+ rows.set(row._id, { row, match: { key, value } });
45097
45113
  }
45098
45114
  if (!matches.length) {
45099
45115
  const titles = new Set(inputs.filter((input2) => input2.attributes[key] === value && input2.title !== void 0).map((input2) => input2.title));
45100
- 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);
45116
+ 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 });
45101
45117
  }
45102
45118
  }
45103
45119
  return [...rows.values()];
@@ -45113,13 +45129,12 @@ function rowJson(row) {
45113
45129
  type: row.type,
45114
45130
  completed: row.completed ?? false,
45115
45131
  createdAt: row._creationTime,
45116
- attributes: row.attributes ?? {},
45117
- ...row.fields ? { fields: row.fields, fieldIndexReady: row.fieldIndexReady } : {},
45132
+ ...row.fields !== void 0 ? { fields: row.fields, fieldIndexReady: row.fieldIndexReady } : { attributes: row.attributes ?? {} },
45118
45133
  entities: (row.entityDetails ?? []).filter((e) => e !== null).map((e) => ({ entityId: e._id, name: e.name }))
45119
45134
  };
45120
45135
  }
45121
45136
  function rowLine(row) {
45122
- const attrStr = Object.entries(row.attributes ?? {}).filter(([, v3]) => v3 !== null && v3 !== void 0 && !(Array.isArray(v3) && v3.length === 0)).map(([k, v3]) => `${k}=${Array.isArray(v3) ? v3.join(",") : String(v3)}`).join(" ");
45137
+ const attrStr = activityFieldDisplayEntries(row).map((field) => [field.label, field.value]).filter(([, v3]) => v3 !== null && v3 !== void 0 && !(Array.isArray(v3) && v3.length === 0)).map(([k, v3]) => `${k}=${Array.isArray(v3) ? v3.join(",") : String(v3)}`).join(" ");
45123
45138
  return `- ${row.title || "(untitled)"} (${row._id})${attrStr ? ` [${attrStr}]` : ""}`;
45124
45139
  }
45125
45140
  async function applyStep(ctx, step, progress) {
@@ -45139,7 +45154,7 @@ async function applyStep(ctx, step, progress) {
45139
45154
  }
45140
45155
  for (const [index, [key, value]] of orderedCells(ctx, step).entries()) {
45141
45156
  const args = cellArgs(rowId, key, value, ctx.columns.find((column) => column.key === key));
45142
- await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutationUnqueued(setAttributeValue, args)), (raw) => parseOperationResult("activities:setAttributeValue", databaseCellWriteContract.result, raw));
45157
+ await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutationUnqueued(setFieldCell, args)), (raw) => parseOperationResult("activityFields:setCell", databaseCellWriteContract.result, raw));
45143
45158
  }
45144
45159
  return rowId;
45145
45160
  });
@@ -45170,8 +45185,14 @@ function columnOrThrow(columns, key, listName) {
45170
45185
  if (col.type !== "text") throw new Error(`--key '${key}' must be a text column (it is ${col.type}).`);
45171
45186
  return col;
45172
45187
  }
45173
- function toExisting(row) {
45174
- return { rowId: row._id, title: row.title ?? null, attributes: row.attributes ?? {} };
45188
+ function toExisting(row, columns = [], match) {
45189
+ if (row.fields === void 0) return { rowId: row._id, title: row.title ?? null, attributes: { ...row.attributes, ...match ? { [match.key]: match.value } : {} } };
45190
+ const cells = {};
45191
+ for (const column of columns) {
45192
+ const values = row.fields.filter((field) => column.fieldIds?.length ? column.fieldIds.some((id21) => id21 === field.fieldId) : fieldLabelKey(field.label) === fieldLabelKey(column.key));
45193
+ if (values.length) cells[column.key] = activityFieldLegacyValue(values[0].type, values.map((field) => field.value));
45194
+ }
45195
+ return { rowId: row._id, title: row.title ?? null, attributes: { ...cells, ...match ? { [match.key]: match.value } : {} } };
45175
45196
  }
45176
45197
 
45177
45198
  // ente/commands/listColumns.ts
@@ -45287,7 +45308,7 @@ var ListAdd = class extends ProfileCommand {
45287
45308
  ...content !== void 0 ? { content } : {}
45288
45309
  };
45289
45310
  if (this.key !== void 0) columnOrThrow(view.columns, this.key, entity5.name);
45290
- const existing = this.key !== void 0 ? (await fetchRowsForKeys(caller, entityId2, [input2], this.key)).map(toExisting) : [];
45311
+ const existing = this.key !== void 0 ? (await fetchRowsForKeys(caller, entityId2, [input2], this.key)).map(({ row, match }) => toExisting(row, view.columns, match)) : [];
45291
45312
  const keyColumn = this.key ?? "";
45292
45313
  const step = this.key !== void 0 ? planUpsert(existing, [input2], keyColumn)[0] : { action: "create", input: input2, key: "" };
45293
45314
  const deadline = this.type === "task" && this.deadline ? parseDeadline(this.deadline) : void 0;
@@ -45335,7 +45356,7 @@ var ListUpdate = class extends ProfileCommand {
45335
45356
  }
45336
45357
  for (const [index, [key, value]] of Object.entries(attributes2).entries()) {
45337
45358
  const args = cellArgs(row._id, key, value, view.columns.find((column) => column.key === key));
45338
- await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutation(setAttributeValue, args)), (raw) => parseOperationResult("activities:setAttributeValue", databaseCellWriteContract.result, raw));
45359
+ await progress.write(`cell:${index + 1}`, () => databaseWrite(() => caller.mutation(setFieldCell, args)), (raw) => parseOperationResult("activityFields:setCell", databaseCellWriteContract.result, raw));
45339
45360
  }
45340
45361
  });
45341
45362
  this.emitText(
@@ -45391,7 +45412,7 @@ var ListImport = class extends ProfileCommand {
45391
45412
  throw new Error(`Line ${l.line}: ${errorMessage(exc)}`);
45392
45413
  }
45393
45414
  });
45394
- const existing = (await fetchRowsForKeys(caller, entityId2, inputs, this.key)).map(toExisting);
45415
+ const existing = (await fetchRowsForKeys(caller, entityId2, inputs, this.key)).map(({ row, match }) => toExisting(row, view.columns, match));
45395
45416
  const steps = planUpsert(existing, inputs, this.key);
45396
45417
  const needsSpace = steps.some((s) => s.action === "create");
45397
45418
  const ownerSpaceId = needsSpace ? await resolveOwnerSpace(caller, this.space) : "";