@principles/core 1.240.20 → 1.241.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/diagnostician/__tests__/diag-distiller-output.test.js +46 -0
- package/dist/runtime-v2/diagnostician/__tests__/diag-distiller-output.test.js.map +1 -1
- package/dist/runtime-v2/diagnostician/diag-distiller-output.d.ts +2 -0
- package/dist/runtime-v2/diagnostician/diag-distiller-output.d.ts.map +1 -1
- package/dist/runtime-v2/diagnostician/diag-distiller-output.js +29 -2
- package/dist/runtime-v2/diagnostician/diag-distiller-output.js.map +1 -1
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.d.ts +15 -0
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.d.ts.map +1 -0
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.js +90 -0
- package/dist/runtime-v2/feature-flags/__tests__/artifact-summary-redundancy-flag.test.js.map +1 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js +6 -0
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.d.ts +11 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.js +124 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.d.ts +12 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.js +253 -0
- package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.js +279 -0
- package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.d.ts +22 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.js +92 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.d.ts +165 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.js +657 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.d.ts +22 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.js +229 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.js +1039 -0
- package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.d.ts +22 -0
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.js +280 -0
- package/dist/runtime-v2/internalization/__tests__/summary-chain-flow.property.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.d.ts +25 -0
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.js +413 -0
- package/dist/runtime-v2/internalization/__tests__/summary-envelope-writer.property.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.d.ts +12 -0
- package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.js +176 -0
- package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.js.map +1 -0
- package/dist/runtime-v2/internalization/artifact-content-hash.d.ts +19 -0
- package/dist/runtime-v2/internalization/artifact-content-hash.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/artifact-content-hash.js +116 -0
- package/dist/runtime-v2/internalization/artifact-content-hash.js.map +1 -0
- package/dist/runtime-v2/internalization/artifact-summary.d.ts +106 -0
- package/dist/runtime-v2/internalization/artifact-summary.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/artifact-summary.js +331 -0
- package/dist/runtime-v2/internalization/artifact-summary.js.map +1 -0
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.js +29 -1
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/attach-summary-envelope.d.ts +60 -0
- package/dist/runtime-v2/internalization/attach-summary-envelope.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/attach-summary-envelope.js +126 -0
- package/dist/runtime-v2/internalization/attach-summary-envelope.js.map +1 -0
- package/dist/runtime-v2/internalization/diag-distiller-runner.d.ts +1 -1
- package/dist/runtime-v2/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-distiller-runner.js +20 -2
- package/dist/runtime-v2/internalization/diag-distiller-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-rootcause-runner.js +6 -1
- package/dist/runtime-v2/internalization/diag-rootcause-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.d.ts +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/diag-router-runner.js +25 -1
- package/dist/runtime-v2/internalization/diag-router-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts +9 -1
- package/dist/runtime-v2/internalization/dreamer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/dreamer-runner.js +28 -6
- package/dist/runtime-v2/internalization/dreamer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js +35 -2
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/philosopher-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/philosopher-runner.js +25 -1
- package/dist/runtime-v2/internalization/philosopher-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/scribe-runner.js +23 -1
- package/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
- package/dist/runtime-v2/runner/base-peer-runner.d.ts +30 -0
- package/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/runner/base-peer-runner.js +106 -0
- package/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
- package/dist/runtime-v2/runner/peer-runner-types.d.ts +19 -0
- package/dist/runtime-v2/runner/peer-runner-types.d.ts.map +1 -1
- package/dist/runtime-v2/store/commit/diagnostician-committer.d.ts +15 -0
- package/dist/runtime-v2/store/commit/diagnostician-committer.d.ts.map +1 -1
- package/dist/runtime-v2/store/commit/diagnostician-committer.js +19 -1
- package/dist/runtime-v2/store/commit/diagnostician-committer.js.map +1 -1
- package/package.json +2 -1
package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope regression test (design §4.7.1, task 3.21).
|
|
3
|
+
*
|
|
4
|
+
* Guards the Layer 0 scope boundary: the three diagnostic stages
|
|
5
|
+
* (`diag_rootcause` / `diag_distiller` / `diag_router`) and `philosopher`
|
|
6
|
+
* participate in Layer 0 ONLY as writer-side summary producers/forwarders.
|
|
7
|
+
* They MUST NOT:
|
|
8
|
+
* - own a ContextManifest (manifests are exactly 4: dreamer / scribe /
|
|
9
|
+
* artificer / evaluator)
|
|
10
|
+
* - widen their export surface (philosopher stays de-surfaced from the
|
|
11
|
+
* internal barrel — PRI-458)
|
|
12
|
+
* - change their output schema or prompt text (Requirement 1.7)
|
|
13
|
+
*
|
|
14
|
+
* PR 1 has no manifest table yet (that lands in PR 2). This test asserts the
|
|
15
|
+
* negative today ("no diagnostic stage owns a manifest") and will be re-run
|
|
16
|
+
* unchanged once PR 2 introduces the manifest registry.
|
|
17
|
+
*
|
|
18
|
+
* @see .kiro/specs/internalization-progressive-disclosure/design.md §4.7, §4.7.1
|
|
19
|
+
* @see .kiro/specs/internalization-progressive-disclosure/requirements.md Requirements 1.7, 2.14
|
|
20
|
+
*/
|
|
21
|
+
import { describe, it, expect } from 'vitest';
|
|
22
|
+
import { readFileSync } from 'node:fs';
|
|
23
|
+
import { resolve } from 'node:path';
|
|
24
|
+
import { SUMMARY_RUNNER_KINDS, } from '../artifact-summary.js';
|
|
25
|
+
import { SUMMARY_EDGE_PREDECESSOR } from '../attach-summary-envelope.js';
|
|
26
|
+
const DIAG_KINDS = ['diag_rootcause', 'diag_distiller', 'diag_router'];
|
|
27
|
+
describe('Layer 0 scope regression — diagnostic stages & philosopher (task 3.21)', () => {
|
|
28
|
+
it('SUMMARY_RUNNER_KINDS includes the 3 diagnostic stages (they produce summaries)', () => {
|
|
29
|
+
// design §4.7.1: diag stages ARE SummaryRunnerKinds (writer-side only).
|
|
30
|
+
for (const kind of DIAG_KINDS) {
|
|
31
|
+
expect(SUMMARY_RUNNER_KINDS).toContain(kind);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
it('diag stages have NO manifest field/import anywhere in their runner source (design §4.7.1)', () => {
|
|
35
|
+
// A diagnostic stage owning a manifest would be a scope violation. Today
|
|
36
|
+
// (PR 1) no ContextManifest type exists in the codebase yet, so we assert
|
|
37
|
+
// the stronger negative: the diag runner source files do not reference any
|
|
38
|
+
// manifest symbol. When PR 2 lands the manifest registry, this same test
|
|
39
|
+
// guards against a diag kind sneaking in.
|
|
40
|
+
const diagFiles = [
|
|
41
|
+
'diag-rootcause-runner.ts',
|
|
42
|
+
'diag-distiller-runner.ts',
|
|
43
|
+
'diag-router-runner.ts',
|
|
44
|
+
];
|
|
45
|
+
for (const file of diagFiles) {
|
|
46
|
+
const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
|
|
47
|
+
// Must not reference ContextManifest, manifest, DREAMER_MANIFEST, etc.
|
|
48
|
+
expect(src, `${file} must not own a manifest`).not.toMatch(/\bContextManifest\b/);
|
|
49
|
+
expect(src, `${file} must not reference allocateContext`).not.toMatch(/\ballocateContext\b/);
|
|
50
|
+
// But it SHOULD reference the Layer 0 writer wiring (proves it only does
|
|
51
|
+
// writer-side summary, not manifest-driven injection).
|
|
52
|
+
expect(src, `${file} must wire buildArtifactContentJson (writer-side only)`).toMatch(/buildArtifactContentJson/);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it('diag-router predecessor is diag_distiller, NOT diag_rootcause (F17 edge-predecessor uniqueness)', () => {
|
|
56
|
+
// Even though diag_router loads BOTH rootcause and distiller in buildContext,
|
|
57
|
+
// only distiller is the edge predecessor. This is the single most important
|
|
58
|
+
// scope assertion for the diagnostic chain.
|
|
59
|
+
expect(SUMMARY_EDGE_PREDECESSOR.diag_router).toBe('diag_distiller');
|
|
60
|
+
expect(SUMMARY_EDGE_PREDECESSOR.diag_router).not.toBe('diag_rootcause');
|
|
61
|
+
});
|
|
62
|
+
it('dreamer predecessor is diag_router (F13/F14: diagnostic chain is dreamer\'s direct upstream)', () => {
|
|
63
|
+
expect(SUMMARY_EDGE_PREDECESSOR.dreamer).toBe('diag_router');
|
|
64
|
+
});
|
|
65
|
+
it('evaluator predecessor is artificer, NOT scribe (F17)', () => {
|
|
66
|
+
expect(SUMMARY_EDGE_PREDECESSOR.evaluator).toBe('artificer');
|
|
67
|
+
expect(SUMMARY_EDGE_PREDECESSOR.evaluator).not.toBe('scribe');
|
|
68
|
+
});
|
|
69
|
+
it('philosopher stays de-surfaced from internalization/index.ts barrel (PRI-458 MVP-Quiet)', () => {
|
|
70
|
+
// PRI-458: PhilosopherRunner is NOT exported from the internal barrel.
|
|
71
|
+
// Layer 0 does not re-add it. (It remains reachable via runtime-v2/index.ts
|
|
72
|
+
// for the rulehost pipeline — guarded separately by architecture-regression.test.ts.)
|
|
73
|
+
const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
|
|
74
|
+
expect(src).not.toContain("from './philosopher-runner.js'");
|
|
75
|
+
expect(src).not.toContain('PhilosopherRunner');
|
|
76
|
+
});
|
|
77
|
+
it('each SummaryRunnerKind has a defined edge predecessor (or null for the root)', () => {
|
|
78
|
+
// Every kind must resolve to a predecessor entry — no kind left un-mapped.
|
|
79
|
+
for (const kind of SUMMARY_RUNNER_KINDS) {
|
|
80
|
+
expect(Object.hasOwn(SUMMARY_EDGE_PREDECESSOR, kind)).toBe(true);
|
|
81
|
+
const pred = SUMMARY_EDGE_PREDECESSOR[kind];
|
|
82
|
+
// Either null (chain root = diag_rootcause) or a valid SummaryRunnerKind.
|
|
83
|
+
if (pred !== null) {
|
|
84
|
+
expect(SUMMARY_RUNNER_KINDS).toContain(pred);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Exactly one root (null).
|
|
88
|
+
const roots = SUMMARY_RUNNER_KINDS.filter((k) => SUMMARY_EDGE_PREDECESSOR[k] === null);
|
|
89
|
+
expect(roots).toEqual(['diag_rootcause']);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=progressive-disclosure-scope-regression.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressive-disclosure-scope-regression.test.js","sourceRoot":"","sources":["../../../../src/runtime-v2/internalization/__tests__/progressive-disclosure-scope-regression.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,UAAU,GAAsB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAE1F,QAAQ,CAAC,wEAAwE,EAAE,GAAG,EAAE;IACtF,EAAE,CAAC,gFAAgF,EAAE,GAAG,EAAE;QACxF,wEAAwE;QACxE,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,CAAC,oBAAoB,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2FAA2F,EAAE,GAAG,EAAE;QACnG,yEAAyE;QACzE,0EAA0E;QAC1E,2EAA2E;QAC3E,yEAAyE;QACzE,0CAA0C;QAC1C,MAAM,SAAS,GAAG;YAChB,0BAA0B;YAC1B,0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ization progressive-disclosure value verification.
|
|
4
|
+
*
|
|
5
|
+
* SPIKE-ONLY. This module is deliberately isolated:
|
|
6
|
+
* - it is imported by Spike tests only (task 1.1 self-check, task 1.2 driver);
|
|
7
|
+
* - it is NOT exported from any barrel (`internalization/index.ts` untouched);
|
|
8
|
+
* - it imports **types only**, so it adds no production runtime dependency;
|
|
9
|
+
* - it performs no I/O (core is pure logic — AGENTS.md `antipattern-core-io`).
|
|
10
|
+
*
|
|
11
|
+
* Why the chain starts at the diagnostician chain and not at dreamer
|
|
12
|
+
* (design §4.7.1 / F13): `diag_router` is dreamer's predecessor on the task
|
|
13
|
+
* graph edge, so it is the only data source for the `pain.summary.*` /
|
|
14
|
+
* `diagnosis.summary.*` fields the `pain_to_dreamer` diagnosis segment needs.
|
|
15
|
+
* A chain that started at dreamer could only exercise 2 of the 3 segments.
|
|
16
|
+
*
|
|
17
|
+
* Every `contentJson` shape below is taken from the real output type in the
|
|
18
|
+
* repo — no invented fields:
|
|
19
|
+
* diag_rootcause → `DiagRootCauseOutputV1` (diagnostician/diag-rootcause-output.ts)
|
|
20
|
+
* diag_distiller → `DiagDistillerOutputV1` (diagnostician/diag-distiller-output.ts)
|
|
21
|
+
* diag_router → `DiagnosticianOutputV1` (diagnostician-output.ts)
|
|
22
|
+
* dreamer → `DreamerOutputV1` (dreamer-output.ts)
|
|
23
|
+
* philosopher → `PhilosopherOutputV1` (philosopher-output.ts)
|
|
24
|
+
* scribe → `ScribeOutputV1` (scribe-output.ts)
|
|
25
|
+
* artificer → `ArtificerRuleOutput` (artificer-output.ts)
|
|
26
|
+
* evaluator → `EvaluatorOutputV2` (evaluator-output.ts)
|
|
27
|
+
*
|
|
28
|
+
* The evaluator hop carries only fields that exist today (V1 + optional
|
|
29
|
+
* `codeReview`). `painCoverage` / `compressionFidelity` are Layer 2 additions
|
|
30
|
+
* and are intentionally absent — the expected defect lives in fixture metadata
|
|
31
|
+
* (`expectedDefect`), never inside the LLM-shaped payload, so a Spike assertion
|
|
32
|
+
* cannot trivially read the answer out of the artifact it is judging (ERR-088).
|
|
33
|
+
*
|
|
34
|
+
* @see .kiro/specs/internalization-progressive-disclosure/design.md §12 Phase 0, §16.3
|
|
35
|
+
* @see Requirement 12.2
|
|
36
|
+
*/
|
|
37
|
+
import type { DiagRootCauseOutputV1 } from '../../diagnostician/diag-rootcause-output.js';
|
|
38
|
+
import type { DiagDistillerOutputV1 } from '../../diagnostician/diag-distiller-output.js';
|
|
39
|
+
import type { DiagnosticianOutputV1 } from '../../diagnostician-output.js';
|
|
40
|
+
import type { DreamerOutputV1 } from '../dreamer-output.js';
|
|
41
|
+
import type { PhilosopherOutputV1 } from '../philosopher-output.js';
|
|
42
|
+
import type { ScribeOutputV1 } from '../scribe-output.js';
|
|
43
|
+
import type { ArtificerRuleOutput } from '../artificer-output.js';
|
|
44
|
+
import type { EvaluatorOutputV2 } from '../evaluator-output.js';
|
|
45
|
+
/** The 8 stages that carry a summary in Layer 0 (design §6.1). */
|
|
46
|
+
export type SpikeStageKind = 'diag_rootcause' | 'diag_distiller' | 'diag_router' | 'dreamer' | 'philosopher' | 'scribe' | 'artificer' | 'evaluator';
|
|
47
|
+
/**
|
|
48
|
+
* Stage order along the synthetic chain. Mirrors `DIAGNOSTICIAN_EDGES`
|
|
49
|
+
* followed by `ALLOWED_EDGES` (design F5 / F14).
|
|
50
|
+
*/
|
|
51
|
+
export declare const SPIKE_STAGE_ORDER: readonly SpikeStageKind[];
|
|
52
|
+
export type SpikeChainId =
|
|
53
|
+
/** 缺陷链 A:scribe 原则文本完全丢失 dreamer 的 riskLevel 维度 */
|
|
54
|
+
'defect_a_risk_level_dropped'
|
|
55
|
+
/** 缺陷链 B:scribe 把 dreamer 的具体动作模糊为抽象表述 */
|
|
56
|
+
| 'defect_b_action_abstracted'
|
|
57
|
+
/** 对照链:无缺陷,用于识别「任何输入都报缺失」的假阳性 */
|
|
58
|
+
| 'control_no_defect';
|
|
59
|
+
/** The 5 dreamer dimensions the pipeline is supposed to carry forward. */
|
|
60
|
+
export type DreamerDimension = 'badDecision' | 'betterDecision' | 'rationale' | 'riskLevel' | 'strategicPerspective';
|
|
61
|
+
/**
|
|
62
|
+
* The defect a chain encodes, stated independently of the artifacts.
|
|
63
|
+
*
|
|
64
|
+
* The Spike driver (task 1.2) compares the summary-level evaluator's finding
|
|
65
|
+
* against this — it is the expected answer, not an input to any stage.
|
|
66
|
+
*/
|
|
67
|
+
export type SpikeExpectedDefect = {
|
|
68
|
+
readonly kind: 'none';
|
|
69
|
+
} | {
|
|
70
|
+
/** A dimension present at dreamer is absent from the scribe principle text. */
|
|
71
|
+
readonly kind: 'missing_dimension';
|
|
72
|
+
readonly segment: 'dreamer_to_scribe';
|
|
73
|
+
readonly dimension: DreamerDimension;
|
|
74
|
+
} | {
|
|
75
|
+
/** Concrete actions at dreamer became an abstract phrase at scribe. */
|
|
76
|
+
readonly kind: 'action_abstracted';
|
|
77
|
+
readonly segment: 'dreamer_to_scribe';
|
|
78
|
+
readonly concreteActions: readonly string[];
|
|
79
|
+
readonly abstractedAs: string;
|
|
80
|
+
};
|
|
81
|
+
/** One hop of a synthetic chain: artifact identity + the stage's contentJson. */
|
|
82
|
+
export interface SpikeChainHop<TContent> {
|
|
83
|
+
readonly stage: SpikeStageKind;
|
|
84
|
+
readonly artifactId: string;
|
|
85
|
+
readonly taskId: string;
|
|
86
|
+
/**
|
|
87
|
+
* Stage identity source of truth. Per F1, `artifactKind` cannot identify a
|
|
88
|
+
* stage (artificer writes `'principle'` too), so consumers must read this.
|
|
89
|
+
*/
|
|
90
|
+
readonly taskKind: SpikeStageKind;
|
|
91
|
+
/**
|
|
92
|
+
* The artifact id of the predecessor **on the task graph edge**
|
|
93
|
+
* (design §6.1). `null` only at the chain head.
|
|
94
|
+
*/
|
|
95
|
+
readonly edgePredecessorArtifactId: string | null;
|
|
96
|
+
readonly contentJson: TContent;
|
|
97
|
+
}
|
|
98
|
+
export interface SpikeChain {
|
|
99
|
+
readonly chainId: SpikeChainId;
|
|
100
|
+
/** Short human-readable label for Spike output. */
|
|
101
|
+
readonly label: string;
|
|
102
|
+
readonly expectedDefect: SpikeExpectedDefect;
|
|
103
|
+
readonly diagRootCause: SpikeChainHop<DiagRootCauseOutputV1>;
|
|
104
|
+
readonly diagDistiller: SpikeChainHop<DiagDistillerOutputV1>;
|
|
105
|
+
readonly diagRouter: SpikeChainHop<DiagnosticianOutputV1>;
|
|
106
|
+
readonly dreamer: SpikeChainHop<DreamerOutputV1>;
|
|
107
|
+
readonly philosopher: SpikeChainHop<PhilosopherOutputV1>;
|
|
108
|
+
readonly scribe: SpikeChainHop<ScribeOutputV1>;
|
|
109
|
+
readonly artificer: SpikeChainHop<ArtificerRuleOutput>;
|
|
110
|
+
readonly evaluator: SpikeChainHop<EvaluatorOutputV2>;
|
|
111
|
+
}
|
|
112
|
+
/** Ordered hops of a chain. `contentJson` stays `unknown` (rc-1). */
|
|
113
|
+
export declare function spikeChainHops(chain: SpikeChain): readonly SpikeChainHop<unknown>[];
|
|
114
|
+
/** The three concrete actions dreamer prescribes. Defect chain B loses these. */
|
|
115
|
+
export declare const CONCRETE_ACTIONS: readonly string[];
|
|
116
|
+
/** The abstract phrase defect chain B substitutes for the concrete actions. */
|
|
117
|
+
export declare const ABSTRACTED_PHRASE = "\u7406\u89E3\u67B6\u6784";
|
|
118
|
+
/** The dreamer risk level. Defect chain A loses this dimension entirely. */
|
|
119
|
+
export declare const DREAMER_RISK_LEVEL = "high";
|
|
120
|
+
/** 缺陷链 A:scribe 原则文本完全丢失 dreamer 的 `riskLevel` 维度。 */
|
|
121
|
+
export declare const SPIKE_CHAIN_DEFECT_A: SpikeChain;
|
|
122
|
+
/** 缺陷链 B:scribe 把 dreamer 的具体动作模糊为抽象表述。 */
|
|
123
|
+
export declare const SPIKE_CHAIN_DEFECT_B: SpikeChain;
|
|
124
|
+
/** 对照链:无缺陷。用于识别「任何输入都报缺失」的假阳性。 */
|
|
125
|
+
export declare const SPIKE_CHAIN_CONTROL: SpikeChain;
|
|
126
|
+
export declare const SPIKE_CHAINS: readonly SpikeChain[];
|
|
127
|
+
/** One inconsistency between a hop's lineage field and the hop it should name. */
|
|
128
|
+
export interface SpikeLineageViolation {
|
|
129
|
+
readonly chainId: SpikeChainId;
|
|
130
|
+
readonly stage: SpikeStageKind;
|
|
131
|
+
/** Dotted path of the offending field, e.g. `sourceTrace.scribeArtifactId`. */
|
|
132
|
+
readonly field: string;
|
|
133
|
+
readonly expected: string;
|
|
134
|
+
readonly actual: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Collect every lineage inconsistency in a chain.
|
|
138
|
+
*
|
|
139
|
+
* Only fields that actually exist on the real output types are checked, and each
|
|
140
|
+
* check names the concrete field and the hop it must point at — so a failure
|
|
141
|
+
* reports *which* field of *which* stage drifted, not merely "chain invalid"
|
|
142
|
+
* (ERR-088: the assertion signal must identify the intended path uniquely).
|
|
143
|
+
*
|
|
144
|
+
* Checked invariants:
|
|
145
|
+
* - `taskKind` equals `stage` (F1: stage identity comes from taskKind, never artifactKind)
|
|
146
|
+
* - each hop's `edgePredecessorArtifactId` is the previous hop on the task graph edge
|
|
147
|
+
* - `contentJson.taskId` equals the hop's own `taskId` (every stage except
|
|
148
|
+
* `diag_router`, whose output carries no `taskId` — PRI-272 removed it)
|
|
149
|
+
* - `diag_distiller.sourceRootCauseArtifactId` → rootcause artifact
|
|
150
|
+
* - `diag_router` carries Stage A's `rootCause`/`evidence` and Stage B's
|
|
151
|
+
* `confidence` (the invariants `diag-router-runner.postFetchTransform` injects)
|
|
152
|
+
* - `dreamer.contextRefs` contains the router artifact
|
|
153
|
+
* - `philosopher.sourceDreamerArtifactId` → dreamer artifact
|
|
154
|
+
* - scribe / artificer / evaluator top-level source ids and every
|
|
155
|
+
* `sourceTrace.*` id point at the actual upstream artifacts
|
|
156
|
+
*/
|
|
157
|
+
export declare function findSpikeLineageViolations(chain: SpikeChain): readonly SpikeLineageViolation[];
|
|
158
|
+
/**
|
|
159
|
+
* Throw with a per-field report when a chain's lineage is inconsistent.
|
|
160
|
+
*
|
|
161
|
+
* Used by the fixture self-check test and available to the Spike driver so a
|
|
162
|
+
* corrupted fixture fails loud instead of silently weakening the Spike (rc-9).
|
|
163
|
+
*/
|
|
164
|
+
export declare function assertSpikeChainLineageConsistent(chain: SpikeChain): void;
|
|
165
|
+
//# sourceMappingURL=progressive-disclosure-spike-fixtures.d.ts.map
|
package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressive-disclosure-spike-fixtures.d.ts","sourceRoot":"","sources":["../../../../src/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,kEAAkE;AAClE,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,gBAAgB,GAChB,aAAa,GACb,SAAS,GACT,aAAa,GACb,QAAQ,GACR,WAAW,GACX,WAAW,CAAC;AAEhB;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAStD,CAAC;AAEF,MAAM,MA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