@proposit/proposit-core 2.3.1 → 2.4.1

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 (90) hide show
  1. package/dist/cli/builder-repl.d.ts +3 -0
  2. package/dist/cli/builder-repl.d.ts.map +1 -0
  3. package/dist/cli/builder-repl.js +174 -0
  4. package/dist/cli/builder-repl.js.map +1 -0
  5. package/dist/extensions/builder/distill.d.ts +38 -0
  6. package/dist/extensions/builder/distill.d.ts.map +1 -0
  7. package/dist/extensions/builder/distill.js +81 -0
  8. package/dist/extensions/builder/distill.js.map +1 -0
  9. package/dist/extensions/builder/index.d.ts +7 -0
  10. package/dist/extensions/builder/index.d.ts.map +1 -0
  11. package/dist/extensions/builder/index.js +11 -0
  12. package/dist/extensions/builder/index.js.map +1 -0
  13. package/dist/extensions/builder/review.d.ts +11 -0
  14. package/dist/extensions/builder/review.d.ts.map +1 -0
  15. package/dist/extensions/builder/review.js +32 -0
  16. package/dist/extensions/builder/review.js.map +1 -0
  17. package/dist/extensions/builder/simulate.d.ts +12 -0
  18. package/dist/extensions/builder/simulate.d.ts.map +1 -0
  19. package/dist/extensions/builder/simulate.js +33 -0
  20. package/dist/extensions/builder/simulate.js.map +1 -0
  21. package/dist/extensions/openai/provider.d.ts.map +1 -1
  22. package/dist/extensions/openai/provider.js +3 -0
  23. package/dist/extensions/openai/provider.js.map +1 -1
  24. package/dist/extensions/openai/types.d.ts +2 -0
  25. package/dist/extensions/openai/types.d.ts.map +1 -1
  26. package/dist/lib/conversation/contract.d.ts +16 -0
  27. package/dist/lib/conversation/contract.d.ts.map +1 -0
  28. package/dist/lib/conversation/contract.js +9 -0
  29. package/dist/lib/conversation/contract.js.map +1 -0
  30. package/dist/lib/conversation/conversation.d.ts +43 -0
  31. package/dist/lib/conversation/conversation.d.ts.map +1 -0
  32. package/dist/lib/conversation/conversation.js +65 -0
  33. package/dist/lib/conversation/conversation.js.map +1 -0
  34. package/dist/lib/conversation/index.d.ts +8 -0
  35. package/dist/lib/conversation/index.d.ts.map +1 -0
  36. package/dist/lib/conversation/index.js +7 -0
  37. package/dist/lib/conversation/index.js.map +1 -0
  38. package/dist/lib/conversation/turn.d.ts +55 -0
  39. package/dist/lib/conversation/turn.d.ts.map +1 -0
  40. package/dist/lib/conversation/turn.js +112 -0
  41. package/dist/lib/conversation/turn.js.map +1 -0
  42. package/dist/lib/core/expression-manager-checks.d.ts +73 -0
  43. package/dist/lib/core/expression-manager-checks.d.ts.map +1 -0
  44. package/dist/lib/core/expression-manager-checks.js +355 -0
  45. package/dist/lib/core/expression-manager-checks.js.map +1 -0
  46. package/dist/lib/core/expression-manager-dirty-set.d.ts +21 -0
  47. package/dist/lib/core/expression-manager-dirty-set.d.ts.map +1 -0
  48. package/dist/lib/core/expression-manager-dirty-set.js +93 -0
  49. package/dist/lib/core/expression-manager-dirty-set.js.map +1 -0
  50. package/dist/lib/core/expression-manager-invariants.d.ts +14 -0
  51. package/dist/lib/core/expression-manager-invariants.d.ts.map +1 -0
  52. package/dist/lib/core/expression-manager-invariants.js +171 -0
  53. package/dist/lib/core/expression-manager-invariants.js.map +1 -0
  54. package/dist/lib/core/expression-manager.d.ts +2 -3
  55. package/dist/lib/core/expression-manager.d.ts.map +1 -1
  56. package/dist/lib/core/expression-manager.js +18 -523
  57. package/dist/lib/core/expression-manager.js.map +1 -1
  58. package/dist/lib/index.d.ts +4 -0
  59. package/dist/lib/index.d.ts.map +1 -1
  60. package/dist/lib/index.js +6 -0
  61. package/dist/lib/index.js.map +1 -1
  62. package/dist/lib/llm/index.d.ts +1 -1
  63. package/dist/lib/llm/index.d.ts.map +1 -1
  64. package/dist/lib/llm/types.d.ts +13 -0
  65. package/dist/lib/llm/types.d.ts.map +1 -1
  66. package/dist/lib/parsing/prompt-builder.d.ts.map +1 -1
  67. package/dist/lib/parsing/prompt-builder.js +13 -5
  68. package/dist/lib/parsing/prompt-builder.js.map +1 -1
  69. package/dist/lib/pipelines/index.d.ts +4 -2
  70. package/dist/lib/pipelines/index.d.ts.map +1 -1
  71. package/dist/lib/pipelines/index.js +2 -1
  72. package/dist/lib/pipelines/index.js.map +1 -1
  73. package/dist/lib/pipelines/llm-stage-helpers.d.ts +126 -0
  74. package/dist/lib/pipelines/llm-stage-helpers.d.ts.map +1 -0
  75. package/dist/lib/pipelines/llm-stage-helpers.js +567 -0
  76. package/dist/lib/pipelines/llm-stage-helpers.js.map +1 -0
  77. package/dist/lib/pipelines/scheduler.d.ts +62 -0
  78. package/dist/lib/pipelines/scheduler.d.ts.map +1 -0
  79. package/dist/lib/pipelines/{execute.js → scheduler.js} +8 -325
  80. package/dist/lib/pipelines/scheduler.js.map +1 -0
  81. package/dist/lib/pipelines/{execute.d.ts → single-stage.d.ts} +2 -22
  82. package/dist/lib/pipelines/{execute.d.ts.map → single-stage.d.ts.map} +1 -1
  83. package/dist/lib/pipelines/single-stage.js +333 -0
  84. package/dist/lib/pipelines/single-stage.js.map +1 -0
  85. package/dist/lib/pipelines/stage-helpers.d.ts +4 -123
  86. package/dist/lib/pipelines/stage-helpers.d.ts.map +1 -1
  87. package/dist/lib/pipelines/stage-helpers.js +28 -567
  88. package/dist/lib/pipelines/stage-helpers.js.map +1 -1
  89. package/package.json +13 -3
  90. package/dist/lib/pipelines/execute.js.map +0 -1
