@agentsmarket/pipeline-runtime 0.1.9 → 0.1.12
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/pipeline-refs.d.ts +18 -0
- package/dist/pipeline-refs.js +26 -0
- package/dist/stages.js +17 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export { createModelResolver, resolveModelSync, DEFAULT_MODEL, type ModelResolve
|
|
|
36
36
|
export { sha256Hex, computeSkillContentHash, } from './content-hash.js';
|
|
37
37
|
export { executeStage, runPipelineV2, makeWhenResolve, parseUsesEntry, parseUsesList, validateOutputFormat, StageNotFoundError, StageForbiddenError, StageBadConfigError, type StageExecutorDeps, type StageContext, type StageExecutionResult, type RunPipelineOptions, type RunPipelineResult, type NestedCallRecord, type ResolvedUse, type SkillInvocationDetail, type MCPValidationResult, type MCPDetail, } from './stages.js';
|
|
38
38
|
export { validateInputs, formatInputErrors, type InputDecl, type InputSpec, type InputValidationError, } from './validate-inputs.js';
|
|
39
|
-
export { resolveInputRefs, type PipelineRefContext, } from './pipeline-refs.js';
|
|
39
|
+
export { resolveInputRefs, resolveSpecialKeys, type PipelineRefContext, } from './pipeline-refs.js';
|
|
40
40
|
export { isToolSkill, invokeToolSkill, type ToolSkillContext, type ToolSkillResult, type ToolSkillHandler, } from './tools/tool-skills.js';
|
|
41
41
|
export interface PipelineStageSpec {
|
|
42
42
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { createModelResolver, resolveModelSync, DEFAULT_MODEL, } from './model-r
|
|
|
23
23
|
export { sha256Hex, computeSkillContentHash, } from './content-hash.js';
|
|
24
24
|
export { executeStage, runPipelineV2, makeWhenResolve, parseUsesEntry, parseUsesList, validateOutputFormat, StageNotFoundError, StageForbiddenError, StageBadConfigError, } from './stages.js';
|
|
25
25
|
export { validateInputs, formatInputErrors, } from './validate-inputs.js';
|
|
26
|
-
export { resolveInputRefs, } from './pipeline-refs.js';
|
|
26
|
+
export { resolveInputRefs, resolveSpecialKeys, } from './pipeline-refs.js';
|
|
27
27
|
export { isToolSkill, invokeToolSkill, } from './tools/tool-skills.js';
|
|
28
28
|
export async function runStage(stage, ctx) {
|
|
29
29
|
const vars = [];
|
package/dist/pipeline-refs.d.ts
CHANGED
|
@@ -33,3 +33,21 @@ export interface PipelineRefContext {
|
|
|
33
33
|
previousOutputs: Record<string, string>;
|
|
34
34
|
}
|
|
35
35
|
export declare function resolveInputRefs(value: unknown, ctx: PipelineRefContext): unknown;
|
|
36
|
+
/**
|
|
37
|
+
* Substitute built-in special keys (\$today, \$now, \$year, \$month, \$weekday)
|
|
38
|
+
* anywhere they appear in text. Used for LLM prompts / system messages where
|
|
39
|
+
* \$input.X / \$stages.X.output are NOT resolved (they would inflate prompts
|
|
40
|
+
* with raw arrays or huge prior outputs). Special keys are small strings —
|
|
41
|
+
* safe to substitute everywhere.
|
|
42
|
+
*
|
|
43
|
+
* Bare and braced forms both work:
|
|
44
|
+
* \$today / \${today} → '2026-09-22'
|
|
45
|
+
* \$now / \${now} → '2026-09-22T00:00:00Z'
|
|
46
|
+
* \$year / \${year} → '2026'
|
|
47
|
+
* \$month / \${month} → '2026-09'
|
|
48
|
+
* \$weekday / \${weekday} → 'Monday'
|
|
49
|
+
*
|
|
50
|
+
* Unknown \$keys are left literal (no false-matching — only the 5 known
|
|
51
|
+
* keys trigger substitution).
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveSpecialKeys(text: string): string;
|
package/dist/pipeline-refs.js
CHANGED
|
@@ -126,3 +126,29 @@ function stringifyValue(v) {
|
|
|
126
126
|
return '';
|
|
127
127
|
return JSON.stringify(v);
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Substitute built-in special keys (\$today, \$now, \$year, \$month, \$weekday)
|
|
131
|
+
* anywhere they appear in text. Used for LLM prompts / system messages where
|
|
132
|
+
* \$input.X / \$stages.X.output are NOT resolved (they would inflate prompts
|
|
133
|
+
* with raw arrays or huge prior outputs). Special keys are small strings —
|
|
134
|
+
* safe to substitute everywhere.
|
|
135
|
+
*
|
|
136
|
+
* Bare and braced forms both work:
|
|
137
|
+
* \$today / \${today} → '2026-09-22'
|
|
138
|
+
* \$now / \${now} → '2026-09-22T00:00:00Z'
|
|
139
|
+
* \$year / \${year} → '2026'
|
|
140
|
+
* \$month / \${month} → '2026-09'
|
|
141
|
+
* \$weekday / \${weekday} → 'Monday'
|
|
142
|
+
*
|
|
143
|
+
* Unknown \$keys are left literal (no false-matching — only the 5 known
|
|
144
|
+
* keys trigger substitution).
|
|
145
|
+
*/
|
|
146
|
+
export function resolveSpecialKeys(text) {
|
|
147
|
+
return text.replace(SPECIAL_KEY_PATTERN, (match, k1, k2) => {
|
|
148
|
+
const key = k1 ?? k2;
|
|
149
|
+
if (key !== undefined && Object.prototype.hasOwnProperty.call(SPECIAL_KEYS, key)) {
|
|
150
|
+
return SPECIAL_KEYS[key]();
|
|
151
|
+
}
|
|
152
|
+
return match;
|
|
153
|
+
});
|
|
154
|
+
}
|
package/dist/stages.js
CHANGED
|
@@ -16,7 +16,7 @@ import { StageOutputFormatError, StageSkillVersionMismatchError, StageMCPConfigE
|
|
|
16
16
|
import { createModelResolver, } from './model-resolver.js';
|
|
17
17
|
import { computeSkillContentHash } from './content-hash.js';
|
|
18
18
|
import { shouldSkipStage } from './when.js';
|
|
19
|
-
import { resolveInputRefs } from './pipeline-refs.js';
|
|
19
|
+
import { resolveInputRefs, resolveSpecialKeys } from './pipeline-refs.js';
|
|
20
20
|
import { isToolSkill, invokeToolSkill } from './tools/tool-skills.js';
|
|
21
21
|
import { isRetryableStatus, computeBackoffMs, RetryExhaustedError, DEFAULT_RETRY, } from './retry.js';
|
|
22
22
|
import { NoopEventSink, makeStartedEvent as makePipelineStartedEvent, makeCompletedEvent as makePipelineCompletedEvent, makeFailedEvent as makePipelineFailedEvent, makeStageStartedEvent, makeStageCompletedEvent, makeStageSkippedEvent, makeStageFailedEvent, makeStageRetriedEvent, } from './streaming-events.js';
|
|
@@ -85,7 +85,7 @@ export function parseUsesList(stage) {
|
|
|
85
85
|
return [];
|
|
86
86
|
}
|
|
87
87
|
function getPath(obj, dotted) {
|
|
88
|
-
const parts = dotted.
|
|
88
|
+
const parts = dotted.match(/[^.\[]+|\[\*\]/g)?.map((p) => (p === '[*]' ? '*' : p)) ?? [];
|
|
89
89
|
let cursor = obj;
|
|
90
90
|
for (let i = 0; i < parts.length; i++) {
|
|
91
91
|
if (cursor == null)
|
|
@@ -94,6 +94,19 @@ function getPath(obj, dotted) {
|
|
|
94
94
|
return { found: false, reason: `expected object at segment '${parts[i]}', got ${typeof cursor}` };
|
|
95
95
|
}
|
|
96
96
|
const key = parts[i];
|
|
97
|
+
if (key === '*') {
|
|
98
|
+
if (!Array.isArray(cursor)) {
|
|
99
|
+
return { found: false, reason: `expected array at segment '${parts[i - 1]}' for wildcard, got ${typeof cursor}` };
|
|
100
|
+
}
|
|
101
|
+
const restPath = parts.slice(i + 1).join('.');
|
|
102
|
+
for (let j = 0; j < cursor.length; j++) {
|
|
103
|
+
const itemResult = getPath(cursor[j], restPath);
|
|
104
|
+
if (!itemResult.found) {
|
|
105
|
+
return { found: false, reason: `array item [${j}]: ${itemResult.reason}` };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { found: true, reason: '' };
|
|
109
|
+
}
|
|
97
110
|
if (Array.isArray(cursor)) {
|
|
98
111
|
const idx = Number(key);
|
|
99
112
|
if (!Number.isInteger(idx) || idx < 0 || idx >= cursor.length) {
|
|
@@ -417,9 +430,9 @@ export async function executeStage(stage, pipeline, ctx, deps) {
|
|
|
417
430
|
const model = deps.modelResolver.resolveSync(stage, pipeline);
|
|
418
431
|
const stageProvider = resolveStageProvider(deps, stage, model);
|
|
419
432
|
const resolvedSystem = stage.system
|
|
420
|
-
? resolveStageOutputRefs(stage.system, ctx.previousOutputs)
|
|
433
|
+
? resolveSpecialKeys(resolveStageOutputRefs(stage.system, ctx.previousOutputs))
|
|
421
434
|
: stage.system;
|
|
422
|
-
const resolvedPrompt = resolveStageOutputRefs(stage.prompt ?? '', ctx.previousOutputs);
|
|
435
|
+
const resolvedPrompt = resolveSpecialKeys(resolveStageOutputRefs(stage.prompt ?? '', ctx.previousOutputs));
|
|
423
436
|
const prompt = previousContext + `Inputs:\n${inputsString}\n---\n\n${resolvedPrompt}`;
|
|
424
437
|
const ran = await runWithRetry(() => stageProvider.generateText(prompt, {
|
|
425
438
|
model,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentsmarket/pipeline-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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",
|