@barnum/barnum 0.2.0 → 0.2.2
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"title": "ConfigFile",
|
|
4
|
-
"description": "Top-level Barnum configuration file format.\n\
|
|
4
|
+
"description": "Top-level Barnum configuration file format.\n\nDefines a workflow as a directed graph of steps. Each step processes tasks and can spawn follow-up tasks on other steps.",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"required": [
|
|
7
7
|
"steps"
|
|
8
8
|
],
|
|
9
9
|
"properties": {
|
|
10
10
|
"$schema": {
|
|
11
|
-
"description": "JSON Schema
|
|
11
|
+
"description": "Optional JSON Schema URL for editor validation (e.g., `\"./node_modules/@barnum/barnum/barnum-config-schema.json\"`). Ignored at runtime.",
|
|
12
12
|
"writeOnly": true,
|
|
13
13
|
"type": [
|
|
14
14
|
"string",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"entrypoint": {
|
|
19
|
-
"description": "
|
|
19
|
+
"description": "Name of the step that starts the workflow. When set, the CLI accepts `--entrypoint-value` to provide the initial task value (defaults to `{}`). When omitted, `--initial-state` must provide explicit `[{\"kind\": \"StepName\", \"value\": ...}]` tasks.",
|
|
20
20
|
"default": null,
|
|
21
21
|
"type": [
|
|
22
22
|
"string",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"options": {
|
|
27
|
-
"description": "
|
|
27
|
+
"description": "Global runtime options (timeout, retries, concurrency). Individual steps can override these via their own `options` field.",
|
|
28
28
|
"default": {
|
|
29
29
|
"max_concurrency": null,
|
|
30
30
|
"max_retries": 0,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"steps": {
|
|
42
|
-
"description": "
|
|
42
|
+
"description": "The steps that make up this workflow. Each step defines how to process a task and which steps it can spawn follow-up tasks on.",
|
|
43
43
|
"type": "array",
|
|
44
44
|
"items": {
|
|
45
45
|
"$ref": "#/definitions/StepFile"
|
|
@@ -49,20 +49,18 @@
|
|
|
49
49
|
"additionalProperties": false,
|
|
50
50
|
"definitions": {
|
|
51
51
|
"ActionFile": {
|
|
52
|
-
"description": "How a step processes tasks
|
|
52
|
+
"description": "How a step processes tasks. Set `\"kind\": \"Pool\"` to send tasks to AI agents, or `\"kind\": \"Command\"` to run a local shell script.",
|
|
53
53
|
"oneOf": [
|
|
54
54
|
{
|
|
55
|
-
"description": "Send to the agent pool
|
|
55
|
+
"description": "Send the task to the agent pool. An AI agent receives the task's `value` along with the `instructions` (markdown prompt) and produces a JSON array of follow-up tasks.",
|
|
56
56
|
"type": "object",
|
|
57
57
|
"required": [
|
|
58
|
+
"instructions",
|
|
58
59
|
"kind"
|
|
59
60
|
],
|
|
60
61
|
"properties": {
|
|
61
62
|
"instructions": {
|
|
62
|
-
"description": "Markdown
|
|
63
|
-
"default": {
|
|
64
|
-
"inline": ""
|
|
65
|
-
},
|
|
63
|
+
"description": "Markdown prompt shown to the agent processing this task. This is the core of what tells the agent what to do. Use `{\"inline\": \"...\"}` to write the markdown directly, or `{\"link\": \"path/to/file.md\"}` to reference an external file.",
|
|
66
64
|
"allOf": [
|
|
67
65
|
{
|
|
68
66
|
"$ref": "#/definitions/MaybeLinked_for_String"
|
|
@@ -78,7 +76,7 @@
|
|
|
78
76
|
}
|
|
79
77
|
},
|
|
80
78
|
{
|
|
81
|
-
"description": "Run a local command.",
|
|
79
|
+
"description": "Run a local shell command instead of sending to an agent. Use this for deterministic transformations, fan-out, or glue logic.",
|
|
82
80
|
"type": "object",
|
|
83
81
|
"required": [
|
|
84
82
|
"kind",
|
|
@@ -92,7 +90,32 @@
|
|
|
92
90
|
]
|
|
93
91
|
},
|
|
94
92
|
"script": {
|
|
95
|
-
"description": "Shell script to execute.\n\n**Input (stdin):** JSON object
|
|
93
|
+
"description": "Shell script to execute.\n\n**Input (stdin):** JSON object: `{\"kind\": \"<step name>\", \"value\": <payload>}`. Use `jq '.value'` to extract the payload, or `jq -r '.value.fieldName'` for a specific field.\n\n**Output (stdout):** JSON array of follow-up tasks to spawn: `[{\"kind\": \"NextStep\", \"value\": {...}}, ...]`. Each `kind` must be a step name listed in this step's `next` array. Return `[]` to spawn no follow-ups.",
|
|
94
|
+
"type": "string"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"FinallyHook": {
|
|
101
|
+
"description": "Finally hook. Runs after a task and all its descendants complete.\n\nIn JSON: `{\"kind\": \"Command\", \"script\": \"./finally-hook.sh\"}`\n\n**stdin:** The task's original value payload as JSON. **stdout:** JSON array of follow-up tasks: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Return `[]` for no follow-ups.",
|
|
102
|
+
"oneOf": [
|
|
103
|
+
{
|
|
104
|
+
"description": "Run a shell command as the finally hook.",
|
|
105
|
+
"type": "object",
|
|
106
|
+
"required": [
|
|
107
|
+
"kind",
|
|
108
|
+
"script"
|
|
109
|
+
],
|
|
110
|
+
"properties": {
|
|
111
|
+
"kind": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"enum": [
|
|
114
|
+
"Command"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"script": {
|
|
118
|
+
"description": "Shell script to execute. Receives the task's original value as JSON on stdin, must write a JSON array of follow-up tasks on stdout.",
|
|
96
119
|
"type": "string"
|
|
97
120
|
}
|
|
98
121
|
}
|
|
@@ -100,7 +123,7 @@
|
|
|
100
123
|
]
|
|
101
124
|
},
|
|
102
125
|
"MaybeLinked_for_String": {
|
|
103
|
-
"description": "Content that can be inline or linked to a file.\n\nIn config files: - `{\"inline\": <value>}` →
|
|
126
|
+
"description": "Content that can be inline or linked to a file.\n\nIn config files: - `{\"inline\": <value>}` → content provided directly in the config - `{\"link\": \"path\"}` → content loaded from a file (path relative to the config file)",
|
|
104
127
|
"anyOf": [
|
|
105
128
|
{
|
|
106
129
|
"description": "Inline content.",
|
|
@@ -110,20 +133,20 @@
|
|
|
110
133
|
],
|
|
111
134
|
"properties": {
|
|
112
135
|
"inline": {
|
|
113
|
-
"description": "The
|
|
136
|
+
"description": "The content value, provided directly in the config file.",
|
|
114
137
|
"type": "string"
|
|
115
138
|
}
|
|
116
139
|
}
|
|
117
140
|
},
|
|
118
141
|
{
|
|
119
|
-
"description": "Link to a file.",
|
|
142
|
+
"description": "Link to a file whose contents will be loaded at runtime.",
|
|
120
143
|
"type": "object",
|
|
121
144
|
"required": [
|
|
122
145
|
"link"
|
|
123
146
|
],
|
|
124
147
|
"properties": {
|
|
125
148
|
"link": {
|
|
126
|
-
"description": "
|
|
149
|
+
"description": "Relative path to the file (resolved relative to the config file's directory).",
|
|
127
150
|
"type": "string"
|
|
128
151
|
}
|
|
129
152
|
}
|
|
@@ -131,7 +154,7 @@
|
|
|
131
154
|
]
|
|
132
155
|
},
|
|
133
156
|
"Options": {
|
|
134
|
-
"description": "
|
|
157
|
+
"description": "Global runtime options for task execution. All fields have sensible defaults.",
|
|
135
158
|
"type": "object",
|
|
136
159
|
"properties": {
|
|
137
160
|
"max_concurrency": {
|
|
@@ -174,42 +197,87 @@
|
|
|
174
197
|
},
|
|
175
198
|
"additionalProperties": false
|
|
176
199
|
},
|
|
200
|
+
"PostHook": {
|
|
201
|
+
"description": "Post-action hook. Inspects or modifies the action's outcome.\n\nIn JSON: `{\"kind\": \"Command\", \"script\": \"./post-hook.sh\"}`\n\n**stdin:** Tagged JSON describing the outcome (`\"kind\": \"Success\"`, `\"Timeout\"`, `\"Error\"`, or `\"PreHookError\"`). On success, includes an `input`, `output`, and `next` (follow-up tasks) field. **stdout:** Same tagged JSON, possibly modified (e.g., filtering `next`).",
|
|
202
|
+
"oneOf": [
|
|
203
|
+
{
|
|
204
|
+
"description": "Run a shell command as the post hook.",
|
|
205
|
+
"type": "object",
|
|
206
|
+
"required": [
|
|
207
|
+
"kind",
|
|
208
|
+
"script"
|
|
209
|
+
],
|
|
210
|
+
"properties": {
|
|
211
|
+
"kind": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"enum": [
|
|
214
|
+
"Command"
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
"script": {
|
|
218
|
+
"description": "Shell script to execute. Receives the action outcome as JSON on stdin, must write the (possibly modified) outcome as JSON on stdout.",
|
|
219
|
+
"type": "string"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"PreHook": {
|
|
226
|
+
"description": "Pre-action hook. Transforms the task value before the action runs.\n\nIn JSON: `{\"kind\": \"Command\", \"script\": \"./pre-hook.sh\"}`\n\n**stdin:** Task value payload (e.g., `{\"path\": \"/src\"}`). **stdout:** Modified value payload (same shape).",
|
|
227
|
+
"oneOf": [
|
|
228
|
+
{
|
|
229
|
+
"description": "Run a shell command as the pre hook.",
|
|
230
|
+
"type": "object",
|
|
231
|
+
"required": [
|
|
232
|
+
"kind",
|
|
233
|
+
"script"
|
|
234
|
+
],
|
|
235
|
+
"properties": {
|
|
236
|
+
"kind": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"enum": [
|
|
239
|
+
"Command"
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"script": {
|
|
243
|
+
"description": "Shell script to execute. Receives the task's value as JSON on stdin, must write the (possibly modified) value as JSON on stdout.",
|
|
244
|
+
"type": "string"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
]
|
|
249
|
+
},
|
|
177
250
|
"SchemaRef": {
|
|
178
|
-
"description": "
|
|
251
|
+
"description": "A JSON Schema for validating task payloads. Can be provided inline or loaded from a file.\n\n- Inline: write the JSON Schema object directly, e.g. `{\"type\": \"object\", \"properties\": {...}}` - Linked: `{\"link\": \"path/to/schema.json\"}` to reference an external file (path relative to config file)",
|
|
179
252
|
"anyOf": [
|
|
180
253
|
{
|
|
181
|
-
"description": "
|
|
254
|
+
"description": "Reference to an external JSON Schema file. The path is relative to the config file's directory.",
|
|
182
255
|
"type": "object",
|
|
183
256
|
"required": [
|
|
184
257
|
"link"
|
|
185
258
|
],
|
|
186
259
|
"properties": {
|
|
187
260
|
"link": {
|
|
188
|
-
"description": "
|
|
261
|
+
"description": "Relative path to the JSON Schema file (e.g., `\"schemas/task.json\"`).",
|
|
189
262
|
"type": "string"
|
|
190
263
|
}
|
|
191
264
|
}
|
|
192
265
|
},
|
|
193
266
|
{
|
|
194
|
-
"description": "Inline JSON Schema."
|
|
267
|
+
"description": "Inline JSON Schema object (any valid JSON Schema)."
|
|
195
268
|
}
|
|
196
269
|
]
|
|
197
270
|
},
|
|
198
271
|
"StepFile": {
|
|
199
|
-
"description": "A step in the
|
|
272
|
+
"description": "A named step in the workflow. Steps are the nodes of the task graph.\n\nExecution order for each task: `pre` hook → `action` → `post` hook. The `finally` hook runs after the task **and all of its descendant tasks** complete.",
|
|
200
273
|
"type": "object",
|
|
201
274
|
"required": [
|
|
275
|
+
"action",
|
|
202
276
|
"name"
|
|
203
277
|
],
|
|
204
278
|
"properties": {
|
|
205
279
|
"action": {
|
|
206
|
-
"description": "How to
|
|
207
|
-
"default": {
|
|
208
|
-
"instructions": {
|
|
209
|
-
"inline": ""
|
|
210
|
-
},
|
|
211
|
-
"kind": "Pool"
|
|
212
|
-
},
|
|
280
|
+
"description": "How this step processes tasks — either send to the agent pool (`Pool`) or run a local shell command (`Command`).",
|
|
213
281
|
"allOf": [
|
|
214
282
|
{
|
|
215
283
|
"$ref": "#/definitions/ActionFile"
|
|
@@ -217,19 +285,23 @@
|
|
|
217
285
|
]
|
|
218
286
|
},
|
|
219
287
|
"finally": {
|
|
220
|
-
"description": "
|
|
288
|
+
"description": "Shell script that runs after this task **and all tasks it spawned (recursively)** have completed.\n\n**stdin:** The task's original `value` payload as JSON (same as what the pre hook received — just the value, not the full task wrapper).\n\n**stdout:** A JSON array of follow-up tasks to spawn: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Each `kind` must be a valid step name. Return `[]` to spawn no follow-ups.\n\nUse this for cleanup, aggregation, or spawning a final summarization step after an entire subtree of work completes.",
|
|
221
289
|
"default": null,
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
290
|
+
"anyOf": [
|
|
291
|
+
{
|
|
292
|
+
"$ref": "#/definitions/FinallyHook"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"type": "null"
|
|
296
|
+
}
|
|
225
297
|
]
|
|
226
298
|
},
|
|
227
299
|
"name": {
|
|
228
|
-
"description": "
|
|
300
|
+
"description": "Unique name for this step (e.g., `\"Analyze\"`, `\"Implement\"`, `\"Review\"`). This is the string used as `kind` when creating tasks: `{\"kind\": \"ThisStepName\", \"value\": {...}}`.",
|
|
229
301
|
"type": "string"
|
|
230
302
|
},
|
|
231
303
|
"next": {
|
|
232
|
-
"description": "
|
|
304
|
+
"description": "Step names this step is allowed to spawn follow-up tasks on. Each string must match the `name` of another step in this config. An empty array means this is a terminal step (no follow-ups).",
|
|
233
305
|
"default": [],
|
|
234
306
|
"type": "array",
|
|
235
307
|
"items": {
|
|
@@ -237,7 +309,7 @@
|
|
|
237
309
|
}
|
|
238
310
|
},
|
|
239
311
|
"options": {
|
|
240
|
-
"description": "Per-step options that override global options.",
|
|
312
|
+
"description": "Per-step options that override the global `options`. Only the fields you set here take effect; everything else falls through to the global defaults.",
|
|
241
313
|
"default": {
|
|
242
314
|
"max_retries": null,
|
|
243
315
|
"retry_on_invalid_response": null,
|
|
@@ -251,23 +323,31 @@
|
|
|
251
323
|
]
|
|
252
324
|
},
|
|
253
325
|
"post": {
|
|
254
|
-
"description": "
|
|
326
|
+
"description": "Shell script that runs **after** the action completes (or fails).\n\n**stdin:** A tagged JSON object describing the outcome. The `kind` field indicates what happened:\n\n- `{\"kind\": \"Success\", \"input\": <value>, \"output\": <agent_output>, \"next\": [<tasks>]}` — Action succeeded. `next` contains the follow-up tasks to spawn. - `{\"kind\": \"Timeout\", \"input\": <value>}` — Action timed out. - `{\"kind\": \"Error\", \"input\": <value>, \"error\": \"<message>\"}` — Action failed. - `{\"kind\": \"PreHookError\", \"input\": <value>, \"error\": \"<message>\"}` — Pre hook failed.\n\n**stdout:** The same tagged JSON object, possibly modified. Typically you modify the `next` array in `Success` to filter, rewrite, or add follow-up tasks.",
|
|
255
327
|
"default": null,
|
|
256
|
-
"
|
|
257
|
-
|
|
258
|
-
|
|
328
|
+
"anyOf": [
|
|
329
|
+
{
|
|
330
|
+
"$ref": "#/definitions/PostHook"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"type": "null"
|
|
334
|
+
}
|
|
259
335
|
]
|
|
260
336
|
},
|
|
261
337
|
"pre": {
|
|
262
|
-
"description": "
|
|
338
|
+
"description": "Shell script that runs **before** the action.\n\n**stdin:** The task's `value` payload as JSON (e.g., `{\"path\": \"/src\"}`). This is just the value — not the full `{\"kind\": ..., \"value\": ...}` wrapper.\n\n**stdout:** The (possibly modified) value payload as JSON. Must be the same shape. The modified value is what the action receives.\n\nUse this to enrich or transform the task before the action sees it (e.g., adding timestamps, resolving paths, fetching metadata).",
|
|
263
339
|
"default": null,
|
|
264
|
-
"
|
|
265
|
-
|
|
266
|
-
|
|
340
|
+
"anyOf": [
|
|
341
|
+
{
|
|
342
|
+
"$ref": "#/definitions/PreHook"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"type": "null"
|
|
346
|
+
}
|
|
267
347
|
]
|
|
268
348
|
},
|
|
269
349
|
"value_schema": {
|
|
270
|
-
"description": "JSON Schema
|
|
350
|
+
"description": "JSON Schema that validates the `value` payload for tasks on this step. When set, tasks whose `value` doesn't conform are rejected. When omitted, any JSON value is accepted.",
|
|
271
351
|
"default": null,
|
|
272
352
|
"anyOf": [
|
|
273
353
|
{
|
|
@@ -282,11 +362,11 @@
|
|
|
282
362
|
"additionalProperties": false
|
|
283
363
|
},
|
|
284
364
|
"StepOptions": {
|
|
285
|
-
"description": "Per-step
|
|
365
|
+
"description": "Per-step option overrides. Only set the fields you want to override; omitted fields inherit from the global `options`.",
|
|
286
366
|
"type": "object",
|
|
287
367
|
"properties": {
|
|
288
368
|
"max_retries": {
|
|
289
|
-
"description": "Maximum retries for this step (overrides global).",
|
|
369
|
+
"description": "Maximum retries for tasks on this step (overrides global `max_retries`).",
|
|
290
370
|
"default": null,
|
|
291
371
|
"type": [
|
|
292
372
|
"integer",
|
|
@@ -296,7 +376,7 @@
|
|
|
296
376
|
"minimum": 0.0
|
|
297
377
|
},
|
|
298
378
|
"retry_on_invalid_response": {
|
|
299
|
-
"description": "Whether to retry
|
|
379
|
+
"description": "Whether to retry when an agent returns an invalid response on this step (overrides global `retry_on_invalid_response`).",
|
|
300
380
|
"default": null,
|
|
301
381
|
"type": [
|
|
302
382
|
"boolean",
|
|
@@ -304,7 +384,7 @@
|
|
|
304
384
|
]
|
|
305
385
|
},
|
|
306
386
|
"retry_on_timeout": {
|
|
307
|
-
"description": "Whether to retry
|
|
387
|
+
"description": "Whether to retry when an agent times out on this step (overrides global `retry_on_timeout`).",
|
|
308
388
|
"default": null,
|
|
309
389
|
"type": [
|
|
310
390
|
"boolean",
|
|
@@ -312,7 +392,7 @@
|
|
|
312
392
|
]
|
|
313
393
|
},
|
|
314
394
|
"timeout": {
|
|
315
|
-
"description": "Timeout in seconds for this step (overrides global).",
|
|
395
|
+
"description": "Timeout in seconds for tasks on this step (overrides global `timeout`).",
|
|
316
396
|
"default": null,
|
|
317
397
|
"type": [
|
|
318
398
|
"integer",
|