@principles/core 1.289.1 → 1.290.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.
- package/dist/runtime-v2/activation/activation-dispatcher.d.ts +4 -0
- package/dist/runtime-v2/activation/activation-dispatcher.d.ts.map +1 -1
- package/dist/runtime-v2/activation/activation-dispatcher.js +215 -63
- package/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -1
- package/dist/runtime-v2/activation/activation-types.d.ts +48 -0
- package/dist/runtime-v2/activation/activation-types.d.ts.map +1 -1
- package/dist/runtime-v2/activation/activation-types.js.map +1 -1
- package/dist/runtime-v2/activation/approval-completion-service.d.ts +9 -0
- package/dist/runtime-v2/activation/approval-completion-service.d.ts.map +1 -1
- package/dist/runtime-v2/activation/approval-completion-service.js +4 -1
- package/dist/runtime-v2/activation/approval-completion-service.js.map +1 -1
- package/dist/runtime-v2/activation/index.d.ts +4 -2
- package/dist/runtime-v2/activation/index.d.ts.map +1 -1
- package/dist/runtime-v2/activation/index.js +4 -1
- package/dist/runtime-v2/activation/index.js.map +1 -1
- package/dist/runtime-v2/activation/low-risk-writers.d.ts.map +1 -1
- package/dist/runtime-v2/activation/low-risk-writers.js +2 -1
- package/dist/runtime-v2/activation/low-risk-writers.js.map +1 -1
- package/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +11 -0
- package/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -1
- package/dist/runtime-v2/activation/prompt-activation-reader-contract.js +12 -2
- package/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
- package/dist/runtime-v2/activation/prompt-replacement.d.ts +79 -0
- package/dist/runtime-v2/activation/prompt-replacement.d.ts.map +1 -0
- package/dist/runtime-v2/activation/prompt-replacement.js +171 -0
- package/dist/runtime-v2/activation/prompt-replacement.js.map +1 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts +17 -1
- package/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -1
- package/dist/runtime-v2/activation/sqlite-activation-state-store.js +132 -0
- package/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -1
- package/dist/runtime-v2/candidate-audit.d.ts +19 -0
- package/dist/runtime-v2/candidate-audit.d.ts.map +1 -1
- package/dist/runtime-v2/candidate-audit.js +72 -12
- package/dist/runtime-v2/candidate-audit.js.map +1 -1
- package/dist/runtime-v2/index.d.ts +8 -2
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +8 -2
- package/dist/runtime-v2/index.js.map +1 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +13 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js +15 -2
- package/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/intervention-evidence-normalizer.d.ts +28 -0
- package/dist/runtime-v2/intervention-evidence-normalizer.d.ts.map +1 -0
- package/dist/runtime-v2/intervention-evidence-normalizer.js +654 -0
- package/dist/runtime-v2/intervention-evidence-normalizer.js.map +1 -0
- package/dist/runtime-v2/pain-chain-read-model.d.ts.map +1 -1
- package/dist/runtime-v2/pain-chain-read-model.js +48 -14
- package/dist/runtime-v2/pain-chain-read-model.js.map +1 -1
- package/dist/runtime-v2/receipt-coverage.d.ts +8 -0
- package/dist/runtime-v2/receipt-coverage.d.ts.map +1 -1
- package/dist/runtime-v2/receipt-coverage.js +18 -0
- package/dist/runtime-v2/receipt-coverage.js.map +1 -1
- package/dist/runtime-v2/store/intervention-evidence-schema.d.ts +6 -0
- package/dist/runtime-v2/store/intervention-evidence-schema.d.ts.map +1 -0
- package/dist/runtime-v2/store/intervention-evidence-schema.js +122 -0
- package/dist/runtime-v2/store/intervention-evidence-schema.js.map +1 -0
- package/dist/runtime-v2/store/sqlite-connection.d.ts +8 -0
- package/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
- package/dist/runtime-v2/store/sqlite-connection.js +62 -3
- package/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/dist/runtime-v2/store/sqlite-intervention-evidence-store.d.ts +67 -0
- package/dist/runtime-v2/store/sqlite-intervention-evidence-store.d.ts.map +1 -0
- package/dist/runtime-v2/store/sqlite-intervention-evidence-store.js +737 -0
- package/dist/runtime-v2/store/sqlite-intervention-evidence-store.js.map +1 -0
- package/dist/runtime-v2/types/event-types.d.ts +6 -0
- package/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/dist/runtime-v2/types/event-types.js +2 -0
- package/dist/runtime-v2/types/event-types.js.map +1 -1
- package/dist/runtime-v2/types/intervention-evidence-contract.d.ts +287 -0
- package/dist/runtime-v2/types/intervention-evidence-contract.d.ts.map +1 -0
- package/dist/runtime-v2/types/intervention-evidence-contract.js +84 -0
- package/dist/runtime-v2/types/intervention-evidence-contract.js.map +1 -0
- package/package.json +5 -1
|
@@ -100,13 +100,14 @@ CONSTRAINTS:
|
|
|
100
100
|
- Output ONLY valid JSON (no markdown, no explanatory text, no code fences)
|
|
101
101
|
- principleDraft.title MUST be a non-empty string (concise, <=100 chars)
|
|
102
102
|
- principleDraft.statement MUST be a non-empty string describing the principle
|
|
103
|
+
- PD_PROMPT_CAPACITY_V1 R-B1 (prompt.v5): principleDraft.statement is the ONLY text injected into the agent prompt, and that prompt surface has a hard character budget. Write it in the SHORTEST wording that stays sufficient: keep the trigger condition (when it applies), the required action (what must be done), and any necessary exception (when it does not apply) — nothing else. Do NOT move explanatory detail into the statement; rationale, evidence, and history belong in principleDraft.rationale / risks / intentContract, which are NOT injected and have no such pressure. Never pad, never add examples inside the statement, and never trade a necessary trigger/exception for brevity — if any of the three parts disappears, the statement is wrong, not shorter
|
|
103
104
|
- principleDraft.rationale MUST be a non-empty string
|
|
104
105
|
- principleDraft.applicability MUST be an array of strings (at least one recommended)
|
|
105
106
|
- principleDraft.antiPatterns MUST be an array of strings (can be empty)
|
|
106
107
|
- principleDraft.confidence MUST be a number between 0.0 and 1.0 (NOT a string, NOT a percentage)
|
|
107
108
|
- intentContract is REQUIRED and every one of its five fields MUST be a non-empty string (no placeholders, no "TBD")
|
|
108
109
|
- intentContract itself MUST be a nested JSON OBJECT — never a JSON-encoded string (do not double-encode it as a string containing JSON)
|
|
109
|
-
- intentContract.ownerIntent / targetBehavior / forbiddenBehavior MUST stay consistent with principleDraft.statement and antiPatterns — they express the SAME intent at different precision, never a different one
|
|
110
|
+
- intentContract.ownerIntent / targetBehavior / forbiddenBehavior MUST stay consistent with principleDraft.statement and antiPatterns — they express the SAME intent at different precision, never a different one; shortening the statement MUST NOT drop or weaken any of these anchors
|
|
110
111
|
- sourcePhilosopherArtifactId MUST be copied exactly from input.sourcePhilosopherArtifactId (non-empty string)
|
|
111
112
|
- sourceTrace.philosopherArtifactId MUST be copied exactly from input.sourcePhilosopherArtifactId
|
|
112
113
|
- sourceTrace.dreamerArtifactId: when input.sourceDreamerArtifactId is provided, it MUST be copied exactly from input.sourceDreamerArtifactId (non-empty string); omit the field only when the input does not carry one. Never scrape artifact content for ids — use the input field
|
|
@@ -138,7 +139,19 @@ ${formationEvidenceBlock}${languageDirective}`;
|
|
|
138
139
|
* unchanged, and a run without formation evidence emits exactly the v3 wire
|
|
139
140
|
* shape plus the new version string.
|
|
140
141
|
*/
|
|
141
|
-
|
|
142
|
+
/**
|
|
143
|
+
* PD_PROMPT_CAPACITY_V1 R-B1: bumped v4 → v5. The CONSTRAINTS gained the
|
|
144
|
+
* statement-brevity requirement: the statement is the only text injected into
|
|
145
|
+
* the budget-capped agent prompt, so it must be the shortest sufficient
|
|
146
|
+
* wording that preserves the trigger condition, required action, and
|
|
147
|
+
* necessary exception — rationale/evidence/history stay in their own
|
|
148
|
+
* (uninjected) fields. Additive wire shape: the OUTPUT FORMAT, the validator,
|
|
149
|
+
* and `ScribeOutputV1` are unchanged (deliberately NO hard char cap and no
|
|
150
|
+
* silent truncation — content validation stays separate from host-capacity
|
|
151
|
+
* prechecks), and a run on v5 emits exactly the v4 shape plus the new
|
|
152
|
+
* version string.
|
|
153
|
+
*/
|
|
154
|
+
export const SCRIBE_PROMPT_CONTRACT_VERSION = 'scribe-output-v1.prompt.v5';
|
|
142
155
|
export class ScribePromptBuilder {
|
|
143
156
|
coreGrounding;
|
|
144
157
|
outputLanguage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scribe-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/scribe-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAkDlE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,sBAAsB,CAAC;AAE1E,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;4EAgBiC,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAC5C,IAAI,GAA6F,EAAE;IAEnG,MAAM,EAAE,cAAc,EAAE,iBAAiB,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC;IACzE,MAAM,eAAe,GAAG,mBAAmB,CAAC,EAAE,GAAG,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;IAC9E,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACjE,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,CAAC;IAEpF,OAAO;;;;;;;;EAQP,eAAe
|
|
1
|
+
{"version":3,"file":"scribe-prompt-builder.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/scribe-prompt-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAG7E,OAAO,EAAE,sBAAsB,EAAE,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AAK,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,CAAC;QAEnE,MAAM,iBAAiB,GAAG,8BAA8B,CAAC;YACvD,aAAa;YACb,cAAc;YACd,iBAAiB,EAAE,KAAK,CAAC,gBAAgB,KAAK,SAAS;SACxD,CAAC,CAAC;QAEH,MAAM,WAAW,GAAsB;YACrC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,2BAA2B,EAAE,KAAK,CAAC,2BAA2B;YAC9D,GAAG,CAAC,KAAK,CAAC,uBAAuB,KAAK,SAAS;gBAC7C,CAAC,CAAC,EAAE,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,EAAE;gBAC5D,CAAC,CAAC,EAAE,CAAC;YACP,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;YAC9C,yEAAyE;YACzE,kEAAkE;YAClE,GAAG,CAAC,KAAK,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,qBAAqB,EAAE,8BAA8B;SACtD,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAE5C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type InterventionCapabilityDeclaration, type InterventionSourceKind, type NormalizedInterventionRecord } from './types/intervention-evidence-contract.js';
|
|
2
|
+
export interface NormalizedInterventionBatch {
|
|
3
|
+
evidenceScopeId: string;
|
|
4
|
+
sourceKind: InterventionSourceKind;
|
|
5
|
+
adapterVersion: string;
|
|
6
|
+
recordedAt: string;
|
|
7
|
+
records: NormalizedInterventionRecord[];
|
|
8
|
+
capabilityDeclarations: InterventionCapabilityDeclaration[];
|
|
9
|
+
}
|
|
10
|
+
export type InterventionNormalization = {
|
|
11
|
+
ok: true;
|
|
12
|
+
batch: NormalizedInterventionBatch;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
/** Deterministic key minting for producers: joins parts with '|', mapping absent parts to '-'. */
|
|
18
|
+
export declare function mintObservationKey(parts: readonly (string | undefined)[]): string;
|
|
19
|
+
/** Canonical JSON: recursively key-sorted, no whitespace — stable across replays. */
|
|
20
|
+
export declare function canonicalJson(value: unknown): string;
|
|
21
|
+
export declare function computeEvidenceId(sourceKind: string, sourceLocator: string, observationKey: string): string;
|
|
22
|
+
export declare function computeRecordDigest(record: Omit<NormalizedInterventionRecord, 'recordDigest'>): string;
|
|
23
|
+
/**
|
|
24
|
+
* Validate and normalize one evidence batch. Never throws; the first
|
|
25
|
+
* validation failure is returned as a stable reason string.
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeInterventionEvidenceBatch(raw: unknown): InterventionNormalization;
|
|
28
|
+
//# sourceMappingURL=intervention-evidence-normalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intervention-evidence-normalizer.d.ts","sourceRoot":"","sources":["../../src/runtime-v2/intervention-evidence-normalizer.ts"],"names":[],"mappings":"AAuBA,OAAO,EAUL,KAAK,iCAAiC,EAUtC,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EAClC,MAAM,2CAA2C,CAAC;AAEnD,MAAM,WAAW,2BAA2B;IAC1C,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,sBAAsB,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxC,sBAAsB,EAAE,iCAAiC,EAAE,CAAC;CAC7D;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,2BAA2B,CAAA;CAAE,GAChD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA8HlC,kGAAkG;AAClG,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAEjF;AAMD,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASpD;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE3G;AAYD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,4BAA4B,EAAE,cAAc,CAAC,GAAG,MAAM,CAMtG;AAmXD;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB,CAoE1F"}
|