@hanzo/build 0.2.122 → 0.2.124

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/run.js CHANGED
@@ -39,6 +39,7 @@ import { approve, followUp, headline, retry, start, steer } from './api/coding.j
39
39
  import { limits as readLimits } from './api/models.js';
40
40
  import { list, message, pause, publish, rename, resume, stop, story, took } from './api/sessions.js';
41
41
  import { answer, cards, followed, outcome, pull, settled, steps } from './api/turn.js';
42
+ import { answer as reply, say as talk, talks } from './api/talk.js';
42
43
  import { verdict } from './api/verdict.js';
43
44
  import { useKept, useProjects, useRead, useRun } from './data.js';
44
45
  import { Desk, SEED } from './desk.js';
@@ -54,6 +55,7 @@ import { schedule } from './scheduled.js';
54
55
  import { SideProvider, useSplit } from './side.js';
55
56
  import { PAGE, useDeck, useKey, usePanel } from './tabs.js';
56
57
  import { carrying, compose, pick } from './tools.js';
58
+ import { Talk } from './talk.js';
57
59
  import { Transcript } from './transcript.js';
58
60
  const LIVE = new Set(['running', 'paused', '']);
59
61
  /** A run's status as the line under its title says it; one the service adds later is drawn as it comes. */
@@ -64,13 +66,20 @@ const STATUS = {
64
66
  error: phrase('error'),
65
67
  stopped: phrase('stopped'),
66
68
  };
