@koda-sl/baker-cli 0.353.0-dev.847cbae62 → 0.353.0-dev.afbf521d7

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/dist/cli.js CHANGED
@@ -54,6 +54,7 @@ import {
54
54
  promptMaxLength,
55
55
  requireCredentialsFromEnv,
56
56
  resolveConcurrency,
57
+ runFailureCode,
57
58
  runYtDlp,
58
59
  sha256Hex,
59
60
  spineInputFlags,
@@ -68,7 +69,7 @@ import {
68
69
  validateCanvasDeep,
69
70
  withoutCastName,
70
71
  ytDlpBlockSignal
71
- } from "./chunk-B7MLH3K6.js";
72
+ } from "./chunk-RZWMHH4X.js";
72
73
  import {
73
74
  csvOrJson,
74
75
  daysAgoIso,
@@ -11035,20 +11036,6 @@ function adCopyHints(payload) {
11035
11036
  return tells.slice(0, MAX_HINTS).map(hintFor);
11036
11037
  }
11037
11038
 
11038
- // src/commands/ads/hints.ts
11039
- function backendHints(envelope) {
11040
- const hints2 = envelope.hints;
11041
- return Array.isArray(hints2) ? hints2.filter((hint) => typeof hint === "string") : [];
11042
- }
11043
- function withHints(envelope, extra) {
11044
- const hints2 = [...backendHints(envelope), ...extra];
11045
- return hints2.length > 0 ? { ...envelope, hints: hints2 } : envelope;
11046
- }
11047
- function hintLines(envelope) {
11048
- return backendHints(envelope).map((hint) => `
11049
- > ${hint}`).join("");
11050
- }
11051
-
11052
11039
  // src/commands/ads/google/draft-status.ts
11053
11040
  var OPERATION_LABELS = {
11054
11041
  create: "Creating",
@@ -11378,7 +11365,7 @@ async function stageGoogleOp(raw, hints2) {
11378
11365
  const chatId = requireChatId();
11379
11366
  const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
11380
11367
  const allHints = [...noopHints(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
11381
- writeJsonEnvelope(withHints(response, allHints));
11368
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11382
11369
  } catch (err) {
11383
11370
  handleGoogleError(err);
11384
11371
  }
@@ -11416,7 +11403,7 @@ async function stageGoogleOps(rawOps, hints2) {
11416
11403
  const chatId = requireChatId();
11417
11404
  const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
11418
11405
  const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints2 ?? [], ...adCopyHints(ops)];
11419
- writeJsonEnvelope(withHints(response, allHints));
11406
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
11420
11407
  } catch (err) {
11421
11408
  handleGoogleError(err);
11422
11409
  }
@@ -11444,7 +11431,7 @@ async function draftListAction(json, chat) {
11444
11431
  writeJsonEnvelope(response);
11445
11432
  return;
11446
11433
  }
11447
- process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}
11434
+ process.stdout.write(`${renderDraftStatus(response.data)}
11448
11435
  `);
11449
11436
  } catch (err) {
11450
11437
  handleGoogleError(err);
@@ -19228,7 +19215,7 @@ async function stageOp(raw, hints2) {
19228
19215
  op: preflight.data
19229
19216
  });
19230
19217
  const allHints = [...batchNudge(response.data), ...hints2 ?? [], ...adCopyHints(preflight.data)];
19231
- writeJsonEnvelope(withHints(response, allHints));
19218
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19232
19219
  } catch (err) {
19233
19220
  handleLinkedinError(err);
19234
19221
  }
@@ -19255,7 +19242,7 @@ async function stageLinkedinOps(rawOps, hints2) {
19255
19242
  const chatId = requireChatId();
19256
19243
  const response = await apiPost("/api/ads/linkedin/draft/stage-batch", { chatId, ops });
19257
19244
  const allHints = [...hints2 ?? [], ...adCopyHints(ops)];
19258
- writeJsonEnvelope(withHints(response, allHints));
19245
+ writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
19259
19246
  } catch (err) {
19260
19247
  handleLinkedinError(err);
19261
19248
  }
@@ -22464,7 +22451,7 @@ async function listDraft(json, chat) {
22464
22451
  writeJsonEnvelope(response);
22465
22452
  return;
22466
22453
  }
22467
- process.stdout.write(`${renderDraftStatus2(response.data)}${hintLines(response)}
22454
+ process.stdout.write(`${renderDraftStatus2(response.data)}
22468
22455
  `);
22469
22456
  } catch (err) {
22470
22457
  handleLinkedinError(err);
@@ -24993,7 +24980,7 @@ async function stageOp2(raw) {
24993
24980
  const chatId = requireChatId();
24994
24981
  const response = await apiPost("/api/ads/meta/draft/stage", { chatId, op: preflight.data });
24995
24982
  const copyHints = adCopyHints(preflight.data);
24996
- writeJsonEnvelope(withHints(response, copyHints));
24983
+ writeJsonEnvelope(copyHints.length > 0 ? { ...response, hints: copyHints } : response);
24997
24984
  } catch (err) {
24998
24985
  handleMetaError(err);
24999
24986
  }
@@ -41186,14 +41173,14 @@ ${describeRewrites(healed.rewrites)}
41186
41173
  const failures = e.failures.map((f) => ({ node_id: f.nodeId, message: describeFailureReason(f.reason) }));
41187
41174
  if (poster) await poster.flush(failedPayload(e.message));
41188
41175
  process.stderr.write(
41189
- `${JSON.stringify({ ok: false, error: { code: "runtime", message: e.message, failures } }, null, 2)}
41176
+ `${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: e.message, failures } }, null, 2)}
41190
41177
  `
41191
41178
  );
41192
41179
  process.exit(1);
41193
41180
  }
41194
41181
  const msg = e instanceof Error ? e.message : String(e);
41195
41182
  if (poster) await poster.flush(failedPayload(msg));
41196
- process.stderr.write(`${JSON.stringify({ ok: false, error: { code: "runtime", message: msg } }, null, 2)}
41183
+ process.stderr.write(`${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: msg } }, null, 2)}
41197
41184
  `);
41198
41185
  process.exit(1);
41199
41186
  }
@@ -44461,7 +44448,7 @@ import { defineCommand as defineCommand118 } from "citty";
44461
44448
  var validateCommand = defineCommand118({
44462
44449
  meta: {
44463
44450
  name: "validate",
44464
- description: "Validate a canvas JSON file (no execution). Includes a per-node cost preview and runs each node's deep validators (composition meta checks for hyperframe_render/_snapshot)."
44451
+ description: "Validate a canvas JSON file (no execution). Includes a per-node cost preview and runs each node's deep validators (composition meta checks for hyperframe_render/_snapshot), and measures each generator prompt with its {{slots}} filled against the model's character cap (PROMPT_OVER_MODEL_LIMIT)."
44465
44452
  },
44466
44453
  args: { file: { type: "positional", required: true, description: "Path to canvas JSON" } },
44467
44454
  async run({ args: args5 }) {