zidane 1.6.17 → 1.8.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/README.md +36 -10
- package/dist/{agent-CtGvwTdo.d.ts → agent-CWQ5XOw6.d.ts} +436 -5
- package/dist/{chunk-V4PBD7LE.js → chunk-2IB4XBQE.js} +162 -0
- package/dist/{chunk-KLFSGJE4.js → chunk-3RJOWJOJ.js} +1 -1
- package/dist/{chunk-OJATGJ5F.js → chunk-4N5ADW7A.js} +387 -70
- package/dist/{chunk-QCJKUQTQ.js → chunk-EC7IRWVS.js} +135 -4
- package/dist/chunk-FFFDQHMA.js +68 -0
- package/dist/{chunk-WDBO3JCO.js → chunk-TBC6MSVK.js} +118 -7
- package/dist/chunk-WQBKOZVI.js +641 -0
- package/dist/glob-j9gbk6xm.d.ts +5 -0
- package/dist/harnesses.d.ts +1 -1
- package/dist/harnesses.js +4 -3
- package/dist/index.d.ts +68 -4
- package/dist/index.js +152 -6
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +3 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +17 -285
- package/dist/session.d.ts +1 -1
- package/dist/session.js +5 -2
- package/dist/{spawn-hNTJA3Iw.d.ts → spawn-EEv1Johs.d.ts} +1 -1
- package/dist/tools.d.ts +3 -2
- package/dist/tools.js +5 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +14 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -10,15 +10,18 @@ Minimal TypeScript agent loop built with [Bun](https://bun.sh). Hook into every
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
bun install
|
|
13
|
-
bun run auth # Anthropic OAuth
|
|
13
|
+
bun run auth # Anthropic + OpenAI Codex OAuth
|
|
14
14
|
bun start --prompt "create a hello world app"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
`auth` runs both OAuth flows by default. Pass `--openai` or `--anthropic` to authenticate only one provider; the npm script form works too, e.g. `npm run auth --openai`.
|
|
18
|
+
|
|
17
19
|
## Agent Setup
|
|
18
20
|
|
|
19
21
|
```ts
|
|
20
|
-
import { createAgent
|
|
21
|
-
import { basic } from 'zidane'
|
|
22
|
+
import { createAgent } from 'zidane'
|
|
23
|
+
import { basic } from 'zidane/harnesses'
|
|
24
|
+
import { anthropic } from 'zidane/providers'
|
|
22
25
|
|
|
23
26
|
const agent = createAgent({
|
|
24
27
|
provider: anthropic({ apiKey: 'sk-ant-...' }),
|
|
@@ -77,7 +80,7 @@ Precedence: `run.behavior` > `agent.behavior` > `harness.behavior` > hardcoded d
|
|
|
77
80
|
bun start \
|
|
78
81
|
--prompt "your task" \ # required
|
|
79
82
|
--model claude-opus-4-6 \ # model id
|
|
80
|
-
--provider anthropic \ # anthropic | openrouter | cerebras
|
|
83
|
+
--provider anthropic \ # anthropic | openai | openrouter | cerebras
|
|
81
84
|
--harness basic \ # tool set
|
|
82
85
|
--system "be concise" \ # system prompt
|
|
83
86
|
--thinking off \ # off | minimal | low | medium | high
|
|
@@ -92,10 +95,11 @@ All providers accept runtime credentials via a params object. Env vars are fallb
|
|
|
92
95
|
### Anthropic
|
|
93
96
|
|
|
94
97
|
```ts
|
|
95
|
-
import { anthropic } from 'zidane'
|
|
98
|
+
import { anthropic } from 'zidane/providers'
|
|
96
99
|
|
|
97
100
|
anthropic({ apiKey: 'sk-ant-...' })
|
|
98
101
|
anthropic({ access: 'sk-ant-oat-...' }) // OAuth
|
|
102
|
+
anthropic({ access: 'sk-ant-oat-...', refresh: '...', expires: Date.now() + 3600_000 }) // auto-refresh
|
|
99
103
|
anthropic({ apiKey: '...', defaultModel: 'claude-sonnet-4-6' })
|
|
100
104
|
```
|
|
101
105
|
|
|
@@ -104,17 +108,31 @@ Fallback: `params.apiKey` > `params.access` > `ANTHROPIC_API_KEY` env > `.creden
|
|
|
104
108
|
### OpenRouter
|
|
105
109
|
|
|
106
110
|
```ts
|
|
107
|
-
import { openrouter } from 'zidane'
|
|
111
|
+
import { openrouter } from 'zidane/providers'
|
|
108
112
|
|
|
109
113
|
openrouter({ apiKey: 'sk-or-...', defaultModel: 'google/gemini-pro' })
|
|
110
114
|
```
|
|
111
115
|
|
|
112
116
|
Fallback: `params.apiKey` > `OPENROUTER_API_KEY` env
|
|
113
117
|
|
|
118
|
+
### OpenAI
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { openai } from 'zidane/providers'
|
|
122
|
+
|
|
123
|
+
openai() // OpenAI Codex OAuth
|
|
124
|
+
openai({ access: 'eyJ...', defaultModel: 'gpt-5.4' })
|
|
125
|
+
openai({ access: 'eyJ...', refresh: '...', expires: Date.now() + 3600_000, accountId: 'acct_123' })
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Fallback: `params.apiKey` > `params.access` > `OPENAI_CODEX_API_KEY` env > `.credentials.json`
|
|
129
|
+
|
|
130
|
+
Pass the full OAuth credential fields (`access`, `refresh`, `expires`, plus provider extras like `accountId`) to let the provider auto-refresh tokens without reading `.credentials.json`.
|
|
131
|
+
|
|
114
132
|
### Cerebras
|
|
115
133
|
|
|
116
134
|
```ts
|
|
117
|
-
import { cerebras } from 'zidane'
|
|
135
|
+
import { cerebras } from 'zidane/providers'
|
|
118
136
|
|
|
119
137
|
cerebras({ apiKey: 'csk-...', defaultModel: 'zai-glm-4.7' })
|
|
120
138
|
```
|
|
@@ -136,7 +154,7 @@ Tools are grouped into **harnesses**. The `basic` harness includes:
|
|
|
136
154
|
Define a custom harness:
|
|
137
155
|
|
|
138
156
|
```ts
|
|
139
|
-
import { defineHarness, basicTools } from 'zidane'
|
|
157
|
+
import { defineHarness, basicTools } from 'zidane/harnesses'
|
|
140
158
|
|
|
141
159
|
const harness = defineHarness({
|
|
142
160
|
name: 'researcher',
|
|
@@ -221,6 +239,12 @@ agent.hooks.hook('stream:thinking', (ctx) => {
|
|
|
221
239
|
// ctx.delta, ctx.thinking (accumulated), ctx.turnId
|
|
222
240
|
// Fires when the model streams reasoning traces (Anthropic, OpenRouter)
|
|
223
241
|
})
|
|
242
|
+
|
|
243
|
+
agent.hooks.hook('oauth:refresh', (ctx) => {
|
|
244
|
+
// ctx.provider, ctx.providerId, ctx.source
|
|
245
|
+
// ctx.previousCredentials, ctx.credentials
|
|
246
|
+
// Fires when an OAuth token is refreshed from passed credentials or .credentials.json
|
|
247
|
+
})
|
|
224
248
|
```
|
|
225
249
|
|
|
226
250
|
### Tool execution
|
|
@@ -290,7 +314,8 @@ agent.followUp('now write tests for what you built')
|
|
|
290
314
|
The `spawn` tool delegates tasks to child agents that run independently.
|
|
291
315
|
|
|
292
316
|
```ts
|
|
293
|
-
import { createSpawnTool
|
|
317
|
+
import { createSpawnTool } from 'zidane/tools'
|
|
318
|
+
import { defineHarness, basicTools } from 'zidane/harnesses'
|
|
294
319
|
|
|
295
320
|
const harness = defineHarness({
|
|
296
321
|
name: 'orchestrator',
|
|
@@ -312,7 +337,8 @@ Children inherit the parent's harness and can spawn their own children.
|
|
|
312
337
|
Let the agent pause and request structured input from the outside world. Not included in any harness by default.
|
|
313
338
|
|
|
314
339
|
```ts
|
|
315
|
-
import { createInteractionTool
|
|
340
|
+
import { createInteractionTool } from 'zidane/tools'
|
|
341
|
+
import { defineHarness, basicTools } from 'zidane/harnesses'
|
|
316
342
|
|
|
317
343
|
const askUser = createInteractionTool({
|
|
318
344
|
name: 'ask_user',
|