genaicode 2.9.1 → 2.13.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.
- package/CHANGELOG.md +66 -0
- package/README.md +142 -16
- package/dist/agents/cli-agent.d.ts +6 -3
- package/dist/agents/cli-agent.js +57 -35
- package/dist/agents/cli-agent.js.map +1 -1
- package/dist/agents/drivers/antigravity.d.ts +7 -1
- package/dist/agents/drivers/antigravity.js +27 -2
- package/dist/agents/drivers/antigravity.js.map +1 -1
- package/dist/agents/drivers/claude-approvals.d.ts +86 -0
- package/dist/agents/drivers/claude-approvals.js +277 -0
- package/dist/agents/drivers/claude-approvals.js.map +1 -0
- package/dist/agents/drivers/claude.d.ts +12 -2
- package/dist/agents/drivers/claude.js +73 -11
- package/dist/agents/drivers/claude.js.map +1 -1
- package/dist/agents/drivers/codex-approvals.d.ts +10 -0
- package/dist/agents/drivers/codex-approvals.js +102 -0
- package/dist/agents/drivers/codex-approvals.js.map +1 -0
- package/dist/agents/drivers/codex-live.d.ts +12 -1
- package/dist/agents/drivers/codex-live.js +46 -32
- package/dist/agents/drivers/codex-live.js.map +1 -1
- package/dist/agents/drivers/codex.d.ts +10 -1
- package/dist/agents/drivers/codex.js +48 -2
- package/dist/agents/drivers/codex.js.map +1 -1
- package/dist/agents/drivers/copilot.d.ts +9 -1
- package/dist/agents/drivers/copilot.js +31 -1
- package/dist/agents/drivers/copilot.js.map +1 -1
- package/dist/agents/drivers/cursor.d.ts +10 -1
- package/dist/agents/drivers/cursor.js +48 -5
- package/dist/agents/drivers/cursor.js.map +1 -1
- package/dist/agents/drivers/gemini.d.ts +11 -1
- package/dist/agents/drivers/gemini.js +46 -2
- package/dist/agents/drivers/gemini.js.map +1 -1
- package/dist/agents/drivers/muse-approvals.d.ts +19 -0
- package/dist/agents/drivers/muse-approvals.js +156 -0
- package/dist/agents/drivers/muse-approvals.js.map +1 -0
- package/dist/agents/drivers/muse-live.d.ts +5 -1
- package/dist/agents/drivers/muse-live.js +21 -109
- package/dist/agents/drivers/muse-live.js.map +1 -1
- package/dist/agents/drivers/opencode.d.ts +7 -1
- package/dist/agents/drivers/opencode.js +28 -2
- package/dist/agents/drivers/opencode.js.map +1 -1
- package/dist/agents/drivers/permission-args.d.ts +14 -0
- package/dist/agents/drivers/permission-args.js +40 -0
- package/dist/agents/drivers/permission-args.js.map +1 -0
- package/dist/agents/drivers/vibe.d.ts +9 -1
- package/dist/agents/drivers/vibe.js +40 -2
- package/dist/agents/drivers/vibe.js.map +1 -1
- package/dist/agents/hosted.js +6 -0
- package/dist/agents/hosted.js.map +1 -1
- package/dist/agents/live-agent.d.ts +49 -4
- package/dist/agents/live-agent.js +84 -15
- package/dist/agents/live-agent.js.map +1 -1
- package/dist/agents/permissions.d.ts +27 -0
- package/dist/agents/permissions.js +79 -0
- package/dist/agents/permissions.js.map +1 -0
- package/dist/agents/prepare.d.ts +12 -1
- package/dist/agents/prepare.js +18 -3
- package/dist/agents/prepare.js.map +1 -1
- package/dist/agents/rpc.d.ts +13 -2
- package/dist/agents/rpc.js +20 -2
- package/dist/agents/rpc.js.map +1 -1
- package/dist/agents/runtime.d.ts +2 -0
- package/dist/agents/runtime.js +10 -0
- package/dist/agents/runtime.js.map +1 -1
- package/dist/agents/session.d.ts +9 -1
- package/dist/agents/session.js +71 -16
- package/dist/agents/session.js.map +1 -1
- package/dist/agents/types.d.ts +56 -7
- package/dist/agents.d.ts +21 -13
- package/dist/agents.js +14 -9
- package/dist/agents.js.map +1 -1
- package/dist/react/agent-chat.css +506 -0
- package/dist/react/agent-chat.d.ts +65 -0
- package/dist/react/agent-chat.js +148 -0
- package/dist/react/agent-chat.js.map +1 -0
- package/dist/react/format.d.ts +16 -0
- package/dist/react/format.js +95 -0
- package/dist/react/format.js.map +1 -0
- package/dist/react/markdown.d.ts +6 -0
- package/dist/react/markdown.js +163 -0
- package/dist/react/markdown.js.map +1 -0
- package/dist/react.d.ts +19 -0
- package/dist/react.js +17 -0
- package/dist/react.js.map +1 -0
- package/dist/ui/index.js +78 -136
- package/dist/ui/web-client.js +520 -13
- package/dist/ui.d.ts +71 -0
- package/dist/ui.js +25 -0
- package/dist/ui.js.map +1 -0
- package/dist/vite/overlay.js +132 -8
- package/dist/vite/overlay.js.map +1 -1
- package/docs/agents.md +130 -19
- package/docs/semver.md +2 -0
- package/package.json +22 -7
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AgentSession, SessionState } from './agents/session.js';
|
|
2
|
+
import type { AgentTask, ApprovalDecision, CodingAgent } from './agents/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* `genaicode/ui`: the `genaicode ui` chat served on 127.0.0.1 for a host that shows it in its
|
|
5
|
+
* own page (an iframe) and wants a say in the session: MCP servers, env, a prompt prefix.
|
|
6
|
+
*
|
|
7
|
+
* The UI itself (React, Ink) is bundled in `dist/ui/` and loaded only when
|
|
8
|
+
* `startEmbeddedWeb` runs, so importing this module pulls no UI code. For a chat drawn by the
|
|
9
|
+
* host's own React tree, use `genaicode/react` instead.
|
|
10
|
+
*/
|
|
11
|
+
export interface EmbeddedWebOptions {
|
|
12
|
+
/** Directory the agent works in. */
|
|
13
|
+
cwd: string;
|
|
14
|
+
/** Agents to offer. Default: the same headless drivers as `genaicode ui`. */
|
|
15
|
+
agents?: readonly CodingAgent[];
|
|
16
|
+
/** Agent to start with. Default: the first installed one. */
|
|
17
|
+
agent?: string;
|
|
18
|
+
model?: string;
|
|
19
|
+
effort?: string;
|
|
20
|
+
/** Continue this agent session on the first turn. */
|
|
21
|
+
resume?: string;
|
|
22
|
+
/** Environment for the agent CLIs. Default: `process.env`. */
|
|
23
|
+
env?: NodeJS.ProcessEnv;
|
|
24
|
+
/** Task fields for every turn: `mcpServers`, `timeoutMs`, `maxTurns`, `extraArgs`. */
|
|
25
|
+
task?: Omit<AgentTask, 'prompt' | 'cwd' | 'model' | 'effort' | 'resume' | 'signal' | 'onApproval' | 'env'>;
|
|
26
|
+
/** Rewrites each prompt before it reaches the agent; the transcript shows what was typed. */
|
|
27
|
+
transformPrompt?(prompt: string): string;
|
|
28
|
+
/** Approve every permission request without asking. */
|
|
29
|
+
approveAll?: boolean;
|
|
30
|
+
/** Bark when the agent needs the user or finishes, while the tab is hidden. Default true. */
|
|
31
|
+
bark?: boolean;
|
|
32
|
+
/** Origins of the pages that show the UI in a frame. Read per request. Default: none. */
|
|
33
|
+
frameAncestors?: () => readonly string[];
|
|
34
|
+
/** Port on 127.0.0.1. Default: a free port. */
|
|
35
|
+
port?: number;
|
|
36
|
+
/** Shown in the page header. Default: this package's version. */
|
|
37
|
+
version?: string;
|
|
38
|
+
}
|
|
39
|
+
/** The session behind an embedded UI, for the host to drive alongside the user. */
|
|
40
|
+
export interface EmbeddedChatController {
|
|
41
|
+
/** Send a prompt (or a slash command) as if typed in the UI. */
|
|
42
|
+
submit(text: string): 'ok' | 'quit';
|
|
43
|
+
stop(): void;
|
|
44
|
+
approve(id: string, decision: ApprovalDecision): boolean;
|
|
45
|
+
/** Show a line from the host in the transcript. */
|
|
46
|
+
note(text: string, tone?: 'info' | 'error'): void;
|
|
47
|
+
get(): {
|
|
48
|
+
session: SessionState;
|
|
49
|
+
};
|
|
50
|
+
subscribe(listener: (view: {
|
|
51
|
+
session: SessionState;
|
|
52
|
+
}) => void): () => void;
|
|
53
|
+
readonly session: AgentSession;
|
|
54
|
+
}
|
|
55
|
+
export interface EmbeddedWeb {
|
|
56
|
+
/** The UI with its access token: the iframe's `src`. Keep it out of logs and other pages. */
|
|
57
|
+
url: string;
|
|
58
|
+
controller: EmbeddedChatController;
|
|
59
|
+
close(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
/** What `startEmbeddedWeb` in the bundle (src/ui/index.tsx) takes, after defaults. */
|
|
62
|
+
export type EmbeddedWebBundleOptions = EmbeddedWebOptions & {
|
|
63
|
+
agents: readonly CodingAgent[];
|
|
64
|
+
version: string;
|
|
65
|
+
frameAncestors: () => readonly string[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Start the chat UI on 127.0.0.1 for the host's page. Rejects with an error named
|
|
69
|
+
* `NoAgentError` when no agent CLI is installed (or `agent` is unknown).
|
|
70
|
+
*/
|
|
71
|
+
export declare function startEmbeddedWeb(options: EmbeddedWebOptions): Promise<EmbeddedWeb>;
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { defaultAgents } from './agents/defaults.js';
|
|
3
|
+
/**
|
|
4
|
+
* Start the chat UI on 127.0.0.1 for the host's page. Rejects with an error named
|
|
5
|
+
* `NoAgentError` when no agent CLI is installed (or `agent` is unknown).
|
|
6
|
+
*/
|
|
7
|
+
export async function startEmbeddedWeb(options) {
|
|
8
|
+
const ui = await loadBundledUi();
|
|
9
|
+
return ui.startEmbeddedWeb({
|
|
10
|
+
...options,
|
|
11
|
+
agents: options.agents ?? defaultAgents(),
|
|
12
|
+
version: options.version ?? packageVersion(),
|
|
13
|
+
frameAncestors: options.frameAncestors ?? (() => []),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** The front ends are bundled into dist/ui by scripts/build-ui.mjs; the path is kept opaque to tsc. */
|
|
17
|
+
function loadBundledUi() {
|
|
18
|
+
const bundle = new URL('./ui/index.js', import.meta.url).href;
|
|
19
|
+
return import(bundle);
|
|
20
|
+
}
|
|
21
|
+
function packageVersion() {
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
return require('../package.json').version;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ui.js.map
|
package/dist/ui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAyErD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA2B;IAChE,MAAM,EAAE,GAAG,MAAM,aAAa,EAAE,CAAC;IACjC,OAAO,EAAE,CAAC,gBAAgB,CAAC;QACzB,GAAG,OAAO;QACV,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,aAAa,EAAE;QACzC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,cAAc,EAAE;QAC5C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,uGAAuG;AACvG,SAAS,aAAa;IACpB,MAAM,MAAM,GAAW,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAsB,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc;IACrB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,OAAQ,OAAO,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC;AACrE,CAAC"}
|
package/dist/vite/overlay.js
CHANGED
|
@@ -24,14 +24,19 @@ export function mountOverlay(config, hot) {
|
|
|
24
24
|
.badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
|
|
25
25
|
background: #c92a2a; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
|
|
26
26
|
.badge[hidden], .panel[hidden], .fix[hidden] { display: none; }
|
|
27
|
-
.panel { position: fixed; right: 18px; bottom: 82px; width: min(460px, calc(100vw - 36px));
|
|
28
|
-
display: flex; flex-direction: column; background: #fff; border: 1px solid #e4e4df; border-radius: 14px; overflow: hidden;
|
|
27
|
+
.panel { position: fixed; right: 18px; bottom: 82px; width: min(var(--width, 460px), calc(100vw - 36px));
|
|
28
|
+
height: min(var(--height, 680px), calc(100vh - 110px)); display: flex; flex-direction: column; background: #fff; border: 1px solid #e4e4df; border-radius: 14px; overflow: hidden;
|
|
29
29
|
box-shadow: 0 8px 40px rgba(0,0,0,.22); }
|
|
30
30
|
.head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #e4e4df; background: #f7f7f5; color: #1d1d1b; }
|
|
31
31
|
.head b { flex: 1; }
|
|
32
32
|
.head button { border: 1px solid #e4e4df; background: #fff; color: #1d1d1b; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
|
|
33
33
|
.head .fix { background: #c92a2a; border-color: #c92a2a; color: #fff; font-weight: 600; }
|
|
34
34
|
iframe { flex: 1; width: 100%; border: 0; background: #f7f7f5; }
|
|
35
|
+
.grip { position: absolute; z-index: 1; touch-action: none; outline-offset: -3px; }
|
|
36
|
+
.grip.width { left: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
|
|
37
|
+
.grip.height { left: 0; right: 0; top: 0; height: 6px; cursor: ns-resize; }
|
|
38
|
+
.grip:hover, .grip:focus-visible, .resizing .grip { background: rgba(127,127,120,.25); }
|
|
39
|
+
.resizing iframe { pointer-events: none; }
|
|
35
40
|
.note { padding: 16px; color: #6b6b66; }
|
|
36
41
|
@media (prefers-color-scheme: dark) {
|
|
37
42
|
.wolf, .panel { background-color: #1d1d1c; border-color: #2e2e2c; }
|
|
@@ -40,16 +45,123 @@ iframe { flex: 1; width: 100%; border: 0; background: #f7f7f5; }
|
|
|
40
45
|
iframe { background: #141414; }
|
|
41
46
|
}
|
|
42
47
|
</style>
|
|
48
|
+
<button class="wolf" title="genaicode" aria-expanded="false"><span class="badge" hidden></span></button>
|
|
43
49
|
<div class="panel" hidden>
|
|
44
50
|
<div class="head"><b>genaicode</b><button class="fix" hidden></button><button class="close" title="Hide">✕</button></div>
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
<div class="grip width" role="separator" aria-orientation="vertical" aria-label="Panel width" tabindex="0"
|
|
52
|
+
aria-keyshortcuts="Enter" title="Drag or use arrow keys to resize · Enter or double-click to reset"></div>
|
|
53
|
+
<div class="grip height" role="separator" aria-orientation="horizontal" aria-label="Panel height" tabindex="0"
|
|
54
|
+
aria-keyshortcuts="Enter" title="Drag or use arrow keys to resize · Enter or double-click to reset"></div>
|
|
55
|
+
</div>`;
|
|
47
56
|
const $ = (selector) => root.querySelector(selector);
|
|
48
57
|
const wolf = $('.wolf');
|
|
49
58
|
const badge = $('.badge');
|
|
50
59
|
const panel = $('.panel');
|
|
51
60
|
const fix = $('.fix');
|
|
52
61
|
let frame;
|
|
62
|
+
// The panel keeps its corner and grows left and up. Its size outlives reloads of the app.
|
|
63
|
+
const SIZE_KEY = 'genaicode-overlay-size';
|
|
64
|
+
const DEFAULT_SIZE = { width: 460, height: 680 };
|
|
65
|
+
const MIN_SIZE = { width: 320, height: 300 };
|
|
66
|
+
const size = { ...DEFAULT_SIZE };
|
|
67
|
+
try {
|
|
68
|
+
const saved = JSON.parse(localStorage.getItem(SIZE_KEY) ?? 'null');
|
|
69
|
+
for (const axis of ['width', 'height']) {
|
|
70
|
+
const value = saved?.[axis];
|
|
71
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
72
|
+
size[axis] = Math.max(MIN_SIZE[axis], Math.round(value));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// No storage, or nothing usable in it: the default size.
|
|
77
|
+
}
|
|
78
|
+
// What the window leaves for the panel; the CSS clamps to the same, even below the minimum.
|
|
79
|
+
const maxSize = () => ({
|
|
80
|
+
width: Math.max(0, innerWidth - 36),
|
|
81
|
+
height: Math.max(0, innerHeight - 110),
|
|
82
|
+
});
|
|
83
|
+
const minOf = (axis) => Math.min(MIN_SIZE[axis], maxSize()[axis]);
|
|
84
|
+
const grips = {
|
|
85
|
+
width: $('.grip.width'),
|
|
86
|
+
height: $('.grip.height'),
|
|
87
|
+
};
|
|
88
|
+
const sync = () => {
|
|
89
|
+
const max = maxSize();
|
|
90
|
+
for (const axis of ['width', 'height']) {
|
|
91
|
+
grips[axis].setAttribute('aria-valuemin', String(minOf(axis)));
|
|
92
|
+
grips[axis].setAttribute('aria-valuemax', String(max[axis]));
|
|
93
|
+
grips[axis].setAttribute('aria-valuenow', String(Math.min(max[axis], size[axis])));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const resize = (axis, value, save) => {
|
|
97
|
+
size[axis] = Math.round(Math.max(minOf(axis), Math.min(maxSize()[axis], value)));
|
|
98
|
+
panel.style.setProperty(`--${axis}`, `${size[axis]}px`);
|
|
99
|
+
sync();
|
|
100
|
+
if (!save)
|
|
101
|
+
return;
|
|
102
|
+
try {
|
|
103
|
+
localStorage.setItem(SIZE_KEY, JSON.stringify(size));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// The size just isn't remembered.
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (size.width !== DEFAULT_SIZE.width)
|
|
110
|
+
panel.style.setProperty('--width', `${size.width}px`);
|
|
111
|
+
if (size.height !== DEFAULT_SIZE.height)
|
|
112
|
+
panel.style.setProperty('--height', `${size.height}px`);
|
|
113
|
+
sync();
|
|
114
|
+
window.addEventListener('resize', sync);
|
|
115
|
+
for (const axis of ['width', 'height']) {
|
|
116
|
+
const grip = grips[axis];
|
|
117
|
+
const along = (event) => (axis === 'width' ? event.clientX : event.clientY);
|
|
118
|
+
grip.addEventListener('pointerdown', (event) => {
|
|
119
|
+
if (event.button !== 0)
|
|
120
|
+
return;
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
const start = along(event);
|
|
123
|
+
const from = Math.min(maxSize()[axis], size[axis]);
|
|
124
|
+
grip.setPointerCapture?.(event.pointerId);
|
|
125
|
+
// The frame would swallow the pointer moves over it.
|
|
126
|
+
panel.classList.add('resizing');
|
|
127
|
+
const move = (moved) => resize(axis, from + start - along(moved), false);
|
|
128
|
+
const end = () => {
|
|
129
|
+
grip.removeEventListener('pointermove', move);
|
|
130
|
+
grip.removeEventListener('pointerup', end);
|
|
131
|
+
grip.removeEventListener('pointercancel', end);
|
|
132
|
+
panel.classList.remove('resizing');
|
|
133
|
+
resize(axis, size[axis], true);
|
|
134
|
+
};
|
|
135
|
+
grip.addEventListener('pointermove', move);
|
|
136
|
+
grip.addEventListener('pointerup', end);
|
|
137
|
+
grip.addEventListener('pointercancel', end);
|
|
138
|
+
});
|
|
139
|
+
const reset = () => {
|
|
140
|
+
panel.style.removeProperty(`--${axis}`);
|
|
141
|
+
size[axis] = DEFAULT_SIZE[axis];
|
|
142
|
+
sync();
|
|
143
|
+
try {
|
|
144
|
+
localStorage.setItem(SIZE_KEY, JSON.stringify(size));
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// The size just isn't remembered.
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
grip.addEventListener('keydown', (event) => {
|
|
151
|
+
if (event.key === 'Enter') {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
reset();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const keys = axis === 'width' ? { ArrowLeft: 24, ArrowRight: -24 } : { ArrowUp: 24, ArrowDown: -24 };
|
|
157
|
+
const step = keys[event.key];
|
|
158
|
+
if (!step)
|
|
159
|
+
return;
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
resize(axis, Math.min(maxSize()[axis], size[axis]) + step, true);
|
|
162
|
+
});
|
|
163
|
+
grip.addEventListener('dblclick', reset);
|
|
164
|
+
}
|
|
53
165
|
const render = () => {
|
|
54
166
|
badge.hidden = errors.length === 0;
|
|
55
167
|
badge.textContent = String(errors.length);
|
|
@@ -72,9 +184,13 @@ iframe { flex: 1; width: 100%; border: 0; background: #f7f7f5; }
|
|
|
72
184
|
render();
|
|
73
185
|
return session;
|
|
74
186
|
};
|
|
187
|
+
const show = (visible) => {
|
|
188
|
+
panel.hidden = !visible;
|
|
189
|
+
wolf.setAttribute('aria-expanded', String(visible));
|
|
190
|
+
};
|
|
75
191
|
// One frame, even when the wolf and "Fix" are clicked before the session has loaded.
|
|
76
192
|
const open = () => {
|
|
77
|
-
|
|
193
|
+
show(true);
|
|
78
194
|
frame ??= loadSession().then(({ url }) => {
|
|
79
195
|
const iframe = document.createElement('iframe');
|
|
80
196
|
iframe.src = url;
|
|
@@ -88,8 +204,12 @@ iframe { flex: 1; width: 100%; border: 0; background: #f7f7f5; }
|
|
|
88
204
|
});
|
|
89
205
|
return frame;
|
|
90
206
|
};
|
|
91
|
-
wolf.addEventListener('click', () => (panel.hidden ? void open() : (
|
|
92
|
-
$('.close').addEventListener('click', () =>
|
|
207
|
+
wolf.addEventListener('click', () => (panel.hidden ? void open() : show(false)));
|
|
208
|
+
$('.close').addEventListener('click', () => {
|
|
209
|
+
show(false);
|
|
210
|
+
// The focused button is gone with the panel: back to the wolf that opened it.
|
|
211
|
+
wolf.focus();
|
|
212
|
+
});
|
|
93
213
|
fix.addEventListener('click', async () => {
|
|
94
214
|
const sent = errors;
|
|
95
215
|
errors = [];
|
|
@@ -145,9 +265,13 @@ iframe { flex: 1; width: 100%; border: 0; background: #f7f7f5; }
|
|
|
145
265
|
consoleError(...args);
|
|
146
266
|
// Collecting the error must never break the app's own logging.
|
|
147
267
|
try {
|
|
268
|
+
const message = args.map(text).join(' ');
|
|
269
|
+
// Vite's client logs a build error it has no overlay for; 'vite:error' below has it already.
|
|
270
|
+
if (hot && message.startsWith('[vite] Internal Server Error\n'))
|
|
271
|
+
return;
|
|
148
272
|
add({
|
|
149
273
|
source: 'console',
|
|
150
|
-
message
|
|
274
|
+
message,
|
|
151
275
|
stack: args.find((arg) => arg instanceof Error)?.stack,
|
|
152
276
|
});
|
|
153
277
|
}
|
package/dist/vite/overlay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../src/vite/overlay.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,GA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AM,CAAC,MAAM,KAAK,MAAM;gBAAE,MAAM,EAAE,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,EAAE,CAAC;IACT,KAAK,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/docs/agents.md
CHANGED
|
@@ -113,22 +113,25 @@ session.send('Now cover it with a test'); // resumes the same agent session
|
|
|
113
113
|
`autoApprove` decides them. `stop()` denies whatever is pending.
|
|
114
114
|
- `setAgent()` switches agents between turns and starts a fresh agent session; `reset()`
|
|
115
115
|
does the same for the current agent.
|
|
116
|
+
- `transformPrompt(text)` rewrites what reaches the agent (a briefing, a context prefix)
|
|
117
|
+
while turns, the queue and steered input keep the text given to `send()`.
|
|
118
|
+
- `<AgentChat>` from `genaicode/react` renders `state` in a React page (see the README).
|
|
116
119
|
|
|
117
120
|
## Drivers
|
|
118
121
|
|
|
119
|
-
| Driver | Command | Mode | Notes
|
|
120
|
-
| --------------------- | -------------- | ---------------------------------------- |
|
|
121
|
-
| `claude(options?)` | `claude` | `-p --output-format stream-json` | `permissionMode` defaults to `acceptEdits`; `allowedTools` / `disallowedTools
|
|
122
|
-
| `codex(options?)` | `codex` | `exec --json` | `sandbox` defaults to `workspace-write`; effort via `model_reasoning_effort`
|
|
123
|
-
| `muse(options?)` | `muse` | `exec --json --trust-workspace` | `maxTurns` maps to `--max-model-steps`
|
|
124
|
-
| `codexLive(options?)` | `codex` | `app-server` (JSON-RPC) | `steer()`, approvals, MCP. See [Live sessions](#live-sessions-steering-and-approvals)
|
|
125
|
-
| `museLive(options?)` | `muse` | `serve` (JSON-RPC) | `steer()`, approvals. See [Live sessions](#live-sessions-steering-and-approvals)
|
|
126
|
-
| `gemini(options?)` | `gemini` | `--output-format stream-json --prompt=…` | `approvalMode` defaults to `auto_edit`; `--skip-trust` unless `trustWorkspace: false`
|
|
127
|
-
| `cursor(options?)` | `cursor-agent` | `-p --output-format stream-json` | `--force --approve-mcps` by default (`--trust` if `force: false`); `partialOutput`
|
|
128
|
-
| `opencode(options?)` | `opencode` | `run --format json` | `model` is `provider/model`; `effort` maps to `--variant`; `autoApprove` adds `--auto`
|
|
129
|
-
| `copilot(options?)` | `copilot` | `--output-format json --prompt=…` | `--allow-all-tools --no-ask-user` by default; `allowTools` / `denyTools` patterns
|
|
130
|
-
| `vibe(options?)` | `vibe` | `--output streaming --prompt=…` | `agent` defaults to `accept-edits`; `--trust`; `model` via `VIBE_ACTIVE_MODEL`
|
|
131
|
-
| `antigravity(opts?)` | `agy` | `--output-format stream-json --print` | `mode` defaults to `accept-edits`; `--sandbox` unless `sandbox: false`
|
|
122
|
+
| Driver | Command | Mode | Notes |
|
|
123
|
+
| --------------------- | -------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
124
|
+
| `claude(options?)` | `claude` | `-p --output-format stream-json` | `permissionMode` defaults to `acceptEdits`; `allowedTools` / `disallowedTools`; approvals |
|
|
125
|
+
| `codex(options?)` | `codex` | `exec --json` | `sandbox` defaults to `workspace-write`; effort via `model_reasoning_effort` |
|
|
126
|
+
| `muse(options?)` | `muse` | `exec --json --trust-workspace` | `maxTurns` maps to `--max-model-steps` |
|
|
127
|
+
| `codexLive(options?)` | `codex` | `app-server` (JSON-RPC) | `steer()`, approvals, MCP. See [Live sessions](#live-sessions-steering-and-approvals) |
|
|
128
|
+
| `museLive(options?)` | `muse` | `serve` (JSON-RPC) | `steer()`, approvals. See [Live sessions](#live-sessions-steering-and-approvals) |
|
|
129
|
+
| `gemini(options?)` | `gemini` | `--output-format stream-json --prompt=…` | `approvalMode` defaults to `auto_edit`; `--skip-trust` unless `trustWorkspace: false` |
|
|
130
|
+
| `cursor(options?)` | `cursor-agent` | `-p --output-format stream-json` | `--force --approve-mcps` by default (`--trust` if `force: false`); `partialOutput` |
|
|
131
|
+
| `opencode(options?)` | `opencode` | `run --format json` | `model` is `provider/model`; `effort` maps to `--variant`; `autoApprove` adds `--auto` |
|
|
132
|
+
| `copilot(options?)` | `copilot` | `--output-format json --prompt=…` | `--allow-all-tools --no-ask-user` by default; `allowTools` / `denyTools` patterns |
|
|
133
|
+
| `vibe(options?)` | `vibe` | `--output streaming --prompt=…` | `agent` defaults to `accept-edits`; `--trust`; `model` via `VIBE_ACTIVE_MODEL` |
|
|
134
|
+
| `antigravity(opts?)` | `agy` | `--output-format stream-json --print` | `mode` defaults to `accept-edits`; `--sandbox` unless `sandbox: false` |
|
|
132
135
|
|
|
133
136
|
Every driver accepts `command` to point at a specific executable. `task.extraArgs` is
|
|
134
137
|
inserted before the prompt for flags that have no portable field.
|
|
@@ -157,15 +160,123 @@ const result = await run.result;
|
|
|
157
160
|
|
|
158
161
|
- `steer(text)` resolves once the agent acknowledges the input. It rejects after the task has
|
|
159
162
|
ended, and when no acknowledgement arrives (the input may or may not have reached the agent).
|
|
160
|
-
- `onApproval`
|
|
161
|
-
`other` request and returns `'approve'` or `'deny'`. If `onApproval` is missing or throws, the
|
|
162
|
-
request is denied. Codex runs with approval policy `never` when no `onApproval` is set.
|
|
163
|
-
- `museLive()` answers each approval with one of the choices Muse offers: the `once`
|
|
164
|
-
approve or deny choice where there is one. A multi-stage approval asks `onApproval` once
|
|
165
|
-
per stage; later stages get ids like `ap-1/2`.
|
|
163
|
+
- `onApproval` answers permission requests; see [Approvals](#approvals).
|
|
166
164
|
- The task ends when the agent reports its turn complete. The server is then stopped. An exit
|
|
167
165
|
before that point is a failure, even with exit code 0.
|
|
168
166
|
|
|
167
|
+
## Approvals
|
|
168
|
+
|
|
169
|
+
`onApproval(request, signal)` answers the agent's permission prompts on drivers with
|
|
170
|
+
`capabilities.approvals`: `claude`, `codexLive`, `museLive`. It returns `'approve'` or
|
|
171
|
+
`'deny'`.
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
const run = claude().run({
|
|
175
|
+
prompt: 'Run the tests and fix what fails',
|
|
176
|
+
cwd: '/work/repo',
|
|
177
|
+
onApproval: (request, signal) => askUser(request, signal), // your UI
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
- `request.kind` is `command`, `file-change` or `other`; `summary` is one line to show;
|
|
182
|
+
`detail` is the vendor's whole request (the command with its working directory, the tool
|
|
183
|
+
input, the requested permissions). Show `detail` before asking for a decision.
|
|
184
|
+
- `request.scope` says what approving grants. `once` (or absent): this one call. `turn`: the
|
|
185
|
+
permissions in `detail` until the agent's current turn ends (Codex permission profiles).
|
|
186
|
+
- `signal` aborts when the answer is no longer needed: the agent withdrew the request, the
|
|
187
|
+
turn ended, the process exited, or the task was stopped. Close the question then. A late
|
|
188
|
+
answer counts as `deny`.
|
|
189
|
+
- No handler, a handler that throws, and an aborted signal all deny. Nothing is approved
|
|
190
|
+
automatically unless `permissions.approval` says so (see [Permissions](#permissions)).
|
|
191
|
+
`approval-request` and `approval-resolved` events record each question.
|
|
192
|
+
|
|
193
|
+
Per agent:
|
|
194
|
+
|
|
195
|
+
- `claude()`: with `onApproval`, the driver serves Claude Code's `--permission-prompt-tool`
|
|
196
|
+
from a private MCP endpoint on 127.0.0.1 (random port, random bearer token), next to the
|
|
197
|
+
task's own `mcpServers`, and raises `MCP_TOOL_TIMEOUT` to a day unless `env` sets it. The
|
|
198
|
+
permission mode still applies first (`acceptEdits` by default): only what it does not allow
|
|
199
|
+
is asked. Approving allows exactly the input Claude asked about (`updatedInput` unchanged).
|
|
200
|
+
- `codexLive()`: runs with approval policy `on-request` when `onApproval` is set (`never`
|
|
201
|
+
otherwise). Commands and file changes are answered `accept` / `decline`. A permission
|
|
202
|
+
profile request (`item/permissions/requestApproval`) is asked with `scope: 'turn'`; approving
|
|
203
|
+
grants the requested categories (those that are not null) for the turn, denying grants none.
|
|
204
|
+
Requests from another thread or turn are rejected; `serverRequest/resolved` withdraws one.
|
|
205
|
+
- `museLive()`: answers with one of the choices Muse offers and the stage's requirement id.
|
|
206
|
+
Approving picks the `once` choice; a request that only offers session-wide approval is
|
|
207
|
+
denied. A multi-stage approval asks once per stage (later stages get ids like `ap-1/2`),
|
|
208
|
+
however often a stage is delivered. `approval/resolved` withdraws an open question.
|
|
209
|
+
|
|
210
|
+
The protocol handlers are exported for apps that run their own driver or MCP server:
|
|
211
|
+
|
|
212
|
+
- `codexApprovals(session, ids)` and `museApprovals(session, ids, options?)` take a
|
|
213
|
+
`LiveSession` and a function returning the current `{ session, turn }` ids. Hand them each
|
|
214
|
+
request and notification first (`request()` returns `undefined`, `notification()` false,
|
|
215
|
+
for methods they do not own) and call `close()` when the turn ends.
|
|
216
|
+
- `claudeApprovalTool(onApproval)` is the permission prompt tool as an MCP tool (`name`,
|
|
217
|
+
`description`, `inputSchema`, `call(args, signal)`) to serve from the app's own MCP server;
|
|
218
|
+
pass `claudeApprovalArgs(serverName)` to Claude and `claudeApprovalEnv(env)` in its env.
|
|
219
|
+
Abort `signal` when the MCP caller disconnects. `startClaudeApprovalServer(onApproval)`
|
|
220
|
+
serves the tool on its own endpoint instead.
|
|
221
|
+
|
|
222
|
+
## Permissions
|
|
223
|
+
|
|
224
|
+
`task.permissions` picks the approval policy and the sandbox in one place, and each driver
|
|
225
|
+
translates it into the agent's own options. An omitted field keeps the driver's default (the
|
|
226
|
+
behavior described above); `'yolo'` is `{ approval: 'auto-approve', sandbox: 'unrestricted' }`.
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
claude().run({ prompt, cwd, permissions: { approval: 'auto-approve', sandbox: 'workspace-write' } });
|
|
230
|
+
codexLive().run({ prompt, cwd, permissions: 'yolo' });
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
- `approval`: `ask` sends prompts to `onApproval` (required then). `auto-approve` approves each
|
|
234
|
+
prompt without asking, for exactly the scope the agent asked for (one call, or a Codex
|
|
235
|
+
profile for the turn; never a session-wide grant). `deny` refuses whatever would need a
|
|
236
|
+
prompt and does not call `onApproval`.
|
|
237
|
+
- `sandbox`: `workspace-write` turns on the agent's own sandbox (writes limited to `cwd`;
|
|
238
|
+
network rules are the vendor's), `read-only` its read-only mode, `unrestricted` no sandbox,
|
|
239
|
+
even when the agent's settings enable one. The sandbox bounds approvals: neither a person
|
|
240
|
+
nor `auto-approve` can grant a step outside it.
|
|
241
|
+
- `capabilities.permissions` lists the values a driver accepts. Anything else, and any
|
|
242
|
+
combination the agent cannot honor, fails the run with `status: 'failed'` and an `error`
|
|
243
|
+
naming the value before the agent starts. Setting both a permissions field and the driver
|
|
244
|
+
option it replaces (`permissionMode`, `sandbox`, `approvalMode`, `force`...) is an error too.
|
|
245
|
+
- Where genaicode sees the prompt (Claude's prompt tool, Muse), `auto-approve` and policy
|
|
246
|
+
denials still emit `approval-request` and `approval-resolved` with `automatic: true`, and
|
|
247
|
+
`createAgentSession` shows them as transcript entries. Agents that approve by themselves
|
|
248
|
+
(Codex with policy `never`, Gemini `yolo`, Cursor `--force`...) report nothing to show.
|
|
249
|
+
|
|
250
|
+
| Driver | approval | sandbox | Translation |
|
|
251
|
+
| --------------- | ----------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
252
|
+
| `claude()` | ask, auto-approve, deny | workspace-write, read-only, unrestricted | `ask` / `auto-approve`: the prompt tool; `deny`: none. `workspace-write`: Claude's sandbox via `--settings` (required, no per-command escape), `acceptEdits`; `read-only`: `plan`; `unrestricted`: sandbox off |
|
|
253
|
+
| `codex()` | auto-approve, deny | workspace-write, read-only, unrestricted | `approval_policy="never"` (exec never asks); `--sandbox` read-only / workspace-write / danger-full-access |
|
|
254
|
+
| `codexLive()` | ask, auto-approve, deny | workspace-write, read-only, unrestricted | `ask`: policy `on-request`, otherwise `never`; `thread/start` sandbox as above |
|
|
255
|
+
| `museLive()` | ask, auto-approve, deny | unrestricted | `ask` / `auto-approve`: approval mode `onRequest` (the `once` choice); `deny`: `denyUnmatched`. Muse has no sandbox |
|
|
256
|
+
| `gemini()` | auto-approve, deny | workspace-write, read-only, unrestricted | `--approval-mode yolo` / `auto_edit`; `read-only`: `plan` (not with `auto-approve`); `--sandbox` / `--no-sandbox` plus `GEMINI_SANDBOX`, which overrides the flag in Gemini |
|
|
257
|
+
| `cursor()` | auto-approve, deny | workspace-write, read-only, unrestricted | `auto-approve`: `--force`, which runs commands unsandboxed, so only with `unrestricted`; `deny`: `--trust`; `--sandbox enabled` / `disabled`; `read-only`: `--mode ask` |
|
|
258
|
+
| `copilot()` | auto-approve | unrestricted | `--allow-all-tools` (prompt mode needs it); `--allow-all-paths --allow-all-urls`. Copilot's `--sandbox` lets a command opt out of it, so `workspace-write` is not offered |
|
|
259
|
+
| `opencode()` | auto-approve, deny | unrestricted | `--auto`; opencode has no sandbox |
|
|
260
|
+
| `vibe()` | auto-approve, deny | read-only, unrestricted | `--auto-approve`; `read-only`: `--agent plan` (not with `auto-approve`); no sandbox |
|
|
261
|
+
| `antigravity()` | none | workspace-write, unrestricted | `--sandbox` on or off |
|
|
262
|
+
| `muse()` | none | none | |
|
|
263
|
+
|
|
264
|
+
Claude in `read-only` writes nothing in the workspace, but plan mode may still save its plan
|
|
265
|
+
under `~/.claude/plans`. In `workspace-write`, Claude's sandbox covers Bash; edits through its
|
|
266
|
+
file tools are accepted inside `cwd` and denied outside it.
|
|
267
|
+
|
|
268
|
+
For apps that keep their own argument lists (an adapters file, say),
|
|
269
|
+
`applyPermissionArgs(agent, args, permissions)` returns `{ args, env }` with the flags the
|
|
270
|
+
translation owns replaced, using the same per-agent functions (`claudePermissionFlags`,
|
|
271
|
+
`codexPermissionFlags`, `geminiPermissionFlags`, `cursorPermissionFlags`,
|
|
272
|
+
`copilotPermissionFlags`, `opencodePermissionFlags`, `vibePermissionFlags`,
|
|
273
|
+
`antigravityPermissionFlags`; `codexThreadPolicy` for the app server). For Claude, `ask` and
|
|
274
|
+
`auto-approve` also need the prompt tool: `claudeApprovalTool(handler, { sandbox, cwd })`
|
|
275
|
+
denies requests outside the sandbox before asking, and `decideApproval(task, request, signal)`
|
|
276
|
+
applies the approval policy the way the drivers do.
|
|
277
|
+
|
|
278
|
+
## Custom live agents
|
|
279
|
+
|
|
169
280
|
For other JSON-RPC agents, `liveAgent({ name, command, args, drive })` provides the process,
|
|
170
281
|
an `RpcPeer`, event emission, the approval flow, and `setSteer()`. `drive(session)` runs the
|
|
171
282
|
protocol and resolves with `{ ok, error? }` when the turn ends.
|
package/docs/semver.md
CHANGED
|
@@ -21,6 +21,8 @@ These are covered by minor/patch compatibility within 2.x:
|
|
|
21
21
|
|
|
22
22
|
- `genaicode/agents` (coding-agent drivers, `AgentEvent`, `CodingAgent`) may change in a
|
|
23
23
|
minor release until this section lists it as stable. See [agents.md](./agents.md).
|
|
24
|
+
- `genaicode/react` (`<AgentChat>` props, its `.gc-*` class names and `--gc-*` custom
|
|
25
|
+
properties) and `genaicode/ui` (`startEmbeddedWeb`), on the same terms.
|
|
24
26
|
|
|
25
27
|
## Additive changes (minor)
|
|
26
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genaicode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "A small, provider-neutral TypeScript toolkit for calling LLMs from backend code.",
|
|
5
5
|
"author": "Grzegorz Tańczyk",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"toolkit",
|
|
17
17
|
"coding-agent",
|
|
18
18
|
"cli",
|
|
19
|
-
"vite-plugin"
|
|
19
|
+
"vite-plugin",
|
|
20
|
+
"react"
|
|
20
21
|
],
|
|
21
22
|
"type": "module",
|
|
22
23
|
"bin": {
|
|
@@ -26,7 +27,9 @@
|
|
|
26
27
|
"node": ">=20"
|
|
27
28
|
},
|
|
28
29
|
"license": "Apache-2.0",
|
|
29
|
-
"sideEffects":
|
|
30
|
+
"sideEffects": [
|
|
31
|
+
"**/*.css"
|
|
32
|
+
],
|
|
30
33
|
"files": [
|
|
31
34
|
"dist",
|
|
32
35
|
"docs",
|
|
@@ -50,6 +53,15 @@
|
|
|
50
53
|
"./vite": {
|
|
51
54
|
"types": "./dist/vite.d.ts",
|
|
52
55
|
"import": "./dist/vite.js"
|
|
56
|
+
},
|
|
57
|
+
"./react": {
|
|
58
|
+
"types": "./dist/react.d.ts",
|
|
59
|
+
"import": "./dist/react.js"
|
|
60
|
+
},
|
|
61
|
+
"./react/styles.css": "./dist/react/agent-chat.css",
|
|
62
|
+
"./ui": {
|
|
63
|
+
"types": "./dist/ui.d.ts",
|
|
64
|
+
"import": "./dist/ui.js"
|
|
53
65
|
}
|
|
54
66
|
},
|
|
55
67
|
"scripts": {
|
|
@@ -58,6 +70,7 @@
|
|
|
58
70
|
"lint": "eslint . --ext js,ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
59
71
|
"test": "vitest --config vitest.unit.config.ts --run",
|
|
60
72
|
"test:e2e": "vitest --config vitest.e2e.config.ts --run",
|
|
73
|
+
"test:browser": "vitest --config vitest.browser.config.ts --run",
|
|
61
74
|
"test:watch": "vitest --config vitest.unit.config.ts",
|
|
62
75
|
"type-check": "tsc --noEmit",
|
|
63
76
|
"check": "npm run type-check && npm run lint && npm test && npm run build",
|
|
@@ -73,21 +86,23 @@
|
|
|
73
86
|
"@types/node": "^20.0.0",
|
|
74
87
|
"@types/react": "^19.3.0",
|
|
75
88
|
"@types/react-dom": "^19.3.0",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
77
|
-
"@typescript-eslint/parser": "^
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^8.71.1",
|
|
90
|
+
"@typescript-eslint/parser": "^8.71.1",
|
|
78
91
|
"esbuild": "^0.28.2",
|
|
79
92
|
"eslint": "^8.54.0",
|
|
80
93
|
"eslint-config-prettier": "^9.0.0",
|
|
94
|
+
"happy-dom": "^20.14.5",
|
|
81
95
|
"husky": "^9.1.1",
|
|
82
96
|
"ink": "^6.8.0",
|
|
83
97
|
"ink-testing-library": "^4.0.0",
|
|
84
|
-
"lint-staged": "^
|
|
98
|
+
"lint-staged": "^16.4.0",
|
|
99
|
+
"playwright": "^1.56.1",
|
|
85
100
|
"prettier": "^3.1.0",
|
|
86
101
|
"react": "^19.3.0",
|
|
87
102
|
"react-dom": "^19.3.0",
|
|
88
103
|
"typescript": "^5.0.0",
|
|
89
104
|
"vite": "^6.4.3",
|
|
90
|
-
"vitest": "^
|
|
105
|
+
"vitest": "^4.1.11"
|
|
91
106
|
},
|
|
92
107
|
"lint-staged": {
|
|
93
108
|
"*.{js,ts,md}": "prettier --write"
|