@principles/host-runtime 0.13.0 → 0.13.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.
@@ -701,6 +701,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
701
701
  // identity on the live production chain. listForCandidate reads
702
702
  // the ledger from disk per call — no cross-cycle staleness.
703
703
  ledgerIdentity: {
704
+ resolveForCandidate: async (candidateId) => {
705
+ const candidate = await stateManager.getCandidate(candidateId);
706
+ return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
707
+ },
704
708
  // PRI-915: availability first — an unreadable ledger must not
705
709
  // read as an unresolved chain.
706
710
  isAvailable: () => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).isAvailable(),
@@ -711,6 +715,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
711
715
  case 'artificer':
712
716
  runner = new ArtificerRunner({
713
717
  stateManager, runtimeAdapter: adapter, eventEmitter: storeEmitter, artifactStore: stateManager.piArtifactStore, validator: new DefaultArtificerValidator(),
718
+ ledgerIdentity: { resolveForCandidate: async (candidateId) => {
719
+ const candidate = await stateManager.getCandidate(candidateId);
720
+ return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
721
+ } },
714
722
  // PRI-982 (SPEC-PD-IAER-001 FR-02): the preflight-assembled Owner
715
723
  // evidence pack — present only when the authoritative channel is
716
724
  // code_tool_hook AND the readiness gate returned ready (same
@@ -753,6 +761,10 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
753
761
  // PRI-915: availability first — an unreadable ledger must surface
754
762
  // as identity_source_unavailable, not as invalid_identity drift.
755
763
  ledgerIdentity: {
764
+ resolveForCandidate: async (candidateId) => {
765
+ const candidate = await stateManager.getCandidate(candidateId);
766
+ return new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).resolveCandidatePrincipleIdentity(candidateId, candidate?.rawRecommendationKind);
767
+ },
756
768
  isAvailable: () => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).isAvailable(),
757
769
  hasPrinciple: (principleId) => new PrincipleTreeLedgerAdapter({ stateDir: `${workspaceDir}/.state` }).hasPrinciple(principleId),
758
770
  },
@@ -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.0",
3
+ "version": "0.13.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",
@@ -31,7 +31,7 @@
31
31
  "lint": "eslint \"src/**/*.ts\""
32
32
  },
33
33
  "dependencies": {
34
- "@principles/core": "^1.296.0",
34
+ "@principles/core": "^1.296.2",
35
35
  "@principles/install-layout": "^0.4.0",
36
36
  "better-sqlite3": "^13.0.3",
37
37
  "js-yaml": "^5.4.3"