genaicode 2.14.0 → 2.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +70 -0
  3. package/dist/agents/drivers/claude.d.ts +5 -0
  4. package/dist/agents/drivers/claude.js +12 -4
  5. package/dist/agents/drivers/claude.js.map +1 -1
  6. package/dist/agents/drivers/codex.d.ts +34 -2
  7. package/dist/agents/drivers/codex.js +83 -8
  8. package/dist/agents/drivers/codex.js.map +1 -1
  9. package/dist/agents/drivers/copilot.d.ts +13 -0
  10. package/dist/agents/drivers/copilot.js +26 -1
  11. package/dist/agents/drivers/copilot.js.map +1 -1
  12. package/dist/agents/drivers/mcp-isolation.d.ts +9 -0
  13. package/dist/agents/drivers/mcp-isolation.js +24 -0
  14. package/dist/agents/drivers/mcp-isolation.js.map +1 -0
  15. package/dist/agents/prepare.d.ts +2 -0
  16. package/dist/agents/prepare.js +2 -1
  17. package/dist/agents/prepare.js.map +1 -1
  18. package/dist/agents/session.d.ts +12 -2
  19. package/dist/agents/session.js +53 -9
  20. package/dist/agents/session.js.map +1 -1
  21. package/dist/app-agent/app-agent.d.ts +139 -0
  22. package/dist/app-agent/app-agent.js +683 -0
  23. package/dist/app-agent/app-agent.js.map +1 -0
  24. package/dist/app-agent/git.d.ts +25 -0
  25. package/dist/app-agent/git.js +286 -0
  26. package/dist/app-agent/git.js.map +1 -0
  27. package/dist/app-agent/http.d.ts +41 -0
  28. package/dist/app-agent/http.js +228 -0
  29. package/dist/app-agent/http.js.map +1 -0
  30. package/dist/app-agent/json.d.ts +7 -0
  31. package/dist/app-agent/json.js +62 -0
  32. package/dist/app-agent/json.js.map +1 -0
  33. package/dist/app-agent/mcp.d.ts +15 -0
  34. package/dist/app-agent/mcp.js +53 -0
  35. package/dist/app-agent/mcp.js.map +1 -0
  36. package/dist/app-agent/policy.d.ts +13 -0
  37. package/dist/app-agent/policy.js +99 -0
  38. package/dist/app-agent/policy.js.map +1 -0
  39. package/dist/app-agent/state.d.ts +75 -0
  40. package/dist/app-agent/state.js +10 -0
  41. package/dist/app-agent/state.js.map +1 -0
  42. package/dist/app-agent.d.ts +8 -0
  43. package/dist/app-agent.js +5 -0
  44. package/dist/app-agent.js.map +1 -0
  45. package/dist/react/agent-chat.css +137 -0
  46. package/dist/react/app-agent-chat.d.ts +62 -0
  47. package/dist/react/app-agent-chat.js +230 -0
  48. package/dist/react/app-agent-chat.js.map +1 -0
  49. package/dist/react.d.ts +4 -0
  50. package/dist/react.js +2 -0
  51. package/dist/react.js.map +1 -1
  52. package/dist/ui/index.js +59 -59
  53. package/dist/ui/web-client.js +148 -11
  54. package/package.json +5 -1
@@ -66,6 +66,8 @@
66
66
  .gc-chat {
67
67
  height: 100%;
68
68
  min-height: 0;
69
+ /* As a flex item it may shrink below its widest line, so a narrow drawer does not overflow. */
70
+ min-width: 0;
69
71
  display: flex;
70
72
  flex-direction: column;
71
73
  background: var(--_bg);
@@ -504,3 +506,138 @@
504
506
  max-width: 92%;
505
507
  }
506
508
  }
