@skrr-ai/cli 0.1.32 → 0.1.34
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/bin/run.js +2 -2
- package/dist/base-command.js +5 -0
- package/dist/commands/agents/list.d.ts +2 -1
- package/dist/commands/agents/list.js +2 -1
- package/dist/commands/agents/show.js +2 -1
- package/dist/commands/balance/statement.js +8 -4
- package/dist/commands/browser/install.js +6 -2
- package/dist/commands/browser/uninstall.js +6 -2
- package/dist/commands/code/acp.js +2 -1
- package/dist/commands/code/doctor.d.ts +1 -1
- package/dist/commands/code/doctor.js +6 -5
- package/dist/commands/code/handover.d.ts +2 -2
- package/dist/commands/code/handover.js +2 -2
- package/dist/commands/code/index.d.ts +2 -2
- package/dist/commands/code/index.js +18 -17
- package/dist/commands/code/install.d.ts +3 -3
- package/dist/commands/code/install.js +18 -11
- package/dist/commands/code/migrate.js +3 -2
- package/dist/commands/code/oversky-agent.d.ts +5 -4
- package/dist/commands/code/oversky-agent.js +24 -22
- package/dist/commands/code/run.js +2 -1
- package/dist/commands/harnesses/list.d.ts +9 -1
- package/dist/commands/harnesses/list.js +28 -7
- package/dist/commands/harnesses/show.js +7 -2
- package/dist/commands/instructions/install.js +16 -6
- package/dist/commands/learning/delete.d.ts +9 -0
- package/dist/commands/learning/delete.js +40 -0
- package/dist/commands/learning/export.d.ts +9 -0
- package/dist/commands/learning/export.js +56 -0
- package/dist/commands/learning/reset.d.ts +9 -0
- package/dist/commands/learning/reset.js +36 -0
- package/dist/commands/learning/set.d.ts +10 -0
- package/dist/commands/learning/set.js +52 -0
- package/dist/commands/learning/status.d.ts +8 -0
- package/dist/commands/learning/status.js +35 -0
- package/dist/commands/logout.js +10 -5
- package/dist/commands/machines/dedicated/attach.js +2 -1
- package/dist/commands/tasks/runs.js +3 -1
- package/dist/commands/workspaces/use.js +2 -1
- package/dist/lib/adaptive-learning.d.ts +37 -0
- package/dist/lib/adaptive-learning.js +39 -0
- package/dist/lib/auth-core-init.d.ts +23 -0
- package/dist/lib/auth-core-init.js +61 -0
- package/dist/lib/code-handover.d.ts +1 -1
- package/dist/lib/code-handover.js +3 -2
- package/dist/lib/config.d.ts +30 -4
- package/dist/lib/config.js +2 -1
- package/dist/lib/daemon-installer.d.ts +1 -1
- package/dist/lib/daemon-target.js +2 -2
- package/dist/lib/dedicated-machines.d.ts +2 -2
- package/dist/lib/dedicated-machines.js +11 -4
- package/dist/lib/exec-runtime-binary.d.ts +2 -2
- package/dist/lib/exec-runtime-binary.js +2 -2
- package/dist/lib/{sky-code-agent.d.ts → first-party-harness-agent.d.ts} +20 -19
- package/dist/lib/{sky-code-agent.js → first-party-harness-agent.js} +85 -47
- package/dist/lib/{sky-code-broker.d.ts → first-party-harness-broker.d.ts} +6 -6
- package/dist/lib/{sky-code-broker.js → first-party-harness-broker.js} +23 -23
- package/dist/lib/{sky-code-doctor.d.ts → first-party-harness-doctor.d.ts} +12 -2
- package/dist/lib/{sky-code-doctor.js → first-party-harness-doctor.js} +181 -94
- package/dist/lib/{sky-code-managed.d.ts → first-party-harness-managed.d.ts} +55 -30
- package/dist/lib/{sky-code-managed.js → first-party-harness-managed.js} +92 -35
- package/dist/lib/{sky-code.d.ts → first-party-harness.d.ts} +107 -36
- package/dist/lib/{sky-code.js → first-party-harness.js} +172 -73
- package/dist/lib/harness-provider-input.d.ts +35 -0
- package/dist/lib/harness-provider-input.js +57 -0
- package/dist/lib/harness-tiers.d.ts +8 -2
- package/dist/lib/harness-tiers.js +11 -6
- package/dist/lib/task-instruction-offer.js +10 -4
- package/dist/lib/worklogs.js +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/configRoot.js +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.d.ts +248 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +361 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.d.ts +147 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +180 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.d.ts +111 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessHome.js +314 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.d.ts +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/harnessTrust.js +14 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/index.js +51 -14
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseManifest.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.d.ts +4 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +4 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/configRoot.js +2 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.d.ts +248 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +332 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.d.ts +147 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +170 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.d.ts +111 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessHome.js +303 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.d.ts +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/harnessTrust.js +14 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/index.js +12 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseManifest.js +1 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.d.ts +4 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +4 -4
- package/dist/node_modules/@skrr-ai/auth-core/package.json +11 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +4816 -4782
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +1 -1
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +34286 -33962
- package/package.json +5 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/skyCodeChannels.d.ts +0 -96
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/skyCodeChannels.js +0 -115
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/skyCodeChannels.d.ts +0 -96
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/skyCodeChannels.js +0 -107
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OSK-3892 — which AGENT a locally-hosted
|
|
2
|
+
* OSK-3892 — which AGENT a locally-hosted first-party harness session belongs to.
|
|
3
3
|
*
|
|
4
4
|
* ── Why a session needs an agent at all ────────────────────────────────────
|
|
5
5
|
*
|
|
6
6
|
* `skrr code` is the local arm of an agent's harness. The cloud dispatches to
|
|
7
|
-
*
|
|
7
|
+
* the first-party harness AS an agent, and a human running it here runs the same harness against
|
|
8
8
|
* the same server contract — so the session is attributed to an agent the user
|
|
9
9
|
* names.
|
|
10
10
|
*
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ── Resolution order, and why it ends in a refusal ─────────────────────────
|
|
17
17
|
*
|
|
18
|
-
* 1. `--
|
|
19
|
-
* 2. `
|
|
18
|
+
* 1. `--skrr-agent <id-or-name>` (or its older spelling, `--oversky-agent`)
|
|
19
|
+
* 2. `AGENT_CONFIG_KEY` in `~/.skrr/cli-config.json` (or the key earlier CLIs wrote)
|
|
20
20
|
* 3. the user's single agent, when they have exactly one AND AUTHORED IT
|
|
21
21
|
* 4. the user's own DEFAULT agent for this harness, created on first use
|
|
22
22
|
*
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
* `--oversky-agent` fail inside any daemon-spawned CLI child. Its error TYPE and
|
|
49
49
|
* its habit of listing what it found are worth copying; its precedence is not.
|
|
50
50
|
*/
|
|
51
|
-
export type
|
|
52
|
-
export interface
|
|
51
|
+
export type FirstPartyHarnessAgentSource = 'flag' | 'config' | 'sole-agent' | 'default-agent';
|
|
52
|
+
export interface FirstPartyHarnessAgent {
|
|
53
53
|
id: string;
|
|
54
54
|
name?: string;
|
|
55
|
-
source:
|
|
55
|
+
source: FirstPartyHarnessAgentSource;
|
|
56
56
|
/**
|
|
57
57
|
* True only on the run that actually minted the default agent, so the CLI can
|
|
58
58
|
* say so once instead of on every session. The server reports it as 201 vs
|
|
@@ -60,10 +60,10 @@ export interface SkyCodeAgent {
|
|
|
60
60
|
*/
|
|
61
61
|
createdNow?: boolean;
|
|
62
62
|
}
|
|
63
|
-
export type
|
|
64
|
-
export declare class
|
|
65
|
-
readonly code:
|
|
66
|
-
constructor(code:
|
|
63
|
+
export type FirstPartyHarnessAgentFailure = 'agent-unknown' | 'agent-ambiguous' | 'agent-unset' | 'agent-lookup-failed';
|
|
64
|
+
export declare class FirstPartyHarnessAgentError extends Error {
|
|
65
|
+
readonly code: FirstPartyHarnessAgentFailure;
|
|
66
|
+
constructor(code: FirstPartyHarnessAgentFailure, message: string);
|
|
67
67
|
}
|
|
68
68
|
interface AgentRow {
|
|
69
69
|
id?: string;
|
|
@@ -77,11 +77,12 @@ interface AgentRow {
|
|
|
77
77
|
* Set when this row IS the caller's auto-created default for a harness. Also
|
|
78
78
|
* already on the wire, for the same reason — which is what lets a read-only
|
|
79
79
|
* caller recognise an existing default without asking the get-or-create
|
|
80
|
-
* endpoint to establish one.
|
|
80
|
+
* endpoint to establish one. A stored row may carry any accepted spelling of
|
|
81
|
+
* the harness, so it is compared with `isFirstPartyHarnessProvider`, never `===`.
|
|
81
82
|
*/
|
|
82
83
|
defaultForHarness?: string;
|
|
83
84
|
}
|
|
84
|
-
export interface
|
|
85
|
+
export interface FirstPartyHarnessAgentDeps {
|
|
85
86
|
/** Agents this user may run. Bounded; see `ROSTER_LIMIT`. */
|
|
86
87
|
listAgents?: (signal?: AbortSignal) => Promise<AgentRow[]>;
|
|
87
88
|
/** Direct read, for an id outside the bounded roster. `null` when unreadable. */
|
|
@@ -99,7 +100,7 @@ interface DefaultAgentRow extends AgentRow {
|
|
|
99
100
|
/** Whether THIS call created it (server 201) rather than found it (200). */
|
|
100
101
|
created?: boolean;
|
|
101
102
|
}
|
|
102
|
-
export interface
|
|
103
|
+
export interface FirstPartyHarnessAgentOptions {
|
|
103
104
|
/**
|
|
104
105
|
* OSK-3892 — the CALLER's deadline for the whole managed acquisition.
|
|
105
106
|
*
|
|
@@ -120,8 +121,8 @@ export interface SkyCodeAgentOptions {
|
|
|
120
121
|
/**
|
|
121
122
|
* How a refusal NAMES an explicitly-supplied reference.
|
|
122
123
|
*
|
|
123
|
-
* Defaults to `--
|
|
124
|
-
*
|
|
124
|
+
* Defaults to `--skrr-agent`, which is how a session receives one. `skrr code
|
|
125
|
+
* skrr-agent --set` passes its own spelling so a bad value does not send the
|
|
125
126
|
* user to fix a flag they never typed.
|
|
126
127
|
*/
|
|
127
128
|
explicitLabel?: string;
|
|
@@ -143,18 +144,18 @@ export interface SkyCodeAgentOptions {
|
|
|
143
144
|
* a refusal listable. That is worth just as much care — a wrong pick is not a
|
|
144
145
|
* breach, it is a bill someone else reads weeks later — but it is a different job.
|
|
145
146
|
*/
|
|
146
|
-
export declare function
|
|
147
|
+
export declare function resolveFirstPartyHarnessAgent(explicit?: string, deps?: FirstPartyHarnessAgentDeps, options?: FirstPartyHarnessAgentOptions): Promise<FirstPartyHarnessAgent>;
|
|
147
148
|
/** The stored value, unresolved — for a `--show` that must report "unset" honestly. */
|
|
148
149
|
export declare function readConfiguredAgentId(): string | undefined;
|
|
149
150
|
/**
|
|
150
151
|
* Persist the agent `skrr code` runs as when no flag is passed.
|
|
151
152
|
*
|
|
152
|
-
* Resolves through the SAME roster `
|
|
153
|
+
* Resolves through the SAME roster `resolveFirstPartyHarnessAgent` uses, for two reasons: a
|
|
153
154
|
* typo is refused while the user is still looking at it rather than at the start
|
|
154
155
|
* of some later session, and what lands on disk is always a canonical id. Storing
|
|
155
156
|
* the display name a user typed would silently break on the next rename.
|
|
156
157
|
*/
|
|
157
|
-
export declare function setConfiguredAgentId(ref: string, deps?:
|
|
158
|
+
export declare function setConfiguredAgentId(ref: string, deps?: FirstPartyHarnessAgentDeps, options?: FirstPartyHarnessAgentOptions): Promise<FirstPartyHarnessAgent>;
|
|
158
159
|
/** Remove the setting. Returns what was there, so the caller can say so. */
|
|
159
160
|
export declare function clearConfiguredAgentId(): string | undefined;
|
|
160
161
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* OSK-3892 — which AGENT a locally-hosted
|
|
3
|
+
* OSK-3892 — which AGENT a locally-hosted first-party harness session belongs to.
|
|
4
4
|
*
|
|
5
5
|
* ── Why a session needs an agent at all ────────────────────────────────────
|
|
6
6
|
*
|
|
7
7
|
* `skrr code` is the local arm of an agent's harness. The cloud dispatches to
|
|
8
|
-
*
|
|
8
|
+
* the first-party harness AS an agent, and a human running it here runs the same harness against
|
|
9
9
|
* the same server contract — so the session is attributed to an agent the user
|
|
10
10
|
* names.
|
|
11
11
|
*
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
*
|
|
17
17
|
* ── Resolution order, and why it ends in a refusal ─────────────────────────
|
|
18
18
|
*
|
|
19
|
-
* 1. `--
|
|
20
|
-
* 2. `
|
|
19
|
+
* 1. `--skrr-agent <id-or-name>` (or its older spelling, `--oversky-agent`)
|
|
20
|
+
* 2. `AGENT_CONFIG_KEY` in `~/.skrr/cli-config.json` (or the key earlier CLIs wrote)
|
|
21
21
|
* 3. the user's single agent, when they have exactly one AND AUTHORED IT
|
|
22
22
|
* 4. the user's own DEFAULT agent for this harness, created on first use
|
|
23
23
|
*
|
|
@@ -50,15 +50,16 @@
|
|
|
50
50
|
* its habit of listing what it found are worth copying; its precedence is not.
|
|
51
51
|
*/
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
54
|
-
exports.
|
|
53
|
+
exports.FirstPartyHarnessAgentError = void 0;
|
|
54
|
+
exports.resolveFirstPartyHarnessAgent = resolveFirstPartyHarnessAgent;
|
|
55
55
|
exports.readConfiguredAgentId = readConfiguredAgentId;
|
|
56
56
|
exports.setConfiguredAgentId = setConfiguredAgentId;
|
|
57
57
|
exports.clearConfiguredAgentId = clearConfiguredAgentId;
|
|
58
|
+
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
58
59
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
59
60
|
const api_fetch_1 = require("./api-fetch");
|
|
60
61
|
const config_1 = require("./config");
|
|
61
|
-
const
|
|
62
|
+
const first_party_harness_managed_1 = require("./first-party-harness-managed");
|
|
62
63
|
/**
|
|
63
64
|
* How many agents the refusal is allowed to look at.
|
|
64
65
|
*
|
|
@@ -68,15 +69,15 @@ const sky_code_managed_1 = require("./sky-code-managed");
|
|
|
68
69
|
const ROSTER_LIMIT = 100;
|
|
69
70
|
/** How many candidates a refusal prints before it summarizes the rest. */
|
|
70
71
|
const CANDIDATES_SHOWN = 12;
|
|
71
|
-
class
|
|
72
|
+
class FirstPartyHarnessAgentError extends Error {
|
|
72
73
|
code;
|
|
73
74
|
constructor(code, message) {
|
|
74
75
|
super(message);
|
|
75
|
-
this.name = '
|
|
76
|
+
this.name = 'FirstPartyHarnessAgentError';
|
|
76
77
|
this.code = code;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
exports.
|
|
80
|
+
exports.FirstPartyHarnessAgentError = FirstPartyHarnessAgentError;
|
|
80
81
|
/**
|
|
81
82
|
* Resolve the agent for this session, or refuse with something actionable.
|
|
82
83
|
*
|
|
@@ -94,9 +95,20 @@ exports.SkyCodeAgentError = SkyCodeAgentError;
|
|
|
94
95
|
* a refusal listable. That is worth just as much care — a wrong pick is not a
|
|
95
96
|
* breach, it is a bill someone else reads weeks later — but it is a different job.
|
|
96
97
|
*/
|
|
97
|
-
async function
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
async function resolveFirstPartyHarnessAgent(explicit, deps = {}, options = {}) {
|
|
99
|
+
// Lazy, as before: a session with an explicit flag must not fail on an
|
|
100
|
+
// unreadable config it never needed. The KEY travels with the value so a refusal
|
|
101
|
+
// names the key actually in the file, which is not always the one written today.
|
|
102
|
+
const configured = () => {
|
|
103
|
+
if (deps.configuredAgentId)
|
|
104
|
+
return { value: deps.configuredAgentId(), key: first_party_harness_managed_1.AGENT_CONFIG_KEY };
|
|
105
|
+
const setting = (0, first_party_harness_managed_1.readConfiguredAgentSetting)();
|
|
106
|
+
if (setting.legacy && migrateLegacyAgentSettingKey()) {
|
|
107
|
+
return { value: setting.value, key: first_party_harness_managed_1.AGENT_CONFIG_KEY };
|
|
108
|
+
}
|
|
109
|
+
return { value: setting.value, key: setting.key ?? first_party_harness_managed_1.AGENT_CONFIG_KEY };
|
|
110
|
+
};
|
|
111
|
+
const explicitLabel = options.explicitLabel ?? first_party_harness_managed_1.SKRR_AGENT_FLAG;
|
|
100
112
|
let cached = null;
|
|
101
113
|
const roster = async () => {
|
|
102
114
|
if (cached)
|
|
@@ -105,11 +117,11 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
105
117
|
cached = (await (deps.listAgents ?? listAgents)(options.signal)).filter((row) => Boolean(row?.id));
|
|
106
118
|
}
|
|
107
119
|
catch (err) {
|
|
108
|
-
throw new
|
|
120
|
+
throw new FirstPartyHarnessAgentError('agent-lookup-failed', `could not read your agents — ${message(err)}`);
|
|
109
121
|
}
|
|
110
122
|
return cached;
|
|
111
123
|
};
|
|
112
|
-
const named = async (ref, source) => {
|
|
124
|
+
const named = async (ref, source, configKey = first_party_harness_managed_1.AGENT_CONFIG_KEY) => {
|
|
113
125
|
const rows = await roster();
|
|
114
126
|
const byId = rows.find((row) => row.id === ref);
|
|
115
127
|
if (byId)
|
|
@@ -122,8 +134,8 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
122
134
|
return { id: byName[0].id, ...(byName[0].name ? { name: byName[0].name } : {}), source };
|
|
123
135
|
}
|
|
124
136
|
if (byName.length > 1) {
|
|
125
|
-
throw new
|
|
126
|
-
`Pass ${
|
|
137
|
+
throw new FirstPartyHarnessAgentError('agent-ambiguous', `${describeSource(source, ref, explicitLabel, configKey)} matches ${byName.length} agents. ` +
|
|
138
|
+
`Pass ${first_party_harness_managed_1.SKRR_AGENT_FLAG} with an id instead: ${candidates(byName)}`);
|
|
127
139
|
}
|
|
128
140
|
// Not in the bounded roster. It may still be a real id belonging to a user with
|
|
129
141
|
// more agents than the roster shows, so ask directly before refusing.
|
|
@@ -131,7 +143,7 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
131
143
|
if (direct?.id) {
|
|
132
144
|
return { id: direct.id, ...(direct.name ? { name: direct.name } : {}), source };
|
|
133
145
|
}
|
|
134
|
-
throw new
|
|
146
|
+
throw new FirstPartyHarnessAgentError('agent-unknown', `${describeSource(source, ref, explicitLabel, configKey)} is not an agent you can run. ` +
|
|
135
147
|
(rows.length ? `Yours: ${candidates(rows)}` : 'You have no agents yet.'));
|
|
136
148
|
};
|
|
137
149
|
/**
|
|
@@ -153,9 +165,10 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
153
165
|
const flag = explicit?.trim();
|
|
154
166
|
if (flag)
|
|
155
167
|
return named(flag, 'flag');
|
|
156
|
-
const fromConfig = configured()
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
const fromConfig = configured();
|
|
169
|
+
const configuredRef = fromConfig.value?.trim();
|
|
170
|
+
if (configuredRef)
|
|
171
|
+
return named(configuredRef, 'config', fromConfig.key);
|
|
159
172
|
const rows = await roster();
|
|
160
173
|
if (rows.length === 1) {
|
|
161
174
|
// AUTHORSHIP, not visibility. The roster is read at EDIT and `AGENT_EDITOR`
|
|
@@ -194,7 +207,7 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
194
207
|
// hardest to notice: "do not create" is not "do not look", and `--show`
|
|
195
208
|
// would report "no default agent yet" while staring at the row.
|
|
196
209
|
if (options.createDefault === false) {
|
|
197
|
-
const existing = rows.find((row) => row.defaultForHarness
|
|
210
|
+
const existing = rows.find((row) => (0, auth_core_1.isFirstPartyHarnessProvider)(row.defaultForHarness));
|
|
198
211
|
if (existing?.id) {
|
|
199
212
|
return {
|
|
200
213
|
id: existing.id,
|
|
@@ -206,7 +219,9 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
206
219
|
try {
|
|
207
220
|
const created = options.createDefault === false
|
|
208
221
|
? null
|
|
209
|
-
: await (deps.ensureDefaultAgent ?? ensureDefaultAgent)(
|
|
222
|
+
: await (deps.ensureDefaultAgent ?? ensureDefaultAgent)(
|
|
223
|
+
// Canonical: what the server stores. It accepts every spelling.
|
|
224
|
+
auth_core_1.FIRST_PARTY_HARNESS.provider, options.signal);
|
|
210
225
|
if (created?.id) {
|
|
211
226
|
return {
|
|
212
227
|
id: created.id,
|
|
@@ -219,30 +234,30 @@ async function resolveSkyCodeAgent(explicit, deps = {}, options = {}) {
|
|
|
219
234
|
catch (err) {
|
|
220
235
|
if (isAbortError(err))
|
|
221
236
|
throw err;
|
|
222
|
-
throw new
|
|
223
|
-
`Pass ${
|
|
224
|
-
|
|
237
|
+
throw new FirstPartyHarnessAgentError('agent-unset', `could not establish your default ${auth_core_1.FIRST_PARTY_HARNESS.displayName} agent — ${message(err)}. ` +
|
|
238
|
+
`Pass ${first_party_harness_managed_1.SKRR_AGENT_FLAG} <id-or-name>, or set one with ` +
|
|
239
|
+
`\`${auth_core_1.FIRST_PARTY_HARNESS.command} skrr-agent --set <id>\`` +
|
|
225
240
|
(rows.length ? `. Yours: ${candidates(rows)}` : ''));
|
|
226
241
|
}
|
|
227
242
|
// Asked, not told: the caller opted out of creation, so "no default" is a fact
|
|
228
243
|
// about this machine rather than a failure, and the remedy is a real command.
|
|
229
244
|
if (options.createDefault === false) {
|
|
230
|
-
throw new
|
|
245
|
+
throw new FirstPartyHarnessAgentError('agent-unset', `nothing is configured and you have no ${auth_core_1.FIRST_PARTY_HARNESS.displayName} default agent yet. ` +
|
|
231
246
|
'One is created automatically the first time you run a managed session — ' +
|
|
232
|
-
|
|
247
|
+
`or make it now with \`${auth_core_1.FIRST_PARTY_HARNESS.command} skrr-agent --create\`` +
|
|
233
248
|
(rows.length ? `. Yours: ${candidates(rows)}` : ''));
|
|
234
249
|
}
|
|
235
250
|
// The endpoint answered without an agent. Nothing here can repair that, but
|
|
236
251
|
// the user still has every ordinary way to name one.
|
|
237
|
-
throw new
|
|
238
|
-
?
|
|
239
|
-
`Pass ${
|
|
252
|
+
throw new FirstPartyHarnessAgentError('agent-unset', rows.length
|
|
253
|
+
? `${auth_core_1.FIRST_PARTY_HARNESS.displayName} has no default agent for you and will not pick one of your ${rows.length}. ` +
|
|
254
|
+
`Pass ${first_party_harness_managed_1.SKRR_AGENT_FLAG} <id-or-name>, or set "${first_party_harness_managed_1.AGENT_CONFIG_KEY}" in ` +
|
|
240
255
|
`${configPathHint()}. Yours: ${candidates(rows)}`
|
|
241
|
-
:
|
|
256
|
+
: `you have no agents and no default could be created, yet a managed ${auth_core_1.FIRST_PARTY_HARNESS.displayName} session ` +
|
|
242
257
|
'runs as one. Create an agent in the skrr app first');
|
|
243
258
|
}
|
|
244
|
-
function describeSource(source, ref, explicitLabel) {
|
|
245
|
-
return source === 'config' ? `"${
|
|
259
|
+
function describeSource(source, ref, explicitLabel, configKey) {
|
|
260
|
+
return source === 'config' ? `"${configKey}": "${ref}"` : `${explicitLabel} "${ref}"`;
|
|
246
261
|
}
|
|
247
262
|
function candidates(rows) {
|
|
248
263
|
const shown = rows
|
|
@@ -263,22 +278,22 @@ function configPathHint() {
|
|
|
263
278
|
}
|
|
264
279
|
/** The stored value, unresolved — for a `--show` that must report "unset" honestly. */
|
|
265
280
|
function readConfiguredAgentId() {
|
|
266
|
-
return (0,
|
|
281
|
+
return (0, first_party_harness_managed_1.readConfiguredAgentSetting)().value;
|
|
267
282
|
}
|
|
268
283
|
/**
|
|
269
284
|
* Persist the agent `skrr code` runs as when no flag is passed.
|
|
270
285
|
*
|
|
271
|
-
* Resolves through the SAME roster `
|
|
286
|
+
* Resolves through the SAME roster `resolveFirstPartyHarnessAgent` uses, for two reasons: a
|
|
272
287
|
* typo is refused while the user is still looking at it rather than at the start
|
|
273
288
|
* of some later session, and what lands on disk is always a canonical id. Storing
|
|
274
289
|
* the display name a user typed would silently break on the next rename.
|
|
275
290
|
*/
|
|
276
291
|
async function setConfiguredAgentId(ref, deps = {}, options = {}) {
|
|
277
|
-
const resolved = await
|
|
292
|
+
const resolved = await resolveFirstPartyHarnessAgent(ref, deps, {
|
|
278
293
|
// Name the thing the user actually typed. Without this a bad `--set` value
|
|
279
|
-
// is refused with "--
|
|
294
|
+
// is refused with "--skrr-agent \"typo\" is not an agent you can run",
|
|
280
295
|
// pointing at a flag that was never on the command line.
|
|
281
|
-
explicitLabel:
|
|
296
|
+
explicitLabel: `${auth_core_1.FIRST_PARTY_HARNESS.command} skrr-agent --set`,
|
|
282
297
|
...options,
|
|
283
298
|
});
|
|
284
299
|
writeConfigKey(resolved.id);
|
|
@@ -291,8 +306,7 @@ function clearConfiguredAgentId() {
|
|
|
291
306
|
return previous;
|
|
292
307
|
}
|
|
293
308
|
function readRawConfigKey() {
|
|
294
|
-
|
|
295
|
-
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
309
|
+
return (0, first_party_harness_managed_1.readAgentSetting)((0, config_1.loadRawConfig)()).value;
|
|
296
310
|
}
|
|
297
311
|
/**
|
|
298
312
|
* Read-modify-write through the RAW accessors, never `loadConfig`/`saveConfig`.
|
|
@@ -304,13 +318,37 @@ function readRawConfigKey() {
|
|
|
304
318
|
* that moved credentials to the keychain, on a command about an agent id. The raw
|
|
305
319
|
* pair also preserves operator-added keys the typed shape does not enumerate.
|
|
306
320
|
*/
|
|
321
|
+
/**
|
|
322
|
+
* Move an agent setting stored under an older key onto the neutral one, on the
|
|
323
|
+
* first real session read. Returns whether the file now holds it under the
|
|
324
|
+
* neutral key.
|
|
325
|
+
*
|
|
326
|
+
* Reading alone used to leave it where it was, which is safe only while that key
|
|
327
|
+
* is still an accepted spelling. The contract phase empties the identity's
|
|
328
|
+
* aliases, `legacyAgentConfigKeys()` then stops naming the old key, and a user
|
|
329
|
+
* who never ran `--set`, `--clear` or logout would silently lose their setting.
|
|
330
|
+
* Moving it here retires the old key long before that date.
|
|
331
|
+
*
|
|
332
|
+
* Only the session path calls this — `skrr code doctor` reports and never
|
|
333
|
+
* writes. Best-effort: an unwritable config is left alone and still read.
|
|
334
|
+
*/
|
|
335
|
+
function migrateLegacyAgentSettingKey() {
|
|
336
|
+
try {
|
|
337
|
+
const raw = (0, config_1.loadRawConfig)();
|
|
338
|
+
const stored = (0, first_party_harness_managed_1.readAgentSetting)(raw);
|
|
339
|
+
if (!stored.legacy || !stored.value)
|
|
340
|
+
return false;
|
|
341
|
+
(0, config_1.saveRawConfig)((0, first_party_harness_managed_1.withAgentSetting)(raw, stored.value));
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
catch {
|
|
345
|
+
return false;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
307
348
|
function writeConfigKey(id) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
else
|
|
312
|
-
delete raw[sky_code_managed_1.AGENT_CONFIG_KEY];
|
|
313
|
-
(0, config_1.saveRawConfig)(raw);
|
|
349
|
+
// Every older key goes too, so the file ends holding the setting under one
|
|
350
|
+
// name — a clear that left an older key behind would un-clear on the next read.
|
|
351
|
+
(0, config_1.saveRawConfig)((0, first_party_harness_managed_1.withAgentSetting)((0, config_1.loadRawConfig)(), id));
|
|
314
352
|
}
|
|
315
353
|
/**
|
|
316
354
|
* The roster, at EDIT.
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
*/
|
|
60
60
|
import { buildManagedInferenceRelayCredential, startManagedInferenceBroker, type RenewalStopReason } from '@skrr-ai/inference-broker';
|
|
61
61
|
import { type ApiFetchOptions } from './api-fetch';
|
|
62
|
-
import { type EngineExitOutcome } from './
|
|
63
|
-
import { type
|
|
62
|
+
import { type EngineExitOutcome } from './first-party-harness';
|
|
63
|
+
import { type FirstPartyHarnessAgent } from './first-party-harness-agent';
|
|
64
64
|
/**
|
|
65
65
|
* Reasons the server accepts for a release. An ALLOW-LIST on its side, mirrored
|
|
66
66
|
* here as a type so a typo becomes a compile error rather than a silent
|
|
@@ -88,7 +88,7 @@ export interface ManagedSessionHandle {
|
|
|
88
88
|
env: Record<string, string>;
|
|
89
89
|
socketPath: string;
|
|
90
90
|
sessionId: string;
|
|
91
|
-
agent:
|
|
91
|
+
agent: FirstPartyHarnessAgent;
|
|
92
92
|
reservationId: string;
|
|
93
93
|
/** The ADMITTED model. After admission the reservation is the model authority. */
|
|
94
94
|
model: string;
|
|
@@ -125,7 +125,7 @@ export interface ManagedSessionHandle {
|
|
|
125
125
|
}
|
|
126
126
|
type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
|
|
127
127
|
export interface AcquireManagedSessionInput {
|
|
128
|
-
/** `--oversky-agent` value, if the user passed one. */
|
|
128
|
+
/** `--skrr-agent` (or `--oversky-agent`) value, if the user passed one. */
|
|
129
129
|
agentRef?: string;
|
|
130
130
|
/** The model the user named to the engine, if any. */
|
|
131
131
|
model?: string;
|
|
@@ -147,7 +147,7 @@ export interface AcquireManagedSessionDeps {
|
|
|
147
147
|
prefetchAuth?: () => Promise<void>;
|
|
148
148
|
hasCredential?: () => boolean;
|
|
149
149
|
/** `signal` is the acquisition-wide deadline; an override that ignores it is unbounded. */
|
|
150
|
-
resolveAgent?: (ref?: string, signal?: AbortSignal) => Promise<
|
|
150
|
+
resolveAgent?: (ref?: string, signal?: AbortSignal) => Promise<FirstPartyHarnessAgent>;
|
|
151
151
|
/** The user-JWT call. Defaults to `apiFetch`. */
|
|
152
152
|
api?: <T>(path: string, opts?: ApiFetchOptions) => Promise<T>;
|
|
153
153
|
/** The session-token calls. Defaults to global `fetch`. */
|
|
@@ -226,7 +226,7 @@ export interface ManagedEngineHooks {
|
|
|
226
226
|
}
|
|
227
227
|
export interface ManagedEngineHooksInput {
|
|
228
228
|
subcommand: string | null;
|
|
229
|
-
/** Argv bound for the engine, with `--oversky-agent` already removed. */
|
|
229
|
+
/** Argv bound for the engine, with `--skrr-agent` / `--oversky-agent` already removed. */
|
|
230
230
|
passthrough: readonly string[];
|
|
231
231
|
agentRef?: string;
|
|
232
232
|
env?: NodeJS.ProcessEnv;
|
|
@@ -75,9 +75,9 @@ const auth_core_init_1 = require("./auth-core-init");
|
|
|
75
75
|
const config_1 = require("./config");
|
|
76
76
|
const cred_envelope_1 = require("./cred-envelope");
|
|
77
77
|
const device_id_1 = require("./device-id");
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
78
|
+
const first_party_harness_1 = require("./first-party-harness");
|
|
79
|
+
const first_party_harness_agent_1 = require("./first-party-harness-agent");
|
|
80
|
+
const first_party_harness_managed_1 = require("./first-party-harness-managed");
|
|
81
81
|
const task_execution_1 = require("./task-execution");
|
|
82
82
|
/**
|
|
83
83
|
* Harness selections the POLICY resolves, mirroring the server's own set.
|
|
@@ -173,7 +173,7 @@ async function acquireManagedSession(input = {}, deps = {}) {
|
|
|
173
173
|
const newId = deps.newId ?? (() => (0, node_crypto_1.randomUUID)());
|
|
174
174
|
const fetchImpl = deps.fetchImpl ?? ((url, init) => fetch(url, init));
|
|
175
175
|
const api = deps.api ?? ((path, opts) => (0, api_fetch_1.apiFetch)(path, opts));
|
|
176
|
-
const serverUrl = (deps.serverUrl ?? (() => (0,
|
|
176
|
+
const serverUrl = (deps.serverUrl ?? (() => (0, first_party_harness_managed_1.configuredServerUrl)(input.env ?? process.env)))();
|
|
177
177
|
// Envelope-wrapped credentials are unreadable until this has run: without it
|
|
178
178
|
// `readFromBackend` returns a null plaintext and the whole bundle is dropped, so
|
|
179
179
|
// a signed-in user looks signed out. `BaseCommand` awaits it for the same reason
|
|
@@ -236,7 +236,7 @@ async function acquireManagedSession(input = {}, deps = {}) {
|
|
|
236
236
|
let lease;
|
|
237
237
|
try {
|
|
238
238
|
agent = await (deps.resolveAgent ??
|
|
239
|
-
((ref, signal) => (0,
|
|
239
|
+
((ref, signal) => (0, first_party_harness_agent_1.resolveFirstPartyHarnessAgent)(ref, {}, signal ? { signal } : {})))(input.agentRef, acquisition.signal);
|
|
240
240
|
// Say it exactly once, on the run that actually minted it.
|
|
241
241
|
//
|
|
242
242
|
// A user who never chose an agent is about to have a new one appear in their
|
|
@@ -245,9 +245,9 @@ async function acquireManagedSession(input = {}, deps = {}) {
|
|
|
245
245
|
// on every subsequent session, which is why the server distinguishes created
|
|
246
246
|
// from found rather than the CLI guessing from a timestamp.
|
|
247
247
|
if (agent.createdNow) {
|
|
248
|
-
input.log?.(`Created "${agent.name ?? agent.id}" as your default
|
|
248
|
+
input.log?.(`Created "${agent.name ?? agent.id}" as your default ${auth_core_1.FIRST_PARTY_HARNESS.displayName} agent — ` +
|
|
249
249
|
'this session, and future ones, are attributed to it. ' +
|
|
250
|
-
|
|
250
|
+
`Change it with \`${auth_core_1.FIRST_PARTY_HARNESS.command} skrr-agent --set <id-or-name>\`.`);
|
|
251
251
|
}
|
|
252
252
|
const minted = await mintSessionToken({ sessionId, processStartId, agentId: agent.id, actorId: newId() }, api, acquisition.signal);
|
|
253
253
|
sessionToken = minted.token;
|
|
@@ -942,31 +942,31 @@ function localClock(atMs) {
|
|
|
942
942
|
* wrong one of the three is the confusion, not a mitigation of it.
|
|
943
943
|
*
|
|
944
944
|
* The predicate is `hasProviderCredential`, the same one that decides what the
|
|
945
|
-
* engine actually inherits (`
|
|
945
|
+
* engine actually inherits (`first-party-harness.ts`), so the sentence and the spawn cannot
|
|
946
946
|
* disagree. `strippedProviderCredentialNames` covers the third case that
|
|
947
947
|
* predicate cannot see: the machine HAS a provider credential and this run
|
|
948
948
|
* removes it, which reads as absence and is not.
|
|
949
949
|
*/
|
|
950
950
|
function fallbackTail(env) {
|
|
951
|
-
if ((0,
|
|
951
|
+
if ((0, first_party_harness_1.hasProviderCredential)(env))
|
|
952
952
|
return 'Continuing with your own provider credentials.';
|
|
953
953
|
// Absence and removal are different problems, and the old sentence said the
|
|
954
954
|
// first when the second was true: on a machine whose only credential is an AWS
|
|
955
955
|
// profile the engine runs fine on its own and fails through `skrr code`,
|
|
956
956
|
// because `AWS_*` is stripped on the way in. Being told "no provider
|
|
957
957
|
// credential is set here" sends that user to buy a key they do not need.
|
|
958
|
-
const stripped = (0,
|
|
958
|
+
const stripped = (0, first_party_harness_1.strippedProviderCredentialNames)(env);
|
|
959
959
|
if (stripped.length > 0) {
|
|
960
960
|
return (`${stripped.join(', ')} is set here, but this run does not pass it to the engine — ` +
|
|
961
961
|
'it is stripped so a model-driven process opening other people\u2019s repositories cannot ' +
|
|
962
962
|
'reuse a cloud credential. So the engine starts without one and its first request will ' +
|
|
963
963
|
'fail. Export a provider key the engine may inherit (any `*_API_KEY`, e.g. ' +
|
|
964
964
|
'OPENROUTER_API_KEY), resolve the reason above, or run the engine directly if you ' +
|
|
965
|
-
|
|
965
|
+
`intend to spend that credential (\`${auth_core_1.FIRST_PARTY_HARNESS.command} doctor\` shows where it is).`);
|
|
966
966
|
}
|
|
967
967
|
return ('No provider credential is set here either, so the engine will start without one and ' +
|
|
968
968
|
'its first request will fail — set OPENROUTER_API_KEY, or resolve the reason above ' +
|
|
969
|
-
|
|
969
|
+
`(\`${auth_core_1.FIRST_PARTY_HARNESS.command} doctor\`).`);
|
|
970
970
|
}
|
|
971
971
|
/**
|
|
972
972
|
* Build the three `execEngine` hooks for one `skrr code` invocation.
|
|
@@ -992,7 +992,7 @@ function createManagedEngineHooks(input) {
|
|
|
992
992
|
const env = input.env ?? process.env;
|
|
993
993
|
const log = input.log ?? ((line) => process.stderr.write(`${line}\n`));
|
|
994
994
|
const acquire = input.acquire ?? acquireManagedSession;
|
|
995
|
-
const requestedModel = (0,
|
|
995
|
+
const requestedModel = (0, first_party_harness_managed_1.namedEngineModel)(input.passthrough);
|
|
996
996
|
let handle = null;
|
|
997
997
|
/**
|
|
998
998
|
* Set the instant teardown begins, so a renewal refusal our OWN release caused
|
|
@@ -1008,7 +1008,7 @@ function createManagedEngineHooks(input) {
|
|
|
1008
1008
|
// user was told so.
|
|
1009
1009
|
credentialMode: () => (handle ? 'managed' : 'byok'),
|
|
1010
1010
|
prepare: async () => {
|
|
1011
|
-
const skip = (0,
|
|
1011
|
+
const skip = (0, first_party_harness_managed_1.managedSkipReason)(env);
|
|
1012
1012
|
if (skip) {
|
|
1013
1013
|
if (skip.announce)
|
|
1014
1014
|
log(`Managed inference not used: ${skip.detail}. ${fallbackTail(env)}`);
|
|
@@ -1061,14 +1061,14 @@ function createManagedEngineHooks(input) {
|
|
|
1061
1061
|
const failure = managedAcquisitionFailure(err, env);
|
|
1062
1062
|
log(failure.line);
|
|
1063
1063
|
if (failure.action === 'refuse') {
|
|
1064
|
-
throw new
|
|
1064
|
+
throw new first_party_harness_1.EngineStartRefusedError(failure.code, failure.line);
|
|
1065
1065
|
}
|
|
1066
1066
|
return {};
|
|
1067
1067
|
}
|
|
1068
1068
|
},
|
|
1069
1069
|
finalizeArgs: (args) =>
|
|
1070
1070
|
// Only when WE resolved the model. A user-named model is already in the argv.
|
|
1071
|
-
(0,
|
|
1071
|
+
(0, first_party_harness_managed_1.withManagedModel)(input.subcommand, args, handle && !requestedModel ? (handle.clientModelId ?? handle.model) : undefined),
|
|
1072
1072
|
cleanup: async (outcome) => {
|
|
1073
1073
|
const live = handle;
|
|
1074
1074
|
handle = null;
|
|
@@ -1126,7 +1126,7 @@ function managedRenewalStoppedLine(reason, detail) {
|
|
|
1126
1126
|
// the useful detail here is WHEN the window ended, not which rule fired.
|
|
1127
1127
|
return ('Managed inference reached the limit this session was authorized for' +
|
|
1128
1128
|
`${detail ? ` (${detail})` : ''}. ` +
|
|
1129
|
-
|
|
1129
|
+
`It cannot be extended further — start a new \`${auth_core_1.FIRST_PARTY_HARNESS.command}\` session to continue.`);
|
|
1130
1130
|
case 'expired':
|
|
1131
1131
|
// Deliberately names the cause rather than only the fact. A user who was
|
|
1132
1132
|
// told "renewal was refused" goes looking for a policy or budget problem;
|
|
@@ -1134,7 +1134,7 @@ function managedRenewalStoppedLine(reason, detail) {
|
|
|
1134
1134
|
// and the fix is the same one-liner as the ceiling's.
|
|
1135
1135
|
return ('Managed inference lost its session credential before it could be refreshed' +
|
|
1136
1136
|
`${detail ? ` (${detail})` : ''} — this usually means the machine slept. ` +
|
|
1137
|
-
|
|
1137
|
+
`Start a new \`${auth_core_1.FIRST_PARTY_HARNESS.command}\` session to continue.`);
|
|
1138
1138
|
case 'exhausted': {
|
|
1139
1139
|
// OSK-3932 — the money, which until now could only reach the user as
|
|
1140
1140
|
// `denied` ("something is wrong with your access") or, worse, as nothing at
|
|
@@ -1155,7 +1155,7 @@ function managedRenewalStoppedLine(reason, detail) {
|
|
|
1155
1155
|
'or export OPENROUTER_API_KEY to continue on your own key.');
|
|
1156
1156
|
}
|
|
1157
1157
|
return ('Managed inference stopped: this session spent the budget it was authorized. ' +
|
|
1158
|
-
|
|
1158
|
+
`Waiting will not restore it — start a new \`${auth_core_1.FIRST_PARTY_HARNESS.command}\` session to continue, ` +
|
|
1159
1159
|
'or export OPENROUTER_API_KEY to continue on your own key.');
|
|
1160
1160
|
}
|
|
1161
1161
|
case 'denied':
|
|
@@ -1175,7 +1175,7 @@ function managedRenewalStoppedLine(reason, detail) {
|
|
|
1175
1175
|
return (`Managed inference renewal was refused (${reason}${because}). ` +
|
|
1176
1176
|
'This session will lose access to the model shortly. This is an answer about ' +
|
|
1177
1177
|
'your account rather than the clock, so a new session may get it again — run ' +
|
|
1178
|
-
|
|
1178
|
+
`\`${auth_core_1.FIRST_PARTY_HARNESS.command} doctor\`, or export OPENROUTER_API_KEY to continue on your own key.`);
|
|
1179
1179
|
default:
|
|
1180
1180
|
// `unavailable`, and any reason a future package version adds: the cautious
|
|
1181
1181
|
// sentence is the right default for something this CLI does not recognise.
|
|
@@ -1185,7 +1185,7 @@ function managedRenewalStoppedLine(reason, detail) {
|
|
|
1185
1185
|
// than the fix.
|
|
1186
1186
|
return (`Managed inference could not renew its lease (${reason}${because}). ` +
|
|
1187
1187
|
'This session will lose access to the model shortly. If it does not recover, ' +
|
|
1188
|
-
|
|
1188
|
+
`start a new \`${auth_core_1.FIRST_PARTY_HARNESS.command}\` session, or export OPENROUTER_API_KEY to continue on ` +
|
|
1189
1189
|
'your own key.');
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
@@ -1276,9 +1276,9 @@ function managedAcquisitionFailure(err, env = process.env) {
|
|
|
1276
1276
|
* offered where there is no key to spend.
|
|
1277
1277
|
*/
|
|
1278
1278
|
function refusalTail(env) {
|
|
1279
|
-
if ((0,
|
|
1279
|
+
if ((0, first_party_harness_1.hasProviderCredential)(env)) {
|
|
1280
1280
|
return ('`skrr code` did not start the engine; to run on your own provider key instead, ' +
|
|
1281
|
-
`set ${
|
|
1281
|
+
`set ${first_party_harness_managed_1.MANAGED_ENV_FLAG}=0.`);
|
|
1282
1282
|
}
|
|
1283
1283
|
return '`skrr code` did not start the engine.';
|
|
1284
1284
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WL-6.9 — skrr
|
|
2
|
+
* WL-6.9 — first-party harness diagnostics (`skrr code doctor`).
|
|
3
3
|
*
|
|
4
4
|
* The plan makes this a launch gate, phrased as: support must be able to
|
|
5
5
|
* identify the product version, upstream base, config source, and runtime mode
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
* actions, and collapsing them into one red line is how a user spends an
|
|
21
21
|
* hour reinstalling something that was merely absent. Hence three statuses,
|
|
22
22
|
* not two.
|
|
23
|
+
*
|
|
24
|
+
* Every product-named value — display name, binary name, project directory, env
|
|
25
|
+
* var names — comes from the identity module in `@skrr-ai/auth-core`. A variable
|
|
26
|
+
* that was read under an OLDER name is reported by that name, with the neutral
|
|
27
|
+
* one to move to: the older names are still honoured, and a diagnostic that
|
|
28
|
+
* hid which one was in effect would send an operator to edit the wrong line.
|
|
23
29
|
*/
|
|
24
30
|
export type CheckStatus = 'ok' | 'warn' | 'fail';
|
|
25
31
|
export interface DoctorCheck {
|
|
@@ -35,7 +41,11 @@ export interface DoctorReport {
|
|
|
35
41
|
/** `fail` if any check failed, else `warn` if any warned, else `ok`. */
|
|
36
42
|
status: CheckStatus;
|
|
37
43
|
}
|
|
38
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Project-level state dir — the ENGINE's own project marker
|
|
46
|
+
* (`FIRST_PARTY_HARNESS_ENGINE.projectDirectory`). Basename deliberately differs
|
|
47
|
+
* from `~/.skrr`.
|
|
48
|
+
*/
|
|
39
49
|
export declare function projectStateDir(cwd: string): string;
|
|
40
50
|
export declare function runDoctor(cwd?: string, env?: NodeJS.ProcessEnv): DoctorReport;
|
|
41
51
|
/** Render a report for a terminal. */
|