@hanzo/build 0.2.126 → 0.2.127
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/lib/api/machines.d.ts +8 -0
- package/lib/api/machines.js +16 -5
- package/lib/api/places.d.ts +12 -4
- package/lib/api/places.js +11 -3
- package/lib/automations.js +74 -35
- package/lib/awake.d.ts +24 -0
- package/lib/awake.js +68 -0
- package/lib/clipboard.d.ts +2 -0
- package/lib/clipboard.js +10 -0
- package/lib/customize/agents.js +149 -31
- package/lib/customize/connectors.js +91 -34
- package/lib/customize/drafted.js +23 -10
- package/lib/customize/index.js +40 -10
- package/lib/customize/inventory.d.ts +4 -1
- package/lib/customize/inventory.js +66 -17
- package/lib/customize/plugins.js +43 -15
- package/lib/customize/skills.js +87 -23
- package/lib/customize/ui.d.ts +29 -3
- package/lib/customize/ui.js +89 -12
- package/lib/desk.d.ts +1 -1
- package/lib/desk.js +67 -40
- package/lib/dev-mode.d.ts +22 -0
- package/lib/dev-mode.js +80 -0
- package/lib/environment.js +4 -4
- package/lib/forge.js +97 -24
- package/lib/handoff.d.ts +8 -0
- package/lib/handoff.js +22 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/landing.js +100 -25
- package/lib/library.js +108 -39
- package/lib/make.js +3 -2
- package/lib/mind.d.ts +9 -29
- package/lib/mind.js +43 -4
- package/lib/pane.d.ts +13 -0
- package/lib/pane.js +4 -0
- package/lib/panel.d.ts +4 -0
- package/lib/panel.js +49 -46
- package/lib/plans.js +36 -15
- package/lib/project.js +72 -63
- package/lib/reply.d.ts +6 -1
- package/lib/reply.js +19 -9
- package/lib/run.js +23 -41
- package/lib/scheduled.js +36 -16
- package/lib/settings/account.js +2 -1
- package/lib/settings/billing.js +9 -4
- package/lib/settings/credits.d.ts +2 -1
- package/lib/settings/credits.js +2 -2
- package/lib/settings/machines.js +41 -18
- package/lib/settings/notifications.js +2 -1
- package/lib/shelf.d.ts +4 -1
- package/lib/shelf.js +79 -14
- package/lib/suggestions.js +2 -1
- package/lib/summary.js +3 -2
- package/lib/sync.js +3 -3
- package/lib/transcript.js +13 -6
- package/package.json +11 -1
package/lib/shelf.js
CHANGED
|
@@ -8,11 +8,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* starter is taken as a COPY of its own repository (`POST /v1/project/fork`),
|
|
9
9
|
* so what opens is that template, not a model's imitation of it.
|
|
10
10
|
*/
|
|
11
|
-
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
11
|
+
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
12
12
|
import { useI18n } from '@hanzo/i18n/react';
|
|
13
|
-
import { Boxes, ExternalLink, Globe, Lock, MoreHorizontal } from '@hanzogui/lucide-icons-2';
|
|
14
|
-
import { Button, DropdownMenu } from '@hanzo/ui';
|
|
15
|
-
import { useState } from 'react';
|
|
13
|
+
import { Boxes, ExternalLink, GitBranch, Globe, Lock, MoreHorizontal, Pencil, Search, Trash2, X } from '@hanzogui/lucide-icons-2';
|
|
14
|
+
import { Button, DropdownMenu, Input, Skeleton } from '@hanzo/ui';
|
|
15
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
16
|
+
import { RING, RING_INSET } from './pane.js';
|
|
16
17
|
import { clone } from './address.js';
|
|
17
18
|
import { address, change, fork, remove, templates } from './api/projects.js';
|
|
18
19
|
import { Address, Confirm, Rename } from './ask.js';
|
|
@@ -23,8 +24,8 @@ const SHOTS = ['/templates', 'https://gallery.hanzo.ai/screenshots', 'https://ha
|
|
|
23
24
|
function Head({ title, says }) {
|
|
24
25
|
return (_jsxs(YStack, { gap: "$1", pb: "$4", children: [_jsx(SizableText, { render: "h1", size: "$6", color: "$ink", children: title }), _jsx(SizableText, { size: "$2", color: "$soft", children: says })] }));
|
|
25
26
|
}
|
|
26
|
-
function Card({ onPress, label,
|
|
27
|
-
return (_jsx(YStack, { render: "button", onPress: onPress, "aria-label": label,
|
|
27
|
+
function Card({ onPress, label, disabled = false, children }) {
|
|
28
|
+
return (_jsx(YStack, { render: "button", onPress: onPress, disabled: disabled, "aria-label": label, width: "100%", minW: 0, rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", overflow: "hidden", opacity: disabled ? 0.72 : 1, focusVisibleStyle: RING, "$platform-web": { textAlign: 'start' }, children: children }));
|
|
28
29
|
}
|
|
29
30
|
/** Copying a starter into a project of this org, then opening it: one copy at a time. */
|
|
30
31
|
function useFork() {
|
|
@@ -82,7 +83,7 @@ function edited(s, say) {
|
|
|
82
83
|
* Its repository is the one its builds are cut from, by a GitHub address in any
|
|
83
84
|
* form GitHub hands out (address.ts), with the branch whose pushes rebuild it.
|
|
84
85
|
*/
|
|
85
|
-
export function Sites() {
|
|
86
|
+
export function Sites({ q = '', onMatch } = {}) {
|
|
86
87
|
const { t: say } = useI18n();
|
|
87
88
|
const t = useTarget();
|
|
88
89
|
const host = useHost();
|
|
@@ -93,6 +94,11 @@ export function Sites() {
|
|
|
93
94
|
const [relinking, setRelinking] = useState(null);
|
|
94
95
|
const [deleting, setDeleting] = useState(null);
|
|
95
96
|
const [note, setNote] = useState('');
|
|
97
|
+
const needle = q.trim().toLowerCase();
|
|
98
|
+
const filtered = useMemo(() => (needle ? list.value.filter((p) => `${p.name} ${p.slug} ${p.live ?? ''} ${p.repo ?? ''}`.toLowerCase().includes(needle)) : list.value), [list.value, needle]);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
onMatch?.(filtered.length);
|
|
101
|
+
}, [filtered.length, onMatch]);
|
|
96
102
|
const flip = async (p) => {
|
|
97
103
|
const visibility = p.visibility === 'private' ? 'public' : 'private';
|
|
98
104
|
setNote('');
|
|
@@ -105,15 +111,25 @@ export function Sites() {
|
|
|
105
111
|
setNote(e.message);
|
|
106
112
|
}
|
|
107
113
|
};
|
|
114
|
+
if (needle && filtered.length === 0)
|
|
115
|
+
return null;
|
|
108
116
|
const said = failed || note;
|
|
109
|
-
return (_jsxs(YStack, { width: "100%", role: "region", "aria-label": say('Sites'), children: [_jsxs(YStack, { width: "100%", children: [_jsxs(YStack, { gap: "$1", pb: "$4", children: [_jsx(SizableText, { render: "h2", size: "$5", color: "$ink", children: say('Sites') }), _jsx(SizableText, { size: "$2", color: "$soft", children: `${say('What this organization has built.')} ${say('Open one to keep building it.')}` })] }), said ? (_jsx(SizableText, { size: "$2", color: "$soft", role: "status", pb: "$3", children: said })) : null, starters.value.length ? (_jsxs(YStack, { gap: "$3", pb: "$6", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: say('Make something new') }), _jsx(
|
|
117
|
+
return (_jsxs(YStack, { width: "100%", role: "region", "aria-label": say('Sites'), children: [_jsxs(YStack, { width: "100%", children: [_jsxs(YStack, { gap: "$1", pb: "$4", children: [_jsx(SizableText, { render: "h2", size: "$5", color: "$ink", children: say('Sites') }), _jsx(SizableText, { size: "$2", color: "$soft", children: `${say('What this organization has built.')} ${say('Open one to keep building it.')}` })] }), said ? (_jsx(SizableText, { size: "$2", color: "$soft", role: "status", pb: "$3", children: said })) : null, !needle && starters.value.length ? (_jsxs(YStack, { gap: "$3", pb: "$6", width: "100%", children: [_jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", children: say('Make something new') }), _jsx(YStack, { display: "grid", gridTemplateColumns: "repeat(4, minmax(0, 1fr))", gap: "$3", width: "100%", children: starters.value.slice(0, 4).map((x) => (_jsxs(Card, { label: say('Start from {template}', { template: x.title }), disabled: Boolean(busy) && busy !== x.slug, onPress: () => void take(x.slug), children: [_jsx(Shot, { slug: x.slug }), _jsx(YStack, { px: "$3", py: "$2.5", children: _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: busy === x.slug ? say('Copying…') : x.title }) })] }, x.slug))) })] })) : null, list.error ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$7", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", children: say(list.error.message) }), _jsx(Button, { size: "sm", variant: "outline", onPress: list.reload, children: say('Try again') })] })) : !host.person ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$7", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: say('Sign in to see what your organization has built.') }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: say('Sign in') })] })) : list.loading && list.value.length === 0 ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('Reading your projects…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", bg: "$panel", overflow: "hidden", children: [0, 1, 2].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$3", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 16, height: 16, rounded: 999, shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "36%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "52%", height: 12, rounded: "$2" })] })] }, i))) })] })) : filtered.length === 0 ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$7", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: needle ? say('Nothing matches.') : `${say('Nothing built yet.')} ${say('Describe something on the New page and it lands here.')}` }), needle ? null : (_jsx(Button, { size: "sm", variant: "primary", onPress: () => host.go(''), children: say('New run') }))] })) : (_jsx(YStack, { gap: "$5", children: months(filtered, say).map((g) => (_jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: g.label }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: g.rows.map((p, i) => (_jsxs(XStack, { items: "center", pr: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { flex: 1, minW: 0, render: "button", "aria-label": say('Open {name}', { name: p.name }), onPress: () => host.go(p.slug), items: "center", gap: "$3", px: "$3", py: "$2.5", minH: 44, cursor: "pointer", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING_INSET, children: [p.visibility === 'private' ? _jsx(Lock, { size: 16, opacity: 0.7 }) : _jsx(Globe, { size: 16, opacity: 0.7 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: p.name }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [p.visibility === 'private' ? say('Private') : say('Public'), edited(when(p), say), p.live ? new URL(p.live).host : say('Not deployed yet')]
|
|
110
118
|
.filter(Boolean)
|
|
111
119
|
.join(' · ') })] })] }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Actions for {name}', { name: p.name }), px: "$1.5", py: "$1", rounded: "$2", hoverStyle: { bg: '$raised' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
...(p.live
|
|
121
|
+
? [{ key: 'live', label: say('Open live site'), icon: _jsx(ExternalLink, { size: 14 }), onSelect: () => window.open(p.live, '_blank', 'noopener,noreferrer') }]
|
|
122
|
+
: []),
|
|
123
|
+
{ key: 'rename', label: say('Rename'), icon: _jsx(Pencil, { size: 14 }), onSelect: () => setRenaming(p) },
|
|
124
|
+
{ key: 'repo', label: say('Change repository'), icon: _jsx(GitBranch, { size: 14 }), onSelect: () => setRelinking(p) },
|
|
125
|
+
{
|
|
126
|
+
key: 'visibility',
|
|
127
|
+
label: p.visibility === 'private' ? say('Make public') : say('Make private'),
|
|
128
|
+
icon: p.visibility === 'private' ? _jsx(Globe, { size: 14 }) : _jsx(Lock, { size: 14 }),
|
|
129
|
+
onSelect: () => void flip(p),
|
|
130
|
+
},
|
|
115
131
|
{ type: 'separator' },
|
|
116
|
-
{ key: 'delete', label: say('Delete'), destructive: true, onSelect: () => setDeleting(p) },
|
|
132
|
+
{ key: 'delete', label: say('Delete'), icon: _jsx(Trash2, { size: 14 }), destructive: true, onSelect: () => setDeleting(p) },
|
|
117
133
|
] })] }, p.slug))) })] }, g.label))) }))] }), renaming ? (_jsx(Rename, { open: true, onOpenChange: (o) => !o && setRenaming(null), title: say('Rename'), name: renaming.name, run: async (name) => {
|
|
118
134
|
await change(t, renaming.slug, { name });
|
|
119
135
|
setNote(say('Renamed to {name}', { name }));
|
|
@@ -136,12 +152,61 @@ export function Sites() {
|
|
|
136
152
|
function Shot({ slug }) {
|
|
137
153
|
const [step, setStep] = useState(0);
|
|
138
154
|
const base = SHOTS[step];
|
|
139
|
-
return (_jsxs(YStack, { width: "100%", aspectRatio: 16 / 10, bg: "$hover", items: "center", justify: "center", position: "relative", overflow: "hidden", children: [_jsxs(YStack, { items: "center", gap: "$2", opacity: 0.
|
|
155
|
+
return (_jsxs(YStack, { width: "100%", aspectRatio: 16 / 10, bg: "$hover", items: "center", justify: "center", position: "relative", overflow: "hidden", children: [_jsxs(YStack, { items: "center", gap: "$2", opacity: 0.7, children: [_jsx(Boxes, { size: 24, color: "$soft" }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: slug })] }), base ? (_jsx(YStack, { render: _jsx("img", { src: `${base}/${encodeURIComponent(slug)}.webp`, alt: "", loading: "lazy", onError: () => setStep((s) => s + 1) }), position: "absolute", t: 0, r: 0, b: 0, l: 0, width: "100%", height: "100%", "$platform-web": { objectFit: 'cover', objectPosition: 'top' } })) : null] }));
|
|
140
156
|
}
|
|
141
157
|
export function Templates() {
|
|
142
158
|
const { t: say } = useI18n();
|
|
159
|
+
const host = useHost();
|
|
143
160
|
const t = useTarget();
|
|
161
|
+
const desktop = Boolean(useMedia().sm);
|
|
144
162
|
const list = useRead(() => templates(t), [], [t.api]);
|
|
145
163
|
const { busy, failed, take } = useFork();
|
|
146
|
-
|
|
164
|
+
const [q, setQ] = useState('');
|
|
165
|
+
const [cat, setCat] = useState('');
|
|
166
|
+
const [moreCats, setMoreCats] = useState(false);
|
|
167
|
+
const categories = useMemo(() => {
|
|
168
|
+
const seen = new Set();
|
|
169
|
+
const out = [];
|
|
170
|
+
for (const x of list.value) {
|
|
171
|
+
if (x.category && !seen.has(x.category)) {
|
|
172
|
+
seen.add(x.category);
|
|
173
|
+
out.push(x.category);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return out;
|
|
177
|
+
}, [list.value]);
|
|
178
|
+
const allCategoryPills = useMemo(() => [{ id: '', label: say('All') }, ...categories.map((c) => ({ id: c, label: c }))], [categories, say]);
|
|
179
|
+
const catCap = desktop ? 6 : 4;
|
|
180
|
+
const catOverflow = allCategoryPills.length > catCap;
|
|
181
|
+
const visibleCategoryPills = !moreCats && catOverflow
|
|
182
|
+
? (() => {
|
|
183
|
+
const base = allCategoryPills.slice(0, catCap);
|
|
184
|
+
if (base.some((p) => p.id === cat))
|
|
185
|
+
return base;
|
|
186
|
+
const active = allCategoryPills.find((p) => p.id === cat);
|
|
187
|
+
return active ? [...base.slice(0, Math.max(1, catCap - 1)), active] : base;
|
|
188
|
+
})()
|
|
189
|
+
: allCategoryPills;
|
|
190
|
+
const hiddenCatCount = allCategoryPills.length - visibleCategoryPills.length;
|
|
191
|
+
const filtered = useMemo(() => {
|
|
192
|
+
const needle = q.trim().toLowerCase();
|
|
193
|
+
return list.value.filter((x) => {
|
|
194
|
+
if (cat && x.category !== cat)
|
|
195
|
+
return false;
|
|
196
|
+
if (!needle)
|
|
197
|
+
return true;
|
|
198
|
+
return `${x.title} ${x.slug} ${x.framework} ${x.category} ${x.description}`.toLowerCase().includes(needle);
|
|
199
|
+
});
|
|
200
|
+
}, [list.value, cat, q]);
|
|
201
|
+
const narrowed = q.trim() !== '' || cat !== '';
|
|
202
|
+
return (_jsx(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", items: "center", children: _jsxs(YStack, { width: "100%", maxW: 1080, children: [_jsx(Head, { title: say('Templates'), says: `${say('Start from a working app.')} ${say('Picking one copies its repository into a project of yours.')}` }), failed ? (_jsx(SizableText, { size: "$2", color: "$soft", role: "status", pb: "$3", children: failed })) : null, list.value.length > 0 ? (_jsxs(YStack, { gap: "$2.5", children: [_jsx(YStack, { maxW: 420, width: "100%", children: _jsx(Input, { value: q, onChangeText: setQ, placeholder: say('Search templates…'), "aria-label": say('Search templates'), startAdornment: _jsx(Search, { size: 14, color: "$soft" }), endAdornment: q ? (_jsx(XStack, { render: "button", "aria-label": say('Clear search'), onPress: () => setQ(''), minW: 24, minH: 24, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(X, { size: 13, color: "$soft" }) })) : undefined, onKeyDown: (e) => {
|
|
203
|
+
if (e.key === 'Escape' && q)
|
|
204
|
+
setQ('');
|
|
205
|
+
} }) }), categories.length > 1 ? (_jsxs(XStack, { role: "group", "aria-label": say('Category'), gap: "$1.5", rowGap: "$1.5", flexWrap: "wrap", width: "100%", children: [visibleCategoryPills.map((c) => {
|
|
206
|
+
const on = cat === c.id;
|
|
207
|
+
return (_jsx(XStack, { render: "button", "aria-pressed": on, "aria-label": c.label, onPress: () => setCat(c.id), items: "center", px: "$3", py: "$1", minH: 32, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: on ? '500' : '400', color: on ? '$background' : '$soft', children: c.label }) }, c.id || 'all'));
|
|
208
|
+
}), catOverflow ? (_jsx(XStack, { render: "button", "aria-expanded": moreCats, "aria-label": moreCats ? say('Show fewer categories') : say('Show {n} more categories', { n: hiddenCatCount }), onPress: () => setMoreCats((v) => !v), items: "center", px: "$3", py: "$1", minH: 32, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: moreCats ? say('Show less') : say('+{n} more', { n: hiddenCatCount }) }) })) : null] })) : null] })) : null, list.error ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", children: say(list.error.message) }), _jsx(Button, { size: "sm", variant: "outline", onPress: list.reload, children: say('Try again') })] })) : list.loading && !list.value.length ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('Reading templates…') }), _jsx(YStack, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(min(100%, 260px), 1fr))", gap: "$3", width: "100%", children: [0, 1, 2, 3, 4, 5].map((i) => (_jsxs(YStack, { rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", overflow: "hidden", children: [_jsx(Skeleton, { layout: "block", width: "100%", aspectRatio: 16 / 10, rounded: 0 }), _jsxs(YStack, { p: "$3", gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "55%", height: 15, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "85%", height: 12, rounded: "$2" })] })] }, i))) })] })) : !list.value.length ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsxs(YStack, { items: "center", gap: "$1", maxW: 420, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: say('No templates right now') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: `${say('No templates here right now.')} ${say('The whole catalog has more.')}` })] }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", justify: "center", children: [_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.open('https://gallery.hanzo.ai'), children: [_jsx(ExternalLink, { size: 14 }), say('The whole catalog')] }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.go(''), children: say('Start a new run') })] })] })) : !filtered.length ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: say('Nothing matches.') }), narrowed ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => {
|
|
209
|
+
setQ('');
|
|
210
|
+
setCat('');
|
|
211
|
+
}, children: say('Clear filters') })) : null] })) : (_jsx(YStack, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(min(100%, 260px), 1fr))", gap: "$3", width: "100%", children: filtered.map((x) => (_jsxs(Card, { label: say('Start from {template}', { template: x.title }), disabled: Boolean(busy) && busy !== x.slug, onPress: () => void take(x.slug), children: [_jsx(Shot, { slug: x.slug }), _jsxs(YStack, { p: "$3", gap: "$1", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: busy === x.slug ? say('Copying…') : x.title }), x.framework ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: x.framework })) : null, _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: x.description })] })] }, x.slug))) })), _jsx(YStack, { pt: "$5", children: _jsxs(Out, { href: "https://gallery.hanzo.ai", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('The whole catalog') }), _jsx(ExternalLink, { size: 12, opacity: 0.6 })] }) })] }) }));
|
|
147
212
|
}
|
package/lib/suggestions.js
CHANGED
|
@@ -31,6 +31,7 @@ import { Bot, CalendarClock, FileText, Github, MessageSquare, X } from '@hanzogu
|
|
|
31
31
|
import { useI18n } from '@hanzo/i18n/react';
|
|
32
32
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@hanzo/ui';
|
|
33
33
|
import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from 'react';
|
|
34
|
+
import { RING } from './pane.js';
|
|
34
35
|
import { automations, create } from './api/auto.js';
|
|
35
36
|
import { call, Refusal, unwrap } from './api/call.js';
|
|
36
37
|
import { conversations } from './api/conversations.js';
|
|
@@ -207,6 +208,6 @@ function Row({ row: kept, touch, onAct, onDismiss }) {
|
|
|
207
208
|
const row = starter(kept) ? { ...kept, title: t(kept.title), act: 'prompt' in kept.act ? { ...kept.act, prompt: t(kept.act.prompt) } : kept.act } : kept;
|
|
208
209
|
const Mark = MARKS[row.icon];
|
|
209
210
|
const handleAct = () => onAct(row.act, row);
|
|
210
|
-
const button = (_jsxs(XStack, { render: "button", "data-act": row.act.kind, "aria-label": row.title, onPress: handleAct,
|
|
211
|
+
const button = (_jsxs(XStack, { render: "button", "data-act": row.act.kind, "aria-label": row.title, onPress: handleAct, flex: 1, minW: 0, self: "stretch", items: "center", gap: "$3", paddingInlineStart: "$3", rounded: "$4", cursor: "pointer", focusVisibleStyle: RING, children: [_jsx(Mark, { size: 18, color: "$soft" }), _jsx(SizableText, { fontSize: 15, color: "$soft", numberOfLines: 1, shrink: 1, minW: 0, children: row.title })] }));
|
|
211
212
|
return (_jsxs(XStack, { role: "listitem", "data-slot": "suggestion", items: "center", gap: "$1", minH: PITCH, paddingInlineEnd: "$2", rounded: "$4", hoverStyle: { bg: '$hover' }, onPointerEnter: () => setNear(true), onPointerLeave: () => setNear(false), children: [row.summary && !touch ? (_jsxs(HoverCard, { openDelay: 300, closeDelay: 150, children: [_jsx(HoverCardTrigger, { flex: 1, minW: 0, self: "stretch", flexDirection: "row", children: button }), _jsx(HoverCardContent, { side: "top", align: "start", sideOffset: 8, width: 470, maxW: "calc(100vw - 32px)", rounded: "$6", p: "$4", children: _jsx(SizableText, { fontSize: 16, lineHeight: 26, color: "$ink", children: row.summary }) })] })) : (button), _jsx(XStack, { render: "button", "aria-label": t('Dismiss {suggestion}', { suggestion: row.title }), onPress: () => onDismiss(row.id), p: "$1.5", rounded: "$2", cursor: "pointer", opacity: touch || near ? 1 : 0, hoverStyle: { bg: '$hover' }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(X, { size: 16, color: "$soft" }) })] }));
|
|
212
213
|
}
|
package/lib/summary.js
CHANGED
|
@@ -15,12 +15,13 @@ import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
|
15
15
|
import { useI18n } from '@hanzo/i18n/react';
|
|
16
16
|
import { FilePlus2, ListTodo } from '@hanzogui/lucide-icons-2';
|
|
17
17
|
import { Popover, PopoverContent, PopoverTrigger } from '@hanzo/ui';
|
|
18
|
+
import { RING } from './pane.js';
|
|
18
19
|
/** A row's pitch and inset, px: the kit menu's, so this panel reads as every other one. */
|
|
19
20
|
const ROW_H = 32;
|
|
20
21
|
const ROW_PX = 8;
|
|
21
22
|
/** A row of the summary: its mark and its name, one press from a tab. */
|
|
22
23
|
function Line({ icon, children, detail, onPress, quiet = false }) {
|
|
23
|
-
return (_jsxs(XStack, { render: onPress ? 'button' : undefined, role: onPress ? 'button' : undefined, onPress: onPress, items: "center", justify: "flex-start", gap: ROW_PX, px: ROW_PX, minH: ROW_H, width: "100%", rounded: 4, cursor: onPress ? 'pointer' : undefined, hoverStyle: onPress ? { bg: '$hover' } : undefined, focusVisibleStyle:
|
|
24
|
+
return (_jsxs(XStack, { render: onPress ? 'button' : undefined, role: onPress ? 'button' : undefined, onPress: onPress, items: "center", justify: "flex-start", gap: ROW_PX, px: ROW_PX, minH: ROW_H, width: "100%", rounded: 4, cursor: onPress ? 'pointer' : undefined, hoverStyle: onPress ? { bg: '$hover' } : undefined, focusVisibleStyle: RING, children: [icon ? (_jsx(XStack, { width: 16, justify: "center", shrink: 0, opacity: 0.75, children: icon })) : null, _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", py: detail ? '$1' : 0, children: [_jsx(SizableText, { fontSize: 14, color: quiet ? '$soft' : '$ink', numberOfLines: 1, style: { textAlign: 'left' }, children: children }), detail ? (_jsx(SizableText, { fontSize: 12, color: "$soft", numberOfLines: 2, style: { textAlign: 'left' }, children: detail })) : null] })] }));
|
|
24
25
|
}
|
|
25
26
|
/** A section's heading, with what it adds at its end. */
|
|
26
27
|
const Head = ({ children, action }) => (_jsxs(XStack, { items: "center", justify: "space-between", px: ROW_PX, minH: ROW_H, children: [_jsx(SizableText, { fontSize: 13, color: "$soft", children: children }), action] }));
|
|
@@ -56,7 +57,7 @@ export function Summary({ sections, onOpen, label: named, open: controlledOpen,
|
|
|
56
57
|
if (pane) {
|
|
57
58
|
return (_jsx(YStack, { "data-slot": "summary", role: "complementary", "aria-label": label, width: 280, shrink: 0, minH: 0, self: "stretch", p: 8, overflowY: "auto", overflowX: "hidden", children: sections.map((s, i) => (_jsxs(YStack, { pt: i ? 8 : 0, children: [_jsx(Head, { action: s.action, children: s.title }), _jsx(Rows, { section: s, done: onOpen, details: true })] }, s.id))) }));
|
|
58
59
|
}
|
|
59
|
-
const toggle = (_jsx(XStack, { render: "button", "data-slot": "summary-toggle", "aria-label": label, "aria-haspopup": docked ? undefined : 'dialog', "aria-expanded": open, ...{ title: label }, onPress: docked ? () => setOpen(!open) : undefined, width: 32, height: 32, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: open ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle:
|
|
60
|
+
const toggle = (_jsx(XStack, { render: "button", "data-slot": "summary-toggle", "aria-label": label, "aria-haspopup": docked ? undefined : 'dialog', "aria-expanded": open, ...{ title: label }, onPress: docked ? () => setOpen(!open) : undefined, width: 32, height: 32, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: open ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(ListTodo, { size: 16, "aria-hidden": true }) }));
|
|
60
61
|
if (docked)
|
|
61
62
|
return toggle;
|
|
62
63
|
const done = () => {
|
package/lib/sync.js
CHANGED
|
@@ -138,19 +138,19 @@ export function Sync() {
|
|
|
138
138
|
window.clearInterval(id);
|
|
139
139
|
};
|
|
140
140
|
}, [syncing, target, host.org, host.go, picked]);
|
|
141
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", children: [_jsxs(XStack, { px: "$6", pt: "$5", pb: "$2", gap: "$2", items: "center", children: [_jsx(XStack, { render: "button", "aria-label": t('Back to projects'), onPress: back, children: _jsx(SizableText, { size: "$2", color: "$soft", children: t('Projects') }) }), _jsx(SizableText, { size: "$2", color: "$soft", children: "/" }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Sync') })] }), _jsxs(YStack, { flex: 1, items: "center", justify: "center", px: "$6", pb: "$10", gap: "$5", children: [_jsxs(XStack, { justify: "center", gap: "$6", children: [_jsx(Step, { label: t('Select repositories'), done: step === 'access', current: step === 'pick' }), _jsx(Step, { label: t('Repository access'), done: false, current: step === 'access' })] }), _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$5", bg: "$panel", px: "$6", py: "$6", gap: "$4", width: "100%", maxW: 460, children: [step === 'pick' && !owner ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$1", items: "center", children: [_jsx(SizableText, { size: "$5", color: "$ink", children: t('Select repositories') }), _jsx(SizableText, { size: "$2", color: "$soft",
|
|
141
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", children: [_jsxs(XStack, { px: "$6", pt: "$5", pb: "$2", gap: "$2", items: "center", children: [_jsx(XStack, { render: "button", "aria-label": t('Back to projects'), onPress: back, children: _jsx(SizableText, { size: "$2", color: "$soft", children: t('Projects') }) }), _jsx(SizableText, { size: "$2", color: "$soft", children: "/" }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Sync') })] }), _jsxs(YStack, { flex: 1, items: "center", justify: "center", px: "$6", pb: "$10", gap: "$5", children: [_jsxs(XStack, { justify: "center", gap: "$6", children: [_jsx(Step, { label: t('Select repositories'), done: step === 'access', current: step === 'pick' }), _jsx(Step, { label: t('Repository access'), done: false, current: step === 'access' })] }), _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$5", bg: "$panel", px: "$6", py: "$6", gap: "$4", width: "100%", maxW: 460, children: [step === 'pick' && !owner ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$1", items: "center", children: [_jsx(SizableText, { size: "$5", color: "$ink", children: t('Select repositories') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t('Choose repositories to bring into {place}', { place: dest }) })] }), _jsxs(Panel, { children: [_jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Search organizations'), "aria-label": t('Search organizations'), disabled: !signed }), signed && !(list.loading && orgs.length === 0) ? (_jsx(SizableText, { size: "$1", color: "$soft", children: orgs.length === 1 ? t('1 organization') : t('{n} organizations', { n: orgs.length }) })) : null, list.error ? _jsx(Soft, { children: t('The GitHub connection could not be read right now.') }) : null, !signed ? (_jsx(Soft, { children: t('Sign in to choose repositories the GitHub connection can read.') })) : list.loading && rows.length === 0 && orgs.length === 0 ? (_jsx(Soft, { children: t('Reading the connection…') })) : list.error && orgs.length === 0 ? null : shownOrgs.length === 0 ? (_jsx(Soft, { children: orgs.length === 0
|
|
142
142
|
? t('No GitHub account is added to {place} yet. Add organization installs the Hanzo app on one.', { place: dest })
|
|
143
143
|
: t('Nothing matches.') })) : (shownOrgs.map((a) => (_jsxs(XStack, { render: "button", "aria-label": a.blocked ? t('{name} needs an organization admin', { name: a.name }) : t('Open {name}', { name: a.name }), disabled: a.blocked, items: "center", gap: "$2", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", onPress: () => {
|
|
144
144
|
setOwner(a.name);
|
|
145
145
|
setQ('');
|
|
146
|
-
}, children: [_jsx(SizableText, { flex: 1, size: "$2", color: a.blocked ? '$soft' : '$ink', numberOfLines: 1, children: a.name }), a.blocked ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Needs organization admin') })) : (_jsx(ChevronRight, { size: 14, 'data-i18n-mirror': '' }))] }, a.name)))), _jsxs(XStack, { render: "button", "aria-label": t('Add organization'), items: "center", gap: "$2", py: "$2", onPress: () => void addOrg(), disabled: !signed, children: [_jsx(Plus, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Add organization') })] })] })] })) : null, step === 'pick' && owner ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$1", items: "center", children: [_jsx(SizableText, { size: "$5", color: "$ink", children: t('Select repositories') }), _jsx(SizableText, { size: "$2", color: "$soft",
|
|
146
|
+
}, children: [_jsx(SizableText, { flex: 1, size: "$2", color: a.blocked ? '$soft' : '$ink', numberOfLines: 1, children: a.name }), a.blocked ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Needs organization admin') })) : (_jsx(ChevronRight, { size: 14, 'data-i18n-mirror': '' }))] }, a.name)))), _jsxs(XStack, { render: "button", "aria-label": t('Add organization'), items: "center", gap: "$2", py: "$2", onPress: () => void addOrg(), disabled: !signed, children: [_jsx(Plus, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Add organization') })] })] })] })) : null, step === 'pick' && owner ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$1", items: "center", children: [_jsx(SizableText, { size: "$5", color: "$ink", children: t('Select repositories') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t('Choose repositories to bring into {place}', { place: dest }) })] }), _jsxs(Panel, { children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(XStack, { render: "button", "aria-label": t('All organizations'), onPress: () => setOwner(''), children: _jsx(ChevronLeft, { size: 16, 'data-i18n-mirror': '' }) }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: owner })] }), _jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Search repositories'), "aria-label": t('Search repositories') }), _jsxs(XStack, { justify: "space-between", items: "center", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: ofOwner.length === 1 ? t('1 repository') : t('{n} repositories', { n: ofOwner.length }) }), _jsx(XStack, { render: "button", "aria-label": t('Select all'), onPress: selectShown, disabled: shownRepos.length === 0, children: _jsx(SizableText, { size: "$1", color: "$ink", children: t('Select all') }) })] }), shownRepos.length === 0 ? (_jsx(Soft, { children: t('Nothing matches.') })) : (shownRepos.map((r) => (_jsx(RepoRow, { repo: r, on: picked.includes(r.fullName), onPress: () => toggle(r.fullName) }, r.fullName)))), _jsxs(XStack, { render: "button", "aria-label": t('Grant more repositories'), items: "center", gap: "$2", py: "$2", onPress: () => void addOrg(), children: [_jsx(Plus, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Add repositories') })] })] })] })) : null, step === 'access' ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$1", items: "center", children: [_jsx(SizableText, { size: "$5", color: "$ink", children: t('Repository access') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t('Review who can read these repositories') })] }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsxs(XStack, { flex: 1, items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { render: "button", "aria-label": t('Clear the selection'), onPress: () => { setPicked([]); setStep('pick'); }, children: _jsx(X, { size: 12 }) }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: more ? t('{name}, +{n} more', { name: lead, n: more }) : lead })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setStep('pick'), children: t('Edit') })] }), _jsxs(XStack, { justify: "space-between", gap: "$4", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Who gets access') }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('{name} · You', { name: host.person?.name || host.person?.email || t('You') }) })] }), _jsxs(YStack, { gap: "$1", items: "flex-end", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Role') }), _jsx(SizableText, { size: "$2", color: "$ink", children: host.admin ? t('Repository admin') : t('Member') })] })] }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: t('Anyone with access to {place}', { place: dest }) })] })) : null, error ? _jsx(Soft, { children: error }) : null, unbound && step === 'access' ? (_jsxs(Button, { width: "100%", variant: "outline", onPress: () => void addOrg(), children: [_jsx(Plus, { size: 14 }), t('Add organization')] })) : null, step === 'pick' ? (_jsx(Button, { width: "100%", disabled: !owner || picked.length === 0, onPress: () => setStep('access'), children: t('Continue') })) : (_jsxs(YStack, { gap: "$3", items: "center", width: "100%", children: [_jsx(Button, { width: "100%", disabled: busy || syncing || picked.length === 0, onPress: () => void send(), children: syncing || busy
|
|
147
147
|
? t('Syncing…')
|
|
148
148
|
: picked.length === 1
|
|
149
149
|
? t('Sync 1 repository to {place}', { place: dest })
|
|
150
150
|
: t('Sync {n} repositories to {place}', { n: picked.length, place: dest }) }), syncing ? null : (_jsx(XStack, { render: "button", "aria-label": t('Sync later'), onPress: back, children: _jsx(SizableText, { size: "$2", color: "$soft", children: t('Sync later') }) }))] })), !signed ? (_jsx(Button, { width: "100%", onPress: () => host.signIn?.(), children: t('Sign in') })) : null] })] })] }));
|
|
151
151
|
}
|
|
152
152
|
function Step({ label, done, current }) {
|
|
153
|
-
return (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(YStack, { width: 14, height: 14, rounded: 999,
|
|
153
|
+
return (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(YStack, { width: 14, height: 14, rounded: 999, borderWidth: 1, items: "center", justify: "center", children: done ? _jsx(Check, { size: 10, color: "white" }) : null }), _jsx(SizableText, { size: "$1", color: current || done ? '$ink' : '$soft', children: label })] }));
|
|
154
154
|
}
|
|
155
155
|
function Panel({ children }) {
|
|
156
156
|
return (_jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", px: "$3", py: "$2", gap: "$2", maxH: 360, overflow: "scroll", children: children }));
|
package/lib/transcript.js
CHANGED
|
@@ -19,6 +19,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
*/
|
|
20
20
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
21
21
|
import { useI18n } from '@hanzo/i18n/react';
|
|
22
|
+
import { GitBranch } from '@hanzogui/lucide-icons-2';
|
|
22
23
|
import { Button } from '@hanzo/ui';
|
|
23
24
|
import { Feedback } from '@hanzo/ui/agents';
|
|
24
25
|
import { Code, GAP, MEASURE, Message, Step, Thread } from '@hanzo/ui/chat';
|
|
@@ -32,11 +33,12 @@ const tail = (s) => (s.length > TAIL ? `…${s.slice(-TAIL)}` : s);
|
|
|
32
33
|
const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)' };
|
|
33
34
|
/** What a thought is about: its first line, without the markdown that bolds it. */
|
|
34
35
|
const firstLine = (text) => text.trim().split('\n')[0].replace(/[*_#`]/g, '').slice(0, 120);
|
|
35
|
-
|
|
36
|
+
/** A user turn: a tight bubble holding only the text; Show more and Send now sit outside, below it. */
|
|
37
|
+
function UserSaid({ text, after }) {
|
|
36
38
|
const { t } = useI18n();
|
|
37
39
|
const [open, setOpen] = useState(false);
|
|
38
40
|
const long = text.length > 180 || text.includes('\n');
|
|
39
|
-
return (_jsxs(YStack, { gap: "$1", children: [_jsx(YStack, { ...(long && !open ? { maxHeight: 72, overflow: 'hidden' } : null), children: _jsx(Prose, { text: text }) }), long ? (_jsx(XStack, { render: "button", "aria-expanded": open, onPress: () => setOpen((v) => !v), self: "flex-start", px: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$1", color: "$soft", children: open ? t('Show less') : t('Show more') }) })) : null] }));
|
|
41
|
+
return (_jsxs(YStack, { width: "100%", items: "flex-end", gap: "$1", children: [_jsx(Message, { role: "user", children: _jsx(YStack, { ...(long && !open ? { maxHeight: 72, overflow: 'hidden' } : null), children: _jsx(Prose, { text: text }) }) }), long ? (_jsx(XStack, { render: "button", "aria-expanded": open, onPress: () => setOpen((v) => !v), self: "flex-start", px: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$1", color: "$soft", children: open ? t('Show less') : t('Show more') }) })) : null, after] }));
|
|
40
42
|
}
|
|
41
43
|
export function Transcript({ cards, live, empty, header, onApprove, approving = false, onVerdict, onOpen, onDiff, listen, end, view = 'normal', queued = [], onSendQueued, onRun, onAnswer, }) {
|
|
42
44
|
const { t } = useI18n();
|
|
@@ -50,7 +52,7 @@ export function Transcript({ cards, live, empty, header, onApprove, approving =
|
|
|
50
52
|
switch (c.kind) {
|
|
51
53
|
case 'said': {
|
|
52
54
|
if (c.who === 'person')
|
|
53
|
-
return
|
|
55
|
+
return _jsx(UserSaid, { text: c.text }, c.key);
|
|
54
56
|
const made = artifacts(c.text);
|
|
55
57
|
const first = lead(made);
|
|
56
58
|
return (_jsx(Message, { role: "assistant", busy: c.key === last, children: _jsxs(YStack, { gap: "$1", children: [_jsx(Prose, { text: c.text }), c.key === last ? null : (_jsx(Reply, { text: c.text, listen: listen, onOpen: first && onOpen ? () => onOpen(first) : undefined, children: _jsx(Judge, { onVerdict: onVerdict }) }))] }) }, c.key));
|
|
@@ -70,8 +72,13 @@ export function Transcript({ cards, live, empty, header, onApprove, approving =
|
|
|
70
72
|
return (_jsx(Step, { name: !c.files.length ? t('Edited files') : c.files.length > 1 ? `Edited ${c.files.length} files` : edited(c.files).split(' ')[0], detail: !c.files.length ? '' : c.files.length > 1 ? edited(c.files).split(' ').slice(3).join(' ') : edited(c.files).split(' ').slice(1).join(' '), status: state(c.ran), defaultOpen: expandVerbose, "aria-label": c.files.length ? edited(c.files) : t('Edited files'), children: _jsxs(YStack, { gap: "$2", items: "flex-start", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: { whiteSpace: 'pre-wrap' }, children: c.files.length ? c.files.map((f) => `${f.path} ${counted(f)}`.trimEnd()).join('\n') : t('The agent named no files.') }), onDiff ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onDiff, children: t('Open the diff') })) : null] }) }, `${c.key}:${view}`));
|
|
71
73
|
case 'step':
|
|
72
74
|
return (_jsx(Step, { name: t(c.name), detail: c.detail, status: state(c.ran), defaultOpen: c.name === 'Error' || expandVerbose, "aria-label": `${t(c.name)} ${c.detail}`.trim(), children: c.name === 'Error' ? (_jsx(SizableText, { size: "$2", color: "$ink", style: { ...mono, whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' }, children: c.output })) : c.output.trim() ? (_jsx(Code, { language: "output", value: c.output, children: tail(c.output.replace(/\n+$/, '')) })) : undefined }, `${c.key}:${view}`));
|
|
73
|
-
case 'note':
|
|
74
|
-
|
|
75
|
+
case 'note': {
|
|
76
|
+
const noteText = t(c.text);
|
|
77
|
+
if (/^Pushed\s+/i.test(c.text) || /^Pushed\s+/i.test(noteText)) {
|
|
78
|
+
return (_jsx(XStack, { role: "note", self: "flex-start", children: _jsxs(XStack, { items: "center", gap: "$1.5", px: "$2.5", py: "$1", "$platform-web": { display: 'inline-flex' }, children: [_jsx(GitBranch, { size: 12, color: "$soft", shrink: 0, "aria-hidden": true }), _jsx(SizableText, { size: "$1", color: "$soft", children: noteText })] }) }, c.key));
|
|
79
|
+
}
|
|
80
|
+
return (_jsx(SizableText, { size: "$1", color: "$soft", role: "note", children: noteText }, c.key));
|
|
81
|
+
}
|
|
75
82
|
case 'run':
|
|
76
83
|
return (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", "aria-label": t('Coding run'), children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: t('Coding run') }), onRun ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => onRun(c.session), children: t('Open the run') })) : null] }, c.key));
|
|
77
84
|
case 'ask':
|
|
@@ -79,7 +86,7 @@ export function Transcript({ cards, live, empty, header, onApprove, approving =
|
|
|
79
86
|
case 'plan':
|
|
80
87
|
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", "aria-label": t('Plan'), children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Plan') }), _jsx(Prose, { text: c.text }), _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Reply, { text: c.text, listen: listen }), onApprove ? (_jsx(Button, { size: "sm", disabled: approving, onPress: () => onApprove(c.text), children: approving ? t('Starting the build…') : t('Approve and build') })) : null, _jsx(Judge, { onVerdict: onVerdict })] })] }, c.key));
|
|
81
88
|
}
|
|
82
|
-
}), queued.map((q) => (
|
|
89
|
+
}), queued.map((q) => (_jsx(UserSaid, { text: q.text, after: onSendQueued ? (_jsx(XStack, { render: "button", "aria-label": t('Send now'), onPress: () => onSendQueued(q.id), px: "$2", py: "$0.5", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('Send now') }) })) : undefined }, q.id))), end] }));
|
|
83
90
|
}
|
|
84
91
|
/** Say whether what the agent said was good. A verdict that did not land is taken back and says why. */
|
|
85
92
|
function Judge({ onVerdict }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/build",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.127",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
|
|
@@ -55,6 +55,16 @@
|
|
|
55
55
|
"import": "./lib/mind.js",
|
|
56
56
|
"default": "./lib/mind.js"
|
|
57
57
|
},
|
|
58
|
+
"./handoff": {
|
|
59
|
+
"types": "./lib/handoff.d.ts",
|
|
60
|
+
"import": "./lib/handoff.js",
|
|
61
|
+
"default": "./lib/handoff.js"
|
|
62
|
+
},
|
|
63
|
+
"./dev-mode": {
|
|
64
|
+
"types": "./lib/dev-mode.d.ts",
|
|
65
|
+
"import": "./lib/dev-mode.js",
|
|
66
|
+
"default": "./lib/dev-mode.js"
|
|
67
|
+
},
|
|
58
68
|
"./package.json": "./package.json"
|
|
59
69
|
},
|
|
60
70
|
"files": [
|