@swirls/shuttle 0.0.0-stage → 0.1.0
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.
- package/CHANGELOG.md +10 -0
- package/LICENSE +190 -0
- package/NOTICE +5 -0
- package/README.md +42 -2
- package/dist/api/auth.d.ts +18 -0
- package/dist/api/auth.js +15 -0
- package/dist/api/common.d.ts +8 -0
- package/dist/api/common.js +4 -0
- package/dist/api/connections.d.ts +292 -0
- package/dist/api/connections.js +114 -0
- package/dist/api/github.d.ts +20 -0
- package/dist/api/github.js +13 -0
- package/dist/api/harness.d.ts +97 -0
- package/dist/api/harness.js +47 -0
- package/dist/api/index.d.ts +2059 -0
- package/dist/api/index.js +37 -0
- package/dist/api/runners.d.ts +93 -0
- package/dist/api/runners.js +45 -0
- package/dist/api/sandbox.d.ts +550 -0
- package/dist/api/sandbox.js +210 -0
- package/dist/api/sessions.d.ts +318 -0
- package/dist/api/sessions.js +154 -0
- package/dist/api/tenant.d.ts +54 -0
- package/dist/api/tenant.js +19 -0
- package/dist/api/timings.d.ts +36 -0
- package/dist/api/timings.js +48 -0
- package/dist/api/workspace.d.ts +738 -0
- package/dist/api/workspace.js +246 -0
- package/dist/core/pulls.d.ts +1001 -0
- package/dist/core/pulls.js +170 -0
- package/dist/core/workspace.d.ts +985 -0
- package/dist/core/workspace.js +174 -0
- package/dist/react/components/command-palette.d.ts +22 -0
- package/dist/react/components/command-palette.js +66 -0
- package/dist/react/components/follow-list.d.ts +20 -0
- package/dist/react/components/follow-list.js +98 -0
- package/dist/react/components/json-tree.d.ts +11 -0
- package/dist/react/components/json-tree.js +120 -0
- package/dist/react/components/markdown.d.ts +5 -0
- package/dist/react/components/markdown.js +29 -0
- package/dist/react/components/shuttle-mark.d.ts +7 -0
- package/dist/react/components/shuttle-mark.js +9 -0
- package/dist/react/components/status-dot.d.ts +9 -0
- package/dist/react/components/status-dot.js +27 -0
- package/dist/react/components/status.d.ts +6 -0
- package/dist/react/components/status.js +66 -0
- package/dist/react/components/ui/badge.d.ts +7 -0
- package/dist/react/components/ui/badge.js +19 -0
- package/dist/react/components/ui/button.d.ts +10 -0
- package/dist/react/components/ui/button.js +40 -0
- package/dist/react/components/ui/dialog.d.ts +19 -0
- package/dist/react/components/ui/dialog.js +34 -0
- package/dist/react/components/ui/dropdown-menu.d.ts +14 -0
- package/dist/react/components/ui/dropdown-menu.js +33 -0
- package/dist/react/components/ui/input.d.ts +3 -0
- package/dist/react/components/ui/input.js +6 -0
- package/dist/react/components/ui/panel.d.ts +18 -0
- package/dist/react/components/ui/panel.js +22 -0
- package/dist/react/components/ui/popover.d.ts +7 -0
- package/dist/react/components/ui/popover.js +16 -0
- package/dist/react/components/ui/resizable.d.ts +7 -0
- package/dist/react/components/ui/resizable.js +14 -0
- package/dist/react/components/ui/scroll-area.d.ts +14 -0
- package/dist/react/components/ui/scroll-area.js +12 -0
- package/dist/react/components/ui/select.d.ts +10 -0
- package/dist/react/components/ui/select.js +20 -0
- package/dist/react/components/ui/sheet.d.ts +8 -0
- package/dist/react/components/ui/sheet.js +20 -0
- package/dist/react/components/ui/tabs.d.ts +7 -0
- package/dist/react/components/ui/tabs.js +16 -0
- package/dist/react/components/ui/textarea.d.ts +3 -0
- package/dist/react/components/ui/textarea.js +6 -0
- package/dist/react/components/ui/tooltip.d.ts +8 -0
- package/dist/react/components/ui/tooltip.js +17 -0
- package/dist/react/features/artifacts/artifact-links.d.ts +9 -0
- package/dist/react/features/artifacts/artifact-links.js +38 -0
- package/dist/react/features/artifacts/artifact-pane.d.ts +19 -0
- package/dist/react/features/artifacts/artifact-pane.js +64 -0
- package/dist/react/features/artifacts/artifact-types.d.ts +59 -0
- package/dist/react/features/artifacts/artifact-types.js +69 -0
- package/dist/react/features/artifacts/browser-viewer.d.ts +5 -0
- package/dist/react/features/artifacts/browser-viewer.js +60 -0
- package/dist/react/features/artifacts/diff-style.d.ts +10 -0
- package/dist/react/features/artifacts/diff-style.js +21 -0
- package/dist/react/features/artifacts/file-pane.d.ts +13 -0
- package/dist/react/features/artifacts/file-pane.js +305 -0
- package/dist/react/features/artifacts/file-quick-open.d.ts +15 -0
- package/dist/react/features/artifacts/file-quick-open.js +74 -0
- package/dist/react/features/artifacts/file-search.d.ts +12 -0
- package/dist/react/features/artifacts/file-search.js +90 -0
- package/dist/react/features/artifacts/media-viewer.d.ts +8 -0
- package/dist/react/features/artifacts/media-viewer.js +41 -0
- package/dist/react/features/artifacts/review-diff.d.ts +19 -0
- package/dist/react/features/artifacts/review-diff.js +59 -0
- package/dist/react/features/artifacts/review-viewer.d.ts +4 -0
- package/dist/react/features/artifacts/review-viewer.js +337 -0
- package/dist/react/features/artifacts/sandbox.d.ts +43 -0
- package/dist/react/features/artifacts/sandbox.js +109 -0
- package/dist/react/features/artifacts/tab-strip.d.ts +11 -0
- package/dist/react/features/artifacts/tab-strip.js +55 -0
- package/dist/react/features/artifacts/terminal-theme.d.ts +34 -0
- package/dist/react/features/artifacts/terminal-theme.js +62 -0
- package/dist/react/features/artifacts/terminal-viewer.d.ts +5 -0
- package/dist/react/features/artifacts/terminal-viewer.js +209 -0
- package/dist/react/features/artifacts/unified-diff.d.ts +16 -0
- package/dist/react/features/artifacts/unified-diff.js +55 -0
- package/dist/react/features/artifacts/workspace-viewer.d.ts +16 -0
- package/dist/react/features/artifacts/workspace-viewer.js +275 -0
- package/dist/react/features/connections/agent-sign-in.d.ts +71 -0
- package/dist/react/features/connections/agent-sign-in.js +251 -0
- package/dist/react/features/connections/connections-panel.d.ts +8 -0
- package/dist/react/features/connections/connections-panel.js +42 -0
- package/dist/react/features/connections/login.d.ts +24 -0
- package/dist/react/features/connections/login.js +35 -0
- package/dist/react/features/connections/places.d.ts +20 -0
- package/dist/react/features/connections/places.js +27 -0
- package/dist/react/features/connections/queries.d.ts +28 -0
- package/dist/react/features/connections/queries.js +8 -0
- package/dist/react/features/events/event-cache.d.ts +4 -0
- package/dist/react/features/events/event-cache.js +29 -0
- package/dist/react/features/events/event-catalog.d.ts +17 -0
- package/dist/react/features/events/event-catalog.js +261 -0
- package/dist/react/features/events/event-inspector.d.ts +7 -0
- package/dist/react/features/events/event-inspector.js +29 -0
- package/dist/react/features/events/event-row.d.ts +21 -0
- package/dist/react/features/events/event-row.js +34 -0
- package/dist/react/features/events/event-stream.d.ts +18 -0
- package/dist/react/features/events/event-stream.js +58 -0
- package/dist/react/features/events/global-events.d.ts +122 -0
- package/dist/react/features/events/global-events.js +329 -0
- package/dist/react/features/events/shuttle-events.d.ts +7 -0
- package/dist/react/features/events/shuttle-events.js +1 -0
- package/dist/react/features/playbook/playbook-page.d.ts +2 -0
- package/dist/react/features/playbook/playbook-page.js +36 -0
- package/dist/react/features/playbook/playbook-query.d.ts +111 -0
- package/dist/react/features/playbook/playbook-query.js +17 -0
- package/dist/react/features/pulls/linked-session.d.ts +12 -0
- package/dist/react/features/pulls/linked-session.js +22 -0
- package/dist/react/features/pulls/pull-detail-sheet.d.ts +10 -0
- package/dist/react/features/pulls/pull-detail-sheet.js +41 -0
- package/dist/react/features/pulls/pull-fixtures.d.ts +8 -0
- package/dist/react/features/pulls/pull-fixtures.js +258 -0
- package/dist/react/features/pulls/pull-glyphs.d.ts +24 -0
- package/dist/react/features/pulls/pull-glyphs.js +89 -0
- package/dist/react/features/pulls/pull-inbox-list.d.ts +13 -0
- package/dist/react/features/pulls/pull-inbox-list.js +230 -0
- package/dist/react/features/pulls/pull-inbox-pref.d.ts +2 -0
- package/dist/react/features/pulls/pull-inbox-pref.js +19 -0
- package/dist/react/features/pulls/pull-inbox.d.ts +30 -0
- package/dist/react/features/pulls/pull-inbox.js +110 -0
- package/dist/react/features/pulls/pull-threads.d.ts +39 -0
- package/dist/react/features/pulls/pull-threads.js +145 -0
- package/dist/react/features/pulls/pulls.d.ts +120 -0
- package/dist/react/features/pulls/pulls.js +414 -0
- package/dist/react/features/pulls/session-pull-groups.d.ts +14 -0
- package/dist/react/features/pulls/session-pull-groups.js +29 -0
- package/dist/react/features/pulls/stack-ladder.d.ts +9 -0
- package/dist/react/features/pulls/stack-ladder.js +32 -0
- package/dist/react/features/sessions/agent-tree.d.ts +16 -0
- package/dist/react/features/sessions/agent-tree.js +100 -0
- package/dist/react/features/sessions/agents.d.ts +34 -0
- package/dist/react/features/sessions/agents.js +146 -0
- package/dist/react/features/sessions/attention.d.ts +32 -0
- package/dist/react/features/sessions/attention.js +42 -0
- package/dist/react/features/sessions/composer-attachments.d.ts +33 -0
- package/dist/react/features/sessions/composer-attachments.js +126 -0
- package/dist/react/features/sessions/composer.d.ts +15 -0
- package/dist/react/features/sessions/composer.js +327 -0
- package/dist/react/features/sessions/context-usage-meter.d.ts +5 -0
- package/dist/react/features/sessions/context-usage-meter.js +122 -0
- package/dist/react/features/sessions/context-usage.d.ts +54 -0
- package/dist/react/features/sessions/context-usage.js +206 -0
- package/dist/react/features/sessions/conversation.d.ts +21 -0
- package/dist/react/features/sessions/conversation.js +549 -0
- package/dist/react/features/sessions/harness-switcher.d.ts +26 -0
- package/dist/react/features/sessions/harness-switcher.js +118 -0
- package/dist/react/features/sessions/intake-heuristic.d.ts +5 -0
- package/dist/react/features/sessions/intake-heuristic.js +28 -0
- package/dist/react/features/sessions/interjection-routes.d.ts +13 -0
- package/dist/react/features/sessions/interjection-routes.js +72 -0
- package/dist/react/features/sessions/llm-models.d.ts +128 -0
- package/dist/react/features/sessions/llm-models.js +174 -0
- package/dist/react/features/sessions/media-strip.d.ts +25 -0
- package/dist/react/features/sessions/media-strip.js +56 -0
- package/dist/react/features/sessions/media.d.ts +43 -0
- package/dist/react/features/sessions/media.js +115 -0
- package/dist/react/features/sessions/model-search.d.ts +6 -0
- package/dist/react/features/sessions/model-search.js +16 -0
- package/dist/react/features/sessions/model-switcher.d.ts +16 -0
- package/dist/react/features/sessions/model-switcher.js +262 -0
- package/dist/react/features/sessions/open-pull-request.d.ts +20 -0
- package/dist/react/features/sessions/open-pull-request.js +92 -0
- package/dist/react/features/sessions/pull-publish-card.d.ts +14 -0
- package/dist/react/features/sessions/pull-publish-card.js +88 -0
- package/dist/react/features/sessions/recent-sessions.d.ts +11 -0
- package/dist/react/features/sessions/recent-sessions.js +29 -0
- package/dist/react/features/sessions/seen-sessions.d.ts +16 -0
- package/dist/react/features/sessions/seen-sessions.js +108 -0
- package/dist/react/features/sessions/session-activity.d.ts +95 -0
- package/dist/react/features/sessions/session-activity.js +785 -0
- package/dist/react/features/sessions/session-context.d.ts +8 -0
- package/dist/react/features/sessions/session-context.js +98 -0
- package/dist/react/features/sessions/session-feed.d.ts +243 -0
- package/dist/react/features/sessions/session-feed.js +883 -0
- package/dist/react/features/sessions/session-header.d.ts +24 -0
- package/dist/react/features/sessions/session-header.js +97 -0
- package/dist/react/features/sessions/session-layout.d.ts +7 -0
- package/dist/react/features/sessions/session-layout.js +87 -0
- package/dist/react/features/sessions/session-panes.d.ts +49 -0
- package/dist/react/features/sessions/session-panes.js +142 -0
- package/dist/react/features/sessions/session-parts.d.ts +35 -0
- package/dist/react/features/sessions/session-parts.js +74 -0
- package/dist/react/features/sessions/session-place.d.ts +9 -0
- package/dist/react/features/sessions/session-place.js +109 -0
- package/dist/react/features/sessions/session-pr-pills.d.ts +7 -0
- package/dist/react/features/sessions/session-pr-pills.js +28 -0
- package/dist/react/features/sessions/session-queries.d.ts +172 -0
- package/dist/react/features/sessions/session-queries.js +90 -0
- package/dist/react/features/sessions/session-repos.d.ts +8 -0
- package/dist/react/features/sessions/session-repos.js +15 -0
- package/dist/react/features/sessions/session-share.d.ts +8 -0
- package/dist/react/features/sessions/session-share.js +112 -0
- package/dist/react/features/sessions/session-tabs.d.ts +38 -0
- package/dist/react/features/sessions/session-tabs.js +191 -0
- package/dist/react/features/sessions/session.d.ts +103 -0
- package/dist/react/features/sessions/session.js +216 -0
- package/dist/react/features/sessions/signals.d.ts +13 -0
- package/dist/react/features/sessions/signals.js +34 -0
- package/dist/react/features/sessions/tab-set.d.ts +20 -0
- package/dist/react/features/sessions/tab-set.js +58 -0
- package/dist/react/features/sessions/team.d.ts +16 -0
- package/dist/react/features/sessions/team.js +35 -0
- package/dist/react/features/sessions/timeline.d.ts +53 -0
- package/dist/react/features/sessions/timeline.js +153 -0
- package/dist/react/features/sessions/use-session-tabs.d.ts +18 -0
- package/dist/react/features/sessions/use-session-tabs.js +119 -0
- package/dist/react/features/sessions/vendor-models.d.ts +23 -0
- package/dist/react/features/sessions/vendor-models.js +61 -0
- package/dist/react/features/workspace/activity-dot.d.ts +15 -0
- package/dist/react/features/workspace/activity-dot.js +36 -0
- package/dist/react/features/workspace/app-sidebar.d.ts +16 -0
- package/dist/react/features/workspace/app-sidebar.js +227 -0
- package/dist/react/features/workspace/fixture-toggle.d.ts +2 -0
- package/dist/react/features/workspace/fixture-toggle.js +72 -0
- package/dist/react/features/workspace/folder-group.d.ts +18 -0
- package/dist/react/features/workspace/folder-group.js +83 -0
- package/dist/react/features/workspace/inline-name-input.d.ts +10 -0
- package/dist/react/features/workspace/inline-name-input.js +33 -0
- package/dist/react/features/workspace/link-repo-dialog.d.ts +9 -0
- package/dist/react/features/workspace/link-repo-dialog.js +76 -0
- package/dist/react/features/workspace/repo-chip.d.ts +13 -0
- package/dist/react/features/workspace/repo-chip.js +15 -0
- package/dist/react/features/workspace/session-row.d.ts +20 -0
- package/dist/react/features/workspace/session-row.js +23 -0
- package/dist/react/features/workspace/use-debounced.d.ts +2 -0
- package/dist/react/features/workspace/use-debounced.js +10 -0
- package/dist/react/features/workspace/workspace-context.d.ts +45 -0
- package/dist/react/features/workspace/workspace-context.js +245 -0
- package/dist/react/features/workspace/workspace-fixtures.d.ts +16 -0
- package/dist/react/features/workspace/workspace-fixtures.js +175 -0
- package/dist/react/features/workspace/workspace-tree.d.ts +30 -0
- package/dist/react/features/workspace/workspace-tree.js +69 -0
- package/dist/react/features/workspace/workspace.d.ts +107 -0
- package/dist/react/features/workspace/workspace.js +458 -0
- package/dist/react/index.d.ts +33 -0
- package/dist/react/index.js +35 -0
- package/dist/react/lib/cn.d.ts +6 -0
- package/dist/react/lib/cn.js +20 -0
- package/dist/react/lib/initials.d.ts +6 -0
- package/dist/react/lib/initials.js +32 -0
- package/dist/react/lib/json.d.ts +33 -0
- package/dist/react/lib/json.js +101 -0
- package/dist/react/lib/time.d.ts +8 -0
- package/dist/react/lib/time.js +57 -0
- package/dist/react/lib/use-media-query.d.ts +1 -0
- package/dist/react/lib/use-media-query.js +9 -0
- package/dist/react/lib/use-now.d.ts +2 -0
- package/dist/react/lib/use-now.js +10 -0
- package/dist/react/lib/use-width-bucket.d.ts +6 -0
- package/dist/react/lib/use-width-bucket.js +28 -0
- package/dist/react/parts/index.d.ts +43 -0
- package/dist/react/parts/index.js +43 -0
- package/dist/react/shuttle/device.d.ts +42 -0
- package/dist/react/shuttle/device.js +10 -0
- package/dist/react/shuttle/host.d.ts +1126 -0
- package/dist/react/shuttle/host.js +93 -0
- package/dist/react/shuttle/identity.d.ts +31 -0
- package/dist/react/shuttle/identity.js +20 -0
- package/dist/react/shuttle/index.d.ts +14 -0
- package/dist/react/shuttle/index.js +13 -0
- package/dist/react/shuttle/provider.d.ts +41 -0
- package/dist/react/shuttle/provider.js +59 -0
- package/dist/react/shuttle/router.d.ts +43 -0
- package/dist/react/shuttle/router.js +1 -0
- package/dist/react/theme.css +456 -0
- package/dist/react/ui.d.ts +19 -0
- package/dist/react/ui.js +19 -0
- package/package.json +100 -4
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { File, Search } from 'lucide-react';
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Dialog, DialogContent, DialogDescription, DialogTitle } from '../../components/ui/dialog.js';
|
|
5
|
+
import { ScrollArea } from '../../components/ui/scroll-area.js';
|
|
6
|
+
import { cn } from '../../lib/cn.js';
|
|
7
|
+
import { searchFiles } from './file-search.js';
|
|
8
|
+
/** The hint for the shortcut that opens file search, as this platform writes it. */
|
|
9
|
+
export function quickOpenShortcut() {
|
|
10
|
+
return /mac|iphone|ipad/i.test(navigator.userAgent) ? '⌘P' : 'Ctrl+P';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Go to file: type part of a name, arrow to a result, Enter to open it. With nothing typed it
|
|
14
|
+
* lists the files already open, most recent first, then the rest.
|
|
15
|
+
*/
|
|
16
|
+
export function FileQuickOpen({ open, onOpenChange, paths, recent, onPick, }) {
|
|
17
|
+
// Counts openings, so each one gets a fresh search even when it follows the last so closely
|
|
18
|
+
// that the dialog had not finished closing.
|
|
19
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
20
|
+
const [opening, setOpening] = useState(0);
|
|
21
|
+
if (wasOpen !== open) {
|
|
22
|
+
setWasOpen(open);
|
|
23
|
+
if (open) {
|
|
24
|
+
setOpening(opening + 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { instant: true, className: "top-[18%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0", children: [_jsx(DialogTitle, { className: "sr-only", children: "Go to file" }), _jsx(DialogDescription, { className: "sr-only", children: "Type part of a file name, then use the arrow keys and Enter to open it." }), _jsx(QuickOpenBody, { paths: paths, recent: recent, onPick: (path) => {
|
|
28
|
+
onPick(path);
|
|
29
|
+
onOpenChange(false);
|
|
30
|
+
} }, opening)] }) }));
|
|
31
|
+
}
|
|
32
|
+
function QuickOpenBody({ paths, recent, onPick, }) {
|
|
33
|
+
const [query, setQuery] = useState('');
|
|
34
|
+
const [cursor, setCursor] = useState(0);
|
|
35
|
+
const listRef = useRef(null);
|
|
36
|
+
const results = useMemo(() => {
|
|
37
|
+
if (query.trim()) {
|
|
38
|
+
return searchFiles(paths, query);
|
|
39
|
+
}
|
|
40
|
+
const present = new Set(paths);
|
|
41
|
+
const first = recent.toReversed().filter((path) => present.has(path));
|
|
42
|
+
const seen = new Set(first);
|
|
43
|
+
return [...first, ...searchFiles(paths, '').filter((path) => !seen.has(path))].slice(0, 50);
|
|
44
|
+
}, [paths, recent, query]);
|
|
45
|
+
const active = Math.min(cursor, Math.max(results.length - 1, 0));
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
listRef.current?.children[active]?.scrollIntoView({ block: 'nearest' });
|
|
48
|
+
}, [active]);
|
|
49
|
+
const pick = (path) => {
|
|
50
|
+
if (path) {
|
|
51
|
+
onPick(path);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex h-11 items-center gap-2 border-b px-3.5", children: [_jsx(Search, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("input", { autoFocus: true, value: query, onChange: (event) => {
|
|
55
|
+
setQuery(event.target.value);
|
|
56
|
+
setCursor(0);
|
|
57
|
+
}, onKeyDown: (event) => {
|
|
58
|
+
if (event.key === 'ArrowDown') {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setCursor(Math.min(active + 1, results.length - 1));
|
|
61
|
+
}
|
|
62
|
+
else if (event.key === 'ArrowUp') {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
setCursor(Math.max(active - 1, 0));
|
|
65
|
+
}
|
|
66
|
+
else if (event.key === 'Enter') {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
pick(results[active]);
|
|
69
|
+
}
|
|
70
|
+
}, placeholder: "Go to file\u2026", "aria-label": "Search files by name", role: "combobox", "aria-expanded": true, "aria-controls": "file-quick-open-results", "aria-activedescendant": results[active] ? `file-result-${active}` : undefined, spellCheck: false, autoComplete: "off", className: "placeholder:text-muted-foreground/70 h-full min-w-0 flex-1 bg-transparent text-[13px] outline-none" })] }), results.length === 0 ? (_jsxs("p", { className: "text-muted-foreground px-3.5 py-6 text-center text-[12px]", children: ["No file matches \u201C", query.trim(), "\u201D."] })) : (_jsx(ScrollArea, { className: "max-h-80", viewportClassName: "max-h-80", children: _jsx("ul", { ref: listRef, id: "file-quick-open-results", role: "listbox", className: "p-1.5", children: results.map((path, index) => {
|
|
71
|
+
const slash = path.lastIndexOf('/');
|
|
72
|
+
return (_jsxs("li", { id: `file-result-${index}`, role: "option", "aria-selected": index === active, "data-active": index === active, onMouseMove: () => setCursor(index), onClick: () => pick(path), className: cn('flex h-7 cursor-default items-center gap-2 rounded-md px-2 text-[12.5px]', index === active && 'bg-accent text-accent-foreground'), children: [_jsx(File, { className: "text-muted-foreground size-3.5 shrink-0" }), _jsx("span", { className: "shrink-0", children: path.slice(slash + 1) }), _jsx("span", { className: "text-muted-foreground min-w-0 truncate text-[11.5px]", children: slash > 0 ? path.slice(0, slash) : '' })] }, path));
|
|
73
|
+
}) }) }))] }));
|
|
74
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matching for quick file search: the letters typed must appear in the path in order, and paths
|
|
3
|
+
* where they land in the file's name, at the start of a word, or next to each other rank higher.
|
|
4
|
+
* It is the behaviour people expect from an editor's "go to file".
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* How well `query` matches `path`: higher is better, null is no match. An empty query matches
|
|
8
|
+
* everything equally.
|
|
9
|
+
*/
|
|
10
|
+
export declare function matchScore(query: string, path: string): number | null;
|
|
11
|
+
/** The paths that match `query`, best first, at most `limit` of them. */
|
|
12
|
+
export declare function searchFiles(paths: readonly string[], query: string, limit?: number): string[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matching for quick file search: the letters typed must appear in the path in order, and paths
|
|
3
|
+
* where they land in the file's name, at the start of a word, or next to each other rank higher.
|
|
4
|
+
* It is the behaviour people expect from an editor's "go to file".
|
|
5
|
+
*/
|
|
6
|
+
const SEPARATORS = new Set(['/', '.', '-', '_', ' ']);
|
|
7
|
+
/**
|
|
8
|
+
* Scores `needle` as letters found in order in `haystack`, or null when they are not all there.
|
|
9
|
+
* Letters score more for carrying straight on from the one before, for starting a word, and for
|
|
10
|
+
* sitting at or after `nameStart`.
|
|
11
|
+
*/
|
|
12
|
+
function inOrderScore(needle, haystack, nameStart) {
|
|
13
|
+
const atWordStart = (at) => at === 0 || SEPARATORS.has(haystack[at - 1] ?? '');
|
|
14
|
+
/** Whether `needle` from letter `letter` on can still be found in order from `start`. */
|
|
15
|
+
const restFits = (letter, start) => {
|
|
16
|
+
let at = start;
|
|
17
|
+
for (let index = letter; index < needle.length; index++) {
|
|
18
|
+
at = haystack.indexOf(needle[index] ?? '', at) + 1;
|
|
19
|
+
if (at === 0) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
25
|
+
if (!restFits(0, 0)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
let score = 0;
|
|
29
|
+
let from = 0;
|
|
30
|
+
let previous = -2;
|
|
31
|
+
for (let index = 0; index < needle.length; index++) {
|
|
32
|
+
const letter = needle[index] ?? '';
|
|
33
|
+
const next = haystack.indexOf(letter, from);
|
|
34
|
+
let at = next;
|
|
35
|
+
// Carrying straight on from the last letter is best; failing that, the start of a later
|
|
36
|
+
// word, which is how initials ("ssh" for session-share) are meant.
|
|
37
|
+
if (next !== previous + 1) {
|
|
38
|
+
for (let seek = next; seek >= 0; seek = haystack.indexOf(letter, seek + 1)) {
|
|
39
|
+
if (atWordStart(seek) && restFits(index + 1, seek + 1)) {
|
|
40
|
+
at = seek;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
score +=
|
|
46
|
+
1 + (at === previous + 1 ? 6 : 0) + (atWordStart(at) ? 8 : 0) + (at >= nameStart ? 4 : 0);
|
|
47
|
+
previous = at;
|
|
48
|
+
from = at + 1;
|
|
49
|
+
}
|
|
50
|
+
return score;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* How well `query` matches `path`: higher is better, null is no match. An empty query matches
|
|
54
|
+
* everything equally.
|
|
55
|
+
*/
|
|
56
|
+
export function matchScore(query, path) {
|
|
57
|
+
const needle = query.toLowerCase().replaceAll(/\s+/g, '');
|
|
58
|
+
if (!needle) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
const haystack = path.toLowerCase();
|
|
62
|
+
const nameStart = haystack.lastIndexOf('/') + 1;
|
|
63
|
+
// The whole query inside the file's name is what people most often mean.
|
|
64
|
+
const inName = haystack.indexOf(needle, nameStart);
|
|
65
|
+
if (inName >= 0) {
|
|
66
|
+
return 1000 - (inName - nameStart) * 2 - (haystack.length - nameStart - needle.length);
|
|
67
|
+
}
|
|
68
|
+
// Next best is every letter within the name; then letters anywhere along the path.
|
|
69
|
+
const withinName = inOrderScore(needle, haystack.slice(nameStart), 0);
|
|
70
|
+
const alongPath = inOrderScore(needle, haystack, nameStart);
|
|
71
|
+
if (withinName === null && alongPath === null) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
// Among equal matches the shorter path is the likelier one.
|
|
75
|
+
return (Math.max(withinName === null ? 0 : withinName + 100, alongPath ?? 0) - haystack.length / 100);
|
|
76
|
+
}
|
|
77
|
+
/** The paths that match `query`, best first, at most `limit` of them. */
|
|
78
|
+
export function searchFiles(paths, query, limit = 50) {
|
|
79
|
+
const scored = [];
|
|
80
|
+
for (const path of paths) {
|
|
81
|
+
const score = matchScore(query, path);
|
|
82
|
+
if (score !== null) {
|
|
83
|
+
scored.push({ path, score });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return scored
|
|
87
|
+
.toSorted((left, right) => right.score - left.score || left.path.localeCompare(right.path))
|
|
88
|
+
.slice(0, limit)
|
|
89
|
+
.map((item) => item.path);
|
|
90
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentIdentity } from '../sessions/agents.js';
|
|
2
|
+
import { type SessionMedia } from '../sessions/media.js';
|
|
3
|
+
/** Every file in the session in one place, newest first: what agents made and what people sent. */
|
|
4
|
+
export declare function MediaViewer({ runId, media, identities, }: {
|
|
5
|
+
runId: string;
|
|
6
|
+
media: readonly SessionMedia[];
|
|
7
|
+
identities: ReadonlyMap<string, AgentIdentity>;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Images } from 'lucide-react';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { EmptyState } from '../../components/ui/panel.js';
|
|
5
|
+
import { ScrollArea } from '../../components/ui/scroll-area.js';
|
|
6
|
+
import { cn } from '../../lib/cn.js';
|
|
7
|
+
import { clockTime } from '../../lib/time.js';
|
|
8
|
+
import { formatBytes, mediaKind } from '../sessions/media.js';
|
|
9
|
+
import { MediaTile } from '../sessions/media-strip.js';
|
|
10
|
+
const FILTERS = [
|
|
11
|
+
{ id: 'all', label: 'All' },
|
|
12
|
+
{ id: 'agent', label: 'Made by agents' },
|
|
13
|
+
{ id: 'upload', label: 'Attached' },
|
|
14
|
+
];
|
|
15
|
+
/** Every file in the session in one place, newest first: what agents made and what people sent. */
|
|
16
|
+
export function MediaViewer({ runId, media, identities, }) {
|
|
17
|
+
const [filter, setFilter] = useState('all');
|
|
18
|
+
const shown = useMemo(() => media.filter((entry) => filter === 'all' || entry.source === filter).toReversed(), [media, filter]);
|
|
19
|
+
if (media.length === 0) {
|
|
20
|
+
return (_jsx(EmptyState, { icon: _jsx(Images, {}), title: "No media yet", children: "Images, video, audio and other files show up here when an agent shares one or someone attaches one to a message." }));
|
|
21
|
+
}
|
|
22
|
+
return (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [_jsx("div", { className: "flex shrink-0 items-center gap-1 border-b px-2.5 py-1.5", children: FILTERS.map((option) => {
|
|
23
|
+
const count = option.id === 'all'
|
|
24
|
+
? media.length
|
|
25
|
+
: media.filter((entry) => entry.source === option.id).length;
|
|
26
|
+
return (_jsxs("button", { type: "button", "aria-pressed": filter === option.id, onClick: () => setFilter(option.id), className: cn('ease-snappy inline-flex h-6 items-center gap-1.5 rounded-md px-2 text-[11.5px] transition-colors duration-150', filter === option.id
|
|
27
|
+
? 'bg-accent text-foreground'
|
|
28
|
+
: 'text-muted-foreground hover:text-foreground'), children: [option.label, _jsx("span", { className: "text-muted-foreground tabular-nums", children: count })] }, option.id));
|
|
29
|
+
}) }), _jsx(ScrollArea, { className: "min-h-0 flex-1", children: shown.length === 0 ? (_jsx("p", { className: "text-muted-foreground px-4 py-8 text-center text-xs", children: "Nothing here yet." })) : (_jsx("ul", { className: "grid grid-cols-[repeat(auto-fill,minmax(13rem,1fr))] gap-3 p-3", children: shown.map((entry) => (_jsxs("li", { className: "flex min-w-0 flex-col gap-1.5", children: [_jsx(MediaTile, { runId: runId, asset: entry.asset, size: "fill" }), _jsxs("div", { className: "min-w-0 px-0.5", children: [named(entry) ? null : (_jsx("p", { className: "truncate text-[12px] font-medium", dir: "auto", title: entry.asset.name, children: entry.asset.name })), _jsxs("p", { className: "text-muted-foreground truncate text-[11px]", children: [origin(entry, identities), " \u00B7 ", clockTime(entry.ts), " \u00B7", ' ', _jsx("span", { className: "tabular-nums", children: formatBytes(entry.asset.size) })] })] })] }, `${entry.asset.id}:${entry.seq}`))) })) })] }));
|
|
30
|
+
}
|
|
31
|
+
function named(entry) {
|
|
32
|
+
const kind = mediaKind(entry.asset.mediaType);
|
|
33
|
+
return kind !== 'image' && kind !== 'video';
|
|
34
|
+
}
|
|
35
|
+
function origin(entry, identities) {
|
|
36
|
+
if (entry.source === 'upload') {
|
|
37
|
+
return entry.authorName ? `Attached by ${entry.authorName}` : 'Attached';
|
|
38
|
+
}
|
|
39
|
+
const label = entry.threadId ? identities.get(entry.threadId)?.label : undefined;
|
|
40
|
+
return label ? `Made by ${label}` : 'Made by an agent';
|
|
41
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pull request's diff, cut into the pieces the review tab draws: one patch per file, and for
|
|
3
|
+
* each the lines a comment can sit on.
|
|
4
|
+
*/
|
|
5
|
+
export interface ReviewFile {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
/** The file's own patch, from its `diff --git` line to the next file's. */
|
|
8
|
+
readonly patch: string;
|
|
9
|
+
readonly additions: number;
|
|
10
|
+
readonly deletions: number;
|
|
11
|
+
/** New-file line numbers the patch shows: added and unchanged lines. */
|
|
12
|
+
readonly rightLines: ReadonlySet<number>;
|
|
13
|
+
/** Old-file line numbers the patch shows: removed and unchanged lines. */
|
|
14
|
+
readonly leftLines: ReadonlySet<number>;
|
|
15
|
+
}
|
|
16
|
+
/** The files of a `git diff`, in the order it lists them. */
|
|
17
|
+
export declare function reviewFiles(diff: string): ReviewFile[];
|
|
18
|
+
/** Whether a comment on `line` of `side` has a line of the file's patch to sit on. */
|
|
19
|
+
export declare function anchorsIn(file: ReviewFile, side: 'LEFT' | 'RIGHT', line: number | null): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pull request's diff, cut into the pieces the review tab draws: one patch per file, and for
|
|
3
|
+
* each the lines a comment can sit on.
|
|
4
|
+
*/
|
|
5
|
+
function pathOf(patch) {
|
|
6
|
+
const next = patch.match(/^\+\+\+ b\/(.+)$/m)?.[1];
|
|
7
|
+
const previous = patch.match(/^--- a\/(.+)$/m)?.[1];
|
|
8
|
+
const header = patch.match(/^diff --git a\/.+ b\/(.+)$/m)?.[1];
|
|
9
|
+
return (next ?? previous ?? header ?? '').trim();
|
|
10
|
+
}
|
|
11
|
+
function fileOf(patch) {
|
|
12
|
+
const rightLines = new Set();
|
|
13
|
+
const leftLines = new Set();
|
|
14
|
+
let additions = 0;
|
|
15
|
+
let deletions = 0;
|
|
16
|
+
let oldLine = 0;
|
|
17
|
+
let newLine = 0;
|
|
18
|
+
let inHunk = false;
|
|
19
|
+
for (const line of patch.split('\n')) {
|
|
20
|
+
const hunk = line.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
|
|
21
|
+
if (hunk) {
|
|
22
|
+
oldLine = Number(hunk[1]);
|
|
23
|
+
newLine = Number(hunk[2]);
|
|
24
|
+
inHunk = true;
|
|
25
|
+
}
|
|
26
|
+
else if (!inHunk) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
else if (line.startsWith('+')) {
|
|
30
|
+
rightLines.add(newLine);
|
|
31
|
+
newLine += 1;
|
|
32
|
+
additions += 1;
|
|
33
|
+
}
|
|
34
|
+
else if (line.startsWith('-')) {
|
|
35
|
+
leftLines.add(oldLine);
|
|
36
|
+
oldLine += 1;
|
|
37
|
+
deletions += 1;
|
|
38
|
+
}
|
|
39
|
+
else if (line.startsWith(' ')) {
|
|
40
|
+
rightLines.add(newLine);
|
|
41
|
+
leftLines.add(oldLine);
|
|
42
|
+
oldLine += 1;
|
|
43
|
+
newLine += 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { path: pathOf(patch), patch, additions, deletions, rightLines, leftLines };
|
|
47
|
+
}
|
|
48
|
+
/** The files of a `git diff`, in the order it lists them. */
|
|
49
|
+
export function reviewFiles(diff) {
|
|
50
|
+
return diff
|
|
51
|
+
.split(/^(?=diff --git )/m)
|
|
52
|
+
.filter((patch) => patch.startsWith('diff --git '))
|
|
53
|
+
.map(fileOf)
|
|
54
|
+
.filter((file) => file.path !== '');
|
|
55
|
+
}
|
|
56
|
+
/** Whether a comment on `line` of `side` has a line of the file's patch to sit on. */
|
|
57
|
+
export function anchorsIn(file, side, line) {
|
|
58
|
+
return line !== null && (side === 'LEFT' ? file.leftLines : file.rightLines).has(line);
|
|
59
|
+
}
|