taskflow-core 0.1.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 (115) hide show
  1. package/dist/agents/analyst.md +30 -0
  2. package/dist/agents/critic.md +31 -0
  3. package/dist/agents/doc-writer.md +43 -0
  4. package/dist/agents/executor-code.md +36 -0
  5. package/dist/agents/executor-fast.md +26 -0
  6. package/dist/agents/executor-ui.md +35 -0
  7. package/dist/agents/executor.md +29 -0
  8. package/dist/agents/final-arbiter.md +29 -0
  9. package/dist/agents/plan-arbiter.md +35 -0
  10. package/dist/agents/planner.md +30 -0
  11. package/dist/agents/recover.md +28 -0
  12. package/dist/agents/reviewer.md +37 -0
  13. package/dist/agents/risk-reviewer.md +37 -0
  14. package/dist/agents/scout.md +51 -0
  15. package/dist/agents/security-reviewer.md +39 -0
  16. package/dist/agents/test-engineer.md +31 -0
  17. package/dist/agents/verifier.md +29 -0
  18. package/dist/agents/visual-explorer.md +32 -0
  19. package/dist/agents.d.ts +55 -0
  20. package/dist/agents.d.ts.map +1 -0
  21. package/dist/agents.js +265 -0
  22. package/dist/agents.js.map +1 -0
  23. package/dist/cache.d.ts +57 -0
  24. package/dist/cache.d.ts.map +1 -0
  25. package/dist/cache.js +256 -0
  26. package/dist/cache.js.map +1 -0
  27. package/dist/compile.d.ts +37 -0
  28. package/dist/compile.d.ts.map +1 -0
  29. package/dist/compile.js +324 -0
  30. package/dist/compile.js.map +1 -0
  31. package/dist/context-store.d.ts +142 -0
  32. package/dist/context-store.d.ts.map +1 -0
  33. package/dist/context-store.js +383 -0
  34. package/dist/context-store.js.map +1 -0
  35. package/dist/detached-runner.d.ts +12 -0
  36. package/dist/detached-runner.d.ts.map +1 -0
  37. package/dist/detached-runner.js +68 -0
  38. package/dist/detached-runner.js.map +1 -0
  39. package/dist/flowir/hash.d.ts +51 -0
  40. package/dist/flowir/hash.d.ts.map +1 -0
  41. package/dist/flowir/hash.js +90 -0
  42. package/dist/flowir/hash.js.map +1 -0
  43. package/dist/flowir/index.d.ts +43 -0
  44. package/dist/flowir/index.d.ts.map +1 -0
  45. package/dist/flowir/index.js +62 -0
  46. package/dist/flowir/index.js.map +1 -0
  47. package/dist/flowir/meta.d.ts +103 -0
  48. package/dist/flowir/meta.d.ts.map +1 -0
  49. package/dist/flowir/meta.js +19 -0
  50. package/dist/flowir/meta.js.map +1 -0
  51. package/dist/flowir/phasefp.d.ts +55 -0
  52. package/dist/flowir/phasefp.d.ts.map +1 -0
  53. package/dist/flowir/phasefp.js +123 -0
  54. package/dist/flowir/phasefp.js.map +1 -0
  55. package/dist/flowir/translate.d.ts +37 -0
  56. package/dist/flowir/translate.d.ts.map +1 -0
  57. package/dist/flowir/translate.js +137 -0
  58. package/dist/flowir/translate.js.map +1 -0
  59. package/dist/frontmatter.d.ts +21 -0
  60. package/dist/frontmatter.d.ts.map +1 -0
  61. package/dist/frontmatter.js +107 -0
  62. package/dist/frontmatter.js.map +1 -0
  63. package/dist/host/runner-types.d.ts +98 -0
  64. package/dist/host/runner-types.d.ts.map +1 -0
  65. package/dist/host/runner-types.js +21 -0
  66. package/dist/host/runner-types.js.map +1 -0
  67. package/dist/index.d.ts +26 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +30 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/interpolate.d.ts +52 -0
  72. package/dist/interpolate.d.ts.map +1 -0
  73. package/dist/interpolate.js +418 -0
  74. package/dist/interpolate.js.map +1 -0
  75. package/dist/paths.d.ts +23 -0
  76. package/dist/paths.d.ts.map +1 -0
  77. package/dist/paths.js +43 -0
  78. package/dist/paths.js.map +1 -0
  79. package/dist/runner-core.d.ts +49 -0
  80. package/dist/runner-core.d.ts.map +1 -0
  81. package/dist/runner-core.js +208 -0
  82. package/dist/runner-core.js.map +1 -0
  83. package/dist/runtime.d.ts +234 -0
  84. package/dist/runtime.d.ts.map +1 -0
  85. package/dist/runtime.js +2284 -0
  86. package/dist/runtime.js.map +1 -0
  87. package/dist/schema.d.ts +257 -0
  88. package/dist/schema.d.ts.map +1 -0
  89. package/dist/schema.js +795 -0
  90. package/dist/schema.js.map +1 -0
  91. package/dist/stale.d.ts +72 -0
  92. package/dist/stale.d.ts.map +1 -0
  93. package/dist/stale.js +179 -0
  94. package/dist/stale.js.map +1 -0
  95. package/dist/store.d.ts +237 -0
  96. package/dist/store.d.ts.map +1 -0
  97. package/dist/store.js +761 -0
  98. package/dist/store.js.map +1 -0
  99. package/dist/typebox-helpers.d.ts +15 -0
  100. package/dist/typebox-helpers.d.ts.map +1 -0
  101. package/dist/typebox-helpers.js +19 -0
  102. package/dist/typebox-helpers.js.map +1 -0
  103. package/dist/usage.d.ts +21 -0
  104. package/dist/usage.d.ts.map +1 -0
  105. package/dist/usage.js +33 -0
  106. package/dist/usage.js.map +1 -0
  107. package/dist/verify.d.ts +38 -0
  108. package/dist/verify.d.ts.map +1 -0
  109. package/dist/verify.js +324 -0
  110. package/dist/verify.js.map +1 -0
  111. package/dist/workspace.d.ts +64 -0
  112. package/dist/workspace.d.ts.map +1 -0
  113. package/dist/workspace.js +178 -0
  114. package/dist/workspace.js.map +1 -0
  115. package/package.json +40 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Minimal YAML-frontmatter parser for agent `.md` files.
