@cadenya/cadenya 0.129.0 → 0.130.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +17 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +17 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +17 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +17 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/api-keys.d.mts +5 -4
  12. package/resources/api-keys.d.mts.map +1 -1
  13. package/resources/api-keys.d.ts +5 -4
  14. package/resources/api-keys.d.ts.map +1 -1
  15. package/resources/index.d.mts +2 -0
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +2 -0
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +5 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +2 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/objectives/objectives.d.mts +53 -0
  24. package/resources/objectives/objectives.d.mts.map +1 -1
  25. package/resources/objectives/objectives.d.ts +53 -0
  26. package/resources/objectives/objectives.d.ts.map +1 -1
  27. package/resources/objectives/objectives.js.map +1 -1
  28. package/resources/objectives/objectives.mjs.map +1 -1
  29. package/resources/widget-sessions.d.mts +388 -0
  30. package/resources/widget-sessions.d.mts.map +1 -0
  31. package/resources/widget-sessions.d.ts +388 -0
  32. package/resources/widget-sessions.d.ts.map +1 -0
  33. package/resources/widget-sessions.js +79 -0
  34. package/resources/widget-sessions.js.map +1 -0
  35. package/resources/widget-sessions.mjs +75 -0
  36. package/resources/widget-sessions.mjs.map +1 -0
  37. package/resources/widgets.d.mts +225 -0
  38. package/resources/widgets.d.mts.map +1 -0
  39. package/resources/widgets.d.ts +225 -0
  40. package/resources/widgets.d.ts.map +1 -0
  41. package/resources/widgets.js +83 -0
  42. package/resources/widgets.js.map +1 -0
  43. package/resources/widgets.mjs +79 -0
  44. package/resources/widgets.mjs.map +1 -0
  45. package/src/client.ts +81 -0
  46. package/src/resources/api-keys.ts +5 -4
  47. package/src/resources/index.ts +32 -0
  48. package/src/resources/objectives/objectives.ts +57 -0
  49. package/src/resources/widget-sessions.ts +509 -0
  50. package/src/resources/widgets.ts +317 -0
  51. package/src/version.ts +1 -1
  52. package/version.d.mts +1 -1
  53. package/version.d.ts +1 -1
  54. package/version.js +1 -1
  55. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -88,6 +88,38 @@ import {
88
88
  Uploads as UploadsAPIUploads,
89
89
  } from './resources/uploads';
90
90
  import { UnsafeUnwrapWebhookEvent, UnwrapWebhookEvent, Webhooks } from './resources/webhooks';
