@koda-sl/baker-cli 0.122.0-dev.fff192e73 → 0.122.1-dev.57a9836c5

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.
@@ -47,6 +47,13 @@ declare class BackendClient$1 {
47
47
  putUrl: string;
48
48
  publicUrl: string;
49
49
  }>;
50
+ /** Remote cache lookup. A miss (404) — or an old backend without the route — returns null. */
51
+ getCacheEntry<T>(cacheKey: string, signal?: AbortSignal): Promise<T | null>;
52
+ putCacheEntry(entry: {
53
+ cacheKey: string;
54
+ }, signal?: AbortSignal): Promise<void>;
55
+ /** Durable run-history record — POST /api/canvas/runs (idempotent server-side on runId). */
56
+ recordRun(payload: unknown, signal?: AbortSignal): Promise<void>;
50
57
  getArtifact(kind: string, name: string, version?: string, signal?: AbortSignal): Promise<ArtifactResponse>;
51
58
  }
52
59
 
@@ -339,6 +346,39 @@ type RunResult = {
339
346
  duration_ms: number;
340
347
  };
341
348
  outputs_dir: string;
349
+ node_runs: NodeRunRecord[];
350
+ };
351
+ type NodeRunRecord = {
352
+ node_id: string;
353
+ node_type: string;
354
+ cached: boolean;
355
+ duration_ms: number;
356
+ credits: number;
357
+ };
358
+ /**
359
+ * Live run telemetry: the plan (post-prune node list + dependency edges) fires
360
+ * once before any node executes, then start/settled/failed per node. Consumers
361
+ * stream these into run-history progress snapshots; a throwing consumer is
362
+ * swallowed — telemetry must never fail a paid run.
363
+ */
364
+ type RunProgressEvent = {
365
+ kind: "plan";
366
+ nodes: Array<{
367
+ node_id: string;
368
+ node_type: string;
369
+ deps: string[];
370
+ params: unknown;
371
+ }>;
372
+ } | {
373
+ kind: "node_start";
374
+ node_id: string;
375
+ } | {
376
+ kind: "node_settled";
377
+ run: NodeRunRecord;
378
+ outputs: Record<string, unknown>;
379
+ } | {
380
+ kind: "node_failed";
381
+ node_id: string;
342
382
  };
343
383
  type RunOptions = {
344
384
  signal?: AbortSignal;
@@ -346,6 +386,7 @@ type RunOptions = {
346
386
  cache_policy?: "read_write" | "bypass" | "read_only";
347
387
  /** Max nodes of one layer in flight at once; invalid or missing → 5. */
348
388
  concurrency?: number;
389
+ onProgress?: (event: RunProgressEvent) => void;
349
390
  };
350
391
  type EngineOptions = {
351
392
  registry: NodeRegistry;
@@ -354,6 +395,13 @@ type EngineOptions = {
354
395
  cache: CacheStore;
355
396
  outputsDir: string;
356
397
  log?: LogFn;
398
+ /**
399
+ * Stamp durable canvas-assets URLs onto fresh node outputs before they are
400
+ * cached — the precondition for remote cache portability and run-history
401
+ * records. Best-effort: a failed upload logs a warning and keeps the entry
402
+ * local-only, never fails the node.
403
+ */
404
+ persistAssets?: boolean;
357
405
  };
358
406
  declare class Engine$1 {
359
407
  private readonly registry;
@@ -362,6 +410,7 @@ declare class Engine$1 {
362
410
  private readonly cache;
363
411
  private readonly outputsDir;
364
412
  private readonly log;
413
+ private readonly persistAssets;
365
414
  constructor(opts: EngineOptions);
366
415
  validate(canvas: unknown): {
367
416
  ok: true;
@@ -390,6 +439,8 @@ declare class Engine$1 {
390
439
  }>;
391
440
  run(input: unknown, opts?: RunOptions): Promise<RunResult>;
392
441
  private runLayers;
442
+ /** Progress consumers are observers only — an exception there must never fail the run. */
443
+ private emitProgress;
393
444
  /**
394
445
  * Dead-node elimination: when the canvas declares an `output`, execute only the
395
446
  * nodes that output transitively depends on. Orphaned nodes (left by an edit or
@@ -467,6 +518,13 @@ declare function createEngineFromEnv(opts?: {
467
518
  cacheDir?: string;
468
519
  outputsDir?: string;
469
520
  log?: (line: string) => void;
521
+ /**
522
+ * Layer the company-scoped remote cache over the local one (and stamp
523
+ * durable asset URLs onto fresh outputs) so a fresh sandbox re-runs an
524
+ * already-computed canvas at zero credits. Defaults to on; disable with
525
+ * `remoteCache: false` or env BAKER_CANVAS_REMOTE_CACHE=off.
526
+ */
527
+ remoteCache?: boolean;
470
528
  }): Engine$1;
471
529
 
472
530
  export { BackendClient, Engine, LocalAssetStore, LocalCacheStore, ValidationError, createEngineFromEnv, defaultRegistry, generateCatalog, validateCanvasDeep };
@@ -8,7 +8,7 @@ import {
8
8
  defaultRegistry,
9
9
  generateCatalog,
10
10
  validateCanvasDeep
11
- } from "../chunk-MWFJ5NOP.js";
11
+ } from "../chunk-T6HBTZOO.js";
12
12
  import "../chunk-5WRI5ZAA.js";
13
13
  export {
14
14
  BackendClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koda-sl/baker-cli",
3
- "version": "0.122.0-dev.fff192e73",
3
+ "version": "0.122.1-dev.57a9836c5",
4
4
  "description": "AI-agent-first CLI for interacting with Baker, including the Baker creative canvas.",
5
5
  "type": "module",
6
6
  "bin": {