@principles/core 1.161.0 → 1.162.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.
Files changed (102) hide show
  1. package/dist/runtime-v2/__tests__/adversarial-loop.test.js +24 -78
  2. package/dist/runtime-v2/__tests__/adversarial-loop.test.js.map +1 -1
  3. package/dist/runtime-v2/__tests__/architecture-regression.test.js +8 -5
  4. package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  5. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js +32 -80
  6. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js.map +1 -1
  7. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js +2 -2
  8. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js.map +1 -1
  9. package/dist/runtime-v2/__tests__/principle-compiler-core.test.js +7 -7
  10. package/dist/runtime-v2/__tests__/principle-compiler-core.test.js.map +1 -1
  11. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.js +24 -1
  12. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.js.map +1 -1
  13. package/dist/runtime-v2/activation/production-gate-deps.d.ts.map +1 -1
  14. package/dist/runtime-v2/activation/production-gate-deps.js +18 -1
  15. package/dist/runtime-v2/activation/production-gate-deps.js.map +1 -1
  16. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js +277 -475
  17. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js.map +1 -1
  18. package/dist/runtime-v2/adapter/artificer-l2-adapter.d.ts +14 -34
  19. package/dist/runtime-v2/adapter/artificer-l2-adapter.d.ts.map +1 -1
  20. package/dist/runtime-v2/adapter/artificer-l2-adapter.js +182 -222
  21. package/dist/runtime-v2/adapter/artificer-l2-adapter.js.map +1 -1
  22. package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +2 -2
  23. package/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
  24. package/dist/runtime-v2/adversarial-loop.d.ts.map +1 -1
  25. package/dist/runtime-v2/adversarial-loop.js +5 -27
  26. package/dist/runtime-v2/adversarial-loop.js.map +1 -1
  27. package/dist/runtime-v2/golden-trace-replay-validator.d.ts +8 -0
  28. package/dist/runtime-v2/golden-trace-replay-validator.d.ts.map +1 -1
  29. package/dist/runtime-v2/golden-trace-replay-validator.js +3 -3
  30. package/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
  31. package/dist/runtime-v2/golden-trace.d.ts +16 -1
  32. package/dist/runtime-v2/golden-trace.d.ts.map +1 -1
  33. package/dist/runtime-v2/golden-trace.js +13 -4
  34. package/dist/runtime-v2/golden-trace.js.map +1 -1
  35. package/dist/runtime-v2/index.d.ts +8 -5
  36. package/dist/runtime-v2/index.d.ts.map +1 -1
  37. package/dist/runtime-v2/index.js +11 -4
  38. package/dist/runtime-v2/index.js.map +1 -1
  39. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts +2 -0
  40. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts.map +1 -0
  41. package/dist/runtime-v2/internalization/__tests__/{artificer-output-v2.test.js → artificer-rule-output.test.js} +126 -127
  42. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -0
  43. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts +2 -0
  44. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts.map +1 -0
  45. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js +270 -0
  46. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js.map +1 -0
  47. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts +2 -0
  48. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts.map +1 -0
  49. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js +180 -0
  50. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js.map +1 -0
  51. package/dist/runtime-v2/internalization/artificer-output.d.ts +33 -51
  52. package/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
  53. package/dist/runtime-v2/internalization/artificer-output.js +48 -87
  54. package/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
  55. package/dist/runtime-v2/internalization/artificer-runner.d.ts +8 -8
  56. package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
  57. package/dist/runtime-v2/internalization/artificer-runner.js +5 -5
  58. package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
  59. package/dist/runtime-v2/internalization/evaluator-runner.js +2 -2
  60. package/dist/runtime-v2/internalization/index.d.ts +9 -4
  61. package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
  62. package/dist/runtime-v2/internalization/index.js +8 -3
  63. package/dist/runtime-v2/internalization/index.js.map +1 -1
  64. package/dist/runtime-v2/internalization/rule-code-validator.d.ts +16 -0
  65. package/dist/runtime-v2/internalization/rule-code-validator.d.ts.map +1 -1
  66. package/dist/runtime-v2/internalization/rule-code-validator.js +50 -1
  67. package/dist/runtime-v2/internalization/rule-code-validator.js.map +1 -1
  68. package/dist/runtime-v2/internalization/rule-host-input-builder.d.ts +62 -0
  69. package/dist/runtime-v2/internalization/rule-host-input-builder.d.ts.map +1 -0
  70. package/dist/runtime-v2/internalization/rule-host-input-builder.js +182 -0
  71. package/dist/runtime-v2/internalization/rule-host-input-builder.js.map +1 -0
  72. package/dist/runtime-v2/internalization/rule-host-validator.d.ts.map +1 -1
  73. package/dist/runtime-v2/internalization/rule-host-validator.js +22 -1
  74. package/dist/runtime-v2/internalization/rule-host-validator.js.map +1 -1
  75. package/dist/runtime-v2/internalization/template-generator.d.ts +7 -2
  76. package/dist/runtime-v2/internalization/template-generator.d.ts.map +1 -1
  77. package/dist/runtime-v2/internalization/template-generator.js +10 -5
  78. package/dist/runtime-v2/internalization/template-generator.js.map +1 -1
  79. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts +2 -0
  80. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts.map +1 -0
  81. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +322 -0
  82. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -0
  83. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts +2 -0
  84. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts.map +1 -0
  85. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js +149 -0
  86. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js.map +1 -0
  87. package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts +72 -0
  88. package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -0
  89. package/dist/runtime-v2/tools/artificer-l2-tool-contract.js +275 -0
  90. package/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -0
  91. package/dist/runtime-v2/tools/artificer-output-typebox.d.ts +78 -0
  92. package/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -0
  93. package/dist/runtime-v2/tools/artificer-output-typebox.js +70 -0
  94. package/dist/runtime-v2/tools/artificer-output-typebox.js.map +1 -0
  95. package/dist/telemetry-event.d.ts +2 -2
  96. package/dist/telemetry-event.d.ts.map +1 -1
  97. package/dist/telemetry-event.js +5 -3
  98. package/dist/telemetry-event.js.map +1 -1
  99. package/package.json +1 -1
  100. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts +0 -2
  101. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts.map +0 -1
  102. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.js.map +0 -1
