vibes-diy 14.3.339 → 14.3.341

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.
@@ -211,6 +211,8 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
211
211
  overdueMs: number;
212
212
  healed: boolean;
213
213
  releaseIntervalMs: number | null;
214
+ pausedIntervalMs: number | null;
215
+ settingsUrl: string;
214
216
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
215
217
  type: "vibes-diy.cli.app-chips";
216
218
  appSlug: string;
@@ -1101,6 +1103,8 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1101
1103
  state: "dead" | "healthy" | "overdue" | "running" | "unscheduled";
1102
1104
  intervalMs: number | null;
1103
1105
  nextAlarmAt: string | null;
1106
+ pausedIntervalMs: number | null;
1107
+ settingsUrl: string;
1104
1108
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1105
1109
  type: "vibes-diy.cli.app-screenshot";
1106
1110
  appSlug: string;
@@ -1453,6 +1457,7 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1453
1457
  type: "vibes-diy.cli.phone-link-alerts";
1454
1458
  apiUrl: string;
1455
1459
  handle: string;
1460
+ settles?: true | undefined;
1456
1461
  }, {
1457
1462
  type: "vibes-diy.cli.res-phone-link-alerts";
1458
1463
  ownerHandle: string;
@@ -1474,6 +1479,17 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1474
1479
  expiresAt?: string | undefined;
1475
1480
  }[];
1476
1481
  more: boolean;
