@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,242 +1,163 @@
|
|
|
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
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* `skrr code update` — pull the engine's signed release down through the daemon.
|
|
11
|
-
*
|
|
12
|
-
* ── Why this command exists ────────────────────────────────────────────────
|
|
13
|
-
*
|
|
14
|
-
* The update verb has been API-exposed and daemon-implemented since OSK-10096 —
|
|
15
|
-
* `POST /api/daemons/:id/cli-installers/:provider/update` re-fetches the signed
|
|
16
|
-
* manifest and installs whatever the channel points at. But the only CLI that
|
|
17
|
-
* reached it was `skrr harnesses install <provider> --update`: a flag on a
|
|
18
|
-
* command a `code` user has no reason to read. On stable that left no
|
|
19
|
-
* discoverable path at all — `code install` answered "Already installed." with
|
|
20
|
-
* no next step, and the channel moving past the installed build was invisible
|
|
21
|
-
* from the surface that owns the engine (OSK-10650).
|
|
22
|
-
*
|
|
23
|
-
* So this adds a SURFACE and no mechanism. Same route `harnesses install
|
|
24
|
-
* --update` posts, same inventory pre-check, same 504 recovery — one update
|
|
25
|
-
* path, spelled where the engine's users look.
|
|
26
|
-
*/
|
|
27
|
-
class CodeUpdate extends base_command_1.BaseCommand {
|
|
28
|
-
static description = `Update 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
|
+
const first_party_harness_startup_update_1 = require("../../lib/first-party-harness-startup-update");
|
|
40
|
+
/** The default target is this computer; an explicit daemon keeps the remote API path. */
|
|
41
|
+
class CodeUpdate extends core_1.Command {
|
|
42
|
+
static description = `Check or update the local ${auth_core_1.FIRST_PARTY_HARNESS.displayName} signed release; use --daemon to update another machine`;
|
|
29
43
|
static examples = [
|
|
30
44
|
'<%= config.bin %> code update',
|
|
45
|
+
'<%= config.bin %> code update --check',
|
|
31
46
|
'<%= config.bin %> code update --daemon <daemon-id>',
|
|
32
|
-
'<%= config.bin %> code update --
|
|
47
|
+
'<%= config.bin %> code update --rollback',
|
|
33
48
|
];
|
|
34
49
|
static flags = {
|
|
35
|
-
daemon: core_1.Flags.string({
|
|
36
|
-
description: 'Which daemon runs the update. Defaults to this machine on a Dedicated Runtime, otherwise to the only active one; required when you have several.',
|
|
37
|
-
}),
|
|
50
|
+
daemon: core_1.Flags.string({ description: 'Run the update on this daemon instead of this computer' }),
|
|
38
51
|
wait: core_1.Flags.boolean({
|
|
39
52
|
default: true,
|
|
40
53
|
allowNo: true,
|
|
41
|
-
description: '
|
|
54
|
+
description: 'Wait for completion. --no-wait returns the local process or remote job.',
|
|
42
55
|
}),
|
|
43
56
|
json: core_1.Flags.boolean({ description: 'Emit the result as JSON' }),
|
|
57
|
+
check: core_1.Flags.boolean({
|
|
58
|
+
description: 'Check the signed release channel without downloading or changing the engine',
|
|
59
|
+
}),
|
|
60
|
+
'target-version': core_1.Flags.string({ description: 'Install this exact signed release' }),
|
|
61
|
+
'allow-downgrade': core_1.Flags.boolean({
|
|
62
|
+
description: 'Allow an explicitly pinned older signed release',
|
|
63
|
+
}),
|
|
64
|
+
rollback: core_1.Flags.boolean({ description: 'Restore the previous verified release' }),
|
|
65
|
+
'startup-checks': core_1.Flags.string({
|
|
66
|
+
options: ['on', 'off'],
|
|
67
|
+
description: 'Enable or disable new-session update checks without updating the engine',
|
|
68
|
+
}),
|
|
44
69
|
};
|
|
45
70
|
async run() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
inventory = await (0, cli_installers_1.listCliInstallers)(daemonId, this.resolvedCredential);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
this.handleApiError(err);
|
|
57
|
-
}
|
|
58
|
-
const row = (inventory.providers ?? []).find((p) => (0, auth_core_1.isFirstPartyHarnessProvider)(p.provider));
|
|
59
|
-
if (!row) {
|
|
60
|
-
this.failWithCliError({
|
|
61
|
-
message: `${auth_core_1.FIRST_PARTY_HARNESS.displayName} is not installed on ${daemonId}. ` +
|
|
62
|
-
`Install it with \`${this.config.bin} code install\`.`,
|
|
63
|
-
code: 'NOT_INSTALLED',
|
|
64
|
-
exit: 1,
|
|
65
|
-
retryable: false,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
if (row.updatable === undefined) {
|
|
69
|
-
this.failWithCliError({
|
|
70
|
-
message: `The daemon ${daemonId} (${inventory.daemonVersion ?? 'version not reported'}) cannot update ${auth_core_1.FIRST_PARTY_HARNESS.displayName}: it predates managed updates. ` +
|
|
71
|
-
`Update the daemon, then run this again.`,
|
|
72
|
-
code: 'DAEMON_UPDATE_UNSUPPORTED',
|
|
73
|
-
exit: 1,
|
|
74
|
-
retryable: false,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
if (!row.updatable) {
|
|
78
|
-
this.failWithCliError({
|
|
79
|
-
message: row.updateDisabledReason?.trim() ||
|
|
80
|
-
`${auth_core_1.FIRST_PARTY_HARNESS.displayName}: the daemon cannot update it here.`,
|
|
81
|
-
code: 'CLI_NOT_UPDATABLE',
|
|
82
|
-
exit: 1,
|
|
83
|
-
retryable: false,
|
|
84
|
-
});
|
|
71
|
+
// Preserve all authenticated remote flags (--profile, --workspace, --token)
|
|
72
|
+
// without importing or initializing the auth stack for a local operation.
|
|
73
|
+
if (this.argv.some((arg) => arg === '--daemon' || arg.startsWith('--daemon='))) {
|
|
74
|
+
const { default: RemoteCodeUpdate } = await Promise.resolve().then(() => __importStar(require('../../lib/first-party-harness-remote-update')));
|
|
75
|
+
await this.parse(RemoteCodeUpdate);
|
|
76
|
+
await RemoteCodeUpdate.run(this.argv, this.config);
|
|
77
|
+
return;
|
|
85
78
|
}
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
79
|
+
const { flags } = await this.parse(CodeUpdate);
|
|
80
|
+
if (flags['startup-checks']) {
|
|
81
|
+
if (flags.daemon ||
|
|
82
|
+
flags.check ||
|
|
83
|
+
flags.rollback ||
|
|
84
|
+
flags['target-version'] ||
|
|
85
|
+
flags['allow-downgrade'] ||
|
|
86
|
+
!flags.wait)
|
|
87
|
+
this.error('--startup-checks changes only the local preference; use it without other update controls.');
|
|
88
|
+
const setting = (0, first_party_harness_startup_update_1.configureCodeStartupChecks)(flags['startup-checks'] === 'on');
|
|
89
|
+
if (flags.json)
|
|
90
|
+
this.log(JSON.stringify({
|
|
91
|
+
component: 'code',
|
|
92
|
+
state: 'configured',
|
|
93
|
+
startupChecks: setting.enabled,
|
|
94
|
+
preferencesPath: setting.preferencesPath,
|
|
95
|
+
}, null, 2));
|
|
96
|
+
else
|
|
97
|
+
this.log(`${auth_core_1.FIRST_PARTY_HARNESS.displayName} startup update checks ${setting.enabled ? 'enabled' : 'disabled'}. Change this with \`skrr code update --startup-checks ${setting.enabled ? 'off' : 'on'}\`.`);
|
|
88
98
|
return;
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
99
|
+
}
|
|
100
|
+
if (flags.rollback &&
|
|
101
|
+
(flags.check || flags['target-version'] || flags['allow-downgrade'] || !flags.wait))
|
|
102
|
+
this.error('--rollback cannot be combined with --check, --target-version, --allow-downgrade or --no-wait.');
|
|
103
|
+
if (flags['allow-downgrade'] && !flags['target-version'])
|
|
104
|
+
this.error('--allow-downgrade requires --target-version.');
|
|
105
|
+
const options = {
|
|
106
|
+
version: flags['target-version'],
|
|
107
|
+
allowDowngrade: flags['allow-downgrade'],
|
|
108
|
+
force: true,
|
|
109
|
+
};
|
|
110
|
+
try {
|
|
111
|
+
const current = (0, first_party_harness_update_1.getLocalCodeUpdateStatus)();
|
|
112
|
+
if (!flags.check && !flags.rollback && !current.activePath && current.owner === 'managed') {
|
|
113
|
+
const missing = {
|
|
114
|
+
...current,
|
|
115
|
+
state: 'failed',
|
|
116
|
+
code: 'NOT_INSTALLED',
|
|
117
|
+
message: `${auth_core_1.FIRST_PARTY_HARNESS.displayName} is not installed on this computer. Run \`skrr code install\`.`,
|
|
118
|
+
};
|
|
119
|
+
if (flags.json)
|
|
120
|
+
this.log(JSON.stringify(missing, null, 2));
|
|
121
|
+
else
|
|
122
|
+
this.log((0, first_party_harness_update_1.formatLocalCodeUpdate)(missing));
|
|
123
|
+
process.exitCode = 1;
|
|
93
124
|
return;
|
|
94
125
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (flags.json) {
|
|
102
|
-
this.log(JSON.stringify({ daemonId, ...start }, null, 2));
|
|
126
|
+
if (!flags.check && !flags.rollback && !flags.wait) {
|
|
127
|
+
const queued = await (0, first_party_harness_update_1.startLocalCodeUpdate)(options);
|
|
128
|
+
if (flags.json)
|
|
129
|
+
this.log(JSON.stringify(queued, null, 2));
|
|
130
|
+
else
|
|
131
|
+
this.log(`${auth_core_1.FIRST_PARTY_HARNESS.displayName} update queued (process ${queued.pid}). Results: ${queued.logPath}; status: skrr code doctor.`);
|
|
103
132
|
return;
|
|
104
133
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
134
|
+
const result = flags.check
|
|
135
|
+
? await (0, first_party_harness_update_1.checkLocalCodeUpdate)(options)
|
|
136
|
+
: flags.rollback
|
|
137
|
+
? (0, first_party_harness_update_1.rollbackLocalCode)()
|
|
138
|
+
: await (0, first_party_harness_update_1.updateLocalCode)({
|
|
139
|
+
...options,
|
|
140
|
+
onProgress: flags.json ? undefined : (line) => this.logToStderr(line),
|
|
141
|
+
});
|
|
142
|
+
if (flags.json)
|
|
143
|
+
this.log(JSON.stringify(result, null, 2));
|
|
144
|
+
else
|
|
145
|
+
this.log((0, first_party_harness_update_1.formatLocalCodeUpdate)(result));
|
|
146
|
+
if (result.state === 'failed' || result.state === 'check-failed')
|
|
117
147
|
process.exitCode = 1;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (job.status === 'failed') {
|
|
121
|
-
this.failWithCliError({
|
|
122
|
-
message: job.error || 'The update failed and the daemon gave no reason.',
|
|
123
|
-
code: 'UPDATE_FAILED',
|
|
124
|
-
exit: 1,
|
|
125
|
-
retryable: false,
|
|
126
|
-
});
|
|
127
148
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
local: (0, daemon_target_1.localMachine)({ baseURL: this.cliConfig?.baseURL }),
|
|
137
|
-
listActiveDaemons: () => (0, daemon_target_1.listConnectedDaemons)(this.resolvedCredential),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
catch (err) {
|
|
141
|
-
this.handleApiError(err);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The daemon id to update through, or the refusal — identical rules to
|
|
146
|
-
* `code install`: a Dedicated Runtime's own machine is image-managed, several
|
|
147
|
-
* connected daemons get named rather than guessed.
|
|
148
|
-
*/
|
|
149
|
-
updateTarget(target) {
|
|
150
|
-
if (target.kind === 'daemon')
|
|
151
|
-
return target.daemonId;
|
|
152
|
-
if (target.kind === 'this-machine') {
|
|
153
|
-
this.failWithCliError({
|
|
154
|
-
message: target.explicit
|
|
155
|
-
? first_party_harness_1.DEDICATED_RUNTIME_ENGINE_MESSAGE
|
|
156
|
-
: `${first_party_harness_1.DEDICATED_RUNTIME_ENGINE_MESSAGE} This command updates the machine it runs on; ` +
|
|
157
|
-
'to update another of your machines, name it with --daemon.',
|
|
158
|
-
code: 'DEDICATED_RUNTIME_ENGINE_SHIPS_WITH_IMAGE',
|
|
159
|
-
exit: 1,
|
|
160
|
-
retryable: false,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
if (target.kind === 'none') {
|
|
164
|
-
this.failWithCliError({
|
|
165
|
-
message: 'No daemon is connected for this account, so nothing can perform the update. ' +
|
|
166
|
-
`Start the background service on this computer with \`${this.config.bin} daemon start\`, then run this again.`,
|
|
167
|
-
code: 'NO_DAEMON',
|
|
168
|
-
exit: 1,
|
|
169
|
-
retryable: false,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
const { daemons } = target;
|
|
173
|
-
const choices = daemons
|
|
174
|
-
.slice(0, 10)
|
|
175
|
-
.map((d) => ` ${d.id} ${d.name || '—'}`)
|
|
176
|
-
.join('\n');
|
|
177
|
-
this.failWithCliError({
|
|
178
|
-
message: `${daemons.length} connected daemons — say which machine should update the engine:\n${choices}\n` +
|
|
179
|
-
`Pass one with --daemon, or see each daemon id in the DAEMON ID column of \`${this.config.bin} harnesses list\`.`,
|
|
180
|
-
code: 'AMBIGUOUS_DAEMON',
|
|
181
|
-
exit: 1,
|
|
182
|
-
retryable: false,
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Start the update, and survive a gateway that cut the request off — the same
|
|
187
|
-
* 504 recovery `harnesses install --update` uses: the relay can drop the
|
|
188
|
-
* answer while the daemon runs the job it started, so on a server-side
|
|
189
|
-
* failure we ask the daemon and follow the job it reports.
|
|
190
|
-
*/
|
|
191
|
-
async start(daemonId, json) {
|
|
192
|
-
try {
|
|
193
|
-
return await (0, cli_installers_1.startManagedCliUpdate)(daemonId, PROVIDER, this.resolvedCredential);
|
|
194
|
-
}
|
|
195
|
-
catch (err) {
|
|
196
|
-
const status = err.status ?? 0;
|
|
197
|
-
if (status >= 500 || status === 408) {
|
|
198
|
-
const job = await (0, cli_installers_1.jobStartedDespiteTimeout)(daemonId, PROVIDER, this.resolvedCredential);
|
|
199
|
-
if (job?.id) {
|
|
200
|
-
if (!json) {
|
|
201
|
-
this.logToStderr(`The request to ${daemonId} did not come back (HTTP ${status}), but the daemon started job ${job.id}. Following it.`);
|
|
202
|
-
}
|
|
203
|
-
return { started: true, job };
|
|
204
|
-
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (flags.json) {
|
|
151
|
+
this.log(JSON.stringify({
|
|
152
|
+
component: 'code',
|
|
153
|
+
state: 'failed',
|
|
154
|
+
error: error instanceof Error ? error.message : String(error),
|
|
155
|
+
}));
|
|
156
|
+
process.exitCode = 1;
|
|
205
157
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/** Follow a job to its end, or report why it could not be followed (and return nothing). */
|
|
211
|
-
async follow(daemonId, jobId, json) {
|
|
212
|
-
const outcome = await (0, cli_installers_1.followManagedCliInstallJob)({
|
|
213
|
-
daemonId,
|
|
214
|
-
jobId,
|
|
215
|
-
credential: this.resolvedCredential,
|
|
216
|
-
onLogLine: json ? undefined : (line) => this.logToStderr(` ${line}`),
|
|
217
|
-
});
|
|
218
|
-
if (outcome.kind === 'missing') {
|
|
219
|
-
this.failWithCliError({
|
|
220
|
-
message: `The daemon no longer has update job ${jobId}.`,
|
|
221
|
-
code: 'JOB_MISSING',
|
|
222
|
-
exit: 1,
|
|
223
|
-
retryable: false,
|
|
224
|
-
});
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
if (outcome.kind === 'timeout') {
|
|
228
|
-
this.failWithCliError({
|
|
229
|
-
message: `Still updating after ${Math.round(cli_installers_1.INSTALL_MAX_WAIT_MS / 60000)} minutes — the daemon is ` +
|
|
230
|
-
`still working on job ${jobId}. Check \`${this.config.bin} code doctor\` in a while.`,
|
|
231
|
-
code: 'UPDATE_PENDING',
|
|
232
|
-
exit: 1,
|
|
233
|
-
retryable: true,
|
|
234
|
-
});
|
|
235
|
-
return undefined;
|
|
158
|
+
else
|
|
159
|
+
this.error(error instanceof Error ? error : String(error));
|
|
236
160
|
}
|
|
237
|
-
return outcome.job;
|
|
238
161
|
}
|
|
239
162
|
}
|
|
240
163
|
exports.default = CodeUpdate;
|
|
241
|
-
/** Same canonical provider id `code install` posts — read from the identity module. */
|
|
242
|
-
const PROVIDER = auth_core_1.FIRST_PARTY_HARNESS.provider;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { BaseCommand } from '../../../base-command';
|
|
2
2
|
/**
|
|
3
|
-
* `skrr commitments
|
|
3
|
+
* `skrr commitments cadence-requests decide <id> <request-id> --approve`
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* wake through the same resolver a bypass-mode agent would have used; rejecting
|
|
9
|
-
* records the no and leaves the cadence alone.
|
|
5
|
+
* The server records concrete cadence proposals requiring an owner decision.
|
|
6
|
+
* Approval changes only the check schedule; it grants no execution permissions.
|
|
7
|
+
* Rejection records the decision and leaves the schedule unchanged.
|
|
10
8
|
*
|
|
11
9
|
* List the pending ones with `skrr commitments show <id>`.
|
|
12
10
|
*/
|
|
13
|
-
export default class
|
|
11
|
+
export default class CommitmentsCadenceRequestsDecide extends BaseCommand {
|
|
14
12
|
static description: string;
|
|
15
13
|
static examples: string[];
|
|
16
14
|
static args: {
|
|
@@ -4,44 +4,42 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const commitments_1 = require("../../../lib/commitments");
|
|
6
6
|
/**
|
|
7
|
-
* `skrr commitments
|
|
7
|
+
* `skrr commitments cadence-requests decide <id> <request-id> --approve`
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* wake through the same resolver a bypass-mode agent would have used; rejecting
|
|
13
|
-
* records the no and leaves the cadence alone.
|
|
9
|
+
* The server records concrete cadence proposals requiring an owner decision.
|
|
10
|
+
* Approval changes only the check schedule; it grants no execution permissions.
|
|
11
|
+
* Rejection records the decision and leaves the schedule unchanged.
|
|
14
12
|
*
|
|
15
13
|
* List the pending ones with `skrr commitments show <id>`.
|
|
16
14
|
*/
|
|
17
|
-
class
|
|
15
|
+
class CommitmentsCadenceRequestsDecide extends base_command_1.BaseCommand {
|
|
18
16
|
static description = 'Approve or reject an agent-proposed commitment cadence change';
|
|
19
17
|
static examples = [
|
|
20
|
-
'<%= config.bin %> commitments
|
|
21
|
-
'<%= config.bin %> commitments
|
|
18
|
+
'<%= config.bin %> commitments cadence-requests decide obj_abc123 req_xyz --approve',
|
|
19
|
+
'<%= config.bin %> commitments cadence-requests decide obj_abc123 req_xyz --reject',
|
|
22
20
|
];
|
|
23
21
|
static args = {
|
|
24
22
|
commitmentId: core_1.Args.string({ ignoreStdin: true, description: 'Commitment ID', required: true }),
|
|
25
23
|
requestId: core_1.Args.string({
|
|
26
24
|
ignoreStdin: true,
|
|
27
|
-
description: 'Pending
|
|
25
|
+
description: 'Pending cadence request ID',
|
|
28
26
|
required: true,
|
|
29
27
|
}),
|
|
30
28
|
};
|
|
31
29
|
static flags = {
|
|
32
30
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
33
|
-
approve: core_1.Flags.boolean({ description: 'Approve
|
|
31
|
+
approve: core_1.Flags.boolean({ description: 'Approve the cadence change', exclusive: ['reject'] }),
|
|
34
32
|
reject: core_1.Flags.boolean({ description: 'Reject the proposal', exclusive: ['approve'] }),
|
|
35
33
|
};
|
|
36
34
|
async run() {
|
|
37
35
|
this.requireAuth();
|
|
38
|
-
const { args, flags } = await this.parse(
|
|
36
|
+
const { args, flags } = await this.parse(CommitmentsCadenceRequestsDecide);
|
|
39
37
|
if (!flags.approve && !flags.reject) {
|
|
40
38
|
this.error('Pass --approve or --reject.');
|
|
41
39
|
}
|
|
42
40
|
let result;
|
|
43
41
|
try {
|
|
44
|
-
result = await commitments_1.commitmentApi.
|
|
42
|
+
result = await commitments_1.commitmentApi.decideCadenceRequest(args.commitmentId, args.requestId, Boolean(flags.approve));
|
|
45
43
|
}
|
|
46
44
|
catch (err) {
|
|
47
45
|
this.handleApiError(err);
|
|
@@ -51,8 +49,8 @@ class CommitmentsAutonomyRequestsDecide extends base_command_1.BaseCommand {
|
|
|
51
49
|
return;
|
|
52
50
|
}
|
|
53
51
|
this.log(flags.approve
|
|
54
|
-
? `Approved ${args.requestId} — the proposed
|
|
52
|
+
? `Approved ${args.requestId} — the proposed cadence was applied.`
|
|
55
53
|
: `Rejected ${args.requestId} — the cadence is unchanged.`);
|
|
56
54
|
}
|
|
57
55
|
}
|
|
58
|
-
exports.default =
|
|
56
|
+
exports.default = CommitmentsCadenceRequestsDecide;
|
|
@@ -32,7 +32,7 @@ export declare function resolveCostWindow(input?: {
|
|
|
32
32
|
* Money on this path has no other bound the operator can read: a Commitment's
|
|
33
33
|
* agent turns are `AgentOutcome` rows carrying no cost fields, so
|
|
34
34
|
* `spendLimitDailyUsd` cannot see them and `maxRunsPerDay` IS the spend control
|
|
35
|
-
* (see `
|
|
35
|
+
* (see `executionBudget.maxRunsPerDay` in the API's own schema note). This is
|
|
36
36
|
* the read that says what those runs actually cost.
|
|
37
37
|
*
|
|
38
38
|
* `metrics` shows the daily rows; this sums the closed ones over a window and,
|
|
@@ -50,7 +50,7 @@ function resolveCostWindow(input = {}, now = new Date()) {
|
|
|
50
50
|
* Money on this path has no other bound the operator can read: a Commitment's
|
|
51
51
|
* agent turns are `AgentOutcome` rows carrying no cost fields, so
|
|
52
52
|
* `spendLimitDailyUsd` cannot see them and `maxRunsPerDay` IS the spend control
|
|
53
|
-
* (see `
|
|
53
|
+
* (see `executionBudget.maxRunsPerDay` in the API's own schema note). This is
|
|
54
54
|
* the read that says what those runs actually cost.
|
|
55
55
|
*
|
|
56
56
|
* `metrics` shows the daily rows; this sums the closed ones over a window and,
|
|
@@ -26,11 +26,6 @@ export declare function createCadenceFromFlags({ eventDriven, cadence: cadenceIn
|
|
|
26
26
|
* be said out loud at the CLI boundary; otherwise a successful create response
|
|
27
27
|
* reads like the requested autonomy is live when something else is running.
|
|
28
28
|
*/
|
|
29
|
-
export declare function autonomyStagingNotice({ payload, commitment, bin, }: {
|
|
30
|
-
payload: Record<string, unknown>;
|
|
31
|
-
commitment: Record<string, unknown>;
|
|
32
|
-
bin: string;
|
|
33
|
-
}): string | undefined;
|
|
34
29
|
/**
|
|
35
30
|
* `skrr commitments create` — author a durable commitment contract.
|
|
36
31
|
*
|
|
@@ -70,11 +65,9 @@ export default class CommitmentsCreate extends BaseCommand {
|
|
|
70
65
|
'event-driven': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
71
66
|
'cadence-mode': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
72
67
|
timezone: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
73
|
-
mode: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
74
68
|
delivery: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
75
69
|
repo: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
76
70
|
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
77
|
-
autonomy: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
78
71
|
isolation: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
79
72
|
'max-nudges': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
80
73
|
'max-concurrent-runs': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|