@skrr-ai/cli 0.1.164 → 0.1.166

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 (111) hide show
  1. package/README.md +13 -0
  2. package/dist/base-command.d.ts +14 -1
  3. package/dist/base-command.js +166 -46
  4. package/dist/commands/agent/message/send.d.ts +1 -0
  5. package/dist/commands/agent/message/send.js +3 -0
  6. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  7. package/dist/commands/agents/mini-computer/tasks-view.js +1 -1
  8. package/dist/commands/apps/check.js +3 -8
  9. package/dist/commands/apps/data/batch.d.ts +1 -0
  10. package/dist/commands/apps/data/batch.js +19 -2
  11. package/dist/commands/apps/data/delete.d.ts +1 -0
  12. package/dist/commands/apps/data/delete.js +14 -2
  13. package/dist/commands/apps/data/patch.d.ts +1 -0
  14. package/dist/commands/apps/data/patch.js +11 -2
  15. package/dist/commands/apps/data/put.d.ts +1 -0
  16. package/dist/commands/apps/data/put.js +17 -3
  17. package/dist/commands/apps/install.js +7 -2
  18. package/dist/commands/apps/installations/compatibility.d.ts +13 -0
  19. package/dist/commands/apps/installations/compatibility.js +60 -0
  20. package/dist/commands/apps/installations/migrate/abort.d.ts +13 -0
  21. package/dist/commands/apps/installations/migrate/abort.js +45 -0
  22. package/dist/commands/apps/installations/migrate/cutover.d.ts +15 -0
  23. package/dist/commands/apps/installations/migrate/cutover.js +102 -0
  24. package/dist/commands/apps/installations/migrate/plan.d.ts +13 -0
  25. package/dist/commands/apps/installations/migrate/plan.js +51 -0
  26. package/dist/commands/apps/installations/migrate/rollback.d.ts +16 -0
  27. package/dist/commands/apps/installations/migrate/rollback.js +103 -0
  28. package/dist/commands/apps/installations/migrate/stage.d.ts +15 -0
  29. package/dist/commands/apps/installations/migrate/stage.js +96 -0
  30. package/dist/commands/apps/installations/migrate/status.d.ts +12 -0
  31. package/dist/commands/apps/installations/migrate/status.js +52 -0
  32. package/dist/commands/apps/installations/migrate/validate.d.ts +14 -0
  33. package/dist/commands/apps/installations/migrate/validate.js +58 -0
  34. package/dist/commands/apps/installations/show.js +14 -9
  35. package/dist/commands/apps/installations/snapshot.js +5 -2
  36. package/dist/commands/apps/operations/check.d.ts +16 -0
  37. package/dist/commands/apps/operations/check.js +127 -0
  38. package/dist/commands/apps/publish/propose.js +33 -4
  39. package/dist/commands/apps/reconsent.js +7 -1
  40. package/dist/commands/apps/reference.d.ts +4 -2
  41. package/dist/commands/apps/reference.js +7 -4
  42. package/dist/commands/apps/resume.js +1 -1
  43. package/dist/commands/apps/rollback.d.ts +9 -0
  44. package/dist/commands/apps/rollback.js +81 -2
  45. package/dist/commands/apps/settings/set.js +22 -10
  46. package/dist/commands/apps/upgrade.d.ts +8 -0
  47. package/dist/commands/apps/upgrade.js +67 -2
  48. package/dist/commands/apps/version/cat.d.ts +22 -0
  49. package/dist/commands/apps/version/cat.js +220 -0
  50. package/dist/commands/apps/version/show.js +3 -1
  51. package/dist/commands/commerce/incidents/release.d.ts +24 -0
  52. package/dist/commands/commerce/incidents/release.js +46 -0
  53. package/dist/commands/duties/cases.js +12 -1
  54. package/dist/commands/duties/hypotheses.js +10 -3
  55. package/dist/commands/duties/observations.d.ts +4 -0
  56. package/dist/commands/duties/observations.js +14 -3
  57. package/dist/commands/outbox/list.d.ts +11 -4
  58. package/dist/commands/outbox/list.js +56 -9
  59. package/dist/commands/outbox/retry.d.ts +8 -2
  60. package/dist/commands/outbox/retry.js +76 -16
  61. package/dist/commands/outbox/show.d.ts +20 -0
  62. package/dist/commands/outbox/show.js +83 -0
  63. package/dist/commands/proposals/list.js +13 -9
  64. package/dist/commands/requests/show.d.ts +12 -0
  65. package/dist/commands/requests/show.js +42 -23
  66. package/dist/commands/spaces/deletion/cancel.d.ts +21 -0
  67. package/dist/commands/spaces/deletion/cancel.js +70 -0
  68. package/dist/commands/spaces/workflows/run.js +12 -0
  69. package/dist/commands/widgets/check.d.ts +9 -0
  70. package/dist/commands/widgets/check.js +16 -3
  71. package/dist/generated/agent-guides.json +17 -17
  72. package/dist/lib/api-fetch.d.ts +5 -0
  73. package/dist/lib/api-fetch.js +81 -22
  74. package/dist/lib/appCompatibility.d.ts +31 -0
  75. package/dist/lib/appCompatibility.js +66 -0
  76. package/dist/lib/appData.d.ts +46 -4
  77. package/dist/lib/appData.js +161 -32
  78. package/dist/lib/appDataMigration.d.ts +204 -0
  79. package/dist/lib/appDataMigration.js +753 -0
  80. package/dist/lib/appDataMigrationCommand.d.ts +39 -0
  81. package/dist/lib/appDataMigrationCommand.js +90 -0
  82. package/dist/lib/appInstallations.d.ts +40 -5
  83. package/dist/lib/appInstallations.js +251 -35
  84. package/dist/lib/appVersionFile.d.ts +82 -0
  85. package/dist/lib/appVersionFile.js +195 -0
  86. package/dist/lib/apps-command.d.ts +14 -3
  87. package/dist/lib/apps-command.js +80 -65
  88. package/dist/lib/appsCheck.js +16 -2
  89. package/dist/lib/commerce.d.ts +6 -0
  90. package/dist/lib/commerce.js +9 -0
  91. package/dist/lib/duties.d.ts +15 -1
  92. package/dist/lib/duties.js +21 -3
  93. package/dist/lib/json-output.d.ts +2 -0
  94. package/dist/lib/json-output.js +8 -4
  95. package/dist/lib/node-adapter.js +69 -38
  96. package/dist/lib/outbox.d.ts +110 -1
  97. package/dist/lib/outbox.js +261 -35
  98. package/dist/lib/rate-limit-retry.d.ts +4 -5
  99. package/dist/lib/rate-limit-retry.js +6 -10
  100. package/dist/lib/refresh.d.ts +2 -0
  101. package/dist/lib/refresh.js +6 -0
  102. package/dist/lib/space-deletion-cancel.d.ts +47 -0
  103. package/dist/lib/space-deletion-cancel.js +141 -0
  104. package/dist/lib/widgetCheck.js +1 -1
  105. package/dist/lib/widgetStaticScan.d.ts +11 -5
  106. package/dist/lib/widgetStaticScan.js +73 -165
  107. package/dist/lib/write-outcome.d.ts +76 -0
  108. package/dist/lib/write-outcome.js +190 -0
  109. package/dist/node_modules/@skrr-ai/data-provider/index.js +11955 -11231
  110. package/oclif.manifest.json +3019 -499
  111. package/package.json +12 -3
