genaicode 2.18.2 → 2.18.4

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.
@@ -18,10 +18,10 @@ the project has HTML pages a browser can open.
18
18
  in `vite dev` the page gets a wolf button that opens a chat with the agent working in
19
19
  the project root, and the page's errors can be sent to the agent with one click.
20
20
  Builds are untouched, nothing reaches production.
21
- 2. **Dev panel without Vite** (`genaicode/ui`): the same chat for apps on webpack, Next.js,
22
- Express, Fastify, Remix, Astro or any other Node dev server. The dev server process
23
- starts the chat on 127.0.0.1 with `startEmbeddedWeb`, and a development-only component
24
- on the page shows it in a frame. A few more lines than the plugin, same result.
21
+ 2. **Dev overlay without Vite** (`createDevOverlay` from `genaicode/ui`): the same overlay
22
+ (the wolf, the error badge, "Fix N errors") for apps on webpack, Next.js, Express,
23
+ Fastify, Koa or any other Node dev server. The dev server mounts its routes, the page
24
+ loads one script in development. A few more lines than the plugin, same result.
25
25
  3. **In-app agent** (`genaicode/app-agent` on the server, `<AppAgentChat>` from
26
26
  `genaicode/react` on the page): for a local app with its own Node server (an admin
27
27
  console, an internal tool, an editor) whose users want the agent to act on the app's
@@ -31,9 +31,9 @@ the project has HTML pages a browser can open.
31
31
  4. **A dev server of your own**: the project has pages but nothing serves them in
32
32
  development (static HTML, files opened from `file://`, a build script that writes
33
33
  `index.html`, a game jam entry with a size budget...). Write a small Node script that
34
- serves those files on localhost and injects the panel into the HTML it serves, and an
35
- npm script to start it. The files on disk and the build output stay untouched, so size
36
- budgets and release builds are not affected.
34
+ serves those files on localhost with the overlay from option 2 injected into the HTML
35
+ it serves, and an npm script to start it. The files on disk and the build output stay
36
+ untouched, so size budgets and release builds are not affected.
37
37
  5. **Last resort**: no Node at all in the project and no HTML to serve (a Rails, Django or
38
38
  Go app whose server you cannot change safely): tell the user to run `npx genaicode ui`
39
39
  (browser) or `npx genaicode` (terminal) next to their dev server, and say why.
@@ -78,8 +78,13 @@ allow, batch what must run into few commands, and do not run the dev server just
78
78
  production build. For options 1, 2 and 4 the production output must not contain
79
79
  genaicode. Fix what you broke; do not "fix" unrelated failures. Remove build output
80
80
  you created that the project does not track.
81
- 6. **Report**: what you changed, file by file, and how to try it (the dev command, where
82
- to click). Say that the agent uses its own CLI login and billing.
81
+ 6. **Report**, starting with how to see it, before anything else: one line with the exact
82
+ command to run and what happens next, e.g. "Run `npm run agent`: the game opens in your
83
+ browser with the genaicode wolf in the bottom-right corner. You can also type
84
+ `!npm run agent` right here." The developer may not know
85
+ the project's scripts or that a new one exists, so never leave this for the end of a
86
+ long summary. Then what you changed, file by file, briefly. Say that the agent uses its
87
+ own CLI login and billing.
83
88
 
84
89
  ## Recipe: Vite overlay
85
90
 
