@agentsmarket/pipeline-runtime 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -55,6 +55,7 @@ export interface PipelineContext {
55
55
  export interface PipelineHooks {
56
56
  onStageStart?: (stageId: string) => void;
57
57
  onStageComplete?: (stageId: string, ms: number, output: string) => void;
58
+ onLlmResponse?: (stageId: string, rawText: string, model: string) => void;
58
59
  }
59
60
  import type { LLMProvider } from './types.js';
60
61
  export declare function runStage(stage: PipelineStageSpec, ctx: PipelineContext): Promise<string>;
package/dist/stages.d.ts CHANGED
@@ -82,6 +82,14 @@ export interface StageExecutorDeps {
82
82
  pricing: PricingResolver;
83
83
  modelResolver: ModelResolver;
84
84
  fetchSkill: (skillId: string) => Promise<SkillLike | null>;
85
+ /**
86
+ * F24 debug hook. Fires after `provider.generateText` returns but
87
+ * before `validateOutputFormat`. Lets the CLI capture the raw LLM
88
+ * text and surface it when validation fails (e.g. "Output format
89
+ * violations: takeaway_1: key missing" without `--debug` you never
90
+ * see what the model actually returned).
91
+ */
92
+ onLlmResponse?: (stageId: string, rawText: string, model: string) => void;
85
93
  /**
86
94
  * Optional pipeline fetcher for composition refs (R10.7.b, ADR Q10).
87
95
  * When supplied, runPipelineV2 walks the spec once before the loop and
package/dist/stages.js CHANGED
@@ -198,7 +198,7 @@ function resolveStageProvider(deps, stage, model) {
198
198
  }
199
199
  return deps.registry.resolveWithSupports(stage.provider, model);
200
200
  }
201
- async function invokeSkill(skill, input, previousContext, skillLabel, provider, retry, retryCtx) {
201
+ async function invokeSkill(skill, input, previousContext, skillLabel, provider, retry, retryCtx, outputFormat) {
202
202
  const t0 = Date.now();
203
203
  const inputStr = JSON.stringify(input ?? {}, null, 2);
204
204
  const fullMd = skill.full_md ?? '';
@@ -208,6 +208,7 @@ async function invokeSkill(skill, input, previousContext, skillLabel, provider,
208
208
  system: `${skillLabel}\n${description}`,
209
209
  complexity: 'complex',
210
210
  maxTokens: 4096,
211
+ ...(outputFormat ? { outputFormat } : {}),
211
212
  }), retry, retryCtx);
212
213
  return { result: ran.value, durationMs: Date.now() - t0, attempts: ran.attempts };
213
214
  }
@@ -361,7 +362,8 @@ export async function executeStage(stage, pipeline, ctx, deps) {
361
362
  const resolvedInput = typeof chainedInput === 'string'
362
363
  ? resolveStageOutputRefs(chainedInput, ctx.previousOutputs)
363
364
  : chainedInput;
364
- const { result, durationMs } = await invokeSkill(skill, resolvedInput, previousContext, label, stageProvider, stage.retry, retryCtx);
365
+ const { result, durationMs } = await invokeSkill(skill, resolvedInput, previousContext, label, stageProvider, stage.retry, retryCtx, stage.output_format);
366
+ deps.onLlmResponse?.(`${stage.id}:${use.id}`, result.text, skillModel);
365
367
  lastResult = result;
366
368
  chainedInput = { input_from_previous_skill: result.text };
367
369
  nestedCalls.push({
@@ -403,9 +405,11 @@ export async function executeStage(stage, pipeline, ctx, deps) {
403
405
  complexity: stage.model?.includes('M3') || stage.model?.includes('opus') ? 'complex' : 'simple',
404
406
  maxTokens: 4096,
405
407
  fields: stage.fields,
408
+ outputFormat: stage.output_format,
406
409
  }), stage.retry, retryCtx);
407
410
  const result = ran.value;
408
411
  const costMicroUsdc = await deps.pricing.resolveCostMicroUsdc(model, result.usage);
412
+ deps.onLlmResponse?.(stage.id, result.text, model);
409
413
  validateOutputFormat(result.text, stage.output_format, stage.fields);
410
414
  return {
411
415
  output: result.text,
package/dist/types.d.ts CHANGED
@@ -38,6 +38,21 @@ export interface GenerateOptions {
38
38
  * this — they emit JSON based on the real model's output.
39
39
  */
40
40
  fields?: string[];
41
+ /**
42
+ * Stage-level output_format constraint. MockProvider branches on this to
43
+ * emit a realistic deterministic shape per format (text, markdown, code,
44
+ * structured_json). Other providers ignore this — they emit whatever
45
+ * the real model returns and downstream `validateOutputFormat` checks
46
+ * the result.
47
+ *
48
+ * Added in F13: previously MockProvider echoed the prompt back via
49
+ * `[mock] echo: <preview>` for every non-structured format, which made
50
+ * `pipeline call --local --mock` produce noisy unhelpful output. With
51
+ * `outputFormat` set, each format gets its own deterministic mock
52
+ * (markdown headers, fenced code, plain text summary) — useful for
53
+ * demo/QA without a real LLM.
54
+ */
55
+ outputFormat?: OutputFormat;
41
56
  }
42
57
  export interface TokenUsage {
43
58
  inputTokens: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsmarket/pipeline-runtime",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Runtime for executing PIPELINE.md workflows (multi-skill orchestration). Provider-agnostic (MiniMax, Claude, OpenAI).",
5
5
  "license": "MIT",
6
6
  "type": "module",