@vibes.diy/base 14.3.333 → 14.3.334

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.
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { SECTION_TITLES } from "../menu-state.js";
3
- import { chatOnlyHistoryOpens, codeCardMoment } from "../moments.js";
3
+ import { FIRST_BUILD_LOADING_LINE, chatOnlyHistoryOpens, codeCardMoment } from "../moments.js";
4
4
  import { activeWorkspaceTab, lookDrillOpen } from "../code-tabs.js";
5
5
  import { draftYouLines } from "../parts/use-composer-draft.js";
6
6
  import { EDIT_TEXT_LABEL, EDIT_TEXT_SAVE, EDIT_TEXT_SAVING, REMIX_INVITE_KICKER, GUEST_BUILD_NOTE } from "../copy.js";
@@ -291,7 +291,7 @@ export function CodeCard(props) {
291
291
  keepAppNode,
292
292
  composerNode,
293
293
  props.chipRow ?? null,
294
- hasMoment ? React.createElement(MomentLine, { moment: moment, log: log, onAction: code.onMomentAction }) : null,
294
+ hasMoment ? React.createElement(MomentLine, { moment: moment, log: log, onAction: code.onMomentAction, onLiveTap: code.onLiveLineTap }) : null,
295
295
  buildAskNode));
296
296
  if (code.tabRow === true) {
297
297
  const tabLog = logOpens === false ? null : log;
@@ -321,12 +321,24 @@ export function CodeCard(props) {
321
321
  else if (firstBuild)
322
322
  handoffSawBuild.current = true;
323
323
  const handoffHold = code.firstBuildHandoff === true && handoffSawBuild.current === false;
324
+ const bootHold = handoffHold && editor === true && moment.pinned === null && firstBuild === false;
325
+ const bootMoment = !bootHold
326
+ ? moment
327
+ : live === null
328
+ ? { pinned: null, live: { kind: "progress", text: FIRST_BUILD_LOADING_LINE.text } }
329
+ : live.kind === "loading"
330
+ ? { pinned: null, live: FIRST_BUILD_LOADING_LINE }
331
+ : moment;
332
+ const bootLog = chatLog === null && bootMoment !== moment && bootMoment.live?.kind === "progress" && logOpens
333
+ ? { ...toggle, tail, history: hasHistory ? history : undefined }
334
+ : chatLog;
335
+ const building = working || bootHold;
324
336
  const showComposer = code.composerHidden !== true && (firstBuild === false || askOpen) && historyLoading === false && handoffHold === false;
325
- const guestBuildNode = editor === true && code.guestBuild === true && working === true && showComposer === false ? (React.createElement("p", { className: "vm-sub vm-guest-build", "data-guest-build-note": "" },
337
+ const guestBuildNode = editor === true && code.guestBuild === true && building === true && showComposer === false ? (React.createElement("p", { className: "vm-sub vm-guest-build", "data-guest-build-note": "" },
326
338
  React.createElement("strong", null, GUEST_BUILD_NOTE.lead),
327
339
  " ",
328
340
  GUEST_BUILD_NOTE.body)) : null;
329
- const guestSlot = editor === true && code.guestBuild === true && working === true;
341
+ const guestSlot = editor === true && code.guestBuild === true && building === true;
330
342
  const guestSpacer = guestSlot && buildAskNode !== null && guestBuildNode === null ? (React.createElement("p", { className: "vm-sub vm-guest-build", "data-guest-build-spacer": "", "aria-hidden": "true", style: { visibility: "hidden" } },
331
343
  React.createElement("strong", null, GUEST_BUILD_NOTE.lead),
332
344
  " ",
@@ -339,12 +351,13 @@ export function CodeCard(props) {
339
351
  const mainAction = showComposer ? (composerNode) : working ? (React.createElement(StopIconButton, { disabled: composer.stopDisabled === true, armedAt: latestStopArm(live?.expected?.fromMs, pinnedLeftAt.current), onStop: () => {
340
352
  heldFirstBuild.current = null;
341
353
  draft.stop();
342
- }, latch: code.composerHidden !== true })) : null;
354
+ }, latch: code.composerHidden !== true })) : bootHold ? (React.createElement("div", { "data-stop-reserve": "", "aria-hidden": "true", inert: true, style: { visibility: "hidden" } },
355
+ React.createElement(StopIconButton, { disabled: true, onStop: () => undefined }))) : null;
343
356
  return (React.createElement("div", { className: "vm-code vm-ctab", "data-card": "vibe", "data-tab-row": "", "data-chat-only": code.chatOnly === true ? "" : undefined },
344
357
  React.createElement("style", null, CODE_CARD_CSS + CODE_TAB_ROW_CSS + CODE_SUMMARY_LINE_CSS),
345
358
  requestHead ?? invite,
346
359
  props.chipRow ?? null,
347
- hasMoment ? React.createElement(MomentLine, { moment: moment, log: chatLog, onAction: code.onMomentAction }) : null,
360
+ bootMoment.pinned !== null || bootMoment.live !== null ? (React.createElement(MomentLine, { moment: bootMoment, log: bootLog, onAction: code.onMomentAction, onLiveTap: code.onLiveLineTap, reserveBar: bootHold })) : null,
348
361
  askSlot,
349
362
  saveRow,
350
363
  showComposer ? keepAppNode : null,
@@ -8,10 +8,11 @@ export declare const ClipboardWriterContext: React.Context<ClipboardWriter>;
8
8
  export declare function copyText(text: string, write?: ClipboardWriter): Promise<Result<void>>;
9
9
  export interface CopyFeedback {
10
10
  readonly copied: boolean;
11
+ readonly failed: boolean;
11
12
  readonly ref: React.RefObject<HTMLButtonElement | null>;
12
13
  onCopy(): void;
13
14
  }
14
- export declare function useCopyFeedback(text: string, onCopied?: () => void): CopyFeedback;
15
+ export declare function useCopyFeedback(text: string, onCopied?: () => void, onFailed?: () => void): CopyFeedback;
15
16
  export interface CopyChipProps {
16
17
  readonly text: string;
17
18
  readonly label: string;
@@ -24,8 +24,9 @@ export function copyText(text, write = navigatorClipboardWriter) {
24
24
  await write(text);
25
25
  });
26
26
  }
27
- export function useCopyFeedback(text, onCopied) {
27
+ export function useCopyFeedback(text, onCopied, onFailed) {
28
28
  const [copied, setCopied] = useState(false);
29
+ const [failed, setFailed] = useState(false);
29
30
  const ref = useRef(null);
30
31
  const timer = useRef(null);
31
32
  const write = useContext(ClipboardWriterContext);
@@ -37,8 +38,12 @@ export function useCopyFeedback(text, onCopied) {
37
38
  }, []);
38
39
  const onCopy = useCallback(function onCopy() {
39
40
  void copyText(text, write).then((res) => {
40
- if (res.isErr())
41
+ if (res.isErr()) {
42
+ setFailed(true);
43
+ onFailed?.();
41
44
  return;
45
+ }
46
+ setFailed(false);
42
47
  onCopied?.();
43
48
  const el = ref.current;
44
49
  if (el !== null && timer.current === null)
@@ -53,8 +58,8 @@ export function useCopyFeedback(text, onCopied) {
53
58
  ref.current.style.minWidth = "";
54
59
  }, MOTION.copiedMs);
55
60
  });
56
- }, [text, write, onCopied]);
57
- return { copied, ref, onCopy };
61
+ }, [text, write, onCopied, onFailed]);
62
+ return { copied, failed, ref, onCopy };
58
63
  }
59
64
  export function CopyChip({ text, label, ariaLabel, onCopied }) {
60
65
  const { copied, ref, onCopy } = useCopyFeedback(text, onCopied);
@@ -55,7 +55,8 @@ export interface ComposerSlice {
55
55
  readonly seed: ComposerSeed | null;
56
56
  readonly restore: ComposerRestore | null;
57
57
  readonly onSendBlocked?: (reason: ComposerSendBlockedReason) => void;
58
- readonly onSendQueued?: (queued: number) => void;
58
+ readonly onSendQueued?: (queued: number, cause?: "host_refused") => void;
59
+ readonly queuesRefusedSend?: boolean;
59
60
  readonly onQueueDropped?: (drop: ComposerQueueDrop) => void;
60
61
  readonly turnMark?: string;
61
62
  readonly onQueueFlushed?: (messages: number) => void;
@@ -12,6 +12,9 @@ export interface ExpectedTimeLinks {
12
12
  export type FirstBuildNoteAction = "shown" | "my_vibes_tapped";
13
13
  export declare const ExpectedTimeLinksContext: React.Context<ExpectedTimeLinks>;
14
14
  export declare const EXPECTED_TIME_CSS = "\n [data-vibe-menu] .vm-expected { display: grid; gap: var(--space-6); padding: 0 var(--space-2); }\n [data-vibe-menu] .vm-expected-track { height: 4px; border-radius: 2px; overflow: hidden; background: var(--line-hairline); }\n [data-vibe-menu] .vm-expected-fill {\n height: 100%; background: var(--ink); transform-origin: left center;\n }\n [data-vibe-menu] .vm-expected-fill[data-moving] { transition: transform 1s linear; }\n [data-vibe-menu] .vm-expected-note { margin: 0; font: 400 13px/1.4 var(--font-display); color: var(--muted); }\n [data-vibe-menu] .vm-expected-reserve::after { content: attr(data-reserve); visibility: hidden; }\n [data-vibe-menu] .vm-expected-reserve-link { font-weight: 700; }\n [data-vibe-menu] .vm-expected-link { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }\n [data-vibe-menu] .vm-live > .vm-expected { margin-top: var(--space-8); }\n [data-vibe-menu] .vm-prompt-status + .vm-expected { margin: calc(-1 * var(--space-8)) 0 var(--space-16); }\n @media (prefers-reduced-motion: reduce) {\n [data-vibe-menu] .vm-expected-fill { transition: none; }\n }\n";
15
+ export declare function ExpectedTimeReserve({ ms }: {
16
+ readonly ms?: number;
17
+ }): React.ReactElement;
15
18
  export declare function ExpectedTimeBar({ expected }: {
16
19
  readonly expected: ExpectedTime;
17
20
  }): React.ReactElement;
@@ -64,6 +64,14 @@ export const EXPECTED_TIME_CSS = `
64
64
  [data-vibe-menu] .vm-expected-fill { transition: none; }
65
65
  }
66
66
  `;
67
+ export function ExpectedTimeReserve({ ms = 120_000 }) {
68
+ const links = React.useContext(ExpectedTimeLinksContext);
69
+ return (React.createElement("div", { className: "vm-expected", "data-expected-reserve": "", "aria-hidden": "true", style: { visibility: "hidden" } },
70
+ React.createElement("style", null, EXPECTED_TIME_CSS),
71
+ React.createElement("div", { className: "vm-expected-track" }),
72
+ React.createElement("p", { className: "vm-expected-note" },
73
+ React.createElement(Reserve, { text: [expectedTimeNote(ms), ...findIt(links)] }))));
74
+ }
67
75
  export function ExpectedTimeBar({ expected }) {
68
76
  const links = React.useContext(ExpectedTimeLinksContext);
69
77
  const now = useNowMs(expected.fromMs);
@@ -18,6 +18,8 @@ export interface MomentLineProps {
18
18
  readonly moment: CurrentMoment;
19
19
  readonly log: MomentLogControl | null;
20
20
  readonly onAction: (item: MomentItem, action: string) => void;
21
+ readonly reserveBar?: boolean;
22
+ readonly onLiveTap?: (opened: boolean) => void;
21
23
  }
22
24
  export interface AgentLogProps {
23
25
  readonly id?: string;
@@ -3,7 +3,7 @@ import { NEXT_STEP_KICKER } from "../moments.js";
3
3
  import { AgentLogFrameContext } from "./agent-log-frame.js";
4
4
  import { ActionPill } from "./ActionPill.js";
5
5
  import { Chip } from "./Chip.js";
6
- import { ExpectedTimeBar } from "./ExpectedTimeBar.js";
6
+ import { ExpectedTimeBar, ExpectedTimeReserve } from "./ExpectedTimeBar.js";
7
7
  import { Glyph } from "./Glyph.js";
8
8
  import { ThinkingLine, useElapsedText } from "./ThinkingLine.js";
9
9
  const WHO_LABEL = { you: "You", built: "Built", agent: "Agent" };
@@ -107,7 +107,7 @@ function LiveMoment(props) {
107
107
  const hasHistory = log !== null && log.history !== undefined && log.history !== null;
108
108
  const peek = log !== null && log.open === false && log.peek === true;
109
109
  const link = item.link === undefined ? null : (React.createElement("a", { className: "vm-moment-link", href: item.link.href, onClick: stayIfHere }, item.link.label));
110
- const bar = item.kind === "progress" && item.resting !== true && item.expected !== undefined ? (React.createElement(ExpectedTimeBar, { expected: item.expected })) : null;
110
+ const bar = item.kind === "progress" && item.resting !== true && item.expected !== undefined ? (React.createElement(ExpectedTimeBar, { expected: item.expected })) : props.reserveBar === true ? (React.createElement(ExpectedTimeReserve, null)) : null;
111
111
  if (log === null) {
112
112
  return (React.createElement(React.Fragment, null,
113
113
  React.createElement("p", { className: `vm-moment ${kindClass}`, "data-moment": item.kind },
@@ -116,7 +116,11 @@ function LiveMoment(props) {
116
116
  bar));
117
117
  }
118
118
  return (React.createElement("div", { className: "vm-live" },
119
- React.createElement("button", { className: `vm-moment ${kindClass} is-expander`, type: "button", "data-moment": item.kind, "aria-expanded": log.open, "aria-controls": logId, "aria-label": `Chat: ${item.text}`, onClick: () => log.onToggle() },
119
+ React.createElement("button", { className: `vm-moment ${kindClass} is-expander`, type: "button", "data-moment": item.kind, "aria-expanded": log.open, "aria-controls": logId, "aria-label": `Chat: ${item.text}`, onClick: () => {
120
+ if (item.kind === "progress" && item.resting !== true)
121
+ props.onLiveTap?.(log.open === false);
122
+ log.onToggle();
123
+ } },
120
124
  React.createElement("span", { className: log.open ? "vm-chev is-open" : "vm-chev", "data-log-chev": "" },
121
125
  React.createElement(Glyph, { name: "chevron-right" })),
122
126
  words),
@@ -132,6 +136,6 @@ export function MomentLine(props) {
132
136
  return null;
133
137
  return (React.createElement("div", { className: "vm-moments", "data-moment-block": "" },
134
138
  pinned === null ? null : React.createElement(PinnedMoment, { item: pinned, onAction: props.onAction }),
135
- live === null ? null : React.createElement(LiveMoment, { item: live, log: props.log }),
139
+ live === null ? null : React.createElement(LiveMoment, { item: live, log: props.log, reserveBar: props.reserveBar, onLiveTap: props.onLiveTap }),
136
140
  live === null && props.log !== null && props.log.lines.length > 0 ? React.createElement(AgentLog, { lines: props.log.lines }) : null));
137
141
  }
@@ -288,6 +288,21 @@ export function useComposerDraft(input) {
288
288
  }
289
289
  const restoringFiles = restoringFilesFor !== null && restoringFilesFor === persistKey;
290
290
  const draftAttachments = React.useMemo(() => (restoringFiles ? { ...attachments, busy: true } : attachments), [attachments, restoringFiles]);
291
+ function queueSend(trimmed, ready, cause) {
292
+ submittedRender.current = true;
293
+ queuedSuggestion.current = queued.length === 0 && suggestion === text && ready.length === 0;
294
+ setSuggestion(undefined);
295
+ const words = trimmed !== "" ? trimmed : ready.length === 1 ? ONE_FILE_TEXT : MANY_FILES_TEXT;
296
+ setQueuedSends([...queuedSends, { text: words, files: ready }]);
297
+ if (ready.length > 0)
298
+ attachments.clear();
299
+ setText("");
300
+ if (cause === undefined)
301
+ composer.onSendQueued?.(queued.length + 1);
302
+ else
303
+ composer.onSendQueued?.(queued.length + 1, cause);
304
+ return true;
305
+ }
291
306
  function submit() {
292
307
  if (submittedRender.current === true || pendingSubmit.current !== undefined) {
293
308
  composer.onSendBlocked?.("busy");
@@ -313,22 +328,15 @@ export function useComposerDraft(input) {
313
328
  composer.onSendBlocked?.("busy");
314
329
  return false;
315
330
  }
316
- submittedRender.current = true;
317
- queuedSuggestion.current = queued.length === 0 && suggestion === text && ready.length === 0;
318
- setSuggestion(undefined);
319
- const words = trimmed !== "" ? trimmed : ready.length === 1 ? ONE_FILE_TEXT : MANY_FILES_TEXT;
320
- setQueuedSends([...queuedSends, { text: words, files: ready }]);
321
- if (ready.length > 0)
322
- attachments.clear();
323
- setText("");
324
- composer.onSendQueued?.(queued.length + 1);
325
- return true;
331
+ return queueSend(trimmed, ready);
326
332
  }
327
333
  const fileText = ready.length === 1 ? ONE_FILE_TEXT : MANY_FILES_TEXT;
328
334
  const message = trimmed === "" ? fileText : trimmed;
329
335
  submittedRender.current = true;
330
336
  const answer = suggestion === text ? composer.onSubmit(message, ready, "suggestion") : composer.onSubmit(message, ready);
331
337
  if (answer === false) {
338
+ if (composer.queuesRefusedSend === true)
339
+ return queueSend(trimmed, ready, "host_refused");
332
340
  submittedRender.current = false;
333
341
  composer.onSendBlocked?.("other");
334
342
  return false;
@@ -95,6 +95,7 @@ export interface CodeSlice {
95
95
  composer: ComposerSlice;
96
96
  moments: readonly MomentItem[];
97
97
  onMomentAction(item: MomentItem, action: string): void;
98
+ readonly onLiveLineTap?: (opened: boolean) => void;
98
99
  log: readonly AgentLogLine[];
99
100
  suggestions: readonly string[];
100
101
  goldSuggestion: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/base",
3
- "version": "14.3.333",
3
+ "version": "14.3.334",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -10,10 +10,10 @@
10
10
  "dependencies": {
11
11
  "@adviser/cement": "~0.5.37",
12
12
  "@emotion/css": "~11.13.5",
13
- "@vibes.diy/api-types": "14.3.333",
14
- "@vibes.diy/use-vibes-types": "14.3.333",
15
- "@vibes.diy/vibe-runtime": "14.3.333",
16
- "@vibes.diy/vibe-types": "14.3.333",
13
+ "@vibes.diy/api-types": "14.3.334",
14
+ "@vibes.diy/use-vibes-types": "14.3.334",
15
+ "@vibes.diy/vibe-runtime": "14.3.334",
16
+ "@vibes.diy/vibe-types": "14.3.334",
17
17
  "arktype": "~2.2.9",
18
18
  "officeparser": "~8.7.1",
19
19
  "qrcode-generator": "~2.0.4",