vibes-diy 14.3.444 → 14.3.445

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.
@@ -1070,6 +1070,7 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1070
1070
  releaseSeq: number;
1071
1071
  created: string;
1072
1072
  published: boolean;
1073
+ byHandle?: string | undefined;
1073
1074
  }[];
1074
1075
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1075
1076
  type: "vibes-diy.cli.assets-ls";
@@ -1,10 +1,12 @@
1
1
  import { Result, EventoHandler } from "@adviser/cement";
2
- import { appLinksIn, foldAgentReplies } from "@vibes.diy/api-types";
3
- import { CliCtx } from "../cli-ctx.js";
2
+ import { appLinksIn, foldAgentReplies, type AgentPicture } from "@vibes.diy/api-types";
3
+ import { CliCtx, type CliOutput } from "../cli-ctx.js";
4
4
  import { WrapCmdTSMsg } from "../cmd-evento.js";
5
5
  import { type PutAssetApi } from "./put-asset-core.js";
6
+ import { type AgentPictureDownloadCtx } from "./agent-picture-download.js";
6
7
  import type { VibesFileContent } from "@vibes.diy/call-ai-v2";
7
8
  export { foldAgentReplies, appLinksIn };
9
+ export declare function agentPictureHook(download: AgentPictureDownloadCtx, output: CliOutput, json: boolean): (picture: AgentPicture) => Promise<void>;
8
10
  export declare const ReqAgent: import("arktype/internal/variants/object.ts").ObjectType<{
9
11
  type: "vibes-diy.cli.agent";
10
12
  apiUrl: string;
@@ -1,9 +1,9 @@
1
1
  import { resolve as resolvePath, basename } from "node:path";
2
2
  import { array, command, flag, multioption, number, option, positional, string } from "cmd-ts";
3
- import { Result, Option } from "@adviser/cement";
3
+ import { Result, exception2Result, Option, } from "@adviser/cement";
4
4
  import { type } from "arktype";
5
5
  import { AGENT_CHAT_APP_SLUG, appLinksIn, foldAgentReplies, splitAgentFold } from "@vibes.diy/api-types";
6
- import { OpenChatSessionError, openChatSession, } from "@vibes.diy/api-impl";
6
+ import { OpenChatSessionError, openChatSession } from "@vibes.diy/api-impl";
7
7
  import { cmdTsDefaultArgs } from "../cli-ctx.js";
8
8
  import { sendMsg } from "../cmd-evento.js";
9
9
  import { resolveHandle } from "../resolve-handle.js";
@@ -15,6 +15,22 @@ import { inferMimeType } from "./infer-mime-type.js";
15
15
  import { putAssetFile } from "./put-asset-core.js";
16
16
  import { downloadAgentPicture } from "./agent-picture-download.js";
17
17
  export { foldAgentReplies, appLinksIn };
18
+ export function agentPictureHook(download, output, json) {
19
+ return async (picture) => {
20
+ const rPath = await downloadAgentPicture(download, picture);
21
+ const base = { name: picture.name, mimeType: picture.mimeType, url: picture.url };
22
+ if (json) {
23
+ const line = rPath.isOk() ? { ...base, path: rPath.Ok() } : { ...base, error: rPath.Err().message };
24
+ output.stdout(JSON.stringify({ type: "vibes-diy.cli.agent-picture", ...line }) + "\n");
25
+ }
26
+ else if (rPath.isOk())
27
+ output.stdout(`[picture: ${rPath.Ok()}]\n\n`);
28
+ else
29
+ output.stderr(`[picture not saved: ${rPath.Err().message}]\n`);
30
+ if (rPath.isErr())
31
+ return Promise.reject(rPath.Err());
32
+ };
33
+ }
18
34
  export const ReqAgent = type({
19
35
  type: "'vibes-diy.cli.agent'",
20
36
  apiUrl: "string",
@@ -121,19 +137,18 @@ export const agentEvento = {
121
137
  return Result.Err(rBlocks.Err());
122
138
  fileBlocks = rBlocks.Ok();
123
139
  }
124
- let session;
125
- try {
126
- session = await openChatSession({
127
- api: api,
128
- openReq: { ownerHandle, appSlug: AGENT_CHAT_APP_SLUG, mode: "codegen", ...rConversation.Ok() },
129
- renderError: (e) => formatErr(e),
130
- });
131
- }
132
- catch (e) {
140
+ const rSession = await exception2Result(() => openChatSession({
141
+ api: api,
142
+ openReq: { ownerHandle, appSlug: AGENT_CHAT_APP_SLUG, mode: "codegen", ...rConversation.Ok() },
143
+ renderError: (e) => formatErr(e),
144
+ }));
145
+ if (rSession.isErr()) {
146
+ const e = rSession.Err();
133
147
  if (e instanceof OpenChatSessionError && e.stage === "overloaded")
134
148
  return Result.Err("The agent is busy with other builds right now. Try again in a minute.");
135
149
  return Result.Err(`Failed to open the agent chat: ${e instanceof Error ? e.message : String(e)}`);
136
150
  }
151
+ const session = rSession.Ok();
137
152
  const feed = makeChatEventFeed(session);
138
153
  try {
139
154
  const turnOpts = {
@@ -174,18 +189,7 @@ export const agentEvento = {
174
189
  if (args.json)
175
190
  ectx.output.stdout(JSON.stringify({ type: "vibes-diy.cli.agent-copy", ...copy }) + "\n");
176
191
  },
177
- onPicture: async (picture) => {
178
- const rPath = await downloadAgentPicture({ getToken: () => api.cfg.getToken(), ...(ectx.fetch === undefined ? {} : { fetch: ectx.fetch }) }, picture);
179
- const base = { name: picture.name, mimeType: picture.mimeType, url: picture.url };
180
- if (args.json) {
181
- const line = rPath.isOk() ? { ...base, path: rPath.Ok() } : { ...base, error: rPath.Err().message };
182
- ectx.output.stdout(JSON.stringify({ type: "vibes-diy.cli.agent-picture", ...line }) + "\n");
183
- }
184
- else if (rPath.isOk())
185
- ectx.output.stdout(`[picture: ${rPath.Ok()}]\n\n`);
186
- else
187
- ectx.output.stderr(`[picture not saved: ${rPath.Err().message}]\n`);
188
- },
192
+ onPicture: agentPictureHook({ getToken: () => api.cfg.getToken(), ...(ectx.fetch === undefined ? {} : { fetch: ectx.fetch }) }, ectx.output, args.json),
189
193
  });
190
194
  return sendMsg(ctx, {
191
195
  type: "vibes-diy.cli.res-agent",
@@ -1,3 +1,4 @@
1
+ import { exception2Result } from "@adviser/cement";
1
2
  import { HANDLE_REQUIRED_CLI_MESSAGE, isHandleRequiredError } from "../handle-required.js";
2
3
  export function formatErr(err) {
3
4
  if (isHandleRequiredError(err))
@@ -19,10 +20,6 @@ export function formatErr(err) {
19
20
  const message = err.message;
20
21
  if (typeof message === "string")
21
22
  return message;
22
- try {
23
- return JSON.stringify(err);
24
- }
25
- catch {
26
- return String(err);
27
- }
23
+ const rJson = exception2Result(() => JSON.stringify(err));
24
+ return rJson.isOk() ? rJson.Ok() : String(err);
28
25
  }
@@ -63,17 +63,15 @@ async function runGenerateRound(api, args, progress) {
63
63
  ...(args.stylePin === undefined ? {} : { stylePin: args.stylePin }),
64
64
  ...(args.fastPass === undefined ? {} : { fastPass: args.fastPass }),
65
65
  };
66
- let session;
67
- try {
68
- session = await openChatSession({
69
- api: api,
70
- openReq,
71
- decode: { keepBlock: true },
72
- shouldProceed: () => args.signal?.aborted !== true,
73
- renderError: (e) => formatErr(e),
74
- });
75
- }
76
- catch (e) {
66
+ const rSession = await exception2Result(() => openChatSession({
67
+ api: api,
68
+ openReq,
69
+ decode: { keepBlock: true },
70
+ shouldProceed: () => args.signal?.aborted !== true,
71
+ renderError: (e) => formatErr(e),
72
+ }));
73
+ if (rSession.isErr()) {
74
+ const e = rSession.Err();
77
75
  if (e instanceof OpenChatSessionError && e.stage === "fenced") {
78
76
  return Result.Err("Cancelled by caller after opening the chat");
79
77
  }
@@ -83,6 +81,7 @@ async function runGenerateRound(api, args, progress) {
83
81
  }
84
82
  return Result.Err(`Failed to open chat: ${e instanceof Error ? e.message : String(e)}`);
85
83
  }
84
+ const session = rSession.Ok();
86
85
  if (args.signal?.aborted) {
87
86
  await session.close();
88
87
  return Result.Err("Cancelled by caller after opening the chat");
@@ -315,14 +315,12 @@ export function createMcpServer(deps) {
315
315
  if (progressToken === undefined)
316
316
  return;
317
317
  progressCount += 1;
318
- try {
318
+ await exception2Result(async () => {
319
319
  await extra.sendNotification({
320
320
  method: "notifications/progress",
321
321
  params: { progressToken, progress: progressCount, message: `${level === "warn" ? "warning: " : ""}${message}` },
322
322
  });
323
- }
324
- catch {
325
- }
323
+ });
326
324
  };
327
325
  const baseDir = await mkdtemp(join(tmpdir(), "vibes-generate-"));
328
326
  const startedAt = Date.now();
@@ -25732,6 +25732,7 @@ var init_data_stream = __esm({
25732
25732
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
25733
25733
  init_performance2();
25734
25734
  init_out4();
25735
+ init_esm();
25735
25736
  init_types3();
25736
25737
  init_line_stream();
25737
25738
  init_stats_stream();
@@ -30606,7 +30607,12 @@ var init_app = __esm({
30606
30607
  mode: "'production'|'dev'",
30607
30608
  releaseSeq: "number",
30608
30609
  created: "string",
30609
- published: "boolean"
30610
+ published: "boolean",
30611
+ // #10219: the handle of the person who made this version when it was not
30612
+ // the owner (an editor's turn or a developer push, `Apps.deployerUserId`).
30613
+ // Sent only to the app's owner; absent means the owner
30614
+ // made it (or the caller is not the owner). A handle, never a name or email.
30615
+ "byHandle?": "string"
30610
30616
  })
30611
30617
  );
30612
30618
  resListVersions = lazyType(
@@ -38355,7 +38361,7 @@ function textOnboardingSmsBody(nonce) {
38355
38361
  function textSmsHref(phoneNumber, body) {
38356
38362
  return `sms:${phoneNumber}?&body=${encodeURIComponent(body)}`;
38357
38363
  }
38358
- var TEXT_LINE_CYCLE_START_DAY, TEXT_LINE_CYCLE_START_DAYS, TEXT_NUMBER_ERROR, TEXT_ONBOARDING_GREETING, reqGetTextOnboarding, resGetTextOnboarding, reqGetTextNumber, resGetTextNumber;
38364
+ var TEXT_LINE_CYCLE_START_DAY, TEXT_LINE_CYCLE_START_DAYS, TEXT_NUMBER_ERROR, TEXT_ONBOARDING_GREETING, reqGetTextOnboarding, resGetTextOnboarding, reqGetTextNumber, resGetTextNumber, resGetTextNumberAnswer;
38359
38365
  var init_text_number = __esm({
38360
38366
  "../../home/runner/work/vibes.diy/vibes.diy/vibes.diy/api/types/text-number.ts"() {
38361
38367
  "use strict";
@@ -38408,6 +38414,19 @@ var init_text_number = __esm({
38408
38414
  phoneNumber: "string > 0"
38409
38415
  })
38410
38416
  );
38417
+ resGetTextNumberAnswer = lazyType(
38418
+ () => type({
38419
+ type: "'vibes.diy.res-get-text-number-answer'",
38420
+ answer: "'line'",
38421
+ /** The line with room (E.164). */
38422
+ phoneNumber: "string > 0"
38423
+ }).or({
38424
+ type: "'vibes.diy.res-get-text-number-answer'",
38425
+ answer: "'agent' | 'direct'",
38426
+ /** The web agent's address, without the `?text=` the button adds. */
38427
+ agentUrl: "string > 0"
38428
+ })
38429
+ );
38411
38430
  }
38412
38431
  });
38413
38432
 
@@ -134412,12 +134431,13 @@ ${JSON.stringify(example, null, 2)}
134412
134431
  \`\`\``;
134413
134432
  }
134414
134433
  async function schemaSystemMessageText(schema5, onDegrade) {
134415
- try {
134416
- return await buildSchemaSystemMessage(schema5);
134417
- } catch (err) {
134434
+ const rMessage = await exception2Result(() => buildSchemaSystemMessage(schema5));
134435
+ if (rMessage.isErr()) {
134436
+ const err = rMessage.Err();
134418
134437
  onDegrade?.(err instanceof Error ? err : new Error(String(err)));
134419
134438
  return bareSchemaInstruction(schema5);
134420
134439
  }
134440
+ return rMessage.Ok();
134421
134441
  }
134422
134442
  var init_build_schema_prompt = __esm({
134423
134443
  "../../home/runner/work/vibes.diy/vibes.diy/prompts/pkg/build-schema-prompt.ts"() {
@@ -134425,6 +134445,7 @@ var init_build_schema_prompt = __esm({
134425
134445
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
134426
134446
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
134427
134447
  init_performance2();
134448
+ init_esm();
134428
134449
  init_dist2();
134429
134450
  __name(buildExample, "buildExample");
134430
134451
  __name(bareSchemaInstruction, "bareSchemaInstruction");
@@ -137356,7 +137377,7 @@ var init_agent_session_instruction = __esm({
137356
137377
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
137357
137378
  init_performance2();
137358
137379
  init_types4();
137359
- AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-23.7";
137380
+ AGENT_SESSION_INSTRUCTION_VERSION = "2026-11-24.2";
137360
137381
  BROWSER_APP_ASK_LINE = 'When the ask names a desktop program, a phone app or software to install (an iPhone, iPad or Android app, or a mobile app, is a phone app), the app is made as one that opens from its own link, and those words say so in a clause: "Making your <app> as an app that opens in your browser", or for a phone app "Making your <app> as an app that opens on your phone from its own link".';
137361
137382
  FIRST_BUILD_SAYS_WHAT_IS_MADE = `On a first build, the words before create_vibe say what will be made in the person's terms, and a control they mention is one the brief asks for. ${BROWSER_APP_ASK_LINE}`;
137362
137383
  REPLY_FOLD = `A reply that runs past about three short sentences, as one often does after tool calls or a build, opens with a summary of one or two plain sentences that stands on its own: what happened, and the one link or question that matters most. Then comes a line holding only ${AGENT_FOLD_MARKER}, then the full reply, shaped by every rule here. The summary is what a phone receives as a text message, and the web page shows the full reply under a More button, so the summary carries that link or question itself. A reply of three short sentences or fewer is its own summary and goes out whole, just as it is. Words written before a tool call go out as their own text the moment the call starts, so keep them to one short sentence of what you are about to do; the result comes in the reply after.`;
@@ -149729,6 +149750,7 @@ var init_error_handling = __esm({
149729
149750
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
149730
149751
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
149731
149752
  init_performance2();
149753
+ init_esm();
149732
149754
  init_key_management();
149733
149755
  init_types9();
149734
149756
  }
@@ -149816,6 +149838,7 @@ var init_streaming = __esm({
149816
149838
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_process();
149817
149839
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
149818
149840
  init_performance2();
149841
+ init_esm();
149819
149842
  init_types9();
149820
149843
  init_key_management();
149821
149844
  init_response_metadata();
@@ -149832,6 +149855,7 @@ var init_api2 = __esm({
149832
149855
  init_virtual_unenv_global_polyfill_cloudflare_unenv_preset_node_console();
149833
149856
  init_performance2();
149834
149857
  init_types9();
149858
+ init_esm();
149835
149859
  init_strategies();
149836
149860
  init_response_metadata();
149837
149861
  init_key_management();
@@ -168586,6 +168610,8 @@ async function getTextNumber(vctx, opts = {}) {
168586
168610
  return phoneNumber === void 0 ? unavailable() : { type: "vibes.diy.res-get-text-number", phoneNumber };
168587
168611
  }
168588
168612
  __name(getTextNumber, "getTextNumber");
168613
+ var TEXT_LINE_FULL_NEW_CHATS_24H = Math.ceil(NEW_CHATS_24H_HOLD * 95 / 100);
168614
+ var TEXT_LINE_FULL_CYCLE_ACTIVE = Math.ceil(LINE_CYCLE_CAP * 95 / 100);
168589
168615
  async function pickOnboardingLine(vctx, cfg, now2) {
168590
168616
  const linq = cfg.linq;
168591
168617
  if (linq === void 0) return void 0;
@@ -169420,11 +169446,8 @@ var DeviceIdVerifyMsg = class {
169420
169446
  }
169421
169447
  findTrustedCA(cert, trustedCAs) {
169422
169448
  return trustedCAs.find((trustedCA) => {
169423
- try {
169424
- return cert.iss === trustedCA.sub;
169425
- } catch {
169426
- return false;
169427
- }
169449
+ const r2 = exception2Result(() => cert.iss === trustedCA.sub);
169450
+ return r2.isOk() ? r2.Ok() : false;
169428
169451
  });
169429
169452
  }
169430
169453
  // #2671: verify the embedded device cert was genuinely issued by the trusted CA,