@principles/pd-cli 1.74.0 → 1.76.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/console.d.ts +18 -0
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +439 -0
- package/dist/commands/console.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/index.js +51 -15
- package/dist/index.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/console-launcher.d.ts +110 -0
- package/dist/services/console-launcher.d.ts.map +1 -0
- package/dist/services/console-launcher.js +282 -0
- package/dist/services/console-launcher.js.map +1 -0
- 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/console.ts +445 -1
- package/src/commands/runtime-features.ts +98 -44
- package/src/index.ts +55 -16
- package/src/services/config-doctor.ts +236 -425
- package/src/services/console-launcher.ts +373 -0
- package/src/services/pd-config-loader.ts +213 -0
- package/tests/commands/config-doctor.test.ts +207 -506
- package/tests/commands/console-open.test.ts +773 -0
- package/tests/commands/runtime-features.test.ts +220 -85
- package/tests/services/pd-config-loader.test.ts +479 -0
|
@@ -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,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,OAAO,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CA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