@puku-ai/sdk 3.0.5 → 4.0.1

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.
Files changed (7) hide show
  1. package/README.md +29 -10
  2. package/package.json +25 -6
  3. package/sdk.cjs +13130 -4062
  4. package/sdk.cjs.map +140 -56
  5. package/sdk.d.ts +5166 -3095
  6. package/sdk.mjs +38 -22
  7. package/sdk.mjs.map +140 -56
package/README.md CHANGED
@@ -25,6 +25,7 @@ console.log(msg.content[0].text);
25
25
 
26
26
  - [Install](#install)
27
27
  - [Configuration](#configuration)
28
+ - [Supported models](#supported-models)
28
29
  - [Usage](#usage)
29
30
  - [Working features](#working-features)
30
31
  - [Namespace](#namespace)
@@ -65,6 +66,20 @@ const client = new PukuAI({
65
66
  });
66
67
  ```
67
68
 
69
+ Defaults: `maxRetries = 2`, `timeout = 600_000` ms (10 min).
70
+
71
+ ## Supported models
72
+
73
+ Exactly three model names are accepted by the Puku gateway. Any other string
74
+ returns a model-not-found error.
75
+
76
+ | Model | Family | Notes |
77
+ |---------------|----------|-------|
78
+ | `puku-ai-2.7` | Puku AI | Cheaper, lower-latency. |
79
+ | `puku-ai-2.8` | Puku AI | Default for most workloads. |
80
+ | `opus-4.8` | Opus | Strongest reasoning; pick this for fallbacks (`fallbacks: [{ model: "opus-4.8" }]`). |
81
+
82
+
68
83
  ## Usage
69
84
 
70
85
  ### Blocking
@@ -140,12 +155,8 @@ All error classes are static members of the `PukuAI` class,
140
155
  ## Working features
141
156
 
142
157
  Every feature below was exercised against the live Puku gateway at
143
-
144
-
145
- ```bash
146
- PUKU_BASE_URL="" \
147
- PUKU_API_KEY=pk_live_... \
148
- ```
158
+ `PUKU_BASE_URL=` with a `pk_live_*` API key (see
159
+ `.env` and `.env.staging.example`).
149
160
 
150
161
  ### Verified against the live gateway
151
162
 
@@ -168,6 +179,14 @@ PUKU_API_KEY=pk_live_... \
168
179
  |--------------------------------------|--------|------|
169
180
  | `client.messages.countTokens` | ⚠ 404 | SDK POSTs to `/v1/messages/count_tokens` exactly like upstream. Puku's gateway does not proxy this endpoint. |
170
181
  | `client.messages.batches.create` | ⚠ 404 | SDK POSTs to `/v1/messages/batches` exactly like upstream. Puku's gateway does not proxy this endpoint. |
182
+ | `client.beta.agents.*` | ⚠ 404 | SDK POSTs to `/v1/agents/*` exactly like upstream. Puku's gateway does not proxy these endpoints yet. |
183
+ | `client.beta.environments.*` | ⚠ 404 | SDK POSTs to `/v1/environments/*` exactly like upstream. Puku's gateway does not proxy these endpoints yet. |
184
+ | `client.beta.sessions.*` | ⚠ 404 | SDK POSTs to `/v1/sessions/*` exactly like upstream. Puku's gateway does not proxy these endpoints yet. |
185
+ | `client.beta.vaults.*` | ⚠ 404 | SDK POSTs to `/v1/vaults/*` exactly like upstream. Puku's gateway does not proxy these endpoints yet. |
186
+ | `client.beta.skills.{listVersions, retrieve, delete}` | ⚠ 404 | SDK POSTs/GETs to `/v1/skills/{id}/versions/...` exactly like upstream. Puku's gateway does not proxy these endpoints yet. The pure archive-validation helpers (`assertSafeMemberNames`, `assertNoSpecialMembers`, `runArchiveTool`, `archiveTopDir`, `readHead`) remain usable. |
187
+ | `client.messages.batches.results` | ⚠ n/a | Not exercised against the live gateway because `batches.create` already 404s. |
188
+ | Structured-outputs JSON parser (`output_format` / `output_config.format`) | ⚠ not wired | The SDK accepts the option but no structured-outputs parser is hooked into the stream finalizer. The `JSONOutputFormat` shape exists in types only. |
189
+ | Server-side `web_search` tool result | ⚠ not proxied | The SDK forwards a `web_search_20250305` tool definition; the gateway does not execute the search and returns the placeholder shape. Use the agent toolset + your own search client instead. |
171
190
 
172
191
 
173
192
 
@@ -198,7 +217,7 @@ const getWeather = {
198
217
 
199
218
  const finalMessage = await client.beta.messages
200
219
  .toolRunner({
201
- model: "puku-ai--2.8",
220
+ model: "puku-ai-2.8",
202
221
  max_tokens: 512,
203
222
  messages: [{ role: "user", content: "What's the weather in Tokyo?" }],
204
223
  tools: [getWeather],
@@ -220,7 +239,7 @@ import PukuAI from "@puku-ai/sdk";
220
239
  const client = new PukuAI();
221
240
 
222
241
  const stream = client.messages.stream({
223
- model: "puku-ai--2.8",
242
+ model: "puku-ai-2.8",
224
243
  max_tokens: 128,
225
244
  messages: [{ role: "user", content: "Say hello in three languages." }],
226
245
  });
@@ -255,7 +274,7 @@ await mcp.connect(clientT);
255
274
  const tools = await mcpTools({ mcpClient: mcp });
256
275
 
257
276
  const reply = await client.beta.messages.create({
258
- model: "puku-ai--2.8",
277
+ model: "puku-ai-2.8",
259
278
  max_tokens: 512,
260
279
  mcp_servers: [{ type: "url", url: "https://mcp.example.com/sse", name: "example" }],
261
280
  messages: [{ role: "user", content: "Find any open PRs." }],
@@ -334,7 +353,7 @@ PukuAI.VERSION; // SDK version
334
353
  ### CJS / ESM shim
335
354
 
336
355
  When you `require('@puku-ai/sdk')`, the default export is a callable function
337
- that instantiates `PukuAI` — matching the `@anthropic-ai/sdk` convention:
356
+ that instantiates `PukuAI`:
338
357
 
339
358
  ```ts
340
359
  // CJS or ESM-from-CJS:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puku-ai/sdk",
3
- "version": "3.0.5",
3
+ "version": "4.0.1",
4
4
  "description": "PukuAI client SDK",
5
5
  "type": "module",
6
6
  "main": "./sdk.cjs",
@@ -13,7 +13,23 @@
13
13
  "require": "./sdk.cjs",
14
14
  "default": "./sdk.mjs"
15
15
  },
16
- "./package.json": "./package.json"
16
+ "./package.json": "./package.json",
17
+ "./*.mjs": {
18
+ "types": "./sdk.d.ts",
19
+ "import": "./sdk.mjs",
20
+ "default": "./sdk.mjs"
21
+ },
22
+ "./*.js": {
23
+ "types": "./sdk.d.ts",
24
+ "require": "./sdk.cjs",
25
+ "default": "./sdk.cjs"
26
+ },
27
+ "./*": {
28
+ "types": "./sdk.d.ts",
29
+ "import": "./sdk.mjs",
30
+ "require": "./sdk.cjs",
31
+ "default": "./sdk.mjs"
32
+ }
17
33
  },
18
34
  "files": [
19
35
  "sdk.mjs",
@@ -42,7 +58,8 @@
42
58
  },
43
59
  "homepage": "https://github.com/puku-ai/puku-ai-sdk#readme",
44
60
  "dependencies": {
45
- "json-schema-to-ts": "^3.1.1"
61
+ "json-schema-to-ts": "^3.1.1",
62
+ "standardwebhooks": "^1.0.0"
46
63
  },
47
64
  "peerDependencies": {
48
65
  "zod": "^3.25.0 || ^4.0.0"
@@ -55,16 +72,18 @@
55
72
  "scripts": {
56
73
  "build": "bun run scripts/build.ts",
57
74
  "smoke": "node scripts/smoke-offline.mjs",
58
- "smoke:brand": "node scripts/smoke-anthropic-free.mjs",
75
+ "smoke:brand": "node scripts/smoke-puku-brand.mjs",
59
76
  "smoke:live": "bun run build && node --experimental-vm-modules scripts/smoke.mjs",
60
77
  "integration": "bun run build && node scripts/integration.mjs",
61
- "parity": "bun run build && node tests/parity/run-all.mjs",
78
+ "parity": "node tests/parity/run-all.mjs",
79
+ "test": "jest --config jest.config.cjs",
62
80
  "type-check": "tsc --noEmit",
63
81
  "prepack": "bun run build"
64
82
  },
65
83
  "devDependencies": {
66
84
  "@types/node": "^22.10.0",
67
85
  "bun-types": "^1.1.0",
68
- "typescript": "^5.6.0"
86
+ "typescript": "^5.6.0",
87
+ "zod": "^4.0.0"
69
88
  }
70
89
  }