@ai-matrx/coding-sessions 0.1.88 → 0.1.90

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: [
@@ -3284,52 +3285,62 @@ function Home({ onNew }) {
3284
3285
  /* @__PURE__ */ jsx7("kbd", { className: "cs-kbd", children: "\u2318/" }),
3285
3286
  " all shortcuts"
3286
3287
  ] }),
3287
- /* @__PURE__ */ jsx7("div", { className: "mt-6 flex flex-wrap justify-center gap-2 text-left", children: state.providers.data.map((p) => /* @__PURE__ */ jsxs7("div", { "data-provider-card": p.provider, className: "flex w-[260px] items-start gap-2.5 rounded-lg border border-border bg-card px-3 py-2.5", children: [
3288
- /* @__PURE__ */ jsx7(ProviderMark, { provider: p.provider, size: 16 }),
3289
- /* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1 leading-5", children: [
3290
- /* @__PURE__ */ jsx7("span", { className: "block truncate text-[14px] font-semibold", children: p.label }),
3291
- p.ready ? /* @__PURE__ */ jsxs7("span", { className: "block truncate text-[12px] text-muted-foreground", children: [
3292
- "Ready",
3293
- p.plan ? ` on your ${p.plan} plan` : "",
3294
- p.billing === "api" ? " (API key, billed per use)" : ""
3295
- ] }) : null,
3296
- p.installed && p.version ? /* @__PURE__ */ jsxs7(
3297
- "span",
3298
- {
3299
- className: "block truncate text-[12px] text-muted-foreground",
3300
- title: newerWords(p) ?? p.binary?.path ?? void 0,
3301
- children: [
3302
- binaryWords(p),
3303
- p.binary?.newer ? ` \xB7 ${p.binary.newer.version} available` : ""
3304
- ]
3305
- }
3306
- ) : null,
3307
- p.ready ? null : /* @__PURE__ */ jsxs7("span", { className: "block text-muted-foreground", children: [
3308
- p.problem,
3309
- " ",
3310
- p.fix
3311
- ] })
3312
- ] }),
3313
- p.ready ? /* @__PURE__ */ jsx7(CheckIcon, { size: 15, className: "mt-0.5 text-success" }) : /* @__PURE__ */ jsx7(AlertIcon, { size: 15, className: "mt-0.5 text-warning" })
3314
- ] }, p.provider)) })
3288
+ /* @__PURE__ */ jsx7("div", { className: "mt-6 flex flex-wrap justify-center gap-2 text-left", children: state.providers.data.map((p) => /* @__PURE__ */ jsxs7(
3289
+ "div",
3290
+ {
3291
+ "data-provider-card": p.provider,
3292
+ title: p.installed && p.version ? [binaryWords(p), newerWords(p) ?? p.binary?.path].filter(Boolean).join(" \xB7 ") : void 0,
3293
+ className: "flex w-[260px] items-start gap-2.5 rounded-lg border border-border bg-card px-3 py-2.5",
3294
+ children: [
3295
+ /* @__PURE__ */ jsx7(ProviderMark, { provider: p.provider, size: 16 }),
3296
+ /* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1 leading-5", children: [
3297
+ /* @__PURE__ */ jsx7("span", { className: "block truncate text-[14px] font-semibold", children: p.label }),
3298
+ p.ready ? /* @__PURE__ */ jsxs7("span", { className: "block truncate text-[12px] text-muted-foreground", children: [
3299
+ "Ready",
3300
+ p.plan ? ` on your ${p.plan} plan` : "",
3301
+ p.billing === "api" ? " (API key, billed per use)" : ""
3302
+ ] }) : /* @__PURE__ */ jsxs7("span", { className: "block text-[12px] text-muted-foreground", children: [
3303
+ p.problem,
3304
+ " ",
3305
+ p.fix
3306
+ ] })
3307
+ ] }),
3308
+ p.ready ? /* @__PURE__ */ jsx7(CheckIcon, { size: 15, className: "mt-0.5 text-success" }) : /* @__PURE__ */ jsx7(AlertIcon, { size: 15, className: "mt-0.5 text-warning" })
3309
+ ]
3310
+ },
3311
+ p.provider
3312
+ )) })
3315
3313
  ] }) });
3316
3314
  }
