@skrr-ai/cli 0.1.161 → 0.1.163

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.
Files changed (91) hide show
  1. package/dist/base-command.d.ts +5 -2
  2. package/dist/base-command.js +96 -39
  3. package/dist/commands/activity/list.d.ts +7 -0
  4. package/dist/commands/activity/list.js +17 -0
  5. package/dist/commands/activity/scan-older.d.ts +2 -2
  6. package/dist/commands/activity/scan-older.js +6 -5
  7. package/dist/commands/activity/show.d.ts +0 -2
  8. package/dist/commands/activity/show.js +21 -42
  9. package/dist/commands/agents/always-on/release-run.d.ts +3 -3
  10. package/dist/commands/agents/always-on/release-run.js +5 -6
  11. package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
  12. package/dist/commands/agents/mini-computer/app/reset.js +5 -2
  13. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  14. package/dist/commands/agents/mini-computer/show.js +4 -2
  15. package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
  16. package/dist/commands/agents/triggers/replay.js +1 -1
  17. package/dist/commands/agents/triggers/runs.d.ts +2 -3
  18. package/dist/commands/agents/triggers/runs.js +4 -5
  19. package/dist/commands/apps/auto-apply.js +31 -10
  20. package/dist/commands/apps/check.js +8 -0
  21. package/dist/commands/apps/data/batch.js +16 -5
  22. package/dist/commands/apps/data/collections.js +1 -1
  23. package/dist/commands/apps/data/delete.js +12 -4
  24. package/dist/commands/apps/data/patch.js +11 -4
  25. package/dist/commands/apps/data/put.js +13 -6
  26. package/dist/commands/apps/data/query.js +3 -3
  27. package/dist/commands/apps/install.js +24 -7
  28. package/dist/commands/apps/installations/events.d.ts +1 -0
  29. package/dist/commands/apps/installations/events.js +63 -10
  30. package/dist/commands/apps/installations/show.js +26 -5
  31. package/dist/commands/apps/installations/snapshot.js +1 -1
  32. package/dist/commands/apps/installations/versions.js +25 -9
  33. package/dist/commands/apps/logs.js +4 -1
  34. package/dist/commands/apps/push.js +10 -2
  35. package/dist/commands/apps/reconsent.js +7 -1
  36. package/dist/commands/apps/rollback.js +2 -2
  37. package/dist/commands/apps/settings/set.js +81 -4
  38. package/dist/commands/apps/settings/show.js +38 -7
  39. package/dist/commands/balance/usage/breakdown.d.ts +1 -1
  40. package/dist/commands/balance/usage/breakdown.js +4 -4
  41. package/dist/commands/balance/usage/events.d.ts +1 -1
  42. package/dist/commands/balance/usage/events.js +4 -4
  43. package/dist/commands/duties/status.js +20 -15
  44. package/dist/commands/goals/create.js +18 -1
  45. package/dist/commands/outbox/drop.js +21 -15
  46. package/dist/commands/outbox/list.d.ts +2 -1
  47. package/dist/commands/outbox/list.js +20 -11
  48. package/dist/commands/outbox/retry.d.ts +8 -11
  49. package/dist/commands/outbox/retry.js +135 -92
  50. package/dist/commands/spaces/create.js +1 -1
  51. package/dist/commands/tasks/comments/add.js +1 -1
  52. package/dist/commands/triggers/audit.js +3 -5
  53. package/dist/commands/triggers/fire-detail.js +7 -1
  54. package/dist/commands/triggers/preflight.js +15 -10
  55. package/dist/commands/triggers/replay.js +1 -1
  56. package/dist/commands/triggers/runs.d.ts +2 -4
  57. package/dist/commands/triggers/runs.js +3 -5
  58. package/dist/generated/agent-guides.json +19 -19
  59. package/dist/lib/agent-activity.d.ts +21 -1
  60. package/dist/lib/agent-activity.js +98 -29
  61. package/dist/lib/api-fetch.d.ts +2 -0
  62. package/dist/lib/api-fetch.js +5 -5
  63. package/dist/lib/appData.d.ts +43 -5
  64. package/dist/lib/appData.js +117 -25
  65. package/dist/lib/appInstallations.d.ts +5 -5
  66. package/dist/lib/appInstallations.js +211 -74
  67. package/dist/lib/appSettings.d.ts +2 -0
  68. package/dist/lib/appSettings.js +36 -3
  69. package/dist/lib/apps-command.d.ts +9 -0
  70. package/dist/lib/apps-command.js +191 -7
  71. package/dist/lib/appsCheck.js +29 -3
  72. package/dist/lib/appsFs.d.ts +1 -1
  73. package/dist/lib/balance.d.ts +5 -5
  74. package/dist/lib/balance.js +4 -4
  75. package/dist/lib/dedicated-power.js +4 -3
  76. package/dist/lib/json-output.d.ts +4 -0
  77. package/dist/lib/json-output.js +38 -0
  78. package/dist/lib/miniComputer.js +9 -2
  79. package/dist/lib/node-adapter.js +35 -2
  80. package/dist/lib/outbox.d.ts +20 -5
  81. package/dist/lib/outbox.js +233 -76
  82. package/dist/lib/rate-limit-retry.d.ts +3 -2
  83. package/dist/lib/rate-limit-retry.js +3 -2
  84. package/dist/lib/roles.d.ts +1 -1
  85. package/dist/lib/triggers.d.ts +3 -0
  86. package/dist/lib/triggers.js +10 -0
  87. package/dist/lib/widgetStaticScan.d.ts +3 -1
  88. package/dist/lib/widgetStaticScan.js +182 -47
  89. package/dist/node_modules/@skrr-ai/data-provider/index.js +10442 -9507
  90. package/oclif.manifest.json +138 -45
  91. package/package.json +4 -3
