ente-cli 0.4.71 → 0.4.72

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
@@ -423,3 +423,24 @@ JSON failures use stdout `{ "error": { "message": "..." } }` with a nonzero
423
423
  exit. REST status and structured error fields survive. Check the exit before
424
424
  parsing; see [Retrieve bounded context](playbooks/retrieve-bounded-context.md).
425
425
  The unsupported `entity show` spelling gives a targeted `entity get` correction.
426
+
427
+ ### Granted incident diagnostics
428
+
429
+ `ente diagnostics page --source toolMessages --since <epoch-ms> --until <epoch-ms> --profile ente-operator --json`
430
+ reads fixed global content-free aggregates using the existing bound agent REST
431
+ credential. Access is off unless a current human platform admin explicitly grants
432
+ this exact owned Personal agent diagnostics with expiry. Installation grants no
433
+ access. No grant/revoke or arbitrary admin executor is exposed to agents.
434
+
435
+ Sources/flags match `health page`: toolMessages, threads with `--status
436
+ idle|running|error`, recordings with its processing status; `--limit` 1–100,
437
+ `--cursor`, and `--stale-after-ms` 60000–86400000. Keep source/since/until fixed
438
+ across pages. Results put aggregates and continuation under `data.page`, with
439
+ window/observation/coverage alongside. Read every page before claiming complete
440
+ counts; terminal recording history excludes missing progress timestamps. No
441
+ message bodies or customer identifiers. The legacy `health page` remains a
442
+ separate human-admin JWT surface and never serves as a fallback.
443
+
444
+ Diagnostics is unavailable inside Ente-hosted chats, recordings and automations.
445
+ Use the external operator command. Whole-history panel sharing does not grant
446
+ access to diagnostics, and diagnostic reads do not append to chat history.
package/dist/SKILL.md CHANGED
@@ -583,3 +583,26 @@ assignees and preserves humans. `--clear-agent-assignees` removes the agent assi
583
583
  Assignment requires the agent to have write access in the task space; it grants no access.
584
584
 
585
585
  Scheduled runs also accept `runCondition: "new_chats"`: skip model execution unless this agent has new manual or recording chats since its previous scheduled check. Scheduled/reflection chats do not trigger it; explicit Run now bypasses the condition.
586
+
587
+ ## Explicit incident diagnostics
588
+
589
+ Use `ente diagnostics page --source toolMessages --since <epoch-ms> --until
590
+ <epoch-ms> --profile <bound-profile> --json` only within the requested incident.
591
+ A current human platform admin must explicitly grant the exact owned Personal
592
+ agent read-only global health aggregates with expiry in its agent editor. An
593
+ admin owner, company billing role, settings delegation or mailbox grant alone
594
+ is insufficient. Do not grant or renew access yourself, change credentials, or
595
+ fall back to `health page` after denial. Installation enables no grant.
596
+
597
+ Source/window flags match `health page`; rows 1–100, read budget 1 MiB, tool-message
598
+ and terminal recording windows at most 7 days. Active recordings require `since=0`;
599
+ terminal recordings require positive since and exclude legacy missing timestamps.
600
+ Responses contain window/observation/coverage and `data.page` aggregates. Continue
601
+ with `--cursor <data.page.continueCursor>` while `isDone=false`, keeping the
602
+ window/source fixed. Only sum completed pages; partial/unavailable is not zero
603
+ failures. These live state pages are not an atomic or immutable incident history.
604
+ No customer bodies, arbitrary account lookup, settings writes or mailbox retries.
605
+
606
+ Diagnostics is unavailable inside Ente-hosted chats, recordings and automations.
607
+ Use the external operator command. Whole-history panel sharing does not grant
608
+ access to diagnostics, and diagnostic reads do not append to chat history.
package/dist/cli.mjs CHANGED
@@ -3800,7 +3800,7 @@ async function runCli(cli2, argv, context) {
3800
3800
  }
3801
3801
 
3802
3802
  // ente/version.ts
3803
- var VERSION = "0.4.71";
3803
+ var VERSION = "0.4.72";
3804
3804
 
3805
3805
  // ente/branding.ts
3806
3806
  var NPM_REGISTRY = "https://registry.npmjs.org";
@@ -4275,6 +4275,9 @@ var EnteClient = class _EnteClient {
4275
4275
  body
4276
4276
  );
4277
4277
  }
