@chusky/sdk 0.3.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ Releases use semantic versioning and are tagged `sdk-vX.Y.Z`.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.4.0 - 2026-09-22
8
+
9
+ - Added typed A2A discovery and durable task operations through `chusky.a2a`.
10
+ - Added Agent Card, task status, cursor pagination, cancellation, and A2A
11
+ JSON-RPC transport coverage.
12
+ - Documented the shared owner-scoped A2A contract and usage example.
13
+
14
+ ## 0.3.1 - 2026-09-21
15
+
16
+ - Rewrote the SDK README with production setup, security, durability, approvals, missions, company workflows, and resource guidance.
17
+ - Added runnable TypeScript examples for quickstarts, streaming, governed agents, missions, approvals, departments, files, and webhooks.
18
+ - Included the examples directory in published packages.
19
+
7
20
  ## 0.3.0 - 2026-09-21
8
21
 
9
22
  - Added typed SDK resources for autonomous missions, proof/evidence verification, provider-event resume, replanning, context, departments, and outcome packages.
package/README.md CHANGED
@@ -1,90 +1,431 @@
1
1
  # Chusky TypeScript SDK
2
2
 
3
- ## Documentation
3
+ The official TypeScript client for the Chusky Developer API.
4
4
 
5
- The complete Mintlify-style documentation is in [`docs/`](docs/index.mdx), including the quickstart, concepts, streaming, model selection, calls and live voice, Recall meetings, autonomous missions, context, departments, outcome packages, files, approvals, durable tasks, tools, skills, artifacts, video jobs, workers, channels, webhooks, security, errors, release operations, and production guidance. Embedded chat is documented in [`docs/embedded-chat.mdx`](docs/embedded-chat.mdx); import the browser element from `@chusky/sdk/widget` and keep the project key on your server. The Mintlify navigation configuration is [`docs.json`](docs.json).
5
+ Chusky gives applications a persistent, tool-using agent that can stream
6
+ responses, run durable work, use connected business applications, pause for
7
+ human approval, produce artifacts, and continue after restarts. The SDK is the
8
+ server-side boundary for those capabilities; it does not expose Redis,
9
+ Composio credentials, or Chusky's internal `CHUCK_*` tool implementations.
6
10
 
7
- This package is the public developer boundary for Chusky. It is intentionally separate from the Telegram bot, Redis store, Composio credentials, and internal `CHUCK_*` tool names. SDK applications use `CHUSKY_API_KEY`, containing their scoped `chsk_` API key. `CHUSKY_PROJECT_KEY` is used only by the self-hosted Chusky operator to provision those API keys; it is never an SDK application credential.
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @chusky/sdk
15
+ ```
16
+
17
+ Requirements: Node.js 18 or newer.
18
+
19
+ ## Five-minute quickstart
20
+
21
+ Create a project-scoped API key in the Chusky dashboard under **Developer API**
22
+ or provision one from a trusted operator environment. Then keep it on your
23
+ server:
24
+
25
+ ```env
26
+ CHUSKY_API_KEY=chsk_your_project_key
27
+ CHUSKY_BASE_URL=https://api.chusky.ai
28
+ ```
29
+
30
+ Never put `CHUSKY_API_KEY` in browser JavaScript, a mobile binary, a public
31
+ repository, or client-side environment variables.
8
32
 
9
33
  ```ts
10
34
  import { Chusky } from "@chusky/sdk";
11
35
 
