vibes-diy 14.3.379 → 14.3.380

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.
@@ -201969,6 +201969,10 @@ var PromptContextSql = lazyType2(
201969
201969
  // meter leaves the row out and no Autumn track is sent. Written beside
201970
201970
  // `platformFunded`.
201971
201971
  "emptyTurn?": "true",
201972
+ // Why an `emptyTurn` row was waived, when it was a named cause rather than an
201973
+ // empty reply: `thinking-cap`, the builder planned through its whole output
201974
+ // allowance and wrote no code (VibesDIY/vibes.diy#9437, owner 2026-11-17).
201975
+ "noCodeCause?": "'thinking-cap'",
201972
201976
  // The platform paid this row's usage (a guest's turn, `guest-credit-meter.ts`,
201973
201977
  // a free repair or an empty turn above). Usually stamped by SQL after the insert; declared
201974
201978
  // here for the rows that carry it from the start.
@@ -213618,7 +213622,12 @@ var resBillingCustomer = lazyType(
213618
213622
  "autoRefill?": billingAutoRefill,
213619
213623
  "recentUsage?": billingRecentUsage,
213620
213624
  // Epoch ms a cancelled membership runs through (#6878); absent otherwise.
213621
- "plusEndsAt?": "number"
213625
+ "plusEndsAt?": "number",
213626
+ // #9460: a saved card is on file, and its last four when known. The
213627
+ // Account card's top-up confirm names it; absent on an older server, the
213628
+ // confirm says "your saved card".
213629
+ "cardOnFile?": "boolean",
213630
+ "cardLast4?": "string"
213622
213631
  })
213623
213632
  );
