@koda-sl/baker-cli 0.292.0-dev.1d5970764 → 0.293.0-dev.cf9d5462d

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
@@ -29824,7 +29824,7 @@ var VIDEO_ROUTING = "In video, a photoreal presenter renders on `google/veo-3.1`
29824
29824
  function castingHints(avatar) {
29825
29825
  if (avatar.status === "generating") {
29826
29826
  return [
29827
- `Still building. The identity sheet is a ~30s render that settles on its own \u2014 this avatar is castable only once its status is \`ready\`. Do the next piece of work, then check with \`baker avatars get ${avatar.handle}\`. Never sleep waiting on it.`
29827
+ `Still building \u2014 a ~30s render that settles on its own, and this avatar is castable only once it reads \`ready\`. If the next thing you do needs it (a clip, a still, anything with --avatar), block on it: \`baker avatars get ${avatar.handle} --wait\` returns the moment it is ready. Otherwise do other work first and read it back with \`baker avatars get ${avatar.handle}\`. Never write your own sleep or poll loop, and never end the turn waiting \u2014 the user would have to come back and tell you it is ready.`
29828
29828
  ];
29829
29829
  }
29830
29830
  if (avatar.status === "error") {
@@ -30282,6 +30282,28 @@ var deleteCommand = defineCommand97({
30282
30282
 
30283
30283
  // src/commands/avatars/get.ts
30284
30284
  import { defineCommand as defineCommand98 } from "citty";
30285
+
30286
+ // src/commands/avatars/wait.ts
30287
+ var WAIT_TIMEOUT_MS = 9e4;
30288
+ var WAIT_INTERVAL_MS = 3e3;
30289
+ function shouldKeepWaiting(status, elapsedMs) {
30290
+ if (status === "ready") return { done: true, reason: "ready" };
30291
+ if (status === "error" || status === "archived") return { done: true, reason: "settled" };
30292
+ if (elapsedMs >= WAIT_TIMEOUT_MS) return { done: false, reason: "expired" };
30293
+ return { done: false, reason: "building" };
30294
+ }
30295
+ async function waitForSheet(first, read, sleep4 = (ms) => new Promise((resolve5) => setTimeout(resolve5, ms))) {
30296
+ const startedAt = Date.now();
30297
+ let latest = first;
30298
+ while (!shouldKeepWaiting(latest.status, Date.now() - startedAt).done) {
30299
+ if (shouldKeepWaiting(latest.status, Date.now() - startedAt).reason === "expired") return latest;
30300
+ await sleep4(WAIT_INTERVAL_MS);
30301
+ latest = await read();
30302
+ }
30303
+ return latest;
30304
+ }
30305
+
30306
+ // src/commands/avatars/get.ts
30285
30307
  registerSchema({
30286
30308
  command: "avatars.get",
30287
30309
  description: "Read one avatar by handle \u2014 the command you run before casting it. Returns its status (only `ready` can be cast), the identity sheet URL every render must be grounded on via --reference, and the subject description that goes into the prompt VERBATIM. Add --full for the whole written profile (persona, speech, motion, wardrobe, setting, guardrails, voice, source photos).",
@@ -30305,7 +30327,13 @@ var getCommand2 = defineCommand98({
30305
30327
  "avatar-handle": { type: "string", description: "Avatar handle (alternative to positional)", required: false },
30306
30328
  full: { type: "boolean", description: "Include the whole written profile", required: false, default: false },
30307
30329
  output: { type: "string", description: "Output format: json|files|md", required: false, default: "json" },
30308
- fields: { type: "string", description: "Comma-separated field names to include", required: false }
30330
+ fields: { type: "string", description: "Comma-separated field names to include", required: false },
30331
+ wait: {
30332
+ type: "boolean",
30333
+ description: "Block until the identity sheet has settled (up to 90s), instead of returning while it is still building. Use it when the NEXT thing you do needs this avatar \u2014 a clip, a still, anything with --avatar. Without it you get the current status and have to come back; with it the command returns the moment it is ready. Never write your own sleep/poll loop around this.",
30334
+ required: false,
30335
+ default: false
30336
+ }
30309
30337
  },
30310
30338
  run: async ({ args }) => {
30311
30339
  const handle = (args.handle || args["avatar-handle"])?.trim();
@@ -30315,7 +30343,13 @@ var getCommand2 = defineCommand98({
30315
30343
  try {
30316
30344
  const params = { handle };
30317
30345
  if (args.full) params.full = "1";
30318
- const avatar = await readAvatars("/api/avatars/get", params);
30346
+ let avatar = await readAvatars("/api/avatars/get", params);
30347
+ if (args.wait) {
30348
+ avatar = await waitForSheet(
30349
+ avatar,
30350
+ () => readAvatars("/api/avatars/get", params)
30351
+ );
30352
+ }
30319
30353
  const hints2 = castingHints(avatar);
30320
30354
  const format = args.output || "json";
30321
30355
  if (format === "json") {