@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.
- 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/show.js +9 -3
- 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/rollback.d.ts +9 -0
- package/dist/commands/apps/rollback.js +81 -2
- 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 +53 -21
- 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 +156 -31
- package/dist/lib/appInstallations.d.ts +32 -5
- package/dist/lib/appInstallations.js +197 -34
- 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 +68 -60
- 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.d.ts +2 -0
- package/dist/lib/node-adapter.js +35 -8
- package/dist/lib/outbox.d.ts +110 -1
- package/dist/lib/outbox.js +261 -35
- 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 +74 -0
- package/dist/lib/write-outcome.js +176 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +11839 -11318
- package/oclif.manifest.json +1940 -16
- package/package.json +9 -3
|
@@ -9,6 +9,14 @@ export default class AppsUpgrade extends AppsCommand {
|
|
|
9
9
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
'expected-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'check-data': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
14
|
};
|
|
13
15
|
run(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* `--check-data`: ask, print, and decide whether to go on. Only a `compatible` answer goes on by itself; anything else stops, with the
|
|
18
|
+
* exit the check has (1 incompatible, 5 unknown, which an unreadable answer is), unless the person said --yes. A check that cannot be run
|
|
19
|
+
* (a request that fails) stops too: the person asked for the check and does not have it. Nothing is written by the check.
|
|
20
|
+
*/
|
|
21
|
+
private checkDataFirst;
|
|
14
22
|
}
|
|
@@ -3,12 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const apps_command_1 = require("../../lib/apps-command");
|
|
6
|
+
const appCompatibility_1 = require("../../lib/appCompatibility");
|
|
6
7
|
const appInstallations_1 = require("../../lib/appInstallations");
|
|
8
|
+
const drain_stdio_1 = require("../../lib/drain-stdio");
|
|
7
9
|
class AppsUpgrade extends apps_command_1.AppsCommand {
|
|
8
|
-
static description = 'Move an installation to another version of its app (a newer one, or an older one to roll back). It never widens what was approved: a version that asks for more lands as needing your approval again, and does not run until you give it (`apps reconsent`).';
|
|
10
|
+
static description = 'Move an installation to another version of its app (a newer one, or an older one to roll back). It never widens what was approved: a version that asks for more lands as needing your approval again, and does not run until you give it (`apps reconsent`). With --check-data it first checks whether the installation’s stored data fits the data schemas that version declares (`apps installations compatibility`) and prints the result; if the data is incompatible or could not be proven compatible it stops before moving, unless you add --yes. The server never refuses a move because of that check; the choice is yours.';
|
|
9
11
|
static examples = [
|
|
10
12
|
'<%= config.bin %> apps upgrade appi_abc --version appv_xyz',
|
|
11
13
|
'<%= config.bin %> apps upgrade appi_abc --version appv_xyz --expected-version appv_old',
|
|
14
|
+
'<%= config.bin %> apps upgrade appi_abc --version appv_xyz --check-data',
|
|
15
|
+
'<%= config.bin %> apps upgrade appi_abc --version appv_xyz --check-data --yes',
|
|
12
16
|
];
|
|
13
17
|
static args = {
|
|
14
18
|
installation: core_1.Args.string({
|
|
@@ -23,10 +27,29 @@ class AppsUpgrade extends apps_command_1.AppsCommand {
|
|
|
23
27
|
'expected-version': core_1.Flags.string({
|
|
24
28
|
description: 'Move only if it still runs this version (appv_...); otherwise nothing changes',
|
|
25
29
|
}),
|
|
30
|
+
'check-data': core_1.Flags.boolean({
|
|
31
|
+
description: 'First check the installation’s stored data against that version’s declared schemas and print the result. Compatible: move. Incompatible or unknown: stop (exit 1 or 5) unless --yes',
|
|
32
|
+
default: false,
|
|
33
|
+
}),
|
|
34
|
+
yes: core_1.Flags.boolean({
|
|
35
|
+
description: 'With --check-data: move even though the check found the data incompatible or could not prove it compatible. It changes no data; `apps rollback` goes back',
|
|
36
|
+
default: false,
|
|
37
|
+
}),
|
|
26
38
|
};
|
|
27
39
|
async run() {
|
|
28
40
|
this.requireAuth();
|
|
29
41
|
const { args, flags } = await this.parse(AppsUpgrade);
|
|
42
|
+
if (flags.yes && !flags['check-data']) {
|
|
43
|
+
return this.failWithCliError({
|
|
44
|
+
message: '--yes only answers the question --check-data asks. Use `--check-data --yes`, or leave --yes out. Nothing was changed.',
|
|
45
|
+
code: 'APP_FLAG_INVALID',
|
|
46
|
+
exit: 2,
|
|
47
|
+
retryable: false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (flags['check-data']) {
|
|
51
|
+
await this.checkDataFirst(args.installation, flags.version, flags.yes, flags.json);
|
|
52
|
+
}
|
|
30
53
|
try {
|
|
31
54
|
const result = await data_provider_1.dataService.activateAppInstallationVersion(args.installation, {
|
|
32
55
|
versionId: flags.version,
|
|
@@ -42,8 +65,50 @@ class AppsUpgrade extends apps_command_1.AppsCommand {
|
|
|
42
65
|
}
|
|
43
66
|
}
|
|
44
67
|
catch (error) {
|
|
45
|
-
this.failInstallation(error
|
|
68
|
+
this.failInstallation(error, {
|
|
69
|
+
action: 'upgrade',
|
|
70
|
+
subject: args.installation,
|
|
71
|
+
versionId: flags.version,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* `--check-data`: ask, print, and decide whether to go on. Only a `compatible` answer goes on by itself; anything else stops, with the
|
|
77
|
+
* exit the check has (1 incompatible, 5 unknown, which an unreadable answer is), unless the person said --yes. A check that cannot be run
|
|
78
|
+
* (a request that fails) stops too: the person asked for the check and does not have it. Nothing is written by the check.
|
|
79
|
+
*/
|
|
80
|
+
async checkDataFirst(installation, versionId, yes, json) {
|
|
81
|
+
let view;
|
|
82
|
+
try {
|
|
83
|
+
view = await (0, appCompatibility_1.fetchCompatibility)(installation, versionId);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return this.failInstallation(error, { action: 'upgrade', subject: installation, versionId });
|
|
87
|
+
}
|
|
88
|
+
if (view === null) {
|
|
89
|
+
return this.failWithCliError({
|
|
90
|
+
message: `${appCompatibility_1.COMPATIBILITY_UNREADABLE_MESSAGE} Nothing was changed.`,
|
|
91
|
+
code: 'APP_COMPATIBILITY_UNREADABLE',
|
|
92
|
+
exit: 5,
|
|
93
|
+
retryable: false,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// The check is printed on STDERR with --json, so stdout stays one JSON document (the installation, as it always was).
|
|
97
|
+
for (const line of (0, appCompatibility_1.formatCompatibility)(view)) {
|
|
98
|
+
if (json)
|
|
99
|
+
this.logToStderr(line);
|
|
100
|
+
else
|
|
101
|
+
this.log(line);
|
|
102
|
+
}
|
|
103
|
+
if (view.verdict === 'compatible' || yes) {
|
|
104
|
+
if (view.verdict !== 'compatible') {
|
|
105
|
+
this.logToStderr('Moving anyway, as you asked (--yes). No data is changed by a move.');
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
46
108
|
}
|
|
109
|
+
this.logToStderr(`Not moved. To move anyway: \`${this.config.bin} apps upgrade ${installation} --version ${versionId} --check-data --yes\`. To move without the check, leave out --check-data.`);
|
|
110
|
+
await (0, drain_stdio_1.drainStdio)();
|
|
111
|
+
return this.exit((0, appCompatibility_1.compatibilityExit)(view));
|
|
47
112
|
}
|
|
48
113
|
}
|
|
49
114
|
exports.default = AppsUpgrade;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AppsCommand } from '../../../lib/apps-command';
|
|
2
|
+
export default class AppsVersionCat extends AppsCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
version: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
path: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
8
|
+
};
|
|
9
|
+
static flags: {
|
|
10
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
out: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
offset: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
/** What was checked, on stderr so stdout stays the file. */
|
|
19
|
+
private note;
|
|
20
|
+
/** Say what went wrong, in this command's terms where it has them. Never returns. */
|
|
21
|
+
private failVersionFile;
|
|
22
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const node_fs_1 = require("node:fs");
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
|
+
const apps_command_1 = require("../../../lib/apps-command");
|
|
8
|
+
const apps_1 = require("../../../lib/apps");
|
|
9
|
+
const appVersionFile_1 = require("../../../lib/appVersionFile");
|
|
10
|
+
class AppsVersionCat extends apps_command_1.AppsCommand {
|
|
11
|
+
static description = "Print the full text of one file of a FROZEN version, checked against the version's own hashes, so a reviewer reads exactly the bytes the version's bundle hash covers (never the draft, which may have moved). " +
|
|
12
|
+
"The file list is first tied to the bundle hash; each slice (at most 64 KiB) is checked against the version's record; and when the whole file is read, the joined bytes must match its sha-256 and size. Nothing is printed unless every check passed. " +
|
|
13
|
+
'The text is untrusted: it was written by whoever authored the version. On a terminal, control and direction-changing characters are shown as \\u{...} escapes and a binary file is refused (use --out to save it, --raw for the exact bytes). ' +
|
|
14
|
+
`Exit ${appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT}: the bytes are not the version's.`;
|
|
15
|
+
static examples = [
|
|
16
|
+
'<%= config.bin %> apps version cat appv_... app.js',
|
|
17
|
+
'<%= config.bin %> apps version cat appv_... app.json --json',
|
|
18
|
+
'<%= config.bin %> apps version cat appv_... icon.png --out ./icon.png',
|
|
19
|
+
'<%= config.bin %> apps version cat appv_... app.js --offset 30000 --limit 5000',
|
|
20
|
+
];
|
|
21
|
+
static args = {
|
|
22
|
+
version: core_1.Args.string({
|
|
23
|
+
description: 'The version id (appv_...)',
|
|
24
|
+
required: true,
|
|
25
|
+
ignoreStdin: true,
|
|
26
|
+
}),
|
|
27
|
+
path: core_1.Args.string({
|
|
28
|
+
description: 'The file, exactly as `apps version show` lists it',
|
|
29
|
+
required: true,
|
|
30
|
+
ignoreStdin: true,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
static flags = {
|
|
34
|
+
json: core_1.Flags.boolean({
|
|
35
|
+
description: 'Output { versionId, bundleHash, path, offset, length, total, fileSha256, wholeFileVerified, encoding, content } as JSON',
|
|
36
|
+
exclusive: ['raw'],
|
|
37
|
+
}),
|
|
38
|
+
out: core_1.Flags.string({
|
|
39
|
+
description: 'Save the exact bytes to this file instead of printing them (written only after every check passed; an existing file is refused without --force)',
|
|
40
|
+
}),
|
|
41
|
+
force: core_1.Flags.boolean({
|
|
42
|
+
description: 'With --out, replace a file that already exists (never write through a symbolic link)',
|
|
43
|
+
default: false,
|
|
44
|
+
}),
|
|
45
|
+
raw: core_1.Flags.boolean({
|
|
46
|
+
description: 'Write the exact bytes to stdout even on a terminal, escaping nothing and refusing nothing',
|
|
47
|
+
exclusive: ['json', 'out'],
|
|
48
|
+
}),
|
|
49
|
+
offset: core_1.Flags.integer({
|
|
50
|
+
description: 'Start at this byte. A read that does not start at 0 or stops early checks each slice but cannot check the whole file, and says so',
|
|
51
|
+
min: 0,
|
|
52
|
+
}),
|
|
53
|
+
limit: core_1.Flags.integer({
|
|
54
|
+
description: `Read at most this many bytes in all (the server answers in slices of at most ${data_provider_1.APP_VERSION_FILE_LIMITS.chunkBytesMax})`,
|
|
55
|
+
min: 1,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
async run() {
|
|
59
|
+
this.requireAuth();
|
|
60
|
+
const { args, flags } = await this.parse(AppsVersionCat);
|
|
61
|
+
let read;
|
|
62
|
+
try {
|
|
63
|
+
read = await (0, appVersionFile_1.readVersionFile)({
|
|
64
|
+
getVersion: (versionId) => data_provider_1.dataService.getAppVersion(versionId),
|
|
65
|
+
readChunk: (versionId, params) => data_provider_1.dataService.readAppVersionFile(versionId, params),
|
|
66
|
+
}, {
|
|
67
|
+
versionId: args.version,
|
|
68
|
+
path: args.path,
|
|
69
|
+
...(flags.offset === undefined ? {} : { offset: flags.offset }),
|
|
70
|
+
...(flags.limit === undefined ? {} : { limit: flags.limit }),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return this.failVersionFile(error);
|
|
75
|
+
}
|
|
76
|
+
const summary = {
|
|
77
|
+
versionId: read.versionId,
|
|
78
|
+
bundleHash: read.bundleHash,
|
|
79
|
+
path: read.path,
|
|
80
|
+
offset: read.offset,
|
|
81
|
+
length: read.length,
|
|
82
|
+
total: read.total,
|
|
83
|
+
fileSha256: read.fileSha256,
|
|
84
|
+
wholeFileVerified: read.wholeFileVerified,
|
|
85
|
+
};
|
|
86
|
+
if (flags.out !== undefined) {
|
|
87
|
+
try {
|
|
88
|
+
saveVerified(flags.out, read.bytes, flags.force);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
return this.failWithCliError({
|
|
92
|
+
message: `Could not write ${flags.out}: ${error.message}`,
|
|
93
|
+
code: 'APP_VERSION_FILE_OUT',
|
|
94
|
+
exit: 1,
|
|
95
|
+
retryable: false,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (flags.json) {
|
|
99
|
+
this.printJsonResult({ ...summary, out: flags.out, bytesWritten: read.bytes.length });
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.log(`wrote ${read.bytes.length} bytes to ${flags.out}`);
|
|
103
|
+
this.note(read);
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (flags.json) {
|
|
108
|
+
const text = (0, appVersionFile_1.isBinary)(read.bytes) ? null : read.bytes.toString('utf8');
|
|
109
|
+
this.printJsonResult({
|
|
110
|
+
...summary,
|
|
111
|
+
...(text === null
|
|
112
|
+
? { encoding: 'base64', content: read.bytes.toString('base64') }
|
|
113
|
+
: { encoding: 'utf8', content: text }),
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (flags.raw || !process.stdout.isTTY) {
|
|
118
|
+
// The exact bytes, for a pipe or a file: `apps version cat ... > file` makes a clean file.
|
|
119
|
+
process.stdout.write(read.bytes);
|
|
120
|
+
this.note(read);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if ((0, appVersionFile_1.isBinary)(read.bytes)) {
|
|
124
|
+
return this.failWithCliError({
|
|
125
|
+
message: `"${read.path}" is binary (${read.length} bytes), so it is not printed to a terminal. Save it with --out <file>, or write the exact bytes with --raw.`,
|
|
126
|
+
code: 'APP_VERSION_FILE_BINARY',
|
|
127
|
+
exit: 2,
|
|
128
|
+
retryable: false,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const shown = (0, appVersionFile_1.escapeForTerminal)(read.bytes.toString('utf8'));
|
|
132
|
+
process.stdout.write(shown.text);
|
|
133
|
+
if (!shown.text.endsWith('\n'))
|
|
134
|
+
process.stdout.write('\n');
|
|
135
|
+
if (shown.escaped > 0) {
|
|
136
|
+
process.stderr.write(`${shown.escaped} control or direction-changing character${shown.escaped === 1 ? '' : 's'} shown as \\u{...} escapes; --raw writes the exact bytes.\n`);
|
|
137
|
+
}
|
|
138
|
+
this.note(read);
|
|
139
|
+
}
|
|
140
|
+
/** What was checked, on stderr so stdout stays the file. */
|
|
141
|
+
note(read) {
|
|
142
|
+
const bundle = read.bundleHash.slice(0, 12);
|
|
143
|
+
process.stderr.write(read.wholeFileVerified
|
|
144
|
+
? `verified: ${read.length} bytes, sha-256 ${read.fileSha256.slice(0, 12)} matches the record of version ${read.versionId} (bundle ${bundle})\n`
|
|
145
|
+
: `partial read (bytes ${read.offset}-${read.offset + read.length} of ${read.total}): each slice matches the record of version ${read.versionId}, but the whole file was not read, so its sha-256 was not checked\n`);
|
|
146
|
+
}
|
|
147
|
+
/** Say what went wrong, in this command's terms where it has them. Never returns. */
|
|
148
|
+
failVersionFile(error) {
|
|
149
|
+
if (error instanceof appVersionFile_1.VersionFileIntegrityError) {
|
|
150
|
+
return this.failWithCliError({
|
|
151
|
+
message: `${error.message} Nothing was printed. Do not approve this version on the strength of this file.`,
|
|
152
|
+
code: appVersionFile_1.VERSION_FILE_INTEGRITY_CODE,
|
|
153
|
+
exit: appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT,
|
|
154
|
+
retryable: false,
|
|
155
|
+
details: { problem: error.kind, ...error.details },
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (error instanceof appVersionFile_1.VersionFileNotListedError) {
|
|
159
|
+
return this.failWithCliError({
|
|
160
|
+
message: `${error.message} It lists: ${error.listed.join(', ')}. \`${this.config.bin} apps version show <version>\` lists them with their hashes.`,
|
|
161
|
+
code: 'APP_VERSION_FILE_NOT_LISTED',
|
|
162
|
+
exit: 4,
|
|
163
|
+
retryable: false,
|
|
164
|
+
details: { path: error.path, listed: error.listed },
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (error instanceof appVersionFile_1.VersionFileInputError) {
|
|
168
|
+
return this.failWithCliError({
|
|
169
|
+
message: error.message,
|
|
170
|
+
code: error.code,
|
|
171
|
+
exit: 2,
|
|
172
|
+
retryable: false,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
// The server checks the stored bytes against the record first and refuses, with the reason, when they disagree.
|
|
176
|
+
const refusal = (0, apps_1.readAppsRefusal)(error);
|
|
177
|
+
if (refusal?.error === 'integrity_mismatch') {
|
|
178
|
+
return this.failWithCliError({
|
|
179
|
+
message: `${refusal.message ?? 'The stored bytes of this file are not the bytes the version recorded.'} Nothing was printed. Do not approve this version on the strength of this file.`,
|
|
180
|
+
code: appVersionFile_1.VERSION_FILE_INTEGRITY_CODE,
|
|
181
|
+
...(refusal.status === undefined ? {} : { status: refusal.status }),
|
|
182
|
+
exit: appVersionFile_1.VERSION_FILE_INTEGRITY_EXIT,
|
|
183
|
+
retryable: false,
|
|
184
|
+
details: {
|
|
185
|
+
problem: 'server_integrity',
|
|
186
|
+
...(refusal.reason ? { reason: refusal.reason } : {}),
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return this.failApps(error);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.default = AppsVersionCat;
|
|
194
|
+
/**
|
|
195
|
+
* Write `bytes` to `target` only once they are verified, and so that no reader sees a part of them: a file of the same name
|
|
196
|
+
* in the same directory, then a rename. An existing target is refused unless `force`, and a symbolic link is never written
|
|
197
|
+
* through (the rename replaces the link itself).
|
|
198
|
+
*/
|
|
199
|
+
function saveVerified(target, bytes, force) {
|
|
200
|
+
let existing = null;
|
|
201
|
+
try {
|
|
202
|
+
existing = (0, node_fs_1.lstatSync)(target);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (error.code !== 'ENOENT')
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
if (existing && !force)
|
|
209
|
+
throw new Error('it already exists; use --force to replace it');
|
|
210
|
+
if (existing?.isDirectory())
|
|
211
|
+
throw new Error('it is a directory');
|
|
212
|
+
const staging = (0, node_path_1.join)((0, node_path_1.dirname)(target), `.${(0, node_path_1.basename)(target)}.${process.pid}.partial`);
|
|
213
|
+
try {
|
|
214
|
+
(0, node_fs_1.writeFileSync)(staging, bytes, { flag: 'wx', mode: 0o644 });
|
|
215
|
+
(0, node_fs_1.renameSync)(staging, target);
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
(0, node_fs_1.rmSync)(staging, { force: true });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -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 AppsVersionShow extends apps_command_1.AppsCommand {
|
|
7
|
-
static description = 'Show one version: its bundle hash, its files, what it declares and where it stands.';
|
|
7
|
+
static description = 'Show one version: its bundle hash, its files, what it declares and where it stands. To read the full text of a file, checked against these hashes, use `apps version cat`.';
|
|
8
8
|
static examples = ['<%= config.bin %> apps version show appv_...'];
|
|
9
9
|
static args = {
|
|
10
10
|
version: core_1.Args.string({
|
|
@@ -30,6 +30,8 @@ class AppsVersionShow extends apps_command_1.AppsCommand {
|
|
|
30
30
|
this.log(`bundle ${version.bundleHash}`);
|
|
31
31
|
for (const file of version.files)
|
|
32
32
|
this.log(`${file.path} ${file.size} bytes ${file.sha256.slice(0, 12)}`);
|
|
33
|
+
// a digest is not something a person can read: the text itself, checked against these hashes, is one command away
|
|
34
|
+
this.log(`read a file in full, checked against its hash: ${this.config.bin} apps version cat ${version.id} <path>`);
|
|
33
35
|
}
|
|
34
36
|
catch (error) {
|
|
35
37
|
this.failApps(error);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* `skrr commerce incidents release` — a person's decision to release a held refund.
|
|
4
|
+
*
|
|
5
|
+
* An open Store Agent incident whose id another Agent now holds cannot prove its access is
|
|
6
|
+
* gone, so a retry (manual or automatic) never moves it. This records the decision to release
|
|
7
|
+
* it anyway, with a reason and evidence, then runs it: the pinned Agent's own permissions are
|
|
8
|
+
* removed, the replacement's data under the id is left in place, and the buyer is refunded
|
|
9
|
+
* through the ordinary path. It is a decision, not a retry, which is why it is its own verb and
|
|
10
|
+
* why the body is required: an administrator cannot release a refund without saying why.
|
|
11
|
+
* The server refuses unless that is exactly the live state of the incident.
|
|
12
|
+
*/
|
|
13
|
+
export default class CommerceIncidentsRelease extends BaseCommand {
|
|
14
|
+
static description: string;
|
|
15
|
+
static examples: string[];
|
|
16
|
+
static args: {
|
|
17
|
+
reconciliation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
18
|
+
};
|
|
19
|
+
static flags: {
|
|
20
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
|
+
};
|
|
23
|
+
run(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 commerce_1 = require("../../../lib/commerce");
|
|
6
|
+
const commerce_command_1 = require("../../../lib/commerce-command");
|
|
7
|
+
/**
|
|
8
|
+
* `skrr commerce incidents release` — a person's decision to release a held refund.
|
|
9
|
+
*
|
|
10
|
+
* An open Store Agent incident whose id another Agent now holds cannot prove its access is
|
|
11
|
+
* gone, so a retry (manual or automatic) never moves it. This records the decision to release
|
|
12
|
+
* it anyway, with a reason and evidence, then runs it: the pinned Agent's own permissions are
|
|
13
|
+
* removed, the replacement's data under the id is left in place, and the buyer is refunded
|
|
14
|
+
* through the ordinary path. It is a decision, not a retry, which is why it is its own verb and
|
|
15
|
+
* why the body is required: an administrator cannot release a refund without saying why.
|
|
16
|
+
* The server refuses unless that is exactly the live state of the incident.
|
|
17
|
+
*/
|
|
18
|
+
class CommerceIncidentsRelease extends base_command_1.BaseCommand {
|
|
19
|
+
static description = "Release a Store refund held because another Agent holds the install's id (admin). A recorded decision with a reason and evidence — not a retry; for that see `commerce incidents retry`.";
|
|
20
|
+
static examples = [
|
|
21
|
+
'<%= config.bin %> commerce incidents release <reconciliation-id> --file ./release.json',
|
|
22
|
+
];
|
|
23
|
+
static args = {
|
|
24
|
+
reconciliation: core_1.Args.string({
|
|
25
|
+
description: 'Fulfillment reconciliation id',
|
|
26
|
+
required: true,
|
|
27
|
+
ignoreStdin: true,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
static flags = { ...commerce_command_1.jsonBodyFlags };
|
|
31
|
+
async run() {
|
|
32
|
+
this.requireAuth();
|
|
33
|
+
const { args, flags } = await this.parse(CommerceIncidentsRelease);
|
|
34
|
+
const body = await (0, commerce_command_1.jsonBodyFrom)(this, flags.file, { required: true });
|
|
35
|
+
let result;
|
|
36
|
+
try {
|
|
37
|
+
result = await (0, commerce_1.releaseFulfillmentReplacementHold)(args.reconciliation, body);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.handleApiError(error);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.printJsonResult(result);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = CommerceIncidentsRelease;
|
|
@@ -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.
|