@agimon-ai/po-git 0.0.0-alpha.41 → 0.0.0-alpha.43

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 { createApiClient, defineActivityGroup, defineChannelFile, defineFill, defineGlobalStore, defineLeaderBinding, defineRepositorySettingsPanel, defineSessionStore, defineToolRenderer, defineWebLifecycle, defineWebPlugin, sessionApiAddress } from "@agimon-ai/po-core/web";
2
2
  import { ArrowRightIcon, BranchIcon, Button, CheckIcon, ChevronDownIcon, ChevronUpIcon, Dialog, DialogContent, DialogTitle, DiffView, Dot, DropdownMenuItem, EmptyState, Input, MessageIcon, MessageItem, MessageItemBody, ReviewCommentDraft, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SettingsActions, SettingsCard, SettingsNote, SettingsRow, SettingsRowDescription, SettingsRowText, SettingsRowTitle, SettingsSection, SettingsSectionDescription, SettingsSectionHeader, SettingsSectionTitle, ShieldIcon, Spinner, StatusBadge, Tabs, TabsContent, TabsList, TabsTrigger, buildReviewPrompt } from "@agimon-ai/po-web-components";
3
- import { createElement, useCallback, useEffect, useId, useRef, useState } from "react";
3
+ import { createElement, useCallback, useEffect, useEffectEvent, useId, useRef, useState } from "react";
4
4
  import { browserTransport } from "@agimon-ai/po-web-security/browser";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { useStore } from "@tanstack/react-store";
