paseo-plugin-genui 0.1.7 → 0.2.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/OVERVIEW.md CHANGED
@@ -11,11 +11,11 @@ When automatic instructions are enabled, new agents receive the Generative UI co
11
11
  ## Capabilities and data access
12
12
 
13
13
  - **86 components in 10 groups**: Layout, Content, Data, Media, Inputs, Widgets, Project, Dev, Manage, and Evidence.
14
- - **Confined file reading**: `Load(path)`, `Snippet(path, from, to)`, and `Image(path)` read JSON, CSV, TSV, logs, test reports (Vitest, Jest, JUnit), coverage (`lcov`, Istanbul, `coverage.py`, Go), lint and typecheck findings (ESLint, SARIF, `tsc`, Ruff), HAR traces, and benchmarks. Reads are strictly confined to the agent's workspace directory, its per-agent thread storage directory (`/tmp/opencode/genui-storage/<agentId>`), and `/tmp`.
14
+ - **Confined file reading**: `Load(path)`, `Snippet(path, from, to)`, and `Image(path)` read JSON, CSV, TSV, logs, test reports (Vitest, Jest, JUnit), coverage (`lcov`, Istanbul, `coverage.py`, Go), lint and typecheck findings (ESLint, SARIF, `tsc`, Ruff), HAR traces, and benchmarks. Reads are strictly confined to the agent's workspace directory, its per-agent thread storage directory (`/tmp/opencode/genui-storage/<agentId>`), `/tmp`, and any extra folders added in settings.
15
15
  - **Live workspace and git state**: `Changes()`, `Commits()`, `PullRequest()`, `Threads()`, and `Environments()` read the workspace's git diff, commits, pull request status, subagents, and worktrees on the daemon host.
16
16
  - **Sandboxed mini-apps**: `app` blocks run self-contained HTML and JavaScript inside a sandboxed iframe (`sandbox="allow-scripts"`) with a network-blocking Content Security Policy on desktop and web clients.
17
- - **Settings and web lookups**: Under **Settings -> Plugins -> Generative UI**, you can toggle automatic agent instructions for new sessions and toggle server-side web lookups. When web lookups are on, the daemon fetches photo searches from Wikimedia Commons (`commons.wikimedia.org` / `upload.wikimedia.org`), geocoding from Photon (`photon.komoot.io`), map tiles from OpenStreetMap (`tile.openstreetmap.org`), and HTTPS images through an address-checked proxy that rejects loopback, private, and link-local IP addresses. No cookies, credentials, or conversation text beyond the specific search query or place name are sent. Turning web lookups off disables all external network requests.
17
+ - **Settings and web lookups**: Under **Settings -> Plugins -> Generative UI**, you can toggle automatic agent instructions for new sessions and toggle server-side web lookups, and add extra folders (for example `~/dev/scratch`) that file reads may use. When web lookups are on, the daemon fetches photo searches from Wikimedia Commons (`commons.wikimedia.org` / `upload.wikimedia.org`), geocoding from Photon (`photon.komoot.io`), map tiles from OpenStreetMap (`tile.openstreetmap.org`), and HTTPS images through an address-checked proxy that rejects loopback, private, and link-local IP addresses. No cookies, credentials, or conversation text beyond the specific search query or place name are sent. Turning web lookups off disables all external network requests.
18
18
 
19
19
  ## Limits
20
20
 
21
- File reads outside the agent's workspace, thread storage, and `/tmp` are refused. Sandboxed `app` blocks require a desktop or browser client; mobile clients display the block's source code.
21
+ File reads outside the agent's workspace, thread storage, `/tmp`, and the extra folders in settings are refused; agents are told to copy other files into thread storage first. Sandboxed `app` blocks require a desktop or browser client; mobile clients display the block's source code.
package/README.md CHANGED
@@ -48,7 +48,7 @@ Paseo renders a card with a plan switch, a seat slider, and a live total. Moving
48
48
  | Group | Components |
49
49
  | --- | --- |
50
50
  | **Layout** | `Card` · `Row` · `Stack` · `Grid` · `Tabs` · `Details` · `Divider` · `Carousel` |
