@ai-matrx/coding-sessions 0.1.89 → 0.1.91

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.
@@ -5,6 +5,7 @@ import {
5
5
  useCallback as useCallback2,
6
6
  useContext as useContext3,
7
7
  useEffect as useEffect4,
8
+ useLayoutEffect,
8
9
  useMemo as useMemo4,
9
10
  useRef as useRef3,
10
11
  useState as useState6
@@ -2695,7 +2696,7 @@ function SessionView({ session, changesOpen, setChangesOpen }) {
2695
2696
  ) : null,
2696
2697
  messages.length === 0 && !live ? /* @__PURE__ */ jsx7("div", { className: "flex flex-1 items-center justify-center text-[13px] text-muted-foreground", children: session.origin === "takeover" ? "You've taken over this chat. Send a message to continue it." : "Nothing here yet." }) : /* @__PURE__ */ jsx7(ChatMessageList, { className: "min-h-0 flex-1", label: `Conversation: ${entry.title}` })
2697
2698
  ] }) }),
2698
- /* @__PURE__ */ jsxs7("div", { className: "mx-auto w-full max-w-[820px] px-4 pb-4", children: [
2699
+ /* @__PURE__ */ jsxs7("div", { "data-cs-composer": true, className: "mx-auto w-full max-w-[820px] px-4 pb-4", children: [
2699
2700
  limited ? /* @__PURE__ */ jsxs7("div", { className: "mb-2 flex items-start gap-2 rounded-lg border border-warning/40 bg-warning/10 px-3 py-2 text-[12.5px]", children: [
2700
2701
  /* @__PURE__ */ jsx7(AlertIcon, { size: 15, className: "mt-0.5 shrink-0 text-warning" }),
2701
2702
  /* @__PURE__ */ jsxs7("span", { children: [
@@ -3297,8 +3298,7 @@ function Home({ onNew }) {
3297
3298
  p.ready ? /* @__PURE__ */ jsxs7("span", { className: "block truncate text-[12px] text-muted-foreground", children: [
3298
3299
  "Ready",
3299
3300
  p.plan ? ` on your ${p.plan} plan` : "",
3300
- p.billing === "api" ? " (API key, billed per use)" : "",
3301
- p.binary?.newer ? ` \xB7 ${p.binary.newer.version} available` : ""
3301
+ p.billing === "api" ? " (API key, billed per use)" : ""
3302
3302
  ] }) : /* @__PURE__ */ jsxs7("span", { className: "block text-[12px] text-muted-foreground", children: [
3303
3303
  p.problem,
3304
3304
  " ",
@@ -3313,21 +3313,34 @@ function Home({ onNew }) {
3313
3313
  ] }) });
3314
3314
  }
3315
3315
  function useToast() {
3316
- const [text, setText] = useState6(null);
3316
+ const [current, setCurrent] = useState6(null);
3317
3317
  const timer = useRef3(null);
3318
3318
  useEffect4(() => () => {
3319
3319
  if (timer.current) clearTimeout(timer.current);
3320
3320
  }, []);
3321
- const show = useCallback2((next) => {
3322
- setText(next);
3321
+ const show = useCallback2((next, sessionId = null) => {
3322
+ setCurrent({ text: next, sessionId });
3323
3323
  if (timer.current) clearTimeout(timer.current);
3324
- timer.current = setTimeout(() => setText(null), 6e3);
3324
+ timer.current = setTimeout(() => setCurrent(null), 6e3);
3325
3325
  }, []);
3326
- return [text, show];
3326
+ const dismiss = useCallback2(() => {
3327
+ if (timer.current) clearTimeout(timer.current);
3328
+ setCurrent(null);
3329
+ }, []);
3330
+ return { text: current?.text ?? null, sessionId: current?.sessionId ?? null, show, dismiss };
3327
3331
  }
3328
3332
  function Toast({ text }) {
3333
+ const ref = useRef3(null);
3334
+ useLayoutEffect(() => {
3335
+ const el = ref.current;
3336
+ const pane = el?.parentElement;
3337
+ if (!el || !pane) return;
3338
+ const composer = pane.querySelector("[data-cs-composer]");
3339
+ const gap = composer ? pane.getBoundingClientRect().bottom - composer.getBoundingClientRect().top + 8 : 20;
3340
+ el.style.setProperty("--cs-toast-bottom", `${Math.max(20, Math.round(gap))}px`);
3341
+ }, [text]);
3329
3342
  if (!text) return null;
3330
- return /* @__PURE__ */ jsx7("div", { role: "status", className: "cs-toast", children: text });
3343
+ return /* @__PURE__ */ jsx7("div", { ref, role: "status", "data-cs-toast": true, className: "cs-toast", children: text });
3331
3344
  }
3332
3345
  var SIDEBAR_DEFAULT = 300;
3333
3346
  var SIDEBAR_MIN = 220;
@@ -3430,7 +3443,14 @@ function ShortcutsDialog(props) {
3430
3443
  ] }) });
3431
3444
  }
3432
3445
  var BASE_TITLE = "Coding sessions";
3433
- function useRunFinishedNotices(openSessionId, show) {
3446
+ function useRunFinishedNotices(openSessionId, toast) {
3447
+ const { show, dismiss, sessionId: toastSession } = toast;
3448
+ const state = useCodingSessionsState();
3449
+ useEffect4(() => {
3450
+ if (!toastSession) return;
3451
+ const run = state.runs[toastSession];
3452
+ if (openSessionId === toastSession || run && (run.status === "starting" || run.status === "running")) dismiss();
3453
+ }, [toastSession, openSessionId, state.runs, dismiss]);
3434
3454
  const client = useCodingSessionsClient();
3435
3455
  const unseen = useRef3(0);
3436
3456
  const openRef = useRef3(openSessionId);
@@ -3459,7 +3479,7 @@ function useRunFinishedNotices(openSessionId, show) {
3459
3479
  };
3460
3480
  }
3461
3481
  } else if (openRef.current !== run.sessionId && run.status !== "stopped") {
3462
- show(sentence);
3482
+ show(sentence, run.sessionId);
3463
3483
  }
3464
3484
  });
3465
3485
  return () => {
@@ -3499,7 +3519,8 @@ function Shell() {
3499
3519
  const [changesOpen, setChangesOpen] = useState6(false);
3500
3520
  const [found, setFound] = useState6({});
3501
3521
  const [theme, setTheme] = useTheme();
3502
- const [toast, showToast] = useToast();
3522
+ const toast = useToast();
3523
+ const showToast = toast.show;
3503
3524
  const layout = useSidebarLayout();
3504
3525
  const searchRef = useRef3(null);
3505
3526
  const select = useCallback2((next) => {
@@ -3511,7 +3532,7 @@ function Shell() {
3511
3532
  window.addEventListener("hashchange", onHash);
3512
3533
  return () => window.removeEventListener("hashchange", onHash);
3513
3534
  }, []);
3514
- useRunFinishedNotices(selection.kind === "session" ? selection.id : null, showToast);
3535
+ useRunFinishedNotices(selection.kind === "session" ? selection.id : null, toast);
3515
3536
  const session = selection.kind === "session" ? state.sessions.data.find((s) => s.id === selection.id) ?? null : null;
3516
3537
  const discovered = selection.kind === "discovered" ? state.discovered.data.find((d) => d.providerSessionId === selection.id) ?? found[`${selection.provider}:${selection.id}`] ?? null : null;
3517
3538
  const run = session ? state.runs[session.id] : void 0;
@@ -3661,7 +3682,10 @@ function Shell() {
3661
3682
  ),
3662
3683
  /* @__PURE__ */ jsx7(Resizer, { width: layout.width, setWidth: layout.setWidth })
3663
3684
  ] }),
3664
- /* @__PURE__ */ jsx7("main", { className: "flex min-w-0 flex-1", children: main })
3685
+ /* @__PURE__ */ jsxs7("main", { className: "relative flex min-w-0 flex-1", children: [
3686
+ main,
3687
+ /* @__PURE__ */ jsx7(Toast, { text: toast.text })
3688
+ ] })
3665
3689
  ] }),
3666
3690
  /* @__PURE__ */ jsx7(
3667
3691
  NewSessionDialog,
@@ -3674,8 +3698,7 @@ function Shell() {
3674
3698
  }
3675
3699
  }
3676
3700
  ),
3677
- /* @__PURE__ */ jsx7(ShortcutsDialog, { open: shortcutsOpen, onOpenChange: setShortcutsOpen }),
3678
- /* @__PURE__ */ jsx7(Toast, { text: toast })
3701
+ /* @__PURE__ */ jsx7(ShortcutsDialog, { open: shortcutsOpen, onOpenChange: setShortcutsOpen })
3679
3702
  ] }) });
3680
3703
  }
3681
3704
  function CodingSessionsApp({ transport }) {