@principles/host-runtime 4.2.0 → 4.2.1
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.
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* mapping. Any missing identity/config/model keeps the Native path unchanged.
|
|
10
10
|
*/
|
|
11
11
|
import type { HostEvent } from '@principles/core/host';
|
|
12
|
-
import type
|
|
12
|
+
import { type ActivatedPrinciple, type PdConfig } from '@principles/core/runtime';
|
|
13
13
|
import type { AdaptiveGapOptions } from './active-principle-prompt.js';
|
|
14
14
|
import { type AdaptiveSelectionModel } from './adaptive-selection.js';
|
|
15
15
|
/** Independent switch. `features.host.codex.enabled` remains the whole-hook gate. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pdProviderCredentials } from '@principles/core/runtime';
|
|
1
2
|
import { loadPdConfigForPlugin } from './pd-config.js';
|
|
2
3
|
import { ADAPTIVE_SELECTION_LIMITS, runAdaptiveSelection, } from './adaptive-selection.js';
|
|
3
4
|
import { decideAdaptiveSkip } from './adaptive-skip-decision.js';
|
|
@@ -38,12 +39,12 @@ export function resolveAdaptiveSelectionModel(config, env, flag = ADAPTIVE_ACTIV
|
|
|
38
39
|
nextAction: 'Set endpoint (https URL), model and apiKeyEnv on adaptiveActivation',
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
if (
|
|
42
|
+
if (pdProviderCredentials.resolve(section.apiKeyEnv, { env }).value === null) {
|
|
42
43
|
return {
|
|
43
44
|
ok: false,
|
|
44
45
|
readiness: 'needs_setup',
|
|
45
|
-
reason: `
|
|
46
|
-
nextAction: `
|
|
46
|
+
reason: `No API key for '${section.apiKeyEnv}' in env or ~/.pd/credentials.yaml`,
|
|
47
|
+
nextAction: `Save an API key for '${section.apiKeyEnv}' in the console, or set the environment variable`,
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ActivatedPrinciple } from '@principles/core/runtime';
|
|
2
2
|
import { type DecisionOutcome, type DecisionProtocolError, type DecisionRequestEnvelope } from './adaptive-decision-protocol.js';
|
|
3
3
|
export declare const ADAPTIVE_SELECTION_LIMITS: {
|
|
4
4
|
readonly maxCandidates: 12;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* - Diagnostics never carry the raw prompt, the raw response, or credentials.
|
|
22
22
|
*/
|
|
23
23
|
import crypto from 'node:crypto';
|
|
24
|
+
import { pdProviderCredentials } from '@principles/core/runtime';
|
|
24
25
|
import { revalidateAdaptivePrinciple } from './adaptive-principle-revalidation.js';
|
|
25
26
|
import { ADAPTIVE_DECISION_MAX_CANDIDATE_CHARS, adjudicateDecision, buildDecisionRequest, validateDecisionResponse, } from './adaptive-decision-protocol.js';
|
|
26
27
|
export const ADAPTIVE_SELECTION_LIMITS = {
|
|
@@ -199,7 +200,7 @@ export function createDecisionSelector(options) {
|
|
|
199
200
|
diagnostics.cancelledAt = now();
|
|
200
201
|
fail('TURN_DEADLINE_EXCEEDED');
|
|
201
202
|
}
|
|
202
|
-
const apiKey =
|
|
203
|
+
const apiKey = pdProviderCredentials.resolve(options.model.apiKeyEnv).value;
|
|
203
204
|
if (!apiKey)
|
|
204
205
|
fail('DECISION_CREDENTIAL_MISSING');
|
|
205
206
|
const body = JSON.stringify(input.body);
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* No second model runtime is introduced (ADR-0029: pi-ai is the only backend).
|
|
14
14
|
*/
|
|
15
15
|
import path from 'node:path';
|
|
16
|
-
import { PiAiRuntimeAdapter, RUNTIME_CONTRACT_SCHEMA_VERSION, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, safeStringifyPreview, } from '@principles/core/runtime';
|
|
16
|
+
import { PiAiRuntimeAdapter, RUNTIME_CONTRACT_SCHEMA_VERSION, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, pdProviderCredentials, safeStringifyPreview, } from '@principles/core/runtime';
|
|
17
17
|
import { loadPdConfigForPlugin } from './pd-config.js';
|
|
18
18
|
/**
|
|
19
19
|
* The Stage-2 structured-output contract this classifier requests. It MUST stay
|
|
@@ -153,12 +153,12 @@ export function createSignalClassifierForWorkspace(workspaceDir, options = {}) {
|
|
|
153
153
|
nextAction: `Set provider and model on runtime profile '${runtimeProfileId}'`,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
156
|
+
if (pdProviderCredentials.resolve(profile.apiKeyEnv).value === null) {
|
|
157
157
|
return {
|
|
158
158
|
ok: false,
|
|
159
159
|
readiness: 'needs_setup',
|
|
160
|
-
reason: `
|
|
161
|
-
nextAction: `
|
|
160
|
+
reason: `No API key for '${profile.apiKeyEnv}' in env or ~/.pd/credentials.yaml`,
|
|
161
|
+
nextAction: `Save an API key for '${profile.apiKeyEnv}' in the console, or set the environment variable`,
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
const resolved = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/host-runtime",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"lint": "eslint \"src/**/*.ts\""
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@principles/core": "^7.
|
|
39
|
-
"@principles/install-layout": "^0.8.
|
|
38
|
+
"@principles/core": "^7.8.0",
|
|
39
|
+
"@principles/install-layout": "^0.8.2",
|
|
40
40
|
"better-sqlite3": "^13.0.3",
|
|
41
41
|
"js-yaml": "^5.4.3"
|
|
42
42
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"url": "git+https://github.com/csuzngjh/principles.git"
|
|
54
54
|
},
|
|
55
55
|
"license": "Apache-2.0",
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "8ad7b7924a5edb2231486ef0ed99c2462ad78318"
|
|
57
57
|
}
|