@runappsai/agent 0.1.9 → 0.1.11

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/agent.md CHANGED
@@ -164,6 +164,8 @@ createAgent(provider, {
164
164
  await agent.compact("keep every API name we discussed"); // now, with a focus
165
165
  ```
166
166
 
167
+ A user can change compaction mid-conversation, from the next turn on: `agent.configure({ compaction: { summarize, reserveTokens, keepRecentTokens } })`. `summarize: false` only shortens and drops (as `compaction: false`), `true` summarises again (with your function, if you gave one); a threshold named without a number (`reserveTokens: undefined`) goes back to the default. `agent.settings.compaction` reads the choice back, and `agent.compactionFor(window)` says what it comes to for a window: the thresholds are capped at 20 % / 40 % of it. The chat UI's settings have a *Context* tab for this.
168
+
167
169
  ### When a request does not fit
168
170
 
169
171
  A provider may refuse a request as larger than the model takes, in its own words (`isContextOverflow(err)` recognises them; a status of 413 counts too). The agent then makes it smaller by itself and sends it again: it summarises what is older than the latest turn and trims to 70% of the window, then, if refused again, to 40%, the big results of the latest turn included. A refusal that states the real limit corrects the window for the rest of the run. A request more than twice a window the catalogue vouches for is treated as refused without being sent.
@@ -247,4 +249,4 @@ Both live in the workspace's directory: shared by every conversation that uses t
247
249
  | `webTools` | `false` | RunApps (SDK 0.19+): the platform's `web_search` and `web_fetch` beside your tools, billed per call (see [Tools](tools.md#web-search-and-reading-pages)). A function is read every turn. |
248
250
  | `serverTools` | | Deprecated, use `webTools`: the gateway runs the tools inside the chat call, for an agent with no tools of its own. |
249
251
 
250
- Change settings on a live agent with `agent.configure({ model, maxTurns, maxTokens, permissions, reasoningEffort, webTools })`; `agent.settings` reads them back, `agent.webTools` says whether the web tools are on and `agent.webToolsAvailable` whether the provider has them.
252
+ Change settings on a live agent with `agent.configure({ model, maxTurns, maxTokens, permissions, reasoningEffort, webTools, compaction })`; `agent.settings` reads them back, `agent.webTools` says whether the web tools are on and `agent.webToolsAvailable` whether the provider has them.
package/docs/chat-ui.md CHANGED
@@ -31,7 +31,7 @@
31
31
  - **Files** — the header's *Files* button opens the directory: a tree, an editor (⌘S, word wrap, Markdown preview), picture and PDF previews, upload, new file, download (folders as zip). File paths in replies open there. Live: changes by the agent show at once.
32
32
  - **Skills** — the *Skills* button lists the skills (with a count), uploads zips, removes the user's own.
33
33
  - **Chats** — the conversation list (the open one first), new chat, delete. Conversations keep running when you switch away (up to three in the background).
34
- - **Settings** — the gear: model (with context and output limits, and which models see pictures), thinking level when the model has one, max turns, max output, tool permissions. Kept per app in the browser and applied to every conversation; only what differs from the app's defaults is kept, and a saved model the catalogue no longer lists is dropped (the default applies again).
34
+ - **Settings** — the gear: model (with context and output limits, and which models see pictures), thinking level when the model has one, max turns, max output, tool permissions; and a *Context* tab for compaction — summarise older turns or only trim, how many tokens left starts it, how much of the newest stays word for word (each "Default" or a number, with what that comes to for the chosen model). Kept per app in the browser and applied to every conversation; only what differs from the app's defaults is kept, and a saved model the catalogue no longer lists is dropped (the default applies again).
35
35
  - **Reply actions** — hover a reply: copy its answer, *answer again* (rewinds to its question, with the same restore choices, and sends it again), delete the question and its answer; on the right what the reply cost (its `runUsage`, in the model's `price.currency`), the tokens and calls in its tooltip.
36
36
  - **Rewind** — hover a user message: when it was sent, copy, *rewind to here* (the conversation after it is dropped, the message goes back into the composer, and the directory's files can be restored to that moment).
37
37
  - **How a run ended** — *Stopped.*, the turn limit with *Continue*, an error with *Retry*, a request too large for the model with what solves it (below); kept across reloads until the next run.
@@ -94,7 +94,7 @@ Typing `/` lists the built-in commands, then the directory's prompt templates an
94
94
  | `uploadsDir` | `/uploads` | Where attachments are saved (with a workspace and file tools; with `fileTools: false` a text file goes into the message itself, so the model can read it). |
95
95
  | `showUsage` | on | The context ring in the header and its panel (context use, spending, *Compact now*). |
96
96
  | `locale` | the document's | `"en"` or `"zh"`. |
97
- | `theme` | `"auto"` | `"auto"`, `"light"`, `"dark"`. |
97
+ | `theme` | `"auto"` | `"auto"`, `"light"`, `"dark"`. A fixed theme also declares its `color-scheme`, so scrollbars and native controls follow the chat, not the page or the system. Checkboxes and radios are drawn by the chat in the palette's colours. |
98
98
  | `palette` | `"claude"` | `"claude"`, `"violet"`, `"slate"`, `"forest"`, or your own. |
99
99
  | `vars` | | Colour and font overrides (see Theming). |
100
100
  | `className` | | Extra classes on the chat's root. |
@@ -211,7 +211,7 @@ chat.updateComposerAction("analyze", { disabled: true, label: "Backtest running
211
211
 
212
212
  `iconOnly: true` draws only the icon, with the label as its tooltip.
213
213
 
214
- `settingsTabs` adds tabs of yours to the gear's panel, after the chat's own "Model" tab, so a host needs no second settings button and the panel stays short. In a tab the chat draws a `toggle` or a `select`, reads it back when the user presses Apply (calling `onChange` only for a value that changed) and puts back `default` on Reset; you keep the value and act on it. An element goes in as it is. The panel reopens on the tab last shown.
214
+ `settingsTabs` adds tabs of yours to the gear's panel, after the chat's own "Model" and "Context" tabs, so a host needs no second settings button and the panel stays short. In a tab the chat draws a `toggle` or a `select`, reads it back when the user presses Apply (calling `onChange` only for a value that changed) and puts back `default` on Reset; you keep the value and act on it. An element goes in as it is. The panel reopens on the tab last shown.
215
215
 
216
216
  ```js
217
217
  renderChat(host, {
package/docs/reference.md CHANGED
@@ -44,7 +44,8 @@ Three entry points:
44
44
  | `queued`, `dequeue(message)`, `clearQueue()` | What waits. |
45
45
  | `on(event, handler)` / `on("*", (name, event) => …)` | Subscribe; returns an unsubscribe function. |
46
46
  | `ready()` | Resolves once a saved session is loaded. |
47
- | `configure(patch)`, `settings` | `model`, `maxTurns`, `maxTokens`, `permissions`, `reasoningEffort`. |
47
+ | `configure(patch)`, `settings` | `model`, `maxTurns`, `maxTokens`, `permissions`, `reasoningEffort`, `webTools`, `compaction` (`{ summarize, reserveTokens, keepRecentTokens }`). |
48
+ | `compactionFor(window)` | Compaction as it applies to a window of that many tokens: `{ summarize, reserveTokens, keepRecentTokens }`, thresholds capped. |
48
49
  | `limits()` → `{ input, output }`, `context()` → `{ used, window }` | Model limits, context use. |
49
50
  | `useSkill(name)` | Load a skill for the next prompt. |
50
51
  | `systemPrompt()` | The system prompt as it would be sent. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runappsai/agent",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "description": "Agent harness: the model ↔ tool loop with a workspace, skills, sessions, compaction, a sandbox and a chat UI. Bring any OpenAI-compatible model provider (RunApps included); no runtime dependencies.",
6
6
  "license": "MIT",