@skrr-ai/cli 0.1.165 → 0.1.167

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 (97) hide show
  1. package/dist/base-command.js +0 -1
  2. package/dist/commands/activity/scan-older.d.ts +1 -1
  3. package/dist/commands/activity/scan-older.js +5 -4
  4. package/dist/commands/agent/message/approve.d.ts +1 -0
  5. package/dist/commands/agent/message/approve.js +6 -2
  6. package/dist/commands/agent/message/decline.d.ts +1 -0
  7. package/dist/commands/agent/message/decline.js +6 -2
  8. package/dist/commands/agent/message/pending.js +5 -2
  9. package/dist/commands/agent/message/review.d.ts +13 -0
  10. package/dist/commands/agent/message/review.js +68 -0
  11. package/dist/commands/agents/always-on/recovery-close.d.ts +28 -0
  12. package/dist/commands/agents/always-on/recovery-close.js +60 -0
  13. package/dist/commands/agents/always-on/recovery-review.d.ts +22 -0
  14. package/dist/commands/agents/always-on/recovery-review.js +190 -0
  15. package/dist/commands/apps/installations/compatibility.js +1 -1
  16. package/dist/commands/apps/installations/list.js +3 -0
  17. package/dist/commands/apps/installations/migrate/abort.d.ts +13 -0
  18. package/dist/commands/apps/installations/migrate/abort.js +45 -0
  19. package/dist/commands/apps/installations/migrate/cutover.d.ts +15 -0
  20. package/dist/commands/apps/installations/migrate/cutover.js +102 -0
  21. package/dist/commands/apps/installations/migrate/plan.d.ts +13 -0
  22. package/dist/commands/apps/installations/migrate/plan.js +51 -0
  23. package/dist/commands/apps/installations/migrate/rollback.d.ts +16 -0
  24. package/dist/commands/apps/installations/migrate/rollback.js +103 -0
  25. package/dist/commands/apps/installations/migrate/stage.d.ts +15 -0
  26. package/dist/commands/apps/installations/migrate/stage.js +96 -0
  27. package/dist/commands/apps/installations/migrate/status.d.ts +12 -0
  28. package/dist/commands/apps/installations/migrate/status.js +52 -0
  29. package/dist/commands/apps/installations/migrate/validate.d.ts +14 -0
  30. package/dist/commands/apps/installations/migrate/validate.js +58 -0
  31. package/dist/commands/apps/installations/show.js +8 -6
  32. package/dist/commands/apps/operations/check.js +1 -1
  33. package/dist/commands/apps/resume.js +1 -1
  34. package/dist/commands/apps/settings/set.js +22 -10
  35. package/dist/commands/duties/show.js +10 -0
  36. package/dist/commands/goals/key-results/assess.d.ts +2 -3
  37. package/dist/commands/goals/key-results/assess.js +5 -12
  38. package/dist/commands/harnesses/removal-references.d.ts +16 -0
  39. package/dist/commands/harnesses/removal-references.js +61 -0
  40. package/dist/commands/tasks/actionability.js +8 -3
  41. package/dist/commands/tasks/complete.js +35 -17
  42. package/dist/commands/tasks/expectations/assess.d.ts +1 -0
  43. package/dist/commands/tasks/expectations/assess.js +50 -21
  44. package/dist/commands/tasks/expectations.js +5 -2
  45. package/dist/commands/tasks/judge.d.ts +1 -0
  46. package/dist/commands/tasks/judge.js +17 -2
  47. package/dist/commands/tasks/result/submit.js +26 -17
  48. package/dist/commands/tasks/review-queue.js +2 -1
  49. package/dist/commands/tasks/review.d.ts +1 -0
  50. package/dist/commands/tasks/review.js +24 -3
  51. package/dist/commands/tasks/show.d.ts +13 -0
  52. package/dist/commands/tasks/show.js +41 -3
  53. package/dist/commands/tasks/updates/add.d.ts +1 -0
  54. package/dist/commands/tasks/updates/add.js +71 -21
  55. package/dist/commands/tasks/updates/list.d.ts +4 -0
  56. package/dist/commands/tasks/updates/list.js +3 -1
  57. package/dist/commands/tasks/waive.d.ts +1 -0
  58. package/dist/commands/tasks/waive.js +17 -2
  59. package/dist/generated/agent-guides.json +20 -20
  60. package/dist/lib/agent-activity.d.ts +3 -1
  61. package/dist/lib/agent-activity.js +50 -11
  62. package/dist/lib/api-fetch.js +32 -5
  63. package/dist/lib/appCompatibility.js +1 -1
  64. package/dist/lib/appData.d.ts +1 -1
  65. package/dist/lib/appData.js +6 -2
  66. package/dist/lib/appDataMigration.d.ts +204 -0
  67. package/dist/lib/appDataMigration.js +753 -0
  68. package/dist/lib/appDataMigrationCommand.d.ts +39 -0
  69. package/dist/lib/appDataMigrationCommand.js +90 -0
  70. package/dist/lib/appInstallations.d.ts +8 -0
  71. package/dist/lib/appInstallations.js +55 -2
  72. package/dist/lib/apps-command.js +17 -10
  73. package/dist/lib/harnesses.d.ts +24 -0
  74. package/dist/lib/harnesses.js +4 -0
  75. package/dist/lib/node-adapter.d.ts +0 -2
  76. package/dist/lib/node-adapter.js +46 -42
  77. package/dist/lib/rate-limit-retry.d.ts +4 -5
  78. package/dist/lib/rate-limit-retry.js +6 -10
  79. package/dist/lib/reference-syntax.d.ts +28 -0
  80. package/dist/lib/reference-syntax.js +91 -0
  81. package/dist/lib/refresh.d.ts +2 -0
  82. package/dist/lib/refresh.js +6 -0
  83. package/dist/lib/runtime-context.js +6 -0
  84. package/dist/lib/task-closure.d.ts +1 -1
  85. package/dist/lib/task-closure.js +1 -1
  86. package/dist/lib/task-operations.d.ts +28 -6
  87. package/dist/lib/task-operations.js +77 -4
  88. package/dist/lib/task-preflight.js +8 -3
  89. package/dist/lib/task-write-attribution.d.ts +183 -19
  90. package/dist/lib/task-write-attribution.js +270 -39
  91. package/dist/lib/write-outcome.d.ts +2 -0
  92. package/dist/lib/write-outcome.js +14 -0
  93. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +63 -0
  94. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +71 -0
  95. package/dist/node_modules/@skrr-ai/data-provider/index.js +11635 -11306
  96. package/oclif.manifest.json +1387 -412
  97. package/package.json +5 -2
