@principles/pd-cli 1.75.0 → 1.77.0
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/dist/commands/config-doctor.d.ts +3 -6
- package/dist/commands/config-doctor.d.ts.map +1 -1
- package/dist/commands/config-doctor.js +30 -31
- package/dist/commands/config-doctor.js.map +1 -1
- package/dist/commands/runtime-features.d.ts +23 -8
- package/dist/commands/runtime-features.d.ts.map +1 -1
- package/dist/commands/runtime-features.js +72 -31
- package/dist/commands/runtime-features.js.map +1 -1
- package/dist/services/config-doctor.d.ts +26 -66
- package/dist/services/config-doctor.d.ts.map +1 -1
- package/dist/services/config-doctor.js +197 -374
- package/dist/services/config-doctor.js.map +1 -1
- package/dist/services/pd-config-loader.d.ts +64 -0
- package/dist/services/pd-config-loader.d.ts.map +1 -0
- package/dist/services/pd-config-loader.js +156 -0
- package/dist/services/pd-config-loader.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/config-doctor.ts +30 -30
- package/src/commands/runtime-features.ts +98 -44
- package/src/services/config-doctor.ts +236 -425
- package/src/services/pd-config-loader.ts +213 -0
- package/tests/commands/config-doctor.test.ts +207 -506
- package/tests/commands/console-launcher-edge-cases.test.ts +421 -0
- package/tests/commands/runtime-features.test.ts +220 -85
- package/tests/services/pd-config-loader.test.ts +479 -0
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pd config doctor — Discover and explain PD / OpenClaw configuration state.
|
|
3
3
|
*
|
|
4
|
-
* PRI-
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Classifies provider/model/auth connectivity (healthy, auth_missing, rate_limit, etc.)
|
|
8
|
-
* - Emits `reason` + `nextActions` for failures
|
|
9
|
-
* - NEVER leaks tokens, env var values, or raw config bytes
|
|
4
|
+
* PRI-305: Cutover to .pd/config.yaml.
|
|
5
|
+
* - Feature flags and internal agent runtime bindings come from .pd/config.yaml
|
|
6
|
+
* - .pd/feature-flags.yaml and .state/workflows.yaml are no longer production inputs
|
|
10
7
|
*
|
|
11
8
|
* Usage:
|
|
12
9
|
* pd config doctor [--workspace <path>] [--json]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-doctor.d.ts","sourceRoot":"","sources":["../../src/commands/config-doctor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config-doctor.d.ts","sourceRoot":"","sources":["../../src/commands/config-doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAuGD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC3E"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pd config doctor — Discover and explain PD / OpenClaw configuration state.
|
|
3
3
|
*
|
|
4
|
-
* PRI-
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Classifies provider/model/auth connectivity (healthy, auth_missing, rate_limit, etc.)
|
|
8
|
-
* - Emits `reason` + `nextActions` for failures
|
|
9
|
-
* - NEVER leaks tokens, env var values, or raw config bytes
|
|
4
|
+
* PRI-305: Cutover to .pd/config.yaml.
|
|
5
|
+
* - Feature flags and internal agent runtime bindings come from .pd/config.yaml
|
|
6
|
+
* - .pd/feature-flags.yaml and .state/workflows.yaml are no longer production inputs
|
|
10
7
|
*
|
|
11
8
|
* Usage:
|
|
12
9
|
* pd config doctor [--workspace <path>] [--json]
|
|
@@ -24,7 +21,8 @@ function formatTextOutput(output) {
|
|
|
24
21
|
lines.push('PD config paths:');
|
|
25
22
|
for (const [k, v] of Object.entries(output.pdConfigPaths)) {
|
|
26
23
|
const exists = v.exists ? '[exists]' : '[missing]';
|
|
27
|
-
|
|
24
|
+
const parseable = v.parseable === false ? ' [unparseable]' : '';
|
|
25
|
+
lines.push(` ${k.padEnd(16)} ${exists.padEnd(10)}${parseable} ${v.path}`);
|
|
28
26
|
}
|
|
29
27
|
lines.push('');
|
|
30
28
|
lines.push('OpenClaw paths:');
|
|
@@ -42,6 +40,25 @@ function formatTextOutput(output) {
|
|
|
42
40
|
lines.push(` warnings: ${output.featureFlags.warnings.length}`);
|
|
43
41
|
}
|
|
44
42
|
lines.push('');
|
|
43
|
+
lines.push('Internal agents:');
|
|
44
|
+
if (output.internalAgents.length === 0) {
|
|
45
|
+
lines.push(' (no internal agents diagnosed)');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
for (const agent of output.internalAgents) {
|
|
49
|
+
const readiness = agent.readiness.toUpperCase();
|
|
50
|
+
const enabledLabel = agent.enabled ? 'enabled' : 'disabled';
|
|
51
|
+
lines.push(` ${agent.name}: [${readiness}] (${enabledLabel})`);
|
|
52
|
+
lines.push(` profile: ${agent.runtimeProfileLabel} (${agent.runtimeProfileId})`);
|
|
53
|
+
if (agent.apiKeyEnv) {
|
|
54
|
+
const apiKeyState = agent.apiKeyPresent ? 'present' : 'absent';
|
|
55
|
+
lines.push(` apiKeyEnv: ${agent.apiKeyEnv} (${apiKeyState})`);
|
|
56
|
+
}
|
|
57
|
+
lines.push(` reason: ${agent.reason}`);
|
|
58
|
+
lines.push(` nextAction: ${agent.nextAction}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
lines.push('');
|
|
45
62
|
lines.push('Provider health:');
|
|
46
63
|
if (output.providerHealth.length === 0) {
|
|
47
64
|
lines.push(' (no providers discovered)');
|
|
@@ -49,11 +66,9 @@ function formatTextOutput(output) {
|
|
|
49
66
|
else {
|
|
50
67
|
for (const p of output.providerHealth) {
|
|
51
68
|
const cls = p.classification.toUpperCase();
|
|
52
|
-
const provider = p.provider ?? '(unset)';
|
|
53
|
-
const model = p.model ?? '(unset)';
|
|
54
69
|
const apiKeyEnv = p.apiKeyEnv ?? '(unset)';
|
|
55
70
|
const apiKeyState = p.apiKeyPresent ? 'present' : 'absent';
|
|
56
|
-
lines.push(` [${cls}]
|
|
71
|
+
lines.push(` [${cls}]`);
|
|
57
72
|
lines.push(` apiKeyEnv: ${apiKeyEnv} (${apiKeyState})`);
|
|
58
73
|
lines.push(` source: ${p.source}`);
|
|
59
74
|
lines.push(` reason: ${p.reason}`);
|
|
@@ -61,29 +76,13 @@ function formatTextOutput(output) {
|
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
lines.push('');
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const coProvider = co.provider ?? '(unset)';
|
|
69
|
-
const coModel = co.model ?? '(unset)';
|
|
70
|
-
const coApiKeyEnv = co.apiKeyEnv ?? '(unset)';
|
|
71
|
-
const coApiKeyState = co.apiKeyPresent ? 'present' : 'absent';
|
|
72
|
-
lines.push(` correctionObserver: [${coStatus}]`);
|
|
73
|
-
lines.push(` enabled: ${co.enabled}`);
|
|
74
|
-
lines.push(` flagSource: ${co.flagSource}`);
|
|
75
|
-
lines.push(` configSource:${co.configSource}`);
|
|
76
|
-
if (co.provider || co.model) {
|
|
77
|
-
lines.push(` provider: ${coProvider} / ${coModel}`);
|
|
79
|
+
if (output.legacyFilesDetected.length > 0) {
|
|
80
|
+
lines.push('Legacy files detected (not used for resolution):');
|
|
81
|
+
for (const f of output.legacyFilesDetected) {
|
|
82
|
+
lines.push(` [!] ${f}`);
|
|
78
83
|
}
|
|
79
|
-
lines.push(
|
|
80
|
-
lines.push(` reason: ${co.reason}`);
|
|
81
|
-
lines.push(` nextAction: ${co.nextAction}`);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
lines.push(' (no internal agents diagnosed)');
|
|
84
|
+
lines.push('');
|
|
85
85
|
}
|
|
86
|
-
lines.push('');
|
|
87
86
|
if (output.warnings.length > 0) {
|
|
88
87
|
lines.push('Warnings:');
|
|
89
88
|
for (const w of output.warnings) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-doctor.js","sourceRoot":"","sources":["../../src/commands/config-doctor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config-doctor.js","sourceRoot":"","sources":["../../src/commands/config-doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAqB,MAAM,8BAA8B,CAAC;AAOpF,SAAS,gBAAgB,CAAC,MAAoB;IAC5C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAE3F,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC/B,KAAK,CAAC,IAAI,CAAC,WAAW,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACnE,KAAK,CAAC,IAAI,CAAC,cAAc,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QAC1D,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;QACnD,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC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|
4
|
+
* PRI-305: Cutover from .pd/feature-flags.yaml to .pd/config.yaml.
|
|
5
|
+
* Uses core computeFeatureFlagsFromConfig for flag computation.
|
|
6
|
+
* --json outputs a single parseable JSON object.
|
|
7
|
+
* Missing config uses core defaults with nextAction.
|
|
8
|
+
* Malformed config fails loud with reason and nextAction.
|
|
9
|
+
* No secret output.
|
|
10
|
+
*/
|
|
11
|
+
export interface RuntimeFeaturesOutput {
|
|
12
|
+
status: 'ok' | 'degraded' | 'failed';
|
|
13
|
+
source: 'defaults' | 'user_config' | 'malformed';
|
|
4
14
|
configPath: string;
|
|
5
|
-
|
|
15
|
+
features: {
|
|
6
16
|
id: string;
|
|
7
17
|
category: string;
|
|
8
18
|
enabled: boolean;
|
|
9
|
-
since: string;
|
|
10
|
-
description?: string;
|
|
11
19
|
}[];
|
|
12
|
-
|
|
20
|
+
enabledMvpChannels: string[];
|
|
13
21
|
totalFlags: number;
|
|
14
22
|
enabledCount: number;
|
|
15
23
|
disabledCount: number;
|
|
24
|
+
warnings: string[];
|
|
16
25
|
reason?: string;
|
|
17
26
|
nextAction?: string;
|
|
27
|
+
/** Malformed config errors (only present when source=malformed) */
|
|
28
|
+
errors?: {
|
|
29
|
+
path: string;
|
|
30
|
+
reason: string;
|
|
31
|
+
nextAction: string;
|
|
32
|
+
}[];
|
|
18
33
|
}
|
|
34
|
+
export declare function buildRuntimeFeaturesStatus(workspaceDir: string): RuntimeFeaturesOutput;
|
|
19
35
|
interface FeaturesOptions {
|
|
20
36
|
workspace?: string;
|
|
21
37
|
json?: boolean;
|
|
22
38
|
}
|
|
23
|
-
export declare function buildFeatureFlagsStatus(workspaceDir: string): FeatureFlagsStatusOutput;
|
|
24
39
|
export declare function handleRuntimeFeaturesStatus(opts: FeaturesOptions): Promise<void>;
|
|
25
40
|
export {};
|
|
26
41
|
//# sourceMappingURL=runtime-features.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-features.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-features.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime-features.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;IACrC,MAAM,EAAE,UAAU,GAAG,aAAa,GAAG,WAAW,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;KAClB,EAAE,CAAC;IACJ,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACjE;AAID,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,qBAAqB,CA6CtF;AAkDD,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF"}
|
|
@@ -1,56 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd runtime features — Show effective feature flags from .pd/config.yaml.
|
|
3
|
+
*
|
|
4
|
+
* PRI-305: Cutover from .pd/feature-flags.yaml to .pd/config.yaml.
|
|
5
|
+
* Uses core computeFeatureFlagsFromConfig for flag computation.
|
|
6
|
+
* --json outputs a single parseable JSON object.
|
|
7
|
+
* Missing config uses core defaults with nextAction.
|
|
8
|
+
* Malformed config fails loud with reason and nextAction.
|
|
9
|
+
* No secret output.
|
|
10
|
+
*/
|
|
1
11
|
import * as path from 'path';
|
|
2
|
-
import {
|
|
12
|
+
import { loadPdConfig, computeFlagsFromLoadResult } from '../services/pd-config-loader.js';
|
|
3
13
|
import { resolveWorkspaceDir } from '../resolve-workspace.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
// ── Build output ─────────────────────────────────────────────────────────────
|
|
15
|
+
export function buildRuntimeFeaturesStatus(workspaceDir) {
|
|
16
|
+
const loadResult = loadPdConfig(workspaceDir);
|
|
17
|
+
const flags = computeFlagsFromLoadResult(loadResult);
|
|
18
|
+
const allFlags = Object.values(flags.flags);
|
|
19
|
+
const enabledCount = allFlags.filter(f => f.enabled).length;
|
|
20
|
+
const features = allFlags.map(f => ({
|
|
21
|
+
id: f.id,
|
|
22
|
+
category: f.category,
|
|
23
|
+
enabled: f.enabled,
|
|
24
|
+
}));
|
|
25
|
+
// Determine status
|
|
26
|
+
let status = 'ok';
|
|
27
|
+
const warnings = [...loadResult.warnings, ...flags.warnings];
|
|
28
|
+
if (!loadResult.ok) {
|
|
29
|
+
status = 'failed';
|
|
30
|
+
}
|
|
31
|
+
else if (warnings.length > 0) {
|
|
32
|
+
status = 'degraded';
|
|
33
|
+
}
|
|
34
|
+
const output = {
|
|
35
|
+
status,
|
|
36
|
+
source: loadResult.ok ? loadResult.source : 'malformed',
|
|
37
|
+
configPath: loadResult.configPath,
|
|
38
|
+
features,
|
|
39
|
+
enabledMvpChannels: [...flags.enabledChannels],
|
|
40
|
+
totalFlags: allFlags.length,
|
|
22
41
|
enabledCount,
|
|
23
|
-
disabledCount:
|
|
24
|
-
|
|
25
|
-
reason: `Config warnings: ${effective.warnings.join('; ')}`,
|
|
26
|
-
nextAction: 'Review feature-flags.yaml for malformed overrides or unknown flags',
|
|
27
|
-
} : {}),
|
|
42
|
+
disabledCount: allFlags.length - enabledCount,
|
|
43
|
+
warnings,
|
|
28
44
|
};
|
|
45
|
+
// Add reason and nextAction for non-ok states
|
|
46
|
+
if (!loadResult.ok) {
|
|
47
|
+
output.reason = `Config validation failed: ${loadResult.errors.map(e => e.reason).join('; ')}`;
|
|
48
|
+
output.nextAction = loadResult.errors[0]?.nextAction ?? 'Fix .pd/config.yaml and retry';
|
|
49
|
+
output.errors = loadResult.errors;
|
|
50
|
+
}
|
|
51
|
+
else if (warnings.length > 0) {
|
|
52
|
+
output.reason = `Config warnings: ${warnings.slice(0, 3).join('; ')}`;
|
|
53
|
+
output.nextAction = 'Review .pd/config.yaml for warnings';
|
|
54
|
+
}
|
|
55
|
+
return output;
|
|
29
56
|
}
|
|
57
|
+
// ── Text formatting ──────────────────────────────────────────────────────────
|
|
30
58
|
function formatTextOutput(output) {
|
|
31
59
|
const lines = [];
|
|
32
|
-
lines.push('PD
|
|
60
|
+
lines.push('PD Runtime Features');
|
|
33
61
|
lines.push(`source: ${output.source}`);
|
|
34
62
|
lines.push(`config: ${output.configPath}`);
|
|
35
63
|
lines.push('');
|
|
36
|
-
const categoryOrder = ['core', 'quiet', 'gone'
|
|
64
|
+
const categoryOrder = ['core', 'quiet', 'gone'];
|
|
37
65
|
for (const category of categoryOrder) {
|
|
38
|
-
const categoryFlags = output.
|
|
66
|
+
const categoryFlags = output.features.filter(f => f.category === category);
|
|
39
67
|
if (categoryFlags.length === 0)
|
|
40
68
|
continue;
|
|
41
69
|
lines.push(` ${category.toUpperCase()} (${categoryFlags.length})`);
|
|
42
70
|
for (const flag of categoryFlags) {
|
|
43
71
|
const icon = flag.enabled ? '+' : '-';
|
|
44
|
-
lines.push(` [${icon}] ${flag.id}
|
|
72
|
+
lines.push(` [${icon}] ${flag.id}`);
|
|
45
73
|
}
|
|
46
74
|
lines.push('');
|
|
47
75
|
}
|
|
48
76
|
lines.push(`Total: ${output.totalFlags} flags, ${output.enabledCount} enabled, ${output.disabledCount} disabled`);
|
|
77
|
+
lines.push(`MVP channels: ${output.enabledMvpChannels.length > 0 ? output.enabledMvpChannels.join(', ') : '(none)'}`);
|
|
49
78
|
if (output.warnings.length > 0) {
|
|
50
79
|
lines.push('');
|
|
51
80
|
lines.push('Warnings:');
|
|
52
|
-
for (const
|
|
53
|
-
lines.push(` [!] ${
|
|
81
|
+
for (const w of output.warnings) {
|
|
82
|
+
lines.push(` [!] ${w}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (output.errors && output.errors.length > 0) {
|
|
86
|
+
lines.push('');
|
|
87
|
+
lines.push('Errors:');
|
|
88
|
+
for (const e of output.errors) {
|
|
89
|
+
lines.push(` [x] ${e.path}: ${e.reason}`);
|
|
90
|
+
lines.push(` → ${e.nextAction}`);
|
|
54
91
|
}
|
|
55
92
|
}
|
|
56
93
|
return lines.join('\n');
|
|
@@ -59,12 +96,16 @@ export async function handleRuntimeFeaturesStatus(opts) {
|
|
|
59
96
|
const workspaceDir = opts.workspace
|
|
60
97
|
? path.resolve(opts.workspace)
|
|
61
98
|
: resolveWorkspaceDir();
|
|
62
|
-
const output =
|
|
99
|
+
const output = buildRuntimeFeaturesStatus(workspaceDir);
|
|
63
100
|
if (opts.json) {
|
|
101
|
+
// JSON mode: single parseable object on stdout
|
|
64
102
|
console.log(JSON.stringify(output, null, 2));
|
|
65
103
|
}
|
|
66
104
|
else {
|
|
67
105
|
console.log(formatTextOutput(output));
|
|
68
106
|
}
|
|
107
|
+
if (output.status === 'failed') {
|
|
108
|
+
process.exitCode = 1;
|
|
109
|
+
}
|
|
69
110
|
}
|
|
70
111
|
//# sourceMappingURL=runtime-features.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-features.js","sourceRoot":"","sources":["../../src/commands/runtime-features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime-features.js","sourceRoot":"","sources":["../../src/commands/runtime-features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAwB9D,gFAAgF;AAEhF,MAAM,UAAU,0BAA0B,CAAC,YAAoB;IAC7D,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC5D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClC,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,OAAO,EAAE,CAAC,CAAC,OAAO;KACnB,CAAC,CAAC,CAAC;IAEJ,mBAAmB;IACnB,IAAI,MAAM,GAAoC,IAAI,CAAC;IACnD,MAAM,QAAQ,GAAG,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE7D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+CAA+C;QAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* pd config doctor — Discover and explain PD / OpenClaw configuration state.
|
|
3
|
+
*
|
|
4
|
+
* PRI-305: Cutover to .pd/config.yaml.
|
|
5
|
+
* - Feature flags and internal agent runtime bindings come from .pd/config.yaml
|
|
6
|
+
* - .pd/feature-flags.yaml and .state/workflows.yaml are no longer production inputs
|
|
7
|
+
* - Legacy files are detected and reported as warnings
|
|
3
8
|
*
|
|
4
9
|
* PRI-299 MVP UX: provides a single, read-only view of:
|
|
5
10
|
* - PD workspace config paths (with existence checks)
|
|
6
11
|
* - OpenClaw config paths (with existence checks)
|
|
7
|
-
* - Effective feature flags
|
|
12
|
+
* - Effective feature flags from .pd/config.yaml
|
|
13
|
+
* - Internal agent runtime binding readiness from .pd/config.yaml
|
|
8
14
|
* - Provider/model/auth status (classified)
|
|
9
15
|
*
|
|
10
16
|
* Constraints:
|
|
@@ -13,24 +19,21 @@
|
|
|
13
19
|
* - Missing/malformed config produces a structured warning, never a crash.
|
|
14
20
|
* - Failures include `reason` and `nextAction` for operator guidance.
|
|
15
21
|
*/
|
|
16
|
-
export type DoctorClassification = 'healthy' | 'config_missing' | 'auth_missing' | 'rate_limit' | 'unavailable' | 'parse_failure' | 'unknown';
|
|
22
|
+
export type DoctorClassification = 'healthy' | 'config_missing' | 'auth_missing' | 'needs_probe' | 'rate_limit' | 'unavailable' | 'parse_failure' | 'unknown';
|
|
17
23
|
export type DoctorStatus = 'ok' | 'degraded' | 'failed';
|
|
18
24
|
export interface ConfigPathEntry {
|
|
19
25
|
path: string;
|
|
20
26
|
exists: boolean;
|
|
21
|
-
/** Optional structural check (file is parseable JSON/YAML, etc.) */
|
|
22
27
|
parseable?: boolean;
|
|
23
28
|
}
|
|
24
29
|
export interface ProviderHealthEntry {
|
|
25
30
|
provider: string | null;
|
|
26
31
|
model: string | null;
|
|
27
32
|
apiKeyEnv: string | null;
|
|
28
|
-
/** True if the env var name is non-empty and the env var is set. */
|
|
29
33
|
apiKeyPresent: boolean;
|
|
30
34
|
classification: DoctorClassification;
|
|
31
35
|
reason: string;
|
|
32
36
|
nextAction: string;
|
|
33
|
-
/** Source of the discovered config (e.g., 'workflows.yaml', 'cli_flag', 'default'). */
|
|
34
37
|
source: string;
|
|
35
38
|
}
|
|
36
39
|
export interface FeatureFlagSummary {
|
|
@@ -40,14 +43,26 @@ export interface FeatureFlagSummary {
|
|
|
40
43
|
disabledFlags: string[];
|
|
41
44
|
warnings: string[];
|
|
42
45
|
}
|
|
46
|
+
export interface InternalAgentDiagnostics {
|
|
47
|
+
name: string;
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
runtimeProfileId: string;
|
|
50
|
+
runtimeProfileLabel: string;
|
|
51
|
+
readiness: 'ready' | 'not_ready' | 'needs_setup' | 'disabled' | 'unknown';
|
|
52
|
+
provider: string | null;
|
|
53
|
+
model: string | null;
|
|
54
|
+
apiKeyEnv: string | null;
|
|
55
|
+
apiKeyPresent: boolean;
|
|
56
|
+
reason: string;
|
|
57
|
+
nextAction: string;
|
|
58
|
+
}
|
|
43
59
|
export interface DoctorOutput {
|
|
44
60
|
status: DoctorStatus;
|
|
45
61
|
workspaceDir: string;
|
|
46
62
|
pdConfigPaths: {
|
|
47
63
|
workspaceDir: ConfigPathEntry;
|
|
48
64
|
pdDir: ConfigPathEntry;
|
|
49
|
-
|
|
50
|
-
workflowsYaml: ConfigPathEntry;
|
|
65
|
+
configYaml: ConfigPathEntry;
|
|
51
66
|
stateDb: ConfigPathEntry;
|
|
52
67
|
};
|
|
53
68
|
openclawConfigPaths: {
|
|
@@ -55,35 +70,18 @@ export interface DoctorOutput {
|
|
|
55
70
|
openclawConfig: ConfigPathEntry;
|
|
56
71
|
};
|
|
57
72
|
featureFlags: FeatureFlagSummary;
|
|
73
|
+
internalAgents: InternalAgentDiagnostics[];
|
|
58
74
|
providerHealth: ProviderHealthEntry[];
|
|
59
|
-
internalAgents: {
|
|
60
|
-
correctionObserver: {
|
|
61
|
-
enabled: boolean;
|
|
62
|
-
flagSource: string;
|
|
63
|
-
status: 'disabled' | 'configured' | 'auth_missing' | 'config_missing' | 'unavailable';
|
|
64
|
-
configSource: 'workflows.yaml' | 'env' | 'missing' | 'unavailable';
|
|
65
|
-
provider: string | null;
|
|
66
|
-
model: string | null;
|
|
67
|
-
apiKeyEnv: string | null;
|
|
68
|
-
apiKeyPresent: boolean;
|
|
69
|
-
reason: string;
|
|
70
|
-
nextAction: string;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
75
|
warnings: string[];
|
|
74
76
|
reason?: string;
|
|
75
77
|
nextActions: string[];
|
|
78
|
+
/** Legacy files detected (informational only, not used for resolution) */
|
|
79
|
+
legacyFilesDetected: string[];
|
|
76
80
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Resolve the OpenClaw home directory used to look up `openclaw.json` and
|
|
79
|
-
* extension state. PD does not own this path — it only reports its existence.
|
|
80
|
-
*/
|
|
81
81
|
export declare function getOpenClawHome(): string;
|
|
82
82
|
export declare function getOpenClawConfigPath(): string;
|
|
83
83
|
export interface InspectStateDbOptions {
|
|
84
|
-
/** Max rows to scan from tasks table. */
|
|
85
84
|
maxRows?: number;
|
|
86
|
-
/** Max age in ms — only signals within this window are considered "recent". */
|
|
87
85
|
maxAgeMs?: number;
|
|
88
86
|
}
|
|
89
87
|
export interface RecentProviderSignal {
|
|
@@ -93,50 +91,12 @@ export interface RecentProviderSignal {
|
|
|
93
91
|
}
|
|
94
92
|
export interface StateDbSignalResult {
|
|
95
93
|
signal: RecentProviderSignal | null;
|
|
96
|
-
/** True if the DB was found and could be opened in readonly mode. */
|
|
97
94
|
dbReachable: boolean;
|
|
98
|
-
/** Optional warning when the DB exists but couldn't be read. */
|
|
99
95
|
warning?: string;
|
|
100
96
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Read the state.db recent provider error signal (best-effort, structural only).
|
|
103
|
-
*
|
|
104
|
-
* We inspect recent task/run rows in `<workspaceDir>/.pd/state.db` to detect
|
|
105
|
-
* `rate_limit` / `auth_missing` / `unavailable` signals from the live pipeline.
|
|
106
|
-
* This is a bounded best-effort probe — if the DB is missing or unreadable we
|
|
107
|
-
* return `null` and let the doctor fall back to config-only classification.
|
|
108
|
-
*/
|
|
109
97
|
export declare function inspectStateDbForProviderSignal(stateDbPath: string, nowMs?: number, opts?: InspectStateDbOptions): Promise<StateDbSignalResult>;
|
|
110
|
-
/**
|
|
111
|
-
* Resolve the provider/model/apiKeyEnv from the workspace's `workflows.yaml`
|
|
112
|
-
* funnel policy. Returns `null` for each field when not configured.
|
|
113
|
-
*
|
|
114
|
-
* NEVER leaks api key values or env var values.
|
|
115
|
-
*/
|
|
116
|
-
export interface ProviderConfigFromWorkflows {
|
|
117
|
-
provider: string | null;
|
|
118
|
-
model: string | null;
|
|
119
|
-
apiKeyEnv: string | null;
|
|
120
|
-
baseUrl: string | null;
|
|
121
|
-
source: 'workflows.yaml' | 'cli_flag' | 'default' | 'missing';
|
|
122
|
-
/** True if the workflows.yaml file was found and parseable. */
|
|
123
|
-
workflowsFound: boolean;
|
|
124
|
-
/** Parse warning, if any. */
|
|
125
|
-
parseWarning?: string;
|
|
126
|
-
}
|
|
127
|
-
export declare function resolveProviderConfigFromWorkflows(stateDir: string, opts?: {
|
|
128
|
-
cliProvider?: string;
|
|
129
|
-
cliModel?: string;
|
|
130
|
-
cliApiKeyEnv?: string;
|
|
131
|
-
cliBaseUrl?: string;
|
|
132
|
-
}): Promise<ProviderConfigFromWorkflows>;
|
|
133
98
|
export interface BuildDoctorInput {
|
|
134
99
|
workspaceDir: string;
|
|
135
|
-
/** Optional CLI overrides for provider/model/apiKeyEnv. */
|
|
136
|
-
cliProvider?: string;
|
|
137
|
-
cliModel?: string;
|
|
138
|
-
cliApiKeyEnv?: string;
|
|
139
|
-
cliBaseUrl?: string;
|
|
140
100
|
}
|
|
141
101
|
export declare function buildDoctorOutput(input: BuildDoctorInput): Promise<DoctorOutput>;
|
|
142
102
|
//# sourceMappingURL=config-doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-doctor.d.ts","sourceRoot":"","sources":["../../src/services/config-doctor.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config-doctor.d.ts","sourceRoot":"","sources":["../../src/services/config-doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAoBH,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,gBAAgB,GAChB,cAAc,GACd,aAAa,GACb,YAAY,GACZ,aAAa,GACb,eAAe,GACf,SAAS,CAAC;AAEd,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,oBAAoB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAA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