Skip to content

Commit ba8e1b1

Browse files
unraidclaude
andcommitted
feat: enable /schedule by adding AGENT_TRIGGERS_REMOTE to default features
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ca976ff commit ba8e1b1

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

build.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,24 @@ const outdir = "dist";
88
const { rmSync } = await import("fs");
99
rmSync(outdir, { recursive: true, force: true });
1010

11+
// Default features that match the official CLI build.
12+
// Additional features can be enabled via FEATURE_<NAME>=1 env vars.
13+
const DEFAULT_BUILD_FEATURES = ["AGENT_TRIGGERS_REMOTE"];
14+
15+
// Collect FEATURE_* env vars → Bun.build features
16+
const envFeatures = Object.keys(process.env)
17+
.filter(k => k.startsWith("FEATURE_"))
18+
.map(k => k.replace("FEATURE_", ""));
19+
const features = [...new Set([...DEFAULT_BUILD_FEATURES, ...envFeatures])];
20+
1121
// Step 2: Bundle with splitting
1222
const result = await Bun.build({
1323
entrypoints: ["src/entrypoints/cli.tsx"],
1424
outdir,
1525
target: "bun",
1626
splitting: true,
1727
define: getMacroDefines(),
28+
features,
1829
});
1930

2031
if (!result.success) {

scripts/dev.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,26 @@ const defineArgs = Object.entries(defines).flatMap(([k, v]) => [
1313
`${k}:${v}`,
1414
]);
1515

16+
// Bun --feature flags: enable feature() gates at runtime.
17+
// Default features enabled in dev mode.
18+
const DEFAULT_FEATURES = ["BUDDY", "TRANSCRIPT_CLASSIFIER", "BRIDGE_MODE", "AGENT_TRIGGERS_REMOTE"];
19+
20+
// Any env var matching FEATURE_<NAME>=1 will also enable that feature.
21+
// e.g. FEATURE_PROACTIVE=1 bun run dev
22+
const envFeatures = Object.entries(process.env)
23+
.filter(([k]) => k.startsWith("FEATURE_"))
24+
.map(([k]) => k.replace("FEATURE_", ""));
25+
26+
const allFeatures = [...new Set([...DEFAULT_FEATURES, ...envFeatures])];
27+
const featureArgs = allFeatures.flatMap((name) => ["--feature", name]);
28+
29+
// If BUN_INSPECT is set, pass --inspect-wait to the child process
30+
const inspectArgs = process.env.BUN_INSPECT
31+
? ["--inspect-wait=" + process.env.BUN_INSPECT]
32+
: [];
33+
1634
const result = Bun.spawnSync(
17-
["bun", "run", ...defineArgs, "src/entrypoints/cli.tsx", ...process.argv.slice(2)],
35+
["bun", "run", ...defineArgs, ...featureArgs, ...inspectArgs, "src/entrypoints/cli.tsx", ...process.argv.slice(2)],
1836
{ stdio: ["inherit", "inherit", "inherit"] },
1937
);
2038

0 commit comments

Comments
 (0)