@skrr-ai/cli 0.1.164 → 0.1.165

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 (88) 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/show.js +9 -3
  21. package/dist/commands/apps/installations/snapshot.js +5 -2
  22. package/dist/commands/apps/operations/check.d.ts +16 -0
  23. package/dist/commands/apps/operations/check.js +127 -0
  24. package/dist/commands/apps/publish/propose.js +33 -4
  25. package/dist/commands/apps/reconsent.js +7 -1
  26. package/dist/commands/apps/reference.d.ts +4 -2
  27. package/dist/commands/apps/reference.js +7 -4
  28. package/dist/commands/apps/rollback.d.ts +9 -0
  29. package/dist/commands/apps/rollback.js +81 -2
  30. package/dist/commands/apps/upgrade.d.ts +8 -0
  31. package/dist/commands/apps/upgrade.js +67 -2
  32. package/dist/commands/apps/version/cat.d.ts +22 -0
  33. package/dist/commands/apps/version/cat.js +220 -0
  34. package/dist/commands/apps/version/show.js +3 -1
  35. package/dist/commands/commerce/incidents/release.d.ts +24 -0
  36. package/dist/commands/commerce/incidents/release.js +46 -0
  37. package/dist/commands/duties/cases.js +12 -1
  38. package/dist/commands/duties/hypotheses.js +10 -3
  39. package/dist/commands/duties/observations.d.ts +4 -0
  40. package/dist/commands/duties/observations.js +14 -3
  41. package/dist/commands/outbox/list.d.ts +11 -4
  42. package/dist/commands/outbox/list.js +56 -9
  43. package/dist/commands/outbox/retry.d.ts +8 -2
  44. package/dist/commands/outbox/retry.js +76 -16
  45. package/dist/commands/outbox/show.d.ts +20 -0
  46. package/dist/commands/outbox/show.js +83 -0
  47. package/dist/commands/proposals/list.js +13 -9
  48. package/dist/commands/requests/show.d.ts +12 -0
  49. package/dist/commands/requests/show.js +42 -23
  50. package/dist/commands/spaces/deletion/cancel.d.ts +21 -0
  51. package/dist/commands/spaces/deletion/cancel.js +70 -0
  52. package/dist/commands/spaces/workflows/run.js +12 -0
  53. package/dist/commands/widgets/check.d.ts +9 -0
  54. package/dist/commands/widgets/check.js +16 -3
  55. package/dist/generated/agent-guides.json +17 -17
  56. package/dist/lib/api-fetch.d.ts +5 -0
  57. package/dist/lib/api-fetch.js +53 -21
  58. package/dist/lib/appCompatibility.d.ts +31 -0
  59. package/dist/lib/appCompatibility.js +66 -0
  60. package/dist/lib/appData.d.ts +46 -4
  61. package/dist/lib/appData.js +156 -31
  62. package/dist/lib/appInstallations.d.ts +32 -5
  63. package/dist/lib/appInstallations.js +197 -34
  64. package/dist/lib/appVersionFile.d.ts +82 -0
  65. package/dist/lib/appVersionFile.js +195 -0
  66. package/dist/lib/apps-command.d.ts +14 -3
  67. package/dist/lib/apps-command.js +68 -60
  68. package/dist/lib/appsCheck.js +16 -2
  69. package/dist/lib/commerce.d.ts +6 -0
  70. package/dist/lib/commerce.js +9 -0
  71. package/dist/lib/duties.d.ts +15 -1
  72. package/dist/lib/duties.js +21 -3
  73. package/dist/lib/json-output.d.ts +2 -0
  74. package/dist/lib/json-output.js +8 -4
  75. package/dist/lib/node-adapter.d.ts +2 -0
  76. package/dist/lib/node-adapter.js +35 -8
  77. package/dist/lib/outbox.d.ts +110 -1
  78. package/dist/lib/outbox.js +261 -35
  79. package/dist/lib/space-deletion-cancel.d.ts +47 -0
  80. package/dist/lib/space-deletion-cancel.js +141 -0
  81. package/dist/lib/widgetCheck.js +1 -1
  82. package/dist/lib/widgetStaticScan.d.ts +11 -5
  83. package/dist/lib/widgetStaticScan.js +73 -165
  84. package/dist/lib/write-outcome.d.ts +74 -0
  85. package/dist/lib/write-outcome.js +176 -0
  86. package/dist/node_modules/@skrr-ai/data-provider/index.js +11839 -11318
  87. package/oclif.manifest.json +1940 -16
  88. package/package.json +9 -3
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.queuedBecause = queuedBecause;
4
+ exports.boundTo = boundTo;
4
5
  exports.outboxListSnapshot = outboxListSnapshot;
5
6
  const list_output_1 = require("../../lib/list-output");
6
7
  const core_1 = require("@oclif/core");
@@ -29,16 +30,35 @@ function queuedBecause(entry) {
29
30
  }
30
31
  return { label: status ? `HTTP ${status}` : 'unknown', kind: 'other' };
31
32
  }
