@principles/core 1.161.0 → 1.163.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 (109) 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 +9 -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-prompt-builder.test.js +3 -2
  40. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
  41. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts +2 -0
  42. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts.map +1 -0
  43. package/dist/runtime-v2/internalization/__tests__/{artificer-output-v2.test.js → artificer-rule-output.test.js} +126 -127
  44. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -0
  45. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts +2 -0
  46. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts.map +1 -0
  47. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js +270 -0
  48. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js.map +1 -0
  49. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts +2 -0
  50. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts.map +1 -0
  51. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js +180 -0
  52. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js.map +1 -0
  53. package/dist/runtime-v2/internalization/artificer-output.d.ts +33 -51
  54. package/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
  55. package/dist/runtime-v2/internalization/artificer-output.js +48 -87
  56. package/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
  57. package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +1 -1
  58. package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
  59. package/dist/runtime-v2/internalization/artificer-prompt-builder.js +5 -17
  60. package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
  61. package/dist/runtime-v2/internalization/artificer-runner.d.ts +8 -8
  62. package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
  63. package/dist/runtime-v2/internalization/artificer-runner.js +5 -5
  64. package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
  65. package/dist/runtime-v2/internalization/evaluator-runner.d.ts +1 -1
  66. package/dist/runtime-v2/internalization/evaluator-runner.js +2 -2
  67. package/dist/runtime-v2/internalization/index.d.ts +9 -4
  68. package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
  69. package/dist/runtime-v2/internalization/index.js +8 -3
  70. package/dist/runtime-v2/internalization/index.js.map +1 -1
  71. package/dist/runtime-v2/internalization/rule-code-validator.d.ts +16 -0
  72. package/dist/runtime-v2/internalization/rule-code-validator.d.ts.map +1 -1
  73. package/dist/runtime-v2/internalization/rule-code-validator.js +50 -1
  74. package/dist/runtime-v2/internalization/rule-code-validator.js.map +1 -1
  75. package/dist/runtime-v2/internalization/rule-host-input-builder.d.ts +62 -0
  76. package/dist/runtime-v2/internalization/rule-host-input-builder.d.ts.map +1 -0
  77. package/dist/runtime-v2/internalization/rule-host-input-builder.js +182 -0
  78. package/dist/runtime-v2/internalization/rule-host-input-builder.js.map +1 -0
  79. package/dist/runtime-v2/internalization/rule-host-validator.d.ts.map +1 -1
  80. package/dist/runtime-v2/internalization/rule-host-validator.js +22 -1
  81. package/dist/runtime-v2/internalization/rule-host-validator.js.map +1 -1
  82. package/dist/runtime-v2/internalization/template-generator.d.ts +7 -2
  83. package/dist/runtime-v2/internalization/template-generator.d.ts.map +1 -1
  84. package/dist/runtime-v2/internalization/template-generator.js +10 -5
  85. package/dist/runtime-v2/internalization/template-generator.js.map +1 -1
  86. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts +2 -0
  87. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts.map +1 -0
  88. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +322 -0
  89. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -0
  90. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts +2 -0
  91. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts.map +1 -0
  92. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js +149 -0
  93. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js.map +1 -0
  94. package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts +72 -0
  95. package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -0
  96. package/dist/runtime-v2/tools/artificer-l2-tool-contract.js +275 -0
  97. package/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -0
  98. package/dist/runtime-v2/tools/artificer-output-typebox.d.ts +78 -0
  99. package/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -0
  100. package/dist/runtime-v2/tools/artificer-output-typebox.js +70 -0
  101. package/dist/runtime-v2/tools/artificer-output-typebox.js.map +1 -0
  102. package/dist/telemetry-event.d.ts +2 -2
  103. package/dist/telemetry-event.d.ts.map +1 -1
  104. package/dist/telemetry-event.js +5 -3
  105. package/dist/telemetry-event.js.map +1 -1
  106. package/package.json +1 -1
  107. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts +0 -2
  108. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.d.ts.map +0 -1
  109. package/dist/runtime-v2/internalization/__tests__/artificer-output-v2.test.js.map +0 -1
