@principles/host-runtime 0.3.12 → 0.5.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, {
@@ -349,6 +356,9 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
349
356
  timeoutMs: taskRuntimeConfig.timeoutMs,
350
357
  baseUrl: taskRuntimeConfig.baseUrl,
351
358
  workspace: workspaceDir,
359
+ // PRI-758: profile reasoning level rides to pi-ai (thinking control
360
+ // for always-thinking zai models, e.g. glm-5.3-flash).
361
+ ...(taskRuntimeConfig.reasoning !== undefined ? { reasoning: taskRuntimeConfig.reasoning } : {}),
352
362
  // PRI-633: profile systemPrompt rides as the append layer.
353
363
  ...(taskRuntimeConfig.systemPrompt ? { systemPrompt: taskRuntimeConfig.systemPrompt } : {}),
354
364
  });
@@ -409,7 +419,9 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
409
419
  runner = new ScribeRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultScribeValidator(), contentHashFn }, runnerOptions);
410
420
  break;
411
421
  case 'artificer':
412
- runner = new ArtificerRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(), contentHashFn }, runnerOptions);
422
+ runner = new ArtificerRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(), contentHashFn },
423
+ // PRI-741: thread the host semantic projection into generation.
424
+ { ...runnerOptions, ...(artificerHostSemanticContext !== undefined ? { hostSemanticContext: artificerHostSemanticContext } : {}) });
413
425
  break;
414
426
  case 'evaluator':
415
427
  // P0-D 生产接线: PRI-509 repair loop 正式进入 consumer (bounded,
@@ -441,6 +453,9 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
441
453
  ...(hostToolCatalog
442
454
  ? { hostToolCatalog: { readOnlyTools: [...hostToolCatalog.readOnlyTools], writeTools: [...hostToolCatalog.writeTools] } }
443
455
  : {}),
456
+ // PRI-741: host-name parity replay case from the SAME registry
457
+ // provenance as the gateDeps above.
458
+ ...(artificerHostSemanticContext !== undefined ? { hostSemanticContext: artificerHostSemanticContext } : {}),
444
459
  });
445
460
  break;
446
461
  case 'rollout_reviewer':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "0.3.12",
3
+ "version": "0.5.0",
4
4
  "description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",