@koda-sl/baker-cli 0.361.0-dev.abddfd7be → 0.361.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 +6 -5
- package/canvas/avocado-tutorial.json +1 -1
- package/canvas/hello-world-overlay.json +1 -1
- package/dist/{chunk-K2IKLMCM.js → chunk-AI4HWQVN.js} +4 -4
- package/dist/chunk-AI4HWQVN.js.map +1 -0
- package/dist/cli.js +152 -144
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-K2IKLMCM.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
validateCanvasDeep,
|
|
70
70
|
withoutCastName,
|
|
71
71
|
ytDlpBlockSignal
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-AI4HWQVN.js";
|
|
73
73
|
import {
|
|
74
74
|
csvOrJson,
|
|
75
75
|
daysAgoIso,
|
|
@@ -36641,9 +36641,134 @@ var critiqueCommand = defineCommand109({
|
|
|
36641
36641
|
// src/commands/canvas/inspect.ts
|
|
36642
36642
|
import { execFile } from "child_process";
|
|
36643
36643
|
import { readdir as readdir2, readFile as readFile4, stat } from "fs/promises";
|
|
36644
|
-
import
|
|
36644
|
+
import path6 from "path";
|
|
36645
36645
|
import { promisify } from "util";
|
|
36646
36646
|
import { defineCommand as defineCommand110 } from "citty";
|
|
36647
|
+
|
|
36648
|
+
// src/commands/canvas/normalize-paths.ts
|
|
36649
|
+
import { existsSync as existsSync4, realpathSync } from "fs";
|
|
36650
|
+
import { writeFile as writeFile2 } from "fs/promises";
|
|
36651
|
+
import path5 from "path";
|
|
36652
|
+
|
|
36653
|
+
// src/commands/canvas/resolve-paths.ts
|
|
36654
|
+
import path4 from "path";
|
|
36655
|
+
function resolveRelativeCanvasPaths(canvas, baseDir) {
|
|
36656
|
+
if (!canvas || typeof canvas !== "object") return canvas;
|
|
36657
|
+
const c = canvas;
|
|
36658
|
+
if (!Array.isArray(c.nodes)) return canvas;
|
|
36659
|
+
return { ...canvas, nodes: c.nodes.map((n) => resolveNode(n, baseDir)) };
|
|
36660
|
+
}
|
|
36661
|
+
function localPathParam(node) {
|
|
36662
|
+
if (node.type === "ingest") return node.params?.source === "path" ? "path" : null;
|
|
36663
|
+
if (node.type === "hyperframe_render" || node.type === "hyperframe_snapshot") return "composition";
|
|
36664
|
+
return null;
|
|
36665
|
+
}
|
|
36666
|
+
function resolveNode(node, baseDir) {
|
|
36667
|
+
if (!node || typeof node !== "object") return node;
|
|
36668
|
+
const n = node;
|
|
36669
|
+
const params = n.params;
|
|
36670
|
+
if (!params || typeof params !== "object") return node;
|
|
36671
|
+
const key = localPathParam(n);
|
|
36672
|
+
if (key && isResolvableRelative(params[key])) {
|
|
36673
|
+
return { ...node, params: { ...params, [key]: path4.resolve(baseDir, params[key]) } };
|
|
36674
|
+
}
|
|
36675
|
+
return node;
|
|
36676
|
+
}
|
|
36677
|
+
function isResolvableRelative(value) {
|
|
36678
|
+
return typeof value === "string" && value.length > 0 && !value.includes("[TODO") && !looksLikeHttpUrl(value) && !path4.isAbsolute(value);
|
|
36679
|
+
}
|
|
36680
|
+
|
|
36681
|
+
// src/commands/canvas/normalize-paths.ts
|
|
36682
|
+
function findWorkspaceRoot(startDir, exists2 = existsSync4, maxDepth = 12) {
|
|
36683
|
+
let dir = path5.resolve(startDir);
|
|
36684
|
+
for (let i = 0; i < maxDepth; i++) {
|
|
36685
|
+
if (exists2(path5.join(dir, "package.json"))) return dir;
|
|
36686
|
+
const parent = path5.dirname(dir);
|
|
36687
|
+
if (parent === dir) break;
|
|
36688
|
+
dir = parent;
|
|
36689
|
+
}
|
|
36690
|
+
return null;
|
|
36691
|
+
}
|
|
36692
|
+
function canvasOutputsRoot(canvasFile, cwd = process.cwd(), exists2 = existsSync4) {
|
|
36693
|
+
const root = findWorkspaceRoot(path5.dirname(path5.resolve(cwd, canvasFile)), exists2) ?? cwd;
|
|
36694
|
+
return path5.join(root, "canvas");
|
|
36695
|
+
}
|
|
36696
|
+
function canonicalize(target2) {
|
|
36697
|
+
const abs = path5.resolve(target2);
|
|
36698
|
+
let dir = abs;
|
|
36699
|
+
for (; ; ) {
|
|
36700
|
+
try {
|
|
36701
|
+
const real = realpathSync(dir);
|
|
36702
|
+
return dir === abs ? real : path5.join(real, path5.relative(dir, abs));
|
|
36703
|
+
} catch {
|
|
36704
|
+
const parent = path5.dirname(dir);
|
|
36705
|
+
if (parent === dir) return abs;
|
|
36706
|
+
dir = parent;
|
|
36707
|
+
}
|
|
36708
|
+
}
|
|
36709
|
+
}
|
|
36710
|
+
function isInside(root, target2) {
|
|
36711
|
+
const rel = path5.relative(root, target2);
|
|
36712
|
+
return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
|
|
36713
|
+
}
|
|
36714
|
+
function toCanvasRelative(canvasDir, target2) {
|
|
36715
|
+
return path5.relative(canvasDir, target2).split(path5.sep).join("/");
|
|
36716
|
+
}
|
|
36717
|
+
var RUNTIME_WORKSPACE_ROOT = "/home/user/repo";
|
|
36718
|
+
function rewriteTarget(value, workspaceRoot) {
|
|
36719
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
36720
|
+
if (value.includes("[TODO") || looksLikeHttpUrl(value) || !path5.isAbsolute(value)) return null;
|
|
36721
|
+
const target2 = canonicalize(value);
|
|
36722
|
+
if (isInside(workspaceRoot, target2)) return target2;
|
|
36723
|
+
const fromRuntime = path5.relative(RUNTIME_WORKSPACE_ROOT, path5.normalize(value));
|
|
36724
|
+
if (fromRuntime !== "" && !fromRuntime.startsWith("..") && !path5.isAbsolute(fromRuntime)) {
|
|
36725
|
+
return path5.join(workspaceRoot, fromRuntime);
|
|
36726
|
+
}
|
|
36727
|
+
return null;
|
|
36728
|
+
}
|
|
36729
|
+
function normalizeCanvasPaths(canvas, canvasDir, workspaceRoot) {
|
|
36730
|
+
if (!canvas || typeof canvas !== "object") return { canvas, rewrites: [] };
|
|
36731
|
+
const c = canvas;
|
|
36732
|
+
if (!Array.isArray(c.nodes)) return { canvas, rewrites: [] };
|
|
36733
|
+
const root = canonicalize(workspaceRoot);
|
|
36734
|
+
const dir = canonicalize(canvasDir);
|
|
36735
|
+
const rewrites = [];
|
|
36736
|
+
const nodes = c.nodes.map((node) => {
|
|
36737
|
+
if (!node || typeof node !== "object") return node;
|
|
36738
|
+
const n = node;
|
|
36739
|
+
const params = n.params;
|
|
36740
|
+
if (!params || typeof params !== "object") return node;
|
|
36741
|
+
const nodeId = typeof n.id === "string" ? n.id : "?";
|
|
36742
|
+
if (n.type === "ingest" && params.source === "path" && looksLikeHttpUrl(params.path)) {
|
|
36743
|
+
rewrites.push({ nodeId, param: "source", from: "path", to: "url" });
|
|
36744
|
+
return { ...node, params: coercePathUrlToUrl(params) };
|
|
36745
|
+
}
|
|
36746
|
+
const key = localPathParam(n);
|
|
36747
|
+
if (!key) return node;
|
|
36748
|
+
const target2 = rewriteTarget(params[key], root);
|
|
36749
|
+
if (target2 === null) return node;
|
|
36750
|
+
const to = toCanvasRelative(dir, target2);
|
|
36751
|
+
rewrites.push({ nodeId, param: key, from: params[key], to });
|
|
36752
|
+
return { ...node, params: { ...params, [key]: to } };
|
|
36753
|
+
});
|
|
36754
|
+
return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...canvas, nodes }, rewrites };
|
|
36755
|
+
}
|
|
36756
|
+
async function healCanvasPaths(filePath, canvas) {
|
|
36757
|
+
const canvasDir = path5.dirname(filePath);
|
|
36758
|
+
const workspaceRoot = findWorkspaceRoot(canvasDir);
|
|
36759
|
+
if (!workspaceRoot) return { canvas, rewrites: [], text: null };
|
|
36760
|
+
const normalized = normalizeCanvasPaths(canvas, canvasDir, workspaceRoot);
|
|
36761
|
+
if (normalized.rewrites.length === 0) return { ...normalized, text: null };
|
|
36762
|
+
const text2 = `${JSON.stringify(normalized.canvas, null, 2)}
|
|
36763
|
+
`;
|
|
36764
|
+
await writeFile2(filePath, text2, "utf8");
|
|
36765
|
+
return { ...normalized, text: text2 };
|
|
36766
|
+
}
|
|
36767
|
+
function describeRewrites(rewrites) {
|
|
36768
|
+
return rewrites.map((r) => ` ${r.nodeId}.${r.param}: ${r.from} \u2192 ${r.to}`).join("\n");
|
|
36769
|
+
}
|
|
36770
|
+
|
|
36771
|
+
// src/commands/canvas/inspect.ts
|
|
36647
36772
|
var execFileAsync = promisify(execFile);
|
|
36648
36773
|
var inspectCommand = defineCommand110({
|
|
36649
36774
|
meta: {
|
|
@@ -36652,14 +36777,15 @@ var inspectCommand = defineCommand110({
|
|
|
36652
36777
|
},
|
|
36653
36778
|
args: {
|
|
36654
36779
|
run: { type: "positional", required: true, description: "Run id (e.g. r_01K...) or absolute run directory" },
|
|
36655
|
-
"outputs-dir": { type: "string", description: "Per-run outputs root (default
|
|
36780
|
+
"outputs-dir": { type: "string", description: "Per-run outputs root (default <workspace root>/canvas, where `canvas run` writes)" },
|
|
36656
36781
|
thumbnails: {
|
|
36657
36782
|
type: "boolean",
|
|
36658
36783
|
description: "Extract start/middle/end frames from every video output (requires ffmpeg)"
|
|
36659
36784
|
}
|
|
36660
36785
|
},
|
|
36661
36786
|
async run({ args: args5 }) {
|
|
36662
|
-
const
|
|
36787
|
+
const cwd = process.cwd();
|
|
36788
|
+
const outputsDir = args5["outputs-dir"] ? path6.resolve(String(args5["outputs-dir"])) : path6.join(findWorkspaceRoot(cwd) ?? cwd, "canvas");
|
|
36663
36789
|
const runArg = String(args5.run);
|
|
36664
36790
|
const runDir = await resolveRunDir(runArg, outputsDir);
|
|
36665
36791
|
const manifest = await loadManifest(runDir);
|
|
@@ -36671,7 +36797,7 @@ var inspectCommand = defineCommand110({
|
|
|
36671
36797
|
}
|
|
36672
36798
|
const summary = {
|
|
36673
36799
|
ok: true,
|
|
36674
|
-
run_id: manifest.run_id ??
|
|
36800
|
+
run_id: manifest.run_id ?? path6.basename(runDir),
|
|
36675
36801
|
run_dir: runDir,
|
|
36676
36802
|
stats: manifest.stats ?? null,
|
|
36677
36803
|
output: manifest.output ?? null,
|
|
@@ -36684,18 +36810,18 @@ var inspectCommand = defineCommand110({
|
|
|
36684
36810
|
}
|
|
36685
36811
|
});
|
|
36686
36812
|
async function resolveRunDir(run, outputsDir) {
|
|
36687
|
-
if (
|
|
36813
|
+
if (path6.isAbsolute(run)) {
|
|
36688
36814
|
const s2 = await stat(run).catch(() => null);
|
|
36689
36815
|
if (s2?.isDirectory()) return run;
|
|
36690
36816
|
throw new Error(`inspect: ${run} is not a directory`);
|
|
36691
36817
|
}
|
|
36692
|
-
const candidate =
|
|
36818
|
+
const candidate = path6.join(outputsDir, run);
|
|
36693
36819
|
const s = await stat(candidate).catch(() => null);
|
|
36694
36820
|
if (s?.isDirectory()) return candidate;
|
|
36695
36821
|
throw new Error(`inspect: no run directory at ${candidate}`);
|
|
36696
36822
|
}
|
|
36697
36823
|
async function loadManifest(runDir) {
|
|
36698
|
-
const manifestPath =
|
|
36824
|
+
const manifestPath = path6.join(runDir, "manifest.json");
|
|
36699
36825
|
try {
|
|
36700
36826
|
const raw = await readFile4(manifestPath, "utf-8");
|
|
36701
36827
|
return JSON.parse(raw);
|
|
@@ -36707,7 +36833,7 @@ async function listRunFiles(runDir) {
|
|
|
36707
36833
|
const out = [];
|
|
36708
36834
|
const names = await readdir2(runDir);
|
|
36709
36835
|
for (const name of names) {
|
|
36710
|
-
const abs =
|
|
36836
|
+
const abs = path6.join(runDir, name);
|
|
36711
36837
|
const s = await stat(abs).catch(() => null);
|
|
36712
36838
|
if (!s?.isFile()) continue;
|
|
36713
36839
|
out.push({ name, path: abs, size: s.size });
|
|
@@ -36760,95 +36886,6 @@ import { readFile as readFile12 } from "fs/promises";
|
|
|
36760
36886
|
import path16 from "path";
|
|
36761
36887
|
import { defineCommand as defineCommand111 } from "citty";
|
|
36762
36888
|
|
|
36763
|
-
// src/commands/canvas/normalize-paths.ts
|
|
36764
|
-
import { existsSync as existsSync4, realpathSync } from "fs";
|
|
36765
|
-
import { writeFile as writeFile2 } from "fs/promises";
|
|
36766
|
-
import path5 from "path";
|
|
36767
|
-
function findWorkspaceRoot(startDir, exists2 = existsSync4, maxDepth = 12) {
|
|
36768
|
-
let dir = path5.resolve(startDir);
|
|
36769
|
-
for (let i = 0; i < maxDepth; i++) {
|
|
36770
|
-
if (exists2(path5.join(dir, "package.json"))) return dir;
|
|
36771
|
-
const parent = path5.dirname(dir);
|
|
36772
|
-
if (parent === dir) break;
|
|
36773
|
-
dir = parent;
|
|
36774
|
-
}
|
|
36775
|
-
return null;
|
|
36776
|
-
}
|
|
36777
|
-
function canonicalize(target2) {
|
|
36778
|
-
const abs = path5.resolve(target2);
|
|
36779
|
-
let dir = abs;
|
|
36780
|
-
for (; ; ) {
|
|
36781
|
-
try {
|
|
36782
|
-
const real = realpathSync(dir);
|
|
36783
|
-
return dir === abs ? real : path5.join(real, path5.relative(dir, abs));
|
|
36784
|
-
} catch {
|
|
36785
|
-
const parent = path5.dirname(dir);
|
|
36786
|
-
if (parent === dir) return abs;
|
|
36787
|
-
dir = parent;
|
|
36788
|
-
}
|
|
36789
|
-
}
|
|
36790
|
-
}
|
|
36791
|
-
function isInside(root, target2) {
|
|
36792
|
-
const rel = path5.relative(root, target2);
|
|
36793
|
-
return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
|
|
36794
|
-
}
|
|
36795
|
-
function toCanvasRelative(canvasDir, target2) {
|
|
36796
|
-
return path5.relative(canvasDir, target2).split(path5.sep).join("/");
|
|
36797
|
-
}
|
|
36798
|
-
var RUNTIME_WORKSPACE_ROOT = "/home/user/repo";
|
|
36799
|
-
function rewriteTarget(value, workspaceRoot) {
|
|
36800
|
-
if (typeof value !== "string" || value.length === 0) return null;
|
|
36801
|
-
if (value.includes("[TODO") || looksLikeHttpUrl(value) || !path5.isAbsolute(value)) return null;
|
|
36802
|
-
const target2 = canonicalize(value);
|
|
36803
|
-
if (isInside(workspaceRoot, target2)) return target2;
|
|
36804
|
-
const fromRuntime = path5.relative(RUNTIME_WORKSPACE_ROOT, path5.normalize(value));
|
|
36805
|
-
if (fromRuntime !== "" && !fromRuntime.startsWith("..") && !path5.isAbsolute(fromRuntime)) {
|
|
36806
|
-
return path5.join(workspaceRoot, fromRuntime);
|
|
36807
|
-
}
|
|
36808
|
-
return null;
|
|
36809
|
-
}
|
|
36810
|
-
function normalizeCanvasPaths(canvas, canvasDir, workspaceRoot) {
|
|
36811
|
-
if (!canvas || typeof canvas !== "object") return { canvas, rewrites: [] };
|
|
36812
|
-
const c = canvas;
|
|
36813
|
-
if (!Array.isArray(c.nodes)) return { canvas, rewrites: [] };
|
|
36814
|
-
const root = canonicalize(workspaceRoot);
|
|
36815
|
-
const dir = canonicalize(canvasDir);
|
|
36816
|
-
const rewrites = [];
|
|
36817
|
-
const nodes = c.nodes.map((node) => {
|
|
36818
|
-
if (!node || typeof node !== "object") return node;
|
|
36819
|
-
const n = node;
|
|
36820
|
-
const params = n.params;
|
|
36821
|
-
if (!params || typeof params !== "object") return node;
|
|
36822
|
-
const nodeId = typeof n.id === "string" ? n.id : "?";
|
|
36823
|
-
if (n.type === "ingest" && params.source === "path" && looksLikeHttpUrl(params.path)) {
|
|
36824
|
-
rewrites.push({ nodeId, param: "source", from: "path", to: "url" });
|
|
36825
|
-
return { ...node, params: coercePathUrlToUrl(params) };
|
|
36826
|
-
}
|
|
36827
|
-
const key = n.type === "ingest" && params.source === "path" ? "path" : n.type === "hyperframe_render" ? "composition" : null;
|
|
36828
|
-
if (!key) return node;
|
|
36829
|
-
const target2 = rewriteTarget(params[key], root);
|
|
36830
|
-
if (target2 === null) return node;
|
|
36831
|
-
const to = toCanvasRelative(dir, target2);
|
|
36832
|
-
rewrites.push({ nodeId, param: key, from: params[key], to });
|
|
36833
|
-
return { ...node, params: { ...params, [key]: to } };
|
|
36834
|
-
});
|
|
36835
|
-
return rewrites.length === 0 ? { canvas, rewrites } : { canvas: { ...canvas, nodes }, rewrites };
|
|
36836
|
-
}
|
|
36837
|
-
async function healCanvasPaths(filePath, canvas) {
|
|
36838
|
-
const canvasDir = path5.dirname(filePath);
|
|
36839
|
-
const workspaceRoot = findWorkspaceRoot(canvasDir);
|
|
36840
|
-
if (!workspaceRoot) return { canvas, rewrites: [], text: null };
|
|
36841
|
-
const normalized = normalizeCanvasPaths(canvas, canvasDir, workspaceRoot);
|
|
36842
|
-
if (normalized.rewrites.length === 0) return { ...normalized, text: null };
|
|
36843
|
-
const text2 = `${JSON.stringify(normalized.canvas, null, 2)}
|
|
36844
|
-
`;
|
|
36845
|
-
await writeFile2(filePath, text2, "utf8");
|
|
36846
|
-
return { ...normalized, text: text2 };
|
|
36847
|
-
}
|
|
36848
|
-
function describeRewrites(rewrites) {
|
|
36849
|
-
return rewrites.map((r) => ` ${r.nodeId}.${r.param}: ${r.from} \u2192 ${r.to}`).join("\n");
|
|
36850
|
-
}
|
|
36851
|
-
|
|
36852
36889
|
// src/commands/canvas/placeholders.ts
|
|
36853
36890
|
function unsuppliedPlaceholderAssets(canvas) {
|
|
36854
36891
|
const nodes = canvas?.nodes;
|
|
@@ -36865,31 +36902,6 @@ function unsuppliedPlaceholderAssets(canvas) {
|
|
|
36865
36902
|
return out;
|
|
36866
36903
|
}
|
|
36867
36904
|
|
|
36868
|
-
// src/commands/canvas/resolve-paths.ts
|
|
36869
|
-
import path6 from "path";
|
|
36870
|
-
function resolveRelativeCanvasPaths(canvas, baseDir) {
|
|
36871
|
-
if (!canvas || typeof canvas !== "object") return canvas;
|
|
36872
|
-
const c = canvas;
|
|
36873
|
-
if (!Array.isArray(c.nodes)) return canvas;
|
|
36874
|
-
return { ...canvas, nodes: c.nodes.map((n) => resolveNode(n, baseDir)) };
|
|
36875
|
-
}
|
|
36876
|
-
function resolveNode(node, baseDir) {
|
|
36877
|
-
if (!node || typeof node !== "object") return node;
|
|
36878
|
-
const n = node;
|
|
36879
|
-
const params = n.params;
|
|
36880
|
-
if (!params || typeof params !== "object") return node;
|
|
36881
|
-
if (n.type === "ingest" && params.source === "path" && isResolvableRelative(params.path)) {
|
|
36882
|
-
return { ...node, params: { ...params, path: path6.resolve(baseDir, params.path) } };
|
|
36883
|
-
}
|
|
36884
|
-
if (n.type === "hyperframe_render" && isResolvableRelative(params.composition)) {
|
|
36885
|
-
return { ...node, params: { ...params, composition: path6.resolve(baseDir, params.composition) } };
|
|
36886
|
-
}
|
|
36887
|
-
return node;
|
|
36888
|
-
}
|
|
36889
|
-
function isResolvableRelative(value) {
|
|
36890
|
-
return typeof value === "string" && value.length > 0 && !value.includes("[TODO") && !looksLikeHttpUrl(value) && !path6.isAbsolute(value);
|
|
36891
|
-
}
|
|
36892
|
-
|
|
36893
36905
|
// src/commands/canvas/source-version.ts
|
|
36894
36906
|
import { readFile as readFile6 } from "fs/promises";
|
|
36895
36907
|
import path8 from "path";
|
|
@@ -40999,12 +41011,9 @@ function localPathRefsFromCanvas(parsed) {
|
|
|
40999
41011
|
const n = node;
|
|
41000
41012
|
const params = n.params;
|
|
41001
41013
|
if (!params || typeof params !== "object") continue;
|
|
41002
|
-
|
|
41003
|
-
|
|
41004
|
-
|
|
41005
|
-
if (n.type === "hyperframe_render" && isSnapshotablePath(params.composition)) {
|
|
41006
|
-
refs.add(params.composition);
|
|
41007
|
-
}
|
|
41014
|
+
const key = localPathParam(n);
|
|
41015
|
+
const value = key ? params[key] : void 0;
|
|
41016
|
+
if (isSnapshotablePath(value)) refs.add(value);
|
|
41008
41017
|
}
|
|
41009
41018
|
return [...refs];
|
|
41010
41019
|
}
|
|
@@ -41689,8 +41698,8 @@ var runCommand = defineCommand111({
|
|
|
41689
41698
|
type: "string",
|
|
41690
41699
|
description: "What the person asked for, IN THEIR OWN WORDS \u2014 paste their message, do not summarise it. The review compares the finished video against this and reports what they asked for that is missing or contradicted. Without it the review can only say whether the video is well made, not whether it is the one they wanted: every other check grades the render against the spec, and a spec that misread the request agrees with itself."
|
|
41691
41700
|
},
|
|
41692
|
-
"cache-dir": { type: "string", description: "Cache root (default
|
|
41693
|
-
"outputs-dir": { type: "string", description: "Per-run outputs root (default
|
|
41701
|
+
"cache-dir": { type: "string", description: "Cache root (default <workspace root>/canvas/.cache, whatever directory you run from)" },
|
|
41702
|
+
"outputs-dir": { type: "string", description: "Per-run outputs root (default <workspace root>/canvas, whatever directory you run from)" },
|
|
41694
41703
|
"run-id": { type: "string", description: "Override run id (also resumes that run, re-attaching its in-flight jobs)" },
|
|
41695
41704
|
fresh: {
|
|
41696
41705
|
type: "boolean",
|
|
@@ -41768,6 +41777,7 @@ function stopBeforeKinds(until) {
|
|
|
41768
41777
|
}
|
|
41769
41778
|
async function executeCanvasRun(opts) {
|
|
41770
41779
|
const filePath = path16.resolve(opts.file);
|
|
41780
|
+
const canvasRoot = canvasOutputsRoot(filePath);
|
|
41771
41781
|
const raw = await readFile12(filePath, "utf8");
|
|
41772
41782
|
let parsed;
|
|
41773
41783
|
try {
|
|
@@ -41779,7 +41789,7 @@ async function executeCanvasRun(opts) {
|
|
|
41779
41789
|
process.exit(2);
|
|
41780
41790
|
}
|
|
41781
41791
|
const attemptedSlug = creativeSlugFromCanvasPath(filePath);
|
|
41782
|
-
if (attemptedSlug) await clearCreativeDirty(attemptedSlug);
|
|
41792
|
+
if (attemptedSlug) await clearCreativeDirty(attemptedSlug, path16.join(canvasRoot, ".dirty"));
|
|
41783
41793
|
const healed = await healCanvasPaths(filePath, parsed);
|
|
41784
41794
|
parsed = healed.canvas;
|
|
41785
41795
|
const canvasText = healed.text ?? raw;
|
|
@@ -41875,8 +41885,8 @@ ${describeRewrites(healed.rewrites)}
|
|
|
41875
41885
|
}
|
|
41876
41886
|
}
|
|
41877
41887
|
const engine = createEngineFromEnv({
|
|
41878
|
-
cacheDir: opts.cacheDir,
|
|
41879
|
-
outputsDir: opts.outputsDir,
|
|
41888
|
+
cacheDir: opts.cacheDir ?? path16.join(canvasRoot, ".cache"),
|
|
41889
|
+
outputsDir: opts.outputsDir ?? canvasRoot,
|
|
41880
41890
|
log: (line) => process.stdout.write(`${line}
|
|
41881
41891
|
`),
|
|
41882
41892
|
remoteCache: opts.remoteCache
|
|
@@ -41896,7 +41906,7 @@ ${describeRewrites(healed.rewrites)}
|
|
|
41896
41906
|
const canvasSha = sha256Hex(Buffer.from(canvasText));
|
|
41897
41907
|
const creativeSlug = creativeSlugFromCanvasPath(filePath) ?? void 0;
|
|
41898
41908
|
const client = opts.record === false ? null : buildBackendClient();
|
|
41899
|
-
const outputsDir = opts.outputsDir ? path16.resolve(opts.outputsDir) :
|
|
41909
|
+
const outputsDir = opts.outputsDir ? path16.resolve(opts.outputsDir) : canvasRoot;
|
|
41900
41910
|
const { runId, resumed, source, concurrentRunId } = await resolveRunId({
|
|
41901
41911
|
explicitRunId: opts.runId,
|
|
41902
41912
|
fresh: opts.fresh === true,
|
|
@@ -41930,7 +41940,7 @@ ${describeRewrites(healed.rewrites)}
|
|
|
41930
41940
|
const canvasSnapshotUrl = client && creativeSlug ? await uploadRunSnapshot(client, { canvasPath: filePath, raw: canvasText, creativeSlug, parsed }) ?? void 0 : void 0;
|
|
41931
41941
|
const recordMeta = {
|
|
41932
41942
|
creativeSlug,
|
|
41933
|
-
canvasPath: path16.relative(
|
|
41943
|
+
canvasPath: path16.relative(path16.dirname(canvasRoot), filePath) || void 0,
|
|
41934
41944
|
canvasSha,
|
|
41935
41945
|
// The fingerprint the dashboard compares against the current source to flag
|
|
41936
41946
|
// "edited since last render". Computed from the on-disk canvas.json +
|
|
@@ -61796,7 +61806,7 @@ A tool or platform the user names that is NOT listed anywhere here is simply not
|
|
|
61796
61806
|
);
|
|
61797
61807
|
}
|
|
61798
61808
|
hints2.push(
|
|
61799
|
-
|
|
61809
|
+
"Not listed anywhere = not connected. Managed app (Slack, Attio, \u2026) or platform (HubSpot, Google Ads, GA4, \u2026) \u2192 the user connects it in the dashboard: Brain \u2192 Integrations \u2192 Tools. Custom HTTPS MCP endpoint \u2192 `baker mcp add`."
|
|
61800
61810
|
);
|
|
61801
61811
|
writeJson({
|
|
61802
61812
|
ok: true,
|
|
@@ -61836,10 +61846,9 @@ var listCommand16 = defineCommand183({
|
|
|
61836
61846
|
}
|
|
61837
61847
|
}
|
|
61838
61848
|
});
|
|
61839
|
-
var HEADER_DESCRIPTION = 'Extra request header "Key: Value" (repeatable). Never a key, token or password: never ask the user for one in chat \u2014 a server that needs a key is added by the user on the `request_connection` card ({ server, url, headerName, reason }).';
|
|
61840
61849
|
registerSchema({
|
|
61841
61850
|
command: "mcp.add",
|
|
61842
|
-
description: "Register a custom MCP server.
|
|
61851
|
+
description: "Register a custom MCP server. Tools appear as mcp__<name>__* on the next message. URL must be HTTPS. Scope: company (default, all chats) | org (org admin key) | user (only the current sender).",
|
|
61843
61852
|
args: {
|
|
61844
61853
|
name: { type: "string", description: "Server name \u2192 tools appear as mcp__<name>__*", required: true },
|
|
61845
61854
|
url: {
|
|
@@ -61848,7 +61857,7 @@ registerSchema({
|
|
|
61848
61857
|
required: true
|
|
61849
61858
|
},
|
|
61850
61859
|
scope: { type: "string", description: "user | user_org | company | org (default company)", required: false },
|
|
61851
|
-
header: { type: "string", description:
|
|
61860
|
+
header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
|
|
61852
61861
|
}
|
|
61853
61862
|
});
|
|
61854
61863
|
var addCommand2 = defineCommand183({
|
|
@@ -61856,13 +61865,11 @@ var addCommand2 = defineCommand183({
|
|
|
61856
61865
|
name: "add",
|
|
61857
61866
|
description: `Register a custom MCP server. Tools appear as mcp__<name>__* on the NEXT message.
|
|
61858
61867
|
|
|
61859
|
-
To connect a server FOR the user, call the \`request_connection\` tool with { server, url?, headerName?, reason }
|
|
61860
|
-
instead: they add it on the card in the chat, key included, and you never see the key.
|
|
61861
|
-
|
|
61862
61868
|
Scope: company (default \u2014 every chat in the company) | org (all companies in the org; needs an admin key) | user (only the current message sender).
|
|
61863
61869
|
|
|
61864
61870
|
Examples:
|
|
61865
61871
|
baker mcp add --name weather --url https://mcp.example.com/mcp
|
|
61872
|
+
baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
|
|
61866
61873
|
baker mcp add --name mine --url https://my.dev/mcp --scope user`
|
|
61867
61874
|
},
|
|
61868
61875
|
args: {
|
|
@@ -61873,7 +61880,7 @@ Examples:
|
|
|
61873
61880
|
required: true
|
|
61874
61881
|
},
|
|
61875
61882
|
scope: { type: "string", description: "user | user_org | company | org (default company)", required: false },
|
|
61876
|
-
header: { type: "string", description:
|
|
61883
|
+
header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
|
|
61877
61884
|
},
|
|
61878
61885
|
run: async ({ args: args5, rawArgs }) => {
|
|
61879
61886
|
try {
|
|
@@ -61940,6 +61947,7 @@ Start here:
|
|
|
61940
61947
|
|
|
61941
61948
|
Examples:
|
|
61942
61949
|
baker mcp add --name weather --url https://mcp.example.com/mcp
|
|
61950
|
+
baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
|
|
61943
61951
|
baker mcp remove --name weather
|
|
61944
61952
|
Full guide: __tooling__/docs/tools/baker/mcp.md`
|
|
61945
61953
|
},
|