@@ -0,0 +1,275 @@
1
+ import { Type } from 'typebox';
2
+ import { ArtificerRuleOutputTypebox, GoldenTraceCaseInputTypebox } from './artificer-output-typebox.js';
3
+ import { checkForbiddenPatterns, checkReturnStatementsMissingFields, checkMatchedFalseDecisions } from '../internalization/rule-code-validator.js';
4
+ import { evaluateRefinerRuleHostGate } from '../internalization/refiner-rulehost-gate.js';
5
+ import { buildGoldenTraceFromArtificer } from '../golden-trace.js';
6
+ // ── Tool parameter schemas (typebox) ─────────────────────────────────────────
7
+ const readRulecodeSpecSchema = Type.Object({});
8
+ const validateRulecodeSchema = Type.Object({
9
+ code: Type.String({ description: 'The rule implementation source code to validate statically.' }),
10
+ });
11
+ const replayRulecodeSchema = Type.Object({
12
+ code: Type.String({ description: 'The rule implementation source code to replay.' }),
13
+ goldenTraceCases: Type.Array(GoldenTraceCaseInputTypebox, {
14
+ minItems: 2,
15
+ maxItems: 10,
16
+ description: 'Golden trace cases to replay against. At least 1 positive + 1 negative.',
17
+ }),
18
+ });
19
+ // submit_rulecode parameter schema = ArtificerRuleOutputTypebox (re-exported for clarity).
20
+ export { ArtificerRuleOutputTypebox as SubmitRulecodeSchema };
21
+ // ── Spec text (read_rulecode_spec return value) ──────────────────────────────
22
+ /**
23
+ * The RuleCode dialect spec returned by read_rulecode_spec. Pure text so the
24
+ * model can reference it during the loop. Mirrors the constraints in
25
+ * ARTIFICER_PROTOCOL_INSTRUCTION + checkForbiddenPatterns + the matched=false
26
+ * decision rule.
27
+ *
28
+ * Exported so the `pd rulecode spec` CLI command (PRI-439 Phase 5) can return
29
+ * the same canonical text the Artificer L2 agent sees — single source of truth.
30
+ */
31
+ export const RULECODE_SPEC_TEXT = [
32
+ '=== RuleCode Dialect Spec (PRI-439) ===',
33
+ '',
34
+ 'CANONICAL FORM:',
35
+ ' function evaluate(input, helpers) {',
36
+ ' // ... matcher logic ...',
37
+ ' return { decision: "allow"|"block"|"requireApproval"|"auto_correct", matched: <boolean>, reason: "<string>" };',
38
+ ' }',
39
+ '',
40
+ ' - Bare function (NO `export` keyword — export is forbidden).',
41
+ ' - Synchronous only (NO `async` / `await`).',
42
+ ' - The function MUST be named `evaluate` and take exactly (input, helpers).',
43
+ '',
44
+ 'RETURN SHAPE (every return statement must include all three required fields):',
45
+ ' - decision: "allow" | "block" | "requireApproval" | "auto_correct"',
46
+ ' - matched: boolean (true if the rule applied to this input)',
47
+ ' - reason: non-empty string',
48
+ ' - correctionProposal?: required when decision === "auto_correct"',
49
+ '',
50
+ 'MATCHED=FALSE RULE:',
51
+ ' When matched === false, decision MUST be "allow". A "block" or "requireApproval"',
52
+ ' with matched=false is contradictory and will be rejected.',
53
+ '',
54
+ 'FORBIDDEN PATTERNS (static check rejects these):',
55
+ ' require, import, export, async, await, fetch, eval, Function, process,',
56
+ ' globalThis, global, Reflect, Proxy, constructor, Buffer,',
57
+ ' setTimeout, setInterval, setImmediate, queueMicrotask,',
58
+ ' XMLHttpRequest, Math.random, crypto',
59
+ ' (also forbidden: bracket access like globalThis["require"])',
60
+ '',
61
+ 'INPUT SHAPE (input.action is the only safe surface to inspect):',
62
+ ' input.action.toolName : string',
63
+ ' input.action.normalizedPath: string | null (posix-relative when available)',
64
+ ' input.action.paramsSummary : Record<string, unknown>',
65
+ ' input.workspace.isRiskPath : boolean',
66
+ ' input.workspace.planStatus : "NONE"|"DRAFT"|"READY"|"UNKNOWN"',
67
+ ' input.workspace.hasPlanFile: boolean',
68
+ ' input.derived.estimatedLineChanges: number',
69
+ ' input.derived.bashRisk : "safe"|"normal"|"dangerous"|"unknown"',
70
+ '',
71
+ 'HELPERS (second argument):',
72
+ ' helpers.isRiskPath() : boolean',
73
+ ' helpers.getToolName() : string',
74
+ ' helpers.getEstimatedLineChanges() : number',
75
+ ' helpers.getBashRisk() : "safe"|"normal"|"dangerous"|"unknown"',
76
+ ' helpers.hasPlanFile() : boolean',
77
+ ' helpers.getPlanStatus() : "NONE"|"DRAFT"|"READY"|"UNKNOWN"',
78
+ ' helpers.getEpTier() : number',
79
+ '',
80
+ 'GOLDEN TRACE CASES (2-10 cases, at least 1 positive + 1 negative):',
81
+ ' - positive case: expectedDecision must be "allow"',
82
+ ' - negative case: expectedDecision is "block" or "propose_correction"',
83
+ ' - propose_correction cases MUST include expectedProposedParams + expectedApplicationMode',
84
+ '',
85
+ 'WORKFLOW:',
86
+ ' 1. Call read_rulecode_spec once (or as needed) to ground your output.',
87
+ ' 2. Call validate_rulecode with your draft code to catch static errors.',
88
+ ' 3. Call replay_rulecode with your code + goldenTraceCases to verify sandbox replay.',
89
+ ' 4. Call submit_rulecode with the full ArtificerRuleOutput once replay passes.',
90
+ '',
91
+ ].join('\n');
92
+ // ── Tool factory ──────────────────────────────────────────────────────────────
93
+ /**
94
+ * Build the Artificer L2 tool set bound to an injected context.
95
+ *
96
+ * Returns AgentTool[] suitable for assignment to AgentContext.tools. Tools are
97
+ * read-only by construction (validate/replay do not mutate state; submit writes
98
+ * only into the adapter-owned outputCapture).
99
+ */
100
+ export function buildArtificerL2Tools(ctx) {
101
+ const readRulecodeSpecTool = {
102
+ label: 'Read RuleCode spec',
103
+ name: 'read_rulecode_spec',
104
+ description: 'Read the RuleCode dialect spec: canonical form, forbidden patterns, return shape, input/helpers shape, golden trace rules. Call this BEFORE writing code so your output conforms to the contract.',
105
+ parameters: readRulecodeSpecSchema,
106
+ execute: async () => {
107
+ try {
108
+ ctx.onToolExecution?.({ toolName: 'read_rulecode_spec', ok: true });
109
+ return {
110
+ content: [{ type: 'text', text: RULECODE_SPEC_TEXT }],
111
+ details: undefined,
112
+ };
113
+ }
114
+ catch (err) {
115
+ const error = err instanceof Error ? err.message : String(err);
116
+ ctx.onToolExecution?.({ toolName: 'read_rulecode_spec', ok: false, error });
117
+ return {
118
+ content: [{ type: 'text', text: `read_rulecode_spec failed: ${error}` }],
119
+ details: undefined,
120
+ };
121
+ }
122
+ },
123
+ };
124
+ const validateRulecodeTool = {
125
+ label: 'Validate RuleCode (static)',
126
+ name: 'validate_rulecode',
127
+ description: 'Run STATIC validation on a rule implementation code string. Checks forbidden patterns, return-statement missing fields, and matched=false decision consistency. Does NOT execute the code. Returns VALID or INVALID with specific violations. Call this before replay_rulecode to catch cheap errors early.',
128
+ parameters: validateRulecodeSchema,
129
+ execute: async (_id, params) => {
130
+ try {
131
+ const { code } = params;
132
+ const forbidden = checkForbiddenPatterns(code);
133
+ const missingFields = checkReturnStatementsMissingFields(code);
134
+ const matchedFalseViolations = checkMatchedFalseDecisions(code);
135
+ const allViolations = [
136
+ ...forbidden.map((label) => `forbidden pattern: ${label}`),
137
+ ...missingFields,
138
+ ...matchedFalseViolations,
139
+ ];
140
+ ctx.onToolExecution?.({ toolName: 'validate_rulecode', ok: true });
141
+ if (allViolations.length === 0) {
142
+ return {
143
+ content: [{ type: 'text', text: 'VALID: no static violations detected. Proceed to replay_rulecode to verify runtime behavior.' }],
144
+ details: undefined,
145
+ };
146
+ }
147
+ return {
148
+ content: [{
149
+ type: 'text',
150
+ text: `INVALID: ${allViolations.length} violation(s) found:\n${allViolations.map((v) => ` - ${v}`).join('\n')}`,
151
+ }],
152
+ details: undefined,
153
+ };
154
+ }
155
+ catch (err) {
156
+ const error = err instanceof Error ? err.message : String(err);
157
+ ctx.onToolExecution?.({ toolName: 'validate_rulecode', ok: false, error });
158
+ return {
159
+ content: [{ type: 'text', text: `validate_rulecode failed: ${error}` }],
160
+ details: undefined,
161
+ };
162
+ }
163
+ },
164
+ };
165
+ const replayRulecodeTool = {
166
+ label: 'Replay RuleCode (sandbox)',
167
+ name: 'replay_rulecode',
168
+ description: 'Run SANDBOX replay of rule code against a golden trace. Executes the code in a constrained VM and verifies each case produces the expected decision. Returns PASSED or FAILED with per-case results. Call this after validate_rulecode passes.',
169
+ parameters: replayRulecodeSchema,
170
+ execute: async (_id, params) => {
171
+ try {
172
+ const { code, goldenTraceCases } = params;
173
+ // Build the GoldenTrace from the artificer-input shape.
174
+ const traceResult = buildGoldenTraceFromArtificer({
175
+ cases: goldenTraceCases,
176
+ sourceArtifactId: undefined,
177
+ });
178
+ if (!traceResult.ok) {
179
+ ctx.onToolExecution?.({ toolName: 'replay_rulecode', ok: false, error: traceResult.reason });
180
+ return {
181
+ content: [{ type: 'text', text: `FAILED: golden trace build failed — ${traceResult.reason}` }],
182
+ details: undefined,
183
+ };
184
+ }
185
+ // Run the sandbox replay via the injected gate deps.
186
+ const gateResult = evaluateRefinerRuleHostGate({ code, goldenTrace: traceResult.trace }, ctx.gateDeps);
187
+ ctx.onToolExecution?.({ toolName: 'replay_rulecode', ok: gateResult.decision === 'accepted_shadow' });
188
+ if (gateResult.decision === 'accepted_shadow') {
189
+ return {
190
+ content: [{ type: 'text', text: 'PASSED: all golden trace cases replayed successfully. You may now call submit_rulecode.' }],
191
+ details: undefined,
192
+ };
193
+ }
194
+ // Format the failure details for the model.
195
+ const { sandboxResult } = gateResult;
196
+ const failedCaseLines = sandboxResult.failedCases.length > 0
197
+ ? sandboxResult.failedCases.map((c) => ` - caseId: ${c.caseId} | errorType: ${c.errorType} | message: ${c.message}`)
198
+ : [];
199
+ const forbiddenLines = sandboxResult.forbiddenPatternViolations.length > 0
200
+ ? sandboxResult.forbiddenPatternViolations.map((p) => ` - forbidden pattern: ${p}`)
201
+ : [];
202
+ const lines = [
203
+ `FAILED: ${gateResult.decision}`,
204
+ ...gateResult.reasons.map((r) => ` - ${r}`),
205
+ ...failedCaseLines,
206
+ ...forbiddenLines,
207
+ ].join('\n');
208
+ return {
209
+ content: [{ type: 'text', text: lines }],
210
+ details: undefined,
211
+ };
212
+ }
213
+ catch (err) {
214
+ const error = err instanceof Error ? err.message : String(err);
215
+ ctx.onToolExecution?.({ toolName: 'replay_rulecode', ok: false, error });
216
+ return {
217
+ content: [{ type: 'text', text: `replay_rulecode failed: ${error}` }],
218
+ details: undefined,
219
+ };
220
+ }
221
+ },
222
+ };
223
+ const submitRulecodeTool = {
224
+ label: 'Submit RuleCode',
225
+ name: 'submit_rulecode',
226
+ description: 'Submit your final ArtificerRuleOutput. You MUST call this exactly once with a complete object (taskId, sourceScribeArtifactId, implementationCode, goldenTraceCases, affectedTools, implementationSummary, risks, sourceTrace, generatedAt). The loop stops after you call this. Do not emit the answer as free text — call this tool.',
227
+ parameters: ArtificerRuleOutputTypebox,
228
+ execute: async (_id, params) => {
229
+ try {
230
+ // Runtime-validate the submission against the authoritative validator
231
+ // (Runtime Contract Rule 1/2 — never trust the typebox-validated shape
232
+ // blindly; the DefaultArtificerValidator performs field-by-field checks
233
+ // including lineage consistency).
234
+ const validation = await ctx.validator.validate(params, ctx.taskId);
235
+ if (!validation.valid) {
236
+ ctx.onToolExecution?.({ toolName: 'submit_rulecode', ok: false, error: validation.errors.join('; ') });
237
+ return {
238
+ content: [{
239
+ type: 'text',
240
+ text: `REJECTED: ArtificerValidator found ${validation.errors.length} error(s):\n${validation.errors.map((e) => ` - ${e}`).join('\n')}\n\nFix the issues and call submit_rulecode again.`,
241
+ }],
242
+ details: undefined,
243
+ };
244
+ }
245
+ // Store the captured output. The adapter's shouldStopAfterTurn detects
246
+ // this and terminates the loop; terminate:true is a secondary hint only
247
+ // (unreliable across a multi-tool batch — see l2-agent-loop-adapter.ts).
248
+ ctx.outputCapture.output = params;
249
+ ctx.onToolExecution?.({ toolName: 'submit_rulecode', ok: true });
250
+ return {
251
+ content: [{ type: 'text', text: 'Output submitted.' }],
252
+ details: undefined,
253
+ terminate: true,
254
+ };
255
+ }
256
+ catch (err) {
257
+ const error = err instanceof Error ? err.message : String(err);
258
+ ctx.onToolExecution?.({ toolName: 'submit_rulecode', ok: false, error });
259
+ return {
260
+ content: [{ type: 'text', text: `submit_rulecode failed: ${error}` }],
261
+ details: undefined,
262
+ };
263
+ }
264
+ },
265
+ };
266
+ return [readRulecodeSpecTool, validateRulecodeTool, replayRulecodeTool, submitRulecodeTool];
267
+ }
268
+ /** Allow-list of tool names the Artificer L2 loop may execute (defense-in-depth for beforeToolCall). */
269
+ export const ARTIFICER_L2_TOOL_WHITELIST = new Set([
270
+ 'read_rulecode_spec',
271
+ 'validate_rulecode',
272
+ 'replay_rulecode',
273
+ 'submit_rulecode',
274
+ ]);
275
+ //# sourceMappingURL=artificer-l2-tool-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artificer-l2-tool-contract.js","sourceRoot":"","sources":["../../../src/runtime-v2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,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC/D,GAAG,CAAC,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;gBACzE,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,KAAK,EAAE,EAAE,CAAC;oBACrE,OAAO,EAAE,SAAS;iBACnB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,CAAC,oBAAoB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAC9F,CAAC;AAED,wGAAwG;AACxG,MAAM,CAAC,MAAM,2BAA2B,GAAwB,IAAI,GAAG,CAAC;IACtE,oBAAoB;IACpB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * PRI-439 — typebox redeclaration of ArtificerRuleOutput for the L2 agent loop.
3
+ *
4
+ * Why this file exists (mirrors dreamer-output-typebox.ts):
5
+ * pi-agent-core's `AgentTool<TParameters extends TSchema>` requires a schema built
6
+ * with the `typebox` package (the earendil fork), NOT PD's usual `@sinclair/typebox`.
7
+ * The two packages are nominally incompatible TS types and PD's Runtime Contract
8
+ * forbids `as` to bridge them. The `submit_rulecode` tool's parameter schema must
9
+ * therefore be declared with `typebox` directly.
10
+ *
11
+ * This file redeclares the ArtificerRuleOutput shape with `typebox`, structured so
12
+ * the `submit_rulecode` tool can require the model to return a complete
13
+ * implementationCode + goldenTraceCases payload. The authoritative runtime
14
+ * validator remains `DefaultArtificerValidator` (which validates `unknown`
15
+ * field-by-field) — the schema here is the LLM-facing tool contract only.
16
+ *
17
+ * Consistency guarantee:
18
+ * `artificer-output-typebox.test.ts` proves that for a shared sample set (valid +
19
+ * invalid candidates), this typebox schema's structural requirements match the
20
+ * @sinclair/typebox `ArtificerRuleOutputSchema` requirements. No `as`, no cast —
21
+ * the proof is behavioural (both reject the same invalid shapes).
22
+ *
23
+ * Boundary: pure data, zero I/O. Lives in core. No `node:*` imports.
24
+ */
25
+ import { Type } from 'typebox';
26
+ /**
27
+ * typebox redeclaration of GoldenTraceCaseInput (artificer-output.ts).
28
+ * Field-for-field equivalent — see artificer-output-typebox.test.ts for the proof.
29
+ */
30
+ export declare const GoldenTraceCaseInputTypebox: Type.TObject<{
31
+ caseId: Type.TString;
32
+ kind: Type.TUnion<[Type.TLiteral<"positive">, Type.TLiteral<"negative">]>;
33
+ toolName: Type.TString;
34
+ params: Type.TRecord<"^.*$", Type.TUnknown>;
35
+ expectedDecision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"block">, Type.TLiteral<"propose_correction">]>;
36
+ expectedProposedParams: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
37
+ expectedApplicationMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"shadow">, Type.TLiteral<"live">]>>;
38
+ }>;
39
+ /**
40
+ * typebox redeclaration of ArtificerSourceTrace (artificer-output.ts).
41
+ */
42
+ export declare const ArtificerSourceTraceTypebox: Type.TObject<{
43
+ scribeArtifactId: Type.TString;
44
+ philosopherArtifactId: Type.TOptional<Type.TString>;
45
+ dreamerArtifactId: Type.TOptional<Type.TString>;
46
+ }>;
47
+ /**
48
+ * typebox redeclaration of ArtificerRuleOutputSchema.
49
+ *
50
+ * Used as the parameter schema of the `submit_rulecode` tool in the L2 artificer
51
+ * loop. Field-for-field equivalent to the @sinclair/typebox
52
+ * ArtificerRuleOutputSchema — see artificer-output-typebox.test.ts for the
53
+ * consistency proof.
54
+ */
55
+ export declare const ArtificerRuleOutputTypebox: Type.TObject<{
56
+ taskId: Type.TString;
57
+ sourceScribeArtifactId: Type.TString;
58
+ implementationCode: Type.TString;
59
+ goldenTraceCases: Type.TArray<Type.TObject<{
60
+ caseId: Type.TString;
61
+ kind: Type.TUnion<[Type.TLiteral<"positive">, Type.TLiteral<"negative">]>;
62
+ toolName: Type.TString;
63
+ params: Type.TRecord<"^.*$", Type.TUnknown>;
64
+ expectedDecision: Type.TUnion<[Type.TLiteral<"allow">, Type.TLiteral<"block">, Type.TLiteral<"propose_correction">]>;
65
+ expectedProposedParams: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
66
+ expectedApplicationMode: Type.TOptional<Type.TUnion<[Type.TLiteral<"shadow">, Type.TLiteral<"live">]>>;
67
+ }>>;
68
+ affectedTools: Type.TArray<Type.TString>;
69
+ implementationSummary: Type.TString;
70
+ risks: Type.TArray<Type.TString>;
71
+ sourceTrace: Type.TObject<{
72
+ scribeArtifactId: Type.TString;
73
+ philosopherArtifactId: Type.TOptional<Type.TString>;
74
+ dreamerArtifactId: Type.TOptional<Type.TString>;
75
+ }>;
76
+ generatedAt: Type.TString;
77
+ }>;
78
+ //# sourceMappingURL=artificer-output-typebox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artificer-output-typebox.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/tools/artificer-output-typebox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;EAYtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;EAItC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;EAUrC,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * PRI-439 — typebox redeclaration of ArtificerRuleOutput for the L2 agent loop.
3
+ *
4
+ * Why this file exists (mirrors dreamer-output-typebox.ts):
5
+ * pi-agent-core's `AgentTool<TParameters extends TSchema>` requires a schema built
6
+ * with the `typebox` package (the earendil fork), NOT PD's usual `@sinclair/typebox`.
7
+ * The two packages are nominally incompatible TS types and PD's Runtime Contract
8
+ * forbids `as` to bridge them. The `submit_rulecode` tool's parameter schema must
9
+ * therefore be declared with `typebox` directly.
10
+ *
11
+ * This file redeclares the ArtificerRuleOutput shape with `typebox`, structured so
12
+ * the `submit_rulecode` tool can require the model to return a complete
13
+ * implementationCode + goldenTraceCases payload. The authoritative runtime
14
+ * validator remains `DefaultArtificerValidator` (which validates `unknown`
15
+ * field-by-field) — the schema here is the LLM-facing tool contract only.
16
+ *
17
+ * Consistency guarantee:
18
+ * `artificer-output-typebox.test.ts` proves that for a shared sample set (valid +
19
+ * invalid candidates), this typebox schema's structural requirements match the
20
+ * @sinclair/typebox `ArtificerRuleOutputSchema` requirements. No `as`, no cast —
21
+ * the proof is behavioural (both reject the same invalid shapes).
22
+ *
23
+ * Boundary: pure data, zero I/O. Lives in core. No `node:*` imports.
24
+ */
25
+ import { Type } from 'typebox';
26
+ /**
27
+ * typebox redeclaration of GoldenTraceCaseInput (artificer-output.ts).
28
+ * Field-for-field equivalent — see artificer-output-typebox.test.ts for the proof.
29
+ */
30
+ export const GoldenTraceCaseInputTypebox = Type.Object({
31
+ caseId: Type.String({ minLength: 1 }),
32
+ kind: Type.Union([Type.Literal('positive'), Type.Literal('negative')]),
33
+ toolName: Type.String({ minLength: 1 }),
34
+ params: Type.Record(Type.String(), Type.Unknown()),
35
+ expectedDecision: Type.Union([
36
+ Type.Literal('allow'),
37
+ Type.Literal('block'),
38
+ Type.Literal('propose_correction'),
39
+ ]),
40
+ expectedProposedParams: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
41
+ expectedApplicationMode: Type.Optional(Type.Union([Type.Literal('shadow'), Type.Literal('live')])),
42
+ });
43
+ /**
44
+ * typebox redeclaration of ArtificerSourceTrace (artificer-output.ts).
45
+ */
46
+ export const ArtificerSourceTraceTypebox = Type.Object({
47
+ scribeArtifactId: Type.String({ minLength: 1 }),
48
+ philosopherArtifactId: Type.Optional(Type.String({ minLength: 1 })),
49
+ dreamerArtifactId: Type.Optional(Type.String({ minLength: 1 })),
50
+ });
51
+ /**
52
+ * typebox redeclaration of ArtificerRuleOutputSchema.
53
+ *
54
+ * Used as the parameter schema of the `submit_rulecode` tool in the L2 artificer
55
+ * loop. Field-for-field equivalent to the @sinclair/typebox
56
+ * ArtificerRuleOutputSchema — see artificer-output-typebox.test.ts for the
57
+ * consistency proof.
58
+ */
59
+ export const ArtificerRuleOutputTypebox = Type.Object({
60
+ taskId: Type.String({ minLength: 1 }),
61
+ sourceScribeArtifactId: Type.String({ minLength: 1 }),
62
+ implementationCode: Type.String({ minLength: 1 }),
63
+ goldenTraceCases: Type.Array(GoldenTraceCaseInputTypebox, { minItems: 2, maxItems: 10 }),
64
+ affectedTools: Type.Array(Type.String({ minLength: 1 }), { minItems: 1 }),
65
+ implementationSummary: Type.String({ minLength: 1 }),
66
+ risks: Type.Array(Type.String()),
67
+ sourceTrace: ArtificerSourceTraceTypebox,
68
+ generatedAt: Type.String({ minLength: 1 }),
69
+ });
70
+ //# sourceMappingURL=artificer-output-typebox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artificer-output-typebox.js","sourceRoot":"","sources":["../../../src/runtime-v2/tools/artificer-output-typebox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IACtE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SA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MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACrD,kBAAkB,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,2BAA2B,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACxF,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzE,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IACpD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;CAC3C,CAAC,CAAC"}
@@ -56,7 +56,7 @@ import { type Static } from '@sinclair/typebox';
56
56
  * - output_schema_invalid — PRI-200 schema validation failed (before repair)
