@hanzo/build 0.2.99 → 0.2.111
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/agents.d.ts +25 -11
- package/lib/api/agents.js +54 -19
- package/lib/api/coding.d.ts +8 -0
- package/lib/api/coding.js +27 -3
- package/lib/api/library.d.ts +6 -2
- package/lib/api/library.js +50 -6
- package/lib/api/sessions.js +16 -1
- package/lib/api/turn.d.ts +2 -0
- package/lib/api/turn.js +12 -0
- package/lib/carry.js +79 -7
- package/lib/customize/agents.d.ts +1 -1
- package/lib/customize/agents.js +78 -13
- package/lib/desk.d.ts +7 -1
- package/lib/desk.js +56 -11
- package/lib/files.js +6 -2
- package/lib/landing.js +38 -34
- package/lib/library.js +36 -8
- package/lib/nav.js +19 -9
- package/lib/panel.js +2 -2
- package/lib/plugins/index.js +1 -1
- package/lib/reply.d.ts +13 -4
- package/lib/reply.js +74 -14
- package/lib/route.d.ts +2 -2
- package/lib/route.js +2 -2
- package/lib/run.js +185 -13
- package/lib/summary.d.ts +11 -1
- package/lib/summary.js +17 -3
- package/lib/transcript.d.ts +12 -1
- package/lib/transcript.js +16 -8
- package/package.json +1 -1
package/lib/customize/agents.js
CHANGED
|
@@ -4,8 +4,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
4
4
|
* what it may spend.
|
|
5
5
|
*
|
|
6
6
|
* Browse is every agent there is to start from: the host's default agents
|
|
7
|
-
* (`cast`) and personas (`personas`), and the
|
|
8
|
-
* calls run on the platform, by name and category. Use makes the org's own
|
|
7
|
+
* (`cast`) and personas (`personas`), by name and category. Use makes the org's own
|
|
9
8
|
* agent from one and opens it; nothing is added any other way, so an org starts
|
|
10
9
|
* with none. An agent is also made from scratch, from the person signed in
|
|
11
10
|
* (Clone yourself) or from anyone named. Yours lists the org's agents. Opening one is its profile page
|
|
@@ -27,7 +26,7 @@ import { ArrowLeft, Upload } from '@hanzogui/lucide-icons-2';
|
|
|
27
26
|
import { Button, Input, Switch, Textarea } from '@hanzo/ui';
|
|
28
27
|
import { ModelPicker } from '@hanzo/ui/models';
|
|
29
28
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
30
|
-
import { agents, ALL, create, draft, EMPTY,
|
|
29
|
+
import { agents, ALL, CAST_CAP, CAST_TASK, create, draft, EMPTY, one, PERIODS, person, profile, remove, SCHEDULES, TRIGGERS, update, use } from '../api/agents.js';
|
|
31
30
|
import { models } from '../api/models.js';
|
|
32
31
|
import { tools } from '../api/tools.js';
|
|
33
32
|
import { useHost, useTarget } from '../host.js';
|
|
@@ -36,9 +35,15 @@ import { useLoad } from './load.js';
|
|
|
36
35
|
import { say } from './say.js';
|
|
37
36
|
import { Add, Choice, Confirm, Empty, Failed, Field, Grid, Line, Mark, matches, mono, Part, Sheet, Soft, Tile, useCount, Visitor } from './ui.js';
|
|
38
37
|
/** How many cards Browse draws at a time. */
|
|
39
|
-
const PAGE =
|
|
38
|
+
const PAGE = 120;
|
|
40
39
|
const ANY = phrase('All');
|
|
41
|
-
|
|
40
|
+
const TRIGGER_LABELS = {
|
|
41
|
+
webhook: { title: phrase('Webhook & API events'), detail: phrase('Wake immediately when an inbound webhook or API event fires.') },
|
|
42
|
+
git: { title: phrase('Git, PR & CI events'), detail: phrase('React proactively to pushes, pull requests, and build failures.') },
|
|
43
|
+
channel: { title: phrase('Channel & message events'), detail: phrase('Listen and respond to Slack, Discord, Telegram, and team channels.') },
|
|
44
|
+
watch: { title: phrase('Proactive anomaly watch'), detail: phrase('Continuously monitor metrics, queues, and alerts 24/7.') },
|
|
45
|
+
};
|
|
46
|
+
/** Categories as Browse offers them: the default agents' first, as listed, then the rest by how many each holds. */
|
|
42
47
|
export function kinds(first, rest) {
|
|
43
48
|
const lead = [...new Set(first.map((c) => c.category))];
|
|
44
49
|
const count = new Map();
|
|
@@ -48,8 +53,8 @@ export function kinds(first, rest) {
|
|
|
48
53
|
return [ANY, ...lead, ...[...count.keys()].sort((a, b) => count.get(b) - count.get(a) || a.localeCompare(b))];
|
|
49
54
|
}
|
|
50
55
|
const money = (m) => `$${(m / 1_000_000).toFixed(m % 10_000 ? 4 : 2).replace(/\.?0+$/, '')}`;
|
|
51
|
-
/** A category as Browse names it: All
|
|
52
|
-
const category = (c, t) => (c === ANY || c === '
|
|
56
|
+
/** A category as Browse names it: All and people, in the reader's words; the rest are the host's, as given. */
|
|
57
|
+
const category = (c, t) => (c === ANY || c === 'Person' ? t(c) : c);
|
|
53
58
|
/**
|
|
54
59
|
* A budget's sentences by its period ('' where the agent names none): whole
|
|
55
60
|
* sentences, so a language says the period its own way.
|
|
@@ -81,7 +86,6 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
|
|
|
81
86
|
const signed = Boolean(host.person);
|
|
82
87
|
const browsing = view === 'discover';
|
|
83
88
|
const mine = useLoad(signed ? () => agents(target) : null, [], [target, signed]);
|
|
84
|
-
const offered = useLoad(browsing ? () => presets(target) : null, [], [target, view]);
|
|
85
89
|
const figures = useLoad(browsing && host.personas ? host.personas : null, [], [view]);
|
|
86
90
|
useCount(mine.value.length, onCount);
|
|
87
91
|
const [note, setNote] = useState('');
|
|
@@ -89,6 +93,7 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
|
|
|
89
93
|
const [more, setMore] = useState(PAGE);
|
|
90
94
|
const [using, setUsing] = useState(null);
|
|
91
95
|
const [making, setMaking] = useState(null);
|
|
96
|
+
const [electing, setElecting] = useState(null);
|
|
92
97
|
useEffect(() => setMore(PAGE), [q, kind]);
|
|
93
98
|
const opened = (a) => host.go(path({ kind: 'agent', name: a.name }));
|
|
94
99
|
const take = async (c) => {
|
|
@@ -111,11 +116,13 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
|
|
|
111
116
|
setNote(t('{name} is saved', { name: a.name }));
|
|
112
117
|
} })) : null;
|
|
113
118
|
if (browsing) {
|
|
114
|
-
const first =
|
|
119
|
+
const first = host.cast ?? [];
|
|
115
120
|
const all = [...first, ...figures.value];
|
|
116
121
|
const shown = all.filter((c) => (kind === ANY || c.category === kind) && matches(q, c.title, c.name, c.description, c.category));
|
|
117
|
-
const
|
|
118
|
-
|
|
122
|
+
const topAgents = kind === ANY ? shown.filter((c) => c.category !== 'Bot') : shown;
|
|
123
|
+
const botPresets = kind === ANY ? shown.filter((c) => c.category === 'Bot') : [];
|
|
124
|
+
const card = (c) => (_jsx(Tile, { title: c.title, detail: c.description === c.title || c.description === c.category ? undefined : c.description, meta: [category(c.category, t), c.executionMode === 'long-running' ? t('24/7 · Proactive · Event-driven') : '', c.schedule].filter(Boolean).join(' · '), mark: _jsx(Mark, { name: c.title, size: 40, logo: c.avatar }), onOpen: signed ? () => setElecting(c) : undefined, action: signed ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(XStack, { "$max-sm": { display: 'none' }, children: _jsx(Button, { size: "sm", variant: "ghost", disabled: using !== null, "aria-label": t('Elect {name} to run 24/7', { name: c.title }), onPress: () => setElecting(c), children: t('24/7') }) }), _jsx(Add, { name: c.title, use: true, added: false, busy: using !== null, onPress: () => void take(c) })] })) : undefined }, `${c.category}/${c.name}/${c.title}`));
|
|
125
|
+
return (_jsxs(YStack, { gap: "$3", children: [signed ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onAdding(true), children: t('Start from scratch') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('self'), children: t('Clone yourself') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('person'), children: t('Create from a person') }), first.length ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setElecting(first[0]), children: t('Elect 24/7 preset') })) : null] })) : null, _jsx(XStack, { overflowX: "auto", overflowY: "hidden", pb: "$1", children: _jsx(Choice, { label: t('Category'), value: kind, options: kinds(first, figures.value).map((id) => ({ id, label: category(id, t) })), onChange: setKind }) }), _jsx(Line, { children: note }), shown.length ? (_jsxs(YStack, { gap: "$5", children: [topAgents.length ? (_jsx(Grid, { label: kind === 'Bot' ? t('Bots to start from') : t('Agents to start from'), children: topAgents.slice(0, more).map(card) })) : null, botPresets.length ? (_jsx(Part, { title: t('Bots'), detail: t('Autonomous 24/7, proactive and event-driven workers. Select and elect any agent or bot preset to run continuously on a schedule or when events fire.'), children: _jsx(Grid, { label: t('Bots to start from'), children: botPresets.slice(0, more).map(card) }) })) : null] })) : figures.loading ? null : (_jsx(Soft, { children: t('No agent matches “{q}”.', { q: q.trim() }) })), topAgents.length > more || botPresets.length > more ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setMore(more + PAGE), children: t('More') }) })) : null, figures.error ? _jsx(Failed, { error: figures.error, onRetry: figures.reload }) : figures.loading ? _jsx(Soft, { children: t('Loading…') }) : null, editor, making ? _jsx(Person, { self: making === 'self', onClose: () => setMaking(null), onMade: opened }) : null, electing ? _jsx(Elect, { preset: electing, all: first, onClose: () => setElecting(null), onElected: opened }) : null] }));
|
|
119
126
|
}
|
|
120
127
|
if (!signed) {
|
|
121
128
|
return _jsx(Visitor, { children: t('Sign in to see your agents.') });
|
|
@@ -123,6 +130,8 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
|
|
|
123
130
|
const shown = mine.value.filter((a) => matches(q, a.name, a.description, a.model));
|
|
124
131
|
return (_jsxs(YStack, { gap: "$3", children: [_jsx(Line, { children: note }), mine.error && !mine.value.length ? (_jsx(Failed, { error: mine.error, onRetry: mine.reload })) : mine.loading && !mine.value.length ? (_jsx(Soft, { children: t('Loading your agents…') })) : !mine.value.length ? (_jsxs(Empty, { title: t('No agents yet'), detail: "", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onView('discover'), children: t('Browse agents') }), _jsx(Button, { size: "sm", onPress: () => onAdding(true), children: t('New agent') })] })) : !shown.length ? (_jsx(Soft, { children: t('No agent of yours matches “{q}”.', { q: q.trim() }) })) : (_jsx(Grid, { label: t('Your agents'), children: shown.map((a) => (_jsx(Tile, { title: a.name, detail: a.description || t('No description.'), meta: [
|
|
125
132
|
a.model,
|
|
133
|
+
a.executionMode === 'long-running' ? t('24/7') : '',
|
|
134
|
+
a.schedule || '',
|
|
126
135
|
a.runs === 1 ? t('1 run') : t('{n} runs', { n: a.runs }),
|
|
127
136
|
reach(a, t),
|
|
128
137
|
a.cap ? t(SPENT[a.period], { spent: money(a.spent), cap: money(a.cap) }) : '',
|
|
@@ -130,6 +139,51 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
|
|
|
130
139
|
.filter(Boolean)
|
|
131
140
|
.join(' · '), mark: _jsx(Face, { agent: a, cast: host.cast ?? [] }), onOpen: () => opened(a) }, a.id || a.name))) })), editor] }));
|
|
132
141
|
}
|
|
142
|
+
/** Elect an agent or bot preset to run autonomously 24/7, proactively on a schedule, and event-driven. */
|
|
143
|
+
function Elect({ preset, all, onClose, onElected, }) {
|
|
144
|
+
const { t } = useI18n();
|
|
145
|
+
const target = useTarget();
|
|
146
|
+
const [picked, setPicked] = useState(preset);
|
|
147
|
+
const [autonomous, setAutonomous] = useState(true);
|
|
148
|
+
const [schedule, setSchedule] = useState(preset.schedule || '*/15 * * * *');
|
|
149
|
+
const [triggers, setTriggers] = useState(preset.triggers?.length ? preset.triggers : ['webhook', 'git', 'channel', 'watch']);
|
|
150
|
+
const [cap, setCap] = useState(CAST_CAP);
|
|
151
|
+
const [task, setTask] = useState(CAST_TASK);
|
|
152
|
+
const [period, setPeriod] = useState('month');
|
|
153
|
+
const [working, setWorking] = useState(false);
|
|
154
|
+
const [note, setNote] = useState('');
|
|
155
|
+
const selectPreset = (c) => {
|
|
156
|
+
setPicked(c);
|
|
157
|
+
setSchedule(c.schedule || '*/15 * * * *');
|
|
158
|
+
setTriggers(c.triggers?.length ? c.triggers : ['webhook', 'git', 'channel', 'watch']);
|
|
159
|
+
};
|
|
160
|
+
const toggleTrigger = (tr, yes) => {
|
|
161
|
+
setTriggers((prev) => (yes ? [...new Set([...prev, tr])] : prev.filter((x) => x !== tr)));
|
|
162
|
+
};
|
|
163
|
+
const save = async () => {
|
|
164
|
+
setWorking(true);
|
|
165
|
+
setNote('');
|
|
166
|
+
try {
|
|
167
|
+
const created = await use(target, picked, window.location.href, {
|
|
168
|
+
executionMode: autonomous ? 'long-running' : 'one-shot',
|
|
169
|
+
schedule: autonomous ? schedule.trim() || '*/15 * * * *' : undefined,
|
|
170
|
+
triggers: autonomous ? triggers : undefined,
|
|
171
|
+
cap,
|
|
172
|
+
task,
|
|
173
|
+
period,
|
|
174
|
+
});
|
|
175
|
+
onElected(created);
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
setNote(say(e, t));
|
|
179
|
+
setWorking(false);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return (_jsxs(Sheet, { title: t('Elect 24/7 autonomous preset'), open: true, onOpenChange: (o) => !o && onClose(), width: 680, children: [_jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Mark, { name: picked.title, size: 44, logo: picked.avatar }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$3", color: "$ink", children: picked.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: picked.description || picked.category })] })] }), all.length > 1 ? (_jsx(Field, { label: t('Preset'), hint: t('Select any Agent or Bot preset to elect as an autonomous 24/7 worker.'), children: _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", maxH: 136, overflow: "scroll", p: "$1", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: all.map((c) => {
|
|
183
|
+
const active = c.name === picked.name && c.category === picked.category;
|
|
184
|
+
return (_jsx(Button, { size: "sm", variant: active ? 'primary' : 'ghost', onPress: () => selectPreset(c), children: c.title }, `${c.category}/${c.name}`));
|
|
185
|
+
}) }) })) : null, _jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Run autonomously 24/7') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Stays active continuously (long-running), waking proactively on its schedule and when events fire.') })] }), _jsx(Switch, { checked: autonomous, onCheckedChange: setAutonomous, "aria-label": t('Run autonomously 24/7') })] }), autonomous ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t('Proactive schedule'), hint: t('Choose how often this agent wakes proactively, or enter any 5-field cron expression.'), children: _jsxs(YStack, { gap: "$2", children: [_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) => (_jsx(Button, { size: "sm", variant: schedule.trim() === s.cron ? 'primary' : 'outline', onPress: () => setSchedule(s.cron), children: t(s.label) }, s.cron))) }), _jsx(Input, { value: schedule, onChangeText: setSchedule, placeholder: "*/15 * * * *", "aria-label": t('Proactive schedule') })] }) }), _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Event-driven triggers') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: TRIGGERS.map((tr, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t(TRIGGER_LABELS[tr].title) }), _jsx(SizableText, { size: "$1", color: "$soft", children: t(TRIGGER_LABELS[tr].detail) })] }), _jsx(Switch, { checked: triggers.includes(tr), onCheckedChange: (v) => toggleTrigger(tr, v), "aria-label": t(TRIGGER_LABELS[tr].title) })] }, tr))) })] })] })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Budget') }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", rowGap: "$2", items: "flex-end", children: [_jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t(EACH[period]) }), _jsx(Input, { value: cap, onChangeText: setCap, placeholder: "10", "aria-label": t('Budget each period'), inputMode: "decimal" })] }), _jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('One run, USD') }), _jsx(Input, { value: task, onChangeText: setTask, placeholder: "1", "aria-label": t('Budget for one run'), inputMode: "decimal" })] }), _jsx(Choice, { label: t('Period'), value: period, options: PERIODS.map((p) => ({ id: p, label: t(PERIOD[p]) })), onChange: (p) => setPeriod(p) })] })] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(XStack, { flex: 1 }), _jsx(Button, { size: "sm", variant: "ghost", onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working || (autonomous && !schedule.trim()), onPress: () => void save(), children: autonomous ? t('Elect & Run 24/7') : t('Create') })] })] }));
|
|
186
|
+
}
|
|
133
187
|
/** Clone yourself, or anyone named: a name, who they are, and writing of theirs, pasted or uploaded. */
|
|
134
188
|
function Person({ self, onClose, onMade }) {
|
|
135
189
|
const { t } = useI18n();
|
|
@@ -181,7 +235,11 @@ export function Profile({ name }) {
|
|
|
181
235
|
const [editing, setEditing] = useState(false);
|
|
182
236
|
const back = () => host.go(path({ kind: 'customize', tab: 'agents' }));
|
|
183
237
|
const a = got.value?.agent;
|
|
184
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { render: "button", onPress: back, items: "center", gap: "$1.5", self: "flex-start", cursor: "pointer", "aria-label": t('Back to agents'), children: [_jsx(ArrowLeft, { size: 14, color: "$soft", 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Agents') })] }), !host.person ? (_jsx(Visitor, { children: t('Sign in to see this agent.') })) : got.error && !a ? (_jsx(Failed, { error: got.error, onRetry: got.reload })) : !a ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { items: "center", gap: "$4", children: [_jsx(Face, { agent: a, cast: host.cast ?? [], size: 64 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(SizableText, { render: "h1", size: "$7", color: "$ink", numberOfLines: 1, children: a.name }), _jsx(SizableText, { size: "$3", color: "$soft", children: a.description || t('No role written yet.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditing(true), children: t('Edit') })] }), _jsx(Part, { title: t('Model'), detail: a.model || t('The deployment’s default') }), _jsx(Part, { title: t('
|
|
238
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { render: "button", onPress: back, items: "center", gap: "$1.5", self: "flex-start", cursor: "pointer", "aria-label": t('Back to agents'), children: [_jsx(ArrowLeft, { size: 14, color: "$soft", 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Agents') })] }), !host.person ? (_jsx(Visitor, { children: t('Sign in to see this agent.') })) : got.error && !a ? (_jsx(Failed, { error: got.error, onRetry: got.reload })) : !a ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { items: "center", gap: "$4", children: [_jsx(Face, { agent: a, cast: host.cast ?? [], size: 64 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(SizableText, { render: "h1", size: "$7", color: "$ink", numberOfLines: 1, children: a.name }), _jsx(SizableText, { size: "$3", color: "$soft", children: a.description || t('No role written yet.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditing(true), children: t('Edit') })] }), _jsx(Part, { title: t('Model'), detail: a.model || t('The deployment’s default') }), _jsx(Part, { title: t('Autonomous & Event-Driven'), detail: a.executionMode === 'long-running'
|
|
239
|
+
? [t('Runs autonomously 24/7'), a.schedule ? `${t('Schedule')}: ${a.schedule}` : '', a.triggers?.length ? `${t('Triggers')}: ${a.triggers.join(', ')}` : '']
|
|
240
|
+
.filter(Boolean)
|
|
241
|
+
.join(' · ')
|
|
242
|
+
: t('One-shot (on-demand). Edit to enable 24/7 proactive and event-driven execution.') }), _jsx(Part, { title: t('Instructions'), detail: a.instructions ? '' : t('None written: it runs on its model alone.'), children: a.instructions ? (_jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", maxH: 320, overflow: "scroll", children: _jsx(SizableText, { size: "$2", color: "$ink", style: { whiteSpace: 'pre-wrap' }, children: a.instructions }) })) : null }), _jsx(Part, { title: t('Tools'), detail: a.tools.includes(ALL) ? t('Every tool the fleet’s MCP server serves.') : a.tools.length ? a.tools.join(', ') : t('None: it calls no tool.') }), _jsx(Part, { title: t('Budget'), detail: a.cap ? t(BUDGET[a.period], { spent: money(a.spent), cap: money(a.cap), task: money(a.task) }) : t('No budget set.') }), _jsx(Part, { title: t('Runs'), detail: a.runs ? t('{runs} in all; the latest {n} below.', { runs: a.runs, n: Math.min(a.runs, got.value.runs.length) }) : t('It has not run yet.'), children: got.value.runs.map((r) => (_jsxs(XStack, { gap: "$3", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", items: "flex-start", children: [_jsx(SizableText, { size: "$1", color: r.status === 'ok' ? '$soft' : '$bad', width: 44, shrink: 0, children: r.status === 'ok' ? t('ok') : t('failed') }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: r.input || t('(no input)') }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: r.status === 'ok' ? r.output : r.error })] }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: [r.model, r.at ? new Date(r.at).toLocaleString() : ''].filter(Boolean).join(' · ') })] }, r.id))) })] }))] }), editing && a ? (_jsx(Editor, { agent: a, onClose: () => setEditing(false), onSaved: () => {
|
|
185
243
|
setEditing(false);
|
|
186
244
|
got.reload();
|
|
187
245
|
}, onDeleted: back })) : null] }));
|
|
@@ -235,7 +293,14 @@ function Editor({ agent, onClose, onSaved, onDeleted, }) {
|
|
|
235
293
|
? t('Every tool the fleet’s MCP server serves when it runs.')
|
|
236
294
|
: d.tools.length
|
|
237
295
|
? t('{n} chosen. It can call only these.', { n: d.tools.length })
|
|
238
|
-
: t('None chosen: it can call no tool.') })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Every tool') }), _jsx(Switch, { checked: every, onCheckedChange: (v) => set({ tools: v ? [ALL] : [] }), "aria-label": t('Every tool') })] }), every ? null : (_jsxs(_Fragment, { children: [_jsx(Input, { value: find, onChangeText: setFind, placeholder: t('Find a tool…'), "aria-label": t('Find a tool') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", maxH: 240, overflow: "scroll", children: on.loading && !on.value.length ? (_jsx(Soft, { children: t('Loading the tools that are on…') })) : on.error && !on.value.length ? (_jsx(Failed, { error: on.error, onRetry: on.reload })) : !shownTools.length ? (_jsx(Soft, { children: choices.length ? t('No tool matches.') : t('No tool is on for your organization yet. Add skills or connectors first.') })) : (shownTools.map((x, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", style: mono, numberOfLines: 1, children: x.name }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [x.source, x.description].filter(Boolean).join(' · ') })] }), _jsx(Switch, { checked: d.tools.includes(x.name), onCheckedChange: (v) => pick(x.name, v), "aria-label": t('Use {name}', { name: x.name }) })] }, x.name)))) })] }))] }), _jsxs(YStack, { gap: "$2", children: [
|
|
296
|
+
: t('None chosen: it can call no tool.') })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Every tool') }), _jsx(Switch, { checked: every, onCheckedChange: (v) => set({ tools: v ? [ALL] : [] }), "aria-label": t('Every tool') })] }), every ? null : (_jsxs(_Fragment, { children: [_jsx(Input, { value: find, onChangeText: setFind, placeholder: t('Find a tool…'), "aria-label": t('Find a tool') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", maxH: 240, overflow: "scroll", children: on.loading && !on.value.length ? (_jsx(Soft, { children: t('Loading the tools that are on…') })) : on.error && !on.value.length ? (_jsx(Failed, { error: on.error, onRetry: on.reload })) : !shownTools.length ? (_jsx(Soft, { children: choices.length ? t('No tool matches.') : t('No tool is on for your organization yet. Add skills or connectors first.') })) : (shownTools.map((x, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", style: mono, numberOfLines: 1, children: x.name }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [x.source, x.description].filter(Boolean).join(' · ') })] }), _jsx(Switch, { checked: d.tools.includes(x.name), onCheckedChange: (v) => pick(x.name, v), "aria-label": t('Use {name}', { name: x.name }) })] }, x.name)))) })] }))] }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Autonomous & Event-Driven (24/7)') }), _jsx(SizableText, { size: "$1", color: "$soft", children: d.executionMode === 'long-running'
|
|
297
|
+
? t('Runs autonomously 24/7 on its proactive schedule and event triggers.')
|
|
298
|
+
: t('One-shot (on-demand). Turn on to run autonomously 24/7.') })] }), _jsx(Switch, { checked: d.executionMode === 'long-running', onCheckedChange: (v) => set(v
|
|
299
|
+
? { executionMode: 'long-running', schedule: d.schedule || '*/15 * * * *', triggers: d.triggers?.length ? d.triggers : ['webhook', 'git', 'channel', 'watch'] }
|
|
300
|
+
: { executionMode: undefined, schedule: undefined, triggers: undefined }), "aria-label": t('Run autonomously 24/7') })] }), d.executionMode === 'long-running' ? (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Proactive schedule (5-field cron)') }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) => (_jsx(Button, { size: "sm", variant: (d.schedule ?? '').trim() === s.cron ? 'primary' : 'outline', onPress: () => set({ schedule: s.cron }), children: t(s.label) }, s.cron))) }), _jsx(Input, { value: d.schedule ?? '', onChangeText: (v) => set({ schedule: v }), placeholder: "*/15 * * * *", "aria-label": t('Proactive schedule') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Event-driven triggers') }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: TRIGGERS.map((tr) => {
|
|
301
|
+
const active = (d.triggers ?? []).includes(tr);
|
|
302
|
+
return (_jsx(Button, { size: "sm", variant: active ? 'primary' : 'outline', onPress: () => set({ triggers: active ? (d.triggers ?? []).filter((x) => x !== tr) : [...(d.triggers ?? []), tr] }), children: t(TRIGGER_LABELS[tr].title) }, tr));
|
|
303
|
+
}) })] })) : null] }), _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Budget') }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", rowGap: "$2", items: "flex-end", children: [_jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t(EACH[d.period]) }), _jsx(Input, { value: d.cap, onChangeText: (v) => set({ cap: v }), placeholder: "10", "aria-label": t('Budget each period'), inputMode: "decimal" })] }), _jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('One run, USD') }), _jsx(Input, { value: d.task, onChangeText: (v) => set({ task: v }), placeholder: "1", "aria-label": t('Budget for one run'), inputMode: "decimal" })] }), _jsx(Choice, { label: t('Period'), value: d.period, options: PERIODS.map((p) => ({ id: p, label: t(PERIOD[p]) })), onChange: (p) => set({ period: p }) })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: [full.value && full.value.cap ? t(SO_FAR[full.value.period], { spent: money(full.value.spent) }) : '', t('A run stops at either limit.')].filter(Boolean).join(' ') })] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", items: "center", children: [agent && onDeleted ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => setAsking(true), children: t('Delete') })) : null, _jsx(XStack, { flex: 1 }), _jsx(Button, { size: "sm", variant: "ghost", onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working, onPress: () => void save(), children: agent ? t('Save') : t('Create') })] }), agent && onDeleted ? (_jsx(Confirm, { what: agent.name, says: t('The agent and every run recorded against it are removed.'), open: asking, onOpenChange: setAsking, onYes: async () => {
|
|
239
304
|
await remove(target, agent.id || agent.name);
|
|
240
305
|
onDeleted();
|
|
241
306
|
} })) : null] })) }));
|
package/lib/desk.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Event } from './api/sessions.ts';
|
|
|
3
3
|
import type { Deck, Tabs } from './tabs.ts';
|
|
4
4
|
/** A run's panel before anyone has arranged it: what a run is read by, the terminal chosen. */
|
|
5
5
|
export declare const SEED: Tabs;
|
|
6
|
-
export declare function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, }: {
|
|
6
|
+
export declare function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, envColumn, splitPanes, onCloseSplitPane, onExpandSplitPane, }: {
|
|
7
7
|
id: string;
|
|
8
8
|
repo: string;
|
|
9
9
|
branch: string;
|
|
@@ -33,4 +33,10 @@ export declare function Desk({ id, repo, branch, base, environment, mode, pr, ti
|
|
|
33
33
|
side: Deck;
|
|
34
34
|
sheet: boolean;
|
|
35
35
|
onHide: () => void;
|
|
36
|
+
/** Show the Environment inspection column beside the dock panes. */
|
|
37
|
+
envColumn?: boolean;
|
|
38
|
+
/** Active split panes in the 2x2 multi-pane dock grid ('terminal' | 'preview' | 'diff' | 'files'). */
|
|
39
|
+
splitPanes?: string[];
|
|
40
|
+
onCloseSplitPane?: (paneId: string) => void;
|
|
41
|
+
onExpandSplitPane?: (paneId: string) => void;
|
|
36
42
|
}): import("react").JSX.Element;
|
package/lib/desk.js
CHANGED
|
@@ -14,17 +14,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
*/
|
|
15
15
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
16
16
|
import { useI18n } from '@hanzo/i18n/react';
|
|
17
|
-
import { ExternalLink, Info, MoreHorizontal, RefreshCcw } from '@hanzogui/lucide-icons-2';
|
|
18
|
-
import { Button, DropdownMenu } from '@hanzo/ui';
|
|
17
|
+
import { ChevronRight, ExternalLink, Folder, GitBranch, GitPullRequest, Globe, Info, Laptop, Maximize2, MoreHorizontal, RefreshCcw, Square, SquareTerminal, X } from '@hanzogui/lucide-icons-2';
|
|
18
|
+
import { Button, DropdownMenu, Input, Switch } from '@hanzo/ui';
|
|
19
19
|
import { PreviewFrame } from '@hanzo/ui/agents';
|
|
20
20
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
21
|
+
import { read as readChanges } from './api/changes.js';
|
|
21
22
|
import { park, ports as listening, preview, sandbox as look, wake } from './api/sandbox.js';
|
|
22
|
-
import { failure, shell } from './api/turn.js';
|
|
23
|
+
import { cards, failure, shell, steps } from './api/turn.js';
|
|
24
|
+
import { useKept, useRead } from './data.js';
|
|
23
25
|
import { Door } from './door.js';
|
|
24
26
|
import { Environment } from './environment.js';
|
|
25
27
|
import { Artifacts, Files } from './files.js';
|
|
26
28
|
import { Git } from './git.js';
|
|
27
|
-
import { useTarget } from './host.js';
|
|
29
|
+
import { useHost, useTarget } from './host.js';
|
|
28
30
|
import { away, Out } from './out.js';
|
|
29
31
|
import { Panel } from './panel.js';
|
|
30
32
|
/** A run's panel before anyone has arranged it: what a run is read by, the terminal chosen. */
|
|
@@ -41,7 +43,7 @@ export const SEED = {
|
|
|
41
43
|
/** How often the sandbox's state, and what it serves, is read while the panel is open. */
|
|
42
44
|
const EVERY = 10_000;
|
|
43
45
|
const PORTS = 5_000;
|
|
44
|
-
export function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, }) {
|
|
46
|
+
export function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, envColumn = false, splitPanes = [], onCloseSplitPane, onExpandSplitPane, }) {
|
|
45
47
|
const { t: say } = useI18n();
|
|
46
48
|
const name = repo.split('/').filter(Boolean).pop() || repo;
|
|
47
49
|
const lines = shell(events);
|
|
@@ -72,9 +74,25 @@ export function Desk({ id, repo, branch, base, environment, mode, pr, title, pro
|
|
|
72
74
|
render: () => (_jsxs(YStack, { gap: "$2", children: [_jsx(Environment, { repo: name, busy: live && mode === 'setup' }), _jsx(SizableText, { size: "$2", color: "$ink", pt: "$4", children: say('This run') }), _jsx(Fact, { label: say('Run'), value: id }), _jsx(Fact, { label: say('Repository'), value: name || '—' }), _jsx(Fact, { label: say('Branch'), value: branch || '—' }), _jsx(Fact, { label: say('Base'), value: base || '—' }), _jsx(Fact, { label: say('Runs on'), value: environment || 'sandbox' }), _jsx(Fact, { label: say('Sandbox'), value: sandbox || '—' }), _jsx(Fact, { label: say('Mode'), value: mode || 'build' })] })),
|
|
73
75
|
},
|
|
74
76
|
];
|
|
75
|
-
|
|
77
|
+
const panelNode = splitPanes.length >= 2 && !sheet ? (_jsx(YStack, { flex: 1, minW: 0, minH: 0, display: "grid", gridTemplateColumns: splitPanes.length > 1 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', gridTemplateRows: splitPanes.length > 2 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', bg: "$background", children: splitPanes.map((pid, idx) => {
|
|
78
|
+
const k = kinds.find((x) => x.id === pid);
|
|
79
|
+
if (!k)
|
|
80
|
+
return null;
|
|
81
|
+
const headerTitle = pid === 'diff'
|
|
82
|
+
? `${base || 'main'} → ${branch || 'HEAD'}`
|
|
83
|
+
: pid === 'terminal'
|
|
84
|
+
? `${say('Terminal')} ${name || 'workspace'}`
|
|
85
|
+
: pid === 'preview'
|
|
86
|
+
? say('New tab')
|
|
87
|
+
: k.label;
|
|
88
|
+
return (_jsxs(YStack, { minW: 0, minH: 0, borderLeftWidth: idx % 2 === 1 ? 1 : 0, borderTopWidth: idx >= 2 ? 1 : 0, borderColor: "$borderColor", display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", children: [_jsxs(XStack, { px: "$2.5", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", minH: 36, children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: headerTitle }), onExpandSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Expand {pane}', { pane: k.label }), onPress: () => onExpandSplitPane(pid), p: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(Maximize2, { size: 13, opacity: 0.7 }) })) : null, onCloseSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Close {pane}', { pane: k.label }), onPress: () => onCloseSplitPane(pid), p: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(X, { size: 14, opacity: 0.7 }) })) : null] }), _jsx(YStack, { flex: 1, minH: 0, overflow: k.bleed ? 'hidden' : 'scroll', ...(k.bleed ? null : { p: '$3' }), children: k.render() })] }, pid));
|
|
89
|
+
}) })) : (_jsx(Panel, { side: side, kinds: kinds, sheet: sheet, onHide: onHide, label: say('Run details'),
|
|
76
90
|
// An empty tab offers what this run made: its site and its pull request.
|
|
77
91
|
suggested: [...(site ? [{ title: name || site, url: site }] : []), ...(pr.href ? [{ title: say('Pull request {pr}', { pr: pr.label }), url: pr.href }] : [])], bar: sandbox ? _jsx(Held, { box: box, live: live }) : null, menu: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Run actions'), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [...menu, { key: 'details', label: say('Details'), icon: _jsx(Info, { size: 16 }), onSelect: environ }] }) }));
|
|
92
|
+
if (envColumn && !sheet) {
|
|
93
|
+
return (_jsxs(XStack, { flex: 1, minW: 0, minH: 0, width: "100%", height: "100%", children: [_jsx(EnvironmentInspection, { id: id, repo: repo, name: name, branch: branch, environment: environment, pr: pr, title: title, events: events, live: live, onOpenEnvironment: environ, onOpenDiff: () => side.open({ kind: 'diff', title: say('Diff') }) }), _jsx(YStack, { flex: 1, minW: 0, minH: 0, borderLeftWidth: 1, borderColor: "$borderColor", children: panelNode })] }));
|
|
94
|
+
}
|
|
95
|
+
return panelNode;
|
|
78
96
|
}
|
|
79
97
|
/**
|
|
80
98
|
* The run's sandbox as it stands, and what moves it. It is read while the pane is
|
|
@@ -228,10 +246,18 @@ function Browser({ sandbox, held, site, live }) {
|
|
|
228
246
|
return () => window.removeEventListener('message', hear);
|
|
229
247
|
}, [src, port, say]);
|
|
230
248
|
const tab = () => away(preview(t, sandbox, port)).catch((e) => setWhy(e.message));
|
|
249
|
+
const detect = () => {
|
|
250
|
+
if (!sandbox)
|
|
251
|
+
return;
|
|
252
|
+
void listening(t, sandbox).then((ps) => {
|
|
253
|
+
setOpen(ps);
|
|
254
|
+
setPort((p) => (ps.some((x) => x.port === p) ? p : (ps[0]?.port ?? 0)));
|
|
255
|
+
}, () => undefined);
|
|
256
|
+
};
|
|
231
257
|
if (!running)
|
|
232
|
-
return _jsx(Site, { site: site, live: live, held: held });
|
|
258
|
+
return _jsx(Site, { site: site, live: live, held: held, onDetect: detect });
|
|
233
259
|
if (!port)
|
|
234
|
-
return _jsx(Site, { site: site, live: live, held: held });
|
|
260
|
+
return _jsx(Site, { site: site, live: live, held: held, onDetect: detect });
|
|
235
261
|
const host = open.find((p) => p.port === port)?.host ?? '';
|
|
236
262
|
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { render: "button", "aria-label": say('Reload the page'), onPress: () => setAttempt((a) => a + 1), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), open.length > 1 ? (_jsx(XStack, { gap: "$1", children: open.map((p) => (_jsx(XStack, { render: "button", "aria-label": say('Port {port}', { port: p.port }), onPress: () => setPort(p.port), px: "$2", py: "$1", rounded: "$2", bg: p.port === port ? '$hover' : 'transparent', children: _jsx(SizableText, { size: "$1", color: p.port === port ? '$ink' : '$soft', children: String(p.port) }) }, p.port))) })) : null, _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: host || say('port {port}', { port }) }), _jsx(XStack, { render: "button", "aria-label": say('Open in a new tab'), onPress: () => void tab(), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 14 }) })] }), why ? (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$2", p: "$6", children: [_jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center' }, children: why }), _jsxs(XStack, { gap: "$2", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => setAttempt((a) => a + 1), children: say('Retry') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => void tab(), children: say('Open in a new tab') })] })] })) : src ? (_jsx("iframe", { ref: frame, src: src, title: say('What the run serves on port {port}', { port }), sandbox: "allow-scripts allow-same-origin allow-forms allow-popups", style: { border: 0, width: '100%', height: '100%', display: 'block', background: '#fff' } })) : (_jsx(YStack, { flex: 1, items: "center", justify: "center", children: _jsx(SizableText, { size: "$2", color: "$soft", children: say('Opening port {port}…', { port }) }) }))] }));
|
|
237
263
|
}
|
|
@@ -239,14 +265,33 @@ function Browser({ sandbox, held, site, live }) {
|
|
|
239
265
|
* Where the run published its work, framed, with its address, a reload and the
|
|
240
266
|
* page in a tab of its own; or what keeps its sandbox from serving.
|
|
241
267
|
*/
|
|
242
|
-
function Site({ site, live, held }) {
|
|
268
|
+
function Site({ site, live, held, onDetect }) {
|
|
243
269
|
const { t } = useI18n();
|
|
244
270
|
const frame = useRef(null);
|
|
245
|
-
|
|
271
|
+
const [urlInput, setUrlInput] = useState(site);
|
|
272
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the page'), onPress: () => frame.current?.reload(), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: site || t('Nothing is serving yet') }), _jsx(Input, { unstyled: true, value: urlInput, onChangeText: setUrlInput, placeholder: t('Type a URL'), "aria-label": t('Type a URL'), style: { width: 120, fontSize: 12, outlineStyle: 'none', background: 'transparent' } }), site ? (_jsx(Out, { href: site, label: t('Open in a new tab'), children: _jsx(XStack, { p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 14 }) }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: site, title: t('Where this run is published'), device: "desktop", empty: _jsxs(YStack, { items: "center", gap: "$2.5", p: "$6", children: [_jsx(Globe, { size: 28, opacity: 0.45 }), _jsx(SizableText, { size: "$3", color: "$ink", children: t('Nothing is serving yet') }), _jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center', maxWidth: 280 }, children: held === 'parked'
|
|
246
273
|
? `${t('The run’s sandbox is suspended.')} ${t('Resume it to see what it serves.')}`
|
|
247
274
|
: live
|
|
248
275
|
? t('When the run starts a server in its sandbox, the page opens here.')
|
|
249
|
-
: `${t('Nothing listens in this run’s sandbox, and it published no site.')} ${t('Its work is on its branch.')}` })] }) })] }));
|
|
276
|
+
: `${t('Nothing listens in this run’s sandbox, and it published no site.')} ${t('Its work is on its branch.')}` }), onDetect ? (_jsxs(XStack, { gap: "$1", items: "center", pt: "$1", flexWrap: "wrap", justify: "center", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Preview your app instead?') }), _jsx(XStack, { render: "button", onPress: onDetect, px: "$1.5", py: "$0.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$1", color: "$ink", style: { textDecorationLine: 'underline' }, children: t('Detect dev server') }) })] })) : null] }) })] }));
|
|
277
|
+
}
|
|
278
|
+
function EnvironmentInspection({ id, repo, name, branch, environment, pr, title, events, live, onOpenEnvironment, onOpenDiff, }) {
|
|
279
|
+
const { t } = useI18n();
|
|
280
|
+
const host = useHost();
|
|
281
|
+
const target = useTarget();
|
|
282
|
+
const signed = Boolean(host.person);
|
|
283
|
+
const [remoteControl, setRemoteControl] = useKept('hanzo.build.remote.control', true);
|
|
284
|
+
const changes = useRead(signed ? () => readChanges(target, id) : null, null, [target, id, signed]);
|
|
285
|
+
const allCards = cards(events, '', t);
|
|
286
|
+
const shellCards = allCards.filter((c) => c.kind === 'shell');
|
|
287
|
+
const runningTasks = shellCards.filter((c) => c.ran === 'running' && live);
|
|
288
|
+
const finishedCount = shellCards.filter((c) => c.ran !== 'running' || !live).length + steps(events).filter((s) => s.done).length;
|
|
289
|
+
const totalChars = events.reduce((sum, e) => sum + JSON.stringify(e.payload ?? '').length, 0);
|
|
290
|
+
const estTokens = Math.max(1, Math.round(totalChars / 4));
|
|
291
|
+
const contextPct = Math.min(100, Math.max(1, Math.round((estTokens / 128_000) * 100)));
|
|
292
|
+
const added = changes.value?.files.reduce((n, f) => n + f.additions, 0) ?? 0;
|
|
293
|
+
const removed = changes.value?.files.reduce((n, f) => n + f.deletions, 0) ?? 0;
|
|
294
|
+
return (_jsxs(YStack, { width: 264, shrink: 0, minH: 0, overflow: "scroll", bg: "$background", px: "$3", py: "$2.5", gap: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: t('Environment') }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Laptop, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: environment && environment !== 'sandbox' ? environment : t('This computer') }), _jsx(XStack, { render: "button", onPress: onOpenEnvironment, px: "$1.5", py: "$0.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$1", color: "$ink", style: { textDecorationLine: 'underline' }, children: t('Save') }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: name || 'workspace' }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: "\u00B7 ~/work" })] }), repo ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: repo })] })) : null, branch ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(GitBranch, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: branch })] })) : null, _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", children: t('Remote Control') }), _jsx(Switch, { checked: remoteControl, onCheckedChange: setRemoteControl, size: "sm", "aria-label": t('Remote Control') })] })] }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Context') }), _jsx(ChevronRight, { size: 12, opacity: 0.6 }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", children: `${contextPct}%` }), _jsx(YStack, { width: 28, height: 6, rounded: 99, bg: "$borderColor", overflow: "hidden", children: _jsx(YStack, { width: `${contextPct}%`, height: "100%", bg: "$blue10" }) })] }) }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Connectors') }), _jsx(ChevronRight, { size: 12, opacity: 0.6 }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", children: t('Connected') })] }) }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Changes') }), _jsxs(XStack, { render: "button", onPress: onOpenDiff, items: "flex-start", gap: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: [_jsx(GitPullRequest, { size: 14, color: "$green10" }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, text: "start", children: title || branch || t('Working tree') }), _jsxs(XStack, { gap: "$1.5", items: "center", children: [pr.label ? (_jsx(SizableText, { size: "$1", color: "$soft", children: pr.label })) : null, _jsx(SizableText, { size: "$1", color: "$green10", children: `+${added}` }), _jsx(SizableText, { size: "$1", color: "$red10", children: `−${removed}` })] })] })] })] }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Background tasks') }), runningTasks.map((task) => (_jsxs(XStack, { items: "center", gap: "$2", py: "$1", children: [_jsx(SquareTerminal, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: task.command }), _jsx(Square, { size: 10, fill: "currentColor" })] }, task.key))), _jsx(XStack, { items: "center", gap: "$2", py: "$0.5", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('{n} finished', { n: finishedCount }) }) })] })] }));
|
|
250
295
|
}
|
|
251
296
|
function Fact({ label, value }) {
|
|
252
297
|
return (_jsxs(XStack, { gap: "$3", items: "baseline", children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 96, children: label }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 2, children: value })] }));
|
package/lib/files.js
CHANGED
|
@@ -12,7 +12,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
*/
|
|
13
13
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
14
14
|
import { useI18n } from '@hanzo/i18n/react';
|
|
15
|
-
import { Download, ExternalLink, File, FileDiff, Folder, Globe, GitBranch, GitPullRequest, Layers, MonitorPlay, Rocket, Settings2 } from '@hanzogui/lucide-icons-2';
|
|
15
|
+
import { Download, ExternalLink, File, FileDiff, Folder, Globe, GitBranch, GitPullRequest, Layers, MonitorPlay, Rocket, Search, Settings2 } from '@hanzogui/lucide-icons-2';
|
|
16
|
+
import { Input } from '@hanzo/ui';
|
|
16
17
|
import { useState } from 'react';
|
|
17
18
|
import { blob, tree } from './api/changes.js';
|
|
18
19
|
import { artifact, artifacts } from './api/coding.js';
|
|
@@ -94,7 +95,10 @@ function Branch({ session, label }) {
|
|
|
94
95
|
}
|
|
95
96
|
function Listing({ where, up, error, loading, rows, file, body, }) {
|
|
96
97
|
const { t } = useI18n();
|
|
97
|
-
|
|
98
|
+
const [filter, setFilter] = useState('');
|
|
99
|
+
const needle = filter.replace(/^\?/, '').trim().toLowerCase();
|
|
100
|
+
const shown = needle ? rows.filter((r) => r.name.toLowerCase().includes(needle)) : rows;
|
|
101
|
+
return (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Search, { size: 13, opacity: 0.6 }), _jsx(Input, { unstyled: true, flex: 1, minW: 0, value: filter, onChangeText: setFilter, placeholder: t('Filter, or ? to search in files'), "aria-label": t('Filter, or ? to search in files'), style: { fontSize: 12, outlineStyle: 'none', background: 'transparent' } })] }), _jsxs(XStack, { gap: "$2", items: "center", children: [up ? (_jsx(XStack, { render: "button", "aria-label": t('Up one directory'), onPress: up, px: "$1", py: "$1", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('Up') }) })) : null, _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: where })] }), error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: error })) : loading ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading…') })) : shown.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: needle ? t('No matching files.') : t('This directory is empty.') })) : (shown.map((r) => (_jsxs(XStack, { render: "button", "aria-label": r.dir === false ? t('Read {name}', { name: r.name }) : t('Open {name}', { name: r.name }), onPress: r.onPress, items: "center", gap: "$2", py: "$1", hoverStyle: { bg: '$hover' }, children: [r.dir === false ? _jsx(File, { size: 14 }) : r.dir ? _jsx(Folder, { size: 14 }) : _jsx(File, { size: 14, opacity: 0.6 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, text: "start", children: r.name })] }, r.key)))), file && body ? (_jsxs(YStack, { gap: "$1", pt: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: file }), _jsx(SizableText, { size: "$1", color: "$ink", style: monoWrap, children: body })] })) : null] }));
|
|
98
102
|
}
|
|
99
103
|
/** A stored artifact's size, as a person reads it. */
|
|
100
104
|
const size = (n) => (n < 1024 ? `${n} B` : n < 1 << 20 ? `${(n / 1024).toFixed(1)} KB` : `${(n / (1 << 20)).toFixed(1)} MB`);
|
package/lib/landing.js
CHANGED
|
@@ -18,10 +18,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
18
18
|
* Its words are the reader's language (@hanzo/i18n `t`, the target is
|
|
19
19
|
* `target`); a codebase's, a machine's and a branch's names are drawn as given.
|
|
20
20
|
*/
|
|
21
|
-
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
21
|
+
import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
|
|
22
22
|
import { phrase } from '@hanzo/i18n';
|
|
23
23
|
import { useI18n } from '@hanzo/i18n/react';
|
|
24
|
-
import { CircleDot, Cloud, Code, GitBranch, LayoutTemplate, Link2, Monitor, Play } from '@hanzogui/lucide-icons-2';
|
|
24
|
+
import { CircleDot, Cloud, Code, Ghost, GitBranch, LayoutTemplate, Link2, Monitor, Play } from '@hanzogui/lucide-icons-2';
|
|
25
25
|
import { Button } from '@hanzo/ui';
|
|
26
26
|
import { Composer, MEASURE } from '@hanzo/ui/chat';
|
|
27
27
|
import { BranchSelect, ChipSelect, FooterLink, RepoSelect } from '@hanzo/ui/product';
|
|
@@ -46,7 +46,9 @@ import { Publish } from './publish.js';
|
|
|
46
46
|
import { path } from './route.js';
|
|
47
47
|
import { useCarry } from './carry.js';
|
|
48
48
|
import { DEV_MODES } from './gear.js';
|
|
49
|
-
import {
|
|
49
|
+
import { Panel, PanelToggle } from './panel.js';
|
|
50
|
+
import { PAGE, useDeck, useKey } from './tabs.js';
|
|
51
|
+
import { book, hand, taken, useSuggestions } from './suggestions.js';
|
|
50
52
|
import { want } from './library.js';
|
|
51
53
|
import { carrying, compose, pick, read as readFiles } from './tools.js';
|
|
52
54
|
import { useEar, useSpoken } from './voice.js';
|
|
@@ -88,6 +90,8 @@ export function Landing({ onStarted }) {
|
|
|
88
90
|
const host = useHost();
|
|
89
91
|
const target = useTarget();
|
|
90
92
|
const { t } = useI18n();
|
|
93
|
+
const media = useMedia();
|
|
94
|
+
const wide = Boolean(media.md);
|
|
91
95
|
const signed = Boolean(host.person);
|
|
92
96
|
const { prefs, save: savePrefs } = usePrefs();
|
|
93
97
|
const [stored, keep] = useKept(`hanzo.build.new.${host.org ?? 'none'}`, null);
|
|
@@ -106,6 +110,13 @@ export function Landing({ onStarted }) {
|
|
|
106
110
|
const [note, setNote] = useState('');
|
|
107
111
|
const [adding, setAdding] = useState(null);
|
|
108
112
|
const [offering, setOffering] = useState(false);
|
|
113
|
+
const [forgetful, setForgetful] = useState(false);
|
|
114
|
+
const [desk, setDesk] = useState(false);
|
|
115
|
+
const deck = useDeck('dev-new', { tabs: [{ id: 'tab-1', kind: PAGE, title: '' }], at: 'tab-1' });
|
|
116
|
+
useKey(() => setDesk((d) => !d));
|
|
117
|
+
const [browserTabs, setBrowserTabs] = useState(false);
|
|
118
|
+
const [webSearch, setWebSearch] = useState(false);
|
|
119
|
+
const [research, setResearch] = useState(false);
|
|
109
120
|
// Asking for a repository's address, for one the lists do not show.
|
|
110
121
|
const [giving, setGiving] = useState(false);
|
|
111
122
|
// The repository and branch lists are read again each time they open.
|
|
@@ -188,9 +199,9 @@ export function Landing({ onStarted }) {
|
|
|
188
199
|
const fresh = !homes.loading && homes.error === null && homes.value !== NOHOMES && homes.value.whole;
|
|
189
200
|
const forgeNames = useMemo(() => (fresh ? homes.value.homes.map((h) => h.name) : null), [fresh, homes.value]);
|
|
190
201
|
useEffect(() => {
|
|
191
|
-
if (codebase && gone(latest.current.repo, { forge: forgeNames, github: null }))
|
|
202
|
+
if ((codebase && gone(latest.current.repo, { forge: forgeNames, github: null })) || stranger)
|
|
192
203
|
drop();
|
|
193
|
-
}, [codebase, forgeNames, drop]);
|
|
204
|
+
}, [codebase, forgeNames, stranger, drop]);
|
|
194
205
|
// A GitHub repository, by GitHub's listing narrowed to its own address, so one
|
|
195
206
|
// page is the whole answer for it however many the connection grants. A read
|
|
196
207
|
// refused is no list; one this page has moved on from is not heard.
|
|
@@ -239,7 +250,7 @@ export function Landing({ onStarted }) {
|
|
|
239
250
|
}
|
|
240
251
|
const repo = isForge(kept.repo) ? kept.repo : null;
|
|
241
252
|
const hub = isHub(kept.repo) ? kept.repo : null;
|
|
242
|
-
if (!repo && !hub) {
|
|
253
|
+
if (!repo && !hub && place.id) {
|
|
243
254
|
setNote(t('Choose the project this run works on: a repository of this organization, or one on its GitHub.'));
|
|
244
255
|
setPicking(true);
|
|
245
256
|
return;
|
|
@@ -250,11 +261,6 @@ export function Landing({ onStarted }) {
|
|
|
250
261
|
setNote(why);
|
|
251
262
|
return;
|
|
252
263
|
}
|
|
253
|
-
if (stranger) {
|
|
254
|
-
setNote(t('{repo} is not one of this organization’s repositories. Choose one, or leave it empty to start a new project.', { repo: codebase }));
|
|
255
|
-
setPicking(true);
|
|
256
|
-
return;
|
|
257
|
-
}
|
|
258
264
|
setBusy(true);
|
|
259
265
|
setNote('');
|
|
260
266
|
try {
|
|
@@ -409,13 +415,6 @@ export function Landing({ onStarted }) {
|
|
|
409
415
|
});
|
|
410
416
|
},
|
|
411
417
|
}, placeholder: t('Repository'), placement: "top-start", disabled: !signed }), forge ? _jsx(BranchSelect, { open: branching, onOpenChange: setBranching, value: branch, onChange: (b) => set({ branch: b }), load: loadBranches, placement: "top-start" }) : null] }));
|
|
412
|
-
// Where a run goes from here: its repositories, branches, issues and templates, each one press away.
|
|
413
|
-
const chips = [
|
|
414
|
-
{ id: 'repos', label: t('Repos'), icon: _jsx(Code, { size: 13, color: "$soft" }), onPress: () => setPicking(true) },
|
|
415
|
-
...(forge ? [{ id: 'branches', label: t('Branches'), icon: _jsx(GitBranch, { size: 13, color: "$soft" }), onPress: () => setBranching(true) }] : []),
|
|
416
|
-
{ id: 'issues', label: t('Issues'), icon: _jsx(CircleDot, { size: 13, color: "$soft" }), onPress: screen('issues') },
|
|
417
|
-
{ id: 'templates', label: t('Templates'), icon: _jsx(LayoutTemplate, { size: 13, color: "$soft" }), onPress: screen('templates') },
|
|
418
|
-
];
|
|
419
418
|
const commands = [
|
|
420
419
|
{ id: 'run', label: t('Run'), keys: 'Ctrl+↵', icon: _jsx(Play, { size: 14, color: "$soft" }), disabled: !draft.trim(), run: () => void send() },
|
|
421
420
|
{ id: 'issues', label: t('View issues'), icon: _jsx(CircleDot, { size: 14, color: "$soft" }), run: screen('issues') },
|
|
@@ -431,20 +430,25 @@ export function Landing({ onStarted }) {
|
|
|
431
430
|
loading: places.loading,
|
|
432
431
|
error: places.error?.message ?? null,
|
|
433
432
|
};
|
|
434
|
-
return (_jsxs(YStack, { display: "grid", gridTemplateRows:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
433
|
+
return (_jsxs(XStack, { flex: 1, width: "100%", height: "100%", minW: 0, minH: 0, overflow: "hidden", children: [_jsxs(YStack, { flex: 1, minW: 0, minH: 0, height: "100%", overflow: "hidden", children: [_jsxs(XStack, { "data-slot": "conversation-head", shrink: 0, items: "center", justify: "space-between", gap: "$2", px: "$3", height: 36, "$max-md": { display: 'none' }, children: [_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1 }), _jsxs(XStack, { "data-slot": "conversation-controls", items: "center", gap: "$1", shrink: 0, children: [_jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t('Private chat'), "aria-pressed": forgetful, onPress: () => setForgetful((f) => !f), width: 32, height: 32, rounded: "$3", items: "center", justify: "center", bg: forgetful ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(Ghost, { size: 16, color: forgetful ? 'var(--foreground)' : 'var(--muted-foreground)', "aria-hidden": true }) }), wide ? _jsx(PanelToggle, { open: desk, onToggle: () => setDesk((d) => !d) }) : null] })] }), _jsxs(YStack, { display: "grid", gridTemplateRows: wide ? '1fr auto auto 1fr' : 'minmax(0, 1fr) auto', items: "center", "$platform-web": { justifyItems: 'center' }, width: "100%", flex: 1, minH: 0, overflowX: "hidden", "data-slot": "new", children: [wide ? _jsx(YStack, {}) : null, _jsx(YStack, { display: "grid",
|
|
434
|
+
// One track, its question set at the track's foot, just above the composer: a
|
|
435
|
+
// second `auto` track left the question alone in the first, at the pane's top.
|
|
436
|
+
gridTemplateRows: "minmax(0, 1fr)", items: "flex-end", width: "100%", maxW: MEASURE, height: wide ? undefined : '100%', pb: wide ? '$5' : '$3', overflowY: "auto", children: _jsx(SizableText, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", style: { textAlign: 'center' }, children: t('Build what’s next.') }) }), _jsx(YStack, { width: "100%", maxW: MEASURE, gap: "$2", pb: 12, children: _jsxs(YStack, { gap: "$2", children: [env.value && (env.value.state === 'proposed' || unset(env.value)) && !place.id ? (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", px: "$3", py: "$2", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 0, children: env.value.state === 'proposed'
|
|
437
|
+
? t('A proposed environment for {repo} is waiting for review.', { repo: codebase })
|
|
438
|
+
: t('{repo} has no environment yet, so every run starts it bare.', { repo: codebase }) }), env.value.state === 'proposed' && env.value.session ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => host.go(env.value.session), children: t('Review') })) : (_jsx(Button, { size: "sm", onPress: () => setOffering(true), children: t('Set up environment') }))] })) : null, note || unhonoured(mode, place.id, t) || mind.note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note || unhonoured(mode, place.id, t) || mind.note })) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void send(), busy: busy, ...{ forgetful }, placeholder: t('Ask, build, or run anything…'), label: t('Describe a task or ask a question'), plus: {
|
|
439
|
+
upload: () => pick(files, setFiles, setNote, t),
|
|
440
|
+
...{
|
|
441
|
+
browserTabs: { on: browserTabs, set: setBrowserTabs },
|
|
442
|
+
webSearch: { on: webSearch, set: setWebSearch },
|
|
443
|
+
},
|
|
444
|
+
research: { on: research, set: setResearch },
|
|
445
|
+
skills: carry.skills,
|
|
446
|
+
design: carry.design,
|
|
447
|
+
plugins: carry.plugins,
|
|
448
|
+
devices,
|
|
449
|
+
memory: { on: carry.gear.gear.memory, set: (on) => carry.gear.set({ memory: on }) },
|
|
450
|
+
}, carried: [...carry.on, ...carrying(files, setFiles)], slash: carry.skills, at: carry.plugins, pills: pills, commands: commands, mind: mind, effort: pacing(mind), limits: limits, onUpgrade: () => host.go(path({ kind: 'screen', screen: 'plans' })), voice: voice, language: prefs.language ?? null, onLanguage: (id) => void savePrefs({ language: id }), talk: talk })] }) }), wide ? _jsx(YStack, {}) : null, _jsx(Publish, { source: adding, onClose: () => setAdding(null) }), _jsx(Address, { open: giving, onOpenChange: setGiving, title: t('Use a git URL'), says: t('Runs work on the GitHub repository at this address until you choose another. A private one needs GitHub connected.'), act: t('Use'), address: "", run: async (at) => give(at) }), carry.dialog, codebase ? (_jsx(SetupDialog, { repo: codebase, homes: homes, open: offering, onOpenChange: setOffering, onStart: setup, onRepo: choose, onSaved: () => {
|
|
451
|
+
setOffering(false);
|
|
452
|
+
env.reload();
|
|
453
|
+
} })) : null] })] }), desk && wide ? (_jsx(YStack, { width: 440, shrink: 0, height: "100%", borderLeftWidth: 1, borderColor: "$borderColor", bg: "$background", minW: 0, minH: 0, overflow: "hidden", children: _jsx(Panel, { side: deck, kinds: [], onHide: () => setDesk(false), label: t('Tabs') }) })) : null] }));
|
|
450
454
|
}
|