@@ -1,144 +1,63 @@
1
1
  /**
2
- * ArtificerL2Adapter (RuleHost MVP Activation, ADR-0014 Amendment 2026-06-17,
3
- * PRD Decision 8, PRI-424).
2
+ * ArtificerL2Adapter (PRI-439 Phase 4 — tool-using L2 agent).
4
3
  *
5
- * A PDRuntimeAdapter that runs Artificer through a write-test-fix loop:
6
- * generate code (LLM) validate → sandbox replay → on failure, inject
7
- * RefinerSandboxFailedCase[] feedback into the next attempt regenerate.
8
- * Max 3 attempts. On exhaustion, degrade to a V1 output (plan only, no code
9
- * fields) so the downstream Evaluator's isArtificerOutputV2() returns false
10
- * and the principle-artifact path remains usable.
4
+ * A PDRuntimeAdapter that runs Artificer through a multi-turn agent loop
5
+ * (@earendil-works/pi-agent-core) with 4 tools:
6
+ * - read_rulecode_spec : RuleCode dialect spec (canonical form, forbidden patterns)
7
+ * - validate_rulecode : static validation (forbidden patterns + return shape)
8
+ * - replay_rulecode : sandbox replay against a golden trace
9
+ * - submit_rulecode : final ArtificerRuleOutput submission (terminates loop)
10
+ *
11
+ * Why runAgentLoop (not completeSimple):
12
+ * The former completeSimple write-test-fix loop required the adapter to
13
+ * re-prompt the LLM with sandbox failure feedback. runAgentLoop lets the
14
+ * model call validate_rulecode + replay_rulecode itself, inspect the
15
+ * violations, and iterate inside a single agent loop — no external retry
16
+ * wiring. This matches the Dreamer L2 precedent (L2AgentLoopAdapter).
11
17
  *
12
18
  * Why the loop lives in the adapter (not in BasePeerRunner.succeedTask):
13
19
  * BasePeerRunner.run() is strictly linear (lease → buildContext → invokeRuntime
14
20
  * → poll → fetch → validate → succeedTask). succeedTask runs AFTER invokeRuntime
15
21
  * returns a terminal output and cannot loop back to invokeRuntime. Encapsulating
16
- * the write-test-fix loop inside a PDRuntimeAdapter (like Dreamer's
17
- * L2AgentLoopAdapter) keeps BasePeerRunner unchanged it still sees a single
18
- * startRun() that blocks until the loop finishes.
22
+ * the agent loop inside a PDRuntimeAdapter keeps BasePeerRunner unchanged — it
23
+ * still sees a single startRun() that blocks until the loop finishes.
19
24
  *
20
- * Testability: the LLM call is an injected `generateCode` function (mockable).
21
- * Sandbox replay uses the real evaluateRefinerRuleHostGate with an injected
22
- * RefinerRuleHostGateDeps. No real LLM calls in tests.
25
+ * No V1/L1 fallback (PRI-439):
26
+ * Missing/invalid/replay-failing RuleCode fails loud (PDRuntimeError). No
27
+ * degradation to a plan-only output, no completeSimple fallback. The loop
28
+ * either produces a valid ArtificerRuleOutput via submit_rulecode, or throws.
23
29
  *
24
- * ERR considerations (EP-05 Loop State Freshness):
25
- * - Each attempt reads FRESH sandbox errors. The feedback string injected into
26
- * attempt N+1 is built from attempt N's RefinerSandboxFailedCase[], never
27
- * from a stale earlier attempt. (ERR-015/018/019)
28
- * - The recorded output is always from the attempt that produced it, not a
29
- * blend of multiple attempts.
30
+ * ERR considerations:
31
+ * - EP-05 Loop State Freshness: each runAgentLoop call uses a fresh
32
+ * outputCapture + turnCount (never stale loop state across runs).
33
+ * - EP-03 Fail Loud: exhaustion throws PDRuntimeError with a structured
34
+ * nextAction (Runtime Contract Rule 9).
35
+ * - EP-01 Trust Boundary: submit_rulecode validates params via the injected
36
+ * ArtificerValidator before storing (Runtime Contract Rule 1/2).
30
37
  */
31
38
  import { randomUUID } from 'node:crypto';
