@darqlabs/curator-sdk 0.1.3 → 0.1.5

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Official Curator SDK.
4
4
 
5
+ > **Beta.** The Curator SDKs are in beta. APIs and behavior may change in future versions, including breaking changes to existing behavior, until a 1.0 release. Pin an exact version and review the release notes before upgrading.
6
+
5
7
  Integrate with your deployed agents. Works in Node, the browser, and modern edge runtimes (anywhere `fetch` exists).
6
8
 
7
9
  ```ts
@@ -17,7 +19,7 @@ const reply = await curator.agent("support-bot").run("How do I reset my password
17
19
 
18
20
  You'll need three things from your Curator dashboard:
19
21
 
20
- 1. **An API key.** Generate one at **Settings → Developer**. Each key is scoped to a single environment (production, staging, or development) pick the one you're integrating against.
22
+ 1. **An API key.** Generate one at **Settings → Developer**. Each key is scoped to a single environment (production, staging, or development), pick the one you're integrating against.
21
23
  2. **Your project slug.**
22
24
  3. **A deployed agent's identifier slug.**
23
25
 
@@ -31,7 +33,7 @@ pnpm add @darqlabs/curator-sdk
31
33
  yarn add @darqlabs/curator-sdk
32
34
  ```
33
35
 
34
- Requires Node 18+ or any runtime with a global `fetch`. Ships ESM + CommonJS modern bundlers tree-shake it automatically.
36
+ Requires Node 18+ or any runtime with a global `fetch`. Ships ESM + CommonJS, modern bundlers tree-shake it automatically.
35
37
 
36
38
  ### 2. Initialize the client
37
39
 
@@ -54,12 +56,13 @@ For a single round-trip, use `agent.run()`:
54
56
  ```ts
55
57
  const reply = await curator
56
58
  .agent("support-bot")
57
- .run("Hi, I lost my receipt can you resend it for order #4823?")
59
+ .run("Hi, I lost my receipt, can you resend it for order #4823?")
58
60
 
59
61
  console.log(reply.content)
60
- // reply.conversationId store this if you want to follow up
61
- // reply.runId useful for log correlation
62
- // reply.sequence per-conversation message index
62
+ // reply.conversationId, store this if you want to follow up
63
+ // reply.runId, useful for log correlation
64
+ // reply.sequence, per-conversation message index
65
+ // reply.metadata, structured result from the agent, or null (see below)
63
66
  ```
64
67
 
65
68
  ### 4. Multi-turn conversations