509
+
510
+ /* <AppAgentChat>: page chips, action cards, the agent and mode controls */
511
+ .gc-app-controls {
512
+ display: flex;
513
+ align-items: center;
514
+ gap: 8px;
515
+ flex-wrap: wrap;
516
+ }
517
+ .gc-app-controls select {
518
+ font: inherit;
519
+ font-size: 0.87em;
520
+ color: var(--_text);
521
+ background: var(--_bg);
522
+ border: 1px solid var(--_border);
523
+ border-radius: 8px;
524
+ padding: 5px 8px;
525
+ }
526
+ .gc-app-modes {
527
+ display: inline-flex;
528
+ border: 1px solid var(--_border);
529
+ border-radius: 999px;
530
+ overflow: hidden;
531
+ }
532
+ .gc-app-modes button {
533
+ font: inherit;
534
+ font-size: 0.87em;
535
+ border: 0;
536
+ background: transparent;
537
+ color: var(--_muted);
538
+ padding: 4px 12px;
539
+ cursor: pointer;
540
+ }
541
+ .gc-app-modes button.gc-on {
542
+ background: var(--_accent-soft);
543
+ color: var(--_text);
544
+ font-weight: 600;
545
+ }
546
+ .gc-app-modes button:disabled,
547
+ .gc-app-controls select:disabled {
548
+ cursor: default;
549
+ opacity: 0.6;
550
+ }
551
+ .gc-app-banner {
552
+ flex-basis: 100%;
553
+ order: 99;
554
+ font-size: 0.87em;
555
+ color: var(--_error);
556
+ background: var(--_error-soft);
557
+ border-radius: 8px;
558
+ padding: 6px 10px;
559
+ }
560
+ .gc-app-links {
561
+ display: flex;
562
+ flex-wrap: wrap;
563
+ gap: 6px;
564
+ padding-left: 38px;
565
+ }
566
+ .gc-app-link {
567
+ font: inherit;
568
+ font-size: 0.87em;
569
+ border: 1px solid var(--_accent);
570
+ color: var(--_accent);
571
+ background: var(--_panel);
572
+ border-radius: 999px;
573
+ padding: 3px 12px;
574
+ cursor: pointer;
575
+ }
576
+ .gc-app-link::after {
577
+ content: ' →';
578
+ }
579
+ .gc-app-link.gc-here {
580
+ background: var(--_accent-soft);
581
+ }
582
+ .gc-prompt:has(> .gc-app-note) {
583
+ background: transparent;
584
+ color: var(--_muted);
585
+ border: 1px dashed var(--_border);
586
+ font-size: 0.87em;
587
+ }
588
+ .gc-app-actions {
589
+ display: flex;
590
+ flex-direction: column;
591
+ gap: 10px;
592
+ }
593
+ .gc-app-action {
594
+ border: 1px solid var(--_border);
595
+ background: var(--_panel);
596
+ border-radius: 12px;
597
+ padding: 12px 14px;
598
+ display: flex;
599
+ flex-direction: column;
600
+ gap: 8px;
601
+ font-size: 0.93em;
602
+ }
603
+ .gc-app-action.gc-pending {
604
+ border-color: var(--_warn);
605
+ background: var(--_warn-soft);
606
+ }
607
+ .gc-app-action.gc-failed {
608
+ border-color: var(--_error);
609
+ }
610
+ .gc-app-action.gc-done,
611
+ .gc-app-action.gc-rejected {
612
+ opacity: 0.75;
613
+ }
614
+ .gc-app-action-head {
615
+ display: flex;
616
+ justify-content: space-between;
617
+ gap: 8px;
618
+ align-items: baseline;
619
+ }
620
+ .gc-app-action code,
621
+ .gc-app-action pre {
622
+ font-family: var(--_mono);
623
+ font-size: 0.87em;
624
+ }
625
+ .gc-app-action pre {
626
+ margin: 0;
627
+ background: var(--_code-bg);
628
+ border-radius: 8px;
629
+ padding: 8px 10px;
630
+ overflow: auto;
631
+ max-height: 320px;
632
+ white-space: pre-wrap;
633
+ overflow-wrap: anywhere;
634
+ }
635
+ .gc-app-diff-status {
636
+ color: var(--_muted);
637
+ font-size: 0.87em;
638
+ }
639
+ .gc-app-action summary {
640
+ cursor: pointer;
641
+ color: var(--_muted);
642
+ font-size: 0.87em;
643
+ }
@@ -0,0 +1,62 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ import type { ApprovalDecision } from '../agents/types.js';
3
+ import { type AppAction, type AppAgentMode, type AppAgentState, type TreeChanges } from '../app-agent/state.js';
4
+ /** The page side of `createAppAgentHandler`: live state and the calls that drive it. */
5
+ export interface AppAgentClient {
6
+ /** Null until the first event arrives. */
7
+ state: AppAgentState | null;
8
+ /** The last failed call or a lost event stream. */
9
+ error: string | null;
10
+ send(text: string): void;
11
+ stop(): void;
12
+ reset(): void;
13
+ configure(change: {
14
+ agent?: string;
15
+ mode?: AppAgentMode;
16
+ }): void;
17
+ /** Tell the agent which page is open. */
18
+ view(path: string): void;
19
+ decide(id: string, decision: 'approve' | 'reject'): void;
20
+ approve(id: string, decision: ApprovalDecision): void;
21
+ changes(id: string): Promise<TreeChanges>;
22
+ }
23
+ export interface AppAgentClientOptions {
24
+ /**
25
+ * URL of the event stream. Default `<basePath>/events`. `EventSource` cannot send headers,
26
+ * so an app that wants a key on every request puts it in this URL's query.
27
+ */
28
+ eventsUrl?: string;
29
+ }
30
+ /**
31
+ * Connect to an app agent served by `createAppAgentHandler` at `basePath` (default
32
+ * `/api/agent`, same origin). Calls send the page's cookies, so the app's `authorize` sees them.
33
+ */
34
+ export declare function useAppAgent(basePath?: string, options?: AppAgentClientOptions): AppAgentClient;
35
+ export interface AppAgentChatProps {
36
+ /** Where `createAppAgentHandler` is mounted. Default `/api/agent`. */
37
+ basePath?: string;
38
+ /** Or pass a client you already hold (`useAppAgent`), e.g. to share it with the page. */
39
+ client?: AppAgentClient;
40
+ /** The page the user has open, reported to the agent whenever it changes. */
41
+ currentPath?: string;
42
+ /** Open a page of the app: a link chip was clicked or the agent was asked to go there. */
43
+ onNavigate?(path: string): void;
44
+ /** Mode button labels. Default `use` and `dev`. */
45
+ modeLabels?: Partial<Record<AppAgentMode, string>>;
46
+ /** A line under the header, e.g. a warning that dev mode edits the running app. */
47
+ banner?: ReactNode;
48
+ /** How an action card describes what will run. Default: the tool and its arguments. */
49
+ renderAction?(action: AppAction): ReactNode;
50
+ emptyState?: ReactNode;
51
+ placeholder?: string;
52
+ theme?: 'auto' | 'light' | 'dark';
53
+ className?: string;
54
+ style?: CSSProperties;
55
+ }
56
+ /**
57
+ * The chat for an app agent: `<AgentChat>` plus the app agent's own parts, all drawn from
58
+ * the state the server streams. Under each reply it shows the agent's page chips; after the
59
+ * transcript, the actions waiting for the user (with the diff of a proposed commit); in the
60
+ * header, the agent picker, the modes and "New". Turns from before a switch stay in place.
61
+ */
62
+ export declare function AppAgentChat(props: AppAgentChatProps): import("react").JSX.Element;
@@ -0,0 +1,230 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ import { APP_NOTE, userText, } from '../app-agent/state.js';
4
+ import { AgentChat } from './agent-chat.js';
5
+ import { toolLabel } from './format.js';
6
+ // `mcp__app__tool` (Claude, Copilot) or `app/tool` (Codex) shows as `tool`.
7
+ const MCP_PREFIX = /^(mcp__[A-Za-z0-9_-]+__|[A-Za-z0-9_-]+\/)/;
8
+ /**
9
+ * Connect to an app agent served by `createAppAgentHandler` at `basePath` (default
10
+ * `/api/agent`, same origin). Calls send the page's cookies, so the app's `authorize` sees them.
11
+ */
12
+ export function useAppAgent(basePath = '/api/agent', options = {}) {
13
+ const base = basePath.replace(/\/$/, '');
14
+ const eventsUrl = options.eventsUrl ?? `${base}/events`;
15
+ const [state, setState] = useState(null);
16
+ const [error, setError] = useState(null);
17
+ // While the stream is up it is the truth: a POST reply can be older than its latest snapshot.
18
+ const streaming = useRef(false);
19
+ // Another backend: nothing from the old one may stay on screen or land late, or a card could send
20
+ // its id to the new one.
21
+ const current = useRef(base);
22
+ current.current = base;
23
+ useEffect(() => {
24
+ setState(null);
25
+ const source = new EventSource(eventsUrl);
26
+ source.onmessage = (event) => {
27
+ streaming.current = true;
28
+ setError(null);
29
+ setState(JSON.parse(event.data));
30
+ };
31
+ source.onerror = () => {
32
+ streaming.current = false;
33
+ setError('Lost the connection to the agent; retrying…');
34
+ };
35
+ return () => {
36
+ streaming.current = false;
37
+ source.close();
38
+ };
39
+ }, [base, eventsUrl]);
40
+ const call = useCallback((route, body = {}) => {
41
+ setError(null);
42
+ fetch(`${base}${route}`, {
43
+ method: 'POST',
44
+ headers: { 'content-type': 'application/json' },
45
+ body: JSON.stringify(body),
46
+ })
47
+ .then(async (res) => {
48
+ if (res.status === 204)
49
+ return;
50
+ const data = (await res.json());
51
+ if (current.current !== base)
52
+ return;
53
+ if (!res.ok)
54
+ throw new Error(data.error ?? `HTTP ${res.status}`);
55
+ if (!streaming.current)
56
+ setState(data);
57
+ })
58
+ .catch((e) => {
59
+ if (current.current === base)
60
+ setError(e.message);
61
+ });
62
+ }, [base]);
63
+ // Stable, so a card does not reload its diff on every streamed update.
64
+ const changes = useCallback(async (id) => {
65
+ const res = await fetch(`${base}/actions/${encodeURIComponent(id)}/changes`);
66
+ if (!res.ok)
67
+ throw new Error(`HTTP ${res.status}`);
68
+ return (await res.json());
69
+ }, [base]);
70
+ return useMemo(() => ({
71
+ state,
72
+ error,
73
+ send: (text) => call('/send', { text }),
74
+ stop: () => call('/stop'),
75
+ reset: () => call('/reset'),
76
+ configure: (change) => call('/config', change),
77
+ view: (path) => call('/view', { path }),
78
+ decide: (id, decision) => call(`/actions/${encodeURIComponent(id)}`, { decision }),
79
+ approve: (id, decision) => call(`/approvals/${encodeURIComponent(id)}`, { decision }),
80
+ changes,
81
+ }), [state, error, call, changes]);
82
+ }
83
+ /**
84
+ * The chat for an app agent: `<AgentChat>` plus the app agent's own parts, all drawn from
85
+ * the state the server streams. Under each reply it shows the agent's page chips; after the
86
+ * transcript, the actions waiting for the user (with the diff of a proposed commit); in the
87
+ * header, the agent picker, the modes and "New". Turns from before a switch stay in place.
88
+ */
89
+ export function AppAgentChat(props) {
90
+ return props.client ? _jsx(AppAgentView, { ...props, client: props.client }) : _jsx(ConnectedChat, { ...props });
91
+ }
92
+ function ConnectedChat(props) {
93
+ const client = useAppAgent(props.basePath);
94
+ return _jsx(AppAgentView, { ...props, client: client });
95
+ }
96
+ function AppAgentView(props) {
97
+ const { client } = props;
98
+ const { state } = client;
99
+ const { onNavigate, currentPath } = props;
100
+ // Report the open page; the agent reads it with each prompt. Once until the server's state
101
+ // shows it, then again whenever it does not: a restarted or another backend starts without it.
102
+ const reported = useRef(null);
103
+ // A lost report or a lost stream (maybe a restarted backend) leaves nothing acknowledged: report
104
+ // again, but only on the next streamed state, so a backend that keeps refusing is not hammered.
105
+ const retry = useRef(undefined);
106
+ const latest = useRef(state);
107
+ latest.current = state;
108
+ useEffect(() => {
109
+ if (client.error)
110
+ retry.current = latest.current;
111
+ }, [client.error]);
112
+ const serverView = state?.view;
113
+ useEffect(() => {
114
+ // No state yet: a new connection or another backend, which has heard nothing.
115
+ if (!state)
116
+ reported.current = null;
117
+ if (!state || currentPath === undefined)
118
+ return;
119
+ if (serverView === currentPath) {
120
+ reported.current = null;
121
+ return;
122
+ }
123
+ if (retry.current !== undefined && retry.current !== state) {
124
+ retry.current = undefined;
125
+ reported.current = null;
126
+ }
127
+ if (reported.current === currentPath)
128
+ return;
129
+ reported.current = currentPath;
130
+ client.view(currentPath);
131
+ }, [client, state, serverView, currentPath]);
132
+ // Follow `app_open` once per request; the first state only primes the counter.
133
+ const handled = useRef(null);
134
+ const navigation = state?.navigation;
135
+ useEffect(() => {
136
+ if (!state)
137
+ return;
138
+ const id = navigation?.id ?? 0;
139
+ const primed = handled.current !== null;
140
+ if (handled.current === id)
141
+ return;
142
+ handled.current = id;
143
+ if (primed && navigation)
144
+ onNavigate?.(navigation.path);
145
+ }, [state, navigation, onNavigate]);
146
+ const shown = useMemo(() => merged(state), [state]);
147
+ const notices = useMemo(() => switchNotices(state), [state]);
148
+ // An approved action that still runs blocks switches and New on the server too.
149
+ const running = state?.session?.status === 'running' || !!state?.actions.some((action) => action.status === 'running');
150
+ const labels = { use: 'use', dev: 'dev', ...props.modeLabels };
151
+ const pending = state?.actions.filter((action) => action.status === 'pending' || action.status === 'running');
152
+ const settled = state?.actions.filter((action) => action.status !== 'pending' && action.status !== 'running');
153
+ return (_jsx(AgentChat, { state: shown, onSend: client.send, onStop: client.stop, onApprove: client.approve, renderPrompt: (text) => {
154
+ const typed = userText(text);
155
+ if (!typed.startsWith(APP_NOTE))
156
+ return typed;
157
+ return _jsx("span", { className: "gc-app-note", children: typed.slice(APP_NOTE.length).split('\n')[0] });
158
+ }, formatToolName: (name) => toolLabel(name.replace(MCP_PREFIX, '')), renderAfterTurn: (turn) => {
159
+ const links = state?.links.filter((link) => link.turnId === turn.id) ?? [];
160
+ if (!links.length)
161
+ return null;
162
+ return (_jsx("div", { className: "gc-app-links", children: links.map((link, index) => (_jsx("button", { type: "button", className: `gc-app-link${link.path === currentPath ? ' gc-here' : ''}`, title: link.path, onClick: () => onNavigate?.(link.path), children: link.label }, index))) }));
163
+ }, renderFooter: () => state?.actions.length ? (_jsxs("div", { className: "gc-app-actions", children: [[...(settled ?? []), ...(pending ?? [])].map((action) => (_jsx(ActionCard, { action: action, client: client, render: props.renderAction }, action.id))), client.error && _jsx("div", { className: "gc-error", children: client.error })] })) : client.error ? (_jsx("div", { className: "gc-error", children: client.error })) : null, notices: notices, headerExtras: state ? (_jsxs("div", { className: "gc-app-controls", children: [props.banner && _jsx("div", { className: "gc-app-banner", children: props.banner }), _jsx("select", { "aria-label": "Agent", value: state.agent, disabled: running, onChange: (e) => client.configure({ agent: e.target.value }), children: state.agents.map((choice) => (_jsxs("option", { value: choice.name, disabled: !choice.installed, children: [choice.name, choice.installed ? '' : ' (not installed)'] }, choice.name))) }), state.modes.length > 1 && (_jsx("div", { className: "gc-app-modes", role: "group", "aria-label": "Mode", children: state.modes.map((mode) => (_jsx("button", { type: "button", className: state.mode === mode ? 'gc-on' : '', "aria-pressed": state.mode === mode, disabled: running, onClick: () => client.configure({ mode }), children: labels[mode] }, mode))) })), _jsx("button", { type: "button", className: "gc-btn", disabled: running, onClick: client.reset, title: "New conversation", children: "New" })] })) : undefined, emptyState: props.emptyState, placeholder: props.placeholder, disabled: !state, theme: props.theme, className: ['gc-app', props.className].filter(Boolean).join(' '), style: props.style }));
164
+ }
165
+ function ActionCard({ action, client, render, }) {
166
+ // A loaded diff belongs to one reviewed tree: ids start over when the server restarts.
167
+ const key = `${action.id}:${action.commit?.tree ?? ''}:${action.commit?.base ?? ''}`;
168
+ const [loaded, setLoaded] = useState(null);
169
+ const changes = loaded?.key === key ? (loaded.changes ?? null) : null;
170
+ const loadError = loaded?.key === key ? (loaded.error ?? null) : null;
171
+ const { changes: load } = client;
172
+ useEffect(() => {
173
+ if (action.kind !== 'commit' || action.status !== 'pending')
174
+ return;
175
+ // A reply for a tree the card no longer shows is dropped.
176
+ let current = true;
177
+ load(action.id).then((result) => current && setLoaded({ key, changes: result }), (error) => current && setLoaded({ key, error: error instanceof Error ? error.message : String(error) }));
178
+ return () => {
179
+ current = false;
180
+ };
181
+ }, [action.id, action.kind, action.status, key, load]);
182
+ // A commit is approved only after its diff has been shown.
183
+ const blocked = action.kind === 'commit' && (!changes || changes.truncated === true);
184
+ const what = render?.(action) ??
185
+ (action.kind === 'commit' ? (_jsx("pre", { children: action.commit?.message })) : (_jsxs(_Fragment, { children: [_jsx("code", { children: action.tool?.name }), action.tool && Object.keys(action.tool.args).length > 0 && (_jsx("pre", { children: JSON.stringify(action.tool.args, null, 2) }))] })));
186
+ return (_jsxs("div", { className: `gc-app-action gc-${action.status}`, children: [_jsxs("div", { className: "gc-app-action-head", children: [_jsx("strong", { children: action.summary }), _jsx("span", { className: "gc-chip", children: action.kind === 'commit' ? 'commit' : action.status })] }), what, changes && (_jsxs("details", { children: [_jsxs("summary", { children: [changes.files.length, " changed file", changes.files.length === 1 ? '' : 's'] }), _jsx("pre", { children: changes.files.map((file) => `${file.status.padEnd(2)} ${file.path}`).join('\n') }), _jsx("pre", { className: "gc-app-diff", children: changes.diff })] })), changes?.binary && (_jsxs("div", { className: "gc-app-diff-status", children: ["Binary, contents not shown: ", changes.binary.join(', '), ". Check them in your editor before approving."] })), action.status === 'pending' && blocked && (_jsx("div", { className: "gc-app-diff-status", children: changes?.truncated
187
+ ? 'The diff is too large to review here. Reject it and commit from git yourself.'
188
+ : loadError
189
+ ? `Could not load the changes: ${loadError}`
190
+ : 'Loading the changes…' })), action.status === 'pending' ? (_jsxs("div", { className: "gc-buttons", children: [_jsx("button", { type: "button", className: "gc-btn gc-primary", disabled: blocked, onClick: () => client.decide(action.id, 'approve'), children: "Approve" }), _jsx("button", { type: "button", className: "gc-btn gc-danger", onClick: () => client.decide(action.id, 'reject'), children: "Reject" })] })) : (action.result && (_jsxs("details", { children: [_jsx("summary", { children: action.status === 'running' ? 'Running…' : 'Result' }), _jsx("pre", { children: action.result })] })))] }));
191
+ }
192
+ // History first, then the live session, as one transcript.
193
+ function merged(state) {
194
+ if (!state)
195
+ return null;
196
+ const { session, history } = state;
197
+ if (!history.length)
198
+ return session;
199
+ if (session)
200
+ return { ...session, turns: [...history, ...session.turns] };
201
+ return {
202
+ agent: state.agent,
203
+ cwd: '',
204
+ status: 'idle',
205
+ turns: history,
206
+ queued: [],
207
+ approvals: [],
208
+ usage: {},
209
+ canSteer: false,
210
+ };
211
+ }
212
+ // "Continued with <agent>" where the agent changed.
213
+ function switchNotices(state) {
214
+ if (!state?.history.length)
215
+ return [];
216
+ const turns = [...state.history, ...(state.session?.turns ?? [])];
217
+ const notices = [];
218
+ for (let index = 1; index < turns.length; index++) {
219
+ const before = turns[index - 1];
220
+ const after = turns[index];
221
+ if ((before.id < 0 && after.id > 0) || before.agent !== after.agent) {
222
+ notices.push({ id: `switch-${index}`, afterTurn: index, text: `Continued with ${after.agent}` });
223
+ }
224
+ }
225
+ if (!state.session && state.history.length) {
226
+ notices.push({ id: 'switch-end', afterTurn: turns.length, text: `Continued with ${state.agent} (${state.mode})` });
227
+ }
228
+ return notices;
229
+ }
230
+ //# sourceMappingURL=app-agent-chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-agent-chat.js","sourceRoot":"","sources":["../../src/react/app-agent-chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AAG9G,OAAO,EACL,QAAQ,EACR,QAAQ,GAKT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAmB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,4EAA4E;AAC5E,MAAM,UAAU,GAAG,2CAA2C,CAAC;AA2B/D;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAQ,GAAG,YAAY,EAAE,UAAiC,EAAE;IACtF,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,IAAI,SAAS,CAAC;IACxD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAuB,IAAI,CAAC,CAAC;IAC/D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,8FAA8F;IAC9F,MAAM,SAAS,GAAG,MAAM,CAA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KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAE,CAAC;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC;YACpE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,UAAU,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACnG,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IACrH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/react.d.ts CHANGED
@@ -14,6 +14,10 @@
14
14
  export { AgentChat } from './react/agent-chat.js';