213624
213633
  var reqBillingCheckout = lazyType(
@@ -262319,6 +262328,15 @@ function hasSavedCard(json6) {
262319
262328
  return pm !== void 0 && pm !== null;
262320
262329
  }
262321
262330
  __name(hasSavedCard, "hasSavedCard");
262331
+ function savedCardLast4(json6) {
262332
+ const pm = json6.payment_method;
262333
+ if (typeof pm !== "object" || pm === null) return void 0;
262334
+ const flat = pm.last4;
262335
+ const nested = pm.card?.last4;
262336
+ const last4 = typeof flat === "string" ? flat : nested;
262337
+ return typeof last4 === "string" && /^\d{4}$/.test(last4) ? last4 : void 0;
262338
+ }
262339
+ __name(savedCardLast4, "savedCardLast4");
262322
262340
  function requiredAction(json6) {
262323
262341
  const raw = json6.required_action;
262324
262342
  if (typeof raw !== "object" || raw === null) {
@@ -262609,6 +262627,9 @@ function defaultBilling(opts) {
262609
262627
  }
262610
262628
  }
262611
262629
  const plusEndsAt = isMember(parsed3.plan) ? plusEndsAtFromCustomerJson(rCustomer.Ok().json) : void 0;
262630
+ const cardOnFile = hasSavedCard(rCustomer.Ok().json);
262631
+ const cardLast4 = cardOnFile ? savedCardLast4(rCustomer.Ok().json) : void 0;
262632
+ const card = isMember(parsed3.plan) ? { cardOnFile, ...cardLast4 !== void 0 ? { cardLast4 } : {} } : {};
262612
262633
  if (parsed3.unlimited === true) {
262613
262634
  return Result.Ok({
262614
262635
  enabled: true,
@@ -262617,7 +262638,8 @@ function defaultBilling(opts) {
262617
262638
  grantIncluded: includedCreditsForPlan(parsed3.plan),
262618
262639
  autoRefill: parseAutoRefillJson(rCustomer.Ok().json),
262619
262640
  ...recentUsage !== void 0 ? { recentUsage } : {},
262620
- ...plusEndsAt !== void 0 ? { plusEndsAt } : {}
262641
+ ...plusEndsAt !== void 0 ? { plusEndsAt } : {},
262642
+ ...card
262621
262643
  });
262622
262644
  }
262623
262645
  return Result.Ok({
@@ -262629,7 +262651,8 @@ function defaultBilling(opts) {
262629
262651
  ...parsed3.grantResetsAt !== void 0 ? { grantResetsAt: parsed3.grantResetsAt } : {},
262630
262652
  autoRefill: parseAutoRefillJson(rCustomer.Ok().json),
262631
262653
  ...recentUsage !== void 0 ? { recentUsage } : {},
262632
- ...plusEndsAt !== void 0 ? { plusEndsAt } : {}
262654
+ ...plusEndsAt !== void 0 ? { plusEndsAt } : {},
262655
+ ...card
262633
262656
  });
262634
262657
  },
262635
262658
  async createCheckout({ userId, kind, units, successUrl, customerData }) {
@@ -263059,7 +263082,9 @@ function captureCodegenTurnSettled(vctx, args3) {
263059
263082
  tokens_prompt: args3.emptyTurn.promptTokens,
263060
263083
  tokens_completion: args3.emptyTurn.completionTokens,
263061
263084
  tokens_total: args3.emptyTurn.totalTokens,
263062
- waived_cents: args3.emptyTurn.waivedCents
263085
+ waived_cents: args3.emptyTurn.waivedCents,
263086
+ // #9437: a pass waived because it planned through its output allowance.
263087
+ ...args3.emptyTurn.cause === void 0 ? {} : { no_code_cause: args3.emptyTurn.cause }
263063
263088
  },
263064
263089
  // #9776: a tapped option, and whether the agent's own turn changed anything.
263065
263090
  ...args3.chipPrompt === true ? { chip_prompt: true } : {},
@@ -290368,6 +290393,10 @@ function readAgentWakeBudget(raw) {
290368
290393
  __name(readAgentWakeBudget, "readAgentWakeBudget");
290369
290394
  var REPORT_IS_AUTHORITATIVE = "This report is the platform's own record of what this build changed; read the app again only for a question it does not answer.";
290370
290395
  var THINKING_CAP_SENTENCE = "The build you dispatched planned until it used its whole output allowance and stopped before it wrote any code. No files changed and no version was saved. The same request will stop the same way, so the way forward is smaller parts: tell the person in one line that this pass saved nothing and that you are building it in smaller parts, then dispatch the parts now, each its own edit_vibe of one feature in one or two files, all in this round and in build order, so each one queues behind the one before it.";
290396
+ var THINKING_CAP_NO_CHARGE_SENTENCE = THINKING_CAP_SENTENCE.replace(
290397
+ "tell the person in one line that this pass saved nothing and that you are building it in smaller parts",
290398
+ "tell the person in one line that this pass saved nothing, is on us with no credits used, and that you are building it in smaller parts"
290399
+ );
290371
290400
  var ACCESS_SUMMARY_MAX_CHARS = 400;
290372
290401
  function capAccessSummary(summary) {
290373
290402
  const flat = summary.replace(/\s+/g, " ").trim();
@@ -290383,7 +290412,7 @@ function renderBuildSettledSentence(outcome) {
290383
290412
  return reason === void 0 ? "The build you dispatched did not finish \u2014 it failed. Nothing was saved." : `The build you dispatched did not finish \u2014 it failed. Nothing was saved. The error was: ${reason}`;
290384
290413
  }
290385
290414
  if (outcome.outcome === "no-code")
290386
- return outcome.noCodeCause === "thinking-cap" ? `${THINKING_CAP_SENTENCE} ${REPORT_IS_AUTHORITATIVE}` : `The build you dispatched finished and made no changes to the app. No files changed and no version was saved. ${REPORT_IS_AUTHORITATIVE}`;
290415
+ return outcome.noCodeCause === "thinking-cap" ? `${outcome.noCharge === true ? THINKING_CAP_NO_CHARGE_SENTENCE : THINKING_CAP_SENTENCE} ${REPORT_IS_AUTHORITATIVE}` : `The build you dispatched finished and made no changes to the app. No files changed and no version was saved. ${REPORT_IS_AUTHORITATIVE}`;
290387
290416
  const settled = outcome.settled ?? (touched.length === 0 ? void 0 : classifyTurnReach(touched));
290388
290417
  const facts = [`${BUILD_SAVED_LEAD}${touched.length === 0 ? "" : ` (${touched.join(", ")})`}.`];
290389
290418
  if (settled !== void 0) {
@@ -373815,6 +373844,12 @@ function isEmptyTurnOutput(args3) {
373815
373844
  return args3.msgs.every(isNothing);
373816
373845
  }
373817
373846
  __name(isEmptyTurnOutput, "isEmptyTurnOutput");
373847
+ function isThinkingCapPass(args3) {
373848
+ if (canonicalModelUsage(args3.mode) !== "codegen") return false;
373849
+ if (args3.saved || args3.applied || (args3.touchedPaths?.length ?? 0) > 0) return false;
373850
+ return noCodeCause(args3.end) === "thinking-cap";
373851
+ }
373852
+ __name(isThinkingCapPass, "isThinkingCapPass");
373818
373853
 
373819
373854
  // ../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/svc/intern/persist-url-research.ts
373820
373855
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
@@ -374776,6 +374811,7 @@ async function handlePromptContext({
374776
374811
  const firstBuildPromptVariant = frontendDraft === true ? "initial-oneshot" : void 0;
374777
374812
  const freeRepair = agentDispatched === true && isFreeRepairBuild(promptId);
374778
374813
  let emptyTurn = false;
374814
+ let thinkingCap = false;
374779
374815
  const promptContextValues = /* @__PURE__ */ __name(() => ({
374780
374816
  userId: req2._auth.verifiedAuth.claims.userId,
374781
374817
  chatId: req2.chatId,
@@ -374872,6 +374908,8 @@ async function handlePromptContext({
374872
374908
  // #8977 (owner, 2026-11-18): an empty turn is on us. The row records the usage, the guest
374873
374909
  // meter leaves it out, and no Autumn track is sent below.
374874
374910
  ...emptyTurn ? { emptyTurn: true, platformFunded: true } : {},
374911
+ // #9437 (owner, 2026-11-17): the waiver's named cause, so these passes count apart.
374912
+ ...emptyTurn && thinkingCap ? { noCodeCause: "thinking-cap" } : {},
374875
374913
  // Platform-initiated turn marker. Nothing sets it since #5647; kept so
374876
374914
  // historical rows and this stamp speak the same vocabulary. Ordinary
374877
374915
  // user turns carry no initiator.
@@ -375139,7 +375177,7 @@ async function handlePromptContext({
375139
375177
  if (saveRepair !== void 0) value2.saveRepair = { repaired: [...saveRepair.repaired], attempts: saveRepair.attempts };
375140
375178
  if (seedRepair !== void 0) value2.seedRepair = { repaired: [...seedRepair.repaired], attempts: seedRepair.attempts };
375141
375179
  if (publishHold !== void 0 && fsRef.IsSome()) value2.publishHold = { findings: publishHold.findings.map((f3) => ({ ...f3 })) };
375142
- emptyTurn = byok !== true && isEmptyTurnOutput({
375180
+ const emptyOutput = isEmptyTurnOutput({
375143
375181
  mode: req2.mode,
375144
375182
  msgs: collectedMsgs,
375145
375183
  saved: fsRef.IsSome(),
@@ -375147,6 +375185,14 @@ async function handlePromptContext({
375147
375185
  touchedPaths: value2.touchedPaths,
375148
375186
  rounds: value2.usage.given.length
375149
375187
  });
375188
+ thinkingCap = byok !== true && isThinkingCapPass({
375189
+ mode: req2.mode,
375190
+ end: value2,
375191
+ saved: fsRef.IsSome(),
375192
+ applied: value2.settled?.applied === true,
375193
+ touchedPaths: value2.touchedPaths
375194
+ });
375195
+ emptyTurn = byok !== true && (emptyOutput || thinkingCap);
375150
375196
  const rSql = await exception2Result(async () => {
375151
375197
  const values = promptContextValues();
375152
375198
  await vctx.sql.db.insert(vctx.sql.tables.promptContexts).values(values);
@@ -375365,6 +375411,7 @@ async function handlePromptContext({
375365
375411
  ...releaseMint2 === void 0 ? {} : { releaseMint: releaseMint2 },
375366
375412
  ...emptyTurn ? {
375367
375413
  emptyTurn: {
375414
+ ...thinkingCap ? { cause: "thinking-cap" } : {},
375368
375415
  promptTokens: value2.usage.calculated.prompt_tokens,
375369
375416
  completionTokens: value2.usage.calculated.completion_tokens,
375370
375417
  totalTokens: value2.usage.calculated.total_tokens,
@@ -395004,7 +395051,16 @@ __name(admitClosingOptions, "admitClosingOptions");
395004
395051
  async function appInScope(vctx, args3) {
395005
395052
  if (args3.chatId !== void 0) {
395006
395053
  const rApp = await resolveChatApp(vctx, args3.actor, args3.chatId);
395007
- return rApp.isOk() ? rApp.Ok() : void 0;
395054
+ if (rApp.isOk()) return rApp.Ok();
395055
+ const rFollowed = await exception2Result(() => followAgentActor(vctx, args3.actor, args3.chatId));
395056
+ if (rFollowed.isErr()) {
395057
+ vctx.logger.Warn().Err(rFollowed).Str("chatId", args3.chatId).Msg("closing-options-actor-follow-failed");
395058
+ return void 0;
395059
+ }
395060
+ const followed = rFollowed.Ok();
395061
+ if (followed.ownerHandle === args3.actor.ownerHandle) return void 0;
395062
+ const rMoved = await resolveChatApp(vctx, followed, args3.chatId);
395063
+ return rMoved.isOk() ? rMoved.Ok() : void 0;
395008
395064
  }
395009
395065
  const slug = args3.actor.scope?.appSlug;
395010
395066
  return slug === void 0 ? void 0 : { ownerHandle: args3.actor.scope?.ownerHandle ?? args3.actor.ownerHandle, appSlug: slug };
@@ -399409,7 +399465,11 @@ async function settlePromptTurn(args3) {
399409
399465
  ...facts.errorReason === void 0 ? {} : { errorReason: facts.errorReason },
399410
399466
  // #9437: a no-code build that planned through its whole output allowance says so,
399411
399467
  // so the agent sends smaller parts instead of the same request again.
399412
- ...terminal.noCodeCause === void 0 || facts.errored || terminal.settled?.applied === true ? {} : { noCodeCause: terminal.noCodeCause },
399468
+ ...terminal.noCodeCause === void 0 || facts.errored || terminal.settled?.applied === true ? {} : {
399469
+ noCodeCause: terminal.noCodeCause,
399470
+ // #9437: the charge site waived this pass, so the agent can say it was on us.
399471
+ ...terminal.emptyTurn?.cause === "thinking-cap" ? { noCharge: true } : {}
399472
+ },
399413
399473
  // Owner directive 2026-10-05: the chat's first build does not send the
399414
399474
  // agent to wait for its picture. The same fact the settled event records.
399415
399475
  ...preAssembled?.isInitialTurn === true ? { firstBuild: true, appUrl: appUrl(resChat.ownerHandle, resChat.appSlug) } : {}
@@ -4139,6 +4139,10 @@ var init_block_stream = __esm({
4139
4139
  // meter leaves the row out and no Autumn track is sent. Written beside
4140
4140
  // `platformFunded`.
4141
4141
  "emptyTurn?": "true",
4142
+ // Why an `emptyTurn` row was waived, when it was a named cause rather than an
4143
+ // empty reply: `thinking-cap`, the builder planned through its whole output
4144
+ // allowance and wrote no code (VibesDIY/vibes.diy#9437, owner 2026-11-17).
4145
+ "noCodeCause?": "'thinking-cap'",
4142
4146
  // The platform paid this row's usage (a guest's turn, `guest-credit-meter.ts`,
4143
4147
  // a free repair or an empty turn above). Usually stamped by SQL after the insert; declared
4144
4148
  // here for the rows that carry it from the start.
@@ -16879,7 +16883,12 @@ var init_billing_msg = __esm({
16879
16883
  "autoRefill?": billingAutoRefill,
16880
16884
  "recentUsage?": billingRecentUsage,
16881
16885
  // Epoch ms a cancelled membership runs through (#6878); absent otherwise.
16882
- "plusEndsAt?": "number"
16886
+ "plusEndsAt?": "number",
16887
+ // #9460: a saved card is on file, and its last four when known. The
16888
+ // Account card's top-up confirm names it; absent on an older server, the
16889
+ // confirm says "your saved card".
16890
+ "cardOnFile?": "boolean",
16891
+ "cardLast4?": "string"
16883
16892
  })
16884
16893
  );
16885
16894
  __name(isResBillingCustomer, "isResBillingCustomer");
@@ -30624,6 +30633,14 @@ function hasSavedCard(json3) {
30624
30633
  const pm = json3.payment_method;
30625
30634
  return pm !== void 0 && pm !== null;
30626
30635
  }
30636
+ function savedCardLast4(json3) {
30637
+ const pm = json3.payment_method;
30638
+ if (typeof pm !== "object" || pm === null) return void 0;
30639
+ const flat = pm.last4;
30640
+ const nested = pm.card?.last4;
30641
+ const last4 = typeof flat === "string" ? flat : nested;
30642
+ return typeof last4 === "string" && /^\d{4}$/.test(last4) ? last4 : void 0;
30643
+ }
30627
30644
  function requiredAction(json3) {
30628
30645
  const raw = json3.required_action;
30629
30646
  if (typeof raw !== "object" || raw === null) {
@@ -30906,6 +30923,9 @@ function defaultBilling(opts) {
30906
30923
  }
30907
30924
  }
30908
30925
  const plusEndsAt = isMember(parsed.plan) ? plusEndsAtFromCustomerJson(rCustomer.Ok().json) : void 0;
30926
+ const cardOnFile = hasSavedCard(rCustomer.Ok().json);
30927
+ const cardLast4 = cardOnFile ? savedCardLast4(rCustomer.Ok().json) : void 0;
30928
+ const card = isMember(parsed.plan) ? { cardOnFile, ...cardLast4 !== void 0 ? { cardLast4 } : {} } : {};
30909
30929
  if (parsed.unlimited === true) {
30910
30930
  return Result10.Ok({
30911
30931
  enabled: true,
@@ -30914,7 +30934,8 @@ function defaultBilling(opts) {
30914
30934
  grantIncluded: includedCreditsForPlan(parsed.plan),
30915
30935
  autoRefill: parseAutoRefillJson(rCustomer.Ok().json),
30916
30936
  ...recentUsage !== void 0 ? { recentUsage } : {},
30917
- ...plusEndsAt !== void 0 ? { plusEndsAt } : {}
30937
+ ...plusEndsAt !== void 0 ? { plusEndsAt } : {},
30938
+ ...card
30918
30939
  });
30919
30940
  }
30920
30941
  return Result10.Ok({
@@ -30926,7 +30947,8 @@ function defaultBilling(opts) {
30926
30947
  ...parsed.grantResetsAt !== void 0 ? { grantResetsAt: parsed.grantResetsAt } : {},
30927
30948
  autoRefill: parseAutoRefillJson(rCustomer.Ok().json),
30928
30949
  ...recentUsage !== void 0 ? { recentUsage } : {},
30929
- ...plusEndsAt !== void 0 ? { plusEndsAt } : {}
30950
+ ...plusEndsAt !== void 0 ? { plusEndsAt } : {},
30951
+ ...card
30930
30952
  });
30931
30953
  },
30932
30954
  async createCheckout({ userId, kind, units, successUrl, customerData }) {
@@ -31168,6 +31190,7 @@ var init_billing = __esm({
31168
31190
  __name(planFromReads, "planFromReads");
31169
31191
  __name(plusEndsAtFromCustomerJson, "plusEndsAtFromCustomerJson");
31170
31192
  __name(hasSavedCard, "hasSavedCard");
31193
+ __name(savedCardLast4, "savedCardLast4");
31171
31194
  __name(requiredAction, "requiredAction");
31172
31195
  __name(autumnErrorCode, "autumnErrorCode");
31173
31196
  __name(creditsGrantedFromRedeem, "creditsGrantedFromRedeem");
@@ -31424,7 +31447,9 @@ function captureCodegenTurnSettled(vctx, args) {
31424
31447
  tokens_prompt: args.emptyTurn.promptTokens,
31425
31448
  tokens_completion: args.emptyTurn.completionTokens,
31426
31449
  tokens_total: args.emptyTurn.totalTokens,
31427
- waived_cents: args.emptyTurn.waivedCents
31450
+ waived_cents: args.emptyTurn.waivedCents,
31451
+ // #9437: a pass waived because it planned through its output allowance.
31452
+ ...args.emptyTurn.cause === void 0 ? {} : { no_code_cause: args.emptyTurn.cause }
31428
31453
  },
31429
31454
  // #9776: a tapped option, and whether the agent's own turn changed anything.
31430
31455
  ...args.chipPrompt === true ? { chip_prompt: true } : {},
@@ -55434,7 +55459,7 @@ function renderBuildSettledSentence(outcome) {
55434
55459
  return reason === void 0 ? "The build you dispatched did not finish \u2014 it failed. Nothing was saved." : `The build you dispatched did not finish \u2014 it failed. Nothing was saved. The error was: ${reason}`;
55435
55460
  }
55436
55461
  if (outcome.outcome === "no-code")
55437
- return outcome.noCodeCause === "thinking-cap" ? `${THINKING_CAP_SENTENCE} ${REPORT_IS_AUTHORITATIVE}` : `The build you dispatched finished and made no changes to the app. No files changed and no version was saved. ${REPORT_IS_AUTHORITATIVE}`;
55462
+ return outcome.noCodeCause === "thinking-cap" ? `${outcome.noCharge === true ? THINKING_CAP_NO_CHARGE_SENTENCE : THINKING_CAP_SENTENCE} ${REPORT_IS_AUTHORITATIVE}` : `The build you dispatched finished and made no changes to the app. No files changed and no version was saved. ${REPORT_IS_AUTHORITATIVE}`;
55438
55463
  const settled = outcome.settled ?? (touched.length === 0 ? void 0 : classifyTurnReach(touched));
55439
55464
  const facts = [`${BUILD_SAVED_LEAD}${touched.length === 0 ? "" : ` (${touched.join(", ")})`}.`];
55440
55465
  if (settled !== void 0) {
@@ -55540,7 +55565,7 @@ function fireAgentWakeTurn(args) {
55540
55565
  });
55541
55566
  if (vctx.waitUntil !== void 0) vctx.waitUntil(run);
55542
55567
  }
55543
- var AGENT_WAKE_MAX_BUDGET, REPORT_IS_AUTHORITATIVE, THINKING_CAP_SENTENCE, ACCESS_SUMMARY_MAX_CHARS, ENTRY_UNTOUCHED_CLAUSE, SEED_REPAIR_LINE, DESIGN_CHECK_LEAD, PUBLISH_HOLD_LEAD, SEE_IT_LINE, BUILD_PICTURE_LINE, FIRST_BUILD_SEEN_LINE;
55568
+ var AGENT_WAKE_MAX_BUDGET, REPORT_IS_AUTHORITATIVE, THINKING_CAP_SENTENCE, THINKING_CAP_NO_CHARGE_SENTENCE, ACCESS_SUMMARY_MAX_CHARS, ENTRY_UNTOUCHED_CLAUSE, SEED_REPAIR_LINE, DESIGN_CHECK_LEAD, PUBLISH_HOLD_LEAD, SEE_IT_LINE, BUILD_PICTURE_LINE, FIRST_BUILD_SEEN_LINE;
55544
55569
  var init_agent_wake = __esm({
55545
55570
  "../vibes.diy/api/svc/intern/agent-wake.ts"() {
55546
55571
  "use strict";
@@ -55556,6 +55581,10 @@ var init_agent_wake = __esm({
55556
55581
  __name(readAgentWakeBudget, "readAgentWakeBudget");
55557
55582
  REPORT_IS_AUTHORITATIVE = "This report is the platform's own record of what this build changed; read the app again only for a question it does not answer.";
55558
55583
  THINKING_CAP_SENTENCE = "The build you dispatched planned until it used its whole output allowance and stopped before it wrote any code. No files changed and no version was saved. The same request will stop the same way, so the way forward is smaller parts: tell the person in one line that this pass saved nothing and that you are building it in smaller parts, then dispatch the parts now, each its own edit_vibe of one feature in one or two files, all in this round and in build order, so each one queues behind the one before it.";
55584
+ THINKING_CAP_NO_CHARGE_SENTENCE = THINKING_CAP_SENTENCE.replace(
55585
+ "tell the person in one line that this pass saved nothing and that you are building it in smaller parts",
55586
+ "tell the person in one line that this pass saved nothing, is on us with no credits used, and that you are building it in smaller parts"
55587
+ );
55559
55588
  ACCESS_SUMMARY_MAX_CHARS = 400;
55560
55589
  __name(capAccessSummary, "capAccessSummary");
55561
55590
  ENTRY_UNTOUCHED_CLAUSE = `the entry file ${ENTRY_PATH} is not one of them`;
@@ -124663,11 +124692,17 @@ function isEmptyTurnOutput(args) {
124663
124692
  if (args.rounds > 1) return false;
124664
124693
  return args.msgs.every(isNothing);
124665
124694
  }
124695
+ function isThinkingCapPass(args) {
124696
+ if (canonicalModelUsage(args.mode) !== "codegen") return false;
124697
+ if (args.saved || args.applied || (args.touchedPaths?.length ?? 0) > 0) return false;
124698
+ return noCodeCause(args.end) === "thinking-cap";
124699
+ }
124666
124700
  var FRAME_TYPES;
124667
124701
  var init_empty_turn = __esm({
124668
124702
  "../vibes.diy/api/svc/intern/empty-turn.ts"() {
124669
124703
  "use strict";
124670
124704
  init_types3();
124705
+ init_build_no_code_cause();
124671
124706
  FRAME_TYPES = /* @__PURE__ */ new Set([
124672
124707
  "block.begin",
124673
124708
  "block.end",
@@ -124677,6 +124712,7 @@ var init_empty_turn = __esm({
124677
124712
  ]);
124678
124713
  __name(isNothing, "isNothing");
124679
124714
  __name(isEmptyTurnOutput, "isEmptyTurnOutput");
124715
+ __name(isThinkingCapPass, "isThinkingCapPass");
124680
124716
  }
124681
124717
  });
124682
124718
 
@@ -125673,6 +125709,7 @@ async function handlePromptContext({
125673
125709
  const firstBuildPromptVariant = frontendDraft === true ? "initial-oneshot" : void 0;
125674
125710
  const freeRepair = agentDispatched === true && isFreeRepairBuild(promptId);
125675
125711
  let emptyTurn = false;
125712
+ let thinkingCap = false;
125676
125713
  const promptContextValues = /* @__PURE__ */ __name(() => ({
125677
125714
  userId: req2._auth.verifiedAuth.claims.userId,
125678
125715
  chatId: req2.chatId,
@@ -125769,6 +125806,8 @@ async function handlePromptContext({
125769
125806
  // #8977 (owner, 2026-11-18): an empty turn is on us. The row records the usage, the guest
125770
125807
  // meter leaves it out, and no Autumn track is sent below.
125771
125808
  ...emptyTurn ? { emptyTurn: true, platformFunded: true } : {},
125809
+ // #9437 (owner, 2026-11-17): the waiver's named cause, so these passes count apart.
125810
+ ...emptyTurn && thinkingCap ? { noCodeCause: "thinking-cap" } : {},
125772
125811
  // Platform-initiated turn marker. Nothing sets it since #5647; kept so
125773
125812
  // historical rows and this stamp speak the same vocabulary. Ordinary
125774
125813
  // user turns carry no initiator.
@@ -126036,7 +126075,7 @@ async function handlePromptContext({
126036
126075
  if (saveRepair !== void 0) value.saveRepair = { repaired: [...saveRepair.repaired], attempts: saveRepair.attempts };
126037
126076
  if (seedRepair !== void 0) value.seedRepair = { repaired: [...seedRepair.repaired], attempts: seedRepair.attempts };
126038
126077
  if (publishHold !== void 0 && fsRef.IsSome()) value.publishHold = { findings: publishHold.findings.map((f) => ({ ...f })) };
126039
- emptyTurn = byok !== true && isEmptyTurnOutput({
126078
+ const emptyOutput = isEmptyTurnOutput({
126040
126079
  mode: req2.mode,
126041
126080
  msgs: collectedMsgs,
126042
126081
  saved: fsRef.IsSome(),
@@ -126044,6 +126083,14 @@ async function handlePromptContext({
126044
126083
  touchedPaths: value.touchedPaths,
126045
126084
  rounds: value.usage.given.length
126046
126085
  });
126086
+ thinkingCap = byok !== true && isThinkingCapPass({
126087
+ mode: req2.mode,
126088
+ end: value,
126089
+ saved: fsRef.IsSome(),
126090
+ applied: value.settled?.applied === true,
126091
+ touchedPaths: value.touchedPaths
126092
+ });
126093
+ emptyTurn = byok !== true && (emptyOutput || thinkingCap);
126047
126094
  const rSql = await exception2Result267(async () => {
126048
126095
  const values = promptContextValues();
126049
126096
  await vctx.sql.db.insert(vctx.sql.tables.promptContexts).values(values);
@@ -126262,6 +126309,7 @@ async function handlePromptContext({
126262
126309
  ...releaseMint2 === void 0 ? {} : { releaseMint: releaseMint2 },
126263
126310
  ...emptyTurn ? {
126264
126311
  emptyTurn: {
126312
+ ...thinkingCap ? { cause: "thinking-cap" } : {},
126265
126313
  promptTokens: value.usage.calculated.prompt_tokens,
126266
126314
  completionTokens: value.usage.calculated.completion_tokens,
126267
126315
  totalTokens: value.usage.calculated.total_tokens,
@@ -146744,7 +146792,16 @@ async function admitClosingOptions(vctx, args, asked) {
146744
146792
  async function appInScope(vctx, args) {
146745
146793
  if (args.chatId !== void 0) {
146746
146794
  const rApp = await resolveChatApp(vctx, args.actor, args.chatId);
146747
- return rApp.isOk() ? rApp.Ok() : void 0;
146795
+ if (rApp.isOk()) return rApp.Ok();
146796
+ const rFollowed = await exception2Result326(() => followAgentActor(vctx, args.actor, args.chatId));
146797
+ if (rFollowed.isErr()) {
146798
+ vctx.logger.Warn().Err(rFollowed).Str("chatId", args.chatId).Msg("closing-options-actor-follow-failed");
146799
+ return void 0;
146800
+ }
146801
+ const followed = rFollowed.Ok();
146802
+ if (followed.ownerHandle === args.actor.ownerHandle) return void 0;
146803
+ const rMoved = await resolveChatApp(vctx, followed, args.chatId);
146804
+ return rMoved.isOk() ? rMoved.Ok() : void 0;
146748
146805
  }
146749
146806
  const slug = args.actor.scope?.appSlug;
146750
146807
  return slug === void 0 ? void 0 : { ownerHandle: args.actor.scope?.ownerHandle ?? args.actor.ownerHandle, appSlug: slug };
@@ -151387,7 +151444,11 @@ async function settlePromptTurn(args) {
151387
151444
  ...facts.errorReason === void 0 ? {} : { errorReason: facts.errorReason },
151388
151445
  // #9437: a no-code build that planned through its whole output allowance says so,
151389
151446
  // so the agent sends smaller parts instead of the same request again.
151390
- ...terminal.noCodeCause === void 0 || facts.errored || terminal.settled?.applied === true ? {} : { noCodeCause: terminal.noCodeCause },
151447
+ ...terminal.noCodeCause === void 0 || facts.errored || terminal.settled?.applied === true ? {} : {
151448
+ noCodeCause: terminal.noCodeCause,
151449
+ // #9437: the charge site waived this pass, so the agent can say it was on us.
151450
+ ...terminal.emptyTurn?.cause === "thinking-cap" ? { noCharge: true } : {}
151451
+ },
151391
151452
  // Owner directive 2026-10-05: the chat's first build does not send the
151392
151453
  // agent to wait for its picture. The same fact the settled event records.
151393
151454
  ...preAssembled?.isInitialTurn === true ? { firstBuild: true, appUrl: appUrl(resChat.ownerHandle, resChat.appSlug) } : {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibes-diy",
3
- "version": "14.3.379",
3
+ "version": "14.3.380",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "description": "Command-line tool for vibes.diy — generate, edit, pull, push, and publish AI-built apps",
@@ -41,13 +41,13 @@
41
41
  "@neondatabase/serverless": "~1.2.0",
42
42
  "@noble/hashes": "~2.4.0",
43
43
  "@shadcn/lint": "~0.2.3",
44
- "@vibes.diy/api-impl": "14.3.379",
45
- "@vibes.diy/api-types": "14.3.379",
46
- "@vibes.diy/call-ai-v2": "14.3.379",
47
- "@vibes.diy/cmd-harness": "14.3.379",
48
- "@vibes.diy/cmd-tools": "14.3.379",
49
- "@vibes.diy/identity": "14.3.379",
50
- "@vibes.diy/prompts": "14.3.379",
44
+ "@vibes.diy/api-impl": "14.3.380",
45
+ "@vibes.diy/api-types": "14.3.380",
46
+ "@vibes.diy/call-ai-v2": "14.3.380",
47
+ "@vibes.diy/cmd-harness": "14.3.380",
48
+ "@vibes.diy/cmd-tools": "14.3.380",
49
+ "@vibes.diy/identity": "14.3.380",
50
+ "@vibes.diy/prompts": "14.3.380",
51
51
  "acorn": "~8.19.0",
52
52
  "acorn-jsx": "~5.3.2",
53
53
  "arktype": "~2.2.9",