@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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { AppVersionDetail, AppVersionFileChunk } from '@skrr-ai/data-provider';
|
|
2
|
+
/** The most a read will hold. A package file is far smaller (`APP_DRAFT_LIMITS`); a server that says otherwise is not believed. */
|
|
3
|
+
export declare const VERSION_FILE_READ_MAX_BYTES: number;
|
|
4
|
+
/** The machine code and exit under which a mismatch is reported. A distinct exit: a harness must not read "6" as an ordinary failure. */
|
|
5
|
+
export declare const VERSION_FILE_INTEGRITY_CODE = "APP_VERSION_FILE_INTEGRITY";
|
|
6
|
+
export declare const VERSION_FILE_INTEGRITY_EXIT = 6;
|
|
7
|
+
/** What disagreed, in a closed set a harness can switch on. */
|
|
8
|
+
export type VersionFileProblemKind =
|
|
9
|
+
/** the version's file list does not hash to its `bundleHash` */
|
|
10
|
+
'bundle_hash'
|
|
11
|
+
/** the server says the bytes it holds are not the bytes the version recorded */
|
|
12
|
+
| 'server_integrity'
|
|
13
|
+
/** a slice names another version, bundle, path, digest or size than the version's record */
|
|
14
|
+
| 'record'
|
|
15
|
+
/** a slice does not start where the last one ended, or is not the length asked for */
|
|
16
|
+
| 'continuity'
|
|
17
|
+
/** a slice's bytes are not valid base64, or do not hash to the digest it states */
|
|
18
|
+
| 'chunk_digest'
|
|
19
|
+
/** the slices joined are not the size, or do not hash to the digest, the version recorded */
|
|
20
|
+
| 'file_digest';
|
|
21
|
+
/** The bytes are not provably the version's. Carries what disagreed; never the bytes. */
|
|
22
|
+
export declare class VersionFileIntegrityError extends Error {
|
|
23
|
+
readonly kind: VersionFileProblemKind;
|
|
24
|
+
readonly details: Record<string, unknown>;
|
|
25
|
+
constructor(kind: VersionFileProblemKind, message: string, details?: Record<string, unknown>);
|
|
26
|
+
}
|
|
27
|
+
/** The path is not one the version lists. Carries a bounded sample of the ones it does. */
|
|
28
|
+
export declare class VersionFileNotListedError extends Error {
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly listed: string[];
|
|
31
|
+
constructor(path: string, listed: string[]);
|
|
32
|
+
}
|
|
33
|
+
/** The caller asked for something that cannot be read (an offset past the end, a file past what the CLI will hold). */
|
|
34
|
+
export declare class VersionFileInputError extends Error {
|
|
35
|
+
readonly code: string;
|
|
36
|
+
constructor(code: string, message: string);
|
|
37
|
+
}
|
|
38
|
+
/** The two calls a read makes. `dataService` is the real one; a spec hands in its own. */
|
|
39
|
+
export interface VersionFileReader {
|
|
40
|
+
getVersion(versionId: string): Promise<AppVersionDetail>;
|
|
41
|
+
readChunk(versionId: string, params: {
|
|
42
|
+
path: string;
|
|
43
|
+
offset: number;
|
|
44
|
+
limit: number;
|
|
45
|
+
}): Promise<AppVersionFileChunk>;
|
|
46
|
+
}
|
|
47
|
+
export interface VersionFileRead {
|
|
48
|
+
versionId: string;
|
|
49
|
+
bundleHash: string;
|
|
50
|
+
path: string;
|
|
51
|
+
/** Where the bytes start, and how many there are. */
|
|
52
|
+
offset: number;
|
|
53
|
+
length: number;
|
|
54
|
+
/** The file's size, as the version recorded it. */
|
|
55
|
+
total: number;
|
|
56
|
+
/** The file's digest, as the version recorded it. */
|
|
57
|
+
fileSha256: string;
|
|
58
|
+
/** Slices asked for. */
|
|
59
|
+
chunks: number;
|
|
60
|
+
/** True when the whole file was read and its size and digest matched the record. False is a partial read, not a failure. */
|
|
61
|
+
wholeFileVerified: boolean;
|
|
62
|
+
bytes: Buffer;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Read `path` of `versionId` from `offset` for at most `limit` bytes (to the end when absent), checking everything the file
|
|
66
|
+
* header lists, and return the bytes only if all of it held. Throws {@link VersionFileIntegrityError},
|
|
67
|
+
* {@link VersionFileNotListedError} or {@link VersionFileInputError}; anything else is the API's own failure and is the
|
|
68
|
+
* caller's to say.
|
|
69
|
+
*/
|
|
70
|
+
export declare function readVersionFile(reader: VersionFileReader, input: {
|
|
71
|
+
versionId: string;
|
|
72
|
+
path: string;
|
|
73
|
+
offset?: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
}): Promise<VersionFileRead>;
|
|
76
|
+
/** True when these bytes cannot be shown as text: a NUL, or not valid UTF-8. */
|
|
77
|
+
export declare function isBinary(bytes: Uint8Array): boolean;
|
|
78
|
+
/** The text with every unsafe character shown as `\u{hex}`, and how many there were. The bytes are not changed by `--raw` or `--out`. */
|
|
79
|
+
export declare function escapeForTerminal(text: string): {
|
|
80
|
+
text: string;
|
|
81
|
+
escaped: number;
|
|
82
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersionFileInputError = exports.VersionFileNotListedError = exports.VersionFileIntegrityError = exports.VERSION_FILE_INTEGRITY_EXIT = exports.VERSION_FILE_INTEGRITY_CODE = exports.VERSION_FILE_READ_MAX_BYTES = void 0;
|
|
4
|
+
exports.readVersionFile = readVersionFile;
|
|
5
|
+
exports.isBinary = isBinary;
|
|
6
|
+
exports.escapeForTerminal = escapeForTerminal;
|
|
7
|
+
/**
|
|
8
|
+
* `skrr apps version cat`: read the full text of a file of a FROZEN version, and prove it is the file the version's hash covers.
|
|
9
|
+
*
|
|
10
|
+
* A reviewer is asked to approve a version by its `bundleHash`. `apps version show` lists the files with their sizes and
|
|
11
|
+
* digests, but a digest is not something a person can read; `apps file cat` reads the MUTABLE draft, which may have moved
|
|
12
|
+
* since. This reads the version, a slice at a time, and refuses to hand over anything it has not checked itself:
|
|
13
|
+
*
|
|
14
|
+
* 1. the version's file list must hash to its `bundleHash` (`appBundlePreimage`), so the digests below are the ones the
|
|
15
|
+
* version's identity, and any consent bound to it, rests on;
|
|
16
|
+
* 2. the path must be one of those files, exactly;
|
|
17
|
+
* 3. every slice must name the same version, bundle, path, digest and size as that record, start where the last one ended,
|
|
18
|
+
* be exactly as long as was asked for (or what is left), and hash to the `chunkSha256` it states;
|
|
19
|
+
* 4. when the whole file was read, all the slices joined must hash to the record's `sha256` and be `size` bytes long.
|
|
20
|
+
*
|
|
21
|
+
* The server verifies the stored bytes against the same record before it serves a slice (`AppAuthoring/versionFile.js`); this
|
|
22
|
+
* does not take its word for it. Nothing here writes: the caller gets the bytes only after every check has passed, because a
|
|
23
|
+
* file that fails on its last slice has already been half printed by anything that streams. The bytes are bounded (a package
|
|
24
|
+
* file is at most a few hundred KB), so holding them costs nothing, and the bound is enforced so that a server that claims
|
|
25
|
+
* more cannot make a terminal command hold it.
|
|
26
|
+
*
|
|
27
|
+
* A read that starts after byte 0, or stops before the end (`--offset`, `--limit`), cannot check the file's digest; it says so
|
|
28
|
+
* (`wholeFileVerified: false`) and still checks every slice it did read.
|
|
29
|
+
*/
|
|
30
|
+
const node_crypto_1 = require("node:crypto");
|
|
31
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
32
|
+
const json_output_1 = require("./json-output");
|
|
33
|
+
/** The most a read will hold. A package file is far smaller (`APP_DRAFT_LIMITS`); a server that says otherwise is not believed. */
|
|
34
|
+
exports.VERSION_FILE_READ_MAX_BYTES = 8 * 1024 * 1024;
|
|
35
|
+
/** The machine code and exit under which a mismatch is reported. A distinct exit: a harness must not read "6" as an ordinary failure. */
|
|
36
|
+
exports.VERSION_FILE_INTEGRITY_CODE = 'APP_VERSION_FILE_INTEGRITY';
|
|
37
|
+
exports.VERSION_FILE_INTEGRITY_EXIT = 6;
|
|
38
|
+
/** The bytes are not provably the version's. Carries what disagreed; never the bytes. */
|
|
39
|
+
class VersionFileIntegrityError extends Error {
|
|
40
|
+
kind;
|
|
41
|
+
details;
|
|
42
|
+
constructor(kind, message, details = {}) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.kind = kind;
|
|
45
|
+
this.details = details;
|
|
46
|
+
this.name = 'VersionFileIntegrityError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.VersionFileIntegrityError = VersionFileIntegrityError;
|
|
50
|
+
/** The path is not one the version lists. Carries a bounded sample of the ones it does. */
|
|
51
|
+
class VersionFileNotListedError extends Error {
|
|
52
|
+
path;
|
|
53
|
+
listed;
|
|
54
|
+
constructor(path, listed) {
|
|
55
|
+
super(`This version lists no file at "${path}".`);
|
|
56
|
+
this.path = path;
|
|
57
|
+
this.listed = listed;
|
|
58
|
+
this.name = 'VersionFileNotListedError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.VersionFileNotListedError = VersionFileNotListedError;
|
|
62
|
+
/** The caller asked for something that cannot be read (an offset past the end, a file past what the CLI will hold). */
|
|
63
|
+
class VersionFileInputError extends Error {
|
|
64
|
+
code;
|
|
65
|
+
constructor(code, message) {
|
|
66
|
+
super(message);
|
|
67
|
+
this.code = code;
|
|
68
|
+
this.name = 'VersionFileInputError';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.VersionFileInputError = VersionFileInputError;
|
|
72
|
+
const sha256Hex = (bytes) => (0, node_crypto_1.createHash)('sha256').update(bytes).digest('hex');
|
|
73
|
+
/** Base64 as `Buffer.from` would decode it, or null when the text is not canonical base64 (`Buffer` skips what it does not know). */
|
|
74
|
+
function strictBase64(text) {
|
|
75
|
+
if (typeof text !== 'string')
|
|
76
|
+
return null;
|
|
77
|
+
const bytes = Buffer.from(text, 'base64');
|
|
78
|
+
return bytes.toString('base64') === text ? bytes : null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Read `path` of `versionId` from `offset` for at most `limit` bytes (to the end when absent), checking everything the file
|
|
82
|
+
* header lists, and return the bytes only if all of it held. Throws {@link VersionFileIntegrityError},
|
|
83
|
+
* {@link VersionFileNotListedError} or {@link VersionFileInputError}; anything else is the API's own failure and is the
|
|
84
|
+
* caller's to say.
|
|
85
|
+
*/
|
|
86
|
+
async function readVersionFile(reader, input) {
|
|
87
|
+
const { versionId, path } = input;
|
|
88
|
+
const offset = input.offset ?? 0;
|
|
89
|
+
const { version } = await reader.getVersion(versionId);
|
|
90
|
+
// 1. the list the digests come from is the list the version's identity covers
|
|
91
|
+
let preimage;
|
|
92
|
+
try {
|
|
93
|
+
preimage = (0, data_provider_1.appBundlePreimage)(version.files);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
throw new VersionFileIntegrityError('bundle_hash', "The version's file list cannot be hashed, so its digests cannot be tied to its bundle hash.");
|
|
97
|
+
}
|
|
98
|
+
if (sha256Hex(Buffer.from(preimage, 'utf8')) !== version.bundleHash) {
|
|
99
|
+
throw new VersionFileIntegrityError('bundle_hash', "The version's file list does not hash to its bundle hash, so its file digests are not the ones the version is identified by.", { bundleHash: version.bundleHash });
|
|
100
|
+
}
|
|
101
|
+
// 2. exactly one of those files
|
|
102
|
+
const record = version.files.find((file) => file.path === path);
|
|
103
|
+
if (!record) {
|
|
104
|
+
throw new VersionFileNotListedError(path, version.files.map((file) => file.path).slice(0, 50));
|
|
105
|
+
}
|
|
106
|
+
const total = record.size;
|
|
107
|
+
if (total > exports.VERSION_FILE_READ_MAX_BYTES) {
|
|
108
|
+
throw new VersionFileInputError('APP_VERSION_FILE_TOO_LARGE', `"${path}" is ${total} bytes; this command holds at most ${exports.VERSION_FILE_READ_MAX_BYTES} bytes of a file. A package file is far smaller, so the version's record is not believed.`);
|
|
109
|
+
}
|
|
110
|
+
if (offset > total) {
|
|
111
|
+
throw new VersionFileInputError('APP_VERSION_FILE_OFFSET', `--offset ${offset} is past the end of "${path}", which is ${total} bytes.`);
|
|
112
|
+
}
|
|
113
|
+
const end = input.limit === undefined ? total : Math.min(total, offset + input.limit);
|
|
114
|
+
// 3. every slice, against the record
|
|
115
|
+
const parts = [];
|
|
116
|
+
const whole = offset === 0 ? (0, node_crypto_1.createHash)('sha256') : null;
|
|
117
|
+
let at = offset;
|
|
118
|
+
let chunks = 0;
|
|
119
|
+
for (;;) {
|
|
120
|
+
// an empty window (an empty file, or an offset at the end) still asks once, so the server vouches for the file it is empty of
|
|
121
|
+
const want = Math.max(1, Math.min(data_provider_1.APP_VERSION_FILE_LIMITS.chunkBytesMax, end - at));
|
|
122
|
+
const expectedLength = Math.min(want, total - at);
|
|
123
|
+
const chunk = await reader.readChunk(versionId, { path, offset: at, limit: want });
|
|
124
|
+
chunks += 1;
|
|
125
|
+
if (chunk.versionId !== versionId ||
|
|
126
|
+
chunk.bundleHash !== version.bundleHash ||
|
|
127
|
+
chunk.path !== path ||
|
|
128
|
+
chunk.fileSha256 !== record.sha256 ||
|
|
129
|
+
chunk.total !== record.size) {
|
|
130
|
+
throw new VersionFileIntegrityError('record', `A slice of "${path}" does not name the version, path, digest and size the version recorded.`, { at });
|
|
131
|
+
}
|
|
132
|
+
const reachesEnd = at + expectedLength >= total;
|
|
133
|
+
if (chunk.offset !== at ||
|
|
134
|
+
chunk.length !== expectedLength ||
|
|
135
|
+
chunk.done !== reachesEnd ||
|
|
136
|
+
chunk.nextOffset !== (reachesEnd ? null : at + expectedLength)) {
|
|
137
|
+
throw new VersionFileIntegrityError('continuity', `A slice of "${path}" is not the one asked for at byte ${at}.`, { at });
|
|
138
|
+
}
|
|
139
|
+
const bytes = strictBase64(chunk.contentBase64);
|
|
140
|
+
if (bytes === null || bytes.length !== chunk.length || sha256Hex(bytes) !== chunk.chunkSha256) {
|
|
141
|
+
throw new VersionFileIntegrityError('chunk_digest', `The slice of "${path}" at byte ${at} is not the bytes its digest names.`, { at });
|
|
142
|
+
}
|
|
143
|
+
parts.push(bytes);
|
|
144
|
+
whole?.update(bytes);
|
|
145
|
+
at += bytes.length;
|
|
146
|
+
if (at >= end)
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
// 4. the whole file, when the whole file was read
|
|
150
|
+
const joined = Buffer.concat(parts);
|
|
151
|
+
const wholeFile = offset === 0 && at === total;
|
|
152
|
+
if (wholeFile && (joined.length !== record.size || whole?.digest('hex') !== record.sha256)) {
|
|
153
|
+
throw new VersionFileIntegrityError('file_digest', `The slices of "${path}" joined are not the ${record.size} bytes with the digest this version recorded.`, { expectedBytes: record.size, readBytes: joined.length });
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
versionId,
|
|
157
|
+
bundleHash: version.bundleHash,
|
|
158
|
+
path,
|
|
159
|
+
offset,
|
|
160
|
+
length: joined.length,
|
|
161
|
+
total,
|
|
162
|
+
fileSha256: record.sha256,
|
|
163
|
+
chunks,
|
|
164
|
+
wholeFileVerified: wholeFile,
|
|
165
|
+
bytes: joined,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/** True when these bytes cannot be shown as text: a NUL, or not valid UTF-8. */
|
|
169
|
+
function isBinary(bytes) {
|
|
170
|
+
if (bytes.includes(0))
|
|
171
|
+
return true;
|
|
172
|
+
try {
|
|
173
|
+
new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* What a terminal would act on rather than show: C0 controls other than newline, tab and a carriage return that belongs to
|
|
182
|
+
* a CRLF; DEL and C1; and the invisible and direction-changing characters (zero-width, bidi overrides and isolates, line and
|
|
183
|
+
* paragraph separators, the byte-order mark, tag characters). The last group is what makes reviewed code differ from the
|
|
184
|
+
* code a compiler reads ("Trojan Source"), and an escape sequence is what lets a file repaint a reviewer's screen.
|
|
185
|
+
*/
|
|
186
|
+
const TERMINAL_UNSAFE = new RegExp(`[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]|\\r(?!\\n)|${json_output_1.JSON_TERMINAL_CONTROLS.source}`, 'gu');
|
|
187
|
+
/** The text with every unsafe character shown as `\u{hex}`, and how many there were. The bytes are not changed by `--raw` or `--out`. */
|
|
188
|
+
function escapeForTerminal(text) {
|
|
189
|
+
let escaped = 0;
|
|
190
|
+
const out = text.replace(TERMINAL_UNSAFE, (char) => {
|
|
191
|
+
escaped += 1;
|
|
192
|
+
return `\\u{${char.codePointAt(0).toString(16)}}`;
|
|
193
|
+
});
|
|
194
|
+
return { text: out, escaped };
|
|
195
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../base-command';
|
|
2
|
+
import type { InstallationConflictContext } from './appInstallations';
|
|
2
3
|
/**
|
|
3
4
|
* The base of every `skrr apps` command that talks to the API.
|
|
4
5
|
*
|
|
@@ -11,6 +12,12 @@ import { BaseCommand } from '../base-command';
|
|
|
11
12
|
export declare abstract class AppsCommand extends BaseCommand {
|
|
12
13
|
/** A successful response was already received; do not turn a synchronous output failure into a request failure. */
|
|
13
14
|
protected failConfirmedDataOutput(): never;
|
|
15
|
+
/**
|
|
16
|
+
* Say, on STDERR, the operation a confirmed write left (step 4b): its reference, and whether this run wrote anything. Stdout is what it
|
|
17
|
+
* always was. The reference is a support reference and nothing else: it changes neither what the write was nor what to do next, and an
|
|
18
|
+
* answer without one is simply a write no receipt exists for.
|
|
19
|
+
*/
|
|
20
|
+
protected logOperationReference(result: unknown): void;
|
|
14
21
|
/** The id of the app the person named (an id or a slug). */
|
|
15
22
|
protected appId(ref: string): Promise<string>;
|
|
16
23
|
/**
|
|
@@ -18,10 +25,12 @@ export declare abstract class AppsCommand extends BaseCommand {
|
|
|
18
25
|
* are answers with a next step (a bundle that moved while the person decided, data that would be deleted),
|
|
19
26
|
* so they come under their own machine code and exit, and a refusal that is not one of them is the base
|
|
20
27
|
* command's. Never returns.
|
|
28
|
+
*
|
|
29
|
+
* `context` is what the command knows and the refusal's words may use: the installation it was about (`subject`), the
|
|
30
|
+
* version it was installing, moving to or approving, what it was doing, and who an install was for. A command that
|
|
31
|
+
* passes less gets words that say less, never a command with an argument missing (`InstallationConflictContext`).
|
|
21
32
|
*/
|
|
22
|
-
protected failInstallation(error: unknown,
|
|
23
|
-
subject?: string;
|
|
24
|
-
}): never;
|
|
33
|
+
protected failInstallation(error: unknown, context?: InstallationConflictContext): never;
|
|
25
34
|
/**
|
|
26
35
|
* Say what went wrong with a call to the PERSON channel (`apps data put | query`): a document that was not given or
|
|
27
36
|
* is not JSON (before anything was sent), a refusal from the contract's closed set, or a conflict, which is an
|
|
@@ -40,6 +49,8 @@ export declare abstract class AppsCommand extends BaseCommand {
|
|
|
40
49
|
collection?: unknown;
|
|
41
50
|
id?: unknown;
|
|
42
51
|
}>;
|
|
52
|
+
/** The key the write was sent with: when the outcome is unknown, it is what a person asks the server by. */
|
|
53
|
+
idempotencyKey?: string;
|
|
43
54
|
}): never;
|
|
44
55
|
/**
|
|
45
56
|
* Say what went wrong with a REPORT: the refusals only a report makes (a reason the Store does not take, a
|
package/dist/lib/apps-command.js
CHANGED
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppsCommand = void 0;
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
|
+
const write_outcome_1 = require("./write-outcome");
|
|
5
6
|
const base_command_1 = require("../base-command");
|
|
6
7
|
const apps_1 = require("./apps");
|
|
7
8
|
const appInstallations_1 = require("./appInstallations");
|
|
8
9
|
const appsFs_1 = require("./appsFs");
|
|
9
10
|
const appData_1 = require("./appData");
|
|
11
|
+
/**
|
|
12
|
+
* The refusals the person-data write route sends BEFORE it writes, with the status it sends each at: the route's own table,
|
|
13
|
+
* plus the store's `conflict` answer. A generic `unavailable` proves nothing. A confirmed pause or a fence refusal
|
|
14
|
+
* can establish that the write was not applied when it arrives with its documented status.
|
|
15
|
+
*/
|
|
16
|
+
const { unavailable: _notAContractRefusal, ...PERSON_DATA_CONTRACT_REFUSALS } = data_provider_1.APP_PERSON_DATA_REFUSAL_STATUS;
|
|
17
|
+
const PERSON_DATA_WRITE_REFUSALS = {
|
|
18
|
+
...PERSON_DATA_CONTRACT_REFUSALS,
|
|
19
|
+
conflict: 409,
|
|
20
|
+
};
|
|
10
21
|
/**
|
|
11
22
|
* The base of every `skrr apps` command that talks to the API.
|
|
12
23
|
*
|
|
@@ -29,6 +40,17 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
29
40
|
// an arbitrary output exception. BaseCommand drains pending stdio before handling this exit.
|
|
30
41
|
return this.exit(1);
|
|
31
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Say, on STDERR, the operation a confirmed write left (step 4b): its reference, and whether this run wrote anything. Stdout is what it
|
|
45
|
+
* always was. The reference is a support reference and nothing else: it changes neither what the write was nor what to do next, and an
|
|
46
|
+
* answer without one is simply a write no receipt exists for.
|
|
47
|
+
*/
|
|
48
|
+
logOperationReference(result) {
|
|
49
|
+
const reference = (0, appData_1.readOperationReference)(result);
|
|
50
|
+
if (reference) {
|
|
51
|
+
this.logToStderr((0, appData_1.describeOperationReference)(reference));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
32
54
|
/** The id of the app the person named (an id or a slug). */
|
|
33
55
|
async appId(ref) {
|
|
34
56
|
try {
|
|
@@ -51,11 +73,16 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
51
73
|
* are answers with a next step (a bundle that moved while the person decided, data that would be deleted),
|
|
52
74
|
* so they come under their own machine code and exit, and a refusal that is not one of them is the base
|
|
53
75
|
* command's. Never returns.
|
|
76
|
+
*
|
|
77
|
+
* `context` is what the command knows and the refusal's words may use: the installation it was about (`subject`), the
|
|
78
|
+
* version it was installing, moving to or approving, what it was doing, and who an install was for. A command that
|
|
79
|
+
* passes less gets words that say less, never a command with an argument missing (`InstallationConflictContext`).
|
|
54
80
|
*/
|
|
55
|
-
failInstallation(error,
|
|
81
|
+
failInstallation(error, context = {}) {
|
|
82
|
+
const { subject } = context;
|
|
56
83
|
const refusal = (0, apps_1.readAppsRefusal)(error);
|
|
57
84
|
if (refusal && (0, data_provider_1.isAppInstallationConflict)(refusal.error)) {
|
|
58
|
-
const words = (0, appInstallations_1.describeInstallationConflict)(refusal, this.config.bin,
|
|
85
|
+
const words = (0, appInstallations_1.describeInstallationConflict)(refusal, this.config.bin, context);
|
|
59
86
|
if (words !== null) {
|
|
60
87
|
return this.failWithCliError({
|
|
61
88
|
message: words,
|
|
@@ -104,29 +131,32 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
104
131
|
const responseStatus = error?.status;
|
|
105
132
|
const responseCode = error?.code;
|
|
106
133
|
const parsedFailure = (0, appData_1.readPersonDataFailure)(error);
|
|
107
|
-
const
|
|
108
|
-
parsedFailure.
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// `rate` body is a definite "not applied". Any other 429 proves nothing and stays unknown.
|
|
115
|
-
const confirmedRate = parsedFailure?.kind === 'refusal' && parsedFailure.code === 'rate' && responseStatus === 429;
|
|
116
|
-
const sentWrite = Boolean(target.verb) && target.requestStarted;
|
|
117
|
-
// An unrecognized body or a recognizable body with a different HTTP status is not a confirmed app-data response.
|
|
118
|
-
// Both sides use the shared contract. A conflict is an answer, not a refusal, and uses 409.
|
|
119
|
-
const expectedStatus = parsedFailure?.kind === 'conflict'
|
|
120
|
-
? 409
|
|
121
|
-
: parsedFailure?.kind === 'refusal'
|
|
122
|
-
? data_provider_1.APP_PERSON_DATA_REFUSAL_STATUS[parsedFailure.code]
|
|
134
|
+
const unavailableReason = parsedFailure?.kind === 'refusal' && parsedFailure.code === 'unavailable'
|
|
135
|
+
? parsedFailure.reason
|
|
136
|
+
: undefined;
|
|
137
|
+
const unavailableStatuses = unavailableReason === 'installation_suspended'
|
|
138
|
+
? [403, 503]
|
|
139
|
+
: unavailableReason === 'installation_changed'
|
|
140
|
+
? [data_provider_1.APP_PERSON_DATA_REFUSAL_STATUS.unavailable]
|
|
123
141
|
: undefined;
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
const sentWrite = Boolean(target.verb) && target.requestStarted;
|
|
143
|
+
// Which responses prove the write was NOT applied is the shared contract's table, not this method's: a typed refusal
|
|
144
|
+
// counts only at the status its route promises, a 401, 408, 425, 5xx or bare 429 never does, and no answer at all is
|
|
145
|
+
// unknown (`classifyWriteOutcome`, OSK-24076). What is this command's own is the route's list of refusals, below.
|
|
146
|
+
// The route's per-operation limit refuses before any write runs, so a 429 carrying the `rate` body is a definite
|
|
147
|
+
// "not applied". The route also confirms a refusal when it names a pause or the generation fence explicitly.
|
|
148
|
+
const sent = (0, write_outcome_1.requestOfError)(error);
|
|
149
|
+
const outcome = (0, write_outcome_1.classifyRequestOutcome)({
|
|
150
|
+
request: { method: sentWrite ? sent.method || 'PUT' : 'GET', path: sent.path },
|
|
151
|
+
status: typeof responseStatus === 'number' ? responseStatus : undefined,
|
|
152
|
+
body: error?.body,
|
|
153
|
+
transportError: sentWrite && (responseStatus === undefined || responseStatus === 0),
|
|
154
|
+
refusals: unavailableStatuses
|
|
155
|
+
? { ...PERSON_DATA_WRITE_REFUSALS, unavailable: unavailableStatuses }
|
|
156
|
+
: PERSON_DATA_WRITE_REFUSALS,
|
|
157
|
+
// A 2xx the transport could not read as JSON is not the confirmation it looks like.
|
|
158
|
+
bodyConfirms: responseCode !== 'NON_JSON_RESPONSE',
|
|
159
|
+
});
|
|
130
160
|
// A batch conflict identifies one submitted operation. An absent or out-of-range index cannot
|
|
131
161
|
// establish which request the response describes, so do not claim that nothing was written.
|
|
132
162
|
const invalidBatchConflict = sentWrite &&
|
|
@@ -137,28 +167,17 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
137
167
|
parsedFailure.index < 0 ||
|
|
138
168
|
parsedFailure.index >= target.batchTargets.length);
|
|
139
169
|
const unconfirmedResponse = invalidBatchConflict ||
|
|
140
|
-
(sentWrite
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
(responseStatus === 401 ||
|
|
146
|
-
responseStatus === 408 ||
|
|
147
|
-
responseStatus === 425 ||
|
|
148
|
-
(responseStatus === 429 && !confirmedRate) ||
|
|
149
|
-
(!confirmedPause &&
|
|
150
|
-
((responseStatus >= 500 && responseStatus <= 599) ||
|
|
151
|
-
(responseStatus === 403 && !knownForbidden))))) ||
|
|
152
|
-
(responseStatus >= 200 &&
|
|
153
|
-
responseStatus <= 299 &&
|
|
154
|
-
responseCode === 'NON_JSON_RESPONSE')));
|
|
170
|
+
(sentWrite
|
|
171
|
+
? // A refusal this command cannot read as one of its own (`readPersonDataFailure`) proves nothing either.
|
|
172
|
+
outcome.kind === 'unknown' || (outcome.kind === 'rejected' && parsedFailure === null)
|
|
173
|
+
: // Not a write: only a redirect, or a 2xx that is not the JSON it should be, is unconfirmed.
|
|
174
|
+
outcome.reason === 'redirect' || outcome.reason === 'unconfirmed_response');
|
|
155
175
|
const failure = unconfirmedResponse ? null : parsedFailure;
|
|
156
176
|
if (failure === null ||
|
|
157
177
|
(failure.kind === 'refusal' && (failure.code === 'unavailable' || failure.code === 'rate'))) {
|
|
158
178
|
const e = error;
|
|
159
179
|
const status = typeof e?.status === 'number' ? e.status : undefined;
|
|
160
180
|
const code = typeof e?.code === 'string' ? e.code : '';
|
|
161
|
-
const message = typeof e?.message === 'string' ? e.message : '';
|
|
162
181
|
let body;
|
|
163
182
|
try {
|
|
164
183
|
const parsed = typeof e?.body === 'string' ? JSON.parse(e.body) : undefined;
|
|
@@ -174,7 +193,7 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
174
193
|
target.requestStarted &&
|
|
175
194
|
failure?.kind === 'refusal' &&
|
|
176
195
|
failure.code === 'unavailable' &&
|
|
177
|
-
failure.reason === 'installation_suspended') {
|
|
196
|
+
(failure.reason === 'installation_suspended' || failure.reason === 'installation_changed')) {
|
|
178
197
|
return this.failWithCliError({
|
|
179
198
|
code: appData_1.PERSON_DATA_REFUSAL_CODES.unavailable,
|
|
180
199
|
message: (0, appData_1.describePersonDataRefusal)(failure, this.config.bin),
|
|
@@ -184,30 +203,19 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
184
203
|
retryable: false,
|
|
185
204
|
details: {
|
|
186
205
|
reason: failure.reason,
|
|
187
|
-
|
|
206
|
+
...(failure.reason === 'installation_suspended'
|
|
207
|
+
? { retryability: 'after_state_change' }
|
|
208
|
+
: {}),
|
|
188
209
|
outcome: 'not_applied',
|
|
189
210
|
},
|
|
190
211
|
});
|
|
191
212
|
}
|
|
213
|
+
// `unconfirmedResponse` is the table above. Beyond it, only what is not an HTTP status: an error this command's own
|
|
214
|
+
// reader raised for a body it could not use.
|
|
192
215
|
const uncertain = unconfirmedResponse ||
|
|
193
|
-
status === 0 ||
|
|
194
|
-
status === 401 ||
|
|
195
|
-
status === 408 ||
|
|
196
|
-
status === 425 ||
|
|
197
|
-
(status === 429 && !confirmedRate) ||
|
|
198
|
-
(status !== undefined && status >= 300 && status <= 399) ||
|
|
199
|
-
(status === 403 &&
|
|
200
|
-
(failure === null ||
|
|
201
|
-
(failure.kind === 'refusal' &&
|
|
202
|
-
(failure.code === 'rate' || failure.code === 'unavailable')))) ||
|
|
203
|
-
(status !== undefined && status >= 500 && status <= 599) ||
|
|
204
216
|
code === 'APP_DATA_UNCONFIRMED_RESPONSE' ||
|
|
205
217
|
code === 'NON_JSON_RESPONSE' ||
|
|
206
|
-
e?.name === 'SyntaxError'
|
|
207
|
-
(status === undefined &&
|
|
208
|
-
(e?.name === 'AbortError' ||
|
|
209
|
-
/^(ECONN|EPIPE|ETIMEDOUT|UND_ERR_)/.test(code) ||
|
|
210
|
-
/fetch failed|network error/i.test(message)));
|
|
218
|
+
e?.name === 'SyntaxError';
|
|
211
219
|
if (target.verb && target.requestStarted && uncertain) {
|
|
212
220
|
const originalCode = safe(code) ?? safe(body?.code);
|
|
213
221
|
const retryAfterMs = parsedFailure?.kind === 'refusal' &&
|
|
@@ -225,6 +233,16 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
225
233
|
message: (target.verb === 'batch' && target.batchHasGeneratedIds
|
|
226
234
|
? 'The batch may have reached the server, but its outcome is unknown. One or more puts had no ID; if applied, their server-generated IDs may be impossible to identify from this response. Matching document content alone does not prove which write happened. Do not resend blindly; reconcile the batch and any concurrent changes before deciding what to do.'
|
|
227
235
|
: 'The write may have reached the server, but its outcome is unknown. Read the affected data and revisions before deciding what to do; for a batch, check each affected document. Reconcile concurrent changes before writing again.') +
|
|
236
|
+
(target.idempotencyKey
|
|
237
|
+
? (0, appData_1.describeKeyedUnknown)({
|
|
238
|
+
bin: this.config.bin,
|
|
239
|
+
installation: target.installation,
|
|
240
|
+
verb: target.verb,
|
|
241
|
+
collection: target.collection,
|
|
242
|
+
id: target.id,
|
|
243
|
+
key: target.idempotencyKey,
|
|
244
|
+
})
|
|
245
|
+
: '') +
|
|
228
246
|
(status === 401 ? ' A 401 response was received; check your sign-in separately.' : ''),
|
|
229
247
|
...(status === undefined || status === 0 ? {} : { status }),
|
|
230
248
|
...(requestId ? { requestId } : {}),
|
|
@@ -233,6 +251,7 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
233
251
|
details: {
|
|
234
252
|
outcome: 'unknown',
|
|
235
253
|
operation: target.verb,
|
|
254
|
+
...(target.idempotencyKey ? { idempotencyKey: target.idempotencyKey } : {}),
|
|
236
255
|
...(target.verb === 'batch' && target.batchHasGeneratedIds
|
|
237
256
|
? { generatedIdsMayBeUnknown: true }
|
|
238
257
|
: {}),
|
|
@@ -269,18 +288,14 @@ class AppsCommand extends base_command_1.BaseCommand {
|
|
|
269
288
|
...(failure.retryAfterMs === undefined &&
|
|
270
289
|
failure.index === undefined &&
|
|
271
290
|
failure.code !== 'unavailable' &&
|
|
272
|
-
!(target.operation === 'query' &&
|
|
273
|
-
typeof data_provider_1.APP_STORE_CURSOR_INVALID_REASON === 'string' &&
|
|
274
|
-
failure.reason === data_provider_1.APP_STORE_CURSOR_INVALID_REASON)
|
|
291
|
+
!(target.operation === 'query' && (0, appData_1.cursorRefusalReason)(failure.reason) !== undefined)
|
|
275
292
|
? {}
|
|
276
293
|
: {
|
|
277
294
|
details: {
|
|
278
295
|
...(failure.retryAfterMs === undefined ? {} : { retryAfterMs: failure.retryAfterMs }),
|
|
279
296
|
...(failure.index === undefined ? {} : { index: failure.index }),
|
|
280
|
-
...(target.operation === 'query' &&
|
|
281
|
-
|
|
282
|
-
failure.reason === data_provider_1.APP_STORE_CURSOR_INVALID_REASON
|
|
283
|
-
? { reason: data_provider_1.APP_STORE_CURSOR_INVALID_REASON }
|
|
297
|
+
...(target.operation === 'query' && (0, appData_1.cursorRefusalReason)(failure.reason) !== undefined
|
|
298
|
+
? { reason: (0, appData_1.cursorRefusalReason)(failure.reason) }
|
|
284
299
|
: {}),
|
|
285
300
|
...(failure.code !== 'unavailable'
|
|
286
301
|
? {}
|
package/dist/lib/appsCheck.js
CHANGED
|
@@ -84,6 +84,7 @@ function scanSandbox(sections, options) {
|
|
|
84
84
|
})),
|
|
85
85
|
inlineScripts: scan.inlineScripts,
|
|
86
86
|
inlineModules: scan.inlineModules,
|
|
87
|
+
inlineHandlers: scan.inlineHandlers,
|
|
87
88
|
inlineCoverageComplete: scan.inlineCoverageComplete,
|
|
88
89
|
};
|
|
89
90
|
}
|
|
@@ -162,7 +163,7 @@ function formatAppCheckReport(report) {
|
|
|
162
163
|
if (security) {
|
|
163
164
|
lines.push(storeLine(report));
|
|
164
165
|
if (!security.scan.complete) {
|
|
165
|
-
lines.push(`scan:
|
|
166
|
+
lines.push(`scan: did not read everything (${security.scan.filesSkipped} of ${security.scan.filesScanned + security.scan.filesSkipped} files not read in full).`);
|
|
166
167
|
}
|
|
167
168
|
if (security.disabledRules.length > 0) {
|
|
168
169
|
lines.push(`policy: ${security.disabledRules.length} rule(s) switched off: ${security.disabledRules.join(', ')}`);
|
|
@@ -199,7 +200,20 @@ function formatAppCheckReport(report) {
|
|
|
199
200
|
if (issue.fix)
|
|
200
201
|
lines.push(` fix: ${issue.fix}`);
|
|
201
202
|
if (count > 5 && shown === 2) {
|
|
202
|
-
lines.push(` ${count - 3} more matching warning${count - 3 === 1 ? '' : 's'}. Run with --json to see every
|
|
203
|
+
lines.push(` ${count - 3} more matching warning${count - 3 === 1 ? '' : 's'}. Run with --json to see every one the report lists.`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// What the check itself left off: one code repeated in one file past the report's bound. The counts above are exact; this is
|
|
207
|
+
// where the missing lines went, and it reads from the report as it is, so a capped report prints the same way.
|
|
208
|
+
const omitted = report.omitted;
|
|
209
|
+
if (omitted && omitted.count > 0) {
|
|
210
|
+
lines.push('', `${omitted.count} more finding${omitted.count === 1 ? ' is' : 's are'} counted and not listed (the report keeps the first ${omitted.limit} of a code in a file):`);
|
|
211
|
+
for (const group of omitted.groups) {
|
|
212
|
+
lines.push(` ${group.omitted} more ${group.code}${group.path ? ` ${group.path}` : ''}${group.errors > 0 ? ` (${group.errors} of them error${group.errors === 1 ? '' : 's'})` : ''}`);
|
|
213
|
+
}
|
|
214
|
+
const named = omitted.groups.reduce((total, group) => total + group.omitted, 0);
|
|
215
|
+
if (named < omitted.count) {
|
|
216
|
+
lines.push(` ${omitted.count - named} more in other files`);
|
|
203
217
|
}
|
|
204
218
|
}
|
|
205
219
|
if (security) {
|
package/dist/lib/commerce.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export declare function listMarketplaceIncidentAudit(kind: string, incidentId: s
|
|
|
66
66
|
export declare function resolveIntegrityIncident(incidentId: string, body: Record<string, unknown>): Promise<unknown>;
|
|
67
67
|
/** `POST /admin/marketplace/fulfillment-reconciliations/:id/retry` — run it again. */
|
|
68
68
|
export declare function retryFulfillmentReconciliation(reconciliationId: string, body?: Record<string, unknown>): Promise<unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* `POST /admin/marketplace/fulfillment-reconciliations/:id/release-hold` — record a decision
|
|
71
|
+
* to release a refund that a replacement Agent holding the install's id has been holding, and
|
|
72
|
+
* run it. The actor is the authenticated admin; the body carries the reason and evidence.
|
|
73
|
+
*/
|
|
74
|
+
export declare function releaseFulfillmentReplacementHold(reconciliationId: string, body: Record<string, unknown>): Promise<unknown>;
|
|
69
75
|
/** `POST /admin/products` — create a product. Body is the server's schema. */
|
|
70
76
|
export declare function createCommerceProduct(body: Record<string, unknown>): Promise<unknown>;
|
|
71
77
|
/** `POST /admin/offers` — create an offer VERSION. Body is the server's schema. */
|
package/dist/lib/commerce.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.getMarketplaceIncident = getMarketplaceIncident;
|
|
|
8
8
|
exports.listMarketplaceIncidentAudit = listMarketplaceIncidentAudit;
|
|
9
9
|
exports.resolveIntegrityIncident = resolveIntegrityIncident;
|
|
10
10
|
exports.retryFulfillmentReconciliation = retryFulfillmentReconciliation;
|
|
11
|
+
exports.releaseFulfillmentReplacementHold = releaseFulfillmentReplacementHold;
|
|
11
12
|
exports.createCommerceProduct = createCommerceProduct;
|
|
12
13
|
exports.createCommerceOfferVersion = createCommerceOfferVersion;
|
|
13
14
|
exports.validateCommerceOffer = validateCommerceOffer;
|
|
@@ -81,6 +82,14 @@ async function resolveIntegrityIncident(incidentId, body) {
|
|
|
81
82
|
async function retryFulfillmentReconciliation(reconciliationId, body = {}) {
|
|
82
83
|
return (0, api_fetch_1.apiFetch)(`/api/commerce/admin/marketplace/fulfillment-reconciliations/${encodeURIComponent(reconciliationId)}/retry`, { method: 'POST', body });
|
|
83
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* `POST /admin/marketplace/fulfillment-reconciliations/:id/release-hold` — record a decision
|
|
87
|
+
* to release a refund that a replacement Agent holding the install's id has been holding, and
|
|
88
|
+
* run it. The actor is the authenticated admin; the body carries the reason and evidence.
|
|
89
|
+
*/
|
|
90
|
+
async function releaseFulfillmentReplacementHold(reconciliationId, body) {
|
|
91
|
+
return (0, api_fetch_1.apiFetch)(`/api/commerce/admin/marketplace/fulfillment-reconciliations/${encodeURIComponent(reconciliationId)}/release-hold`, { method: 'POST', body });
|
|
92
|
+
}
|
|
84
93
|
/** `POST /admin/products` — create a product. Body is the server's schema. */
|
|
85
94
|
async function createCommerceProduct(body) {
|
|
86
95
|
return (0, api_fetch_1.apiFetch)('/api/commerce/admin/products', { method: 'POST', body });
|