@barnum/barnum 0.0.0-main-bca0b910 → 0.0.0-main-20fffb47

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
package/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./barnum-config-schema.zod.js";
2
2
  export * from "./barnum-cli-schema.zod.js";
3
+ export { BarnumConfig, type RunOptions } from "./run.js";
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@barnum/barnum",
3
- "version": "0.0.0-main-bca0b910",
3
+ "version": "0.0.0-main-20fffb47",
4
+ "type": "module",
4
5
  "description": "Barnum CLI - workflow engine for agents.",
5
6
  "main": "index.ts",
6
7
  "types": "index.ts",
@@ -8,10 +9,10 @@
8
9
  ".": "./index.ts",
9
10
  "./schema": "./barnum-config-schema.zod.ts",
10
11
  "./cli-schema": "./barnum-cli-schema.zod.ts",
11
- "./binary": "./index.js"
12
+ "./binary": "./index.cjs"
12
13
  },
13
14
  "bin": {
14
- "barnum": "cli.js"
15
+ "barnum": "cli.cjs"
15
16
  },
16
17
  "author": "Robert Balicki",
17
18
  "license": "MIT",
@@ -32,12 +33,13 @@
32
33
  ],
33
34
  "files": [
34
35
  "index.ts",
35
- "index.js",
36
- "cli.js",
36
+ "index.cjs",
37
+ "cli.cjs",
37
38
  "artifacts/**/*",
38
39
  "barnum-config-schema.json",
39
40
  "barnum-config-schema.zod.ts",
40
- "barnum-cli-schema.zod.ts"
41
+ "barnum-cli-schema.zod.ts",
42
+ "run.ts"
41
43
  ],
42
44
  "scripts": {
43
45
  "typecheck": "tsc --noEmit"
@@ -46,6 +48,7 @@
46
48
  "zod": "^3.0.0"
47
49
  },
48
50
  "devDependencies": {
51
+ "@types/node": "^25.5.0",
49
52
  "typescript": "^5.9.3"
50
53
  },
51
54
  "sideEffects": false
package/run.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { spawn, type ChildProcess } from "node:child_process";
2
+ import { chmodSync } from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import type { configFileSchema } from "./barnum-config-schema.zod.js";
5
+ import type { z } from "zod";
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const binaryPath: string = process.env.BARNUM ?? require("./index.cjs");
9
+
10
+ function spawnBarnum(args: string[]): ChildProcess {
11
+ try {
12
+ chmodSync(binaryPath, 0o755);
13
+ } catch {}
14
+ return spawn(binaryPath, args, { stdio: "inherit" });
15
+ }
16
+
17
+ export interface RunOptions {
18
+ pool?: string;
19
+ entrypointValue?: string;
20
+ resumeFrom?: string;
21
+ root?: string;
22
+ logLevel?: string;
23
+ logFile?: string;
24
+ stateLog?: string;
25
+ wake?: string;
26
+ }
27
+
28
+ export class BarnumConfig {
29
+ private readonly config: z.input<typeof configFileSchema>;
30
+
31
+ private constructor(config: z.input<typeof configFileSchema>) {
32
+ this.config = config;
33
+ }
34
+
35
+ static fromConfig(config: z.input<typeof configFileSchema>): BarnumConfig {
36
+ return new BarnumConfig(config);
37
+ }
38
+
39
+ run(opts?: RunOptions): ChildProcess {
40
+ const args = opts?.resumeFrom
41
+ ? ["run", "--resume-from", opts.resumeFrom]
42
+ : ["run", "--config", JSON.stringify(this.config)];
43
+ if (opts?.pool) args.push("--pool", opts.pool);
44
+ if (opts?.entrypointValue) args.push("--entrypoint-value", opts.entrypointValue);
45
+ if (opts?.root) args.push("--root", opts.root);
46
+ if (opts?.logLevel) args.push("--log-level", opts.logLevel);
47
+ if (opts?.logFile) args.push("--log-file", opts.logFile);
48
+ if (opts?.stateLog) args.push("--state-log", opts.stateLog);
49
+ if (opts?.wake) args.push("--wake", opts.wake);
50
+ return spawnBarnum(args);
51
+ }
52
+ }
File without changes
File without changes