32
- import { completeSimple } from '@earendil-works/pi-ai';
33
- import { evaluateRefinerRuleHostGate } from '../internalization/refiner-rulehost-gate.js';
34
- import { isArtificerOutputV2 } from '../internalization/artificer-output.js';
35
- import { buildGoldenTraceFromArtificer } from '../golden-trace.js';
39
+ import { runAgentLoop } from '@earendil-works/pi-agent-core';
36
40
  import { PDRuntimeError } from '../error-categories.js';
37
41
  import { storeEmitter } from '../store/event-emitter.js';
38
42
  import { safeStringifyPreview, truncatePreview } from './output-repair-contract.js';
39
43
  import { resolveL2Model } from './l2-agent-loop-adapter.js';
40
- import { extractJsonObject } from './json-extractor.js';
41
- /**
42
- * Factory: build a production `generateCode` function from LLM config.
43
- *
44
- * Uses `resolveL2Model` + `completeSimple` from @earendil-works/pi-ai. The
45
- * returned function takes a prompt string, calls the LLM, extracts text content,
46
- * parses JSON, and returns it as `unknown` (the adapter validates it).
47
- *
48
- * This factory lives in principles-core (not pd-cli) so the LLM wiring logic
49
- * stays in one place and pd-cli doesn't need a direct @earendil-works/pi-ai
50
- * dependency.
51
- *
52
- * ERR refs:
53
- * - ERR-001: returned value is `unknown` — caller must validate
54
- * - ERR-014: response content is safely extracted (no raw JSON.stringify on unknown)
55
- */
56
- export function buildArtificerL2GenerateCode(config) {
57
- const model = resolveL2Model(config.provider, config.model, config.baseUrl);
58
- const timeoutMs = config.timeoutMs ?? 120_000;
59
- return async (prompt) => {
60
- const context = {
61
- messages: [{ role: 'user', content: prompt, timestamp: Date.now() }],
62
- };
63
- const response = await completeSimple(model, context, {
64
- apiKey: config.apiKey,
65
- signal: AbortSignal.timeout(timeoutMs),
66
- });
67
- // Extract text content from the response (ERR-014: safe extraction).
68
- let text = null;
69
- if (typeof response.content === 'string') {
70
- text = response.content;
71
- }
72
- else if (Array.isArray(response.content)) {
73
- const textPart = response.content.find((c) => typeof c === 'object' && c !== null && Object.hasOwn(c, 'type') && Reflect.get(c, 'type') === 'text');
74
- text = textPart?.text ?? null;
75
- }
76
- if (!text) {
77
- throw new Error('ArtificerL2 generateCode: response had no text content');
78
- }
79
- // Parse JSON from the text. The adapter validates the shape — we just
80
- // return the parsed value as unknown.
81
- const extracted = extractJsonObject(text);
82
- if (!extracted) {
83
- throw new Error('ArtificerL2 generateCode: response had no parseable JSON');
84
- }
85
- return extracted;
86
- };
87
- }
88
- const DEFAULT_MAX_ATTEMPTS = 3;
44
+ import { buildArtificerL2Tools, ARTIFICER_L2_TOOL_WHITELIST, } from '../tools/artificer-l2-tool-contract.js';
45
+ const DEFAULT_MAX_TURNS = 8;
46
+ const DEFAULT_TOTAL_BUDGET_MS = 300_000;
47
+ const DEFAULT_MAX_TOKENS = 8192;
89
48
  const MAX_RETAINED_RUNS = 100;
