vibes-diy 14.3.453 → 14.3.455

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.
@@ -2,17 +2,53 @@ import { isCmdProgress, sendMsg, sendProgress, type CmdProgress, type CmdTSMsg,
2
2
  export type { CmdTSMsg, WrapCmdTSMsg, CmdProgress };
3
3
  export { isCmdProgress, sendMsg, sendProgress };
4
4
  export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
5
- type: "use-vibes.cli.themes";
5
+ type: "core-cli.device-id-register";
6
+ commonName: string;
7
+ organization: string;
8
+ locality: string;
9
+ state: string;
10
+ country: string;
11
+ caUrl: string;
12
+ port: string;
13
+ timeout: string;
14
+ forceRenew: boolean;
15
+ cert?: string | undefined;
16
+ noBrowser?: boolean | undefined;
17
+ apiUrl?: string | undefined;
18
+ expectHandle?: string | undefined;
19
+ expectUser?: string | undefined;
6
20
  }, {
7
- type: "use-vibes.cli.res-themes-list";
8
- themes: {
9
- slug: string;
10
- name: string;
21
+ type: "core-cli.res-device-id-register";
22
+ output: string;
23
+ }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
24
+ type: "vibes-diy.cli.variety";
25
+ }, {
26
+ type: "vibes-diy.cli.res-variety-list";
27
+ grammar: string;
28
+ flourishCount: number;
29
+ archetypes: {
30
+ id: string;
31
+ guidance: string;
32
+ }[];
33
+ flourishes: {
34
+ id: string;
35
+ guidance: string;
11
36
  }[];
12
- } | {
13
- type: "use-vibes.cli.res-theme-content";
14
- slug: string;
15
- content: string;
37
+ }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
38
+ type: "vibes-diy.cli.put-asset";
39
+ file: string;
40
+ appSlug: string;
41
+ ownerHandle: string;
42
+ apiUrl: string;
43
+ mimeType: string;
44
+ verifyFetch: boolean;
45
+ }, {
46
+ type: "vibes-diy.cli.res-put-asset";
47
+ cid: string;
48
+ getURL: string;
49
+ size: number;
50
+ uploadId: string;
51
+ verified?: boolean | undefined;
16
52
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
17
53
  type: "vibes-diy.cli.db.list";
18
54
  apiUrl: string;
@@ -413,6 +449,9 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
413
449
  email: string;
414
450
  updatedAt: string;
415
451
  verified?: boolean | undefined;
452
+ } | {
453
+ type: "onboarding";
454
+ completedAt: string;
416
455
  } | {
417
456
  type: "geoCountry";
418
457
  country: string;
@@ -423,9 +462,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
423
462
  [x: string]: string;
424
463
  };
425
464
  updatedAt: string;
