ente-cli 0.4.114 → 0.4.116

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/README.md CHANGED
@@ -657,3 +657,17 @@ Both use the existing separate platform credential, never the agent key. Preview
657
657
  first; imports preserve server validation, idempotency and revision comparison.
658
658
  V1 and v2 formats and the human admin-session fallback are documented in
659
659
  `docs/admin-costs.md`. Keep provider credentials and real financial files outside Git.
660
+
661
+ Task delegation uses owner-managed **Acts for** grants on the delegate's Settings
662
+ page. `agent tasks list --principals granted --view attention --profile
663
+ ente-operator --json` includes own and directly granted queues. Use repeatable
664
+ `--for-agent <id>` for an explicit subset. Each task includes `agentId` and
665
+ `assignedAt`; cursors and observations are invalidated by grant or scope changes.
666
+ Delegated reads and acknowledgments remain bounded by the credential and
667
+ principal's live task access. Discussion, comments and claims stay own-agent-only.
668
+
669
+ Canonical task writes accept `onBehalfOfAgentId` or the explicit flag:
670
+ `ente task sync updateActivity '{"activityId":"<id>","completed":false}'
671
+ --on-behalf-of-agent <principal-id> --profile ente-operator --json`.
672
+ The principal is attributed as actor; the delegate remains the external-key
673
+ namespace and appears as provenance. Owner grant management rejects agent JWTs.
package/dist/SKILL.md CHANGED
@@ -950,3 +950,21 @@ from attention; acknowledge the exact issued observation only after processing i
950
950
  Task-only read can inspect but cannot acknowledge. Do not assign real operators
951
951
  for testing; use fictional local identities or the explicitly approved dedicated
952
952
  production test agent and its one task.
953
+
954
+ Task delegation: the human owner selects **Acts for** principals on the delegate's
955
+ Settings page. Agent credentials cannot administer grants. Use
956
+ `ente agent tasks list --principals granted --view attention --profile ente-operator --json`
957
+ or repeated `--for-agent <id>` selectors. Items include principal `agentId` and
958
+ assignment-generation `assignedAt`. Follow empty cursor pages until `isDone`.
959
+ Inspect then acknowledge exact observations; grant/scope changes invalidate
960
+ receipts. `selfAuthored` is relative to the assignment agent, not the delegate.
961
+ Discussion/message/comment/claim/renew/release remain own-agent-only.
962
+
963
+ Canonical create/update/assignees writes accept JSON `onBehalfOfAgentId` or
964
+ `--on-behalf-of-agent <id>` on `task sync`. Both live task scope and the direct
965
+ grant are required. The authenticated delegate owns externalKey namespaces,
966
+ including old v1 mappings; principal changes do not duplicate tasks. Other
967
+ resource access is never delegated. Link tasks with
968
+ `t3code://threads/<environmentId>/<threadId>`; native frame dispatch needs the
969
+ updated binary and a registered T3 handler. Never infer App Store delivery from
970
+ web deployment.
package/dist/cli.mjs CHANGED
@@ -28648,7 +28648,7 @@ function parseOperationAttrs(operation, pairs) {
28648
28648
  }
28649
28649
 
28650
28650
  // ente/version.ts
28651
- var VERSION = "0.4.114";
28651
+ var VERSION = "0.4.116";
28652
28652
 
28653
28653
  // ente/branding.ts
28654
28654
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -28792,11 +28792,11 @@ var nullableDeadline = activityWriteDeadline.nullable();
28792
28792
  var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
28793
28793
  var stringAttributes2 = external_exports.record(attributeKey, external_exports.string());
28794
28794
  var patchAttributes = attributeStringPatch;