90
- /** Build the feedback string injected into the next LLM attempt. */
91
- function isRecord(v) {
92
- return v !== null && typeof v === 'object' && !Array.isArray(v);
93
- }
94
- /**
95
- * Ensure the candidate carries the expected taskId (LLM may echo a stale or
96
- * example id). Only fills when absent via Object.hasOwn — present-but-wrong
97
- * values reach the validator and fail loud (Runtime Contract Rule 3).
98
- */
99
- function injectTaskId(candidate, taskId) {
100
- if (isRecord(candidate) && !Object.hasOwn(candidate, 'taskId')) {
101
- candidate.taskId = taskId;
102
- }
103
- return candidate;
104
- }
105
- function formatSandboxFeedback(failedCases) {
106
- const lines = failedCases.map((c) => `- caseId: ${c.caseId} | errorType: ${c.errorType} | message: ${c.message}`);
107
- return [
108
- '--- Previous sandbox replay failures (fix these) ---',
109
- ...lines,
110
- '--- end failures ---',
111
- ].join('\n');
112
- }
113
- /**
114
- * Strip the V2 code fields from an output, producing a V1-compatible object
115
- * (plan + lineage only). Used on L2 exhaustion so the principle-artifact path
116
- * still works. Returns a fresh object; does not mutate the input.
117
- */
118
- function degradeToV1(v2) {
119
- const { implementationCode: _code, goldenTraceCases: _cases, affectedTools: _tools, ...v1 } = v2;
120
- void _code;
121
- void _cases;
122
- void _tools;
123
- return v1;
124
- }
125
49
  export class ArtificerL2Adapter {
126
50
  config;
127
- generateCode;
128
51
  gateDeps;
129
52
  validator;
130
53
  eventEmitter;
131
54
  runs = new Map();
55
+ abortControllers = new Map();
132
56
  constructor(config) {
133
- const maxAttempts = config.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
134
- if (!Number.isInteger(maxAttempts) || maxAttempts <= 0) {
135
- throw new RangeError('maxAttempts must be a positive integer');
136
- }
137
- this.generateCode = config.generateCode;
57
+ this.config = config;
138
58
  this.gateDeps = config.gateDeps;
139
59
  this.validator = config.validator;
140
60
  this.eventEmitter = config.eventEmitter ?? storeEmitter;
141
- this.config = { maxAttempts };
142
61
  }
143
62
  // eslint-disable-next-line @typescript-eslint/class-methods-use-this -- required by interface
144
63
  kind() {
@@ -148,7 +67,7 @@ export class ArtificerL2Adapter {
148
67
  async getCapabilities() {
149
68
  return {
150
69
  supportsStructuredJsonOutput: true,
151
- supportsToolUse: false,
70
+ supportsToolUse: true,
152
71
  supportsWorkingDirectory: false,
153
72
  supportsModelSelection: true,
154
73
  supportsLongRunningSessions: false,
@@ -161,22 +80,32 @@ export class ArtificerL2Adapter {
161
80
  async refreshCapabilities() {
162
81
  return this.getCapabilities();
163
82
  }
164
- // eslint-disable-next-line @typescript-eslint/class-methods-use-this -- required by interface
165
83
  async healthCheck() {
84
+ const lastCheckedAt = new Date().toISOString();
85
+ const apiKey = process.env[this.config.apiKeyEnv];
86
+ if (!apiKey) {
87
+ return {
88
+ healthy: false,
89
+ degraded: false,
90
+ warnings: [`API key not found in env: ${this.config.apiKeyEnv}`],
91
+ lastCheckedAt,
92
+ };
93
+ }
166
94
  return {
167
95
  healthy: true,
168
96
  degraded: false,
169
97
  warnings: [],
170
- lastCheckedAt: new Date().toISOString(),
98
+ lastCheckedAt,
171
99
  };
172
100
  }
173
101
  async startRun(input) {
174
102
  const runId = randomUUID();
175
103
  const startedAt = new Date().toISOString();
104
+ const apiKey = process.env[this.config.apiKeyEnv];
105
+ if (!apiKey) {
106
+ throw new PDRuntimeError('runtime_unavailable', `API key not found in env: ${this.config.apiKeyEnv}`);
107
+ }
176
108
  const taskId = input.taskRef?.taskId ?? runId;
177
- const initialPrompt = typeof input.inputPayload === 'string'
178
- ? truncatePreview(input.inputPayload, 50_000)
179
- : safeStringifyPreview(input.inputPayload, 50_000);
180
109
  const runState = {
181
110
  runId,
182
111
  startedAt,
@@ -186,89 +115,134 @@ export class ArtificerL2Adapter {
186
115
  };
187
116
  this.runs.set(runId, runState);
188
117
  this.evictOldRuns();
189
- let lastValidV2 = null;
190
- let lastFailureFeedback = null;
191
- for (let attempt = 1; attempt <= this.config.maxAttempts; attempt += 1) {
192
- // Build prompt: initial + (on retry) the IMMEDIATELY-PRIOR attempt's failure feedback.
193
- // EP-05: lastFailureFeedback is reassigned each iteration from the current attempt's
194
- // sandbox result, so attempt N+1 always sees attempt N's errors, never stale ones.
195
- const prompt = lastFailureFeedback === null
196
- ? initialPrompt
197
- : `${initialPrompt}\n\n${lastFailureFeedback}`;
198
- let candidateRaw;
199
- try {
200
- candidateRaw = await this.generateCode(prompt);
201
- }
202
- catch (err) {
203
- // LLM call threw record and continue to next attempt (or degrade).
204
- const llmError = err instanceof Error ? err.message : String(err);
205
- lastFailureFeedback = `--- LLM call failed ---\n${llmError}`;
206
- this.emitAttempt({ taskId, runId, attempt, decision: 'llm_error' });
207
- continue;
208
- }
209
- // Validate the candidate. taskId is injected for lineage consistency.
210
- const candidateWithTaskId = injectTaskId(candidateRaw, taskId);
211
- const validation = await this.validator.validate(candidateWithTaskId, taskId);
212
- if (!validation.valid) {
213
- // Malformed output (e.g. missing affectedTools). Feed the validator errors back.
214
- // P2 fix: do NOT update lastValidV2 here — degradation must only trust candidates
215
- // that PASSED validation, otherwise we'd emit an unvalidated V1 downstream.
216
- lastFailureFeedback = `--- Validator rejected previous output ---\n${validation.errors.join('\n')}`;
217
- this.emitAttempt({ taskId, runId, attempt, decision: 'validator_rejected' });
218
- continue;
219
- }
220
- // This adapter is the executable RuleHost path. A valid V1 plan is not a
221
- // successful L2 result because it cannot be activated by RuleHost. Give
222
- // the model a bounded repair opportunity instead of silently accepting a
223
- // text-only artifact as if code generation had succeeded.
224
- if (!isArtificerOutputV2(candidateWithTaskId)) {
225
- lastFailureFeedback = '--- Executable RuleCode required ---\nThe previous output was a text-only V1 plan. Include implementationCode, goldenTraceCases, and affectedTools exactly as required by the output contract.';
226
- this.emitAttempt({ taskId, runId, attempt, decision: 'validator_rejected' });
227
- continue;
228
- }
229
- const v2 = candidateWithTaskId;
230
- lastValidV2 = v2;
231
- // Build the GoldenTrace for sandbox replay.
232
- const traceResult = buildGoldenTraceFromArtificer({
233
- cases: v2.goldenTraceCases,
234
- sourceArtifactId: undefined,
235
- });
236
- if (!traceResult.ok) {
237
- lastFailureFeedback = `--- Golden trace build failed ---\n${traceResult.reason}`;
238
- this.emitAttempt({ taskId, runId, attempt, decision: 'trace_build_failed' });
239
- continue;
240
- }
241
- // Sandbox replay.
242
- const gateResult = evaluateRefinerRuleHostGate({ code: v2.implementationCode, goldenTrace: traceResult.trace }, this.gateDeps);
243
- if (gateResult.decision === 'accepted_shadow') {
244
- // Success — store the V2 output.
245
- this.emitAttempt({ taskId, runId, attempt, decision: 'replay_passed' });
246
- this.emitComplete({ taskId, runId, attempts: attempt, degraded: false, succeeded: true });
247
- this.completeRun(runId, 'succeeded', v2);
248
- return this.runHandle(runId, startedAt);
249
- }
250
- // Replay failed — capture THIS attempt's failures for the next prompt (EP-05).
251
- const { failedCases } = gateResult.sandboxResult;
252
- lastFailureFeedback = failedCases.length > 0
253
- ? formatSandboxFeedback(failedCases)
254
- : `--- Sandbox replay failed ---\n${gateResult.decision}: ${gateResult.reasons.join('; ')}`;
255
- this.emitAttempt({ taskId, runId, attempt, decision: 'replay_failed' });
118
+ const totalBudgetMs = this.config.totalBudgetMs ?? DEFAULT_TOTAL_BUDGET_MS;
119
+ const maxTurns = this.config.maxTurns ?? DEFAULT_MAX_TURNS;
120
+ const maxTokens = this.config.maxTokens ?? DEFAULT_MAX_TOKENS;
121
+ const abortController = new AbortController();
122
+ this.abortControllers.set(runId, abortController);
123
+ // Track whether the budget timer fired (vs. cancelRun calling abort).
124
+ // Without this flag, cancelRun() is misidentified as a timeout because
125
+ // both paths set abortController.signal.aborted to true.
126
+ let budgetTimedOut = false;
127
+ const budgetTimer = setTimeout(() => { budgetTimedOut = true; abortController.abort(); }, totalBudgetMs);
128
+ // Build the prompt message. Serialized before the try block so a
129
+ // non-serializable inputPayload fails loud with cleanup (no timer leak).
130
+ let messageContent;
131
+ try {
132
+ messageContent = typeof input.inputPayload === 'string'
133
+ ? truncatePreview(input.inputPayload, 50_000)
134
+ : safeStringifyPreview(input.inputPayload, 50_000);
256
135
  }
257
- // Exhaustion: degrade to V1 if we ever saw a VALIDATED V2 candidate, else fail.
258
- if (lastValidV2) {
259
- const v1 = degradeToV1(lastValidV2);
260
- this.emitComplete({ taskId, runId, attempts: this.config.maxAttempts, degraded: true, succeeded: false });
261
- this.completeRun(runId, 'succeeded', v1);
136
+ catch (err) {
137
+ clearTimeout(budgetTimer);
138
+ this.abortControllers.delete(runId);
139
+ const reason = err instanceof Error ? err.message : String(err);
140
+ runState.status = 'failed';
141
+ runState.reason = `inputPayload not serializable: ${reason}`;
142
+ runState.endedAt = new Date().toISOString();
143
+ throw new PDRuntimeError('input_invalid', `Artificer L2 inputPayload is not serializable: ${reason}`, { nextAction: 'ensure StartRunInput.inputPayload is a string or JSON-serializable object' });
144
+ }
145
+ const toolInstruction = '\n\n--- Tool protocol (Artificer L2 mode, PRI-439) ---\n' +
146
+ 'You have 4 tools to write and verify RuleCode:\n' +
147
+ ' - read_rulecode_spec: read the RuleCode dialect spec (canonical form, forbidden patterns, return shape). Call FIRST.\n' +
148
+ ' - validate_rulecode: statically validate a code string (forbidden patterns + return shape). Call after drafting code.\n' +
149
+ ' - replay_rulecode: sandbox-replay code against a golden trace. Call after validate passes.\n' +
150
+ ' - submit_rulecode: submit your final ArtificerRuleOutput. You MUST call this exactly once with a complete object; the loop stops after you call it.\n' +
151
+ 'Do not emit your final answer as free text — call submit_rulecode.';
152
+ const prompts = [
153
+ { role: 'user', content: messageContent + toolInstruction, timestamp: Date.now() },
154
+ ];
155
+ // Fresh capture + turn counter per run (EP-05 loop-state freshness).
156
+ const outputCapture = { output: null };
157
+ let turnCount = 0;
158
+ const toolsInvoked = {};
159
+ const toolContext = {
160
+ gateDeps: this.gateDeps,
161
+ validator: this.validator,
162
+ taskId,
163
+ outputCapture,
164
+ onToolExecution: (info) => {
165
+ toolsInvoked[info.toolName] = (toolsInvoked[info.toolName] ?? 0) + 1;
166
+ this.eventEmitter.emitTelemetry({
167
+ eventType: 'artificer_l2_turn',
168
+ traceId: taskId,
169
+ timestamp: new Date().toISOString(),
170
+ sessionId: 'l2-adapter',
171
+ agentId: 'artificer-l2',
172
+ payload: { runId, toolName: info.toolName, ok: info.ok, error: info.error, turn: turnCount },
173
+ });
174
+ },
175
+ };
176
+ const tools = buildArtificerL2Tools(toolContext);
177
+ const agentContext = {
178
+ systemPrompt: '',
179
+ messages: prompts,
180
+ tools,
181
+ };
182
+ const loopConfig = {
183
+ model: resolveL2Model(this.config.provider, this.config.model, this.config.baseUrl),
184
+ apiKey,
185
+ maxTokens,
186
+ convertToLlm: (msgs) => msgs.map((m) => {
187
+ if (m.role === 'user' || m.role === 'assistant' || m.role === 'toolResult') {
188
+ return m;
189
+ }
190
+ throw new PDRuntimeError('output_invalid', `Artificer L2 convertToLlm encountered an unsupported message role: ${String(m.role)}`);
191
+ }),
192
+ beforeToolCall: async (ctx) => {
193
+ if (!ARTIFICER_L2_TOOL_WHITELIST.has(ctx.toolCall.name)) {
194
+ return { block: true, reason: `tool '${ctx.toolCall.name}' is not in the Artificer L2 whitelist` };
195
+ }
196
+ return undefined;
197
+ },
198
+ shouldStopAfterTurn: () => {
199
+ turnCount += 1;
200
+ return outputCapture.output !== null || turnCount >= maxTurns;
201
+ },
202
+ };
203
+ this.eventEmitter.emitTelemetry({
204
+ eventType: 'artificer_l2_turn',
205
+ traceId: taskId,
206
+ timestamp: new Date().toISOString(),
207
+ sessionId: 'l2-adapter',
208
+ agentId: 'artificer-l2',
209
+ payload: { runId, phase: 'loop_started', maxTurns, totalBudgetMs, maxTokens },
210
+ });
211
+ let timedOut = false;
212
+ let loopError = null;
213
+ try {
214
+ await runAgentLoop(prompts, agentContext, loopConfig, async (event) => { void event; }, abortController.signal);
215
+ }
216
+ catch (err) {
217
+ const reason = err instanceof Error ? err.message : String(err);
218
+ timedOut = budgetTimedOut;
219
+ loopError = reason;
220
+ }
221
+ clearTimeout(budgetTimer);
222
+ this.abortControllers.delete(runId);
223
+ // Extract output from the capture (set by submit_rulecode).
224
+ if (outputCapture.output !== null) {
225
+ runState.status = 'succeeded';
226
+ runState.endedAt = new Date().toISOString();
227
+ runState.output = { runId, payload: outputCapture.output };
228
+ this.emitComplete({ taskId, runId, turnCount, toolsInvoked, succeeded: true, timedOut: false });
262
229
  return this.runHandle(runId, startedAt);
263
230
  }
264
- // No validated candidate ever produced — fail loud (Runtime Contract Rule 9).
265
- // Throw PDRuntimeError so BasePeerRunner's handlePostLeaseError handles it
266
- // (aligns with Dreamer L2's failure pattern in L2AgentLoopAdapter).
267
- runState.status = 'failed';
231
+ // No output captured — fail loud (Runtime Contract Rule 9, ERR-002).
232
+ // PRI-439: no V1/L1 fallback. Missing/invalid/replay-failing RuleCode
233
+ // creates no rule artifact, approval, or activation.
234
+ const failureReason = loopError !== null
235
+ ? `Artificer L2 agent loop threw: ${loopError}`
236
+ : `Artificer L2 agent loop ended without a submit_rulecode call after ${turnCount} turn(s)`;
237
+ runState.status = timedOut ? 'timed_out' : 'failed';
268
238
  runState.endedAt = new Date().toISOString();
269
- runState.reason = `Artificer L2 exhausted ${this.config.maxAttempts} attempts without a validated candidate`;
270
- this.emitComplete({ taskId, runId, attempts: this.config.maxAttempts, degraded: false, succeeded: false });
271
- throw new PDRuntimeError('output_invalid', runState.reason, { nextAction: 'inspect artificer L2 feedback chain; verify LLM produces parseable ArtificerOutputV1/V2' });
239
+ runState.reason = failureReason;
240
+ this.emitComplete({ taskId, runId, turnCount, toolsInvoked, succeeded: false, timedOut });
241
+ throw new PDRuntimeError(timedOut ? 'timeout' : 'output_invalid', failureReason, {
242
+ nextAction: timedOut
243
+ ? 'increase totalBudgetMs or use a faster model; verify the model supports tool use'
244
+ : 'inspect artificer L2 telemetry; verify the model calls submit_rulecode with a valid ArtificerRuleOutput',
245
+ });
272
246
  }
273
247
  async pollRun(runId) {
274
248
  const state = this.runs.get(runId);
@@ -284,6 +258,10 @@ export class ArtificerL2Adapter {
284
258
  };
285
259
  }
286
260
  async cancelRun(runId) {
261
+ const controller = this.abortControllers.get(runId);
262
+ if (controller) {
263
+ controller.abort();
264
+ }
287
265
  const state = this.runs.get(runId);
288
266
  if (state && state.status !== 'succeeded') {
289
267
  state.status = 'failed';
@@ -304,33 +282,13 @@ export class ArtificerL2Adapter {
304
282
  // No-op: L2 artificer builds its full prompt in startRun.
305
283
  }
306
284
  // ── internals ──────────────────────────────────────────────────────────────
307
- completeRun(runId, status, payload) {
308
- const state = this.runs.get(runId);
309
- if (!state)
310
- return;
311
- state.status = status;
312
- state.endedAt = new Date().toISOString();
313
- state.output = { runId, payload };
314
- }
315
285
  runHandle(runId, startedAt) {
316
- // RunHandleSchema = { runId, runtimeKind, startedAt } — no status field.
317
- // The run's terminal status is reported via pollRun(), not the handle.
318
286
  return {
319
287
  runId,
320
288
  runtimeKind: this.kind(),
321
289
  startedAt,
322
290
  };
323
291
  }
324
- emitAttempt(opts) {
325
- this.eventEmitter.emitTelemetry({
326
- eventType: 'artificer_l2_attempt',
327
- traceId: opts.taskId,
328
- timestamp: new Date().toISOString(),
329
- sessionId: 'l2-adapter',
330
- agentId: 'artificer-l2',
331
- payload: { runId: opts.runId, attempt: opts.attempt, decision: opts.decision },
332
- });
333
- }
334
292
  emitComplete(opts) {
335
293
  this.eventEmitter.emitTelemetry({
336
294
  eventType: 'artificer_l2_complete',
@@ -340,9 +298,11 @@ export class ArtificerL2Adapter {
340
298
  agentId: 'artificer-l2',
341
299
  payload: {
342
300
  runId: opts.runId,
343
- attempts: opts.attempts,
344
- degraded: opts.degraded,
301
+ turnCount: opts.turnCount,
302
+ toolsInvoked: opts.toolsInvoked,
345
303
  succeeded: opts.succeeded,
304
+ timedOut: opts.timedOut,
305
+ outputPreview: safeStringifyPreview(this.runs.get(opts.runId)?.output?.payload, 300),
346
306
  },
347
307
  });
348
308
  }
@@ -1 +1 @@
1
- {"version":3,"file":"artificer-l2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AG,iBAAiB,CAAC;QAClD,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACpD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
@@ -24,7 +24,7 @@ import { DiagDistillerOutputV1Schema } from '../diagnostician/diag-distiller-out
24
24
  import { DreamerOutputV1Schema } from '../internalization/dreamer-output.js';
25
25
  import { PhilosopherOutputV1Schema } from '../internalization/philosopher-output.js';
26
26
  import { ScribeOutputV1Schema } from '../internalization/scribe-output.js';
27
- import { ArtificerOutputV1Schema } from '../internalization/artificer-output.js';
27
+ import { ArtificerRuleOutputSchema } from '../internalization/artificer-output.js';
28
28
  import { EvaluatorOutputV1Schema } from '../internalization/evaluator-output.js';
29
29
  import { RolloutReviewerOutputV1Schema } from '../internalization/rollout-reviewer-output.js';
30
30
  import { TrainerOutputV1Schema } from '../internalization/trainer-output.js';
@@ -220,7 +220,7 @@ const OUTPUT_SCHEMA_REGISTRY = new Map([
220
220
  ['dreamer-output-v1', DreamerOutputV1Schema],
221
221
  ['philosopher-output-v1', PhilosopherOutputV1Schema],
222
222
  ['scribe-output-v1', ScribeOutputV1Schema],
223
- ['artificer-output-v1', ArtificerOutputV1Schema],
223
+ ['artificer-rule-output-v2', ArtificerRuleOutputSchema],
224
224
  ['evaluator-output-v1', EvaluatorOutputV1Schema],
225
225
  ['rollout-reviewer-output-v1', RolloutReviewerOutputV1Schema],
226
226
  ['trainer-output-v1', TrainerOutputV1Schema],