426
- } | {
427
- type: "onboarding";
428
- completedAt: string;
429
465
  } | {
430
466
  type: "kyc";
431
467
  cardAt?: string | undefined;
@@ -559,19 +595,17 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
559
595
  name: string;
560
596
  content: string;
561
597
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
562
- type: "vibes-diy.cli.variety";
598
+ type: "use-vibes.cli.themes";
563
599
  }, {
564
- type: "vibes-diy.cli.res-variety-list";
565
- grammar: string;
566
- flourishCount: number;
567
- archetypes: {
568
- id: string;
569
- guidance: string;
570
- }[];
571
- flourishes: {
572
- id: string;
573
- guidance: string;
600
+ type: "use-vibes.cli.res-themes-list";
601
+ themes: {
602
+ slug: string;
603
+ name: string;
574
604
  }[];
605
+ } | {
606
+ type: "use-vibes.cli.res-theme-content";
607
+ slug: string;
608
+ content: string;
575
609
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
576
610
  type: "vibes-diy.cli.system";
577
611
  }, {
@@ -595,6 +629,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
595
629
  apiUrl: string;
596
630
  idleTimeoutMs?: number | undefined;
597
631
  }, {
632
+ type: "vibes.diy.res-error";
633
+ error: {
634
+ message: string;
635
+ code: "max-app-slugs-reached";
636
+ };
637
+ } | {
598
638
  appSlug: string;
599
639
  ownerHandle: string;
600
640
  mode: "dev" | "production";
@@ -656,31 +696,25 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
656
696
  type: "vibes.diy.res-error";
657
697
  error: {
658
698
  message: string;
659
- code: "from-not-owned";
660
- };
661
- } | {
662
- type: "vibes.diy.res-error";
663
- error: {
664
- message: string;
665
- code: "from-carry-failed";
699
+ code: "handle-required";
666
700
  };
667
701
  } | {
668
702
  type: "vibes.diy.res-error";
669
703
  error: {
670
704
  message: string;
671
- code: "auto-enhance-off";
705
+ code: "from-not-owned";
672
706
  };
673
707
  } | {
674
708
  type: "vibes.diy.res-error";
675
709
  error: {
676
710
  message: string;
677
- code: "handle-required";
711
+ code: "from-carry-failed";
678
712
  };
679
713
  } | {
680
714
  type: "vibes.diy.res-error";
681
715
  error: {
682
716
  message: string;
683
- code: "max-app-slugs-reached";
717
+ code: "auto-enhance-off";
684
718
  };
685
719
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
686
720
  type: "vibes-diy.cli.remix";
@@ -767,21 +801,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
767
801
  model: string;
768
802
  };
769
803
  };
