paseo-plugin-genui 0.2.2 → 0.3.1
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 +5 -3
- package/README.md +15 -7
- package/assets/screenshot-chat.png +0 -0
- package/assets/screenshot-gallery.png +0 -0
- package/assets/screenshot-map.png +0 -0
- package/assets/screenshot-playground.png +0 -0
- package/client/components/content.tsx +41 -21
- package/client/components/data.tsx +18 -7
- package/client/components/dev.tsx +38 -26
- package/client/components/diagram.tsx +1 -1
- package/client/components/feedback.tsx +333 -0
- package/client/components/inputs.tsx +54 -47
- package/client/components/layout.tsx +3 -1
- package/client/components/media.tsx +2 -2
- package/client/components/project.tsx +7 -2
- package/client/components/widgets.tsx +35 -24
- package/client/gallery.tsx +7 -5
- package/client/live-ui.tsx +26 -2
- package/client/markdown.tsx +1 -5
- package/client/node-renderer.tsx +6 -1
- package/client/queue-pill.tsx +123 -0
- package/client/render.tsx +2 -0
- package/client/reply-queue.ts +82 -0
- package/client/runtime.ts +7 -0
- package/gallery/Other.ui +11 -0
- package/gallery/Plan.ui +1 -1
- package/index.client.tsx +6 -1
- package/index.server.ts +10 -0
- package/package.json +2 -2
- package/paseo-plugin.json +2 -1
- package/server/render-tool.ts +45 -0
- package/shared/actions-only.test.ts +23 -0
- package/shared/core/catalog.ts +23 -5
- package/shared/core/evaluate.ts +2 -0
- package/shared/core/markdown.ts +2 -0
- package/shared/core/types.ts +2 -1
- package/shared/diagram/markdown.test.ts +13 -0
- package/shared/diagram/markdown.ts +15 -1
- package/shared/fallback.ts +21 -1
- package/shared/hermes-syntax.test.ts +1 -1
- package/shared/instructions.ts +3 -1
- package/shared/logic/reply.test.ts +29 -0
- package/shared/logic/reply.ts +33 -0
- package/shared/logic/values.ts +1 -0
package/OVERVIEW.md
CHANGED
|
@@ -4,15 +4,17 @@ Instead of replying only with plain Markdown tables or pasted command output, ag
|
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
7
|
-
Requires Paseo 0.
|
|
7
|
+
Requires Paseo 0.14.0 or later on both the daemon and the app. Git and the GitHub CLI (`gh`) on the daemon host are optional and used only when a block includes `Changes()`, `Commits()`, or `PullRequest()`.
|
|
8
8
|
|
|
9
|
-
When automatic instructions are enabled, new agents receive the Generative UI component reference in their system prompt when created. For an existing agent, run `/genui` in the composer to send it the component reference, or `/genui-demo` to append an interactive sample block to the timeline. Open the **Gen-UI Gallery** from the sidebar or workspace panel to browse all
|
|
9
|
+
When automatic instructions are enabled, new agents receive the Generative UI component reference in their system prompt when created. For an existing agent, run `/genui` in the composer to send it the component reference, or `/genui-demo` to append an interactive sample block to the timeline. Open the **Gen-UI Gallery** from the sidebar or workspace panel to browse all 88 components across 10 groups with 170+ live examples and an interactive spec playground.
|
|
10
10
|
|
|
11
11
|
## Capabilities and data access
|
|
12
12
|
|
|
13
|
-
- **
|
|
13
|
+
- **88 components in 10 groups**: Layout, Content, Data, Media, Inputs, Widgets, Project, Dev, Manage, and Evidence.
|
|
14
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
|
+
- **Replies the user builds**: Agents can let you answer a card in your own words before anything is sent. A `Queue` button adds its text to your reply instead of sending it, `comments: true` adds a Comment action to each item of a Plan, Steps, List, Table, Findings, Decision or OptionCards, `editable: true` lets you rewrite an item's text, and `Other()` opens a free-form box. The queued parts from every card in the chat show in a composer pill, where you can remove them, send them, or clear them; the next Send sends them together with its own text as one message. The queue is kept in the app's local storage per chat. A message you type in Paseo's composer does not include the queue.
|
|
17
|
+
- **Checked UI with the `render_ui` tool**: The plugin gives each agent a `render_ui` tool through Paseo's agent tools. The agent passes a `ui` spec and a one-sentence answer, which the plugin shows as text above the card; the daemon checks the spec (compile, file loads, render) and adds it to the chat only when it renders, otherwise it returns the errors so the agent fixes them in the same turn. The plugin approves `render_ui` permission prompts on its own, because the tool only reads files the plugin can already read and adds UI to the chat. Agents whose provider cannot reach Paseo's agent tools write `ui` blocks in their reply instead.
|
|
16
18
|
- **Repair of broken blocks**: When an agent's turn ends, the daemon checks each `ui` block in its reply. If a block fails to compile, load a file, or render, the plugin sends the agent one follow-up message that starts with `[genui]` and lists the errors, and the agent replies with corrected blocks. It sends at most one such message per user message and skips subagents. The follow-up shows in the chat as a user message. Turning off automatic agent instructions in settings also turns this off.
|
|
17
19
|
- **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.
|
|
18
20
|
- **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.
|
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
**Agents answer with charts, diagrams, maps, plans, and forms rendered inline in the Paseo chat timeline.**
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
|
-