51
- | **Content** | `Text` · `Callout` · `Metric` · `Badge` · `Icon` · `KeyValue` · `Image` · `File` · `Entity` · `Sources` · `List` |
51
+ | **Content** | `Text` · `Callout` · `Draft` · `Metric` · `Badge` · `Icon` · `KeyValue` · `Image` · `File` · `Entity` · `Sources` · `List` |
52
52
  | **Data** | `Table` · `Chart` (bar, line, area, pie, scatter, radar, funnel, heatmap) · `Sparkline` · `Progress` · `Gauge` · `SegmentedBar` · `Steps` · `Timeline` · `Calendar` · `CalendarHeatmap` · `Tree` · `Code` · `Snippet` · `Diff` · `Diagram` |
53
53
  | **Media** | `ImageSearch` · `Gallery` · `Map` · `Hotspots` |
54
54
  | **Inputs** | `Slider` · `Stepper` · `Toggle` · `Choice` · `Radio` · `Select` · `Checklist` · `ListEditor` · `Input` · `TextArea` · `DateInput` · `Rating` · `OptionCards` · `Swatches` · `EditableTable` · `Button` · `Form` · `FollowUps` |
@@ -1,4 +1,4 @@
1
- import { Icon as PaseoIcon, Modal } from "@getpaseo/plugin/client/react-native";
1
+ import { Icon as PaseoIcon, Modal, copyText, useToast } from "@getpaseo/plugin/client/react-native";
2
2
  import { ImageLightbox } from "./image-lightbox";
3
3
  import { ExternalLink } from "@getpaseo/plugin/client/ui";
4
4
  import React, { useContext, useEffect, useState } from "react";
@@ -8,7 +8,7 @@ import { parseListRows } from "../../shared/logic/explain-logic";
8
8
  import { resolveIconName } from "../../shared/logic/icons";
9
9
  import { entityKind, imageRef, inlineFacts, sourceLinks } from "../../shared/logic/references-model";
10
10
  import { finiteNumber, isNode, list, optionalText, text, tone, type Props } from "../../shared/logic/values";
11
- import { MarkdownText } from "../markdown";
11
+ import { InlineMarkdown, MarkdownText } from "../markdown";
12
12
  import { ErrorLine, RenderNode } from "../node-renderer";
13
13
  import { InTableContext, toneColor, toneMutedColor, useUiRuntime, type ImageUrl } from "../runtime";
14
14
 
@@ -51,6 +51,65 @@ export function Callout({ props }: { props: Props }) {
51
51
  );
52
52
  }
53
53
 
