@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.
- package/README.md +13 -0
- package/dist/base-command.d.ts +14 -1
- package/dist/base-command.js +166 -46
- package/dist/commands/agent/message/send.d.ts +1 -0
- package/dist/commands/agent/message/send.js +3 -0
- package/dist/commands/agents/mini-computer/app/set.js +1 -1
- package/dist/commands/agents/mini-computer/tasks-view.js +1 -1
- package/dist/commands/apps/check.js +3 -8
- package/dist/commands/apps/data/batch.d.ts +1 -0
- package/dist/commands/apps/data/batch.js +19 -2
- package/dist/commands/apps/data/delete.d.ts +1 -0
- package/dist/commands/apps/data/delete.js +14 -2
- package/dist/commands/apps/data/patch.d.ts +1 -0
- package/dist/commands/apps/data/patch.js +11 -2
- package/dist/commands/apps/data/put.d.ts +1 -0
- package/dist/commands/apps/data/put.js +17 -3
- package/dist/commands/apps/install.js +7 -2
- package/dist/commands/apps/installations/compatibility.d.ts +13 -0
- package/dist/commands/apps/installations/compatibility.js +60 -0
- package/dist/commands/apps/installations/migrate/abort.d.ts +13 -0
- package/dist/commands/apps/installations/migrate/abort.js +45 -0
- package/dist/commands/apps/installations/migrate/cutover.d.ts +15 -0
- package/dist/commands/apps/installations/migrate/cutover.js +102 -0
- package/dist/commands/apps/installations/migrate/plan.d.ts +13 -0
- package/dist/commands/apps/installations/migrate/plan.js +51 -0
- package/dist/commands/apps/installations/migrate/rollback.d.ts +16 -0
- package/dist/commands/apps/installations/migrate/rollback.js +103 -0
- package/dist/commands/apps/installations/migrate/stage.d.ts +15 -0
- package/dist/commands/apps/installations/migrate/stage.js +96 -0
- package/dist/commands/apps/installations/migrate/status.d.ts +12 -0
- package/dist/commands/apps/installations/migrate/status.js +52 -0
- package/dist/commands/apps/installations/migrate/validate.d.ts +14 -0
- package/dist/commands/apps/installations/migrate/validate.js +58 -0
- package/dist/commands/apps/installations/show.js +14 -9
- package/dist/commands/apps/installations/snapshot.js +5 -2
- package/dist/commands/apps/operations/check.d.ts +16 -0
- package/dist/commands/apps/operations/check.js +127 -0
- package/dist/commands/apps/publish/propose.js +33 -4
- package/dist/commands/apps/reconsent.js +7 -1
- package/dist/commands/apps/reference.d.ts +4 -2
- package/dist/commands/apps/reference.js +7 -4
- package/dist/commands/apps/resume.js +1 -1
- package/dist/commands/apps/rollback.d.ts +9 -0
- package/dist/commands/apps/rollback.js +81 -2
- package/dist/commands/apps/settings/set.js +22 -10
- package/dist/commands/apps/upgrade.d.ts +8 -0
- package/dist/commands/apps/upgrade.js +67 -2
- package/dist/commands/apps/version/cat.d.ts +22 -0
- package/dist/commands/apps/version/cat.js +220 -0
- package/dist/commands/apps/version/show.js +3 -1
- package/dist/commands/commerce/incidents/release.d.ts +24 -0
- package/dist/commands/commerce/incidents/release.js +46 -0
- package/dist/commands/duties/cases.js +12 -1
- package/dist/commands/duties/hypotheses.js +10 -3
- package/dist/commands/duties/observations.d.ts +4 -0
- package/dist/commands/duties/observations.js +14 -3
- package/dist/commands/outbox/list.d.ts +11 -4
- package/dist/commands/outbox/list.js +56 -9
- package/dist/commands/outbox/retry.d.ts +8 -2
- package/dist/commands/outbox/retry.js +76 -16
- package/dist/commands/outbox/show.d.ts +20 -0
- package/dist/commands/outbox/show.js +83 -0
- package/dist/commands/proposals/list.js +13 -9
- package/dist/commands/requests/show.d.ts +12 -0
- package/dist/commands/requests/show.js +42 -23
- package/dist/commands/spaces/deletion/cancel.d.ts +21 -0
- package/dist/commands/spaces/deletion/cancel.js +70 -0
- package/dist/commands/spaces/workflows/run.js +12 -0
- package/dist/commands/widgets/check.d.ts +9 -0
- package/dist/commands/widgets/check.js +16 -3
- package/dist/generated/agent-guides.json +17 -17
- package/dist/lib/api-fetch.d.ts +5 -0
- package/dist/lib/api-fetch.js +81 -22
- package/dist/lib/appCompatibility.d.ts +31 -0
- package/dist/lib/appCompatibility.js +66 -0
- package/dist/lib/appData.d.ts +46 -4
- package/dist/lib/appData.js +161 -32
- package/dist/lib/appDataMigration.d.ts +204 -0
- package/dist/lib/appDataMigration.js +753 -0
- package/dist/lib/appDataMigrationCommand.d.ts +39 -0
- package/dist/lib/appDataMigrationCommand.js +90 -0
- package/dist/lib/appInstallations.d.ts +40 -5
- package/dist/lib/appInstallations.js +251 -35
- package/dist/lib/appVersionFile.d.ts +82 -0
- package/dist/lib/appVersionFile.js +195 -0
- package/dist/lib/apps-command.d.ts +14 -3
- package/dist/lib/apps-command.js +80 -65
- package/dist/lib/appsCheck.js +16 -2
- package/dist/lib/commerce.d.ts +6 -0
- package/dist/lib/commerce.js +9 -0
- package/dist/lib/duties.d.ts +15 -1
- package/dist/lib/duties.js +21 -3
- package/dist/lib/json-output.d.ts +2 -0
- package/dist/lib/json-output.js +8 -4
- package/dist/lib/node-adapter.js +69 -38
- package/dist/lib/outbox.d.ts +110 -1
- package/dist/lib/outbox.js +261 -35
- package/dist/lib/rate-limit-retry.d.ts +4 -5
- package/dist/lib/rate-limit-retry.js +6 -10
- package/dist/lib/refresh.d.ts +2 -0
- package/dist/lib/refresh.js +6 -0
- package/dist/lib/space-deletion-cancel.d.ts +47 -0
- package/dist/lib/space-deletion-cancel.js +141 -0
- package/dist/lib/widgetCheck.js +1 -1
- package/dist/lib/widgetStaticScan.d.ts +11 -5
- package/dist/lib/widgetStaticScan.js +73 -165
- package/dist/lib/write-outcome.d.ts +76 -0
- package/dist/lib/write-outcome.js +190 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11955 -11231
- package/oclif.manifest.json +3019 -499
- package/package.json +12 -3
|
@@ -35,7 +35,18 @@ class DutiesCases extends base_command_1.BaseCommand {
|
|
|
35
35
|
this.log(JSON.stringify(result, null, 2));
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
// A bound-only list (OSK-23203) leaves out Cases that cannot be tied to this Duty document, so it must say so,
|
|
39
|
+
// and an empty one must not claim that nothing was recorded.
|
|
40
|
+
const bound = (0, duties_1.boundHistoryCoverage)(result);
|
|
41
|
+
if (bound?.someHidden)
|
|
42
|
+
this.log(`NOTE: ${duties_1.BOUND_CASES_NOTE}`);
|
|
43
|
+
(0, duties_1.renderDutyCases)(result, (line) => this.log(line), {
|
|
44
|
+
...(bound?.someHidden
|
|
45
|
+
? {
|
|
46
|
+
emptyMessage: `No cases are shown${flags.status ? ` with status ${flags.status}` : ''}. ${duties_1.BOUND_CASES_NOTE}`,
|
|
47
|
+
}
|
|
48
|
+
: {}),
|
|
49
|
+
});
|
|
39
50
|
(0, duties_1.renderListPageHint)(result, (line) => this.log(line));
|
|
40
51
|
}
|
|
41
52
|
}
|
|
@@ -65,9 +65,16 @@ class DutiesHypotheses extends base_command_1.BaseCommand {
|
|
|
65
65
|
flags.status ? `--status ${flags.status}` : null,
|
|
66
66
|
flags['investigation-key'] ? `--investigation-key ${flags['investigation-key']}` : null,
|
|
67
67
|
].filter(Boolean);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
// A bound-only list (OSK-23203) leaves out claims that cannot be tied to this Duty document, so it must say so,
|
|
69
|
+
// and an empty one must not claim that nothing was recorded.
|
|
70
|
+
const bound = (0, duties_1.boundHistoryCoverage)(response);
|
|
71
|
+
const emptyMessage = bound?.someHidden
|
|
72
|
+
? `No hypotheses are shown${filters.length ? ` that match ${filters.join(' ')}` : ''}. ${duties_1.BOUND_HYPOTHESES_NOTE}`
|
|
73
|
+
: filters.length
|
|
74
|
+
? `No hypotheses match ${filters.join(' ')}.`
|
|
75
|
+
: 'No hypotheses recorded.';
|
|
76
|
+
if (bound?.someHidden)
|
|
77
|
+
this.log(`NOTE: ${duties_1.BOUND_HYPOTHESES_NOTE}`);
|
|
71
78
|
(0, duties_1.renderDutyHypotheses)(response, (line) => this.log(line), { emptyMessage });
|
|
72
79
|
(0, duties_1.renderListPageHint)(response, (line) => this.log(line));
|
|
73
80
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
+
import { boundHistoryCoverage } from '../../lib/duties';
|
|
3
|
+
/** What the server says about a bound-only history: only readings tied to THIS Duty document are shown. */
|
|
4
|
+
export declare const BOUND_HISTORY_NOTE = "Only readings tied to this Duty document are shown. Other readings carry this Duty\u2019s id but cannot be tied to it (an earlier Duty with the same id, or recorded before the link existed), so they are left out.";
|
|
5
|
+
export { boundHistoryCoverage };
|
|
2
6
|
/** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
|
|
3
7
|
export declare function parseObservationWindow(value: string): {
|
|
4
8
|
from: string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.boundHistoryCoverage = exports.BOUND_HISTORY_NOTE = void 0;
|
|
3
4
|
exports.parseObservationWindow = parseObservationWindow;
|
|
4
5
|
exports.renderObservationWindow = renderObservationWindow;
|
|
5
6
|
const core_1 = require("@oclif/core");
|
|
6
7
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
8
|
const base_command_1 = require("../../base-command");
|
|
8
9
|
const duties_1 = require("../../lib/duties");
|
|
10
|
+
Object.defineProperty(exports, "boundHistoryCoverage", { enumerable: true, get: function () { return duties_1.boundHistoryCoverage; } });
|
|
9
11
|
const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
10
12
|
/** Legacy responses cannot prove that historical observations belong to this
|
|
11
13
|
* physical Duty. Never print rows or aggregate values without a source policy. */
|
|
@@ -15,6 +17,8 @@ function hasVerifiedSource(value) {
|
|
|
15
17
|
const policy = value.sourcePolicy;
|
|
16
18
|
return policy?.status === 'supported' || policy?.status === 'partial';
|
|
17
19
|
}
|
|
20
|
+
/** What the server says about a bound-only history: only readings tied to THIS Duty document are shown. */
|
|
21
|
+
exports.BOUND_HISTORY_NOTE = 'Only readings tied to this Duty document are shown. Other readings carry this Duty’s id but cannot be tied to it (an earlier Duty with the same id, or recorded before the link existed), so they are left out.';
|
|
18
22
|
/** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
|
|
19
23
|
function parseObservationWindow(value) {
|
|
20
24
|
const parts = value.split('/');
|
|
@@ -178,9 +182,16 @@ class DutiesObservations extends base_command_1.BaseCommand {
|
|
|
178
182
|
flags['changed-only'] ? '--changed-only' : null,
|
|
179
183
|
flags.since ? `--since ${flags.since}` : null,
|
|
180
184
|
].filter(Boolean);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
// A bound-only history (OSK-23203) leaves out readings that cannot be tied to this Duty document, so an
|
|
186
|
+
// empty page must not claim that nothing was recorded, and a non-empty one must say it is partial.
|
|
187
|
+
const bound = (0, duties_1.boundHistoryCoverage)(response);
|
|
188
|
+
const emptyMessage = bound?.someHidden
|
|
189
|
+
? `No observations are shown${filters.length ? ` that match ${filters.join(' ')}` : ''}. ${exports.BOUND_HISTORY_NOTE}`
|
|
190
|
+
: filters.length
|
|
191
|
+
? `No observations match ${filters.join(' ')}.`
|
|
192
|
+
: 'No observations recorded.';
|
|
193
|
+
if (bound?.someHidden)
|
|
194
|
+
this.log(`NOTE: ${exports.BOUND_HISTORY_NOTE}`);
|
|
184
195
|
if (response?.truncated)
|
|
185
196
|
this.log(`TRUNCATED: ${response.omitted} current keys omitted; increase --limit (max 200).`);
|
|
186
197
|
(0, duties_1.renderDutyObservations)(response, (line) => this.log(line), { emptyMessage });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
-
import { type OutboxEntry } from '../../lib/outbox';
|
|
2
|
+
import { type OutboxEntry, type ReplayContext, type ReplayContextVerdict } from '../../lib/outbox';
|
|
3
3
|
/**
|
|
4
4
|
* Why one entry was queued, in words (OSK-12121). The queue holds more than
|
|
5
5
|
* outage casualties — a 401 is queued too, so authored content survives a lapsed
|
|
@@ -10,11 +10,18 @@ export declare function queuedBecause(entry: Pick<OutboxEntry, 'reason' | 'repla
|
|
|
10
10
|
label: string;
|
|
11
11
|
kind: 'auth' | 'throttled' | 'unavailable' | 'other';
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Where an entry will be replayed, in a cell: the server and the account it was
|
|
15
|
+
* queued as, or the plain statement that it recorded neither (OSK-23807).
|
|
16
|
+
*/
|
|
17
|
+
export declare function boundTo(entry: Pick<OutboxEntry, 'origin' | 'account'>): string;
|
|
18
|
+
export declare function outboxListSnapshot(profile?: string, current?: ReplayContext): {
|
|
19
|
+
queued: (OutboxEntry & {
|
|
20
|
+
replayContext?: ReplayContextVerdict;
|
|
21
|
+
})[];
|
|
15
22
|
incident: import("../../lib/outbox").IncidentState | null;
|
|
16
23
|
incidentActive: boolean;
|
|
17
|
-
originalContext: "unverified" | "not_applicable";
|
|
24
|
+
originalContext: "unverified" | "bound" | "not_applicable";
|
|
18
25
|
};
|
|
19
26
|
/**
|
|
20
27
|
* `skrr outbox list` — what is queued, and why.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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')
|
|
115
|
-
|
|
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.
|
|
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` —
|
|
4
|
-
*
|
|
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' &&
|
|
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` —
|
|
25
|
-
*
|
|
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 = '
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
75
|
-
//
|
|
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
|
|
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: {
|
|
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({
|
|
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({
|
|
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 {
|
|
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 ||
|
|
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 ||
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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[];
|