@principles/host-runtime 0.7.8 → 0.7.10
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.
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* Hosts inject: a logger, a structured-event sink, their tool catalog, and an
|
|
21
21
|
* env getter. Everything else is the existing production path.
|
|
22
22
|
*/
|
|
23
|
-
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, buildArtificerHostSemanticContext, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, ArtificerL2Adapter, 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,
|
|
23
|
+
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, buildArtificerHostSemanticContext, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, ArtificerL2Adapter, 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, PrincipleTreeLedgerAdapter,
|
|
24
24
|
// PRI-714: resolve outputLanguage from the same effective config the
|
|
25
25
|
// runners already receive (EP-07: canonical resolved value, not raw input).
|
|
26
26
|
resolveOutputLanguage, } from '@principles/core/runtime-v2';
|
|
@@ -459,7 +459,18 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
459
459
|
runner = new PhilosopherRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultPhilosopherValidator() }, runnerOptions);
|
|
460
460
|
break;
|
|
461
461
|
case 'scribe':
|
|
462
|
-
runner = new ScribeRunner({
|
|
462
|
+
runner = new ScribeRunner({
|
|
463
|
+
stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultScribeValidator(),
|
|
464
|
+
// I2 — CHAIN STAMPING (Owner review of PR #1856, P1): the scribe
|
|
465
|
+
// stamps the ledger principle UUID (minted at intake, keyed by the
|
|
466
|
+
// dreamer task seed's candidateId) onto the artifact it writes, so
|
|
467
|
+
// the dispatcher's ledger identity gate sees a resolvable
|
|
468
|
+
// identity on the live production chain. listForCandidate reads
|
|
469
|
+
// the ledger from disk per call — no cross-cycle staleness.
|
|
470
|
+
ledgerIdentity: {
|
|
471
|
+
listForCandidate: (candidateId) => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).listForCandidate(candidateId),
|
|
472
|
+
},
|
|
473
|
+
}, runnerOptions);
|
|
463
474
|
break;
|
|
464
475
|
case 'artificer':
|
|
465
476
|
runner = new ArtificerRunner({ stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator() },
|
|
@@ -483,6 +494,14 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
483
494
|
runner = new EvaluatorRunner({
|
|
484
495
|
stateManager, runtimeAdapter: adapter, eventEmitter: workspaceEmitter,
|
|
485
496
|
artifactStore: stateManager.piArtifactStore, validator: new DefaultEvaluatorValidator(),
|
|
497
|
+
// PRI-911A (I1 writer boundary): the rule artifact's identity is a
|
|
498
|
+
// ledger UUID or nothing. hasPrinciple turns "UUID-shaped" into
|
|
499
|
+
// "UUID the ledger actually mints", so a shaped-but-unknown id is
|
|
500
|
+
// refused as invalid_identity instead of being carried forward.
|
|
501
|
+
// Same per-call disk read as the scribe wiring above.
|
|
502
|
+
ledgerIdentity: {
|
|
503
|
+
hasPrinciple: (principleId) => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).hasPrinciple(principleId),
|
|
504
|
+
},
|
|
486
505
|
...createEvaluatorRepairDeps(workspaceDir, stateManager, logger),
|
|
487
506
|
}, {
|
|
488
507
|
...runnerOptions,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* dedupes by `${artifactId}::${channel}`; reopen idempotency is owned by
|
|
15
15
|
* orchestrator.reopenTaskForRevision.
|
|
16
16
|
*/
|
|
17
|
-
import { ActivationDispatcher, PromptWriter, DeferArchiveWriter, RuleHostWriter, SqliteConnection, SqliteActivationStateStore, SqliteApprovalQueueStore, SqlitePIArtifactStore, createProductionGateDeps, createPITaskDiagnosticJson, artificerRepairTaskId, computeFeatureFlagsFromConfig, isFeatureEnabled, } from '@principles/core/runtime-v2';
|
|
17
|
+
import { ActivationDispatcher, PromptWriter, DeferArchiveWriter, RuleHostWriter, SqliteConnection, SqliteActivationStateStore, SqliteApprovalQueueStore, SqlitePIArtifactStore, PrincipleTreeLedgerAdapter, createProductionGateDeps, createPITaskDiagnosticJson, artificerRepairTaskId, computeFeatureFlagsFromConfig, isFeatureEnabled, } from '@principles/core/runtime-v2';
|
|
18
18
|
import { loadPdConfigForPlugin } from './pd-config.js';
|
|
19
19
|
function normalizeDecision(decision) {
|
|
20
20
|
if (decision.decision === 'activated') {
|
|
@@ -64,6 +64,27 @@ export async function dispatchRolloutActivation(workspaceDir, input, options = {
|
|
|
64
64
|
const activationStateStore = new SqliteActivationStateStore(connection);
|
|
65
65
|
const approvalQueueStore = new SqliteApprovalQueueStore(connection);
|
|
66
66
|
const flagProbe = makeFlagProbe(workspaceDir);
|
|
67
|
+
// I3 upgrade (Owner review of PR #1856, P1): the production dispatch path
|
|
68
|
+
// verifies ledger membership BEFORE the approval record and the activation
|
|
69
|
+
// commit. The ledger SSOT lives in <workspace>/.state (same dir the intake
|
|
70
|
+
// used to mint the principle UUID); candidate lineage reuses the artifact
|
|
71
|
+
// read model plus raw diagnostic_json reads.
|
|
72
|
+
const ledgerIdentity = {
|
|
73
|
+
ledger: new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }),
|
|
74
|
+
getArtifactById: artifactReadModel.getArtifactById,
|
|
75
|
+
getTaskDiagnosticJson: (taskId) => {
|
|
76
|
+
try {
|
|
77
|
+
const row = connection
|
|
78
|
+
.getDb()
|
|
79
|
+
.prepare('SELECT diagnostic_json FROM tasks WHERE task_id = ?')
|
|
80
|
+
.get(taskId);
|
|
81
|
+
return row?.diagnostic_json ?? null;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
};
|
|
67
88
|
const dispatcher = new ActivationDispatcher(artifactReadModel, activationStateStore, {
|
|
68
89
|
writers: [
|
|
69
90
|
new PromptWriter(),
|
|
@@ -79,6 +100,7 @@ export async function dispatchRolloutActivation(workspaceDir, input, options = {
|
|
|
79
100
|
new DeferArchiveWriter(),
|
|
80
101
|
],
|
|
81
102
|
approvalQueueStore,
|
|
103
|
+
ledgerIdentity,
|
|
82
104
|
});
|
|
83
105
|
const decision = await dispatcher.dispatch({
|
|
84
106
|
artifactId: input.artifactId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/host-runtime",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"lint": "eslint \"src/**/*.ts\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@principles/core": "^1.287.
|
|
24
|
+
"@principles/core": "^1.287.5",
|
|
25
25
|
"@principles/install-layout": "^0.2.7",
|
|
26
26
|
"better-sqlite3": "^13.0.3",
|
|
27
27
|
"js-yaml": "^5.4.1"
|