54
+ export function Draft({ props }: { props: Props }) {
55
+ const { theme, compact } = useUiRuntime();
56
+ const toast = useToast();
57
+ const [source, setSource] = useState(false);
58
+ const body = text(props.markdown);
59
+ const title = optionalText(props.title);
60
+ const action = (label: string, onPress: () => void, active = false) => (
61
+ <Pressable accessibilityRole="button" onPress={onPress} hitSlop={8}>
62
+ <RNText style={{ color: active ? theme.colors.foreground : theme.colors.foregroundMuted, fontSize: 11.5, fontWeight: "500" }}>
63
+ {label}
64
+ </RNText>
65
+ </Pressable>
66
+ );
67
+
68
+ return (
69
+ <View
70
+ style={{
71
+ borderRadius: 8,
72
+ borderWidth: StyleSheet.hairlineWidth,
73
+ borderColor: theme.colors.border,
74
+ backgroundColor: theme.colors.surface2,
75
+ overflow: "hidden",
76
+ }}
77
+ >
78
+ <View
79
+ style={{
80
+ flexDirection: "row",
81
+ alignItems: "center",
82
+ gap: 12,
83
+ paddingHorizontal: 10,
84
+ paddingVertical: 6,
85
+ borderBottomWidth: StyleSheet.hairlineWidth,
86
+ borderBottomColor: theme.colors.border,
87
+ }}
88
+ >
89
+ <RNText numberOfLines={1} style={{ flex: 1, color: theme.colors.foregroundMuted, fontSize: 11.5 }}>
90
+ {title ?? "Draft"}
91
+ </RNText>
92
+ {action("Source", () => setSource((value) => !value), source)}
93
+ {action("Copy", () => {
94
+ void copyText(body).then(
95
+ () => toast.show("Copied", { variant: "success" }),
96
+ () => toast.error("Could not copy"),
97
+ );
98
+ })}
99
+ </View>
100
+ <View style={{ padding: 10 }}>
101
+ {source ? (
102
+ <RNText selectable style={{ color: theme.colors.foreground, fontFamily: "monospace", fontSize: 12, lineHeight: 18 }}>
103
+ {body}
104
+ </RNText>
105
+ ) : (
106
+ <MarkdownText text={body} theme={theme} compact={compact} />
107
+ )}
108
+ </View>
109
+ </View>
110
+ );
111
+ }
112
+
54
113
  export function Metric({ props }: { props: Props }) {
55
114
  const { theme } = useUiRuntime();
56
115
  const label = text(props.label);
@@ -473,7 +532,7 @@ export function List({ props }: { props: Props }) {
473
532
  </RNText>
474
533
  {item.detail ? (
475
534
  <RNText style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
476
- {item.detail}
535
+ <InlineMarkdown text={item.detail} theme={theme} />
477
536
  </RNText>
478
537
  ) : null}
479
538
  </View>
@@ -1,4 +1,5 @@
1
1
  import { Icon, copyText, useToast } from "@getpaseo/plugin/client/react-native";
2
+ import { InlineMarkdown } from "../markdown";
2
3
  import React, { useMemo, useState } from "react";
3
4
  import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
4
5
  import { calendarLayout, calendarStats, dayLabel, readDays } from "../../shared/logic/calendarMath";
@@ -525,7 +526,7 @@ export function Steps({ props }: { props: Props }) {
525
526
  </Text>
526
527
  {detail ? (
527
528
  <Text selectable style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
528
- {detail}
529
+ <InlineMarkdown text={detail} theme={theme} />
529
530
  </Text>
530
531
  ) : null}
531
532
  </View>
@@ -564,7 +565,7 @@ export function Timeline({ props }: { props: Props }) {
564
565
  </View>
565
566
  {entry.detail ? (
566
567
  <Text selectable style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
567
- {entry.detail}
568
+ <InlineMarkdown text={entry.detail} theme={theme} />
568
569
  </Text>
569
570
  ) : null}
570
571
  </View>
@@ -782,11 +783,27 @@ export function Tree({ props }: { props: Props }) {
782
783
  );
783
784
  }
784
785
 
786
+ const PROSE_LANGUAGES = new Set(["markdown", "md", "text", "txt"]);
787
+
785
788
  export function Code({ props }: { props: Props }) {
786
789
  const { theme } = useUiRuntime();
787
790
  const toast = useToast();
788
791
  const code = text(props.code);
789
792
  const language = optionalText(props.language);
793
+ const wrap = language !== null && PROSE_LANGUAGES.has(language.toLowerCase());
794
+ const codeText = (
795
+ <Text
796
+ selectable
797
+ style={{
798
+ color: theme.colors.foreground,
799
+ fontFamily: "monospace",
800
+ fontSize: 12,
801
+ lineHeight: 18,
802
+ }}
803
+ >
804
+ {code}
805
+ </Text>
806
+ );
790
807
 
791
808
  return (
792
809
  <View
@@ -823,21 +840,13 @@ export function Code({ props }: { props: Props }) {
823
840
  <Icon name="Copy" size={13} color={theme.colors.foregroundMuted} />
824
841
  </Pressable>
825
842
  </View>
826
- <ScrollView horizontal>
827
- <View style={{ padding: 10 }}>
828
- <Text
829
- selectable
830
- style={{
831
- color: theme.colors.foreground,
832
- fontFamily: "monospace",
833
- fontSize: 12,
834
- lineHeight: 18,
835
- }}
836
- >
837
- {code}
838
- </Text>
839
- </View>
840
- </ScrollView>
843
+ {wrap ? (
844
+ <View style={{ padding: 10 }}>{codeText}</View>
845
+ ) : (
846
+ <ScrollView horizontal>
847
+ <View style={{ padding: 10 }}>{codeText}</View>
848
+ </ScrollView>
849
+ )}
841
850
  </View>
842
851
  );
843
852
  }
@@ -1,5 +1,6 @@
1
1
  import { Icon, TextInput, copyText as copyToClipboard, useToast } from "@getpaseo/plugin/client/react-native";
2
2
  import { ExternalLink } from "@getpaseo/plugin/client/ui";
3
+ import { InlineMarkdown } from "../markdown";
3
4
  import React, { useMemo, useState } from "react";
4
5
  import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
5
6
  import { formatRatio, readBenchmark } from "../../shared/core/benchmark";
@@ -309,7 +310,7 @@ export function Findings({ props }: { props: Props }) {
309
310
  </Pressable>
310
311
  ) : null}
311
312
  {item.detail ? (
312
- <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>{item.detail}</Text>
313
+ <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}><InlineMarkdown text={item.detail} theme={theme} /></Text>
313
314
  ) : null}
314
315
  <Pressable
315
316
  onPress={() => {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
2
2
  import {
3
3
  Image,
4
4
  Modal,
@@ -10,11 +10,22 @@ import {
10
10
  useWindowDimensions,
11
11
  View,
12
12
  } from "react-native";
13
+ import { clampZoom, wheelFactor, zoomAt, type LightboxView } from "../../shared/logic/lightbox";
14
+
15
+ type PointerLike = { clientX: number; clientY: number; button: number };
16
+ type WheelLike = { clientX: number; clientY: number; deltaY: number; deltaMode: number; ctrlKey: boolean; preventDefault(): void };
17
+ /** The DOM node react-native-web hands back as a View ref; the plugin has no DOM lib types. */
18
+ type StageNode = {
19
+ addEventListener(type: string, listener: (event: never) => void, options?: { passive: boolean }): void;
20
+ removeEventListener(type: string, listener: (event: never) => void): void;
21
+ getBoundingClientRect(): { left: number; top: number; width: number; height: number };
22
+ };
13
23
 
14
24
  /**
15
25
  * A fullscreen image viewer, like the one Paseo uses for chat images. The plugin
16
26
  * SDK exposes no call to open the host's, so this is built on React Native's Modal,
17
- * which covers the whole window. Click the image to switch between fit and actual size.
27
+ * which covers the whole window. On web, scroll or pinch zooms at the cursor and
28
+ * dragging moves the image; click the image to switch between fit and actual size.
18
29
  */
19
30
  export function ImageLightbox({
20
31
  uri,
@@ -25,9 +36,14 @@ export function ImageLightbox({
25
36
  title: string;
26
37
  onClose(): void;
27
38
  }) {
39
+ const web = Platform.OS === "web";
28
40
  const viewport = useWindowDimensions();
29
41
  const [natural, setNatural] = useState<{ width: number; height: number } | null>(null);
30
42
  const [actual, setActual] = useState(false);
43
+ const [stage, setStage] = useState<{ width: number; height: number } | null>(null);
44
+ const [view, setView] = useState<LightboxView | null>(null);
45
+ const stageRef = useRef<View>(null);
46
+ const moved = useRef(false);
31
47
 
32
48
  useEffect(() => {
33
49
  let live = true;
@@ -43,12 +59,83 @@ export function ImageLightbox({
43
59
  };
44
60
  }, [uri]);
45
61
 
46
- const stageWidth = viewport.width;
47
- const stageHeight = Math.max(200, viewport.height - 96);
62
+ const stageWidth = stage?.width ?? viewport.width;
63
+ const stageHeight = stage?.height ?? Math.max(200, viewport.height - 96);
48
64
  const fit = natural === null ? 1 : Math.min(stageWidth / natural.width, stageHeight / natural.height, 1);
49
- const scale = actual ? 1 : fit;
50
- const shown = natural === null ? null : { width: natural.width * scale, height: natural.height * scale };
51
65
  const zoomable = natural !== null && fit < 1;
66
+ const current = view ?? { zoom: fit, x: 0, y: 0 };
67
+ const scale = web ? current.zoom : actual ? 1 : fit;
68
+ const shown = natural === null ? null : { width: natural.width * scale, height: natural.height * scale };
69
+
70
+ const latest = useRef({ current, fit });
71
+ useLayoutEffect(() => {
72
+ latest.current = { current, fit };
73
+ });
74
+
75
+ useEffect(() => {
76
+ const node = stageRef.current as unknown as StageNode | null;
77
+ if (!web || natural === null || node === null) return;
78
+ const fromCentre = (e: { clientX: number; clientY: number }) => {
79
+ const r = node.getBoundingClientRect();
80
+ return { x: e.clientX - r.left - r.width / 2, y: e.clientY - r.top - r.height / 2 };
81
+ };
82
+ let drag: { px: number; py: number; x: number; y: number } | null = null;
83
+ const onWheel = (e: WheelLike) => {
84
+ e.preventDefault();
85
+ const { current: now, fit: f } = latest.current;
86
+ setView(zoomAt(now, wheelFactor(e.deltaY, e.ctrlKey, e.deltaMode), fromCentre(e), f));
87
+ };
88
+ const onDown = (e: PointerLike) => {
89
+ if (e.button !== 0) return;
90
+ moved.current = false;
91
+ const { x, y } = latest.current.current;
92
+ drag = { px: e.clientX, py: e.clientY, x, y };
93
+ };
94
+ const onMove = (e: PointerLike) => {
95
+ if (drag === null) return;
96
+ const dx = e.clientX - drag.px;
97
+ const dy = e.clientY - drag.py;
98
+ if (!moved.current && Math.hypot(dx, dy) < 4) return;
99
+ moved.current = true;
100
+ const { current: now, fit: f } = latest.current;
101
+ if (now.zoom > f) setView({ zoom: now.zoom, x: drag.x + dx, y: drag.y + dy });
102
+ };
103
+ const onUp = () => {
104
+ drag = null;
105
+ };
106
+ const noDrag = (e: { preventDefault(): void }) => e.preventDefault();
107
+ node.addEventListener("wheel", onWheel, { passive: false });
108
+ node.addEventListener("pointerdown", onDown);
109
+ node.addEventListener("pointermove", onMove);
110
+ node.addEventListener("pointerup", onUp);
111
+ node.addEventListener("pointerleave", onUp);
112
+ node.addEventListener("dragstart", noDrag);
113
+ return () => {
114
+ node.removeEventListener("wheel", onWheel);
115
+ node.removeEventListener("pointerdown", onDown);
116
+ node.removeEventListener("pointermove", onMove);
117
+ node.removeEventListener("pointerup", onUp);
118
+ node.removeEventListener("pointerleave", onUp);
119
+ node.removeEventListener("dragstart", noDrag);
120
+ };
121
+ }, [web, natural]);
122
+
123
+ // A press that ended a drag is not a click.
124
+ const closeFromStage = () => {
125
+ if (!moved.current) onClose();
126
+ };
127
+ const toggleWeb = () => {
128
+ if (moved.current || natural === null) return;
129
+ setView(current.zoom > fit + 1e-3 ? null : zoomable ? { zoom: clampZoom(1, fit), x: 0, y: 0 } : view);
130
+ };
131
+
132
+ const hint = web
133
+ ? `Scroll to zoom${current.zoom > fit ? " · drag to move" : ""}${zoomable ? " · click for 100%" : ""} · Esc to close`
134
+ : zoomable
135
+ ? actual
136
+ ? "Tap to fit"
137
+ : "Tap to zoom"
138
+ : "";
52
139
 
53
140
  return (
54
141
  <Modal transparent animationType="fade" visible onRequestClose={onClose} statusBarTranslucent>
@@ -59,40 +146,71 @@ export function ImageLightbox({
59
146
  {natural !== null ? ` ${natural.width} × ${natural.height}` : ""}
60
147
  </Text>
61
148
  {natural !== null ? <Text style={styles.percent}>{Math.round(scale * 100)}%</Text> : null}
62
- <Pressable accessibilityRole="button" accessibilityLabel="Close" hitSlop={12} onPress={onClose} style={styles.close}>
149
+ <Pressable accessibilityRole="button" accessibilityLabel="Close" hitSlop={16} onPress={onClose} style={styles.close}>
63
150
  <Text style={styles.closeText}>✕</Text>
64
151
  </Pressable>
65
152
  </View>
66
- <ScrollView
67
- style={styles.stage}
68
- contentContainerStyle={{ minHeight: stageHeight, minWidth: stageWidth, alignItems: "center", justifyContent: "center" }}
69
- horizontal={actual}
70
- maximumZoomScale={4}
71
- centerContent
72
- >
153
+ {web ? (
154
+ <View
155
+ ref={stageRef}
156
+ style={styles.webStage}
157
+ onLayout={(e) => setStage({ width: e.nativeEvent.layout.width, height: e.nativeEvent.layout.height })}
158
+ >
159
+ <Pressable accessibilityRole="button" accessibilityLabel="Close" onPress={closeFromStage} style={StyleSheet.absoluteFill} />
160
+ {shown !== null ? (
161
+ <Pressable
162
+ accessibilityRole="imagebutton"
163
+ accessibilityLabel={title}
164
+ onPress={toggleWeb}
165
+ style={{
166
+ position: "absolute",
167
+ left: (stageWidth - shown.width) / 2 + current.x,
168
+ top: (stageHeight - shown.height) / 2 + current.y,
169
+ cursor: current.zoom > fit ? "grab" : zoomable ? "zoom-in" : "default",
170
+ } as never}
171
+ >
172
+ <Image source={{ uri }} resizeMode="contain" style={shown} />
173
+ </Pressable>
174
+ ) : (
175
+ <Text style={[styles.percent, styles.loading]}>Loading…</Text>
176
+ )}
177
+ </View>
178
+ ) : (
73
179
  <ScrollView
74
- contentContainerStyle={{ minHeight: stageHeight, justifyContent: "center", alignItems: "center" }}
75
- scrollEnabled={actual}
180
+ style={styles.stage}
181
+ contentContainerStyle={{ minHeight: stageHeight, minWidth: stageWidth, alignItems: "center", justifyContent: "center" }}
182
+ horizontal={actual}
183
+ maximumZoomScale={4}
184
+ centerContent
76
185
  >
77
186
  <Pressable
78
- accessibilityRole="imagebutton"
79
- accessibilityLabel={zoomable ? (actual ? "Fit to window" : "Show actual size") : title}
80
- onPress={() => {
81
- if (zoomable) setActual((value) => !value);
82
- }}
187
+ accessibilityRole="button"
188
+ accessibilityLabel="Close"
189
+ onPress={onClose}
190
+ style={{ minHeight: stageHeight, minWidth: stageWidth }}
83
191
  >
84
- {shown !== null ? (
85
- <Image source={{ uri }} resizeMode="contain" style={shown} />
86
- ) : (
87
- <Text style={styles.percent}>Loading…</Text>
88
- )}
192
+ <ScrollView
193
+ contentContainerStyle={{ minHeight: stageHeight, justifyContent: "center", alignItems: "center" }}
194
+ scrollEnabled={actual}
195
+ >
196
+ <Pressable
197
+ accessibilityRole="imagebutton"
198
+ accessibilityLabel={zoomable ? (actual ? "Fit to window" : "Show actual size") : title}
199
+ onPress={() => {
200
+ if (zoomable) setActual((value) => !value);
201
+ }}
202
+ >
203
+ {shown !== null ? (
204
+ <Image source={{ uri }} resizeMode="contain" style={shown} />
205
+ ) : (
206
+ <Text style={styles.percent}>Loading…</Text>
207
+ )}
208
+ </Pressable>
209
+ </ScrollView>
89
210
  </Pressable>
90
211
  </ScrollView>
91
- </ScrollView>
92
- <Text style={styles.hint}>
93
- {zoomable ? (actual ? "Click to fit" : "Click to zoom") : ""}
94
- {Platform.OS === "web" ? `${zoomable ? " · " : ""}Esc to close` : ""}
95
- </Text>
212
+ )}
213
+ <Text style={styles.hint}>{hint}</Text>
96
214
  </View>
97
215
  </Modal>
98
216
  );
@@ -103,8 +221,10 @@ const styles = StyleSheet.create({
103
221
  header: { flexDirection: "row", alignItems: "center", gap: 12, paddingHorizontal: 16, paddingTop: 16, paddingBottom: 8 },
104
222
  title: { flex: 1, color: "#f4f4f5", fontSize: 13, fontWeight: "600" },
105
223
  percent: { color: "#a1a1aa", fontSize: 12 },
106
- close: { padding: 6 },
107
- closeText: { color: "#f4f4f5", fontSize: 16 },
224
+ loading: { textAlign: "center", marginTop: 40 },
225
+ close: { paddingHorizontal: 14, paddingVertical: 8 },
226
+ closeText: { color: "#f4f4f5", fontSize: 24 },
108
227
  stage: { flex: 1 },
228
+ webStage: { flex: 1, overflow: "hidden" },
109
229
  hint: { color: "#a1a1aa", fontSize: 12, textAlign: "center", paddingVertical: 8 },
110
230
  });
@@ -1,4 +1,5 @@
1
1
  import { Icon, TextInput } from "@getpaseo/plugin/client/react-native";
2
+ import { InlineMarkdown } from "../markdown";
2
3
  import React, { useState } from "react";
3
4
  import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
4
5
  import { formMessage } from "../../shared/core/form";
@@ -377,7 +378,7 @@ export function Radio({ props }: { props: Props }) {
377
378
  </Text>
378
379
  {opt.detail ? (
379
380
  <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
380
- {opt.detail}
381
+ <InlineMarkdown text={opt.detail} theme={theme} />
381
382
  </Text>
382
383
  ) : null}
383
384
  </View>
@@ -686,7 +687,7 @@ export function OptionCards({ props }: { props: Props }) {
686
687
  </Text>
687
688
  </View>
688
689
  {opt.detail ? (
689
- <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>{opt.detail}</Text>
690
+ <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}><InlineMarkdown text={opt.detail} theme={theme} /></Text>
690
691
  ) : null}
691
692
  </Pressable>
692
693
  );
@@ -1,4 +1,4 @@
1
- import { Icon, Modal } from "@getpaseo/plugin/client/react-native";
1
+ import { Icon } from "@getpaseo/plugin/client/react-native";
2
2
  import { ExternalLink } from "@getpaseo/plugin/client/ui";
3
3
  import React, { useEffect, useMemo, useState } from "react";
4
4
  import { Image as RNImage, Pressable, StyleSheet, Text, View } from "react-native";
@@ -7,8 +7,9 @@ import { hotspotPoints, imageRef } from "../../shared/logic/references-model";
7
7
  import { asRecord, finiteNumber, list, optionalText, text, type Props } from "../../shared/logic/values";
8
8
  import { useGeocodePlace, useImageSearch, useMapTileLoader } from "../loaders";
9
9
  import { ErrorLine } from "../node-renderer";
10
- import { useUiRuntime } from "../runtime";
10
+ import { useUiRuntime, type ImageUrl } from "../runtime";
11
11
  import { LoadedImageView } from "./content";
12
+ import { ImageLightbox } from "./image-lightbox";
12
13
 
13
14
  export function ImageSearch({ props }: { props: Props }) {
14
15
  const { theme } = useUiRuntime();
@@ -71,6 +72,39 @@ export function ImageSearch({ props }: { props: Props }) {
71
72
  );
72
73
  }
73
74
 
75
+ function GalleryLightbox({
76
+ item,
77
+ onClose,
78
+ }: {
79
+ item: { src?: string; query?: string; caption: string | null };
80
+ onClose(): void;
81
+ }) {
82
+ const { loadImage } = useUiRuntime();
83
+ const found = useImageSearch(item.query ?? "");
84
+ const [loaded, setLoaded] = useState<ImageUrl | null>(null);
85
+
86
+ useEffect(() => {
87
+ if (item.query || !item.src || !loadImage) return;
88
+ let live = true;
89
+ void loadImage(item.src).then((res) => {
90
+ if (live) setLoaded(res);
91
+ });
92
+ return () => {
93
+ live = false;
94
+ };
95
+ }, [item.query, item.src, loadImage]);
96
+
97
+ const result = item.query ? (found === null ? null : found.ok ? { ok: true as const, url: found.image.url } : found) : loaded;
98
+ const failed = result !== null && !result.ok;
99
+ // The tile already shows why the image failed, so a failed lookup just closes.
100
+ useEffect(() => {
101
+ if (failed) onClose();
102
+ }, [failed, onClose]);
103
+
104
+ if (result === null || !result.ok) return null;
105
+ return <ImageLightbox uri={result.url} title={item.caption ?? item.query ?? item.src ?? "Image"} onClose={onClose} />;
106
+ }
107
+
74
108
  export function Gallery({ props }: { props: Props }) {
75
109
  const { theme, compact } = useUiRuntime();
76
110
  const rawItems = list(props.images);
@@ -118,32 +152,11 @@ export function Gallery({ props }: { props: Props }) {
118
152
  ) : item.src ? (
119
153
  <LoadedImageView src={item.src} alt={item.caption} height={150} zoomable={false} />
120
154
  ) : null}
121
- {item.caption ? (
122
- <Text style={{ color: theme.colors.foregroundMuted, fontSize: 11.5 }}>
123
- {item.caption}
124
- </Text>
125
- ) : null}
126
155
  </Pressable>
127
156
  ))}
128
157
  </View>
129
158
  ))}
130
- {selected ? (
131
- <Modal
132
- title={selected.caption ?? "Image"}
133
- open={true}
134
- onOpenChange={(open) => {
135
- if (!open) setSelected(null);
136
- }}
137
- >
138
- <Modal.Content>
139
- {selected.query ? (
140
- <ImageSearch props={{ query: selected.query, alt: selected.caption ?? selected.query }} />
141
- ) : selected.src ? (
142
- <LoadedImageView src={selected.src} alt={selected.caption} height={360} zoomable={false} />
143
- ) : null}
144
- </Modal.Content>
145
- </Modal>
146
- ) : null}
159
+ {selected ? <GalleryLightbox item={selected} onClose={() => setSelected(null)} /> : null}
147
160
  </View>
148
161
  );
149
162
  }
@@ -27,6 +27,8 @@ import { useUiRuntime } from "../runtime";
27
27
  import { LoadedImageView } from "./content";
28
28
  import { Diff } from "./data";
29
29
 
30
+ const CHANGES_ROWS = 50;
31
+
30
32
  export function Changes({ props }: { props: Props }) {
31
33
  const { theme, agentId, blockKey } = useUiRuntime();
32
34
  const projectRpc = useProjectRpc();
@@ -34,6 +36,10 @@ export function Changes({ props }: { props: Props }) {
34
36
  const parsedPaths = parsePathFilter(props.paths);
35
37
  const [state, setState] = useState<ChangesResult | null>(null);
36
38
  const [expandedFile, setExpandedFile] = useState<string | null>(null);
39
+ // Keyed by the request so a new target or path filter starts collapsed again.
40
+ const requestKey = `${rawTarget ?? ""}|${JSON.stringify(parsedPaths.ok ? parsedPaths.value : null)}`;
41
+ const [expandedFor, setExpandedFor] = useState<string | null>(null);
42
+ const showAll = expandedFor === requestKey;
37
43
 
38
44
  useEffect(() => {
39
45
  const parsedTarget = parseChangesTarget(rawTarget);
@@ -67,6 +73,8 @@ export function Changes({ props }: { props: Props }) {
67
73
 
68
74
  const totals = changeTotals(state.files);
69
75
  const patchByPath = new Map(state.patches.map((p) => [p.path, p.patch]));
76
+ const shownFiles = showAll ? state.files : state.files.slice(0, CHANGES_ROWS);
77
+ const hiddenFiles = state.files.length - shownFiles.length;
70
78
 
71
79
  return (
72
80
  <View
@@ -97,7 +105,7 @@ export function Changes({ props }: { props: Props }) {
97
105
  <Text style={{ color: theme.colors.statusDanger }}>−{totals.deletions}</Text>
98
106
  </Text>
99
107
  </View>
100
- {state.files.map((file, idx) => {
108
+ {shownFiles.map((file, idx) => {
101
109
  const patch = patchByPath.get(file.path);
102
110
  const isOpen = expandedFile === file.path;
103
111
  return (
@@ -133,6 +141,21 @@ export function Changes({ props }: { props: Props }) {
133
141
  </View>
134
142
  );
135
143
  })}
144
+ {hiddenFiles > 0 ? (
145
+ <Pressable
146
+ onPress={() => setExpandedFor(requestKey)}
147
+ style={{
148
+ paddingHorizontal: 10,
149
+ paddingVertical: 8,
150
+ borderTopWidth: StyleSheet.hairlineWidth,
151
+ borderTopColor: theme.colors.border,
152
+ }}
153
+ >
154
+ <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
155
+ Show {hiddenFiles} more file{hiddenFiles === 1 ? "" : "s"}
156
+ </Text>
157
+ </Pressable>
158
+ ) : null}
136
159
  </View>
137
160
  );
138
161
  }
@@ -46,7 +46,7 @@ import {
46
46
  STOPPED,
47
47
  type Clock,
48
48
  } from "../../shared/logic/widget-logic";
49
- import { MarkdownText } from "../markdown";
49
+ import { InlineMarkdown, MarkdownText } from "../markdown";
50
50
  import { ErrorLine } from "../node-renderer";
51
51
  import { propsKey, usePersistedState, useUiRuntime } from "../runtime";
52
52
 
@@ -385,7 +385,7 @@ export function Plan({ props }: { props: Props }) {
385
385
  ) : null}
386
386
  </View>
387
387
  {step.detail ? (
388
- <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>{step.detail}</Text>
388
+ <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}><InlineMarkdown text={step.detail} theme={theme} /></Text>
389
389
  ) : null}
390
390
  {step.files.length > 0 ? (
391
391
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>