32
- function outboxListSnapshot(profile) {
33
+ /**
34
+ * Where an entry will be replayed, in a cell: the server and the account it was
35
+ * queued as, or the plain statement that it recorded neither (OSK-23807).
36
+ */
37
+ function boundTo(entry) {
38
+ return (0, outbox_1.isOutboxBound)(entry)
39
+ ? `${(0, outbox_1.printableOutboxField)(entry.origin)} as ${(0, outbox_1.printableOutboxField)(entry.account)}`
40
+ : 'not recorded (queued before origin binding)';
41
+ }
42
+ function outboxListSnapshot(profile, current) {
33
43
  const queued = (0, outbox_1.listWrites)(profile);
34
44
  const incident = (0, outbox_1.readIncident)(profile);
45
+ const rows = current
46
+ ? queued.map((entry) => ({ ...entry, replayContext: (0, outbox_1.assessReplayContext)(entry, current) }))
47
+ : queued;
35
48
  return {
36
- queued,
49
+ queued: rows,
37
50
  incident,
38
51
  incidentActive: Boolean(incident && (0, outbox_1.isIncidentActive)(profile)),
39
- originalContext: queued.length > 0 ? 'unverified' : 'not_applicable',
52
+ // `unverified` while any entry cannot say where it was meant to go; the
53
+ // per-entry `replayContext` is the answer for one row.
54
+ originalContext: originalContextOf(queued),
40
55
  };
41
56
  }
57
+ function originalContextOf(queued) {
58
+ if (queued.length === 0)
59
+ return 'not_applicable';
60
+ return queued.every(outbox_1.isOutboxBound) ? 'bound' : 'unverified';
61
+ }
42
62
  /**
43
63
  * `skrr outbox list` — what is queued, and why.
44
64
  *
@@ -59,7 +79,12 @@ class OutboxList extends base_command_1.BaseCommand {
59
79
  async run() {
60
80
  const { flags } = await this.parse(OutboxList);
61
81
  const profile = (0, keychain_1.getActiveProfile)();
62
- const { queued: entries, incident, incidentActive, originalContext } = outboxListSnapshot(profile);
82
+ const current = (0, outbox_1.currentReplayContext)({
83
+ baseURL: this.cliConfig?.baseURL,
84
+ token: this.resolvedCredential?.token,
85
+ profile,
86
+ });
87
+ const { queued: entries, incident, incidentActive, originalContext, } = outboxListSnapshot(profile, current);
63
88
  if (flags.json) {
64
89
  this.printJsonResult((0, list_output_1.listResult)({ queued: entries, incident, incidentActive, originalContext }, 'queued'));
65
90
  return;
@@ -82,7 +107,15 @@ class OutboxList extends base_command_1.BaseCommand {
82
107
  this.log('Nothing is currently queued.');
83
108
  return;
84
109
  }
85
- this.log('These records do not prove their original server, account, and workspace. Automatic replay is paused; inspect the JSON and reconcile the original result and target before taking further action.');
110
+ const unbound = entries.filter((e) => !(0, outbox_1.isOutboxBound)(e));
111
+ const refusedHere = entries.filter((e) => e.replayContext?.state === 'mismatch');
112
+ this.log(`Current context: server ${(0, outbox_1.printableOutboxField)(current.origin ?? 'unknown')}, account ${(0, outbox_1.printableOutboxField)(current.account)}.`);
113
+ if (unbound.length > 0) {
114
+ this.log(`${unbound.length} entry(ies) were queued before the outbox recorded their server and account, so nothing proves where they were meant to go. Replay stays paused for them; inspect the JSON and reconcile the original result and target before taking further action.`);
115
+ }
116
+ if (entries.length > unbound.length) {
117
+ this.log('Entries with a recorded server and account are replayed only to that server as that account; `outbox retry` refuses any other context.');
118
+ }
86
119
  this.log('');
87
120
  (0, format_1.renderTable)(entries.map((e) => ({
88
121
  id: e.id,
@@ -90,6 +123,7 @@ class OutboxList extends base_command_1.BaseCommand {
90
123
  command: e.command,
91
124
  summary: e.summary,
92
125
  why: queuedBecause(e).label,
126
+ boundTo: boundTo(e),
93
127
  // Surface the attempt count only once it matters; a column of "0"s is
94
128
  // noise, but an entry nearing the cap needs a human.
95
129
  attempts: e.attempts > 0 ? `${e.attempts}/${outbox_1.MAX_REPLAY_ATTEMPTS}` : '-',
@@ -99,8 +133,16 @@ class OutboxList extends base_command_1.BaseCommand {
99
133
  { key: 'command', header: 'COMMAND', maxWidth: 24 },
100
134
  { key: 'summary', header: 'SUMMARY', maxWidth: 40 },
101
135
  { key: 'why', header: 'WHY', maxWidth: 24 },
136
+ // Verbatim: a clipped host is a host nobody can compare.
137
+ { key: 'boundTo', header: 'QUEUED FOR', verbatim: true },
102
138
  { key: 'attempts', header: 'TRIES' },
103
139
  ], (line) => this.log(line));
140
+ for (const e of refusedHere) {
141
+ if (e.replayContext?.state !== 'mismatch')
142
+ continue;
143
+ this.log('');
144
+ this.log(`${e.id} would be refused here: ${(0, outbox_1.describeReplayFindings)(e.replayContext.findings)}.`);
145
+ }
104
146
  if (entries.some((e) => e.replay)) {
105
147
  this.log('');
106
148
  this.log('Started entries are not replayed again. Inspect their original target and result before deciding how to handle them.');
@@ -111,13 +153,18 @@ class OutboxList extends base_command_1.BaseCommand {
111
153
  this.log(`${exhausted.length} entry(ies) hit the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap. ` +
112
154
  'Automatic replay is paused; inspect their records and reconcile the original results.');
113
155
  }
114
- const authQueued = entries.filter((e) => queuedBecause(e).kind === 'auth').length;
115
- if (authQueued > 0) {
156
+ const authQueued = entries.filter((e) => queuedBecause(e).kind === 'auth');
157
+ const authUnbound = authQueued.filter((e) => !(0, outbox_1.isOutboxBound)(e)).length;
158
+ if (authUnbound > 0) {
159
+ this.log('');
160
+ this.log(`${authUnbound} entry(ies) were queued after a sign-in refusal. Signing in now does not prove which account originally made the request.`);
161
+ }
162
+ if (authQueued.length > authUnbound) {
116
163
  this.log('');
117
- this.log(`${authQueued} entry(ies) were queued after a sign-in refusal. Signing in now does not prove which account originally made the request.`);
164
+ this.log(`${authQueued.length - authUnbound} entry(ies) were queued after a sign-in refusal. Sign in as the account shown in QUEUED FOR before retrying them.`);
118
165
  }
119
166
  this.log('');
120
- this.log(`Inspect: ${this.config.bin} outbox list --json`);
167
+ this.log(`Inspect: ${this.config.bin} outbox show <id> (or outbox list --json)`);
121
168
  this.log(`Discard: ${this.config.bin} outbox drop <id>`);
122
169
  }
123
170
  }
@@ -1,7 +1,13 @@
1
1
  import { BaseCommand } from '../../base-command';
2
2
  /**
3
- * `skrr outbox retry` — inspect queued writes for safe replay.
4
- * Existing records lack verified original context, so replay is paused.
3
+ * `skrr outbox retry` — replay queued writes to the deployment and account they
4
+ * were queued for, and only there (OSK-23807).
5
+ *
6
+ * An entry records the normalized server origin and the account label it was
7
+ * queued under. Replay is refused, with nothing sent, when either differs from
8
+ * the current context, or when the workspace the request would carry is not the
9
+ * one recorded. Entries queued before origin binding record neither, cannot be
10
+ * verified, and stay paused: `--force` only concerns the attempt cap.
5
11
  *
6
12
  * A queued request can already have reached the server. Its key prevents a
7
13
  * duplicate only when that endpoint actually enforces durable idempotency;
@@ -17,12 +17,19 @@ function replayResultId(entry, value) {
17
17
  return null;
18
18
  const supported = entry.method === 'post' &&
19
19
  ((entry.command === 'spaces create' && entry.url === '/api/spaces') ||
20
- (entry.command === 'tasks comments add' && /^\/api\/tasks\/[^/]+\/comments$/.test(entry.url)));
20
+ (entry.command === 'tasks comments add' &&
21
+ /^\/api\/tasks\/[^/]+\/comments$/.test(entry.url)));
21
22
  return supported ? id : null;
22
23
  }
23
24
  /**
24
- * `skrr outbox retry` — inspect queued writes for safe replay.
25
- * Existing records lack verified original context, so replay is paused.
25
+ * `skrr outbox retry` — replay queued writes to the deployment and account they
26
+ * were queued for, and only there (OSK-23807).
27
+ *
28
+ * An entry records the normalized server origin and the account label it was
29
+ * queued under. Replay is refused, with nothing sent, when either differs from
30
+ * the current context, or when the workspace the request would carry is not the
31
+ * one recorded. Entries queued before origin binding record neither, cannot be
32
+ * verified, and stay paused: `--force` only concerns the attempt cap.
26
33
  *
27
34
  * A queued request can already have reached the server. Its key prevents a
28
35
  * duplicate only when that endpoint actually enforces durable idempotency;
@@ -34,7 +41,7 @@ function replayResultId(entry, value) {
34
41
  * - deferred — no confirmed success. The entry stays for reconciliation.
35
42
  */
36
43
  class OutboxRetry extends base_command_1.BaseCommand {
37
- static description = 'Inspect whether queued writes can be replayed safely';
44
+ static description = 'Replay queued writes to the server and account they were queued for; refuse any other context';
38
45
  static examples = [
39
46
  '<%= config.bin %> outbox retry',
40
47
  '<%= config.bin %> outbox retry <id>',
@@ -50,7 +57,7 @@ class OutboxRetry extends base_command_1.BaseCommand {
50
57
  static flags = {
51
58
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
52
59
  force: core_1.Flags.boolean({
53
- description: `Include entries that hit the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap; does not bypass the replay pause`,
60
+ description: `Include entries that hit the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap; does not bypass the server and account check`,
54
61
  }),
55
62
  };
56
63
  async run() {
@@ -59,9 +66,12 @@ class OutboxRetry extends base_command_1.BaseCommand {
59
66
  const releaseReplay = await (0, outbox_1.lockOutboxReplay)(profile);
60
67
  try {
61
68
  const all = (0, outbox_1.listReplayWrites)(profile);
62
- const review = all.filter((e) => (!args.id || e.id === args.id) && e.replay !== undefined)
69
+ const review = all
70
+ .filter((e) => (!args.id || e.id === args.id) && e.replay !== undefined)
63
71
  .map((e) => ({ id: e.id, state: e.replay.state, resultId: e.replay.resultId }));
64
- const unverified = all.filter((e) => (!args.id || e.id === args.id) && e.replay === undefined);
72
+ // An entry that records no server and account cannot say where it was meant
73
+ // to go. Its absence of a binding is not evidence for the current context.
74
+ const unverified = all.filter((e) => (!args.id || e.id === args.id) && e.replay === undefined && !(0, outbox_1.isOutboxBound)(e));
65
75
  const targets = all.filter((e) => {
66
76
  if (args.id && e.id !== args.id)
67
77
  return false;
@@ -71,17 +81,24 @@ class OutboxRetry extends base_command_1.BaseCommand {
71
81
  return false;
72
82
  return true;
73
83
  });
74
- // Existing entries do not bind an authenticated actor, deployment, and
75
- // workspace to the original request. A current profile or credential is
84
+ // Entries queued before origin binding do not bind an authenticated actor
85
+ // or deployment to the original request. A current profile or credential is
76
86
  // not evidence of that original context. Keep them for manual review;
77
87
  // --force only concerns the attempt cap and must not bypass this guard.
78
88
  if (unverified.length > 0) {
89
+ const bound = all.filter((e) => e.replay === undefined && (0, outbox_1.isOutboxBound)(e));
79
90
  this.failWithCliError({
80
91
  code: 'OUTBOX_CONTEXT_UNVERIFIED',
81
- message: `These queued writes do not prove their original server, account, and workspace. Nothing was sent. Inspect \`${this.config.bin} outbox list --json\`, then reconcile the original result and target before taking any further action. The local records remain.`,
92
+ message: `These queued writes were queued before the outbox recorded their server and account, so nothing proves where they were meant to go. Nothing was sent. Inspect \`${this.config.bin} outbox list --json\`, then reconcile the original result and target before taking any further action. The local records remain.` +
93
+ (!args.id && bound.length > 0
94
+ ? ` Entries that do record their server and account can still be replayed one at a time: \`${this.config.bin} outbox retry <id>\`.`
95
+ : ''),
82
96
  exit: 1,
83
97
  retryable: false,
84
- details: { unverifiedIds: unverified.map((entry) => entry.id), reason: 'original_context_unverified' },
98
+ details: {
99
+ unverifiedIds: unverified.map((entry) => entry.id),
100
+ reason: 'original_context_unverified',
101
+ },
85
102
  });
86
103
  }
87
104
  if (targets.length === 0) {
@@ -102,6 +119,37 @@ class OutboxRetry extends base_command_1.BaseCommand {
102
119
  return;
103
120
  }
104
121
  this.requireAuth();
122
+ // The refusal this command exists to make: a queued write is a promise to
123
+ // one server as one account, and replaying it anywhere else is a different
124
+ // action. Checked for every target before the first claim, so a refusal
125
+ // sends nothing and changes nothing on disk.
126
+ const current = (0, outbox_1.currentReplayContext)({
127
+ baseURL: this.cliConfig.baseURL,
128
+ token: this.resolvedCredential?.token,
129
+ profile,
130
+ });
131
+ const mismatched = [];
132
+ for (const entry of targets) {
133
+ const verdict = (0, outbox_1.assessReplayContext)(entry, current);
134
+ if (verdict.state === 'mismatch')
135
+ mismatched.push({ id: entry.id, findings: verdict.findings });
136
+ }
137
+ if (mismatched.length > 0) {
138
+ const matching = targets.length - mismatched.length;
139
+ this.failWithCliError({
140
+ code: 'OUTBOX_CONTEXT_MISMATCH',
141
+ message: `Refusing to replay: ${mismatched.map((m) => `${m.id} (${(0, outbox_1.describeReplayFindings)(m.findings)})`).join('; ')}. ` +
142
+ 'Nothing was sent; the local records remain. ' +
143
+ `Return to the recorded server, account and workspace (\`${this.config.bin} login --base-url <server>\`, \`${this.config.bin} whoami\`, \`${this.config.bin} workspaces use\`) and retry, ` +
144
+ `or discard the entry with \`${this.config.bin} outbox drop <id>\` and redo it where you intend.` +
145
+ (!args.id && matching > 0
146
+ ? ` ${matching} other entry(ies) match this context and can be replayed one at a time: \`${this.config.bin} outbox retry <id>\`.`
147
+ : ''),
148
+ exit: 2,
149
+ retryable: false,
150
+ details: { mismatches: mismatched, reason: 'replay_context_mismatch' },
151
+ });
152
+ }
105
153
  const sent = [];
106
154
  const refused = [];
107
155
  const deferred = [];
@@ -113,11 +161,17 @@ class OutboxRetry extends base_command_1.BaseCommand {
113
161
  claim = (0, outbox_1.claimOutboxReplay)(entry.id, profile);
114
162
  }
115
163
  catch {
116
- deferred.push({ id: entry.id, error: 'Could not persist replay state. No further entries were sent; inspect the queue and reconcile previous results.' });
164
+ deferred.push({
165
+ id: entry.id,
166
+ error: 'Could not persist replay state. No further entries were sent; inspect the queue and reconcile previous results.',
167
+ });
117
168
  break;
118
169
  }
119
170
  if (!claim) {
120
- deferred.push({ id: entry.id, error: 'The entry changed before it could be claimed; inspect it before retrying.' });
171
+ deferred.push({
172
+ id: entry.id,
173
+ error: 'The entry changed before it could be claimed; inspect it before retrying.',
174
+ });
121
175
  break;
122
176
  }
123
177
  try {
@@ -133,7 +187,9 @@ class OutboxRetry extends base_command_1.BaseCommand {
133
187
  try {
134
188
  (0, outbox_1.recordRecovery)({ baseURL: this.cliConfig.baseURL }, profile);
135
189
  }
136
- catch { /* best effort */ }
190
+ catch {
191
+ /* best effort */
192
+ }
137
193
  }
138
194
  catch (err) {
139
195
  const e = err;
@@ -146,7 +202,9 @@ class OutboxRetry extends base_command_1.BaseCommand {
146
202
  }
147
203
  if (flags.json) {
148
204
  this.log(JSON.stringify({ sent, refused, deferred, review }, null, 2));
149
- if (deferred.length > 0 || refused.length > 0 || review.some((item) => item.state === 'sending'))
205
+ if (deferred.length > 0 ||
206
+ refused.length > 0 ||
207
+ review.some((item) => item.state === 'sending'))
150
208
  this.exit(5);
151
209
  return;
152
210
  }
@@ -166,7 +224,9 @@ class OutboxRetry extends base_command_1.BaseCommand {
166
224
  if (review.length > 0) {
167
225
  this.log(`${review.length} previously started or recorded entry(ies) were not sent again. Inspect them with \`${this.config.bin} outbox list --json\`.`);
168
226
  }
169
- if (deferred.length > 0 || refused.length > 0 || review.some((item) => item.state === 'sending'))
227
+ if (deferred.length > 0 ||
228
+ refused.length > 0 ||
229
+ review.some((item) => item.state === 'sending'))
170
230
  this.exit(5);
171
231
  }
172
232
  finally {
@@ -0,0 +1,20 @@
1
+ import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * `skrr outbox show <id>` — one queued write, with where it will be replayed.
4
+ *
5
+ * `list` is the overview; this is the record a person reads before deciding
6
+ * whether to replay or drop (OSK-23807). It prints the server and account the
7
+ * write was queued under, the workspace, and what `outbox retry` would decide
8
+ * about it from the current context. Nothing is sent.
9
+ */
10
+ export default class OutboxShow extends BaseCommand {
11
+ static description: string;
12
+ static examples: string[];
13
+ static args: {
14
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
15
+ };
16
+ static flags: {
17
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ };
19
+ run(): Promise<void>;
20
+ }
@@ -0,0 +1,83 @@
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 json_output_1 = require("../../lib/json-output");
6
+ const keychain_1 = require("../../lib/keychain");
7
+ const outbox_1 = require("../../lib/outbox");
8
+ const list_1 = require("./list");
9
+ /**
10
+ * `skrr outbox show <id>` — one queued write, with where it will be replayed.
11
+ *
12
+ * `list` is the overview; this is the record a person reads before deciding
13
+ * whether to replay or drop (OSK-23807). It prints the server and account the
14
+ * write was queued under, the workspace, and what `outbox retry` would decide
15
+ * about it from the current context. Nothing is sent.
16
+ */
17
+ class OutboxShow extends base_command_1.BaseCommand {
18
+ static description = 'Show one queued write: its server, account and workspace, and whether it could be replayed from here';
19
+ static examples = [
20
+ '<%= config.bin %> outbox show <id>',
21
+ '<%= config.bin %> outbox show <id> --json',
22
+ ];
23
+ static args = {
24
+ id: core_1.Args.string({ ignoreStdin: true, description: 'Queued write id', required: true }),
25
+ };
26
+ static flags = {
27
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
28
+ };
29
+ async run() {
30
+ const { args, flags } = await this.parse(OutboxShow);
31
+ const profile = (0, keychain_1.getActiveProfile)();
32
+ const entry = (0, outbox_1.listWrites)(profile).find((e) => e.id === args.id);
33
+ if (!entry) {
34
+ this.failWithCliError({
35
+ message: `No queued write with id ${args.id}. List them with \`${this.config.bin} outbox list\`.`,
36
+ code: 'NOT_FOUND',
37
+ exit: 4,
38
+ retryable: false,
39
+ });
40
+ }
41
+ const current = (0, outbox_1.currentReplayContext)({
42
+ baseURL: this.cliConfig?.baseURL,
43
+ token: this.resolvedCredential?.token,
44
+ profile,
45
+ });
46
+ const verdict = (0, outbox_1.assessReplayContext)(entry, current);
47
+ if (flags.json) {
48
+ this.printJsonResult({ entry, current, replayContext: verdict });
49
+ return;
50
+ }
51
+ const bound = (0, outbox_1.isOutboxBound)(entry);
52
+ const field = (value) => value === undefined ? '' : (0, outbox_1.printableOutboxField)(value);
53
+ this.log(`ID: ${field(entry.id)}`);
54
+ this.log(`Command: ${field(entry.command)}`);
55
+ this.log(`Summary: ${field(entry.summary)}`);
56
+ this.log(`Queued: ${field(entry.queuedAt)}`);
57
+ this.log(`Why: ${(0, list_1.queuedBecause)(entry).label}`);
58
+ this.log(`Request: ${entry.method.toUpperCase()} ${field(entry.url)}`);
59
+ this.log(`Server: ${bound ? field(entry.origin) : 'not recorded (queued before origin binding)'}`);
60
+ this.log(`Account: ${bound ? field(entry.account) : 'not recorded (queued before origin binding)'}`);
61
+ this.log(`Workspace: ${entry.workspaceId ? field(entry.workspaceId) : 'none recorded'}`);
62
+ this.log(`Attempts: ${entry.attempts}/${outbox_1.MAX_REPLAY_ATTEMPTS}${entry.replay ? ` (replay ${entry.replay.state})` : ''}`);
63
+ this.log(`Current: server ${(0, outbox_1.printableOutboxField)(current.origin ?? 'unknown')}, account ${(0, outbox_1.printableOutboxField)(current.account)}`);
64
+ if (verdict.state === 'unverified') {
65
+ this.log('Replay: paused. This entry does not record where it was meant to go, so nothing proves the current context is the original one.');
66
+ }
67
+ else if (verdict.state === 'mismatch') {
68
+ this.log(`Replay: refused from here (${(0, outbox_1.describeReplayFindings)(verdict.findings)}).`);
69
+ }
70
+ else if (entry.replay) {
71
+ this.log('Replay: already started; it is not sent again. Reconcile its result before deciding.');
72
+ }
73
+ else if (entry.attempts >= outbox_1.MAX_REPLAY_ATTEMPTS) {
74
+ this.log(`Replay: matches here, but the ${outbox_1.MAX_REPLAY_ATTEMPTS}-attempt cap is reached; \`${this.config.bin} outbox retry ${entry.id} --force\` includes it.`);
75
+ }
76
+ else {
77
+ this.log('Replay: allowed from here, to the recorded server as the recorded account.');
78
+ }
79
+ this.log('Payload:');
80
+ this.log((0, json_output_1.escapeJsonForTerminal)(JSON.stringify(entry.body, null, 2) ?? 'null'));
81
+ }
82
+ }
83
+ exports.default = OutboxShow;
@@ -40,15 +40,19 @@ function aboutFor(row) {
40
40
  }
41
41
  /** A snoozed proposal reads `proposed` in its disposition; the wake time is what tells them apart. */
42
42
  function noteFor(row) {
43
- if (row.sourceStatus === 'snoozed' && row.snoozedUntil)
44
- return `snoozed until ${row.snoozedUntil}`;
45
- // The inbox files a policy refusal under `discarded`; for a Northstar intent say what it was.
46
- const intent = (0, proposals_1.northstarIntentNote)(row);
47
- if (intent)
48
- return intent;
49
- if (!row.canDecide && row.undecidableReason && row.undecidableReason !== 'settled')
50
- return data_provider_1.PROPOSAL_UNDECIDABLE_TEXT[row.undecidableReason];
51
- return '—';
43
+ let state = '';
44
+ if (row.sourceStatus === 'snoozed' && row.snoozedUntil) {
45
+ state = `snoozed until ${row.snoozedUntil}`;
46
+ }
47
+ else {
48
+ // The inbox files a policy refusal under `discarded`; say what it was.
49
+ state = (0, proposals_1.northstarIntentNote)(row);
50
+ if (!state && !row.canDecide && row.undecidableReason && row.undecidableReason !== 'settled') {
51
+ state = data_provider_1.PROPOSAL_UNDECIDABLE_TEXT[row.undecidableReason];
52
+ }
53
+ }
54
+ const requestNote = row.kind === 'request' ? row.outcomeNote : undefined;
55
+ return [state, requestNote].filter(Boolean).join(' · ') || '—';
52
56
  }
53
57
  class ProposalsList extends base_command_1.BaseCommand {
54
58
  static description = "List the bounded proposal inbox and source coverage. BASIS is how the proposal's own cost/benefit estimate was established (agent_estimate, human_confirmed or measured); — means it carries none.";
@@ -1,4 +1,16 @@
1
1
  import { BaseCommand } from '../../base-command';
2
+ /**
3
+ * The workspace of a request, in a word. A request filed without a workspace stores no `workspaceId` at all
4
+ * (`createRequest` writes the field only when there is one), so it comes back with the key ABSENT, not `null`: both mean
5
+ * it belongs to no workspace, and neither is "not reported" (OSK-23683: an `app_publish` proposal printed that, which
6
+ * left its owner to guess whether the server had said nothing or the request was unscoped).
7
+ */
8
+ export declare function describeRequestWorkspace(workspaceId: unknown): string;
9
+ /**
10
+ * The lines `requests show` prints for a request, in order. A function of the request alone, so what a person reads is
11
+ * what a spec reads.
12
+ */
13
+ export declare function requestDisplayLines(r: Record<string, unknown>): string[];
2
14
  export default class RequestsShow extends BaseCommand {
3
15
  static description: string;
4
16
  static examples: string[];
@@ -1,8 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeRequestWorkspace = describeRequestWorkspace;
4
+ exports.requestDisplayLines = requestDisplayLines;
3
5
  const core_1 = require("@oclif/core");
4
6
  const data_provider_1 = require("@skrr-ai/data-provider");
5
7
  const base_command_1 = require("../../base-command");
8
+ const APP_PUBLISH_NOTICE = 'An approved request alone does not prove the app was published. Check the version distribution.';
9
+ /**
10
+ * The workspace of a request, in a word. A request filed without a workspace stores no `workspaceId` at all
11
+ * (`createRequest` writes the field only when there is one), so it comes back with the key ABSENT, not `null`: both mean
12
+ * it belongs to no workspace, and neither is "not reported" (OSK-23683: an `app_publish` proposal printed that, which
13
+ * left its owner to guess whether the server had said nothing or the request was unscoped).
14
+ */
15
+ function describeRequestWorkspace(workspaceId) {
16
+ return workspaceId === null || workspaceId === undefined ? 'unscoped' : String(workspaceId);
17
+ }
18
+ /**
19
+ * The lines `requests show` prints for a request, in order. A function of the request alone, so what a person reads is
20
+ * what a spec reads.
21
+ */
22
+ function requestDisplayLines(r) {
23
+ const lines = [
24
+ `ID: ${r.id ?? r._id ?? '-'}`,
25
+ `Title: ${r.title ?? '-'}`,
26
+ `Type: ${r.type ?? '-'}`,
27
+ `Status: ${r.status ?? '-'}`,
28
+ ];
29
+ if (r.type === 'app_publish') {
30
+ lines.push(`Publication: ${APP_PUBLISH_NOTICE}`, `Workspace: ${describeRequestWorkspace(r.workspaceId)}`);
31
+ }
32
+ lines.push(`Priority: ${r.priority ?? '-'}`, `Author: ${r.author ?? '-'}`, `Requester: ${r.requesterName ?? r.requesterUserId ?? '-'}`, `Target: ${r.targetName ?? r.targetUserId ?? '-'}`, `Created: ${r.createdAt ?? '-'}`);
33
+ if (r.resolvedAt) {
34
+ lines.push(`Resolved at: ${r.resolvedAt}`);
35
+ }
36
+ if (r.resolutionComment) {
37
+ lines.push('', 'Resolution comment:', ` ${r.resolutionComment}`);
38
+ }
39
+ if (r.description) {
40
+ lines.push('', 'Description:', ` ${r.description}`);
41
+ }
42
+ return lines;
43
+ }
6
44
  class RequestsShow extends base_command_1.BaseCommand {
7
45
  static description = 'Show details for a single request';
8
46
  static examples = [
@@ -25,32 +63,13 @@ class RequestsShow extends base_command_1.BaseCommand {
25
63
  catch (err) {
26
64
  this.handleApiError(err);
27
65
  }
66
+ const r = result;
28
67
  if (flags.json) {
29
- this.log(JSON.stringify(result, null, 2));
68
+ this.log(JSON.stringify(r, null, 2));
30
69
  return;
31
70
  }
32
- const r = result;
33
- this.log(`ID: ${r.id ?? r._id ?? '-'}`);
34
- this.log(`Title: ${r.title ?? '-'}`);
35
- this.log(`Type: ${r.type ?? '-'}`);
36
- this.log(`Status: ${r.status ?? '-'}`);
37
- this.log(`Priority: ${r.priority ?? '-'}`);
38
- this.log(`Author: ${r.author ?? '-'}`);
39
- this.log(`Requester: ${r.requesterName ?? r.requesterUserId ?? '-'}`);
40
- this.log(`Target: ${r.targetName ?? r.targetUserId ?? '-'}`);
41
- this.log(`Created: ${r.createdAt ?? '-'}`);
42
- if (r.resolvedAt) {
43
- this.log(`Resolved at: ${r.resolvedAt}`);
44
- }
45
- if (r.resolutionComment) {
46
- this.log('');
47
- this.log('Resolution comment:');
48
- this.log(` ${r.resolutionComment}`);
49
- }
50
- if (r.description) {
51
- this.log('');
52
- this.log('Description:');
53
- this.log(` ${r.description}`);
71
+ for (const line of requestDisplayLines(r)) {
72
+ this.log(line);
54
73
  }
55
74
  }
56
75
  }
@@ -0,0 +1,21 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * `skrr spaces deletion cancel <space>` (OSK-24060): abandon a Space deletion that is waiting to
4
+ * finish. The safe direction (it preserves data), so there is no confirmation prompt, and it is
5
+ * idempotent: when nothing is pending it says so and exits 0.
6
+ *
7
+ * Signed-in person only. The route refuses a personal access token on purpose, so an automation
8
+ * token cannot undo a deletion a person ordered; the CLI's own credential after `skrr login` is
9
+ * accepted. Words for each answer: `lib/space-deletion-cancel.ts`.
10
+ */
11
+ export default class SpacesDeletionCancel extends BaseCommand {
12
+ static description: string;
13
+ static examples: string[];
14
+ static args: {
15
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
16
+ };
17
+ static flags: {
18
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
+ };
20
+ run(): Promise<void>;
21
+ }
@@ -0,0 +1,70 @@
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 space_deletion_cancel_1 = require("../../../lib/space-deletion-cancel");
7
+ /**
8
+ * `skrr spaces deletion cancel <space>` (OSK-24060): abandon a Space deletion that is waiting to
9
+ * finish. The safe direction (it preserves data), so there is no confirmation prompt, and it is
10
+ * idempotent: when nothing is pending it says so and exits 0.
11
+ *
12
+ * Signed-in person only. The route refuses a personal access token on purpose, so an automation
13
+ * token cannot undo a deletion a person ordered; the CLI's own credential after `skrr login` is
14
+ * accepted. Words for each answer: `lib/space-deletion-cancel.ts`.
15
+ */
16
+ class SpacesDeletionCancel extends base_command_1.BaseCommand {
17
+ static description = 'Cancel a pending Space deletion (needs delete access; a signed-in person, not an access token)';
18
+ static examples = [
19
+ '<%= config.bin %> spaces deletion cancel <space-id>',
20
+ '<%= config.bin %> spaces deletion cancel "Growth lab" --json',
21
+ ];
22
+ static args = {
23
+ id: core_1.Args.string({
24
+ description: 'Space ID, or a title to resolve',
25
+ required: true,
26
+ ignoreStdin: true,
27
+ }),
28
+ };
29
+ static flags = {
30
+ json: core_1.Flags.boolean({ description: 'Output the outcome as JSON' }),
31
+ };
32
+ async run() {
33
+ this.requireAuth();
34
+ const { args, flags } = await this.parse(SpacesDeletionCancel);
35
+ const spaceRef = await this.resolveEntityRef('space', args.id);
36
+ let result;
37
+ try {
38
+ result = await data_provider_1.dataService.cancelSpaceDeletionReservation(spaceRef);
39
+ }
40
+ catch (err) {
41
+ const refusal = (0, space_deletion_cancel_1.describeDeletionCancelRefusal)(err, {
42
+ spaceRef: args.id,
43
+ bin: this.config.bin,
44
+ });
45
+ if (refusal)
46
+ this.failWithCliError(refusal);
47
+ this.handleApiError(err, { subject: `space ${args.id}` });
48
+ }
49
+ const answer = (0, space_deletion_cancel_1.readDeletionCancelAnswer)(result);
50
+ if (!answer) {
51
+ // A 200 that does not say `cancelled` either way. Reporting "cancelled" or "nothing pending"
52
+ // would tell a person their Space is safe (or not) on no evidence.
53
+ this.failWithCliError({
54
+ message: `The server answered, but not in a form this command understands, so it is not known ` +
55
+ `whether the deletion of space ${args.id} was cancelled. ` +
56
+ `→ Check with \`${this.config.bin} spaces show ${args.id}\`, then run this again.`,
57
+ code: 'SPACE_DELETION_CANCEL_UNREADABLE',
58
+ exit: 1,
59
+ retryable: true,
60
+ });
61
+ }
62
+ if (flags.json) {
63
+ this.printJsonResult({ spaceId: spaceRef, ...answer });
64
+ return;
65
+ }
66
+ for (const line of (0, space_deletion_cancel_1.deletionCancelLines)(answer, args.id, this.config.bin))
67
+ this.log(line);
68
+ }
69
+ }
70
+ exports.default = SpacesDeletionCancel;