@@ -109,109 +114,63 @@ export default defineConfig({
109
114
  - The chat runs on its own 127.0.0.1 port, only the app's own pages can frame it, and it
110
115
  takes requests only from the same machine. No env vars or secrets are needed.
111
116
 
112
- ## Recipe: dev panel without Vite
117
+ ## Recipe: dev overlay without Vite
118
+
119
+ `createDevOverlay()` from `genaicode/ui` is the Vite plugin's overlay for any Node dev
120
+ server: the genaicode wolf in the page's bottom-right corner opens the chat, its badge
121
+ counts the page's errors, and "Fix N errors" sends them to the agent. Do not write your own
122
+ button, panel or session route: use this.
113
123
 
114
124
  Server side, in the Node process that serves the app in development, and only there:
115
125
 
116
126
  ```ts
117
- import type { IncomingMessage, ServerResponse } from 'node:http';
118
-
119
127
  // Development only: production never imports genaicode.
120
- // The origins the app was opened at; the chat lets only these frame it, read per request.
121
- const origins = new Set<string>();
122
- let panel: Promise<{ url: string }> | undefined;
123
- export function genaicodePanel() {
124
- panel ??= import('genaicode/ui').then(({ startEmbeddedWeb }) =>
125
- startEmbeddedWeb({ cwd: process.cwd(), frameAncestors: () => [...origins] }),
126
- );
127
- return panel;
128
- }
129
-
130
- // GET /__genaicode/session -> { url }. The url carries the chat's access token: hand it only
131
- // to the app's own pages on this machine.
132
- export async function genaicodeSession(req: IncomingMessage, res: ServerResponse) {
133
- const address = req.socket.remoteAddress ?? '';
134
- const local = address === '::1' || address.startsWith('127.') || address.startsWith('::ffff:127.');
135
- const host = req.headers.host ?? '';
136
- const loopbackHost = /^(localhost|127\.0\.0\.1|\[::1\])(:\d+)?$/.test(host);
137
- if (!local || !loopbackHost || req.headers['sec-fetch-site'] !== 'same-origin') {
138
- res.writeHead(403).end();
139
- return;
140
- }
141
- origins.add(`http://${host}`); // localhost and 127.0.0.1 can both frame it, without a restart
142
- const { url } = await genaicodePanel();
143
- res.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' });
144
- res.end(JSON.stringify({ url }));
128
+ if (process.env.NODE_ENV !== 'production') {
129
+ const { createDevOverlay } = await import('genaicode/ui');
130
+ const overlay = createDevOverlay(); // the agent works in process.cwd(); `cwd` to change
131
+ app.use(overlay.middleware); // before the app's own routes
145
132
  }
146
133
  ```
147
134
 
148
- - `frameAncestors` is read per request and must list every origin the app is opened at in
149
- development (`http://localhost:3000`, `http://127.0.0.1:3000`...); the chat refuses other
150
- frames. Collect them as above rather than capturing the first one. Behind a dev host name
151
- (`app.localhost`, https), allow that name explicitly.
152
- `startEmbeddedWeb` binds to 127.0.0.1 on a free port (`port` to fix one) and takes
153
- `agent`, `model`, `effort`, `approveAll` like the Vite plugin.
135
+ - `overlay.handle(req, res)` answers everything under `/__genaicode/` and resolves to
136
+ `false` for other URLs; `overlay.middleware` is the same for Express / Connect. Options:
137
+ `cwd`, `agent`, `model`, `effort`, `approveAll` (only if asked), `port`,
138
+ `captureErrors: false`, like the Vite plugin.
139
+ - The chat starts in the background on 127.0.0.1. Its token goes only to the app's own
140
+ pages, on this machine, opened at `localhost`, `*.localhost`, `127.0.0.1` or `[::1]`.
141
+ Without an agent CLI it logs why and the app runs on.
154
142
  - Start it once per process. Dev servers that reload server code (Next.js, nodemon...)
155
- re-run modules: keep the promise on `globalThis` so a reload does not start a second chat.
156
- - Where to hook the route:
157
- - Express / Connect / node:http dev server: before the app's routes, behind
158
- `process.env.NODE_ENV !== 'production'`.
159
- - webpack-dev-server: `devServer.setupMiddlewares(middlewares, devServer)`, push a
160
- middleware for `/__genaicode/session`.
161
- - Next.js: a route handler such as `app/api/genaicode/route.ts` (folders starting with
162
- `_` are private in the app router) that returns 404 unless
163
- `process.env.NODE_ENV === 'development'`. It has no socket address, so check that the
164
- `Host` header is `localhost` / `127.0.0.1` / `[::1]` with a port and that
165
- `sec-fetch-site` is `same-origin`. Start the chat from the route on first use (Node
166
- runtime: `export const runtime = 'nodejs'`), cached on `globalThis`.
167
- - Fastify: a route under `if (dev)`; Koa: a middleware under `if (dev)`.
168
-
169
- Page side, a component rendered only in development (`process.env.NODE_ENV === 'development'`,
170
- `import.meta.env.DEV`...), loaded so the production bundle drops it (a dynamic `import()`
171
- behind that check, or the framework's dev-only slot):
172
-
173
- ```tsx
174
- import { useEffect, useState } from 'react';
175
-
176
- export function GenaicodePanel() {
177
- const [url, setUrl] = useState<string>();
178
- const [open, setOpen] = useState(false);
179
- useEffect(() => {
180
- fetch('/__genaicode/session')
181
- .then((r) => (r.ok ? r.json() : undefined))
182
- .then((s) => setUrl(s?.url));
183
- }, []);
184
- if (!url) return null;
185
- return (
186
- <>
187
- <button onClick={() => setOpen(!open)} style={{ position: 'fixed', right: 16, bottom: 16, zIndex: 2147483647 }}>
188
- Agent
189
- </button>
190
- {open && (
191
- <iframe
192
- src={url}
193
- title="genaicode"
194
- style={{
195
- position: 'fixed',
196
- right: 16,
197
- bottom: 64,
198
- width: 420,
199
- height: '70vh',
200
- zIndex: 2147483647,
201
- border: 0,
202
- borderRadius: 12,
203
- boxShadow: '0 8px 32px #0004',
204
- }}
205
- />
206
- )}
207
- </>
208
- );
209
- }
210
- ```
211
-
212
- Not React? The same in the app's own framework or plain DOM: fetch the session, then a
213
- fixed button that toggles a fixed iframe. Keep the token URL out of logs, `localStorage`
214
- and anything the page sends elsewhere.
143
+ re-run modules: keep the overlay on `globalThis` so a reload does not start a second chat.
144
+ - Where to hook it:
145
+ - Express / Connect: `app.use(overlay.middleware)` before the routes.
146
+ - node:http: `if (await overlay.handle(req, res)) return;` at the top of the handler.
147
+ - webpack-dev-server: `setupMiddlewares: (middlewares) => [{ name: 'genaicode', middleware: overlay.middleware }, ...middlewares]`.
148
+ - Fastify: an `onRequest` hook that, for URLs under `/__genaicode/`, calls
149
+ `reply.hijack()` and `overlay.handle(request.raw, reply.raw)`. Koa: a middleware that
150
+ sets `ctx.respond = false` when `await overlay.handle(ctx.req, ctx.res)` is true.
151
+ - Next.js: a rewrite in `next.config` from `/__genaicode/:path*` to
152
+ `/api/genaicode/:path*` (development only), and a pages-router route
153
+ `pages/api/genaicode/[...path].ts` with `export const config = { api: { bodyParser: false } }`
154
+ that returns 404 outside development, sets
155
+ `req.url = '/__genaicode/' + [req.query.path].flat().join('/')` and calls
156
+ `overlay.handle(req, res)`.
157
+
158
+ Page side, the overlay script in development only:
159
+
160
+ - Where the server renders or serves the HTML: `overlay.injectHtml(html)`, or
161
+ `overlay.script` (an inline error collector plus
162
+ `<script type="module" src="/__genaicode/overlay.js"></script>`) at the top of the dev
163
+ template's `<head>`.
164
+ - Otherwise, in the app's entry, behind the bundler's dev flag so production drops it:
165
+
166
+ ```js
167
+ if (process.env.NODE_ENV === 'development') {
168
+ const script = document.createElement('script');
169
+ script.type = 'module';
170
+ script.src = '/__genaicode/overlay.js';
171
+ document.head.append(script);
172
+ }
173
+ ```
215
174
 
216
175
  ## Recipe: a dev server of your own
217
176
 
@@ -220,17 +179,17 @@ project's folder for scripts), plus `"agent": "node tools/agent-dev.mjs"` (or a
220
179
  fits next to the existing scripts) in `package.json`:
221
180
 
222
181
  ```js
223
- // Development only: serves <dir> on 127.0.0.1 with the genaicode panel injected into HTML.
182
+ // Development only: serves <dir> on 127.0.0.1 with the genaicode overlay injected into HTML.
224
183
  // The files on disk are not changed.
184
+ import { spawn } from 'node:child_process';
225
185
  import { createServer } from 'node:http';
226
186
  import { readFile, stat } from 'node:fs/promises';
227
187
  import { extname, join, normalize, resolve, sep } from 'node:path';
228
- import { startEmbeddedWeb } from 'genaicode/ui';
188
+ import { createDevOverlay } from 'genaicode/ui';
229
189
 
230
190
  const root = resolve(process.argv[2] ?? 'build');
231
191
  const port = Number(process.env.PORT ?? 5173);
232
- const origins = new Set([`http://localhost:${port}`, `http://127.0.0.1:${port}`]);
233
- const chat = await startEmbeddedWeb({ cwd: process.cwd(), frameAncestors: () => [...origins] });
192
+ const overlay = createDevOverlay();
234
193
  const TYPES = {
235
194
  '.html': 'text/html',
236
195
  '.js': 'text/javascript',
@@ -241,26 +200,12 @@ const TYPES = {
241
200
  '.svg': 'image/svg+xml',
242
201
  '.wasm': 'application/wasm',
243
202
  };
244
- const PANEL = `<script type="module" src="/__genaicode/panel.js"></script>`;
245
203
 
246
204
  createServer(async (req, res) => {
247
- const url = new URL(req.url ?? '/', 'http://x');
248
- if (url.pathname === '/__genaicode/session') {
249
- // The token: only this machine (a loopback Host, which stops DNS rebinding), only the
250
- // app's own pages.
251
- if (!origins.has(`http://${req.headers.host}`) || req.headers['sec-fetch-site'] !== 'same-origin') {
252
- return res.writeHead(403).end();
253
- }
254
- res.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' });
255
- return res.end(JSON.stringify({ url: chat.url }));
256
- }
257
- if (url.pathname === '/__genaicode/panel.js') {
258
- res.writeHead(200, { 'content-type': 'text/javascript' });
259
- return res.end(PANEL_SCRIPT);
260
- }
205
+ if (await overlay.handle(req, res)) return;
261
206
  let file;
262
207
  try {
263
- file = normalize(join(root, decodeURIComponent(url.pathname)));
208
+ file = normalize(join(root, decodeURIComponent(new URL(req.url ?? '/', 'http://x').pathname)));
264
209
  } catch {
265
210
  return res.writeHead(400).end();
266
211
  }
@@ -270,30 +215,26 @@ createServer(async (req, res) => {
270
215
  if (!body) return res.writeHead(404).end('not found');
271
216
  const type = TYPES[extname(file)] ?? 'application/octet-stream';
272
217
  res.writeHead(200, { 'content-type': type, 'cache-control': 'no-store' });
273
- res.end(type === 'text/html' ? injectPanel(body.toString()) : body);
274
- }).listen(port, '127.0.0.1', () =>
275
- console.log(`http://localhost:${port} (genaicode panel: the button in the corner)`),
276
- );
277
-
278
- function injectPanel(html) {
279
- return html.includes('</body>') ? html.replace('</body>', `${PANEL}</body>`) : html + PANEL;
280
- }
218
+ res.end(type === 'text/html' ? overlay.injectHtml(body.toString()) : body);
219
+ }).listen(port, '127.0.0.1', () => {
220
+ const page = `http://localhost:${port}/`;
221
+ console.log(`${page} (genaicode: the wolf in the bottom-right corner)`);
222
+ // Open it like `vite --open` does; NO_OPEN=1 to skip.
223
+ if (!process.env.NO_OPEN && !process.env.CI) {
224
+ const opener = { darwin: 'open', win32: 'explorer' }[process.platform] ?? 'xdg-open';
225
+ spawn(opener, [page], { stdio: 'ignore', detached: true })
226
+ .on('error', () => {})
227
+ .unref();
228
+ }
229
+ });
281
230
  ```
282
231
 
283
- `PANEL_SCRIPT` is the page side as plain DOM, the same as the React component in the
284
- recipe above: fetch `/__genaicode/session`, then a fixed button in a corner that toggles a
285
- fixed iframe with `src` set to the session `url`. Keep it out of the app's own code.
286
-
287
- - Listen on `127.0.0.1` only, and hand out the token only for a loopback `Host` and
288
- `Sec-Fetch-Site: same-origin`. Together they keep the token on this machine and away from
289
- other sites, including DNS-rebinding pages.
232
+ - Listen on `127.0.0.1` only.
290
233
  - Serve what the developer actually opens: the build output folder if the project builds
291
234
  one (start or chain its build or watch script when it has one, e.g. with `--watch` or a
292
235
  second process), otherwise the source folder with the HTML.
293
- - Optional, for the agent to see what breaks: in `PANEL_SCRIPT`, collect `error` and
294
- `unhandledrejection` events and offer a "Fix N errors" button that POSTs them to a
295
- `/__genaicode/fix` route (same checks as the session route) which calls
296
- `chat.controller.submit('Fix these errors in the page …' + details)`.
236
+ - Open the browser on start (as above), at the page the developer works on when there is
237
+ one obvious page (e.g. `/fireball/`), not a folder listing.
297
238
  - A page that reloads itself on change (a watch build) is the developer's own; do not
298
239
  add a live-reload system for this.
299
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genaicode",
3
- "version": "2.18.2",
3
+ "version": "2.18.4",
4
4
  "description": "Drive the coding-agent CLIs you already have (Claude Code, Codex, Copilot, Cursor, Gemini, opencode...) behind one API and one CLI, plus a thin provider-neutral LLM layer.",
5
5
  "author": "Grzegorz Tańczyk",
6
6
  "repository": {
@@ -35,7 +35,6 @@
35
35
  "docs",
36
36
  "!docs/examples",
37
37
  "!docs/media",
38
- "skills",
39
38
  "README.md",
40
39
  "LICENSE"
41
40
  ],
@@ -1,19 +0,0 @@
1
- /** What the plugin tells the overlay. */
2
- export interface OverlayConfig {
3
- /** Path of the plugin's endpoints on the dev server, e.g. `/__genaicode`. */
4
- api: string;
5
- /** Collect errors from the page and offer to send them to the agent. */
6
- captureErrors: boolean;
7
- }
8
- /** The part of Vite's `import.meta.hot` the overlay listens to. */
9
- export interface OverlayHot {
10
- on(event: string, callback: (payload: unknown) => void): void;
11
- }
12
- /**
13
- * The dev-server overlay: a wolf in the corner of the app that opens the genaicode UI in a
14
- * panel, and collects the page's errors so one click sends them to the agent.
15
- *
16
- * The plugin serves this function's source (`mountOverlay.toString()`) as a module, so it must
17
- * not use anything from outside its own body.
18
- */
19
- export declare function mountOverlay(config: OverlayConfig, hot: OverlayHot | undefined): void;
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../src/vite/overlay.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,GAA2B;IAC7E,IAAI,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC;QAAE,OAAO;IAOxD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,QAAQ,GAAG,IAAI,CAAC;IACtB,IAAI,MAAM,GAAgB,EAAE,CAAC;IAC7B,IAAI,OAAmD,CAAC;IAExD,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACzD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