@principles/host-runtime 0.13.0 → 0.13.2
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,
|
|
23
|
+
import { createRuntimeStateHandle, InternalizationOrchestrator, DreamerRunner, PhilosopherRunner, ScribeRunner, ArtificerRunner, buildArtificerHostSemanticContext, EvaluatorRunner, RolloutReviewerRunner, DefaultDreamerValidator, DefaultPhilosopherValidator, DefaultScribeValidator, DefaultArtificerValidator, DefaultEvaluatorValidator, DefaultRolloutReviewerValidator, PiAiRuntimeAdapter, L2AgentLoopAdapter, ArtificerL2Adapter, buildL2PrincipleReaderFromLedger, 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, hydratePITaskRecord, preflightArtificerOwnerEvidence, preflightArtificerIntentBasis, consumeSourceFaultBackoffSkip, advanceSourceFaultBackoff, } from '@principles/core/runtime-v2';
|
|
@@ -641,13 +641,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
641
641
|
});
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
else if (taskRuntimeKind === 'openclaw-cli') {
|
|
645
|
-
adapter = new OpenClawCliRuntimeAdapter({
|
|
646
|
-
runtimeMode: taskRuntimeConfig.openclawMode ?? 'default',
|
|
647
|
-
workspaceDir: workspaceDir,
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
644
|
else {
|
|
645
|
+
// ADR-0029 retired every backend except pi-ai; the resolver can only hand
|
|
646
|
+
// back 'pi-ai', so anything else (including legacy 'openclaw-cli') means
|
|
647
|
+
// the readiness invariant broke.
|
|
651
648
|
throw new Error(`Unsupported runtime kind resolved for auto-consumer: ${taskRuntimeKind}`);
|
|
652
649
|
}
|
|
653
650
|
const { taskId } = wakeResult;
|
|
@@ -701,6 +698,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
701
698
|
// identity on the live production chain. listForCandidate reads
|
|
702
699
|
// the ledger from disk per call — no cross-cycle staleness.
|
|
703
700
|
ledgerIdentity: {
|
|
701
|
+
resolveForCandidate: async (candidateId) => {
|
|
702
|
+
const candidate = await stateManager.getCandidate(candidateId);
|
|
703
|
+
return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
|
|
704
|
+
},
|
|
704
705
|
// PRI-915: availability first — an unreadable ledger must not
|
|
705
706
|
// read as an unresolved chain.
|
|
706
707
|
isAvailable: () => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).isAvailable(),
|
|
@@ -711,6 +712,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
711
712
|
case 'artificer':
|
|
712
713
|
runner = new ArtificerRunner({
|
|
713
714
|
stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(),
|
|
715
|
+
ledgerIdentity: { resolveForCandidate: async (candidateId) => {
|
|
716
|
+
const candidate = await stateManager.getCandidate(candidateId);
|
|
717
|
+
return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
|
|
718
|
+
} },
|
|
714
719
|
// PRI-982 (SPEC-PD-IAER-001 FR-02): the preflight-assembled Owner
|
|
715
720
|
// evidence pack — present only when the authoritative channel is
|
|
716
721
|
// code_tool_hook AND the readiness gate returned ready (same
|
|
@@ -753,6 +758,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
753
758
|
// PRI-915: availability first — an unreadable ledger must surface
|
|
754
759
|
// as identity_source_unavailable, not as invalid_identity drift.
|
|
755
760
|
ledgerIdentity: {
|
|
761
|
+
resolveForCandidate: async (candidateId) => {
|
|
762
|
+
const candidate = await stateManager.getCandidate(candidateId);
|
|
763
|
+
return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
|
|
764
|
+
},
|
|
756
765
|
isAvailable: () => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).isAvailable(),
|
|
757
766
|
hasPrinciple: (principleId) => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).hasPrinciple(principleId),
|
|
758
767
|
},
|
|
@@ -70,6 +70,10 @@ export async function dispatchRolloutActivation(workspaceDir, input, options = {
|
|
|
70
70
|
// used to mint the principle UUID); candidate lineage reuses the artifact
|
|
71
71
|
// read model plus raw diagnostic_json reads.
|
|
72
72
|
const ledgerIdentity = {
|
|
73
|
+
getCandidateKind: (candidateId) => {
|
|
74
|
+
const row = connection.getDb().prepare('SELECT recommendation_kind FROM principle_candidates WHERE candidate_id = ?').get(candidateId);
|
|
75
|
+
return row !== null && typeof row === 'object' && Object.hasOwn(row, 'recommendation_kind') ? Reflect.get(row, 'recommendation_kind') : undefined;
|
|
76
|
+
},
|
|
73
77
|
ledger: new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }),
|
|
74
78
|
getArtifactById: artifactReadModel.getArtifactById,
|
|
75
79
|
getTaskDiagnosticJson: (taskId) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@principles/host-runtime",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"description": "Shared host-neutral orchestration for Principles Disciple MVP-Core hook paths.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"lint": "eslint \"src/**/*.ts\""
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@principles/core": "^1.
|
|
34
|
+
"@principles/core": "^1.297.0",
|
|
35
35
|
"@principles/install-layout": "^0.4.0",
|
|
36
36
|
"better-sqlite3": "^13.0.3",
|
|
37
37
|
"js-yaml": "^5.4.3"
|