3
+ *
4
+ * Vendored so taskflow-core stays dependency-free (the host SDK's
5
+ * `parseFrontmatter` pulls in the `yaml` package). Agent frontmatter is flat
6
+ * `key: value` — scalars, quoted strings, comma lists, or inline `[a, b]`
7
+ * sequences — which is all this parser needs to support. Anything it can't
8
+ * parse degrades to a string value (the caller already tolerates that).
9
+ */
10
+ const normalizeNewlines = (value) => value.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
11
+ function extract(content) {
12
+ const normalized = normalizeNewlines(content);
13
+ if (!normalized.startsWith("---"))
14
+ return { yamlString: null, body: normalized };
15
+ const endIndex = normalized.indexOf("\n---", 3);
16
+ if (endIndex === -1)
17
+ return { yamlString: null, body: normalized };
18
+ return {
19
+ yamlString: normalized.slice(4, endIndex),
20
+ body: normalized.slice(endIndex + 4).trim(),
21
+ };
22
+ }
23
+ /** Strip one layer of matching quotes. */
24
+ function unquote(s) {
25
+ const t = s.trim();
26
+ if (t.length >= 2 && ((t[0] === '"' && t.at(-1) === '"') || (t[0] === "'" && t.at(-1) === "'"))) {
27
+ return t.slice(1, -1);
28
+ }
29
+ return t;
30
+ }
31
+ /** Parse a scalar value, an inline `[a, b]` sequence, or a quoted string. */
32
+ function parseValue(raw) {
33
+ const v = raw.trim();
34
+ if (v === "")
35
+ return "";
36
+ // Inline flow sequence: [a, b, c]
37
+ if (v.startsWith("[") && v.endsWith("]")) {
38
+ const inner = v.slice(1, -1).trim();
39
+ if (!inner)
40
+ return [];
41
+ return inner.split(",").map((x) => unquote(x)).filter((x) => x.length > 0);
42
+ }
43
+ // Booleans / null kept as their YAML meaning so the caller can reject them.
44
+ if (v === "true")
45
+ return true;
46
+ if (v === "false")
47
+ return false;
48
+ if (v === "null" || v === "~")
49
+ return null;
50
+ return unquote(v);
51
+ }
52
+ /**
53
+ * Parse frontmatter from a markdown file. Returns `{ frontmatter, body }`.
54
+ * Lines that aren't `key: value` (e.g. block sequences) are skipped; the caller
55
+ * only relies on flat keys.
56
+ */
57
+ export function parseFrontmatter(content) {
58
+ const { yamlString, body } = extract(content);
59
+ if (!yamlString)
60
+ return { frontmatter: {}, body };
61
+ const frontmatter = {};
62
+ const lines = yamlString.split("\n");
63
+ for (let i = 0; i < lines.length; i++) {
64
+ const line = lines[i];
65
+ const trimmed = line.trim();
66
+ if (!trimmed || trimmed.startsWith("#"))
67
+ continue;
68
+ // Block sequence item (`- value`) is consumed by its parent key below.
69
+ if (trimmed.startsWith("- "))
70
+ continue;
71
+ const colon = trimmed.indexOf(":");
72
+ if (colon === -1)
73
+ continue;
74
+ const key = trimmed.slice(0, colon).trim();
75
+ if (!key)
76
+ continue;
77
+ const rest = trimmed.slice(colon + 1).trim();
78
+ if (rest === "") {
79
+ // Possibly a block sequence: collect following `- item` lines.
80
+ const items = [];
81
+ let j = i + 1;
82
+ for (; j < lines.length; j++) {
83
+ const next = lines[j];
84
+ const nt = next.trim();
85
+ if (nt === "" || nt.startsWith("#"))
86
+ continue;
87
+ if (next.match(/^\s+-\s/)) {
88
+ items.push(unquote(nt.replace(/^-\s*/, "")));
89
+ }
90
+ else
91
+ break;
92
+ }
93
+ if (items.length > 0) {
94
+ frontmatter[key] = items.filter((x) => x.length > 0);
95
+ i = j - 1; // skip consumed sequence lines
96
+ }
97
+ else {
98
+ frontmatter[key] = "";
99
+ }
100
+ continue;
101
+ }
102
+ frontmatter[key] = parseValue(rest);
103
+ }
104
+ return { frontmatter, body };
105
+ }
106
+ export const stripFrontmatter = (content) => parseFrontmatter(content).body;
107
+ //# sourceMappingURL=frontmatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAEvG,SAAS,OAAO,CAAC,OAAe;IAC/B,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACjF,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAChD,IAAI,QAAQ,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACnE,OAAO;QACN,UAAU,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,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;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Host-neutral subagent execution contract.
3
+ *
4
+ * This is the seam that lets pi-taskflow's engine run on any host (pi, Codex,
5
+ * …) without knowing how a subagent is actually spawned. The engine
6
+ * (`runtime.ts`) only ever talks to a `SubagentRunner`; each host ships one
7
+ * concrete implementation:
8
+ *
9
+ * - pi → `piSubagentRunner` (spawns `pi --mode json -p …`, in runner.ts)
10
+ * - codex → `codexSubagentRunner` (spawns `codex exec --json …`, future)
11
+ *
12
+ * The data types here (`RunResult`, `RunOptions`, `LiveUpdate`) are
13
+ * deliberately host-agnostic: they describe *what* a subagent run produces, not
14
+ * *how* it was produced. Nothing in this file imports a host SDK.
15
+ *
16
+ * `runner.ts` re-exports these types so every existing
17
+ * `import { RunResult, RunOptions, … } from "./runner.ts"` keeps working
18
+ * unchanged — this file is purely additive.
19
+ */
20
+ import type { UsageStats } from "../usage.ts";
21
+ /**
22
+ * Minimal structural `Message` shape the core parser needs. Vendored (instead of
23
+ * importing `@earendil-works/pi-ai`) so `taskflow-core` stays host-SDK-free. A
24
+ * host whose subagent emits richer messages can pass them through — only these
25
+ * fields are read structurally; everything else is accessed defensively.
26
+ */
27
+ export interface CoreMessagePart {
28
+ type: string;
29
+ text?: string;
30
+ name?: string;
31
+ arguments?: Record<string, unknown>;
32
+ }
33
+ export interface CoreMessage {
34
+ role: string;
35
+ content: CoreMessagePart[];
36
+ [k: string]: unknown;
37
+ }
38
+ /** The structured outcome of a single subagent run, independent of host. */
39
+ export interface RunResult {
40
+ agent: string;
41
+ task: string;
42
+ exitCode: number;
43
+ output: string;
44
+ stderr: string;
45
+ usage: UsageStats;
46
+ model?: string;
47
+ stopReason?: string;
48
+ errorMessage?: string;
49
+ /** Total subagent attempts incl. retries (set by the runtime's retry wrapper). */
50
+ attempts?: number;
51
+ /** Set when the subagent was killed by the idle watchdog (not a user abort). */
52
+ idleTimeout?: boolean;
53
+ }
54
+ /** A streaming progress tick from a running subagent. */
55
+ export interface LiveUpdate {
56
+ /** Latest assistant text or tool activity (single-line, truncated upstream). */
57
+ text: string;
58
+ usage: UsageStats;
59
+ model?: string;
60
+ }
61
+ /** Per-run knobs the engine passes to whichever host runner executes the task. */
62
+ export interface RunOptions {
63
+ model?: string;
64
+ thinking?: string;
65
+ tools?: string[];
66
+ cwd?: string;
67
+ signal?: AbortSignal;
68
+ /** Fires on each assistant turn with the latest activity + accumulated usage. */
69
+ onLive?: (live: LiveUpdate) => void;
70
+ /**
71
+ * Idle watchdog: if the subagent produces no output for this many ms, it is
72
+ * considered stalled (hung stream / provider stall / tool deadlock) and is
73
+ * killed. Resets on every output chunk. 0/undefined keeps the host default.
74
+ */
75
+ idleTimeoutMs?: number;
76
+ /**
77
+ * Shared Context Tree (opt-in). When set, the spawned subagent is given the
78
+ * blackboard dir + node id so it can register the ctx_* tools (read/write/
79
+ * report/spawn). A host that cannot inject these may ignore them (fail-open:
80
+ * context sharing simply degrades to "no sharing").
81
+ */
82
+ ctxDir?: string;
83
+ nodeId?: string;
84
+ }
85
+ /**
86
+ * The minimal contract a host must satisfy to execute taskflow subagents.
87
+ *
88
+ * `agents` is the resolved agent roster (name → model/prompt/tools); the runner
89
+ * looks up `agentName` in it. `globalThinking` is the flow-level default applied
90
+ * when neither the per-phase opts nor the agent frontmatter set a thinking
91
+ * level. A runner MUST resolve a successful run to a `RunResult` (never throw
92
+ * for an ordinary subagent failure) — set `exitCode`/`stopReason`/`errorMessage`
93
+ * instead, so the engine's retry and fail-soft logic can act on it.
94
+ */
95
+ export interface SubagentRunner<TAgent = unknown> {
96
+ runTask(defaultCwd: string, agents: TAgent[], agentName: string, task: string, opts: RunOptions, globalThinking?: string): Promise<RunResult>;
97
+ }
98
+ //# sourceMappingURL=runner-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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E,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iFAAiF;IACjF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACpC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,OAAO;IAC/C,OAAO,CACN,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,UAAU,EAChB,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,SAAS,CAAC,CAAC;CACtB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Host-neutral subagent execution contract.
3
+ *
4
+ * This is the seam that lets pi-taskflow's engine run on any host (pi, Codex,
5
+ * …) without knowing how a subagent is actually spawned. The engine
6
+ * (`runtime.ts`) only ever talks to a `SubagentRunner`; each host ships one
7
+ * concrete implementation:
8
+ *
9
+ * - pi → `piSubagentRunner` (spawns `pi --mode json -p …`, in runner.ts)
10
+ * - codex → `codexSubagentRunner` (spawns `codex exec --json …`, future)
11
+ *
12
+ * The data types here (`RunResult`, `RunOptions`, `LiveUpdate`) are
13
+ * deliberately host-agnostic: they describe *what* a subagent run produces, not
14
+ * *how* it was produced. Nothing in this file imports a host SDK.
15
+ *
16
+ * `runner.ts` re-exports these types so every existing
17
+ * `import { RunResult, RunOptions, … } from "./runner.ts"` keeps working
18
+ * unchanged — this file is purely additive.
19
+ */
20
+ export {};
21
+ //# sourceMappingURL=runner-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner-types.js","sourceRoot":"","sources":["../../src/host/runner-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * taskflow-core — the host-neutral engine.
3
+ *
4
+ * Barrel of everything the pi / codex adapters consume. The engine has no host
5
+ * SDK dependency: schema (DSL + validation), runtime (DAG execution), cache,
6
+ * interpolation, verification, the FlowIR compile seam, the shared context tree,
7
+ * agent discovery, persistence, and the host-neutral SubagentRunner contract.
8
+ *
9
+ * Adapters inject their own subagent runner via `RuntimeDeps.runTask`.
10
+ */
11
+ export * from "./schema.ts";
12
+ export * from "./runtime.ts";
13
+ export * from "./cache.ts";
14
+ export * from "./interpolate.ts";
15
+ export * from "./verify.ts";
16
+ export * from "./usage.ts";
17
+ export * from "./stale.ts";
18
+ export * from "./workspace.ts";
19
+ export * from "./context-store.ts";
20
+ export * from "./compile.ts";
21
+ export * from "./store.ts";
22
+ export * from "./agents.ts";
23
+ export * from "./runner-core.ts";
24
+ export * from "./host/runner-types.ts";
25
+ export * from "./flowir/index.ts";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAK7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * taskflow-core — the host-neutral engine.
3
+ *
4
+ * Barrel of everything the pi / codex adapters consume. The engine has no host
5
+ * SDK dependency: schema (DSL + validation), runtime (DAG execution), cache,
6
+ * interpolation, verification, the FlowIR compile seam, the shared context tree,
7
+ * agent discovery, persistence, and the host-neutral SubagentRunner contract.
8
+ *
9
+ * Adapters inject their own subagent runner via `RuntimeDeps.runTask`.
10
+ */
11
+ export * from "./schema.js";
12
+ export * from "./runtime.js";
13
+ export * from "./cache.js";
14
+ export * from "./interpolate.js";
15
+ export * from "./verify.js";
16
+ export * from "./usage.js";
17
+ export * from "./stale.js";
18
+ export * from "./workspace.js";
19
+ export * from "./context-store.js";
20
+ export * from "./compile.js";
21
+ // NOTE: detached-runner.ts is intentionally NOT re-exported — it is a spawn-only
22
+ // entry point with top-level argv parsing + process.exit. Importing it via the
23
+ // barrel would run that entry on every `import` of taskflow-core. The pi adapter
24
+ // spawns it directly by file path.
25
+ export * from "./store.js";
26
+ export * from "./agents.js";
27
+ export * from "./runner-core.js";
28
+ export * from "./host/runner-types.js";
29
+ export * from "./flowir/index.js";
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,mCAAmC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Template interpolation for taskflow tasks.
3
+ *
4
+ * Supported placeholders:
5
+ * {args.X} invocation argument
6
+ * {steps.ID.output} prior phase final output (string)
7
+ * {steps.ID.json} prior phase output parsed as JSON (stringified back if object)
8
+ * {previous.output} alias for the immediately-preceding completed phase output
9
+ * {item} / {item.f} map loop variable (or custom name via phase.as)
10
+ *
11
+ * Unknown placeholders are left intact rather than throwing, so a
12
+ * partially-specified task still runs. The unresolved refs are returned in
13
+ * `missing[]`; the runtime surfaces them as a phase warning (see
14
+ * `warnUnresolvedRefs` in runtime.ts) — logged and persisted to
15
+ * `PhaseState.warnings`.
16
+ */
17
+ export interface InterpolationContext {
18
+ args: Record<string, unknown>;
19
+ steps: Record<string, {
20
+ output: string;
21
+ json?: unknown;
22
+ }>;
23
+ previousOutput?: string;
24
+ /** loop variable bindings, e.g. { item: {...} } */
25
+ locals?: Record<string, unknown>;
26
+ /** Observed-read hook (M3): invoked once per successfully-resolved
27
+ * placeholder path, so the runtime can capture which upstream phases a
28
+ * phase actually consumed (its observed readSet). Unresolved refs do NOT
29
+ * fire it (they become `missing` warnings instead). Default undefined →
30
+ * zero overhead, fully backward-compatible. */
31
+ onRead?: (ref: string) => void;
32
+ }
33
+ export interface InterpolationResult {
34
+ text: string;
35
+ missing: string[];
36
+ }
37
+ export declare function interpolate(template: string | null | undefined, ctx: InterpolationContext): InterpolationResult;
38
+ export declare function safeParse(text: string): unknown;
39
+ /** Coerce a parsed value into an array for map fan-out. */
40
+ export declare function coerceArray(value: unknown): unknown[] | null;
41
+ /**
42
+ * Evaluate a `when` expression to a boolean. Returns `{ value, error }`.
43
+ * Parse errors set `error` and fail OPEN (`value: true`) so a broken guard
44
+ * never silently drops a phase.
45
+ */
46
+ export declare function tryEvaluateCondition(expr: string, ctx: InterpolationContext): {
47
+ value: boolean;
48
+ error?: string;
49
+ };
50
+ /** Boolean convenience wrapper over {@link tryEvaluateCondition}. */
51
+ export declare function evaluateCondition(expr: string, ctx: InterpolationContext): boolean;
52
+ //# sourceMappingURL=interpolate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interpolate.d.ts","sourceRoot":"","sources":["../src/interpolate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;;oDAIgD;IAChD,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAID,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAgB,WAAW,CAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,GAAG,EAAE,oBAAoB,GACvB,mBAAmB,CAarB;AAkFD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA8D/C;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,IAAI,CAU5D;AA8ND;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,oBAAoB,GACvB;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAWpC;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,C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