1482
+ }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1483
+ type: "vibes-diy.cli.phone-link-settle-alert";
1484
+ apiUrl: string;
1485
+ handle: string;
1486
+ id: string;
1487
+ outcome: string;
1488
+ }, {
1489
+ type: "vibes-diy.cli.res-phone-link-settle-alert";
1490
+ ownerHandle: string;
1491
+ id: string;
1492
+ outcome: "missed" | "sent";
1477
1493
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1478
1494
  type: "vibes-diy.cli.phone-link-wakes";
1479
1495
  apiUrl: string;
package/cli/cmd-evento.js CHANGED
@@ -29,7 +29,7 @@ import { developerEvento } from "./cmds/developer/developer-cmd.js";
29
29
  import { membersEvento } from "./cmds/members/members-cmd.js";
30
30
  import { retentionPreviewEvento, retentionResetEvento } from "./cmds/retention/index.js";
31
31
  import { moderationEvento } from "./cmds/moderation/index.js";
32
- import { phoneLinkAlertsEvento, phoneLinkWakesEvento, phoneLinkVibesEvento, phoneLinkPauseVibeEvento, phoneLinkGroupEvento, phoneLinkPayForGroupEvento, phoneLinkGroupRosterEvento, phoneLinkStopSponsoringEvento, phoneLinkRedeemEvento, } from "./cmds/phone-link-cmd.js";
32
+ import { phoneLinkAlertsEvento, phoneLinkSettleAlertEvento, phoneLinkWakesEvento, phoneLinkVibesEvento, phoneLinkPauseVibeEvento, phoneLinkGroupEvento, phoneLinkPayForGroupEvento, phoneLinkGroupRosterEvento, phoneLinkStopSponsoringEvento, phoneLinkRedeemEvento, } from "./cmds/phone-link-cmd.js";
33
33
  import { phoneLinkInviteEvento, phoneLinkInviteStatusEvento } from "./cmds/phone-link-invite-cmd.js";
34
34
  import { phoneLinkClassifyEvento } from "./cmds/phone-link-classify-cmd.js";
35
35
  import { deviceIdRegisterEvento } from "@vibes.diy/identity/node";
@@ -84,6 +84,7 @@ export function cliEventoHandlers() {
84
84
  phoneLinkGroupRosterEvento,
85
85
  phoneLinkStopSponsoringEvento,
86
86
  phoneLinkAlertsEvento,
87
+ phoneLinkSettleAlertEvento,
87
88
  phoneLinkWakesEvento,
88
89
  phoneLinkVibesEvento,
89
90
  phoneLinkPauseVibeEvento,
@@ -238,12 +238,33 @@ export function poufBoldRoom(slug) {
238
238
  export function poufWornRoom(pouf, colorTheme) {
239
239
  if (poufSeedMatchesRoom(pouf, colorTheme))
240
240
  return { slug: colorTheme, edited: false };
241
- const bold = `${colorTheme === "pouf" ? "home" : colorTheme}-bold`;
241
+ const stored = colorTheme === "pouf" ? "home" : colorTheme;
242
+ const bold = `${stored}-bold`;
242
243
  if (pouf.tone === POUF_BOLD_TONE && poufSeedMatchesRoom(pouf, bold))
243
244
  return { slug: bold, edited: false };
244
245
  const rooms = pouf.tone === POUF_BOLD_TONE ? POUF_BOLD_PRESETS.map((p) => p.slug) : POUF_ROOM_SLUGS;
245
246
  const other = rooms.find((slug) => poufSeedMatchesRoom(pouf, slug));
246
247
  if (other !== undefined)
247
248
  return { slug: other, edited: false };
248
- return { slug: colorTheme, edited: true };
249
+ return { slug: editedFromRoom(pouf, rooms, pouf.tone === POUF_BOLD_TONE ? bold : stored) ?? colorTheme, edited: true };
250
+ }
251
+ function poufRoomDistance(pouf, roomSlug) {
252
+ const room = getStylePreset(roomSlug)?.palette.pouf;
253
+ if (room === undefined)
254
+ return undefined;
255
+ return Number(room.lead !== pouf.lead) + Number(room.gap !== pouf.gap) + Number(room.locked !== pouf.locked);
256
+ }
257
+ function editedFromRoom(pouf, rooms, storedSlug) {
258
+ const scored = rooms.flatMap((slug) => {
259
+ const d = poufRoomDistance(pouf, slug);
260
+ return d === undefined ? [] : [{ slug, d }];
261
+ });
262
+ if (scored.length === 0)
263
+ return undefined;
264
+ const best = Math.min(...scored.map((s) => s.d));
265
+ const nearest = scored.filter((s) => s.d === best);
266
+ if (nearest.some((s) => s.slug === storedSlug) || nearest.length !== 1)
267
+ return undefined;
268
+ const slug = nearest[0].slug;
269
+ return slug.endsWith("-bold") ? slug.slice(0, -"-bold".length) : slug;
249
270
  }
@@ -16,6 +16,8 @@ export declare const ResAppRearmCli: import("arktype/internal/variants/object.ts
16
16
  state: "dead" | "healthy" | "overdue" | "running" | "unscheduled";
17
17
  intervalMs: number | null;
18
18
  nextAlarmAt: string | null;
19
+ pausedIntervalMs: number | null;
20
+ settingsUrl: string;
19
21
  }, {}>;
20
22
  export type ResAppRearmCli = typeof ResAppRearmCli.infer;
21
23
  export declare function isResAppRearmCli(obj: unknown): obj is ResAppRearmCli;
@@ -9,6 +9,7 @@ import { formatErr } from "../format-err.js";
9
9
  import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
10
10
  import { humanizeDuration } from "@vibes.diy/api-types";
11
11
  import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
12
+ import { appSettingsUrl, pausedScheduleLines } from "./status-cmd.js";
12
13
  export const ReqAppRearm = type({
13
14
  type: "'vibes-diy.cli.app-rearm'",
14
15
  appSlug: "string",
@@ -25,12 +26,17 @@ export const ResAppRearmCli = type({
25
26
  state: "'unscheduled'|'running'|'healthy'|'overdue'|'dead'",
26
27
  intervalMs: "number|null",
27
28
  nextAlarmAt: "string|null",
29
+ pausedIntervalMs: "number|null",
30
+ settingsUrl: "string",
28
31
  });
29
32
  export function isResAppRearmCli(obj) {
30
33
  return ResAppRearmCli.allows(obj);
31
34
  }
32
35
  export function renderAppRearmLines(msg) {
33
36
  const app = `${msg.ownerHandle}/${msg.appSlug}`;
37
+ if (msg.state === "unscheduled" && msg.pausedIntervalMs !== null) {
38
+ return pausedScheduleLines(app, msg.pausedIntervalMs, msg.settingsUrl);
39
+ }
34
40
  if (msg.state === "unscheduled" || msg.intervalMs === null) {
35
41
  return [`${app}: nothing to arm — the live release exports no \`scheduled\` handler.`];
36
42
  }
@@ -73,6 +79,8 @@ export const appRearmEvento = {
73
79
  state: r.state,
74
80
  intervalMs: r.intervalMs,
75
81
  nextAlarmAt: r.nextAlarmAt,
82
+ pausedIntervalMs: r.pausedIntervalMs ?? null,
83
+ settingsUrl: appSettingsUrl(args.apiUrl, r.ownerHandle, r.appSlug),
76
84
  });
77
85
  },
78
86
  };
@@ -26,9 +26,13 @@ export declare const ResAppStatusCli: import("arktype/internal/variants/object.t
26
26
  overdueMs: number;
27
27
  healed: boolean;
28
28
  releaseIntervalMs: number | null;
29
+ pausedIntervalMs: number | null;
30
+ settingsUrl: string;
29
31
  }, {}>;
30
32
  export type ResAppStatusCli = typeof ResAppStatusCli.infer;
31
33
  export declare function isResAppStatusCli(obj: unknown): obj is ResAppStatusCli;
34
+ export declare function appSettingsUrl(apiUrl: string, ownerHandle: string, appSlug: string): string;
35
+ export declare function pausedScheduleLines(app: string, pausedIntervalMs: number, settingsUrl: string): string[];
32
36
  export declare function renderAppStatusLines(msg: ResAppStatusCli): string[];
33
37
  export declare const appStatusEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppStatus, ResAppStatusCli>;
34
38
  export declare function appStatusCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
@@ -9,6 +9,7 @@ import { formatErr } from "../format-err.js";
9
9
  import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
10
10
  import { humanizeDuration } from "@vibes.diy/api-types";
11
11
  import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
12
+ import { webOriginForApi } from "../credits-wall.js";
12
13
  export const ReqAppStatus = type({
13
14
  type: "'vibes-diy.cli.app-status'",
14
15
  appSlug: "string",
@@ -35,12 +36,26 @@ export const ResAppStatusCli = type({
35
36
  overdueMs: "number",
36
37
  healed: "boolean",
37
38
  releaseIntervalMs: "number|null",
39
+ pausedIntervalMs: "number|null",
40
+ settingsUrl: "string",
38
41
  });
39
42
  export function isResAppStatusCli(obj) {
40
43
  return ResAppStatusCli.allows(obj);
41
44
  }
45
+ export function appSettingsUrl(apiUrl, ownerHandle, appSlug) {
46
+ return `${webOriginForApi(apiUrl)}/vibes/mine/${ownerHandle}/${appSlug}/settings`;
47
+ }
48
+ export function pausedScheduleLines(app, pausedIntervalMs, settingsUrl) {
49
+ return [
50
+ `${app}: paused — the live release runs \`scheduled\` every ${humanizeDuration(pausedIntervalMs)}, and scheduled runs are switched off.`,
51
+ ` Start it again: turn on "Scheduled runs" in App settings: ${settingsUrl}`,
52
+ ];
53
+ }
42
54
  export function renderAppStatusLines(msg) {
43
55
  const app = `${msg.ownerHandle}/${msg.appSlug}`;
56
+ if (msg.state === "unscheduled" && msg.pausedIntervalMs !== null) {
57
+ return pausedScheduleLines(app, msg.pausedIntervalMs, msg.settingsUrl);
58
+ }
44
59
  if (msg.state === "unscheduled" && msg.releaseIntervalMs !== null) {
45
60
  return [
46
61
  `${app}: STALLED — the live release runs \`scheduled\` every ${humanizeDuration(msg.releaseIntervalMs)}, and no timer is armed for it.`,
@@ -125,6 +140,8 @@ export const appStatusEvento = {
125
140
  overdueMs: s.overdueMs,
126
141
  healed: s.healed,
127
142
  releaseIntervalMs: s.releaseIntervalMs ?? null,
143
+ pausedIntervalMs: s.pausedIntervalMs ?? null,
144
+ settingsUrl: appSettingsUrl(args.apiUrl, s.ownerHandle, s.appSlug),
128
145
  });
129
146
  },
130
147
  };
@@ -1,5 +1,6 @@
1
1
  import type { VibesDiyApi } from "@vibes.diy/api-impl";
2
2
  export declare const WALL_BILLING_READ_MS = 2000;
3
+ export declare function webOriginForApi(apiUrl: string): string;
3
4
  export declare function billingSettingsUrl(apiUrl: string): string;
4
5
  export interface WallBilling {
5
6
  readonly plan?: "free" | "plus" | "pro";
@@ -2,13 +2,15 @@ import { exception2Result, URI } from "@adviser/cement";
2
2
  import { CREDITS_EXHAUSTED_PREFIX, outOfCreditsLine } from "@vibes.diy/api-types";
3
3
  export const WALL_BILLING_READ_MS = 2_000;
4
4
  const FALLBACK_ORIGIN = "https://vibes.diy";
5
- export function billingSettingsUrl(apiUrl) {
5
+ export function webOriginForApi(apiUrl) {
6
6
  const rUri = exception2Result(() => URI.from(apiUrl));
7
7
  const uri = rUri.isOk() ? rUri.Ok() : undefined;
8
8
  const scheme = { "https:": "https:", "http:": "http:", "wss:": "https:", "ws:": "http:" };
9
9
  const web = uri === undefined ? undefined : scheme[uri.protocol];
10
- const origin = uri !== undefined && web !== undefined && uri.host !== "" ? `${web}//${uri.host}` : FALLBACK_ORIGIN;
11
- return `${origin}/settings?tab=billing`;
10
+ return uri !== undefined && web !== undefined && uri.host !== "" ? `${web}//${uri.host}` : FALLBACK_ORIGIN;
11
+ }
12
+ export function billingSettingsUrl(apiUrl) {
13
+ return `${webOriginForApi(apiUrl)}/settings?tab=billing`;
12
14
  }
13
15
  export function creditsWallMessage(billing, settingsUrl) {
14
16
  const line = outOfCreditsLine({
@@ -7,6 +7,7 @@ import { cmdTsDefaultArgs } from "../cli-ctx.js";
7
7
  import { sendMsg, sendProgress } from "../cmd-evento.js";
8
8
  import { resolveVibeArgs } from "../parse-vibe.js";
9
9
  import { runGenerate } from "./generate-core.js";
10
+ import { generateErrorExitCode } from "./publish-saved-build.js";
10
11
  import { PUBLISH_HANDLE_FLAG_HELP, VIBE_FLAG_HELP } from "../vibe-arg-help.js";
11
12
  export { ResGenerate, isResGenerate, resGenerateJsonLine } from "./generate-core.js";
12
13
  export const ReqGenerate = type({
@@ -82,15 +83,17 @@ export const generateEvento = {
82
83
  },
83
84
  }),
84
85
  }, (level, message) => sendProgress(ctx, level, message)).finally(() => rl?.close());
85
- if (rGenerate.isErr())
86
+ if (rGenerate.isErr()) {
87
+ ectx.exitCode = generateErrorExitCode(rGenerate.Err());
86
88
  return Result.Err(rGenerate.Err());
89
+ }
87
90
  return sendMsg(ctx, rGenerate.Ok());
88
91
  },
89
92
  };
90
93
  export function generateCmd(ctx) {
91
94
  return command({
92
95
  name: "generate",
93
- description: "Generate a vibe from a text prompt and write it to disk. The server builds and releases it; on a terminal the chat stays open for follow-ups.",
96
+ description: "Generate a vibe from a text prompt and write it to disk. The server builds and releases it; on a terminal the chat stays open for follow-ups. Exits 0 when live, 3 when live but the last build's version is unconfirmed, 1 on failure.",
94
97
  args: {
95
98
  ...cmdTsDefaultArgs(ctx),
96
99
  prompt: positional({
@@ -15,7 +15,7 @@ import { mapCreditsWall } from "./credits-wall.js";
15
15
  import { materializeFile } from "./materialize-file.js";
16
16
  import { isNoAccessFnRefusal } from "./push-from-dir.js";
17
17
  import { isTextManifestItem, pullVersionToDir } from "./pull-cmd.js";
18
- import { publishSavedBuild, unconfirmedBuildMessage, } from "./publish-saved-build.js";
18
+ import { LiveUnconfirmedBuildError, UnconfirmedBuildError, publishSavedBuild, unconfirmedBuildMessage, } from "./publish-saved-build.js";
19
19
  export const ResGenerate = type({
20
20
  type: "'vibes-diy.cli.res-generate'",
21
21
  appSlug: "string",
@@ -141,6 +141,8 @@ async function runGenerateRound(api, args, progress) {
141
141
  let blockCount = 0;
142
142
  let streamedBytes = 0;
143
143
  let landingError;
144
+ let unsavedBuildError;
145
+ const landingFailure = () => landingError ?? unsavedBuildError;
144
146
  let followErr;
145
147
  const address = { ownerHandle: session.ownerHandle, appSlug: session.appSlug };
146
148
  let landed;
@@ -210,9 +212,20 @@ async function runGenerateRound(api, args, progress) {
210
212
  announcedModel,
211
213
  });
212
214
  if (r.isErr()) {
213
- landingError = r.Err().message;
215
+ const err = r.Err();
216
+ if (err instanceof UnconfirmedBuildError)
217
+ unsavedBuildError = err;
218
+ else
219
+ landingError = err;
214
220
  return;
215
221
  }
222
+ const held = unsavedBuildError;
223
+ if (held !== undefined && r.Ok() !== landed && supersedes(held, r.Ok())) {
224
+ unsavedBuildError = undefined;
225
+ if (held.wrote !== undefined)
226
+ await removeUnsavedLeftovers(held.wrote, r.Ok());
227
+ await progress("info", "An earlier build in this run ended before the server saved a version; this later build is the saved one.");
228
+ }
216
229
  landed = r.Ok();
217
230
  },
218
231
  });
@@ -229,8 +242,9 @@ async function runGenerateRound(api, args, progress) {
229
242
  if (args.signal?.aborted) {
230
243
  return Result.Err("Cancelled by caller during code generation");
231
244
  }
232
- if (landingError !== undefined)
233
- return Result.Err(landingError);
245
+ const failed = landingFailure();
246
+ if (failed !== undefined)
247
+ return Result.Err(failed);
234
248
  if (landed === undefined) {
235
249
  if (followErr !== undefined)
236
250
  return Result.Err(followErr);
@@ -264,8 +278,9 @@ async function runGenerateRound(api, args, progress) {
264
278
  if (next.isErr()) {
265
279
  await progress("warn", String(await mapCreditsWall(next.Err().message, { api, apiUrl: args.apiUrl })));
266
280
  }
267
- if (landingError !== undefined)
268
- return Result.Err(landingError);
281
+ const failedNext = landingFailure();
282
+ if (failedNext !== undefined)
283
+ return Result.Err(failedNext);
269
284
  }
270
285
  }
271
286
  }
@@ -287,6 +302,31 @@ async function runGenerateRound(api, args, progress) {
287
302
  }
288
303
  return Result.Ok({ ...landed.result, turns });
289
304
  }
305
+ function unsavedBuild(err, vibe, wrote) {
306
+ const e = err instanceof UnconfirmedBuildError ? err : new UnconfirmedBuildError(typeof err === "string" ? err : err.message);
307
+ e.vibe = { ownerHandle: vibe.ownerHandle, appSlug: vibe.appSlug };
308
+ if (wrote !== undefined)
309
+ e.wrote = wrote;
310
+ return e;
311
+ }
312
+ function supersedes(held, next) {
313
+ if (held.vibe === undefined)
314
+ return true;
315
+ return held.vibe.ownerHandle === next.result.ownerHandle && held.vibe.appSlug === next.result.appSlug;
316
+ }
317
+ async function removeUnsavedLeftovers(wrote, next) {
318
+ const keep = new Set(Object.keys(next.files).map(stripSlash));
319
+ const keepRaw = new Set(Object.keys(next.raw).map(stripSlash));
320
+ for (const p of wrote.paths) {
321
+ if (!keep.has(stripSlash(p)))
322
+ await rm(join(wrote.dir, stripSlash(p)), { force: true }).catch(() => undefined);
323
+ }
324
+ for (const p of wrote.rawPaths) {
325
+ if (!keepRaw.has(stripSlash(p))) {
326
+ await rm(join(wrote.dir, RAW_STREAM_DIR, stripSlash(p)), { force: true }).catch(() => undefined);
327
+ }
328
+ }
329
+ }
290
330
  export const RAW_STREAM_DIR = ".raw";
291
331
  function stripSlash(p) {
292
332
  return p.startsWith("/") ? p.slice(1) : p;
@@ -389,20 +429,21 @@ async function landBuild(o) {
389
429
  await progress("info", "That turn changed no files.");
390
430
  return Result.Ok(o.previous);
391
431
  }
392
- return Result.Err(formatNoFilesError({
432
+ return Result.Err(unsavedBuild(formatNoFilesError({
393
433
  sectionEventCount: 0,
394
434
  blockCount: 0,
395
435
  streamedBytes: 0,
396
436
  upstreamErrors: resolved.promptErrors.map((message) => ({ message })),
397
437
  applyErrors: errors,
398
438
  pullVibe,
399
- }));
439
+ }), landing));
400
440
  }
401
441
  if (!turnComplete && !serverVersionOnly) {
402
442
  const missing = announcedPaths.filter((p) => !(p in files));
403
443
  if (missing.length > 0) {
404
- return Result.Err(`Stream recovery lost file(s) it had announced: ${missing.join(", ")}. ` +
405
- `Refusing to deploy a partial app. Re-run the generate, or push the files from disk if they were written.`);
444
+ const lost = `Stream recovery lost file(s) it had announced: ${missing.join(", ")}. ` +
445
+ `Refusing to deploy a partial app. Re-run the generate, or push the files from disk if they were written.`;
446
+ return Result.Err(savedFsId === undefined ? unsavedBuild(lost, landing) : lost);
406
447
  }
407
448
  const names = Object.keys(files)
408
449
  .map((p) => (p.startsWith("/") ? p.slice(1) : p))
@@ -519,13 +560,16 @@ async function landBuild(o) {
519
560
  onProgress: progress,
520
561
  });
521
562
  if (rPush.isErr()) {
563
+ const wrote = { dir, paths: Object.keys(files), rawPaths: Object.keys(changed) };
522
564
  const earlier = o.previous?.result;
523
565
  if (savedFsId === undefined &&
524
566
  earlier !== undefined &&
525
567
  earlier.ownerHandle === liveOwnerHandle &&
526
568
  earlier.appSlug === liveAppSlug) {
527
- return Result.Err(unconfirmedBuildMessage(liveOwnerHandle, liveAppSlug, earlier.url));
569
+ return Result.Err(unsavedBuild(new LiveUnconfirmedBuildError(unconfirmedBuildMessage(liveOwnerHandle, liveAppSlug, earlier.url)), landing, wrote));
528
570
  }
571
+ if (savedFsId === undefined)
572
+ return Result.Err(unsavedBuild(rPush.Err(), landing, wrote));
529
573
  if (privateMode || !isNoAccessFnRefusal(rPush.Err()))
530
574
  return Result.Err(rPush.Err());
531
575
  publish = "kept-private-no-access-fn";
@@ -114,6 +114,7 @@ export declare const ReqPhoneLinkAlertsCli: import("arktype/internal/variants/ob
114
114
  type: "vibes-diy.cli.phone-link-alerts";
115
115
  apiUrl: string;
116
116
  handle: string;
117
+ settles?: true | undefined;
117
118
  }, {}>;
118
119
  export type ReqPhoneLinkAlertsCli = typeof ReqPhoneLinkAlertsCli.infer;
119
120
  export declare function isReqPhoneLinkAlertsCli(obj: unknown): obj is ReqPhoneLinkAlertsCli;
@@ -143,6 +144,25 @@ export type ResPhoneLinkAlertsCli = typeof ResPhoneLinkAlertsCli.infer;
143
144
  export declare function isResPhoneLinkAlertsCli(obj: unknown): obj is ResPhoneLinkAlertsCli;
144
145
  export declare const phoneLinkAlertsEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqPhoneLinkAlertsCli, ResPhoneLinkAlertsCli>;
145
146
  export declare function renderPhoneLinkAlertsLines(msg: ResPhoneLinkAlertsCli): string[];
147
+ export declare const ReqPhoneLinkSettleAlertCli: import("arktype/internal/variants/object.ts").ObjectType<{
148
+ type: "vibes-diy.cli.phone-link-settle-alert";
149
+ apiUrl: string;
150
+ handle: string;
151
+ id: string;
152
+ outcome: string;
153
+ }, {}>;
154
+ export type ReqPhoneLinkSettleAlertCli = typeof ReqPhoneLinkSettleAlertCli.infer;
155
+ export declare function isReqPhoneLinkSettleAlertCli(obj: unknown): obj is ReqPhoneLinkSettleAlertCli;
156
+ export declare const ResPhoneLinkSettleAlertCli: import("arktype/internal/variants/object.ts").ObjectType<{
157
+ type: "vibes-diy.cli.res-phone-link-settle-alert";
158
+ ownerHandle: string;
159
+ id: string;
160
+ outcome: "missed" | "sent";
161
+ }, {}>;
162
+ export type ResPhoneLinkSettleAlertCli = typeof ResPhoneLinkSettleAlertCli.infer;
163
+ export declare function isResPhoneLinkSettleAlertCli(obj: unknown): obj is ResPhoneLinkSettleAlertCli;
164
+ export declare const phoneLinkSettleAlertEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqPhoneLinkSettleAlertCli, ResPhoneLinkSettleAlertCli>;
165
+ export declare function renderPhoneLinkSettleAlertLines(msg: ResPhoneLinkSettleAlertCli): string[];
146
166
  export declare const ReqPhoneLinkWakesCli: import("arktype/internal/variants/object.ts").ObjectType<{
147
167
  type: "vibes-diy.cli.phone-link-wakes";
148
168
  apiUrl: string;
@@ -315,6 +335,16 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
315
335
  address: string;
316
336
  claimGroupKey: string;
317
337
  };
338
+ } | {
339
+ command: "settle-alert";
340
+ args: {
341
+ apiUrl: string;
342
+ json: boolean;
343
+ text: boolean;
344
+ handle: string;
345
+ id: string;
346
+ outcome: string;
347
+ };
318
348
  } | {
319
349
  command: "stop-sponsoring";
320
350
  args: {
@@ -426,6 +456,16 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
426
456
  address: string;
427
457
  claimGroupKey: string;
428
458
  };
459
+ } | {
460
+ command: "settle-alert";
461
+ args: {
462
+ apiUrl: string;
463
+ json: boolean;
464
+ text: boolean;
465
+ handle: string;
466
+ id: string;
467
+ outcome: string;
468
+ };
429
469
  } | {
430
470
  command: "stop-sponsoring";
431
471
  args: {
@@ -477,6 +517,9 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
477
517
  } | {
478
518
  command: "redeem";
479
519
  value: never;
520
+ } | {
521
+ command: "settle-alert";
522
+ value: never;
480
523
  } | {
481
524
  command: "stop-sponsoring";
482
525
  value: never;
@@ -514,6 +557,9 @@ export declare function phoneLinkSubcommands(ctx: CliCtx): Partial<import("cmd-t
514
557
  } | {
515
558
  command: "redeem";
516
559
  value: never;
560
+ } | {
561
+ command: "settle-alert";
562
+ value: never;
517
563
  } | {
518
564
  command: "stop-sponsoring";
519
565
  value: never;
@@ -455,6 +455,7 @@ export const ReqPhoneLinkAlertsCli = type({
455
455
  type: "'vibes-diy.cli.phone-link-alerts'",
456
456
  apiUrl: "string",
457
457
  handle: "string",
458
+ "settles?": "true",
458
459
  });
459
460
  export function isReqPhoneLinkAlertsCli(obj) {
460
461
  return ReqPhoneLinkAlertsCli.allows(obj);
@@ -488,7 +489,10 @@ export const phoneLinkAlertsEvento = {
488
489
  const args = ctx.validated;
489
490
  const api = ectx.vibesDiyApiFactory(args.apiUrl);
490
491
  const handle = args.handle.trim().replace(/^@/, "");
491
- const r = await api.readPhoneAlerts(handle === "" ? {} : { ownerHandle: handle });
492
+ const r = await api.readPhoneAlerts({
493
+ ...(handle === "" ? {} : { ownerHandle: handle }),
494
+ ...(args.settles === true ? { settles: true } : {}),
495
+ });
492
496
  if (r.isErr())
493
497
  return Result.Err(formatErr(r.Err()));
494
498
  const download = {
@@ -552,6 +556,87 @@ function phoneLinkAlertsCmd(ctx) {
552
556
  type: "vibes-diy.cli.phone-link-alerts",
553
557
  apiUrl: args.apiUrl,
554
558
  handle: args.handle,
559
+ ...(ctx.sthis.env.get("VIBES_ALERTS_SETTLE") === "1" ? { settles: true } : {}),
560
+ };
561
+ }),
562
+ });
563
+ }
564
+ export const ReqPhoneLinkSettleAlertCli = type({
565
+ type: "'vibes-diy.cli.phone-link-settle-alert'",
566
+ apiUrl: "string",
567
+ handle: "string",
568
+ id: "string",
569
+ outcome: "string",
570
+ });
571
+ export function isReqPhoneLinkSettleAlertCli(obj) {
572
+ return ReqPhoneLinkSettleAlertCli.allows(obj);
573
+ }
574
+ export const ResPhoneLinkSettleAlertCli = type({
575
+ type: "'vibes-diy.cli.res-phone-link-settle-alert'",
576
+ ownerHandle: "string",
577
+ id: "string",
578
+ outcome: "'sent' | 'missed'",
579
+ });
580
+ export function isResPhoneLinkSettleAlertCli(obj) {
581
+ return ResPhoneLinkSettleAlertCli.allows(obj);
582
+ }
583
+ export const phoneLinkSettleAlertEvento = {
584
+ hash: "vibes-diy.cli.phone-link-settle-alert",
585
+ validate: (ctx) => {
586
+ if (isReqPhoneLinkSettleAlertCli(ctx.enRequest))
587
+ return Promise.resolve(Result.Ok(Option.Some(ctx.enRequest)));
588
+ return Promise.resolve(Result.Ok(Option.None()));
589
+ },
590
+ handle: async (ctx) => {
591
+ const args = ctx.validated;
592
+ const outcome = args.outcome.trim();
593
+ if (outcome !== "sent" && outcome !== "missed")
594
+ return Result.Err(`--outcome is sent or missed, not "${args.outcome}".`);
595
+ const id = args.id.trim();
596
+ if (id === "")
597
+ return Result.Err("--id names the alert to settle.");
598
+ const ectx = ctx.ctx.getOrThrow("cliCtx");
599
+ if (ectx.vibesDiyApiFactory === undefined)
600
+ return Result.Err("Not logged in. Run 'vibes-diy login' first.");
601
+ const api = ectx.vibesDiyApiFactory(args.apiUrl);
602
+ const handle = args.handle.trim().replace(/^@/, "");
603
+ const r = await api.settlePhoneAlert({ ...(handle === "" ? {} : { ownerHandle: handle }), alertId: id, outcome });
604
+ if (r.isErr())
605
+ return Result.Err(formatErr(r.Err()));
606
+ return sendMsg(ctx, {
607
+ type: "vibes-diy.cli.res-phone-link-settle-alert",
608
+ ownerHandle: r.Ok().ownerHandle,
609
+ id,
610
+ outcome,
611
+ });
612
+ },
613
+ };
614
+ export function renderPhoneLinkSettleAlertLines(msg) {
615
+ return [`Settled ${msg.id} as ${msg.outcome} for @${msg.ownerHandle}.`];
616
+ }
617
+ function phoneLinkSettleAlertCmd(ctx) {
618
+ return command({
619
+ name: "settle-alert",
620
+ description: "Say how a reminder this phone was handed went: sent, or missed when it was let go unsent (the iMessage bridge runs it after each one).",
621
+ args: {
622
+ ...cmdTsDefaultArgs(ctx),
623
+ handle: option({
624
+ long: "handle",
625
+ description: "The handle the phone is linked to (default: the account's active handle).",
626
+ type: string,
627
+ defaultValue: () => "",
628
+ defaultValueIsSerializable: true,
629
+ }),
630
+ id: option({ long: "id", description: "The alert's id, as `phone-link alerts` gave it.", type: string }),
631
+ outcome: option({ long: "outcome", description: "sent, or missed.", type: string }),
632
+ },
633
+ handler: ctx.cliStream.enqueue((args) => {
634
+ return {
635
+ type: "vibes-diy.cli.phone-link-settle-alert",
636
+ apiUrl: args.apiUrl,
637
+ handle: args.handle,
638
+ id: args.id,
639
+ outcome: args.outcome,
555
640
  };
556
641
  }),
557
642
  });
@@ -894,6 +979,7 @@ export function phoneLinkSubcommands(ctx) {
894
979
  "group-roster": phoneLinkGroupRosterCmd(ctx),
895
980
  "stop-sponsoring": phoneLinkStopSponsoringCmd(ctx),
896
981
  alerts: phoneLinkAlertsCmd(ctx),
982
+ "settle-alert": phoneLinkSettleAlertCmd(ctx),
897
983
  wakes: phoneLinkWakesCmd(ctx),
898
984
  vibes: phoneLinkVibesCmd(ctx),
899
985
  "pause-vibe": phoneLinkPauseVibeCmd(ctx),
@@ -16,4 +16,20 @@ export interface PublishSavedBuildOk {
16
16
  readonly publicUrl: string;
17
17
  }
18
18
  export declare function unconfirmedBuildMessage(ownerHandle: string | undefined, appSlug: string, liveUrl?: string): string;
19
+ export declare const GENERATE_EXIT_LIVE_UNCONFIRMED = 3;
20
+ export declare class UnconfirmedBuildError extends Error {
21
+ vibe?: {
22
+ readonly ownerHandle: string;
23
+ readonly appSlug: string;
24
+ };
25
+ wrote?: {
26
+ readonly dir: string;
27
+ readonly paths: readonly string[];
28
+ readonly rawPaths: readonly string[];
29
+ };
30
+ }
31
+ export declare class LiveUnconfirmedBuildError extends UnconfirmedBuildError {
32
+ readonly exitCode = 3;
33
+ }
34
+ export declare function generateErrorExitCode(err: unknown): number;
19
35
  export declare function publishSavedBuild(opts: PublishSavedBuildOptions): Promise<Result<PublishSavedBuildOk>>;
@@ -48,9 +48,20 @@ export function unconfirmedBuildMessage(ownerHandle, appSlug, liveUrl) {
48
48
  "The server keeps the version it saved and may release it on its own. " +
49
49
  `${look}, or run the generate again.`);
50
50
  }
51
+ export const GENERATE_EXIT_LIVE_UNCONFIRMED = 3;
52
+ export class UnconfirmedBuildError extends Error {
53
+ vibe;
54
+ wrote;
55
+ }
56
+ export class LiveUnconfirmedBuildError extends UnconfirmedBuildError {
57
+ exitCode = GENERATE_EXIT_LIVE_UNCONFIRMED;
58
+ }
59
+ export function generateErrorExitCode(err) {
60
+ return err instanceof LiveUnconfirmedBuildError ? GENERATE_EXIT_LIVE_UNCONFIRMED : 1;
61
+ }
51
62
  export async function publishSavedBuild(opts) {
52
63
  if (opts.fsId === undefined)
53
- return Result.Err(unconfirmedBuildMessage(opts.ownerHandle, opts.appSlug));
64
+ return Result.Err(new UnconfirmedBuildError(unconfirmedBuildMessage(opts.ownerHandle, opts.appSlug)));
54
65
  const note = opts.onProgress ?? (() => undefined);
55
66
  if (opts.ownerHandle === undefined || opts.ownerHandle === "")
56
67
  return Result.Err(HANDLE_REQUIRED_CLI_MESSAGE);