@@ -84,6 +84,7 @@ export declare abstract class BaseCommand extends Command {
84
84
  */
85
85
  protected printJsonResult(value: unknown, options?: {
86
86
  ok?: boolean;
87
+ preserveAppData?: boolean;
87
88
  }): void;
88
89
  /**
89
90
  * A task write the Space write policy HELD for approval (OSK-17988): the
@@ -436,7 +437,8 @@ export declare abstract class BaseCommand extends Command {
436
437
  * For commands where the USER AUTHORED THE CONTENT — a completion summary, a
437
438
  * comment body, a new Space — losing it to a 503 costs the thinking, not just
438
439
  * a retry. Those commands call this instead of `handleApiError`, and the
439
- * content lands in the outbox where `skrr outbox retry` can replay it.
440
+ * content lands in the outbox for reconciliation. Automatic replay is
441
+ * paused while the original request context cannot be verified.
440
442
  *
441
443
  * Two invariants the caller must honour, both load-bearing:
442
444
  *
@@ -458,7 +460,7 @@ export declare abstract class BaseCommand extends Command {
458
460
  url: string;
459
461
  body: unknown;
460
462
  idempotencyKey: string;
461
- }): never;
463
+ }): Promise<never>;
462
464
  protected failWithCliError({ message, code, status, exit, retryable, details, requestId, }: {
463
465
  message: string;
464
466
  code: string;
@@ -732,4 +734,5 @@ export declare function parseErrorRemedy(err: Error & {
732
734
  fix?: string;
733
735
  flag?: string;
734
736
  };
737
+ export declare function isOclifExitError(err: Error): boolean;
735
738
  export { Flags };
@@ -24,6 +24,7 @@ exports.errorBodyMessage = errorBodyMessage;
24
24
  exports.envelopeDetails = envelopeDetails;
25
25
  exports.retiredFlagHint = retiredFlagHint;
26
26
  exports.parseErrorRemedy = parseErrorRemedy;
27
+ exports.isOclifExitError = isOclifExitError;
27
28
  const space_write_policy_1 = require("./lib/space-write-policy");
28
29
  const node_fs_1 = require("node:fs");
29
30
  const core_1 = require("@oclif/core");
@@ -204,8 +205,8 @@ class BaseCommand extends core_1.Command {
204
205
  * `--raw` / `OVERSKY_CLI_RAW=1` opts out.
205
206
  */
206
207
  log(message, ...args) {
207
- const text = typeof message === 'string' && this.wantsJsonOutput() && !this.wantsRawJson()
208
- ? (0, json_output_1.stripStorageFieldsFromText)(message)
208
+ const text = typeof message === 'string' && this.wantsJsonOutput()
209
+ ? (0, json_output_1.escapeJsonForTerminal)(this.wantsRawJson() ? message : (0, json_output_1.stripStorageFieldsFromText)(message))
209
210
  : message;
210
211
  super.log(text, ...args);
211
212
  }
@@ -228,7 +229,14 @@ class BaseCommand extends core_1.Command {
228
229
  * that has not been moved here yet.
229
230
  */
230
231
  printJsonResult(value, options = {}) {
231
- this.log(JSON.stringify((0, json_output_1.withOk)(value, options.ok ?? true), null, 2));
232
+ const result = (0, json_output_1.withOk)(value, options.ok ?? true);
233
+ if (options.preserveAppData) {
234
+ // The app owns docs[].data: its `_id` and `__v` keys are data, not Mongo envelope metadata.
235
+ const output = this.wantsRawJson() ? result : (0, json_output_1.stripAppDataQueryMetadata)(result);
236
+ super.log((0, json_output_1.escapeJsonForTerminal)(JSON.stringify(output, null, 2)));
237
+ return;
238
+ }
239
+ this.log(JSON.stringify(result, null, 2));
232
240
  }
233
241
  /**
234
242
  * A task write the Space write policy HELD for approval (OSK-17988): the
@@ -1587,6 +1595,16 @@ class BaseCommand extends core_1.Command {
1587
1595
  details: envelopeDetails(body),
1588
1596
  });
1589
1597
  }
1598
+ else if (bodyCode === 'DUTY_REMEDIATION_SOURCE_UNVERIFIED') {
1599
+ this.failWithCliError({
1600
+ message: say('Remediation proposals and decisions are unavailable because their original Duty and Case sources cannot be verified.'),
1601
+ code: bodyCode,
1602
+ status: e.status,
1603
+ exit: 1,
1604
+ retryable: false,
1605
+ details: envelopeDetails(body),
1606
+ });
1607
+ }
1590
1608
  else if (bodyCode === 'AGENT_RUNTIME_UNAVAILABLE') {
1591
1609
  // A specific agent's runtime is offline — not a platform outage, even
1592
1610
  // though the server returns 503. Intercept before the 503→outage
@@ -1622,6 +1640,16 @@ class BaseCommand extends core_1.Command {
1622
1640
  details: envelopeDetails(body),
1623
1641
  });
1624
1642
  }
1643
+ else if (bodyCode === 'DUTY_REFLECTION_SOURCE_UNVERIFIED') {
1644
+ this.failWithCliError({
1645
+ message: say('Reflection history and decisions are unavailable because the original Duty source cannot be verified.'),
1646
+ code: bodyCode,
1647
+ status: e.status,
1648
+ exit: 1,
1649
+ retryable: false,
1650
+ details: envelopeDetails(body),
1651
+ });
1652
+ }
1625
1653
  else if (bodyCode === 'DUTY_HISTORY_UNAVAILABLE' ||
1626
1654
  bodyCode === 'DUTY_HISTORY_SOURCE_UNVERIFIED' ||
1627
1655
  stringProp(body, 'error') === 'DUTY_HISTORY_UNAVAILABLE') {
@@ -2087,7 +2115,8 @@ class BaseCommand extends core_1.Command {
2087
2115
  * For commands where the USER AUTHORED THE CONTENT — a completion summary, a
2088
2116
  * comment body, a new Space — losing it to a 503 costs the thinking, not just
2089
2117
  * a retry. Those commands call this instead of `handleApiError`, and the
2090
- * content lands in the outbox where `skrr outbox retry` can replay it.
2118
+ * content lands in the outbox for reconciliation. Automatic replay is
2119
+ * paused while the original request context cannot be verified.
2091
2120
  *
2092
2121
  * Two invariants the caller must honour, both load-bearing:
2093
2122
  *
@@ -2102,7 +2131,7 @@ class BaseCommand extends core_1.Command {
2102
2131
  * Anything that is not an outage — every 4xx — falls through to the normal
2103
2132
  * error path untouched, because replaying a refusal is just a slower refusal.
2104
2133
  */
2105
- queueWriteOrFail(err, write) {
2134
+ async queueWriteOrFail(err, write) {
2106
2135
  // The durable-write path, and the one this whole step is about. It must
2107
2136
  // read the WIDE predicate: a 401 here is precisely the case where an
2108
2137
  // authored payload was being dropped, because `outbox` only ever queued on
@@ -2134,24 +2163,60 @@ class BaseCommand extends core_1.Command {
2134
2163
  }, (0, keychain_2.getActiveProfile)());
2135
2164
  queuedId = entry.id;
2136
2165
  }
2137
- catch {
2138
- // The queue itself failed. Say so plainly rather than claiming a
2139
- // durability guarantee we did not deliver.
2140
- this.failWithCliError({
2141
- message: `${this.cliConfig.baseURL} could not accept this write and it could NOT be queued ` +
2142
- 'locally. Your content was not saved anywhere — copy it before retrying.',
2143
- code: 'CONTROL_PLANE_UNAVAILABLE',
2144
- status: e.status,
2145
- exit: 5,
2146
- retryable: true,
2147
- });
2166
+ catch (queueError) {
2167
+ {
2168
+ const full = queueError instanceof outbox_1.OutboxFullError;
2169
+ // The request may already have committed. Preserve the original key
2170
+ // and context with the payload so it can be reconciled, not blindly
2171
+ // re-issued as a fresh operation.
2172
+ let server = null;
2173
+ try {
2174
+ const url = new URL(this.cliConfig.baseURL);
2175
+ if (!url.username && !url.password && !url.search && !url.hash)
2176
+ server = url.toString();
2177
+ }
2178
+ catch { /* A malformed server is not a reliable recovery target. */ }
2179
+ const recovery = {
2180
+ configuredServer: server,
2181
+ currentWorkspaceId: (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'] ?? null,
2182
+ actualTarget: 'unknown', actor: 'unverified',
2183
+ command: write.command, method: write.method,
2184
+ path: write.url.startsWith('/') && !write.url.startsWith('//') && !/[?#]/.test(write.url)
2185
+ ? write.url : null,
2186
+ idempotencyKey: write.idempotencyKey, body: write.body,
2187
+ };
2188
+ const recoveryText = (JSON.stringify(recovery, null, 2) ?? 'null')
2189
+ .replace(/[\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu, (char) => {
2190
+ const code = char.codePointAt(0) ?? 0;
2191
+ if (code <= 0xffff)
2192
+ return `\\u${code.toString(16).padStart(4, '0')}`;
2193
+ const offset = code - 0x10000;
2194
+ const high = 0xd800 + (offset >> 10);
2195
+ const low = 0xdc00 + (offset & 0x3ff);
2196
+ return `\\u${high.toString(16)}\\u${low.toString(16)}`;
2197
+ });
2198
+ if (!this.wantsJsonOutput()) {
2199
+ process.stderr.write(`Unsaved recovery details (may contain private data):\n${recoveryText}\n`);
2200
+ await (0, drain_stdio_1.drainStdio)();
2201
+ }
2202
+ this.failWithCliError({
2203
+ message: (full ? `The local outbox is full; this write was not saved in the queue. ` :
2204
+ `The local outbox could not confirm that this write was saved. `) +
2205
+ `The server may already have applied it. Reconcile the original request before trying again. ` +
2206
+ `The actual target and actor are not verified. ` +
2207
+ `Inspect existing entries with \`${this.config.bin} outbox list\`. ` +
2208
+ (this.wantsJsonOutput() ? 'Keep the unsaved recovery details in this response; they may contain private data.' :
2209
+ 'Keep the unsaved recovery details printed above.'),
2210
+ code: full ? 'OUTBOX_FULL' : 'OUTBOX_UNAVAILABLE',
2211
+ status: e.status,
2212
+ exit: 5,
2213
+ retryable: false,
2214
+ details: { outcome: 'unknown', recovery },
2215
+ });
2216
+ }
2148
2217
  }
2149
- // Same discipline as `handleApiError`: only a real outage gets outage
2150
- // wording. Even an edge 504 can arrive AFTER the application committed a
2151
- // write, so neither branch claims nothing landed. A replay is safe because
2152
- // the queued record carries an idempotency key, not because the first
2153
- // attempt is assumed absent.
2154
- const outage = (0, outbox_1.isOutageFailure)(err);
2218
+ // An intermediary can answer after the application committed a write;
2219
+ // neither the outcome nor the original context is proven here.
2155
2220
  const statusSuffix = e.status ? ` (HTTP ${e.status})` : '';
2156
2221
  // OSK-12121 — a 401 is queued (the payload is authored, and it is worth
2157
2222
  // keeping until someone signs in again), but it is an AUTHENTICATION
@@ -2172,14 +2237,12 @@ class BaseCommand extends core_1.Command {
2172
2237
  // OSK-12474 — the daemon was asked for a hand-off and refused; say why.
2173
2238
  (brokerRefusal ? ` ${brokerRefusal.headline}` : '');
2174
2239
  this.failWithCliError({
2175
- message: `Authentication failed${statusSuffix}. ${why} Your ${write.summary} was not applied; it ` +
2176
- `was saved locally as ${queuedId} so it is not lost. Sign in with ` +
2177
- `\`${this.config.bin} login\`, then replay it with \`${this.config.bin} outbox retry\` ` +
2178
- `(or discard it with \`${this.config.bin} outbox drop ${queuedId}\`).`,
2240
+ message: `Authentication failed${statusSuffix}. ${why} Your ${write.summary} was saved locally as ${queuedId}; ` +
2241
+ `the original outcome and context need reconciliation. Automatic replay is paused. Inspect \`${this.config.bin} outbox list --json\` before taking further action.`,
2179
2242
  code: refusal?.code || 'AUTHENTICATION_FAILED',
2180
2243
  status: e.status,
2181
2244
  exit: this.bareMode ? 75 : 2,
2182
- retryable: true,
2245
+ retryable: false,
2183
2246
  details: {
2184
2247
  queued: true,
2185
2248
  outboxId: queuedId,
@@ -2188,21 +2251,15 @@ class BaseCommand extends core_1.Command {
2188
2251
  },
2189
2252
  });
2190
2253
  }
2191
- const lead = outage
2192
- ? `${this.cliConfig.baseURL} is not serving requests right now${statusSuffix}. ` +
2193
- `Your ${write.summary} was queued locally as ${queuedId}; whether the server already ` +
2194
- 'applied the timed-out attempt is unknown, so verify before replaying.'
2195
- : `${this.cliConfig.baseURL} did not accept this write${statusSuffix}. ` +
2196
- `Your ${write.summary} was queued locally as ${queuedId}; whether the server applied ` +
2197
- 'any of it is not reported, so verify before replaying.';
2254
+ const lead = `The request did not return a confirmed result${statusSuffix}. ` +
2255
+ `Your ${write.summary} was queued locally as ${queuedId}; whether it was applied is unknown.`;
2198
2256
  this.failWithCliError({
2199
2257
  message: `${lead} ` +
2200
- `Replay it with \`${this.config.bin} outbox retry\` (it carries an idempotency key, so a ` +
2201
- `replay will not double-apply), or discard it with \`${this.config.bin} outbox drop ${queuedId}\`.`,
2258
+ `Automatic replay is paused. Inspect \`${this.config.bin} outbox list --json\` and reconcile the original target and result before taking further action.`,
2202
2259
  code: 'QUEUED_FOR_RETRY',
2203
2260
  status: e.status,
2204
2261
  exit: 5,
2205
- retryable: true,
2262
+ retryable: false,
2206
2263
  details: { outboxId: queuedId, idempotencyKey: write.idempotencyKey },
2207
2264
  });
2208
2265
  }
@@ -2289,9 +2346,9 @@ class BaseCommand extends core_1.Command {
2289
2346
  printList(shaped, ndjson) {
2290
2347
  const out = (0, list_output_1.renderListOutput)(shaped, ndjson);
2291
2348
  for (const line of out.stdout)
2292
- this.log(line);
2349
+ this.log(typeof line === 'string' ? (0, json_output_1.escapeJsonForTerminal)(line) : line);
2293
2350
  for (const line of out.stderr)
2294
- process.stderr.write(`${line}\n`);
2351
+ process.stderr.write(`${typeof line === 'string' ? (0, json_output_1.escapeJsonForTerminal)(line) : line}\n`);
2295
2352
  }
2296
2353
  wantsJsonOutput() {
2297
2354
  // `this.argv` is only populated by oclif's parse path; a command run
@@ -6,6 +6,13 @@ export default class ActivityList extends BaseCommand {
6
6
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  duty: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ source: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ runtime: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ initiator: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ content: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ from: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ before: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
16
  limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
10
17
  cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
18
  };
@@ -11,11 +11,21 @@ class ActivityList extends base_command_1.BaseCommand {
11
11
  '<%= config.bin %> activity list --agent agent_123',
12
12
  '<%= config.bin %> activity list --duty duty_123 --json',
13
13
  '<%= config.bin %> activity list --agent agent_123 --cursor <cursor>',
14
+ '<%= config.bin %> activity list --source task_execution',
15
+ '<%= config.bin %> activity list --status failed --runtime bound',
16
+ '<%= config.bin %> activity list --initiator automation --from 2026-11-01T00:00:00Z',
14
17
  ];
15
18
  static flags = {
16
19
  json: core_1.Flags.boolean({ description: 'Output the server response as JSON' }),
17
20
  agent: core_1.Flags.string({ description: 'Show activity for this Agent ID', exclusive: ['duty'] }),
18
21
  duty: core_1.Flags.string({ description: 'Show activity for this Duty ID', exclusive: ['agent'] }),
22
+ source: core_1.Flags.string({ description: 'Limit the feed to one source kind', options: [...agent_activity_1.ACTIVITY_SOURCES] }),
23
+ status: core_1.Flags.string({ description: 'Match a public activity status, for example failed or succeeded' }),
24
+ runtime: core_1.Flags.string({ description: 'Match a public runtime state or selected machine product', options: [...agent_activity_1.ACTIVITY_RUNTIMES] }),
25
+ initiator: core_1.Flags.string({ description: 'Match a public initiator; unknown includes missing evidence', options: [...agent_activity_1.ACTIVITY_INITIATORS] }),
26
+ content: core_1.Flags.string({ description: 'Match public content availability, such as partial or unsupported' }),
27
+ from: core_1.Flags.string({ description: 'Include activity from this ISO timestamp, with timezone' }),
28
+ before: core_1.Flags.string({ description: 'Exclude activity at or after this ISO timestamp, with timezone' }),
19
29
  limit: core_1.Flags.integer({
20
30
  description: 'Maximum records per page (1–100)',
21
31
  min: 1,
@@ -33,6 +43,13 @@ class ActivityList extends base_command_1.BaseCommand {
33
43
  scope,
34
44
  ...(flags.agent ? { agentId: flags.agent } : {}),
35
45
  ...(flags.duty ? { dutyId: flags.duty } : {}),
46
+ ...(flags.source ? { source: flags.source } : {}),
47
+ ...(flags.status ? { status: flags.status } : {}),
48
+ ...(flags.runtime ? { runtime: flags.runtime } : {}),
49
+ ...(flags.initiator ? { initiator: flags.initiator } : {}),
50
+ ...(flags.content ? { content: flags.content } : {}),
51
+ ...(flags.from ? { from: flags.from } : {}),
52
+ ...(flags.before ? { before: flags.before } : {}),
36
53
  limit: flags.limit,
37
54
  ...(flags.cursor ? { cursor: flags.cursor } : {}),
38
55
  }, this.resolvedCredential);
@@ -1,7 +1,7 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  /**
3
- * `skrr activity scan-older <chat|group-chat>` — a separate, bounded read of older chat or group
4
- * replies (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
3
+ * `skrr activity scan-older <chat|group-chat|task>` — a separate, bounded read of older chat, group or personal Task
4
+ * activity (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
5
5
  *
6
6
  * This is not the feed with another cursor. A scan does not depend on what the feed filtered out,
7
7
  * its cursor is not a global time order or a has-more signal, and some history may be unavailable,
@@ -4,8 +4,8 @@ const core_1 = require("@oclif/core");
4
4
  const base_command_1 = require("../../base-command");
5
5
  const agent_activity_1 = require("../../lib/agent-activity");
6
6
  /**
7
- * `skrr activity scan-older <chat|group-chat>` — a separate, bounded read of older chat or group
8
- * replies (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
7
+ * `skrr activity scan-older <chat|group-chat|task>` — a separate, bounded read of older chat, group or personal Task
8
+ * activity (`GET /api/agent-activity/chat/scan-older`, `.../group-chat/scan-older`).
9
9
  *
10
10
  * This is not the feed with another cursor. A scan does not depend on what the feed filtered out,
11
11
  * its cursor is not a global time order or a has-more signal, and some history may be unavailable,
@@ -13,19 +13,20 @@ const agent_activity_1 = require("../../lib/agent-activity");
13
13
  * the list envelope, whose `has_more` would claim what the cursor does not.
14
14
  */
15
15
  class ActivityScanOlder extends base_command_1.BaseCommand {
16
- static description = 'Scan for older chat or group replies the activity feed does not page to';
16
+ static description = 'Scan for older chat, group or personal Task activity the feed does not page to';
17
17
  static examples = [
18
18
  '<%= config.bin %> activity scan-older chat',
19
19
  '<%= config.bin %> activity scan-older group-chat',
20
+ '<%= config.bin %> activity scan-older task',
20
21
  '<%= config.bin %> activity scan-older group-chat --cursor <scanOlderCursor>',
21
22
  '<%= config.bin %> activity scan-older chat --limit 10 --json',
22
23
  ];
23
24
  static args = {
24
25
  source: core_1.Args.string({
25
- description: 'Which scan: chat (your own chat replies from your Agents) or group-chat (replies in Groups you can read)',
26
+ description: 'Which scan: chat, group-chat, or task (owned personal Tasks; clear the workspace selection first)',
26
27
  required: true,
27
28
  ignoreStdin: true,
28
- options: ['chat', 'group-chat'],
29
+ options: ['chat', 'group-chat', 'task'],
29
30
  }),
30
31
  };
31
32
  static flags = {
@@ -1,7 +1,5 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  import { type GroupChatActivityDetail } from '../../lib/agent-activity';
3
- /** Render only content returned by the owner-authorized trigger detail API. */
4
- export declare function renderFireContent(detail: Record<string, unknown>, log: (line: string) => void): void;
5
3
  /**
6
4
  * Render one Group reply: the saved reply text and what the server says it does NOT have. Every
7
5
  * string is the response's, so it goes through `terminalText`, and a state the server did not
@@ -1,43 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderFireContent = renderFireContent;
4
3
  exports.renderGroupChatContent = renderGroupChatContent;
4
+ const node_util_1 = require("node:util");
5
5
  const core_1 = require("@oclif/core");
6
6
  const base_command_1 = require("../../base-command");
7
7
  const agent_activity_1 = require("../../lib/agent-activity");
8
8
  const duties_1 = require("../../lib/duties");
9
9
  const http_error_1 = require("../../lib/http-error");
10
- const triggers_1 = require("../../lib/triggers");
11
10
  const workspace_header_1 = require("../../lib/workspace-header");
12
- const fire_detail_1 = require("../triggers/fire-detail");
13
11
  // Source text is untrusted. Preserve useful whitespace, but never send terminal
14
12
  // control sequences from a stored prompt or response to the caller's terminal.
15
13
  function terminalText(value) {
16
- // eslint-disable-next-line no-control-regex -- control characters are the subject: this strips them out of text bound for a terminal.
17
- return value.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, '');
18
- }
19
- /** Render only content returned by the owner-authorized trigger detail API. */
20
- function renderFireContent(detail, log) {
21
- const input = detail.input;
22
- const output = detail.output;
23
- if (typeof input?.promptText === 'string') {
24
- log('');
25
- log(`Trigger input${input.truncated === true ? ' (excerpt; truncated)' : ''}:`);
26
- log(terminalText(input.promptText));
27
- log('This is the recorded trigger input; the runtime may add or change context.');
28
- }
29
- else
30
- log('Trigger input: unavailable');
31
- const fullText = typeof output?.fullText === 'string' ? output.fullText : undefined;
32
- const excerpt = typeof output?.excerpt === 'string' ? output.excerpt : undefined;
33
- const response = fullText ?? excerpt;
34
- if (response !== undefined) {
35
- log('');
36
- log(`Response${!fullText && output?.truncated === true ? ' (excerpt; truncated)' : ''}:`);
37
- log(terminalText(response));
38
- }
39
- else
40
- log('Response: unavailable');
14
+ // Preserve line breaks, but prevent carriage returns and bidi controls from
15
+ // rewriting or visually reordering previously printed terminal output.
16
+ return (0, node_util_1.stripVTControlCharacters)(value.replace(/\r\n?/g, '\n'))
17
+ .replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g, '');
41
18
  }
42
19
  /**
43
20
  * Render one Group reply: the saved reply text and what the server says it does NOT have. Every
@@ -45,15 +22,17 @@ function renderFireContent(detail, log) {
45
22
  * report is never filled in (an unrecognised availability is printed as itself, not as "empty").
46
23
  */
47
24
  function renderGroupChatContent(detail, log) {
25
+ log('This is the currently authorized group reply; its connection to the earlier Activity record is unverified.');
48
26
  const { output } = detail;
49
27
  const state = (entry) => entry?.availability
50
28
  ? `${terminalText(entry.availability)}${entry.reason ? ` (${terminalText(entry.reason)})` : ''}`
51
29
  : 'not reported';
52
30
  log('Group chat reply');
31
+ const reference = (value) => (0, agent_activity_1.isPrintableActivityToken)(value) ? value : '[unprintable]';
53
32
  if (detail.source?.groupChatId)
54
- log(` Group chat: ${terminalText(detail.source.groupChatId)}`);
33
+ log(` Group chat: ${reference(detail.source.groupChatId)}`);
55
34
  if (detail.source?.responseMessageId)
56
- log(` Message: ${terminalText(detail.source.responseMessageId)}`);
35
+ log(` Message: ${reference(detail.source.responseMessageId)}`);
57
36
  log('');
58
37
  const partial = output.availability === 'partial'
59
38
  ? typeof output.originalLength === 'number' && typeof output.text === 'string'
@@ -80,16 +59,15 @@ function renderGroupChatContent(detail, log) {
80
59
  log('Output coverage: partial. Attachments and other output may be missing.');
81
60
  }
82
61
  class ActivityShow extends base_command_1.BaseCommand {
83
- static description = 'Inspect a source-linked trigger fire, a Duty trace or a Group reply';
62
+ static description = 'Inspect an independently authorized Duty trace or Group reply';
84
63
  static examples = [
85
- '<%= config.bin %> activity show --trigger <trigger-id> --fire <occurrence-id>',
86
64
  '<%= config.bin %> activity show --duty <duty-id> --json',
87
65
  '<%= config.bin %> activity show --group-chat <group-chat-id> --message <message-id>',
88
66
  ];
89
67
  static flags = {
90
68
  json: core_1.Flags.boolean({ description: 'Output the authorized source response as JSON' }),
91
69
  trigger: core_1.Flags.string({
92
- description: 'Trigger ID from source reference',
70
+ description: 'Trigger ID from a legacy Activity reference (source detail unavailable)',
93
71
  exclusive: ['duty', 'task', 'group-chat'],
94
72
  }),
95
73
  fire: core_1.Flags.string({
@@ -210,15 +188,16 @@ class ActivityShow extends base_command_1.BaseCommand {
210
188
  (0, duties_1.renderDutyTrace)(trace, (line) => this.log(terminalText(line)));
211
189
  return;
212
190
  }
213
- const detail = await triggers_1.triggerApi.fireDetail(flags.trigger, flags.fire);
214
- if (flags.json)
215
- this.printJsonResult(detail);
216
- else {
217
- const row = detail;
218
- for (const line of (0, fire_detail_1.describeFireAuditDetail)(row, flags.fire, flags.trigger))
219
- this.log(terminalText(line));
220
- renderFireContent(row, (line) => this.log(line));
221
- }
191
+ // A logical Trigger and Fire id do not identify the physical Trigger at
192
+ // occurrence time. The separate Trigger audit API authorizes its current
193
+ // source, but cannot establish this Activity row's historical lineage.
194
+ const unavailable = {
195
+ source: 'trigger_fire',
196
+ state: 'unsupported',
197
+ reason: 'Trigger Activity detail is unavailable because the original Trigger identity was not recorded. ' +
198
+ 'The separate triggers fire-detail command is an independently authorized audit, not proof of this Activity source.',
199
+ };
200
+ this.log(flags.json ? JSON.stringify(unavailable, null, 2) : unavailable.reason);
222
201
  }
223
202
  catch (err) {
224
203
  this.handleApiError(err);
@@ -4,8 +4,8 @@ import { BaseCommand } from '../../../base-command';
4
4
  * ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
5
5
  *
6
6
  * A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
7
- * not start a second provider request while the first may still run. `skrr triggers fire-detail` shows that wait and the
8
- * generation to pass here. Releasing is the one exit that does not wait for the machine, so it costs something the
7
+ * not start a second provider request while the first may still run. Trigger fire detail currently withholds the Run and
8
+ * generation because the historical source identity is unverified. Releasing does not wait for the machine, so it costs something the
9
9
  * platform cannot take back: the provider may receive a SECOND request for the same turn.
10
10
  *
11
11
  * So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
@@ -17,7 +17,7 @@ import { BaseCommand } from '../../../base-command';
17
17
  * What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
18
18
  * machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
19
19
  * adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
20
- * script. That is also why `triggers fire-detail` prints this command WITHOUT the flag. Do not hand your login to a program
20
+ * script. Do not hand your login to a program
21
21
  * you would not trust to make this decision; give it its own delegated session, which the server refuses.
22
22
  */
23
23
  export default class AgentsAlwaysOnReleaseRun extends BaseCommand {
@@ -8,8 +8,8 @@ const base_command_1 = require("../../../base-command");
8
8
  * ran it never confirmed it stopped, via `POST /api/agents/:id/always-on/runs/:runId/stop-release` (OSK-22700).
9
9
  *
10
10
  * A Run whose daemon was killed mid-turn is queued again and refused as `previous_execution_stopping`: the platform will
11
- * not start a second provider request while the first may still run. `skrr triggers fire-detail` shows that wait and the
12
- * generation to pass here. Releasing is the one exit that does not wait for the machine, so it costs something the
11
+ * not start a second provider request while the first may still run. Trigger fire detail currently withholds the Run and
12
+ * generation because the historical source identity is unverified. Releasing does not wait for the machine, so it costs something the
13
13
  * platform cannot take back: the provider may receive a SECOND request for the same turn.
14
14
  *
15
15
  * So the command refuses to go anywhere without `--accept-duplicate-risk`: with the flag missing it prints the risk and
@@ -21,20 +21,19 @@ const base_command_1 = require("../../../base-command");
21
21
  * What this does NOT guarantee, and the help says so: your own `skrr login` IS you to the server, so a program running on your
22
22
  * machine with your login (a coding agent, a script) passes every check above. `--accept-duplicate-risk` is the flag a person
23
23
  * adds after reading the risk; it is friction, not a barrier, and nothing on the server can tell a person typing it from a
24
- * script. That is also why `triggers fire-detail` prints this command WITHOUT the flag. Do not hand your login to a program
24
+ * script. Do not hand your login to a program
25
25
  * you would not trust to make this decision; give it its own delegated session, which the server refuses.
26
26
  */
27
27
  class AgentsAlwaysOnReleaseRun extends base_command_1.BaseCommand {
28
28
  static description = 'Let one queued Run start although the machine that ran it never confirmed it stopped (Agent owner only; the provider may receive a second request for the same turn). Release it only when its machine is online and ready: the claim spends the release even if the new attempt then parks before it reaches a machine, and the Run then needs another. It runs as you, so a program using your login can do this too: --accept-duplicate-risk is a deliberate step, not a barrier';
29
29
  static examples = [
30
- '<%= config.bin %> triggers fire-detail <trigger-id> <fire-id> # shows the Run, the wait and the generation',
31
30
  '<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk',
32
31
  '<%= config.bin %> agents always-on release-run <agent-id> <run-id> --expected-generation 3 --accept-duplicate-risk --reason "Laptop was destroyed" --json',
33
32
  ];
34
33
  static args = {
35
34
  id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
36
35
  runId: core_1.Args.string({
37
- description: 'Run ID (the `Run:` line of `triggers fire-detail`)',
36
+ description: 'Run ID; historical Trigger fire detail does not currently expose it',
38
37
  required: true,
39
38
  ignoreStdin: true,
40
39
  }),
@@ -43,7 +42,7 @@ class AgentsAlwaysOnReleaseRun extends base_command_1.BaseCommand {
43
42
  'expected-generation': core_1.Flags.integer({
44
43
  min: 0,
45
44
  required: true,
46
- description: 'The generation `triggers fire-detail` printed for this wait. A stale one is refused, so you cannot release a wait you did not read.',
45
+ description: 'The Run generation for the wait. Historical Trigger fire detail does not currently expose it; a stale generation is refused.',
47
46
  }),
48
47
  'accept-duplicate-risk': core_1.Flags.boolean({
49
48
  description: 'I understand the provider may receive a second request for the same turn. Required: without it nothing is sent.',
@@ -8,6 +8,7 @@ export default class AgentsMiniComputerAppReset extends MiniComputerCommand {
8
8
  };
9
9
  static flags: {
10
10
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ 'expected-rev': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  run(): Promise<void>;
13
14
  }
@@ -14,12 +14,15 @@ class AgentsMiniComputerAppReset extends miniComputerCommand_1.MiniComputerComma
14
14
  ignoreStdin: true,
15
15
  }),
16
16
  };
17
- static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
17
+ static flags = {
18
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
19
+ 'expected-rev': core_1.Flags.integer({ description: 'Only reset if the app is at this revision', min: 0 }),
20
+ };
18
21
  async run() {
19
22
  this.requireAuth();
20
23
  const { args, flags } = await this.parse(AgentsMiniComputerAppReset);
21
24
  try {
22
- const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, args.app);
25
+ const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, args.app, flags['expected-rev']);
23
26
  if (flags.json) {
24
27
  this.log(this.agentJson(args.agentId, entry));
25
28
  return;
@@ -30,7 +30,7 @@ class AgentsMiniComputerAppSet extends miniComputerCommand_1.MiniComputerCommand
30
30
  exactlyOne: ['config', 'file'],
31
31
  }),
32
32
  'expected-rev': core_1.Flags.integer({
33
- description: 'Only write if the app is at this revision (0: nothing set yet)',
33
+ description: 'Only write if the app is at this revision (0: never configured)',
34
34
  min: 0,
35
35
  }),
36
36
  };
@@ -5,7 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const miniComputerCommand_1 = require("../../../lib/miniComputerCommand");
6
6
  const miniComputer_1 = require("../../../lib/miniComputer");
7
7
  class AgentsMiniComputerShow extends miniComputerCommand_1.MiniComputerCommand {
8
- static description = "Show an Agent's Mini Computer: the configuration set on each built-in app (an app with none is on its default) and the layout of the person you are signed in as, with what is waiting for them and the latest Agent change. The person chooses whether an Agent's layout change is applied or only proposed.";
8
+ static description = "Show an Agent's Mini Computer: the configuration set on each built-in app (an app with none is on its default) and the layout of the person you are signed in as, with what is waiting for them and the latest Agent change. JSON includes the stored layout and layoutSummary, the CLI's resolved built-in and stored app order (null if unreadable). The summary excludes widgets and page breaks; it may omit newly installed apps or include unavailable IDs, so it is not a complete rendered Home. The person chooses whether an Agent's layout change is applied or only proposed.";
9
9
  static examples = [
10
10
  '<%= config.bin %> agents mini-computer show <agent-id>',
11
11
  '<%= config.bin %> agents mini-computer show <agent-id> tasks',
@@ -40,7 +40,9 @@ class AgentsMiniComputerShow extends miniComputerCommand_1.MiniComputerCommand {
40
40
  data_provider_1.dataService.getMiniComputerLayout(args.agentId),
41
41
  ]);
42
42
  if (flags.json) {
43
- this.log(this.agentJson(args.agentId, { apps: apps.apps, layout }));
43
+ const read = (0, data_provider_1.parseMiniComputerLayoutRead)(layout);
44
+ const layoutSummary = read ? (0, data_provider_1.describeMiniComputerLayout)(read.layout) : null;
45
+ this.log(this.agentJson(args.agentId, { apps: apps.apps, layout, layoutSummary }));
44
46
  return;
45
47
  }
46
48
  if (apps.apps.length === 0)
@@ -56,7 +56,7 @@ class AgentsMiniComputerTasksView extends miniComputerCommand_1.MiniComputerComm
56
56
  after: core_1.Flags.string({ description: 'Window start, yyyy-mm-dd, inclusive' }),
57
57
  before: core_1.Flags.string({ description: 'Window end, yyyy-mm-dd, inclusive' }),
58
58
  'expected-rev': core_1.Flags.integer({
59
- description: 'Only write if Tasks is at this revision (0: nothing set yet)',
59
+ description: 'Only write or reset if Tasks is at this revision (0: never configured)',
60
60
  min: 0,
61
61
  }),
62
62
  };
@@ -73,7 +73,7 @@ class AgentsMiniComputerTasksView extends miniComputerCommand_1.MiniComputerComm
73
73
  }
74
74
  try {
75
75
  if (flags.reset) {
76
- const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, 'tasks');
76
+ const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, 'tasks', flags['expected-rev']);
77
77
  if (flags.json)
78
78
  this.log(this.agentJson(args.agentId, entry));
79
79
  else