@skrr-ai/cli 0.1.155 → 0.1.157

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 (148) hide show
  1. package/dist/base-command.js +64 -16
  2. package/dist/commands/activity/list.d.ts +13 -0
  3. package/dist/commands/activity/list.js +50 -0
  4. package/dist/commands/activity/show.d.ts +18 -0
  5. package/dist/commands/activity/show.js +125 -0
  6. package/dist/commands/agent/message/send.js +64 -19
  7. package/dist/commands/agents/always-on/held-messages.js +24 -1
  8. package/dist/commands/agents/always-on/status.js +6 -1
  9. package/dist/commands/agents/mini-computer/app/reset.d.ts +13 -0
  10. package/dist/commands/agents/mini-computer/app/reset.js +35 -0
  11. package/dist/commands/agents/mini-computer/app/set.d.ts +16 -0
  12. package/dist/commands/agents/mini-computer/app/set.js +70 -0
  13. package/dist/commands/agents/mini-computer/layout/change.d.ts +14 -0
  14. package/dist/commands/agents/mini-computer/layout/change.js +44 -0
  15. package/dist/commands/agents/mini-computer/layout/folder.d.ts +14 -0
  16. package/dist/commands/agents/mini-computer/layout/folder.js +35 -0
  17. package/dist/commands/agents/mini-computer/layout/move.d.ts +14 -0
  18. package/dist/commands/agents/mini-computer/layout/move.js +32 -0
  19. package/dist/commands/agents/mini-computer/layout/pin.d.ts +14 -0
  20. package/dist/commands/agents/mini-computer/layout/pin.js +35 -0
  21. package/dist/commands/agents/mini-computer/layout/remove.d.ts +13 -0
  22. package/dist/commands/agents/mini-computer/layout/remove.js +27 -0
  23. package/dist/commands/agents/mini-computer/layout/restore.d.ts +13 -0
  24. package/dist/commands/agents/mini-computer/layout/restore.js +27 -0
  25. package/dist/commands/agents/mini-computer/layout/unfolder.d.ts +13 -0
  26. package/dist/commands/agents/mini-computer/layout/unfolder.js +27 -0
  27. package/dist/commands/agents/mini-computer/layout/unpin.d.ts +14 -0
  28. package/dist/commands/agents/mini-computer/layout/unpin.js +34 -0
  29. package/dist/commands/agents/mini-computer/show.d.ts +13 -0
  30. package/dist/commands/agents/mini-computer/show.js +60 -0
  31. package/dist/commands/agents/mini-computer/tasks-view.d.ts +29 -0
  32. package/dist/commands/agents/mini-computer/tasks-view.js +100 -0
  33. package/dist/commands/apps/auto-apply.d.ts +14 -0
  34. package/dist/commands/apps/auto-apply.js +53 -0
  35. package/dist/commands/apps/check.js +4 -1
  36. package/dist/commands/apps/create.js +11 -6
  37. package/dist/commands/apps/data/batch.d.ts +15 -0
  38. package/dist/commands/apps/data/batch.js +59 -0
  39. package/dist/commands/apps/data/collections.d.ts +12 -0
  40. package/dist/commands/apps/data/collections.js +44 -0
  41. package/dist/commands/apps/data/delete.d.ts +15 -0
  42. package/dist/commands/apps/data/delete.js +57 -0
  43. package/dist/commands/apps/data/patch.d.ts +17 -0
  44. package/dist/commands/apps/data/patch.js +70 -0
  45. package/dist/commands/apps/data/put.js +1 -1
  46. package/dist/commands/apps/data/query.js +1 -1
  47. package/dist/commands/apps/installations/diff.d.ts +14 -0
  48. package/dist/commands/apps/installations/diff.js +45 -0
  49. package/dist/commands/apps/installations/events.d.ts +23 -0
  50. package/dist/commands/apps/installations/events.js +104 -0
  51. package/dist/commands/apps/installations/snapshot.d.ts +18 -0
  52. package/dist/commands/apps/installations/snapshot.js +60 -0
  53. package/dist/commands/apps/installations/versions.d.ts +12 -0
  54. package/dist/commands/apps/installations/versions.js +38 -0
  55. package/dist/commands/apps/logs.js +3 -0
  56. package/dist/commands/apps/preview.js +4 -2
  57. package/dist/commands/apps/pull.js +10 -1
  58. package/dist/commands/apps/push.js +36 -12
  59. package/dist/commands/apps/reference.d.ts +26 -0
  60. package/dist/commands/apps/reference.js +56 -0
  61. package/dist/commands/apps/rollback.d.ts +13 -0
  62. package/dist/commands/apps/rollback.js +47 -0
  63. package/dist/commands/apps/version/create.js +5 -0
  64. package/dist/commands/duties/accounting.js +6 -0
  65. package/dist/commands/duties/analytics/detail.js +6 -0
  66. package/dist/commands/duties/analytics/index.js +14 -0
  67. package/dist/commands/duties/analytics/replay.js +6 -0
  68. package/dist/commands/duties/cost.js +6 -0
  69. package/dist/commands/duties/delete.js +22 -19
  70. package/dist/commands/duties/doctor.d.ts +2 -1
  71. package/dist/commands/duties/doctor.js +17 -3
  72. package/dist/commands/duties/goals/link.js +4 -0
  73. package/dist/commands/duties/goals/unlink.js +4 -0
  74. package/dist/commands/duties/lineage.js +6 -1
  75. package/dist/commands/duties/links/list.js +6 -0
  76. package/dist/commands/duties/metrics.js +10 -0
  77. package/dist/commands/duties/observations.js +12 -0
  78. package/dist/commands/duties/operating-review.d.ts +4 -30
  79. package/dist/commands/duties/operating-review.js +28 -141
  80. package/dist/commands/duties/receipt-metrics.js +7 -0
  81. package/dist/commands/duties/receipt.js +7 -0
  82. package/dist/commands/duties/roster.js +14 -8
  83. package/dist/commands/duties/show.js +27 -9
  84. package/dist/commands/duties/status.js +18 -9
  85. package/dist/commands/duties/trigger-status.d.ts +2 -0
  86. package/dist/commands/duties/trigger-status.js +19 -1
  87. package/dist/commands/duties/wake-capabilities.d.ts +2 -0
  88. package/dist/commands/duties/wake-capabilities.js +32 -2
  89. package/dist/commands/followups/act.js +3 -0
  90. package/dist/commands/followups/remind.js +12 -3
  91. package/dist/commands/followups/show.js +6 -0
  92. package/dist/commands/harnesses/quota.js +1 -1
  93. package/dist/commands/spaces/notebook.d.ts +3 -7
  94. package/dist/commands/spaces/notebook.js +32 -8
  95. package/dist/commands/tasks/create.d.ts +2 -2
  96. package/dist/commands/tasks/create.js +3 -3
  97. package/dist/commands/tasks/list.d.ts +3 -41
  98. package/dist/commands/tasks/list.js +5 -53
  99. package/dist/generated/agent-guides.json +424 -101
  100. package/dist/generated/managed-instruction-guides.json +1 -1
  101. package/dist/lib/agent-activity.d.ts +68 -0
  102. package/dist/lib/agent-activity.js +106 -0
  103. package/dist/lib/always-on-runtime.d.ts +9 -0
  104. package/dist/lib/always-on-runtime.js +20 -0
  105. package/dist/lib/api-fetch.d.ts +10 -0
  106. package/dist/lib/api-fetch.js +12 -2
  107. package/dist/lib/appData.d.ts +28 -1
  108. package/dist/lib/appData.js +111 -9
  109. package/dist/lib/appInstallations.d.ts +9 -1
  110. package/dist/lib/appInstallations.js +100 -0
  111. package/dist/lib/apps-command.d.ts +1 -0
  112. package/dist/lib/apps-command.js +11 -0
  113. package/dist/lib/apps.d.ts +12 -0
  114. package/dist/lib/apps.js +28 -1
  115. package/dist/lib/appsAssets.d.ts +17 -0
  116. package/dist/lib/appsAssets.js +15 -0
  117. package/dist/lib/appsCheck.d.ts +1 -0
  118. package/dist/lib/appsCheck.js +1 -0
  119. package/dist/lib/appsFs.d.ts +18 -1
  120. package/dist/lib/appsFs.js +76 -19
  121. package/dist/lib/compasses.js +6 -0
  122. package/dist/lib/duties.d.ts +25 -2
  123. package/dist/lib/duties.js +58 -3
  124. package/dist/lib/duty-analytics.d.ts +2 -0
  125. package/dist/lib/duty-analytics.js +26 -0
  126. package/dist/lib/duty-goal-propagation.d.ts +2 -0
  127. package/dist/lib/duty-goal-propagation.js +18 -0
  128. package/dist/lib/duty-history-source.d.ts +4 -0
  129. package/dist/lib/duty-history-source.js +12 -0
  130. package/dist/lib/duty-ledgers.d.ts +4 -0
  131. package/dist/lib/duty-ledgers.js +4 -0
  132. package/dist/lib/duty-receipt-source.d.ts +4 -0
  133. package/dist/lib/duty-receipt-source.js +19 -0
  134. package/dist/lib/followups.d.ts +20 -0
  135. package/dist/lib/followups.js +10 -0
  136. package/dist/lib/held-messages.d.ts +22 -0
  137. package/dist/lib/held-messages.js +55 -0
  138. package/dist/lib/list-workspace.d.ts +40 -0
  139. package/dist/lib/list-workspace.js +58 -0
  140. package/dist/lib/miniComputer.d.ts +59 -0
  141. package/dist/lib/miniComputer.js +224 -0
  142. package/dist/lib/miniComputerCommand.d.ts +13 -0
  143. package/dist/lib/miniComputerCommand.js +48 -0
  144. package/dist/lib/roles.d.ts +3 -3
  145. package/dist/lib/space-notebook.js +15 -4
  146. package/dist/node_modules/@skrr-ai/data-provider/index.js +10465 -8383
  147. package/oclif.manifest.json +2789 -533
  148. package/package.json +14 -2