@@ -362,12 +362,12 @@ function GitNewSessionDialog({ newSession }) {
362
362
  const [error, setError] = useState("");
363
363
  const [busy, setBusy] = useState(false);
364
364
  const workspaceId = newSession?.workspaceId;
365
- const request = newSession?.requestWithStepUp;
365
+ const request = useEffectEvent((input) => newSession?.requestWithStepUp(input));
366
366
  useEffect(() => {
367
- if (workspaceId === void 0 || request === void 0) return;
367
+ if (workspaceId === void 0) return;
368
368
  let stale = false;
369
369
  const url = api.workspace(workspaceId).branches.url();
370
- request(url).then(async (response) => {
370
+ request(url)?.then(async (response) => {
371
371
  const body = await response.json().catch(() => void 0);
372
372
  if (stale) return;
373
373
  if (!response.ok) {
@@ -381,7 +381,7 @@ function GitNewSessionDialog({ newSession }) {
381
381
  return () => {
382
382
  stale = true;
383
383
  };
384
- }, [workspaceId, request]);
384
+ }, [workspaceId]);
385
385
  if (newSession === void 0) return null;
386
386
  const submit = async (state) => {
387
387
  if (busy || formProblem$1(state) !== void 0) return;
@@ -1555,12 +1555,6 @@ var gitChanges_web_default = defineChannelFile(gitChangesChannel);
1555
1555
  //#region src/extensions/workspaces/sessions/(frontend)/channel/gitWorktrees.web.ts
1556
1556
  var gitWorktrees_web_default = defineChannelFile(worktreesChannel);
1557
1557
  //#endregion
1558
- //#region src/extensions/workspaces/sessions/(frontend)/fill/Worktree.session-menu.web.tsx
1559
- var Worktree_session_menu_web_default = defineFill({ component: WorktreeSessionMenu });
1560
- //#endregion
1561
- //#region src/extensions/workspaces/sessions/(frontend)/fill/WorktreeCreate.overlay.web.tsx
1562
- var WorktreeCreate_overlay_web_default = defineFill({ component: WorktreeCreateOverlay });
1563
- //#endregion
1564
1558
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/gitReviewApi.ts
1565
1559
  /**
1566
1560
  * The review tab's half of the session API: the changed-file list and one
@@ -1617,16 +1611,34 @@ async function fetchReviewFile(sessionId, path, signal) {
1617
1611
  const gitReview = defineSessionStore({ comments: [] });
1618
1612
  function addReviewComment(sessionId, comment) {
1619
1613
  const id = globalThis.crypto.randomUUID();
1620
- gitReview.update(sessionId, (current) => ({ comments: [...current.comments, {
1621
- ...comment,
1622
- id
1623
- }] }));
1614
+ gitReview.update(sessionId, (current) => ({
1615
+ ...current,
1616
+ comments: [...current.comments, {
1617
+ ...comment,
1618
+ id
1619
+ }]
1620
+ }));
1624
1621
  }
1625
1622
  function removeReviewComment(sessionId, id) {
1626
- gitReview.update(sessionId, (current) => ({ comments: current.comments.filter((comment) => comment.id !== id) }));
1623
+ gitReview.update(sessionId, (current) => ({
1624
+ ...current,
1625
+ comments: current.comments.filter((comment) => comment.id !== id)
1626
+ }));
1627
1627
  }
1628
1628
  function clearReviewComments(sessionId) {
1629
- gitReview.update(sessionId, () => ({ comments: [] }));
1629
+ gitReview.update(sessionId, (current) => ({
1630
+ ...current,
1631
+ comments: []
1632
+ }));
1633
+ }
1634
+ function focusReviewFile(sessionId, path) {
1635
+ gitReview.update(sessionId, (current) => ({
1636
+ ...current,
1637
+ focus: {
1638
+ path,
1639
+ at: Date.now()
1640
+ }
1641
+ }));
1630
1642
  }
1631
1643
  //#endregion
1632
1644
  //#region src/extensions/workspaces/sessions/(frontend)/_lib/gitReviewView.ts
@@ -2350,6 +2362,7 @@ function reviewTab() {
2350
2362
  function GitReviewPanel({ sessionId, sendSessionFrame }) {
2351
2363
  const activity = useStore(gitChanges.store, (state) => gitChanges.select(state, sessionId));
2352
2364
  const comments = useStore(gitReview.store, (state) => gitReview.select(state, sessionId).comments);
2365
+ const focus = useStore(gitReview.store, (state) => gitReview.select(state, sessionId).focus);
2353
2366
  const [summary, setSummary] = useState({ state: "loading" });
2354
2367
  const [files, setFiles] = useState({});
2355
2368
  const [sendError, setSendError] = useState();
@@ -2444,6 +2457,7 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
2444
2457
  if (failure === void 0) onSent?.();
2445
2458
  };
2446
2459
  return /* @__PURE__ */ jsx(GitReviewView, {
2460
+ ...focus === void 0 ? {} : { initialPath: focus.path },
2447
2461
  onDraftChange: (open) => setDraftSnapshot((current) => open ? current?.sessionId === sessionId ? current : {
2448
2462
  sessionId,
2449
2463
  fingerprint
@@ -2470,9 +2484,31 @@ function GitReviewPanel({ sessionId, sendSessionFrame }) {
2470
2484
  onSendReview: () => send(buildReviewPrompt(comments, reviewHeading(comments.length, branch, base)), () => clearReviewComments(sessionId)),
2471
2485
  onDiscard: () => clearReviewComments(sessionId),
2472
2486
  ...sendError === void 0 ? {} : { sendError }
2473
- }, sessionId);
2487
+ }, `${sessionId}:${String(focus?.at ?? 0)}`);
2474
2488
  }
2475
2489
  //#endregion
2490
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/GitReview.vibe-lint.finding-review.web.ts
2491
+ /** Lets code review findings open this checkout's diff review on their file. */
2492
+ var GitReview_vibe_lint_finding_review_web_default = defineFill({
2493
+ slot: "vibe-lint.finding-review",
2494
+ id: "git-review",
2495
+ data: {
2496
+ version: 1,
2497
+ label: "Open in review",
2498
+ open: (props, path) => {
2499
+ if (props.sessionId === null) return;
2500
+ focusReviewFile(props.sessionId, path);
2501
+ props.openTransientTab(reviewTab());
2502
+ }
2503
+ }
2504
+ });
2505
+ //#endregion
2506
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/Worktree.session-menu.web.tsx
2507
+ var Worktree_session_menu_web_default = defineFill({ component: WorktreeSessionMenu });
2508
+ //#endregion
2509
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/WorktreeCreate.overlay.web.tsx
2510
+ var WorktreeCreate_overlay_web_default = defineFill({ component: WorktreeCreateOverlay });
2511
+ //#endregion
2476
2512
  //#region src/extensions/workspaces/sessions/(frontend)/fill/_components/DiffActivitySection.tsx
2477
2513
  /**
2478
2514
  * The '# git' group's branch row: this session's code change against its base.
@@ -2821,6 +2857,10 @@ const webPlugin = defineWebPlugin({
2821
2857
  },
2822
2858
  get fills() {
2823
2859
  return [
2860
+ via({
2861
+ slot: "vibe-lint.finding-review",
2862
+ id: "git-review"
2863
+ }, GitReview_vibe_lint_finding_review_web_default),
2824
2864
  via({
2825
2865
  slot: "session-menu",
2826
2866
  id: "worktree"