genaicode 2.31.0 → 2.32.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/docs/agents.md CHANGED
@@ -274,8 +274,9 @@ const session = createAgentSession({ agent: claude(), cwd, artifacts });
274
274
  app.get('/artifacts/:id', (req, res) => {
275
275
  const found = artifacts.store.read(req.params.id);
276
276
  if (!found) return res.status(404).end();
277
- const { headers, body } = artifactResponse(found.artifact, found.body);
278
- res.writeHead(200, headers).end(body);
277
+ // The Range header lets audio and video seek.
278
+ const { status, headers, body } = artifactResponse(found.artifact, found.body, { range: req.headers.range });
279
+ res.writeHead(status, headers).end(body);
279
280
  });
280
281
  ```
281
282
 
@@ -285,10 +286,29 @@ app.get('/artifacts/:id', (req, res) => {
285
286
  simply do not get the tool. An app with its own MCP server can mount `store.tool()` there
286
287
  and pass `{ store }` alone; `createAppAgent` does exactly that (see [app-agent.md](app-agent.md)).
287
288
  - Each publish adds an `artifact` entry (`{ id, title, kind, mimeType, bytes, version, path? }`)
288
- to the running turn. The content is copied into memory at that moment (5 MB each, the newest
289
- 30 by default); publishing the same `name` again replaces it and keeps the `id`.
289
+ to the running turn. The content is copied into memory at that moment (5 MB each, 50 MB for
290
+ audio and video, the newest 30 and 200 MB in all by default: `maxBytes`, `maxMediaBytes`,
291
+ `maxArtifacts`, `maxTotalBytes`); publishing the same `name` again replaces it and keeps the `id`.
290
292
  - `<AgentChat artifactUrl={(a) => `/artifacts/${a.id}?v=${a.version}`}>` shows a card with a
291
293
  preview; the terminal chat shows a line and `/web` opens the browser.
294
+ - **Media**: files ending in png, jpg, gif, webp, avif or svg show as a picture (screenshots),
295
+ mp3, wav, ogg, opus, m4a, aac or flac in an audio player, mp4, m4v, webm, mov or ogv in a
296
+ video player. Media is published from a file (`path`), not as `content`. Your page's own
297
+ Content-Security-Policy has to allow `img-src`, `media-src` and `frame-src` for the address
298
+ you serve artifacts at.
299
+ - **Pages that answer back**: a published page can ask the user something (a questionnaire, a
300
+ choice between mockups) and hand the answer to the agent by calling
301
+ `parent.postMessage({ genaicode: 'submit', data }, '*')`, e.g. from a button. `<AgentChat>`
302
+ takes that only from the frame of that card, shows the user the JSON that would be sent and
303
+ waits for **Send to agent**; then `onArtifactSubmit(artifact, data)` runs, by default
304
+ `onSend(artifactSubmission(artifact, data))`, so the agent reads it as the user's next
305
+ message. Pass `onArtifactSubmit={null}` to turn it off. Nothing is sent without that click,
306
+ and a page opened in a tab of its own has nobody to send to.
307
+ - **Other agents**: the store belongs to the session, not the agent. After `setAgent()` or a
308
+ failover the cards still open, the next agent gets the same tool, and its handoff lists what
309
+ was published (title, `name`, kind, version, source file) so it can replace an artifact under
310
+ the same `name`. Pages and documents that were published as `content` are written into the
311
+ handoff transcript, since they exist nowhere else.
292
312
 
293
313
  Artifacts are agent-written content, so they are handled as untrusted:
294
314
 
@@ -303,6 +323,8 @@ Artifacts are agent-written content, so they are handled as untrusted:
303
323
  cookies, storage or DOM of your app, also when its URL is opened directly) and loads
304
324
  nothing from the network, so no CDN scripts either. `<AgentChat>` adds the same sandbox on
305
325
  the frame. SVG is shown as an image, or with scripts off when opened directly.
326
+ - **Answers from a page** are data from agent-written code: they reach the agent only after
327
+ the user saw and confirmed them, at most 20 KB of JSON at a time.
306
328
  - **What is left**: a page can still navigate its own frame to another site and carry data in
307
329
  that URL; browsers offer no switch for that. The page only knows what the agent put in it,
308
330
  but treat a published page like a link the agent sent you.
package/docs/react.md CHANGED
@@ -71,19 +71,20 @@ HTML; links open in a new tab; GFM tables, strikethrough and task lists), collap
71
71
  own approval requests, queued prompts and a working indicator, and an input where Enter
72
72
  sends, Shift+Enter adds a line and Esc stops. Props:
73
73
 
74
- | Prop | |
75
- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
76
- | `state` | `SessionState`, or null before there is a session |
77
- | `onSend(text)`, `onStop()` | Enter or Send; Stop or Esc. No `onStop`, no Stop button |
78
- | `onApprove(id, decision)` | answers `state.approvals`; without it they show as waiting |
79
- | `renderPrompt(text, turn?)` | how a sent prompt shows (return null to hide it) |
80
- | `renderAfterTurn(turn, i)`, `renderFooter()` | your content after a turn, or at the end |
81
- | `notices` | `{ id, afterTurn, text, tone? }[]`: your own lines between turns |
82
- | `artifactUrl(artifact)`, `renderArtifact(artifact, url)` | where your server serves a published artifact; your own card ([artifacts](agents.md#artifacts)) |
83
- | `foldSteps` | fold each turn's tools and edits into one "N steps" line |
84
- | `header`, `headerExtras` | replace the header (null for none), or add to its right end |
85
- | `emptyState`, `placeholder`, `hint` | text before the first turn, in and under the input |
86
- | `formatToolName(name)`, `disabled`, `autoFocus`, `theme`, `className`, `style` | |
74
+ | Prop | |
75
+ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
76
+ | `state` | `SessionState`, or null before there is a session |
77
+ | `onSend(text)`, `onStop()` | Enter or Send; Stop or Esc. No `onStop`, no Stop button |
78
+ | `onApprove(id, decision)` | answers `state.approvals`; without it they show as waiting |
79
+ | `renderPrompt(text, turn?)` | how a sent prompt shows (return null to hide it) |
80
+ | `renderAfterTurn(turn, i)`, `renderFooter()` | your content after a turn, or at the end |
81
+ | `notices` | `{ id, afterTurn, text, tone? }[]`: your own lines between turns |
82
+ | `artifactUrl(artifact)`, `renderArtifact(artifact, url)` | where your server serves a published artifact; your own card ([artifacts](agents.md#artifacts)) |
83
+ | `onArtifactSubmit(artifact, data)` | a page the agent published sent data and the user confirmed it; default sends it as a message; `null` turns it off |
84
+ | `foldSteps` | fold each turn's tools and edits into one "N steps" line |
85
+ | `header`, `headerExtras` | replace the header (null for none), or add to its right end |
86
+ | `emptyState`, `placeholder`, `hint` | text before the first turn, in and under the input |
87
+ | `formatToolName(name)`, `disabled`, `autoFocus`, `theme`, `className`, `style` | |
87
88
 
88
89
  Theme it with CSS custom properties on the component or any ancestor: `--gc-bg`,
89
90
  `--gc-panel`, `--gc-border`, `--gc-text`, `--gc-muted`, `--gc-accent`, `--gc-accent-text`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genaicode",
3
- "version": "2.31.0",
3
+ "version": "2.32.0",
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": {