@principles/host-runtime 0.3.12 → 0.4.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.
|
@@ -46,6 +46,16 @@ export interface EvaluatorRuntimeContextInput {
|
|
|
46
46
|
export type EvaluatorRuntimeContextResolution = {
|
|
47
47
|
readonly ok: true;
|
|
48
48
|
readonly gateDeps: RefinerRuleHostGateDeps;
|
|
49
|
+
/**
|
|
50
|
+
* PRI-741: the registry snapshot the gateDeps were built from. Callers
|
|
51
|
+
* that need the host tool list (e.g. the host-alias parity projection)
|
|
52
|
+
* MUST derive it from HERE — a second independent
|
|
53
|
+
* `resolveWorkspaceHostToolSemantics` read could observe a different
|
|
54
|
+
* declaration snapshot than the replay gate.
|
|
55
|
+
*/
|
|
56
|
+
readonly registry: ToolSemanticRegistry;
|
|
57
|
+
/** Host kind label(s) when known; the host-threaded path has none. */
|
|
58
|
+
readonly hostKinds?: readonly string[];
|
|
49
59
|
} | {
|
|
50
60
|
readonly ok: false;
|
|
51
61
|
readonly reason: string;
|
|
@@ -47,6 +47,7 @@ export function createEvaluatorRuntimeContext(input) {
|
|
|
47
47
|
if (input.toolSemantics) {
|
|
48
48
|
return {
|
|
49
49
|
ok: true,
|
|
50
|
+
registry: input.toolSemantics,
|
|
50
51
|
gateDeps: createProductionGateDeps({ projectDir: input.workspaceDir, toolSemantics: input.toolSemantics }),
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -56,6 +57,8 @@ export function createEvaluatorRuntimeContext(input) {
|
|
|
56
57
|
}
|
|
57
58
|
return {
|
|
58
59
|
ok: true,
|
|
60
|
+
registry: resolved.registry,
|
|
61
|
+
hostKinds: resolved.hostKinds,
|
|
59
62
|
gateDeps: createProductionGateDeps({ projectDir: input.workspaceDir, toolSemantics: resolved.registry }),
|
|
60
63
|
};
|
|
61
64
|
}
|
|
@@ -32,6 +32,12 @@ export interface InternalizationConsumerCyclePorts {
|
|
|
32
32
|
* hosts that have not declared semantics keep core-baseline behavior.
|
|
33
33
|
*/
|
|
34
34
|
readonly toolSemantics?: ToolSemanticRegistry;
|
|
35
|
+
/**
|
|
36
|
+
* PRI-741: host kind label(s) for the artificer's HOST SEMANTIC CONTEXT
|
|
37
|
+
* block (e.g. ['openclaw']). Only meaningful together with `toolSemantics`;
|
|
38
|
+
* omitted → the artificer prompt is built without host context.
|
|
39
|
+
*/
|
|
40
|
+
readonly hostKinds?: readonly string[];
|
|
35
41
|
/** Log label used in human log prefixes ('AutoConsumer' | 'CodexWorker' | …). */
|
|
36
42
|
readonly logLabel: string;
|
|
37
43
|
readonly envGetter?: (name: string) => string | undefined;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* env getter. Everything else is the existing production path.
|
|
22
22
|
*/
|
|
23
23
|
import { createHash } from 'node:crypto';
|
|
24
|
-
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, buildL2PrincipleReaderFromLedger, OpenClawCliRuntimeAdapter, storeEmitter, createProductionGateDeps, resolveRuntimeConfigFromPdConfig, resolveRuntimeConfigForAgent, AGENT_NAME_FOR_TASK_KIND, isRuntimeConfigError, computeConsumerDecision, FULL_CHAIN_CONSUMER_RUNNER_KINDS, DEFAULT_CONSUMER_RUNNER_KINDS, InternalizationQueueReadModel, MVP_CORE_TASK_KINDS, SqliteConnection, SqliteReconciliationCursorStore, SUCCEEDED_TRANSITIONS_SCOPE,
|
|
24
|
+
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, buildArtificerHostSemanticContext, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, buildL2PrincipleReaderFromLedger, OpenClawCliRuntimeAdapter, storeEmitter, createProductionGateDeps, resolveRuntimeConfigFromPdConfig, resolveRuntimeConfigForAgent, AGENT_NAME_FOR_TASK_KIND, isRuntimeConfigError, computeConsumerDecision, FULL_CHAIN_CONSUMER_RUNNER_KINDS, DEFAULT_CONSUMER_RUNNER_KINDS, InternalizationQueueReadModel, MVP_CORE_TASK_KINDS, SqliteConnection, SqliteReconciliationCursorStore, SUCCEEDED_TRANSITIONS_SCOPE,
|
|
25
25
|
// PRI-714: resolve outputLanguage from the same effective config the
|
|
26
26
|
// runners already receive (EP-07: canonical resolved value, not raw input).
|
|
27
27
|
resolveOutputLanguage, } from '@principles/core/runtime-v2';
|
|
@@ -144,6 +144,13 @@ async function runReconciliationBudget(workspaceDir, orchestrator, ports) {
|
|
|
144
144
|
export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
145
145
|
const { logger, emitEvent, logLabel, owner } = ports;
|
|
146
146
|
const { hostToolCatalog, toolSemantics } = ports;
|
|
147
|
+
// PRI-741: artificer host semantic projection — built once from the SAME
|
|
148
|
+
// registry the activation gate/replay use (ports.toolSemantics), so the
|
|
149
|
+
// generation prompt teaches exactly the host dispatch surface that
|
|
150
|
+
// validateRuleReliability will later enforce. Sanitized for prompt use.
|
|
151
|
+
const artificerHostSemanticContext = toolSemantics !== undefined
|
|
152
|
+
? buildArtificerHostSemanticContext(toolSemantics, ports.hostKinds ?? [])
|
|
153
|
+
: undefined;
|
|
147
154
|
const envGetter = ports.envGetter ?? ((name) => process.env[name]);
|
|
148
155
|
let orchestrator = null;
|
|
149
156
|
const flag = loadFeatureFlagFromConfig(workspaceDir, INTERNALIZATION_AUTO_CONSUMER_FLAG_ID, {
|
|
@@ -409,7 +416,9 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
409
416
|
runner = new ScribeRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultScribeValidator(), contentHashFn }, runnerOptions);
|
|
410
417
|
break;
|
|
411
418
|
case 'artificer':
|
|
412
|
-
runner = new ArtificerRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(), contentHashFn },
|
|
419
|
+
runner = new ArtificerRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(), contentHashFn },
|
|
420
|
+
// PRI-741: thread the host semantic projection into generation.
|
|
421
|
+
{ ...runnerOptions, ...(artificerHostSemanticContext !== undefined ? { hostSemanticContext: artificerHostSemanticContext } : {}) });
|
|
413
422
|
break;
|
|
414
423
|
case 'evaluator':
|
|
415
424
|
// P0-D 生产接线: PRI-509 repair loop 正式进入 consumer (bounded,
|
|
@@ -441,6 +450,9 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
441
450
|
...(hostToolCatalog
|
|
442
451
|
? { hostToolCatalog: { readOnlyTools: [...hostToolCatalog.readOnlyTools], writeTools: [...hostToolCatalog.writeTools] } }
|
|
443
452
|
: {}),
|
|
453
|
+
// PRI-741: host-name parity replay case from the SAME registry
|
|
454
|
+
// provenance as the gateDeps above.
|
|
455
|
+
...(artificerHostSemanticContext !== undefined ? { hostSemanticContext: artificerHostSemanticContext } : {}),
|
|
444
456
|
});
|
|
445
457
|
break;
|
|
446
458
|
case 'rollout_reviewer':
|