4278
+ diagnostics(body) {
4279
+ return this.rest.post("/api/external/agent/diagnostics", body);
4280
+ }
4278
4281
  agentTasks(body) {
4279
4282
  return this.rest.post("/api/external/agent/tasks", body);
4280
4283
  }
@@ -13974,11 +13977,15 @@ var ListShow = class extends ClientCommand {
13974
13977
  };
13975
13978
  var LIST_COMMANDS = [ListCreate, ListAdd, ListColumnAdd, ListColumnRemove, ListShow];
13976
13979
 
13980
+ // ente/diagnosticContract.ts
13981
+ var DIAGNOSTICS_LIMITS = { rows: 100, bytes: 1048576, windowMs: 6048e5, cursorChars: 8192, grantHours: 24 };
13982
+
13977
13983
  // ente/commands/health.ts
13978
13984
  var healthPage = makeFunctionReference("admin/health:page");
13979
- var HealthRead = class extends ProfileCommand {
13985
+ var HealthRead = class extends ClientCommand {
13980
13986
  static paths = [["health", "page"]];
13981
13987
  static usage = Command.Usage({ category: "Admin", description: "Read one content-free operational health page (global admin only)" });
13988
+ agentDiagnostics = false;
13982
13989
  source = options_exports.String("--source", { required: true });
13983
13990
  status = options_exports.String("--status");
13984
13991
  since = options_exports.String("--since", { required: true, description: "Inclusive epoch milliseconds (use 0 for active jobs; positive window for terminal recordings)" });
@@ -13994,18 +14001,25 @@ var HealthRead = class extends ProfileCommand {
13994
14001
  } else if (this.source === "recordings" && ["pending", "transcribing", "structuring", "reflecting", "done", "error"].includes(this.status ?? "")) {
13995
14002
  source = { kind: "recordings", status: this.status };
13996
14003
  } else throw new Error("Use toolMessages without --status, threads with idle/running/error, or recordings with a processing status.");
13997
- const data = await (await resolveCaller()).query(healthPage, {
14004
+ const args = {
13998
14005
  source,
13999
14006
  since: Number(this.since),
14000
14007
  until: Number(this.until),
14001
14008
  staleAfterMs: Number(this.staleAfter),
14002
14009
  limit: Number(this.limit),
14003
14010
  cursor: this.cursor ?? null
14004
- });
14011
+ };
14012
+ if (![args.since, args.until, args.staleAfterMs, args.limit].every(Number.isSafeInteger) || args.since < 0 || args.until <= args.since || args.staleAfterMs < 6e4 || args.staleAfterMs > 864e5 || args.limit < 1 || args.limit > DIAGNOSTICS_LIMITS.rows || (args.cursor?.length ?? 0) > DIAGNOSTICS_LIMITS.cursorChars || source.kind === "recordings" && !["done", "error"].includes(source.status) && args.since !== 0 || source.kind === "recordings" && ["done", "error"].includes(source.status) && args.since === 0 || (source.kind === "toolMessages" || source.kind === "recordings" && ["done", "error"].includes(source.status)) && args.until - args.since > DIAGNOSTICS_LIMITS.windowMs) throw new Error("Invalid diagnostics window or limits");
14013
+ const data = this.agentDiagnostics ? (await this.client().diagnostics({ operation: "health", ...args })).data : await (await resolveCaller()).query(healthPage, args);
14005
14014
  this.emitText({ data }, () => JSON.stringify(data, null, 2));
14006
14015
  }
14007
14016
  };
14008
- var HEALTH_COMMANDS = [HealthRead];
14017
+ var AgentDiagnosticsRead = class extends HealthRead {
14018
+ static paths = [["diagnostics", "page"]];
14019
+ static usage = Command.Usage({ category: "Diagnostics", description: "Read one explicitly granted content-free health page as the bound personal agent", details: "Default denied. A current human platform admin must grant this exact owned agent read-only diagnostics with expiry. No production grant is enabled by installing or upgrading the CLI. Keep source/window fixed across cursors. Counts are partial until every page has been read; terminal recordings exclude legacy missing timestamps." });
14020
+ agentDiagnostics = true;
14021
+ };
14022
+ var HEALTH_COMMANDS = [HealthRead, AgentDiagnosticsRead];
14009
14023
 
14010
14024
  // ente/commands/users.ts
14011
14025
  var MANAGED_PLANS = ["free", "sponsored", "company_managed", "own_models"];