@@ -115,7 +118,7 @@ try {
115
118
  } catch (err) {
116
119
  if (err instanceof CuratorApprovalRequiredError) {
117
120
  // The agent paused waiting for human approval. Resolution happens in
118
- // the Curator dashboard surface a friendly message to your user.
121
+ // the Curator dashboard, surface a friendly message to your user.
119
122
  showToUser(
120
123
  `That action needs administrator approval. Please contact your ` +
121
124
  `administrator to review the request for "${err.approval.tool_name}".`,
@@ -125,15 +128,15 @@ try {
125
128
  // Either give the user a "still thinking…" message, or keep waiting:
126
129
  const reply = await err.continueWaiting(180000)
127
130
  } else if (err instanceof CuratorAgentError) {
128
- // Terminal agent failure LLM quota, provider auth, etc.
131
+ // Terminal agent failure, LLM quota, provider auth, etc.
129
132
  // err.failureClass is one of: provider_quota_exhausted | provider_auth |
130
133
  // provider_bad_request | provider_rate_limited | provider_unavailable |
131
134
  // internal | unknown. err.isPermanent tells you whether retrying helps.
132
135
  log.error({ err }, "agent run failed")
133
136
  } else if (err instanceof CuratorAuthError) {
134
- // 401 bad / revoked API key.
137
+ // 401, bad / revoked API key.
135
138
  } else if (err instanceof CuratorNotFoundError) {
136
- // 404 wrong deployment slug, project, or conversation id.
139
+ // 404, wrong deployment slug, project, or conversation id.
137
140
  } else {
138
141
  throw err
139
142
  }
@@ -158,7 +161,7 @@ const reply = await chat.send("What does this CSV show?", {
158
161
  })
159
162
  ```
160
163
 
161
- **Two-step** useful when you want to drive the PUT yourself (progress UI, resumable uploads, custom transport):
164
+ **Two-step:** useful when you want to drive the PUT yourself (progress UI, resumable uploads, custom transport):
162
165
 
163
166
  ```ts
164
167
  const { uploadUrl, headers, fileReference } = await curator.files.createUpload({
@@ -202,6 +205,28 @@ const reply = await chat.send("Do a deep research pass on this brief.", {
202
205
  })
203
206
  ```
204
207
 
208
+ ### Structured results (`metadata`)
209
+
210
+ An agent whose instructions define a structured output (an itinerary draft, an extracted form, a plan) returns that object on `reply.metadata` alongside the conversational `reply.content`. It's `null` for plain conversational agents. The shape is whatever the agent emits (schema-agnostic); validate it in your app (e.g. with a zod schema).
211
+
212
+ ```ts
213
+ const reply = await chat.send("Plan 3 days in Kyoto in April, focused on temples.")
214
+ console.log(reply.content) // "I've sketched a 3-day Kyoto itinerary…"
215
+ console.log(reply.metadata) // { itinerary: { destination: "Kyoto", days: [...] }, changedFields: [...], clarification: null }
216
+ ```
217
+
218
+ **Live updates:** `chat.send()` returns only the final snapshot. To render progress as the agent fills the object in (turn by turn, before it replies), stream instead and handle `state` events:
219
+
220
+ ```ts
221
+ for await (const event of chat.stream("Plan 3 days in Kyoto in April.")) {
222
+ if (event.type === "delta") appendText(event.text) // prose tokens
223
+ else if (event.type === "state") renderDraft(event.metadata) // live structured snapshot, every turn
224
+ else if (event.type === "done") finalize(event.message) // message.metadata = final snapshot
225
+ }
226
+ ```
227
+
228
+ Using React? `@darqlabs/curator-sdk-react`'s `<CuratorChat onState={…} />` wires this up for you.
229
+
205
230
  ---
206
231
 
207
232
  ## Using from a browser
@@ -212,9 +237,9 @@ const reply = await chat.send("Do a deep research pass on this brief.", {
212
237
 
213
238
  ## Optional: verified end-user identity
214
239
 
215
- **You don't need this to get started.** An API key + project is all it takes to talk to your agents everything above works without any user-level identity.
240
+ **You don't need this to get started.** An API key + project is all it takes to talk to your agents. Everything above works without any user-level identity.
216
241
 
217
- Turn this on only when you want Curator to know *which* of your users is driving a conversation for per-user policies, audit attribution, or tenant isolation. It's opt-in per org: until an operator enables it in **Settings → Developer → End-user auth**, the SDK ignores `endUserJwt` entirely and requests authenticate on the API key alone.
242
+ Turn this on only when you want Curator to know *which* of your users is driving a conversation, for per-user policies, audit attribution, or tenant isolation. It's opt-in per org: until an operator enables it in **Settings → Developer → End-user auth**, the SDK ignores `endUserJwt` entirely and requests authenticate on the API key alone.
218
243
 
219
244
  When enabled, your backend mints a short-lived JWT per user and hands it to the SDK. The server verifies it against your configured JWKS endpoint:
220
245
 
@@ -227,7 +252,7 @@ const curator = new Curator({
227
252
  })
228
253
  ```
229
254
 
230
- Standing up a JWKS endpoint is **not required for MVP** skip this section and revisit it when you need verified identity.
255
+ Standing up a JWKS endpoint is **not required for MVP**. Skip this section and revisit it when you need verified identity.
231
256
 
232
257
  ---
233
258
 
@@ -237,14 +262,14 @@ Standing up a JWKS endpoint is **not required for MVP** — skip this section an
237
262
 
238
263
  | Option | Type | Default | Notes |
239
264
  | --- | --- | --- | --- |
240
- | `apiKey` | `string` | | Required. `curator_live_*` (production) or `curator_test_*` (staging / development), from Settings → Developer. |
241
- | `project` | `string` | | Default project slug. Required unless every call passes `{ system: true }`. |
265
+ | `apiKey` | `string` | - | Required. `curator_live_*` (production) or `curator_test_*` (staging / development), from Settings → Developer. |
266
+ | `project` | `string` | - | Default project slug. Required unless every call passes `{ system: true }`. |
242
267
  | `environment` | `'production' \| 'staging' \| 'development'` | `'production'` | Default environment. Must match the environment your `apiKey` was issued for. |
243
268
  | `baseUrl` | `string` | managed host | Override for self-hosted. |
244
269
  | `defaultTimeoutMs` | `number` | `120000` | Server-capped at `300000`. |
245
270
  | `defaultHeaders` | `Record<string,string>` | `{}` | Sent on every request. |
246
271
  | `fetch` | `typeof fetch` | global | Inject a custom fetch. |
247
- | `endUserJwt` | `string \| () => string \| Promise<string>` | | **Optional.** Only needed if your org has turned on verified end-user identity (see below). Leave it unset otherwise. |
272
+ | `endUserJwt` | `string \| () => string \| Promise<string>` | - | **Optional.** Only needed if your org has turned on verified end-user identity (see below). Leave it unset otherwise. |
248
273
 
249
274
  ### `curator.agent(slug, locator?)`
250
275
 
@@ -264,13 +289,42 @@ Reattach to an existing conversation by id.
264
289
 
265
290
  ### `chat.send(content, opts?) → Promise<AssistantMessage>`
266
291
 
267
- `opts.files?: FileAttachment[]` attachments.
268
- `opts.timeoutMs?: number` override the wait timeout for this call.
292
+ `opts.files?: FileAttachment[]`, attachments.
293
+ `opts.timeoutMs?: number`, override the wait timeout for this call.
294
+
295
+ Returns the final assistant message. `message.metadata` holds the agent's structured result (or `null`).
296
+
297
+ ### `chat.stream(content, opts?) → AsyncIterable<StreamEvent>`
298
+
299
+ Same send, streamed. Yields events as they arrive:
300
+
301
+ | `event.type` | Payload | Terminal |
302
+ | --- | --- | --- |
303
+ | `delta` | `text`, incremental prose tokens | no |
304
+ | `state` | `metadata`, complete structured snapshot for this turn | no |
305
+ | `plan_progress` | `phase`, `message`, `completed`/`total`, `labels` | no |
306
+ | `tool_call.started` / `tool_call.completed` | tool call id / name | no |
307
+ | `done` | `message` (with `message.metadata`) | yes |
308
+ | `error` | `failureClass`, `message` | yes |
309
+ | `paused_for_approval` | `approval` | yes |
310
+
311
+ `state` fires on every turn the agent reports structured state, see [Structured results](#structured-results-metadata).
312
+
313
+ `plan_progress` fires for **planned** agents (ones that decompose a request into a task plan). It reports coarse progress through `phase` (`planning` → `executing` → `finalizing`) with a user-facing `message` (e.g. "Working on 3 tasks") and, once tasks are running, `completed`/`total`. A planned run is otherwise quiet until the finalizer streams `delta`s, so handle this to show progress while it works:
314
+
315
+ ```ts
316
+ for await (const event of chat.stream("Research our top 5 competitors")) {
317
+ if (event.type === "delta") appendText(event.text)
318
+ else if (event.type === "plan_progress") setStatus(event.message) // "Planning the work…", "Completed 2 of 5"
319
+ }
320
+ ```
321
+
322
+ Non-planned agents never emit it, so it's always safe to ignore.
269
323
 
270
324
  ### `chat.history(opts?) → Promise<HistoryPage>`
271
325
 
272
- `opts.limit?: number` page size (server cap 500).
273
- `opts.beforeSequence?: number` cursor; pass `page.oldestSequence` from the previous page.
326
+ `opts.limit?: number`, page size (server cap 500).
327
+ `opts.beforeSequence?: number`, cursor; pass `page.oldestSequence` from the previous page.
274
328
 
275
329
  ### `chat.id`
276
330
 
@@ -288,26 +342,26 @@ Two-step: returns `{ uploadUrl, method, headers, expiresAt, fileReference }`. PU
288
342
 
289
343
  | Class | Thrown when |
290
344
  | --- | --- |
291
- | `CuratorAuthError` | 401 bad / revoked API key. |
292
- | `CuratorForbiddenError` | 403 permission denied. |
293
- | `CuratorNotFoundError` | 404 unknown deployment / conversation. |
294
- | `CuratorDeploymentRetiredError` | 410 deployment retired. |
295
- | `CuratorRateLimitError` | 429 back off. |
345
+ | `CuratorAuthError` | 401: bad / revoked API key. |
346
+ | `CuratorForbiddenError` | 403: permission denied. |
347
+ | `CuratorNotFoundError` | 404: unknown deployment / conversation. |
348
+ | `CuratorDeploymentRetiredError` | 410: deployment retired. |
349
+ | `CuratorRateLimitError` | 429: back off. |
296
350
  | `CuratorApprovalRequiredError` | Run paused for human approval. |
297
351
  | `CuratorAgentError` | Terminal agent failure (LLM quota, etc.). `failureClass` + `isPermanent`. |
298
352
  | `CuratorTimeoutError` | Wait expired. `continueWaiting()` resumes. |
299
- | `CuratorError` | Base class everything above extends this. |
353
+ | `CuratorError` | Base class; everything above extends this. |
300
354
 
301
355
  ---
302
356
 
303
357
  ## Troubleshooting
304
358
 
305
- **`CuratorAuthError: Invalid or revoked API key`** double-check the key in **Settings → Developer**. The SDK sends it as `Authorization: Bearer <key>`.
359
+ **`CuratorAuthError: Invalid or revoked API key`**, double-check the key in **Settings → Developer**. The SDK sends it as `Authorization: Bearer <key>`.
306
360
 
307
- **`CuratorNotFoundError: Deployment not found`** verify (project slug, environment, deployment slug) all match what the **Deployments** tab shows. Missing one of these is the #1 cause.
361
+ **`CuratorNotFoundError: Deployment not found`**, verify (project slug, environment, deployment slug) all match what the **Deployments** tab shows. Missing one of these is the #1 cause.
308
362
 
309
- **`CuratorTimeoutError` on every call** your agent is taking longer than `defaultTimeoutMs`. Raise the timeout (`new Curator({ defaultTimeoutMs: 300000 })`) or call `err.continueWaiting()` once.
363
+ **`CuratorTimeoutError` on every call**, your agent is taking longer than `defaultTimeoutMs`. Raise the timeout (`new Curator({ defaultTimeoutMs: 300000 })`) or call `err.continueWaiting()` once.
310
364
 
311
- **Browser requests fail with a CORS error** add your origin to the allowlist in **Settings → Developer**. The SDK isn't doing anything unusual; the request gets blocked before it reaches Curator.
365
+ **Browser requests fail with a CORS error**, add your origin to the allowlist in **Settings → Developer**. The SDK isn't doing anything unusual; the request gets blocked before it reaches Curator.
312
366
 
313
- **Approval-required pauses on every send** your agent has tools that require human approval. Resolve them once in the dashboard and adjust the deployment's policy if you don't want this gate in your environment.
367
+ **Approval-required pauses on every send**, your agent has tools that require human approval. Resolve them once in the dashboard and adjust the deployment's policy if you don't want this gate in your environment.
@@ -5,6 +5,6 @@ export { Files } from "./files.js";
5
5
  export type { PresignUploadInput, PresignUploadResult, OneShotUploadInput, UploadData, } from "./files.js";
6
6
  export { CuratorError, CuratorAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorApprovalRequiredError, CuratorAgentError, CuratorTimeoutError, } from "./errors.js";
7
7
  export type { AssistantMessage, UserMessage, ToolMessage, ConversationMessage, Environment, FileAttachment, ApprovalDetails, AgentFailureClass, SendOptions, HistoryOptions, HistoryPage, DeploymentConfig, } from "./types.js";
8
- export type { StreamEvent, StreamDelta, StreamToolCallStarted, StreamToolCallCompleted, StreamDone, StreamError, StreamPausedForApproval, } from "./streamEvents.js";
8
+ export type { StreamEvent, StreamDelta, StreamToolCallStarted, StreamToolCallCompleted, StreamState, StreamPlanProgress, StreamDone, StreamError, StreamPausedForApproval, } from "./streamEvents.js";
9
9
  export { isTerminalStreamEvent } from "./streamEvents.js";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACX,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAAzC,oGAAA,OAAO,OAAA;AAAE,kGAAA,KAAK,OAAA;AAAE,iGAAA,IAAI,OAAA;AAG7B,uCAAkC;AAAzB,iGAAA,KAAK,OAAA;AAOd,yCAUoB;AATlB,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,yHAAA,4BAA4B,OAAA;AAC5B,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AAyBrB,qDAAyD;AAAhD,wHAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAAzC,oGAAA,OAAO,OAAA;AAAE,kGAAA,KAAK,OAAA;AAAE,iGAAA,IAAI,OAAA;AAG7B,uCAAkC;AAAzB,iGAAA,KAAK,OAAA;AAOd,yCAUoB;AATlB,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,yHAAA,4BAA4B,OAAA;AAC5B,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AA2BrB,qDAAyD;AAAhD,wHAAA,qBAAqB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CA2EtE"}
1
+ {"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CAuFtE"}
@@ -74,6 +74,18 @@ function frameToStreamEvent(frame) {
74
74
  runId: String(data.run_id ?? ""),
75
75
  conversationId: String(data.conversation_id ?? ""),
76
76
  };
77
+ case "plan_progress":
78
+ return {
79
+ type: "plan_progress",
80
+ phase: data.phase === "executing" || data.phase === "finalizing" ? data.phase : "planning",
81
+ message: String(data.message ?? ""),
82
+ completed: typeof data.completed === "number" ? data.completed : null,
83
+ total: typeof data.total === "number" ? data.total : null,
84
+ labels: Array.isArray(data.labels) ? data.labels.map((l) => String(l)) : [],
85
+ key: data.key != null ? String(data.key) : null,
86
+ runId: String(data.run_id ?? ""),
87
+ conversationId: String(data.conversation_id ?? ""),
88
+ };
77
89
  case "paused_for_approval":
78
90
  return {
79
91
  type: "paused_for_approval",
@@ -1 +1 @@
1
- {"version":3,"file":"streamEventParse.js","sourceRoot":"","sources":["../../src/streamEventParse.ts"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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACpF,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;gBAC/C,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH,KAAK,qBAAqB;YACxB,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH;YACE,sEAAsE;YACtE,iCAAiC;YACjC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC"}
@@ -43,6 +43,34 @@ export interface StreamState {
43
43
  runId: string;
44
44
  conversationId: string;
45
45
  }
46
+ /**
47
+ * Non-terminal: coarse progress from a PLANNED run — the agent decomposed the
48
+ * request into a task plan and is working through it. Fires through the
49
+ * planning → executing → finalizing phases so a UI can show live progress
50
+ * before the final answer streams (a planned run is otherwise quiet until the
51
+ * finalizer's `delta`s). Purely informational; safe to ignore.
52
+ */
53
+ export interface StreamPlanProgress {
54
+ type: "plan_progress";
55
+ /** Coarse phase of the planned run. */
56
+ phase: "planning" | "executing" | "finalizing";
57
+ /** User-facing status line, e.g. "Working on 3 tasks". */
58
+ message: string;
59
+ /** Completed task count (executing/finalizing phases), else null. */
60
+ completed: number | null;
61
+ /** Total task count once the plan is authored, else null. */
62
+ total: number | null;
63
+ /** Task labels to list under the message, if any. */
64
+ labels: string[];
65
+ /**
66
+ * Stable key for in-place updates: progress events sharing a key replace
67
+ * each other (e.g. a single "Completed N of M" line that ticks up) rather
68
+ * than appending. Null to append.
69
+ */
70
+ key: string | null;
71
+ runId: string;
72
+ conversationId: string;
73
+ }
46
74
  /** Terminal: assistant finished, no more tokens. */
47
75
  export interface StreamDone {
48
76
  type: "done";
@@ -67,6 +95,6 @@ export interface StreamPausedForApproval {
67
95
  runId: string;
68
96
  conversationId: string;
69
97
  }
70
- export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamState | StreamDone | StreamError | StreamPausedForApproval;
98
+ export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamState | StreamPlanProgress | StreamDone | StreamError | StreamPausedForApproval;
71
99
  export declare function isTerminalStreamEvent(e: StreamEvent): boolean;
72
100
  //# sourceMappingURL=streamEvents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamEvents.d.ts","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEnF,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,QA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IAChC,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,iBAAiB,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,sDAAsD;AACtD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,QAAQ,EAAE,eAAe,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,qBAAqB,GACrB,uBAAuB,GACvB,WAAW,GACX,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,uBAAuB,CAAA;AAQ3B,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAE7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAoFH,sDAEC;AARD,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAC;IAC/D,MAAM;IACN,OAAO;IACP,qBAAqB;CACtB,CAAC,CAAA;AAEF,SAAgB,qBAAqB,CAAC,CAAc;IAClD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
1
+ {"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAkHH,sDAEC;AARD,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAC;IAC/D,MAAM;IACN,OAAO;IACP,qBAAqB;CACtB,CAAC,CAAA;AAEF,SAAgB,qBAAqB,CAAC,CAAc;IAClD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
@@ -11,11 +11,11 @@ export interface AssistantMessage<TMetadata = unknown> {
11
11
  content: string;
12
12
  /**
13
13
  * Opaque structured payload emitted by a structured-output agent via its
14
- * reserved `__emit_state` tool — e.g. `{ bookingDraft, changedFields }`.
14
+ * reserved `__emit_state` tool — e.g. `{ itinerary, changedFields }`.
15
15
  * Updated on every turn the agent reports state (see the `state` stream event).
16
16
  * `null` for normal agents or when none was emitted. The SDK does not
17
17
  * interpret the shape; validate it in your app (e.g. with a zod schema).
18
- * Use the type parameter for a typed result: `agent<BookingResult>(...)`.
18
+ * Use the type parameter for a typed result: `agent<ItineraryResult>(...)`.
19
19
  */
20
20
  metadata: TMetadata | null;
21
21
  /** Monotonic per-conversation sequence number. */
@@ -5,6 +5,6 @@ export { Files } from "./files.js";
5
5
  export type { PresignUploadInput, PresignUploadResult, OneShotUploadInput, UploadData, } from "./files.js";
6
6
  export { CuratorError, CuratorAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorApprovalRequiredError, CuratorAgentError, CuratorTimeoutError, } from "./errors.js";
7
7
  export type { AssistantMessage, UserMessage, ToolMessage, ConversationMessage, Environment, FileAttachment, ApprovalDetails, AgentFailureClass, SendOptions, HistoryOptions, HistoryPage, DeploymentConfig, } from "./types.js";
8
- export type { StreamEvent, StreamDelta, StreamToolCallStarted, StreamToolCallCompleted, StreamDone, StreamError, StreamPausedForApproval, } from "./streamEvents.js";
8
+ export type { StreamEvent, StreamDelta, StreamToolCallStarted, StreamToolCallCompleted, StreamState, StreamPlanProgress, StreamDone, StreamError, StreamPausedForApproval, } from "./streamEvents.js";
9
9
  export { isTerminalStreamEvent } from "./streamEvents.js";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACX,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAOlC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAwBpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAOlC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,aAAa,CAAA;AA0BpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CA2EtE"}
1
+ {"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CAuFtE"}
@@ -71,6 +71,18 @@ export function frameToStreamEvent(frame) {
71
71
  runId: String(data.run_id ?? ""),
72
72
  conversationId: String(data.conversation_id ?? ""),
73
73
  };
74
+ case "plan_progress":
75
+ return {
76
+ type: "plan_progress",
77
+ phase: data.phase === "executing" || data.phase === "finalizing" ? data.phase : "planning",
78
+ message: String(data.message ?? ""),
79
+ completed: typeof data.completed === "number" ? data.completed : null,
80
+ total: typeof data.total === "number" ? data.total : null,
81
+ labels: Array.isArray(data.labels) ? data.labels.map((l) => String(l)) : [],
82
+ key: data.key != null ? String(data.key) : null,
83
+ runId: String(data.run_id ?? ""),
84
+ conversationId: String(data.conversation_id ?? ""),
85
+ };
74
86
  case "paused_for_approval":
75
87
  return {
76
88
  type: "paused_for_approval",
@@ -1 +1 @@
1
- {"version":3,"file":"streamEventParse.js","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,UAAU,kBAAkB,CAAC,KAAe;IAChD,IAAI,IAAS,CAAA;IACb,IAAI,CAAC;QACH,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IACD,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAA;QACzD,KAAK,mBAAmB;YACtB,OAAO;gBACL,IAAI,EAAE,mBAAmB;gBACzB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;gBACrC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBAChC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;aACzC,CAAA;QACH,KAAK,qBAAqB;YACxB,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;gBACrC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;gBAChC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;gBACxC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;aAC1C,CAAA;QACH,KAAK,OAAO;YACV,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,IA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AC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;gBACpF,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;gBAC/C,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH,KAAK,qBAAqB;YACxB,OAAO;gBACL,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH;YACE,sEAAsE;YACtE,iCAAiC;YACjC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC"}
@@ -43,6 +43,34 @@ export interface StreamState {
43
43
  runId: string;
44
44
  conversationId: string;
45
45
  }
46
+ /**
47
+ * Non-terminal: coarse progress from a PLANNED run — the agent decomposed the
48
+ * request into a task plan and is working through it. Fires through the
49
+ * planning → executing → finalizing phases so a UI can show live progress
50
+ * before the final answer streams (a planned run is otherwise quiet until the
51
+ * finalizer's `delta`s). Purely informational; safe to ignore.
52
+ */
53
+ export interface StreamPlanProgress {
54
+ type: "plan_progress";
55
+ /** Coarse phase of the planned run. */
56
+ phase: "planning" | "executing" | "finalizing";
57
+ /** User-facing status line, e.g. "Working on 3 tasks". */
58
+ message: string;
59
+ /** Completed task count (executing/finalizing phases), else null. */
60
+ completed: number | null;
61
+ /** Total task count once the plan is authored, else null. */
62
+ total: number | null;
63
+ /** Task labels to list under the message, if any. */
64
+ labels: string[];
65
+ /**
66
+ * Stable key for in-place updates: progress events sharing a key replace
67
+ * each other (e.g. a single "Completed N of M" line that ticks up) rather
68
+ * than appending. Null to append.
69
+ */
70
+ key: string | null;
71
+ runId: string;
72
+ conversationId: string;
73
+ }
46
74
  /** Terminal: assistant finished, no more tokens. */
47
75
  export interface StreamDone {
48
76
  type: "done";
@@ -67,6 +95,6 @@ export interface StreamPausedForApproval {
67
95
  runId: string;
68
96
  conversationId: string;
69
97
  }
70
- export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamState | StreamDone | StreamError | StreamPausedForApproval;
98
+ export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamState | StreamPlanProgress | StreamDone | StreamError | StreamPausedForApproval;
71
99
  export declare function isTerminalStreamEvent(e: StreamEvent): boolean;
72
100
  //# sourceMappingURL=streamEvents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"streamEvents.d.ts","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAEnF,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iCAAiC;AACjC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CA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,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,iBAAiB,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,sDAAsD;AACtD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,qBAAqB,CAAA;IAC3B,QAAQ,EAAE,eAAe,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,qBAAqB,GACrB,uBAAuB,GACvB,WAAW,GACX,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,uBAAuB,CAAA;AAQ3B,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAE7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA8EH,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAC;IAC/D,MAAM;IACN,OAAO;IACP,qBAAqB;CACtB,CAAC,CAAA;AAEF,MAAM,UAAU,qBAAqB,CAAC,CAAc;IAClD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
1
+ {"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA4GH,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAC;IAC/D,MAAM;IACN,OAAO;IACP,qBAAqB;CACtB,CAAC,CAAA;AAEF,MAAM,UAAU,qBAAqB,CAAC,CAAc;IAClD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
@@ -11,11 +11,11 @@ export interface AssistantMessage<TMetadata = unknown> {
11
11
  content: string;
12
12
  /**
13
13
  * Opaque structured payload emitted by a structured-output agent via its
14
- * reserved `__emit_state` tool — e.g. `{ bookingDraft, changedFields }`.
14
+ * reserved `__emit_state` tool — e.g. `{ itinerary, changedFields }`.
15
15
  * Updated on every turn the agent reports state (see the `state` stream event).
16
16
  * `null` for normal agents or when none was emitted. The SDK does not
17
17
  * interpret the shape; validate it in your app (e.g. with a zod schema).
18
- * Use the type parameter for a typed result: `agent<BookingResult>(...)`.
18
+ * Use the type parameter for a typed result: `agent<ItineraryResult>(...)`.
19
19
  */
20
20
  metadata: TMetadata | null;
21
21
  /** Monotonic per-conversation sequence number. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darqlabs/curator-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Official Curator SDK — talk to your deployed agents from server-side JavaScript or TypeScript.",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/index.js",