@cadenya/widgets 1.0.1 → 1.1.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/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/types.d.ts +40 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/types.ts +43 -7
package/dist/client.js
CHANGED
|
@@ -18,7 +18,7 @@ export class CadenyaWidgets {
|
|
|
18
18
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
19
19
|
maxRetries: options.maxRetries ?? 0,
|
|
20
20
|
timeout: options.timeout,
|
|
21
|
-
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.0
|
|
21
|
+
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },
|
|
22
22
|
fetch: options.fetch,
|
|
23
23
|
logger: options.logger,
|
|
24
24
|
logLevel: options.logLevel,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA0B7D,MAAM,OAAO,cAAc;IAChB,MAAM,CAAS;IACf,aAAa,CAAgB;IAErB,OAAO,CAAa;IAErC,YAAY,UAAyB,EAAE;QACrC,sEAAsE;QACtE,+CAA+C;QAC/C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI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CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AAClC,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient } from './core/http.js';\nimport type { Logger, LogLevel } from './core/http.js';\nimport { Config } from './resources/config.js';\nimport { Conversations } from './resources/conversations.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYAWIDGETS_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to . */\n baseURL?: string;\n /** Max automatic retries for retryable failures. Defaults to 0. */\n maxRetries?: number;\n /**\n * Deadline for ordinary (non-streaming) requests in milliseconds; override\n * per request with `options.timeout`. Streams bound only response-header\n * acquisition — body lifetime stays under the caller's AbortSignal.\n * Defaults to 60000; a non-finite or <= 0 value disables the deadline.\n */\n timeout?: number;\n /** Headers sent with every request. */\n defaultHeaders?: Record<string, string>;\n /** Custom fetch implementation. */\n fetch?: typeof fetch;\n /** Destination for SDK logs. Defaults to `console`. */\n logger?: Logger;\n /** 'debug' | 'warn' (default) | 'off'. Never logs headers or bodies. */\n logLevel?: LogLevel;\n}\n\nexport class CadenyaWidgets {\n readonly config: Config;\n readonly conversations: Conversations;\n\n private readonly _client: HttpClient;\n\n constructor(options: ClientOptions = {}) {\n // Presence is not validity: empty strings from options or environment\n // are configuration mistakes, not credentials.\n const apiKey = resolveOption('apiKey', options.apiKey, readEnv('CADENYAWIDGETS_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new CadenyaWidgets({ apiKey })` or set the CADENYAWIDGETS_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYAWIDGETS_BASE_URL')) ?? '',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { 'User-Agent': 'cadenyawidgets-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C,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,GAAG,GAAI,UAAyE;SACnF,OAAO,EAAE,GAAG,CAAC;IAChB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,SAAS,aAAa,CACpB,KAAa,EACb,QAA4B,EAC5B,GAAuB;IAEvB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sFAAsF,CAC/F,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AAClC,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient } from './core/http.js';\nimport type { Logger, LogLevel } from './core/http.js';\nimport { Config } from './resources/config.js';\nimport { Conversations } from './resources/conversations.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYAWIDGETS_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to . */\n baseURL?: string;\n /** Max automatic retries for retryable failures. Defaults to 0. */\n maxRetries?: number;\n /**\n * Deadline for ordinary (non-streaming) requests in milliseconds; override\n * per request with `options.timeout`. Streams bound only response-header\n * acquisition — body lifetime stays under the caller's AbortSignal.\n * Defaults to 60000; a non-finite or <= 0 value disables the deadline.\n */\n timeout?: number;\n /** Headers sent with every request. */\n defaultHeaders?: Record<string, string>;\n /** Custom fetch implementation. */\n fetch?: typeof fetch;\n /** Destination for SDK logs. Defaults to `console`. */\n logger?: Logger;\n /** 'debug' | 'warn' (default) | 'off'. Never logs headers or bodies. */\n logLevel?: LogLevel;\n}\n\nexport class CadenyaWidgets {\n readonly config: Config;\n readonly conversations: Conversations;\n\n private readonly _client: HttpClient;\n\n constructor(options: ClientOptions = {}) {\n // Presence is not validity: empty strings from options or environment\n // are configuration mistakes, not credentials.\n const apiKey = resolveOption('apiKey', options.apiKey, readEnv('CADENYAWIDGETS_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new CadenyaWidgets({ apiKey })` or set the CADENYAWIDGETS_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYAWIDGETS_BASE_URL')) ?? '',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },\n fetch: options.fetch,\n logger: options.logger,\n logLevel: options.logLevel,\n defaults: { },\n });\n this.config = new Config(this._client);\n this.conversations = new Conversations(this._client);\n }\n}\n\nfunction readEnv(name: string): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n return env?.[name];\n}\n\n// Presence is not validity: an explicitly provided option must be usable —\n// a blank value is a configuration mistake and never silently falls back to\n// the environment or a default. Only an OMITTED option reads the env.\nfunction resolveOption(\n label: string,\n explicit: string | undefined,\n env: string | undefined,\n): string | undefined {\n if (explicit !== undefined) {\n const value = explicit.trim();\n if (!value) {\n throw new Error(\n `${label} must not be blank when provided explicitly; omit it to use the environment instead.`,\n );\n }\n return value;\n }\n return env?.trim() || undefined;\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -210,14 +210,27 @@ export interface WidgetErrorEvent {
|
|
|
210
210
|
* events map to these through an explicit, exhaustive server-side projection;
|
|
211
211
|
* internal-only types (context compaction, memory reads, sub-agent
|
|
212
212
|
* bookkeeping) have no widget variant and are dropped. Nothing here carries
|
|
213
|
-
* tool configuration,
|
|
214
|
-
*
|
|
213
|
+
* tool configuration, server identities, operator details, or internal error
|
|
214
|
+
* strings. Tool arguments cross this boundary only when an enabled tool set
|
|
215
|
+
* overlay explicitly opts the matching tool in.
|
|
215
216
|
*/
|
|
216
|
-
export type WidgetEvent = WidgetEvent_UserMessage | WidgetEvent_AssistantMessage | WidgetEvent_ToolApprovalRequested | WidgetEvent_ToolApproved | WidgetEvent_ToolDenied | WidgetEvent_ToolCalled | WidgetEvent_ToolResult | WidgetEvent_ToolError | WidgetEvent_Error | WidgetEvent_Cancelled | WidgetEvent_TimedOut;
|
|
217
|
+
export type WidgetEvent = WidgetEvent_UserMessage | WidgetEvent_AssistantMessage | WidgetEvent_ToolApprovalRequested | WidgetEvent_ToolApproved | WidgetEvent_ToolDenied | WidgetEvent_ToolCalled | WidgetEvent_ToolResult | WidgetEvent_ToolError | WidgetEvent_Error | WidgetEvent_Cancelled | WidgetEvent_TimedOut | WidgetEvent_Finalized;
|
|
218
|
+
/**
|
|
219
|
+
* WidgetFinalizedEvent: the conversation's agent produced its structured
|
|
220
|
+
* output and the objective reached its terminal state. Only agents with an
|
|
221
|
+
* output definition finalize — such an agent ends the conversation after one
|
|
222
|
+
* turn, so a widget bound to one should treat this as the answer, not a
|
|
223
|
+
* message to keep chatting past.
|
|
224
|
+
*/
|
|
225
|
+
export interface WidgetFinalizedEvent {
|
|
226
|
+
/**
|
|
227
|
+
* The structured output the agent produced, matching the shape of the
|
|
228
|
+
* agent's output definition schema.
|
|
229
|
+
*/
|
|
230
|
+
output?: Record<string, unknown>;
|
|
231
|
+
}
|
|
217
232
|
/**
|
|
218
233
|
* WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.
|
|
219
|
-
* (There is no finalized variant: agents with structured output — the only
|
|
220
|
-
* path to finalization — cannot be bound to widgets.)
|
|
221
234
|
*/
|
|
222
235
|
export interface WidgetTimedOutEvent {
|
|
223
236
|
}
|
|
@@ -241,12 +254,18 @@ export interface WidgetToolApprovedEvent {
|
|
|
241
254
|
toolCallId: string;
|
|
242
255
|
}
|
|
243
256
|
/**
|
|
244
|
-
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
245
|
-
* never included.
|
|
257
|
+
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
246
258
|
*/
|
|
247
259
|
export interface WidgetToolCalledEvent {
|
|
248
260
|
toolCallId: string;
|
|
249
261
|
tool: WidgetToolReference;
|
|
262
|
+
/**
|
|
263
|
+
* The final arguments sent to the tool, after parameter actions were
|
|
264
|
+
* applied. Present only when an enabled matching tool set overlay opts the
|
|
265
|
+
* tool into exposing arguments in widget sessions. Arguments are omitted
|
|
266
|
+
* by default because they may contain sensitive customer data.
|
|
267
|
+
*/
|
|
268
|
+
arguments?: Record<string, unknown>;
|
|
250
269
|
}
|
|
251
270
|
/**
|
|
252
271
|
* WidgetToolDeniedEvent records that the pending tool call was denied.
|
|
@@ -458,4 +477,18 @@ export interface WidgetEvent_TimedOut {
|
|
|
458
477
|
conversationId: string;
|
|
459
478
|
createdAt: string;
|
|
460
479
|
}
|
|
480
|
+
export interface WidgetEvent_Finalized {
|
|
481
|
+
type: 'finalized';
|
|
482
|
+
finalized: WidgetFinalizedEvent;
|
|
483
|
+
/**
|
|
484
|
+
* Unique event id (ULID). Doubles as the SSE `id:` — replay it as
|
|
485
|
+
* `Last-Event-ID` on reconnect to resume without duplication.
|
|
486
|
+
*/
|
|
487
|
+
id: string;
|
|
488
|
+
/**
|
|
489
|
+
* The conversation this event belongs to.
|
|
490
|
+
*/
|
|
491
|
+
conversationId: string;
|
|
492
|
+
createdAt: string;
|
|
493
|
+
}
|
|
461
494
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACr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WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * Approve tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface ApproveToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Continue conversation request.\n */\nexport interface ContinueConversationRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The visitor's next message.\n */\n message: string;\n}\n\n/**\n * Create conversation request. The session, tenant, subject, secrets, labels,\n * and pinned parameters all come from the presenting token's session — the\n * browser asserts nothing.\n */\nexport interface CreateConversationRequest {\n /**\n * The visitor's opening message.\n */\n message: string;\n}\n\n/**\n * Deny tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface DenyToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\n/**\n * Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.\n */\nexport type GoogleProtobufValue = unknown;\n\n/**\n * List conversation events response. Ordered oldest first.\n */\nexport interface ListConversationEventsResponse {\n items?: Array<WidgetEvent>;\n pagination?: Page;\n}\n\n/**\n * List conversations response. Ordered by last activity, newest first.\n */\nexport interface ListConversationsResponse {\n items?: Array<WidgetConversation>;\n pagination?: Page;\n}\n\n/**\n * Page carries pagination data for list responses. A deliberate local\n * duplicate of the api module's Page — this package imports nothing from\n * cadenya.api.v1 (see the workspace README).\n */\nexport interface Page {\n /**\n * Cursor for the next page. Empty when there are no further results.\n */\n nextCursor?: string;\n /**\n * Total number of items matching the request.\n */\n total?: number;\n}\n\n/**\n * Set tool call content request. Lets the embedding page supply the result\n * of a bare tool call (one whose tool set has no execution adapter) — the\n * widget-session flavor of the reverse-harness pattern, where client-side\n * logic executes the tool and reports the result back. The result then\n * reaches the conversation as a toolResult event.\n */\nexport interface SetToolCallContentRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The bare tool call to supply content for.\n */\n toolCallId?: string;\n /**\n * The tool call's result content.\n */\n content: string;\n}\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<GoogleProtobufAny>;\n}\n\n/**\n * Submit conversation feedback request — the visitor's rating of a\n * conversation, mirroring internal objective feedback in slimmed form. Flows\n * into the same feedback machinery that scores agent variations.\n */\nexport interface SubmitConversationFeedbackRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * A score between -1.0 and 1.0. -1.0 is the worst, 0.0 neutral, 1.0 the\n * best — a thumbs-down/up UI maps to -1.0/1.0.\n */\n score: number;\n /**\n * Optional comment explaining the feedback.\n */\n comment?: string;\n}\n\n/**\n * WidgetAssistantMessageEvent is a message from the agent. Content may\n * arrive incrementally: later events for the same turn replace earlier\n * partial content.\n */\nexport interface WidgetAssistantMessageEvent {\n content: string;\n}\n\n/**\n * WidgetCancelledEvent: the conversation was cancelled. Terminal.\n */\nexport interface WidgetCancelledEvent {\n}\n\n/**\n * WidgetConfig is the widget's presentation configuration, served to the\n * browser before any session exists. Contains nothing sensitive: the widget\n * is identified by the hostname, and the edge has already enforced the\n * origin allowlist by the time this is served.\n */\nexport interface WidgetConfig {\n /**\n * Display name shown in the widget header.\n */\n displayName: string;\n}\n\nexport type WidgetConversationState = 'STATE_UNSPECIFIED' | 'STATE_RESPONDING' | 'STATE_OPEN' | 'STATE_CLOSED';\n\n/**\n * WidgetConversation is one conversation between the session's visitor and\n * the widget's agent. Conversations are scoped by the presenting token to the\n * VISITOR: a session with a subject sees that subject's conversations on this\n * widget; a session without one sees only the conversations it created\n * itself. A conversation id from outside that scope is indistinguishable from\n * one that does not exist. Tenant is a management-side grouping only — it is\n * never a read scope on this surface.\n */\nexport interface WidgetConversation {\n id: string;\n state: WidgetConversationState;\n /**\n * Server-derived display title (e.g. from the opening message).\n */\n title?: string;\n createdAt: string;\n /**\n * When the conversation last saw a message or event.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetErrorEvent reports a visitor-safe conversation error. The message is\n * sanitized; internal error detail never reaches the widget.\n */\nexport interface WidgetErrorEvent {\n message: string;\n}\n\n/**\n * WidgetEvent is the visitor-facing event vocabulary. It MIRRORS the internal\n * conversation event variants — same granularity, same discriminator names —\n * with slimmed messages holding exactly what a widget UI needs. Internal\n * events map to these through an explicit, exhaustive server-side projection;\n * internal-only types (context compaction, memory reads, sub-agent\n * bookkeeping) have no widget variant and are dropped. Nothing here carries\n * tool configuration, tool arguments, server identities, operator details,\n * or internal error strings.\n */\nexport type WidgetEvent =\n | WidgetEvent_UserMessage\n | WidgetEvent_AssistantMessage\n | WidgetEvent_ToolApprovalRequested\n | WidgetEvent_ToolApproved\n | WidgetEvent_ToolDenied\n | WidgetEvent_ToolCalled\n | WidgetEvent_ToolResult\n | WidgetEvent_ToolError\n | WidgetEvent_Error\n | WidgetEvent_Cancelled\n | WidgetEvent_TimedOut;\n\n/**\n * WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.\n * (There is no finalized variant: agents with structured output — the only\n * path to finalization — cannot be bound to widgets.)\n */\nexport interface WidgetTimedOutEvent {\n}\n\n/**\n * WidgetToolApprovalRequestedEvent asks the visitor to approve or deny a\n * tool call before it runs. The tool reference lets the embedding UI render\n * a custom approval experience per tool; the visitor responds via the\n * approve/deny endpoints.\n */\nexport interface WidgetToolApprovalRequestedEvent {\n /**\n * The tool call awaiting a decision; pass it to the approve/deny endpoint.\n */\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolApprovedEvent records that the pending tool call was approved.\n */\nexport interface WidgetToolApprovedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolCalledEvent reports that the agent invoked a tool. Arguments are\n * never included.\n */\nexport interface WidgetToolCalledEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolDeniedEvent records that the pending tool call was denied.\n */\nexport interface WidgetToolDeniedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolErrorEvent reports that a tool call failed. Internal error\n * detail never reaches the widget.\n */\nexport interface WidgetToolErrorEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolReference identifies the tool involved in a tool event — enough\n * for the embedding UI to label the activity and to register custom\n * renderers keyed by the tool's id or the customer's own external id.\n * Deliberately omitted: tool configuration, adapter details, and any server\n * identity.\n */\nexport interface WidgetToolReference {\n /**\n * Cadenya's canonical tool id.\n */\n id: string;\n /**\n * The tool's external id in the customer's namespace, when set.\n */\n externalId?: string;\n /**\n * The tool's name as the workspace configured it (e.g. \"FetchOrderDetails\").\n */\n name: string;\n}\n\n/**\n * WidgetToolResultEvent reports that a tool call finished. Result content is\n * omitted by default and included only for tools the workspace has opted in\n * to sharing content with widget sessions.\n */\nexport interface WidgetToolResultEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The tool's result, present only for tools opted in to sharing content\n * with widget sessions (a per-tool setting; default off). Arbitrary JSON\n * the embedding UI may render — chart data, cards, structured results.\n */\n content?: GoogleProtobufValue;\n}\n\n/**\n * WidgetUserMessageEvent is a message from the visitor.\n */\nexport interface WidgetUserMessageEvent {\n content: string;\n}\n\nexport interface WidgetEvent_UserMessage {\n type: 'userMessage';\n userMessage: WidgetUserMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: WidgetAssistantMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: WidgetToolApprovalRequestedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApproved {\n type: 'toolApproved';\n toolApproved: WidgetToolApprovedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolDenied {\n type: 'toolDenied';\n toolDenied: WidgetToolDeniedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolCalled {\n type: 'toolCalled';\n toolCalled: WidgetToolCalledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolResult {\n type: 'toolResult';\n toolResult: WidgetToolResultEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolError {\n type: 'toolError';\n toolError: WidgetToolErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Error {\n type: 'error';\n error: WidgetErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Cancelled {\n type: 'cancelled';\n cancelled: WidgetCancelledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_TimedOut {\n type: 'timedOut';\n timedOut: WidgetTimedOutEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * Approve tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface ApproveToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Continue conversation request.\n */\nexport interface ContinueConversationRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The visitor's next message.\n */\n message: string;\n}\n\n/**\n * Create conversation request. The session, tenant, subject, secrets, labels,\n * and pinned parameters all come from the presenting token's session — the\n * browser asserts nothing.\n */\nexport interface CreateConversationRequest {\n /**\n * The visitor's opening message.\n */\n message: string;\n}\n\n/**\n * Deny tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface DenyToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\n/**\n * Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.\n */\nexport type GoogleProtobufValue = unknown;\n\n/**\n * List conversation events response. Ordered oldest first.\n */\nexport interface ListConversationEventsResponse {\n items?: Array<WidgetEvent>;\n pagination?: Page;\n}\n\n/**\n * List conversations response. Ordered by last activity, newest first.\n */\nexport interface ListConversationsResponse {\n items?: Array<WidgetConversation>;\n pagination?: Page;\n}\n\n/**\n * Page carries pagination data for list responses. A deliberate local\n * duplicate of the api module's Page — this package imports nothing from\n * cadenya.api.v1 (see the workspace README).\n */\nexport interface Page {\n /**\n * Cursor for the next page. Empty when there are no further results.\n */\n nextCursor?: string;\n /**\n * Total number of items matching the request.\n */\n total?: number;\n}\n\n/**\n * Set tool call content request. Lets the embedding page supply the result\n * of a bare tool call (one whose tool set has no execution adapter) — the\n * widget-session flavor of the reverse-harness pattern, where client-side\n * logic executes the tool and reports the result back. The result then\n * reaches the conversation as a toolResult event.\n */\nexport interface SetToolCallContentRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The bare tool call to supply content for.\n */\n toolCallId?: string;\n /**\n * The tool call's result content.\n */\n content: string;\n}\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<GoogleProtobufAny>;\n}\n\n/**\n * Submit conversation feedback request — the visitor's rating of a\n * conversation, mirroring internal objective feedback in slimmed form. Flows\n * into the same feedback machinery that scores agent variations.\n */\nexport interface SubmitConversationFeedbackRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * A score between -1.0 and 1.0. -1.0 is the worst, 0.0 neutral, 1.0 the\n * best — a thumbs-down/up UI maps to -1.0/1.0.\n */\n score: number;\n /**\n * Optional comment explaining the feedback.\n */\n comment?: string;\n}\n\n/**\n * WidgetAssistantMessageEvent is a message from the agent. Content may\n * arrive incrementally: later events for the same turn replace earlier\n * partial content.\n */\nexport interface WidgetAssistantMessageEvent {\n content: string;\n}\n\n/**\n * WidgetCancelledEvent: the conversation was cancelled. Terminal.\n */\nexport interface WidgetCancelledEvent {\n}\n\n/**\n * WidgetConfig is the widget's presentation configuration, served to the\n * browser before any session exists. Contains nothing sensitive: the widget\n * is identified by the hostname, and the edge has already enforced the\n * origin allowlist by the time this is served.\n */\nexport interface WidgetConfig {\n /**\n * Display name shown in the widget header.\n */\n displayName: string;\n}\n\nexport type WidgetConversationState = 'STATE_UNSPECIFIED' | 'STATE_RESPONDING' | 'STATE_OPEN' | 'STATE_CLOSED';\n\n/**\n * WidgetConversation is one conversation between the session's visitor and\n * the widget's agent. Conversations are scoped by the presenting token to the\n * VISITOR: a session with a subject sees that subject's conversations on this\n * widget; a session without one sees only the conversations it created\n * itself. A conversation id from outside that scope is indistinguishable from\n * one that does not exist. Tenant is a management-side grouping only — it is\n * never a read scope on this surface.\n */\nexport interface WidgetConversation {\n id: string;\n state: WidgetConversationState;\n /**\n * Server-derived display title (e.g. from the opening message).\n */\n title?: string;\n createdAt: string;\n /**\n * When the conversation last saw a message or event.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetErrorEvent reports a visitor-safe conversation error. The message is\n * sanitized; internal error detail never reaches the widget.\n */\nexport interface WidgetErrorEvent {\n message: string;\n}\n\n/**\n * WidgetEvent is the visitor-facing event vocabulary. It MIRRORS the internal\n * conversation event variants — same granularity, same discriminator names —\n * with slimmed messages holding exactly what a widget UI needs. Internal\n * events map to these through an explicit, exhaustive server-side projection;\n * internal-only types (context compaction, memory reads, sub-agent\n * bookkeeping) have no widget variant and are dropped. Nothing here carries\n * tool configuration, server identities, operator details, or internal error\n * strings. Tool arguments cross this boundary only when an enabled tool set\n * overlay explicitly opts the matching tool in.\n */\nexport type WidgetEvent =\n | WidgetEvent_UserMessage\n | WidgetEvent_AssistantMessage\n | WidgetEvent_ToolApprovalRequested\n | WidgetEvent_ToolApproved\n | WidgetEvent_ToolDenied\n | WidgetEvent_ToolCalled\n | WidgetEvent_ToolResult\n | WidgetEvent_ToolError\n | WidgetEvent_Error\n | WidgetEvent_Cancelled\n | WidgetEvent_TimedOut\n | WidgetEvent_Finalized;\n\n/**\n * WidgetFinalizedEvent: the conversation's agent produced its structured\n * output and the objective reached its terminal state. Only agents with an\n * output definition finalize — such an agent ends the conversation after one\n * turn, so a widget bound to one should treat this as the answer, not a\n * message to keep chatting past.\n */\nexport interface WidgetFinalizedEvent {\n /**\n * The structured output the agent produced, matching the shape of the\n * agent's output definition schema.\n */\n output?: Record<string, unknown>;\n}\n\n/**\n * WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.\n */\nexport interface WidgetTimedOutEvent {\n}\n\n/**\n * WidgetToolApprovalRequestedEvent asks the visitor to approve or deny a\n * tool call before it runs. The tool reference lets the embedding UI render\n * a custom approval experience per tool; the visitor responds via the\n * approve/deny endpoints.\n */\nexport interface WidgetToolApprovalRequestedEvent {\n /**\n * The tool call awaiting a decision; pass it to the approve/deny endpoint.\n */\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolApprovedEvent records that the pending tool call was approved.\n */\nexport interface WidgetToolApprovedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolCalledEvent reports that the agent invoked a tool.\n */\nexport interface WidgetToolCalledEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The final arguments sent to the tool, after parameter actions were\n * applied. Present only when an enabled matching tool set overlay opts the\n * tool into exposing arguments in widget sessions. Arguments are omitted\n * by default because they may contain sensitive customer data.\n */\n arguments?: Record<string, unknown>;\n}\n\n/**\n * WidgetToolDeniedEvent records that the pending tool call was denied.\n */\nexport interface WidgetToolDeniedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolErrorEvent reports that a tool call failed. Internal error\n * detail never reaches the widget.\n */\nexport interface WidgetToolErrorEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolReference identifies the tool involved in a tool event — enough\n * for the embedding UI to label the activity and to register custom\n * renderers keyed by the tool's id or the customer's own external id.\n * Deliberately omitted: tool configuration, adapter details, and any server\n * identity.\n */\nexport interface WidgetToolReference {\n /**\n * Cadenya's canonical tool id.\n */\n id: string;\n /**\n * The tool's external id in the customer's namespace, when set.\n */\n externalId?: string;\n /**\n * The tool's name as the workspace configured it (e.g. \"FetchOrderDetails\").\n */\n name: string;\n}\n\n/**\n * WidgetToolResultEvent reports that a tool call finished. Result content is\n * omitted by default and included only for tools the workspace has opted in\n * to sharing content with widget sessions.\n */\nexport interface WidgetToolResultEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The tool's result, present only for tools opted in to sharing content\n * with widget sessions (a per-tool setting; default off). Arbitrary JSON\n * the embedding UI may render — chart data, cards, structured results.\n */\n content?: GoogleProtobufValue;\n}\n\n/**\n * WidgetUserMessageEvent is a message from the visitor.\n */\nexport interface WidgetUserMessageEvent {\n content: string;\n}\n\nexport interface WidgetEvent_UserMessage {\n type: 'userMessage';\n userMessage: WidgetUserMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: WidgetAssistantMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: WidgetToolApprovalRequestedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApproved {\n type: 'toolApproved';\n toolApproved: WidgetToolApprovedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolDenied {\n type: 'toolDenied';\n toolDenied: WidgetToolDeniedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolCalled {\n type: 'toolCalled';\n toolCalled: WidgetToolCalledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolResult {\n type: 'toolResult';\n toolResult: WidgetToolResultEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolError {\n type: 'toolError';\n toolError: WidgetToolErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Error {\n type: 'error';\n error: WidgetErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Cancelled {\n type: 'cancelled';\n cancelled: WidgetCancelledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_TimedOut {\n type: 'timedOut';\n timedOut: WidgetTimedOutEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Finalized {\n type: 'finalized';\n finalized: WidgetFinalizedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\n"]}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -49,7 +49,7 @@ export class CadenyaWidgets {
|
|
|
49
49
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
50
50
|
maxRetries: options.maxRetries ?? 0,
|
|
51
51
|
timeout: options.timeout,
|
|
52
|
-
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.0
|
|
52
|
+
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },
|
|
53
53
|
fetch: options.fetch,
|
|
54
54
|
logger: options.logger,
|
|
55
55
|
logLevel: options.logLevel,
|
package/src/types.ts
CHANGED
|
@@ -230,8 +230,9 @@ export interface WidgetErrorEvent {
|
|
|
230
230
|
* events map to these through an explicit, exhaustive server-side projection;
|
|
231
231
|
* internal-only types (context compaction, memory reads, sub-agent
|
|
232
232
|
* bookkeeping) have no widget variant and are dropped. Nothing here carries
|
|
233
|
-
* tool configuration,
|
|
234
|
-
*
|
|
233
|
+
* tool configuration, server identities, operator details, or internal error
|
|
234
|
+
* strings. Tool arguments cross this boundary only when an enabled tool set
|
|
235
|
+
* overlay explicitly opts the matching tool in.
|
|
235
236
|
*/
|
|
236
237
|
export type WidgetEvent =
|
|
237
238
|
| WidgetEvent_UserMessage
|
|
@@ -244,12 +245,26 @@ export type WidgetEvent =
|
|
|
244
245
|
| WidgetEvent_ToolError
|
|
245
246
|
| WidgetEvent_Error
|
|
246
247
|
| WidgetEvent_Cancelled
|
|
247
|
-
| WidgetEvent_TimedOut
|
|
248
|
+
| WidgetEvent_TimedOut
|
|
249
|
+
| WidgetEvent_Finalized;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* WidgetFinalizedEvent: the conversation's agent produced its structured
|
|
253
|
+
* output and the objective reached its terminal state. Only agents with an
|
|
254
|
+
* output definition finalize — such an agent ends the conversation after one
|
|
255
|
+
* turn, so a widget bound to one should treat this as the answer, not a
|
|
256
|
+
* message to keep chatting past.
|
|
257
|
+
*/
|
|
258
|
+
export interface WidgetFinalizedEvent {
|
|
259
|
+
/**
|
|
260
|
+
* The structured output the agent produced, matching the shape of the
|
|
261
|
+
* agent's output definition schema.
|
|
262
|
+
*/
|
|
263
|
+
output?: Record<string, unknown>;
|
|
264
|
+
}
|
|
248
265
|
|
|
249
266
|
/**
|
|
250
267
|
* WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.
|
|
251
|
-
* (There is no finalized variant: agents with structured output — the only
|
|
252
|
-
* path to finalization — cannot be bound to widgets.)
|
|
253
268
|
*/
|
|
254
269
|
export interface WidgetTimedOutEvent {
|
|
255
270
|
}
|
|
@@ -276,12 +291,18 @@ export interface WidgetToolApprovedEvent {
|
|
|
276
291
|
}
|
|
277
292
|
|
|
278
293
|
/**
|
|
279
|
-
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
280
|
-
* never included.
|
|
294
|
+
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
281
295
|
*/
|
|
282
296
|
export interface WidgetToolCalledEvent {
|
|
283
297
|
toolCallId: string;
|
|
284
298
|
tool: WidgetToolReference;
|
|
299
|
+
/**
|
|
300
|
+
* The final arguments sent to the tool, after parameter actions were
|
|
301
|
+
* applied. Present only when an enabled matching tool set overlay opts the
|
|
302
|
+
* tool into exposing arguments in widget sessions. Arguments are omitted
|
|
303
|
+
* by default because they may contain sensitive customer data.
|
|
304
|
+
*/
|
|
305
|
+
arguments?: Record<string, unknown>;
|
|
285
306
|
}
|
|
286
307
|
|
|
287
308
|
/**
|
|
@@ -510,3 +531,18 @@ export interface WidgetEvent_TimedOut {
|
|
|
510
531
|
createdAt: string;
|
|
511
532
|
}
|
|
512
533
|
|
|
534
|
+
export interface WidgetEvent_Finalized {
|
|
535
|
+
type: 'finalized';
|
|
536
|
+
finalized: WidgetFinalizedEvent;
|
|
537
|
+
/**
|
|
538
|
+
* Unique event id (ULID). Doubles as the SSE `id:` — replay it as
|
|
539
|
+
* `Last-Event-ID` on reconnect to resume without duplication.
|
|
540
|
+
*/
|
|
541
|
+
id: string;
|
|
542
|
+
/**
|
|
543
|
+
* The conversation this event belongs to.
|
|
544
|
+
*/
|
|
545
|
+
conversationId: string;
|
|
546
|
+
createdAt: string;
|
|
547
|
+
}
|
|
548
|
+
|