@@ -3,14 +3,16 @@
3
3
  // - `deterministicStage` — pure (or async-pure) compute, no LLM call.
4
4
  // - `llmStage` — wraps an LLM call with structured-output validation
5
5
  // and the framework retry policy (schema-validation + transient).
6
+ // Implementation lives in `llm-stage-helpers.ts`; this file re-exports
7
+ // it (and its supporting seam functions) so the ~20 existing direct
8
+ // import sites under `src/extensions/` and the public barrel see no
9
+ // path change.
6
10
  // - `subPipelineStage` — recursively executes a nested pipeline as a
7
11
  // single stage in the outer pipeline. Reserved for future
8
12
  // composition; implemented + tested but not yet used by any shipped
9
13
  // pipeline.
10
- import { Pointer, Value } from "typebox/value";
11
- import { debugMaxLengthTruncation } from "./debug-log.js";
12
- import { executePipeline } from "./execute.js";
13
- import { LLM_NON_RETRYABLE_ERROR, LLM_QUOTA_EXHAUSTED, LLM_RATE_LIMITED, LLM_TRANSIENT_ERROR, LLM_UNKNOWN_ERROR, OUTPUT_SCHEMA_INVALID, } from "./failure-codes.js";
14
+ import { executePipeline } from "./scheduler.js";
15
+ export { readLlmStageConfig, isLlmStage, applyRetrySuffix, buildLlmRequest, validateLlmOutcome, failureRetryReason, llmStage, LlmStageRetryExhaustedError, } from "./llm-stage-helpers.js";
14
16
  // -- Deterministic --
