@ouro.bot/cli 0.1.0-alpha.354 → 0.1.0-alpha.355
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/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.355",
|
|
6
|
+
"changes": [
|
|
7
|
+
"`ouro up` AI-assisted repair diagnosis now uses the same discovered and pinged provider credentials as provider readiness checks, including the machine-wide credential pool, instead of drifting back through the current agent's configured provider registry path."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.354",
|
|
6
12
|
"changes": [
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* This is a lightweight integration: one diagnostic LLM call, not a chat loop.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createAgenticDiagnosisProviderRuntime = createAgenticDiagnosisProviderRuntime;
|
|
10
11
|
exports.runAgenticRepair = runAgenticRepair;
|
|
11
12
|
const runtime_1 = require("../../nerves/runtime");
|
|
13
|
+
const provider_ping_1 = require("../provider-ping");
|
|
12
14
|
function buildSystemPrompt(degraded) {
|
|
13
15
|
const agentList = degraded
|
|
14
16
|
.map((d) => `- ${d.agent}: error="${d.errorReason}", hint="${d.fixHint}"`)
|
|
@@ -48,9 +50,22 @@ function makeInteractiveRepairDeps(deps) {
|
|
|
48
50
|
runAuthFlow: deps.runAuthFlow ?? (async () => undefined),
|
|
49
51
|
};
|
|
50
52
|
}
|
|
53
|
+
function discoveredProviderModel(provider) {
|
|
54
|
+
const model = provider.providerConfig.model?.trim();
|
|
55
|
+
return model ? model : undefined;
|
|
56
|
+
}
|
|
57
|
+
function createAgenticDiagnosisProviderRuntime(provider) {
|
|
58
|
+
const config = {
|
|
59
|
+
...provider.providerConfig,
|
|
60
|
+
...provider.credentials,
|
|
61
|
+
};
|
|
62
|
+
return (0, provider_ping_1.createProviderRuntimeForConfig)(provider.provider, config, {
|
|
63
|
+
model: discoveredProviderModel(provider),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
51
66
|
async function tryAgenticDiagnosis(degraded, provider, deps) {
|
|
52
67
|
const logsTail = deps.readDaemonLogsTail();
|
|
53
|
-
const runtime = deps.createProviderRuntime(provider
|
|
68
|
+
const runtime = deps.createProviderRuntime(provider);
|
|
54
69
|
const systemPrompt = buildSystemPrompt(degraded);
|
|
55
70
|
const userMessage = buildUserMessage(degraded, logsTail);
|
|
56
71
|
const messages = [
|
|
@@ -1529,13 +1529,7 @@ async function runOuroCli(args, deps = (0, cli_defaults_1.createDefaultOuroCliDe
|
|
|
1529
1529
|
secretsRoot: deps.secretsRoot ?? `${process.env["HOME"]}/.agentsecrets`,
|
|
1530
1530
|
});
|
|
1531
1531
|
},
|
|
1532
|
-
createProviderRuntime:
|
|
1533
|
-
const { createProviderRegistry } = require("../core");
|
|
1534
|
-
const runtime = createProviderRegistry().resolve(provider);
|
|
1535
|
-
if (!runtime)
|
|
1536
|
-
throw new Error(`failed to create runtime for ${provider}`);
|
|
1537
|
-
return runtime;
|
|
1538
|
-
},
|
|
1532
|
+
createProviderRuntime: agentic_repair_1.createAgenticDiagnosisProviderRuntime,
|
|
1539
1533
|
readDaemonLogsTail: () => {
|
|
1540
1534
|
try {
|
|
1541
1535
|
const fs = require("node:fs");
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Shared provider discovery — single path for finding a working LLM provider.
|
|
4
4
|
*
|
|
5
|
-
* Scans disk credentials and environment variables,
|
|
6
|
-
*
|
|
5
|
+
* Scans machine-pool credentials, legacy disk credentials, and environment variables,
|
|
6
|
+
* deduplicates by provider, then pings each candidate to validate credentials actually work.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.scanEnvVarCredentials = scanEnvVarCredentials;
|
|
10
10
|
exports.discoverWorkingProvider = discoverWorkingProvider;
|
|
11
11
|
const identity_1 = require("../identity");
|
|
12
|
+
const provider_credential_pool_1 = require("../provider-credential-pool");
|
|
12
13
|
const runtime_1 = require("../../nerves/runtime");
|
|
13
14
|
/**
|
|
14
15
|
* Scan environment variables for API keys using the canonical PROVIDER_CREDENTIALS descriptor.
|
|
@@ -37,16 +38,50 @@ function scanEnvVarCredentials(env) {
|
|
|
37
38
|
}
|
|
38
39
|
return results;
|
|
39
40
|
}
|
|
41
|
+
function stringifyProviderFields(fields) {
|
|
42
|
+
const result = {};
|
|
43
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
44
|
+
result[key] = String(value);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
function machinePoolSource(record) {
|
|
49
|
+
if (record.provenance.contributedByAgent) {
|
|
50
|
+
return `machine-pool:${record.provenance.contributedByAgent}`;
|
|
51
|
+
}
|
|
52
|
+
return `machine-pool:${record.provenance.source}`;
|
|
53
|
+
}
|
|
54
|
+
function discoverMachinePoolCredentials(secretsRoot) {
|
|
55
|
+
const homeDir = (0, provider_credential_pool_1.providerCredentialHomeDirFromSecretsRoot)(secretsRoot);
|
|
56
|
+
const poolResult = (0, provider_credential_pool_1.readProviderCredentialPool)(homeDir);
|
|
57
|
+
if (!poolResult.ok)
|
|
58
|
+
return [];
|
|
59
|
+
const credentials = [];
|
|
60
|
+
for (const [, record] of Object.entries(poolResult.pool.providers)) {
|
|
61
|
+
credentials.push({
|
|
62
|
+
provider: record.provider,
|
|
63
|
+
agentName: machinePoolSource(record),
|
|
64
|
+
credentials: stringifyProviderFields(record.credentials),
|
|
65
|
+
providerConfig: stringifyProviderFields(record.config),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return credentials;
|
|
69
|
+
}
|
|
40
70
|
/**
|
|
41
|
-
* Discover the first working provider by scanning
|
|
42
|
-
* deduplicating by provider
|
|
71
|
+
* Discover the first working provider by scanning configured credential sources,
|
|
72
|
+
* deduplicating by provider, and pinging each candidate.
|
|
43
73
|
*/
|
|
44
74
|
async function discoverWorkingProvider(deps) {
|
|
75
|
+
const poolCreds = discoverMachinePoolCredentials(deps.secretsRoot);
|
|
45
76
|
const diskCreds = deps.discoverExistingCredentials(deps.secretsRoot);
|
|
46
77
|
const envCreds = scanEnvVarCredentials(deps.env);
|
|
47
|
-
// Deduplicate:
|
|
78
|
+
// Deduplicate: machine pool first, legacy per-agent disk next, env vars last.
|
|
48
79
|
const seenProviders = new Set();
|
|
49
80
|
const candidates = [];
|
|
81
|
+
for (const cred of poolCreds) {
|
|
82
|
+
seenProviders.add(cred.provider);
|
|
83
|
+
candidates.push(cred);
|
|
84
|
+
}
|
|
50
85
|
for (const cred of diskCreds) {
|
|
51
86
|
if (!seenProviders.has(cred.provider)) {
|
|
52
87
|
seenProviders.add(cred.provider);
|
|
@@ -64,7 +99,7 @@ async function discoverWorkingProvider(deps) {
|
|
|
64
99
|
level: "info",
|
|
65
100
|
component: "daemon",
|
|
66
101
|
event: "daemon.provider_discovery_none",
|
|
67
|
-
message: "no provider credentials found
|
|
102
|
+
message: "no provider credentials found in machine pool, legacy disk, or environment",
|
|
68
103
|
meta: {},
|
|
69
104
|
});
|
|
70
105
|
return null;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sanitizeErrorMessage = sanitizeErrorMessage;
|
|
4
4
|
exports.pingGithubCopilotModel = pingGithubCopilotModel;
|
|
5
|
+
exports.createProviderRuntimeForConfig = createProviderRuntimeForConfig;
|
|
5
6
|
exports.pingProvider = pingProvider;
|
|
6
7
|
exports.runHealthInventory = runHealthInventory;
|
|
7
8
|
const identity_1 = require("./identity");
|
|
@@ -136,11 +137,11 @@ function hasEmptyCredentials(provider, config) {
|
|
|
136
137
|
}
|
|
137
138
|
return identity_1.PROVIDER_CREDENTIALS[provider].required.some((key) => !record[key]);
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function createProviderRuntimeForConfig(provider, config, options = {}) {
|
|
140
141
|
// Use the same provider defaults as auth switch and hatch so verification
|
|
141
142
|
// cannot drift to stale provider/model pairings, and pass the checked
|
|
142
143
|
// credentials directly so daemon-side pings do not depend on --agent globals.
|
|
143
|
-
const resolvedModel = model ?? (0, provider_models_1.getDefaultModelForProvider)(provider);
|
|
144
|
+
const resolvedModel = options.model ?? (0, provider_models_1.getDefaultModelForProvider)(provider);
|
|
144
145
|
switch (provider) {
|
|
145
146
|
case "anthropic":
|
|
146
147
|
return (0, anthropic_1.createAnthropicProviderRuntime)(resolvedModel, config);
|
|
@@ -166,7 +167,7 @@ async function pingProvider(provider, config, options = {}) {
|
|
|
166
167
|
}
|
|
167
168
|
let runtime;
|
|
168
169
|
try {
|
|
169
|
-
runtime =
|
|
170
|
+
runtime = createProviderRuntimeForConfig(provider, config, { model: options.model });
|
|
170
171
|
/* v8 ignore start -- factory creation failure: tested via individual provider init tests @preserve */
|
|
171
172
|
}
|
|
172
173
|
catch (error) {
|