57
57
  * - output_repair_exhausted — PRI-200 repair loop exhausted, output still invalid
58
58
  */
59
- export declare const TelemetryEventType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pain_detected">, import("@sinclair/typebox").TLiteral<"principle_candidate_created">, import("@sinclair/typebox").TLiteral<"principle_promoted">, import("@sinclair/typebox").TLiteral<"lease_acquired">, import("@sinclair/typebox").TLiteral<"lease_released">, import("@sinclair/typebox").TLiteral<"lease_renewed">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"task_retried">, import("@sinclair/typebox").TLiteral<"task_failed">, import("@sinclair/typebox").TLiteral<"task_succeeded">, import("@sinclair/typebox").TLiteral<"run_started">, import("@sinclair/typebox").TLiteral<"run_completed">, import("@sinclair/typebox").TLiteral<"degradation_triggered">, import("@sinclair/typebox").TLiteral<"diagnostician_task_leased">, import("@sinclair/typebox").TLiteral<"diagnostician_context_built">, import("@sinclair/typebox").TLiteral<"diagnostician_run_started">, import("@sinclair/typebox").TLiteral<"diagnostician_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_output_invalid">, import("@sinclair/typebox").TLiteral<"diagnostician_task_succeeded">, import("@sinclair/typebox").TLiteral<"diagnostician_task_retried">, import("@sinclair/typebox").TLiteral<"diagnostician_task_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"diag_router_invariant_override">, import("@sinclair/typebox").TLiteral<"diagnostician_core_grounding_result">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_committed">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"principle_candidate_registered">, import("@sinclair/typebox").TLiteral<"runtime_adapter_selected">, import("@sinclair/typebox").TLiteral<"runtime_invocation_started">, import("@sinclair/typebox").TLiteral<"runtime_invocation_succeeded">, import("@sinclair/typebox").TLiteral<"runtime_invocation_failed">, import("@sinclair/typebox").TLiteral<"output_validation_succeeded">, import("@sinclair/typebox").TLiteral<"output_validation_failed">, import("@sinclair/typebox").TLiteral<"output_repair_attempted">, import("@sinclair/typebox").TLiteral<"output_extraction_failed">, import("@sinclair/typebox").TLiteral<"output_schema_invalid">, import("@sinclair/typebox").TLiteral<"output_repair_exhausted">, import("@sinclair/typebox").TLiteral<"output_path_chosen">, import("@sinclair/typebox").TLiteral<"output_path_fallback">, import("@sinclair/typebox").TLiteral<"dreamer_task_leased">, import("@sinclair/typebox").TLiteral<"dreamer_context_built">, import("@sinclair/typebox").TLiteral<"dreamer_run_started">, import("@sinclair/typebox").TLiteral<"dreamer_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_invalid">, import("@sinclair/typebox").TLiteral<"dreamer_output_validated">, import("@sinclair/typebox").TLiteral<"dreamer_task_succeeded">, import("@sinclair/typebox").TLiteral<"dreamer_task_retried">, import("@sinclair/typebox").TLiteral<"dreamer_task_failed">, import("@sinclair/typebox").TLiteral<"dreamer_candidate_generated">, import("@sinclair/typebox").TLiteral<"dreamer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"dreamer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"dreamer_update_output_failed">, import("@sinclair/typebox").TLiteral<"dreamer_context_partial">, import("@sinclair/typebox").TLiteral<"dreamer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"dreamer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"philosopher_task_leased">, import("@sinclair/typebox").TLiteral<"philosopher_context_built">, import("@sinclair/typebox").TLiteral<"philosopher_run_started">, import("@sinclair/typebox").TLiteral<"philosopher_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_output_invalid">, import("@sinclair/typebox").TLiteral<"philosopher_output_validated">, import("@sinclair/typebox").TLiteral<"philosopher_task_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_task_retried">, import("@sinclair/typebox").TLiteral<"philosopher_task_failed">, import("@sinclair/typebox").TLiteral<"philosopher_principle_candidate_generated">, import("@sinclair/typebox").TLiteral<"philosopher_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"philosopher_update_output_failed">, import("@sinclair/typebox").TLiteral<"philosopher_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_partial">, import("@sinclair/typebox").TLiteral<"philosopher_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"philosopher_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"philosopher_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_failed_error">, import("@sinclair/typebox").TLiteral<"philosopher_mark_retry_error">, import("@sinclair/typebox").TLiteral<"artificer_task_leased">, import("@sinclair/typebox").TLiteral<"artificer_context_built">, import("@sinclair/typebox").TLiteral<"artificer_run_started">, import("@sinclair/typebox").TLiteral<"artificer_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_output_invalid">, import("@sinclair/typebox").TLiteral<"artificer_output_validated">, import("@sinclair/typebox").TLiteral<"artificer_task_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_task_retried">, import("@sinclair/typebox").TLiteral<"artificer_task_failed">, import("@sinclair/typebox").TLiteral<"artificer_implementation_plan_generated">, import("@sinclair/typebox").TLiteral<"artificer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"artificer_update_output_failed">, import("@sinclair/typebox").TLiteral<"artificer_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"artificer_lineage_partial">, import("@sinclair/typebox").TLiteral<"artificer_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"artificer_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"artificer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"artificer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_task_leased">, import("@sinclair/typebox").TLiteral<"evaluator_context_built">, import("@sinclair/typebox").TLiteral<"evaluator_run_started">, import("@sinclair/typebox").TLiteral<"evaluator_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_output_invalid">, import("@sinclair/typebox").TLiteral<"evaluator_output_validated">, import("@sinclair/typebox").TLiteral<"evaluator_task_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_task_retried">, import("@sinclair/typebox").TLiteral<"evaluator_task_failed">, import("@sinclair/typebox").TLiteral<"evaluator_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"evaluator_update_output_failed">, import("@sinclair/typebox").TLiteral<"evaluator_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_partial">, import("@sinclair/typebox").TLiteral<"evaluator_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"evaluator_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"evaluator_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_failed_error">, import("@sinclair/typebox").TLiteral<"evaluator_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_decision_recorded">, import("@sinclair/typebox").TLiteral<"scribe_task_leased">, import("@sinclair/typebox").TLiteral<"scribe_context_built">, import("@sinclair/typebox").TLiteral<"scribe_run_started">, import("@sinclair/typebox").TLiteral<"scribe_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_output_invalid">, import("@sinclair/typebox").TLiteral<"scribe_output_validated">, import("@sinclair/typebox").TLiteral<"scribe_task_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_task_retried">, import("@sinclair/typebox").TLiteral<"scribe_task_failed">, import("@sinclair/typebox").TLiteral<"scribe_principle_draft_generated">, import("@sinclair/typebox").TLiteral<"scribe_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"scribe_update_output_failed">, import("@sinclair/typebox").TLiteral<"scribe_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"scribe_lineage_partial">, import("@sinclair/typebox").TLiteral<"scribe_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"scribe_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"scribe_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_failed_error">, import("@sinclair/typebox").TLiteral<"scribe_mark_retry_error">, import("@sinclair/typebox").TLiteral<"dreamer_l2_turn">, import("@sinclair/typebox").TLiteral<"dreamer_l2_complete">, import("@sinclair/typebox").TLiteral<"dreamer_l2_fallback_to_l1">, import("@sinclair/typebox").TLiteral<"artificer_l2_attempt">, import("@sinclair/typebox").TLiteral<"artificer_l2_complete">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay_skipped">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembled">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembly_failed">]>;
59
+ export declare const TelemetryEventType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pain_detected">, import("@sinclair/typebox").TLiteral<"principle_candidate_created">, import("@sinclair/typebox").TLiteral<"principle_promoted">, import("@sinclair/typebox").TLiteral<"lease_acquired">, import("@sinclair/typebox").TLiteral<"lease_released">, import("@sinclair/typebox").TLiteral<"lease_renewed">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"task_retried">, import("@sinclair/typebox").TLiteral<"task_failed">, import("@sinclair/typebox").TLiteral<"task_succeeded">, import("@sinclair/typebox").TLiteral<"run_started">, import("@sinclair/typebox").TLiteral<"run_completed">, import("@sinclair/typebox").TLiteral<"degradation_triggered">, import("@sinclair/typebox").TLiteral<"diagnostician_task_leased">, import("@sinclair/typebox").TLiteral<"diagnostician_context_built">, import("@sinclair/typebox").TLiteral<"diagnostician_run_started">, import("@sinclair/typebox").TLiteral<"diagnostician_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_output_invalid">, import("@sinclair/typebox").TLiteral<"diagnostician_task_succeeded">, import("@sinclair/typebox").TLiteral<"diagnostician_task_retried">, import("@sinclair/typebox").TLiteral<"diagnostician_task_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"diag_router_invariant_override">, import("@sinclair/typebox").TLiteral<"diagnostician_core_grounding_result">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_committed">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"principle_candidate_registered">, import("@sinclair/typebox").TLiteral<"runtime_adapter_selected">, import("@sinclair/typebox").TLiteral<"runtime_invocation_started">, import("@sinclair/typebox").TLiteral<"runtime_invocation_succeeded">, import("@sinclair/typebox").TLiteral<"runtime_invocation_failed">, import("@sinclair/typebox").TLiteral<"output_validation_succeeded">, import("@sinclair/typebox").TLiteral<"output_validation_failed">, import("@sinclair/typebox").TLiteral<"output_repair_attempted">, import("@sinclair/typebox").TLiteral<"output_extraction_failed">, import("@sinclair/typebox").TLiteral<"output_schema_invalid">, import("@sinclair/typebox").TLiteral<"output_repair_exhausted">, import("@sinclair/typebox").TLiteral<"output_path_chosen">, import("@sinclair/typebox").TLiteral<"output_path_fallback">, import("@sinclair/typebox").TLiteral<"dreamer_task_leased">, import("@sinclair/typebox").TLiteral<"dreamer_context_built">, import("@sinclair/typebox").TLiteral<"dreamer_run_started">, import("@sinclair/typebox").TLiteral<"dreamer_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_invalid">, import("@sinclair/typebox").TLiteral<"dreamer_output_validated">, import("@sinclair/typebox").TLiteral<"dreamer_task_succeeded">, import("@sinclair/typebox").TLiteral<"dreamer_task_retried">, import("@sinclair/typebox").TLiteral<"dreamer_task_failed">, import("@sinclair/typebox").TLiteral<"dreamer_candidate_generated">, import("@sinclair/typebox").TLiteral<"dreamer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"dreamer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"dreamer_update_output_failed">, import("@sinclair/typebox").TLiteral<"dreamer_context_partial">, import("@sinclair/typebox").TLiteral<"dreamer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"dreamer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"philosopher_task_leased">, import("@sinclair/typebox").TLiteral<"philosopher_context_built">, import("@sinclair/typebox").TLiteral<"philosopher_run_started">, import("@sinclair/typebox").TLiteral<"philosopher_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_output_invalid">, import("@sinclair/typebox").TLiteral<"philosopher_output_validated">, import("@sinclair/typebox").TLiteral<"philosopher_task_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_task_retried">, import("@sinclair/typebox").TLiteral<"philosopher_task_failed">, import("@sinclair/typebox").TLiteral<"philosopher_principle_candidate_generated">, import("@sinclair/typebox").TLiteral<"philosopher_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"philosopher_update_output_failed">, import("@sinclair/typebox").TLiteral<"philosopher_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_partial">, import("@sinclair/typebox").TLiteral<"philosopher_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"philosopher_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"philosopher_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_failed_error">, import("@sinclair/typebox").TLiteral<"philosopher_mark_retry_error">, import("@sinclair/typebox").TLiteral<"artificer_task_leased">, import("@sinclair/typebox").TLiteral<"artificer_context_built">, import("@sinclair/typebox").TLiteral<"artificer_run_started">, import("@sinclair/typebox").TLiteral<"artificer_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_output_invalid">, import("@sinclair/typebox").TLiteral<"artificer_output_validated">, import("@sinclair/typebox").TLiteral<"artificer_task_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_task_retried">, import("@sinclair/typebox").TLiteral<"artificer_task_failed">, import("@sinclair/typebox").TLiteral<"artificer_implementation_plan_generated">, import("@sinclair/typebox").TLiteral<"artificer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"artificer_update_output_failed">, import("@sinclair/typebox").TLiteral<"artificer_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"artificer_lineage_partial">, import("@sinclair/typebox").TLiteral<"artificer_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"artificer_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"artificer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"artificer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_task_leased">, import("@sinclair/typebox").TLiteral<"evaluator_context_built">, import("@sinclair/typebox").TLiteral<"evaluator_run_started">, import("@sinclair/typebox").TLiteral<"evaluator_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_output_invalid">, import("@sinclair/typebox").TLiteral<"evaluator_output_validated">, import("@sinclair/typebox").TLiteral<"evaluator_task_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_task_retried">, import("@sinclair/typebox").TLiteral<"evaluator_task_failed">, import("@sinclair/typebox").TLiteral<"evaluator_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"evaluator_update_output_failed">, import("@sinclair/typebox").TLiteral<"evaluator_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_partial">, import("@sinclair/typebox").TLiteral<"evaluator_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"evaluator_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"evaluator_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_failed_error">, import("@sinclair/typebox").TLiteral<"evaluator_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_decision_recorded">, import("@sinclair/typebox").TLiteral<"scribe_task_leased">, import("@sinclair/typebox").TLiteral<"scribe_context_built">, import("@sinclair/typebox").TLiteral<"scribe_run_started">, import("@sinclair/typebox").TLiteral<"scribe_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_output_invalid">, import("@sinclair/typebox").TLiteral<"scribe_output_validated">, import("@sinclair/typebox").TLiteral<"scribe_task_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_task_retried">, import("@sinclair/typebox").TLiteral<"scribe_task_failed">, import("@sinclair/typebox").TLiteral<"scribe_principle_draft_generated">, import("@sinclair/typebox").TLiteral<"scribe_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"scribe_update_output_failed">, import("@sinclair/typebox").TLiteral<"scribe_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"scribe_lineage_partial">, import("@sinclair/typebox").TLiteral<"scribe_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"scribe_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"scribe_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_failed_error">, import("@sinclair/typebox").TLiteral<"scribe_mark_retry_error">, import("@sinclair/typebox").TLiteral<"dreamer_l2_turn">, import("@sinclair/typebox").TLiteral<"dreamer_l2_complete">, import("@sinclair/typebox").TLiteral<"dreamer_l2_fallback_to_l1">, import("@sinclair/typebox").TLiteral<"artificer_l2_attempt">, import("@sinclair/typebox").TLiteral<"artificer_l2_turn">, import("@sinclair/typebox").TLiteral<"artificer_l2_complete">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay_skipped">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembled">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembly_failed">]>;
60
60
  export type TelemetryEventType = Static<typeof TelemetryEventType>;
