@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,118 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
import { ChevronDown } from 'lucide-react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { HarnessId, TEAM_PRESETS, TeamPreset } from '@swirls/shuttle/api';
|
|
6
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../components/ui/dropdown-menu.js';
|
|
7
|
+
import { cn } from '../../lib/cn.js';
|
|
8
|
+
import { Link, useShuttleHost } from '../../shuttle/index.js';
|
|
9
|
+
import { signedInAt } from '../connections/places.js';
|
|
10
|
+
import { connectionsQuery } from '../connections/queries.js';
|
|
11
|
+
import { useSetSessionDefaults } from './session-queries.js';
|
|
12
|
+
import { canRunAt, DEFAULT_TEAM, effectiveTeam, withTeamChange } from './team.js';
|
|
13
|
+
import { sectionLabel } from './vendor-models.js';
|
|
14
|
+
const SHUTTLE_LABEL = 'Shuttle';
|
|
15
|
+
const PRESET_LABELS = {
|
|
16
|
+
none: 'Conductor decides',
|
|
17
|
+
'codex-builds-claude-reviews': 'Codex builds, Claude reviews',
|
|
18
|
+
'claude-builds-codex-reviews': 'Claude builds, Codex reviews',
|
|
19
|
+
'claude-plans-codex-implements': 'Claude plans, Codex implements',
|
|
20
|
+
};
|
|
21
|
+
/** What the picker shows for a Shuttle session, naming the vendor agents on its team. */
|
|
22
|
+
function teamLabel(team) {
|
|
23
|
+
const members = [
|
|
24
|
+
team?.codex ? 'Codex' : null,
|
|
25
|
+
team?.claudeCode ? 'Claude' : null,
|
|
26
|
+
team?.cursor ? 'Cursor' : null,
|
|
27
|
+
].filter(Boolean);
|
|
28
|
+
return members.length > 0 ? `${SHUTTLE_LABEL} + ${members.join(' + ')}` : SHUTTLE_LABEL;
|
|
29
|
+
}
|
|
30
|
+
function teamKey(harness) {
|
|
31
|
+
switch (harness) {
|
|
32
|
+
case 'codex':
|
|
33
|
+
return 'codex';
|
|
34
|
+
case 'claude-code':
|
|
35
|
+
return 'claudeCode';
|
|
36
|
+
case 'cursor':
|
|
37
|
+
return 'cursor';
|
|
38
|
+
default: {
|
|
39
|
+
const exhaustive = harness;
|
|
40
|
+
return exhaustive;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* How an agent stands where the session runs, for the picker. An agent signed in only at the
|
|
46
|
+
* other place can still be picked: the message box then offers to sign in where it runs.
|
|
47
|
+
*/
|
|
48
|
+
function agentStatus(connection, place) {
|
|
49
|
+
const there = place ? signedInAt(connection, place) : null;
|
|
50
|
+
if (there === true || (there === null && connection.connected)) {
|
|
51
|
+
return { text: 'Your subscription', warn: false };
|
|
52
|
+
}
|
|
53
|
+
if (!connection.connected) {
|
|
54
|
+
return { text: 'Not connected', warn: false };
|
|
55
|
+
}
|
|
56
|
+
return { text: place === 'local' ? 'Cloud only' : 'This machine only', warn: true };
|
|
57
|
+
}
|
|
58
|
+
/** Picks which agent runs the session: Shuttle's own loop, or a connected subscription. */
|
|
59
|
+
export function HarnessSwitcher({ value, onChange, team, onTeamChange, disabled = false, side = 'top', place, }) {
|
|
60
|
+
const host = useShuttleHost();
|
|
61
|
+
const { data: state, refetch } = useQuery(connectionsQuery(host));
|
|
62
|
+
const connections = state?.connections ?? [];
|
|
63
|
+
// An agent with no connection of its own, such as one reached over ACP, goes by its name.
|
|
64
|
+
const label = value === 'shuttle'
|
|
65
|
+
? SHUTTLE_LABEL
|
|
66
|
+
: (connections.find((entry) => entry.harness === value)?.label ?? sectionLabel(value));
|
|
67
|
+
// Until the connections load, show the team as saved rather than flash an empty one.
|
|
68
|
+
const shown = team && state ? effectiveTeam(team, connections, place) : team;
|
|
69
|
+
return (_jsxs(DropdownMenu, { onOpenChange: (open) => (open ? void refetch() : undefined), children: [_jsxs(DropdownMenuTrigger, { disabled: disabled, "aria-label": "Agent", className: "text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring/50 data-[state=open]:bg-accent data-[state=open]:text-foreground ease-snappy flex h-7 min-w-0 shrink items-center gap-1 rounded-md px-2 text-xs whitespace-nowrap transition-[background-color,color,transform] duration-150 outline-none focus-visible:ring-[3px] active:scale-[0.97] disabled:opacity-50", children: [_jsx("span", { className: "truncate", children: value === 'shuttle' ? teamLabel(shown) : label }), _jsx(ChevronDown, { className: "size-3 shrink-0 opacity-60" })] }), _jsxs(DropdownMenuContent
|
|
70
|
+
// The trigger sits at the right of a session composer and the left of a new-session form.
|
|
71
|
+
, {
|
|
72
|
+
// The trigger sits at the right of a session composer and the left of a new-session form.
|
|
73
|
+
align: side === 'top' ? 'end' : 'start', side: side, sideOffset: 8, className: "w-64", children: [_jsx(DropdownMenuLabel, { children: "Run the session on" }), _jsxs(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => {
|
|
74
|
+
const harness = HarnessId.safeParse(next);
|
|
75
|
+
if (harness.success) {
|
|
76
|
+
onChange(harness.data);
|
|
77
|
+
}
|
|
78
|
+
}, children: [_jsxs(DropdownMenuRadioItem, { value: "shuttle", children: [SHUTTLE_LABEL, _jsx("span", { className: "text-muted-foreground ml-auto text-[10px]", children: "OpenRouter" })] }), connections.map((connection) => {
|
|
79
|
+
const status = agentStatus(connection, place);
|
|
80
|
+
return (_jsxs(DropdownMenuRadioItem, { value: connection.harness, children: [connection.label, _jsx("span", { className: cn('ml-auto text-[10px]', status.warn ? 'text-amber-600 dark:text-amber-500' : 'text-muted-foreground'), children: status.text })] }, connection.harness));
|
|
81
|
+
})] }), value === 'shuttle' && shown && onTeamChange ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Shuttle's team" }), _jsxs(DropdownMenuCheckboxItem, { checked: shown.workers,
|
|
82
|
+
// Keep the menu open: a team is usually set with a few clicks.
|
|
83
|
+
onSelect: (event) => event.preventDefault(), onCheckedChange: (checked) => onTeamChange(withTeamChange(shown, { workers: checked })), children: ["Shuttle workers", _jsx("span", { className: "text-muted-foreground ml-auto text-[10px]", children: "OpenRouter" })] }), connections.map((connection) => {
|
|
84
|
+
const key = teamKey(connection.harness);
|
|
85
|
+
return (_jsxs(DropdownMenuCheckboxItem, { checked: shown[key],
|
|
86
|
+
// A team member has no message box of its own to sign in from.
|
|
87
|
+
disabled: !canRunAt(connection, place), onSelect: (event) => event.preventDefault(), onCheckedChange: (checked) => onTeamChange(withTeamChange(shown, { [key]: checked })), children: [connection.label, _jsx("span", { className: "text-muted-foreground ml-auto text-[10px]", children: canRunAt(connection, place)
|
|
88
|
+
? 'Your subscription'
|
|
89
|
+
: connection.connected
|
|
90
|
+
? `Sign in ${place === 'local' ? 'on this machine' : 'in the cloud'}`
|
|
91
|
+
: 'Not connected' })] }, connection.harness));
|
|
92
|
+
}), shown.codex && shown.claudeCode ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: "Roles" }), _jsx(DropdownMenuRadioGroup, { value: shown.preset, onValueChange: (next) => {
|
|
93
|
+
const preset = TeamPreset.safeParse(next);
|
|
94
|
+
if (preset.success) {
|
|
95
|
+
onTeamChange(withTeamChange(shown, { preset: preset.data }));
|
|
96
|
+
}
|
|
97
|
+
}, children: TEAM_PRESETS.map((preset) => (_jsx(DropdownMenuRadioItem, { value: preset, onSelect: (event) => event.preventDefault(), children: PRESET_LABELS[preset] }, preset))) })] })) : null] })) : null, _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { asChild: true, children: _jsx(Link, { to: { page: 'connections' }, children: "Manage connections" }) })] })] }));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The agent and team new sessions start with, for forms that create a session. `save` must
|
|
101
|
+
* finish before the session is launched: a session takes the defaults on its first turn.
|
|
102
|
+
*/
|
|
103
|
+
export function useDefaultHarness() {
|
|
104
|
+
const host = useShuttleHost();
|
|
105
|
+
const { data: state } = useQuery(connectionsQuery(host));
|
|
106
|
+
// What the person picked on this form. Until they pick, the form shows the saved defaults.
|
|
107
|
+
const [chosen, setChosen] = useState(null);
|
|
108
|
+
const { mutateAsync: saveDefaults } = useSetSessionDefaults();
|
|
109
|
+
const harness = chosen?.harness ?? state?.defaultHarness ?? 'shuttle';
|
|
110
|
+
const team = chosen?.team ?? (state ? effectiveTeam(state.defaultTeam, state.connections) : DEFAULT_TEAM);
|
|
111
|
+
return {
|
|
112
|
+
harness,
|
|
113
|
+
setHarness: (next) => setChosen({ harness: next, team }),
|
|
114
|
+
team,
|
|
115
|
+
setTeam: (next) => setChosen({ harness, team: next }),
|
|
116
|
+
save: () => (chosen ? saveDefaults(chosen) : Promise.resolve()),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InterjectionKind } from './session-feed.js';
|
|
2
|
+
/** Mirrors `isHardStop` in apps/worker/src/agents/intake.ts. */
|
|
3
|
+
export declare function isHardStop(text: string): boolean;
|
|
4
|
+
/** Mirrors apps/worker/src/agents/intake.ts for provisional UI routing. */
|
|
5
|
+
export declare function classifyHeuristic(text: string): InterjectionKind;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Mirrors `isHardStop` in apps/worker/src/agents/intake.ts. */
|
|
2
|
+
export function isHardStop(text) {
|
|
3
|
+
return /^(stop|cancel|abort|halt)(\s+(it|that|this|now|please|everything|all|the\s+workers?|workers?))*\s*[.!]*$/i.test(text.trim());
|
|
4
|
+
}
|
|
5
|
+
/** Mirrors apps/worker/src/agents/intake.ts for provisional UI routing. */
|
|
6
|
+
export function classifyHeuristic(text) {
|
|
7
|
+
const trimmed = text.trim();
|
|
8
|
+
if (isHardStop(trimmed)) {
|
|
9
|
+
return 'stop';
|
|
10
|
+
}
|
|
11
|
+
// "stop using tailwind" redirects the work rather than halting it.
|
|
12
|
+
if (/^(stop|cancel|abort|halt)\b/i.test(trimmed)) {
|
|
13
|
+
return 'correction';
|
|
14
|
+
}
|
|
15
|
+
if (trimmed.endsWith('?') ||
|
|
16
|
+
/^(what|why|how|where|who|which|is|are|can|could|did|does|do)\b/i.test(trimmed)) {
|
|
17
|
+
return 'question';
|
|
18
|
+
}
|
|
19
|
+
if (/^(actually|no[, ]|wrong|don't|do not|instead|fix:|correct)\b/i.test(trimmed) ||
|
|
20
|
+
/\b(not that|you should have)\b/i.test(trimmed)) {
|
|
21
|
+
return 'correction';
|
|
22
|
+
}
|
|
23
|
+
if (/^(also|btw|by the way|idea:|consider|prefer|please use|make sure|remember)\b/i.test(trimmed) ||
|
|
24
|
+
/\b(constraint|prefer|use zod|use typescript)\b/i.test(trimmed)) {
|
|
25
|
+
return /^(must|never|always|don't|do not)\b/i.test(trimmed) ? 'constraint' : 'idea';
|
|
26
|
+
}
|
|
27
|
+
return 'task';
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type LucideIcon } from 'lucide-react';
|
|
2
|
+
import type { InterjectionKind } from './session-feed.js';
|
|
3
|
+
export interface RouteStyle {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly icon: LucideIcon;
|
|
6
|
+
readonly tone: string;
|
|
7
|
+
readonly dot: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly example: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const routeStyles: Record<InterjectionKind, RouteStyle>;
|
|
12
|
+
/** Shown on RouteChip before `shuttle.routed` confirms intake. */
|
|
13
|
+
export declare function provisionalRouteSummary(kind: InterjectionKind): string;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CircleStop, HelpCircle, Lightbulb, ListChecks, ShieldAlert, Undo2, } from 'lucide-react';
|
|
2
|
+
export const routeStyles = {
|
|
3
|
+
question: {
|
|
4
|
+
label: 'Question',
|
|
5
|
+
icon: HelpCircle,
|
|
6
|
+
tone: 'text-route-question',
|
|
7
|
+
dot: 'bg-route-question',
|
|
8
|
+
description: 'A narrator answers; workers keep going',
|
|
9
|
+
example: 'What is the worker doing right now?',
|
|
10
|
+
},
|
|
11
|
+
idea: {
|
|
12
|
+
label: 'Idea',
|
|
13
|
+
icon: Lightbulb,
|
|
14
|
+
tone: 'text-route-idea',
|
|
15
|
+
dot: 'bg-route-idea',
|
|
16
|
+
description: 'Amends the brief and nudges agents',
|
|
17
|
+
example: 'Also export the schema so callers can reuse it.',
|
|
18
|
+
},
|
|
19
|
+
constraint: {
|
|
20
|
+
label: 'Constraint',
|
|
21
|
+
icon: ShieldAlert,
|
|
22
|
+
tone: 'text-route-constraint',
|
|
23
|
+
dot: 'bg-route-constraint',
|
|
24
|
+
description: 'Adds a hard rule to the brief',
|
|
25
|
+
example: "Don't add new dependencies besides zod.",
|
|
26
|
+
},
|
|
27
|
+
correction: {
|
|
28
|
+
label: 'Correction',
|
|
29
|
+
icon: Undo2,
|
|
30
|
+
tone: 'text-route-correction',
|
|
31
|
+
dot: 'bg-route-correction',
|
|
32
|
+
description: 'Interrupts the active worker mid-turn',
|
|
33
|
+
example: 'Use z.string().min(1) instead of a regex.',
|
|
34
|
+
},
|
|
35
|
+
task: {
|
|
36
|
+
label: 'Task',
|
|
37
|
+
icon: ListChecks,
|
|
38
|
+
tone: 'text-route-task',
|
|
39
|
+
dot: 'bg-route-task',
|
|
40
|
+
description: 'Hands new work to the conductor',
|
|
41
|
+
example: 'Then add a test for the empty-name case.',
|
|
42
|
+
},
|
|
43
|
+
stop: {
|
|
44
|
+
label: 'Stop',
|
|
45
|
+
icon: CircleStop,
|
|
46
|
+
tone: 'text-route-stop',
|
|
47
|
+
dot: 'bg-route-stop',
|
|
48
|
+
description: 'Stops the target agent',
|
|
49
|
+
example: 'Stop, that approach is wrong.',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/** Shown on RouteChip before `shuttle.routed` confirms intake. */
|
|
53
|
+
export function provisionalRouteSummary(kind) {
|
|
54
|
+
switch (kind) {
|
|
55
|
+
case 'question':
|
|
56
|
+
return 'answering without interrupting';
|
|
57
|
+
case 'idea':
|
|
58
|
+
return 'folding into the brief';
|
|
59
|
+
case 'constraint':
|
|
60
|
+
return 'adding to the brief';
|
|
61
|
+
case 'correction':
|
|
62
|
+
return 'interrupting the worker';
|
|
63
|
+
case 'task':
|
|
64
|
+
return 'steering the conductor';
|
|
65
|
+
case 'stop':
|
|
66
|
+
return 'stopping the agent';
|
|
67
|
+
default: {
|
|
68
|
+
const exhaustive = kind;
|
|
69
|
+
return exhaustive;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export type ModelTag = 'high' | 'medium' | 'fast';
|
|
2
|
+
export type ModelGroup = 'frontier' | 'fast';
|
|
3
|
+
export interface OpenRouterModel {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly group: ModelGroup;
|
|
7
|
+
readonly tags: readonly ModelTag[];
|
|
8
|
+
/** One-line pitch shown in the hover detail panel. */
|
|
9
|
+
readonly description: string;
|
|
10
|
+
/** Context window in tokens. */
|
|
11
|
+
readonly context: number;
|
|
12
|
+
/** Optional italic footnote (e.g. effort / version note). */
|
|
13
|
+
readonly note?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Curated OpenRouter chat models for the session switcher.
|
|
17
|
+
* Ordered frontier-first within each group; keep IDs in sync with openrouter.ai.
|
|
18
|
+
*/
|
|
19
|
+
export declare const OPENROUTER_MODELS: readonly [{
|
|
20
|
+
readonly id: 'anthropic/claude-fable-5.2';
|
|
21
|
+
readonly label: 'Claude Fable 5.2';
|
|
22
|
+
readonly group: 'frontier';
|
|
23
|
+
readonly tags: readonly ["high"];
|
|
24
|
+
readonly description: "Anthropic's most capable model for demanding technical and agentic work.";
|
|
25
|
+
readonly context: 1000000;
|
|
26
|
+
readonly note: 'Flagship';
|
|
27
|
+
}, {
|
|
28
|
+
readonly id: 'anthropic/claude-opus-5.5';
|
|
29
|
+
readonly label: 'Claude Opus 5.5';
|
|
30
|
+
readonly group: 'frontier';
|
|
31
|
+
readonly tags: readonly ["high"];
|
|
32
|
+
readonly description: "Anthropic's large model class, great for difficult agentic tasks.";
|
|
33
|
+
readonly context: 1000000;
|
|
34
|
+
readonly note: 'High effort';
|
|
35
|
+
}, {
|
|
36
|
+
readonly id: 'openai/gpt-6-astra';
|
|
37
|
+
readonly label: 'GPT-6 Astra';
|
|
38
|
+
readonly group: 'frontier';
|
|
39
|
+
readonly tags: readonly ["high"];
|
|
40
|
+
readonly description: "OpenAI's flagship for deep analysis, coding, and long-horizon work.";
|
|
41
|
+
readonly context: 1050000;
|
|
42
|
+
readonly note: 'Flagship';
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: 'google/gemini-4-argon';
|
|
45
|
+
readonly label: 'Gemini 4 Argon';
|
|
46
|
+
readonly group: 'frontier';
|
|
47
|
+
readonly tags: readonly ["high"];
|
|
48
|
+
readonly description: "Google's flagship reasoning model for complex engineering and agents.";
|
|
49
|
+
readonly context: 1048576;
|
|
50
|
+
readonly note: 'Flagship';
|
|
51
|
+
}, {
|
|
52
|
+
readonly id: 'x-ai/grok-4.7';
|
|
53
|
+
readonly label: 'Grok 4.7';
|
|
54
|
+
readonly group: 'frontier';
|
|
55
|
+
readonly tags: readonly ["high", "fast"];
|
|
56
|
+
readonly description: 'Strong at long-running software engineering and self-verification.';
|
|
57
|
+
readonly context: 500000;
|
|
58
|
+
}, {
|
|
59
|
+
readonly id: 'openai/gpt-5.6-sol';
|
|
60
|
+
readonly label: 'GPT-5.6 Sol';
|
|
61
|
+
readonly group: 'frontier';
|
|
62
|
+
readonly tags: readonly ["medium"];
|
|
63
|
+
readonly description: 'Balanced GPT-5.6 flagship for coding and multi-step agent workflows.';
|
|
64
|
+
readonly context: 1050000;
|
|
65
|
+
}, {
|
|
66
|
+
readonly id: 'meta/muse-wonder';
|
|
67
|
+
readonly label: 'Muse Wonder';
|
|
68
|
+
readonly group: 'frontier';
|
|
69
|
+
readonly tags: readonly ["high"];
|
|
70
|
+
readonly description: "Meta's frontier multimodal model for complex agentic tasks.";
|
|
71
|
+
readonly context: 1048576;
|
|
72
|
+
}, {
|
|
73
|
+
readonly id: 'anthropic/claude-sonnet-5.5';
|
|
74
|
+
readonly label: 'Claude Sonnet 5.5';
|
|
75
|
+
readonly group: 'frontier';
|
|
76
|
+
readonly tags: readonly ["high", "fast"];
|
|
77
|
+
readonly description: 'Balanced quality and speed, recommended for most session work.';
|
|
78
|
+
readonly context: 1000000;
|
|
79
|
+
readonly note: 'Recommended';
|
|
80
|
+
}, {
|
|
81
|
+
readonly id: 'google/gemini-3.8-flash';
|
|
82
|
+
readonly label: 'Gemini 3.8 Flash';
|
|
83
|
+
readonly group: 'fast';
|
|
84
|
+
readonly tags: readonly ["fast"];
|
|
85
|
+
readonly description: "Google's smartest Flash model — strong speed/quality tradeoff.";
|
|
86
|
+
readonly context: 1048576;
|
|
87
|
+
}, {
|
|
88
|
+
readonly id: 'openai/gpt-5.6-luna';
|
|
89
|
+
readonly label: 'GPT-5.6 Luna';
|
|
90
|
+
readonly group: 'fast';
|
|
91
|
+
readonly tags: readonly ["fast"];
|
|
92
|
+
readonly description: 'Fast, cost-efficient GPT for latency-sensitive agent turns.';
|
|
93
|
+
readonly context: 1050000;
|
|
94
|
+
}, {
|
|
95
|
+
readonly id: 'anthropic/claude-haiku-5.5';
|
|
96
|
+
readonly label: 'Claude Haiku 5.5';
|
|
97
|
+
readonly group: 'fast';
|
|
98
|
+
readonly tags: readonly ["fast"];
|
|
99
|
+
readonly description: 'Small and quick — good for high-volume or lightweight turns.';
|
|
100
|
+
readonly context: 1000000;
|
|
101
|
+
}, {
|
|
102
|
+
readonly id: 'deepseek/deepseek-v4.1-flash';
|
|
103
|
+
readonly label: 'DeepSeek V4.1 Flash';
|
|
104
|
+
readonly group: 'fast';
|
|
105
|
+
readonly tags: readonly ["fast"];
|
|
106
|
+
readonly description: 'Fast open MoE model with a large context window.';
|
|
107
|
+
readonly context: 1048576;
|
|
108
|
+
}, {
|
|
109
|
+
readonly id: 'x-ai/grok-4.6';
|
|
110
|
+
readonly label: 'Grok 4.6';
|
|
111
|
+
readonly group: 'fast';
|
|
112
|
+
readonly tags: readonly ["high", "fast"];
|
|
113
|
+
readonly description: 'Previous Grok flagship — still strong on coding and STEM.';
|
|
114
|
+
readonly context: 500000;
|
|
115
|
+
}];
|
|
116
|
+
export type OpenRouterModelId = (typeof OPENROUTER_MODELS)[number]['id'];
|
|
117
|
+
export declare const DEFAULT_OPENROUTER_MODEL: OpenRouterModelId;
|
|
118
|
+
export declare const MODEL_GROUP_LABELS: Record<ModelGroup, string>;
|
|
119
|
+
export declare const MODEL_TAG_LABELS: Record<ModelTag, string>;
|
|
120
|
+
/** Soft tint per tag — matches the app's status/route color language. */
|
|
121
|
+
export declare const MODEL_TAG_TONES: Record<ModelTag, string>;
|
|
122
|
+
export declare function isOpenRouterModelId(value: string): value is OpenRouterModelId;
|
|
123
|
+
export declare function getOpenRouterModel(modelId: string): OpenRouterModel | undefined;
|
|
124
|
+
export declare function readStoredLlmModel(): OpenRouterModelId;
|
|
125
|
+
export declare function writeStoredLlmModel(model: OpenRouterModelId): void;
|
|
126
|
+
export declare function modelLabel(modelId: string): string;
|
|
127
|
+
export declare function formatContextWindow(tokens: number): string;
|
|
128
|
+
export declare function modelsByGroup(group: ModelGroup): readonly OpenRouterModel[];
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
const STORAGE_KEY = 'shuttle.llm-model';
|
|
2
|
+
/**
|
|
3
|
+
* Curated OpenRouter chat models for the session switcher.
|
|
4
|
+
* Ordered frontier-first within each group; keep IDs in sync with openrouter.ai.
|
|
5
|
+
*/
|
|
6
|
+
export const OPENROUTER_MODELS = [
|
|
7
|
+
{
|
|
8
|
+
id: 'anthropic/claude-fable-5.2',
|
|
9
|
+
label: 'Claude Fable 5.2',
|
|
10
|
+
group: 'frontier',
|
|
11
|
+
tags: ['high'],
|
|
12
|
+
description: "Anthropic's most capable model for demanding technical and agentic work.",
|
|
13
|
+
context: 1_000_000,
|
|
14
|
+
note: 'Flagship',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'anthropic/claude-opus-5.5',
|
|
18
|
+
label: 'Claude Opus 5.5',
|
|
19
|
+
group: 'frontier',
|
|
20
|
+
tags: ['high'],
|
|
21
|
+
description: "Anthropic's large model class, great for difficult agentic tasks.",
|
|
22
|
+
context: 1_000_000,
|
|
23
|
+
note: 'High effort',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'openai/gpt-6-astra',
|
|
27
|
+
label: 'GPT-6 Astra',
|
|
28
|
+
group: 'frontier',
|
|
29
|
+
tags: ['high'],
|
|
30
|
+
description: "OpenAI's flagship for deep analysis, coding, and long-horizon work.",
|
|
31
|
+
context: 1_050_000,
|
|
32
|
+
note: 'Flagship',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: 'google/gemini-4-argon',
|
|
36
|
+
label: 'Gemini 4 Argon',
|
|
37
|
+
group: 'frontier',
|
|
38
|
+
tags: ['high'],
|
|
39
|
+
description: "Google's flagship reasoning model for complex engineering and agents.",
|
|
40
|
+
context: 1_048_576,
|
|
41
|
+
note: 'Flagship',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'x-ai/grok-4.7',
|
|
45
|
+
label: 'Grok 4.7',
|
|
46
|
+
group: 'frontier',
|
|
47
|
+
tags: ['high', 'fast'],
|
|
48
|
+
description: 'Strong at long-running software engineering and self-verification.',
|
|
49
|
+
context: 500_000,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'openai/gpt-5.6-sol',
|
|
53
|
+
label: 'GPT-5.6 Sol',
|
|
54
|
+
group: 'frontier',
|
|
55
|
+
tags: ['medium'],
|
|
56
|
+
description: 'Balanced GPT-5.6 flagship for coding and multi-step agent workflows.',
|
|
57
|
+
context: 1_050_000,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'meta/muse-wonder',
|
|
61
|
+
label: 'Muse Wonder',
|
|
62
|
+
group: 'frontier',
|
|
63
|
+
tags: ['high'],
|
|
64
|
+
description: "Meta's frontier multimodal model for complex agentic tasks.",
|
|
65
|
+
context: 1_048_576,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'anthropic/claude-sonnet-5.5',
|
|
69
|
+
label: 'Claude Sonnet 5.5',
|
|
70
|
+
group: 'frontier',
|
|
71
|
+
tags: ['high', 'fast'],
|
|
72
|
+
description: 'Balanced quality and speed, recommended for most session work.',
|
|
73
|
+
context: 1_000_000,
|
|
74
|
+
note: 'Recommended',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'google/gemini-3.8-flash',
|
|
78
|
+
label: 'Gemini 3.8 Flash',
|
|
79
|
+
group: 'fast',
|
|
80
|
+
tags: ['fast'],
|
|
81
|
+
description: "Google's smartest Flash model — strong speed/quality tradeoff.",
|
|
82
|
+
context: 1_048_576,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 'openai/gpt-5.6-luna',
|
|
86
|
+
label: 'GPT-5.6 Luna',
|
|
87
|
+
group: 'fast',
|
|
88
|
+
tags: ['fast'],
|
|
89
|
+
description: 'Fast, cost-efficient GPT for latency-sensitive agent turns.',
|
|
90
|
+
context: 1_050_000,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'anthropic/claude-haiku-5.5',
|
|
94
|
+
label: 'Claude Haiku 5.5',
|
|
95
|
+
group: 'fast',
|
|
96
|
+
tags: ['fast'],
|
|
97
|
+
description: 'Small and quick — good for high-volume or lightweight turns.',
|
|
98
|
+
context: 1_000_000,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'deepseek/deepseek-v4.1-flash',
|
|
102
|
+
label: 'DeepSeek V4.1 Flash',
|
|
103
|
+
group: 'fast',
|
|
104
|
+
tags: ['fast'],
|
|
105
|
+
description: 'Fast open MoE model with a large context window.',
|
|
106
|
+
context: 1_048_576,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'x-ai/grok-4.6',
|
|
110
|
+
label: 'Grok 4.6',
|
|
111
|
+
group: 'fast',
|
|
112
|
+
tags: ['high', 'fast'],
|
|
113
|
+
description: 'Previous Grok flagship — still strong on coding and STEM.',
|
|
114
|
+
context: 500_000,
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
export const DEFAULT_OPENROUTER_MODEL = 'anthropic/claude-sonnet-5.5';
|
|
118
|
+
export const MODEL_GROUP_LABELS = {
|
|
119
|
+
frontier: 'Frontier',
|
|
120
|
+
fast: 'Fast',
|
|
121
|
+
};
|
|
122
|
+
export const MODEL_TAG_LABELS = {
|
|
123
|
+
high: 'High',
|
|
124
|
+
medium: 'Medium',
|
|
125
|
+
fast: 'Fast',
|
|
126
|
+
};
|
|
127
|
+
/** Soft tint per tag — matches the app's status/route color language. */
|
|
128
|
+
export const MODEL_TAG_TONES = {
|
|
129
|
+
high: 'text-status-running bg-status-running/12',
|
|
130
|
+
medium: 'text-status-waiting bg-status-waiting/12',
|
|
131
|
+
fast: 'text-status-completed bg-status-completed/12',
|
|
132
|
+
};
|
|
133
|
+
export function isOpenRouterModelId(value) {
|
|
134
|
+
return OPENROUTER_MODELS.some((model) => model.id === value);
|
|
135
|
+
}
|
|
136
|
+
export function getOpenRouterModel(modelId) {
|
|
137
|
+
return OPENROUTER_MODELS.find((model) => model.id === modelId);
|
|
138
|
+
}
|
|
139
|
+
export function readStoredLlmModel() {
|
|
140
|
+
try {
|
|
141
|
+
const stored = localStorage.getItem(STORAGE_KEY)?.trim();
|
|
142
|
+
return stored && isOpenRouterModelId(stored) ? stored : DEFAULT_OPENROUTER_MODEL;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return DEFAULT_OPENROUTER_MODEL;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export function writeStoredLlmModel(model) {
|
|
149
|
+
try {
|
|
150
|
+
localStorage.setItem(STORAGE_KEY, model);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
// ignore quota / private mode
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export function modelLabel(modelId) {
|
|
157
|
+
return getOpenRouterModel(modelId)?.label ?? modelId;
|
|
158
|
+
}
|
|
159
|
+
export function formatContextWindow(tokens) {
|
|
160
|
+
if (tokens >= 1_000_000) {
|
|
161
|
+
const millions = tokens / 1_000_000;
|
|
162
|
+
const rounded = Number.isInteger(millions)
|
|
163
|
+
? String(millions)
|
|
164
|
+
: millions.toFixed(2).replace(/0+$/, '');
|
|
165
|
+
return `${rounded}M context`;
|
|
166
|
+
}
|
|
167
|
+
if (tokens >= 1_000) {
|
|
168
|
+
return `${Math.round(tokens / 1_000)}k context`;
|
|
169
|
+
}
|
|
170
|
+
return `${tokens} context`;
|
|
171
|
+
}
|
|
172
|
+
export function modelsByGroup(group) {
|
|
173
|
+
return OPENROUTER_MODELS.filter((model) => model.group === group);
|
|
174
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type MediaAsset } from './media.js';
|
|
2
|
+
/** A file as a row: its kind, name and size, opening or downloading it when pressed. */
|
|
3
|
+
export declare function FileChip({ runId, asset, className, }: {
|
|
4
|
+
runId: string;
|
|
5
|
+
asset: MediaAsset;
|
|
6
|
+
className?: string;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
/**
|
|
9
|
+
* One file, shown the way its kind allows: an image as a thumbnail that opens full size, video
|
|
10
|
+
* and audio as players, anything else as a row that opens or downloads it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function MediaTile({ runId, asset, size, className, }: {
|
|
13
|
+
runId: string;
|
|
14
|
+
asset: MediaAsset;
|
|
15
|
+
/** `md` suits a message; `fill` takes the width of its container, for a grid. */
|
|
16
|
+
size?: 'md' | 'fill';
|
|
17
|
+
className?: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** Files side by side, wrapping. Used under a message and for what an agent shared. */
|
|
20
|
+
export declare function MediaStrip({ runId, assets, align, className, }: {
|
|
21
|
+
runId: string;
|
|
22
|
+
assets: readonly MediaAsset[];
|
|
23
|
+
align?: 'start' | 'end';
|
|
24
|
+
className?: string;
|
|
25
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Download, FileAudio, FileText, FileVideo, Paperclip, X } from 'lucide-react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle, } from '../../components/ui/dialog.js';
|
|
5
|
+
import { cn } from '../../lib/cn.js';
|
|
6
|
+
import { useShuttleHost } from '../../shuttle/index.js';
|
|
7
|
+
import { formatBytes, mediaKind, mediaUrl } from './media.js';
|
|
8
|
+
const KIND_ICON = {
|
|
9
|
+
video: _jsx(FileVideo, {}),
|
|
10
|
+
audio: _jsx(FileAudio, {}),
|
|
11
|
+
pdf: _jsx(FileText, {}),
|
|
12
|
+
file: _jsx(Paperclip, {}),
|
|
13
|
+
};
|
|
14
|
+
/** A file as a row: its kind, name and size, opening or downloading it when pressed. */
|
|
15
|
+
export function FileChip({ runId, asset, className, }) {
|
|
16
|
+
const host = useShuttleHost();
|
|
17
|
+
const kind = mediaKind(asset.mediaType);
|
|
18
|
+
// A PDF opens in the browser's own viewer. Other files have nothing to show them, so they save.
|
|
19
|
+
const opens = kind === 'pdf';
|
|
20
|
+
return (_jsxs("a", { href: mediaUrl(host, runId, asset.id, !opens), ...(opens ? { target: '_blank', rel: 'noreferrer' } : { download: asset.name }), className: cn('bg-card hover:bg-accent/60 ease-snappy flex max-w-full min-w-0 items-center gap-2.5 rounded-lg border px-2.5 py-2 text-left transition-colors duration-150', className), children: [_jsx("span", { className: "text-muted-foreground bg-secondary flex size-8 shrink-0 items-center justify-center rounded-md [&_svg]:size-4", children: kind === 'image' ? _jsx(Paperclip, {}) : KIND_ICON[kind] }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-[12.5px] font-medium", dir: "auto", children: asset.name }), _jsx("span", { className: "text-muted-foreground block text-[11px] tabular-nums", children: formatBytes(asset.size) })] }), opens ? null : _jsx(Download, { className: "text-muted-foreground size-3.5 shrink-0" })] }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One file, shown the way its kind allows: an image as a thumbnail that opens full size, video
|
|
24
|
+
* and audio as players, anything else as a row that opens or downloads it.
|
|
25
|
+
*/
|
|
26
|
+
export function MediaTile({ runId, asset, size = 'md', className, }) {
|
|
27
|
+
const host = useShuttleHost();
|
|
28
|
+
const kind = mediaKind(asset.mediaType);
|
|
29
|
+
const [broken, setBroken] = useState(false);
|
|
30
|
+
const url = mediaUrl(host, runId, asset.id);
|
|
31
|
+
if (broken) {
|
|
32
|
+
return _jsx(FileChip, { runId: runId, asset: asset, className: className });
|
|
33
|
+
}
|
|
34
|
+
if (kind === 'image') {
|
|
35
|
+
return (_jsx(ImageLightbox, { runId: runId, asset: asset, children: _jsx("button", { type: "button", "aria-label": `Open ${asset.name}`, className: cn('bg-secondary/60 focus-visible:ring-ring/50 ease-snappy block overflow-hidden rounded-lg border transition-[filter,transform] duration-150 outline-none hover:brightness-110 focus-visible:ring-[3px] active:scale-[0.99]', size === 'fill' ? 'aspect-4/3 w-full' : 'max-w-full', className), children: _jsx("img", { src: url, alt: asset.name, loading: "lazy", decoding: "async", onError: () => setBroken(true), className: cn(size === 'fill' ? 'size-full object-cover' : 'max-h-64 max-w-full object-contain') }) }) }));
|
|
36
|
+
}
|
|
37
|
+
if (kind === 'video') {
|
|
38
|
+
return (_jsx("video", { src: url, controls: true, preload: "metadata", playsInline: true, "aria-label": asset.name, onError: () => setBroken(true), className: cn('rounded-lg border bg-black', size === 'fill' ? 'aspect-video w-full' : 'max-h-80 max-w-full', className) }));
|
|
39
|
+
}
|
|
40
|
+
if (kind === 'audio') {
|
|
41
|
+
return (_jsxs("div", { className: cn('bg-card flex min-w-0 flex-col gap-1.5 rounded-lg border p-2.5', size === 'fill' ? 'w-full' : 'w-80 max-w-full', className), children: [_jsx("span", { className: "truncate text-[12.5px] font-medium", dir: "auto", children: asset.name }), _jsx("audio", { src: url, controls: true, preload: "metadata", "aria-label": asset.name, onError: () => setBroken(true), className: "h-9 w-full" })] }));
|
|
42
|
+
}
|
|
43
|
+
return (_jsx(FileChip, { runId: runId, asset: asset, className: cn(size === 'fill' ? 'w-full' : 'w-72', className) }));
|
|
44
|
+
}
|
|
45
|
+
/** Files side by side, wrapping. Used under a message and for what an agent shared. */
|
|
46
|
+
export function MediaStrip({ runId, assets, align = 'start', className, }) {
|
|
47
|
+
if (assets.length === 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return (_jsx("div", { className: cn('flex max-w-full flex-wrap gap-2', align === 'end' ? 'justify-end' : 'justify-start', className), children: assets.map((asset) => (_jsx(MediaTile, { runId: runId, asset: asset }, asset.id))) }));
|
|
51
|
+
}
|
|
52
|
+
function ImageLightbox({ runId, asset, children, }) {
|
|
53
|
+
const host = useShuttleHost();
|
|
54
|
+
const [open, setOpen] = useState(false);
|
|
55
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { onClick: () => setOpen(true), className: "contents", children: children }), _jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "flex max-h-[calc(100dvh-2rem)] w-auto max-w-[calc(100vw-2rem)] flex-col gap-3 p-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2 pl-1", children: [_jsx(DialogTitle, { className: "min-w-0 flex-1 truncate text-[13px]", dir: "auto", children: asset.name }), _jsx(DialogDescription, { className: "shrink-0 tabular-nums", children: formatBytes(asset.size) }), _jsx("a", { href: mediaUrl(host, runId, asset.id, true), download: asset.name, "aria-label": `Download ${asset.name}`, className: "text-muted-foreground hover:bg-accent hover:text-foreground flex size-7 shrink-0 items-center justify-center rounded-md transition-colors duration-150", children: _jsx(Download, { className: "size-3.5" }) }), _jsx(DialogClose, { "aria-label": "Close", className: "text-muted-foreground hover:bg-accent hover:text-foreground flex size-7 shrink-0 items-center justify-center rounded-md transition-colors duration-150", children: _jsx(X, { className: "size-3.5" }) })] }), _jsx("img", { src: mediaUrl(host, runId, asset.id), alt: asset.name, className: "min-h-0 max-w-full flex-1 rounded-md object-contain" })] }) })] }));
|
|
56
|
+
}
|