770
- }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
771
- type: "vibes-diy.cli.put-asset";
772
- file: string;
773
- appSlug: string;
774
- ownerHandle: string;
775
- apiUrl: string;
776
- mimeType: string;
777
- verifyFetch: boolean;
778
- }, {
779
- type: "vibes-diy.cli.res-put-asset";
780
- cid: string;
781
- getURL: string;
782
- size: number;
783
- uploadId: string;
784
- verified?: boolean | undefined;
785
804
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
786
805
  type: "vibes-diy.cli.generate";
787
806
  prompt: string;
@@ -801,6 +820,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
801
820
  style?: string | undefined;
802
821
  fastPass?: boolean | undefined;
803
822
  }, {
823
+ type: "vibes.diy.res-error";
824
+ error: {
825
+ message: string;
826
+ code: "max-app-slugs-reached";
827
+ };
828
+ } | {
804
829
  appSlug: string;
805
830
  ownerHandle: string;
806
831
  mode: "dev" | "production";
@@ -862,31 +887,25 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
862
887
  type: "vibes.diy.res-error";
863
888
  error: {
864
889
  message: string;
865
- code: "from-not-owned";
866
- };
867
- } | {
868
- type: "vibes.diy.res-error";
869
- error: {
870
- message: string;
871
- code: "from-carry-failed";
890
+ code: "handle-required";
872
891
  };
873
892
  } | {
874
893
  type: "vibes.diy.res-error";
875
894
  error: {
876
895
  message: string;
877
- code: "auto-enhance-off";
896
+ code: "from-not-owned";
878
897
  };
879
898
  } | {
880
899
  type: "vibes.diy.res-error";
881
900
  error: {
882
901
  message: string;
883
- code: "handle-required";
902
+ code: "from-carry-failed";
884
903
  };
885
904
  } | {
886
905
  type: "vibes.diy.res-error";
887
906
  error: {
888
907
  message: string;
889
- code: "max-app-slugs-reached";
908
+ code: "auto-enhance-off";
890
909
  };
891
910
  } | {
892
911
  type: "vibes-diy.cli.res-generate";
@@ -948,6 +967,12 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
948
967
  builderModel?: string | undefined;
949
968
  apiKey?: string | undefined;
950
969
  }, {
970
+ type: "vibes.diy.res-error";
971
+ error: {
972
+ message: string;
973
+ code: "max-app-slugs-reached";
974
+ };
975
+ } | {
951
976
  appSlug: string;
952
977
  ownerHandle: string;
953
978
  mode: "dev" | "production";
@@ -1009,31 +1034,25 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1009
1034
  type: "vibes.diy.res-error";
1010
1035
  error: {
1011
1036
  message: string;
1012
- code: "from-not-owned";
1013
- };
1014
- } | {
1015
- type: "vibes.diy.res-error";
1016
- error: {
1017
- message: string;
1018
- code: "from-carry-failed";
1037
+ code: "handle-required";
1019
1038
  };
1020
1039
  } | {
1021
1040
  type: "vibes.diy.res-error";
1022
1041
  error: {
1023
1042
  message: string;
1024
- code: "auto-enhance-off";
1043
+ code: "from-not-owned";
1025
1044
  };
1026
1045
  } | {
1027
1046
  type: "vibes.diy.res-error";
1028
1047
  error: {
1029
1048
  message: string;
1030
- code: "handle-required";
1049
+ code: "from-carry-failed";
1031
1050
  };
1032
1051
  } | {
1033
1052
  type: "vibes.diy.res-error";
1034
1053
  error: {
1035
1054
  message: string;
1036
- code: "max-app-slugs-reached";
1055
+ code: "auto-enhance-off";
1037
1056
  };
1038
1057
  } | {
1039
1058
  type: "vibes-diy.cli.res-edit";
@@ -1731,25 +1750,6 @@ export declare function cliEventoHandlers(): (import("@adviser/cement").EventoHa
1731
1750
  }, {
1732
1751
  type: "vibes-diy.cli.res-phone-link-classify";
1733
1752
  reaction?: string | undefined;
1734
- }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1735
- type: "core-cli.device-id-register";
1736
- commonName: string;
1737
- organization: string;
1738
- locality: string;
1739
- state: string;
1740
- country: string;
1741
- caUrl: string;
1742
- port: string;
1743
- timeout: string;
1744
- forceRenew: boolean;
1745
- cert?: string | undefined;
1746
- noBrowser?: boolean | undefined;
1747
- apiUrl?: string | undefined;
1748
- expectHandle?: string | undefined;
1749
- expectUser?: string | undefined;
1750
- }, {
1751
- type: "core-cli.res-device-id-register";
1752
- output: string;
1753
1753
  }> | import("@adviser/cement").EventoHandler<WrapCmdTSMsg<unknown>, {
1754
1754
  type: "vibes-diy.cli.db.get";
1755
1755
  apiUrl: string;
@@ -86,7 +86,7 @@ export const appAnonWriteEvento = {
86
86
  },
87
87
  handle: async (ctx) => {
88
88
  const ectx = ctx.ctx.getOrThrow("cliCtx");
89
- if (!ectx.vibesDiyApiFactory) {
89
+ if (ectx.vibesDiyApiFactory === undefined) {
90
90
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
91
91
  }
92
92
  const args = ctx.validated;
@@ -61,7 +61,7 @@ export const appAutoEnhanceEvento = {
61
61
  },
62
62
  handle: async (ctx) => {
63
63
  const ectx = ctx.ctx.getOrThrow("cliCtx");
64
- if (!ectx.vibesDiyApiFactory) {
64
+ if (ectx.vibesDiyApiFactory === undefined) {
65
65
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
66
66
  }
67
67
  const args = ctx.validated;
@@ -75,7 +75,7 @@ export const appCallEvento = {
75
75
  },
76
76
  handle: async (ctx) => {
77
77
  const ectx = ctx.ctx.getOrThrow("cliCtx");
78
- if (!ectx.vibesDiyApiFactory) {
78
+ if (ectx.vibesDiyApiFactory === undefined) {
79
79
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
80
80
  }
81
81
  const args = ctx.validated;
@@ -64,7 +64,7 @@ export const appChipsEvento = {
64
64
  },
65
65
  handle: async (ctx) => {
66
66
  const ectx = ctx.ctx.getOrThrow("cliCtx");
67
- if (!ectx.vibesDiyApiFactory) {
67
+ if (ectx.vibesDiyApiFactory === undefined) {
68
68
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
69
69
  }
70
70
  const args = ctx.validated;
@@ -160,7 +160,7 @@ export const appLogsEvento = {
160
160
  },
161
161
  handle: async (ctx) => {
162
162
  const ectx = ctx.ctx.getOrThrow("cliCtx");
163
- if (!ectx.vibesDiyApiFactory) {
163
+ if (ectx.vibesDiyApiFactory === undefined) {
164
164
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
165
165
  }
166
166
  const args = ctx.validated;
@@ -239,7 +239,7 @@ export const appLookEvento = {
239
239
  },
240
240
  handle: async (ctx) => {
241
241
  const ectx = ctx.ctx.getOrThrow("cliCtx");
242
- if (!ectx.vibesDiyApiFactory) {
242
+ if (ectx.vibesDiyApiFactory === undefined) {
243
243
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
244
244
  }
245
245
  const args = ctx.validated;
@@ -60,7 +60,7 @@ export const appRearmEvento = {
60
60
  },
61
61
  handle: async (ctx) => {
62
62
  const ectx = ctx.ctx.getOrThrow("cliCtx");
63
- if (!ectx.vibesDiyApiFactory) {
63
+ if (ectx.vibesDiyApiFactory === undefined) {
64
64
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
65
65
  }
66
66
  const args = ctx.validated;
@@ -63,7 +63,7 @@ export const appScheduleOffEvento = {
63
63
  },
64
64
  handle: async (ctx) => {
65
65
  const ectx = ctx.ctx.getOrThrow("cliCtx");
66
- if (!ectx.vibesDiyApiFactory) {
66
+ if (ectx.vibesDiyApiFactory === undefined) {
67
67
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
68
68
  }
69
69
  const args = ctx.validated;
@@ -58,7 +58,7 @@ export const appScreenshotEvento = {
58
58
  },
59
59
  handle: async (ctx) => {
60
60
  const ectx = ctx.ctx.getOrThrow("cliCtx");
61
- if (!ectx.vibesDiyApiFactory) {
61
+ if (ectx.vibesDiyApiFactory === undefined) {
62
62
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
63
63
  }
64
64
  const args = ctx.validated;
@@ -136,7 +136,7 @@ export const appStatusEvento = {
136
136
  },
137
137
  handle: async (ctx) => {
138
138
  const ectx = ctx.ctx.getOrThrow("cliCtx");
139
- if (!ectx.vibesDiyApiFactory) {
139
+ if (ectx.vibesDiyApiFactory === undefined) {
140
140
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
141
141
  }
142
142
  const args = ctx.validated;
@@ -57,7 +57,7 @@ export const appTickEvento = {
57
57
  },
58
58
  handle: async (ctx) => {
59
59
  const ectx = ctx.ctx.getOrThrow("cliCtx");
60
- if (!ectx.vibesDiyApiFactory) {
60
+ if (ectx.vibesDiyApiFactory === undefined) {
61
61
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
62
62
  }
63
63
  const args = ctx.validated;
@@ -89,7 +89,7 @@ export const appToolsEvento = {
89
89
  },
90
90
  handle: async (ctx) => {
91
91
  const ectx = ctx.ctx.getOrThrow("cliCtx");
92
- if (!ectx.vibesDiyApiFactory)
92
+ if (ectx.vibesDiyApiFactory === undefined)
93
93
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
94
94
  const args = ctx.validated;
95
95
  const api = ectx.vibesDiyApiFactory(args.apiUrl);
@@ -249,7 +249,7 @@ export const appCallToolEvento = {
249
249
  },
250
250
  handle: async (ctx) => {
251
251
  const ectx = ctx.ctx.getOrThrow("cliCtx");
252
- if (!ectx.vibesDiyApiFactory)
252
+ if (ectx.vibesDiyApiFactory === undefined)
253
253
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
254
254
  const args = ctx.validated;
255
255
  const rInput = parseToolInput(args.input);
@@ -62,7 +62,7 @@ export const assetsLsEvento = {
62
62
  },
63
63
  handle: async (ctx) => {
64
64
  const ectx = ctx.ctx.getOrThrow("cliCtx");
65
- if (!ectx.vibesDiyApiFactory) {
65
+ if (ectx.vibesDiyApiFactory === undefined) {
66
66
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
67
67
  }
68
68
  const args = ctx.validated;
@@ -73,13 +73,13 @@ export const claimHandleEvento = {
73
73
  },
74
74
  handle: async (ctx) => {
75
75
  const ectx = ctx.ctx.getOrThrow("cliCtx");
76
- if (!ectx.vibesDiyApiFactory) {
76
+ if (ectx.vibesDiyApiFactory === undefined) {
77
77
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
78
78
  }
79
79
  const args = ctx.validated;
80
80
  const api = ectx.vibesDiyApiFactory(args.apiUrl);
81
81
  const ownerHandle = args.ownerHandle;
82
- if (!ownerHandle) {
82
+ if (ownerHandle === undefined || ownerHandle === "") {
83
83
  const rSuggest = await api.suggestHandleCandidates({});
84
84
  if (rSuggest.isErr()) {
85
85
  return Result.Err(`Could not load handle suggestions: ${formatErr(rSuggest.Err())}`);
@@ -17,6 +17,7 @@ import { materializeFile } from "./materialize-file.js";
17
17
  import { isTextManifestItem, pullVersionToDir } from "./pull-cmd.js";
18
18
  import { publishSavedBuild } from "./publish-saved-build.js";
19
19
  import { makeChatEventFeed } from "./chat-event-feed.js";
20
+ import { relookChat, unfinishedRoundLine } from "./relook-chat.js";
20
21
  import { followChatBuild } from "./follow-chat-build.js";
21
22
  import { PUBLISH_HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../vibe-arg-help.js";
22
23
  export { readDryRunPayloadFromStream, formatDryRunAsText } from "./dry-run.js";
@@ -350,6 +351,10 @@ async function followEditTurn(ctx, args, o) {
350
351
  }
351
352
  }
352
353
  },
354
+ relook: async (inFlight) => {
355
+ await sendProgress(ctx, "info", "Still building: checking back with the server so the agent can finish every part.");
356
+ return relookChat({ chatId: session.chatId, reopen: () => session.reopen(), getOpenTurn: (req) => api.getOpenTurn(req) }, inFlight);
357
+ },
353
358
  onBuildResolved: async (landing) => {
354
359
  if (landingError !== undefined)
355
360
  return;
@@ -360,6 +365,9 @@ async function followEditTurn(ctx, args, o) {
360
365
  });
361
366
  if (landingError !== undefined)
362
367
  return Result.Err(landingError);
368
+ if (rFollow.isOk() && rFollow.Ok().unfinished && rFollow.Ok().landings.length > 0) {
369
+ await sendProgress(ctx, "warn", unfinishedRoundLine(rFollow.Ok()));
370
+ }
363
371
  for (const description of restyleDescriptions) {
364
372
  if (description !== "")
365
373
  await sendProgress(ctx, "info", `Restyled: ${description}`);
@@ -3,6 +3,9 @@ import { type AgentEvidenceLine } from "@vibes.diy/api-types";
3
3
  import { type ChatWireBlockEvent, type ChatWireEvent } from "@vibes.diy/api-impl";
4
4
  import { resolveSectionStream, type PublishHold, type ResolveSectionStreamResult } from "./resolve-section-stream.js";
5
5
  export declare const AGENT_TURN_CEILING_MS = 900000;
6
+ export declare const MAX_RELOOKS = 3;
7
+ export declare const RELOOK_GRACE_MS = 20000;
8
+ export type RelookVerdict = "waiting" | "settled";
6
9
  export interface ChatEventFeed {
7
10
  next(): Promise<IteratorResult<ChatWireEvent>>;
8
11
  pushBack?(event: ChatWireEvent): void;
@@ -32,6 +35,8 @@ export interface FollowChatBuildOpts {
32
35
  readonly onError?: Parameters<typeof resolveSectionStream>[0]["onError"];
33
36
  readonly deadlineMs?: number;
34
37
  readonly startAfterPromptId?: string;
38
+ readonly relook?: (inFlight: readonly string[]) => Promise<RelookVerdict>;
39
+ readonly relookGraceMs?: number;
35
40
  readonly now?: () => number;
36
41
  }
37
42
  export interface FollowChatBuildOk {
@@ -40,5 +45,6 @@ export interface FollowChatBuildOk {
40
45
  readonly claimed: boolean;
41
46
  readonly landings: readonly FollowChatBuildLanding[];
42
47
  readonly idle: boolean;
48
+ readonly unfinished: boolean;
43
49
  }
44
50
  export declare function followChatBuild(opts: FollowChatBuildOpts): Promise<Result<FollowChatBuildOk>>;
@@ -3,6 +3,8 @@ import { agentEvidenceLine, markGoldOptionLines } from "@vibes.diy/api-types";
3
3
  import { wireEventKey } from "@vibes.diy/api-impl";
4
4
  import { readPublishHold, resolveSectionStream, } from "./resolve-section-stream.js";
5
5
  export const AGENT_TURN_CEILING_MS = 900_000;
6
+ export const MAX_RELOOKS = 3;
7
+ export const RELOOK_GRACE_MS = 20_000;
6
8
  function agentAnswer(prose, errors) {
7
9
  const said = prose.trim();
8
10
  const why = errors.length > 0 ? ` (${errors.join("; ")})` : "";
@@ -38,7 +40,12 @@ function asSectionBlocks(block) {
38
40
  }
39
41
  export async function followChatBuild(opts) {
40
42
  const now = opts.now ?? (() => Date.now());
41
- const deadlineAt = now() + (opts.deadlineMs ?? AGENT_TURN_CEILING_MS);
43
+ const windowMs = opts.deadlineMs ?? AGENT_TURN_CEILING_MS;
44
+ const graceMs = opts.relookGraceMs ?? RELOOK_GRACE_MS;
45
+ let deadlineAt = now() + windowMs;
46
+ let relooks = 0;
47
+ let grace;
48
+ const promptIdsSeen = new Set();
42
49
  let ownerHandle = opts.ownerHandle;
43
50
  let appSlug = opts.appSlug;
44
51
  let claimed = false;
@@ -108,10 +115,37 @@ export async function followChatBuild(opts) {
108
115
  agentProse.clear();
109
116
  if (landings.length === 0)
110
117
  return Result.Err(agentAnswer(agentSaid.join(""), promptErrors));
111
- return Result.Ok({ ownerHandle, appSlug, claimed, landings, idle });
118
+ return Result.Ok({ ownerHandle, appSlug, claimed, landings, idle, unfinished: sawEvidence && !idle });
119
+ };
120
+ const inFlight = () => {
121
+ const open = [...agentTurnsSeen].filter((p) => !agentTurnsEnded.has(p));
122
+ if (current !== undefined && !open.includes(current.promptId))
123
+ open.push(current.promptId);
124
+ return open;
125
+ };
126
+ const relookOnExpiry = async () => {
127
+ const relook = opts.relook;
128
+ if (relook === undefined || idle)
129
+ return false;
130
+ if (grace !== undefined)
131
+ return false;
132
+ if (relooks >= MAX_RELOOKS)
133
+ return false;
134
+ relooks += 1;
135
+ const verdict = await relook(inFlight()).catch(() => "waiting");
136
+ if (verdict === "waiting") {
137
+ deadlineAt = now() + windowMs;
138
+ }
139
+ else {
140
+ grace = { known: new Set(promptIdsSeen) };
141
+ deadlineAt = now() + graceMs;
142
+ }
143
+ return true;
112
144
  };
113
145
  for (;;) {
114
146
  const read = await readBounded(opts.feed, deadlineAt, now);
147
+ if (read.kind === "deadline" && (await relookOnExpiry()))
148
+ continue;
115
149
  if (read.kind !== "value") {
116
150
  return finish();
117
151
  }
@@ -139,6 +173,11 @@ export async function followChatBuild(opts) {
139
173
  continue;
140
174
  live = true;
141
175
  }
176
+ if (grace !== undefined && !grace.known.has(ev.promptId)) {
177
+ grace = undefined;
178
+ deadlineAt = now() + windowMs;
179
+ }
180
+ promptIdsSeen.add(ev.promptId);
142
181
  opts.onBlock?.(ev);
143
182
  if (ev.type === "prompt.req" && ev.designRepair === true)
144
183
  repairPromptIds.add(ev.promptId);
@@ -216,7 +255,10 @@ export async function followChatBuild(opts) {
216
255
  agentTurnsErrored.has(ev.promptId) &&
217
256
  agentTurnsSeen.size > 0 &&
218
257
  [...agentTurnsSeen].every((p) => agentTurnsEnded.has(p))) {
219
- return finish();
258
+ if (opts.relook === undefined)
259
+ return finish();
260
+ grace = { known: new Set(promptIdsSeen) };
261
+ deadlineAt = Math.min(deadlineAt, now() + graceMs);
220
262
  }
221
263
  }
222
264
  }
@@ -6,6 +6,7 @@ import { compilePosture } from "@vibes.diy/api-types";
6
6
  import { resolveHandle } from "../resolve-handle.js";
7
7
  import { followChatBuild } from "./follow-chat-build.js";
8
8
  import { makeChatEventFeed } from "./chat-event-feed.js";
9
+ import { relookChat, unfinishedRoundLine } from "./relook-chat.js";
9
10
  import { resumeSectionStream } from "./resume-section-stream.js";
10
11
  import { confirmServerRelease } from "./confirm-release.js";
11
12
  import { formatErr } from "./format-err.js";
@@ -197,6 +198,14 @@ async function runGenerateRound(api, args, progress) {
197
198
  }
198
199
  }
199
200
  },
201
+ relook: async (inFlight) => {
202
+ await progress("info", "Still building: checking back with the server so the agent can finish every part.");
203
+ return relookChat({
204
+ chatId: session.chatId,
205
+ reopen: () => session.reopen(),
206
+ getOpenTurn: (req) => api.getOpenTurn(req),
207
+ }, inFlight);
208
+ },
200
209
  onBuildResolved: async (landing) => {
201
210
  turns += 1;
202
211
  address.ownerHandle = landing.ownerHandle;
@@ -232,6 +241,8 @@ async function runGenerateRound(api, args, progress) {
232
241
  return Result.Err(String(r.Err().message ?? r.Err()));
233
242
  address.ownerHandle = r.Ok().ownerHandle;
234
243
  address.appSlug = r.Ok().appSlug;
244
+ if (r.Ok().unfinished && r.Ok().landings.length > 0)
245
+ await progress("warn", unfinishedRoundLine(address));
235
246
  return Result.Ok(undefined);
236
247
  };
237
248
  try {
@@ -29,7 +29,7 @@ export const listEvento = {
29
29
  },
30
30
  handle: async (ctx) => {
31
31
  const ectx = ctx.ctx.getOrThrow("cliCtx");
32
- if (!ectx.vibesDiyApiFactory) {
32
+ if (ectx.vibesDiyApiFactory === undefined) {
33
33
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
34
34
  }
35
35
  const api = ectx.vibesDiyApiFactory(ctx.validated.apiUrl);
@@ -378,7 +378,7 @@ export function createMcpServer(deps) {
378
378
  return server;
379
379
  }
380
380
  export async function buildMcpServerDeps(ctx, args) {
381
- if (!ctx.vibesDiyApiFactory) {
381
+ if (ctx.vibesDiyApiFactory === undefined) {
382
382
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
383
383
  }
384
384
  const api = ctx.vibesDiyApiFactory(args.apiUrl);
@@ -158,7 +158,7 @@ export const pullEvento = {
158
158
  },
159
159
  handle: async (ctx) => {
160
160
  const ectx = ctx.ctx.getOrThrow("cliCtx");
161
- if (!ectx.vibesDiyApiFactory) {
161
+ if (ectx.vibesDiyApiFactory === undefined) {
162
162
  return Result.Err("Not logged in. Run 'vibes-diy login' first.");
163
163
  }
164
164
  const args = ctx.validated;