12
- const chusky = new Chusky({ apiKey: process.env.CHUSKY_API_KEY!, baseUrl: process.env.CHUSKY_BASE_URL, userId: "customer_123" });
13
- const thread = await chusky.threads.create();
14
-
15
- for await (const event of chusky.threads.runs(thread.id).stream(
16
- { input: "Prepare a concise renewal brief." },
17
- { idempotencyKey: crypto.randomUUID() },
18
- )) {
19
- if (event.type === "run.delta") process.stdout.write(event.text);
20
- if (event.type === "run.approval_required") {
21
- // Present the exact approval to an authenticated human.
22
- }
36
+ const chusky = new Chusky({
37
+ apiKey: process.env.CHUSKY_API_KEY!,
38
+ baseUrl: process.env.CHUSKY_BASE_URL,
39
+ // Use your application's stable user or tenant identity. Do not use a
40
+ // secret, email address, or the root operator identity here.
41
+ userId: "customer_123",
42
+ });
43
+
44
+ const { thread, run } = await chusky.runs.create(
45
+ { input: "Prepare a concise renewal brief.", wait: false },
46
+ { idempotencyKey: "renewal-brief-customer-123-2026-09-21" },
47
+ );
48
+
49
+ const completed = await chusky.runs.wait(thread.id, run.id, {
50
+ timeoutMs: 120_000,
51
+ });
52
+
53
+ console.log(completed.status);
54
+ console.log(completed.output ?? "The run did not produce text output.");
55
+ ```
56
+
57
+ `userId` is an application-owned identity boundary. Chusky uses it to isolate
58
+ threads, runs, memories, approvals, files, tasks, reminders, connected
59
+ accounts, and durable work. Use the same stable value whenever that user
60
+ returns.
61
+
62
+ ## Examples
63
+
64
+ The [`examples/`](examples/) directory contains complete TypeScript examples
65
+ that can be adapted directly into a server application:
66
+
67
+ | Example | Shows |
68
+ | --- | --- |
69
+ | [`quickstart.ts`](examples/quickstart.ts) | Create a durable run and wait for completion |
70
+ | [`streaming.ts`](examples/streaming.ts) | Stream response deltas and handle approval events |
71
+ | [`company-agent.ts`](examples/company-agent.ts) | Use an agent template, policy, budget, and idempotency |
72
+ | [`mission.ts`](examples/mission.ts) | Run multi-step work with proof, evidence, and verification |
73
+ | [`approvals.ts`](examples/approvals.ts) | Present and decide a pending human approval |
74
+ | [`context-and-departments.ts`](examples/context-and-departments.ts) | Save shared context and create a typed department handoff |
75
+ | [`files.ts`](examples/files.ts) | Upload bytes through a short-lived storage intent |
76
+ | [`webhooks.ts`](examples/webhooks.ts) | Register a delivery endpoint and inspect deliveries |
77
+
78
+ Run an example from the SDK repository with `tsx`:
79
+
80
+ ```bash
81
+ CHUSKY_API_KEY=chsk_... npx tsx examples/quickstart.ts
82
+ ```
83
+
84
+ PowerShell:
85
+
86
+ ```powershell
87
+ $env:CHUSKY_API_KEY = "chsk_..."
88
+ npx tsx examples/quickstart.ts
89
+ ```
90
+
91
+ Examples make real API requests. Use a development project key and a test
92
+ identity when trying them.
93
+
94
+ ## The execution model
95
+
96
+ ```text
97
+ Your server
98
+ ↓
99
+ @chusky/sdk
100
+ ↓ authenticated /v1 API
101
+ Chusky runtime
102
+ ↓
103
+ agent loop → native tools / Composio / durable workflows
104
+ ↓
105
+ business result, artifact, webhook, or approval
106
+ ```
107
+
108
+ There are three useful execution modes:
109
+
110
+ 1. **Synchronous** — set `wait: true` when the result should return in the
111
+ request lifecycle and the work is short.
112
+ 2. **Durable** — set `wait: false` to receive a task-backed run immediately,
113
+ then use `runs.get()`, `runs.wait()`, `runs.events()`, `tasks.get()`, or a
114
+ webhook to observe it.
115
+ 3. **Streaming** — use `threads.runs(threadId).stream()` for incremental text
116
+ and approval events. Streaming is a delivery channel, not the source of
117
+ truth; persisted run state remains available through `get()` and `events()`.
118
+
119
+ ### Agent-to-agent tasks
120
+
121
+ The SDK also exposes the standards-shaped A2A boundary. Discover the remote
122
+ Agent Card, submit a durable task, stream or subscribe to updates, and attach
123
+ an encrypted callback for long-running work:
124
+
125
+ ```ts
126
+ const card = await chusky.a2a.card();
127
+ const task = await chusky.a2a.send("Prepare a verified launch brief.", {
128
+ idempotencyKey: "a2a-launch-brief-2026-09-22",
129
+ });
130
+
131
+ const callback = await chusky.a2a.createPushNotificationConfig(task.id, {
132
+ url: "https://your-service.example/a2a/status",
133
+ token: process.env.A2A_CALLBACK_TOKEN,
134
+ });
135
+
136
+ for await (const update of chusky.a2a.subscribe(task.id)) {
137
+ console.log(update.statusUpdate?.status.state);
23
138
  }
24
139
  ```
25
140
 
26
- For company workflows, provision an agent profile from a specialist template
27
- and create a durable run in one call. The project key's scopes and the company
28
- policy are enforced by Chusky; send an idempotency key so retries do not create
29
- duplicate threads or tasks.
141
+ Push callback credentials are never returned after registration. The Chusky
142
+ runtime delivers signed `application/a2a+json` status updates through its
143
+ durable outbox and keeps task state available through `a2a.get()`.
144
+
145
+ ## Idempotency and retries
146
+
147
+ Use an `idempotencyKey` for every durable POST that your server may retry after
148
+ an interruption. Reuse the same key only for the exact same operation and
149
+ request body.
150
+
151
+ ```ts
152
+ const operationKey = `research:${customerId}:${requestId}`;
153
+
154
+ const firstAttempt = await chusky.runs.create(
155
+ { input: "Research our renewal risk and draft next steps.", wait: false },
156
+ { idempotencyKey: operationKey },
157
+ );
158
+
159
+ // A network retry with operationKey returns the same durable operation rather
160
+ // than creating a duplicate run.
161
+ ```
162
+
163
+ Do not generate a new idempotency key for a retry unless you intentionally want
164
+ to start a new operation.
165
+
166
+ ## Human approvals
167
+
168
+ Chusky keeps routine reads and reversible work autonomous while pausing
169
+ materially risky actions according to the project policy. A run can return
170
+ `requires_approval` and include an `approvalId`.
171
+
172
+ Your application should show the action, target, and relevant context to an
173
+ authenticated human, then call `approvals.decide()`. Never auto-approve from a
174
+ browser callback or from model output.
175
+
176
+ ```ts
177
+ const approvals = await chusky.approvals.list();
178
+ const pending = approvals.data.find((item) => item.status === "pending");
179
+
180
+ if (pending) {
181
+ // Render pending.request and the bounded action details in your own UI.
182
+ const decision = await chusky.approvals.decide(
183
+ pending.id,
184
+ "approve",
185
+ { idempotencyKey: `approval:${pending.id}:approve` },
186
+ );
187
+ console.log("Approval handled", decision);
188
+ }
189
+ ```
190
+
191
+ The exact approval boundary is enforced server-side. The SDK is not a way to
192
+ bypass it.
193
+
194
+ ## Agent templates and company workflows
195
+
196
+ Use a built-in specialist template or create a governed agent profile for a
197
+ company workflow. Policies, allowed tools, budgets, and approvals are applied
198
+ by Chusky before execution.
30
199
 
31
200
  ```ts
32
201
  const templates = await chusky.agents.templates();
33
- const agent = await chusky.agents.create({ template: "lead-research", name: "Fintech lead scout" });
34
- const { thread, run } = await chusky.runs.create({
35
- input: "Find fintech companies with more than 50 employees and prepare sourced CRM-ready profiles.",
36
- agentId: agent.id,
37
- wait: false,
38
- }, { idempotencyKey: "customer-42-lead-research-2026-09-14" });
39
- console.log(thread.id, run.id, run.status);
202
+ console.log(templates.data.map((template) => template.slug));
203
+
204
+ const agent = await chusky.agents.create({
205
+ template: "lead-research",
206
+ name: "Fintech lead scout",
207
+ instructions: "Return sourced, deduplicated company profiles.",
208
+ policy: {
209
+ tools: {
210
+ allow: ["crm.read", "web.search", "email.draft"],
211
+ requireApproval: ["email.send", "crm.write"],
212
+ },
213
+ budget: { duration: "30m", maxToolCalls: 80, maxCost: 8 },
214
+ },
215
+ });
216
+
217
+ const { thread, run } = await chusky.runs.create(
218
+ {
219
+ agentId: agent.id,
220
+ input: "Find qualified fintech leads with more than 50 employees.",
221
+ wait: false,
222
+ },
223
+ { idempotencyKey: "acme-fintech-leads-2026-09-21" },
224
+ );
225
+
226
+ console.log(`Run ${run.id} started in thread ${thread.id}`);
40
227
  ```
41
228
 
42
- Poll with `chusky.runs.get(thread.id, run.id)` or use the task ID on the run
43
- with `chusky.tasks.get()`. Composio remains responsible for OAuth, connected
44
- accounts, and tool execution; Chusky enforces the orchestration policy and
45
- approval boundary.
229
+ Composio owns OAuth, connected accounts, token refresh, and external tool
230
+ execution. Chusky owns the agent profile, policy, orchestration, approvals,
231
+ durability, and result delivery.
46
232
 
47
- ## Operator-only API key provisioning
233
+ ## Durable missions
48
234
 
49
- Run this only on a trusted backend or operator machine. Never expose the root
50
- `CHUSKY_PROJECT_KEY` to a browser, developer, or end user.
235
+ Use missions when the work has multiple steps, dependencies, budgets, evidence,
236
+ waits, or a definition of done. The mission API supports pause, resume,
237
+ repair, cancellation, provider-event continuation, replanning, proof, and
238
+ verification.
51
239
 
52
240
  ```ts
53
- import { createChuskyAdmin } from "@chusky/sdk";
54
- const admin = createChuskyAdmin({ apiKey: process.env.CHUSKY_PROJECT_KEY!, baseUrl: process.env.CHUSKY_BASE_URL });
55
- const project = await admin.projects.create({ name: "My App", scopes: ["*"] });
56
- console.log(project.key); // save once; list() never returns it
241
+ const mission = await chusky.missions.create({
242
+ title: "Qualified fintech leads",
243
+ objective: "Find 20 fintech companies matching our ICP.",
244
+ definitionOfDone: "Every lead has a source, qualification reason, and CRM-ready payload.",
245
+ verificationMode: "strict",
246
+ requiredEvidence: ["source URL", "qualification assertion", "deduplication check"],
247
+ steps: [
248
+ { id: "research", title: "Research companies", objective: "Collect source-backed facts." },
249
+ { id: "qualify", title: "Qualify leads", objective: "Apply the ICP and remove duplicates.", dependsOn: ["research"] },
250
+ { id: "prepare", title: "Prepare CRM payload", objective: "Create an approval-ready import.", dependsOn: ["qualify"] },
251
+ ],
252
+ maxDurationSeconds: 3 * 60 * 60,
253
+ maxSteps: 30,
254
+ maxToolCalls: 100,
255
+ maxCost: 15,
256
+ }, { idempotencyKey: "acme-lead-mission-2026-09-21" });
257
+
258
+ const proof = await chusky.missions.proof(mission.id);
259
+ console.log(proof.status, proof.nextAction, proof.verification);
57
260
  ```
58
261
 
59
- ## Dashboard self-service keys
262
+ Treat `proof()` and `verify()` as the external completion record. Do not claim
263
+ that a mission completed because a model produced a plausible paragraph; use
264
+ the recorded steps, evidence, and verification state.
60
265
 
61
- A verified Chusky dashboard user can create up to 10 project keys from
62
- **Developer API** in the dashboard. The raw `chsk_` secret appears only when a
63
- key is created or rotated. Put that scoped value in the application's trusted
64
- server environment:
266
+ ## Shared context, departments, and outcomes
65
267
 
66
- ```env
67
- CHUSKY_API_KEY=chsk_...
268
+ The operating layer lets applications preserve useful, sensitivity-aware
269
+ context and hand work between specialized departments.
270
+
271
+ ```ts
272
+ await chusky.context.save({
273
+ scope: "customer",
274
+ scopeId: "customer_123",
275
+ kind: "preference",
276
+ key: "renewal_window",
277
+ value: "Customer prefers renewal discussions in October.",
278
+ source: "crm",
279
+ confidence: 0.9,
280
+ sensitivity: "normal",
281
+ });
282
+
283
+ const salesContext = await chusky.context.list({
284
+ scope: "customer",
285
+ scopeId: "customer_123",
286
+ purpose: "renewal",
287
+ });
288
+
289
+ const packet = await chusky.departments.handoff("customer-success", {
290
+ objective: "Prepare a renewal risk review for the account team.",
291
+ inputs: { customerId: "customer_123" },
292
+ constraints: ["Use verified CRM facts only."],
293
+ evidenceRequired: ["account health source", "open risk owner"],
294
+ approvalBoundary: "Draft only; do not contact the customer.",
295
+ });
296
+
297
+ console.log(packet.id, packet.status, salesContext.data.length);
298
+ ```
299
+
300
+ ## Agent-to-agent (A2A)
301
+
302
+ The SDK includes a typed client for Chusky's standards-shaped A2A 1.0
303
+ boundary. It uses the same project API key and stable user identity as the
304
+ rest of the SDK, so delegated work stays owner-scoped and durable.
305
+
306
+ ```ts
307
+ const card = await chusky.a2a.card();
308
+ console.log(card.protocolVersion, card.skills?.map((skill) => skill.id));
309
+
310
+ const task = await chusky.a2a.send("Prepare a verified launch brief.", {
311
+ idempotencyKey: "launch-brief-2026-09-22",
312
+ });
313
+
314
+ const current = await chusky.a2a.get(task.id);
315
+ const page = await chusky.a2a.list(undefined, 20);
316
+ console.log(current.status.state, page.tasks.length);
317
+
318
+ if (current.status.state !== "TASK_STATE_COMPLETED") {
319
+ await chusky.a2a.cancel(current.id);
320
+ }
321
+ ```
322
+
323
+ Use `a2a.card()` for discovery, `a2a.send()` for a durable delegated task,
324
+ `a2a.get()` or `a2a.list()` for status, and `a2a.cancel()` for cancellation.
325
+ The SDK sends A2A JSON-RPC over the authenticated `/a2a/rpc` boundary and
326
+ does not expose private prompts, credentials, or unscoped tenant data.
327
+
328
+ ## Files and artifacts
329
+
330
+ File uploads use a short-lived storage URL. The SDK also exposes artifact
331
+ metadata and verified downloads for files generated by Chusky.
332
+
333
+ ```ts
334
+ const body = new TextEncoder().encode("customer_id,renewal_date\n123,2026-10-01\n");
335
+ const upload = await chusky.files.create({
336
+ name: "renewals.csv",
337
+ contentType: "text/csv",
338
+ size: body.byteLength,
339
+ }, { idempotencyKey: "upload-renewals-2026-09-21" });
340
+
341
+ const response = await fetch(upload.uploadUrl, {
342
+ method: "PUT",
343
+ headers: { "Content-Type": "text/csv" },
344
+ body,
345
+ });
346
+ if (!response.ok) throw new Error(`Upload failed: ${response.status}`);
347
+
348
+ const file = await chusky.files.complete(upload.id);
349
+ console.log(file.id, file.status);
350
+ ```
351
+
352
+ ## Webhooks
353
+
354
+ Register a server endpoint for durable delivery notifications and make the
355
+ handler idempotent by recording the delivery ID before applying the event.
356
+
357
+ ```ts
358
+ const webhook = await chusky.webhooks.create(
359
+ "https://app.example.com/api/chusky/events",
360
+ { idempotencyKey: "webhook-register-events-v1" },
361
+ );
362
+
363
+ const deliveries = await chusky.webhooks.deliveries(webhook.id);
364
+ console.log(deliveries.data.map((delivery) => delivery.status));
365
+ ```
366
+
367
+ ## Operator provisioning
368
+
369
+ `createChuskyAdmin()` is for a trusted operator service only. It uses the root
370
+ project key to provision scoped project keys and must never be shipped to an
371
+ end-user application.
372
+
373
+ ```ts
374
+ import { createChuskyAdmin } from "@chusky/sdk";
375
+
376
+ const admin = createChuskyAdmin({
377
+ apiKey: process.env.CHUSKY_PROJECT_KEY!,
378
+ baseUrl: process.env.CHUSKY_BASE_URL,
379
+ });
380
+
381
+ const project = await admin.projects.create({
382
+ name: "Acme production",
383
+ scopes: ["runs:create", "runs:read", "missions:read", "missions:create"],
384
+ });
385
+
386
+ console.log(project.key); // Store once. It is not returned by list().
68
387
  ```
69
388
 
70
- The dashboard never exposes `CHUSKY_PROJECT_KEY`; that Oracle-only root secret
71
- remains solely for trusted operator `/v1/admin/*` provisioning.
389
+ ## Resource map
72
390
 
73
- ## Contract and security
391
+ | Resource | Use it for |
392
+ | --- | --- |
393
+ | `threads`, `runs` | Conversations and durable agent execution |
394
+ | `agents`, `company` | Governed profiles and company telemetry |
395
+ | `tasks`, `approvals` | Recovery and human decisions |
396
+ | `missions` | Multi-step autonomous work with proof |
397
+ | `context`, `departments`, `outcomes` | Shared operating context and typed handoffs |
398
+ | `files`, `artifacts` | Input uploads and generated output downloads |
399
+ | `meetings`, `calls` | Meeting lifecycle and voice operations |
400
+ | `apps`, `channels`, `devices` | Connected account and delivery management |
401
+ | `reminders`, `jobs`, `memory`, `scratchpad` | Owner-scoped autonomous operations |
402
+ | `webhooks`, `audit`, `usage` | Delivery, traceability, and usage visibility |
74
403
 
75
- - The SDK targets the versioned `/v1` Developer API described in [`docs/api-contract.md`](docs/api-contract.md). Do not point it at private `/cli/*` endpoints or use CLI device tokens as developer API keys.
76
- - SDK applications authenticate with `CHUSKY_API_KEY` and send it only from a trusted server. `CHUSKY_PROJECT_KEY` is root-only operator infrastructure for provisioning or rotating scoped `chsk_` API keys; it must never be shipped in an SDK application or browser bundle. Project secrets are returned once, persisted only as hashes, may be rotated or revoked, and must never be exposed in browser code.
77
- - Durable POST operations should receive an `idempotencyKey`; retries only reuse a key for the exact same operation. Streaming run connections are intentionally not replayed: recover their persisted state through `get()` or `events()`.
78
- - Approval decisions always require an authenticated end-user context in the server. The SDK must never auto-approve a tool call.
79
- - `stream()` yields NDJSON events and supports `AbortSignal`, so consumers can stop a particular run without cancelling unrelated durable work.
80
- - The machine-readable API contract is [`openapi.yaml`](openapi.yaml).
404
+ ## Security and production checklist
81
405
 
82
- ## Available resources
406
+ - Keep `CHUSKY_API_KEY` on a trusted server and scope it to one project.
407
+ - Use a stable, non-secret `userId` for every request.
408
+ - Use idempotency keys for retryable durable writes.
409
+ - Treat run output, tool results, emails, documents, and web pages as untrusted
410
+ input—not authorization.
411
+ - Never auto-approve an external action from model output.
412
+ - Verify webhook signatures and deduplicate delivery IDs before processing.
413
+ - Use `AbortSignal` to cancel a request without cancelling unrelated durable
414
+ work.
415
+ - Use `proof()` and `verify()` before treating a mission as complete.
416
+ - Set budgets for duration, tool calls, and cost on long-running work.
417
+ - Keep the SDK server-side; use the separate chat widget only with a server
418
+ proxy that never exposes the project key.
83
419
 
84
- The current resources are `projects`, `threads`, `runs`, `company`, `tasks`, `approvals`, `files`, `tools`, `skills`, `artifacts`, `videos`, `workers`, `channels`, `activity`, `calls`, `meetings`, `apps`, `reminders`, `jobs`, `memory`, `scratchpad`, `devices`, `missions`, `context`, `departments`, `outcomes`, `account.voiceOptions()`, `webhooks`, `audit`, and `usage`. Missions provide durable multi-step work with dependency scheduling, budgets, proof, evidence, verification, provider-event waits, pause/resume, repair, cancellation, and replanning. Context is a sensitivity-aware owner-scoped operating graph; departments and outcome packages provide typed business handoffs and governed plans. Calls validate and start an outbound request directly; the server selects Twilio or Bland and never exposes provider credentials. Meetings cover Recall-based Zoom, Google Meet, Microsoft Teams, and Webex lifecycle operations, private preparation, participant/outcome snapshots, and approved active-meeting context. `company.runs()`, `company.audit()`, and `company.usage()` read bounded, cross-caller telemetry for a company project and require its `company:read` scope. Files use short-lived, direct Cloudflare R2 URLs: create an upload intent, upload with the returned URL, call `files.complete()`, then request a download URL. `files.upload()` is a convenience helper for this sequence. Artifact downloads return verified bytes from the Daytona workspace through the API.
420
+ ## API and documentation
85
421
 
86
- See [`docs/architecture.mdx`](docs/architecture.mdx) for the request, durability, capability, storage, and delivery boundaries that implement these resources.
422
+ - [Developer API contract](docs/api-contract.md)
423
+ - [Full documentation](docs/index.mdx)
424
+ - [Autonomous missions](docs/missions.mdx)
425
+ - [OpenAPI specification](openapi.yaml)
426
+ - [Release guide](docs/releases.mdx)
427
+ - [Examples](examples/)
87
428
 
88
- Runs can be short and synchronous or durable and asynchronous. Pass `wait: false` to `runs.create()` to receive a task-backed run immediately; inspect it with `tasks.get()`, retry or cancel it, and resume a failed or approval-paused run with `runs.resume()`. Use `budget.duration` (`5m`, `30m`, `1h`, `3h`, `6h`, `3d`, or `1w`) together with `budget.maxToolCalls` and `budget.maxCost` to bound work. Tool and skill allowlists are enforced server-side before the agent receives its catalog.
429
+ ## License
89
430
 
90
- Webhook deliveries are queryable and can be retried through the SDK. Keep the endpoint idempotent and treat delivery IDs as deduplication keys.
431
+ MIT
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AccountPreferences, Activity, AppConnection, Approval, ApprovalDecision, Artifact, AuditEvent, CallRecord, CallsResponse, ChannelConnection, ChuskyClientOptions, CliDevice, CompanyAgent, CompanyAgentCreateParams, CompanyAgentTemplate, CompanyAuditEvent, CompanyBranding, CompanyRunSummary, CompanyUsage, ContextNode, CreateRunParams, CreateThreadParams, DepartmentCatalogItem, DepartmentSpace, DeveloperProject, Delivery, FileDownload, FileRecord, FileUpload, JobOccurrence, JoinMeetingParams, LinkableChannelProvider, LiveVoicePreference, MeetingBrief, MeetingContext, MeetingProfile, MeetingRecord, MeetingsResponse, MemoryFact, Mission, MissionCreateParams, MissionEvidence, MissionProof, OutcomePackage, OutcomePlan, Page, RecurringJob, Reminder, RequestOptions, Run, RunEvent, RunStreamEvent, ScratchpadEntry, Skill, SkillFile, Task, Thread, Tool, Usage, VideoJob, VoiceCallProfile, VoiceOptions, Webhook, WebhookDelivery, WorkPacket, Worker } from "./types.js";
1
+ import type { A2AAgentCard, A2APushNotificationConfig, A2AStreamEvent, A2ATask, A2ATaskPage, AccountPreferences, Activity, AppConnection, Approval, ApprovalDecision, Artifact, AuditEvent, CallRecord, CallsResponse, ChannelConnection, ChuskyClientOptions, CliDevice, CompanyAgent, CompanyAgentCreateParams, CompanyAgentTemplate, CompanyAuditEvent, CompanyBranding, CompanyRunSummary, CompanyUsage, ContextNode, CreateRunParams, CreateThreadParams, DepartmentCatalogItem, DepartmentSpace, DeveloperProject, Delivery, FileDownload, FileRecord, FileUpload, JobOccurrence, JoinMeetingParams, LinkableChannelProvider, LiveVoicePreference, MeetingBrief, MeetingContext, MeetingProfile, MeetingRecord, MeetingsResponse, MemoryFact, Mission, MissionCreateParams, MissionEvidence, MissionProof, OutcomePackage, OutcomePlan, Page, RecurringJob, Reminder, RequestOptions, Run, RunEvent, RunStreamEvent, ScratchpadEntry, Skill, SkillFile, Task, Thread, Tool, Usage, VideoJob, VoiceCallProfile, VoiceOptions, Webhook, WebhookDelivery, WorkPacket, Worker } from "./types.js";
2
2
  export declare class Chusky {
3
3
  readonly threads: ThreadsResource;
4
4
  readonly runs: CompanyRunsResource;
@@ -31,6 +31,7 @@ export declare class Chusky {
31
31
  readonly context: ContextResource;
32
32
  readonly departments: DepartmentsResource;
33
33
  readonly outcomes: OutcomesResource;
34
+ readonly a2a: A2AResource;
34
35
  private readonly baseUrl;
35
36
  private readonly apiKey;
36
37
  private readonly userId;
@@ -44,6 +45,10 @@ export declare class Chusky {
44
45
  model?: string;
45
46
  };
46
47
  request<T>(path: string, init?: RequestInit, options?: RequestOptions): Promise<T>;
48
+ /** @internal Authenticated transport for the standards A2A boundary. */
49
+ requestA2A<T>(path: string, init?: RequestInit, options?: RequestOptions): Promise<T>;
50
+ /** @internal Long-lived A2A SSE transport. The caller controls cancellation. */
51
+ requestA2AStream(path: string, init?: RequestInit, options?: RequestOptions): Promise<Response>;
47
52
  /** @internal Binary transport used for artifact and file downloads. */
48
53
  requestBytes(path: string, options?: RequestOptions): Promise<Uint8Array>;
49
54
  /** @internal Upload bytes to a presigned storage URL using the configured fetch implementation. */
@@ -441,7 +446,7 @@ export declare class MeetingsResource {
441
446
  updateProfile(profile: Partial<MeetingProfile>, options?: RequestOptions): Promise<MeetingProfile>;
442
447
  prepare(brief: MeetingBrief, options?: RequestOptions): Promise<Record<string, unknown>>;
443
448
  join(params: JoinMeetingParams, options?: RequestOptions): Promise<MeetingRecord>;
444
- joinPreparation(preparationId: string, options?: RequestOptions): Promise<MeetingRecord & {
449
+ joinPreparation(preparationId: string, briefOrOptions?: MeetingBrief | RequestOptions, options?: RequestOptions): Promise<MeetingRecord & {
445
450
  preparation?: Record<string, unknown>;
446
451
  }>;
447
452
  leave(meetingId: string, options?: RequestOptions): Promise<MeetingRecord & {
@@ -535,6 +540,31 @@ export declare class OutcomesResource {
535
540
  data: OutcomePlan;
536
541
  }>;
537
542
  }
543
+ export declare class A2AResource {
544
+ private readonly client;
545
+ constructor(client: Chusky);
546
+ card(options?: RequestOptions): Promise<A2AAgentCard>;
547
+ send(text: string, options?: RequestOptions, configuration?: {
548
+ pushNotificationConfig?: Omit<A2APushNotificationConfig, "taskId" | "id"> & {
549
+ id?: string;
550
+ };
551
+ }): Promise<A2ATask>;
552
+ stream(text: string, options?: RequestOptions, configuration?: {
553
+ pushNotificationConfig?: Omit<A2APushNotificationConfig, "taskId" | "id"> & {
554
+ id?: string;
555
+ };
556
+ }): AsyncGenerator<A2AStreamEvent>;
557
+ get(taskId: string, options?: RequestOptions): Promise<A2ATask>;
558
+ list(pageToken?: string, pageSize?: number, options?: RequestOptions): Promise<A2ATaskPage>;
559
+ cancel(taskId: string, options?: RequestOptions): Promise<A2ATask>;
560
+ subscribe(taskId: string, options?: RequestOptions): AsyncGenerator<A2AStreamEvent>;
561
+ createPushNotificationConfig(taskId: string, config: Omit<A2APushNotificationConfig, "taskId" | "id"> & {
562
+ id?: string;
563
+ }, options?: RequestOptions): Promise<A2APushNotificationConfig>;
564
+ getPushNotificationConfig(taskId: string, configId?: string, options?: RequestOptions): Promise<A2APushNotificationConfig>;
565
+ listPushNotificationConfigs(taskId: string, options?: RequestOptions): Promise<A2APushNotificationConfig[]>;
566
+ deletePushNotificationConfig(taskId: string, configId: string, options?: RequestOptions): Promise<void>;
567
+ }
538
568
  export declare class UsageResource {
539
569
  private readonly client;
540
570
  constructor(client: Chusky);