28795
- var updateFields = { 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(), ...assignees };
28796
- var assignment = external_exports.strictObject({ 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" });
28795
+ 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(), ...assignees };
28796
+ 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" });
28797
28797
  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" });
28798
28798
  var activityWriteInputs = {
28799
- createActivity: external_exports.strictObject({ externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), attributes: stringAttributes2.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
28799
+ createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), attributes: stringAttributes2.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
28800
28800
  updateActivity: external_exports.strictObject(updateFields),
28801
28801
  updateActivityTitle: external_exports.strictObject({ activityId: id4, title: external_exports.string() }),
28802
28802
  updateActivityDeadline: external_exports.strictObject({ activityId: id4, deadline: nullableDeadline.optional() }),
@@ -33413,7 +33413,7 @@ var publicActivityRecordDto = publicActivityReadDto.extend({ deletedAt: external
33413
33413
  var selectActivity = selectPublicActivityRead.extend({ deletedAt: external_exports.number().optional(), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
33414
33414
  var user = external_exports.strictObject({ _id: id13, name: external_exports.string().optional(), email: external_exports.string().optional(), avatarInitials: external_exports.string().optional(), image: external_exports.string().optional() });
33415
33415
  var agent = external_exports.strictObject({ agentId: id13, icon: external_exports.union([external_exports.enum([.../* @__PURE__ */ new Set([...entityCustomIconIds, ...activityCustomIconIds, ...legacyCustomIconIds])]), external_exports.string().max(AGENT_ICON_IMAGE_MAX).startsWith("data:image/png;base64,").refine(isAgentIconImage)]).optional(), name: external_exports.string(), color: external_exports.string(), archived: external_exports.boolean() });
33416
- var actorFields = { createdByPersonalAgent: external_exports.boolean().optional(), createdByAgent: agent.nullable().optional(), updatedByAgent: agent.nullable().optional(), createdByAgentCreatorUser: user.omit({ email: true, image: true }).extend({ avatarInitials: external_exports.string() }).nullable().optional() };
33416
+ var actorFields = { createdViaAgent: agent.nullable().optional(), updatedViaAgent: agent.nullable().optional(), createdByPersonalAgent: external_exports.boolean().optional(), createdByAgent: agent.nullable().optional(), updatedByAgent: agent.nullable().optional(), createdByAgentCreatorUser: user.omit({ email: true, image: true }).extend({ avatarInitials: external_exports.string() }).nullable().optional() };
33417
33417
  var attachment = external_exports.strictObject({ attachmentId: id13, storageId: id13, name: external_exports.string(), mimeType: external_exports.string(), sizeBytes: external_exports.number(), url: external_exports.string().nullable() });
33418
33418
  var agenda = external_exports.strictObject({ _id: id13, parentPointId: id13.optional(), orderKey: external_exports.string(), title: external_exports.string(), titleMarkdown: external_exports.string(), contentMarkdown: external_exports.string(), contentVersion: external_exports.number().nullable(), updatedAt: external_exports.number() });
33419
33419
  var message = external_exports.strictObject({ _id: id13, activityId: id13, parentMessageId: id13.optional(), depth: external_exports.number().optional(), createdBy: id13, createdByAgentId: id13.optional(), updatedBy: id13.optional(), updatedByAgentId: id13.optional(), createdAt: external_exports.number(), updatedAt: external_exports.number(), contentPlainText: external_exports.string(), createdByUser: user.nullable(), createdByAgent: agent.nullable().optional(), updatedByAgent: agent.nullable().optional() });
@@ -33476,6 +33476,8 @@ var AGENT_TASK_OPERATIONS = ["list", "inspect", "get", "discussion", "message",
33476
33476
  var agentTaskInputSchema = {
33477
33477
  type: "object",
33478
33478
  properties: {
33479
+ principals: { type: "string", enum: ["granted"] },
33480
+ forAgentIds: { type: "array", maxItems: 21, items: { type: "string", minLength: 1 } },
33479
33481
  operation: { type: "string", enum: [...AGENT_TASK_OPERATIONS] },
33480
33482
  assignmentId: { type: "string", minLength: 1 },
33481
33483
  view: { type: "string", enum: ["open", "attention"], description: "list defaults to open; attention includes completed and removed tasks with unseen input." },
@@ -33494,7 +33496,7 @@ var agentTaskInputSchema = {
33494
33496
  additionalProperties: false
33495
33497
  };
33496
33498
  var fields2 = {
33497
- list: ["view", "cursor", "limit"],
33499
+ list: ["view", "cursor", "limit", "principals", "forAgentIds"],
33498
33500
  inspect: ["assignmentId", "observationId", "limit"],
33499
33501
  get: ["assignmentId"],
33500
33502
  discussion: ["assignmentId", "cursor", "limit"],
@@ -33515,6 +33517,9 @@ function validateAgentTaskInput(raw) {
33515
33517
  for (const key of ["assignmentId", "observationId", "claimToken", "cursor", "idempotencyKey", "messageId"]) {
33516
33518
  if (input2[key] !== void 0 && (typeof input2[key] !== "string" || !input2[key].trim())) return invalid4(`${key} must be a non-empty string`);
33517
33519
  }
33520
+ if (input2.principals !== void 0 && input2.principals !== "granted") return invalid4("Invalid principal selector");
33521
+ if (input2.forAgentIds !== void 0 && (!Array.isArray(input2.forAgentIds) || input2.forAgentIds.length > 21 || input2.forAgentIds.some((id21) => typeof id21 !== "string" || !id21.trim()))) return invalid4("Invalid agent IDs");
33522
+ if (input2.principals !== void 0 && input2.forAgentIds !== void 0) return invalid4("Choose one principal selector");
33518
33523
  if (operation === "message" && !input2.messageId) return invalid4("messageId is required");
33519
33524
  if (input2.offset !== void 0 && (!Number.isSafeInteger(input2.offset) || input2.offset < 0)) return invalid4("offset must be a non-negative integer");
33520
33525
  if (input2.expectedUpdatedAt !== void 0 && (typeof input2.expectedUpdatedAt !== "number" || !Number.isFinite(input2.expectedUpdatedAt))) return invalid4("expectedUpdatedAt must be a finite number");
@@ -33670,6 +33675,8 @@ var agentDisplayIdentityValidator = v.object({
33670
33675
  archived: v.boolean()
33671
33676
  });
33672
33677
  var activityActorDisplayFields = {
33678
+ createdViaAgent: v.optional(v.union(agentDisplayIdentityValidator, v.null())),
33679
+ updatedViaAgent: v.optional(v.union(agentDisplayIdentityValidator, v.null())),
33673
33680
  createdByPersonalAgent: v.optional(v.boolean()),
33674
33681
  createdByAgent: v.optional(v.union(agentDisplayIdentityValidator, v.null())),
33675
33682
  updatedByAgent: v.optional(v.union(agentDisplayIdentityValidator, v.null()))
@@ -33683,6 +33690,8 @@ var agentThreadStatusValidator2 = v.union(
33683
33690
 
33684
33691
  // ../packages/shared/src/agent-task-operation-results.ts
33685
33692
  var queueItemValidator = v.object({
33693
+ agentId: v.id("agents"),
33694
+ assignedAt: v.number(),
33686
33695
  assignmentId: v.id("taskAgentAssignments"),
33687
33696
  activityId: v.id("activities"),
33688
33697
  spaceId: v.id("spaces"),
@@ -33709,6 +33718,7 @@ var taskAgentEventFields = {
33709
33718
  activityId: v.id("activities"),
33710
33719
  version: v.number(),
33711
33720
  type: taskAgentEventTypeValidator,
33721
+ actorDelegateAgentId: v.optional(v.id("agents")),
33712
33722
  actorUserId: v.id("users"),
33713
33723
  actorAgentId: v.optional(v.id("agents")),
33714
33724
  occurredAt: v.number(),
@@ -33719,7 +33729,7 @@ var taskAgentEventFields = {
33719
33729
  contentExcerpt: v.optional(v.string()),
33720
33730
  messageId: v.optional(v.id("messages"))
33721
33731
  };
33722
- var eventValidator = v.object(taskAgentEventFields);
33732
+ var eventValidator = v.object({ ...taskAgentEventFields, selfAuthored: v.optional(v.boolean()) });
33723
33733
  var discussionItemValidator = v.object({
33724
33734
  messageId: v.id("messages"),
33725
33735
  content: v.string(),
@@ -42765,6 +42775,8 @@ var activityRevisionSummaryValidator = v.object({
42765
42775
  contentPlainText: v.optional(v.string()),
42766
42776
  source: v.union(v.literal("user"), v.literal("agent"), v.literal("recording")),
42767
42777
  authorId: v.id("users"),
42778
+ authorDelegateAgentId: v.optional(v.id("agents")),
42779
+ authorDelegateAgent: v.optional(v.union(agentIdentity, v.null())),
42768
42780
  authorAgentId: v.optional(v.id("agents")),
42769
42781
  authorAgent: v.optional(v.union(agentIdentity, v.null())),
42770
42782
  authorName: v.optional(v.string()),
@@ -44239,8 +44251,13 @@ var TaskSync = class extends ClientCommand {
44239
44251
  static usage = Command.Usage({ category: "Task", description: "Run a canonical task sync operation with JSON input" });
44240
44252
  operation = options_exports.String();
44241
44253
  input = options_exports.String();
44254
+ onBehalfOfAgentId = options_exports.String("--on-behalf-of-agent");
44242
44255
  async run() {
44243
- const raw = JSON.parse(this.input);
44256
+ let raw = JSON.parse(this.input);
44257
+ if (this.onBehalfOfAgentId) {
44258
+ if (!["createActivity", "updateActivity", "updateActivityAssignees"].includes(this.operation) || !raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error("--on-behalf-of-agent requires a canonical create/update/assignees operation");
44259
+ raw = { ...raw, onBehalfOfAgentId: this.onBehalfOfAgentId };
44260
+ }
44244
44261
  if (this.operation === "getActivity") {
44245
44262
  const request2 = parseActivityReadRequest("getActivity", raw);
44246
44263
  const result2 = await this.client().activityRead("getActivity", request2.input);
@@ -49473,6 +49490,8 @@ var AgentTasks = class extends ClientCommand {
49473
49490
  operation = options_exports.String();
49474
49491
  assignment = options_exports.String("--assignment");
49475
49492
  view = options_exports.String("--view");
49493
+ principals = options_exports.String("--principals");
49494
+ forAgentIds = options_exports.Array("--for-agent");
49476
49495
  cursor = options_exports.String("--cursor");
49477
49496
  limit = options_exports.String("--limit");
49478
49497
  observation = options_exports.String("--observation");
@@ -49495,8 +49514,11 @@ var AgentTasks = class extends ClientCommand {
49495
49514
  const expectedUpdatedAt = number5(this.expectedUpdatedAt, 0, Number.MAX_SAFE_INTEGER, "--expected-updated-at");
49496
49515
  const limit3 = number5(this.limit, 1, 100, "--limit");
49497
49516
  const version5 = number5(this.version, 0, Number.MAX_SAFE_INTEGER, "--version");
49517
+ if (this.principals !== void 0 && this.principals !== "granted") throw new Error("--principals must be granted");
49498
49518
  const input2 = {
49499
49519
  operation: this.operation,
49520
+ ...this.principals ? { principals: "granted" } : {},
49521
+ ...this.forAgentIds?.length ? { forAgentIds: this.forAgentIds } : {},
49500
49522
  ...this.assignment !== void 0 ? { assignmentId: this.assignment } : {},
49501
49523
  ...this.view !== void 0 ? { view: this.view } : {},
49502
49524
  ...this.cursor !== void 0 ? { cursor: this.cursor } : {},