@principles/core 1.151.0 → 1.153.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/__tests__/adversarial-loop.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/adversarial-loop.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/adversarial-loop.test.js +435 -0
- package/dist/runtime-v2/__tests__/adversarial-loop.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.js +5 -0
- package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.js +169 -0
- package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.d.ts +2 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.d.ts.map +1 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +815 -0
- package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js +6 -0
- package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js.map +1 -1
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js +4 -0
- package/dist/runtime-v2/__tests__/pitask-metadata.test.js.map +1 -1
- package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.d.ts +2 -0
- package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js +510 -0
- package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js.map +1 -0
- package/dist/runtime-v2/adapter/artificer-l2-adapter.d.ts +47 -0
- package/dist/runtime-v2/adapter/artificer-l2-adapter.d.ts.map +1 -0
- package/dist/runtime-v2/adapter/artificer-l2-adapter.js +307 -0
- package/dist/runtime-v2/adapter/artificer-l2-adapter.js.map +1 -0
- package/dist/runtime-v2/adversarial-loop.d.ts +65 -0
- package/dist/runtime-v2/adversarial-loop.d.ts.map +1 -0
- package/dist/runtime-v2/adversarial-loop.js +203 -0
- package/dist/runtime-v2/adversarial-loop.js.map +1 -0
- package/dist/runtime-v2/golden-trace.d.ts +30 -0
- package/dist/runtime-v2/golden-trace.d.ts.map +1 -1
- package/dist/runtime-v2/golden-trace.js +57 -0
- package/dist/runtime-v2/golden-trace.js.map +1 -1
- package/dist/runtime-v2/index.d.ts +10 -6
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +7 -3
- package/dist/runtime-v2/index.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.js +139 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.js +62 -0
- package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.js +249 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js +24 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +2 -2
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.js +209 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.js +125 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.js.map +1 -0
- package/dist/runtime-v2/internalization/adversarial-case.d.ts +32 -0
- package/dist/runtime-v2/internalization/adversarial-case.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/adversarial-case.js +68 -0
- package/dist/runtime-v2/internalization/adversarial-case.js.map +1 -0
- package/dist/runtime-v2/internalization/adversarial-feedback.d.ts +23 -0
- package/dist/runtime-v2/internalization/adversarial-feedback.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/adversarial-feedback.js +20 -0
- package/dist/runtime-v2/internalization/adversarial-feedback.js.map +1 -0
- package/dist/runtime-v2/internalization/artificer-output.d.ts +42 -0
- package/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-output.js +147 -0
- package/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +10 -2
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js +26 -3
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.d.ts +7 -0
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.js +11 -2
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-output.d.ts +63 -0
- package/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-output.js +158 -0
- package/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts +8 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js +16 -3
- package/dist/runtime-v2/internalization/evaluator-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts +82 -2
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js +496 -4
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/index.d.ts +9 -4
- package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/index.js +6 -2
- package/dist/runtime-v2/internalization/index.js.map +1 -1
- package/dist/runtime-v2/internalization/peer-runner-contracts.d.ts +2 -0
- package/dist/runtime-v2/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/peer-runner-contracts.js +19 -9
- package/dist/runtime-v2/internalization/peer-runner-contracts.js.map +1 -1
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts +7 -0
- package/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/pitask-metadata.js +15 -5
- package/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
- package/dist/runtime-v2/internalization/prompt-serializer.d.ts +3 -0
- package/dist/runtime-v2/internalization/prompt-serializer.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/prompt-serializer.js +22 -0
- package/dist/runtime-v2/internalization/prompt-serializer.js.map +1 -0
- package/dist/telemetry-event.d.ts +2 -2
- package/dist/telemetry-event.d.ts.map +1 -1
- package/dist/telemetry-event.js +21 -0
- package/dist/telemetry-event.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EvaluatorPromptBuilder V2 tests (RuleHost MVP Activation, PRI-425).
|
|
3
|
+
*
|
|
4
|
+
* TDD Phase 5.1 RED — asserts behavior not yet implemented.
|
|
5
|
+
*
|
|
6
|
+
* Coverage (PRD Decision 7 Part A — Passive Review):
|
|
7
|
+
* - V2 artificer input (has implementationCode) → prompt includes code review
|
|
8
|
+
* three-dimension instruction (intentConsistency / scopePrecision / traceCoverage)
|
|
9
|
+
* - V2 input → scribe principle text is passed through to prompt input
|
|
10
|
+
* - V1 artificer input (no code) → prompt unchanged (backward compat)
|
|
11
|
+
* - short-circuit: instruction tells LLM to skip adversarial cases when
|
|
12
|
+
* passive review fails
|
|
13
|
+
*
|
|
14
|
+
* ERR checklist (EP-01): untrusted artificer artifact kept as `unknown` in the
|
|
15
|
+
* prompt input; builder does not validate its shape (that is the validator's job).
|
|
16
|
+
*/
|
|
17
|
+
import { describe, it, expect } from 'vitest';
|
|
18
|
+
import { EvaluatorPromptBuilder, EVALUATOR_PROTOCOL_INSTRUCTION, } from '../evaluator-prompt-builder.js';
|
|
19
|
+
const V1_ARTIFICER = {
|
|
20
|
+
taskId: 'artificer-task-001',
|
|
21
|
+
implementationPlan: {
|
|
22
|
+
summary: 'Add input validation',
|
|
23
|
+
targetSurface: 'src/ops/*.ts',
|
|
24
|
+
changes: ['Add try-catch'],
|
|
25
|
+
tests: ['Unit test for error handling'],
|
|
26
|
+
rolloutNotes: ['Deploy behind feature flag'],
|
|
27
|
+
confidence: 0.85,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
const V2_ARTIFICER = {
|
|
31
|
+
...V1_ARTIFICER,
|
|
32
|
+
implementationCode: 'function evaluate(input, helpers) { return { decision: "allow", matched: false, reason: "ok" }; }',
|
|
33
|
+
goldenTraceCases: [
|
|
34
|
+
{ caseId: 'negative-1', kind: 'negative', toolName: 'edit', params: { path: '/etc/x' }, expectedDecision: 'block' },
|
|
35
|
+
{ caseId: 'positive-1', kind: 'positive', toolName: 'read', params: { path: '/tmp/y' }, expectedDecision: 'allow' },
|
|
36
|
+
],
|
|
37
|
+
affectedTools: ['edit'],
|
|
38
|
+
};
|
|
39
|
+
const SCRIBE_PRINCIPLE = {
|
|
40
|
+
principleDraft: {
|
|
41
|
+
title: 'Block writes to system directories',
|
|
42
|
+
statement: 'Never allow edits to /etc without explicit approval.',
|
|
43
|
+
},
|
|
44
|
+
painReasonSummary: 'AI deleted a side-effect cleanup function during refactor.',
|
|
45
|
+
};
|
|
46
|
+
describe('EvaluatorPromptBuilder — V2 code review (PRI-425)', () => {
|
|
47
|
+
const builder = new EvaluatorPromptBuilder();
|
|
48
|
+
// ── V2 input triggers code review instruction ──────────────────────────────
|
|
49
|
+
it('V2 artificer input → instruction mentions intentConsistency', () => {
|
|
50
|
+
builder.buildPrompt({
|
|
51
|
+
taskId: 'eval-task-001',
|
|
52
|
+
contextHash: 'ctx-abc',
|
|
53
|
+
sourceArtificerArtifactId: 'pi-art-artificer-001',
|
|
54
|
+
artificerArtifact: V2_ARTIFICER,
|
|
55
|
+
scribeArtifact: SCRIBE_PRINCIPLE,
|
|
56
|
+
});
|
|
57
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('intentConsistency');
|
|
58
|
+
});
|
|
59
|
+
it('V2 artificer input → instruction mentions scopePrecision', () => {
|
|
60
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('scopePrecision');
|
|
61
|
+
});
|
|
62
|
+
it('V2 artificer input → instruction mentions traceCoverage', () => {
|
|
63
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('traceCoverage');
|
|
64
|
+
});
|
|
65
|
+
it('V2 instruction includes the three scopePrecision verdicts', () => {
|
|
66
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('precise');
|
|
67
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('too_broad');
|
|
68
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toContain('too_narrow');
|
|
69
|
+
});
|
|
70
|
+
it('V2 example includes codeReview and adversarialCases so the model cannot copy a V1 response', () => {
|
|
71
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toMatch(/COMPLETE EXAMPLE OUTPUT[\s\S]*"codeReview"/);
|
|
72
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION).toMatch(/COMPLETE EXAMPLE OUTPUT[\s\S]*"adversarialCases"/);
|
|
73
|
+
});
|
|
74
|
+
// ── short-circuit: skip adversarial when passive review fails ──────────────
|
|
75
|
+
it('instruction tells LLM to skip adversarial cases when passive review fails', () => {
|
|
76
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION.toLowerCase()).toContain('adversarial');
|
|
77
|
+
// The instruction must communicate the short-circuit rule.
|
|
78
|
+
expect(EVALUATOR_PROTOCOL_INSTRUCTION.toLowerCase()).toMatch(/skip|only.*pass|do not.*generat.*adversarial.*fail/);
|
|
79
|
+
});
|
|
80
|
+
// ── scribe principle text passed through ────────────────────────────────────
|
|
81
|
+
it('V2 input → scribeArtifact passed through to prompt input', () => {
|
|
82
|
+
const { promptInput } = builder.buildPrompt({
|
|
83
|
+
taskId: 'eval-task-001',
|
|
84
|
+
contextHash: 'ctx-abc',
|
|
85
|
+
sourceArtificerArtifactId: 'pi-art-artificer-001',
|
|
86
|
+
artificerArtifact: V2_ARTIFICER,
|
|
87
|
+
scribeArtifact: SCRIBE_PRINCIPLE,
|
|
88
|
+
});
|
|
89
|
+
expect(promptInput.scribeArtifact).toEqual(SCRIBE_PRINCIPLE);
|
|
90
|
+
});
|
|
91
|
+
it('V2 input → artificerArtifact still passed through', () => {
|
|
92
|
+
const { promptInput } = builder.buildPrompt({
|
|
93
|
+
taskId: 'eval-task-001',
|
|
94
|
+
contextHash: 'ctx-abc',
|
|
95
|
+
sourceArtificerArtifactId: 'pi-art-artificer-001',
|
|
96
|
+
artificerArtifact: V2_ARTIFICER,
|
|
97
|
+
scribeArtifact: SCRIBE_PRINCIPLE,
|
|
98
|
+
});
|
|
99
|
+
expect(promptInput.artificerArtifact).toEqual(V2_ARTIFICER);
|
|
100
|
+
});
|
|
101
|
+
// ── V1 backward compatibility ────────────────────────────────────────────────
|
|
102
|
+
it('V1 artificer input (no code) → buildPrompt succeeds without scribeArtifact', () => {
|
|
103
|
+
const { promptInput } = builder.buildPrompt({
|
|
104
|
+
taskId: 'eval-task-001',
|
|
105
|
+
contextHash: 'ctx-abc',
|
|
106
|
+
sourceArtificerArtifactId: 'pi-art-artificer-001',
|
|
107
|
+
artificerArtifact: V1_ARTIFICER,
|
|
108
|
+
});
|
|
109
|
+
expect(promptInput.artificerArtifact).toEqual(V1_ARTIFICER);
|
|
110
|
+
expect(promptInput.scribeArtifact).toBeUndefined();
|
|
111
|
+
});
|
|
112
|
+
it('V1 input → instruction still works (code review section is conditional on V2 fields)', () => {
|
|
113
|
+
// The instruction can mention code review unconditionally; the LLM only
|
|
114
|
+
// produces codeReview when the artificer artifact carries implementationCode.
|
|
115
|
+
// This test just ensures V1 path doesn't crash.
|
|
116
|
+
const result = builder.buildPrompt({
|
|
117
|
+
taskId: 'eval-task-001',
|
|
118
|
+
contextHash: 'ctx-abc',
|
|
119
|
+
sourceArtificerArtifactId: 'pi-art-artificer-001',
|
|
120
|
+
artificerArtifact: V1_ARTIFICER,
|
|
121
|
+
});
|
|
122
|
+
expect(result.message).toContain('eval-task-001');
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=evaluator-prompt-builder-v2.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator-prompt-builder-v2.test.js","sourceRoot":"","sources":["../../../../src/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AAExC,MAAM,YAAY,GAAG;IACnB,MAAM,EAAE,oBAAoB;IAC5B,kBAAkB,EAAE;QAClB,OAAO,EAAE,sBAAsB;QAC/B,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE,CAAC,eAAe,CAAC;QAC1B,KAAK,EAAE,CAAC,8BAA8B,CAAC;QACvC,YAAY,EAAE,CAAC,4BAA4B,CAAC;QAC5C,UAAU,EAAE,IAAI;KACjB;CACF,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,GAAG,YAAY;IACf,kBAAkB,EAAE,mGAAmG;IACvH,gBAAgB,EAAE;QAChB,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE;QACnH,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE;KACpH;IACD,aAAa,EAAE,CAAC,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACvB,cAAc,EAAE;QACd,KAAK,EAAE,oCAAoC;QAC3C,SAA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AAsB;YACjD,iBAAiB,EAAE,YAAY;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,aAAa,EAAE,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sFAAsF,EAAE,GAAG,EAAE;QAC9F,wEAAwE;QACxE,8EAA8E;QAC9E,gDAAgD;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YACjC,MAAM,EAAE,eAAe;YACvB,WAAW,EAAE,SAAS;YACtB,yBAAyB,EAAE,sBAAsB;YACjD,iBAAiB,EAAE,YAAY;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adversarial case → GoldenTrace conversion (RuleHost MVP Activation, ADR-0014
|
|
3
|
+
* Amendment 2026-06-17, PRD Decision 11d).
|
|
4
|
+
*
|
|
5
|
+
* Adversarial cases are generated by the Evaluator LLM to attack the Artificer's
|
|
6
|
+
* generated code. Every adversarial case is conceptually a NEGATIVE expectation
|
|
7
|
+
* (the attack should reveal a gap), so the converted GoldenTrace marks all
|
|
8
|
+
* cases kind='negative'.
|
|
9
|
+
*
|
|
10
|
+
* IMPORTANT design contract: the converted trace intentionally does NOT pass
|
|
11
|
+
* `validateGoldenTrace()` on its own, because it has no positive case. The
|
|
12
|
+
* caller (Evaluator.succeedTask, Phase 5) must append a positive case (or
|
|
13
|
+
* merge with the Artificer's golden trace) before the combined trace can be
|
|
14
|
+
* replayed. This is pinned by adversarial-case.test.ts.
|
|
15
|
+
*/
|
|
16
|
+
import type { GoldenTrace } from '../golden-trace.js';
|
|
17
|
+
export type AdversarialConversionResult = {
|
|
18
|
+
readonly ok: true;
|
|
19
|
+
readonly trace: GoldenTrace;
|
|
20
|
+
} | {
|
|
21
|
+
readonly ok: false;
|
|
22
|
+
readonly reason: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Convert AdversarialCase[] (all attacks, all negative) into a GoldenTrace.
|
|
26
|
+
*
|
|
27
|
+
* Does NOT synthesize a positive case — see file header. The caller is
|
|
28
|
+
* responsible for ensuring the replayed trace has ≥1 positive case, either
|
|
29
|
+
* by merging with the Artificer's golden trace or appending one.
|
|
30
|
+
*/
|
|
31
|
+
export declare function adversarialCasesToGoldenTrace(cases: unknown): AdversarialConversionResult;
|
|
32
|
+
//# sourceMappingURL=adversarial-case.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-case.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-case.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,oBAAoB,CAAC;AAS5F,MAAM,MAAM,2BAA2B,GACnC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMpD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,2BAA2B,CAyDzF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const ADVERSARIAL_ATTACK_TYPES = new Set(['boundary', 'omission', 'inversion']);
|
|
2
|
+
const GOLDEN_TRACE_DECISIONS = new Set(['allow', 'block', 'propose_correction']);
|
|
3
|
+
function isGoldenTraceDecision(v) {
|
|
4
|
+
return GOLDEN_TRACE_DECISIONS.has(v);
|
|
5
|
+
}
|
|
6
|
+
function isRecord(v) {
|
|
7
|
+
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Convert AdversarialCase[] (all attacks, all negative) into a GoldenTrace.
|
|
11
|
+
*
|
|
12
|
+
* Does NOT synthesize a positive case — see file header. The caller is
|
|
13
|
+
* responsible for ensuring the replayed trace has ≥1 positive case, either
|
|
14
|
+
* by merging with the Artificer's golden trace or appending one.
|
|
15
|
+
*/
|
|
16
|
+
export function adversarialCasesToGoldenTrace(cases) {
|
|
17
|
+
if (!Array.isArray(cases)) {
|
|
18
|
+
return { ok: false, reason: 'adversarialCases must be an array' };
|
|
19
|
+
}
|
|
20
|
+
if (cases.length === 0) {
|
|
21
|
+
return { ok: false, reason: 'adversarialCases must contain at least one case, got 0' };
|
|
22
|
+
}
|
|
23
|
+
const mappedCases = [];
|
|
24
|
+
for (let index = 0; index < cases.length; index += 1) {
|
|
25
|
+
const entry = cases[index];
|
|
26
|
+
const prefix = `adversarialCases[${index}]`;
|
|
27
|
+
if (!isRecord(entry)) {
|
|
28
|
+
return { ok: false, reason: `${prefix} must be an object` };
|
|
29
|
+
}
|
|
30
|
+
if (!Object.hasOwn(entry, 'caseId') || typeof entry.caseId !== 'string' || entry.caseId.trim() === '') {
|
|
31
|
+
return { ok: false, reason: `${prefix}.caseId must be a non-empty string` };
|
|
32
|
+
}
|
|
33
|
+
if (!Object.hasOwn(entry, 'attackType') || typeof entry.attackType !== 'string' || !ADVERSARIAL_ATTACK_TYPES.has(entry.attackType)) {
|
|
34
|
+
return { ok: false, reason: `${prefix}.attackType must be one of boundary|omission|inversion, got ${String(entry.attackType)}` };
|
|
35
|
+
}
|
|
36
|
+
if (!Object.hasOwn(entry, 'toolName') || typeof entry.toolName !== 'string' || entry.toolName.trim() === '') {
|
|
37
|
+
return { ok: false, reason: `${prefix}.toolName must be a non-empty string` };
|
|
38
|
+
}
|
|
39
|
+
if (!Object.hasOwn(entry, 'params') || !isRecord(entry.params)) {
|
|
40
|
+
return { ok: false, reason: `${prefix}.params must be an object` };
|
|
41
|
+
}
|
|
42
|
+
if (!Object.hasOwn(entry, 'expectedDecision')
|
|
43
|
+
|| typeof entry.expectedDecision !== 'string'
|
|
44
|
+
|| !isGoldenTraceDecision(entry.expectedDecision)) {
|
|
45
|
+
return { ok: false, reason: `${prefix}.expectedDecision must be one of allow|block|propose_correction, got ${String(entry.expectedDecision)}` };
|
|
46
|
+
}
|
|
47
|
+
if (!Object.hasOwn(entry, 'rationale') || typeof entry.rationale !== 'string' || entry.rationale.trim() === '') {
|
|
48
|
+
return { ok: false, reason: `${prefix}.rationale must be a non-empty string` };
|
|
49
|
+
}
|
|
50
|
+
mappedCases.push({
|
|
51
|
+
caseId: entry.caseId,
|
|
52
|
+
// All adversarial cases are attacks → negative expectations.
|
|
53
|
+
kind: 'negative',
|
|
54
|
+
toolName: entry.toolName,
|
|
55
|
+
params: entry.params,
|
|
56
|
+
// Narrowed by isGoldenTraceDecision above (Runtime Contract Rule 2).
|
|
57
|
+
expectedDecision: entry.expectedDecision,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const trace = {
|
|
61
|
+
traceId: `golden-trace-adversarial-${Date.now().toString(36)}`,
|
|
62
|
+
version: 1,
|
|
63
|
+
createdAt: new Date().toISOString(),
|
|
64
|
+
cases: mappedCases,
|
|
65
|
+
};
|
|
66
|
+
return { ok: true, trace };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=adversarial-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-case.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-case.ts"],"names":[],"mappings":"AAiBA,MAAM,wBAAwB,GAAwB,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AACrG,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,E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AE,CAAC;QAClJ,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/G,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,uCAAuC,EAAE,CAAC;QACjF,CAAC;QAED,WAAW,CAAC,IAAI,CAAC;YACf,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,6DAA6D;YAC7D,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,qEAAqE;YACrE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;SACzC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,GAAgB;QACzB,OAAO,EAAE,4BAA4B,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE;QAC9D,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,KAAK,EAAE,WAAW;KACnB,CAAC;IAEF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adversarial feedback formatter (RuleHost MVP, PRI-428).
|
|
3
|
+
*
|
|
4
|
+
* Converts EvaluatorAdversarialResult.failedCases into a deterministic,
|
|
5
|
+
* human-readable text block that is injected into a Round-2 Artificer prompt
|
|
6
|
+
* so the LLM can make targeted code corrections instead of blind regeneration.
|
|
7
|
+
*
|
|
8
|
+
* Design:
|
|
9
|
+
* - Pure function, no I/O, no timestamps/random (deterministic).
|
|
10
|
+
* - Each failed case becomes one line: caseId | attackType | expected vs
|
|
11
|
+
* actual | rationale.
|
|
12
|
+
* - Empty input still yields a usable, non-empty string (the gate may
|
|
13
|
+
* reject on a runtime error with no per-case detail).
|
|
14
|
+
*/
|
|
15
|
+
import type { AdversarialFailedCase } from './evaluator-output.js';
|
|
16
|
+
/**
|
|
17
|
+
* Format a list of adversarial failed cases into a prompt-injectable text block.
|
|
18
|
+
*
|
|
19
|
+
* @param failedCases - from EvaluatorAdversarialResult.failedCases (may be empty)
|
|
20
|
+
* @returns a deterministic multi-line string; never empty
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatAdversarialFeedback(failedCases: readonly AdversarialFailedCase[]): string;
|
|
23
|
+
//# sourceMappingURL=adversarial-feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-feedback.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAInE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,SAAS,qBAAqB,EAAE,GAAG,MAAM,CAa/F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const HEADER = '--- Prior adversarial replay failures (address these in your revised code) ---';
|
|
2
|
+
/**
|
|
3
|
+
* Format a list of adversarial failed cases into a prompt-injectable text block.
|
|
4
|
+
*
|
|
5
|
+
* @param failedCases - from EvaluatorAdversarialResult.failedCases (may be empty)
|
|
6
|
+
* @returns a deterministic multi-line string; never empty
|
|
7
|
+
*/
|
|
8
|
+
export function formatAdversarialFeedback(failedCases) {
|
|
9
|
+
if (failedCases.length === 0) {
|
|
10
|
+
return `${HEADER}\n(0 structured failures recorded — the prior code failed the adversarial sandbox replay on a runtime/structural error. Re-examine the matcher logic.)`;
|
|
11
|
+
}
|
|
12
|
+
const lines = failedCases.map((fc) => {
|
|
13
|
+
const rationale = typeof fc.rationale === 'string' && fc.rationale.trim() !== ''
|
|
14
|
+
? fc.rationale
|
|
15
|
+
: '(no rationale provided)';
|
|
16
|
+
return `- ${fc.caseId} [${fc.attackType}]: expected ${fc.expectedDecision}, got ${fc.actualDecision} — ${rationale}`;
|
|
17
|
+
});
|
|
18
|
+
return `${HEADER}\n${lines.join('\n')}`;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=adversarial-feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adversarial-feedback.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/adversarial-feedback.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,GAAG,gFAAgF,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAA6C;IACrF,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,GAAG,MAAM,wJAAwJ,CAAC;IAC3K,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;QACnC,MAAM,SAAS,GAAG,OAAO,EAAE,CAAC,SAAS,KAAK,QAAQ,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;YAC9E,CAAC,CAAC,EAAE,CAAC,SAAS;YACd,CAAC,CAAC,yBAAyB,CAAC;QAC9B,OAAO,KAAK,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,UAAU,eAAe,EAAE,CAAC,gBAAgB,SAAS,EAAE,CAAC,cAAc,MAAM,SAAS,EAAE,CAAC;IACvH,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Static } from '@sinclair/typebox';
|
|
2
|
+
import type { GoldenTraceDecision } from '../golden-trace.js';
|
|
2
3
|
export interface ArtificerImplementationPlan {
|
|
3
4
|
readonly summary: string;
|
|
4
5
|
readonly targetSurface: string;
|
|
@@ -20,6 +21,37 @@ export interface ArtificerOutputV1 {
|
|
|
20
21
|
readonly risks: readonly string[];
|
|
21
22
|
readonly generatedAt: string;
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Artificer-generated golden trace case input (RuleHost MVP Activation, ADR-0014
|
|
26
|
+
* Amendment 2026-06-17 Decision 1).
|
|
27
|
+
*
|
|
28
|
+
* `expectedDecision` uses `GoldenTraceDecision` ('allow'|'block'|'propose_correction'),
|
|
29
|
+
* NOT `RuleHostDecision`. The sandbox replay layer maps the two enums (see PRD
|
|
30
|
+
* Decision 1 mapping table). `kind='positive'` requires `expectedDecision='allow'`
|
|
31
|
+
* (mirrors `validateGoldenTraceCase` invariant in golden-trace.ts:116).
|
|
32
|
+
*/
|
|
33
|
+
export interface GoldenTraceCaseInput {
|
|
34
|
+
readonly caseId: string;
|
|
35
|
+
readonly kind: 'positive' | 'negative';
|
|
36
|
+
readonly toolName: string;
|
|
37
|
+
readonly params: Record<string, unknown>;
|
|
38
|
+
readonly expectedDecision: GoldenTraceDecision;
|
|
39
|
+
readonly expectedProposedParams?: Record<string, unknown>;
|
|
40
|
+
readonly expectedApplicationMode?: 'shadow' | 'live';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* ArtificerOutputV2 — V1 plus executable rule code fields (Decision 1).
|
|
44
|
+
*
|
|
45
|
+
* A V2 output is produced only by `ArtificerL2Adapter` (write-test-fix loop).
|
|
46
|
+
* V1 outputs (no code fields) flow through the existing principle-artifact
|
|
47
|
+
* path unchanged. `isArtificerOutputV2()` distinguishes the two at runtime;
|
|
48
|
+
* never `as`-cast (Runtime Contract Rule 2, ERR-001).
|
|
49
|
+
*/
|
|
50
|
+
export interface ArtificerOutputV2 extends ArtificerOutputV1 {
|
|
51
|
+
readonly implementationCode: string;
|
|
52
|
+
readonly goldenTraceCases: readonly GoldenTraceCaseInput[];
|
|
53
|
+
readonly affectedTools: readonly string[];
|
|
54
|
+
}
|
|
23
55
|
export declare const ArtificerImplementationPlanSchema: import("@sinclair/typebox").TObject<{
|
|
24
56
|
summary: import("@sinclair/typebox").TString;
|
|
25
57
|
targetSurface: import("@sinclair/typebox").TString;
|
|
@@ -62,6 +94,16 @@ export interface ArtificerValidator {
|
|
|
62
94
|
/** Validate untrusted output. Accepts `unknown` — must perform runtime checks (ERR-001). */
|
|
63
95
|
validate(output: unknown, taskId: string, expectedSourceScribeArtifactId?: string): Promise<ArtificerValidationResult>;
|
|
64
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Runtime type guard distinguishing V2 (code-bearing) artificer output from V1.
|
|
99
|
+
* Use this — not `as ArtificerOutputV2` — after `validate()` succeeds to decide
|
|
100
|
+
* whether the rule-artifact assembly path applies (Runtime Contract Rule 2).
|
|
101
|
+
*
|
|
102
|
+
* Detection: V2 requires ALL three code fields present and well-formed. A
|
|
103
|
+
* partially-populated object is NOT V2 (it is malformed and will have been
|
|
104
|
+
* rejected by validate()).
|
|
105
|
+
*/
|
|
106
|
+
export declare function isArtificerOutputV2(output: unknown): output is ArtificerOutputV2;
|
|
65
107
|
export declare class DefaultArtificerValidator implements ArtificerValidator {
|
|
66
108
|
validate(output: unknown, taskId: string, expectedSourceScribeArtifactId?: string): Promise<ArtificerValidationResult>;
|
|
67
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artificer-output.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"artificer-output.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBA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v) {
|
|
24
24
|
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
25
25
|
}
|
|
26
|
+
const GOLDEN_TRACE_DECISIONS = new Set(['allow', 'block', 'propose_correction']);
|
|
27
|
+
const MAX_GOLDEN_TRACE_CASES = 10;
|
|
28
|
+
const MIN_GOLDEN_TRACE_CASES = 2;
|
|
29
|
+
/**
|
|
30
|
+
* Validate Artificer's goldenTraceCases input. Mirrors the structural invariants
|
|
31
|
+
* of `validateGoldenTraceCase` / `validateGoldenTrace` in golden-trace.ts but
|
|
32
|
+
* operates on the artificer-input shape (GoldenTraceCaseInput, no sourceRefs).
|
|
33
|
+
* - At least 1 positive + 1 negative case (PRD Decision 1).
|
|
34
|
+
* - 2..10 cases inclusive.
|
|
35
|
+
* - positive case must expect 'allow' (golden-trace.ts:116).
|
|
36
|
+
* - expectedDecision ∈ {allow, block, propose_correction}.
|
|
37
|
+
*/
|
|
38
|
+
function validateGoldenTraceCasesInput(raw) {
|
|
39
|
+
const errors = [];
|
|
40
|
+
if (!Array.isArray(raw)) {
|
|
41
|
+
errors.push('goldenTraceCases must be an array');
|
|
42
|
+
return errors;
|
|
43
|
+
}
|
|
44
|
+
if (raw.length < MIN_GOLDEN_TRACE_CASES) {
|
|
45
|
+
errors.push(`goldenTraceCases must contain at least ${MIN_GOLDEN_TRACE_CASES} cases (1 positive + 1 negative), got ${raw.length}`);
|
|
46
|
+
}
|
|
47
|
+
if (raw.length > MAX_GOLDEN_TRACE_CASES) {
|
|
48
|
+
errors.push(`goldenTraceCases must contain at most ${MAX_GOLDEN_TRACE_CASES} cases, got ${raw.length}`);
|
|
49
|
+
}
|
|
50
|
+
let hasPositive = false;
|
|
51
|
+
let hasNegative = false;
|
|
52
|
+
raw.forEach((entry, index) => {
|
|
53
|
+
const prefix = `goldenTraceCases[${index}]`;
|
|
54
|
+
if (!isRecord(entry)) {
|
|
55
|
+
errors.push(`${prefix} must be an object`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!Object.hasOwn(entry, 'caseId') || typeof entry.caseId !== 'string' || entry.caseId.trim() === '') {
|
|
59
|
+
errors.push(`${prefix}.caseId must be a non-empty string`);
|
|
60
|
+
}
|
|
61
|
+
if (!Object.hasOwn(entry, 'kind') || (entry.kind !== 'positive' && entry.kind !== 'negative')) {
|
|
62
|
+
errors.push(`${prefix}.kind must be 'positive' or 'negative'`);
|
|
63
|
+
}
|
|
64
|
+
else if (entry.kind === 'positive') {
|
|
65
|
+
hasPositive = true;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
hasNegative = true;
|
|
69
|
+
}
|
|
70
|
+
if (!Object.hasOwn(entry, 'toolName') || typeof entry.toolName !== 'string' || entry.toolName.trim() === '') {
|
|
71
|
+
errors.push(`${prefix}.toolName must be a non-empty string`);
|
|
72
|
+
}
|
|
73
|
+
if (!Object.hasOwn(entry, 'params') || !isRecord(entry.params)) {
|
|
74
|
+
errors.push(`${prefix}.params must be an object`);
|
|
75
|
+
}
|
|
76
|
+
if (!Object.hasOwn(entry, 'expectedDecision')
|
|
77
|
+
|| typeof entry.expectedDecision !== 'string'
|
|
78
|
+
|| !GOLDEN_TRACE_DECISIONS.has(entry.expectedDecision)) {
|
|
79
|
+
errors.push(`${prefix}.expectedDecision must be one of allow|block|propose_correction, got ${String(entry.expectedDecision)}`);
|
|
80
|
+
}
|
|
81
|
+
else if (entry.kind === 'positive' && entry.expectedDecision !== 'allow') {
|
|
82
|
+
errors.push(`${prefix}: positive cases must expect allow (got ${entry.expectedDecision})`);
|
|
83
|
+
}
|
|
84
|
+
// propose_correction requires expectedProposedParams + expectedApplicationMode
|
|
85
|
+
// (mirrors golden-trace.ts:110-114). Enforced here so malformed V2 output
|
|
86
|
+
// fails at validation, not later in the sandbox.
|
|
87
|
+
if (entry.expectedDecision === 'propose_correction') {
|
|
88
|
+
if (!Object.hasOwn(entry, 'expectedProposedParams') || !isRecord(entry.expectedProposedParams)) {
|
|
89
|
+
errors.push(`${prefix}.expectedProposedParams is required when expectedDecision is propose_correction`);
|
|
90
|
+
}
|
|
91
|
+
if (!Object.hasOwn(entry, 'expectedApplicationMode')
|
|
92
|
+
|| (entry.expectedApplicationMode !== 'shadow' && entry.expectedApplicationMode !== 'live')) {
|
|
93
|
+
errors.push(`${prefix}.expectedApplicationMode must be shadow or live when expectedDecision is propose_correction`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
// Only check positive/negative presence when array shape is valid (avoid
|
|
98
|
+
// double-reporting on the same malformed array).
|
|
99
|
+
if (Array.isArray(raw) && raw.length > 0) {
|
|
100
|
+
if (!hasPositive)
|
|
101
|
+
errors.push('goldenTraceCases must include at least one positive case');
|
|
102
|
+
if (!hasNegative)
|
|
103
|
+
errors.push('goldenTraceCases must include at least one negative case');
|
|
104
|
+
}
|
|
105
|
+
return errors;
|
|
106
|
+
}
|
|
107
|
+
function validateAffectedTools(raw) {
|
|
108
|
+
const errors = [];
|
|
109
|
+
if (!Array.isArray(raw)) {
|
|
110
|
+
errors.push('affectedTools must be an array');
|
|
111
|
+
return errors;
|
|
112
|
+
}
|
|
113
|
+
if (raw.length === 0) {
|
|
114
|
+
errors.push('affectedTools must be a non-empty array');
|
|
115
|
+
}
|
|
116
|
+
raw.forEach((entry, index) => {
|
|
117
|
+
if (typeof entry !== 'string' || entry.trim() === '') {
|
|
118
|
+
errors.push(`affectedTools[${index}] must be a non-empty string`);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return errors;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Runtime type guard distinguishing V2 (code-bearing) artificer output from V1.
|
|
125
|
+
* Use this — not `as ArtificerOutputV2` — after `validate()` succeeds to decide
|
|
126
|
+
* whether the rule-artifact assembly path applies (Runtime Contract Rule 2).
|
|
127
|
+
*
|
|
128
|
+
* Detection: V2 requires ALL three code fields present and well-formed. A
|
|
129
|
+
* partially-populated object is NOT V2 (it is malformed and will have been
|
|
130
|
+
* rejected by validate()).
|
|
131
|
+
*/
|
|
132
|
+
export function isArtificerOutputV2(output) {
|
|
133
|
+
if (!isRecord(output))
|
|
134
|
+
return false;
|
|
135
|
+
if (typeof output.implementationCode !== 'string' || output.implementationCode.trim() === '')
|
|
136
|
+
return false;
|
|
137
|
+
if (!Array.isArray(output.goldenTraceCases) || output.goldenTraceCases.length === 0)
|
|
138
|
+
return false;
|
|
139
|
+
if (!Array.isArray(output.affectedTools) || output.affectedTools.length === 0)
|
|
140
|
+
return false;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
26
143
|
export class DefaultArtificerValidator {
|
|
27
144
|
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
28
145
|
async validate(output, taskId, expectedSourceScribeArtifactId) {
|
|
@@ -104,6 +221,36 @@ export class DefaultArtificerValidator {
|
|
|
104
221
|
if (!Object.hasOwn(rec, 'generatedAt') || typeof rec.generatedAt !== 'string' || rec.generatedAt.trim() === '') {
|
|
105
222
|
errors.push('generatedAt must be non-empty string');
|
|
106
223
|
}
|
|
224
|
+
// ── V2 fields (optional; present when ArtificerL2Adapter produces code) ──
|
|
225
|
+
// V1 backward compatibility: absence of code fields is valid (existing path).
|
|
226
|
+
// When ANY V2 field is present, ALL must be present and well-formed (fail loud,
|
|
227
|
+
// ERR-009/010). Detection via Object.hasOwn (ERR-013), never `in`.
|
|
228
|
+
const hasCode = Object.hasOwn(rec, 'implementationCode');
|
|
229
|
+
const hasCases = Object.hasOwn(rec, 'goldenTraceCases');
|
|
230
|
+
const hasTools = Object.hasOwn(rec, 'affectedTools');
|
|
231
|
+
if (hasCode || hasCases || hasTools) {
|
|
232
|
+
// All three must be present together — partial V2 is malformed.
|
|
233
|
+
if (!hasCode)
|
|
234
|
+
errors.push('implementationCode is required when goldenTraceCases or affectedTools are present (V2 output)');
|
|
235
|
+
if (!hasCases)
|
|
236
|
+
errors.push('goldenTraceCases is required when implementationCode or affectedTools are present (V2 output)');
|
|
237
|
+
if (!hasTools)
|
|
238
|
+
errors.push('affectedTools is required when implementationCode or goldenTraceCases are present (V2 output)');
|
|
239
|
+
if (hasCode) {
|
|
240
|
+
const code = rec.implementationCode;
|
|
241
|
+
if (typeof code !== 'string' || code.trim() === '') {
|
|
242
|
+
errors.push('implementationCode must be a non-empty string');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (hasCases) {
|
|
246
|
+
const casesErr = validateGoldenTraceCasesInput(rec.goldenTraceCases);
|
|
247
|
+
errors.push(...casesErr);
|
|
248
|
+
}
|
|
249
|
+
if (hasTools) {
|
|
250
|
+
const toolsErr = validateAffectedTools(rec.affectedTools);
|
|
251
|
+
errors.push(...toolsErr);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
107
254
|
return errors.length > 0
|
|
108
255
|
? { valid: false, errors, errorCategory: 'output_invalid' }
|
|
109
256
|
: { valid: true, errors: [] };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artificer-output.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AA0BtD,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3D,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACtC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAC5C,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAClC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACvC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,C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YAC3B,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC;YACtB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE;YAC3D,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -3,6 +3,12 @@ export interface ArtificerPromptBuilderInput {
|
|
|
3
3
|
contextHash: string;
|
|
4
4
|
sourceScribeArtifactId: string;
|
|
5
5
|
scribeArtifact: unknown;
|
|
6
|
+
/**
|
|
7
|
+
* Prior adversarial replay failures to address (RuleHost MVP, PRI-428).
|
|
8
|
+
* Present only on Round-2+ retries inside runAdversarialLoop. When absent,
|
|
9
|
+
* the prompt is the initial generation prompt (backward compatible).
|
|
10
|
+
*/
|
|
11
|
+
adversarialFeedback?: string;
|
|
6
12
|
}
|
|
7
13
|
export interface ArtificerPromptInput {
|
|
8
14
|
taskId: string;
|
|
@@ -11,13 +17,15 @@ export interface ArtificerPromptInput {
|
|
|
11
17
|
scribeArtifact: unknown;
|
|
12
18
|
artificerInstruction: string;
|
|
13
19
|
promptContractVersion: string;
|
|
20
|
+
/** Present only when this is a retry with prior adversarial failures. */
|
|
21
|
+
adversarialFeedback?: string;
|
|
14
22
|
}
|
|
15
23
|
export interface ArtificerPromptBuildResult {
|
|
16
24
|
readonly message: string;
|
|
17
25
|
readonly promptInput: ArtificerPromptInput;
|
|
18
26
|
}
|
|
19
|
-
export declare const ARTIFICER_PROTOCOL_INSTRUCTION = "You are an Artificer agent in a principle internalization pipeline. Your role is to transform the Scribe's formal principle draft into an implementation-oriented plan with concrete changes, tests, and rollout notes.\n\nPROTOCOL:\n1. Review the scribeArtifact to understand the formal principle draft\n2. Transform the principle draft into an implementation plan
|
|
20
|
-
export declare const ARTIFICER_PROMPT_CONTRACT_VERSION = "artificer-output-
|
|
27
|
+
export declare const ARTIFICER_PROTOCOL_INSTRUCTION = "You are an Artificer agent in a principle internalization pipeline. Your role is to transform the Scribe's formal principle draft into an implementation-oriented plan with concrete changes, tests, and rollout notes.\n\nPROTOCOL:\n1. Review the scribeArtifact to understand the formal principle draft\n2. Transform the principle draft into an implementation plan and executable RuleHost code\n3. Preserve the lineage trace from scribe, philosopher, and dreamer artifacts\n4. Identify risks associated with implementing this principle\n5. The implementation plan should be concrete enough to guide code changes, not just philosophical\n\nOUTPUT FORMAT (pure JSON, no markdown):\n{\n \"taskId\": \"<from input>\",\n \"sourceScribeArtifactId\": \"<copy exactly from input.sourceScribeArtifactId>\",\n \"implementationPlan\": {\n \"summary\": \"<concise summary of the implementation approach>\",\n \"targetSurface\": \"<specific code/module/surface area to modify>\",\n \"changes\": [\"<specific change 1>\", \"<specific change 2>\"],\n \"tests\": [\"<test requirement 1>\", \"<test requirement 2>\"],\n \"rolloutNotes\": [\"<rollout consideration 1>\", \"<rollout consideration 2>\"],\n \"confidence\": 0.8\n },\n \"sourceTrace\": {\n \"scribeArtifactId\": \"<copy exactly from input.sourceScribeArtifactId>\",\n \"philosopherArtifactId\": \"<from scribe artifact if available, or omit>\",\n \"dreamerArtifactId\": \"<from scribe artifact if available, or omit>\"\n },\n \"risks\": [\"<risk 1>\", \"<risk 2>\"],\n \"implementationCode\": \"function evaluate(input, helpers) { ... }\",\n \"goldenTraceCases\": [\n {\"caseId\":\"negative-1\",\"kind\":\"negative\",\"toolName\":\"write_file\",\"params\":{\"path\":\"/system/file\"},\"expectedDecision\":\"block\"},\n {\"caseId\":\"positive-1\",\"kind\":\"positive\",\"toolName\":\"write_file\",\"params\":{\"path\":\"/workspace/file\"},\"expectedDecision\":\"allow\"}\n ],\n \"affectedTools\": [\"write_file\"],\n \"generatedAt\": \"<ISO-8601 timestamp>\"\n}\n\nCONSTRAINTS:\n- Output ONLY valid JSON (no markdown, no explanatory text, no code fences)\n- implementationPlan.summary MUST be a non-empty string\n- implementationPlan.targetSurface MUST be a non-empty string\n- implementationPlan.changes MUST be an array of strings\n- implementationPlan.tests MUST be an array of strings\n- implementationPlan.rolloutNotes MUST be an array of strings\n- implementationPlan.confidence MUST be a number between 0.0 and 1.0 (NOT a string, NOT a percentage)\n- sourceScribeArtifactId MUST be copied exactly from input.sourceScribeArtifactId (non-empty string)\n- sourceTrace.scribeArtifactId MUST be copied exactly from input.sourceScribeArtifactId\n- sourceTrace.philosopherArtifactId is optional \u2014 include only if available from scribe artifact\n- sourceTrace.dreamerArtifactId is optional \u2014 include only if available from scribe artifact\n- risks MUST be an array of strings (can be empty if no risks identified)\n- generatedAt MUST be the current ISO-8601 timestamp (use the actual current time, NOT a placeholder)\n- implementationCode MUST define exactly function evaluate(input, helpers) and return { decision, matched, reason }\n- input.action contains toolName, normalizedPath, and paramsSummary; inspect only these RuleHost inputs\n- implementationCode MUST be deterministic and self-contained: no imports, require, eval, Function, I/O, network, timers, Date.now, or randomness\n- goldenTraceCases MUST contain 2-10 cases with at least one positive allow case and one negative block/propose_correction case\n- propose_correction cases MUST include expectedProposedParams and expectedApplicationMode (shadow or live)\n- affectedTools MUST contain the non-empty tool names the rule can match\n\nPRIOR ADVERSARIAL FAILURES (when `adversarialFeedback` is present):\n- This is a RETRY. A prior version of your generated code was reviewed and failed adversarial sandbox replay.\n- The `adversarialFeedback` field lists the specific cases that failed, each with the attack type, the expected vs actual decision, and a rationale.\n- You MUST address each listed failure specifically \u2014 do not regenerate blind. Adjust the matcher/logic so the failed cases produce the expected decision while preserving the cases that previously passed.\n";
|
|
28
|
+
export declare const ARTIFICER_PROMPT_CONTRACT_VERSION = "artificer-output-v2.prompt.v1";
|
|
21
29
|
export declare class ArtificerPromptBuilder {
|
|
22
30
|
buildPrompt(input: ArtificerPromptBuilderInput): ArtificerPromptBuildResult;
|
|
23
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artificer-prompt-builder.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-prompt-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"artificer-prompt-builder.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/artificer-prompt-builder.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;CAC5C;AAED,eAAO,MAAM,8BAA8B,svIA6D1C,CAAC;AAEF,eAAO,MAAM,iCAAiC,kCAAkC,CAAC;AAEjF,qBAAa,sBAAsB;IAEjC,WAAW,CAAC,KAAK,EAAE,2BAA2B,GAAG,0BAA0B;CAmB5E"}
|