@cadenya/cadenya 1.4.0 → 1.5.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 CHANGED
@@ -50,7 +50,7 @@ export class Cadenya {
50
50
  authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
51
51
  maxRetries: options.maxRetries ?? 0,
52
52
  timeout: options.timeout,
53
- defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.3.0 (api 1.0)'), ...options.defaultHeaders },
53
+ defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.5.0 (api 1.0)'), ...options.defaultHeaders },
54
54
  fetch: options.fetch,
55
55
  logger: options.logger,
56
56
  logLevel: options.logLevel,
@@ -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,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,OAAO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,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 { Webhooks } from './webhooks.js';\nimport { Accounts } from './resources/accounts.js';\nimport { ApiKeys } from './resources/api-keys.js';\nimport { WorkspaceAdmin } from './resources/workspace-admin.js';\nimport { Profiles } from './resources/profiles.js';\nimport { Workspaces } from './resources/workspaces.js';\nimport { Agents } from './resources/agents.js';\nimport { AiProviderKeys } from './resources/ai-provider-keys.js';\nimport { Models } from './resources/models.js';\nimport { MemoryLayers } from './resources/memory-layers.js';\nimport { Objectives } from './resources/objectives.js';\nimport { ToolSearch } from './resources/tool-search.js';\nimport { Tenants } from './resources/tenants.js';\nimport { ToolSets } from './resources/tool-sets.js';\nimport { Uploads } from './resources/uploads.js';\nimport { WidgetSessions } from './resources/widget-sessions.js';\nimport { Widgets } from './resources/widgets.js';\nimport { WorkspaceSecrets } from './resources/workspace-secrets.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYA_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to https://api.cadenya.com. */\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 /** Additional request headers. Browsers supply their own User-Agent by default. */\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 /** Default `workspaceId` for every call that takes one. Defaults to the CADENYA_WORKSPACE_ID environment variable. */\n workspaceId?: string;\n /** Secret for webhook signature verification. Defaults to the CADENYA_WEBHOOK_SECRET environment variable. */\n webhookSecret?: string;\n}\n\nexport class Cadenya {\n readonly accounts: Accounts;\n readonly apiKeys: ApiKeys;\n readonly workspaceAdmin: WorkspaceAdmin;\n readonly profiles: Profiles;\n readonly workspaces: Workspaces;\n readonly agents: Agents;\n readonly aiProviderKeys: AiProviderKeys;\n readonly models: Models;\n readonly memoryLayers: MemoryLayers;\n readonly objectives: Objectives;\n readonly toolSearch: ToolSearch;\n readonly tenants: Tenants;\n readonly toolSets: ToolSets;\n readonly uploads: Uploads;\n readonly widgetSessions: WidgetSessions;\n readonly widgets: Widgets;\n readonly workspaceSecrets: WorkspaceSecrets;\n readonly webhooks: Webhooks;\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('CADENYA_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new Cadenya({ apiKey })` or set the CADENYA_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYA_BASE_URL')) ?? 'https://api.cadenya.com',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.3.0 (api 1.0)'), ...options.defaultHeaders },\n fetch: options.fetch,\n logger: options.logger,\n logLevel: options.logLevel,\n defaults: { workspaceId: resolveOption('workspaceId', options.workspaceId, readEnv('CADENYA_WORKSPACE_ID')) },\n });\n this.webhooks = new Webhooks(resolveOption('webhookSecret', options.webhookSecret, readEnv('CADENYA_WEBHOOK_SECRET')));\n this.accounts = new Accounts(this._client);\n this.apiKeys = new ApiKeys(this._client);\n this.workspaceAdmin = new WorkspaceAdmin(this._client);\n this.profiles = new Profiles(this._client);\n this.workspaces = new Workspaces(this._client);\n this.agents = new Agents(this._client);\n this.aiProviderKeys = new AiProviderKeys(this._client);\n this.models = new Models(this._client);\n this.memoryLayers = new MemoryLayers(this._client);\n this.objectives = new Objectives(this._client);\n this.toolSearch = new ToolSearch(this._client);\n this.tenants = new Tenants(this._client);\n this.toolSets = new ToolSets(this._client);\n this.uploads = new Uploads(this._client);\n this.widgetSessions = new WidgetSessions(this._client);\n this.widgets = new Widgets(this._client);\n this.workspaceSecrets = new WorkspaceSecrets(this._client);\n }\n}\n\n// Browser-authored User-Agent headers require CORS permission. Only Node-compatible\n// runtimes receive the SDK default; browsers and workers use their native header.\nfunction nodeUserAgent(value: string): Record<string, string> {\n const nodeVersion = (globalThis as { process?: { versions?: { node?: string } } })\n .process?.versions?.node;\n return nodeVersion ? { 'User-Agent': value } : {};\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"]}
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,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,O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C;CACF;AAED,oFAAoF;AACpF,kFAAkF;AAClF,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,WAAW,GAAI,UAA6D;SAC/E,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC;IAC3B,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACpD,CAAC;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 { Webhooks } from './webhooks.js';\nimport { Accounts } from './resources/accounts.js';\nimport { ApiKeys } from './resources/api-keys.js';\nimport { WorkspaceAdmin } from './resources/workspace-admin.js';\nimport { Profiles } from './resources/profiles.js';\nimport { Workspaces } from './resources/workspaces.js';\nimport { Agents } from './resources/agents.js';\nimport { AiProviderKeys } from './resources/ai-provider-keys.js';\nimport { Models } from './resources/models.js';\nimport { MemoryLayers } from './resources/memory-layers.js';\nimport { Objectives } from './resources/objectives.js';\nimport { ToolSearch } from './resources/tool-search.js';\nimport { Tenants } from './resources/tenants.js';\nimport { ToolSets } from './resources/tool-sets.js';\nimport { Uploads } from './resources/uploads.js';\nimport { WidgetSessions } from './resources/widget-sessions.js';\nimport { Widgets } from './resources/widgets.js';\nimport { WorkspaceSecrets } from './resources/workspace-secrets.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYA_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to https://api.cadenya.com. */\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 /** Additional request headers. Browsers supply their own User-Agent by default. */\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 /** Default `workspaceId` for every call that takes one. Defaults to the CADENYA_WORKSPACE_ID environment variable. */\n workspaceId?: string;\n /** Secret for webhook signature verification. Defaults to the CADENYA_WEBHOOK_SECRET environment variable. */\n webhookSecret?: string;\n}\n\nexport class Cadenya {\n readonly accounts: Accounts;\n readonly apiKeys: ApiKeys;\n readonly workspaceAdmin: WorkspaceAdmin;\n readonly profiles: Profiles;\n readonly workspaces: Workspaces;\n readonly agents: Agents;\n readonly aiProviderKeys: AiProviderKeys;\n readonly models: Models;\n readonly memoryLayers: MemoryLayers;\n readonly objectives: Objectives;\n readonly toolSearch: ToolSearch;\n readonly tenants: Tenants;\n readonly toolSets: ToolSets;\n readonly uploads: Uploads;\n readonly widgetSessions: WidgetSessions;\n readonly widgets: Widgets;\n readonly workspaceSecrets: WorkspaceSecrets;\n readonly webhooks: Webhooks;\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('CADENYA_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new Cadenya({ apiKey })` or set the CADENYA_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYA_BASE_URL')) ?? 'https://api.cadenya.com',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { ...nodeUserAgent('cadenya-typescript/1.5.0 (api 1.0)'), ...options.defaultHeaders },\n fetch: options.fetch,\n logger: options.logger,\n logLevel: options.logLevel,\n defaults: { workspaceId: resolveOption('workspaceId', options.workspaceId, readEnv('CADENYA_WORKSPACE_ID')) },\n });\n this.webhooks = new Webhooks(resolveOption('webhookSecret', options.webhookSecret, readEnv('CADENYA_WEBHOOK_SECRET')));\n this.accounts = new Accounts(this._client);\n this.apiKeys = new ApiKeys(this._client);\n this.workspaceAdmin = new WorkspaceAdmin(this._client);\n this.profiles = new Profiles(this._client);\n this.workspaces = new Workspaces(this._client);\n this.agents = new Agents(this._client);\n this.aiProviderKeys = new AiProviderKeys(this._client);\n this.models = new Models(this._client);\n this.memoryLayers = new MemoryLayers(this._client);\n this.objectives = new Objectives(this._client);\n this.toolSearch = new ToolSearch(this._client);\n this.tenants = new Tenants(this._client);\n this.toolSets = new ToolSets(this._client);\n this.uploads = new Uploads(this._client);\n this.widgetSessions = new WidgetSessions(this._client);\n this.widgets = new Widgets(this._client);\n this.workspaceSecrets = new WorkspaceSecrets(this._client);\n }\n}\n\n// Browser-authored User-Agent headers require CORS permission. Only Node-compatible\n// runtimes receive the SDK default; browsers and workers use their native header.\nfunction nodeUserAgent(value: string): Record<string, string> {\n const nodeVersion = (globalThis as { process?: { versions?: { node?: string } } })\n .process?.versions?.node;\n return nodeVersion ? { 'User-Agent': value } : {};\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"]}
@@ -124,7 +124,7 @@ export declare class WidgetSessions {
124
124
  *
125
125
  * @example
126
126
  * ```ts
127
- * const widgetSession = await client.widgetSessions.create({ spec: { widgetId: 'sample' } });
127
+ * const widgetSession = await client.widgetSessions.create({ spec: { subject: { id: 'sample' }, tenant: { id: 'sample' }, widgetId: 'sample' } });
128
128
  * ```
129
129
  */
130
130
  create(params: WidgetSessionCreateParams, options?: RequestOptions): APIPromise<WidgetSession>;
@@ -31,7 +31,7 @@ export class WidgetSessions {
31
31
  *
32
32
  * @example
33
33
  * ```ts
34
- * const widgetSession = await client.widgetSessions.create({ spec: { widgetId: 'sample' } });
34
+ * const widgetSession = await client.widgetSessions.create({ spec: { subject: { id: 'sample' }, tenant: { id: 'sample' }, widgetId: 'sample' } });
35
35
  * ```
36
36
  */
37
37
  create(params, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"widget-sessions.js","sourceRoot":"","sources":["../../src/resources/widget-sessions.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAA0C,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA+GpD,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,OAAmB;QAAnB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H,MAAM,CAAC,EAAU,EAAE,MAAkC,EAAE,OAAwB;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAgB,GAAG,EAAE;YACjD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;YAClH,IAAI,WAAW,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAC;YACxK,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,oBAAoB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC;QAC/I,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient, RequestOptions, APIPromise, pathSegment, snapshotParams } from '../core/http.js';\nimport { Page } from '../core/pagination.js';\nimport type { CreateOperationMetadata, CreateWidgetSessionRequest_Secret, DeleteTenantWidgetSessionsResponse, ListWidgetSessionsResponse, WidgetSession, WidgetSessionServiceListWidgetSessionsState, WidgetSessionSpecParam } from '../types.js';\nimport { wireWidgetSessionSpec } from '../types.js';\n\nexport interface WidgetSessionListParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n /**\n * Maximum number of results to return.\n */\n limit?: number;\n /**\n * Pagination cursor from previous response.\n */\n cursor?: string;\n /**\n * Filter to sessions on a specific widget. Accepts the canonical `wgt_…`\n * form or the `external_id:<value>` form.\n */\n widgetId?: string;\n /**\n * Filter to sessions belonging to a tenant. Accepts the canonical\n * `tenant_…` form or the `external_id:<value>` form.\n */\n tenantId?: string;\n /**\n * Filter to sessions asserted for a subject. Accepts the canonical\n * `subj_…` form or the `external_id:<value>` form; the external_id form is\n * scoped within a tenant and requires `tenant_id` to also be set.\n */\n subjectId?: string;\n /**\n * Filter by state.\n */\n state?: WidgetSessionServiceListWidgetSessionsState;\n /**\n * Filters by metadata labels. Comma-separated key=value pairs,\n * e.g. \"env=prod,team=ai\". A resource matches only if every pair\n * matches exactly (AND semantics).\n */\n labels?: string;\n /**\n * Sort order for results (asc or desc by creation time).\n */\n sortOrder?: string;\n /**\n * When true, the `info` field on each returned session is populated.\n * Requests with this flag count more against your rate limit.\n */\n includeInfo?: boolean;\n}\n\nexport interface WidgetSessionCreateParams {\n spec: WidgetSessionSpecParam;\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n metadata?: CreateOperationMetadata;\n /**\n * Secrets to attach to the session.\n */\n secrets?: Array<CreateWidgetSessionRequest_Secret>;\n}\n\nexport interface WidgetSessionDeleteTenantParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n /**\n * Tenant whose sessions to delete. Required — an empty value is rejected\n * rather than matching everything. Accepts the canonical `tenant_…` form or\n * the `external_id:<value>` form.\n */\n tenantId?: string;\n}\n\nexport interface WidgetSessionRetrieveParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport interface WidgetSessionDeleteParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport interface WidgetSessionRevokeParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport class WidgetSessions {\n constructor(private readonly _client: HttpClient) {}\n\n /**\n * List widget sessions\n * \n * @example\n * ```ts\n * const page = await client.widgetSessions.list();\n * for await (const item of page) {\n * // auto-fetches every page\n * }\n * ```\n */\n async list(params?: WidgetSessionListParams, options?: RequestOptions): Promise<Page<WidgetSession>> {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n const _base = snapshotParams(params);\n const response = await this._client.request<ListWidgetSessionsResponse>({ method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, query: { limit: params?.limit, cursor: params?.cursor, widgetId: params?.widgetId, tenantId: params?.tenantId, subjectId: params?.subjectId, state: params?.state, labels: params?.labels, sortOrder: params?.sortOrder, includeInfo: params?.includeInfo } }, options);\n return new Page(response.items ?? [], response.pagination?.nextCursor, (cursor) => this.list({ ..._base, cursor: cursor }, options));\n }\n\n /**\n * Create a widget session\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.create({ spec: { widgetId: 'sample' } });\n * ```\n */\n create(params: WidgetSessionCreateParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, body: { metadata: params.metadata, spec: wireWidgetSessionSpec(params.spec), secrets: params.secrets } };\n }, options);\n }\n\n /**\n * Delete all of a tenant's widget sessions\n * \n * @example\n * ```ts\n * const deleteTenantWidgetSessionsResponse = await client.widgetSessions.deleteTenant();\n * ```\n */\n deleteTenant(params?: WidgetSessionDeleteTenantParams, options?: RequestOptions): APIPromise<DeleteTenantWidgetSessionsResponse> {\n return this._client.requestAPI<DeleteTenantWidgetSessionsResponse>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'DELETE', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, query: { tenantId: params?.tenantId } };\n }, options);\n }\n\n /**\n * Get a widget session by ID\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.retrieve('_123');\n * ```\n */\n retrieve(id: string, params?: WidgetSessionRetrieveParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}` };\n }, options);\n }\n\n /**\n * Delete a widget session\n * \n * @example\n * ```ts\n * await client.widgetSessions.delete('_123');\n * ```\n */\n delete(id: string, params?: WidgetSessionDeleteParams, options?: RequestOptions): APIPromise<void> {\n return this._client.requestAPI<void>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'DELETE', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}`, void: true };\n }, options);\n }\n\n /**\n * Revoke a widget session\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.revoke('_123');\n * ```\n */\n revoke(id: string, params?: WidgetSessionRevokeParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}:revoke` };\n }, options);\n }\n}\n"]}
1
+ {"version":3,"file":"widget-sessions.js","sourceRoot":"","sources":["../../src/resources/widget-sessions.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAA0C,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA+GpD,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,OAAmB;QAAnB,YAAO,GAAP,OAAO,CAAY;IAAG,CAAC;IAEpD;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI,CAAC,MAAgC,EAAE,OAAwB;QACnE,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;QAClH,IAAI,WAAW,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAC;QACxK,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAA6B,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,kBAAkB,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,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EAAE,OAAwB;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAO,GAAG,EAAE;YACxC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;YAClH,IAAI,WAAW,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAC;YACxK,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAkB,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,oBAAoB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACtJ,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,EAAU,EAAE,MAAkC,EAAE,OAAwB;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAgB,GAAG,EAAE;YACjD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;YAClH,IAAI,WAAW,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAC;YACxK,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,oBAAoB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC;QAC/I,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC;CACF","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient, RequestOptions, APIPromise, pathSegment, snapshotParams } from '../core/http.js';\nimport { Page } from '../core/pagination.js';\nimport type { CreateOperationMetadata, CreateWidgetSessionRequest_Secret, DeleteTenantWidgetSessionsResponse, ListWidgetSessionsResponse, WidgetSession, WidgetSessionServiceListWidgetSessionsState, WidgetSessionSpecParam } from '../types.js';\nimport { wireWidgetSessionSpec } from '../types.js';\n\nexport interface WidgetSessionListParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n /**\n * Maximum number of results to return.\n */\n limit?: number;\n /**\n * Pagination cursor from previous response.\n */\n cursor?: string;\n /**\n * Filter to sessions on a specific widget. Accepts the canonical `wgt_…`\n * form or the `external_id:<value>` form.\n */\n widgetId?: string;\n /**\n * Filter to sessions belonging to a tenant. Accepts the canonical\n * `tenant_…` form or the `external_id:<value>` form.\n */\n tenantId?: string;\n /**\n * Filter to sessions asserted for a subject. Accepts the canonical\n * `subj_…` form or the `external_id:<value>` form; the external_id form is\n * scoped within a tenant and requires `tenant_id` to also be set.\n */\n subjectId?: string;\n /**\n * Filter by state.\n */\n state?: WidgetSessionServiceListWidgetSessionsState;\n /**\n * Filters by metadata labels. Comma-separated key=value pairs,\n * e.g. \"env=prod,team=ai\". A resource matches only if every pair\n * matches exactly (AND semantics).\n */\n labels?: string;\n /**\n * Sort order for results (asc or desc by creation time).\n */\n sortOrder?: string;\n /**\n * When true, the `info` field on each returned session is populated.\n * Requests with this flag count more against your rate limit.\n */\n includeInfo?: boolean;\n}\n\nexport interface WidgetSessionCreateParams {\n spec: WidgetSessionSpecParam;\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n metadata?: CreateOperationMetadata;\n /**\n * Secrets to attach to the session.\n */\n secrets?: Array<CreateWidgetSessionRequest_Secret>;\n}\n\nexport interface WidgetSessionDeleteTenantParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n /**\n * Tenant whose sessions to delete. Required — an empty value is rejected\n * rather than matching everything. Accepts the canonical `tenant_…` form or\n * the `external_id:<value>` form.\n */\n tenantId?: string;\n}\n\nexport interface WidgetSessionRetrieveParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport interface WidgetSessionDeleteParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport interface WidgetSessionRevokeParams {\n /**\n * Workspace ID.\n * \n * Defaults to the client-level `workspaceId` option or the CADENYA_WORKSPACE_ID environment variable.\n */\n workspaceId?: string;\n}\n\nexport class WidgetSessions {\n constructor(private readonly _client: HttpClient) {}\n\n /**\n * List widget sessions\n * \n * @example\n * ```ts\n * const page = await client.widgetSessions.list();\n * for await (const item of page) {\n * // auto-fetches every page\n * }\n * ```\n */\n async list(params?: WidgetSessionListParams, options?: RequestOptions): Promise<Page<WidgetSession>> {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n const _base = snapshotParams(params);\n const response = await this._client.request<ListWidgetSessionsResponse>({ method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, query: { limit: params?.limit, cursor: params?.cursor, widgetId: params?.widgetId, tenantId: params?.tenantId, subjectId: params?.subjectId, state: params?.state, labels: params?.labels, sortOrder: params?.sortOrder, includeInfo: params?.includeInfo } }, options);\n return new Page(response.items ?? [], response.pagination?.nextCursor, (cursor) => this.list({ ..._base, cursor: cursor }, options));\n }\n\n /**\n * Create a widget session\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.create({ spec: { subject: { id: 'sample' }, tenant: { id: 'sample' }, widgetId: 'sample' } });\n * ```\n */\n create(params: WidgetSessionCreateParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, body: { metadata: params.metadata, spec: wireWidgetSessionSpec(params.spec), secrets: params.secrets } };\n }, options);\n }\n\n /**\n * Delete all of a tenant's widget sessions\n * \n * @example\n * ```ts\n * const deleteTenantWidgetSessionsResponse = await client.widgetSessions.deleteTenant();\n * ```\n */\n deleteTenant(params?: WidgetSessionDeleteTenantParams, options?: RequestOptions): APIPromise<DeleteTenantWidgetSessionsResponse> {\n return this._client.requestAPI<DeleteTenantWidgetSessionsResponse>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'DELETE', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions`, query: { tenantId: params?.tenantId } };\n }, options);\n }\n\n /**\n * Get a widget session by ID\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.retrieve('_123');\n * ```\n */\n retrieve(id: string, params?: WidgetSessionRetrieveParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'GET', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}` };\n }, options);\n }\n\n /**\n * Delete a widget session\n * \n * @example\n * ```ts\n * await client.widgetSessions.delete('_123');\n * ```\n */\n delete(id: string, params?: WidgetSessionDeleteParams, options?: RequestOptions): APIPromise<void> {\n return this._client.requestAPI<void>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'DELETE', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}`, void: true };\n }, options);\n }\n\n /**\n * Revoke a widget session\n * \n * @example\n * ```ts\n * const widgetSession = await client.widgetSessions.revoke('_123');\n * ```\n */\n revoke(id: string, params?: WidgetSessionRevokeParams, options?: RequestOptions): APIPromise<WidgetSession> {\n return this._client.requestAPI<WidgetSession>(() => {\n const workspaceId = String(params?.workspaceId ?? this._client.defaults['workspaceId'] ?? '').trim() || undefined;\n if (workspaceId === undefined) throw new Error(\"Missing 'workspaceId': pass it in params, set it on the client, or set the CADENYA_WORKSPACE_ID environment variable.\");\n return { method: 'POST', path: `/v1/workspaces/${pathSegment('workspaceId', workspaceId)}/widget_sessions/${pathSegment('id', id)}:revoke` };\n }, options);\n }\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -3220,6 +3220,7 @@ export interface SetToolCallContentRequest_ImageBlock {
3220
3220
  export interface SetToolCallContentRequest_TextBlock {
3221
3221
  text: string;
3222
3222
  }
3223
+ export type StatusDetails = WidgetSessionErrorInfo | GoogleProtobufAny;
3223
3224
  /**
3224
3225
  * 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).
3225
3226
  */
@@ -3235,7 +3236,7 @@ export interface Status {
3235
3236
  /**
3236
3237
  * A list of messages that carry the error details. There is a common set of message types for APIs to use.
3237
3238
  */
3238
- details?: Array<GoogleProtobufAny>;
3239
+ details?: Array<StatusDetails>;
3239
3240
  }
3240
3241
  export interface SubAgentSpawned {
3241
3242
  agent: ResourceMetadata;
@@ -4550,8 +4551,9 @@ export type WidgetSessionState = 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_E
4550
4551
  * a widget, minted server-to-server by the customer's backend. The session
4551
4552
  * carries all customer-asserted context — tenant, subject, labels, secrets —
4552
4553
  * and every conversation (objective) created through the widget inherits it.
4553
- * The bearer token returned at mint is short-lived and refreshed at the
4554
- * widget host; the session row is what makes revocation possible.
4554
+ * The browser renews short-lived bearer tokens at the widget host with
4555
+ * RenewWidgetSession, authenticated by its existing token. Renewal preserves
4556
+ * this bounded grant and does not extend its hard expiry.
4555
4557
  */
4556
4558
  export interface WidgetSession {
4557
4559
  metadata: OperationMetadata;
@@ -4568,6 +4570,44 @@ export interface WidgetSession {
4568
4570
  * headers server-side — never returned by any API.
4569
4571
  */
4570
4572
  secrets: Array<WidgetSession_Secret>;
4573
+ /**
4574
+ * Present only on creation. The same envelope is returned by
4575
+ * RenewWidgetSession on the widget host. Omitted on reads, lists, and revocation.
4576
+ * Existing spec.token/spec.token_expires_at and info.host remain populated
4577
+ * on creation for v1 compatibility and agree with these credentials.
4578
+ */
4579
+ credentials?: WidgetSessionCredentials;
4580
+ }
4581
+ /**
4582
+ * WidgetSessionCredentials is the only credential envelope the customer's
4583
+ * backend forwards to the browser. Never log or persist its token. Responses
4584
+ * containing credentials use Cache-Control: no-store. Both initial and later
4585
+ * issuance use the same schema; no refresh token or management key is included.
4586
+ */
4587
+ export interface WidgetSessionCredentials {
4588
+ /**
4589
+ * Canonical wsess_ identifier. Ordinary renewal cannot change the session.
4590
+ */
4591
+ sessionId: string;
4592
+ /**
4593
+ * Authoritative hostname, without a scheme or path. Use HTTPS with this
4594
+ * host; never construct it or accept a host change during renewal.
4595
+ */
4596
+ host: string;
4597
+ /**
4598
+ * Short-lived bearer credential for the widget host only.
4599
+ */
4600
+ token: string;
4601
+ /**
4602
+ * Exact token expiry, at most 15 minutes after issuance and never later
4603
+ * than session_expires_at. Equals JWT exp without the 60-second validation
4604
+ * tolerance added. Renew proactively before this timestamp.
4605
+ */
4606
+ tokenExpiresAt: string;
4607
+ /**
4608
+ * Immutable hard session expiry. Issuance never extends this deadline.
4609
+ */
4610
+ sessionExpiresAt: string;
4571
4611
  }
4572
4612
  /**
4573
4613
  * WidgetSessionInfo provides read-only server-derived data about a session.
@@ -4603,7 +4643,7 @@ export interface WidgetSessionInfo {
4603
4643
  messageCount: number;
4604
4644
  /**
4605
4645
  * When the session last created a conversation, sent a message, or
4606
- * refreshed a token.
4646
+ * received a newly issued token.
4607
4647
  */
4608
4648
  lastActiveAt?: string;
4609
4649
  }
@@ -4617,18 +4657,19 @@ export interface WidgetSessionSpec {
4617
4657
  */
4618
4658
  widgetId: string;
4619
4659
  /**
4620
- * Optional tenant assertion — the customer's org/company identifier for the
4621
- * visitor. Upserts the tenant record in the workspace and tags the session
4622
- * and every conversation it creates. Conversation listing at the widget
4623
- * host is scoped to this tenant.
4660
+ * Required tenant assertion — the customer's organization identifier.
4661
+ * Upserts the tenant record in the workspace. Every conversation created
4662
+ * through this session inherits the tenant and subject identity.
4624
4663
  */
4625
- tenant?: TenantAssertion;
4664
+ tenant: TenantAssertion;
4626
4665
  /**
4627
- * Optional subject assertion — the visitor within the tenant (e.g. their
4628
- * user id in the customer's namespace). Requires `tenant`; a subject
4629
- * asserted without a tenant is rejected with InvalidArgument.
4666
+ * Required subject assertion — the visitor's ID within the tenant.
4667
+ * Sessions with the same tenant and subject share conversation history on
4668
+ * the same widget and agent, subject to the current session's permissions.
4669
+ * A static ID deliberately shares that history; use a distinct ID per
4670
+ * visitor when their conversations should be separate.
4630
4671
  */
4631
- subject?: SubjectAssertion;
4672
+ subject: SubjectAssertion;
4632
4673
  /**
4633
4674
  * Hard session expiry. Tokens never outlive it; after it passes the session
4634
4675
  * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when
@@ -4636,14 +4677,14 @@ export interface WidgetSessionSpec {
4636
4677
  */
4637
4678
  expiresAt?: string;
4638
4679
  /**
4639
- * The session bearer token. Returned only on creation — subsequent reads
4640
- * omit it. The token is short-lived; the widget refreshes it at the widget
4641
- * host without involving the customer's backend.
4680
+ * Legacy creation-only alias of credentials.token; omitted on reads.
4681
+ * Supported throughout v1. New clients should consume credentials.
4682
+ * The browser obtains replacements with RenewWidgetSession at the widget host.
4642
4683
  */
4643
4684
  token: string;
4644
4685
  /**
4645
- * Expiry of the token returned in `token`. Distinct from `expires_at`,
4646
- * which bounds the session itself.
4686
+ * Legacy creation-only alias of credentials.token_expires_at, supported
4687
+ * throughout v1. Distinct from expires_at, which bounds the session itself.
4647
4688
  */
4648
4689
  tokenExpiresAt?: string;
4649
4690
  /**
@@ -5317,6 +5358,22 @@ export interface ModelSpec_Capability_Caching {
5317
5358
  type: 'caching';
5318
5359
  caching: Capability_Caching;
5319
5360
  }
5361
+ /**
5362
+ * TOKEN_EXPIRED identifies access-token expiry beyond the 60-second clock-skew tolerance. That token cannot renew; use already-installed newer credentials or require explicit app reauthentication. SESSION_* reasons are terminal. Never infer renewability from HTTP status alone.
5363
+ */
5364
+ export type WidgetSessionErrorReason = 'TOKEN_EXPIRED' | 'SESSION_REVOKED' | 'SESSION_EXPIRED' | 'SESSION_EXHAUSTED';
5365
+ /**
5366
+ * google.rpc.ErrorInfo detail for widget lifecycle failures. Match both domain and reason; ignore unknown reasons rather than renewing automatically.
5367
+ */
5368
+ export interface WidgetSessionErrorInfo {
5369
+ '@type': 'type.googleapis.com/google.rpc.ErrorInfo';
5370
+ domain: 'api.cadenya.com';
5371
+ reason: WidgetSessionErrorReason;
5372
+ /**
5373
+ * Optional non-sensitive context. Never contains tokens or secrets.
5374
+ */
5375
+ metadata?: Record<string, string>;
5376
+ }
5320
5377
  export type AgentServiceListAgentsState = 'STATE_UNSPECIFIED' | 'STATE_DRAFT' | 'STATE_PUBLISHED' | 'STATE_ARCHIVED';
5321
5378
  export type AgentServiceListAgentsVariationSelectionMode = 'VARIATION_SELECTION_MODE_UNSPECIFIED' | 'VARIATION_SELECTION_MODE_RANDOM' | 'VARIATION_SELECTION_MODE_WEIGHTED';
5322
5379
  export type AgentServiceListAgentFeedbackSentiment = 'FEEDBACK_SENTIMENT_UNSPECIFIED' | 'FEEDBACK_SENTIMENT_POSITIVE' | 'FEEDBACK_SENTIMENT_NEGATIVE';
@@ -5378,18 +5435,19 @@ export interface WidgetSessionSpecParam {
5378
5435
  */
5379
5436
  widgetId: string;
5380
5437
  /**
5381
- * Optional tenant assertion — the customer's org/company identifier for the
5382
- * visitor. Upserts the tenant record in the workspace and tags the session
5383
- * and every conversation it creates. Conversation listing at the widget
5384
- * host is scoped to this tenant.
5438
+ * Required tenant assertion — the customer's organization identifier.
5439
+ * Upserts the tenant record in the workspace. Every conversation created
5440
+ * through this session inherits the tenant and subject identity.
5385
5441
  */
5386
- tenant?: TenantAssertion;
5442
+ tenant: TenantAssertion;
5387
5443
  /**
5388
- * Optional subject assertion — the visitor within the tenant (e.g. their
5389
- * user id in the customer's namespace). Requires `tenant`; a subject
5390
- * asserted without a tenant is rejected with InvalidArgument.
5444
+ * Required subject assertion — the visitor's ID within the tenant.
5445
+ * Sessions with the same tenant and subject share conversation history on
5446
+ * the same widget and agent, subject to the current session's permissions.
5447
+ * A static ID deliberately shares that history; use a distinct ID per
5448
+ * visitor when their conversations should be separate.
5391
5449
  */
5392
- subject?: SubjectAssertion;
5450
+ subject: SubjectAssertion;
5393
5451
  /**
5394
5452
  * Hard session expiry. Tokens never outlive it; after it passes the session
5395
5453
  * transitions to STATE_EXPIRED. Defaults to a server-chosen horizon when