61
61
  /**
62
62
  * Schema for an in-process telemetry event.
@@ -72,7 +72,7 @@ export type TelemetryEventType = Static<typeof TelemetryEventType>;
72
72
  */
73
73
  export declare const TelemetryEventSchema: import("@sinclair/typebox").TObject<{
74
74
  /** Event type (one of the 3 core types) */
75
- eventType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pain_detected">, import("@sinclair/typebox").TLiteral<"principle_candidate_created">, import("@sinclair/typebox").TLiteral<"principle_promoted">, import("@sinclair/typebox").TLiteral<"lease_acquired">, import("@sinclair/typebox").TLiteral<"lease_released">, import("@sinclair/typebox").TLiteral<"lease_renewed">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"task_retried">, import("@sinclair/typebox").TLiteral<"task_failed">, import("@sinclair/typebox").TLiteral<"task_succeeded">, import("@sinclair/typebox").TLiteral<"run_started">, import("@sinclair/typebox").TLiteral<"run_completed">, import("@sinclair/typebox").TLiteral<"degradation_triggered">, import("@sinclair/typebox").TLiteral<"diagnostician_task_leased">, import("@sinclair/typebox").TLiteral<"diagnostician_context_built">, import("@sinclair/typebox").TLiteral<"diagnostician_run_started">, import("@sinclair/typebox").TLiteral<"diagnostician_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_output_invalid">, import("@sinclair/typebox").TLiteral<"diagnostician_task_succeeded">, import("@sinclair/typebox").TLiteral<"diagnostician_task_retried">, import("@sinclair/typebox").TLiteral<"diagnostician_task_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"diag_router_invariant_override">, import("@sinclair/typebox").TLiteral<"diagnostician_core_grounding_result">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_committed">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"principle_candidate_registered">, import("@sinclair/typebox").TLiteral<"runtime_adapter_selected">, import("@sinclair/typebox").TLiteral<"runtime_invocation_started">, import("@sinclair/typebox").TLiteral<"runtime_invocation_succeeded">, import("@sinclair/typebox").TLiteral<"runtime_invocation_failed">, import("@sinclair/typebox").TLiteral<"output_validation_succeeded">, import("@sinclair/typebox").TLiteral<"output_validation_failed">, import("@sinclair/typebox").TLiteral<"output_repair_attempted">, import("@sinclair/typebox").TLiteral<"output_extraction_failed">, import("@sinclair/typebox").TLiteral<"output_schema_invalid">, import("@sinclair/typebox").TLiteral<"output_repair_exhausted">, import("@sinclair/typebox").TLiteral<"output_path_chosen">, import("@sinclair/typebox").TLiteral<"output_path_fallback">, import("@sinclair/typebox").TLiteral<"dreamer_task_leased">, import("@sinclair/typebox").TLiteral<"dreamer_context_built">, import("@sinclair/typebox").TLiteral<"dreamer_run_started">, import("@sinclair/typebox").TLiteral<"dreamer_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_invalid">, import("@sinclair/typebox").TLiteral<"dreamer_output_validated">, import("@sinclair/typebox").TLiteral<"dreamer_task_succeeded">, import("@sinclair/typebox").TLiteral<"dreamer_task_retried">, import("@sinclair/typebox").TLiteral<"dreamer_task_failed">, import("@sinclair/typebox").TLiteral<"dreamer_candidate_generated">, import("@sinclair/typebox").TLiteral<"dreamer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"dreamer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"dreamer_update_output_failed">, import("@sinclair/typebox").TLiteral<"dreamer_context_partial">, import("@sinclair/typebox").TLiteral<"dreamer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"dreamer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"philosopher_task_leased">, import("@sinclair/typebox").TLiteral<"philosopher_context_built">, import("@sinclair/typebox").TLiteral<"philosopher_run_started">, import("@sinclair/typebox").TLiteral<"philosopher_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_output_invalid">, import("@sinclair/typebox").TLiteral<"philosopher_output_validated">, import("@sinclair/typebox").TLiteral<"philosopher_task_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_task_retried">, import("@sinclair/typebox").TLiteral<"philosopher_task_failed">, import("@sinclair/typebox").TLiteral<"philosopher_principle_candidate_generated">, import("@sinclair/typebox").TLiteral<"philosopher_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"philosopher_update_output_failed">, import("@sinclair/typebox").TLiteral<"philosopher_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_partial">, import("@sinclair/typebox").TLiteral<"philosopher_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"philosopher_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"philosopher_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_failed_error">, import("@sinclair/typebox").TLiteral<"philosopher_mark_retry_error">, import("@sinclair/typebox").TLiteral<"artificer_task_leased">, import("@sinclair/typebox").TLiteral<"artificer_context_built">, import("@sinclair/typebox").TLiteral<"artificer_run_started">, import("@sinclair/typebox").TLiteral<"artificer_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_output_invalid">, import("@sinclair/typebox").TLiteral<"artificer_output_validated">, import("@sinclair/typebox").TLiteral<"artificer_task_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_task_retried">, import("@sinclair/typebox").TLiteral<"artificer_task_failed">, import("@sinclair/typebox").TLiteral<"artificer_implementation_plan_generated">, import("@sinclair/typebox").TLiteral<"artificer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"artificer_update_output_failed">, import("@sinclair/typebox").TLiteral<"artificer_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"artificer_lineage_partial">, import("@sinclair/typebox").TLiteral<"artificer_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"artificer_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"artificer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"artificer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_task_leased">, import("@sinclair/typebox").TLiteral<"evaluator_context_built">, import("@sinclair/typebox").TLiteral<"evaluator_run_started">, import("@sinclair/typebox").TLiteral<"evaluator_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_output_invalid">, import("@sinclair/typebox").TLiteral<"evaluator_output_validated">, import("@sinclair/typebox").TLiteral<"evaluator_task_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_task_retried">, import("@sinclair/typebox").TLiteral<"evaluator_task_failed">, import("@sinclair/typebox").TLiteral<"evaluator_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"evaluator_update_output_failed">, import("@sinclair/typebox").TLiteral<"evaluator_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_partial">, import("@sinclair/typebox").TLiteral<"evaluator_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"evaluator_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"evaluator_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_failed_error">, import("@sinclair/typebox").TLiteral<"evaluator_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_decision_recorded">, import("@sinclair/typebox").TLiteral<"scribe_task_leased">, import("@sinclair/typebox").TLiteral<"scribe_context_built">, import("@sinclair/typebox").TLiteral<"scribe_run_started">, import("@sinclair/typebox").TLiteral<"scribe_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_output_invalid">, import("@sinclair/typebox").TLiteral<"scribe_output_validated">, import("@sinclair/typebox").TLiteral<"scribe_task_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_task_retried">, import("@sinclair/typebox").TLiteral<"scribe_task_failed">, import("@sinclair/typebox").TLiteral<"scribe_principle_draft_generated">, import("@sinclair/typebox").TLiteral<"scribe_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"scribe_update_output_failed">, import("@sinclair/typebox").TLiteral<"scribe_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"scribe_lineage_partial">, import("@sinclair/typebox").TLiteral<"scribe_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"scribe_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"scribe_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_failed_error">, import("@sinclair/typebox").TLiteral<"scribe_mark_retry_error">, import("@sinclair/typebox").TLiteral<"dreamer_l2_turn">, import("@sinclair/typebox").TLiteral<"dreamer_l2_complete">, import("@sinclair/typebox").TLiteral<"dreamer_l2_fallback_to_l1">, import("@sinclair/typebox").TLiteral<"artificer_l2_attempt">, import("@sinclair/typebox").TLiteral<"artificer_l2_complete">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay_skipped">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembled">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembly_failed">]>;
75
+ eventType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pain_detected">, import("@sinclair/typebox").TLiteral<"principle_candidate_created">, import("@sinclair/typebox").TLiteral<"principle_promoted">, import("@sinclair/typebox").TLiteral<"lease_acquired">, import("@sinclair/typebox").TLiteral<"lease_released">, import("@sinclair/typebox").TLiteral<"lease_renewed">, import("@sinclair/typebox").TLiteral<"lease_expired">, import("@sinclair/typebox").TLiteral<"task_retried">, import("@sinclair/typebox").TLiteral<"task_failed">, import("@sinclair/typebox").TLiteral<"task_succeeded">, import("@sinclair/typebox").TLiteral<"run_started">, import("@sinclair/typebox").TLiteral<"run_completed">, import("@sinclair/typebox").TLiteral<"degradation_triggered">, import("@sinclair/typebox").TLiteral<"diagnostician_task_leased">, import("@sinclair/typebox").TLiteral<"diagnostician_context_built">, import("@sinclair/typebox").TLiteral<"diagnostician_run_started">, import("@sinclair/typebox").TLiteral<"diagnostician_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_output_invalid">, import("@sinclair/typebox").TLiteral<"diagnostician_task_succeeded">, import("@sinclair/typebox").TLiteral<"diagnostician_task_retried">, import("@sinclair/typebox").TLiteral<"diagnostician_task_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"diagnostician_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"diag_router_invariant_override">, import("@sinclair/typebox").TLiteral<"diagnostician_core_grounding_result">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_committed">, import("@sinclair/typebox").TLiteral<"diagnostician_artifact_commit_failed">, import("@sinclair/typebox").TLiteral<"principle_candidate_registered">, import("@sinclair/typebox").TLiteral<"runtime_adapter_selected">, import("@sinclair/typebox").TLiteral<"runtime_invocation_started">, import("@sinclair/typebox").TLiteral<"runtime_invocation_succeeded">, import("@sinclair/typebox").TLiteral<"runtime_invocation_failed">, import("@sinclair/typebox").TLiteral<"output_validation_succeeded">, import("@sinclair/typebox").TLiteral<"output_validation_failed">, import("@sinclair/typebox").TLiteral<"output_repair_attempted">, import("@sinclair/typebox").TLiteral<"output_extraction_failed">, import("@sinclair/typebox").TLiteral<"output_schema_invalid">, import("@sinclair/typebox").TLiteral<"output_repair_exhausted">, import("@sinclair/typebox").TLiteral<"output_path_chosen">, import("@sinclair/typebox").TLiteral<"output_path_fallback">, import("@sinclair/typebox").TLiteral<"dreamer_task_leased">, import("@sinclair/typebox").TLiteral<"dreamer_context_built">, import("@sinclair/typebox").TLiteral<"dreamer_run_started">, import("@sinclair/typebox").TLiteral<"dreamer_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_invalid">, import("@sinclair/typebox").TLiteral<"dreamer_output_validated">, import("@sinclair/typebox").TLiteral<"dreamer_task_succeeded">, import("@sinclair/typebox").TLiteral<"dreamer_task_retried">, import("@sinclair/typebox").TLiteral<"dreamer_task_failed">, import("@sinclair/typebox").TLiteral<"dreamer_candidate_generated">, import("@sinclair/typebox").TLiteral<"dreamer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"dreamer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"dreamer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"dreamer_update_output_failed">, import("@sinclair/typebox").TLiteral<"dreamer_context_partial">, import("@sinclair/typebox").TLiteral<"dreamer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"dreamer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"philosopher_task_leased">, import("@sinclair/typebox").TLiteral<"philosopher_context_built">, import("@sinclair/typebox").TLiteral<"philosopher_run_started">, import("@sinclair/typebox").TLiteral<"philosopher_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_output_invalid">, import("@sinclair/typebox").TLiteral<"philosopher_output_validated">, import("@sinclair/typebox").TLiteral<"philosopher_task_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_task_retried">, import("@sinclair/typebox").TLiteral<"philosopher_task_failed">, import("@sinclair/typebox").TLiteral<"philosopher_principle_candidate_generated">, import("@sinclair/typebox").TLiteral<"philosopher_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"philosopher_update_output_failed">, import("@sinclair/typebox").TLiteral<"philosopher_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"philosopher_lineage_partial">, import("@sinclair/typebox").TLiteral<"philosopher_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"philosopher_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"philosopher_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"philosopher_mark_failed_error">, import("@sinclair/typebox").TLiteral<"philosopher_mark_retry_error">, import("@sinclair/typebox").TLiteral<"artificer_task_leased">, import("@sinclair/typebox").TLiteral<"artificer_context_built">, import("@sinclair/typebox").TLiteral<"artificer_run_started">, import("@sinclair/typebox").TLiteral<"artificer_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_output_invalid">, import("@sinclair/typebox").TLiteral<"artificer_output_validated">, import("@sinclair/typebox").TLiteral<"artificer_task_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_task_retried">, import("@sinclair/typebox").TLiteral<"artificer_task_failed">, import("@sinclair/typebox").TLiteral<"artificer_implementation_plan_generated">, import("@sinclair/typebox").TLiteral<"artificer_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"artificer_update_output_failed">, import("@sinclair/typebox").TLiteral<"artificer_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"artificer_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"artificer_lineage_partial">, import("@sinclair/typebox").TLiteral<"artificer_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"artificer_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"artificer_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"artificer_mark_failed_error">, import("@sinclair/typebox").TLiteral<"artificer_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_task_leased">, import("@sinclair/typebox").TLiteral<"evaluator_context_built">, import("@sinclair/typebox").TLiteral<"evaluator_run_started">, import("@sinclair/typebox").TLiteral<"evaluator_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_output_invalid">, import("@sinclair/typebox").TLiteral<"evaluator_output_validated">, import("@sinclair/typebox").TLiteral<"evaluator_task_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_task_retried">, import("@sinclair/typebox").TLiteral<"evaluator_task_failed">, import("@sinclair/typebox").TLiteral<"evaluator_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"evaluator_update_output_failed">, import("@sinclair/typebox").TLiteral<"evaluator_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"evaluator_lineage_partial">, import("@sinclair/typebox").TLiteral<"evaluator_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"evaluator_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"evaluator_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"evaluator_mark_failed_error">, import("@sinclair/typebox").TLiteral<"evaluator_mark_retry_error">, import("@sinclair/typebox").TLiteral<"evaluator_decision_recorded">, import("@sinclair/typebox").TLiteral<"scribe_task_leased">, import("@sinclair/typebox").TLiteral<"scribe_context_built">, import("@sinclair/typebox").TLiteral<"scribe_run_started">, import("@sinclair/typebox").TLiteral<"scribe_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_output_invalid">, import("@sinclair/typebox").TLiteral<"scribe_output_validated">, import("@sinclair/typebox").TLiteral<"scribe_task_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_task_retried">, import("@sinclair/typebox").TLiteral<"scribe_task_failed">, import("@sinclair/typebox").TLiteral<"scribe_principle_draft_generated">, import("@sinclair/typebox").TLiteral<"scribe_cancel_run_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_succeeded_failed">, import("@sinclair/typebox").TLiteral<"scribe_update_output_failed">, import("@sinclair/typebox").TLiteral<"scribe_dependency_not_succeeded">, import("@sinclair/typebox").TLiteral<"scribe_lineage_resolve_failed">, import("@sinclair/typebox").TLiteral<"scribe_lineage_partial">, import("@sinclair/typebox").TLiteral<"scribe_artifact_write_failed">, import("@sinclair/typebox").TLiteral<"scribe_wrong_task_kind">, import("@sinclair/typebox").TLiteral<"scribe_output_extraction_failed">, import("@sinclair/typebox").TLiteral<"scribe_mark_failed_error">, import("@sinclair/typebox").TLiteral<"scribe_mark_retry_error">, import("@sinclair/typebox").TLiteral<"dreamer_l2_turn">, import("@sinclair/typebox").TLiteral<"dreamer_l2_complete">, import("@sinclair/typebox").TLiteral<"dreamer_l2_fallback_to_l1">, import("@sinclair/typebox").TLiteral<"artificer_l2_attempt">, import("@sinclair/typebox").TLiteral<"artificer_l2_turn">, import("@sinclair/typebox").TLiteral<"artificer_l2_complete">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay">, import("@sinclair/typebox").TLiteral<"evaluator_adversarial_replay_skipped">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembled">, import("@sinclair/typebox").TLiteral<"evaluator_rule_assembly_failed">]>;
76
76
  /** Correlation trace ID for linking events across the pipeline */
77
77
  traceId: import("@sinclair/typebox").TString;
78
78
  /** ISO 8601 timestamp */
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-event.d.ts","sourceRoot":"","sources":["../src/telemetry-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,kBAAkB,k2TAsL7B,CAAC;AAGH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAMnE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB;IAC/B,2CAA2C;;IAE3C,kEAAkE;;IAElE,yBAAyB;;IAEzB,yBAAyB;;IAEzB,wDAAwD;;IAExD,6BAA6B;;EAE7B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMjE,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B,CA8BrF"}
1
+ {"version":3,"file":"telemetry-event.d.ts","sourceRoot":"","sources":["../src/telemetry-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,kBAAkB,65TAwL7B,CAAC;AAGH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAMnE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB;IAC/B,2CAA2C;;IAE3C,kEAAkE;;IAElE,yBAAyB;;IAEzB,yBAAyB;;IAEzB,wDAAwD;;IAExD,6BAA6B;;EAE7B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMjE,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B,CA8BrF"}
@@ -221,10 +221,12 @@ export const TelemetryEventType = Type.Union([
221
221
  Type.Literal('dreamer_l2_turn'),
222
222
  Type.Literal('dreamer_l2_complete'),
223
223
  Type.Literal('dreamer_l2_fallback_to_l1'),
224
- // PRI-424: Artificer L2 write-test-fix loop telemetry.
225
- // - artificer_l2_attempt: per LLM attempt (attempt number, decision, degraded flag)
226
- // - artificer_l2_complete: when the loop finishes (attempts, degraded, succeeded)
224
+ // PRI-424/PRI-439: Artificer L2 agent loop telemetry.
225
+ // - artificer_l2_attempt: per LLM attempt in the legacy write-test-fix loop (kept for backward compat)
226
+ // - artificer_l2_turn: per tool-execution turn inside the L2 agent loop (PRI-439 Phase 4)
227
+ // - artificer_l2_complete: when the loop finishes (turnCount, toolsInvoked, succeeded, timedOut)
227
228
  Type.Literal('artificer_l2_attempt'),
229
+ Type.Literal('artificer_l2_turn'),
228
230
  Type.Literal('artificer_l2_complete'),
229
231
  // PRI-426: Evaluator single-round adversarial sandbox replay telemetry.
230
232
  // - evaluator_adversarial_replay: emitted after each gate invocation with the