15
15
  export type { AgentChatProps, ChatNotice } from './react/agent-chat.js';
16
16
  export { Markdown } from './react/markdown.js';
17
+ export { AppAgentChat, useAppAgent } from './react/app-agent-chat.js';
18
+ export type { AppAgentChatProps, AppAgentClient, AppAgentClientOptions } from './react/app-agent-chat.js';
19
+ export { APP_NOTE, PROMPT_MARKER, userText } from './app-agent/state.js';
20
+ export type { AppAction, AppActionStatus, AppAgentMode, AppAgentState, AppLink, TreeChanges, } from './app-agent/state.js';
17
21
  export { formatDuration, formatUsage, relativePath, shortId, toolLabel, toolSummary, turnFooter, } from './react/format.js';
18
22
  export type { SessionEntry, SessionState, SessionTurn } from './agents/session.js';
19
23
  export type { ApprovalDecision, ApprovalRequest } from './agents/types.js';
package/dist/react.js CHANGED
@@ -13,6 +13,8 @@
13
13
  */
14
14
  export { AgentChat } from './react/agent-chat.js';
15
15
  export { Markdown } from './react/markdown.js';
16
+ export { AppAgentChat, useAppAgent } from './react/app-agent-chat.js';
17
+ export { APP_NOTE, PROMPT_MARKER, userText } from './app-agent/state.js';
16
18
  export { formatDuration, formatUsage, relativePath, shortId, toolLabel, toolSummary, turnFooter, } from './react/format.js';
17
19
  export { useFollowScroll } from './react/follow-scroll.js';
18
20
  export { installResizeHandle, storedSize } from './react/resize-handle.js';
package/dist/react.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,GACX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AASzE,OAAO,EACL,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,SAAS,EACT,WAAW,EACX,UAAU,GACX,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}