@cadenya/cadenya 0.129.0 → 0.131.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 +16 -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 +71 -0
  24. package/resources/objectives/objectives.d.mts.map +1 -1
  25. package/resources/objectives/objectives.d.ts +71 -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 +78 -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
@@ -0,0 +1,225 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import * as AccountAPI from "./account.mjs";
3
+ import * as Shared from "./shared.mjs";
4
+ import { APIPromise } from "../core/api-promise.mjs";
5
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from "../core/pagination.mjs";
6
+ import { RequestOptions } from "../internal/request-options.mjs";
7
+ /**
8
+ * Manage embeddable chat widgets. A widget binds an agent to a globally
9
+ * unique hostname with a per-widget origin allowlist; browsers reach it with
10
+ * session tokens minted via WidgetSessionService.
11
+ */
12
+ export declare class Widgets extends APIResource {
13
+ /**
14
+ * Creates a widget bound to an agent. The widget's DNS label and hostname are
15
+ * generated by the server and returned in `info`. The hostname may take up to a
16
+ * minute to become reachable while the edge propagates.
17
+ */
18
+ create(params: WidgetCreateParams, options?: RequestOptions): APIPromise<Widget>;
19
+ /**
20
+ * Retrieves a widget by ID
21
+ */
22
+ retrieve(id: string, params?: WidgetRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<Widget>;
23
+ /**
24
+ * Updates a widget's metadata or spec. The DNS label is immutable and cannot be
25
+ * updated. Re-pointing the agent affects new sessions only; in-flight
26
+ * conversations finish against the agent they started with.
27
+ */
28
+ update(id: string, params: WidgetUpdateParams, options?: RequestOptions): APIPromise<Widget>;
29
+ /**
30
+ * Lists all widgets in a workspace
31
+ */
32
+ list(params?: WidgetListParams | null | undefined, options?: RequestOptions): PagePromise<WidgetsCursorPagination, Widget>;
33
+ /**
34
+ * Deletes a widget. Its hostname stops serving and all of its sessions are
35
+ * revoked.
36
+ */
37
+ delete(id: string, params?: WidgetDeleteParams | null | undefined, options?: RequestOptions): APIPromise<void>;
38
+ /**
39
+ * Transitions a widget to STATE_ARCHIVED. The hostname stops serving at the edge,
40
+ * existing sessions are revoked, and no new sessions can be minted. Reversible via
41
+ * :unarchive.
42
+ */
43
+ archive(id: string, params: WidgetArchiveParams, options?: RequestOptions): APIPromise<Widget>;
44
+ /**
45
+ * Transitions an archived widget back to STATE_ACTIVE so its hostname serves
46
+ * traffic again. Sessions revoked by archival stay revoked; mint new ones.
47
+ */
48
+ unarchive(id: string, params: WidgetUnarchiveParams, options?: RequestOptions): APIPromise<Widget>;
49
+ }
50
+ export type WidgetsCursorPagination = CursorPagination<Widget>;
51
+ /**
52
+ * Widget is an embeddable chat surface bound to a single agent. Each widget owns a
53
+ * globally unique, immutable DNS label under the widgets domain (e.g.
54
+ * "k7m2xq9fp4wn.widgets.cadenya.com"): one widget = one hostname = one origin
55
+ * allowlist = one agent binding. Browsers talk to the widget host with session
56
+ * bearer tokens minted server-side via WidgetSessionService.
57
+ */
58
+ export interface Widget {
59
+ /**
60
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
61
+ */
62
+ metadata: Shared.ResourceMetadata;
63
+ /**
64
+ * WidgetSpec is the user-provided configuration for a widget.
65
+ */
66
+ spec: WidgetSpec;
67
+ /**
68
+ * The current lifecycle state of the widget. Output only. Widgets are created
69
+ * STATE_ACTIVE; use the :archive and :unarchive actions to transition between
70
+ * states.
71
+ */
72
+ state: 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';
73
+ /**
74
+ * WidgetInfo provides read-only server-derived data about a widget.
75
+ */
76
+ info?: WidgetInfo;
77
+ }
78
+ /**
79
+ * WidgetInfo provides read-only server-derived data about a widget.
80
+ */
81
+ export interface WidgetInfo {
82
+ /**
83
+ * BareMetadata contains the minimal metadata for a resource: the ID and an
84
+ * optional human-readable name. These are used for reference fields where the full
85
+ * metadata (account scoping, timestamps, labels, external IDs) is not needed —
86
+ * e.g., the tool references inside an agent variation spec or the tools assigned
87
+ * to an objective. Both fields are server-populated; clients provide IDs through
88
+ * sibling fields rather than by constructing a BareMetadata themselves.
89
+ */
90
+ agent?: Shared.BareMetadata;
91
+ /**
92
+ * A profile identifies a user or non-human principal (such as an API key) at the
93
+ * account level. Profiles are account-scoped and can be granted access to multiple
94
+ * workspaces.
95
+ */
96
+ createdBy?: AccountAPI.Profile;
97
+ /**
98
+ * The widget's DNS label — the single hostname label under the widgets domain.
99
+ * Server-generated at creation, globally unique, immutable, and deliberately
100
+ * unrelated to the widget's id.
101
+ */
102
+ dnsLabel?: string;
103
+ /**
104
+ * The full hostname browsers talk to. Authoritative — clients must use this value
105
+ * rather than constructing the hostname themselves.
106
+ */
107
+ host?: string;
108
+ }
109
+ /**
110
+ * WidgetSpec is the user-provided configuration for a widget.
111
+ */
112
+ export interface WidgetSpec {
113
+ /**
114
+ * Agent this widget is bound to. Accepts the canonical `agent_…` form or the
115
+ * `external_id:<value>` form. Sessions copy the agent at mint: re-pointing a
116
+ * widget's agent affects new sessions only.
117
+ */
118
+ agentId: string;
119
+ /**
120
+ * Web origins allowed to embed and use this widget, enforced at the edge on every
121
+ * browser request. Exact origins only (scheme + host + optional port), no paths,
122
+ * no wildcard subdomains.
123
+ */
124
+ originAllowlist?: Array<string>;
125
+ /**
126
+ * Optional explicit variation pin. Must belong to the widget's agent. When set,
127
+ * every objective created through the widget runs this variation — bypassing the
128
+ * agent's variation_selection_mode (staged rollout: pin in production, follow in
129
+ * staging, promote by clearing). When unset, the agent's selection mode chooses
130
+ * per conversation.
131
+ */
132
+ variationId?: string;
133
+ }
134
+ export interface WidgetCreateParams {
135
+ /**
136
+ * Path param: Workspace ID.
137
+ */
138
+ workspaceId?: string;
139
+ /**
140
+ * Body param: CreateResourceMetadata contains the user-provided fields for
141
+ * creating a workspace-scoped resource. Read-only fields (id, account_id,
142
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
143
+ * server.
144
+ */
145
+ metadata: Shared.CreateResourceMetadata;
146
+ /**
147
+ * Body param: WidgetSpec is the user-provided configuration for a widget.
148
+ */
149
+ spec: WidgetSpec;
150
+ }
151
+ export interface WidgetRetrieveParams {
152
+ /**
153
+ * Workspace ID.
154
+ */
155
+ workspaceId?: string;
156
+ }
157
+ export interface WidgetUpdateParams {
158
+ /**
159
+ * Path param: Workspace ID.
160
+ */
161
+ workspaceId?: string;
162
+ /**
163
+ * Body param: UpdateResourceMetadata contains the user-provided fields for
164
+ * updating a workspace-scoped resource. Read-only fields (id, account_id,
165
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
166
+ * server.
167
+ */
168
+ metadata?: Shared.UpdateResourceMetadata;
169
+ /**
170
+ * Body param: WidgetSpec is the user-provided configuration for a widget.
171
+ */
172
+ spec?: WidgetSpec;
173
+ /**
174
+ * Body param: Fields to update.
175
+ */
176
+ updateMask?: string;
177
+ }
178
+ export interface WidgetListParams extends CursorPaginationParams {
179
+ /**
180
+ * Path param: Workspace ID.
181
+ */
182
+ workspaceId?: string;
183
+ /**
184
+ * Query param: Filter to widgets bound to a specific agent. Accepts the canonical
185
+ * `agent_…` form or the `external_id:<value>` form.
186
+ */
187
+ agentId?: string;
188
+ /**
189
+ * Query param: When true, the `info` field on each returned widget is populated.
190
+ * Requests with this flag count more against your rate limit.
191
+ */
192
+ includeInfo?: boolean;
193
+ /**
194
+ * Query param: Filters by metadata labels. Comma-separated key=value pairs, e.g.
195
+ * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
196
+ * semantics).
197
+ */
198
+ labels?: string;
199
+ /**
200
+ * Query param: Sort order for results (asc or desc by creation time).
201
+ */
202
+ sortOrder?: string;
203
+ }
204
+ export interface WidgetDeleteParams {
205
+ /**
206
+ * Workspace ID.
207
+ */
208
+ workspaceId?: string;
209
+ }
210
+ export interface WidgetArchiveParams {
211
+ /**
212
+ * Workspace ID.
213
+ */
214
+ workspaceId?: string;
215
+ }
216
+ export interface WidgetUnarchiveParams {
217
+ /**
218
+ * Workspace ID.
219
+ */
220
+ workspaceId?: string;
221
+ }
222
+ export declare namespace Widgets {
223
+ export { type Widget as Widget, type WidgetInfo as WidgetInfo, type WidgetSpec as WidgetSpec, type WidgetsCursorPagination as WidgetsCursorPagination, type WidgetCreateParams as WidgetCreateParams, type WidgetRetrieveParams as WidgetRetrieveParams, type WidgetUpdateParams as WidgetUpdateParams, type WidgetListParams as WidgetListParams, type WidgetDeleteParams as WidgetDeleteParams, type WidgetArchiveParams as WidgetArchiveParams, type WidgetUnarchiveParams as WidgetUnarchiveParams, };
224
+ }
225
+ //# sourceMappingURL=widgets.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.d.mts","sourceRoot":"","sources":["../src/resources/widgets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,KAAK,UAAU,sBAAkB;AACxC,OAAO,KAAK,MAAM,qBAAiB;AACnC,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE,+BAA2B;AAEhG,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAKhF;;OAEG;IACH,QAAQ,CACN,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,oBAAoB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC;IAKrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,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AAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
@@ -0,0 +1,225 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as AccountAPI from "./account.js";
3
+ import * as Shared from "./shared.js";
4
+ import { APIPromise } from "../core/api-promise.js";
5
+ import { CursorPagination, type CursorPaginationParams, PagePromise } from "../core/pagination.js";
6
+ import { RequestOptions } from "../internal/request-options.js";
7
+ /**
8
+ * Manage embeddable chat widgets. A widget binds an agent to a globally
9
+ * unique hostname with a per-widget origin allowlist; browsers reach it with
10
+ * session tokens minted via WidgetSessionService.
11
+ */
12
+ export declare class Widgets extends APIResource {
13
+ /**
14
+ * Creates a widget bound to an agent. The widget's DNS label and hostname are
15
+ * generated by the server and returned in `info`. The hostname may take up to a
16
+ * minute to become reachable while the edge propagates.
17
+ */
18
+ create(params: WidgetCreateParams, options?: RequestOptions): APIPromise<Widget>;
19
+ /**
20
+ * Retrieves a widget by ID
21
+ */
22
+ retrieve(id: string, params?: WidgetRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<Widget>;
23
+ /**
24
+ * Updates a widget's metadata or spec. The DNS label is immutable and cannot be
25
+ * updated. Re-pointing the agent affects new sessions only; in-flight
26
+ * conversations finish against the agent they started with.
27
+ */
28
+ update(id: string, params: WidgetUpdateParams, options?: RequestOptions): APIPromise<Widget>;
29
+ /**
30
+ * Lists all widgets in a workspace
31
+ */
32
+ list(params?: WidgetListParams | null | undefined, options?: RequestOptions): PagePromise<WidgetsCursorPagination, Widget>;
33
+ /**
34
+ * Deletes a widget. Its hostname stops serving and all of its sessions are
35
+ * revoked.
36
+ */
37
+ delete(id: string, params?: WidgetDeleteParams | null | undefined, options?: RequestOptions): APIPromise<void>;
38
+ /**
39
+ * Transitions a widget to STATE_ARCHIVED. The hostname stops serving at the edge,
40
+ * existing sessions are revoked, and no new sessions can be minted. Reversible via
41
+ * :unarchive.
42
+ */
43
+ archive(id: string, params: WidgetArchiveParams, options?: RequestOptions): APIPromise<Widget>;
44
+ /**
45
+ * Transitions an archived widget back to STATE_ACTIVE so its hostname serves
46
+ * traffic again. Sessions revoked by archival stay revoked; mint new ones.
47
+ */
48
+ unarchive(id: string, params: WidgetUnarchiveParams, options?: RequestOptions): APIPromise<Widget>;
49
+ }
50
+ export type WidgetsCursorPagination = CursorPagination<Widget>;
51
+ /**
52
+ * Widget is an embeddable chat surface bound to a single agent. Each widget owns a
53
+ * globally unique, immutable DNS label under the widgets domain (e.g.
54
+ * "k7m2xq9fp4wn.widgets.cadenya.com"): one widget = one hostname = one origin
55
+ * allowlist = one agent binding. Browsers talk to the widget host with session
56
+ * bearer tokens minted server-side via WidgetSessionService.
57
+ */
58
+ export interface Widget {
59
+ /**
60
+ * Standard metadata for persistent, named resources (e.g., agents, tools, prompts)
61
+ */
62
+ metadata: Shared.ResourceMetadata;
63
+ /**
64
+ * WidgetSpec is the user-provided configuration for a widget.
65
+ */
66
+ spec: WidgetSpec;
67
+ /**
68
+ * The current lifecycle state of the widget. Output only. Widgets are created
69
+ * STATE_ACTIVE; use the :archive and :unarchive actions to transition between
70
+ * states.
71
+ */
72
+ state: 'STATE_UNSPECIFIED' | 'STATE_ACTIVE' | 'STATE_ARCHIVED';
73
+ /**
74
+ * WidgetInfo provides read-only server-derived data about a widget.
75
+ */
76
+ info?: WidgetInfo;
77
+ }
78
+ /**
79
+ * WidgetInfo provides read-only server-derived data about a widget.
80
+ */
81
+ export interface WidgetInfo {
82
+ /**
83
+ * BareMetadata contains the minimal metadata for a resource: the ID and an
84
+ * optional human-readable name. These are used for reference fields where the full
85
+ * metadata (account scoping, timestamps, labels, external IDs) is not needed —
86
+ * e.g., the tool references inside an agent variation spec or the tools assigned
87
+ * to an objective. Both fields are server-populated; clients provide IDs through
88
+ * sibling fields rather than by constructing a BareMetadata themselves.
89
+ */
90
+ agent?: Shared.BareMetadata;
91
+ /**
92
+ * A profile identifies a user or non-human principal (such as an API key) at the
93
+ * account level. Profiles are account-scoped and can be granted access to multiple
94
+ * workspaces.
95
+ */
96
+ createdBy?: AccountAPI.Profile;
97
+ /**
98
+ * The widget's DNS label — the single hostname label under the widgets domain.
99
+ * Server-generated at creation, globally unique, immutable, and deliberately
100
+ * unrelated to the widget's id.
101
+ */
102
+ dnsLabel?: string;
103
+ /**
104
+ * The full hostname browsers talk to. Authoritative — clients must use this value
105
+ * rather than constructing the hostname themselves.
106
+ */
107
+ host?: string;
108
+ }
109
+ /**
110
+ * WidgetSpec is the user-provided configuration for a widget.
111
+ */
112
+ export interface WidgetSpec {
113
+ /**
114
+ * Agent this widget is bound to. Accepts the canonical `agent_…` form or the
115
+ * `external_id:<value>` form. Sessions copy the agent at mint: re-pointing a
116
+ * widget's agent affects new sessions only.
117
+ */
118
+ agentId: string;
119
+ /**
120
+ * Web origins allowed to embed and use this widget, enforced at the edge on every
121
+ * browser request. Exact origins only (scheme + host + optional port), no paths,
122
+ * no wildcard subdomains.
123
+ */
124
+ originAllowlist?: Array<string>;
125
+ /**
126
+ * Optional explicit variation pin. Must belong to the widget's agent. When set,
127
+ * every objective created through the widget runs this variation — bypassing the
128
+ * agent's variation_selection_mode (staged rollout: pin in production, follow in
129
+ * staging, promote by clearing). When unset, the agent's selection mode chooses
130
+ * per conversation.
131
+ */
132
+ variationId?: string;
133
+ }
134
+ export interface WidgetCreateParams {
135
+ /**
136
+ * Path param: Workspace ID.
137
+ */
138
+ workspaceId?: string;
139
+ /**
140
+ * Body param: CreateResourceMetadata contains the user-provided fields for
141
+ * creating a workspace-scoped resource. Read-only fields (id, account_id,
142
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
143
+ * server.
144
+ */
145
+ metadata: Shared.CreateResourceMetadata;
146
+ /**
147
+ * Body param: WidgetSpec is the user-provided configuration for a widget.
148
+ */
149
+ spec: WidgetSpec;
150
+ }
151
+ export interface WidgetRetrieveParams {
152
+ /**
153
+ * Workspace ID.
154
+ */
155
+ workspaceId?: string;
156
+ }
157
+ export interface WidgetUpdateParams {
158
+ /**
159
+ * Path param: Workspace ID.
160
+ */
161
+ workspaceId?: string;
162
+ /**
163
+ * Body param: UpdateResourceMetadata contains the user-provided fields for
164
+ * updating a workspace-scoped resource. Read-only fields (id, account_id,
165
+ * workspace_id, profile_id, created_at) are excluded since they are set by the
166
+ * server.
167
+ */
168
+ metadata?: Shared.UpdateResourceMetadata;
169
+ /**
170
+ * Body param: WidgetSpec is the user-provided configuration for a widget.
171
+ */
172
+ spec?: WidgetSpec;
173
+ /**
174
+ * Body param: Fields to update.
175
+ */
176
+ updateMask?: string;
177
+ }
178
+ export interface WidgetListParams extends CursorPaginationParams {
179
+ /**
180
+ * Path param: Workspace ID.
181
+ */
182
+ workspaceId?: string;
183
+ /**
184
+ * Query param: Filter to widgets bound to a specific agent. Accepts the canonical
185
+ * `agent_…` form or the `external_id:<value>` form.
186
+ */
187
+ agentId?: string;
188
+ /**
189
+ * Query param: When true, the `info` field on each returned widget is populated.
190
+ * Requests with this flag count more against your rate limit.
191
+ */
192
+ includeInfo?: boolean;
193
+ /**
194
+ * Query param: Filters by metadata labels. Comma-separated key=value pairs, e.g.
195
+ * "env=prod,team=ai". A resource matches only if every pair matches exactly (AND
196
+ * semantics).
197
+ */
198
+ labels?: string;
199
+ /**
200
+ * Query param: Sort order for results (asc or desc by creation time).
201
+ */
202
+ sortOrder?: string;
203
+ }
204
+ export interface WidgetDeleteParams {
205
+ /**
206
+ * Workspace ID.
207
+ */
208
+ workspaceId?: string;
209
+ }
210
+ export interface WidgetArchiveParams {
211
+ /**
212
+ * Workspace ID.
213
+ */
214
+ workspaceId?: string;
215
+ }
216
+ export interface WidgetUnarchiveParams {
217
+ /**
218
+ * Workspace ID.
219
+ */
220
+ workspaceId?: string;
221
+ }
222
+ export declare namespace Widgets {
223
+ export { type Widget as Widget, type WidgetInfo as WidgetInfo, type WidgetSpec as WidgetSpec, type WidgetsCursorPagination as WidgetsCursorPagination, type WidgetCreateParams as WidgetCreateParams, type WidgetRetrieveParams as WidgetRetrieveParams, type WidgetUpdateParams as WidgetUpdateParams, type WidgetListParams as WidgetListParams, type WidgetDeleteParams as WidgetDeleteParams, type WidgetArchiveParams as WidgetArchiveParams, type WidgetUnarchiveParams as WidgetUnarchiveParams, };
224
+ }
225
+ //# sourceMappingURL=widgets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../src/resources/widgets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,UAAU,qBAAkB;AACxC,OAAO,KAAK,MAAM,oBAAiB;AACnC,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE,8BAA2B;AAEhG,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D;;;;GAIG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAKhF;;OAEG;IACH,QAAQ,CACN,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,oBAAoB,GAAG,IAAI,GAAG,SAAc,EACpD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC;IAKrB;;;;OA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AW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Widgets = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const pagination_1 = require("../core/pagination.js");
7
+ const headers_1 = require("../internal/headers.js");
8
+ const path_1 = require("../internal/utils/path.js");
9
+ /**
10
+ * Manage embeddable chat widgets. A widget binds an agent to a globally
11
+ * unique hostname with a per-widget origin allowlist; browsers reach it with
12
+ * session tokens minted via WidgetSessionService.
13
+ */
14
+ class Widgets extends resource_1.APIResource {
15
+ /**
16
+ * Creates a widget bound to an agent. The widget's DNS label and hostname are
17
+ * generated by the server and returned in `info`. The hostname may take up to a
18
+ * minute to become reachable while the edge propagates.
19
+ */
20
+ create(params, options) {
21
+ const { workspaceId = this._client.workspaceID, ...body } = params;
22
+ return this._client.post((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets`, { body, ...options });
23
+ }
24
+ /**
25
+ * Retrieves a widget by ID
26
+ */
27
+ retrieve(id, params = {}, options) {
28
+ const { workspaceId = this._client.workspaceID } = params ?? {};
29
+ return this._client.get((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets/${id}`, options);
30
+ }
31
+ /**
32
+ * Updates a widget's metadata or spec. The DNS label is immutable and cannot be
33
+ * updated. Re-pointing the agent affects new sessions only; in-flight
34
+ * conversations finish against the agent they started with.
35
+ */
36
+ update(id, params, options) {
37
+ const { workspaceId = this._client.workspaceID, ...body } = params;
38
+ return this._client.patch((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets/${id}`, { body, ...options });
39
+ }
40
+ /**
41
+ * Lists all widgets in a workspace
42
+ */
43
+ list(params = {}, options) {
44
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
45
+ return this._client.getAPIList((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets`, (pagination_1.CursorPagination), {
46
+ query,
47
+ ...options,
48
+ });
49
+ }
50
+ /**
51
+ * Deletes a widget. Its hostname stops serving and all of its sessions are
52
+ * revoked.
53
+ */
54
+ delete(id, params = {}, options) {
55
+ const { workspaceId = this._client.workspaceID } = params ?? {};
56
+ return this._client.delete((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets/${id}`, {
57
+ ...options,
58
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
59
+ });
60
+ }
61
+ /**
62
+ * Transitions a widget to STATE_ARCHIVED. The hostname stops serving at the edge,
63
+ * existing sessions are revoked, and no new sessions can be minted. Reversible via
64
+ * :unarchive.
65
+ */
66
+ archive(id, params, options) {
67
+ const { workspaceId = this._client.workspaceID, ...body } = params;
68
+ return this._client.post((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets/${id}:archive`, { body, ...options });
69
+ }
70
+ /**
71
+ * Transitions an archived widget back to STATE_ACTIVE so its hostname serves
72
+ * traffic again. Sessions revoked by archival stay revoked; mint new ones.
73
+ */
74
+ unarchive(id, params, options) {
75
+ const { workspaceId = this._client.workspaceID, ...body } = params;
76
+ return this._client.post((0, path_1.path) `/v1/workspaces/${workspaceId}/widgets/${id}:unarchive`, {
77
+ body,
78
+ ...options,
79
+ });
80
+ }
81
+ }
82
+ exports.Widgets = Widgets;
83
+ //# sourceMappingURL=widgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.js","sourceRoot":"","sources":["../src/resources/widgets.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,sDAAgG;AAChG,oDAAmD;AAEnD,oDAA8C;AAE9C;;;;GAIG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;OAIG;IACH,MAAM,CAAC,MAA0B,EAAE,OAAwB;QACzD,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,EAAU,EACV,SAAkD,EAAE,EACpD,OAAwB;QAExB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAU,EAAE,MAA0B,EAAE,OAAwB;QACrE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,YAAY,EAAE,EAAE,EAAE,EA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AAM,EAAE,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,kBAAkB,WAAW,YAAY,EAAE,YAAY,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AApFD,0BAoFC"}
@@ -0,0 +1,79 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { CursorPagination } from "../core/pagination.mjs";
4
+ import { buildHeaders } from "../internal/headers.mjs";
5
+ import { path } from "../internal/utils/path.mjs";
6
+ /**
7
+ * Manage embeddable chat widgets. A widget binds an agent to a globally
8
+ * unique hostname with a per-widget origin allowlist; browsers reach it with
9
+ * session tokens minted via WidgetSessionService.
10
+ */
11
+ export class Widgets extends APIResource {
12
+ /**
13
+ * Creates a widget bound to an agent. The widget's DNS label and hostname are
14
+ * generated by the server and returned in `info`. The hostname may take up to a
15
+ * minute to become reachable while the edge propagates.
16
+ */
17
+ create(params, options) {
18
+ const { workspaceId = this._client.workspaceID, ...body } = params;
19
+ return this._client.post(path `/v1/workspaces/${workspaceId}/widgets`, { body, ...options });
20
+ }
21
+ /**
22
+ * Retrieves a widget by ID
23
+ */
24
+ retrieve(id, params = {}, options) {
25
+ const { workspaceId = this._client.workspaceID } = params ?? {};
26
+ return this._client.get(path `/v1/workspaces/${workspaceId}/widgets/${id}`, options);
27
+ }
28
+ /**
29
+ * Updates a widget's metadata or spec. The DNS label is immutable and cannot be
30
+ * updated. Re-pointing the agent affects new sessions only; in-flight
31
+ * conversations finish against the agent they started with.
32
+ */
33
+ update(id, params, options) {
34
+ const { workspaceId = this._client.workspaceID, ...body } = params;
35
+ return this._client.patch(path `/v1/workspaces/${workspaceId}/widgets/${id}`, { body, ...options });
36
+ }
37
+ /**
38
+ * Lists all widgets in a workspace
39
+ */
40
+ list(params = {}, options) {
41
+ const { workspaceId = this._client.workspaceID, ...query } = params ?? {};
42
+ return this._client.getAPIList(path `/v1/workspaces/${workspaceId}/widgets`, (CursorPagination), {
43
+ query,
44
+ ...options,
45
+ });
46
+ }
47
+ /**
48
+ * Deletes a widget. Its hostname stops serving and all of its sessions are
49
+ * revoked.
50
+ */
51
+ delete(id, params = {}, options) {
52
+ const { workspaceId = this._client.workspaceID } = params ?? {};
53
+ return this._client.delete(path `/v1/workspaces/${workspaceId}/widgets/${id}`, {
54
+ ...options,
55
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
56
+ });
57
+ }
58
+ /**
59
+ * Transitions a widget to STATE_ARCHIVED. The hostname stops serving at the edge,
60
+ * existing sessions are revoked, and no new sessions can be minted. Reversible via
61
+ * :unarchive.
62
+ */
63
+ archive(id, params, options) {
64
+ const { workspaceId = this._client.workspaceID, ...body } = params;
65
+ return this._client.post(path `/v1/workspaces/${workspaceId}/widgets/${id}:archive`, { body, ...options });
66
+ }
67
+ /**
68
+ * Transitions an archived widget back to STATE_ACTIVE so its hostname serves
69
+ * traffic again. Sessions revoked by archival stay revoked; mint new ones.
70
+ */
71
+ unarchive(id, params, options) {
72
+ const { workspaceId = this._client.workspaceID, ...body } = params;
73
+ return this._client.post(path `/v1/workspaces/${workspaceId}/widgets/${id}:unarchive`, {
74
+ body,
75
+ ...options,
76
+ });
77
+ }
78
+ }
79
+ //# sourceMappingURL=widgets.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.mjs","sourceRoot":"","sources":["../src/resources/widgets.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAI/C,OAAO,EAAE,gBAAgB,EAA4C,+BAA2B;AAChG,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;GAIG;AACH,MAAM,OAAO,OA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