@principles/pd-cli 1.147.15 → 1.147.17
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/runtime-internalization-run-once.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-once.js +23 -7
- package/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/dist/services/__tests__/evaluator-runner-deps.test.js +27 -0
- package/dist/services/__tests__/evaluator-runner-deps.test.js.map +1 -1
- package/dist/services/__tests__/runtime-adapter-resolver.test.js +4 -1
- package/dist/services/__tests__/runtime-adapter-resolver.test.js.map +1 -1
- package/dist/services/resolve-runtime-from-pd-config.d.ts +28 -2
- package/dist/services/resolve-runtime-from-pd-config.d.ts.map +1 -1
- package/dist/services/resolve-runtime-from-pd-config.js +19 -6
- package/dist/services/resolve-runtime-from-pd-config.js.map +1 -1
- package/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/dist/services/rulehost-pipeline-runner.js +12 -4
- package/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/dist/services/rulehost-readiness.js +1 -1
- package/dist/services/rulehost-readiness.js.map +1 -1
- package/dist/services/runtime-adapter-resolver.d.ts +14 -1
- package/dist/services/runtime-adapter-resolver.d.ts.map +1 -1
- package/dist/services/runtime-adapter-resolver.js +4 -1
- package/dist/services/runtime-adapter-resolver.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/runtime-internalization-run-once.ts +23 -7
- package/src/services/__tests__/evaluator-runner-deps.test.ts +29 -0
- package/src/services/__tests__/runtime-adapter-resolver.test.ts +4 -1
- package/src/services/resolve-runtime-from-pd-config.ts +44 -6
- package/src/services/rulehost-pipeline-runner.ts +18 -3
- package/src/services/rulehost-readiness.ts +1 -1
- package/src/services/runtime-adapter-resolver.ts +18 -2
- package/tests/commands/pri-393-runtime-config-unification.test.ts +13 -11
- package/tests/commands/runtime-internalization-run-once-language.test.ts +12 -0
- package/tests/commands/runtime-internalization-run-once-real-config.test.ts +237 -0
- package/tests/commands/runtime-internalization-run-once.test.ts +21 -5
- package/tests/services/resolve-runtime-from-pd-config.test.ts +3 -3
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-719 review — real-config composition tests (NO core module mock).
|
|
3
|
+
*
|
|
4
|
+
* The run-once unit suites mock `@principles/core/runtime-v2`, which cannot
|
|
5
|
+
* prove real default-config behavior. These tests drive the REAL resolver
|
|
6
|
+
* chain (resolveRuntimeFromPdConfig → resolveRuntimeConfigForAgent →
|
|
7
|
+
* resolveRuntimeAdapterFromConfig) against real workspaces built from
|
|
8
|
+
* `getDefaultPdConfig()`:
|
|
9
|
+
*
|
|
10
|
+
* Case 1 evaluator shipped disabled + explicit runtimeProfile → an
|
|
11
|
+
* explicit peer run-once resolves ITS profile (no
|
|
12
|
+
* "Agent 'evaluator' is disabled"), because peer execution scope
|
|
13
|
+
* is the internalization_full_chain flag — the same
|
|
14
|
+
* ignoreAgentEnabled semantics the auto-consumer uses.
|
|
15
|
+
* Case 2 rolloutReviewer shipped disabled — same resolution.
|
|
16
|
+
* Case 3 per-agent isolation: diagnostician→profile-A, evaluator→B;
|
|
17
|
+
* the run-once seam resolves profile-B.
|
|
18
|
+
* Case 4 the diagnostician bridge gate still HONORS enabled (no global
|
|
19
|
+
* bypass leaked from the peer option).
|
|
20
|
+
* B7 cross-entry equivalence: run-once path and auto-consumer path
|
|
21
|
+
* resolve IDENTICAL runtimeProfileId/provider/model for the same
|
|
22
|
+
* config (runtime binding must not drift across entry points).
|
|
23
|
+
*/
|
|
24
|
+
import { describe, expect, it } from 'vitest';
|
|
25
|
+
import fs from 'node:fs';
|
|
26
|
+
import os from 'node:os';
|
|
27
|
+
import path from 'node:path';
|
|
28
|
+
import {
|
|
29
|
+
computeEffectivePdConfig,
|
|
30
|
+
getDefaultPdConfig,
|
|
31
|
+
resolveRuntimeConfigForAgent,
|
|
32
|
+
AGENT_NAME_FOR_TASK_KIND,
|
|
33
|
+
type RuntimeConfigError,
|
|
34
|
+
} from '@principles/core/runtime-v2';
|
|
35
|
+
import { resolveRuntimeFromPdConfig } from '../../src/services/resolve-runtime-from-pd-config.js';
|
|
36
|
+
import { resolveRuntimeAdapterFromConfig } from '../../src/services/runtime-adapter-resolver.js';
|
|
37
|
+
|
|
38
|
+
const dirs: string[] = [];
|
|
39
|
+
|
|
40
|
+
function makeWorkspace(): string {
|
|
41
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pd-runonce-profile-'));
|
|
42
|
+
dirs.push(root);
|
|
43
|
+
fs.mkdirSync(path.join(root, '.pd'), { recursive: true });
|
|
44
|
+
return root;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function writeProfileConfig(root: string, agents: Record<string, string>): void {
|
|
48
|
+
const config = getDefaultPdConfig();
|
|
49
|
+
(config.runtimeProfiles as Record<string, unknown>) = {
|
|
50
|
+
...(config.runtimeProfiles as Record<string, unknown>),
|
|
51
|
+
'profile-diagnostician': {
|
|
52
|
+
type: 'pi-ai', provider: 'prov-diag', model: 'diag-model', apiKeyEnv: 'DIAG_KEY',
|
|
53
|
+
baseUrl: 'http://127.0.0.1:9001/v1',
|
|
54
|
+
},
|
|
55
|
+
'profile-evaluator': {
|
|
56
|
+
type: 'pi-ai', provider: 'prov-evaluator', model: 'evaluator-model', apiKeyEnv: 'EVAL_KEY',
|
|
57
|
+
baseUrl: 'http://127.0.0.1:9002/v1',
|
|
58
|
+
},
|
|
59
|
+
'profile-rollout': {
|
|
60
|
+
type: 'pi-ai', provider: 'prov-rollout', model: 'rollout-model', apiKeyEnv: 'ROLLOUT_KEY',
|
|
61
|
+
baseUrl: 'http://127.0.0.1:9003/v1',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const agentBindings = config.internalAgents.agents as Record<string, { enabled: boolean; runtimeProfile?: string }>;
|
|
65
|
+
// The shipped default config pins every agent's runtimeProfile — replace
|
|
66
|
+
// the DECLARED profiles per the scenario; enabled flags stay at their
|
|
67
|
+
// shipped values (evaluator/rolloutReviewer/philosopher = false).
|
|
68
|
+
for (const [agent, profileId] of Object.entries(agents)) {
|
|
69
|
+
agentBindings[agent] = { ...agentBindings[agent], runtimeProfile: profileId };
|
|
70
|
+
}
|
|
71
|
+
// JSON is valid YAML — same trick the sibling composition tests use.
|
|
72
|
+
fs.writeFileSync(path.join(root, '.pd', 'config.yaml'), JSON.stringify(config));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function readAdapterConfig(adapter: unknown): { provider?: string; model?: string } {
|
|
76
|
+
return (adapter as unknown as { config: { provider?: string; model?: string } }).config;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isErr(result: unknown): RuntimeConfigError {
|
|
80
|
+
return result as RuntimeConfigError;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
describe('PRI-719 review — explicit run-once resolves shipped-disabled peer agents on their own profile (real config)', () => {
|
|
84
|
+
it('Case 1: evaluator enabled=false (default) + declared profile → run-once seam resolves profile-evaluator', () => {
|
|
85
|
+
const ws = makeWorkspace();
|
|
86
|
+
writeProfileConfig(ws, { evaluator: 'profile-evaluator' });
|
|
87
|
+
process.env.EVAL_KEY = 'test-key';
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const resolved = resolveRuntimeFromPdConfig(ws, {
|
|
91
|
+
agentName: 'evaluator',
|
|
92
|
+
ignoreAgentEnabled: true,
|
|
93
|
+
});
|
|
94
|
+
expect(resolved.result).not.toHaveProperty('ok');
|
|
95
|
+
if (resolved.result.ok === false) return;
|
|
96
|
+
expect(resolved.result.runtimeKind).toBe('pi-ai');
|
|
97
|
+
expect(resolved.result.provider).toBe('prov-evaluator');
|
|
98
|
+
expect(resolved.result.model).toBe('evaluator-model');
|
|
99
|
+
expect(resolved.result.runtimeProfileId).toBe('profile-evaluator');
|
|
100
|
+
|
|
101
|
+
// The run-once ADAPTER seam resolves the same profile into the adapter.
|
|
102
|
+
const adapter = resolveRuntimeAdapterFromConfig({
|
|
103
|
+
runtimeKind: 'config',
|
|
104
|
+
workspaceDir: ws,
|
|
105
|
+
runnerKind: 'evaluator',
|
|
106
|
+
agentName: 'evaluator',
|
|
107
|
+
ignoreAgentEnabled: true,
|
|
108
|
+
});
|
|
109
|
+
// The real (unmocked) adapter has no `__type` marker — assert via kind().
|
|
110
|
+
expect(adapter.kind()).toBe('pi-ai');
|
|
111
|
+
expect(readAdapterConfig(adapter)).toMatchObject({
|
|
112
|
+
provider: 'prov-evaluator', model: 'evaluator-model',
|
|
113
|
+
});
|
|
114
|
+
} finally {
|
|
115
|
+
delete process.env.EVAL_KEY;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('Case 2: rolloutReviewer enabled=false (default) → run-once seam resolves profile-rollout', () => {
|
|
120
|
+
const ws = makeWorkspace();
|
|
121
|
+
writeProfileConfig(ws, { rolloutReviewer: 'profile-rollout' });
|
|
122
|
+
process.env.ROLLOUT_KEY = 'test-key';
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
// Through the canonical taskKind→agent map, as run-once does.
|
|
126
|
+
const agentName = AGENT_NAME_FOR_TASK_KIND['rollout_reviewer'];
|
|
127
|
+
expect(agentName).toBe('rolloutReviewer');
|
|
128
|
+
const resolved = resolveRuntimeFromPdConfig(ws, { agentName, ignoreAgentEnabled: true });
|
|
129
|
+
if (resolved.result.ok === false) throw new Error(resolved.result.message);
|
|
130
|
+
expect(resolved.result.provider).toBe('prov-rollout');
|
|
131
|
+
expect(resolved.result.runtimeProfileId).toBe('profile-rollout');
|
|
132
|
+
} finally {
|
|
133
|
+
delete process.env.ROLLOUT_KEY;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('Case 3: per-agent isolation — evaluator resolves ITS profile, not the diagnostician one', () => {
|
|
138
|
+
const ws = makeWorkspace();
|
|
139
|
+
writeProfileConfig(ws, { diagnostician: 'profile-diagnostician', evaluator: 'profile-evaluator' });
|
|
140
|
+
process.env.DIAG_KEY = 'test-key';
|
|
141
|
+
process.env.EVAL_KEY = 'test-key';
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
const adapter = resolveRuntimeAdapterFromConfig({
|
|
145
|
+
runtimeKind: 'config',
|
|
146
|
+
workspaceDir: ws,
|
|
147
|
+
runnerKind: 'evaluator',
|
|
148
|
+
agentName: 'evaluator',
|
|
149
|
+
ignoreAgentEnabled: true,
|
|
150
|
+
});
|
|
151
|
+
expect(readAdapterConfig(adapter)).toMatchObject({
|
|
152
|
+
provider: 'prov-evaluator', model: 'evaluator-model',
|
|
153
|
+
});
|
|
154
|
+
} finally {
|
|
155
|
+
delete process.env.DIAG_KEY;
|
|
156
|
+
delete process.env.EVAL_KEY;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('negative control: without ignoreAgentEnabled the shipped-disabled evaluator still refuses', () => {
|
|
161
|
+
const ws = makeWorkspace();
|
|
162
|
+
writeProfileConfig(ws, { evaluator: 'profile-evaluator' });
|
|
163
|
+
process.env.EVAL_KEY = 'test-key';
|
|
164
|
+
|
|
165
|
+
try {
|
|
166
|
+
// Pins that the option (not something else) lifts the gate: the same
|
|
167
|
+
// call without it honors enabled and refuses.
|
|
168
|
+
expect(() => resolveRuntimeAdapterFromConfig({
|
|
169
|
+
runtimeKind: 'config',
|
|
170
|
+
workspaceDir: ws,
|
|
171
|
+
runnerKind: 'evaluator',
|
|
172
|
+
agentName: 'evaluator',
|
|
173
|
+
})).toThrow(/disabled/);
|
|
174
|
+
} finally {
|
|
175
|
+
delete process.env.EVAL_KEY;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('Case 4: diagnostician bridge gate still HONORS enabled (no global bypass)', () => {
|
|
180
|
+
const ws = makeWorkspace();
|
|
181
|
+
writeProfileConfig(ws, { diagnostician: 'profile-diagnostician' });
|
|
182
|
+
process.env.DIAG_KEY = 'test-key';
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
const config = JSON.parse(fs.readFileSync(path.join(ws, '.pd', 'config.yaml'), 'utf8'));
|
|
186
|
+
config.internalAgents.agents.diagnostician.enabled = false;
|
|
187
|
+
fs.writeFileSync(path.join(ws, '.pd', 'config.yaml'), JSON.stringify(config));
|
|
188
|
+
|
|
189
|
+
// Canonical diagnostician resolution (the pain-signal bridge path)
|
|
190
|
+
// keeps failing closed with readiness=disabled.
|
|
191
|
+
const viaWrapper = resolveRuntimeFromPdConfig(ws);
|
|
192
|
+
expect(viaWrapper.result).toHaveProperty('ok', false);
|
|
193
|
+
expect(isErr(viaWrapper.result).reason).toBe('disabled');
|
|
194
|
+
|
|
195
|
+
const viaCore = resolveRuntimeConfigForAgent(
|
|
196
|
+
computeEffectivePdConfig(config),
|
|
197
|
+
'diagnostician',
|
|
198
|
+
{ getEnvVar: (name) => process.env[name] },
|
|
199
|
+
);
|
|
200
|
+
expect(viaCore).toHaveProperty('ok', false);
|
|
201
|
+
expect(isErr(viaCore).reason).toBe('disabled');
|
|
202
|
+
} finally {
|
|
203
|
+
delete process.env.DIAG_KEY;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('B7 cross-entry equivalence: run-once path and auto-consumer path resolve the SAME binding', () => {
|
|
208
|
+
const ws = makeWorkspace();
|
|
209
|
+
writeProfileConfig(ws, { diagnostician: 'profile-diagnostician', evaluator: 'profile-evaluator' });
|
|
210
|
+
process.env.EVAL_KEY = 'test-key';
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
// Auto-consumer path: per-kind resolution with peer scope semantics.
|
|
214
|
+
const consumerResult = resolveRuntimeConfigForAgent(
|
|
215
|
+
computeEffectivePdConfig(JSON.parse(fs.readFileSync(path.join(ws, '.pd', 'config.yaml'), 'utf8'))),
|
|
216
|
+
'evaluator',
|
|
217
|
+
{ getEnvVar: (name) => process.env[name], ignoreAgentEnabled: true },
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
// Explicit run-once path: resolveRuntimeFromPdConfig with the same
|
|
221
|
+
// agent + scope semantics (exactly what run-once's two resolution
|
|
222
|
+
// points use).
|
|
223
|
+
const runOnceResult = resolveRuntimeFromPdConfig(ws, {
|
|
224
|
+
agentName: 'evaluator',
|
|
225
|
+
ignoreAgentEnabled: true,
|
|
226
|
+
}).result;
|
|
227
|
+
|
|
228
|
+
expect(runOnceResult).toEqual(consumerResult);
|
|
229
|
+
if (runOnceResult.ok === false || consumerResult.ok === false) return;
|
|
230
|
+
expect(runOnceResult.runtimeProfileId).toBe('profile-evaluator');
|
|
231
|
+
expect(runOnceResult.provider).toBe('prov-evaluator');
|
|
232
|
+
expect(runOnceResult.model).toBe('evaluator-model');
|
|
233
|
+
} finally {
|
|
234
|
+
delete process.env.EVAL_KEY;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
@@ -163,6 +163,19 @@ vi.mock('@principles/core/runtime-v2', () => ({
|
|
|
163
163
|
isRuntimeConfigError: vi.fn().mockImplementation((result: unknown) => result != null && typeof result === 'object' && Object.hasOwn(result, 'reason') && !Object.hasOwn(result, 'runtimeKind')),
|
|
164
164
|
validateRuntimeConfig: vi.fn(),
|
|
165
165
|
resolveRuntimeConfigFromPdConfig: vi.fn().mockReturnValue({ runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model', apiKeyEnv: 'TEST_API_KEY', timeoutMs: 300_000, agentId: 'main' }),
|
|
166
|
+
// PRI-719: run-once resolves the SELECTED runner's agent binding through
|
|
167
|
+
// the per-agent variant — this is the seam the PRI-670 timeout tests mock.
|
|
168
|
+
resolveRuntimeConfigForAgent: vi.fn().mockReturnValue({ runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model', apiKeyEnv: 'TEST_API_KEY', timeoutMs: 300_000, agentId: 'main' }),
|
|
169
|
+
// PRI-719: the real taskKind→agent mapping (stable constant, mirrored here
|
|
170
|
+
// because the whole core module is mocked in this file).
|
|
171
|
+
AGENT_NAME_FOR_TASK_KIND: {
|
|
172
|
+
dreamer: 'dreamer',
|
|
173
|
+
philosopher: 'philosopher',
|
|
174
|
+
scribe: 'scribe',
|
|
175
|
+
artificer: 'artificer',
|
|
176
|
+
evaluator: 'evaluator',
|
|
177
|
+
rollout_reviewer: 'rolloutReviewer',
|
|
178
|
+
},
|
|
166
179
|
resolveOutputLanguage: vi.fn().mockReturnValue({ outputLanguage: 'zh-CN' }),
|
|
167
180
|
}));
|
|
168
181
|
|
|
@@ -508,9 +521,12 @@ describe('handleRuntimeInternalizationRunOnce', () => {
|
|
|
508
521
|
const customWs = '/tmp/test-workspace';
|
|
509
522
|
await handleRuntimeInternalizationRunOnce({ workspace: customWs, runtime: 'config', json: true });
|
|
510
523
|
|
|
511
|
-
// PRI-393:
|
|
524
|
+
// PRI-393 + PRI-719 (+review): resolveRuntimeFromPdConfig is called with
|
|
525
|
+
// the workspace dir AND the selected runner's agent binding under the
|
|
526
|
+
// PEER ignoreAgentEnabled semantics (same as the auto-consumer).
|
|
512
527
|
expect(mockResolveRuntimeFromPdConfig).toHaveBeenCalledWith(
|
|
513
528
|
expect.stringContaining('test-workspace'),
|
|
529
|
+
{ agentName: 'dreamer', ignoreAgentEnabled: true },
|
|
514
530
|
);
|
|
515
531
|
});
|
|
516
532
|
|
|
@@ -824,7 +840,7 @@ describe('handleRuntimeInternalizationRunOnce', () => {
|
|
|
824
840
|
// the PRI-670 fix the runner deadline stayed hardcoded at 300s and the
|
|
825
841
|
// profile value only reached the adapter as a per-request timeout.
|
|
826
842
|
const coreModule = await import('@principles/core/runtime-v2');
|
|
827
|
-
vi.mocked(coreModule.
|
|
843
|
+
vi.mocked(coreModule.resolveRuntimeConfigForAgent).mockReturnValue({
|
|
828
844
|
runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model',
|
|
829
845
|
apiKeyEnv: 'TEST_API_KEY', timeoutMs: 600_000, agentId: 'main',
|
|
830
846
|
} as never);
|
|
@@ -857,7 +873,7 @@ describe('handleRuntimeInternalizationRunOnce', () => {
|
|
|
857
873
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0]);
|
|
858
874
|
expect(output.effectiveTimeoutMs).toBe(600_000);
|
|
859
875
|
} finally {
|
|
860
|
-
vi.mocked(coreModule.
|
|
876
|
+
vi.mocked(coreModule.resolveRuntimeConfigForAgent).mockReturnValue({
|
|
861
877
|
runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model',
|
|
862
878
|
apiKeyEnv: 'TEST_API_KEY', timeoutMs: 300_000, agentId: 'main',
|
|
863
879
|
} as never);
|
|
@@ -866,7 +882,7 @@ describe('handleRuntimeInternalizationRunOnce', () => {
|
|
|
866
882
|
|
|
867
883
|
it('PRI-670: --timeout-ms still wins over the profile timeoutMs', async () => {
|
|
868
884
|
const coreModule = await import('@principles/core/runtime-v2');
|
|
869
|
-
vi.mocked(coreModule.
|
|
885
|
+
vi.mocked(coreModule.resolveRuntimeConfigForAgent).mockReturnValue({
|
|
870
886
|
runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model',
|
|
871
887
|
apiKeyEnv: 'TEST_API_KEY', timeoutMs: 600_000, agentId: 'main',
|
|
872
888
|
} as never);
|
|
@@ -892,7 +908,7 @@ describe('handleRuntimeInternalizationRunOnce', () => {
|
|
|
892
908
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0]);
|
|
893
909
|
expect(output.effectiveTimeoutMs).toBe(120_000);
|
|
894
910
|
} finally {
|
|
895
|
-
vi.mocked(coreModule.
|
|
911
|
+
vi.mocked(coreModule.resolveRuntimeConfigForAgent).mockReturnValue({
|
|
896
912
|
runtimeKind: 'pi-ai', provider: 'test-provider', model: 'test-model',
|
|
897
913
|
apiKeyEnv: 'TEST_API_KEY', timeoutMs: 300_000, agentId: 'main',
|
|
898
914
|
} as never);
|
|
@@ -114,7 +114,7 @@ describe('buildProfileLabel', () => {
|
|
|
114
114
|
},
|
|
115
115
|
}));
|
|
116
116
|
try {
|
|
117
|
-
const result = resolveRuntimeFromPdConfig(tmp, mockEnvWithKeys);
|
|
117
|
+
const result = resolveRuntimeFromPdConfig(tmp, { getEnvVar: mockEnvWithKeys });
|
|
118
118
|
expect(result.runtimeProfileId).toBe('pi-ai.test');
|
|
119
119
|
expect(result.runtimeProfileLabel).toBe('pi-ai: openrouter/anthropic/claude-sonnet-4');
|
|
120
120
|
} finally { rmTmpDir(tmp); }
|
|
@@ -141,7 +141,7 @@ describe('buildProfileLabel', () => {
|
|
|
141
141
|
},
|
|
142
142
|
}));
|
|
143
143
|
try {
|
|
144
|
-
const result = resolveRuntimeFromPdConfig(tmp, mockEnvWithKeys);
|
|
144
|
+
const result = resolveRuntimeFromPdConfig(tmp, { getEnvVar: mockEnvWithKeys });
|
|
145
145
|
expect(result.runtimeProfileId).toBe(null);
|
|
146
146
|
expect(result.runtimeProfileLabel).toBe(null);
|
|
147
147
|
} finally { rmTmpDir(tmp); }
|
|
@@ -218,7 +218,7 @@ describe('resolveRuntimeFromPdConfig', () => {
|
|
|
218
218
|
const tmp = mkTmpDir();
|
|
219
219
|
writeConfig(tmp, makeValidPiAiConfigYaml(tmp));
|
|
220
220
|
try {
|
|
221
|
-
const result = resolveRuntimeFromPdConfig(tmp, mockEnvWithKeys);
|
|
221
|
+
const result = resolveRuntimeFromPdConfig(tmp, { getEnvVar: mockEnvWithKeys });
|
|
222
222
|
expect(isRuntimeConfigError(result.result)).toBe(false);
|
|
223
223
|
expect(result.configSource).toBe('.pd/config.yaml');
|
|
224
224
|
} finally { rmTmpDir(tmp); }
|