|
|
8
|
+
|
|
9
|
+

|
|
8
10
|
|
|
9
11
|

|
|
10
12
|
|
|
@@ -22,11 +24,13 @@ Or from npm:
|
|
|
22
24
|
paseo plugin add npm:paseo-plugin-genui
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
Requires Paseo 0.
|
|
27
|
+
Requires Paseo 0.14.0 or later.
|
|
26
28
|
|
|
27
29
|
## What an answer looks like
|
|
28
30
|
|
|
29
|
-
The agent
|
|
31
|
+
The agent passes a UI spec and a one-sentence answer to its `render_ui` tool. The plugin shows the answer as text above the card, so it reaches the user even when the agent wrote it only in its reasoning. The plugin checks the spec first and adds the card to the chat only when it renders; otherwise the tool returns the errors and the agent fixes them in the same turn. Agents without the tool write the same spec as a ```ui block in their reply, and the plugin asks them once to fix a block that fails.
|
|
32
|
+
|
|
33
|
+
A spec looks like this:
|
|
30
34
|
|
|
31
35
|
~~~
|
|
32
36
|
```ui
|
|
@@ -43,7 +47,11 @@ Card("Estimate", [
|
|
|
43
47
|
|
|
44
48
|
Paseo renders a card with a plan switch, a seat slider, and a live total. Moving the slider recomputes the total in place without another model call. Clicking the button sends your choice back to the agent.
|
|
45
49
|
|
|
46
|
-
##
|
|
50
|
+
## Replies you build
|
|
51
|
+
|
|
52
|
+
Cards can collect a reply before anything is sent. A button with `Queue(text)` adds its text to your reply instead of sending it. `comments: true` adds a Comment action to each item of a Plan, Steps, List, Table, Findings, Decision or OptionCards, and `editable: true` lets you rewrite an item's text. `Other()` opens a box for anything the agent did not offer. A pill in the composer shows what is queued; the next Send, or Send now in the pill, sends it all as one message.
|
|
53
|
+
|
|
54
|
+
## Components (88 across 10 groups)
|
|
47
55
|
|
|
48
56
|
| Group | Components |
|
|
49
57
|
| --- | --- |
|
|
@@ -51,7 +59,7 @@ Paseo renders a card with a plan switch, a seat slider, and a live total. Moving
|
|
|
51
59
|
| **Content** | `Text` · `Callout` · `Draft` · `Metric` · `Badge` · `Icon` · `KeyValue` · `Image` · `File` · `Entity` · `Sources` · `List` |
|
|
52
60
|
| **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
61
|
| **Media** | `ImageSearch` · `Gallery` · `Map` · `Hotspots` |
|
|
54
|
-
| **Inputs** | `Slider` · `Stepper` · `Toggle` · `Choice` · `Radio` · `Select` · `Checklist` · `ListEditor` · `Input` · `TextArea` · `DateInput` · `Rating` · `OptionCards` · `Swatches` · `EditableTable` · `Button` · `Form` · `FollowUps` |
|
|
62
|
+
| **Inputs** | `Slider` · `Stepper` · `Toggle` · `Choice` · `Radio` · `Select` · `Checklist` · `ListEditor` · `Input` · `TextArea` · `DateInput` · `Rating` · `OptionCards` · `Swatches` · `EditableTable` · `Button` · `Form` · `FollowUps` · `Other` |
|
|
55
63
|
| **Widgets** | `Timer` · `Quiz` · `Flashcards` · `Walkthrough` |
|
|
56
64
|
| **Project** | `Changes` · `Commits` · `PullRequest` · `Threads` · `Tests` · `Json` |
|
|
57
65
|
| **Dev** | `Logs` · `StackTrace` · `Findings` · `Coverage` · `Dependencies` · `Pipeline` · `Benchmark` · `Waterfall` · `Treemap` |
|
|
@@ -62,7 +70,7 @@ Paseo renders a card with a plan switch, a seat slider, and a live total. Moving
|
|
|
62
70
|
|
|
63
71
|
- `/genui [prompt]` — Teach an existing agent the Generative UI component language.
|
|
64
72
|
- `/genui-demo [ComponentName]` — Insert a live interactive Gen-UI block into the current chat (e.g. `/genui-demo Decision` or `/genui-demo Map`).
|
|
65
|
-
- `/genui-gallery` — Open the **Gen-UI Gallery** screen (
|
|
73
|
+
- `/genui-gallery` — Open the **Gen-UI Gallery** screen (176 examples across all 88 components, plus a live spec Playground).
|
|
66
74
|
|
|
67
75
|
## Develop
|
|
68
76
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,7 +10,8 @@ import { entityKind, imageRef, inlineFacts, sourceLinks } from "../../shared/log
|
|
|
10
10
|
import { finiteNumber, isNode, list, optionalText, text, tone, type Props } from "../../shared/logic/values";
|
|
11
11
|
import { InlineMarkdown, MarkdownText } from "../markdown";
|
|
12
12
|
import { ErrorLine, RenderNode } from "../node-renderer";
|
|
13
|
-
import { InTableContext, toneColor, toneMutedColor, useUiRuntime, type ImageUrl } from "../runtime";
|
|
13
|
+
import { InTableContext, propsKey, toneColor, toneMutedColor, useUiRuntime, type ImageUrl } from "../runtime";
|
|
14
|
+
import { useItemFeedback } from "./feedback";
|
|
14
15
|
|
|
15
16
|
export function Text({ props }: { props: Props }) {
|
|
16
17
|
const { theme, compact } = useUiRuntime();
|
|
@@ -25,32 +26,39 @@ export function Callout({ props }: { props: Props }) {
|
|
|
25
26
|
const body = text(props.text);
|
|
26
27
|
const title = optionalText(props.title);
|
|
27
28
|
const t = tone(props.tone);
|
|
28
|
-
const borderColor = t === "neutral" ? theme.colors.border : toneColor(theme, t);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<View
|
|
32
32
|
style={{
|
|
33
33
|
borderRadius: 8,
|
|
34
34
|
borderWidth: StyleSheet.hairlineWidth,
|
|
35
|
-
borderColor,
|
|
36
|
-
borderLeftWidth: 3,
|
|
37
|
-
borderLeftColor: borderColor,
|
|
35
|
+
borderColor: theme.colors.border,
|
|
38
36
|
backgroundColor: theme.colors.surface2,
|
|
39
37
|
paddingHorizontal: 12,
|
|
40
38
|
paddingVertical: 10,
|
|
41
|
-
|
|
39
|
+
flexDirection: "row",
|
|
40
|
+
gap: 8,
|
|
42
41
|
}}
|
|
43
42
|
>
|
|
44
|
-
{
|
|
45
|
-
<
|
|
46
|
-
{
|
|
47
|
-
</
|
|
48
|
-
)
|
|
49
|
-
<
|
|
43
|
+
{t === "neutral" ? null : (
|
|
44
|
+
<View style={{ paddingTop: 2 }}>
|
|
45
|
+
<PaseoIcon name={CALLOUT_ICONS[t]} size={14} color={toneColor(theme, t)} />
|
|
46
|
+
</View>
|
|
47
|
+
)}
|
|
48
|
+
<View style={{ flex: 1, gap: 4 }}>
|
|
49
|
+
{title ? (
|
|
50
|
+
<RNText style={{ color: theme.colors.foreground, fontSize: 13, fontWeight: "600" }}>
|
|
51
|
+
{title}
|
|
52
|
+
</RNText>
|
|
53
|
+
) : null}
|
|
54
|
+
<MarkdownText text={body} theme={theme} compact={compact} />
|
|
55
|
+
</View>
|
|
50
56
|
</View>
|
|
51
57
|
);
|
|
52
58
|
}
|
|
53
59
|
|
|
60
|
+
const CALLOUT_ICONS = { good: "CircleCheck", warn: "AlertTriangle", bad: "CircleX", info: "Info" } as const;
|
|
61
|
+
|
|
54
62
|
export function Draft({ props }: { props: Props }) {
|
|
55
63
|
const { theme, compact } = useUiRuntime();
|
|
56
64
|
const toast = useToast();
|
|
@@ -496,6 +504,10 @@ export function Sources({ props }: { props: Props }) {
|
|
|
496
504
|
export function List({ props }: { props: Props }) {
|
|
497
505
|
const { theme, run } = useUiRuntime();
|
|
498
506
|
const rows = parseListRows(props.items);
|
|
507
|
+
const feedback = useItemFeedback(`list:${propsKey(props.items)}`, {
|
|
508
|
+
comments: props.comments === true,
|
|
509
|
+
editable: props.editable === true,
|
|
510
|
+
});
|
|
499
511
|
|
|
500
512
|
return (
|
|
501
513
|
<View
|
|
@@ -509,6 +521,9 @@ export function List({ props }: { props: Props }) {
|
|
|
509
521
|
{rows.map((item, idx) => {
|
|
510
522
|
const iconName = item.icon ? resolveIconName(item.icon) ?? item.icon : null;
|
|
511
523
|
const t = item.tone ?? "neutral";
|
|
524
|
+
const original = { title: item.title, detail: item.detail ?? "" };
|
|
525
|
+
const shown = feedback.fields(idx, original);
|
|
526
|
+
const controls = feedback.controls(idx, `"${item.title}"`, original);
|
|
512
527
|
const rowContent = (
|
|
513
528
|
<View
|
|
514
529
|
style={{
|
|
@@ -528,11 +543,11 @@ export function List({ props }: { props: Props }) {
|
|
|
528
543
|
) : null}
|
|
529
544
|
<View style={{ flex: 1, gap: 2 }}>
|
|
530
545
|
<RNText style={{ color: theme.colors.foreground, fontSize: 13, fontWeight: "500" }}>
|
|
531
|
-
{
|
|
546
|
+
{shown.title}
|
|
532
547
|
</RNText>
|
|
533
|
-
{
|
|
548
|
+
{shown.detail ? (
|
|
534
549
|
<RNText style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}>
|
|
535
|
-
<InlineMarkdown text={
|
|
550
|
+
<InlineMarkdown text={shown.detail} theme={theme} />
|
|
536
551
|
</RNText>
|
|
537
552
|
) : null}
|
|
538
553
|
</View>
|
|
@@ -548,12 +563,17 @@ export function List({ props }: { props: Props }) {
|
|
|
548
563
|
) : null}
|
|
549
564
|
</View>
|
|
550
565
|
);
|
|
551
|
-
return
|
|
552
|
-
<
|
|
553
|
-
{
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
566
|
+
return (
|
|
567
|
+
<View key={idx}>
|
|
568
|
+
{item.actions.length > 0 ? (
|
|
569
|
+
<Pressable accessibilityRole="button" onPress={() => void run(item.actions)}>
|
|
570
|
+
{rowContent}
|
|
571
|
+
</Pressable>
|
|
572
|
+
) : (
|
|
573
|
+
rowContent
|
|
574
|
+
)}
|
|
575
|
+
{controls ? <View style={{ paddingHorizontal: 12, paddingBottom: 9 }}>{controls}</View> : null}
|
|
576
|
+
</View>
|
|
557
577
|
);
|
|
558
578
|
})}
|
|
559
579
|
</View>
|
|
@@ -30,6 +30,8 @@ import {
|
|
|
30
30
|
} from "../../shared/logic/values";
|
|
31
31
|
import { ErrorLine, RenderNode } from "../node-renderer";
|
|
32
32
|
import { InTableContext, propsKey, toneColor, usePersistedState, useUiRuntime } from "../runtime";
|
|
33
|
+
import { hasOwnNumber } from "../../shared/logic/reply";
|
|
34
|
+
import { useItemFeedback } from "./feedback";
|
|
33
35
|
|
|
34
36
|
export function Table({ props }: { props: Props }) {
|
|
35
37
|
const { theme, compact } = useUiRuntime();
|
|
@@ -38,6 +40,7 @@ export function Table({ props }: { props: Props }) {
|
|
|
38
40
|
return rec ? text(rec.label ?? rec.key) : text(col);
|
|
39
41
|
});
|
|
40
42
|
const rows = list(props.rows);
|
|
43
|
+
const feedback = useItemFeedback(`table:${propsKey(props.rows)}`, { comments: props.comments === true, editable: false });
|
|
41
44
|
|
|
42
45
|
return (
|
|
43
46
|
<InTableContext.Provider value={true}>
|
|
@@ -77,16 +80,17 @@ export function Table({ props }: { props: Props }) {
|
|
|
77
80
|
: rec
|
|
78
81
|
? columns.map((c) => rec[c] ?? null)
|
|
79
82
|
: [row];
|
|
83
|
+
const first = isNode(cells[0]) ? "" : text(cells[0]);
|
|
84
|
+
const controls = feedback.controls(rIdx, `row ${rIdx + 1}${first ? ` (${first})` : ""}`, {});
|
|
80
85
|
return (
|
|
81
86
|
<View
|
|
82
87
|
key={rIdx}
|
|
83
88
|
style={{
|
|
84
|
-
flexDirection: "row",
|
|
85
|
-
alignItems: "center",
|
|
86
89
|
borderTopWidth: rIdx === 0 ? 0 : StyleSheet.hairlineWidth,
|
|
87
90
|
borderTopColor: theme.colors.border,
|
|
88
91
|
}}
|
|
89
92
|
>
|
|
93
|
+
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
90
94
|
{columns.map((_, cIdx) => {
|
|
91
95
|
const cell = cells[cIdx];
|
|
92
96
|
return (
|
|
@@ -105,6 +109,8 @@ export function Table({ props }: { props: Props }) {
|
|
|
105
109
|
);
|
|
106
110
|
})}
|
|
107
111
|
</View>
|
|
112
|
+
{controls ? <View style={{ paddingHorizontal: 10, paddingBottom: 8 }}>{controls}</View> : null}
|
|
113
|
+
</View>
|
|
108
114
|
);
|
|
109
115
|
})}
|
|
110
116
|
</View>
|
|
@@ -238,7 +244,7 @@ export function Chart({ props }: { props: Props }) {
|
|
|
238
244
|
borderRadius: 4,
|
|
239
245
|
backgroundColor: theme.colors.surface2,
|
|
240
246
|
borderWidth: StyleSheet.hairlineWidth,
|
|
241
|
-
borderColor:
|
|
247
|
+
borderColor: theme.colors.border,
|
|
242
248
|
alignItems: "center",
|
|
243
249
|
justifyContent: "center",
|
|
244
250
|
opacity: v > 0 ? intensity : 0.4,
|
|
@@ -487,13 +493,17 @@ export function SegmentedBar({ props }: { props: Props }) {
|
|
|
487
493
|
export function Steps({ props }: { props: Props }) {
|
|
488
494
|
const { theme } = useUiRuntime();
|
|
489
495
|
const items = list(props.items);
|
|
496
|
+
const feedback = useItemFeedback(`steps:${propsKey(props.items)}`, {
|
|
497
|
+
comments: props.comments === true,
|
|
498
|
+
editable: props.editable === true,
|
|
499
|
+
});
|
|
490
500
|
|
|
491
501
|
return (
|
|
492
502
|
<View style={{ gap: 8 }}>
|
|
493
503
|
{items.map((item, idx) => {
|
|
494
504
|
const obj = asRecord(item) ?? { title: text(item) };
|
|
495
|
-
const
|
|
496
|
-
const detail =
|
|
505
|
+
const original = { title: text(obj.title ?? obj.label), detail: optionalText(obj.detail) ?? "" };
|
|
506
|
+
const { title, detail } = feedback.fields(idx, original);
|
|
497
507
|
const status = text(obj.status);
|
|
498
508
|
const color =
|
|
499
509
|
status === "done"
|
|
@@ -529,6 +539,7 @@ export function Steps({ props }: { props: Props }) {
|
|
|
529
539
|
<InlineMarkdown text={detail} theme={theme} />
|
|
530
540
|
</Text>
|
|
531
541
|
) : null}
|
|
542
|
+
{feedback.controls(idx, hasOwnNumber(original.title) ? `step "${original.title}"` : `step ${idx + 1} (${original.title})`, original)}
|
|
532
543
|
</View>
|
|
533
544
|
</View>
|
|
534
545
|
);
|
|
@@ -636,8 +647,8 @@ export function Calendar({ props }: { props: Props }) {
|
|
|
636
647
|
borderRadius: 6,
|
|
637
648
|
padding: 4,
|
|
638
649
|
backgroundColor: day === null ? "transparent" : theme.colors.surface1,
|
|
639
|
-
borderWidth:
|
|
640
|
-
borderColor:
|
|
650
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
651
|
+
borderColor: theme.colors.border,
|
|
641
652
|
gap: 2,
|
|
642
653
|
}}
|
|
643
654
|
>
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
import { finiteNumber, optionalText, text, type Props } from "../../shared/logic/values";
|
|
38
38
|
import { ErrorLine } from "../node-renderer";
|
|
39
39
|
import { propsKey, toneColor, usePersistedState, useUiRuntime } from "../runtime";
|
|
40
|
+
import { useItemFeedback } from "./feedback";
|
|
40
41
|
|
|
41
42
|
export function Logs({ props }: { props: Props }) {
|
|
42
43
|
const { theme } = useUiRuntime();
|
|
@@ -242,6 +243,10 @@ export function Findings({ props }: { props: Props }) {
|
|
|
242
243
|
const { theme, run, openFile } = useUiRuntime();
|
|
243
244
|
const parsed = useMemo(() => readFindings(props.items), [props.items]);
|
|
244
245
|
const title = optionalText(props.title);
|
|
246
|
+
const feedback = useItemFeedback(`findings:${propsKey(props.items)}`, {
|
|
247
|
+
comments: props.comments === true,
|
|
248
|
+
editable: props.editable === true,
|
|
249
|
+
});
|
|
245
250
|
if (!parsed.ok) return <ErrorLine message={parsed.error} />;
|
|
246
251
|
const { report } = parsed;
|
|
247
252
|
|
|
@@ -272,6 +277,8 @@ export function Findings({ props }: { props: Props }) {
|
|
|
272
277
|
</View>
|
|
273
278
|
{report.findings.map((item, idx) => {
|
|
274
279
|
const loc = findingLocation(item);
|
|
280
|
+
const original = { title: item.title, detail: item.detail ?? "" };
|
|
281
|
+
const shown = feedback.fields(idx, original);
|
|
275
282
|
const sevColor =
|
|
276
283
|
item.severity === "critical" || item.severity === "high"
|
|
277
284
|
? theme.colors.statusDanger
|
|
@@ -292,7 +299,7 @@ export function Findings({ props }: { props: Props }) {
|
|
|
292
299
|
>
|
|
293
300
|
<View style={{ flexDirection: "row", justifyContent: "space-between", alignItems: "center", gap: 8 }}>
|
|
294
301
|
<Text style={{ color: theme.colors.foreground, fontSize: 13, fontWeight: "600", flex: 1 }}>
|
|
295
|
-
{
|
|
302
|
+
{shown.title}
|
|
296
303
|
</Text>
|
|
297
304
|
<Text style={{ color: sevColor, fontSize: 11, fontWeight: "700", textTransform: "uppercase" }}>
|
|
298
305
|
{severityLabel(item.severity, report.scale)}
|
|
@@ -309,26 +316,31 @@ export function Findings({ props }: { props: Props }) {
|
|
|
309
316
|
</Text>
|
|
310
317
|
</Pressable>
|
|
311
318
|
) : null}
|
|
312
|
-
{
|
|
313
|
-
<Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}><InlineMarkdown text={
|
|
319
|
+
{shown.detail ? (
|
|
320
|
+
<Text style={{ color: theme.colors.foregroundMuted, fontSize: 12 }}><InlineMarkdown text={shown.detail} theme={theme} /></Text>
|
|
314
321
|
) : null}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
322
|
+
{feedback.controls(
|
|
323
|
+
idx,
|
|
324
|
+
`finding "${item.title}"`,
|
|
325
|
+
original,
|
|
326
|
+
<Pressable
|
|
327
|
+
onPress={() => {
|
|
328
|
+
const msg = fixThisMessage(item);
|
|
329
|
+
void run([{ kind: "action", type: "send", text: msg }]);
|
|
330
|
+
}}
|
|
331
|
+
style={{
|
|
332
|
+
alignSelf: "flex-start",
|
|
333
|
+
paddingHorizontal: 8,
|
|
334
|
+
paddingVertical: 4,
|
|
335
|
+
borderRadius: 6,
|
|
336
|
+
backgroundColor: theme.colors.surface1,
|
|
337
|
+
}}
|
|
338
|
+
>
|
|
339
|
+
<Text style={{ color: theme.colors.foreground, fontSize: 11.5, fontWeight: "500" }}>
|
|
340
|
+
Fix this
|
|
341
|
+
</Text>
|
|
342
|
+
</Pressable>,
|
|
343
|
+
)}
|
|
332
344
|
</View>
|
|
333
345
|
);
|
|
334
346
|
})}
|
|
@@ -853,12 +865,12 @@ export function Tests({ props }: { props: Props }) {
|
|
|
853
865
|
}}
|
|
854
866
|
>
|
|
855
867
|
<View style={{ flexDirection: "row", justifyContent: "space-between", gap: 8 }}>
|
|
856
|
-
<
|
|
857
|
-
<
|
|
858
|
-
{tc.status === "passed" ? "
|
|
859
|
-
</
|
|
860
|
-
{tc.name}
|
|
861
|
-
</
|
|
868
|
+
<View style={{ flexDirection: "row", gap: 6, flex: 1 }}>
|
|
869
|
+
<View style={{ paddingTop: 1 }}>
|
|
870
|
+
<Icon name={tc.status === "passed" ? "CircleCheck" : tc.status === "failed" ? "CircleX" : "Circle"} size={13} color={color} />
|
|
871
|
+
</View>
|
|
872
|
+
<Text style={{ color: theme.colors.foreground, fontSize: 12.5, flex: 1 }}>{tc.name}</Text>
|
|
873
|
+
</View>
|
|
862
874
|
{tc.ms !== null ? (
|
|
863
875
|
<Text style={{ color: theme.colors.foregroundMuted, fontSize: 11.5 }}>
|
|
864
876
|
{formatDuration(tc.ms)}
|
|
@@ -205,7 +205,7 @@ export function Diagram({ props }: { props: Props }) {
|
|
|
205
205
|
style={{
|
|
206
206
|
borderRadius: 8,
|
|
207
207
|
borderWidth: StyleSheet.hairlineWidth,
|
|
208
|
-
borderColor: theme.colors.
|
|
208
|
+
borderColor: theme.colors.border,
|
|
209
209
|
backgroundColor: theme.colors.surface2,
|
|
210
210
|
padding: 10,
|
|
211
211
|
gap: 6,
|