15
17
  export function deterministicStage(config) {
16
18
  return {
@@ -26,23 +28,6 @@ export const DEFAULT_RETRY_POLICY = {
26
28
  retryOn: ["schema_validation", "transient"],
27
29
  maxAppendedErrorBytes: 2048,
28
30
  };
29
- const TRUNCATION_SUFFIX = "…<truncated>";
30
- function truncateValidationError(error, capBytes) {
31
- // NOTE: `capBytes` is measured in JavaScript `string.length` —
32
- // UTF-16 code units, not UTF-8 bytes. The spec (§6.3) phrases the
33
- // cap as "bytes"; for ASCII-heavy validation errors the two are
34
- // equal, and for non-ASCII paths a 2048 cap is roughly 2–4 KB of
35
- // UTF-8 depending on character distribution. We accept this drift
36
- // for V1: realistic TypeBox validation errors are short and
37
- // English; a future polish pass can switch to
38
- // `new TextEncoder().encode(error).length` if a real workload
39
- // shows the distinction matters.
40
- if (error.length <= capBytes) {
41
- return error;
42
- }
43
- const head = Math.max(0, capBytes - TRUNCATION_SUFFIX.length);
44
- return error.slice(0, head) + TRUNCATION_SUFFIX;
45
- }
46
31
  /**
47
32
  * Thrown by any stage when an `AbortSignal` cancels execution
48
33
  * mid-flight. The executor recognizes this class and marks the stage
@@ -60,6 +45,28 @@ export class StageAbortedError extends Error {
60
45
  this.stageId = args.stageId;
61
46
  }
62
47
  }
48
+ // -- Token-usage side channel ---------------------------------------------
49
+ //
50
+ // llmStage (in llm-stage-helpers.ts) and the executor (in scheduler.ts)
51
+ // share a tiny side-channel so the executor can attach token usage to the
52
+ // matching `stage:end` event without changing the stage `run` return
53
+ // shape. The side channel is a per-pipeline-run weak map keyed by the
54
+ // StageContext object. `stashTokenUsage` is exported (rather than kept
55
+ // module-private) solely so `llmStage`'s implementation, which now lives
56
+ // in the sibling `llm-stage-helpers.ts`, can write into the same map
57
+ // `readStashedTokenUsage` reads from.
58
+ const TOKEN_USAGE_CHANNELS = new WeakMap();
59
+ export function stashTokenUsage(ctx, stageId, usage) {
60
+ let bucket = TOKEN_USAGE_CHANNELS.get(ctx);
61
+ if (!bucket) {
62
+ bucket = new Map();
63
+ TOKEN_USAGE_CHANNELS.set(ctx, bucket);
64
+ }
65
+ bucket.set(stageId, usage);
66
+ }
67
+ export function readStashedTokenUsage(ctx, stageId) {
68
+ return TOKEN_USAGE_CHANNELS.get(ctx)?.get(stageId);
69
+ }
63
70
  /**
64
71
  * Thrown by `subPipelineStage`'s wrapper when the nested pipeline
65
72
  * returns `output: null` (any required dep of its finalize was
@@ -81,552 +88,6 @@ export class SubPipelineFailedError extends Error {
81
88
  this.failureContext = args.context;
82
89
  }
83
90
  }
84
- /**
85
- * Thrown internally by `llmStage` after retry exhaustion. The
86
- * executor catches it and converts it into a `ProcessingFailure`.
87
- */
88
- export class LlmStageRetryExhaustedError extends Error {
89
- reason;
90
- code;
91
- attempts;
92
- stageId;
93
- failureContext;
94
- constructor(args) {
95
- super(args.message);
96
- this.name = "LlmStageRetryExhaustedError";
97
- this.stageId = args.stageId;
98
- this.reason = args.reason;
99
- this.code = args.code;
100
- this.attempts = args.attempts;
101
- this.failureContext = args.context;
102
- }
103
- }
104
- function classifyError(err) {
105
- if (typeof err !== "object" || err === null) {
106
- return "non_retryable";
107
- }
108
- const tag = err.retryReason;
109
- if (tag === "transient" ||
110
- tag === "rate_limit" ||
111
- tag === "quota_exhausted") {
112
- return tag;
113
- }
114
- return "non_retryable";
115
- }
116
- async function sleep(ms, signal) {
117
- if (ms <= 0)
118
- return;
119
- if (signal.aborted)
120
- return;
121
- await new Promise((resolve) => {
122
- const timer = setTimeout(() => {
123
- signal.removeEventListener("abort", onAbort);
124
- resolve();
125
- }, ms);
126
- const onAbort = () => {
127
- clearTimeout(timer);
128
- signal.removeEventListener("abort", onAbort);
129
- resolve();
130
- };
131
- signal.addEventListener("abort", onAbort, { once: true });
132
- });
133
- }
134
- function emitRetry(ctx, stageId, attempt, reason) {
135
- const event = {
136
- kind: "stage:retry",
137
- stageId,
138
- attempt,
139
- reason,
140
- at: now(),
141
- };
142
- ctx.emit(event);
143
- }
144
- function now() {
145
- return typeof performance !== "undefined" && performance.now
146
- ? performance.now()
147
- : Date.now();
148
- }
149
- // Internal-symbol key for the config carrier. Not exported, so no consumer
150
- // can read or forge it; only this module's `readLlmStageConfig` recovers it.
151
- const LLM_STAGE_CONFIG = Symbol("propositLlmStageConfig");
152
- /**
153
- * Recover the resolved `llmStage` config from a stage built by
154
- * `llmStage`. Returns `undefined` for any stage that is not an LLM stage
155
- * (a deterministic / sub-pipeline stage carries no config). Package-internal.
156
- */
157
- export function readLlmStageConfig(stage) {
158
- return stage[LLM_STAGE_CONFIG];
159
- }
160
- /**
161
- * True iff `stage` is an LLM-background stage — one built by `llmStage` that
162
- * carries the resolved LLM config and is therefore driven by `launchStage` /
163
- * `completeStage`. False for deterministic and sub-pipeline stages (drive those
164
- * with `executeStage`). Mirrors exactly the check `launchStage`/`completeStage`
165
- * apply internally, so a consumer driving a pipeline out-of-process can route a
166
- * stage to the right driver without catching a thrown `PipelineConfigurationError`.
167
- */
168
- export function isLlmStage(stage) {
169
- return readLlmStageConfig(stage) != null;
170
- }
171
- /**
172
- * Append the retry-suffix the in-process loop adds after a failed
173
- * schema-validation attempt. Shared by the loop and `launchStage` (so a
174
- * re-launched attempt 2+ rebuilds the identical `userMessage`).
175
- * Package-internal.
176
- */
177
- export function applyRetrySuffix(baseUser, validationError, errorCap) {
178
- const truncated = truncateValidationError(validationError, errorCap);
179
- return (baseUser +
180
- "\n\nYour previous response failed schema validation: " +
181
- truncated +
182
- ". Please retry conforming to the schema.");
183
- }
184
- // Resolved error-cap for a config's retry policy (the per-retry appended
185
- // validation-error byte bound), defaulted the same way the factory does.
186
- function resolveErrorCap(policy) {
187
- return (policy.maxAppendedErrorBytes ??
188
- DEFAULT_RETRY_POLICY.maxAppendedErrorBytes ??
189
- 2048);
190
- }
191
- /**
192
- * Front half of the seam: build the per-attempt prompts + `TLlmRequest`.
193
- * `userMessage` overrides the prompt's user message (the loop / launch
194
- * pass the retry-suffixed message on attempt 2+); it defaults to
195
- * `buildPrompt(ctx).user`. The returned `req` carries NO `onResponseCreated`
196
- * — the in-process loop attaches its own emitter; the launch path uses the
197
- * submit return value instead. Package-internal.
198
- */
199
- export function buildLlmRequest(cfg, ctx, userMessage) {
200
- const prompt = cfg.buildPrompt(ctx);
201
- const user = userMessage ?? prompt.user;
202
- const req = {
203
- model: cfg.model,
204
- reasoningEffort: cfg.reasoningEffort,
205
- systemPrompt: prompt.system,
206
- userMessage: user,
207
- outputSchema: cfg.outputSchema,
208
- tools: cfg.tools,
209
- maxOutputTokens: cfg.maxOutputTokens,
210
- signal: ctx.signal,
211
- };
212
- return { req, prompts: { system: prompt.system, user } };
213
- }
214
- // The genuinely-shared validation core: check a PARSED output value
215
- // against the stage schema and format the validation error. Used by both
216
- // the in-process loop (output already parsed by the provider) and
217
- // `validateLlmOutcome`'s completed branch (output parsed from raw text).
218
- // Truncate every string longer than its schema's `maxLength` to that cap,
219
- // mutating `value` in place. Driven off the validator's own `maxLength`
220
- // errors (which carry the JSON-pointer path + the limit), so it handles
221
- // nested objects, arrays, and discriminated unions without walking the
222
- // schema by hand. Re-runs because a union surfaces a failing variant's
223
- // inner errors only once its siblings are reconciled; truncation is
224
- // monotonic (strings only shrink) so the loop converges. The pass cap is a
225
- // backstop against a degenerate schema.
226
- //
227
- // Truncation is non-fatal (ingestion output is human-proofread before
228
- // publish), so it does not surface to the caller. It does emit a
229
- // debug-gated breadcrumb per clipped field — the only signal of whether
230
- // the upstream length steering (shrunk wire `maxLength` + budget hint)
231
- // is still letting overshoots through. `stageId` tags the breadcrumb so
232
- // it groups with the stage's other diagnostic lines.
233
- function clampMaxLengthStrings(stageId, schema, value) {
234
- for (let pass = 0; pass < 16; pass++) {
235
- let changed = false;
236
- for (const err of Value.Errors(schema, value)) {
237
- if (err.keyword !== "maxLength")
238
- continue;
239
- const limit = err.params.limit;
240
- const current = Pointer.Get(value, err.instancePath);
241
- if (typeof current === "string" && current.length > limit) {
242
- debugMaxLengthTruncation({
243
- stageId,
244
- instancePath: err.instancePath,
245
- limit,
246
- originalLength: current.length,
247
- });
248
- Pointer.Set(value, err.instancePath, current.slice(0, limit));
249
- changed = true;
250
- }
251
- }
252
- if (!changed)
253
- break;
254
- }
255
- }
256
- function checkLlmOutput(cfg, output) {
257
- if (Value.Check(cfg.outputSchema, output)) {
258
- return { valid: true };
259
- }
260
- // OpenAI strict structured-output IGNORES JSON-Schema string `maxLength`,
261
- // so a model can return an over-long string the schema forbids — a
262
- // recoverable issue that must NOT fail the whole stage. Truncate any
263
- // over-long string to its declared cap (in place) and re-check, rather
264
- // than rejecting the output and halting the pipeline.
265
- clampMaxLengthStrings(cfg.id, cfg.outputSchema, output);
266
- if (Value.Check(cfg.outputSchema, output)) {
267
- return { valid: true };
268
- }
269
- const errors = [...Value.Errors(cfg.outputSchema, output)];
270
- const validationError = errors
271
- .map((e) => `${e.instancePath}: ${e.message}`)
272
- .join("; ");
273
- return { valid: false, validationError };
274
- }
275
- /**
276
- * Back half of the seam: turn a retrieved background response (RAW
277
- * assistant text + terminal status + `incompleteReason`) into an outcome
278
- * + optional typed output + a retry classification.
279
- *
280
- * The parse + `Value.Check` half is genuinely shared with the in-process
281
- * loop (via `checkLlmOutput`). The status/reason → outcome+retry mapping
282
- * is a DELIBERATE `lib/`-side MIRROR of the OpenAI provider's
283
- * classification (`extensions/openai/provider.ts`): `src/lib/` may not
284
- * import the extension classifier (the zero-SDK-import invariant), so the
285
- * mapping is duplicated here and pinned to the provider by a contract test.
286
- * Package-internal.
287
- */
288
- export function validateLlmOutcome(cfg, rawText, status, incompleteReason) {
289
- if (status === "completed") {
290
- // Parse the RAW assistant text first. A parse throw mirrors the
291
- // provider's `SchemaValidationLlmError` (malformed structured-output
292
- // JSON), which classifies as retryable `schema_validation`.
293
- let parsed;
294
- try {
295
- parsed = JSON.parse(rawText ?? "");
296
- }
297
- catch (err) {
298
- const message = `Provider returned malformed JSON in structured-output text: ${err instanceof Error ? err.message : String(err)}`;
299
- return {
300
- outcome: "failed",
301
- failure: {
302
- reason: "schema_validation",
303
- code: OUTPUT_SCHEMA_INVALID,
304
- message,
305
- },
306
- validationError: message,
307
- };
308
- }
309
- const checked = checkLlmOutput(cfg, parsed);
310
- if (checked.valid) {
311
- return { outcome: "completed", output: parsed };
312
- }
313
- const validationError = checked.validationError ?? "schema validation failed";
314
- return {
315
- outcome: "failed",
316
- failure: {
317
- reason: "schema_validation",
318
- code: OUTPUT_SCHEMA_INVALID,
319
- message: validationError,
320
- },
321
- validationError,
322
- };
323
- }
324
- if (status === "cancelled") {
325
- // A cancelled background response mirrors a mid-flight abort:
326
- // recorded `skipped`, NO `ProcessingFailure`, so a consumer can
327
- // distinguish a cancel from a genuine error.
328
- return { outcome: "skipped" };
329
- }
330
- if (status === "incomplete") {
331
- const reason = incompleteReason ?? "unspecified";
332
- if (reason === "content_filter") {
333
- // Deterministic — the policy filter won't change on a re-roll;
334
- // fail-fast (NO retryReason), mirroring NonRetryableLlmError.
335
- return {
336
- outcome: "failed",
337
- failure: {
338
- reason: "transient",
339
- code: LLM_NON_RETRYABLE_ERROR,
340
- message: formatIncompleteMirror(reason),
341
- },
342
- };
343
- }
344
- // `max_output_tokens` and any other/unspecified reason → retryable
345
- // transient (mirrors the provider's conservative TransientLlmError).
346
- return {
347
- outcome: "failed",
348
- failure: {
349
- reason: "transient",
350
- code: LLM_TRANSIENT_ERROR,
351
- message: formatIncompleteMirror(reason),
352
- },
353
- };
354
- }
355
- // status === "failed" (or any other non-terminal value reaching here):
356
- // a terminal failed envelope is NonRetryableLlmError → fail-fast (NO
357
- // retryReason). `transient` would be WRONG (it's in the default
358
- // retryOn, so the workflow would retry a definitively-failed response).
359
- return {
360
- outcome: "failed",
361
- failure: {
362
- reason: "transient",
363
- code: LLM_NON_RETRYABLE_ERROR,
364
- message: `Provider returned status "${status}".`,
365
- },
366
- };
367
- }
368
- // `lib/`-side mirror of the provider's incomplete-reason message. Kept
369
- // terse + reason-naming (the provider's full guidance text lives in
370
- // `extensions/openai/provider.ts#formatIncompleteMessage`, which `lib/`
371
- // cannot import).
372
- function formatIncompleteMirror(reason) {
373
- return `Provider returned status "incomplete" (reason: ${reason}).`;
374
- }
375
- // Whether the failure's `reason` is a RETRYABLE classification to surface
376
- // on `TExecuteStageResult.retryReason`. Fail-fast failures carry a
377
- // `non-retryable` code (LLM_NON_RETRYABLE_ERROR) and surface NO
378
- // retryReason; the genuinely-retryable reasons are the workflow's
379
- // re-launch signal. Package-internal.
380
- export function failureRetryReason(failure) {
381
- if (failure.code === LLM_NON_RETRYABLE_ERROR)
382
- return undefined;
383
- return failure.reason;
384
- }
385
- // -- LLM stage --
386
- export function llmStage(config) {
387
- const policy = {
388
- ...DEFAULT_RETRY_POLICY,
389
- ...config.retry,
390
- retryOn: config.retry?.retryOn ?? DEFAULT_RETRY_POLICY.retryOn,
391
- };
392
- const errorCap = resolveErrorCap(policy);
393
- const cfg = {
394
- id: config.id,
395
- outputSchema: config.outputSchema,
396
- model: config.model,
397
- reasoningEffort: config.reasoningEffort,
398
- buildPrompt: config.buildPrompt,
399
- tools: config.tools,
400
- maxOutputTokens: config.maxOutputTokens,
401
- retryPolicy: policy,
402
- };
403
- const stage = {
404
- id: config.id,
405
- dependsOn: config.dependsOn,
406
- outputSchema: config.outputSchema,
407
- run: async (ctx) => {
408
- const prompt = config.buildPrompt(ctx);
409
- let userMessage = prompt.user;
410
- let attempt = 0;
411
- let lastError = null;
412
- while (attempt < policy.maxAttempts) {
413
- attempt += 1;
414
- if (ctx.signal.aborted) {
415
- // Loop-top abort: caller cancelled before (or
416
- // between) attempts. Surface as a `skipped` stage
417
- // rather than a failure.
418
- throw new StageAbortedError({ stageId: config.id });
419
- }
420
- // Emit the `stage:llm-response-created` event the moment
421
- // the provider surfaces a response id. In background-stream
422
- // mode this fires MID-FLIGHT — before `respond()` resolves
423
- // — from the provider's `onResponseCreated` callback (the
424
- // first `response.created` SSE event). That early emit is
425
- // load-bearing: a consumer persists the id before a
426
- // possible crash, so a call interrupted mid-generation can
427
- // be recovered from the upstream's stored copy rather than
428
- // blindly re-run. In synchronous mode the callback never
429
- // fires; the id is surfaced only at completion (below). The
430
- // `responseIdEmitted` flag dedupes so the event fires at
431
- // most once per attempt.
432
- let responseIdEmitted = false;
433
- const emitResponseCreated = (responseId) => {
434
- if (responseIdEmitted)
435
- return;
436
- responseIdEmitted = true;
437
- ctx.emit({
438
- kind: "stage:llm-response-created",
439
- stageId: config.id,
440
- attempt,
441
- responseId,
442
- at: now(),
443
- });
444
- };
445
- // Build the request via the shared seam, then attach this
446
- // attempt's mid-flight id emitter (the seam leaves
447
- // `onResponseCreated` unset — the launch path uses the
448
- // submit return value instead).
449
- const { req } = buildLlmRequest(cfg, ctx, userMessage);
450
- req.onResponseCreated = emitResponseCreated;
451
- // Emit the pre-call stage-input event. Fires inside the
452
- // retry loop after `attempt` is incremented and after the
453
- // request is built, immediately before `respond()` — so a
454
- // consumer can surface the as-sent prompts the instant the
455
- // call starts, without waiting for the post-call
456
- // `stage:llm-call`. On attempt 2+ `userMessage` already
457
- // carries the retry-suffix appended by the prior attempt's
458
- // schema-validation failure path, matching this attempt's
459
- // eventual `stage:llm-call.prompts.user`.
460
- ctx.emit({
461
- kind: "stage:llm-request",
462
- stageId: config.id,
463
- attempt,
464
- prompts: {
465
- system: prompt.system,
466
- user: userMessage,
467
- },
468
- at: now(),
469
- });
470
- try {
471
- const response = await ctx.llm.respond(req);
472
- // Completion-time fallback: if the provider surfaced an
473
- // id but did NOT fire the mid-flight callback (the
474
- // synchronous / poll paths), emit here so the event
475
- // still precedes `stage:llm-call` on this attempt.
476
- if (response.rawResponseId) {
477
- emitResponseCreated(response.rawResponseId);
478
- }
479
- // Shared validation core (same check the launch/complete
480
- // path runs via validateLlmOutcome's completed branch).
481
- const checked = checkLlmOutput(cfg, response.output);
482
- const validationPassed = checked.valid;
483
- const validationError = checked.validationError;
484
- // Emit per-attempt LLM-call event. Fires after the
485
- // call returns and after schema validation has run,
486
- // before retry/return branching. `validationError`
487
- // is `undefined` when the schema accepted the
488
- // output, a string when it rejected. `prompts.user`
489
- // is the as-sent message — on attempt 2+ this
490
- // includes any retry-suffix appended by the prior
491
- // attempt's schema-validation failure path.
492
- ctx.emit({
493
- kind: "stage:llm-call",
494
- stageId: config.id,
495
- attempt,
496
- prompts: {
497
- system: prompt.system,
498
- user: userMessage,
499
- },
500
- output: response.output,
501
- tokenUsage: response.tokenUsage,
502
- rawResponseId: response.rawResponseId,
503
- validationError,
504
- at: now(),
505
- });
506
- if (!validationPassed) {
507
- // validationError is defined here because
508
- // validationPassed is false.
509
- const validationMessage = validationError;
510
- lastError = {
511
- reason: "schema_validation",
512
- code: OUTPUT_SCHEMA_INVALID,
513
- message: validationMessage,
514
- };
515
- const retryable = policy.retryOn.includes("schema_validation");
516
- if (!retryable || attempt >= policy.maxAttempts) {
517
- break;
518
- }
519
- emitRetry(ctx, config.id, attempt, "schema_validation");
520
- userMessage = applyRetrySuffix(prompt.user, validationMessage, errorCap);
521
- await sleep(policy.backoffMs, ctx.signal);
522
- continue;
523
- }
524
- // Token usage emission is handled by the executor at
525
- // stage:end time; we return the response output and
526
- // attach the usage onto a side channel via failure-free
527
- // path.
528
- // We stash token usage on a per-stage well-known key
529
- // recognized by the executor.
530
- stashTokenUsage(ctx, config.id, response.tokenUsage);
531
- return response.output;
532
- }
533
- catch (err) {
534
- if (err instanceof LlmStageRetryExhaustedError &&
535
- err.stageId === config.id) {
536
- // Re-throw our own marker; the catch below shouldn't
537
- // see it. Defensive.
538
- throw err;
539
- }
540
- if (err instanceof StageAbortedError) {
541
- throw err;
542
- }
543
- // Mid-flight abort surfaces here when the provider
544
- // honored the signal and threw. Recognize it before
545
- // classifying as a generic non-retryable failure so
546
- // the executor can mark this stage `skipped`, not
547
- // `failed` with `LLM_NON_RETRYABLE_ERROR`.
548
- if (ctx.signal.aborted) {
549
- throw new StageAbortedError({ stageId: config.id });
550
- }
551
- const reason = classifyError(err);
552
- const message = err instanceof Error ? err.message : String(err);
553
- if (reason === "non_retryable") {
554
- lastError = {
555
- reason: "transient",
556
- code: LLM_NON_RETRYABLE_ERROR,
557
- message,
558
- };
559
- break;
560
- }
561
- lastError = {
562
- reason,
563
- code: reason === "quota_exhausted"
564
- ? LLM_QUOTA_EXHAUSTED
565
- : reason === "rate_limit"
566
- ? LLM_RATE_LIMITED
567
- : LLM_TRANSIENT_ERROR,
568
- message,
569
- };
570
- // Fail-fast for any reason not opted into `retryOn`.
571
- // `quota_exhausted` is absent from every default
572
- // policy, so a quota 429 breaks here on attempt 1 —
573
- // same control flow `rate_limit` already takes.
574
- if (!policy.retryOn.includes(reason)) {
575
- break;
576
- }
577
- if (attempt >= policy.maxAttempts) {
578
- break;
579
- }
580
- emitRetry(ctx, config.id, attempt, reason);
581
- await sleep(policy.backoffMs, ctx.signal);
582
- }
583
- }
584
- const failure = lastError ?? {
585
- reason: "transient",
586
- code: LLM_UNKNOWN_ERROR,
587
- message: "llmStage retry loop exited without error context",
588
- };
589
- throw new LlmStageRetryExhaustedError({
590
- stageId: config.id,
591
- reason: failure.reason,
592
- code: failure.code,
593
- attempts: attempt,
594
- message: failure.message,
595
- context: failure.context,
596
- });
597
- },
598
- };
599
- // Attach the resolved config on a non-enumerable, internal-symbol-keyed
600
- // carrier so `launchStage`/`completeStage` (same package) can recover it
601
- // via `readLlmStageConfig`. Non-enumerable + symbol-keyed keeps it off
602
- // every enumeration and JSON serialization of the stage object, and out
603
- // of the public `TStage` shape.
604
- Object.defineProperty(stage, LLM_STAGE_CONFIG, {
605
- value: cfg,
606
- enumerable: false,
607
- writable: false,
608
- configurable: false,
609
- });
610
- return stage;
611
- }
612
- // -- Token-usage side channel ---------------------------------------------
613
- //
614
- // llmStage and the executor share a tiny side-channel so the executor
615
- // can attach token usage to the matching `stage:end` event without
616
- // changing the stage `run` return shape. The side channel is a per-
617
- // pipeline-run weak map keyed by the StageContext object.
618
- const TOKEN_USAGE_CHANNELS = new WeakMap();
619
- function stashTokenUsage(ctx, stageId, usage) {
620
- let bucket = TOKEN_USAGE_CHANNELS.get(ctx);
621
- if (!bucket) {
622
- bucket = new Map();
623
- TOKEN_USAGE_CHANNELS.set(ctx, bucket);
624
- }
625
- bucket.set(stageId, usage);
626
- }
627
- export function readStashedTokenUsage(ctx, stageId) {
628
- return TOKEN_USAGE_CHANNELS.get(ctx)?.get(stageId);
629
- }
630
91
  // -- Sub-pipeline --
631
92
  export function subPipelineStage(config) {
632
93
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"stage-helpers.js","sourceRoot":"","sources":["../../../src/lib/pipelines/stage-helpers.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,oEAAoE;AACpE,qEAAqE;AACrE,4DAA4D;AAC5D,sEAAsE;AACtE,cAAc;AAGd,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAc9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACxB,MAAM,oBAAoB,CAAA;AAE3B,sBAAsB;AAEtB,MAAM,UAAU,kBAAkB,CAAU,MAK3C;IACG,OAAO;QACH,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,YA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