@@ -366,26 +366,26 @@ class BaseCommand extends core_1.Command {
366
366
  // state. The restricted session token (or a null credential when it is
367
367
  // missing) is the only adapter authority exposed to the command.
368
368
  const historySession = this.constructor.sessionReadPolicy === 'memory-history-v1' &&
369
- (0, memory_history_session_1.hasMemoryHistoryRuntime)() ? (0, memory_history_session_1.memoryHistorySession)() : null;
369
+ (0, memory_history_session_1.hasMemoryHistoryRuntime)()
370
+ ? (0, memory_history_session_1.memoryHistorySession)()
371
+ : null;
370
372
  let autonomousCredential = historySession
371
- ? { token: historySession.token, source: 'env-token', kind: (0, auth_core_1.classifyTokenKind)(historySession.token) }
373
+ ? {
374
+ token: historySession.token,
375
+ source: 'env-token',
376
+ kind: (0, auth_core_1.classifyTokenKind)(historySession.token),
377
+ }
372
378
  : (0, credential_resolver_1.resolveTrustedAutonomousCredential)();
373
379
  const boundSessionCommand = Boolean(autonomousCredential &&
374
380
  this.constructor.autonomousCredentialPolicy === 'bound-session');
375
381
  if ((0, delegated_cli_1.isDelegatedCliSession)() && !boundSessionCommand) {
382
+ // Only the fetch is inside the try. `failWithCliError` writes the envelope and then THROWS to
383
+ // exit, so a call to it inside the try was caught by the catch below and reported a second
384
+ // time with the exit signal as its cause: two JSON documents on stdout and a message ending
385
+ // in `EEXIT: 75` (OSK-23475).
386
+ let delegatedCredential;
376
387
  try {
377
- const delegatedCredential = await (0, delegated_cli_1.fetchDelegatedCliCredential)();
378
- if (!delegatedCredential) {
379
- this.failWithCliError({
380
- message: 'Daemon delegated skrr credential is unavailable.',
381
- code: 'DELEGATED_CLI_CREDENTIAL_UNAVAILABLE',
382
- exit: 75,
383
- retryable: true,
384
- });
385
- return;
386
- }
387
- autonomousCredential = delegatedCredential;
388
- this.credentialProvenance = { kind: 'daemon-delegated' };
388
+ delegatedCredential = await (0, delegated_cli_1.fetchDelegatedCliCredential)();
389
389
  }
390
390
  catch (err) {
391
391
  // OSK-15990 — a refusal only a new daemon sign-in repairs (e.g.
@@ -419,6 +419,16 @@ class BaseCommand extends core_1.Command {
419
419
  retryable: true,
420
420
  });
421
421
  }
422
+ if (!delegatedCredential) {
423
+ this.failWithCliError({
424
+ message: 'Daemon delegated skrr credential is unavailable.',
425
+ code: 'DELEGATED_CLI_CREDENTIAL_UNAVAILABLE',
426
+ exit: 75,
427
+ retryable: true,
428
+ });
429
+ }
430
+ autonomousCredential = delegatedCredential;
431
+ this.credentialProvenance = { kind: 'daemon-delegated' };
422
432
  }
