yaml-flow 2.4.0 → 2.5.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.
- package/README.md +212 -0
- package/dist/{constants-DcCDDQON.d.ts → constants-BEbO2_OK.d.ts} +1 -1
- package/dist/{constants-Dbk6ArN5.d.cts → constants-BNjeIlZ8.d.cts} +1 -1
- package/dist/continuous-event-graph/index.d.cts +5 -135
- package/dist/continuous-event-graph/index.d.ts +5 -135
- package/dist/event-graph/index.d.cts +3 -3
- package/dist/event-graph/index.d.ts +3 -3
- package/dist/index.cjs +259 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +254 -1
- package/dist/index.js.map +1 -1
- package/dist/inference/index.cjs +450 -0
- package/dist/inference/index.cjs.map +1 -0
- package/dist/inference/index.d.cts +229 -0
- package/dist/inference/index.d.ts +229 -0
- package/dist/inference/index.js +443 -0
- package/dist/inference/index.js.map +1 -0
- package/dist/types-C2lOwquM.d.cts +135 -0
- package/dist/{types-CTu8RqY0.d.cts → types-DAI_a2as.d.cts} +11 -0
- package/dist/{types-CTu8RqY0.d.ts → types-DAI_a2as.d.ts} +11 -0
- package/dist/types-mS_pPftm.d.ts +135 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -983,6 +983,208 @@ const restored = restore(data); // → LiveGraph (validates shape)
|
|
|
983
983
|
|
|
984
984
|
---
|
|
985
985
|
|
|
986
|
+
## LLM Inference
|
|
987
|
+
|
|
988
|
+
Pluggable AI-assisted completion detection. The caller provides the LLM via an `InferenceAdapter` — yaml-flow builds the prompt, parses the response, and applies the results. Core stays pure; inference is opt-in.
|
|
989
|
+
|
|
990
|
+
```typescript
|
|
991
|
+
import {
|
|
992
|
+
buildInferencePrompt, inferCompletions, applyInferences, inferAndApply,
|
|
993
|
+
} from 'yaml-flow/inference';
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
### Inference Hints on Nodes
|
|
997
|
+
|
|
998
|
+
Add optional `inference` metadata to any `TaskConfig`:
|
|
999
|
+
|
|
1000
|
+
```typescript
|
|
1001
|
+
const config = {
|
|
1002
|
+
settings: { completion: 'all-tasks' },
|
|
1003
|
+
tasks: {
|
|
1004
|
+
'infra-provisioned': {
|
|
1005
|
+
provides: ['infra-ready'],
|
|
1006
|
+
inference: {
|
|
1007
|
+
criteria: 'All Azure resources provisioned successfully',
|
|
1008
|
+
keywords: ['azure', 'deployment', 'provisioning'],
|
|
1009
|
+
suggestedChecks: ['scan logs for "Deployment Succeeded"'],
|
|
1010
|
+
autoDetectable: true, // LLM will analyze this node
|
|
1011
|
+
},
|
|
1012
|
+
},
|
|
1013
|
+
'app-deployed': {
|
|
1014
|
+
requires: ['infra-ready'],
|
|
1015
|
+
provides: ['app-ready'],
|
|
1016
|
+
inference: {
|
|
1017
|
+
criteria: 'Health check returns HTTP 200',
|
|
1018
|
+
autoDetectable: true,
|
|
1019
|
+
},
|
|
1020
|
+
},
|
|
1021
|
+
'monitoring': { // no inference → LLM skips it
|
|
1022
|
+
requires: ['app-ready'],
|
|
1023
|
+
provides: ['monitored'],
|
|
1024
|
+
},
|
|
1025
|
+
},
|
|
1026
|
+
};
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
### Pluggable Adapter
|
|
1030
|
+
|
|
1031
|
+
Implement one method — `analyze(prompt) → string`:
|
|
1032
|
+
|
|
1033
|
+
```typescript
|
|
1034
|
+
import type { InferenceAdapter } from 'yaml-flow/inference';
|
|
1035
|
+
|
|
1036
|
+
// OpenAI
|
|
1037
|
+
const openaiAdapter: InferenceAdapter = {
|
|
1038
|
+
analyze: async (prompt) => {
|
|
1039
|
+
const res = await openai.chat.completions.create({
|
|
1040
|
+
model: 'gpt-4o', messages: [{ role: 'user', content: prompt }],
|
|
1041
|
+
});
|
|
1042
|
+
return res.choices[0].message.content ?? '[]';
|
|
1043
|
+
},
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
// Anthropic
|
|
1047
|
+
const claudeAdapter: InferenceAdapter = {
|
|
1048
|
+
analyze: async (prompt) => {
|
|
1049
|
+
const res = await anthropic.messages.create({
|
|
1050
|
+
model: 'claude-sonnet-4-20250514', max_tokens: 1024,
|
|
1051
|
+
messages: [{ role: 'user', content: prompt }],
|
|
1052
|
+
});
|
|
1053
|
+
return res.content[0].type === 'text' ? res.content[0].text : '[]';
|
|
1054
|
+
},
|
|
1055
|
+
};
|
|
1056
|
+
|
|
1057
|
+
// Any HTTP endpoint
|
|
1058
|
+
const customAdapter: InferenceAdapter = {
|
|
1059
|
+
analyze: async (prompt) => {
|
|
1060
|
+
const res = await fetch('https://my-llm/analyze', {
|
|
1061
|
+
method: 'POST', body: JSON.stringify({ prompt }),
|
|
1062
|
+
});
|
|
1063
|
+
return (await res.json()).response;
|
|
1064
|
+
},
|
|
1065
|
+
};
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
### Built-in Adapter Factories
|
|
1069
|
+
|
|
1070
|
+
Zero-boilerplate adapters for common patterns:
|
|
1071
|
+
|
|
1072
|
+
```typescript
|
|
1073
|
+
import { createCliAdapter, createHttpAdapter } from 'yaml-flow/inference';
|
|
1074
|
+
|
|
1075
|
+
// Ollama via HTTP
|
|
1076
|
+
const ollama = createHttpAdapter({
|
|
1077
|
+
url: 'http://localhost:11434/api/generate',
|
|
1078
|
+
buildBody: (prompt) => ({ model: 'llama3', prompt, stream: false }),
|
|
1079
|
+
extractResponse: (json) => json.response,
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
// Ollama via CLI
|
|
1083
|
+
const ollamaCli = createCliAdapter({
|
|
1084
|
+
command: 'ollama',
|
|
1085
|
+
args: (prompt) => ['run', 'llama3', prompt],
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
// Simon Willison's llm CLI (stdin mode for long prompts)
|
|
1089
|
+
const llm = createCliAdapter({
|
|
1090
|
+
command: 'llm',
|
|
1091
|
+
args: () => ['--no-stream'],
|
|
1092
|
+
stdin: true,
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
// Custom Python script
|
|
1096
|
+
const custom = createCliAdapter({
|
|
1097
|
+
command: 'python',
|
|
1098
|
+
args: (prompt) => ['scripts/infer.py', '--json', prompt],
|
|
1099
|
+
cwd: '/path/to/project',
|
|
1100
|
+
env: { MODEL: 'gpt-4o' },
|
|
1101
|
+
timeout: 60_000,
|
|
1102
|
+
});
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
**`createCliAdapter(options)`** — spawns a child process, captures stdout:
|
|
1106
|
+
| Option | Type | Description |
|
|
1107
|
+
|--------|------|-------------|
|
|
1108
|
+
| `command` | `string` | Executable to run (`ollama`, `llm`, `python`, `gh`, …) |
|
|
1109
|
+
| `args` | `(prompt) => string[]` | Build argument list from the prompt |
|
|
1110
|
+
| `stdin` | `boolean` | Pipe prompt via stdin instead of args (default: `false`) |
|
|
1111
|
+
| `timeout` | `number` | Kill after N ms (default: `30000`) |
|
|
1112
|
+
| `cwd` | `string` | Working directory |
|
|
1113
|
+
| `env` | `Record<string, string>` | Extra environment variables |
|
|
1114
|
+
|
|
1115
|
+
**`createHttpAdapter(options)`** — POSTs to an HTTP endpoint:
|
|
1116
|
+
| Option | Type | Description |
|
|
1117
|
+
|--------|------|-------------|
|
|
1118
|
+
| `url` | `string` | Endpoint URL |
|
|
1119
|
+
| `headers` | `Record<string, string>` | Request headers |
|
|
1120
|
+
| `buildBody` | `(prompt) => object` | Build request body (default: `{ prompt }`) |
|
|
1121
|
+
| `extractResponse` | `(json) => string` | Extract text from response JSON |
|
|
1122
|
+
| `timeout` | `number` | Abort after N ms (default: `30000`) |
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
### Three APIs: Build → Suggest → Apply
|
|
1126
|
+
|
|
1127
|
+
```typescript
|
|
1128
|
+
import { createLiveGraph } from 'yaml-flow/continuous-event-graph';
|
|
1129
|
+
import { buildInferencePrompt, inferCompletions, applyInferences } from 'yaml-flow/inference';
|
|
1130
|
+
|
|
1131
|
+
let live = createLiveGraph(config);
|
|
1132
|
+
|
|
1133
|
+
// 1. BUILD: Generate the prompt (pure, sync)
|
|
1134
|
+
const prompt = buildInferencePrompt(live, {
|
|
1135
|
+
context: 'Deployment log: "Deployment Succeeded", health check: HTTP 200',
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
// 2. SUGGEST: Ask the LLM (async)
|
|
1139
|
+
const result = await inferCompletions(live, adapter, {
|
|
1140
|
+
threshold: 0.8,
|
|
1141
|
+
context: 'Deployment log: ...',
|
|
1142
|
+
});
|
|
1143
|
+
result.suggestions; // [{ taskName, confidence, reasoning, detectionMethod }]
|
|
1144
|
+
|
|
1145
|
+
// 3. APPLY: Accept high-confidence suggestions (pure, sync)
|
|
1146
|
+
live = applyInferences(live, result, 0.8); // only applies >= 80% confidence
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
### One-Shot Convenience
|
|
1150
|
+
|
|
1151
|
+
```typescript
|
|
1152
|
+
import { inferAndApply } from 'yaml-flow/inference';
|
|
1153
|
+
|
|
1154
|
+
const { live: updated, applied, skipped, inference } = await inferAndApply(
|
|
1155
|
+
live, adapter, { threshold: 0.8, context: 'deployment logs...' }
|
|
1156
|
+
);
|
|
1157
|
+
|
|
1158
|
+
console.log('Auto-completed:', applied.map(s => s.taskName));
|
|
1159
|
+
console.log('Skipped (low confidence):', skipped.map(s => `${s.taskName} (${s.confidence})`));
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
### Inference API Reference
|
|
1163
|
+
|
|
1164
|
+
| Function | Description |
|
|
1165
|
+
|---|---|
|
|
1166
|
+
| `buildInferencePrompt(live, opts?)` | Build LLM prompt from graph state (pure, sync) |
|
|
1167
|
+
| `inferCompletions(live, adapter, opts?)` | Ask LLM to suggest completions (async) |
|
|
1168
|
+
| `applyInferences(live, result, threshold?)` | Apply suggestions above threshold (pure, sync) |
|
|
1169
|
+
| `inferAndApply(live, adapter, opts?)` | Infer + apply in one step (async, convenience) |
|
|
1170
|
+
| `createCliAdapter(opts)` | Factory: adapter that spawns a CLI command |
|
|
1171
|
+
| `createHttpAdapter(opts)` | Factory: adapter that POSTs to an HTTP endpoint |
|
|
1172
|
+
|
|
1173
|
+
### Inference Types
|
|
1174
|
+
|
|
1175
|
+
| Type | Description |
|
|
1176
|
+
|---|---|
|
|
1177
|
+
| `InferenceAdapter` | `{ analyze(prompt: string): Promise<string> }` — pluggable LLM bridge |
|
|
1178
|
+
| `InferenceHints` | `criteria`, `keywords`, `suggestedChecks`, `autoDetectable` on a TaskConfig |
|
|
1179
|
+
| `InferenceOptions` | `threshold`, `scope`, `context`, `systemPrompt` |
|
|
1180
|
+
| `InferenceResult` | `suggestions[]`, `promptUsed`, `rawResponse`, `analyzedNodes` |
|
|
1181
|
+
| `InferredCompletion` | `taskName`, `confidence`, `reasoning`, `detectionMethod: 'llm-inferred'` |
|
|
1182
|
+
| `InferAndApplyResult` | `live`, `inference`, `applied[]`, `skipped[]` |
|
|
1183
|
+
| `CliAdapterOptions` | `command`, `args`, `stdin`, `timeout`, `cwd`, `env` |
|
|
1184
|
+
| `HttpAdapterOptions` | `url`, `headers`, `buildBody`, `extractResponse`, `timeout` |
|
|
1185
|
+
|
|
1186
|
+
---
|
|
1187
|
+
|
|
986
1188
|
## Loading & Exporting Graph Configs
|
|
987
1189
|
|
|
988
1190
|
```typescript
|
|
@@ -1041,6 +1243,12 @@ import {
|
|
|
1041
1243
|
getUpstream, getDownstream,
|
|
1042
1244
|
} from 'yaml-flow/continuous-event-graph';
|
|
1043
1245
|
|
|
1246
|
+
// LLM Inference (AI-assisted completion detection)
|
|
1247
|
+
import {
|
|
1248
|
+
buildInferencePrompt, inferCompletions, applyInferences, inferAndApply,
|
|
1249
|
+
} from 'yaml-flow/inference';
|
|
1250
|
+
import type { InferenceAdapter, InferenceResult, InferenceOptions } from 'yaml-flow/inference';
|
|
1251
|
+
|
|
1044
1252
|
// Backward compatibility (v1 names → v2)
|
|
1045
1253
|
import { FlowEngine, createEngine } from 'yaml-flow'; // aliases for StepMachine, createStepMachine
|
|
1046
1254
|
```
|
|
@@ -1113,6 +1321,10 @@ See the [examples/](./examples) directory:
|
|
|
1113
1321
|
| [URL Pipeline](./examples/graph-of-graphs/url-processing-pipeline.ts) | Graph-of-Graphs | Outer event-graph → batch × inner event-graph per item |
|
|
1114
1322
|
| [Multi-Stage ETL](./examples/graph-of-graphs/multi-stage-etl.ts) | Graph-of-Graphs | Mixed modes: event-graph outer → step-machine + event-graph subs |
|
|
1115
1323
|
| [Stock Dashboard](./examples/continuous-event-graph/stock-dashboard.ts) | Continuous Event Graph | Runtime mutations, token drain, upstream/downstream, snapshot |
|
|
1324
|
+
| [Azure Deployment](./examples/inference/azure-deployment.ts) | Inference | LLM analyzes deployment logs, auto-completes checkpoints |
|
|
1325
|
+
| [Data Pipeline](./examples/inference/data-pipeline.ts) | Inference | Iterative inference — evidence arrives in waves |
|
|
1326
|
+
| [Pluggable Adapters](./examples/inference/pluggable-adapters.ts) | Inference | OpenAI, Anthropic, Azure, CLI, HTTP adapter factories |
|
|
1327
|
+
| [Copilot CLI](./examples/inference/copilot-cli.ts) | Inference | GitHub Copilot CLI as inference adapter via `createCliAdapter` |
|
|
1116
1328
|
| [Order Processing](./examples/flows/order-processing.yaml) | Step Machine | YAML flow definition |
|
|
1117
1329
|
| [Browser Demo](./examples/browser/index.html) | Step Machine | In-browser usage |
|
|
1118
1330
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphConfig, c as ExecutionState, S as SchedulerResult, e as GraphEvent, T as TaskConfig, l as TaskState, g as StuckDetection, C as CompletionStrategy, a as ConflictStrategy, b as ExecutionMode, d as ExecutionStatus, m as TaskStatus } from './types-
|
|
1
|
+
import { G as GraphConfig, c as ExecutionState, S as SchedulerResult, e as GraphEvent, T as TaskConfig, l as TaskState, g as StuckDetection, C as CompletionStrategy, a as ConflictStrategy, b as ExecutionMode, d as ExecutionStatus, m as TaskStatus } from './types-DAI_a2as.js';
|
|
2
2
|
import { e as StepFlowConfig } from './types-FZ_eyErS.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GraphConfig, c as ExecutionState, S as SchedulerResult, e as GraphEvent, T as TaskConfig, l as TaskState, g as StuckDetection, C as CompletionStrategy, a as ConflictStrategy, b as ExecutionMode, d as ExecutionStatus, m as TaskStatus } from './types-
|
|
1
|
+
import { G as GraphConfig, c as ExecutionState, S as SchedulerResult, e as GraphEvent, T as TaskConfig, l as TaskState, g as StuckDetection, C as CompletionStrategy, a as ConflictStrategy, b as ExecutionMode, d as ExecutionStatus, m as TaskStatus } from './types-DAI_a2as.cjs';
|
|
2
2
|
import { e as StepFlowConfig } from './types-FZ_eyErS.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,137 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Continuous Event Graph — Types
|
|
6
|
-
*
|
|
7
|
-
* A long-lived, evolving event-graph where both config and state
|
|
8
|
-
* mutate over time. The single `LiveGraph` type bundles them.
|
|
9
|
-
*
|
|
10
|
-
* Events are shared with event-graph (task-started, task-completed, etc.).
|
|
11
|
-
* Graph mutations (addNode, removeNode, etc.) are unique to this mode.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The single evolving object for a continuous-mode graph.
|
|
16
|
-
* Bundles config + state so they can't get out of sync.
|
|
17
|
-
*/
|
|
18
|
-
interface LiveGraph {
|
|
19
|
-
/** The current graph configuration (evolves as nodes are added/removed) */
|
|
20
|
-
config: GraphConfig;
|
|
21
|
-
/** The current execution state (evolves as events arrive) */
|
|
22
|
-
state: ExecutionState;
|
|
23
|
-
}
|
|
24
|
-
interface ScheduleResult {
|
|
25
|
-
/** Tasks ready to dispatch now — all requires satisfied */
|
|
26
|
-
eligible: string[];
|
|
27
|
-
/** Tasks waiting on tokens that some producer will eventually provide (normal) */
|
|
28
|
-
pending: PendingTask[];
|
|
29
|
-
/** Tasks waiting on tokens that NO task can produce (caller's problem) */
|
|
30
|
-
unresolved: UnresolvedDependency[];
|
|
31
|
-
/** Tasks waiting on tokens whose producer FAILED (caller's problem) */
|
|
32
|
-
blocked: BlockedTask[];
|
|
33
|
-
/** Token conflicts: multiple tasks produce the same token */
|
|
34
|
-
conflicts: Record<string, string[]>;
|
|
35
|
-
}
|
|
36
|
-
interface PendingTask {
|
|
37
|
-
taskName: string;
|
|
38
|
-
/** Tokens this task needs that haven't been produced yet but have a viable producer */
|
|
39
|
-
waitingOn: string[];
|
|
40
|
-
}
|
|
41
|
-
interface UnresolvedDependency {
|
|
42
|
-
taskName: string;
|
|
43
|
-
/** Tokens this task needs that no task in the graph can produce */
|
|
44
|
-
missingTokens: string[];
|
|
45
|
-
}
|
|
46
|
-
interface BlockedTask {
|
|
47
|
-
taskName: string;
|
|
48
|
-
/** Tokens this task needs whose only producer has failed */
|
|
49
|
-
failedTokens: string[];
|
|
50
|
-
/** The tasks that failed and would have produced those tokens */
|
|
51
|
-
failedProducers: string[];
|
|
52
|
-
}
|
|
53
|
-
interface LiveGraphHealth {
|
|
54
|
-
/** Total number of tasks in the graph */
|
|
55
|
-
totalNodes: number;
|
|
56
|
-
/** Task counts by status */
|
|
57
|
-
running: number;
|
|
58
|
-
completed: number;
|
|
59
|
-
failed: number;
|
|
60
|
-
waiting: number;
|
|
61
|
-
notStarted: number;
|
|
62
|
-
/** Number of disabled (inactivated) nodes */
|
|
63
|
-
disabled: number;
|
|
64
|
-
/** Number of tasks with unresolvable dependencies */
|
|
65
|
-
unresolvedCount: number;
|
|
66
|
-
/** Number of tasks whose producer has failed */
|
|
67
|
-
blockedCount: number;
|
|
68
|
-
/** Tokens that no task produces (open dependencies) */
|
|
69
|
-
openDependencies: string[];
|
|
70
|
-
/** Cycles detected in the current graph (if any) */
|
|
71
|
-
cycles: string[][];
|
|
72
|
-
/** Tokens produced by multiple tasks */
|
|
73
|
-
conflictTokens: string[];
|
|
74
|
-
}
|
|
75
|
-
interface NodeInfo {
|
|
76
|
-
/** Node name */
|
|
77
|
-
name: string;
|
|
78
|
-
/** The task configuration */
|
|
79
|
-
config: TaskConfig;
|
|
80
|
-
/** The current runtime state */
|
|
81
|
-
state: TaskState;
|
|
82
|
-
}
|
|
83
|
-
interface LiveGraphSnapshot {
|
|
84
|
-
/** Schema version for forward compatibility */
|
|
85
|
-
version: number;
|
|
86
|
-
/** The graph config at snapshot time */
|
|
87
|
-
config: GraphConfig;
|
|
88
|
-
/** The execution state at snapshot time */
|
|
89
|
-
state: ExecutionState;
|
|
90
|
-
/** ISO timestamp of when the snapshot was taken */
|
|
91
|
-
snapshotAt: string;
|
|
92
|
-
}
|
|
93
|
-
interface UnreachableTokensResult {
|
|
94
|
-
tokens: {
|
|
95
|
-
/** The token that cannot be produced */
|
|
96
|
-
token: string;
|
|
97
|
-
/** Why it's unreachable */
|
|
98
|
-
reason: 'no-producer' | 'all-producers-failed' | 'transitive';
|
|
99
|
-
/** Tasks that could produce it (but are themselves unreachable/failed) */
|
|
100
|
-
producers: string[];
|
|
101
|
-
}[];
|
|
102
|
-
}
|
|
103
|
-
interface UnreachableNodesResult {
|
|
104
|
-
nodes: {
|
|
105
|
-
/** The node that can never become eligible */
|
|
106
|
-
nodeName: string;
|
|
107
|
-
/** Unreachable tokens this node requires (empty if the node itself is failed/disabled) */
|
|
108
|
-
missingTokens: string[];
|
|
109
|
-
}[];
|
|
110
|
-
}
|
|
111
|
-
interface UpstreamResult {
|
|
112
|
-
/** The target node being inspected */
|
|
113
|
-
nodeName: string;
|
|
114
|
-
/** All upstream nodes that transitively feed into the target */
|
|
115
|
-
nodes: {
|
|
116
|
-
nodeName: string;
|
|
117
|
-
/** Tokens this node provides that are in the dependency chain */
|
|
118
|
-
providesTokens: string[];
|
|
119
|
-
}[];
|
|
120
|
-
/** All tokens in the upstream dependency chain */
|
|
121
|
-
tokens: string[];
|
|
122
|
-
}
|
|
123
|
-
interface DownstreamResult {
|
|
124
|
-
/** The target node being inspected */
|
|
125
|
-
nodeName: string;
|
|
126
|
-
/** All downstream nodes that transitively depend on the target */
|
|
127
|
-
nodes: {
|
|
128
|
-
nodeName: string;
|
|
129
|
-
/** Tokens this node requires that are in the dependency chain */
|
|
130
|
-
requiresTokens: string[];
|
|
131
|
-
}[];
|
|
132
|
-
/** All tokens in the downstream dependency chain */
|
|
133
|
-
tokens: string[];
|
|
134
|
-
}
|
|
1
|
+
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-C2lOwquM.cjs';
|
|
2
|
+
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-C2lOwquM.cjs';
|
|
3
|
+
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-DAI_a2as.cjs';
|
|
4
|
+
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-DAI_a2as.cjs';
|
|
135
5
|
|
|
136
6
|
/**
|
|
137
7
|
* Continuous Event Graph — Core
|
|
@@ -306,4 +176,4 @@ declare function getUpstream(live: LiveGraph, nodeName: string): UpstreamResult;
|
|
|
306
176
|
*/
|
|
307
177
|
declare function getDownstream(live: LiveGraph, nodeName: string): DownstreamResult;
|
|
308
178
|
|
|
309
|
-
export {
|
|
179
|
+
export { DownstreamResult, GraphConfig, GraphEvent, LiveGraph, LiveGraphHealth, LiveGraphSnapshot, NodeInfo, ScheduleResult, TaskConfig, UnreachableNodesResult, UnreachableTokensResult, UpstreamResult, addNode, addProvides, addRequires, applyEvent, createLiveGraph, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, removeNode, removeProvides, removeRequires, resetNode, restore, schedule, snapshot };
|
|
@@ -1,137 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Continuous Event Graph — Types
|
|
6
|
-
*
|
|
7
|
-
* A long-lived, evolving event-graph where both config and state
|
|
8
|
-
* mutate over time. The single `LiveGraph` type bundles them.
|
|
9
|
-
*
|
|
10
|
-
* Events are shared with event-graph (task-started, task-completed, etc.).
|
|
11
|
-
* Graph mutations (addNode, removeNode, etc.) are unique to this mode.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The single evolving object for a continuous-mode graph.
|
|
16
|
-
* Bundles config + state so they can't get out of sync.
|
|
17
|
-
*/
|
|
18
|
-
interface LiveGraph {
|
|
19
|
-
/** The current graph configuration (evolves as nodes are added/removed) */
|
|
20
|
-
config: GraphConfig;
|
|
21
|
-
/** The current execution state (evolves as events arrive) */
|
|
22
|
-
state: ExecutionState;
|
|
23
|
-
}
|
|
24
|
-
interface ScheduleResult {
|
|
25
|
-
/** Tasks ready to dispatch now — all requires satisfied */
|
|
26
|
-
eligible: string[];
|
|
27
|
-
/** Tasks waiting on tokens that some producer will eventually provide (normal) */
|
|
28
|
-
pending: PendingTask[];
|
|
29
|
-
/** Tasks waiting on tokens that NO task can produce (caller's problem) */
|
|
30
|
-
unresolved: UnresolvedDependency[];
|
|
31
|
-
/** Tasks waiting on tokens whose producer FAILED (caller's problem) */
|
|
32
|
-
blocked: BlockedTask[];
|
|
33
|
-
/** Token conflicts: multiple tasks produce the same token */
|
|
34
|
-
conflicts: Record<string, string[]>;
|
|
35
|
-
}
|
|
36
|
-
interface PendingTask {
|
|
37
|
-
taskName: string;
|
|
38
|
-
/** Tokens this task needs that haven't been produced yet but have a viable producer */
|
|
39
|
-
waitingOn: string[];
|
|
40
|
-
}
|
|
41
|
-
interface UnresolvedDependency {
|
|
42
|
-
taskName: string;
|
|
43
|
-
/** Tokens this task needs that no task in the graph can produce */
|
|
44
|
-
missingTokens: string[];
|
|
45
|
-
}
|
|
46
|
-
interface BlockedTask {
|
|
47
|
-
taskName: string;
|
|
48
|
-
/** Tokens this task needs whose only producer has failed */
|
|
49
|
-
failedTokens: string[];
|
|
50
|
-
/** The tasks that failed and would have produced those tokens */
|
|
51
|
-
failedProducers: string[];
|
|
52
|
-
}
|
|
53
|
-
interface LiveGraphHealth {
|
|
54
|
-
/** Total number of tasks in the graph */
|
|
55
|
-
totalNodes: number;
|
|
56
|
-
/** Task counts by status */
|
|
57
|
-
running: number;
|
|
58
|
-
completed: number;
|
|
59
|
-
failed: number;
|
|
60
|
-
waiting: number;
|
|
61
|
-
notStarted: number;
|
|
62
|
-
/** Number of disabled (inactivated) nodes */
|
|
63
|
-
disabled: number;
|
|
64
|
-
/** Number of tasks with unresolvable dependencies */
|
|
65
|
-
unresolvedCount: number;
|
|
66
|
-
/** Number of tasks whose producer has failed */
|
|
67
|
-
blockedCount: number;
|
|
68
|
-
/** Tokens that no task produces (open dependencies) */
|
|
69
|
-
openDependencies: string[];
|
|
70
|
-
/** Cycles detected in the current graph (if any) */
|
|
71
|
-
cycles: string[][];
|
|
72
|
-
/** Tokens produced by multiple tasks */
|
|
73
|
-
conflictTokens: string[];
|
|
74
|
-
}
|
|
75
|
-
interface NodeInfo {
|
|
76
|
-
/** Node name */
|
|
77
|
-
name: string;
|
|
78
|
-
/** The task configuration */
|
|
79
|
-
config: TaskConfig;
|
|
80
|
-
/** The current runtime state */
|
|
81
|
-
state: TaskState;
|
|
82
|
-
}
|
|
83
|
-
interface LiveGraphSnapshot {
|
|
84
|
-
/** Schema version for forward compatibility */
|
|
85
|
-
version: number;
|
|
86
|
-
/** The graph config at snapshot time */
|
|
87
|
-
config: GraphConfig;
|
|
88
|
-
/** The execution state at snapshot time */
|
|
89
|
-
state: ExecutionState;
|
|
90
|
-
/** ISO timestamp of when the snapshot was taken */
|
|
91
|
-
snapshotAt: string;
|
|
92
|
-
}
|
|
93
|
-
interface UnreachableTokensResult {
|
|
94
|
-
tokens: {
|
|
95
|
-
/** The token that cannot be produced */
|
|
96
|
-
token: string;
|
|
97
|
-
/** Why it's unreachable */
|
|
98
|
-
reason: 'no-producer' | 'all-producers-failed' | 'transitive';
|
|
99
|
-
/** Tasks that could produce it (but are themselves unreachable/failed) */
|
|
100
|
-
producers: string[];
|
|
101
|
-
}[];
|
|
102
|
-
}
|
|
103
|
-
interface UnreachableNodesResult {
|
|
104
|
-
nodes: {
|
|
105
|
-
/** The node that can never become eligible */
|
|
106
|
-
nodeName: string;
|
|
107
|
-
/** Unreachable tokens this node requires (empty if the node itself is failed/disabled) */
|
|
108
|
-
missingTokens: string[];
|
|
109
|
-
}[];
|
|
110
|
-
}
|
|
111
|
-
interface UpstreamResult {
|
|
112
|
-
/** The target node being inspected */
|
|
113
|
-
nodeName: string;
|
|
114
|
-
/** All upstream nodes that transitively feed into the target */
|
|
115
|
-
nodes: {
|
|
116
|
-
nodeName: string;
|
|
117
|
-
/** Tokens this node provides that are in the dependency chain */
|
|
118
|
-
providesTokens: string[];
|
|
119
|
-
}[];
|
|
120
|
-
/** All tokens in the upstream dependency chain */
|
|
121
|
-
tokens: string[];
|
|
122
|
-
}
|
|
123
|
-
interface DownstreamResult {
|
|
124
|
-
/** The target node being inspected */
|
|
125
|
-
nodeName: string;
|
|
126
|
-
/** All downstream nodes that transitively depend on the target */
|
|
127
|
-
nodes: {
|
|
128
|
-
nodeName: string;
|
|
129
|
-
/** Tokens this node requires that are in the dependency chain */
|
|
130
|
-
requiresTokens: string[];
|
|
131
|
-
}[];
|
|
132
|
-
/** All tokens in the downstream dependency chain */
|
|
133
|
-
tokens: string[];
|
|
134
|
-
}
|
|
1
|
+
import { L as LiveGraph, N as NodeInfo, b as LiveGraphSnapshot, S as ScheduleResult, D as DownstreamResult, U as UnreachableNodesResult, c as UnreachableTokensResult, e as UpstreamResult, a as LiveGraphHealth } from '../types-mS_pPftm.js';
|
|
2
|
+
export { B as BlockedTask, P as PendingTask, d as UnresolvedDependency } from '../types-mS_pPftm.js';
|
|
3
|
+
import { T as TaskConfig, e as GraphEvent, G as GraphConfig } from '../types-DAI_a2as.js';
|
|
4
|
+
export { c as ExecutionState, f as GraphSettings, l as TaskState } from '../types-DAI_a2as.js';
|
|
135
5
|
|
|
136
6
|
/**
|
|
137
7
|
* Continuous Event Graph — Core
|
|
@@ -306,4 +176,4 @@ declare function getUpstream(live: LiveGraph, nodeName: string): UpstreamResult;
|
|
|
306
176
|
*/
|
|
307
177
|
declare function getDownstream(live: LiveGraph, nodeName: string): DownstreamResult;
|
|
308
178
|
|
|
309
|
-
export {
|
|
179
|
+
export { DownstreamResult, GraphConfig, GraphEvent, LiveGraph, LiveGraphHealth, LiveGraphSnapshot, NodeInfo, ScheduleResult, TaskConfig, UnreachableNodesResult, UnreachableTokensResult, UpstreamResult, addNode, addProvides, addRequires, applyEvent, createLiveGraph, disableNode, drainTokens, enableNode, getDownstream, getNode, getUnreachableNodes, getUnreachableTokens, getUpstream, injectTokens, inspect, removeNode, removeProvides, removeRequires, resetNode, restore, schedule, snapshot };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, G as GraphIssue, f as GraphValidationResult, I as IssueSeverity, M as MermaidOptions, T as TASK_STATUS, g as addDynamicTask, N as addKeyToProvides, O as addKeyToRequires, h as apply, i as applyAll, j as computeAvailableOutputs, k as createDefaultTaskState, l as createInitialExecutionState, m as detectStuckState, n as exportGraphConfig, o as exportGraphConfigToFile, p as flowToMermaid, q as getAllTasks, r as getCandidateTasks, s as getProvides, P as getRepeatableMax, t as getRequires, u as getTask, v as graphToMermaid, Q as groupTasksByProvides, R as hasOutputConflict, w as hasTask, x as isExecutionComplete, y as isNonActiveTask, z as isRepeatableTask, A as isTaskCompleted, B as isTaskRunning, F as loadGraphConfig, H as next, J as planExecution, S as removeKeyFromProvides, U as removeKeyFromRequires, K as validateGraph, L as validateGraphConfig } from '../constants-
|
|
2
|
-
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-
|
|
3
|
-
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEvent, f as GraphSettings, I as InjectTokensEvent, R as RepeatableConfig, S as SchedulerResult, g as StuckDetection, n as TaskCircuitBreakerConfig, h as TaskCompletedEvent, i as TaskCreationEvent, j as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRetryConfig, k as TaskStartedEvent, l as TaskState, m as TaskStatus } from '../types-
|
|
1
|
+
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, G as GraphIssue, f as GraphValidationResult, I as IssueSeverity, M as MermaidOptions, T as TASK_STATUS, g as addDynamicTask, N as addKeyToProvides, O as addKeyToRequires, h as apply, i as applyAll, j as computeAvailableOutputs, k as createDefaultTaskState, l as createInitialExecutionState, m as detectStuckState, n as exportGraphConfig, o as exportGraphConfigToFile, p as flowToMermaid, q as getAllTasks, r as getCandidateTasks, s as getProvides, P as getRepeatableMax, t as getRequires, u as getTask, v as graphToMermaid, Q as groupTasksByProvides, R as hasOutputConflict, w as hasTask, x as isExecutionComplete, y as isNonActiveTask, z as isRepeatableTask, A as isTaskCompleted, B as isTaskRunning, F as loadGraphConfig, H as next, J as planExecution, S as removeKeyFromProvides, U as removeKeyFromRequires, K as validateGraph, L as validateGraphConfig } from '../constants-BNjeIlZ8.cjs';
|
|
2
|
+
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-DAI_a2as.cjs';
|
|
3
|
+
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEvent, f as GraphSettings, I as InjectTokensEvent, R as RepeatableConfig, S as SchedulerResult, g as StuckDetection, n as TaskCircuitBreakerConfig, h as TaskCompletedEvent, i as TaskCreationEvent, j as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRetryConfig, k as TaskStartedEvent, l as TaskState, m as TaskStatus } from '../types-DAI_a2as.cjs';
|
|
4
4
|
import '../types-FZ_eyErS.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, G as GraphIssue, f as GraphValidationResult, I as IssueSeverity, M as MermaidOptions, T as TASK_STATUS, g as addDynamicTask, N as addKeyToProvides, O as addKeyToRequires, h as apply, i as applyAll, j as computeAvailableOutputs, k as createDefaultTaskState, l as createInitialExecutionState, m as detectStuckState, n as exportGraphConfig, o as exportGraphConfigToFile, p as flowToMermaid, q as getAllTasks, r as getCandidateTasks, s as getProvides, P as getRepeatableMax, t as getRequires, u as getTask, v as graphToMermaid, Q as groupTasksByProvides, R as hasOutputConflict, w as hasTask, x as isExecutionComplete, y as isNonActiveTask, z as isRepeatableTask, A as isTaskCompleted, B as isTaskRunning, F as loadGraphConfig, H as next, J as planExecution, S as removeKeyFromProvides, U as removeKeyFromRequires, K as validateGraph, L as validateGraphConfig } from '../constants-
|
|
2
|
-
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-
|
|
3
|
-
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEvent, f as GraphSettings, I as InjectTokensEvent, R as RepeatableConfig, S as SchedulerResult, g as StuckDetection, n as TaskCircuitBreakerConfig, h as TaskCompletedEvent, i as TaskCreationEvent, j as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRetryConfig, k as TaskStartedEvent, l as TaskState, m as TaskStatus } from '../types-
|
|
1
|
+
export { C as COMPLETION_STRATEGIES, a as CONFLICT_STRATEGIES, b as CompletionResult, D as DEFAULTS, E as EXECUTION_MODES, c as EXECUTION_STATUS, d as ExecutionPlan, e as ExportOptions, G as GraphIssue, f as GraphValidationResult, I as IssueSeverity, M as MermaidOptions, T as TASK_STATUS, g as addDynamicTask, N as addKeyToProvides, O as addKeyToRequires, h as apply, i as applyAll, j as computeAvailableOutputs, k as createDefaultTaskState, l as createInitialExecutionState, m as detectStuckState, n as exportGraphConfig, o as exportGraphConfigToFile, p as flowToMermaid, q as getAllTasks, r as getCandidateTasks, s as getProvides, P as getRepeatableMax, t as getRequires, u as getTask, v as graphToMermaid, Q as groupTasksByProvides, R as hasOutputConflict, w as hasTask, x as isExecutionComplete, y as isNonActiveTask, z as isRepeatableTask, A as isTaskCompleted, B as isTaskRunning, F as loadGraphConfig, H as next, J as planExecution, S as removeKeyFromProvides, U as removeKeyFromRequires, K as validateGraph, L as validateGraphConfig } from '../constants-BEbO2_OK.js';
|
|
2
|
+
import { T as TaskConfig, c as ExecutionState, a as ConflictStrategy, G as GraphConfig } from '../types-DAI_a2as.js';
|
|
3
|
+
export { A as AgentActionEvent, C as CompletionStrategy, E as ExecutionConfig, b as ExecutionMode, d as ExecutionStatus, e as GraphEvent, f as GraphSettings, I as InjectTokensEvent, R as RepeatableConfig, S as SchedulerResult, g as StuckDetection, n as TaskCircuitBreakerConfig, h as TaskCompletedEvent, i as TaskCreationEvent, j as TaskFailedEvent, o as TaskMessage, p as TaskProgressEvent, q as TaskRetryConfig, k as TaskStartedEvent, l as TaskState, m as TaskStatus } from '../types-DAI_a2as.js';
|
|
4
4
|
import '../types-FZ_eyErS.js';
|
|
5
5
|
|
|
6
6
|
/**
|