3317
3315
  function useToast() {
3318
- const [text, setText] = useState6(null);
3316
+ const [current, setCurrent] = useState6(null);
3319
3317
  const timer = useRef3(null);
3320
3318
  useEffect4(() => () => {
3321
3319
  if (timer.current) clearTimeout(timer.current);
3322
3320
  }, []);
3323
- const show = useCallback2((next) => {
3324
- setText(next);
3321
+ const show = useCallback2((next, sessionId = null) => {
3322
+ setCurrent({ text: next, sessionId });
3325
3323
  if (timer.current) clearTimeout(timer.current);
3326
- timer.current = setTimeout(() => setText(null), 6e3);
3324
+ timer.current = setTimeout(() => setCurrent(null), 6e3);
3327
3325
  }, []);
3328
- 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 };
3329
3331
  }
3330
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]);
3331
3342
  if (!text) return null;
3332
- 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 });
3333
3344
  }
3334
3345
  var SIDEBAR_DEFAULT = 300;
3335
3346
  var SIDEBAR_MIN = 220;
@@ -3432,7 +3443,14 @@ function ShortcutsDialog(props) {
3432
3443
  ] }) });
3433
3444
  }
3434
3445
  var BASE_TITLE = "Coding sessions";
3435
- 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]);
3436
3454
  const client = useCodingSessionsClient();
3437
3455
  const unseen = useRef3(0);
3438
3456
  const openRef = useRef3(openSessionId);
@@ -3461,7 +3479,7 @@ function useRunFinishedNotices(openSessionId, show) {
3461
3479
  };
3462
3480
  }
3463
3481
  } else if (openRef.current !== run.sessionId && run.status !== "stopped") {
3464
- show(sentence);
3482
+ show(sentence, run.sessionId);
3465
3483
  }
3466
3484
  });
3467
3485
  return () => {
@@ -3501,7 +3519,8 @@ function Shell() {
3501
3519
  const [changesOpen, setChangesOpen] = useState6(false);
3502
3520
  const [found, setFound] = useState6({});
3503
3521
  const [theme, setTheme] = useTheme();
3504
- const [toast, showToast] = useToast();
3522
+ const toast = useToast();
3523
+ const showToast = toast.show;
3505
3524
  const layout = useSidebarLayout();
3506
3525
  const searchRef = useRef3(null);
3507
3526
  const select = useCallback2((next) => {
@@ -3513,7 +3532,7 @@ function Shell() {
3513
3532
  window.addEventListener("hashchange", onHash);
3514
3533
  return () => window.removeEventListener("hashchange", onHash);
3515
3534
  }, []);
3516
- useRunFinishedNotices(selection.kind === "session" ? selection.id : null, showToast);
3535
+ useRunFinishedNotices(selection.kind === "session" ? selection.id : null, toast);
3517
3536
  const session = selection.kind === "session" ? state.sessions.data.find((s) => s.id === selection.id) ?? null : null;
3518
3537
  const discovered = selection.kind === "discovered" ? state.discovered.data.find((d) => d.providerSessionId === selection.id) ?? found[`${selection.provider}:${selection.id}`] ?? null : null;
3519
3538
  const run = session ? state.runs[session.id] : void 0;
@@ -3663,7 +3682,10 @@ function Shell() {
3663
3682
  ),
3664
3683
  /* @__PURE__ */ jsx7(Resizer, { width: layout.width, setWidth: layout.setWidth })
3665
3684
  ] }),
3666
- /* @__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
+ ] })
3667
3689
  ] }),
3668
3690
  /* @__PURE__ */ jsx7(
3669
3691
  NewSessionDialog,
@@ -3676,8 +3698,7 @@ function Shell() {
3676
3698
  }
3677
3699
  }
3678
3700
  ),
3679
- /* @__PURE__ */ jsx7(ShortcutsDialog, { open: shortcutsOpen, onOpenChange: setShortcutsOpen }),
3680
- /* @__PURE__ */ jsx7(Toast, { text: toast })
3701
+ /* @__PURE__ */ jsx7(ShortcutsDialog, { open: shortcutsOpen, onOpenChange: setShortcutsOpen })
3681
3702
  ] }) });
3682
3703
  }
3683
3704
  function CodingSessionsApp({ transport }) {