@koda-sl/baker-cli 0.124.0-dev.efe965ce2 → 0.124.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 +79 -366
- package/dist/{chunk-TKL2CJ6G.js → chunk-IWPAXJC3.js} +431 -930
- package/dist/chunk-IWPAXJC3.js.map +1 -0
- package/dist/cli.js +2783 -3804
- package/dist/cli.js.map +1 -1
- package/dist/engine/index.d.ts +1 -137
- package/dist/engine/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-TKL2CJ6G.js.map +0 -1
package/dist/engine/index.d.ts
CHANGED
|
@@ -15,33 +15,12 @@ type ExecRequest = {
|
|
|
15
15
|
/** Run-scoped dedupe key: the backend replays the stored response for a
|
|
16
16
|
* repeated key instead of re-dispatching to the provider (and re-charging). */
|
|
17
17
|
idempotency_key?: string;
|
|
18
|
-
/** Run + node identity, so a completed async job can be mapped back to its
|
|
19
|
-
* frozen run's node by the backend stale-run reconciliation sweep. */
|
|
20
|
-
canvas_run_id?: string;
|
|
21
|
-
node_id?: string;
|
|
22
18
|
};
|
|
23
19
|
type ExecResponse = {
|
|
24
20
|
outputs: Record<string, RawAssetOutput | RawAssetOutput[] | unknown>;
|
|
25
21
|
credits_charged?: number;
|
|
26
22
|
duration_ms?: number;
|
|
27
23
|
};
|
|
28
|
-
/** A resumable run as reported by `GET /api/canvas/runs/active`. */
|
|
29
|
-
type ActiveRunInfo = {
|
|
30
|
-
runId: string;
|
|
31
|
-
status: "running" | "completed" | "failed";
|
|
32
|
-
interrupted?: boolean;
|
|
33
|
-
updatedAt?: number;
|
|
34
|
-
canvasSha?: string;
|
|
35
|
-
canvasSnapshotUrl?: string;
|
|
36
|
-
};
|
|
37
|
-
/** The newest snapshot-bearing run for a creative — `GET /api/canvas/runs/latest`. */
|
|
38
|
-
type SnapshotRunInfo = {
|
|
39
|
-
runId: string;
|
|
40
|
-
status: "running" | "completed" | "failed";
|
|
41
|
-
interrupted?: boolean;
|
|
42
|
-
canvasSha?: string;
|
|
43
|
-
canvasSnapshotUrl: string;
|
|
44
|
-
};
|
|
45
24
|
type ArtifactResponse = {
|
|
46
25
|
artifact: {
|
|
47
26
|
kind: string;
|
|
@@ -64,37 +43,10 @@ declare class BackendClient$1 {
|
|
|
64
43
|
});
|
|
65
44
|
exec(req: ExecRequest, signal?: AbortSignal): Promise<ExecResponse>;
|
|
66
45
|
private pollJob;
|
|
67
|
-
presignAssetUpload(sha256: string, mime: string, signal?: AbortSignal
|
|
46
|
+
presignAssetUpload(sha256: string, mime: string, signal?: AbortSignal): Promise<{
|
|
68
47
|
putUrl: string;
|
|
69
48
|
publicUrl: string;
|
|
70
49
|
}>;
|
|
71
|
-
/** Remote cache lookup. A miss (404) — or an old backend without the route — returns null. */
|
|
72
|
-
getCacheEntry<T>(cacheKey: string, signal?: AbortSignal): Promise<T | null>;
|
|
73
|
-
putCacheEntry(entry: {
|
|
74
|
-
cacheKey: string;
|
|
75
|
-
}, signal?: AbortSignal): Promise<void>;
|
|
76
|
-
/** Durable run-history record — POST /api/canvas/runs (idempotent server-side on runId). */
|
|
77
|
-
recordRun(payload: unknown, signal?: AbortSignal): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Resumable-run lookup — GET /api/canvas/runs/active. Returns the newest
|
|
80
|
-
* still-running/interrupted run for the creative (pinned to the exact canvas
|
|
81
|
-
* sha), so a fresh sandbox can adopt its run id and re-attach billed
|
|
82
|
-
* in-flight jobs. Null on no active run — or an older backend without the
|
|
83
|
-
* route (both 404).
|
|
84
|
-
*/
|
|
85
|
-
getActiveRun(creativeSlug: string, canvasSha?: string, signal?: AbortSignal): Promise<ActiveRunInfo | null>;
|
|
86
|
-
/**
|
|
87
|
-
* Portable-rerun lookup — GET /api/canvas/runs/latest. The newest run for
|
|
88
|
-
* the creative that recorded a canvas snapshot manifest; null when none
|
|
89
|
-
* exists (or the backend predates the route — both 404).
|
|
90
|
-
*/
|
|
91
|
-
getLatestSnapshotRun(creativeSlug: string, signal?: AbortSignal): Promise<SnapshotRunInfo | null>;
|
|
92
|
-
/**
|
|
93
|
-
* Chat-scoped blueprint sync — POST /api/creatives/definition. Lets the
|
|
94
|
-
* dashboard draw a scaffolded creative's workflow graph BEFORE the first run.
|
|
95
|
-
* Additive on the backend (never archives siblings, never sets definitionPath).
|
|
96
|
-
*/
|
|
97
|
-
syncCreativeDefinition(payload: unknown, signal?: AbortSignal): Promise<void>;
|
|
98
50
|
getArtifact(kind: string, name: string, version?: string, signal?: AbortSignal): Promise<ArtifactResponse>;
|
|
99
51
|
}
|
|
100
52
|
|
|
@@ -168,7 +120,6 @@ declare const CanvasSchema: z.ZodObject<{
|
|
|
168
120
|
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
169
121
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
170
122
|
when: z.ZodOptional<z.ZodUnknown>;
|
|
171
|
-
regenerate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
|
|
172
123
|
}, z.core.$strict>>;
|
|
173
124
|
output: z.ZodOptional<z.ZodObject<{
|
|
174
125
|
node: z.ZodString;
|
|
@@ -298,14 +249,6 @@ type ExecCtx = {
|
|
|
298
249
|
/** Content-addressed cache key for this node execution. Remote delegation
|
|
299
250
|
* derives its idempotency key from it so backend retries never double-charge. */
|
|
300
251
|
cacheKey?: string;
|
|
301
|
-
/**
|
|
302
|
-
* Whether this node's outputs must be downloaded to the local content store.
|
|
303
|
-
* False when NO downstream consumer is a local (ffmpeg/magick) node — the
|
|
304
|
-
* backend already persisted the bytes to R2 with a durable sha256 URL, so the
|
|
305
|
-
* redundant R2→sandbox transfer is skipped and the ref is kept URL-only.
|
|
306
|
-
* Absent/true means download (the safe default for older call sites).
|
|
307
|
-
*/
|
|
308
|
-
downloadOutputs?: boolean;
|
|
309
252
|
client: BackendClient$1;
|
|
310
253
|
assets: AssetStore;
|
|
311
254
|
log: LogFn;
|
|
@@ -368,12 +311,6 @@ type NodeDefinition<I = unknown, P = unknown, O = unknown> = {
|
|
|
368
311
|
outputs: z.ZodType<O>;
|
|
369
312
|
/** "local" runs in-process; "remote" delegates to Convex via ctx.client */
|
|
370
313
|
location: "local" | "remote";
|
|
371
|
-
/**
|
|
372
|
-
* Local node that only forwards asset refs and never reads their bytes
|
|
373
|
-
* (e.g. `collect`). Exempts its upstream producers from the forced R2→disk
|
|
374
|
-
* download local consumers otherwise trigger.
|
|
375
|
-
*/
|
|
376
|
-
passthroughRefs?: true;
|
|
377
314
|
cost?: CostFn<P>;
|
|
378
315
|
validateExtra?: ValidateExtraFn;
|
|
379
316
|
cacheKeyExtras?: CacheKeyExtrasFn;
|
|
@@ -402,39 +339,6 @@ type RunResult = {
|
|
|
402
339
|
duration_ms: number;
|
|
403
340
|
};
|
|
404
341
|
outputs_dir: string;
|
|
405
|
-
node_runs: NodeRunRecord[];
|
|
406
|
-
};
|
|
407
|
-
type NodeRunRecord = {
|
|
408
|
-
node_id: string;
|
|
409
|
-
node_type: string;
|
|
410
|
-
cached: boolean;
|
|
411
|
-
duration_ms: number;
|
|
412
|
-
credits: number;
|
|
413
|
-
};
|
|
414
|
-
/**
|
|
415
|
-
* Live run telemetry: the plan (post-prune node list + dependency edges) fires
|
|
416
|
-
* once before any node executes, then start/settled/failed per node. Consumers
|
|
417
|
-
* stream these into run-history progress snapshots; a throwing consumer is
|
|
418
|
-
* swallowed — telemetry must never fail a paid run.
|
|
419
|
-
*/
|
|
420
|
-
type RunProgressEvent = {
|
|
421
|
-
kind: "plan";
|
|
422
|
-
nodes: Array<{
|
|
423
|
-
node_id: string;
|
|
424
|
-
node_type: string;
|
|
425
|
-
deps: string[];
|
|
426
|
-
params: unknown;
|
|
427
|
-
}>;
|
|
428
|
-
} | {
|
|
429
|
-
kind: "node_start";
|
|
430
|
-
node_id: string;
|
|
431
|
-
} | {
|
|
432
|
-
kind: "node_settled";
|
|
433
|
-
run: NodeRunRecord;
|
|
434
|
-
outputs: Record<string, unknown>;
|
|
435
|
-
} | {
|
|
436
|
-
kind: "node_failed";
|
|
437
|
-
node_id: string;
|
|
438
342
|
};
|
|
439
343
|
type RunOptions = {
|
|
440
344
|
signal?: AbortSignal;
|
|
@@ -442,22 +346,6 @@ type RunOptions = {
|
|
|
442
346
|
cache_policy?: "read_write" | "bypass" | "read_only";
|
|
443
347
|
/** Max nodes of one layer in flight at once; invalid or missing → 5. */
|
|
444
348
|
concurrency?: number;
|
|
445
|
-
/**
|
|
446
|
-
* Credit ceiling (`--max-credits`). Enforced pre-flight against the deep
|
|
447
|
-
* validator's estimate (nothing billed) and at layer boundaries against
|
|
448
|
-
* actual spend — a boundary is the only point with no async job in flight,
|
|
449
|
-
* so aborting there strands nothing. Cached nodes cost 0, so a capped run
|
|
450
|
-
* retried with a higher cap loses no completed work.
|
|
451
|
-
*/
|
|
452
|
-
max_credits?: number;
|
|
453
|
-
/**
|
|
454
|
-
* Node ids to force fresh for THIS run only (the `--regenerate` flag). Folds
|
|
455
|
-
* the run id into each named node's cache key so it re-renders regardless of
|
|
456
|
-
* the content cache, without editing the canvas. Persistent regeneration uses
|
|
457
|
-
* the per-node `regenerate` field instead.
|
|
458
|
-
*/
|
|
459
|
-
regenerate?: ReadonlySet<string>;
|
|
460
|
-
onProgress?: (event: RunProgressEvent) => void;
|
|
461
349
|
};
|
|
462
350
|
type EngineOptions = {
|
|
463
351
|
registry: NodeRegistry;
|
|
@@ -466,13 +354,6 @@ type EngineOptions = {
|
|
|
466
354
|
cache: CacheStore;
|
|
467
355
|
outputsDir: string;
|
|
468
356
|
log?: LogFn;
|
|
469
|
-
/**
|
|
470
|
-
* Stamp durable canvas-assets URLs onto fresh node outputs before they are
|
|
471
|
-
* cached — the precondition for remote cache portability and run-history
|
|
472
|
-
* records. Best-effort: a failed upload logs a warning and keeps the entry
|
|
473
|
-
* local-only, never fails the node.
|
|
474
|
-
*/
|
|
475
|
-
persistAssets?: boolean;
|
|
476
357
|
};
|
|
477
358
|
declare class Engine$1 {
|
|
478
359
|
private readonly registry;
|
|
@@ -481,7 +362,6 @@ declare class Engine$1 {
|
|
|
481
362
|
private readonly cache;
|
|
482
363
|
private readonly outputsDir;
|
|
483
364
|
private readonly log;
|
|
484
|
-
private readonly persistAssets;
|
|
485
365
|
constructor(opts: EngineOptions);
|
|
486
366
|
validate(canvas: unknown): {
|
|
487
367
|
ok: true;
|
|
@@ -510,8 +390,6 @@ declare class Engine$1 {
|
|
|
510
390
|
}>;
|
|
511
391
|
run(input: unknown, opts?: RunOptions): Promise<RunResult>;
|
|
512
392
|
private runLayers;
|
|
513
|
-
/** Progress consumers are observers only — an exception there must never fail the run. */
|
|
514
|
-
private emitProgress;
|
|
515
393
|
/**
|
|
516
394
|
* Dead-node elimination: when the canvas declares an `output`, execute only the
|
|
517
395
|
* nodes that output transitively depends on. Orphaned nodes (left by an edit or
|
|
@@ -522,13 +400,6 @@ declare class Engine$1 {
|
|
|
522
400
|
private writeFinal;
|
|
523
401
|
private executeOne;
|
|
524
402
|
private materializeNodeOutputs;
|
|
525
|
-
/**
|
|
526
|
-
* Download any URL-only asset ref reachable in a local node's inputs so the
|
|
527
|
-
* bytes are on disk before the local runner stages them. Returns a copy —
|
|
528
|
-
* refs are replaced, never mutated in place, so the producer's cached output
|
|
529
|
-
* (shared object) keeps its URL-only shape.
|
|
530
|
-
*/
|
|
531
|
-
private materializeLocalInputs;
|
|
532
403
|
}
|
|
533
404
|
|
|
534
405
|
type ValidationResult = {
|
|
@@ -596,13 +467,6 @@ declare function createEngineFromEnv(opts?: {
|
|
|
596
467
|
cacheDir?: string;
|
|
597
468
|
outputsDir?: string;
|
|
598
469
|
log?: (line: string) => void;
|
|
599
|
-
/**
|
|
600
|
-
* Layer the company-scoped remote cache over the local one (and stamp
|
|
601
|
-
* durable asset URLs onto fresh outputs) so a fresh sandbox re-runs an
|
|
602
|
-
* already-computed canvas at zero credits. Defaults to on; disable with
|
|
603
|
-
* `remoteCache: false` or env BAKER_CANVAS_REMOTE_CACHE=off.
|
|
604
|
-
*/
|
|
605
|
-
remoteCache?: boolean;
|
|
606
470
|
}): Engine$1;
|
|
607
471
|
|
|
608
472
|
export { BackendClient, Engine, LocalAssetStore, LocalCacheStore, ValidationError, createEngineFromEnv, defaultRegistry, generateCatalog, validateCanvasDeep };
|
package/dist/engine/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
BackendClient,
|
|
3
3
|
Engine,
|
|
4
4
|
LocalAssetStore,
|
|
5
5
|
LocalCacheStore,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
defaultRegistry,
|
|
9
9
|
generateCatalog,
|
|
10
10
|
validateCanvasDeep
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-IWPAXJC3.js";
|
|
12
12
|
import "../chunk-5WRI5ZAA.js";
|
|
13
13
|
export {
|
|
14
14
|
BackendClient,
|