genaicode 2.28.1 → 2.29.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/dist/agents/cli-agent.js +7 -5
- package/dist/agents/cli-agent.js.map +1 -1
- package/dist/agents/drivers/claude.d.ts +6 -1
- package/dist/agents/drivers/claude.js +55 -0
- package/dist/agents/drivers/claude.js.map +1 -1
- package/dist/agents/drivers/codex-live.d.ts +5 -0
- package/dist/agents/drivers/codex-live.js +44 -0
- package/dist/agents/drivers/codex-live.js.map +1 -1
- package/dist/agents/drivers/vibe.js +6 -2
- package/dist/agents/drivers/vibe.js.map +1 -1
- package/dist/agents/hosted.js +1 -0
- package/dist/agents/hosted.js.map +1 -1
- package/dist/agents/live-agent.js +1 -0
- package/dist/agents/live-agent.js.map +1 -1
- package/dist/agents/runtime.d.ts +17 -1
- package/dist/agents/runtime.js +80 -2
- package/dist/agents/runtime.js.map +1 -1
- package/dist/agents/session.d.ts +12 -1
- package/dist/agents/session.js +65 -2
- package/dist/agents/session.js.map +1 -1
- package/dist/agents/types.d.ts +45 -0
- package/dist/agents/verify.d.ts +1 -0
- package/dist/agents/verify.js +26 -1
- package/dist/agents/verify.js.map +1 -1
- package/dist/agents.d.ts +4 -3
- package/dist/agents.js +3 -2
- package/dist/agents.js.map +1 -1
- package/dist/cli/args.d.ts +5 -1
- package/dist/cli/args.js +25 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/main.d.ts +4 -2
- package/dist/cli/main.js +6 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/render.d.ts +3 -1
- package/dist/cli/render.js +30 -0
- package/dist/cli/render.js.map +1 -1
- package/dist/react/agent-chat.css +10 -0
- package/dist/react/agent-chat.js +3 -2
- package/dist/react/agent-chat.js.map +1 -1
- package/dist/react/format.d.ts +25 -1
- package/dist/react/format.js +74 -0
- package/dist/react/format.js.map +1 -1
- package/dist/react.d.ts +3 -2
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/ui/index.js +67 -65
- package/dist/ui/web-client.js +24 -14
- package/docs/agents.md +44 -0
- package/docs/cli.md +3 -1
- package/package.json +6 -1
package/docs/agents.md
CHANGED
|
@@ -118,6 +118,8 @@ failure of its own. A zero exit alone is not treated as success.
|
|
|
118
118
|
| `file-change` | Paths the agent reported editing |
|
|
119
119
|
| `approval-request` | The agent is waiting for a permission decision |
|
|
120
120
|
| `usage` | Token usage, plus `costUsd` when the agent reports it |
|
|
121
|
+
| `rate-limit` | A plan or account limit: window, status, % used, reset time |
|
|
122
|
+
| `budget-warning` | The run crossed `warnAt` of a `task.budget` cap |
|
|
121
123
|
| `error` | An error the agent reported |
|
|
122
124
|
| `stderr` | Raw stderr chunk |
|
|
123
125
|
| `raw` | A stdout line that was not JSON |
|
|
@@ -125,6 +127,48 @@ failure of its own. A zero exit alone is not treated as success.
|
|
|
125
127
|
|
|
126
128
|
Vendor events that have no mapping are dropped.
|
|
127
129
|
|
|
130
|
+
## Usage, limits and budgets
|
|
131
|
+
|
|
132
|
+
Every driver except `muse`, `museLive` and `vibe` reports token usage (`usage` events,
|
|
133
|
+
`result.usage`); `claude` and `opencode` also report cost (`costUsd`), so a cost cap works for
|
|
134
|
+
them (and for `vibe`, natively). Usage reports are running
|
|
135
|
+
totals for the run, not increments.
|
|
136
|
+
|
|
137
|
+
**Plan limits.** `claude` and `codexLive` say how much of the subscription is left
|
|
138
|
+
(`capabilities.rateLimits`) with `rate-limit` events:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
{ type: 'rate-limit', limit: { window: '5h', status: 'warning', usedPercent: 83, resetsAt: 1794571200000 } }
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`window` is `5h`, `7d`, `7d-opus`, `7d-sonnet`, `overage` (Claude) or the Codex window length.
|
|
145
|
+
`status` is `warning` when the vendor flags it or from 80% used, and `exceeded` when requests are
|
|
146
|
+
refused. Codex names a per-model limit in `name`. For any agent, an error that says a quota or
|
|
147
|
+
rate limit ran out (429, `quota`, `rate limit`, `usage limit`...) adds one
|
|
148
|
+
`{ window: 'quota', status: 'exceeded' }` event, so front ends can say why the agent stopped.
|
|
149
|
+
|
|
150
|
+
**Budgets.** `task.budget` caps one run:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const run = agent.run({ prompt, cwd, budget: { maxTokens: 200_000, maxCostUsd: 2, warnAt: 0.8 } });
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Past `warnAt` (default 0.8) of a cap the run emits one `budget-warning` per cap; past the cap
|
|
157
|
+
genaicode stops the agent and the run fails with `error: "claude went over its cost budget
|
|
158
|
+
($2.0412 of $2)."`. Tokens count `totalTokens`, else input + output. The check runs on the
|
|
159
|
+
agent's usage reports, so an agent that reports usage only at the end (`claude`, `gemini`,
|
|
160
|
+
`copilot`) can overshoot within that turn. `claude` also gets `--max-budget-usd` and `vibe`
|
|
161
|
+
`--max-price` for the cost cap, which stop it from the inside. `runWithVerify` spreads the
|
|
162
|
+
budget over all attempts.
|
|
163
|
+
|
|
164
|
+
`createAgentSession({ budget })` caps the whole session: each turn runs with what is left, and
|
|
165
|
+
once a cap is used up new prompts fail without starting (`setBudget()` changes it). The session
|
|
166
|
+
keeps `state.budget` and the latest report per limit in `state.rateLimits`. `limitChips(state)`
|
|
167
|
+
from `genaicode/react` turns both into short labels with a level (`ok`, `warning`,
|
|
168
|
+
`exceeded`); `<AgentChat>`, `genaicode chat` and `genaicode ui` show them next to usage, yellow
|
|
169
|
+
when close and red when out. `genaicode run|chat|ui --max-tokens <n> --max-cost <usd>` set
|
|
170
|
+
budgets from the command line.
|
|
171
|
+
|
|
128
172
|
## Follow-up turns
|
|
129
173
|
|
|
130
174
|
`result.sessionId` names the agent's own session. Pass it as `resume` to continue that
|
package/docs/cli.md
CHANGED
|
@@ -17,7 +17,9 @@ Assistant text goes to stdout and tool calls, edits, and the result line go to s
|
|
|
17
17
|
`--verify` runs a shell command after the agent finishes and sends its output back for up
|
|
18
18
|
to `--max-repairs` more attempts (`runWithVerify`). The exit code is 0 on success, 1 when
|
|
19
19
|
the agent or the check fails, 2 on a usage error, and 130 when interrupted.
|
|
20
|
-
|
|
20
|
+
`--max-tokens <n>` and `--max-cost <usd>` stop the agent once it goes over (with `--verify`,
|
|
21
|
+
over all attempts together); a line on stderr warns at 80% and when the agent's plan limit
|
|
22
|
+
gets close. `npx genaicode --help` lists every option.
|
|
21
23
|
|
|
22
24
|
## Chat with an agent: terminal and browser
|
|
23
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genaicode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.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": {
|
|
@@ -110,6 +110,11 @@
|
|
|
110
110
|
"vitest": "^4.1.12",
|
|
111
111
|
"zod": "^3.25.76"
|
|
112
112
|
},
|
|
113
|
+
"overrides": {
|
|
114
|
+
"@typescript-eslint/typescript-estree": {
|
|
115
|
+
"minimatch": "^11.0.1"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
113
118
|
"prettier": {
|
|
114
119
|
"trailingComma": "all",
|
|
115
120
|
"tabWidth": 2,
|