@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,204 @@
|
|
|
1
|
+
import type { AppDataMigrationView } from '@skrr-ai/data-provider';
|
|
2
|
+
/**
|
|
3
|
+
* The installer's explicit DATA MIGRATION of an installation, from a terminal: `apps installations migrate plan | status | stage |
|
|
4
|
+
* validate | abort | cutover | rollback` (docs/architecture/apps-installation-lifecycle-2026-11-10.md, section 11, steps 6b-1 and 6b-2,
|
|
5
|
+
* OSK-23687). The contract and every sentence it says (states, findings, refusals, the disclaimers) are `@skrr-ai/data-provider`'s
|
|
6
|
+
* `appDataMigration.ts`; this file only reads the server's answer through that contract and decides what a terminal prints and which exit
|
|
7
|
+
* code a script gets.
|
|
8
|
+
*
|
|
9
|
+
* WHAT CHANGES LIVE DATA. Only `cutover` and `rollback`, and each needs `--yes`: without it they change nothing and say what they would do.
|
|
10
|
+
* `cutover` copies the installation's documents to an archive (kept for 14 days after it completes, outside the storage quota), replaces
|
|
11
|
+
* them with the converted ones and moves the app to the new version; `rollback` puts the archived ones back and moves the app back.
|
|
12
|
+
*
|
|
13
|
+
* EXIT CODES (distinct on purpose, so a script can tell "it failed" from "it was refused" from "nobody can tell"):
|
|
14
|
+
*
|
|
15
|
+
* 0 the step did what it says: planned, staged, validated, aborted, cut over (`completed`), rolled back, or a status (with or without a migration
|
|
16
|
+
* open)
|
|
17
|
+
* 1 the migration is `failed` (a status of one too), or a finding stopped it: the bounded findings are printed. A cutover that could not
|
|
18
|
+
* finish and undid itself from the archive (`rolled_back`) is also 1: the app is as it was, and the cutover did not happen
|
|
19
|
+
* 4 the server REFUSED the request: `migration_refused` (the reason's words), `forbidden`, a stranger or a missing installation, a
|
|
20
|
+
* `changed` migration, a bad request. A refusal changes nothing the person has not already been told about
|
|
21
|
+
* 5 UNKNOWN: an answer this client cannot read, a loop that made no progress or hit its cap, a validation that could not judge, or a
|
|
22
|
+
* request that may have reached the server and got no readable answer. It is never a success: run `status`
|
|
23
|
+
* 6 NOT ENABLED: HTTP 503 `APP_DATA_MIGRATION_UNAVAILABLE`. A deployment setting, not an outage: nothing was changed and retrying
|
|
24
|
+
* will not help
|
|
25
|
+
*
|
|
26
|
+
* A request that fails in the ordinary way (a sign-in that expired, a rate limit, the server being down on a READ) is the CLI's ordinary
|
|
27
|
+
* failure and keeps its own code. A transport failure on a WRITE is 5, because the write may have landed.
|
|
28
|
+
*
|
|
29
|
+
* WHAT A TERMINAL SHOWS. The state in words, the plan's counts (a collection, a number, the kinds of step: never a step's values), the freeze
|
|
30
|
+
* and staging counts, the validation, the failure's words, the findings (`collection/documentId code at path`: the document id is shown
|
|
31
|
+
* because the person who asks can already list it with `apps data query`; it is printed in the findings and nowhere else, never in an
|
|
32
|
+
* error and never in a hint) and, always, the contract's three sentences. Every value that came from the server is written out safely.
|
|
33
|
+
*/
|
|
34
|
+
export declare const APPS_MIGRATION_EXIT: {
|
|
35
|
+
readonly ok: 0;
|
|
36
|
+
readonly failed: 1;
|
|
37
|
+
readonly refused: 4;
|
|
38
|
+
readonly unknown: 5;
|
|
39
|
+
readonly notEnabled: 6;
|
|
40
|
+
};
|
|
41
|
+
/** The machine codes this command family prints under (`--json` `error.code`), next to the exit each has. */
|
|
42
|
+
export declare const APPS_MIGRATION_CODES: {
|
|
43
|
+
readonly unreadable: "APP_MIGRATION_UNREADABLE";
|
|
44
|
+
readonly outcomeUnknown: "APP_MIGRATION_OUTCOME_UNKNOWN";
|
|
45
|
+
readonly noProgress: "APP_MIGRATION_NO_PROGRESS";
|
|
46
|
+
readonly unfinished: "APP_MIGRATION_UNFINISHED";
|
|
47
|
+
readonly validationGap: "APP_MIGRATION_VALIDATION_GAP";
|
|
48
|
+
readonly freezeNotConfirmed: "APP_MIGRATION_FREEZE_NOT_CONFIRMED";
|
|
49
|
+
readonly cutoverNotConfirmed: "APP_MIGRATION_CUTOVER_NOT_CONFIRMED";
|
|
50
|
+
readonly rollbackNotConfirmed: "APP_MIGRATION_ROLLBACK_NOT_CONFIRMED";
|
|
51
|
+
readonly refused: "APP_MIGRATION_REFUSED";
|
|
52
|
+
readonly forbidden: "APP_MIGRATION_FORBIDDEN";
|
|
53
|
+
readonly notFound: "APP_MIGRATION_NOT_FOUND";
|
|
54
|
+
readonly changed: "APP_MIGRATION_CHANGED";
|
|
55
|
+
readonly rejected: "APP_MIGRATION_REQUEST_REJECTED";
|
|
56
|
+
readonly failed: "APP_MIGRATION_FAILED";
|
|
57
|
+
readonly notEnabled: "APP_DATA_MIGRATION_UNAVAILABLE";
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The most calls one `stage` or `validate` makes. The server carries a bounded batch per call (100 documents, within an 8 second budget) and
|
|
61
|
+
* a migration holds at most 60,000 documents, so about 600 calls is the most a real migration needs; this leaves room above it and still
|
|
62
|
+
* stops a loop that is somehow advancing one document at a time forever. Reaching it is "not finished", never a success.
|
|
63
|
+
*/
|
|
64
|
+
export declare const APPS_MIGRATION_CALLS_MAX = 700;
|
|
65
|
+
/** The installation as a command argument: the id when it is one, else a placeholder (never a string that was not an id). */
|
|
66
|
+
export declare function installationRef(value: unknown): string;
|
|
67
|
+
export interface MigrationExpectation {
|
|
68
|
+
installationId: string;
|
|
69
|
+
/** The migration the caller pinned, when it did: an answer about another one is not the answer. */
|
|
70
|
+
migrationId?: string;
|
|
71
|
+
/** For a plan: the version it was asked for. */
|
|
72
|
+
targetVersionId?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Read the server's answer as a migration of THIS installation (and of THIS migration and version, when the call pinned them), through
|
|
76
|
+
* the contract's reader. `null` is an answer this client does not understand: it then knows nothing and says so, and never calls it a
|
|
77
|
+
* success. A state, a failure code or a finding code the contract does not list is unreadable by the contract's own rule.
|
|
78
|
+
*/
|
|
79
|
+
export declare function readMigration(raw: unknown, expected: MigrationExpectation): AppDataMigrationView | null;
|
|
80
|
+
/** The answer of the status read: `{ migration: view | null }`, or `null` when it is not an answer this client understands. */
|
|
81
|
+
export declare function readMigrationState(raw: unknown, installationId: string): {
|
|
82
|
+
migration: AppDataMigrationView | null;
|
|
83
|
+
} | null;
|
|
84
|
+
/** What is said when the server's answer is not a migration this client understands. It is not a success. */
|
|
85
|
+
export declare function migrationUnreadableMessage(step: MigrationStep, installation: string): string;
|
|
86
|
+
export type MigrationStep = 'plan' | 'status' | 'stage' | 'validate' | 'abort' | 'cutover' | 'rollback';
|
|
87
|
+
export declare const migrationCalls: {
|
|
88
|
+
status: (installation: string) => Promise<unknown>;
|
|
89
|
+
plan: (installation: string, targetVersionId: string) => Promise<unknown>;
|
|
90
|
+
stage: (installation: string, body: {
|
|
91
|
+
migrationId?: string;
|
|
92
|
+
confirmFreeze?: boolean;
|
|
93
|
+
}) => Promise<unknown>;
|
|
94
|
+
validate: (installation: string, body: {
|
|
95
|
+
migrationId?: string;
|
|
96
|
+
}) => Promise<unknown>;
|
|
97
|
+
abort: (installation: string, body: {
|
|
98
|
+
migrationId?: string;
|
|
99
|
+
}) => Promise<unknown>;
|
|
100
|
+
cutover: (installation: string, body: {
|
|
101
|
+
migrationId: string;
|
|
102
|
+
confirmCutover: boolean;
|
|
103
|
+
}) => Promise<unknown>;
|
|
104
|
+
rollback: (installation: string, body: {
|
|
105
|
+
migrationId: string;
|
|
106
|
+
confirmRollback: boolean;
|
|
107
|
+
discardWritesSinceCutover?: boolean;
|
|
108
|
+
}) => Promise<unknown>;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The migration as the lines a person reads. Document ids appear in the findings and nowhere else. Every value from the server is
|
|
112
|
+
* written out safely, and the three sentences of the contract close it, always.
|
|
113
|
+
*/
|
|
114
|
+
export declare function formatMigration(view: AppDataMigrationView, bin: string): string[];
|
|
115
|
+
/** The status of an installation with no migration open, in lines. */
|
|
116
|
+
export declare function formatNoMigration(installation: string, bin: string): string[];
|
|
117
|
+
/** One line per call of a loop, in the words of what that call moved. */
|
|
118
|
+
export declare function progressLine(step: LoopStep, call: number, view: AppDataMigrationView): string;
|
|
119
|
+
export type LoopStep = 'stage' | 'validate' | 'cutover' | 'rollback';
|
|
120
|
+
export type LoopStop = 'done' | 'failed' | 'once' | 'no_progress' | 'call_cap' | 'gap' | 'undone';
|
|
121
|
+
export interface LoopResult {
|
|
122
|
+
view: AppDataMigrationView;
|
|
123
|
+
/** How many server calls this run made. */
|
|
124
|
+
calls: number;
|
|
125
|
+
stopped: LoopStop;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* A call of a loop failed or was unreadable after `calls - 1` calls had been answered. The command says "unknown, run status" for a write
|
|
129
|
+
* it cannot prove did not land, and what it knows of the migration from the calls before.
|
|
130
|
+
*/
|
|
131
|
+
export declare class MigrationLoopError extends Error {
|
|
132
|
+
readonly error: unknown;
|
|
133
|
+
readonly calls: number;
|
|
134
|
+
readonly last: AppDataMigrationView | null;
|
|
135
|
+
readonly unreadable: boolean;
|
|
136
|
+
constructor(input: {
|
|
137
|
+
error?: unknown;
|
|
138
|
+
calls: number;
|
|
139
|
+
last: AppDataMigrationView | null;
|
|
140
|
+
unreadable?: boolean;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Repeat a step that carries a bounded slice of work per call. Stops at the first of: the step's goal (`done`), a `failed` migration,
|
|
145
|
+
* a validation that ended without an answer (`gap`), an answer equal to the one before it (`no_progress`), the cap (`call_cap`), or, with
|
|
146
|
+
* `once`, the first answer. The first call pins no migration unless the caller did; every later one pins the migration the first answer
|
|
147
|
+
* named, so the loop can never carry on with a different one.
|
|
148
|
+
*/
|
|
149
|
+
export declare function runUntilSettled(input: {
|
|
150
|
+
step: LoopStep;
|
|
151
|
+
installationId: string;
|
|
152
|
+
migrationId?: string;
|
|
153
|
+
once: boolean;
|
|
154
|
+
maxCalls?: number;
|
|
155
|
+
call: (migrationId: string | undefined) => Promise<unknown>;
|
|
156
|
+
onProgress?: (line: string) => void;
|
|
157
|
+
}): Promise<LoopResult>;
|
|
158
|
+
/** The exit code a loop's result has. A `once` call that moved the migration along is a step that did what it says. */
|
|
159
|
+
export declare function loopExit(result: LoopResult): number;
|
|
160
|
+
/** What a loop that did not reach its goal says on stderr, so the exit code is never the only thing a person has. */
|
|
161
|
+
export declare function loopStopNote(step: LoopStep, result: LoopResult, bin: string): string | null;
|
|
162
|
+
/**
|
|
163
|
+
* What `stage` says, instead of calling the server, when the migration is only planned and the person has not said `--yes`: staging
|
|
164
|
+
* FREEZES the app, which is theirs to confirm. Names the plan's counts, the three sentences and the command that goes on.
|
|
165
|
+
*/
|
|
166
|
+
export declare function describeFreezeGate(view: AppDataMigrationView, bin: string): string;
|
|
167
|
+
/**
|
|
168
|
+
* What `cutover` says, instead of calling the server, when the migration is validated and the person has not said `--yes`: the cutover REPLACES the
|
|
169
|
+
* installation's stored documents and moves the app to the new version, which is theirs to confirm. States what changes and what is kept.
|
|
170
|
+
*/
|
|
171
|
+
export declare function describeCutoverGate(view: AppDataMigrationView, bin: string): string;
|
|
172
|
+
/** What `rollback` says, instead of calling the server, when the person has not said `--yes`. */
|
|
173
|
+
export declare function describeRollbackGate(view: AppDataMigrationView, bin: string): string;
|
|
174
|
+
export interface MigrationFailureContext {
|
|
175
|
+
step: MigrationStep;
|
|
176
|
+
/** The installation the person named. */
|
|
177
|
+
installation: string;
|
|
178
|
+
/** For a plan: the version it was for. */
|
|
179
|
+
versionId?: string;
|
|
180
|
+
bin: string;
|
|
181
|
+
/** Calls of a loop answered before this one, and the last migration they showed. */
|
|
182
|
+
calls?: number;
|
|
183
|
+
last?: AppDataMigrationView | null;
|
|
184
|
+
}
|
|
185
|
+
export interface MigrationFailure {
|
|
186
|
+
message: string;
|
|
187
|
+
code: string;
|
|
188
|
+
exit: number;
|
|
189
|
+
retryable: false;
|
|
190
|
+
status?: number;
|
|
191
|
+
details?: Record<string, unknown>;
|
|
192
|
+
}
|
|
193
|
+
/** A refusal this client makes itself, from what a read of the migration showed, with the words the server's own would have. Nothing was sent. */
|
|
194
|
+
export declare function describeLocalRefusal(reason: 'no_active_migration', ctx: MigrationFailureContext): MigrationFailure;
|
|
195
|
+
/** What is said when the open migration is not the one the person named. Nothing was sent. */
|
|
196
|
+
export declare function describeNamedMigrationNotOpen(ctx: MigrationFailureContext): MigrationFailure;
|
|
197
|
+
/**
|
|
198
|
+
* Say what a failed request means, in the exit table's terms, or `null` when it is the CLI's ordinary failure (a sign-in that expired, a rate
|
|
199
|
+
* limit, the server being down on a READ): the caller then hands it to the base command, which words those.
|
|
200
|
+
*
|
|
201
|
+
* `write` says the request was one that changes state (plan, stage, validate, abort): for one, a transport failure or a 5xx proves
|
|
202
|
+
* nothing, so it is UNKNOWN (5) and says to run `status`. For a read it is not.
|
|
203
|
+
*/
|
|
204
|
+
export declare function describeMigrationFailure(error: unknown, ctx: MigrationFailureContext, write: boolean): MigrationFailure | null;
|