@skrr-ai/cli 0.1.93 → 0.1.95
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 +153 -165
- package/bin/run.js +32 -0
- package/bin/update-npm-runner.cjs +33 -0
- package/bin/update-session.cjs +194 -0
- package/bin/update-worker.cjs +208 -0
- package/dist/base-command.js +0 -15
- package/dist/commands/agents/operating-plan.d.ts +11 -0
- package/dist/commands/agents/operating-plan.js +54 -0
- package/dist/commands/agents/roles/example.d.ts +11 -0
- package/dist/commands/agents/roles/example.js +30 -0
- package/dist/commands/{commitments/mode.d.ts → agents/roles/export.d.ts} +5 -5
- package/dist/commands/agents/roles/export.js +81 -0
- package/dist/commands/agents/roles/install.d.ts +12 -0
- package/dist/commands/agents/roles/install.js +48 -0
- package/dist/commands/agents/roles/list.d.ts +11 -0
- package/dist/commands/agents/roles/list.js +36 -0
- package/dist/commands/agents/roles/preview.d.ts +14 -0
- package/dist/commands/agents/roles/preview.js +49 -0
- package/dist/commands/agents/roles/withdraw.d.ts +13 -0
- package/dist/commands/agents/roles/withdraw.js +43 -0
- package/dist/commands/code/doctor.d.ts +1 -0
- package/dist/commands/code/doctor.js +6 -0
- package/dist/commands/code/index.js +4 -0
- package/dist/commands/code/install.d.ts +5 -62
- package/dist/commands/code/install.js +86 -279
- package/dist/commands/code/rollback.d.ts +8 -0
- package/dist/commands/code/rollback.js +20 -0
- package/dist/commands/code/update.d.ts +8 -37
- package/dist/commands/code/update.js +134 -213
- package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.d.ts +5 -7
- package/dist/commands/commitments/{autonomy-requests → cadence-requests}/decide.js +13 -15
- package/dist/commands/commitments/cost.d.ts +1 -1
- package/dist/commands/commitments/cost.js +1 -1
- package/dist/commands/commitments/create.d.ts +0 -7
- package/dist/commands/commitments/create.js +9 -98
- package/dist/commands/commitments/delivery.js +3 -21
- package/dist/commands/commitments/doctor.js +28 -27
- package/dist/commands/commitments/effective-policy.js +5 -36
- package/dist/commands/commitments/evaluations.d.ts +15 -0
- package/dist/commands/commitments/evaluations.js +54 -0
- package/dist/commands/commitments/pack/activate.d.ts +11 -0
- package/dist/commands/commitments/pack/activate.js +22 -0
- package/dist/commands/commitments/pack/bind.js +1 -1
- package/dist/commands/commitments/remediate.js +2 -5
- package/dist/commands/commitments/show.js +1 -1
- package/dist/commands/commitments/update.js +9 -9
- package/dist/commands/commitments/wake-capabilities.d.ts +1 -3
- package/dist/commands/commitments/wake-capabilities.js +5 -21
- package/dist/commands/daemon/install.js +4 -0
- package/dist/commands/generate-recovery-code.d.ts +13 -1
- package/dist/commands/generate-recovery-code.js +146 -13
- package/dist/commands/instructions/guide.d.ts +20 -0
- package/dist/commands/instructions/guide.js +84 -0
- package/dist/commands/instructions/install.js +57 -33
- package/dist/commands/instructions/setup.d.ts +14 -0
- package/dist/commands/instructions/setup.js +72 -0
- package/dist/commands/integrations/execute.js +1 -1
- package/dist/commands/login.d.ts +5 -6
- package/dist/commands/login.js +27 -11
- package/dist/commands/logout.js +7 -7
- package/dist/commands/security/overview.d.ts +11 -0
- package/dist/commands/security/overview.js +158 -0
- package/dist/commands/spaces/claim.d.ts +12 -0
- package/dist/commands/spaces/claim.js +42 -0
- package/dist/commands/spaces/ownership.d.ts +12 -0
- package/dist/commands/spaces/ownership.js +46 -0
- package/dist/commands/tasks/cancel-cascade.js +1 -1
- package/dist/commands/tasks/create-tree.d.ts +5 -1
- package/dist/commands/tasks/create-tree.js +35 -7
- package/dist/commands/tasks/interrupt.js +2 -2
- package/dist/commands/tasks/pause-schedule.js +1 -1
- package/dist/commands/token/list.d.ts +3 -5
- package/dist/commands/token/list.js +99 -57
- package/dist/commands/update.d.ts +14 -0
- package/dist/commands/update.js +61 -0
- package/dist/generated/managed-instruction-guides.json +9 -0
- package/dist/hooks/init.d.ts +5 -0
- package/dist/hooks/init.js +27 -0
- package/dist/lib/commitment-product.d.ts +0 -6
- package/dist/lib/commitment-product.js +1 -30
- package/dist/lib/commitments.d.ts +9 -53
- package/dist/lib/commitments.js +23 -146
- package/dist/lib/daemon-installer.d.ts +2 -0
- package/dist/lib/daemon-installer.js +100 -24
- package/dist/lib/first-party-harness-doctor.js +31 -1
- package/dist/lib/first-party-harness-remote-install.d.ts +71 -0
- package/dist/lib/first-party-harness-remote-install.js +310 -0
- package/dist/lib/first-party-harness-remote-update.d.ts +46 -0
- package/dist/lib/first-party-harness-remote-update.js +242 -0
- package/dist/lib/first-party-harness-startup-update.d.ts +26 -0
- package/dist/lib/first-party-harness-startup-update.js +166 -0
- package/dist/lib/first-party-harness-update.d.ts +46 -0
- package/dist/lib/first-party-harness-update.js +289 -0
- package/dist/lib/first-party-harness.js +7 -4
- package/dist/lib/managed-instruction-local.d.ts +12 -0
- package/dist/lib/managed-instruction-local.js +58 -0
- package/dist/lib/managed-instruction-setup.d.ts +35 -0
- package/dist/lib/managed-instruction-setup.js +306 -0
- package/dist/lib/memory-sync.d.ts +1 -0
- package/dist/lib/memory-sync.js +279 -68
- package/dist/lib/northstars.js +1 -1
- package/dist/lib/platform-update-local.d.ts +2 -0
- package/dist/lib/platform-update-local.js +113 -0
- package/dist/lib/platform-update.d.ts +39 -0
- package/dist/lib/platform-update.js +84 -0
- package/dist/lib/profile-machine-identity-guard.d.ts +2 -0
- package/dist/lib/profile-machine-identity-guard.js +13 -0
- package/dist/lib/prompt.d.ts +1 -0
- package/dist/lib/prompt.js +4 -3
- package/dist/lib/roles.d.ts +98 -0
- package/dist/lib/roles.js +45 -0
- package/dist/lib/task-batch.d.ts +9 -0
- package/dist/lib/task-batch.js +94 -17
- package/dist/lib/task-instruction-offer.d.ts +1 -4
- package/dist/lib/task-instruction-offer.js +3 -129
- package/dist/lib/update-check.d.ts +61 -53
- package/dist/lib/update-check.js +453 -314
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.d.ts +45 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +550 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.d.ts +3 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +3 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessReleaseKeys.d.ts +82 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessReleaseKeys.js +105 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.d.ts +110 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +945 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.d.ts +32 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessPermissionControls.js +62 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +35 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +169 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +44 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.d.ts +7 -44
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/sessionPermissionAuthority.js +8 -47
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.d.ts +45 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +545 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.d.ts +3 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +3 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessReleaseKeys.d.ts +82 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessReleaseKeys.js +102 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.d.ts +110 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +923 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.d.ts +32 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessPermissionControls.js +59 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +35 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.d.ts +63 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +163 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.d.ts +2 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +41 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.d.ts +7 -44
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/sessionPermissionAuthority.js +8 -47
- package/dist/node_modules/@skrr-ai/auth-core/package.json +41 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +7362 -7232
- package/dist/node_modules/@skrr-ai/data-provider/package.json +2 -2
- package/docs/v1/README.md +28 -0
- package/docs/v1/api.md +55 -0
- package/docs/v1/changelog.md +16 -0
- package/docs/v1/check-examples.mjs +178 -0
- package/docs/v1/examples/api-readonly.mjs +144 -0
- package/docs/v1/operations.md +87 -0
- package/docs/v1/quickstart.md +71 -0
- package/oclif.manifest.json +46381 -45478
- package/package.json +16 -11
- package/dist/commands/commitments/autonomy.d.ts +0 -30
- package/dist/commands/commitments/autonomy.js +0 -67
- package/dist/commands/commitments/mode.js +0 -58
- package/dist/commands/commitments/pack/promote.d.ts +0 -19
- package/dist/commands/commitments/pack/promote.js +0 -46
- package/dist/commands/commitments/pack/shadow.d.ts +0 -20
- package/dist/commands/commitments/pack/shadow.js +0 -42
|
@@ -1,310 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
const core_1 = require("@oclif/core");
|
|
4
37
|
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* `skrr code install` — install the engine from the terminal.
|
|
11
|
-
*
|
|
12
|
-
* ── Why this command exists ────────────────────────────────────────────────
|
|
13
|
-
*
|
|
14
|
-
* `skrr code`'s not-installed message offered exactly two routes and neither
|
|
15
|
-
* worked without a browser: "In the web app: the runtime menu … → Install", or
|
|
16
|
-
* point the engine-path override at a build you already have — which is the thing
|
|
17
|
-
* you are trying to obtain, and the route that gives up provenance. So the
|
|
18
|
-
* ordinary case for a coding harness (a dev box over SSH, a CI runner, a cloud
|
|
19
|
-
* VM) had no way in (dogfood OSK-276).
|
|
20
|
-
*
|
|
21
|
-
* Nothing underneath was missing. The daemon has performed the verified install
|
|
22
|
-
* since 2026-08-08, and `POST /api/daemons/:id/cli-installers/:provider/install`
|
|
23
|
-
* has fronted it since June. The install was API-exposed and CLI-unreachable —
|
|
24
|
-
* the shape the root `CLAUDE.md` names under CLI ↔ API parity: "an endpoint the
|
|
25
|
-
* API exposes must be reachable from `skrr`."
|
|
26
|
-
*
|
|
27
|
-
* So this adds a SURFACE and no mechanism. Same route the web app posts, same
|
|
28
|
-
* daemon job, same signature verification. A second install path would be a
|
|
29
|
-
* second thing to keep in step with the first, and the first is the one that
|
|
30
|
-
* verifies the signed manifest.
|
|
31
|
-
*/
|
|
32
|
-
class CodeInstall extends base_command_1.BaseCommand {
|
|
33
|
-
static description = `Install the ${auth_core_1.FIRST_PARTY_HARNESS.displayName} engine on this machine, through the daemon`;
|
|
38
|
+
const first_party_harness_update_1 = require("../../lib/first-party-harness-update");
|
|
39
|
+
/** Install through the shared signed pipeline without a cloud login or local daemon. */
|
|
40
|
+
class CodeInstall extends core_1.Command {
|
|
41
|
+
static description = `Install the local ${auth_core_1.FIRST_PARTY_HARNESS.displayName} signed release; use --daemon to install on another machine`;
|
|
34
42
|
static examples = [
|
|
35
43
|
'<%= config.bin %> code install',
|
|
36
44
|
'<%= config.bin %> code install --daemon <daemon-id>',
|
|
37
45
|
'<%= config.bin %> code install --json',
|
|
38
46
|
];
|
|
39
47
|
static flags = {
|
|
40
|
-
daemon: core_1.Flags.string({
|
|
41
|
-
description: 'Which daemon installs it. Defaults to this machine on a Dedicated Runtime, otherwise to the only active one; required when you have several.',
|
|
42
|
-
}),
|
|
48
|
+
daemon: core_1.Flags.string({ description: 'Install on this daemon instead of this computer' }),
|
|
43
49
|
wait: core_1.Flags.boolean({
|
|
44
50
|
default: true,
|
|
45
51
|
allowNo: true,
|
|
46
|
-
description: '
|
|
52
|
+
description: 'Wait for completion. --no-wait returns the local process or remote job.',
|
|
47
53
|
}),
|
|
48
54
|
json: core_1.Flags.boolean({ description: 'Emit the result as JSON' }),
|
|
55
|
+
'target-version': core_1.Flags.string({ description: 'Install this exact signed release' }),
|
|
56
|
+
'allow-downgrade': core_1.Flags.boolean({
|
|
57
|
+
description: 'Allow an explicitly pinned older signed release',
|
|
58
|
+
}),
|
|
49
59
|
};
|
|
50
60
|
async run() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
started = await (0, api_fetch_1.apiFetch)(`/api/daemons/${encodeURIComponent(daemonId)}/cli-installers/${PROVIDER}/install`, { method: 'POST', body: {}, credential: this.resolvedCredential });
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
this.handleApiError(err);
|
|
59
|
-
}
|
|
60
|
-
// The daemon distinguishes three refusals, and only one of them attaches a
|
|
61
|
-
// job worth following:
|
|
62
|
-
//
|
|
63
|
-
// - `alreadyInstalled` carries the LAST job the provider ran — context, not
|
|
64
|
-
// this request's work. Following it replays a stale outcome as though it
|
|
65
|
-
// had just happened: `code install` on an engine one release behind
|
|
66
|
-
// reprinted the previous update's log tail verbatim and reported that job
|
|
67
|
-
// as its result (OSK-10650). The right answer is the daemon's own
|
|
68
|
-
// installDisabledReason plus where the update actually comes from.
|
|
69
|
-
// - `alreadyRunning` carries the LIVE job — following it attaches the user
|
|
70
|
-
// to work that is really in flight, which is what they asked for.
|
|
71
|
-
// - `started` carries the job this request began.
|
|
72
|
-
if (started.alreadyInstalled) {
|
|
73
|
-
if (flags.json) {
|
|
74
|
-
this.log(JSON.stringify({ daemonId, ...started }, null, 2));
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const state = started.provider;
|
|
78
|
-
const reason = state?.installDisabledReason?.trim();
|
|
79
|
-
const version = state?.version?.trim();
|
|
80
|
-
this.log(`Nothing to do on ${daemonId} — ${reason || 'Already installed.'}${version ? ` (${version})` : ''}`);
|
|
81
|
-
if (state?.updatable === true) {
|
|
82
|
-
this.log(`To update it: ${this.config.bin} code update`);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
const why = state?.updateDisabledReason?.trim();
|
|
86
|
-
if (why)
|
|
87
|
-
this.log(`Updating: ${why}`);
|
|
88
|
-
}
|
|
61
|
+
if (this.argv.some((arg) => arg === '--daemon' || arg.startsWith('--daemon='))) {
|
|
62
|
+
const { default: RemoteCodeInstall } = await Promise.resolve().then(() => __importStar(require('../../lib/first-party-harness-remote-install')));
|
|
63
|
+
await this.parse(RemoteCodeInstall);
|
|
64
|
+
await RemoteCodeInstall.run(this.argv, this.config);
|
|
89
65
|
return;
|
|
90
66
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.log(JSON.stringify({ daemonId, ...started }, null, 2));
|
|
67
|
+
const { flags } = await this.parse(CodeInstall);
|
|
68
|
+
if (flags['allow-downgrade'] && !flags['target-version'])
|
|
69
|
+
this.error('--allow-downgrade requires --target-version.');
|
|
70
|
+
try {
|
|
71
|
+
const current = (0, first_party_harness_update_1.getLocalCodeUpdateStatus)();
|
|
72
|
+
if (current.activePath && current.owner === 'managed' && !flags['target-version']) {
|
|
73
|
+
if (flags.json)
|
|
74
|
+
this.log(JSON.stringify({ ...current, alreadyInstalled: true }, null, 2));
|
|
75
|
+
else
|
|
76
|
+
this.log(`${auth_core_1.FIRST_PARTY_HARNESS.displayName} is already installed${current.installedVersion ? ` (${current.installedVersion})` : ''}. Run \`skrr code update\` to update it.`);
|
|
102
77
|
return;
|
|
103
78
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const reason = await this.installerNote(daemonId);
|
|
116
|
-
if (reason) {
|
|
117
|
-
this.log(`Nothing to do on ${daemonId} — ${reason}`);
|
|
79
|
+
const options = {
|
|
80
|
+
version: flags['target-version'],
|
|
81
|
+
allowDowngrade: flags['allow-downgrade'],
|
|
82
|
+
install: true,
|
|
83
|
+
};
|
|
84
|
+
if (!flags.wait) {
|
|
85
|
+
const queued = await (0, first_party_harness_update_1.startLocalCodeUpdate)({ ...options, operation: 'install' });
|
|
86
|
+
if (flags.json)
|
|
87
|
+
this.log(JSON.stringify(queued, null, 2));
|
|
88
|
+
else
|
|
89
|
+
this.log(`${auth_core_1.FIRST_PARTY_HARNESS.displayName} install queued (process ${queued.pid}). Results: ${queued.logPath}; status: skrr code doctor.`);
|
|
118
90
|
return;
|
|
119
91
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
`Check what it offers with \`${this.config.bin} harnesses installers --daemon ${daemonId}\`, and ` +
|
|
124
|
-
`\`${this.config.bin} code doctor\` here once you expect it to have landed.`,
|
|
125
|
-
code: 'INSTALL_NOT_TRACKED',
|
|
126
|
-
exit: 1,
|
|
127
|
-
// Retryable: the daemon is reachable and the call was accepted, so the
|
|
128
|
-
// same command may well work once whatever swallowed it is understood.
|
|
129
|
-
retryable: true,
|
|
92
|
+
const result = await (0, first_party_harness_update_1.updateLocalCode)({
|
|
93
|
+
...options,
|
|
94
|
+
onProgress: flags.json ? undefined : (line) => this.logToStderr(line),
|
|
130
95
|
});
|
|
96
|
+
if (flags.json)
|
|
97
|
+
this.log(JSON.stringify(result, null, 2));
|
|
98
|
+
else
|
|
99
|
+
this.log((0, first_party_harness_update_1.formatLocalCodeUpdate)(result));
|
|
100
|
+
if (result.state === 'failed')
|
|
101
|
+
process.exitCode = 1;
|
|
131
102
|
}
|
|
132
|
-
|
|
103
|
+
catch (error) {
|
|
133
104
|
if (flags.json) {
|
|
134
|
-
this.log(JSON.stringify({
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
const job = await this.followJob(daemonId, jobId, flags.json === true);
|
|
141
|
-
if (flags.json) {
|
|
142
|
-
this.log(JSON.stringify({ daemonId, job }, null, 2));
|
|
143
|
-
}
|
|
144
|
-
if (job.status === 'failed') {
|
|
145
|
-
// The daemon's own message, verbatim. It carries the failure CODE
|
|
146
|
-
// (`runSignedInstall` puts it there deliberately) because "the feed is
|
|
147
|
-
// down" and "the signature did not verify" need very different responses.
|
|
148
|
-
this.failWithCliError({
|
|
149
|
-
message: job.error || 'The install failed and the daemon gave no reason.',
|
|
150
|
-
code: 'INSTALL_FAILED',
|
|
151
|
-
exit: 1,
|
|
152
|
-
retryable: false,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
if (!flags.json) {
|
|
156
|
-
this.log(`${auth_core_1.FIRST_PARTY_HARNESS.displayName} installed. Run \`${this.config.bin} code\` to start it.`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
/** Which daemon the install targets, by the rule every daemon-picking command shares. */
|
|
160
|
-
async resolveTarget(explicit) {
|
|
161
|
-
try {
|
|
162
|
-
return await (0, daemon_target_1.resolveDaemonTarget)({
|
|
163
|
-
explicit,
|
|
164
|
-
local: (0, daemon_target_1.localMachine)({ baseURL: this.cliConfig?.baseURL }),
|
|
165
|
-
listActiveDaemons: () => (0, daemon_target_1.listConnectedDaemons)(this.resolvedCredential),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
catch (err) {
|
|
169
|
-
this.handleApiError(err);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* The daemon id to install through, or the refusal.
|
|
174
|
-
*
|
|
175
|
-
* Refuses rather than guessing when several are active. Picking one would mean
|
|
176
|
-
* installing a hundred megabytes onto a machine the user was not thinking
|
|
177
|
-
* about. The candidates are CONNECTED daemons by the id the installer routes
|
|
178
|
-
* take (`listConnectedDaemons`), so the error names values that work — the
|
|
179
|
-
* Daemon resource list `skrr list-daemons` prints is a different id space
|
|
180
|
-
* (OSK-9993).
|
|
181
|
-
*
|
|
182
|
-
* A Dedicated Runtime's own machine is refused here, before any request. The
|
|
183
|
-
* daemon and the API refuse it too; saying so locally is what keeps the answer
|
|
184
|
-
* the same whether or not this machine's daemon is reachable, and whether or
|
|
185
|
-
* not it has published its id. Another of the owner's machines, named with
|
|
186
|
-
* `--daemon`, is not this machine and goes to the API like anywhere else.
|
|
187
|
-
*/
|
|
188
|
-
installTarget(target) {
|
|
189
|
-
if (target.kind === 'daemon')
|
|
190
|
-
return target.daemonId;
|
|
191
|
-
if (target.kind === 'this-machine') {
|
|
192
|
-
this.failWithCliError({
|
|
193
|
-
message: target.explicit
|
|
194
|
-
? first_party_harness_1.DEDICATED_RUNTIME_ENGINE_MESSAGE
|
|
195
|
-
: `${first_party_harness_1.DEDICATED_RUNTIME_ENGINE_MESSAGE} This command installs on the machine it runs on; ` +
|
|
196
|
-
'to install on another of your machines, name it with --daemon.',
|
|
197
|
-
code: 'DEDICATED_RUNTIME_ENGINE_SHIPS_WITH_IMAGE',
|
|
198
|
-
exit: 1,
|
|
199
|
-
retryable: false,
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (target.kind === 'none') {
|
|
203
|
-
this.failWithCliError({
|
|
204
|
-
message: 'No daemon is connected for this account, so nothing can perform the install. ' +
|
|
205
|
-
`Start the background service on this computer with \`${this.config.bin} daemon start\`, then run this again.`,
|
|
206
|
-
code: 'NO_DAEMON',
|
|
207
|
-
exit: 1,
|
|
208
|
-
retryable: false,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
const { daemons } = target;
|
|
212
|
-
const choices = daemons
|
|
213
|
-
.slice(0, 10)
|
|
214
|
-
.map((d) => ` ${d.id} ${d.name || '—'}`)
|
|
215
|
-
.join('\n');
|
|
216
|
-
this.failWithCliError({
|
|
217
|
-
message: `${daemons.length} connected daemons — say which machine should install the engine:\n${choices}\n` +
|
|
218
|
-
`Pass one with --daemon, or see each daemon id in the DAEMON ID column of \`${this.config.bin} harnesses list\`.`,
|
|
219
|
-
code: 'AMBIGUOUS_DAEMON',
|
|
220
|
-
exit: 1,
|
|
221
|
-
retryable: false,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* What the daemon says about this provider, when it started no job.
|
|
226
|
-
*
|
|
227
|
-
* Read from the SAME list route the web app uses, so the CLI reports the
|
|
228
|
-
* daemon's own words rather than inventing an explanation for silence. Best
|
|
229
|
-
* effort: a failure here means falling back to the honest "does not say why",
|
|
230
|
-
* never to a guess.
|
|
231
|
-
*/
|
|
232
|
-
async installerNote(daemonId) {
|
|
233
|
-
try {
|
|
234
|
-
const res = await (0, api_fetch_1.apiFetch)(`/api/daemons/${encodeURIComponent(daemonId)}/cli-installers`, { credential: this.resolvedCredential });
|
|
235
|
-
// Any accepted spelling: a daemon lists the provider the way it registered it,
|
|
236
|
-
// and during a rename's alias window one that predates or postdates the flip
|
|
237
|
-
// spells it differently.
|
|
238
|
-
const row = (res.providers ?? []).find((p) => (0, auth_core_1.isFirstPartyHarnessProvider)(p.provider));
|
|
239
|
-
const reason = row?.installDisabledReason?.trim();
|
|
240
|
-
if (!reason)
|
|
241
|
-
return null;
|
|
242
|
-
// The version is what turns "Already installed." into something a reader
|
|
243
|
-
// can act on — it is the difference between reassurance and a shrug.
|
|
244
|
-
return row?.version ? `${reason} (${row.version})` : reason;
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Poll the job until it settles, printing each new log line.
|
|
252
|
-
*
|
|
253
|
-
* The daemon already writes a progress log — "Fetching the signed release
|
|
254
|
-
* manifest", "Verified and installed …" — and it is the only account
|
|
255
|
-
* of a hundred-megabyte download the user is waiting on. Printing only the
|
|
256
|
-
* lines not yet seen keeps a poll loop from repeating the whole log.
|
|
257
|
-
*/
|
|
258
|
-
async followJob(daemonId, jobId, quiet) {
|
|
259
|
-
const deadline = Date.now() + MAX_WAIT_MS;
|
|
260
|
-
let printed = 0;
|
|
261
|
-
for (;;) {
|
|
262
|
-
let res;
|
|
263
|
-
try {
|
|
264
|
-
res = await (0, api_fetch_1.apiFetch)(`/api/daemons/${encodeURIComponent(daemonId)}/cli-installers/jobs/${encodeURIComponent(jobId)}`, { credential: this.resolvedCredential });
|
|
265
|
-
}
|
|
266
|
-
catch (err) {
|
|
267
|
-
this.handleApiError(err);
|
|
268
|
-
}
|
|
269
|
-
const job = res.job;
|
|
270
|
-
if (!job) {
|
|
271
|
-
this.failWithCliError({
|
|
272
|
-
message: `The daemon no longer has install job ${jobId}.`,
|
|
273
|
-
code: 'JOB_MISSING',
|
|
274
|
-
exit: 1,
|
|
275
|
-
retryable: false,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
if (!quiet) {
|
|
279
|
-
for (const line of (job.log ?? []).slice(printed))
|
|
280
|
-
this.logToStderr(` ${line}`);
|
|
281
|
-
printed = (job.log ?? []).length;
|
|
282
|
-
}
|
|
283
|
-
if (job.status === 'succeeded' || job.status === 'failed')
|
|
284
|
-
return job;
|
|
285
|
-
if (Date.now() > deadline) {
|
|
286
|
-
// NOT a failure: the daemon is still working, and saying "install
|
|
287
|
-
// failed" because this process ran out of patience would be a lie that
|
|
288
|
-
// sends someone to debug a download that is going fine.
|
|
289
|
-
this.failWithCliError({
|
|
290
|
-
message: `Still installing after ${Math.round(MAX_WAIT_MS / 60000)} minutes — the daemon is ` +
|
|
291
|
-
`still working on job ${jobId}. Check \`${this.config.bin} code doctor\` in a while.`,
|
|
292
|
-
code: 'INSTALL_PENDING',
|
|
293
|
-
exit: 1,
|
|
294
|
-
retryable: true,
|
|
295
|
-
});
|
|
105
|
+
this.log(JSON.stringify({
|
|
106
|
+
component: 'code',
|
|
107
|
+
state: 'failed',
|
|
108
|
+
error: error instanceof Error ? error.message : String(error),
|
|
109
|
+
}));
|
|
110
|
+
process.exitCode = 1;
|
|
296
111
|
}
|
|
297
|
-
|
|
112
|
+
else
|
|
113
|
+
this.error(error instanceof Error ? error : String(error));
|
|
298
114
|
}
|
|
299
115
|
}
|
|
300
116
|
}
|
|
301
117
|
exports.default = CodeInstall;
|
|
302
|
-
/**
|
|
303
|
-
* The daemon's id for skrr's own engine — the CANONICAL spelling, read from the
|
|
304
|
-
* identity module rather than written here. The install route accepts every
|
|
305
|
-
* spelling; canonical is what the platform stores and returns.
|
|
306
|
-
*/
|
|
307
|
-
const PROVIDER = auth_core_1.FIRST_PARTY_HARNESS.provider;
|
|
308
|
-
/** A 100 MB download over a hotel connection is the case this has to survive. */
|
|
309
|
-
const MAX_WAIT_MS = 10 * 60_000;
|
|
310
|
-
const POLL_INTERVAL_MS = 2_000;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
5
|
+
const first_party_harness_update_1 = require("../../lib/first-party-harness-update");
|
|
6
|
+
class CodeRollback extends core_1.Command {
|
|
7
|
+
static description = `Restore the previous verified local ${auth_core_1.FIRST_PARTY_HARNESS.displayName} release`;
|
|
8
|
+
static flags = { json: core_1.Flags.boolean({ description: 'Emit the result as JSON' }) };
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(CodeRollback);
|
|
11
|
+
const result = (0, first_party_harness_update_1.rollbackLocalCode)();
|
|
12
|
+
if (flags.json)
|
|
13
|
+
this.log(JSON.stringify(result, null, 2));
|
|
14
|
+
else
|
|
15
|
+
this.log((0, first_party_harness_update_1.formatLocalCodeUpdate)(result));
|
|
16
|
+
if (result.state === 'failed')
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = CodeRollback;
|
|
@@ -1,46 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* ── Why this command exists ────────────────────────────────────────────────
|
|
6
|
-
*
|
|
7
|
-
* The update verb has been API-exposed and daemon-implemented since OSK-10096 —
|
|
8
|
-
* `POST /api/daemons/:id/cli-installers/:provider/update` re-fetches the signed
|
|
9
|
-
* manifest and installs whatever the channel points at. But the only CLI that
|
|
10
|
-
* reached it was `skrr harnesses install <provider> --update`: a flag on a
|
|
11
|
-
* command a `code` user has no reason to read. On stable that left no
|
|
12
|
-
* discoverable path at all — `code install` answered "Already installed." with
|
|
13
|
-
* no next step, and the channel moving past the installed build was invisible
|
|
14
|
-
* from the surface that owns the engine (OSK-10650).
|
|
15
|
-
*
|
|
16
|
-
* So this adds a SURFACE and no mechanism. Same route `harnesses install
|
|
17
|
-
* --update` posts, same inventory pre-check, same 504 recovery — one update
|
|
18
|
-
* path, spelled where the engine's users look.
|
|
19
|
-
*/
|
|
20
|
-
export default class CodeUpdate extends BaseCommand {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
/** The default target is this computer; an explicit daemon keeps the remote API path. */
|
|
3
|
+
export default class CodeUpdate extends Command {
|
|
21
4
|
static description: string;
|
|
22
5
|
static examples: string[];
|
|
23
6
|
static flags: {
|
|
24
7
|
daemon: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
25
8
|
wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
26
9
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
check: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'target-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
'allow-downgrade': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
rollback: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'startup-checks': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
27
15
|
};
|
|
28
16
|
run(): Promise<void>;
|
|
29
|
-
/** Which daemon the update targets, by the rule every daemon-picking command shares. */
|
|
30
|
-
private resolveTarget;
|
|
31
|
-
/**
|
|
32
|
-
* The daemon id to update through, or the refusal — identical rules to
|
|
33
|
-
* `code install`: a Dedicated Runtime's own machine is image-managed, several
|
|
34
|
-
* connected daemons get named rather than guessed.
|
|
35
|
-
*/
|
|
36
|
-
private updateTarget;
|
|
37
|
-
/**
|
|
38
|
-
* Start the update, and survive a gateway that cut the request off — the same
|
|
39
|
-
* 504 recovery `harnesses install --update` uses: the relay can drop the
|
|
40
|
-
* answer while the daemon runs the job it started, so on a server-side
|
|
41
|
-
* failure we ask the daemon and follow the job it reports.
|
|
42
|
-
*/
|
|
43
|
-
private start;
|
|
44
|
-
/** Follow a job to its end, or report why it could not be followed (and return nothing). */
|
|
45
|
-
private follow;
|
|
46
17
|
}
|