423
433
  if (autonomousCredential) {
424
434
  // Parse for normal oclif flag validation, but intentionally ignore both
@@ -1591,6 +1601,42 @@ class BaseCommand extends core_1.Command {
1591
1601
  details: envelopeDetails(body),
1592
1602
  });
1593
1603
  }
1604
+ else if (bodyCode === 'DUTY_GOAL_LINK_UNAVAILABLE' ||
1605
+ stringProp(body, 'error') === 'DUTY_GOAL_LINK_UNAVAILABLE') {
1606
+ this.failWithCliError({
1607
+ message: say('Linking or unlinking a Goal and Duty is currently unavailable. No changes were made.'),
1608
+ code: 'DUTY_GOAL_LINK_UNAVAILABLE',
1609
+ status: e.status,
1610
+ exit: 1,
1611
+ retryable: false,
1612
+ details: envelopeDetails(body),
1613
+ });
1614
+ }
1615
+ else if (bodyCode === 'SOURCE_LINEAGE_UNVERIFIED') {
1616
+ this.failWithCliError({
1617
+ message: say('Preflight is unavailable because its historical sources cannot be verified.'),
1618
+ code: bodyCode,
1619
+ status: e.status,
1620
+ exit: 1,
1621
+ retryable: false,
1622
+ details: envelopeDetails(body),
1623
+ });
1624
+ }
1625
+ else if (bodyCode === 'DUTY_HISTORY_UNAVAILABLE' ||
1626
+ bodyCode === 'DUTY_HISTORY_SOURCE_UNVERIFIED' ||
1627
+ stringProp(body, 'error') === 'DUTY_HISTORY_UNAVAILABLE') {
1628
+ // The API deliberately withholds historical Duty data whose physical
1629
+ // source cannot be verified. Neither the current 409 nor an older 503
1630
+ // is a control-plane outage, and retrying cannot establish lineage.
1631
+ this.failWithCliError({
1632
+ message: say('Duty history is unavailable because its original source cannot be verified.'),
1633
+ code: bodyCode || 'DUTY_HISTORY_UNAVAILABLE',
1634
+ status: e.status,
1635
+ exit: 1,
1636
+ retryable: false,
1637
+ details: envelopeDetails(body),
1638
+ });
1639
+ }
1594
1640
  else if (bodyCode === 'GITHUB_APP_NOT_CONFIGURED') {
1595
1641
  this.failWithCliError({
1596
1642
  message: say(describeGitHubAppNotConfigured()),
@@ -2901,8 +2947,10 @@ function errorBodyMessage(body) {
2901
2947
  ? record.error.message
2902
2948
  : undefined;
2903
2949
  const reason = (0, api_error_reason_1.reasonOnlyCode)(record);
2904
- return text(record.message) ?? text(record.error) ?? text(nested) ??
2905
- (reason ? `Request refused: ${reason}` : undefined);
2950
+ return (text(record.message) ??
2951
+ text(record.error) ??
2952
+ text(nested) ??
2953
+ (reason ? `Request refused: ${reason}` : undefined));
2906
2954
  }
2907
2955
  /**
2908
2956
  * The `details` of a CLI error envelope, in ONE shape. The server's refusal body becomes the
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ export default class ActivityList extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ duty: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
10
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const base_command_1 = require("../../base-command");
5
+ const agent_activity_1 = require("../../lib/agent-activity");
6
+ const list_output_1 = require("../../lib/list-output");
7
+ class ActivityList extends base_command_1.BaseCommand {
8
+ static description = 'List source-linked activity for yourself, an agent, or a duty';
9
+ static examples = [
10
+ '<%= config.bin %> activity list',
11
+ '<%= config.bin %> activity list --agent agent_123',
12
+ '<%= config.bin %> activity list --duty duty_123 --json',
13
+ '<%= config.bin %> activity list --agent agent_123 --cursor <cursor>',
14
+ ];
15
+ static flags = {
16
+ json: core_1.Flags.boolean({ description: 'Output the server response as JSON' }),
17
+ agent: core_1.Flags.string({ description: 'Show activity for this Agent ID', exclusive: ['duty'] }),
18
+ duty: core_1.Flags.string({ description: 'Show activity for this Duty ID', exclusive: ['agent'] }),
19
+ limit: core_1.Flags.integer({
20
+ description: 'Maximum records per page (1–100)',
21
+ min: 1,
22
+ max: 100,
23
+ default: 30,
24
+ }),
25
+ cursor: core_1.Flags.string({ description: 'Cursor from the preceding page, with the same scope' }),
26
+ };
27
+ async run() {
28
+ this.requireAuth();
29
+ const { flags } = await this.parse(ActivityList);
30
+ const scope = flags.agent ? 'agent' : flags.duty ? 'duty' : 'user';
31
+ try {
32
+ const response = await (0, agent_activity_1.listAgentActivity)({
33
+ scope,
34
+ ...(flags.agent ? { agentId: flags.agent } : {}),
35
+ ...(flags.duty ? { dutyId: flags.duty } : {}),
36
+ limit: flags.limit,
37
+ ...(flags.cursor ? { cursor: flags.cursor } : {}),
38
+ }, this.resolvedCredential);
39
+ // Standard list envelope (`data`, `has_more`, `next_cursor`); per-source `coverage` is kept.
40
+ if (flags.json)
41
+ this.log(JSON.stringify((0, list_output_1.listResult)(response, 'items'), null, 2));
42
+ else
43
+ (0, agent_activity_1.renderAgentActivity)(response, (line) => this.log(line));
44
+ }
45
+ catch (err) {
46
+ this.handleApiError(err);
47
+ }
48
+ }
49
+ }
50
+ exports.default = ActivityList;
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /** Render only content returned by the owner-authorized trigger detail API. */
3
+ export declare function renderFireContent(detail: Record<string, unknown>, log: (line: string) => void): void;
4
+ export default class ActivityShow extends BaseCommand {
5
+ static description: string;
6
+ static examples: string[];
7
+ static flags: {
8
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ trigger: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ fire: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ duty: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ run: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ };
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderFireContent = renderFireContent;
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../../base-command");
6
+ const duties_1 = require("../../lib/duties");
7
+ const triggers_1 = require("../../lib/triggers");
8
+ const fire_detail_1 = require("../triggers/fire-detail");
9
+ // Source text is untrusted. Preserve useful whitespace, but never send terminal
10
+ // control sequences from a stored prompt or response to the caller's terminal.
11
+ function terminalText(value) {
12
+ // eslint-disable-next-line no-control-regex -- control characters are the subject: this strips them out of text bound for a terminal.
13
+ return value.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/g, '');
14
+ }
15
+ /** Render only content returned by the owner-authorized trigger detail API. */
16
+ function renderFireContent(detail, log) {
17
+ const input = detail.input;
18
+ const output = detail.output;
19
+ if (typeof input?.promptText === 'string') {
20
+ log('');
21
+ log(`Trigger input${input.truncated === true ? ' (excerpt; truncated)' : ''}:`);
22
+ log(terminalText(input.promptText));
23
+ log('This is the recorded trigger input; the runtime may add or change context.');
24
+ }
25
+ else
26
+ log('Trigger input: unavailable');
27
+ const fullText = typeof output?.fullText === 'string' ? output.fullText : undefined;
28
+ const excerpt = typeof output?.excerpt === 'string' ? output.excerpt : undefined;
29
+ const response = fullText ?? excerpt;
30
+ if (response !== undefined) {
31
+ log('');
32
+ log(`Response${!fullText && output?.truncated === true ? ' (excerpt; truncated)' : ''}:`);
33
+ log(terminalText(response));
34
+ }
35
+ else
36
+ log('Response: unavailable');
37
+ }
38
+ class ActivityShow extends base_command_1.BaseCommand {
39
+ static description = 'Inspect a source-linked trigger fire or a Duty trace';
40
+ static examples = [
41
+ '<%= config.bin %> activity show --trigger <trigger-id> --fire <occurrence-id>',
42
+ '<%= config.bin %> activity show --duty <duty-id> --json',
43
+ ];
44
+ static flags = {
45
+ json: core_1.Flags.boolean({ description: 'Output the authorized source response as JSON' }),
46
+ trigger: core_1.Flags.string({
47
+ description: 'Trigger ID from source reference',
48
+ exclusive: ['duty', 'task'],
49
+ }),
50
+ fire: core_1.Flags.string({
51
+ description: 'Fire occurrence ID or row ID; requires --trigger',
52
+ dependsOn: ['trigger'],
53
+ }),
54
+ duty: core_1.Flags.string({
55
+ description: 'Duty ID; show its independently authorized trace',
56
+ exclusive: ['trigger', 'fire', 'task', 'run'],
57
+ }),
58
+ task: core_1.Flags.string({
59
+ description: 'Task ID from source reference',
60
+ exclusive: ['trigger', 'fire', 'duty'],
61
+ }),
62
+ run: core_1.Flags.string({
63
+ description: 'Task execution run ID; requires --task',
64
+ dependsOn: ['task'],
65
+ exclusive: ['trigger', 'fire', 'duty'],
66
+ }),
67
+ limit: core_1.Flags.integer({ description: 'Maximum Duty trace events (1–500)', min: 1, max: 500 }),
68
+ cursor: core_1.Flags.string({ description: 'Continue a Duty trace using its own cursor' }),
69
+ };
70
+ async run() {
71
+ this.requireAuth();
72
+ const { flags } = await this.parse(ActivityShow);
73
+ const chosen = Number(Boolean(flags.duty)) +
74
+ Number(Boolean(flags.trigger || flags.fire)) +
75
+ Number(Boolean(flags.task || flags.run));
76
+ if (chosen > 1)
77
+ this.error('Choose one source: Duty, trigger fire, or Task run.', { exit: 2 });
78
+ if (!flags.duty && !(flags.trigger && flags.fire) && !(flags.task && flags.run)) {
79
+ this.error('Provide --duty, both --trigger and --fire, or both --task and --run.', {
80
+ exit: 2,
81
+ });
82
+ }
83
+ if (!flags.duty && (flags.limit !== undefined || flags.cursor)) {
84
+ this.error('--limit and --cursor apply only to a Duty trace.', { exit: 2 });
85
+ }
86
+ try {
87
+ if (flags.task && flags.run) {
88
+ // The legacy replay ledger stores only logical Task and Run IDs. It
89
+ // cannot establish that its contents belong to the physical Task and
90
+ // Run referenced by an Activity item after deletion/recreation.
91
+ const unavailable = {
92
+ source: 'task_execution',
93
+ state: 'unsupported',
94
+ reason: 'Task run content is not connected to Activity. Open the Task to view its authorized history.',
95
+ };
96
+ this.log(flags.json ? JSON.stringify(unavailable, null, 2) : unavailable.reason);
97
+ return;
98
+ }
99
+ if (flags.duty) {
100
+ const trace = await duties_1.dutyApi.trace(flags.duty, {
101
+ ...(flags.limit !== undefined ? { limit: flags.limit } : {}),
102
+ ...(flags.cursor ? { cursor: flags.cursor } : {}),
103
+ });
104
+ if (flags.json)
105
+ this.log(JSON.stringify(trace, null, 2));
106
+ else
107
+ (0, duties_1.renderDutyTrace)(trace, (line) => this.log(terminalText(line)));
108
+ return;
109
+ }
110
+ const detail = await triggers_1.triggerApi.fireDetail(flags.trigger, flags.fire);
111
+ if (flags.json)
112
+ this.log(JSON.stringify(detail, null, 2));
113
+ else {
114
+ const row = detail;
115
+ for (const line of (0, fire_detail_1.describeFireAuditDetail)(row, flags.fire, flags.trigger))
116
+ this.log(terminalText(line));
117
+ renderFireContent(row, (line) => this.log(line));
118
+ }
119
+ }
120
+ catch (err) {
121
+ this.handleApiError(err);
122
+ }
123
+ }
124
+ }
125
+ exports.default = ActivityShow;
@@ -93,24 +93,35 @@ class AgentMessageSend extends base_command_1.BaseCommand {
93
93
  if (!partial && !retry)
94
94
  return super.failWithCliError(input);
95
95
  const originalDetails = input.details;
96
- const extra = { ...(partial ? { partialSequence: partial } : {}), ...(retry ? { messageRetry: retry } : {}) };
96
+ const extra = {
97
+ ...(partial ? { partialSequence: partial } : {}),
98
+ ...(retry ? { messageRetry: retry } : {}),
99
+ };
97
100
  const details = originalDetails && typeof originalDetails === 'object' && !Array.isArray(originalDetails)
98
101
  ? {
99
102
  ...originalDetails,
100
- ...(Object.keys(extra).some((key) => Object.hasOwn(originalDetails, key)) ? { originalDetails } : {}),
103
+ ...(Object.keys(extra).some((key) => Object.hasOwn(originalDetails, key))
104
+ ? { originalDetails }
105
+ : {}),
101
106
  ...extra,
102
107
  }
103
108
  : { ...(originalDetails === undefined ? {} : { originalDetails }), ...extra };
104
- const outcomes = partial?.parts.map((part, index) => `${index + 1}: ${part.intent.status}`).join(', ');
105
- const sequenceNote = partial ? `\nEarlier part outcomes: ${outcomes || 'none'}. ` +
106
- `Part ${partial.attemptedPart} was attempted; ${partial.unattemptedParts} later part(s) were not sent.` : '';
109
+ const outcomes = partial?.parts
110
+ .map((part, index) => `${index + 1}: ${part.intent.status}`)
111
+ .join(', ');
112
+ const sequenceNote = partial
113
+ ? `\nEarlier part outcomes: ${outcomes || 'none'}. ` +
114
+ `Part ${partial.attemptedPart} was attempted; ${partial.unattemptedParts} later part(s) were not sent.`
115
+ : '';
107
116
  const json = this.wantsJsonOutput();
108
117
  if (retry && !json) {
109
118
  // oclif wraps error text and inserts prefixes into long generated keys.
110
119
  // Write the key as a single stderr line so it remains copyable.
111
120
  process.stderr.write(`Retry idempotency key: ${retry.idempotencyKey}\n`);
112
121
  }
113
- const retryNote = retry ? '\nIf you retry the same message, reuse the retry key shown above.' : '';
122
+ const retryNote = retry
123
+ ? '\nIf you retry the same message, reuse the retry key shown above.'
124
+ : '';
114
125
  const message = json ? input.message : input.message + sequenceNote + retryNote;
115
126
  return super.failWithCliError({ ...input, message, details });
116
127
  }
@@ -277,7 +288,9 @@ class AgentMessageSend extends base_command_1.BaseCommand {
277
288
  }
278
289
  // Manual task context accepts the same titles and references as task
279
290
  // commands. Managed sessions must leave the claim-derived context alone.
280
- if (!sessionContext && payload.destination.kind === 'app_owner_dm' && payload.context?.taskId) {
291
+ if (!sessionContext &&
292
+ payload.destination.kind === 'app_owner_dm' &&
293
+ payload.context?.taskId) {
281
294
  payload.context.taskId = await this.resolveTaskReference(payload.context.taskId);
282
295
  }
283
296
  const segmentationAdvisory = messageSegmentationAdvisory({
@@ -354,13 +367,16 @@ class AgentMessageSend extends base_command_1.BaseCommand {
354
367
  let halt;
355
368
  for (const [index, requestPart] of requests.entries()) {
356
369
  this.attemptedMessageKey = requestPart.idempotencyKey;
357
- this.partialSequence = requests.length > 1 ? {
358
- sequenceId: idempotencyKey,
359
- parts: [...envelopes],
360
- attemptedPart: index + 1,
361
- totalParts: requests.length,
362
- unattemptedParts: requests.length - index - 1,
363
- } : undefined;
370
+ this.partialSequence =
371
+ requests.length > 1
372
+ ? {
373
+ sequenceId: idempotencyKey,
374
+ parts: [...envelopes],
375
+ attemptedPart: index + 1,
376
+ totalParts: requests.length,
377
+ unattemptedParts: requests.length - index - 1,
378
+ }
379
+ : undefined;
364
380
  const envelope = sessionContext
365
381
  ? await this.submitAsSession({
366
382
  sessionContext,
@@ -671,7 +687,8 @@ const SEQUENCE_CONTINUING_STATUSES = new Set([
671
687
  /** A final held or failed part still leaves the requested sequence incomplete,
672
688
  * even though there are no later parts for sequenceHalt to withhold. */
673
689
  function sequenceComplete(envelopes, halt) {
674
- return !halt && envelopes.every((envelope) => envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status));
690
+ return (!halt &&
691
+ envelopes.every((envelope) => envelope.ok && SEQUENCE_CONTINUING_STATUSES.has(envelope.intent.status)));
675
692
  }
676
693
  /**
677
694
  * Statuses that mean the message will never reach the user without a new send.
@@ -834,8 +851,10 @@ function normalizeIntentPayload({ agentId, jsonBody, merged, }) {
834
851
  throw invalidIntent('--thread-ts / destination.threadTs only applies to slack_channel.');
835
852
  }
836
853
  if (destinationKind !== 'agent_email' &&
837
- (merged.recipients !== undefined || merged.subject !== undefined ||
838
- bodyDestination?.recipients !== undefined || bodyDestination?.subject !== undefined)) {
854
+ (merged.recipients !== undefined ||
855
+ merged.subject !== undefined ||
856
+ bodyDestination?.recipients !== undefined ||
857
+ bodyDestination?.subject !== undefined)) {
839
858
  throw invalidIntent('--to / destination.recipients and --subject / destination.subject only apply to agent_email.');
840
859
  }
841
860
  const destination = buildDestination({
@@ -1228,8 +1247,23 @@ function formatEnvelope(envelope) {
1228
1247
  ? '; reach=user-controlled; presentation=user-controlled'
1229
1248
  : ''}]`
1230
1249
  : '';
1231
- const consequence = STATUS_CONSEQUENCE[status];
1232
- return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}${describeOneVoice(envelope.intent.oneVoice)}${consequence ? ` ${consequence}` : ''}`;
1250
+ const consequence = (envelope.intent.reason && REASON_CONSEQUENCE[envelope.intent.reason]) ||
1251
+ STATUS_CONSEQUENCE[status];
1252
+ return `Agent message intent for ${envelope.agent.id} → ${destination}: ${status}${suffix}.${presentation}${describeOneVoice(envelope.intent.oneVoice)}${consequence ? ` ${consequence}` : ''}${describePersonSender(envelope)}`;
1253
+ }
1254
+ /**
1255
+ * A message a PERSON sends at a terminal goes out as that person, not through the agent's session, so the agent's
1256
+ * own delivery policy (ask-first, quiet hours) is not applied to it (OSK-23450). Someone who sets a policy on an
1257
+ * agent and tests it from their own terminal otherwise concludes the setting is broken: the send answers
1258
+ * `delivered` and nothing says the policy was skipped. Said once, on the owner's app DM, and only when the send
1259
+ * was accepted; `--json` carries `principalKind` already.
1260
+ */
1261
+ function describePersonSender(envelope) {
1262
+ if (envelope.principalKind !== 'human' || envelope.destination.kind !== 'app_owner_dm')
1263
+ return '';
1264
+ if (!['delivered', 'duplicate', 'accepted'].includes(envelope.intent.status))
1265
+ return '';
1266
+ return ' Sent as you, not as the agent: its ask-first mode and quiet hours do not apply to a message a person sends.';
1233
1267
  }
1234
1268
  /**
1235
1269
  * What a status other than `delivered` means for the sender, in the words of
@@ -1239,6 +1273,17 @@ function formatEnvelope(envelope) {
1239
1273
  * the existing line, so anything that reads the old prefix keeps working, and `--json`
1240
1274
  * is unchanged. A status with no entry prints nothing extra rather than a guess.
1241
1275
  */
1276
+ /**
1277
+ * A reason can change what a status means for the sender (OSK-23469). `held` says "may still be delivered", which is
1278
+ * true of a quiet-hours or approval hold and false when the owner's delivery mode is `off`: nothing will ever be
1279
+ * delivered, and `skrr guide communication delivery-statuses` tells the sender to say it in the conversation instead.
1280
+ * Wording is the guide's; a reason with no entry keeps its status sentence.
1281
+ */
1282
+ const REASON_CONSEQUENCE = {
1283
+ delivery_mode_off: "Not delivered, and the owner's delivery mode means it never will be. Say it in the conversation instead. Do not resend.",
1284
+ delivery_mode_suggestions_only: 'Kept as a suggestion the owner sees in the product, not sent as a message. Do not resend.',
1285
+ destination_not_allowed: 'Not delivered: workspace policy excludes this destination. Send to an allowed one, or ask the person to change the policy.',
1286
+ };
1242
1287
  const STATUS_CONSEQUENCE = {
1243
1288
  submitted: 'Recorded and not dispatched yet; the platform still owns it. Do not resend.',
1244
1289
  held: 'Not delivered yet: policy is withholding it and it may still be delivered. Do not resend.',
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const base_command_1 = require("../../../base-command");
6
+ const agent_home_workspace_1 = require("../../../lib/agent-home-workspace");
6
7
  const held_messages_1 = require("../../../lib/held-messages");
8
+ const workspace_header_1 = require("../../../lib/workspace-header");
7
9
  /**
8
10
  * `skrr agents always-on held-messages <agent-id>` — list the session messages the delivery policy
9
11
  * is holding for an agent (`GET /api/agents/:id/always-on/held-messages`).
@@ -30,11 +32,32 @@ class AgentsAlwaysOnHeldMessages extends base_command_1.BaseCommand {
30
32
  async run() {
31
33
  this.requireAuth();
32
34
  const { args, flags } = await this.parse(AgentsAlwaysOnHeldMessages);
35
+ // The route is scoped to a workspace and answers 400 to a request that names none (unlike
36
+ // `always-on status`, which reads the agent's own). With nothing chosen, use the agent's home
37
+ // workspace, as `agents chat` does; `--workspace`, `OVERSKY_WORKSPACE_ID` and
38
+ // `skrr workspaces use` all win over it, and it is never applied in an autonomous Agent session.
39
+ await (0, agent_home_workspace_1.applyAgentHomeWorkspaceDefault)(args.id, (agentId) => data_provider_1.dataService.getAgentById({ agent_id: agentId }));
33
40
  let response;
34
41
  try {
35
42
  response = await data_provider_1.dataService.getAlwaysOnHeldMessages(args.id, flags.cursor);
36
43
  }
37
44
  catch (err) {
45
+ // The server would not use a workspace. Say which one this request carried (if any), because
46
+ // "none selected" and "not a member of the one sent" need different fixes, not a bare 400.
47
+ if ((0, held_messages_1.isWorkspaceContextRequired)(err)) {
48
+ const sentWorkspaceId = (0, workspace_header_1.withWorkspaceHeader)({})['X-Workspace-Id'];
49
+ const refusal = (0, held_messages_1.heldMessagesWorkspaceRefusal)(sentWorkspaceId);
50
+ this.failWithCliError({
51
+ message: refusal.message,
52
+ code: 'HELD_MESSAGES_WORKSPACE_REQUIRED',
53
+ exit: 1,
54
+ retryable: false,
55
+ details: {
56
+ suggestion: refusal.suggestion,
57
+ ...(sentWorkspaceId ? { workspaceId: sentWorkspaceId } : {}),
58
+ },
59
+ });
60
+ }
38
61
  this.handleApiError(err);
39
62
  }
40
63
  // A body that is not the documented shape is an error, not an empty list: "none held" is the
@@ -52,7 +75,7 @@ class AgentsAlwaysOnHeldMessages extends base_command_1.BaseCommand {
52
75
  });
53
76
  }
54
77
  if (flags.json) {
55
- this.log(JSON.stringify(response, null, 2));
78
+ this.printJsonResult(response);
56
79
  return;
57
80
  }
58
81
  for (const line of (0, held_messages_1.heldMessageLines)(args.id, result))
@@ -32,7 +32,8 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
32
32
  const { args, flags } = await this.parse(AgentsAlwaysOnStatus);
33
33
  let status;
34
34
  try {
35
- status = await data_provider_1.dataService.getAlwaysOnStatus(args.id);
35
+ // Asks for `executionReadiness`; the web's 30 s poll does not.
36
+ status = await data_provider_1.dataService.getAlwaysOnStatus(args.id, undefined, { withReadiness: true });
36
37
  }
37
38
  catch (err) {
38
39
  this.handleApiError(err);
@@ -82,6 +83,10 @@ class AgentsAlwaysOnStatus extends base_command_1.BaseCommand {
82
83
  }
83
84
  for (const line of (0, always_on_runtime_1.runtimeLines)(runtime, status.desiredEnabled))
84
85
  this.log(line);
86
+ // Online is not the same as able: a machine on an older Skrr is `blocked` here (OSK-23456).
87
+ for (const line of (0, always_on_runtime_1.executionReadinessLines)(status.executionReadiness, status.desiredEnabled)) {
88
+ this.log(line);
89
+ }
85
90
  const reconcile = status.reconcile;
86
91
  this.log(`Reconcile: ${reconcile?.status ?? 'unavailable'}` +
87
92
  (reconcile?.lastError ? ` (${reconcile.lastError})` : ''));
@@ -0,0 +1,13 @@
1
+ import { MiniComputerCommand } from '../../../../lib/miniComputerCommand';
2
+ export default class AgentsMiniComputerAppReset extends MiniComputerCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ app: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
+ };
9
+ static flags: {
10
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const data_provider_1 = require("@skrr-ai/data-provider");
5
+ const miniComputerCommand_1 = require("../../../../lib/miniComputerCommand");
6
+ class AgentsMiniComputerAppReset extends miniComputerCommand_1.MiniComputerCommand {
7
+ static description = 'Put one built-in Mini Computer app of an Agent back on its default (removes the configuration set on it). Resetting an app with nothing set is not an error. Needs edit access to the Agent.';
8
+ static examples = ['<%= config.bin %> agents mini-computer app reset <agent-id> tasks'];
9
+ static args = {
10
+ agentId: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
11
+ app: core_1.Args.string({
12
+ description: 'Built-in app id (for example tasks)',
13
+ required: true,
14
+ ignoreStdin: true,
15
+ }),
16
+ };
17
+ static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
18
+ async run() {
19
+ this.requireAuth();
20
+ const { args, flags } = await this.parse(AgentsMiniComputerAppReset);
21
+ try {
22
+ const entry = await data_provider_1.dataService.resetMiniComputerAppConfig(args.agentId, args.app);
23
+ if (flags.json) {
24
+ this.log(this.agentJson(args.agentId, entry));
25
+ return;
26
+ }
27
+ this.log(`${entry.appId}: back on its default`);
28
+ this.printAgentUrl(args.agentId);
29
+ }
30
+ catch (error) {
31
+ this.failMiniComputer(error);
32
+ }
33
+ }
34
+ }
35
+ exports.default = AgentsMiniComputerAppReset;
@@ -0,0 +1,16 @@
1
+ import { MiniComputerCommand } from '../../../../lib/miniComputerCommand';
2
+ export default class AgentsMiniComputerAppSet extends MiniComputerCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ agentId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ app: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
+ };
9
+ static flags: {
10
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'expected-rev': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<void>;
16
+ }