@@ -0,0 +1,96 @@
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 AppsInstallationsMigrateStage extends appDataMigrationCommand_1.AppsMigrationCommand {
7
+ static description = 'Freeze the installation and convert its stored documents, with the steps the target version declares, into a STAGING area, a bounded batch at a time, repeating the call while it is `frozen` or `staging` and each call moves it on (one progress line per call; --once makes one call). STAGING FREEZES THE APP: while a migration is open the app does not run and nothing can write its data, until `abort` puts it back. So the first call on a planned migration needs --yes; without it nothing is frozen and the command only says what will happen, with the three sentences every migration view carries, and exits 4. Nothing live changes: no stored document, no version, no old row is touched. It stops at `staged`, at `failed` (a finding stopped it: they are printed) or when a call moves nothing. 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 staged (or, with --once, one call answered), 1 the migration failed or a finding stopped it, 4 the server refused it (or --yes is missing), 5 unknown (an answer this client cannot read, no progress, the call cap, or a request that may have landed: run `status`), 6 not enabled on this server.';
8
+ static examples = [
9
+ '<%= config.bin %> apps installations migrate stage appi_abc --yes',
10
+ '<%= config.bin %> apps installations migrate stage appi_abc --yes --once',
11
+ '<%= config.bin %> apps installations migrate stage appi_abc --migration mig_xyz --yes --json',
12
+ ];
13
+ static args = {
14
+ installation: core_1.Args.string({
15
+ description: 'The installation id (appi_...)',
16
+ required: true,
17
+ ignoreStdin: true,
18
+ }),
19
+ };
20
+ static flags = {
21
+ migration: core_1.Flags.string({
22
+ description: 'Only act on this migration (the id `status` shows); refused if another one is open',
23
+ }),
24
+ yes: core_1.Flags.boolean({
25
+ description: 'Confirm that staging may FREEZE the app (it stops running and nothing can write its data until the migration is aborted). Needed for the first call on a planned migration',
26
+ default: false,
27
+ }),
28
+ once: core_1.Flags.boolean({
29
+ description: 'Make one call and stop, instead of repeating while it makes progress',
30
+ default: false,
31
+ }),
32
+ json: core_1.Flags.boolean({ description: 'Output the migration as JSON' }),
33
+ };
34
+ async run() {
35
+ this.requireAuth();
36
+ const { args, flags } = await this.parse(AppsInstallationsMigrateStage);
37
+ const installation = args.installation;
38
+ const ctx = { step: 'stage', installation };
39
+ const bin = this.config.bin;
40
+ // Staging freezes the app, which is the person's to confirm. Without --yes, READ where the migration stands (a read changes nothing): a
41
+ // planned one is the one thing that would freeze, so that is said and not sent; one already frozen or staging carries on.
42
+ if (!flags.yes) {
43
+ let state;
44
+ try {
45
+ state = (0, appDataMigration_1.readMigrationState)(await appDataMigration_1.migrationCalls.status(installation), installation);
46
+ }
47
+ catch (error) {
48
+ return this.failMigration(error, { step: 'status', installation }, false);
49
+ }
50
+ if (state === null)
51
+ return this.failUnreadable('status', installation);
52
+ const open = state.migration;
53
+ if (open === null) {
54
+ return this.failWithCliError((0, appDataMigration_1.describeLocalRefusal)('no_active_migration', { ...ctx, bin }));
55
+ }
56
+ if (flags.migration !== undefined && flags.migration !== open.id) {
57
+ return this.failWithCliError((0, appDataMigration_1.describeNamedMigrationNotOpen)({ ...ctx, bin }));
58
+ }
59
+ if (open.state === 'planned') {
60
+ return this.failWithCliError({
61
+ message: (0, appDataMigration_1.describeFreezeGate)(open, bin),
62
+ code: appDataMigration_1.APPS_MIGRATION_CODES.freezeNotConfirmed,
63
+ exit: appDataMigration_1.APPS_MIGRATION_EXIT.refused,
64
+ retryable: false,
65
+ details: { reason: 'freeze_not_confirmed', disclaimers: open.disclaimers },
66
+ });
67
+ }
68
+ }
69
+ let result;
70
+ try {
71
+ result = await (0, appDataMigration_1.runUntilSettled)({
72
+ step: 'stage',
73
+ installationId: installation,
74
+ ...(flags.migration === undefined ? {} : { migrationId: flags.migration }),
75
+ once: flags.once,
76
+ call: (pinned) => appDataMigration_1.migrationCalls.stage(installation, {
77
+ ...(pinned === undefined ? {} : { migrationId: pinned }),
78
+ ...(flags.yes ? { confirmFreeze: true } : {}),
79
+ }),
80
+ onProgress: (line) => (flags.json ? this.logToStderr(line) : this.log(line)),
81
+ });
82
+ }
83
+ catch (error) {
84
+ if (error instanceof appDataMigration_1.MigrationLoopError)
85
+ return this.failLoop(error, ctx);
86
+ throw error;
87
+ }
88
+ await this.report(result.view, {
89
+ json: flags.json,
90
+ exit: (0, appDataMigration_1.loopExit)(result),
91
+ jsonValue: { ...result.view, calls: result.calls, stopped: result.stopped },
92
+ notes: [(0, appDataMigration_1.loopStopNote)('stage', result, bin)],
93
+ });
94
+ }
95
+ }
96
+ exports.default = AppsInstallationsMigrateStage;
@@ -0,0 +1,12 @@
1
+ import { AppsMigrationCommand } from '../../../../lib/appDataMigrationCommand';
2
+ export default class AppsInstallationsMigrateStatus 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
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,52 @@
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 AppsInstallationsMigrateStatus extends appDataMigrationCommand_1.AppsMigrationCommand {
7
+ static description = 'Show an installation’s open data migration, or say there is none: its state in words, the plan’s counts, the freeze, how many documents are staged and checked, the cutover’s or the rollback’s progress, and the bounded findings (a collection, a document id, a code and where, never a value), with the three sentences every migration view carries (before the cutover: the app is frozen, nothing live has changed, and a validated staging is a snapshot, not a guarantee; after it: what changed and what is kept). When none is open but a cutover COMPLETED inside its archive window, that migration is shown with the day its archive of the old documents is erased, so you can still roll back. It reads and writes nothing. No migration open is a normal answer (exit 0). 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 a migration that is not failed, or none; 1 the migration is failed (abort it); 4 the server refused it; 5 unknown (an answer this client cannot read: that is NOT "there is none"); 6 not enabled on this server.';
8
+ static examples = [
9
+ '<%= config.bin %> apps installations migrate status appi_abc',
10
+ '<%= config.bin %> apps installations migrate status appi_abc --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
+ json: core_1.Flags.boolean({ description: 'Output the migration state as JSON' }),
21
+ };
22
+ async run() {
23
+ this.requireAuth();
24
+ const { args, flags } = await this.parse(AppsInstallationsMigrateStatus);
25
+ let state;
26
+ try {
27
+ state = (0, appDataMigration_1.readMigrationState)(await appDataMigration_1.migrationCalls.status(args.installation), args.installation);
28
+ }
29
+ catch (error) {
30
+ return this.failMigration(error, { step: 'status', installation: args.installation }, false);
31
+ }
32
+ if (state === null)
33
+ return this.failUnreadable('status', args.installation);
34
+ const view = state.migration;
35
+ if (view === null) {
36
+ if (flags.json) {
37
+ this.printJsonResult({ object: 'app_data_migration_state', migration: null });
38
+ }
39
+ else {
40
+ for (const line of (0, appDataMigration_1.formatNoMigration)(args.installation, this.config.bin))
41
+ this.log(line);
42
+ }
43
+ return;
44
+ }
45
+ await this.report(view, {
46
+ json: flags.json,
47
+ exit: view.state === 'failed' ? appDataMigration_1.APPS_MIGRATION_EXIT.failed : appDataMigration_1.APPS_MIGRATION_EXIT.ok,
48
+ jsonValue: { object: 'app_data_migration_state', migration: view },
49
+ });
50
+ }
51
+ }
52
+ exports.default = AppsInstallationsMigrateStatus;
@@ -0,0 +1,14 @@
1
+ import { AppsMigrationCommand } from '../../../../lib/appDataMigrationCommand';
2
+ export default class AppsInstallationsMigrateValidate 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
+ once: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,58 @@
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 AppsInstallationsMigrateValidate extends appDataMigrationCommand_1.AppsMigrationCommand {
7
+ static description = 'Hold every staged document to the data schemas the target version declares, a bounded slice at a time, repeating the call while the migration is `staged` and validation is not finished (one progress line per call; --once makes one call). `validated` means every converted document fits those schemas as of the time shown: a snapshot, not a guarantee, and not a promise that the app will work with them. A document that does not fit stops it as `failed` and is printed as a finding; something it could not judge (a schema it could not read or enforce, a document too complex for its budget) leaves it `staged` and is NOT a pass. It changes no live document and no version; the app stays frozen until you `abort`. 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 validated (or, with --once, one call answered), 1 the migration failed or a finding stopped it, 4 the server refused it, 5 unknown (an answer this client cannot read, no progress, the call cap, a validation that could not judge, or a request that may have landed: run `status`), 6 not enabled on this server.';
8
+ static examples = [
9
+ '<%= config.bin %> apps installations migrate validate appi_abc',
10
+ '<%= config.bin %> apps installations migrate validate appi_abc --once --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: 'Only act on this migration (the id `status` shows); refused if another one is open',
22
+ }),
23
+ once: core_1.Flags.boolean({
24
+ description: 'Make one call and stop, instead of repeating while it makes progress',
25
+ default: false,
26
+ }),
27
+ json: core_1.Flags.boolean({ description: 'Output the migration as JSON' }),
28
+ };
29
+ async run() {
30
+ this.requireAuth();
31
+ const { args, flags } = await this.parse(AppsInstallationsMigrateValidate);
32
+ const installation = args.installation;
33
+ const ctx = { step: 'validate', installation };
34
+ let result;
35
+ try {
36
+ result = await (0, appDataMigration_1.runUntilSettled)({
37
+ step: 'validate',
38
+ installationId: installation,
39
+ ...(flags.migration === undefined ? {} : { migrationId: flags.migration }),
40
+ once: flags.once,
41
+ call: (pinned) => appDataMigration_1.migrationCalls.validate(installation, pinned === undefined ? {} : { migrationId: pinned }),
42
+ onProgress: (line) => (flags.json ? this.logToStderr(line) : this.log(line)),
43
+ });
44
+ }
45
+ catch (error) {
46
+ if (error instanceof appDataMigration_1.MigrationLoopError)
47
+ return this.failLoop(error, ctx);
48
+ throw error;
49
+ }
50
+ await this.report(result.view, {
51
+ json: flags.json,
52
+ exit: (0, appDataMigration_1.loopExit)(result),
53
+ jsonValue: { ...result.view, calls: result.calls, stopped: result.stopped },
54
+ notes: [(0, appDataMigration_1.loopStopNote)('validate', result, this.config.bin)],
55
+ });
56
+ }
57
+ }
58
+ exports.default = AppsInstallationsMigrateValidate;
@@ -35,29 +35,34 @@ class AppsInstallationsShow extends apps_command_1.AppsCommand {
35
35
  this.log(`${installation.id} ${app.slug} v${version.version}`);
36
36
  this.log(`on ${installation.principal.kind} ${installation.principal.id}; ${(0, appInstallations_1.describeAvailability)(installation.availability)}`);
37
37
  if (installation.availability === 'suspended') {
38
- if (/^appi_[A-Za-z0-9_-]{1,60}(?![\s\S])/.test(installation.id)) {
39
- this.log(`If you can manage this installation, you can try \`${this.config.bin} apps resume ${installation.id}\` using the same account, deployment, profile and workspace as this command. Resuming may enable its jobs.`);
38
+ // who suspended it, when the server says (the installation read does not today; the host view does): a moderation and a data
39
+ // migration are told apart, and one that is not known gets the words that are true of both
40
+ const source = installation.suspension?.by;
41
+ for (const line of (0, appInstallations_1.describeSuspensionNote)(installation.id, source, this.config.bin)) {
42
+ this.log(line);
40
43
  }
41
- else {
42
- this.log('If you can manage this installation, find its valid installation ID before trying to resume it. Resuming may enable its jobs.');
43
- }
44
- this.log('Otherwise ask someone who can manage it. A moderation suspension must be lifted by the platform.');
45
44
  }
46
45
  this.log(`trust: ${(0, appInstallations_1.describeTrust)(installation.trust)}`);
47
46
  const distribution = version.distribution;
48
47
  const details = distribution && typeof distribution === 'object' && !Array.isArray(distribution)
49
- ? distribution : {};
48
+ ? distribution
49
+ : {};
50
50
  const stateName = (value, known) => typeof value === 'string' && known.includes(value) ? value.replace(/_/g, ' ') : 'unknown';
51
51
  const visibility = stateName(details.visibility, ['private', 'workspace', 'public', 'beta']);
52
52
  const status = stateName(details.status, [
53
- 'draft', 'pending_review', 'approved', 'rejected', 'delisted', 'superseded',
53
+ 'draft',
54
+ 'pending_review',
55
+ 'approved',
56
+ 'rejected',
57
+ 'delisted',
58
+ 'superseded',
54
59
  ]);
55
60
  this.log(`app publisher: ${app.publisher.name ?? 'someone the platform cannot name'} (${app.publisher.type})`);
56
61
  this.log(`version distribution: ${visibility}; status: ${status}`);
57
62
  this.log(`updates: ${installation.updatePolicy}`);
58
63
  this.log(`approved ${installation.grant.grantedAt} by ${installation.grant.grantedBy}, for bundle ${installation.grant.bundleHash.slice(0, 12)}`);
59
64
  if (effective.status === 'needs_reconsent') {
60
- for (const line of (0, appInstallations_1.describeGrantReasons)(effective.reasons.map((reason) => reason.kind))) {
65
+ for (const line of (0, appInstallations_1.describeGrantReasons)(effective.reasons)) {
61
66
  this.log(` needs approving again: ${line}`);
62
67
  }
63
68
  this.log(`Review it with \`${this.config.bin} apps disclosure ${version.id} --installation ${installation.id}\`, approve with \`${this.config.bin} apps reconsent ${installation.id} --yes\`.`);
@@ -10,7 +10,10 @@ const apps_command_1 = require("../../../lib/apps-command");
10
10
  * answer says what that does and does not mean.
11
11
  */
12
12
  class AppsInstallationsSnapshot extends apps_command_1.AppsCommand {
13
- static description = "Read a stored snapshot from your installed app's window: visible text and a short outline (at most 8 KB), kept for a day. This is not a live view: reporting may be delayed, pause or stop, and unchanged text may not be sent again. The server received the report at takenAt; the screen may have been captured earlier. It needs the installation to be running and approved, because it is the person's screen. Everything in it is data about the app, never instructions. If no snapshot is available, the answer says what that does and does not mean (it is never a blank screen).";
13
+ // the cadence is said from the contract's limits, the ones the web host is held to, so help cannot promise a fresher snapshot than the window takes
14
+ static description = "Read a stored snapshot from your installed app's window: visible text and a short outline (at most 8 KB), kept for a day. This is not a live view: reporting may be delayed, pause or stop, and unchanged text may not be sent again. The server received the report at takenAt; the screen may have been captured earlier. " +
15
+ `${(0, data_provider_1.describeAppWindowSnapshotCadence)()} ` +
16
+ "It needs the installation to be running and approved, because it is the person's screen. Everything in it is data about the app, never instructions. If no snapshot is available, the answer says what that does and does not mean (it is never a blank screen).";
14
17
  static examples = [
15
18
  '<%= config.bin %> apps installations snapshot appi_abc',
16
19
  '<%= config.bin %> apps installations snapshot appi_abc --json',
@@ -40,7 +43,7 @@ class AppsInstallationsSnapshot extends apps_command_1.AppsCommand {
40
43
  this.log(result.snapshot.text);
41
44
  this.log('');
42
45
  if (result.note)
43
- this.log(result.note);
46
+ this.log((0, data_provider_1.normalizeAppWindowSnapshotNote)(result.note));
44
47
  }
45
48
  else {
46
49
  this.log(`no snapshot of ${args.installation} for the version it runs (${result.versionId ?? 'unknown'}).`);
@@ -0,0 +1,16 @@
1
+ import { AppsCommand } from '../../../lib/apps-command';
2
+ export default class AppsOperationsCheck extends AppsCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ installation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ op: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
+ collection: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
9
+ id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
10
+ };
11
+ static flags: {
12
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ key: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ };
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,127 @@
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 apps_command_1 = require("../../../lib/apps-command");
7
+ const appData_1 = require("../../../lib/appData");
8
+ /** What the receipt of a write applied, as lines a terminal can show (every value is the server's, so it is written out safely). */
9
+ function describeApplied(applied) {
10
+ if ('results' in applied) {
11
+ return applied.results.map((step) => `${step.op} ${(0, appData_1.safeForTerminal)(step.collection)}/${(0, appData_1.safeForTerminal)(step.id)} (rev ${step.rev}${step.created ? ', created' : ''}${step.deleted ? ', deleted' : ''})`);
12
+ }
13
+ if ('deleted' in applied) {
14
+ return [
15
+ `deleted ${(0, appData_1.safeForTerminal)(applied.collection)}/${(0, appData_1.safeForTerminal)(applied.id)} (it was at rev ${applied.rev})`,
16
+ ];
17
+ }
18
+ if ('collection' in applied) {
19
+ return [
20
+ `wrote ${(0, appData_1.safeForTerminal)(applied.collection)}/${(0, appData_1.safeForTerminal)(applied.id)} (rev ${applied.rev}, ${applied.created ? 'created' : 'replaced'}) at ${(0, appData_1.safeForTerminal)(applied.updatedAt)}`,
21
+ ];
22
+ }
23
+ return [`settings of version ${(0, appData_1.safeForTerminal)(applied.versionId)}`];
24
+ }
25
+ class AppsOperationsCheck extends apps_command_1.AppsCommand {
26
+ static description = 'Ask the server what became of a write to an installed app\'s data that you sent with an idempotency key and lost the answer to. The server answers "completed" (with what it applied: the collection, the document ids and revisions, for a batch every step, including the IDs it named) when it kept a receipt of that write for YOU, or "unknown" when it did not. "unknown" is NEVER "not applied": it only means no receipt is on record (the write may never have arrived, may have been refused, may still be running, may have run where no receipt is kept, or the receipt may have expired after 24 hours). It writes nothing. The key is sent in a header and never appears in a URL. `apps data put | patch | delete | batch` print the key when the outcome of a write is unknown; a write you sent yourself with --idempotency-key is asked about the same way. Only the user who made the write, with the kind of credential that made it (a person\'s sign-in, or an Agent\'s), can find its receipt.';
27
+ static examples = [
28
+ '<%= config.bin %> apps operations check appi_abc put goals main --key skrr-data:3f2b8c1e-7d44-4b1a-9a52-0c6e1d2f9a10',
29
+ '<%= config.bin %> apps operations check appi_abc batch --key my-nightly-import-2026-11-10 --json',
30
+ ];
31
+ static args = {
32
+ installation: core_1.Args.string({
33
+ description: 'The installation id (appi_...)',
34
+ required: true,
35
+ ignoreStdin: true,
36
+ }),
37
+ op: core_1.Args.string({
38
+ description: 'Which write it was',
39
+ required: true,
40
+ options: ['put', 'patch', 'delete', 'batch'],
41
+ ignoreStdin: true,
42
+ }),
43
+ collection: core_1.Args.string({
44
+ description: 'The collection the write named (put, patch and delete; not batch)',
45
+ required: false,
46
+ ignoreStdin: true,
47
+ }),
48
+ id: core_1.Args.string({
49
+ description: 'The document id the write named (put, patch and delete; not batch)',
50
+ required: false,
51
+ ignoreStdin: true,
52
+ }),
53
+ };
54
+ static flags = {
55
+ json: core_1.Flags.boolean({ description: 'Output the answer as JSON' }),
56
+ key: core_1.Flags.string({
57
+ description: 'The idempotency key the write was sent with',
58
+ required: true,
59
+ }),
60
+ };
61
+ async run() {
62
+ this.requireAuth();
63
+ const { args, flags } = await this.parse(AppsOperationsCheck);
64
+ try {
65
+ const key = (0, appData_1.checkIdempotencyKey)(flags.key);
66
+ const named = {
67
+ op: args.op,
68
+ ...(args.collection === undefined ? {} : { collection: args.collection }),
69
+ ...(args.id === undefined ? {} : { id: args.id }),
70
+ };
71
+ const target = (0, data_provider_1.parseAppOperationTarget)(named);
72
+ if (!target || target.op === 'settings') {
73
+ throw new appData_1.AppDataInputError('APP_DATA_SOURCE', args.op === 'batch'
74
+ ? 'A batch names no collection or document id.'
75
+ : 'put, patch and delete name the collection and the document id: `apps operations check <installation> put <collection> <id> --key <key>`.');
76
+ }
77
+ const raw = await data_provider_1.dataService.getAppInstallationOperationByKey(args.installation, target, key);
78
+ const read = (0, data_provider_1.parseAppOperationRead)(raw);
79
+ // An answer that is not an operation read, or is about another installation, tells this client nothing: say so, claim nothing.
80
+ if (read === null || read.installationId !== args.installation) {
81
+ return this.failWithCliError({
82
+ message: 'The server answered, but not with an operation this client understands. Nothing is known about the write; read the affected data before deciding what to do.',
83
+ code: 'APP_OPERATION_UNREADABLE',
84
+ exit: 1,
85
+ retryable: false,
86
+ });
87
+ }
88
+ if (read.state === 'unknown') {
89
+ return this.failWithCliError({
90
+ message: 'No receipt is on record for this write for you. That is NOT the same as "not applied": the write may never have arrived, may have been refused, may still be running, may have run on a server that keeps no receipts, or its receipt may have expired (they are kept for 24 hours). Read the affected data and revisions before deciding what to do.',
91
+ code: 'APP_OPERATION_UNKNOWN',
92
+ exit: 5,
93
+ retryable: false,
94
+ details: {
95
+ state: 'unknown',
96
+ installationId: read.installationId,
97
+ target: (0, data_provider_1.appOperationTargetQuery)(target),
98
+ },
99
+ });
100
+ }
101
+ if (flags.json) {
102
+ this.printJsonResult(read);
103
+ return;
104
+ }
105
+ this.log(`completed: the server kept a receipt of this write${read.recordedAt ? ` (recorded ${(0, appData_1.safeForTerminal)(read.recordedAt)})` : ''}`);
106
+ for (const line of describeApplied(read.applied))
107
+ this.log(line);
108
+ this.logToStderr(`operation ${read.operationId} (a reference for support)`);
109
+ }
110
+ catch (error) {
111
+ if (error instanceof Error &&
112
+ ((0, base_command_1.isOclifExitError)(error) ||
113
+ typeof error.oclif?.exit === 'number'))
114
+ throw error;
115
+ if (error instanceof appData_1.AppDataInputError) {
116
+ return this.failWithCliError({
117
+ message: error.message,
118
+ code: error.code,
119
+ exit: 2,
120
+ retryable: false,
121
+ });
122
+ }
123
+ return this.failInstallation(error, { subject: args.installation });
124
+ }
125
+ }
126
+ }
127
+ exports.default = AppsOperationsCheck;
@@ -4,7 +4,7 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const apps_command_1 = require("../../../lib/apps-command");
6
6
  class AppsPublishPropose extends apps_command_1.AppsCommand {
7
- static description = "Propose that a version be published. This records a request the app's owner answers; it publishes nothing, and the version stays private until a person with the right to publish acts on it.";
7
+ static description = 'Record a publication request. It does not select a destination workspace, and workspace publication is not available yet; approval cannot publish the app.';
8
8
  static examples = [
9
9
  '<%= config.bin %> apps publish propose appv_... --visibility workspace --reason "ready for the team"',
10
10
  ];
@@ -18,7 +18,7 @@ class AppsPublishPropose extends apps_command_1.AppsCommand {
18
18
  static flags = {
19
19
  json: core_1.Flags.boolean({ description: 'Output the proposal as JSON' }),
20
20
  visibility: core_1.Flags.string({
21
- description: 'Where it would be published (workspace)',
21
+ description: 'Proposal visibility label (workspace); does not select a destination workspace',
22
22
  required: true,
23
23
  }),
24
24
  reason: core_1.Flags.string({ description: 'Why, in a sentence (the owner reads it)' }),
@@ -32,10 +32,39 @@ class AppsPublishPropose extends apps_command_1.AppsCommand {
32
32
  ...(flags.reason === undefined ? {} : { reason: flags.reason }),
33
33
  });
34
34
  if (flags.json) {
35
- this.printJsonResult(result);
35
+ this.printJsonResult({
36
+ ...result,
37
+ publication: result.publication ?? {
38
+ workspace: 'unknown',
39
+ destinationSelection: 'unknown',
40
+ approvalPublishes: null,
41
+ },
42
+ requestScope: result.requestScope ?? { kind: 'unknown' },
43
+ });
36
44
  return;
37
45
  }
38
- this.log(`request ${result.requestId} is waiting for the app's owner (${result.visibility}). Nothing is published until they act on it.`);
46
+ this.log(`request ${result.requestId} was recorded.`);
47
+ if (result.publication?.workspace === 'unavailable' &&
48
+ result.publication.destinationSelection === 'unavailable' &&
49
+ result.publication.approvalPublishes === false) {
50
+ this.log('This proposal does not select a destination workspace; workspace publication is not available yet.');
51
+ }
52
+ else {
53
+ this.log('This server did not report a recognized publication status. This CLI cannot confirm whether a destination was selected or approval publishes the app.');
54
+ }
55
+ const scope = result.requestScope;
56
+ if (scope?.kind === 'workspace') {
57
+ this.log(`Request workspace: ${scope.workspaceId} (this is not a publication destination).`);
58
+ this.log(`Inspect it with \`${this.config.bin} requests show ${result.requestId} --workspace ${scope.workspaceId}\`.`);
59
+ }
60
+ else if (scope?.kind === 'unscoped') {
61
+ this.log('Request scope: unscoped.');
62
+ this.log(`Inspect it in an unscoped session with \`${this.config.bin} requests show ${result.requestId}\`.`);
63
+ }
64
+ else {
65
+ this.log('Request scope: unknown on this server.');
66
+ this.log(`Inspect \`${this.config.bin} requests show ${result.requestId}\` using the request's actual scope.`);
67
+ }
39
68
  }
40
69
  catch (error) {
41
70
  this.failApps(error);
@@ -24,8 +24,14 @@ class AppsReconsent extends apps_command_1.AppsCommand {
24
24
  async run() {
25
25
  this.requireAuth();
26
26
  const { args, flags } = await this.parse(AppsReconsent);
27
+ // what a refusal's words may say about this approval: the installation, and the version it runs when it is read
28
+ const refused = {
29
+ action: 'reconsent',
30
+ subject: args.installation,
31
+ };
27
32
  try {
28
33
  const current = await data_provider_1.dataService.getAppInstallation(args.installation);
34
+ refused.versionId = current.installation.versionId;
29
35
  const shown = await data_provider_1.dataService.getAppGrantDisclosure({
30
36
  versionId: current.installation.versionId,
31
37
  installationId: current.installation.id,
@@ -66,7 +72,7 @@ class AppsReconsent extends apps_command_1.AppsCommand {
66
72
  this.log(`approved ${result.installation.id}: it is ${result.installation.availability} now`);
67
73
  }
68
74
  catch (error) {
69
- this.failInstallation(error);
75
+ this.failInstallation(error, refused);
70
76
  }
71
77
  }
72
78
  }
@@ -1,7 +1,9 @@
1
1
  import { Command } from '@oclif/core';
2
2
  /**
3
- * `skrr apps reference [topic]`: the reference for writing an App, the same text the Apps MCP's `app_reference` tool
4
- * answers, for a harness that has the CLI and no MCP server.
3
+ * `skrr apps reference [topic]`: the reference for writing an App, the one the Apps MCP's `app_reference` tool answers,
4
+ * for a harness that has the CLI and no MCP server. It is the same text said for the CLI (`surface: 'cli'`): where the
5
+ * MCP text names a tool (`app_check`) this one names the command that does the same (`skrr apps check`), because a
6
+ * harness here has no such tool to call.
5
7
  *
6
8
  * It extends `Command`, not `BaseCommand`, for the reason `apps check` does: it prints text built from the contract
7
9
  * (`appReferenceText`, `@skrr-ai/data-provider`), so it needs no sign-in and no network, and it reaches no API. The text
@@ -4,8 +4,10 @@ const core_1 = require("@oclif/core");
4
4
  const data_provider_1 = require("@skrr-ai/data-provider");
5
5
  const json_output_1 = require("../../lib/json-output");
6
6
  /**
7
- * `skrr apps reference [topic]`: the reference for writing an App, the same text the Apps MCP's `app_reference` tool
8
- * answers, for a harness that has the CLI and no MCP server.
7
+ * `skrr apps reference [topic]`: the reference for writing an App, the one the Apps MCP's `app_reference` tool answers,
8
+ * for a harness that has the CLI and no MCP server. It is the same text said for the CLI (`surface: 'cli'`): where the
9
+ * MCP text names a tool (`app_check`) this one names the command that does the same (`skrr apps check`), because a
10
+ * harness here has no such tool to call.
9
11
  *
10
12
  * It extends `Command`, not `BaseCommand`, for the reason `apps check` does: it prints text built from the contract
11
13
  * (`appReferenceText`, `@skrr-ai/data-provider`), so it needs no sign-in and no network, and it reaches no API. The text
@@ -13,10 +15,11 @@ const json_output_1 = require("../../lib/json-output");
13
15
  * harness reads here is what `apps check` will hold its package to.
14
16
  */
15
17
  class AppsReference extends core_1.Command {
16
- static description = "Print the reference for writing an App, generated from the platform contract: app.json keys, the window API (window.skrr.app), scheduled jobs, app data, and the window's page (ES modules, the libraries it may import with their versions, the --skrr-* theme tokens, the first-party UI kit). With no topic you get a one-page index. Needs no sign-in.";
18
+ static description = "Print the reference for writing an App, generated from the platform contract: app.json keys, the window API (window.skrr.app), scheduled jobs, app data, background service declarations, and the window's page (ES modules, the libraries it may import with their versions, the --skrr-* theme tokens, the first-party UI kit). With no topic you get a one-page index. Needs no sign-in.";
17
19
  static examples = [
18
20
  '<%= config.bin %> apps reference',
19
21
  '<%= config.bin %> apps reference frame',
22
+ '<%= config.bin %> apps reference service',
20
23
  '<%= config.bin %> apps reference sdk --json',
21
24
  ];
22
25
  static args = {
@@ -45,7 +48,7 @@ class AppsReference extends core_1.Command {
45
48
  exit: 2,
46
49
  });
47
50
  }
48
- const answer = (0, data_provider_1.appReferenceText)(topic);
51
+ const answer = (0, data_provider_1.appReferenceText)(topic, { surface: 'cli' });
49
52
  if (flags.json) {
50
53
  this.printJson({ topic: answer.topic, text: answer.text });
51
54
  return;
@@ -29,7 +29,7 @@ class AppsResume extends apps_command_1.AppsCommand {
29
29
  this.log(`${result.installation.id} is ${(0, appInstallations_1.describeAvailability)(result.installation.availability)}`);
30
30
  }
31
31
  catch (error) {
32
- this.failInstallation(error);
32
+ this.failInstallation(error, { subject: args.installation });
33
33
  }
34
34
  }
35
35
  }
@@ -7,7 +7,16 @@ export default class AppsRollback extends AppsCommand {
7
7
  };
8
8
  static flags: {
9
9
  'expected-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'expected-target': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'check-data': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
13
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
14
  };
12
15
  run(): Promise<void>;
16
+ /**
17
+ * `--check-data`: find the version a rollback would go to (the one named, else the server's current rollback target), check the data
18
+ * against it, print the result, and decide whether to go on (see `apps upgrade`). Returns the version checked, or `undefined` when
19
+ * there is nothing to go back to (the rollback then says so itself, as it always did).
20
+ */
21
+ private checkDataFirst;
13
22
  }