@principles/host-runtime 3.0.4 → 3.1.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.
@@ -3,10 +3,11 @@ import path from 'node:path';
3
3
  import { PROMPT_BUDGET_POLICY_VERSION, RUNTIME_PRINCIPLE_BUDGET, isValidContextWindowTokens, promptBudgetCharsForContextWindow, resolvePromptBudget, operatorDeclaredContextWindow, } from '@principles/core/runtime';
4
4
  import { isPromptInjectionTargetHost, } from './prompt-injection-projection.js';
5
5
  /**
6
- * PRI-1104 Stage 0 (expand): accepted budget policy provenance versions.
6
+ * PRI-1104 Stage 0 (expand) / PRI-1139 (PR-6 cutover): accepted budget policy
7
+ * provenance versions.
7
8
  *
8
9
  * Injection events written to the JSONL event log carry `budgetPolicyVersion`
9
- * as a durable wire literal. PR-6 renames the CURRENT policy id from
10
+ * as a durable wire literal. PR-6 renamed the CURRENT policy id from
10
11
  * `model_aware_v2` to a version-neutral `model_aware`; without this read-side
11
12
  * allowance, every historical event would suddenly be classified as
12
13
  * "computed under a different policy" and silently skipped (and a revert of
@@ -14,13 +15,14 @@ import { isPromptInjectionTargetHost, } from './prompt-injection-projection.js';
14
15
  *
15
16
  * These are FROZEN WIRE LITERALS, not a second policy definition: they exist
16
17
  * only so events remain readable across the PR-6 rename AND its revert. The
17
- * PR-6 target id `model_aware` is listed up front (PR #2367 CodeRabbit #2):
18
- * if PR-6 is reverted after it wrote `model_aware` events, a reader accepting
19
- * only `model_aware_v2` would silently skip those observations and the console
20
- * would fall back to a stale budget.
18
+ * pre-cutover id `model_aware_v2` is listed explicitly (PR #2367 CodeRabbit
19
+ * #2): if PR-6 is reverted, a reader accepting only the then-current
20
+ * `model_aware` would silently skip every historical observation and the
21
+ * console would fall back to a stale budget.
21
22
  *
22
- * Today the writer emits only `model_aware_v2`, so listing the future and
23
- * historical literals does not change any current read result.
23
+ * Since the PRI-1139 cutover the writer emits `model_aware`; both spellings
24
+ * denote the SAME formula, so an accepted event of either id is valid
25
+ * evidence about the current budget math.
24
26
  */
25
27
  const ACCEPTED_BUDGET_POLICY_VERSIONS = new Set([
26
28
  PROMPT_BUDGET_POLICY_VERSION,
@@ -29,8 +29,10 @@ export interface CreateSignalClassifierOptions {
29
29
  * packages/principles-core/src/runtime/adapter/output-schema-registry.ts:
30
30
  * the adapter fails loud (`output_invalid`) on an unregistered ref, and the
31
31
  * catch below would silently degrade Stage 2 to "no classification".
32
+ * PRI-1139: version-neutral canonical key; the pre-cutover `-v2` spelling
33
+ * still resolves through the registry's PRI-1104 alias table.
32
34
  */
33
- export declare const SIGNAL_CLASSIFICATION_SCHEMA_REF = "signal-classification-output-v2";
35
+ export declare const SIGNAL_CLASSIFICATION_SCHEMA_REF = "signal-classification-output";
34
36
  /** Build the classifier from an already-resolved profile (no config I/O). */
35
37
  export declare function createSignalLlmClassifier(profile: SignalClassifierProfile, workspaceDir: string, options?: CreateSignalClassifierOptions): SignalLlmClassifier;
36
38
  export type SignalClassifierResolution = {
@@ -13,7 +13,7 @@
13
13
  * No second model runtime is introduced (ADR-0029: pi-ai is the only backend).
14
14
  */
15
15
  import path from 'node:path';
16
- import { PiAiRuntimeAdapter, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, safeStringifyPreview, } from '@principles/core/runtime';
16
+ import { PiAiRuntimeAdapter, RUNTIME_CONTRACT_SCHEMA_VERSION, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, safeStringifyPreview, } from '@principles/core/runtime';
17
17
  import { loadPdConfigForPlugin } from './pd-config.js';
18
18
  /**
19
19
  * The Stage-2 structured-output contract this classifier requests. It MUST stay
@@ -21,8 +21,10 @@ import { loadPdConfigForPlugin } from './pd-config.js';
21
21
  * packages/principles-core/src/runtime/adapter/output-schema-registry.ts:
22
22
  * the adapter fails loud (`output_invalid`) on an unregistered ref, and the
23
23
  * catch below would silently degrade Stage 2 to "no classification".
24
+ * PRI-1139: version-neutral canonical key; the pre-cutover `-v2` spelling
25
+ * still resolves through the registry's PRI-1104 alias table.
24
26
  */
25
- export const SIGNAL_CLASSIFICATION_SCHEMA_REF = 'signal-classification-output-v2';
27
+ export const SIGNAL_CLASSIFICATION_SCHEMA_REF = 'signal-classification-output';
26
28
  /** Build the classifier from an already-resolved profile (no config I/O). */
27
29
  export function createSignalLlmClassifier(profile, workspaceDir, options = {}) {
28
30
  const timeoutMs = options.timeoutMs ?? profile.timeoutMs;
@@ -46,7 +48,7 @@ export function createSignalLlmClassifier(profile, workspaceDir, options = {}) {
46
48
  const effectiveTimeoutMs = callOptions?.timeoutMs ?? timeoutMs;
47
49
  try {
48
50
  const handle = await adapter.startRun({
49
- agentSpec: { agentId: 'signal-collector', schemaVersion: '1' },
51
+ agentSpec: { agentId: 'signal-collector', schemaVersion: RUNTIME_CONTRACT_SCHEMA_VERSION },
50
52
  inputPayload: { prompt },
51
53
  contextItems: [],
52
54
  timeoutMs: effectiveTimeoutMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principles/host-runtime",
3
- "version": "3.0.4",
3
+ "version": "3.1.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",
@@ -31,7 +31,7 @@
31
31
  "lint": "eslint \"src/**/*.ts\""
32
32
  },
33
33
  "dependencies": {
34
- "@principles/core": "^5.2.0",
34
+ "@principles/core": "^6.0.0",
35
35
  "@principles/install-layout": "^0.5.0",
36
36
  "better-sqlite3": "^13.0.3",
37
37
  "js-yaml": "^5.4.3"
@@ -49,5 +49,5 @@
49
49
  "url": "git+https://github.com/csuzngjh/principles.git"
50
50
  },
51
51
  "license": "Apache-2.0",
52
- "gitHead": "d1b8ff89e487e11a242aa705ee562b75ebc8d209"
52
+ "gitHead": "1dd3b8e871ed88bac3cf2cc3a7dcaea9838271ba"
53
53
  }