@barnum/barnum 0.0.0-main-1b7a5ffd → 0.0.0-main-c9d44943
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/artifacts/linux-arm64/barnum +0 -0
- package/artifacts/linux-x64/barnum +0 -0
- package/artifacts/macos-arm64/barnum +0 -0
- package/artifacts/macos-x64/barnum +0 -0
- package/artifacts/win-x64/barnum.exe +0 -0
- package/barnum-cli-schema.zod.ts +0 -2
- package/barnum-config-schema.json +81 -19
- package/barnum-config-schema.zod.ts +22 -4
- package/package.json +1 -1
- package/run.ts +0 -4
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/barnum-cli-schema.zod.ts
CHANGED
|
@@ -31,7 +31,6 @@ const Command = z.discriminatedUnion("kind", [
|
|
|
31
31
|
initialState: z.string().nullable().optional().describe("Initial tasks (JSON string or path to file). Required if config has no `entrypoint`. Cannot be used with `--entrypoint-value`."),
|
|
32
32
|
kind: z.literal("Run"),
|
|
33
33
|
logFile: z.string().nullable().optional().describe("Log file path (logs emitted in addition to stderr)"),
|
|
34
|
-
pool: z.string().nullable().optional().describe("Agent pool ID (e.g., `abc123` resolves to `<root>/pools/abc123/`). Defaults to `default`."),
|
|
35
34
|
resumeFrom: z.string().nullable().optional().describe("Resume from a previous state log file. Incompatible with `--config`, `--initial-state`, and `--entrypoint-value`."),
|
|
36
35
|
stateLog: z.string().nullable().optional().describe("State log file path (NDJSON file for persistence/resume)"),
|
|
37
36
|
wake: z.string().nullable().optional().describe("Wake script to call before starting"),
|
|
@@ -58,7 +57,6 @@ const LogLevel = z.union([
|
|
|
58
57
|
export const cliSchema = z.object({
|
|
59
58
|
command: Command.describe("Subcommand to run."),
|
|
60
59
|
logLevel: LogLevel.describe("Log level (debug shows task return values)"),
|
|
61
|
-
root: z.string().nullable().optional().describe("Root directory. Pools live in `<root>/pools/<id>/`. Defaults to `/tmp/troupe` on Unix."),
|
|
62
60
|
}).describe("Top-level CLI arguments for barnum.");
|
|
63
61
|
|
|
64
62
|
export type Cli = z.infer<typeof cliSchema>;
|
|
@@ -55,23 +55,18 @@
|
|
|
55
55
|
"description": "Send the task to the agent pool for processing.",
|
|
56
56
|
"type": "object",
|
|
57
57
|
"required": [
|
|
58
|
-
"
|
|
59
|
-
"
|
|
58
|
+
"kind",
|
|
59
|
+
"params"
|
|
60
60
|
],
|
|
61
61
|
"properties": {
|
|
62
|
-
"instructions": {
|
|
63
|
-
"description": "Markdown prompt shown to the agent processing this task. This is the core of what tells the agent what to do. Use `{\"kind\": \"Inline\", \"value\": \"...\"}` to write the markdown directly, or `{\"kind\": \"Link\", \"path\": \"path/to/file.md\"}` to reference an external file.",
|
|
64
|
-
"allOf": [
|
|
65
|
-
{
|
|
66
|
-
"$ref": "#/definitions/MaybeLinked_for_String"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
62
|
"kind": {
|
|
71
63
|
"type": "string",
|
|
72
64
|
"enum": [
|
|
73
65
|
"Pool"
|
|
74
66
|
]
|
|
67
|
+
},
|
|
68
|
+
"params": {
|
|
69
|
+
"$ref": "#/definitions/PoolActionFile"
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
72
|
},
|
|
@@ -80,7 +75,7 @@
|
|
|
80
75
|
"type": "object",
|
|
81
76
|
"required": [
|
|
82
77
|
"kind",
|
|
83
|
-
"
|
|
78
|
+
"params"
|
|
84
79
|
],
|
|
85
80
|
"properties": {
|
|
86
81
|
"kind": {
|
|
@@ -89,23 +84,35 @@
|
|
|
89
84
|
"Command"
|
|
90
85
|
]
|
|
91
86
|
},
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"type": "string"
|
|
87
|
+
"params": {
|
|
88
|
+
"$ref": "#/definitions/CommandActionFile"
|
|
95
89
|
}
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
92
|
]
|
|
99
93
|
},
|
|
94
|
+
"CommandActionFile": {
|
|
95
|
+
"description": "Run a local shell command instead of sending to an agent. Use this for deterministic transformations, fan-out, or glue logic.",
|
|
96
|
+
"type": "object",
|
|
97
|
+
"required": [
|
|
98
|
+
"script"
|
|
99
|
+
],
|
|
100
|
+
"properties": {
|
|
101
|
+
"script": {
|
|
102
|
+
"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.",
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
100
107
|
"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:** JSON object: `{\"kind\": \"<step name>\", \"value\": <payload>}`. **stdout:** JSON array of follow-up tasks: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Return `[]` for no follow-ups.",
|
|
108
|
+
"description": "Finally hook. Runs after a task and all its descendants complete.\n\nIn JSON: `{\"kind\": \"Command\", \"params\": {\"script\": \"./finally-hook.sh\"}}`\n\n**stdin:** JSON object: `{\"kind\": \"<step name>\", \"value\": <payload>}`. **stdout:** JSON array of follow-up tasks: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Return `[]` for no follow-ups.",
|
|
102
109
|
"oneOf": [
|
|
103
110
|
{
|
|
104
111
|
"description": "Run a shell command as the finally hook.",
|
|
105
112
|
"type": "object",
|
|
106
113
|
"required": [
|
|
107
114
|
"kind",
|
|
108
|
-
"
|
|
115
|
+
"params"
|
|
109
116
|
],
|
|
110
117
|
"properties": {
|
|
111
118
|
"kind": {
|
|
@@ -114,14 +121,26 @@
|
|
|
114
121
|
"Command"
|
|
115
122
|
]
|
|
116
123
|
},
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"type": "string"
|
|
124
|
+
"params": {
|
|
125
|
+
"$ref": "#/definitions/HookCommand"
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
}
|
|
123
129
|
]
|
|
124
130
|
},
|
|
131
|
+
"HookCommand": {
|
|
132
|
+
"description": "A shell command used as a hook.",
|
|
133
|
+
"type": "object",
|
|
134
|
+
"required": [
|
|
135
|
+
"script"
|
|
136
|
+
],
|
|
137
|
+
"properties": {
|
|
138
|
+
"script": {
|
|
139
|
+
"description": "Shell script to execute.",
|
|
140
|
+
"type": "string"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
125
144
|
"MaybeLinked_for_String": {
|
|
126
145
|
"description": "Content that can be inline or linked to a file.\n\nIn config files: - `{\"kind\": \"Inline\", \"value\": <content>}` → content provided directly in the config - `{\"kind\": \"Link\", \"path\": \"file.md\"}` → content loaded from a file (path relative to the config file)",
|
|
127
146
|
"oneOf": [
|
|
@@ -211,6 +230,49 @@
|
|
|
211
230
|
},
|
|
212
231
|
"additionalProperties": false
|
|
213
232
|
},
|
|
233
|
+
"PoolActionFile": {
|
|
234
|
+
"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.",
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": [
|
|
237
|
+
"instructions"
|
|
238
|
+
],
|
|
239
|
+
"properties": {
|
|
240
|
+
"instructions": {
|
|
241
|
+
"description": "Markdown prompt shown to the agent processing this task. This is the core of what tells the agent what to do. Use `{\"kind\": \"Inline\", \"value\": \"...\"}` to write the markdown directly, or `{\"kind\": \"Link\", \"path\": \"path/to/file.md\"}` to reference an external file.",
|
|
242
|
+
"allOf": [
|
|
243
|
+
{
|
|
244
|
+
"$ref": "#/definitions/MaybeLinked_for_String"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
"pool": {
|
|
249
|
+
"description": "Pool name (e.g., `\"demo\"`, `\"reviewers\"`). If omitted, the pool infrastructure uses its own default.",
|
|
250
|
+
"default": null,
|
|
251
|
+
"type": [
|
|
252
|
+
"string",
|
|
253
|
+
"null"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"root": {
|
|
257
|
+
"description": "Pool root directory. If omitted, the pool infrastructure uses its own default.",
|
|
258
|
+
"default": null,
|
|
259
|
+
"type": [
|
|
260
|
+
"string",
|
|
261
|
+
"null"
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
"timeout": {
|
|
265
|
+
"description": "Agent timeout in seconds. Passed to the pool as `timeout_seconds` in the task payload. Controls how long the agent gets to work. Separate from the step-level `timeout` which controls barnum's worker timeout.",
|
|
266
|
+
"default": null,
|
|
267
|
+
"type": [
|
|
268
|
+
"integer",
|
|
269
|
+
"null"
|
|
270
|
+
],
|
|
271
|
+
"format": "uint64",
|
|
272
|
+
"minimum": 0.0
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
214
276
|
"SchemaLink": {
|
|
215
277
|
"description": "Reference to an external JSON Schema file.",
|
|
216
278
|
"type": "object",
|
|
@@ -11,23 +11,38 @@ const MaybeLinked_for_String = z.discriminatedUnion("kind", [
|
|
|
11
11
|
}).describe("Link to a file whose contents will be loaded at runtime."),
|
|
12
12
|
]).describe("Content that can be inline or linked to a file.\n\nIn config files: - `{\"kind\": \"Inline\", \"value\": <content>}` → content provided directly in the config - `{\"kind\": \"Link\", \"path\": \"file.md\"}` → content loaded from a file (path relative to the config file)");
|
|
13
13
|
|
|
14
|
+
const PoolActionFile = z.object({
|
|
15
|
+
instructions: MaybeLinked_for_String.describe("Markdown prompt shown to the agent processing this task. This is the core of what tells the agent what to do. Use `{\"kind\": \"Inline\", \"value\": \"...\"}` to write the markdown directly, or `{\"kind\": \"Link\", \"path\": \"path/to/file.md\"}` to reference an external file."),
|
|
16
|
+
pool: z.string().nullable().optional().default(null).describe("Pool name (e.g., `\"demo\"`, `\"reviewers\"`). If omitted, the pool infrastructure uses its own default."),
|
|
17
|
+
root: z.string().nullable().optional().default(null).describe("Pool root directory. If omitted, the pool infrastructure uses its own default."),
|
|
18
|
+
timeout: z.number().int().nonnegative().nullable().optional().default(null).describe("Agent timeout in seconds. Passed to the pool as `timeout_seconds` in the task payload. Controls how long the agent gets to work. Separate from the step-level `timeout` which controls barnum's worker timeout."),
|
|
19
|
+
}).describe("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.");
|
|
20
|
+
|
|
21
|
+
const CommandActionFile = z.object({
|
|
22
|
+
script: z.string().describe("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."),
|
|
23
|
+
}).describe("Run a local shell command instead of sending to an agent. Use this for deterministic transformations, fan-out, or glue logic.");
|
|
24
|
+
|
|
14
25
|
const ActionFile = z.discriminatedUnion("kind", [
|
|
15
26
|
z.object({
|
|
16
|
-
instructions: MaybeLinked_for_String.describe("Markdown prompt shown to the agent processing this task. This is the core of what tells the agent what to do. Use `{\"kind\": \"Inline\", \"value\": \"...\"}` to write the markdown directly, or `{\"kind\": \"Link\", \"path\": \"path/to/file.md\"}` to reference an external file."),
|
|
17
27
|
kind: z.literal("Pool"),
|
|
28
|
+
params: PoolActionFile,
|
|
18
29
|
}).describe("Send the task to the agent pool for processing."),
|
|
19
30
|
z.object({
|
|
20
31
|
kind: z.literal("Command"),
|
|
21
|
-
|
|
32
|
+
params: CommandActionFile,
|
|
22
33
|
}).describe("Run a local shell command."),
|
|
23
34
|
]).describe("How a step processes tasks. Set `\"kind\": \"Pool\"` to send tasks to AI agents, or `\"kind\": \"Command\"` to run a local shell script.");
|
|
24
35
|
|
|
36
|
+
const HookCommand = z.object({
|
|
37
|
+
script: z.string().describe("Shell script to execute."),
|
|
38
|
+
}).describe("A shell command used as a hook.");
|
|
39
|
+
|
|
25
40
|
const FinallyHook = z.discriminatedUnion("kind", [
|
|
26
41
|
z.object({
|
|
27
42
|
kind: z.literal("Command"),
|
|
28
|
-
|
|
43
|
+
params: HookCommand,
|
|
29
44
|
}).describe("Run a shell command as the finally hook."),
|
|
30
|
-
]).describe("Finally hook. Runs after a task and all its descendants complete.\n\nIn JSON: `{\"kind\": \"Command\", \"script\": \"./finally-hook.sh\"}`\n\n**stdin:** JSON object: `{\"kind\": \"<step name>\", \"value\": <payload>}`. **stdout:** JSON array of follow-up tasks: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Return `[]` for no follow-ups.");
|
|
45
|
+
]).describe("Finally hook. Runs after a task and all its descendants complete.\n\nIn JSON: `{\"kind\": \"Command\", \"params\": {\"script\": \"./finally-hook.sh\"}}`\n\n**stdin:** JSON object: `{\"kind\": \"<step name>\", \"value\": <payload>}`. **stdout:** JSON array of follow-up tasks: `[{\"kind\": \"StepName\", \"value\": {...}}, ...]`. Return `[]` for no follow-ups.");
|
|
31
46
|
|
|
32
47
|
const Options = z.object({
|
|
33
48
|
max_concurrency: z.number().int().nonnegative().nullable().optional().default(null).describe("Maximum concurrent tasks (None = unlimited)."),
|
|
@@ -71,7 +86,10 @@ export const configFileSchema = z.object({
|
|
|
71
86
|
|
|
72
87
|
export type ConfigFile = z.infer<typeof configFileSchema>;
|
|
73
88
|
export type MaybeLinked_for_String = z.infer<typeof MaybeLinked_for_String>;
|
|
89
|
+
export type PoolActionFile = z.infer<typeof PoolActionFile>;
|
|
90
|
+
export type CommandActionFile = z.infer<typeof CommandActionFile>;
|
|
74
91
|
export type ActionFile = z.infer<typeof ActionFile>;
|
|
92
|
+
export type HookCommand = z.infer<typeof HookCommand>;
|
|
75
93
|
export type FinallyHook = z.infer<typeof FinallyHook>;
|
|
76
94
|
export type Options = z.infer<typeof Options>;
|
|
77
95
|
export type SchemaLink = z.infer<typeof SchemaLink>;
|
package/package.json
CHANGED
package/run.ts
CHANGED
|
@@ -15,10 +15,8 @@ function spawnBarnum(args: string[]): ChildProcess {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface RunOptions {
|
|
18
|
-
pool?: string;
|
|
19
18
|
entrypointValue?: string;
|
|
20
19
|
resumeFrom?: string;
|
|
21
|
-
root?: string;
|
|
22
20
|
logLevel?: string;
|
|
23
21
|
logFile?: string;
|
|
24
22
|
stateLog?: string;
|
|
@@ -40,9 +38,7 @@ export class BarnumConfig {
|
|
|
40
38
|
const args = opts?.resumeFrom
|
|
41
39
|
? ["run", "--resume-from", opts.resumeFrom]
|
|
42
40
|
: ["run", "--config", JSON.stringify(this.config)];
|
|
43
|
-
if (opts?.pool) args.push("--pool", opts.pool);
|
|
44
41
|
if (opts?.entrypointValue) args.push("--entrypoint-value", opts.entrypointValue);
|
|
45
|
-
if (opts?.root) args.push("--root", opts.root);
|
|
46
42
|
if (opts?.logLevel) args.push("--log-level", opts.logLevel);
|
|
47
43
|
if (opts?.logFile) args.push("--log-file", opts.logFile);
|
|
48
44
|
if (opts?.stateLog) args.push("--state-log", opts.stateLog);
|