@cadenya/widgets 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/types.d.ts +40 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -2
- package/src/client.ts +1 -1
- package/src/types.ts +43 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/dist/client.js
CHANGED
|
@@ -18,7 +18,7 @@ export class CadenyaWidgets {
|
|
|
18
18
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
19
19
|
maxRetries: options.maxRetries ?? 0,
|
|
20
20
|
timeout: options.timeout,
|
|
21
|
-
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.
|
|
21
|
+
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },
|
|
22
22
|
fetch: options.fetch,
|
|
23
23
|
logger: options.logger,
|
|
24
24
|
logLevel: options.logLevel,
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,E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G,EAAE,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,SAAS,aAAa,CACpB,KAAa,EACb,QAA4B,EAC5B,GAAuB;IAEvB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sFAAsF,CAC/F,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AAClC,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient } from './core/http.js';\nimport type { Logger, LogLevel } from './core/http.js';\nimport { Config } from './resources/config.js';\nimport { Conversations } from './resources/conversations.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYAWIDGETS_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to . */\n baseURL?: string;\n /** Max automatic retries for retryable failures. Defaults to 0. */\n maxRetries?: number;\n /**\n * Deadline for ordinary (non-streaming) requests in milliseconds; override\n * per request with `options.timeout`. Streams bound only response-header\n * acquisition — body lifetime stays under the caller's AbortSignal.\n * Defaults to 60000; a non-finite or <= 0 value disables the deadline.\n */\n timeout?: number;\n /** Headers sent with every request. */\n defaultHeaders?: Record<string, string>;\n /** Custom fetch implementation. */\n fetch?: typeof fetch;\n /** Destination for SDK logs. Defaults to `console`. */\n logger?: Logger;\n /** 'debug' | 'warn' (default) | 'off'. Never logs headers or bodies. */\n logLevel?: LogLevel;\n}\n\nexport class CadenyaWidgets {\n readonly config: Config;\n readonly conversations: Conversations;\n\n private readonly _client: HttpClient;\n\n constructor(options: ClientOptions = {}) {\n // Presence is not validity: empty strings from options or environment\n // are configuration mistakes, not credentials.\n const apiKey = resolveOption('apiKey', options.apiKey, readEnv('CADENYAWIDGETS_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new CadenyaWidgets({ apiKey })` or set the CADENYAWIDGETS_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYAWIDGETS_BASE_URL')) ?? '',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AA0B7D,MAAM,OAAO,cAAc;IAChB,MAAM,CAAS;IACf,aAAa,CAAgB;IAErB,OAAO,CAAa;IAErC,YAAY,UAAyB,EAAE;QACrC,sEAAsE;QACtE,+CAA+C;QAC/C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,wHAAwH,CACzH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,UAAU,CAAC;YAC5B,OAAO,EAAE,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC,IAAI,EAAE;YAC5F,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;YACzD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC;YACnC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,cAAc,EAAE,EAAE,YAAY,EAAE,2CAA2C,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE;YACxG,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,QAAQ,EAAE,EAAI;SACf,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,GAAG,GAAI,UAAyE;SACnF,OAAO,EAAE,GAAG,CAAC;IAChB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC;AAED,2EAA2E;AAC3E,4EAA4E;AAC5E,sEAAsE;AACtE,SAAS,aAAa,CACpB,KAAa,EACb,QAA4B,EAC5B,GAAuB;IAEvB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sFAAsF,CAC/F,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;AAClC,CAAC","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\nimport { HttpClient } from './core/http.js';\nimport type { Logger, LogLevel } from './core/http.js';\nimport { Config } from './resources/config.js';\nimport { Conversations } from './resources/conversations.js';\n\nexport interface ClientOptions {\n /** API key. Defaults to the CADENYAWIDGETS_API_KEY environment variable. */\n apiKey?: string;\n /** Override the API base URL. Defaults to . */\n baseURL?: string;\n /** Max automatic retries for retryable failures. Defaults to 0. */\n maxRetries?: number;\n /**\n * Deadline for ordinary (non-streaming) requests in milliseconds; override\n * per request with `options.timeout`. Streams bound only response-header\n * acquisition — body lifetime stays under the caller's AbortSignal.\n * Defaults to 60000; a non-finite or <= 0 value disables the deadline.\n */\n timeout?: number;\n /** Headers sent with every request. */\n defaultHeaders?: Record<string, string>;\n /** Custom fetch implementation. */\n fetch?: typeof fetch;\n /** Destination for SDK logs. Defaults to `console`. */\n logger?: Logger;\n /** 'debug' | 'warn' (default) | 'off'. Never logs headers or bodies. */\n logLevel?: LogLevel;\n}\n\nexport class CadenyaWidgets {\n readonly config: Config;\n readonly conversations: Conversations;\n\n private readonly _client: HttpClient;\n\n constructor(options: ClientOptions = {}) {\n // Presence is not validity: empty strings from options or environment\n // are configuration mistakes, not credentials.\n const apiKey = resolveOption('apiKey', options.apiKey, readEnv('CADENYAWIDGETS_API_KEY'));\n if (!apiKey) {\n throw new Error(\n \"Missing API key. Pass it with `new CadenyaWidgets({ apiKey })` or set the CADENYAWIDGETS_API_KEY environment variable.\",\n );\n }\n this._client = new HttpClient({\n baseURL: resolveOption('baseURL', options.baseURL, readEnv('CADENYAWIDGETS_BASE_URL')) ?? '',\n authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),\n maxRetries: options.maxRetries ?? 0,\n timeout: options.timeout,\n defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },\n fetch: options.fetch,\n logger: options.logger,\n logLevel: options.logLevel,\n defaults: { },\n });\n this.config = new Config(this._client);\n this.conversations = new Conversations(this._client);\n }\n}\n\nfunction readEnv(name: string): string | undefined {\n const env = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env;\n return env?.[name];\n}\n\n// Presence is not validity: an explicitly provided option must be usable —\n// a blank value is a configuration mistake and never silently falls back to\n// the environment or a default. Only an OMITTED option reads the env.\nfunction resolveOption(\n label: string,\n explicit: string | undefined,\n env: string | undefined,\n): string | undefined {\n if (explicit !== undefined) {\n const value = explicit.trim();\n if (!value) {\n throw new Error(\n `${label} must not be blank when provided explicitly; omit it to use the environment instead.`,\n );\n }\n return value;\n }\n return env?.trim() || undefined;\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -210,14 +210,27 @@ export interface WidgetErrorEvent {
|
|
|
210
210
|
* events map to these through an explicit, exhaustive server-side projection;
|
|
211
211
|
* internal-only types (context compaction, memory reads, sub-agent
|
|
212
212
|
* bookkeeping) have no widget variant and are dropped. Nothing here carries
|
|
213
|
-
* tool configuration,
|
|
214
|
-
*
|
|
213
|
+
* tool configuration, server identities, operator details, or internal error
|
|
214
|
+
* strings. Tool arguments cross this boundary only when an enabled tool set
|
|
215
|
+
* overlay explicitly opts the matching tool in.
|
|
215
216
|
*/
|
|
216
|
-
export type WidgetEvent = WidgetEvent_UserMessage | WidgetEvent_AssistantMessage | WidgetEvent_ToolApprovalRequested | WidgetEvent_ToolApproved | WidgetEvent_ToolDenied | WidgetEvent_ToolCalled | WidgetEvent_ToolResult | WidgetEvent_ToolError | WidgetEvent_Error | WidgetEvent_Cancelled | WidgetEvent_TimedOut;
|
|
217
|
+
export type WidgetEvent = WidgetEvent_UserMessage | WidgetEvent_AssistantMessage | WidgetEvent_ToolApprovalRequested | WidgetEvent_ToolApproved | WidgetEvent_ToolDenied | WidgetEvent_ToolCalled | WidgetEvent_ToolResult | WidgetEvent_ToolError | WidgetEvent_Error | WidgetEvent_Cancelled | WidgetEvent_TimedOut | WidgetEvent_Finalized;
|
|
218
|
+
/**
|
|
219
|
+
* WidgetFinalizedEvent: the conversation's agent produced its structured
|
|
220
|
+
* output and the objective reached its terminal state. Only agents with an
|
|
221
|
+
* output definition finalize — such an agent ends the conversation after one
|
|
222
|
+
* turn, so a widget bound to one should treat this as the answer, not a
|
|
223
|
+
* message to keep chatting past.
|
|
224
|
+
*/
|
|
225
|
+
export interface WidgetFinalizedEvent {
|
|
226
|
+
/**
|
|
227
|
+
* The structured output the agent produced, matching the shape of the
|
|
228
|
+
* agent's output definition schema.
|
|
229
|
+
*/
|
|
230
|
+
output?: Record<string, unknown>;
|
|
231
|
+
}
|
|
217
232
|
/**
|
|
218
233
|
* WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.
|
|
219
|
-
* (There is no finalized variant: agents with structured output — the only
|
|
220
|
-
* path to finalization — cannot be bound to widgets.)
|
|
221
234
|
*/
|
|
222
235
|
export interface WidgetTimedOutEvent {
|
|
223
236
|
}
|
|
@@ -241,12 +254,18 @@ export interface WidgetToolApprovedEvent {
|
|
|
241
254
|
toolCallId: string;
|
|
242
255
|
}
|
|
243
256
|
/**
|
|
244
|
-
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
245
|
-
* never included.
|
|
257
|
+
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
246
258
|
*/
|
|
247
259
|
export interface WidgetToolCalledEvent {
|
|
248
260
|
toolCallId: string;
|
|
249
261
|
tool: WidgetToolReference;
|
|
262
|
+
/**
|
|
263
|
+
* The final arguments sent to the tool, after parameter actions were
|
|
264
|
+
* applied. Present only when an enabled matching tool set overlay opts the
|
|
265
|
+
* tool into exposing arguments in widget sessions. Arguments are omitted
|
|
266
|
+
* by default because they may contain sensitive customer data.
|
|
267
|
+
*/
|
|
268
|
+
arguments?: Record<string, unknown>;
|
|
250
269
|
}
|
|
251
270
|
/**
|
|
252
271
|
* WidgetToolDeniedEvent records that the pending tool call was denied.
|
|
@@ -458,4 +477,18 @@ export interface WidgetEvent_TimedOut {
|
|
|
458
477
|
conversationId: string;
|
|
459
478
|
createdAt: string;
|
|
460
479
|
}
|
|
480
|
+
export interface WidgetEvent_Finalized {
|
|
481
|
+
type: 'finalized';
|
|
482
|
+
finalized: WidgetFinalizedEvent;
|
|
483
|
+
/**
|
|
484
|
+
* Unique event id (ULID). Doubles as the SSE `id:` — replay it as
|
|
485
|
+
* `Last-Event-ID` on reconnect to resume without duplication.
|
|
486
|
+
*/
|
|
487
|
+
id: string;
|
|
488
|
+
/**
|
|
489
|
+
* The conversation this event belongs to.
|
|
490
|
+
*/
|
|
491
|
+
conversationId: string;
|
|
492
|
+
createdAt: string;
|
|
493
|
+
}
|
|
461
494
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED;;;;GAI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E,oBAAoB,CAAC;IAChC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * Approve tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface ApproveToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Continue conversation request.\n */\nexport interface ContinueConversationRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The visitor's next message.\n */\n message: string;\n}\n\n/**\n * Create conversation request. The session, tenant, subject, secrets, labels,\n * and pinned parameters all come from the presenting token's session — the\n * browser asserts nothing.\n */\nexport interface CreateConversationRequest {\n /**\n * The visitor's opening message.\n */\n message: string;\n}\n\n/**\n * Deny tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface DenyToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\n/**\n * Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.\n */\nexport type GoogleProtobufValue = unknown;\n\n/**\n * List conversation events response. Ordered oldest first.\n */\nexport interface ListConversationEventsResponse {\n items?: Array<WidgetEvent>;\n pagination?: Page;\n}\n\n/**\n * List conversations response. Ordered by last activity, newest first.\n */\nexport interface ListConversationsResponse {\n items?: Array<WidgetConversation>;\n pagination?: Page;\n}\n\n/**\n * Page carries pagination data for list responses. A deliberate local\n * duplicate of the api module's Page — this package imports nothing from\n * cadenya.api.v1 (see the workspace README).\n */\nexport interface Page {\n /**\n * Cursor for the next page. Empty when there are no further results.\n */\n nextCursor?: string;\n /**\n * Total number of items matching the request.\n */\n total?: number;\n}\n\n/**\n * Set tool call content request. Lets the embedding page supply the result\n * of a bare tool call (one whose tool set has no execution adapter) — the\n * widget-session flavor of the reverse-harness pattern, where client-side\n * logic executes the tool and reports the result back. The result then\n * reaches the conversation as a toolResult event.\n */\nexport interface SetToolCallContentRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The bare tool call to supply content for.\n */\n toolCallId?: string;\n /**\n * The tool call's result content.\n */\n content: string;\n}\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<GoogleProtobufAny>;\n}\n\n/**\n * Submit conversation feedback request — the visitor's rating of a\n * conversation, mirroring internal objective feedback in slimmed form. Flows\n * into the same feedback machinery that scores agent variations.\n */\nexport interface SubmitConversationFeedbackRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * A score between -1.0 and 1.0. -1.0 is the worst, 0.0 neutral, 1.0 the\n * best — a thumbs-down/up UI maps to -1.0/1.0.\n */\n score: number;\n /**\n * Optional comment explaining the feedback.\n */\n comment?: string;\n}\n\n/**\n * WidgetAssistantMessageEvent is a message from the agent. Content may\n * arrive incrementally: later events for the same turn replace earlier\n * partial content.\n */\nexport interface WidgetAssistantMessageEvent {\n content: string;\n}\n\n/**\n * WidgetCancelledEvent: the conversation was cancelled. Terminal.\n */\nexport interface WidgetCancelledEvent {\n}\n\n/**\n * WidgetConfig is the widget's presentation configuration, served to the\n * browser before any session exists. Contains nothing sensitive: the widget\n * is identified by the hostname, and the edge has already enforced the\n * origin allowlist by the time this is served.\n */\nexport interface WidgetConfig {\n /**\n * Display name shown in the widget header.\n */\n displayName: string;\n}\n\nexport type WidgetConversationState = 'STATE_UNSPECIFIED' | 'STATE_RESPONDING' | 'STATE_OPEN' | 'STATE_CLOSED';\n\n/**\n * WidgetConversation is one conversation between the session's visitor and\n * the widget's agent. Conversations are scoped by the presenting token to the\n * VISITOR: a session with a subject sees that subject's conversations on this\n * widget; a session without one sees only the conversations it created\n * itself. A conversation id from outside that scope is indistinguishable from\n * one that does not exist. Tenant is a management-side grouping only — it is\n * never a read scope on this surface.\n */\nexport interface WidgetConversation {\n id: string;\n state: WidgetConversationState;\n /**\n * Server-derived display title (e.g. from the opening message).\n */\n title?: string;\n createdAt: string;\n /**\n * When the conversation last saw a message or event.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetErrorEvent reports a visitor-safe conversation error. The message is\n * sanitized; internal error detail never reaches the widget.\n */\nexport interface WidgetErrorEvent {\n message: string;\n}\n\n/**\n * WidgetEvent is the visitor-facing event vocabulary. It MIRRORS the internal\n * conversation event variants — same granularity, same discriminator names —\n * with slimmed messages holding exactly what a widget UI needs. Internal\n * events map to these through an explicit, exhaustive server-side projection;\n * internal-only types (context compaction, memory reads, sub-agent\n * bookkeeping) have no widget variant and are dropped. Nothing here carries\n * tool configuration, tool arguments, server identities, operator details,\n * or internal error strings.\n */\nexport type WidgetEvent =\n | WidgetEvent_UserMessage\n | WidgetEvent_AssistantMessage\n | WidgetEvent_ToolApprovalRequested\n | WidgetEvent_ToolApproved\n | WidgetEvent_ToolDenied\n | WidgetEvent_ToolCalled\n | WidgetEvent_ToolResult\n | WidgetEvent_ToolError\n | WidgetEvent_Error\n | WidgetEvent_Cancelled\n | WidgetEvent_TimedOut;\n\n/**\n * WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.\n * (There is no finalized variant: agents with structured output — the only\n * path to finalization — cannot be bound to widgets.)\n */\nexport interface WidgetTimedOutEvent {\n}\n\n/**\n * WidgetToolApprovalRequestedEvent asks the visitor to approve or deny a\n * tool call before it runs. The tool reference lets the embedding UI render\n * a custom approval experience per tool; the visitor responds via the\n * approve/deny endpoints.\n */\nexport interface WidgetToolApprovalRequestedEvent {\n /**\n * The tool call awaiting a decision; pass it to the approve/deny endpoint.\n */\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolApprovedEvent records that the pending tool call was approved.\n */\nexport interface WidgetToolApprovedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolCalledEvent reports that the agent invoked a tool. Arguments are\n * never included.\n */\nexport interface WidgetToolCalledEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolDeniedEvent records that the pending tool call was denied.\n */\nexport interface WidgetToolDeniedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolErrorEvent reports that a tool call failed. Internal error\n * detail never reaches the widget.\n */\nexport interface WidgetToolErrorEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolReference identifies the tool involved in a tool event — enough\n * for the embedding UI to label the activity and to register custom\n * renderers keyed by the tool's id or the customer's own external id.\n * Deliberately omitted: tool configuration, adapter details, and any server\n * identity.\n */\nexport interface WidgetToolReference {\n /**\n * Cadenya's canonical tool id.\n */\n id: string;\n /**\n * The tool's external id in the customer's namespace, when set.\n */\n externalId?: string;\n /**\n * The tool's name as the workspace configured it (e.g. \"FetchOrderDetails\").\n */\n name: string;\n}\n\n/**\n * WidgetToolResultEvent reports that a tool call finished. Result content is\n * omitted by default and included only for tools the workspace has opted in\n * to sharing content with widget sessions.\n */\nexport interface WidgetToolResultEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The tool's result, present only for tools opted in to sharing content\n * with widget sessions (a per-tool setting; default off). Arbitrary JSON\n * the embedding UI may render — chart data, cards, structured results.\n */\n content?: GoogleProtobufValue;\n}\n\n/**\n * WidgetUserMessageEvent is a message from the visitor.\n */\nexport interface WidgetUserMessageEvent {\n content: string;\n}\n\nexport interface WidgetEvent_UserMessage {\n type: 'userMessage';\n userMessage: WidgetUserMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: WidgetAssistantMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: WidgetToolApprovalRequestedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApproved {\n type: 'toolApproved';\n toolApproved: WidgetToolApprovedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolDenied {\n type: 'toolDenied';\n toolDenied: WidgetToolDeniedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolCalled {\n type: 'toolCalled';\n toolCalled: WidgetToolCalledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolResult {\n type: 'toolResult';\n toolResult: WidgetToolResultEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolError {\n type: 'toolError';\n toolError: WidgetToolErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Error {\n type: 'error';\n error: WidgetErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Cancelled {\n type: 'cancelled';\n cancelled: WidgetCancelledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_TimedOut {\n type: 'timedOut';\n timedOut: WidgetTimedOutEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C","sourcesContent":["// Generated by redwood. Do not edit by hand.\n\n/**\n * Approve tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface ApproveToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Continue conversation request.\n */\nexport interface ContinueConversationRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The visitor's next message.\n */\n message: string;\n}\n\n/**\n * Create conversation request. The session, tenant, subject, secrets, labels,\n * and pinned parameters all come from the presenting token's session — the\n * browser asserts nothing.\n */\nexport interface CreateConversationRequest {\n /**\n * The visitor's opening message.\n */\n message: string;\n}\n\n/**\n * Deny tool call request. Responds to a toolApprovalRequested event.\n */\nexport interface DenyToolCallRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The tool call awaiting a decision, from the toolApprovalRequested event.\n */\n toolCallId?: string;\n}\n\n/**\n * Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.\n */\nexport interface GoogleProtobufAny {\n /**\n * The type of the serialized message.\n */\n '@type'?: string;\n}\n\n/**\n * Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values.\n */\nexport type GoogleProtobufValue = unknown;\n\n/**\n * List conversation events response. Ordered oldest first.\n */\nexport interface ListConversationEventsResponse {\n items?: Array<WidgetEvent>;\n pagination?: Page;\n}\n\n/**\n * List conversations response. Ordered by last activity, newest first.\n */\nexport interface ListConversationsResponse {\n items?: Array<WidgetConversation>;\n pagination?: Page;\n}\n\n/**\n * Page carries pagination data for list responses. A deliberate local\n * duplicate of the api module's Page — this package imports nothing from\n * cadenya.api.v1 (see the workspace README).\n */\nexport interface Page {\n /**\n * Cursor for the next page. Empty when there are no further results.\n */\n nextCursor?: string;\n /**\n * Total number of items matching the request.\n */\n total?: number;\n}\n\n/**\n * Set tool call content request. Lets the embedding page supply the result\n * of a bare tool call (one whose tool set has no execution adapter) — the\n * widget-session flavor of the reverse-harness pattern, where client-side\n * logic executes the tool and reports the result back. The result then\n * reaches the conversation as a toolResult event.\n */\nexport interface SetToolCallContentRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * The bare tool call to supply content for.\n */\n toolCallId?: string;\n /**\n * The tool call's result content.\n */\n content: string;\n}\n\n/**\n * The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).\n */\nexport interface Status {\n /**\n * The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].\n */\n code?: number;\n /**\n * A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.\n */\n message?: string;\n /**\n * A list of messages that carry the error details. There is a common set of message types for APIs to use.\n */\n details?: Array<GoogleProtobufAny>;\n}\n\n/**\n * Submit conversation feedback request — the visitor's rating of a\n * conversation, mirroring internal objective feedback in slimmed form. Flows\n * into the same feedback machinery that scores agent variations.\n */\nexport interface SubmitConversationFeedbackRequest {\n /**\n * Conversation ID.\n */\n id?: string;\n /**\n * A score between -1.0 and 1.0. -1.0 is the worst, 0.0 neutral, 1.0 the\n * best — a thumbs-down/up UI maps to -1.0/1.0.\n */\n score: number;\n /**\n * Optional comment explaining the feedback.\n */\n comment?: string;\n}\n\n/**\n * WidgetAssistantMessageEvent is a message from the agent. Content may\n * arrive incrementally: later events for the same turn replace earlier\n * partial content.\n */\nexport interface WidgetAssistantMessageEvent {\n content: string;\n}\n\n/**\n * WidgetCancelledEvent: the conversation was cancelled. Terminal.\n */\nexport interface WidgetCancelledEvent {\n}\n\n/**\n * WidgetConfig is the widget's presentation configuration, served to the\n * browser before any session exists. Contains nothing sensitive: the widget\n * is identified by the hostname, and the edge has already enforced the\n * origin allowlist by the time this is served.\n */\nexport interface WidgetConfig {\n /**\n * Display name shown in the widget header.\n */\n displayName: string;\n}\n\nexport type WidgetConversationState = 'STATE_UNSPECIFIED' | 'STATE_RESPONDING' | 'STATE_OPEN' | 'STATE_CLOSED';\n\n/**\n * WidgetConversation is one conversation between the session's visitor and\n * the widget's agent. Conversations are scoped by the presenting token to the\n * VISITOR: a session with a subject sees that subject's conversations on this\n * widget; a session without one sees only the conversations it created\n * itself. A conversation id from outside that scope is indistinguishable from\n * one that does not exist. Tenant is a management-side grouping only — it is\n * never a read scope on this surface.\n */\nexport interface WidgetConversation {\n id: string;\n state: WidgetConversationState;\n /**\n * Server-derived display title (e.g. from the opening message).\n */\n title?: string;\n createdAt: string;\n /**\n * When the conversation last saw a message or event.\n */\n lastActiveAt?: string;\n}\n\n/**\n * WidgetErrorEvent reports a visitor-safe conversation error. The message is\n * sanitized; internal error detail never reaches the widget.\n */\nexport interface WidgetErrorEvent {\n message: string;\n}\n\n/**\n * WidgetEvent is the visitor-facing event vocabulary. It MIRRORS the internal\n * conversation event variants — same granularity, same discriminator names —\n * with slimmed messages holding exactly what a widget UI needs. Internal\n * events map to these through an explicit, exhaustive server-side projection;\n * internal-only types (context compaction, memory reads, sub-agent\n * bookkeeping) have no widget variant and are dropped. Nothing here carries\n * tool configuration, server identities, operator details, or internal error\n * strings. Tool arguments cross this boundary only when an enabled tool set\n * overlay explicitly opts the matching tool in.\n */\nexport type WidgetEvent =\n | WidgetEvent_UserMessage\n | WidgetEvent_AssistantMessage\n | WidgetEvent_ToolApprovalRequested\n | WidgetEvent_ToolApproved\n | WidgetEvent_ToolDenied\n | WidgetEvent_ToolCalled\n | WidgetEvent_ToolResult\n | WidgetEvent_ToolError\n | WidgetEvent_Error\n | WidgetEvent_Cancelled\n | WidgetEvent_TimedOut\n | WidgetEvent_Finalized;\n\n/**\n * WidgetFinalizedEvent: the conversation's agent produced its structured\n * output and the objective reached its terminal state. Only agents with an\n * output definition finalize — such an agent ends the conversation after one\n * turn, so a widget bound to one should treat this as the answer, not a\n * message to keep chatting past.\n */\nexport interface WidgetFinalizedEvent {\n /**\n * The structured output the agent produced, matching the shape of the\n * agent's output definition schema.\n */\n output?: Record<string, unknown>;\n}\n\n/**\n * WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.\n */\nexport interface WidgetTimedOutEvent {\n}\n\n/**\n * WidgetToolApprovalRequestedEvent asks the visitor to approve or deny a\n * tool call before it runs. The tool reference lets the embedding UI render\n * a custom approval experience per tool; the visitor responds via the\n * approve/deny endpoints.\n */\nexport interface WidgetToolApprovalRequestedEvent {\n /**\n * The tool call awaiting a decision; pass it to the approve/deny endpoint.\n */\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolApprovedEvent records that the pending tool call was approved.\n */\nexport interface WidgetToolApprovedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolCalledEvent reports that the agent invoked a tool.\n */\nexport interface WidgetToolCalledEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The final arguments sent to the tool, after parameter actions were\n * applied. Present only when an enabled matching tool set overlay opts the\n * tool into exposing arguments in widget sessions. Arguments are omitted\n * by default because they may contain sensitive customer data.\n */\n arguments?: Record<string, unknown>;\n}\n\n/**\n * WidgetToolDeniedEvent records that the pending tool call was denied.\n */\nexport interface WidgetToolDeniedEvent {\n toolCallId: string;\n}\n\n/**\n * WidgetToolErrorEvent reports that a tool call failed. Internal error\n * detail never reaches the widget.\n */\nexport interface WidgetToolErrorEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n}\n\n/**\n * WidgetToolReference identifies the tool involved in a tool event — enough\n * for the embedding UI to label the activity and to register custom\n * renderers keyed by the tool's id or the customer's own external id.\n * Deliberately omitted: tool configuration, adapter details, and any server\n * identity.\n */\nexport interface WidgetToolReference {\n /**\n * Cadenya's canonical tool id.\n */\n id: string;\n /**\n * The tool's external id in the customer's namespace, when set.\n */\n externalId?: string;\n /**\n * The tool's name as the workspace configured it (e.g. \"FetchOrderDetails\").\n */\n name: string;\n}\n\n/**\n * WidgetToolResultEvent reports that a tool call finished. Result content is\n * omitted by default and included only for tools the workspace has opted in\n * to sharing content with widget sessions.\n */\nexport interface WidgetToolResultEvent {\n toolCallId: string;\n tool: WidgetToolReference;\n /**\n * The tool's result, present only for tools opted in to sharing content\n * with widget sessions (a per-tool setting; default off). Arbitrary JSON\n * the embedding UI may render — chart data, cards, structured results.\n */\n content?: GoogleProtobufValue;\n}\n\n/**\n * WidgetUserMessageEvent is a message from the visitor.\n */\nexport interface WidgetUserMessageEvent {\n content: string;\n}\n\nexport interface WidgetEvent_UserMessage {\n type: 'userMessage';\n userMessage: WidgetUserMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_AssistantMessage {\n type: 'assistantMessage';\n assistantMessage: WidgetAssistantMessageEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApprovalRequested {\n type: 'toolApprovalRequested';\n toolApprovalRequested: WidgetToolApprovalRequestedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolApproved {\n type: 'toolApproved';\n toolApproved: WidgetToolApprovedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolDenied {\n type: 'toolDenied';\n toolDenied: WidgetToolDeniedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolCalled {\n type: 'toolCalled';\n toolCalled: WidgetToolCalledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolResult {\n type: 'toolResult';\n toolResult: WidgetToolResultEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_ToolError {\n type: 'toolError';\n toolError: WidgetToolErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Error {\n type: 'error';\n error: WidgetErrorEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Cancelled {\n type: 'cancelled';\n cancelled: WidgetCancelledEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_TimedOut {\n type: 'timedOut';\n timedOut: WidgetTimedOutEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\nexport interface WidgetEvent_Finalized {\n type: 'finalized';\n finalized: WidgetFinalizedEvent;\n /**\n * Unique event id (ULID). Doubles as the SSE `id:` — replay it as\n * `Last-Event-ID` on reconnect to resume without duplication.\n */\n id: string;\n /**\n * The conversation this event belongs to.\n */\n conversationId: string;\n createdAt: string;\n}\n\n"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cadenya/widgets",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "The official TypeScript SDK for the CadenyaWidgets API",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"publishConfig": { "access": "public" },
|
|
17
|
+
"repository": { "type": "git", "url": "https://github.com/cadenya/widgets-sdk" },
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=18"
|
|
19
20
|
},
|
package/src/client.ts
CHANGED
|
@@ -49,7 +49,7 @@ export class CadenyaWidgets {
|
|
|
49
49
|
authHeader: () => ({ Authorization: `Bearer ${apiKey}` }),
|
|
50
50
|
maxRetries: options.maxRetries ?? 0,
|
|
51
51
|
timeout: options.timeout,
|
|
52
|
-
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.
|
|
52
|
+
defaultHeaders: { 'User-Agent': 'cadenyawidgets-typescript/1.1.0 (api 1.0)', ...options.defaultHeaders },
|
|
53
53
|
fetch: options.fetch,
|
|
54
54
|
logger: options.logger,
|
|
55
55
|
logLevel: options.logLevel,
|
package/src/types.ts
CHANGED
|
@@ -230,8 +230,9 @@ export interface WidgetErrorEvent {
|
|
|
230
230
|
* events map to these through an explicit, exhaustive server-side projection;
|
|
231
231
|
* internal-only types (context compaction, memory reads, sub-agent
|
|
232
232
|
* bookkeeping) have no widget variant and are dropped. Nothing here carries
|
|
233
|
-
* tool configuration,
|
|
234
|
-
*
|
|
233
|
+
* tool configuration, server identities, operator details, or internal error
|
|
234
|
+
* strings. Tool arguments cross this boundary only when an enabled tool set
|
|
235
|
+
* overlay explicitly opts the matching tool in.
|
|
235
236
|
*/
|
|
236
237
|
export type WidgetEvent =
|
|
237
238
|
| WidgetEvent_UserMessage
|
|
@@ -244,12 +245,26 @@ export type WidgetEvent =
|
|
|
244
245
|
| WidgetEvent_ToolError
|
|
245
246
|
| WidgetEvent_Error
|
|
246
247
|
| WidgetEvent_Cancelled
|
|
247
|
-
| WidgetEvent_TimedOut
|
|
248
|
+
| WidgetEvent_TimedOut
|
|
249
|
+
| WidgetEvent_Finalized;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* WidgetFinalizedEvent: the conversation's agent produced its structured
|
|
253
|
+
* output and the objective reached its terminal state. Only agents with an
|
|
254
|
+
* output definition finalize — such an agent ends the conversation after one
|
|
255
|
+
* turn, so a widget bound to one should treat this as the answer, not a
|
|
256
|
+
* message to keep chatting past.
|
|
257
|
+
*/
|
|
258
|
+
export interface WidgetFinalizedEvent {
|
|
259
|
+
/**
|
|
260
|
+
* The structured output the agent produced, matching the shape of the
|
|
261
|
+
* agent's output definition schema.
|
|
262
|
+
*/
|
|
263
|
+
output?: Record<string, unknown>;
|
|
264
|
+
}
|
|
248
265
|
|
|
249
266
|
/**
|
|
250
267
|
* WidgetTimedOutEvent: the conversation timed out after inactivity. Terminal.
|
|
251
|
-
* (There is no finalized variant: agents with structured output — the only
|
|
252
|
-
* path to finalization — cannot be bound to widgets.)
|
|
253
268
|
*/
|
|
254
269
|
export interface WidgetTimedOutEvent {
|
|
255
270
|
}
|
|
@@ -276,12 +291,18 @@ export interface WidgetToolApprovedEvent {
|
|
|
276
291
|
}
|
|
277
292
|
|
|
278
293
|
/**
|
|
279
|
-
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
280
|
-
* never included.
|
|
294
|
+
* WidgetToolCalledEvent reports that the agent invoked a tool.
|
|
281
295
|
*/
|
|
282
296
|
export interface WidgetToolCalledEvent {
|
|
283
297
|
toolCallId: string;
|
|
284
298
|
tool: WidgetToolReference;
|
|
299
|
+
/**
|
|
300
|
+
* The final arguments sent to the tool, after parameter actions were
|
|
301
|
+
* applied. Present only when an enabled matching tool set overlay opts the
|
|
302
|
+
* tool into exposing arguments in widget sessions. Arguments are omitted
|
|
303
|
+
* by default because they may contain sensitive customer data.
|
|
304
|
+
*/
|
|
305
|
+
arguments?: Record<string, unknown>;
|
|
285
306
|
}
|
|
286
307
|
|
|
287
308
|
/**
|
|
@@ -510,3 +531,18 @@ export interface WidgetEvent_TimedOut {
|
|
|
510
531
|
createdAt: string;
|
|
511
532
|
}
|
|
512
533
|
|
|
534
|
+
export interface WidgetEvent_Finalized {
|
|
535
|
+
type: 'finalized';
|
|
536
|
+
finalized: WidgetFinalizedEvent;
|
|
537
|
+
/**
|
|
538
|
+
* Unique event id (ULID). Doubles as the SSE `id:` — replay it as
|
|
539
|
+
* `Last-Event-ID` on reconnect to resume without duplication.
|
|
540
|
+
*/
|
|
541
|
+
id: string;
|
|
542
|
+
/**
|
|
543
|
+
* The conversation this event belongs to.
|
|
544
|
+
*/
|
|
545
|
+
conversationId: string;
|
|
546
|
+
createdAt: string;
|
|
547
|
+
}
|
|
548
|
+
|