91
+ import {
92
+ SubjectAssertion,
93
+ SubjectReference,
94
+ TenantAssertion,
95
+ TenantReference,
96
+ WidgetSession,
97
+ WidgetSessionCreateParams,
98
+ WidgetSessionDeleteParams,
99
+ WidgetSessionDeleteTenantParams,
100
+ WidgetSessionDeleteTenantResponse,
101
+ WidgetSessionInfo,
102
+ WidgetSessionListParams,
103
+ WidgetSessionRetrieveParams,
104
+ WidgetSessionRevokeParams,
105
+ WidgetSessionSpec,
106
+ WidgetSessions,
107
+ WidgetSessionsCursorPagination,
108
+ } from './resources/widget-sessions';
109
+ import {
110
+ Widget,
111
+ WidgetArchiveParams,
112
+ WidgetCreateParams,
113
+ WidgetDeleteParams,
114
+ WidgetInfo,
115
+ WidgetListParams,
116
+ WidgetRetrieveParams,
117
+ WidgetSpec,
118
+ WidgetUnarchiveParams,
119
+ WidgetUpdateParams,
120
+ Widgets,
121
+ WidgetsCursorPagination,
122
+ } from './resources/widgets';
91
123
  import {
92
124
  WorkspaceSecret,
93
125
  WorkspaceSecretCreateParams,
@@ -1102,6 +1134,19 @@ export class Cadenya {
1102
1134
  */
1103
1135
  workspaceAdmin: API.WorkspaceAdmin = new API.WorkspaceAdmin(this);
1104
1136
  webhooks: API.Webhooks = new API.Webhooks(this);
1137
+ /**
1138
+ * Manage embeddable chat widgets. A widget binds an agent to a globally
1139
+ * unique hostname with a per-widget origin allowlist; browsers reach it with
1140
+ * session tokens minted via WidgetSessionService.
1141
+ */
1142
+ widgets: API.Widgets = new API.Widgets(this);
1143
+ /**
1144
+ * Mint and manage widget sessions. Session creation is server-to-server only:
1145
+ * the customer's backend authenticates its visitor, asserts tenant/subject
1146
+ * context, attaches any per-visitor secrets, and receives a short-lived
1147
+ * bearer token the browser uses against the widget host.
1148
+ */
1149
+ widgetSessions: API.WidgetSessions = new API.WidgetSessions(this);
1105
1150
  }
1106
1151
 
1107
1152
  Cadenya.AIProviderKeys = AIProviderKeys;
@@ -1120,6 +1165,8 @@ Cadenya.WorkspaceSecrets = WorkspaceSecrets;
1120
1165
  Cadenya.Workspaces = Workspaces;
1121
1166
  Cadenya.WorkspaceAdmin = WorkspaceAdmin;
1122
1167
  Cadenya.Webhooks = Webhooks;
1168
+ Cadenya.Widgets = Widgets;
1169
+ Cadenya.WidgetSessions = WidgetSessions;
1123
1170
 
1124
1171
  export declare namespace Cadenya {
1125
1172
  export type RequestOptions = Opts.RequestOptions;
@@ -1393,6 +1440,40 @@ export declare namespace Cadenya {
1393
1440
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
1394
1441
  };
1395
1442
 
1443
+ export {
1444
+ Widgets as Widgets,
1445
+ type Widget as Widget,
1446
+ type WidgetInfo as WidgetInfo,
1447
+ type WidgetSpec as WidgetSpec,
1448
+ type WidgetsCursorPagination as WidgetsCursorPagination,
1449
+ type WidgetCreateParams as WidgetCreateParams,
1450
+ type WidgetRetrieveParams as WidgetRetrieveParams,
1451
+ type WidgetUpdateParams as WidgetUpdateParams,
1452
+ type WidgetListParams as WidgetListParams,
1453
+ type WidgetDeleteParams as WidgetDeleteParams,
1454
+ type WidgetArchiveParams as WidgetArchiveParams,
1455
+ type WidgetUnarchiveParams as WidgetUnarchiveParams,
1456
+ };
1457
+
1458
+ export {
1459
+ WidgetSessions as WidgetSessions,
1460
+ type SubjectAssertion as SubjectAssertion,
1461
+ type SubjectReference as SubjectReference,
1462
+ type TenantAssertion as TenantAssertion,
1463
+ type TenantReference as TenantReference,
1464
+ type WidgetSession as WidgetSession,
1465
+ type WidgetSessionInfo as WidgetSessionInfo,
1466
+ type WidgetSessionSpec as WidgetSessionSpec,
1467
+ type WidgetSessionDeleteTenantResponse as WidgetSessionDeleteTenantResponse,
1468
+ type WidgetSessionsCursorPagination as WidgetSessionsCursorPagination,
1469
+ type WidgetSessionCreateParams as WidgetSessionCreateParams,
1470
+ type WidgetSessionRetrieveParams as WidgetSessionRetrieveParams,
1471
+ type WidgetSessionListParams as WidgetSessionListParams,
1472
+ type WidgetSessionDeleteParams as WidgetSessionDeleteParams,
1473
+ type WidgetSessionDeleteTenantParams as WidgetSessionDeleteTenantParams,
1474
+ type WidgetSessionRevokeParams as WidgetSessionRevokeParams,
1475
+ };
1476
+
1396
1477
  export type AccountResourceMetadata = API.AccountResourceMetadata;
1397
1478
  export type BareMetadata = API.BareMetadata;
1398
1479
  export type CreateOperationMetadata = API.CreateOperationMetadata;
@@ -160,10 +160,11 @@ export interface APIKeySpec {
160
160
  * Scopes granted to this key. Each entry is a colon-separated resource:verb string
161
161
  * (e.g. "objectives:manage").
162
162
  *
163
- * Resources: agents, objectives, tools, memory, api_keys, workspaces, secrets,
164
- * account. Verbs: read and manage, where manage implies read — a stored scope set
165
- * is normalized to drop "x:read" when "x:manage" is present. The secrets and
166
- * account resources support only manage. "\*" is an explicit full-access grant.
163
+ * Resources: agents, objectives, tools, memory, api_keys, workspaces, widgets,
164
+ * widget_sessions, secrets, account. Verbs: read and manage, where manage implies
165
+ * read — a stored scope set is normalized to drop "x:read" when "x:manage" is
166
+ * present. The secrets and account resources support only manage. "\*" is an
167
+ * explicit full-access grant.
167
168
  *
168
169
  * Scopes are deny-by-default: a key with an empty list can call only scope-free
169
170
  * endpoints. Full access is always an explicit "\*" grant.
@@ -217,6 +217,38 @@ export {
217
217
  type UploadRetrieveParams,
218
218
  } from './uploads';
219
219
  export { Webhooks, type UnsafeUnwrapWebhookEvent, type UnwrapWebhookEvent } from './webhooks';
220
+ export {
221
+ WidgetSessions,
222
+ type SubjectAssertion,
223
+ type SubjectReference,
224
+ type TenantAssertion,
225
+ type TenantReference,
226
+ type WidgetSession,
227
+ type WidgetSessionInfo,
228
+ type WidgetSessionSpec,
229
+ type WidgetSessionDeleteTenantResponse,
230
+ type WidgetSessionCreateParams,
231
+ type WidgetSessionRetrieveParams,
232
+ type WidgetSessionListParams,
233
+ type WidgetSessionDeleteParams,
234
+ type WidgetSessionDeleteTenantParams,
235
+ type WidgetSessionRevokeParams,
236
+ type WidgetSessionsCursorPagination,
237
+ } from './widget-sessions';
238
+ export {
239
+ Widgets,
240
+ type Widget,
241
+ type WidgetInfo,
242
+ type WidgetSpec,
243
+ type WidgetCreateParams,
244
+ type WidgetRetrieveParams,
245
+ type WidgetUpdateParams,
246
+ type WidgetListParams,
247
+ type WidgetDeleteParams,
248
+ type WidgetArchiveParams,
249
+ type WidgetUnarchiveParams,
250
+ type WidgetsCursorPagination,
251
+ } from './widgets';
220
252
  export {
221
253
  WorkspaceAdmin,
222
254
  type WorkspaceMember,
@@ -4,6 +4,7 @@ import { APIResource } from '../../core/resource';
4
4
  import * as ObjectivesAPI from './objectives';
5
5
  import * as AccountAPI from '../account';
6
6
  import * as Shared from '../shared';
7
+ import * as WidgetSessionsAPI from '../widget-sessions';
7
8
  import * as AgentsAPI from '../agents/agents';
8
9
  import * as SchedulesAPI from '../agents/schedules';
9
10
  import * as VariationsAPI from '../agents/variations';
@@ -587,6 +588,12 @@ export interface Objective {
587
588
  */
588
589
  parentObjectiveId?: string;
589
590
 
591
+ /**
592
+ * Parameters forced onto this objective's tool calls, as provided at creation. See
593
+ * CreateObjectiveRequest.pinned_parameters for semantics.
594
+ */
595
+ pinnedParameters?: { [key: string]: string };
596
+
590
597
  /**
591
598
  * Secrets that can be used in the headers for tool calls using the secret
592
599
  * interpolation format.
@@ -1131,6 +1138,18 @@ export interface ObjectiveInfo {
1131
1138
  * Total number of tool calls made during execution
1132
1139
  */
1133
1140
  totalToolCalls: number;
1141
+
1142
+ /**
1143
+ * SubjectReference is the read-only echo of a resource's subject association,
1144
+ * carrying both Cadenya's canonical id and the customer's own key.
1145
+ */
1146
+ subject?: WidgetSessionsAPI.SubjectReference;
1147
+
1148
+ /**
1149
+ * TenantReference is the read-only echo of a resource's tenant association,
1150
+ * carrying both Cadenya's canonical id and the customer's own key.
1151
+ */
1152
+ tenant?: WidgetSessionsAPI.TenantReference;
1134
1153
  }
1135
1154
 
1136
1155
  export interface ObjectiveSecret {
@@ -1351,12 +1370,37 @@ export interface ObjectiveCreateParams {
1351
1370
  */
1352
1371
  metadata?: Shared.CreateOperationMetadata;
1353
1372
 
1373
+ /**
1374
+ * Body param: Parameters forced onto this objective's tool calls. A pinned
1375
+ * parameter is an overlay on a tool's JSON schema: the parameter is removed from
1376
+ * what the LLM sees, and its value is always overwritten server-side with the
1377
+ * pinned value — the model cannot choose a different value for it.
1378
+ */
1379
+ pinnedParameters?: { [key: string]: string };
1380
+
1354
1381
  /**
1355
1382
  * Body param: Secrets that can be used in the headers for tool calls using the
1356
1383
  * secret interpolation format.
1357
1384
  */
1358
1385
  secrets?: Array<ObjectiveCreateParams.Secret>;
1359
1386
 
1387
+ /**
1388
+ * Body param: SubjectAssertion identifies a person within a tenant in the
1389
+ * customer's own namespace — typically their user id. Asserting a subject upserts
1390
+ * the subject record under the asserted tenant and associates the created resource
1391
+ * with it. A subject assertion is only valid alongside a tenant assertion: subject
1392
+ * identifiers are scoped to their tenant.
1393
+ */
1394
+ subject?: WidgetSessionsAPI.SubjectAssertion;
1395
+
1396
+ /**
1397
+ * Body param: TenantAssertion identifies a tenant in the customer's own namespace
1398
+ * — their org, company, or team identifier for an end user. Asserting a tenant
1399
+ * upserts the tenant record in the workspace (keyed on `id` as the tenant's
1400
+ * external_id) and associates the created resource with it.
1401
+ */
1402
+ tenant?: WidgetSessionsAPI.TenantAssertion;
1403
+
1360
1404
  /**
1361
1405
  * Body param: Optional explicit variation selection. Overrides the agent's
1362
1406
  * variation_selection_mode.
@@ -1443,6 +1487,19 @@ export interface ObjectiveListParams extends CursorPaginationParams {
1443
1487
  | 'STATE_CANCELLED'
1444
1488
  | 'STATE_FINALIZED'
1445
1489
  | 'STATE_TIMED_OUT';
1490
+
1491
+ /**
1492
+ * Query param: Filter to objectives associated with a subject. Accepts the
1493
+ * canonical `subj_…` form or the `external_id:<value>` form; the external_id form
1494
+ * is scoped within a tenant and requires `tenant_id` to also be set.
1495
+ */
1496
+ subjectId?: string;
1497
+
1498
+ /**
1499
+ * Query param: Filter to objectives associated with a tenant. Accepts the
1500
+ * canonical `tenant_…` form or the `external_id:<value>` form.
1501
+ */
1502
+ tenantId?: string;
1446
1503
  }
1447
1504
 
1448
1505
  export interface ObjectiveCancelParams {