69
+ /** One session's page: a conversation (talk.tsx) or one run, as its record says. */
67
70
  export function Run({ id }) {
68
- const { t: say } = useI18n();
69
71
  const host = useHost();
70
72
  const t = useTarget();
71
73
  // Signed out, there is nothing to read: the gateway answers a bare run with a refusal.
74
+ const state = useRun(t, host.person ? id : null);
75
+ return talks(state.record) ? _jsx(Talk, { id: id, state: state }) : _jsx(Job, { id: id, state: state });
76
+ }
77
+ function Job({ id, state: read }) {
78
+ const { t: say } = useI18n();
79
+ const host = useHost();
80
+ const t = useTarget();
72
81
  const signed = Boolean(host.person);
73
- const { detail, record, events, status, refused } = useRun(t, signed ? id : null);
82
+ const { detail, record, events, status, refused } = read;
74
83
  const [draft, setDraft] = useState('');
75
84
  const [files, setFiles] = useState([]);
76
85
  const [note, setNote] = useState('');
@@ -100,8 +109,8 @@ export function Run({ id }) {
100
109
  const wakeLockRef = useRef(null);
101
110
  const [nowMs, setNowMs] = useState(() => Date.now());
102
111
  // The model and effort a run started here uses: the one choice Chat and New share.
103
- const mind = useMind(t);
104
112
  const { limits } = useLimits(signed ? (signal) => readLimits(t, signal) : null, t);
113
+ const mind = useMind(t, limits?.plan, host.topUp);
105
114
  const voice = useVoice({ speech: useEar(t), language: useSpoken(), ...useDictation(draft, setDraft) });
106
115
  const listen = useMemo(() => speaker(t), [t]);
107
116
  const mode = record?.mode ?? '';
@@ -171,8 +180,8 @@ export function Run({ id }) {
171
180
  const failed = finished && state === 'error';
172
181
  const asked = shown.find((c) => c.kind === 'said' && c.who === 'person');
173
182
  const again = asked && asked.kind === 'said' ? asked.text : '';
174
- // What the recorded read left out: it carries the latest fifty turns.
175
- const hidden = Math.max(0, (detail.value?.events ?? 0) - (detail.value?.recent.length ?? 0));
183
+ // What the recorded read left out once initial pagination and live replay are merged.
184
+ const hidden = Math.max(0, (detail.value?.events ?? 0) - events.length);
176
185
  // Only a run still working is on a step.
177
186
  const current = running ? plan.find((x) => !x.done) : undefined;
178
187
  // Asked for while it ran, said once when it stops. `notify` is only ever set
@@ -240,6 +249,18 @@ export function Run({ id }) {
240
249
  throw new Error(say('This run is still being read'));
241
250
  if (paused)
242
251
  await stop(t, id, 'Continued in a follow-up run').catch(() => undefined);
252
+ // A run a conversation started is carried on by the conversation (talk.ts): the
253
+ // words go there, in its session, and so does the reader.
254
+ if (record?.parent) {
255
+ const words = how === 'approve' ? `Carry out this plan:\n\n${said.trim()}` : said.trim() || 'Continue where the run left off.';
256
+ // Approving the plan is going ahead: the conversation leaves Plan for Auto, so
257
+ // the run it starts builds.
258
+ await talk(t, { session: record.parent, input: words, model: mind.model, effort: level(mind.effort), ...(how === 'approve' ? { mode: 'auto' } : {}) });
259
+ setDraft('');
260
+ setFiles([]);
261
+ host.go(record.parent);
262
+ return '';
263
+ }
243
264
  const ask = how === 'approve' ? approve(earlier, said) : how === 'retry' ? retry(earlier, said) : followUp(earlier, said);
244
265
  const run = await start(t, tuned(ask));
245
266
  setDraft('');
@@ -461,7 +482,9 @@ export function Run({ id }) {
461
482
  ? say('Add a follow up for the setup agent')
462
483
  : say('Add a follow up')
463
484
  : finished
464
- ? say('Follow up — continues in a new run')
485
+ ? record?.parent
486
+ ? say('Follow up — continues the conversation')
487
+ : say('Follow up — continues in a new run')
465
488
  : say('Reading this run…');
466
489
  const desk_ = (sheet) => (_jsx(Desk, { id: id, repo: record?.repo ?? '', branch: record?.branch ?? '', base: record?.base ?? '', environment: record?.environment ?? '', mode: mode, pr: pr, title: title, project: record?.project ?? '', sandbox: record?.sandbox ?? '', site: site, published: end.published, events: events, live: running, menu: [...manage, ...sharing], refused: signed ? refused || (detail.error ? say(detail.error.message) : '') : say('Sign in to follow this run.'), retry: signed ? say('Retry') : say('Sign in'), onRetry: signed ? detail.reload : () => host.signIn?.(), side: side, sheet: sheet, onHide: () => setDesk(false), envColumn: envColumn, splitPanes: splitPanes, onCloseSplitPane: (pid) => setSplitPanes((prev) => prev.filter((k) => k !== pid)), onExpandSplitPane: (pid) => {
467
490
  setSplitPanes([]);
@@ -528,7 +551,9 @@ export function Run({ id }) {
528
551
  ? `${say('This run stopped with an error.')} ${say('Its work so far is on its branch.')}`
529
552
  : `${say('This run stopped with an error.')} ${say('It saved nothing to its branch, so Try again starts over.')}` })) : null,
530
553
  // A paused run's agent was stopped where it stood; what it was running is cut off.
531
- live: running && !paused, header: hidden ? (_jsx(SizableText, { size: "$1", color: "$soft", children: `${hidden === 1 ? say('{n} earlier turn is not shown.', { n: hidden }) : say('{n} earlier turns are not shown.', { n: hidden })} ${say('The run’s Git tab has everything it pushed.')}` })) : null, onApprove: planned && earlier ? (p) => void act(() => carry(p, 'approve')) : undefined, approving: busy, onVerdict: (v) => verdict(t, id, record?.project ?? '', v), empty: signed ? (_jsx(SizableText, { size: "$2", color: "$soft", children: detail.error
554
+ live: running && !paused, header: hidden ? (_jsx(SizableText, { size: "$1", color: "$soft", children: `${hidden === 1 ? say('{n} earlier turn is not shown.', { n: hidden }) : say('{n} earlier turns are not shown.', { n: hidden })} ${say('The run’s Git tab has everything it pushed.')}` })) : null, onApprove: planned && earlier ? (p) => void act(() => carry(p, 'approve')) : undefined,
555
+ // What dev asks its person while it works (its ask tool), answered here.
556
+ onAnswer: signed ? (q, label) => void act(async () => (await reply(t, id, q, label, true), '')) : undefined, approving: busy, onVerdict: (v) => verdict(t, id, record?.project ?? '', v), empty: signed ? (_jsx(SizableText, { size: "$2", color: "$soft", children: detail.error
532
557
  ? say(detail.error.message)
533
558
  : detail.loading
534
559
  ? say('Reading this run…')
package/lib/section.d.ts CHANGED
@@ -5,6 +5,11 @@ import { type Read } from './data.ts';
5
5
  import type { Host } from './host.tsx';
6
6
  /** A run's status, as the rail's dot draws it. Anything else is idle. */
7
7
  export declare const DOTS: Record<string, SessionStatus>;
8
+ /**
9
+ * The dot a row draws. A conversation rests paused between turns (api/talk.ts):
10
+ * it has answered and waits for the person, which reads as done, not as a run held.
11
+ */
12
+ export declare const dot: (s: Pick<Session, 'status' | 'channel' | 'parent'>) => SessionStatus;
8
13
  /** The org's coding runs, newest first, kept live by the org's feed. */
9
14
  export declare function useSessions(host: Host): Read<Session[]>;
10
15
  /**
package/lib/section.js CHANGED
@@ -14,6 +14,7 @@ import { SizableText } from '@hanzo/gui';
14
14
  import { useI18n } from '@hanzo/i18n/react';
15
15
  import { SidebarItem, SidebarSection, StatusDot } from '@hanzo/ui/chat';
16
16
  import { useMemo } from 'react';
17
+ import { talks } from './api/talk.js';
17
18
  import { useRecents } from './data.js';
18
19
  import { nav } from './nav.js';
19
20
  import { route } from './route.js';
@@ -25,6 +26,11 @@ export const DOTS = {
25
26
  stopped: 'stopped',
26
27
  error: 'error',
27
28
  };
29
+ /**
30
+ * The dot a row draws. A conversation rests paused between turns (api/talk.ts):
31
+ * it has answered and waits for the person, which reads as done, not as a run held.
32
+ */
33
+ export const dot = (s) => talks(s) && s.status === 'paused' ? 'done' : (DOTS[s.status] ?? 'idle');
28
34
  /** The org's coding runs, newest first, kept live by the org's feed. */
29
35
  export function useSessions(host) {
30
36
  const t = useMemo(() => ({ api: host.api, token: host.token, org: host.org }), [host.api, host.token, host.org]);
@@ -46,7 +52,7 @@ export function DevSection({ host, onPick, label, children, }) {
46
52
  press?.();
47
53
  onPick?.();
48
54
  };
49
- return (_jsxs(_Fragment, { children: [nav(host, host.go, t).map((g) => (_jsx(SidebarSection, { label: g.label, children: g.links.map((l) => (_jsx(SidebarItem, { icon: l.icon, active: l.active, onPress: then(l.onPress), children: l.label }, l.id))) }, g.id))), children, _jsx(SidebarSection, { label: label ?? t('Runs'), children: !host.person ? (_jsx(Note, { children: t('Sign in to see your runs.') })) : sessions.value.length ? (sessions.value.map((s) => (_jsx(SidebarItem, { icon: _jsx(StatusDot, { status: DOTS[s.status] ?? 'idle' }), active: r.kind === 'run' && r.id === s.id, onPress: then(() => host.go(s.id)), children: s.title || t('Untitled run') }, s.id)))) : (_jsx(Note, { children: sessions.error
55
+ return (_jsxs(_Fragment, { children: [nav(host, host.go, t).map((g) => (_jsx(SidebarSection, { label: g.label, children: g.links.map((l) => (_jsx(SidebarItem, { icon: l.icon, active: l.active, onPress: then(l.onPress), children: l.label }, l.id))) }, g.id))), children, _jsx(SidebarSection, { label: label ?? t('Runs'), children: !host.person ? (_jsx(Note, { children: t('Sign in to see your runs.') })) : sessions.value.length ? (sessions.value.map((s) => (_jsx(SidebarItem, { icon: _jsx(StatusDot, { status: dot(s) }), active: r.kind === 'run' && r.id === s.id, onPress: then(() => host.go(s.id)), children: s.title || t('Untitled run') }, s.id)))) : (_jsx(Note, { children: sessions.error
50
56
  ? t(sessions.error.message)
51
57
  : sessions.loading
52
58
  ? t('Reading…')
package/lib/talk.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { type RunState } from './data.ts';
2
+ export declare function Talk({ id, state }: {
3
+ id: string;
4
+ state: RunState;
5
+ }): import("react").JSX.Element;
package/lib/talk.js ADDED
@@ -0,0 +1,104 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A conversation in Dev (api/talk.ts): what the person said and what the agent
4
+ * answered, at one address however many turns it takes — the way Chat reads.
5
+ *
6
+ * Every send continues the same session. While a turn works, what is said is that
7
+ * turn's next input; once it has answered, the next turn. A build is never steered
8
+ * from here — the words are the conversation's, and a build is steered from its
9
+ * own page, which its card opens. The agent decides what a turn needs: an answer,
10
+ * a sandbox (leased on first use and kept for the conversation), or a coding run,
11
+ * whose outcome is said here when it ends. A question a turn asks — in Manual,
12
+ * whether a build may start — is answered on its card. The line under the
13
+ * transcript is what the turn is doing now, from its own progress. The mode pill
14
+ * is the conversation's: Plan, Auto or Manual, kept from the turn it is sent with.
15
+ */
16
+ import { SizableText, XStack, YStack } from '@hanzo/gui';
17
+ import { useI18n } from '@hanzo/i18n/react';
18
+ import { Steer } from '@hanzo/ui/agents';
19
+ import { Composer, measure } from '@hanzo/ui/chat';
20
+ import { useLimits } from '@hanzo/ui/product/useLimits';
21
+ import { useMemo, useState } from 'react';
22
+ import { DEV_MODES, MODES } from './gear.js';
23
+ import { Refusal } from './api/call.js';
24
+ import { limits as readLimits } from './api/models.js';
25
+ import { log, message, stop } from './api/sessions.js';
26
+ import { answer, now, say as talk } from './api/talk.js';
27
+ import { cards, merge } from './api/turn.js';
28
+ import { verdict } from './api/verdict.js';
29
+ import { useRead } from './data.js';
30
+ import { useHost, useTarget } from './host.js';
31
+ import { level, useMind } from './mind.js';
32
+ import { pane } from './pane.js';
33
+ import { speaker } from './reply.js';
34
+ import { carrying, compose, pick } from './tools.js';
35
+ import { Transcript } from './transcript.js';
36
+ export function Talk({ id, state }) {
37
+ const { t: say } = useI18n();
38
+ const host = useHost();
39
+ const t = useTarget();
40
+ const signed = Boolean(host.person);
41
+ const { detail, record, status, refused } = state;
42
+ // The whole conversation from its first word: the detail carries the latest
43
+ // fifty events, and a turn that builds says many. Live frames are added to it.
44
+ const whole = useRead(signed ? () => log(t, id) : null, [], [t, id, signed]);
45
+ const events = useMemo(() => merge(whole.value, state.events), [whole.value, state.events]);
46
+ const [draft, setDraft] = useState('');
47
+ const [files, setFiles] = useState([]);
48
+ const [note, setNote] = useState('');
49
+ const [busy, setBusy] = useState(false);
50
+ const { limits } = useLimits(signed ? (signal) => readLimits(t, signal) : null, t);
51
+ const mind = useMind(t, limits?.plan, host.topUp);
52
+ const listen = useMemo(() => speaker(t), [t]);
53
+ const shown = useMemo(() => cards(events, '', say), [events, say]);
54
+ const working = status === 'running';
55
+ const doing = useMemo(() => now(events), [events]);
56
+ // The conversation's mode, as it keeps it until the person picks another: what
57
+ // they pick is sent with what they say next, and kept for every turn after.
58
+ const [picked, setPicked] = useState(null);
59
+ const mode = picked ?? (DEV_MODES.includes(record?.mode) ? record?.mode : 'auto');
60
+ /** One act at a time; what it answers, or the reason it was refused, is the note. */
61
+ const act = async (work) => {
62
+ if (busy)
63
+ return;
64
+ setBusy(true);
65
+ setNote('');
66
+ try {
67
+ setNote(await work());
68
+ }
69
+ catch (e) {
70
+ setNote(e.message);
71
+ }
72
+ finally {
73
+ setBusy(false);
74
+ }
75
+ };
76
+ const send = () => {
77
+ const words = compose(draft.trim(), files);
78
+ if (!words)
79
+ return;
80
+ const next = () => talk(t, { session: id, input: words, model: mind.model, effort: level(mind.effort), ...(picked ? { mode: picked } : {}) });
81
+ void act(async () => {
82
+ if (!working)
83
+ await next();
84
+ else
85
+ try {
86
+ await message(t, id, words);
87
+ }
88
+ catch (e) {
89
+ // The turn answered as the words were sent: they are the next turn.
90
+ if (!(e instanceof Refusal) || e.status !== 409)
91
+ throw e;
92
+ await next();
93
+ }
94
+ setDraft('');
95
+ setFiles([]);
96
+ return '';
97
+ });
98
+ };
99
+ const empty = (_jsx(SizableText, { size: "$2", color: "$soft", children: !signed ? say('Sign in to follow this conversation.') : detail.error ? say(detail.error.message) : detail.loading ? say('Reading this conversation…') : say('Thinking…') }));
100
+ return (_jsxs(YStack, { "data-slot": "talk", ...pane, display: "grid", gridTemplateRows: "auto minmax(0, 1fr) auto", width: "100%", height: "100%", minH: 0, minW: 0, children: [_jsx(XStack, { px: "$4", pt: "$3", pb: "$2", items: "center", minH: 44, children: _jsx(SizableText, { size: "$4", color: "$ink", numberOfLines: 1, children: record?.title || say('New conversation') }) }), _jsx(Transcript, { cards: shown, live: working, empty: empty, listen: signed ? listen : undefined, onVerdict: (v) => verdict(t, id, '', v), onRun: (session) => host.go(session), onAnswer: (question, label) => void act(async () => (await answer(t, id, question, label, true), '')) }), _jsxs(YStack, { pb: "$3", pt: "$2", gap: "$2", children: [_jsxs(YStack, { ...measure, gap: "$2", children: [note || (signed && refused) ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note || refused })) : null, working ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$2", color: "$soft", flex: 1, minW: 0, numberOfLines: 1, role: "status", children: doing || say('Thinking…') }), _jsx(Steer, { onCommand: (c) => {
101
+ if (c === 'stop')
102
+ void act(async () => (await stop(t, id), say('Stopped')));
103
+ }, withhold: ['pause', 'resume', ...(busy ? ['stop'] : [])] })] })) : null] }), _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: send, ready: Boolean(draft.trim()), disabled: !signed || busy || !record, placeholder: !signed ? say('Sign in to reply') : working ? say('Add to what it is doing') : say('Reply'), label: say('Reply to this conversation'), plus: { upload: () => pick(files, setFiles, setNote, say) }, carried: carrying(files, setFiles), mind: signed && !working ? mind : null, mode: signed && !working ? { value: mode, set: (m) => setPicked(m), items: MODES.filter((m) => DEV_MODES.includes(m.id)) } : null })] })] }));
104
+ }
@@ -7,7 +7,7 @@ export interface QueuedMessage {
7
7
  text: string;
8
8
  }
9
9
  export type TranscriptView = 'normal' | 'thinking' | 'verbose';
10
- export declare function Transcript({ cards, live, empty, header, onApprove, approving, onVerdict, onOpen, onDiff, listen, end, view, queued, onSendQueued, }: {
10
+ export declare function Transcript({ cards, live, empty, header, onApprove, approving, onVerdict, onOpen, onDiff, listen, end, view, queued, onSendQueued, onRun, onAnswer, }: {
11
11
  cards: Card[];
12
12
  /** The run is still working: a card still running shows it; otherwise it was cut off. */
13
13
  live: boolean;
@@ -32,4 +32,8 @@ export declare function Transcript({ cards, live, empty, header, onApprove, appr
32
32
  queued?: QueuedMessage[];
33
33
  /** Send a queued message immediately. */
34
34
  onSendQueued?: (id: string) => void;
35
+ /** Open a coding run a conversation started, on its own page. */
36
+ onRun?: (session: string) => void;
37
+ /** Answer a question the run asked with one of its options. Absent, a question has no buttons. */
38
+ onAnswer?: (question: string, label: string) => void;
35
39
  }): import("react").JSX.Element;
package/lib/transcript.js CHANGED
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  * A run's transcript, drawn by what each part is (turn.ts `cards`): what the
4
4
  * agent said as markdown, its reasoning folded, each command it ran as a card
5
5
  * that opens onto its output, the files it changed, its plan as a checklist, the
6
- * run's own steps, and a plan run's plan with the button that builds it.
6
+ * run's own steps, a plan run's plan with the button that builds it, and in a
7
+ * conversation the coding runs its turns started, each opening on its own page.
7
8
  * What the agent said, and its plan, can be copied and judged, as a reply on
8
9
  * claude.ai can: a thumb pressed again takes the verdict back.
9
10
  *
@@ -22,6 +23,7 @@ import { Button } from '@hanzo/ui';
22
23
  import { Feedback } from '@hanzo/ui/agents';
23
24
  import { Code, GAP, MEASURE, Message, Step, Thread } from '@hanzo/ui/chat';
24
25
  import { useState } from 'react';
26
+ import { counted, edited, explored } from './api/cli.js';
25
27
  import { Prose } from './prose.js';
26
28
  import { artifacts, lead, Reply } from './reply.js';
27
29
  /** A card's output, its tail: what a command said last is why it stopped. */
@@ -36,7 +38,7 @@ function UserSaid({ text }) {
36
38
  const long = text.length > 180 || text.includes('\n');
37
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] }));
38
40
  }
39
- export function Transcript({ cards, live, empty, header, onApprove, approving = false, onVerdict, onOpen, onDiff, listen, end, view = 'normal', queued = [], onSendQueued, }) {
41
+ export function Transcript({ cards, live, empty, header, onApprove, approving = false, onVerdict, onOpen, onDiff, listen, end, view = 'normal', queued = [], onSendQueued, onRun, onAnswer, }) {
40
42
  const { t } = useI18n();
41
43
  // A card the run never finished is cut off once the run has ended, not still going.
42
44
  const state = (ran) => (ran === 'running' && !live ? 'cancelled' : ran);
@@ -58,13 +60,22 @@ export function Transcript({ cards, live, empty, header, onApprove, approving =
58
60
  case 'todo':
59
61
  return (_jsx(YStack, { gap: "$1", px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", "aria-label": t('Plan checklist'), children: c.items.map((x, i) => (_jsxs(XStack, { gap: "$2", items: "flex-start", children: [_jsx(SizableText, { size: "$2", color: x.done ? '$ink' : '$soft', children: x.done ? '✓' : '○' }), _jsx(SizableText, { flex: 1, size: "$2", color: x.done ? '$soft' : '$ink', children: x.text })] }, i))) }, c.key));
60
62
  case 'shell':
61
- return (_jsx(Step, { name: t('Shell'), detail: c.command, status: state(c.ran), defaultOpen: expandVerbose, "aria-label": t('Command {command}', { command: c.command }), children: _jsx(Code, { language: "shell", value: c.output ? `$ ${c.command}\n${c.output}` : `$ ${c.command}`, children: c.output ? `$ ${c.command}\n${tail(c.output)}` : `$ ${c.command}` }) }, `${c.key}:${view}`));
63
+ // The CLI's words: Ran (Running while it works), the command as the shell got it, its output under it.
64
+ return (_jsx(Step, { name: state(c.ran) === 'running' ? t('Running') : t('Ran'), detail: c.command, status: state(c.ran), defaultOpen: expandVerbose, "aria-label": t('Command {command}', { command: c.command }), children: _jsx(Code, { language: "shell", value: c.output || t('(no output)'), children: c.output ? tail(c.output.replace(/\n+$/, '')) : t('(no output)') }) }, `${c.key}:${view}`));
65
+ case 'explore':
66
+ // The CLI's Explored block: one line an action, consecutive reads on one line (cli.ts explored).
67
+ return (_jsxs(YStack, { gap: "$1", "aria-label": state(c.ran) === 'running' ? t('Exploring') : t('Explored'), children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: state(c.ran) === 'running' ? t('Exploring') : t('Explored') }), explored(c.calls).map((l, i) => (_jsxs(XStack, { gap: "$2", pl: "$3", children: [_jsx(SizableText, { size: "$2", color: "$soft", shrink: 0, children: t(l.title) }), _jsx(SizableText, { size: "$2", color: "$ink", style: { ...mono, overflowWrap: 'anywhere' }, children: l.text })] }, i)))] }, c.key));
62
68
  case 'edit':
63
- return (_jsx(Step, { name: c.files.length === 1 ? t('Edited') : c.files.length ? t('Edited {n} files', { n: c.files.length }) : t('Edited files'), detail: c.files.join(', '), status: state(c.ran), defaultOpen: expandVerbose, "aria-label": c.files.length ? t('Edited {files}', { files: c.files.join(', ') }) : 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.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}`));
69
+ // The CLI's patch header: Added / Deleted / Edited a file, or Edited N files, with the lines added and removed.
70
+ 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}`));
64
71
  case 'step':
65
72
  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}`));
66
73
  case 'note':
67
74
  return (_jsx(SizableText, { size: "$1", color: "$soft", role: "note", children: t(c.text) }, c.key));
75
+ case 'run':
76
+ 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
+ case 'ask':
78
+ return (_jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", "aria-label": t('Question'), children: [_jsx(Prose, { text: c.text }), c.answer ? (_jsx(SizableText, { size: "$2", color: "$soft", children: `✓ ${c.answer}` })) : (_jsx(XStack, { gap: "$2", flexWrap: "wrap", children: c.options.map((label) => (_jsx(Button, { size: "sm", variant: "outline", disabled: !onAnswer, onPress: () => onAnswer?.(c.question, label), children: label }, label))) }))] }, c.key));
68
79
  case 'plan':
69
80
  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));
70
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/build",
3
- "version": "0.2.122",
3
+ "version": "0.2.124",
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.",