send-to-paseo 2.2.0 → 2.4.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/README.md +26 -25
- package/assets/LICENSE.lucide +43 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +1 -0
- package/client/chat.tsx +157 -0
- package/client/display.tsx +10 -11
- package/client/overview.tsx +147 -0
- package/client/settings.tsx +91 -131
- package/client/sidebar.tsx +33 -0
- package/client/theme.ts +45 -0
- package/docs/media/send-to-paseo-card-dark.png +0 -0
- package/docs/media/send-to-paseo-card-light.png +0 -0
- package/docs/media/send-to-paseo-hero-dark.png +0 -0
- package/docs/media/send-to-paseo-mobile.png +0 -0
- package/docs/media/send-to-paseo-overview-dark.png +0 -0
- package/docs/media/send-to-paseo-overview-light.png +0 -0
- package/docs/media/send-to-paseo-setup-dark.png +0 -0
- package/index.client.tsx +17 -12
- package/index.server.ts +20 -0
- package/package.json +5 -3
- package/paseo-plugin.json +12 -0
- package/server/bridge.ts +1 -1
- package/server/daemon.ts +1 -1
- package/server/follow-up.ts +26 -0
- package/server/resolve.ts +9 -2
- package/server/send.ts +1 -0
- package/shared/chat.ts +159 -0
- package/shared/contracts.ts +81 -1
- package/shared/overview.ts +76 -0
- package/shared/route.ts +33 -0
- package/shared/summary.ts +14 -0
- package/client/navigation.tsx +0 -14
package/client/settings.tsx
CHANGED
|
@@ -6,9 +6,10 @@ import {
|
|
|
6
6
|
useRpc,
|
|
7
7
|
} from "@getpaseo/plugin/client";
|
|
8
8
|
import { copyText, useToast } from "@getpaseo/plugin/client/react-native";
|
|
9
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
9
10
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
10
11
|
import React, { useMemo, useState } from "react";
|
|
11
|
-
import { Pressable, ScrollView, Text, TextInput, View } from "react-native";
|
|
12
|
+
import { Platform, Pressable, ScrollView, Text, TextInput, View } from "react-native";
|
|
12
13
|
import {
|
|
13
14
|
addAdditionalMachine,
|
|
14
15
|
clearRecentSends,
|
|
@@ -29,8 +30,9 @@ import {
|
|
|
29
30
|
type DependencyReportPayload,
|
|
30
31
|
type ModeOption,
|
|
31
32
|
type ProviderOption,
|
|
32
|
-
type RecentSend,
|
|
33
33
|
} from "../shared/contracts";
|
|
34
|
+
import { Overview } from "./overview";
|
|
35
|
+
import { raised } from "./theme";
|
|
34
36
|
import { checkHostAccess, organizeDiscoveredHosts, type DiscoveredHostRow } from "./hosts";
|
|
35
37
|
|
|
36
38
|
/**
|
|
@@ -61,7 +63,7 @@ function stateLabel(status: BridgeStatus): string {
|
|
|
61
63
|
|
|
62
64
|
function stateTone(status: BridgeStatus, theme: PluginTheme): string {
|
|
63
65
|
if (status.state === "running") return theme.colors.statusSuccess;
|
|
64
|
-
if (status.state === "failed") return theme.colors.statusDanger;
|
|
66
|
+
if (status.state === "failed" || status.state === "stopped") return theme.colors.statusDanger;
|
|
65
67
|
return theme.colors.statusWarning;
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -105,14 +107,16 @@ function useStyles(theme: PluginTheme, compact: boolean) {
|
|
|
105
107
|
backgroundColor: theme.colors.surface0,
|
|
106
108
|
},
|
|
107
109
|
content: {
|
|
108
|
-
padding: compact ? 16 :
|
|
110
|
+
padding: compact ? 16 : 32,
|
|
109
111
|
gap: compact ? 16 : 20,
|
|
112
|
+
width: "100%" as const,
|
|
113
|
+
maxWidth: 820,
|
|
114
|
+
alignSelf: "center" as const,
|
|
110
115
|
},
|
|
111
116
|
card: {
|
|
112
117
|
backgroundColor: theme.colors.surface1,
|
|
113
|
-
borderColor: theme.colors.border,
|
|
114
|
-
borderWidth: 1,
|
|
115
118
|
borderRadius: 12,
|
|
119
|
+
...raised(theme.colors),
|
|
116
120
|
padding: compact ? 12 : 16,
|
|
117
121
|
gap: compact ? 8 : 10,
|
|
118
122
|
},
|
|
@@ -131,7 +135,7 @@ function useStyles(theme: PluginTheme, compact: boolean) {
|
|
|
131
135
|
mono: {
|
|
132
136
|
color: theme.colors.foreground,
|
|
133
137
|
fontSize: compact ? 12 : 13,
|
|
134
|
-
fontFamily: "Menlo",
|
|
138
|
+
fontFamily: Platform.OS === "ios" ? "Menlo" : Platform.OS === "android" ? "monospace" : "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
135
139
|
},
|
|
136
140
|
row: { flexDirection: "row" as const, gap: 8, alignItems: "center" as const },
|
|
137
141
|
wrapRow: { flexDirection: "row" as const, gap: 8, flexWrap: "wrap" as const },
|
|
@@ -178,6 +182,19 @@ function useStyles(theme: PluginTheme, compact: boolean) {
|
|
|
178
182
|
paddingVertical: 8,
|
|
179
183
|
gap: 2,
|
|
180
184
|
},
|
|
185
|
+
radio: {
|
|
186
|
+
width: 16,
|
|
187
|
+
height: 16,
|
|
188
|
+
borderRadius: 8,
|
|
189
|
+
borderWidth: 1.5,
|
|
190
|
+
borderColor: theme.colors.foregroundMuted,
|
|
191
|
+
alignItems: "center" as const,
|
|
192
|
+
justifyContent: "center" as const,
|
|
193
|
+
marginTop: compact ? 1 : 2,
|
|
194
|
+
},
|
|
195
|
+
radioOn: { borderColor: theme.colors.foreground },
|
|
196
|
+
radioDot: { width: 8, height: 8, borderRadius: 4, backgroundColor: theme.colors.foreground },
|
|
197
|
+
choiceRow: { borderRadius: 8, paddingHorizontal: 8 },
|
|
181
198
|
selectedRow: {
|
|
182
199
|
backgroundColor: theme.colors.surface2,
|
|
183
200
|
borderRadius: 8,
|
|
@@ -209,13 +226,25 @@ function Button({
|
|
|
209
226
|
accessibilityLabel={label}
|
|
210
227
|
onPress={onPress}
|
|
211
228
|
disabled={disabled}
|
|
212
|
-
style={[primary ? styles.primary : styles.button, disabled ? { opacity: 0.5 } : null]}
|
|
229
|
+
style={({ pressed }) => [primary ? styles.primary : styles.button, disabled ? { opacity: 0.5 } : null, { transform: [{ scale: pressed && !disabled ? 0.97 : 1 }] }]}
|
|
213
230
|
>
|
|
214
231
|
<Text style={primary ? styles.primaryText : styles.buttonText}>{label}</Text>
|
|
215
232
|
</Pressable>
|
|
216
233
|
);
|
|
217
234
|
}
|
|
218
235
|
|
|
236
|
+
/** A radio row: neutral ring and dot, so the accent stays on primary buttons. */
|
|
237
|
+
function Choice({ on, styles, children }: { on: boolean; styles: Styles; children: React.ReactNode }) {
|
|
238
|
+
return (
|
|
239
|
+
<View style={{ flexDirection: "row", gap: 10, paddingVertical: 6 }}>
|
|
240
|
+
<View style={[styles.radio, on ? styles.radioOn : null]}>
|
|
241
|
+
{on ? <View style={styles.radioDot} /> : null}
|
|
242
|
+
</View>
|
|
243
|
+
<View style={{ flex: 1, gap: 2 }}>{children}</View>
|
|
244
|
+
</View>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
219
248
|
function ProviderPicker({
|
|
220
249
|
providers,
|
|
221
250
|
selected,
|
|
@@ -262,15 +291,15 @@ function ProviderPicker({
|
|
|
262
291
|
accessibilityRole="button"
|
|
263
292
|
accessibilityLabel={`Use ${provider.label} by default`}
|
|
264
293
|
onPress={() => onSelect(provider.id)}
|
|
265
|
-
style={isSelected ? styles.selectedRow :
|
|
294
|
+
style={isSelected ? styles.selectedRow : styles.choiceRow}
|
|
266
295
|
>
|
|
267
|
-
<
|
|
296
|
+
<Choice on={isSelected} styles={styles}>
|
|
268
297
|
<Text style={styles.body}>
|
|
269
|
-
|
|
298
|
+
|
|
270
299
|
{provider.label}
|
|
271
300
|
</Text>
|
|
272
301
|
<Text style={styles.muted}>{provider.id}</Text>
|
|
273
|
-
</
|
|
302
|
+
</Choice>
|
|
274
303
|
</Pressable>
|
|
275
304
|
);
|
|
276
305
|
})}
|
|
@@ -311,12 +340,12 @@ function ProfilePicker({
|
|
|
311
340
|
accessibilityRole="button"
|
|
312
341
|
accessibilityLabel="Do not follow a profile"
|
|
313
342
|
onPress={() => onSelect(null)}
|
|
314
|
-
style={selected === null ? styles.selectedRow :
|
|
343
|
+
style={selected === null ? styles.selectedRow : styles.choiceRow}
|
|
315
344
|
>
|
|
316
|
-
<
|
|
317
|
-
<Text style={styles.body}>
|
|
345
|
+
<Choice on={selected === null} styles={styles}>
|
|
346
|
+
<Text style={styles.body}>No profile</Text>
|
|
318
347
|
<Text style={styles.muted}>Use the model and mode chosen below instead.</Text>
|
|
319
|
-
</
|
|
348
|
+
</Choice>
|
|
320
349
|
</Pressable>
|
|
321
350
|
{profiles.map((profile) => {
|
|
322
351
|
const isSelected = profile.id === selected;
|
|
@@ -333,15 +362,15 @@ function ProfilePicker({
|
|
|
333
362
|
accessibilityRole="button"
|
|
334
363
|
accessibilityLabel={`Follow the ${profile.name} profile`}
|
|
335
364
|
onPress={() => onSelect(profile.id)}
|
|
336
|
-
style={isSelected ? styles.selectedRow :
|
|
365
|
+
style={isSelected ? styles.selectedRow : styles.choiceRow}
|
|
337
366
|
>
|
|
338
|
-
<
|
|
367
|
+
<Choice on={isSelected} styles={styles}>
|
|
339
368
|
<Text style={styles.body}>
|
|
340
|
-
|
|
369
|
+
|
|
341
370
|
{profile.name}
|
|
342
371
|
</Text>
|
|
343
372
|
<Text style={styles.muted}>{detail}</Text>
|
|
344
|
-
</
|
|
373
|
+
</Choice>
|
|
345
374
|
</Pressable>
|
|
346
375
|
);
|
|
347
376
|
})}
|
|
@@ -391,12 +420,12 @@ function ModePicker({
|
|
|
391
420
|
accessibilityRole="button"
|
|
392
421
|
accessibilityLabel="Follow Paseo's own default mode"
|
|
393
422
|
onPress={() => onSelect(null)}
|
|
394
|
-
style={selected === null ? styles.selectedRow :
|
|
423
|
+
style={selected === null ? styles.selectedRow : styles.choiceRow}
|
|
395
424
|
>
|
|
396
|
-
<
|
|
397
|
-
<Text style={styles.body}>
|
|
425
|
+
<Choice on={selected === null} styles={styles}>
|
|
426
|
+
<Text style={styles.body}>Follow Paseo</Text>
|
|
398
427
|
<Text style={styles.muted}>Each provider's own default mode.</Text>
|
|
399
|
-
</
|
|
428
|
+
</Choice>
|
|
400
429
|
</Pressable>
|
|
401
430
|
{providers.map(([provider, providerModes]) => (
|
|
402
431
|
<View key={provider} style={{ gap: 2 }}>
|
|
@@ -410,11 +439,11 @@ function ModePicker({
|
|
|
410
439
|
accessibilityRole="button"
|
|
411
440
|
accessibilityLabel={`Default to ${mode.label} for ${provider}`}
|
|
412
441
|
onPress={() => onSelect(mode.id)}
|
|
413
|
-
style={isSelected ? styles.selectedRow :
|
|
442
|
+
style={isSelected ? styles.selectedRow : styles.choiceRow}
|
|
414
443
|
>
|
|
415
|
-
<
|
|
444
|
+
<Choice on={isSelected} styles={styles}>
|
|
416
445
|
<Text style={styles.body}>
|
|
417
|
-
|
|
446
|
+
|
|
418
447
|
{mode.label}
|
|
419
448
|
{unattended ? (
|
|
420
449
|
<Text style={{ color: theme.colors.statusWarning }}> — unattended</Text>
|
|
@@ -422,7 +451,7 @@ function ModePicker({
|
|
|
422
451
|
{mode.isDefault ? <Text style={styles.muted}> (provider default)</Text> : null}
|
|
423
452
|
</Text>
|
|
424
453
|
<Text style={styles.muted}>{mode.id}</Text>
|
|
425
|
-
</
|
|
454
|
+
</Choice>
|
|
426
455
|
</Pressable>
|
|
427
456
|
);
|
|
428
457
|
})}
|
|
@@ -463,10 +492,12 @@ function DependencyRow({
|
|
|
463
492
|
|
|
464
493
|
return (
|
|
465
494
|
<View style={{ gap: 2 }}>
|
|
466
|
-
<
|
|
467
|
-
<
|
|
495
|
+
<View style={styles.row}>
|
|
496
|
+
<Icon name={dependency.state === "ok" ? "CircleCheck" : "TriangleAlert"} size={14} color={tone} />
|
|
497
|
+
<Text style={styles.body}>
|
|
468
498
|
{dependency.name} — {summary}
|
|
469
499
|
</Text>
|
|
500
|
+
</View>
|
|
470
501
|
{dependency.path === null ? null : <Text style={styles.muted}>{dependency.path}</Text>}
|
|
471
502
|
{dependency.detail === "" ? null : (
|
|
472
503
|
<Text style={styles.muted}>{dependency.detail}</Text>
|
|
@@ -476,49 +507,6 @@ function DependencyRow({
|
|
|
476
507
|
);
|
|
477
508
|
}
|
|
478
509
|
|
|
479
|
-
function RecentSendRow({
|
|
480
|
-
send,
|
|
481
|
-
styles,
|
|
482
|
-
onOpen,
|
|
483
|
-
}: {
|
|
484
|
-
send: RecentSend;
|
|
485
|
-
styles: Styles;
|
|
486
|
-
onOpen: ((agentId: string) => void) | null;
|
|
487
|
-
}) {
|
|
488
|
-
const meta = [
|
|
489
|
-
send.workspaceLabel,
|
|
490
|
-
send.branch ?? "no branch",
|
|
491
|
-
send.workspaceCreated ? "new worktree" : null,
|
|
492
|
-
send.dryRun ? "dry run" : null,
|
|
493
|
-
formatWhen(send.at),
|
|
494
|
-
]
|
|
495
|
-
.filter((part): part is string => part !== null && part !== "")
|
|
496
|
-
.join(" · ");
|
|
497
|
-
|
|
498
|
-
const body = (
|
|
499
|
-
<View style={styles.listRow}>
|
|
500
|
-
<Text style={styles.body}>
|
|
501
|
-
{send.outcome === "ok" ? "" : "Failed — "}
|
|
502
|
-
{send.prLabel} · {send.title}
|
|
503
|
-
</Text>
|
|
504
|
-
<Text style={styles.muted}>{meta}</Text>
|
|
505
|
-
{send.error === null ? null : <Text style={styles.danger}>{send.error}</Text>}
|
|
506
|
-
</View>
|
|
507
|
-
);
|
|
508
|
-
|
|
509
|
-
if (send.agentId === null || onOpen === null) return body;
|
|
510
|
-
const agentId = send.agentId;
|
|
511
|
-
return (
|
|
512
|
-
<Pressable
|
|
513
|
-
accessibilityRole="button"
|
|
514
|
-
accessibilityLabel={`Open the agent for ${send.prLabel}`}
|
|
515
|
-
onPress={() => onOpen(agentId)}
|
|
516
|
-
>
|
|
517
|
-
{body}
|
|
518
|
-
</Pressable>
|
|
519
|
-
);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
510
|
export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginSurfaceProps) {
|
|
523
511
|
const styles = useStyles(theme, layout.compact);
|
|
524
512
|
const toast = useToast();
|
|
@@ -542,7 +530,8 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
542
530
|
const [externalUrlDraft, setExternalUrlDraft] = useState<string | null>(null);
|
|
543
531
|
const [connectionCodeDraft, setConnectionCodeDraft] = useState("");
|
|
544
532
|
const [sharedCode, setSharedCode] = useState<string | null>(null);
|
|
545
|
-
|
|
533
|
+
// Null until the person chooses; a bridge that is down opens the details on its own.
|
|
534
|
+
const [detailsChoice, setShowConnectionDetails] = useState<boolean | null>(null);
|
|
546
535
|
const [showAgentDefaults, setShowAgentDefaults] = useState(false);
|
|
547
536
|
const [showAdvancedAccess, setShowAdvancedAccess] = useState(false);
|
|
548
537
|
const [machineTests, setMachineTests] = useState<Record<string, string>>({});
|
|
@@ -664,6 +653,7 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
664
653
|
});
|
|
665
654
|
|
|
666
655
|
const status = query.data?.status ?? null;
|
|
656
|
+
const showConnectionDetails = detailsChoice ?? (status?.state === "failed" || status?.state === "stopped");
|
|
667
657
|
const providers = query.data?.providers ?? [];
|
|
668
658
|
const providersError = query.data?.providersError ?? null;
|
|
669
659
|
const modes = query.data?.modes ?? [];
|
|
@@ -761,33 +751,33 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
761
751
|
|
|
762
752
|
return (
|
|
763
753
|
<ScrollView style={styles.screen} contentContainerStyle={styles.content}>
|
|
764
|
-
|
|
765
|
-
<Text style={styles.
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
754
|
+
{status === null ? (
|
|
755
|
+
<Text style={styles.muted}>{query.isError ? "Status unavailable. Check that the plugin is running." : "Loading…"}</Text>
|
|
756
|
+
) : (
|
|
757
|
+
<Overview
|
|
758
|
+
status={status}
|
|
759
|
+
sends={recent}
|
|
760
|
+
colors={theme.colors}
|
|
761
|
+
compact={layout.compact}
|
|
762
|
+
onCopyToken={() => void onCopy()}
|
|
763
|
+
detailsOpen={showConnectionDetails}
|
|
764
|
+
onToggleDetails={() => setShowConnectionDetails(!showConnectionDetails)}
|
|
765
|
+
onOpenAgent={navigation === undefined ? null : (agentId) => navigation.openAgent({ agentId, serverId: host.id })}
|
|
766
|
+
onClear={() => void clearRecent({ serverId: host.id }).then(invalidate)}
|
|
767
|
+
/>
|
|
768
|
+
)}
|
|
770
769
|
|
|
770
|
+
{status !== null && showConnectionDetails ? (
|
|
771
771
|
<View style={styles.card}>
|
|
772
772
|
<Text style={styles.heading}>Connection</Text>
|
|
773
|
-
{status === null ? (
|
|
774
|
-
<Text style={styles.muted}>{query.isError ? "Status unavailable." : "Loading…"}</Text>
|
|
775
|
-
) : (
|
|
776
773
|
<>
|
|
777
774
|
<Text style={{ ...styles.body, color: stateTone(status, theme) }}>
|
|
778
775
|
{stateLabel(status)}
|
|
779
776
|
</Text>
|
|
780
|
-
{status.error === null ? null : <Text style={styles.danger}>{status.error}</Text>}
|
|
781
777
|
<Text style={styles.muted}>
|
|
782
778
|
{hostDiscovery.hosts.length} Paseo machine
|
|
783
779
|
{hostDiscovery.hosts.length === 1 ? "" : "s"} discovered automatically.
|
|
784
780
|
</Text>
|
|
785
|
-
<Button
|
|
786
|
-
label={showConnectionDetails ? "Hide connection details" : "Advanced connection details"}
|
|
787
|
-
styles={styles}
|
|
788
|
-
onPress={() => setShowConnectionDetails(!showConnectionDetails)}
|
|
789
|
-
/>
|
|
790
|
-
{showConnectionDetails ? (
|
|
791
781
|
<View style={{ gap: 8 }}>
|
|
792
782
|
<Text style={styles.muted}>
|
|
793
783
|
{status.paired ? "Paired" : "Not yet paired"} · {status.requestCount} request
|
|
@@ -825,10 +815,9 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
825
815
|
/>
|
|
826
816
|
</View>
|
|
827
817
|
</View>
|
|
828
|
-
) : null}
|
|
829
818
|
</>
|
|
830
|
-
)}
|
|
831
819
|
</View>
|
|
820
|
+
) : null}
|
|
832
821
|
|
|
833
822
|
{showConnectionDetails ? (
|
|
834
823
|
<>
|
|
@@ -887,7 +876,6 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
887
876
|
<Button
|
|
888
877
|
label={connectMachine.isPending ? "Connecting…" : "Connect additional machine"}
|
|
889
878
|
styles={styles}
|
|
890
|
-
primary
|
|
891
879
|
disabled={connectionCodeDraft.trim() === "" || connectMachine.isPending}
|
|
892
880
|
onPress={() => connectMachine.mutate(connectionCodeDraft)}
|
|
893
881
|
/>
|
|
@@ -1052,6 +1040,7 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
1052
1040
|
</View>
|
|
1053
1041
|
) : null}
|
|
1054
1042
|
|
|
1043
|
+
{status?.paired === false && status.state === "running" ? null : (
|
|
1055
1044
|
<View style={styles.card}>
|
|
1056
1045
|
<Text style={styles.heading}>Pairing token</Text>
|
|
1057
1046
|
<Text style={styles.muted}>
|
|
@@ -1078,6 +1067,7 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
1078
1067
|
/>
|
|
1079
1068
|
</View>
|
|
1080
1069
|
</View>
|
|
1070
|
+
)}
|
|
1081
1071
|
|
|
1082
1072
|
<View style={styles.card}>
|
|
1083
1073
|
<Text style={styles.heading}>Default agent destination</Text>
|
|
@@ -1088,30 +1078,30 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
1088
1078
|
accessibilityRole="button"
|
|
1089
1079
|
accessibilityLabel="Default each send to a new agent"
|
|
1090
1080
|
onPress={() => saveDispatch.mutate("new")}
|
|
1091
|
-
style={(status?.agentDispatch ?? "new") === "new" ? styles.selectedRow :
|
|
1081
|
+
style={(status?.agentDispatch ?? "new") === "new" ? styles.selectedRow : styles.choiceRow}
|
|
1092
1082
|
>
|
|
1093
|
-
<
|
|
1083
|
+
<Choice on={(status?.agentDispatch ?? "new") === "new"} styles={styles}>
|
|
1094
1084
|
<Text style={styles.body}>
|
|
1095
|
-
|
|
1085
|
+
New agent
|
|
1096
1086
|
</Text>
|
|
1097
1087
|
<Text style={styles.muted}>Start a separate agent for every send.</Text>
|
|
1098
|
-
</
|
|
1088
|
+
</Choice>
|
|
1099
1089
|
</Pressable>
|
|
1100
1090
|
<Pressable
|
|
1101
1091
|
accessibilityRole="button"
|
|
1102
1092
|
accessibilityLabel="Default each send to the main agent in the target workspace"
|
|
1103
1093
|
onPress={() => saveDispatch.mutate("main")}
|
|
1104
|
-
style={status?.agentDispatch === "main" ? styles.selectedRow :
|
|
1094
|
+
style={status?.agentDispatch === "main" ? styles.selectedRow : styles.choiceRow}
|
|
1105
1095
|
>
|
|
1106
|
-
<
|
|
1096
|
+
<Choice on={status?.agentDispatch === "main"} styles={styles}>
|
|
1107
1097
|
<Text style={styles.body}>
|
|
1108
|
-
|
|
1098
|
+
Main workspace agent
|
|
1109
1099
|
</Text>
|
|
1110
1100
|
<Text style={styles.muted}>
|
|
1111
1101
|
Reuse the best root agent in that workspace. Prefers one named Main, then an open,
|
|
1112
1102
|
active, or recently used agent; subagents are ignored. Starts fresh if none exists.
|
|
1113
1103
|
</Text>
|
|
1114
|
-
</
|
|
1104
|
+
</Choice>
|
|
1115
1105
|
</Pressable>
|
|
1116
1106
|
{status?.agentDispatch === "main" ? (
|
|
1117
1107
|
<View style={{ gap: 6 }}>
|
|
@@ -1196,36 +1186,6 @@ export function SendToPaseoSettings({ theme, host, layout, navigation }: PluginS
|
|
|
1196
1186
|
</>
|
|
1197
1187
|
) : null}
|
|
1198
1188
|
|
|
1199
|
-
<View style={styles.card}>
|
|
1200
|
-
<View style={{ ...styles.row, justifyContent: "space-between" }}>
|
|
1201
|
-
<Text style={styles.heading}>Recent sends</Text>
|
|
1202
|
-
{recent.length === 0 ? null : (
|
|
1203
|
-
<Button
|
|
1204
|
-
label="Clear"
|
|
1205
|
-
styles={styles}
|
|
1206
|
-
onPress={() => {
|
|
1207
|
-
void clearRecent({ serverId: host.id }).then(invalidate);
|
|
1208
|
-
}}
|
|
1209
|
-
/>
|
|
1210
|
-
)}
|
|
1211
|
-
</View>
|
|
1212
|
-
{recent.length === 0 ? (
|
|
1213
|
-
<Text style={styles.muted}>Nothing sent yet.</Text>
|
|
1214
|
-
) : (
|
|
1215
|
-
recent.map((send) => (
|
|
1216
|
-
<RecentSendRow
|
|
1217
|
-
key={send.id}
|
|
1218
|
-
send={send}
|
|
1219
|
-
styles={styles}
|
|
1220
|
-
onOpen={
|
|
1221
|
-
navigation === undefined
|
|
1222
|
-
? null
|
|
1223
|
-
: (agentId) => navigation.openAgent({ agentId, serverId: host.id })
|
|
1224
|
-
}
|
|
1225
|
-
/>
|
|
1226
|
-
))
|
|
1227
|
-
)}
|
|
1228
|
-
</View>
|
|
1229
1189
|
</ScrollView>
|
|
1230
1190
|
);
|
|
1231
1191
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import type { PluginClientContext, PluginSidebarItemProps } from "@getpaseo/plugin/client";
|
|
4
|
+
import { SidebarRow } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
|
|
6
|
+
import { getSummary } from "../shared/contracts";
|
|
7
|
+
import { summaryAttention, type Summary } from "../shared/summary";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The sidebar row: quiet while everything works, a dot when the bridge needs the
|
|
11
|
+
* person (amber: not paired yet; red: the bridge is down or the last send failed).
|
|
12
|
+
*/
|
|
13
|
+
export function sidebarRow(client: PluginClientContext, title: string) {
|
|
14
|
+
return function SendToPaseoRow({ host, theme, currentScreen, openScreen }: PluginSidebarItemProps) {
|
|
15
|
+
const [summary, setSummary] = useState<Summary | null>(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
let live = true;
|
|
18
|
+
const read = () => void client.rpc(getSummary, { serverId: host.id }).then((value) => { if (live) setSummary(value); }, () => undefined);
|
|
19
|
+
read();
|
|
20
|
+
const timer = setInterval(read, 15_000);
|
|
21
|
+
return () => { live = false; clearInterval(timer); };
|
|
22
|
+
}, [host.id]);
|
|
23
|
+
const attention = summary === null ? null : summaryAttention(summary);
|
|
24
|
+
const color = attention === null ? null : attention.tone === "danger" ? theme.colors.statusDanger : theme.colors.statusWarning;
|
|
25
|
+
return <SidebarRow
|
|
26
|
+
icon="Send"
|
|
27
|
+
label={title}
|
|
28
|
+
active={currentScreen?.screenId === "settings"}
|
|
29
|
+
onPress={() => openScreen({ screenId: "settings" })}
|
|
30
|
+
trailing={color === null ? undefined : <View accessibilityLabel={attention!.label} style={{ width: 7, height: 7, borderRadius: 4, backgroundColor: color, marginRight: 6 }} />}
|
|
31
|
+
/>;
|
|
32
|
+
};
|
|
33
|
+
}
|
package/client/theme.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PluginHostProps } from "@getpaseo/plugin/client";
|
|
2
|
+
import type { ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Theme-aware depth and tint, shared with the rest of the plugin family
|
|
6
|
+
* (Follow-up's client/theme.ts). Only host tokens are used: the helpers derive
|
|
7
|
+
* alphas from them rather than introducing colours of their own.
|
|
8
|
+
*/
|
|
9
|
+
export type Theme = PluginHostProps["theme"];
|
|
10
|
+
export type Colors = Theme["colors"];
|
|
11
|
+
|
|
12
|
+
function channels(color: string | undefined): number[] | null {
|
|
13
|
+
if (typeof color !== "string") return null;
|
|
14
|
+
const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());
|
|
15
|
+
if (hex) return (hex[1]!.length === 3 ? [...hex[1]!].map((d) => d + d) : hex[1]!.match(/../g)!).map((d) => parseInt(d, 16));
|
|
16
|
+
const fn = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(color);
|
|
17
|
+
return fn ? fn.slice(1, 4).map(Number) : null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Light when the page ground is bright; unknown colours count as dark, Paseo's default. */
|
|
21
|
+
export function isLight(colors: Colors): boolean {
|
|
22
|
+
const rgb = channels(colors.surface0);
|
|
23
|
+
if (!rgb) return false;
|
|
24
|
+
const [r, g, b] = rgb.map((v) => { const c = v / 255; return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4; }) as [number, number, number];
|
|
25
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.4;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function withAlpha(color: string, alpha: number): string {
|
|
29
|
+
const rgb = channels(color);
|
|
30
|
+
return rgb ? `rgba(${rgb.join(", ")}, ${alpha})` : color;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A tag fill in the same hue as its text: 12% on light grounds, 16% on dark ones. */
|
|
34
|
+
export function tint(color: string, colors: Colors): string {
|
|
35
|
+
return withAlpha(color, isLight(colors) ? 0.12 : 0.16);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Card depth: a hairline ring plus a soft lift in light themes, a single faint ring in dark ones. */
|
|
39
|
+
export function raised(colors: Colors): ViewStyle {
|
|
40
|
+
return isLight(colors)
|
|
41
|
+
? ({ boxShadow: "0px 0px 0px 1px rgba(0, 0, 0, 0.07), 0px 1px 2px -1px rgba(0, 0, 0, 0.06), 0px 2px 6px 0px rgba(0, 0, 0, 0.04)" } as ViewStyle)
|
|
42
|
+
: ({ boxShadow: "0px 0px 0px 1px rgba(255, 255, 255, 0.08)" } as ViewStyle);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const tabular = { fontVariant: ["tabular-nums" as const] };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.client.tsx
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { contributeDisplay } from "./client/display";
|
|
2
|
-
import { withNavigation } from "./client/navigation";
|
|
3
2
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
3
|
+
import { contributeChat } from "./client/chat";
|
|
4
4
|
import { SendToPaseoSettings } from "./client/settings";
|
|
5
|
+
import { sidebarRow } from "./client/sidebar";
|
|
6
|
+
|
|
7
|
+
const TITLE = "Send to Paseo";
|
|
5
8
|
|
|
6
9
|
export default function contribute(client: PluginClientContext) {
|
|
7
|
-
|
|
10
|
+
// `settings` is the id the screen had as a surface, so existing links and the
|
|
11
|
+
// sidebar route keep resolving.
|
|
12
|
+
const removeScreen = client.addScreen({ id: "settings", title: TITLE, Component: SendToPaseoSettings });
|
|
13
|
+
const Row = sidebarRow(client, TITLE);
|
|
8
14
|
const removeDisplay = contributeDisplay(client, {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
icon: "Send",
|
|
12
|
-
surface: "settings",
|
|
15
|
+
title: TITLE,
|
|
16
|
+
register: () => client.addSidebarHeaderItem({ id: "send-to-paseo", title: TITLE, Component: Row }),
|
|
13
17
|
});
|
|
14
|
-
client
|
|
18
|
+
const removeChat = contributeChat(client);
|
|
19
|
+
const removeCommand = client.addCommandCenterItem({
|
|
15
20
|
id: "send-to-paseo-settings",
|
|
16
|
-
title: "Send to Paseo:
|
|
21
|
+
title: "Send to Paseo: pairing and recent sends",
|
|
17
22
|
icon: "Send",
|
|
18
|
-
keywords: ["graphite", "bridge", "token", "pull request", "extension"],
|
|
23
|
+
keywords: ["graphite", "github", "bridge", "token", "pair", "pull request", "extension", "chrome"],
|
|
19
24
|
context: "global",
|
|
20
|
-
onSelect({
|
|
21
|
-
|
|
25
|
+
onSelect({ openScreen }) {
|
|
26
|
+
openScreen({ screenId: "settings" });
|
|
22
27
|
},
|
|
23
28
|
});
|
|
24
|
-
return () => { removeDisplay(); };
|
|
29
|
+
return () => { removeScreen(); removeDisplay(); removeChat(); removeCommand(); };
|
|
25
30
|
}
|
package/index.server.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { PluginServerContext } from "@getpaseo/plugin/server";
|
|
|
4
4
|
import {
|
|
5
5
|
addAdditionalMachine,
|
|
6
6
|
clearRecentSends,
|
|
7
|
+
dispatchesForAgent,
|
|
8
|
+
getSummary,
|
|
7
9
|
enablePrivateAccess,
|
|
8
10
|
getConnectionCode,
|
|
9
11
|
getStatus,
|
|
@@ -61,6 +63,24 @@ export default function contribute(server: PluginServerContext) {
|
|
|
61
63
|
};
|
|
62
64
|
});
|
|
63
65
|
|
|
66
|
+
server.handle(getSummary, async ({ serverId }) => {
|
|
67
|
+
await requireServerTarget(serverId);
|
|
68
|
+
const [status, current] = await Promise.all([getBridgeStatus(), settings.read()]);
|
|
69
|
+
const last = current.recentSends[0];
|
|
70
|
+
return {
|
|
71
|
+
state: status.state,
|
|
72
|
+
paired: status.paired,
|
|
73
|
+
lastSendAt: last?.at ?? null,
|
|
74
|
+
lastSendFailed: last?.outcome === "failed",
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
server.handle(dispatchesForAgent, async ({ serverId, agentId }) => {
|
|
79
|
+
await requireServerTarget(serverId);
|
|
80
|
+
const current = await settings.read();
|
|
81
|
+
return { sends: current.recentSends.filter((send) => send.agentId === agentId) };
|
|
82
|
+
});
|
|
83
|
+
|
|
64
84
|
server.handle(revealToken, async ({ serverId }) => {
|
|
65
85
|
await requireServerTarget(serverId);
|
|
66
86
|
return { token: (await settings.read()).token };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "send-to-paseo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Local HTTP bridge that dispatches PR work to the right Paseo workspace and agent.",
|
|
7
7
|
"repository": {
|
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
],
|
|
22
22
|
"files": [
|
|
23
23
|
"paseo-plugin.json",
|
|
24
|
+
"assets/",
|
|
24
25
|
"index.client.tsx",
|
|
25
26
|
"index.server.ts",
|
|
26
27
|
"client/**/*.ts",
|
|
27
28
|
"client/**/*.tsx",
|
|
28
29
|
"server/**/*.ts",
|
|
29
|
-
"shared/**/*.ts"
|
|
30
|
+
"shared/**/*.ts",
|
|
31
|
+
"docs/media/"
|
|
30
32
|
],
|
|
31
33
|
"publishConfig": {
|
|
32
34
|
"access": "public"
|
|
@@ -34,7 +36,7 @@
|
|
|
34
36
|
"scripts": {
|
|
35
37
|
"typecheck": "tsc --noEmit",
|
|
36
38
|
"test": "node check-deps.mjs && node --test client/hosts.test.mjs server/main-agent.test.mjs server/follow-up.test.mjs",
|
|
37
|
-
"verify": "npm run typecheck && npm test && node --test --experimental-strip-types agent-tools.test.mjs && node --test native-tools.test.mjs"
|
|
39
|
+
"verify": "npm run typecheck && npm test && node --test --experimental-strip-types agent-tools.test.mjs shared/chat.test.mjs && node --test native-tools.test.mjs"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@getpaseo/client": "0.14.0",
|