@@ -3118,7 +3118,6 @@ const RETIRED_FLAG_REPLACEMENTS = {
3118
3118
  '--conclusion-type/--conclusion-json for a conclusion such as NO-SHIP.',
3119
3119
  '--outcome': '--outcome is now --summary.',
3120
3120
  '--finding': '--finding is gone: record findings as `tasks updates add --type finding`.',
3121
- '--evidence': '--evidence is now --evidence-ref on the Result, or an evidenceRefs entry.',
3122
3121
  '--next': '--next is now --remaining.',
3123
3122
  '--deliverables': '--deliverables is now --deliverable <task-resource-link-id>, recorded first with ' +
3124
3123
  '`tasks deliverable add`.',
@@ -1,6 +1,6 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  /**
3
- * `skrr activity scan-older <chat|group-chat|task>` — a separate, bounded read of older chat, group or personal Task
3
+ * `skrr activity scan-older <chat|group-chat|task|trigger>` — a separate, bounded read of older chat, group, trigger or personal Task
4
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,
@@ -4,7 +4,7 @@ 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|task>` — a separate, bounded read of older chat, group or personal Task
7
+ * `skrr activity scan-older <chat|group-chat|task|trigger>` — a separate, bounded read of older chat, group, trigger or personal Task
8
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,
@@ -13,20 +13,21 @@ 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, group or personal Task activity the feed does not page to';
16
+ static description = 'Scan for older chat, group, trigger 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
20
  '<%= config.bin %> activity scan-older task',
21
+ '<%= config.bin %> activity scan-older trigger',
21
22
  '<%= config.bin %> activity scan-older group-chat --cursor <scanOlderCursor>',
22
23
  '<%= config.bin %> activity scan-older chat --limit 10 --json',
23
24
  ];
24
25
  static args = {
25
26
  source: core_1.Args.string({
26
- description: 'Which scan: chat, group-chat, or task (owned personal Tasks; clear the workspace selection first)',
27
+ description: 'Which scan: chat, group-chat, trigger, or task (owned personal Tasks; clear the workspace selection first)',
27
28
  required: true,
28
29
  ignoreStdin: true,
29
- options: ['chat', 'group-chat', 'task'],
30
+ options: ['chat', 'group-chat', 'task', 'trigger'],
30
31
  }),
31
32
  };
32
33
  static flags = {
@@ -11,6 +11,7 @@ export default class AgentMessageApprove extends BaseCommand {
11
11
  };
12
12
  static flags: {
13
13
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ revision: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
15
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
16
  };
16
17
  run(): Promise<void>;
@@ -13,7 +13,7 @@ class AgentMessageApprove extends base_command_1.BaseCommand {
13
13
  static description = "Approve an Agent's message that is waiting for your approval, and deliver it";
14
14
  static examples = [
15
15
  '<%= config.bin %> agent message pending --agent <agent-id>',
16
- '<%= config.bin %> agent message approve <intent-id> --agent <agent-id>',
16
+ '<%= config.bin %> agent message approve <intent-id> --agent <agent-id> --revision <revision>',
17
17
  ];
18
18
  static args = {
19
19
  intent: core_1.Args.string({
@@ -24,6 +24,10 @@ class AgentMessageApprove extends base_command_1.BaseCommand {
24
24
  };
25
25
  static flags = {
26
26
  agent: core_1.Flags.string({ description: 'Agent ID', required: false }),
27
+ revision: core_1.Flags.string({
28
+ description: 'Approval revision shown by agent message pending',
29
+ required: true,
30
+ }),
27
31
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
28
32
  };
29
33
  async run() {
@@ -55,7 +59,7 @@ class AgentMessageApprove extends base_command_1.BaseCommand {
55
59
  });
56
60
  }
57
61
  try {
58
- const result = await data_provider_1.dataService.decideAgentDmIntent(agentId, args.intent, 'approve');
62
+ const result = await data_provider_1.dataService.decideAgentDmIntent(agentId, args.intent, 'approve', flags.revision);
59
63
  if (flags.json) {
60
64
  this.printJsonResult(result);
61
65
  return;
@@ -11,6 +11,7 @@ export default class AgentMessageDecline extends BaseCommand {
11
11
  };
12
12
  static flags: {
13
13
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ revision: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
15
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
16
  };
16
17
  run(): Promise<void>;
@@ -13,7 +13,7 @@ class AgentMessageDecline extends base_command_1.BaseCommand {
13
13
  static description = "Decline an Agent's message that is waiting for your approval, and cancel it";
14
14
  static examples = [
15
15
  '<%= config.bin %> agent message pending --agent <agent-id>',
16
- '<%= config.bin %> agent message decline <intent-id> --agent <agent-id>',
16
+ '<%= config.bin %> agent message decline <intent-id> --agent <agent-id> --revision <revision>',
17
17
  ];
18
18
  static args = {
19
19
  intent: core_1.Args.string({
@@ -24,6 +24,10 @@ class AgentMessageDecline extends base_command_1.BaseCommand {
24
24
  };
25
25
  static flags = {
26
26
  agent: core_1.Flags.string({ description: 'Agent ID', required: false }),
27
+ revision: core_1.Flags.string({
28
+ description: 'Approval revision shown by agent message pending',
29
+ required: true,
30
+ }),
27
31
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
28
32
  };
29
33
  async run() {
@@ -55,7 +59,7 @@ class AgentMessageDecline extends base_command_1.BaseCommand {
55
59
  });
56
60
  }
57
61
  try {
58
- const result = await data_provider_1.dataService.decideAgentDmIntent(agentId, args.intent, 'decline');
62
+ const result = await data_provider_1.dataService.decideAgentDmIntent(agentId, args.intent, 'decline', flags.revision);
59
63
  if (flags.json) {
60
64
  this.printJsonResult(result);
61
65
  return;
@@ -14,7 +14,7 @@ class AgentMessagePending extends base_command_1.BaseCommand {
14
14
  static description = "List an Agent's own messages that are waiting for your approval because it is set to ask first";
15
15
  static examples = [
16
16
  '<%= config.bin %> agent message pending --agent <agent-id>',
17
- '<%= config.bin %> agent message approve <intent-id> --agent <agent-id>',
17
+ '<%= config.bin %> agent message approve <intent-id> --agent <agent-id> --revision <revision>',
18
18
  ];
19
19
  static args = {
20
20
  agent: core_1.Args.string({ description: 'Agent ID', required: false, ignoreStdin: true }),
@@ -68,8 +68,11 @@ class AgentMessagePending extends base_command_1.BaseCommand {
68
68
  const expires = item.expiresAt ? ` · expires ${item.expiresAt}` : '';
69
69
  this.log(`${item.intentId} [${item.kind ?? 'message'}]${expires}`);
70
70
  this.log(` ${item.preview}`);
71
+ this.log(item.approvalRevision
72
+ ? ` revision: ${item.approvalRevision}`
73
+ : ` Review this older approval with: skrr agent message review ${item.intentId} --agent ${agentId}`);
71
74
  }
72
- this.log(`\nApprove one with: skrr agent message approve <intent-id> --agent ${agentId} (or decline).`);
75
+ this.log(`\nApprove one with: skrr agent message approve <intent-id> --agent ${agentId} --revision <revision> (or decline).`);
73
76
  }
74
77
  catch (error) {
75
78
  this.handleApiError(error);
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /** Prepare and show the current message; this command does not decide it. */
3
+ export default class AgentMessageReview extends BaseCommand {
4
+ static description: string;
5
+ static args: {
6
+ intent: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,68 @@
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 base_command_1 = require("../../../base-command");
6
+ const agent_resolver_1 = require("../../../lib/agent-resolver");
7
+ const message_intent_1 = require("../../../lib/message-intent");
8
+ /** Prepare and show the current message; this command does not decide it. */
9
+ class AgentMessageReview extends base_command_1.BaseCommand {
10
+ static description = 'Review the current pending Agent message before deciding';
11
+ static args = {
12
+ intent: core_1.Args.string({ description: 'Pending intent ID', required: true, ignoreStdin: true }),
13
+ };
14
+ static flags = {
15
+ agent: core_1.Flags.string({ description: 'Agent ID' }),
16
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
17
+ };
18
+ async run() {
19
+ const { args, flags } = await this.parse(AgentMessageReview);
20
+ const sessionContext = (0, message_intent_1.resolveMessageCommandSessionContext)({
21
+ requireHumanAuth: () => this.requireAuth(),
22
+ });
23
+ if (sessionContext)
24
+ this.failWithCliError({
25
+ message: 'Only a person can review a pending message.',
26
+ code: 'HUMAN_APPROVAL_REQUIRED',
27
+ exit: 2,
28
+ retryable: false,
29
+ });
30
+ let agentId;
31
+ try {
32
+ const explicit = (0, agent_resolver_1.mergeExplicitAgentInputs)([{ label: '--agent', value: flags.agent }]);
33
+ agentId = (await (0, agent_resolver_1.resolveAgentIdentity)(explicit)).id;
34
+ }
35
+ catch (error) {
36
+ const failure = (0, agent_resolver_1.agentResolutionFailure)(error);
37
+ this.failWithCliError({
38
+ message: failure.message,
39
+ code: failure.code,
40
+ exit: 2,
41
+ retryable: false,
42
+ details: failure.suggestion ? { suggestion: failure.suggestion } : undefined,
43
+ });
44
+ }
45
+ try {
46
+ const result = await data_provider_1.dataService.prepareAgentDmReview(agentId, args.intent);
47
+ if (!result?.item ||
48
+ result.item.agentId !== agentId ||
49
+ result.item.intentId !== args.intent ||
50
+ result.item.status !== 'approval_required' ||
51
+ typeof result.item.approvalRevision !== 'string' ||
52
+ !/^[a-f0-9]{64}$/.test(result.item.approvalRevision))
53
+ throw new Error('Current pending message could not be verified.');
54
+ if (flags.json) {
55
+ this.printJsonResult(result);
56
+ return;
57
+ }
58
+ this.log(`${result.item.intentId} [${result.item.kind ?? 'message'}]`);
59
+ this.log(` ${result.item.preview}`);
60
+ this.log(` revision: ${result.item.approvalRevision}`);
61
+ this.log(`\nTo decide, use --revision ${result.item.approvalRevision} with agent message approve or decline.`);
62
+ }
63
+ catch (error) {
64
+ this.handleApiError(error);
65
+ }
66
+ }
67
+ }
68
+ exports.default = AgentMessageReview;
@@ -0,0 +1,28 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` — the Agent owner closes ONE held Duty
4
+ * result, via `POST /api/agents/:id/always-on/runs/:runId/result-recovery/close` (OSK-23548).
5
+ *
6
+ * A Duty result whose custody is uncertain is held for review, and the held Run stops its Duty's later Checks until a
7
+ * person decides. Closing ends the Run as cancelled. Its held result is not applied and the turn is not run again; the
8
+ * Duty re-decides at its next Check, from what it finds then. Closing says nothing about effects: anything the turn
9
+ * already did stays done.
10
+ *
11
+ * `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
12
+ * was held again since, the server refuses. The server also requires you to be the Agent's owner signed in as a person
13
+ * (`skrr login`; a personal access token never reaches the route), that you can see the review, and that the machine
14
+ * that ran the turn confirmed it stopped. Nothing about who you are is taken from the command line.
15
+ */
16
+ export default class AgentsAlwaysOnRecoveryClose extends BaseCommand {
17
+ static description: string;
18
+ static examples: string[];
19
+ static args: {
20
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
21
+ runId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
22
+ };
23
+ static flags: {
24
+ hold: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
25
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ };
27
+ run(): Promise<void>;
28
+ }
@@ -0,0 +1,60 @@
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 base_command_1 = require("../../../base-command");
6
+ /**
7
+ * `skrr agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>` — the Agent owner closes ONE held Duty
8
+ * result, via `POST /api/agents/:id/always-on/runs/:runId/result-recovery/close` (OSK-23548).
9
+ *
10
+ * A Duty result whose custody is uncertain is held for review, and the held Run stops its Duty's later Checks until a
11
+ * person decides. Closing ends the Run as cancelled. Its held result is not applied and the turn is not run again; the
12
+ * Duty re-decides at its next Check, from what it finds then. Closing says nothing about effects: anything the turn
13
+ * already did stays done.
14
+ *
15
+ * `--hold` is the ref `recovery-review <agent-id> <run-id>` prints. It binds the close to the hold you read: if the Run
16
+ * was held again since, the server refuses. The server also requires you to be the Agent's owner signed in as a person
17
+ * (`skrr login`; a personal access token never reaches the route), that you can see the review, and that the machine
18
+ * that ran the turn confirmed it stopped. Nothing about who you are is taken from the command line.
19
+ */
20
+ class AgentsAlwaysOnRecoveryClose extends base_command_1.BaseCommand {
21
+ static description = 'Close one held Duty result as the Agent owner: the Run ends cancelled, its held result is not applied, and the Duty re-decides at its next Check. Its effects stay unknown';
22
+ static examples = [
23
+ '<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref>',
24
+ '<%= config.bin %> agents always-on recovery-close <agent-id> <run-id> --hold <hold-ref> --json',
25
+ ];
26
+ static args = {
27
+ id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
28
+ runId: core_1.Args.string({ description: 'Held Duty Run ID', required: true, ignoreStdin: true }),
29
+ };
30
+ static flags = {
31
+ hold: core_1.Flags.string({
32
+ required: true,
33
+ description: 'The hold ref `skrr agents always-on recovery-review <agent-id> <run-id>` prints. A hold that changed since is refused.',
34
+ }),
35
+ json: core_1.Flags.boolean({ description: 'Print the server answer as JSON' }),
36
+ };
37
+ async run() {
38
+ this.requireAuth();
39
+ const { args, flags } = await this.parse(AgentsAlwaysOnRecoveryClose);
40
+ let result;
41
+ try {
42
+ result = await data_provider_1.dataService.closeDutyRunRecoveryReview(args.id, args.runId, {
43
+ holdRef: flags.hold,
44
+ });
45
+ }
46
+ catch (error) {
47
+ // The server's refusals carry their own sentence and `code` (`hold_changed`, `executor_stop_unconfirmed`, ...).
48
+ this.handleApiError(error);
49
+ }
50
+ if (flags.json) {
51
+ this.printJsonResult(result);
52
+ return;
53
+ }
54
+ this.log(result.alreadyClosed
55
+ ? `Run ${result.runId} was already closed.`
56
+ : `Closed run ${result.runId} of agent ${result.agentId}.`);
57
+ this.log(result.message);
58
+ }
59
+ }
60
+ exports.default = AgentsAlwaysOnRecoveryClose;
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * Read-only. The server independently verifies owner and source authorization.
4
+ *
5
+ * With a run id it reads ONE review (`GET .../runs/:runId/result-recovery`). Without one it lists the Agent's held
6
+ * results (`GET .../result-recoveries`), which is the only way to find a run id to open. The list is one positional
7
+ * away from the read rather than a sibling command because it answers the same question for every Run instead of one.
8
+ */
9
+ export default class AgentsAlwaysOnRecoveryReview extends BaseCommand {
10
+ static description: string;
11
+ static examples: string[];
12
+ static args: {
13
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
14
+ runId: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
15
+ };
16
+ static flags: {
17
+ cursor: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
+ };
20
+ run(): Promise<void>;
21
+ private list;
22
+ }
@@ -0,0 +1,190 @@
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 base_command_1 = require("../../../base-command");
6
+ const http_error_1 = require("../../../lib/http-error");
7
+ const INTEGRITY_CAVEAT = 'Result integrity does not prove the executor stopped or that effects did not occur.';
8
+ /**
9
+ * Read-only. The server independently verifies owner and source authorization.
10
+ *
11
+ * With a run id it reads ONE review (`GET .../runs/:runId/result-recovery`). Without one it lists the Agent's held
12
+ * results (`GET .../result-recoveries`), which is the only way to find a run id to open. The list is one positional
13
+ * away from the read rather than a sibling command because it answers the same question for every Run instead of one.
14
+ */
15
+ class AgentsAlwaysOnRecoveryReview extends base_command_1.BaseCommand {
16
+ static description = "Read Duty Run recovery evidence as the Agent owner; without a run id, list the Agent's held results";
17
+ static examples = [
18
+ '<%= config.bin %> agents always-on recovery-review <agent-id>',
19
+ '<%= config.bin %> agents always-on recovery-review <agent-id> --cursor <nextCursor>',
20
+ '<%= config.bin %> agents always-on recovery-review <agent-id> <run-id>',
21
+ '<%= config.bin %> agents always-on recovery-review <agent-id> <run-id> --json',
22
+ ];
23
+ static args = {
24
+ id: core_1.Args.string({ description: 'Agent ID', required: true, ignoreStdin: true }),
25
+ runId: core_1.Args.string({
26
+ description: 'Duty Run ID to open; leave it out to list the held results',
27
+ required: false,
28
+ ignoreStdin: true,
29
+ }),
30
+ };
31
+ static flags = {
32
+ cursor: core_1.Flags.string({ description: 'List only: the nextCursor a previous page printed' }),
33
+ json: core_1.Flags.boolean({ description: 'Print the review, or the page of reviews, as JSON' }),
34
+ };
35
+ async run() {
36
+ this.requireAuth();
37
+ const { args, flags } = await this.parse(AgentsAlwaysOnRecoveryReview);
38
+ if (!args.runId) {
39
+ await this.list(args.id, flags.cursor, flags.json);
40
+ return;
41
+ }
42
+ if (flags.cursor !== undefined) {
43
+ this.failWithCliError({
44
+ message: '--cursor pages the list of held results, and a run id opens one review.\n' +
45
+ `→ Leave out <run-id> to page the list: skrr agents always-on recovery-review ${args.id} --cursor <cursor>`,
46
+ code: 'RECOVERY_REVIEW_CURSOR_WITH_RUN',
47
+ exit: 2,
48
+ retryable: false,
49
+ });
50
+ }
51
+ let review;
52
+ try {
53
+ review = await data_provider_1.dataService.getDutyRunRecoveryReview(args.id, args.runId);
54
+ }
55
+ catch (error) {
56
+ this.handleApiError(error);
57
+ }
58
+ if (flags.json) {
59
+ this.printJsonResult(review);
60
+ return;
61
+ }
62
+ this.log(`Run: ${review.runId}`);
63
+ if (review.source === 'unverified')
64
+ this.log("Duty: not shown; this run's link to its Duty could not be verified");
65
+ this.log(`Status: ${review.status}; generation: ${review.generation ?? 'unknown'}; attempt: ${review.attempt ?? 'unknown'}`);
66
+ this.log(`Recovery: ${review.hold}; stored result: ${review.result}`);
67
+ this.log(`Executor: ${review.executor}; effects: ${review.effects}`);
68
+ this.log(INTEGRITY_CAVEAT);
69
+ for (const line of closeLines(args.id, review))
70
+ this.log(line);
71
+ }
72
+ async list(agentId, cursor, json) {
73
+ let response;
74
+ try {
75
+ response = await data_provider_1.dataService.listDutyRunRecoveryReviews(agentId, cursor);
76
+ }
77
+ catch (error) {
78
+ if (cursor !== undefined &&
79
+ (0, http_error_1.httpStatusOf)(error) === 400 &&
80
+ (0, http_error_1.httpBodyOf)(error)?.code === 'invalid_cursor') {
81
+ this.failWithCliError({
82
+ message: 'The server did not accept that cursor. A cursor expires after 15 minutes and works only for the Agent ' +
83
+ 'and owner it was issued to.\n' +
84
+ `→ Start the list again: skrr agents always-on recovery-review ${agentId}`,
85
+ code: 'RECOVERY_REVIEW_CURSOR_INVALID',
86
+ status: 400,
87
+ exit: 1,
88
+ retryable: false,
89
+ });
90
+ }
91
+ this.handleApiError(error);
92
+ }
93
+ // A body that is not the documented shape is an error, never "nothing is held": that is the one reading that
94
+ // would reassure about exactly what this command exists to show.
95
+ const page = parseReviewPage(response);
96
+ if (!page) {
97
+ this.failWithCliError({
98
+ message: 'The server returned a recovery review list this CLI does not recognise.',
99
+ code: 'RECOVERY_REVIEW_LIST_UNEXPECTED',
100
+ exit: 1,
101
+ retryable: false,
102
+ details: {
103
+ suggestion: 'Update skrr, and check that the server serves GET /api/agents/:id/always-on/result-recoveries.',
104
+ },
105
+ });
106
+ }
107
+ if (json) {
108
+ this.printJsonResult(response);
109
+ return;
110
+ }
111
+ const next = page.nextCursor
112
+ ? `Next page: skrr agents always-on recovery-review ${agentId} --cursor ${page.nextCursor}`
113
+ : undefined;
114
+ if (page.reviews.length === 0) {
115
+ if (next) {
116
+ // The server reads a fixed number of candidate Runs per page and drops the ones it will not show, so an empty
117
+ // page with a cursor is not the end of the list.
118
+ this.log('No held Duty results on this page, but more Runs remain to check.');
119
+ this.log(next);
120
+ }
121
+ else {
122
+ this.log(`No Duty results are held for recovery review on Agent ${agentId}.`);
123
+ }
124
+ return;
125
+ }
126
+ this.log(`Held Duty results for Agent ${agentId}: ${page.reviews.length}${next ? ' on this page' : ''}`);
127
+ for (const review of page.reviews)
128
+ this.log(` ${reviewLine(review)}`);
129
+ this.log(`Open one: skrr agents always-on recovery-review ${agentId} <run-id>`);
130
+ this.log(INTEGRITY_CAVEAT);
131
+ if (next)
132
+ this.log(next);
133
+ }
134
+ }
135
+ exports.default = AgentsAlwaysOnRecoveryReview;
136
+ /**
137
+ * What the owner can do about a held result (OSK-23548), in the server's own terms. Nothing for an unheld Run, an older
138
+ * server, or a hold this server cannot close: no command is offered that would be refused.
139
+ */
140
+ function closeLines(agentId, review) {
141
+ if (review.close === 'available' && isNonEmptyString(review.holdRef)) {
142
+ return [
143
+ 'Close: available. Closing ends the Run without applying its held result; the Duty re-decides at its next Check.',
144
+ `→ skrr agents always-on recovery-close ${agentId} ${review.runId} --hold ${review.holdRef}`,
145
+ ];
146
+ }
147
+ if (review.close === 'executor_stop_unconfirmed') {
148
+ return [
149
+ 'Close: not yet. The machine that ran this turn has not confirmed it stopped; bring it online and read this again.',
150
+ ];
151
+ }
152
+ if (review.close === 'effect_boundary') {
153
+ return [
154
+ 'Close: not available. This Run started applying its result, and closing it would hide which effects happened.',
155
+ ];
156
+ }
157
+ return [];
158
+ }
159
+ /** One line per held result: what a person needs to choose which one to open. */
160
+ function reviewLine(review) {
161
+ const stored = review.resultCapture === 'unsealable'
162
+ ? `${review.result} (could not be sealed)`
163
+ : review.result;
164
+ return [
165
+ review.runId,
166
+ review.source === 'unverified' ? 'duty unverified' : `duty ${review.dutyId ?? 'unknown'}`,
167
+ `recovery: ${review.hold}`,
168
+ `stored result: ${stored}`,
169
+ `run status: ${review.status}`,
170
+ `attempt: ${review.attempt ?? 'unknown'}`,
171
+ ].join(' ');
172
+ }
173
+ const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
174
+ function parseReviewPage(value) {
175
+ if (!value || typeof value !== 'object' || Array.isArray(value))
176
+ return null;
177
+ const body = value;
178
+ if (!Array.isArray(body.reviews))
179
+ return null;
180
+ if (body.nextCursor !== undefined && !isNonEmptyString(body.nextCursor))
181
+ return null;
182
+ for (const review of body.reviews) {
183
+ if (!review ||
184
+ typeof review !== 'object' ||
185
+ !isNonEmptyString(review.runId)) {
186
+ return null;
187
+ }
188
+ }
189
+ return body;
190
+ }
@@ -6,7 +6,7 @@ const apps_command_1 = require("../../../lib/apps-command");
6
6
  const appCompatibility_1 = require("../../../lib/appCompatibility");
7
7
  const drain_stdio_1 = require("../../../lib/drain-stdio");
8
8
  class AppsInstallationsCompatibility extends apps_command_1.AppsCommand {
9
- static description = 'Check whether an installation’s stored data is compatible with another version of its app, before you move it: the server reads the installation’s documents and holds each to the data schema that version declares for its collection. The answer is compatible, incompatible (a document does not fit, or lives in a collection the version no longer declares; the findings name the collection, the document id, a code and where, never a value) or unknown (it could not be proven: the data changed while it was read, a schema could not be read, the installation holds more than one check reads, or the server cannot prove the data epoch is enforced). Unknown is NOT a pass. It proves conformance to the DECLARED schemas, not that the app will work; it is a snapshot, not a guarantee; and it is separate from approval of what the app may do. It writes nothing and no move depends on it: `apps upgrade` and `apps rollback` are never blocked by it. For a person who can edit the installation (a token or an agent’s credential is refused). Exit codes: 0 compatible, 1 incompatible, 5 unknown.';
9
+ static description = 'Check whether an installation’s stored data is compatible with another version of its app, before you move it: the server reads the installation’s documents and holds each to the data schema that version declares for its collection. The answer is compatible, incompatible (a document does not fit, or lives in a collection the version no longer declares; the findings name the collection, the document id, a code and where, never a value) or unknown (it could not be proven: the data changed while it was read, a schema could not be read, the installation holds more than one check reads, or the data epoch is not known to be enforced by every writer). Unknown is NOT a pass. A compatible result proves conformance to the DECLARED schemas, not that the app will work; it is a snapshot, not a guarantee; and it is separate from approval of what the app may do. It writes nothing and no move depends on it: `apps upgrade` and `apps rollback` are never blocked by it. For a person who can edit the installation (a token or an agent’s credential is refused). Exit codes: 0 compatible, 1 incompatible, 5 unknown.';
10
10
  static examples = [
11
11
  '<%= config.bin %> apps installations compatibility appi_abc --version appv_new',
12
12
  '<%= config.bin %> apps installations compatibility appi_abc --version appv_new --json',
@@ -39,6 +39,9 @@ class AppsInstallationsList extends apps_command_1.AppsCommand {
39
39
  }
40
40
  for (const installation of result.installations) {
41
41
  this.log((0, appInstallations_1.formatInstallationRow)(installation));
42
+ if (installation.settlement === 'pending') {
43
+ this.log(` Installation is still being finalized. Check \`${this.config.bin} apps installations show ${installation.id}\`; if it stays pending, contact support with this ID.`);
44
+ }
42
45
  }
43
46
  }
44
47
  catch (error) {
@@ -0,0 +1,13 @@
1
+ import { AppsMigrationCommand } from '../../../../lib/appDataMigrationCommand';
2
+ export default class AppsInstallationsMigrateAbort extends AppsMigrationCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ installation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ migration: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const appDataMigrationCommand_1 = require("../../../../lib/appDataMigrationCommand");
5
+ const appDataMigration_1 = require("../../../../lib/appDataMigration");
6
+ class AppsInstallationsMigrateAbort extends appDataMigrationCommand_1.AppsMigrationCommand {
7
+ static description = 'Close the installation’s data migration: erase its staging and lift ONLY this migration’s own freeze, so the app runs again as it did before. Nothing live had changed (no stored document, no version, no old row), so there is nothing to restore. It is the way out of every state before the cutover, including `failed` and `validated`. Once a cutover has begun (`cutting_over`) it is refused (exit 4): the documents are being replaced, so the cutover can only finish (`cutover --yes`) or be rolled back, and a cutover that has finished is undone with `rollback`. It is safe to repeat: aborting a migration that is already aborted answers `aborted` again (name it with --migration; with none open and none named, the server refuses with "no migration open"). A freeze a platform moderation holds is not lifted by it. Only a signed-in person who is the installation’s installer (the person whose approval it runs under) may run it: a token or an agent’s credential is refused. It is off unless the deployment has it enabled (SKRR_APP_DATA_MIGRATION), which exit 6 says. Exit codes: 0 aborted, 4 the server refused it, 5 unknown (an answer this client cannot read, or a request that may have landed: run `status`), 6 not enabled on this server.';
8
+ static examples = [
9
+ '<%= config.bin %> apps installations migrate abort appi_abc',
10
+ '<%= config.bin %> apps installations migrate abort appi_abc --migration mig_xyz --json',
11
+ ];
12
+ static args = {
13
+ installation: core_1.Args.string({
14
+ description: 'The installation id (appi_...)',
15
+ required: true,
16
+ ignoreStdin: true,
17
+ }),
18
+ };
19
+ static flags = {
20
+ migration: core_1.Flags.string({
21
+ description: 'Abort this migration (the id `status` shows); it may already be aborted. Without it, the open one',
22
+ }),
23
+ json: core_1.Flags.boolean({ description: 'Output the migration as JSON' }),
24
+ };
25
+ async run() {
26
+ this.requireAuth();
27
+ const { args, flags } = await this.parse(AppsInstallationsMigrateAbort);
28
+ let view;
29
+ try {
30
+ view = (0, appDataMigration_1.readMigration)(await appDataMigration_1.migrationCalls.abort(args.installation, flags.migration === undefined ? {} : { migrationId: flags.migration }), {
31
+ installationId: args.installation,
32
+ ...(flags.migration === undefined ? {} : { migrationId: flags.migration }),
33
+ });
34
+ }
35
+ catch (error) {
36
+ return this.failMigration(error, { step: 'abort', installation: args.installation }, true);
37
+ }
38
+ if (view === null)
39
+ return this.failUnreadable('abort', args.installation);
40
+ if (view.state !== 'aborted')
41
+ return this.failUnexpectedState('abort', view, 'aborted');
42
+ await this.report(view, { json: flags.json, exit: appDataMigration_1.APPS_MIGRATION_EXIT.ok });
43
+ }
44
+ }
45
+ exports.default = AppsInstallationsMigrateAbort;
@@ -0,0 +1,15 @@
1
+ import { AppsMigrationCommand } from '../../../../lib/appDataMigrationCommand';
2
+ export default class AppsInstallationsMigrateCutover extends AppsMigrationCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ installation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ migration: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ once: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<void>;
15
+ }