@caitlyn-ai/sdk 0.0.0-stage → 0.0.1

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 (45) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +164 -2
  4. package/dist-browser/sdk/index.mjs +1923 -0
  5. package/dist-browser/sdk/index.mjs.map +7 -0
  6. package/dist-cjs/sdk/index.cjs +1974 -0
  7. package/dist-cjs/sdk/index.cjs.map +7 -0
  8. package/dist-es/sdk/index.mjs +1925 -0
  9. package/dist-es/sdk/index.mjs.map +7 -0
  10. package/dist-types/Caitlyn.d.ts +76 -0
  11. package/dist-types/CaitlynClient.d.ts +160 -0
  12. package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  13. package/dist-types/auth/httpAuthSchemeProvider.d.ts +81 -0
  14. package/dist-types/commandBuilder.d.ts +18 -0
  15. package/dist-types/commands/CreateDocumentCommand.d.ts +190 -0
  16. package/dist-types/commands/CreateUploadCommand.d.ts +165 -0
  17. package/dist-types/commands/GetAgentVersionCommand.d.ts +177 -0
  18. package/dist-types/commands/ListDocumentsCommand.d.ts +176 -0
  19. package/dist-types/commands/ResumeConversationStreamCommand.d.ts +146 -0
  20. package/dist-types/commands/SendMessageCommand.d.ts +183 -0
  21. package/dist-types/commands/UpdateDraftVersionCommand.d.ts +202 -0
  22. package/dist-types/commands/index.d.ts +7 -0
  23. package/dist-types/endpoint/EndpointParameters.d.ts +32 -0
  24. package/dist-types/endpoint/bdd.d.ts +2 -0
  25. package/dist-types/endpoint/endpointResolver.d.ts +8 -0
  26. package/dist-types/extensionConfiguration.d.ts +8 -0
  27. package/dist-types/index.d.ts +22 -0
  28. package/dist-types/models/CaitlynServiceException.d.ts +15 -0
  29. package/dist-types/models/enums.d.ts +148 -0
  30. package/dist-types/models/errors.d.ts +659 -0
  31. package/dist-types/models/models_0.d.ts +754 -0
  32. package/dist-types/pagination/Interfaces.d.ts +8 -0
  33. package/dist-types/pagination/ListDocumentsPaginator.d.ts +7 -0
  34. package/dist-types/pagination/index.d.ts +2 -0
  35. package/dist-types/runtimeConfig.browser.d.ts +50 -0
  36. package/dist-types/runtimeConfig.d.ts +50 -0
  37. package/dist-types/runtimeConfig.native.d.ts +49 -0
  38. package/dist-types/runtimeConfig.shared.d.ts +36 -0
  39. package/dist-types/runtimeExtensions.d.ts +17 -0
  40. package/dist-types/schemas/schemas_0.d.ts +51 -0
  41. package/dist-types/sdk/client.d.ts +47 -0
  42. package/dist-types/sdk/events.d.ts +163 -0
  43. package/dist-types/sdk/index.d.ts +8 -0
  44. package/dist-types/sdk/operations.d.ts +70 -0
  45. package/package.json +49 -5
@@ -0,0 +1,1974 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/sdk/src/sdk/index.ts
21
+ var sdk_exports = {};
22
+ __export(sdk_exports, {
23
+ Caitlyn: () => Caitlyn,
24
+ CaitlynAuthError: () => import_sdk_core5.CaitlynAuthError,
25
+ CaitlynError: () => CaitlynServiceException,
26
+ ClearableDraftField: () => ClearableDraftField,
27
+ ConflictError: () => ConflictError,
28
+ ConversationEventNames: () => ConversationEventNames,
29
+ DocumentStatus: () => DocumentStatus,
30
+ InternalError: () => InternalError,
31
+ NotFoundError: () => NotFoundError,
32
+ NotSupportedByServer: () => import_sdk_core5.NotSupportedByServer,
33
+ OperationKind: () => OperationKind,
34
+ OperationStatus: () => OperationStatus,
35
+ PayloadTooLargeError: () => PayloadTooLargeError,
36
+ PermissionDeniedError: () => PermissionDeniedError,
37
+ PreconditionFailedError: () => PreconditionFailedError,
38
+ PreconditionRequiredError: () => PreconditionRequiredError,
39
+ ServiceUnavailableError: () => ServiceUnavailableError,
40
+ SseStream: () => import_sdk_core5.SseStream,
41
+ TooManyRequestsError: () => TooManyRequestsError,
42
+ UnauthenticatedError: () => UnauthenticatedError,
43
+ UnprocessableContentError: () => UnprocessableContentError,
44
+ UploadStatus: () => UploadStatus,
45
+ ValidationError: () => ValidationError,
46
+ VersionSource: () => VersionSource,
47
+ WaiterError: () => import_sdk_core5.WaiterError,
48
+ createAuth: () => import_sdk_core5.createAuth,
49
+ createCaitlynClient: () => createCaitlynClient,
50
+ createDocument: () => createDocument,
51
+ createUpload: () => createUpload,
52
+ createUploadFromFile: () => createUploadFromFile,
53
+ getAgentVersion: () => getAgentVersion,
54
+ listDocuments: () => listDocuments,
55
+ resumeConversationStream: () => resumeConversationStream,
56
+ sendMessage: () => sendMessage,
57
+ updateDraftVersion: () => updateDraftVersion,
58
+ uploadDocument: () => uploadDocument,
59
+ workspaceAudience: () => import_sdk_core5.workspaceAudience
60
+ });
61
+ module.exports = __toCommonJS(sdk_exports);
62
+
63
+ // packages/sdk/src/CaitlynClient.ts
64
+ var import_sdk_core2 = require("@caitlyn-ai/sdk-core");
65
+ var import_core3 = require("@smithy/core");
66
+ var import_client6 = require("@smithy/core/client");
67
+ var import_endpoints = require("@smithy/core/endpoints");
68
+ var import_protocols3 = require("@smithy/core/protocols");
69
+ var import_retry = require("@smithy/core/retry");
70
+ var import_schema2 = require("@smithy/core/schema");
71
+
72
+ // packages/sdk/src/auth/httpAuthSchemeProvider.ts
73
+ var import_core = require("@smithy/core");
74
+ var import_client = require("@smithy/core/client");
75
+ var defaultCaitlynHttpAuthSchemeParametersProvider = async (config, context, input) => {
76
+ return {
77
+ operation: (0, import_client.getSmithyContext)(context).operation
78
+ };
79
+ };
80
+ function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
81
+ return {
82
+ schemeId: "smithy.api#httpBearerAuth"
83
+ };
84
+ }
85
+ var defaultCaitlynHttpAuthSchemeProvider = (authParameters) => {
86
+ const options = [];
87
+ switch (authParameters.operation) {
88
+ default: {
89
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
90
+ }
91
+ }
92
+ return options;
93
+ };
94
+ var resolveHttpAuthSchemeConfig = (config) => {
95
+ const token = (0, import_core.memoizeIdentityProvider)(config.token, import_core.isIdentityExpired, import_core.doesIdentityRequireRefresh);
96
+ return Object.assign(config, {
97
+ authSchemePreference: (0, import_client.normalizeProvider)(config.authSchemePreference ?? []),
98
+ token
99
+ });
100
+ };
101
+
102
+ // packages/sdk/src/endpoint/EndpointParameters.ts
103
+ var resolveClientEndpointParameters = (options) => {
104
+ return Object.assign(options, {
105
+ defaultSigningName: ""
106
+ });
107
+ };
108
+ var commonParams = {
109
+ endpoint: { type: "builtInParams", name: "endpoint" }
110
+ };
111
+
112
+ // packages/sdk/src/runtimeConfig.ts
113
+ var import_client4 = require("@smithy/core/client");
114
+ var import_serde2 = require("@smithy/core/serde");
115
+ var import_node_http_handler = require("@smithy/node-http-handler");
116
+
117
+ // packages/sdk/src/runtimeConfig.shared.ts
118
+ var import_sdk_core = require("@caitlyn-ai/sdk-core");
119
+ var import_core2 = require("@smithy/core");
120
+ var import_client3 = require("@smithy/core/client");
121
+ var import_protocols = require("@smithy/core/protocols");
122
+ var import_serde = require("@smithy/core/serde");
123
+
124
+ // packages/sdk/src/schemas/schemas_0.ts
125
+ var import_schema = require("@smithy/core/schema");
126
+
127
+ // packages/sdk/src/models/CaitlynServiceException.ts
128
+ var import_client2 = require("@smithy/core/client");
129
+ var CaitlynServiceException = class _CaitlynServiceException extends import_client2.ServiceException {
130
+ static shapeId = "smithy.ts.sdk.synthetic.ai.caitlyn.v3#CaitlynServiceException";
131
+ /**
132
+ * @internal
133
+ */
134
+ constructor(options) {
135
+ super(options);
136
+ Object.setPrototypeOf(this, _CaitlynServiceException.prototype);
137
+ }
138
+ };
139
+
140
+ // packages/sdk/src/models/errors.ts
141
+ var InternalError = class _InternalError extends CaitlynServiceException {
142
+ static shapeId = "ai.caitlyn.v3#InternalError";
143
+ name = "InternalError";
144
+ $fault = "server";
145
+ /**
146
+ * A stable URI for the code: its page in the public error reference,
147
+ * `https://build.caitlyn.ai/errors/\{code\}`.
148
+ * @public
149
+ */
150
+ type;
151
+ /**
152
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
153
+ * @public
154
+ */
155
+ title;
156
+ /**
157
+ * The HTTP status code, repeated from the response.
158
+ * @public
159
+ */
160
+ status;
161
+ /**
162
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
163
+ * renamed; callers match on it.
164
+ * @public
165
+ */
166
+ code;
167
+ /**
168
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
169
+ * storage keys or another person's data.
170
+ * @public
171
+ */
172
+ detail;
173
+ /**
174
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
175
+ * support.
176
+ * @public
177
+ */
178
+ requestId;
179
+ /**
180
+ * Field-level problems, one per member or parameter at fault. Present only on 400
181
+ * `VALIDATION_FAILED`.
182
+ * @public
183
+ */
184
+ errors;
185
+ /**
186
+ * @internal
187
+ */
188
+ constructor(opts) {
189
+ super({
190
+ name: "InternalError",
191
+ $fault: "server",
192
+ ...opts
193
+ });
194
+ Object.setPrototypeOf(this, _InternalError.prototype);
195
+ this.type = opts.type;
196
+ this.title = opts.title;
197
+ this.status = opts.status;
198
+ this.code = opts.code;
199
+ this.detail = opts.detail;
200
+ this.requestId = opts.requestId;
201
+ this.errors = opts.errors;
202
+ }
203
+ };
204
+ var NotFoundError = class _NotFoundError extends CaitlynServiceException {
205
+ static shapeId = "ai.caitlyn.v3#NotFoundError";
206
+ name = "NotFoundError";
207
+ $fault = "client";
208
+ /**
209
+ * A stable URI for the code: its page in the public error reference,
210
+ * `https://build.caitlyn.ai/errors/\{code\}`.
211
+ * @public
212
+ */
213
+ type;
214
+ /**
215
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
216
+ * @public
217
+ */
218
+ title;
219
+ /**
220
+ * The HTTP status code, repeated from the response.
221
+ * @public
222
+ */
223
+ status;
224
+ /**
225
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
226
+ * renamed; callers match on it.
227
+ * @public
228
+ */
229
+ code;
230
+ /**
231
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
232
+ * storage keys or another person's data.
233
+ * @public
234
+ */
235
+ detail;
236
+ /**
237
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
238
+ * support.
239
+ * @public
240
+ */
241
+ requestId;
242
+ /**
243
+ * Field-level problems, one per member or parameter at fault. Present only on 400
244
+ * `VALIDATION_FAILED`.
245
+ * @public
246
+ */
247
+ errors;
248
+ /**
249
+ * @internal
250
+ */
251
+ constructor(opts) {
252
+ super({
253
+ name: "NotFoundError",
254
+ $fault: "client",
255
+ ...opts
256
+ });
257
+ Object.setPrototypeOf(this, _NotFoundError.prototype);
258
+ this.type = opts.type;
259
+ this.title = opts.title;
260
+ this.status = opts.status;
261
+ this.code = opts.code;
262
+ this.detail = opts.detail;
263
+ this.requestId = opts.requestId;
264
+ this.errors = opts.errors;
265
+ }
266
+ };
267
+ var PermissionDeniedError = class _PermissionDeniedError extends CaitlynServiceException {
268
+ static shapeId = "ai.caitlyn.v3#PermissionDeniedError";
269
+ name = "PermissionDeniedError";
270
+ $fault = "client";
271
+ /**
272
+ * A stable URI for the code: its page in the public error reference,
273
+ * `https://build.caitlyn.ai/errors/\{code\}`.
274
+ * @public
275
+ */
276
+ type;
277
+ /**
278
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
279
+ * @public
280
+ */
281
+ title;
282
+ /**
283
+ * The HTTP status code, repeated from the response.
284
+ * @public
285
+ */
286
+ status;
287
+ /**
288
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
289
+ * renamed; callers match on it.
290
+ * @public
291
+ */
292
+ code;
293
+ /**
294
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
295
+ * storage keys or another person's data.
296
+ * @public
297
+ */
298
+ detail;
299
+ /**
300
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
301
+ * support.
302
+ * @public
303
+ */
304
+ requestId;
305
+ /**
306
+ * Field-level problems, one per member or parameter at fault. Present only on 400
307
+ * `VALIDATION_FAILED`.
308
+ * @public
309
+ */
310
+ errors;
311
+ /**
312
+ * @internal
313
+ */
314
+ constructor(opts) {
315
+ super({
316
+ name: "PermissionDeniedError",
317
+ $fault: "client",
318
+ ...opts
319
+ });
320
+ Object.setPrototypeOf(this, _PermissionDeniedError.prototype);
321
+ this.type = opts.type;
322
+ this.title = opts.title;
323
+ this.status = opts.status;
324
+ this.code = opts.code;
325
+ this.detail = opts.detail;
326
+ this.requestId = opts.requestId;
327
+ this.errors = opts.errors;
328
+ }
329
+ };
330
+ var PreconditionFailedError = class _PreconditionFailedError extends CaitlynServiceException {
331
+ static shapeId = "ai.caitlyn.v3#PreconditionFailedError";
332
+ name = "PreconditionFailedError";
333
+ $fault = "client";
334
+ /**
335
+ * A stable URI for the code: its page in the public error reference,
336
+ * `https://build.caitlyn.ai/errors/\{code\}`.
337
+ * @public
338
+ */
339
+ type;
340
+ /**
341
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
342
+ * @public
343
+ */
344
+ title;
345
+ /**
346
+ * The HTTP status code, repeated from the response.
347
+ * @public
348
+ */
349
+ status;
350
+ /**
351
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
352
+ * renamed; callers match on it.
353
+ * @public
354
+ */
355
+ code;
356
+ /**
357
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
358
+ * storage keys or another person's data.
359
+ * @public
360
+ */
361
+ detail;
362
+ /**
363
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
364
+ * support.
365
+ * @public
366
+ */
367
+ requestId;
368
+ /**
369
+ * Field-level problems, one per member or parameter at fault. Present only on 400
370
+ * `VALIDATION_FAILED`.
371
+ * @public
372
+ */
373
+ errors;
374
+ /**
375
+ * @internal
376
+ */
377
+ constructor(opts) {
378
+ super({
379
+ name: "PreconditionFailedError",
380
+ $fault: "client",
381
+ ...opts
382
+ });
383
+ Object.setPrototypeOf(this, _PreconditionFailedError.prototype);
384
+ this.type = opts.type;
385
+ this.title = opts.title;
386
+ this.status = opts.status;
387
+ this.code = opts.code;
388
+ this.detail = opts.detail;
389
+ this.requestId = opts.requestId;
390
+ this.errors = opts.errors;
391
+ }
392
+ };
393
+ var PreconditionRequiredError = class _PreconditionRequiredError extends CaitlynServiceException {
394
+ static shapeId = "ai.caitlyn.v3#PreconditionRequiredError";
395
+ name = "PreconditionRequiredError";
396
+ $fault = "client";
397
+ /**
398
+ * A stable URI for the code: its page in the public error reference,
399
+ * `https://build.caitlyn.ai/errors/\{code\}`.
400
+ * @public
401
+ */
402
+ type;
403
+ /**
404
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
405
+ * @public
406
+ */
407
+ title;
408
+ /**
409
+ * The HTTP status code, repeated from the response.
410
+ * @public
411
+ */
412
+ status;
413
+ /**
414
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
415
+ * renamed; callers match on it.
416
+ * @public
417
+ */
418
+ code;
419
+ /**
420
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
421
+ * storage keys or another person's data.
422
+ * @public
423
+ */
424
+ detail;
425
+ /**
426
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
427
+ * support.
428
+ * @public
429
+ */
430
+ requestId;
431
+ /**
432
+ * Field-level problems, one per member or parameter at fault. Present only on 400
433
+ * `VALIDATION_FAILED`.
434
+ * @public
435
+ */
436
+ errors;
437
+ /**
438
+ * @internal
439
+ */
440
+ constructor(opts) {
441
+ super({
442
+ name: "PreconditionRequiredError",
443
+ $fault: "client",
444
+ ...opts
445
+ });
446
+ Object.setPrototypeOf(this, _PreconditionRequiredError.prototype);
447
+ this.type = opts.type;
448
+ this.title = opts.title;
449
+ this.status = opts.status;
450
+ this.code = opts.code;
451
+ this.detail = opts.detail;
452
+ this.requestId = opts.requestId;
453
+ this.errors = opts.errors;
454
+ }
455
+ };
456
+ var ServiceUnavailableError = class _ServiceUnavailableError extends CaitlynServiceException {
457
+ static shapeId = "ai.caitlyn.v3#ServiceUnavailableError";
458
+ name = "ServiceUnavailableError";
459
+ $fault = "server";
460
+ $retryable = {};
461
+ /**
462
+ * A stable URI for the code: its page in the public error reference,
463
+ * `https://build.caitlyn.ai/errors/\{code\}`.
464
+ * @public
465
+ */
466
+ type;
467
+ /**
468
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
469
+ * @public
470
+ */
471
+ title;
472
+ /**
473
+ * The HTTP status code, repeated from the response.
474
+ * @public
475
+ */
476
+ status;
477
+ /**
478
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
479
+ * renamed; callers match on it.
480
+ * @public
481
+ */
482
+ code;
483
+ /**
484
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
485
+ * storage keys or another person's data.
486
+ * @public
487
+ */
488
+ detail;
489
+ /**
490
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
491
+ * support.
492
+ * @public
493
+ */
494
+ requestId;
495
+ /**
496
+ * Field-level problems, one per member or parameter at fault. Present only on 400
497
+ * `VALIDATION_FAILED`.
498
+ * @public
499
+ */
500
+ errors;
501
+ /**
502
+ * Seconds to wait before trying again, from the `Retry-After` header.
503
+ * @public
504
+ */
505
+ retryAfterSeconds;
506
+ /**
507
+ * @internal
508
+ */
509
+ constructor(opts) {
510
+ super({
511
+ name: "ServiceUnavailableError",
512
+ $fault: "server",
513
+ ...opts
514
+ });
515
+ Object.setPrototypeOf(this, _ServiceUnavailableError.prototype);
516
+ this.type = opts.type;
517
+ this.title = opts.title;
518
+ this.status = opts.status;
519
+ this.code = opts.code;
520
+ this.detail = opts.detail;
521
+ this.requestId = opts.requestId;
522
+ this.errors = opts.errors;
523
+ this.retryAfterSeconds = opts.retryAfterSeconds;
524
+ }
525
+ };
526
+ var TooManyRequestsError = class _TooManyRequestsError extends CaitlynServiceException {
527
+ static shapeId = "ai.caitlyn.v3#TooManyRequestsError";
528
+ name = "TooManyRequestsError";
529
+ $fault = "client";
530
+ $retryable = {
531
+ throttling: true
532
+ };
533
+ /**
534
+ * A stable URI for the code: its page in the public error reference,
535
+ * `https://build.caitlyn.ai/errors/\{code\}`.
536
+ * @public
537
+ */
538
+ type;
539
+ /**
540
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
541
+ * @public
542
+ */
543
+ title;
544
+ /**
545
+ * The HTTP status code, repeated from the response.
546
+ * @public
547
+ */
548
+ status;
549
+ /**
550
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
551
+ * renamed; callers match on it.
552
+ * @public
553
+ */
554
+ code;
555
+ /**
556
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
557
+ * storage keys or another person's data.
558
+ * @public
559
+ */
560
+ detail;
561
+ /**
562
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
563
+ * support.
564
+ * @public
565
+ */
566
+ requestId;
567
+ /**
568
+ * Field-level problems, one per member or parameter at fault. Present only on 400
569
+ * `VALIDATION_FAILED`.
570
+ * @public
571
+ */
572
+ errors;
573
+ /**
574
+ * Seconds to wait before trying again, from the `Retry-After` header.
575
+ * @public
576
+ */
577
+ retryAfterSeconds;
578
+ /**
579
+ * @internal
580
+ */
581
+ constructor(opts) {
582
+ super({
583
+ name: "TooManyRequestsError",
584
+ $fault: "client",
585
+ ...opts
586
+ });
587
+ Object.setPrototypeOf(this, _TooManyRequestsError.prototype);
588
+ this.type = opts.type;
589
+ this.title = opts.title;
590
+ this.status = opts.status;
591
+ this.code = opts.code;
592
+ this.detail = opts.detail;
593
+ this.requestId = opts.requestId;
594
+ this.errors = opts.errors;
595
+ this.retryAfterSeconds = opts.retryAfterSeconds;
596
+ }
597
+ };
598
+ var UnauthenticatedError = class _UnauthenticatedError extends CaitlynServiceException {
599
+ static shapeId = "ai.caitlyn.v3#UnauthenticatedError";
600
+ name = "UnauthenticatedError";
601
+ $fault = "client";
602
+ /**
603
+ * A stable URI for the code: its page in the public error reference,
604
+ * `https://build.caitlyn.ai/errors/\{code\}`.
605
+ * @public
606
+ */
607
+ type;
608
+ /**
609
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
610
+ * @public
611
+ */
612
+ title;
613
+ /**
614
+ * The HTTP status code, repeated from the response.
615
+ * @public
616
+ */
617
+ status;
618
+ /**
619
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
620
+ * renamed; callers match on it.
621
+ * @public
622
+ */
623
+ code;
624
+ /**
625
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
626
+ * storage keys or another person's data.
627
+ * @public
628
+ */
629
+ detail;
630
+ /**
631
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
632
+ * support.
633
+ * @public
634
+ */
635
+ requestId;
636
+ /**
637
+ * Field-level problems, one per member or parameter at fault. Present only on 400
638
+ * `VALIDATION_FAILED`.
639
+ * @public
640
+ */
641
+ errors;
642
+ /**
643
+ * @internal
644
+ */
645
+ constructor(opts) {
646
+ super({
647
+ name: "UnauthenticatedError",
648
+ $fault: "client",
649
+ ...opts
650
+ });
651
+ Object.setPrototypeOf(this, _UnauthenticatedError.prototype);
652
+ this.type = opts.type;
653
+ this.title = opts.title;
654
+ this.status = opts.status;
655
+ this.code = opts.code;
656
+ this.detail = opts.detail;
657
+ this.requestId = opts.requestId;
658
+ this.errors = opts.errors;
659
+ }
660
+ };
661
+ var ValidationError = class _ValidationError extends CaitlynServiceException {
662
+ static shapeId = "ai.caitlyn.v3#ValidationError";
663
+ name = "ValidationError";
664
+ $fault = "client";
665
+ /**
666
+ * A stable URI for the code: its page in the public error reference,
667
+ * `https://build.caitlyn.ai/errors/\{code\}`.
668
+ * @public
669
+ */
670
+ type;
671
+ /**
672
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
673
+ * @public
674
+ */
675
+ title;
676
+ /**
677
+ * The HTTP status code, repeated from the response.
678
+ * @public
679
+ */
680
+ status;
681
+ /**
682
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
683
+ * renamed; callers match on it.
684
+ * @public
685
+ */
686
+ code;
687
+ /**
688
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
689
+ * storage keys or another person's data.
690
+ * @public
691
+ */
692
+ detail;
693
+ /**
694
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
695
+ * support.
696
+ * @public
697
+ */
698
+ requestId;
699
+ /**
700
+ * Field-level problems, one per member or parameter at fault. Present only on 400
701
+ * `VALIDATION_FAILED`.
702
+ * @public
703
+ */
704
+ errors;
705
+ /**
706
+ * @internal
707
+ */
708
+ constructor(opts) {
709
+ super({
710
+ name: "ValidationError",
711
+ $fault: "client",
712
+ ...opts
713
+ });
714
+ Object.setPrototypeOf(this, _ValidationError.prototype);
715
+ this.type = opts.type;
716
+ this.title = opts.title;
717
+ this.status = opts.status;
718
+ this.code = opts.code;
719
+ this.detail = opts.detail;
720
+ this.requestId = opts.requestId;
721
+ this.errors = opts.errors;
722
+ }
723
+ };
724
+ var ConflictError = class _ConflictError extends CaitlynServiceException {
725
+ static shapeId = "ai.caitlyn.v3#ConflictError";
726
+ name = "ConflictError";
727
+ $fault = "client";
728
+ /**
729
+ * A stable URI for the code: its page in the public error reference,
730
+ * `https://build.caitlyn.ai/errors/\{code\}`.
731
+ * @public
732
+ */
733
+ type;
734
+ /**
735
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
736
+ * @public
737
+ */
738
+ title;
739
+ /**
740
+ * The HTTP status code, repeated from the response.
741
+ * @public
742
+ */
743
+ status;
744
+ /**
745
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
746
+ * renamed; callers match on it.
747
+ * @public
748
+ */
749
+ code;
750
+ /**
751
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
752
+ * storage keys or another person's data.
753
+ * @public
754
+ */
755
+ detail;
756
+ /**
757
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
758
+ * support.
759
+ * @public
760
+ */
761
+ requestId;
762
+ /**
763
+ * Field-level problems, one per member or parameter at fault. Present only on 400
764
+ * `VALIDATION_FAILED`.
765
+ * @public
766
+ */
767
+ errors;
768
+ /**
769
+ * @internal
770
+ */
771
+ constructor(opts) {
772
+ super({
773
+ name: "ConflictError",
774
+ $fault: "client",
775
+ ...opts
776
+ });
777
+ Object.setPrototypeOf(this, _ConflictError.prototype);
778
+ this.type = opts.type;
779
+ this.title = opts.title;
780
+ this.status = opts.status;
781
+ this.code = opts.code;
782
+ this.detail = opts.detail;
783
+ this.requestId = opts.requestId;
784
+ this.errors = opts.errors;
785
+ }
786
+ };
787
+ var PayloadTooLargeError = class _PayloadTooLargeError extends CaitlynServiceException {
788
+ static shapeId = "ai.caitlyn.v3#PayloadTooLargeError";
789
+ name = "PayloadTooLargeError";
790
+ $fault = "client";
791
+ /**
792
+ * A stable URI for the code: its page in the public error reference,
793
+ * `https://build.caitlyn.ai/errors/\{code\}`.
794
+ * @public
795
+ */
796
+ type;
797
+ /**
798
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
799
+ * @public
800
+ */
801
+ title;
802
+ /**
803
+ * The HTTP status code, repeated from the response.
804
+ * @public
805
+ */
806
+ status;
807
+ /**
808
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
809
+ * renamed; callers match on it.
810
+ * @public
811
+ */
812
+ code;
813
+ /**
814
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
815
+ * storage keys or another person's data.
816
+ * @public
817
+ */
818
+ detail;
819
+ /**
820
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
821
+ * support.
822
+ * @public
823
+ */
824
+ requestId;
825
+ /**
826
+ * Field-level problems, one per member or parameter at fault. Present only on 400
827
+ * `VALIDATION_FAILED`.
828
+ * @public
829
+ */
830
+ errors;
831
+ /**
832
+ * @internal
833
+ */
834
+ constructor(opts) {
835
+ super({
836
+ name: "PayloadTooLargeError",
837
+ $fault: "client",
838
+ ...opts
839
+ });
840
+ Object.setPrototypeOf(this, _PayloadTooLargeError.prototype);
841
+ this.type = opts.type;
842
+ this.title = opts.title;
843
+ this.status = opts.status;
844
+ this.code = opts.code;
845
+ this.detail = opts.detail;
846
+ this.requestId = opts.requestId;
847
+ this.errors = opts.errors;
848
+ }
849
+ };
850
+ var UnprocessableContentError = class _UnprocessableContentError extends CaitlynServiceException {
851
+ static shapeId = "ai.caitlyn.v3#UnprocessableContentError";
852
+ name = "UnprocessableContentError";
853
+ $fault = "client";
854
+ /**
855
+ * A stable URI for the code: its page in the public error reference,
856
+ * `https://build.caitlyn.ai/errors/\{code\}`.
857
+ * @public
858
+ */
859
+ type;
860
+ /**
861
+ * A short, human-readable summary of the problem, the same for every occurrence of the code.
862
+ * @public
863
+ */
864
+ title;
865
+ /**
866
+ * The HTTP status code, repeated from the response.
867
+ * @public
868
+ */
869
+ status;
870
+ /**
871
+ * The stable code, for example `NOT_FOUND`. Once shipped a code keeps its meaning and is never
872
+ * renamed; callers match on it.
873
+ * @public
874
+ */
875
+ code;
876
+ /**
877
+ * What went wrong in this occurrence, written for the integrator. Never holds stack traces,
878
+ * storage keys or another person's data.
879
+ * @public
880
+ */
881
+ detail;
882
+ /**
883
+ * The request's identifier, the same value as the `Caitlyn-Request-Id` header. Quote it to
884
+ * support.
885
+ * @public
886
+ */
887
+ requestId;
888
+ /**
889
+ * Field-level problems, one per member or parameter at fault. Present only on 400
890
+ * `VALIDATION_FAILED`.
891
+ * @public
892
+ */
893
+ errors;
894
+ /**
895
+ * @internal
896
+ */
897
+ constructor(opts) {
898
+ super({
899
+ name: "UnprocessableContentError",
900
+ $fault: "client",
901
+ ...opts
902
+ });
903
+ Object.setPrototypeOf(this, _UnprocessableContentError.prototype);
904
+ this.type = opts.type;
905
+ this.title = opts.title;
906
+ this.status = opts.status;
907
+ this.code = opts.code;
908
+ this.detail = opts.detail;
909
+ this.requestId = opts.requestId;
910
+ this.errors = opts.errors;
911
+ }
912
+ };
913
+
914
+ // packages/sdk/src/schemas/schemas_0.ts
915
+ var _AC = "AgentConfiguration";
916
+ var _AS = "AttachmentSettings";
917
+ var _CAV = "Caitlyn-Api-Version";
918
+ var _CD = "CreateDocument";
919
+ var _CDI = "CreateDocumentInput";
920
+ var _CDO = "CreateDocumentOutput";
921
+ var _CE = "ConflictError";
922
+ var _CI = "ContextItem";
923
+ var _CIL = "ContextItemList";
924
+ var _CRI = "Caitlyn-Request-Id";
925
+ var _CS = "ContentSafety";
926
+ var _CU = "CreateUpload";
927
+ var _CUI = "CreateUploadInput";
928
+ var _CUO = "CreateUploadOutput";
929
+ var _D = "Document";
930
+ var _DL = "DocumentList";
931
+ var _ESB = "EventStreamBody";
932
+ var _ET = "ETag";
933
+ var _FE = "FieldError";
934
+ var _FEL = "FieldErrorList";
935
+ var _GAV = "GetAgentVersion";
936
+ var _GAVI = "GetAgentVersionInput";
937
+ var _GAVO = "GetAgentVersionOutput";
938
+ var _IE = "InternalError";
939
+ var _IK = "Idempotency-Key";
940
+ var _IM = "If-Match";
941
+ var _KBB = "KnowledgeBaseBinding";
942
+ var _KBBL = "KnowledgeBaseBindingList";
943
+ var _L = "Location";
944
+ var _LD = "ListDocuments";
945
+ var _LDI = "ListDocumentsInput";
946
+ var _LDO = "ListDocumentsOutput";
947
+ var _LEI = "Last-Event-ID";
948
+ var _NFE = "NotFoundError";
949
+ var _O = "Operation";
950
+ var _PDE = "PermissionDeniedError";
951
+ var _PF = "PartialFailure";
952
+ var _PFE = "PreconditionFailedError";
953
+ var _PFL = "PartialFailureList";
954
+ var _PRE = "PreconditionRequiredError";
955
+ var _PTLE = "PayloadTooLargeError";
956
+ var _RA = "Retry-After";
957
+ var _RCS = "ResumeConversationStream";
958
+ var _RCSI = "ResumeConversationStreamInput";
959
+ var _RCSO = "ResumeConversationStreamOutput";
960
+ var _SM = "SendMessage";
961
+ var _SMI = "SendMessageInput";
962
+ var _SMO = "SendMessageOutput";
963
+ var _SUE = "ServiceUnavailableError";
964
+ var _TMRE = "TooManyRequestsError";
965
+ var _UCE = "UnprocessableContentError";
966
+ var _UDV = "UpdateDraftVersion";
967
+ var _UDVI = "UpdateDraftVersionInput";
968
+ var _UDVO = "UpdateDraftVersionOutput";
969
+ var _UE = "UnauthenticatedError";
970
+ var _VE = "ValidationError";
971
+ var _a = "attachments";
972
+ var _aI = "agentId";
973
+ var _aV = "apiVersion";
974
+ var _bO = "basedOn";
975
+ var _bS = "byteSize";
976
+ var _c = "client";
977
+ var _cA = "createdAt";
978
+ var _cI = "conversationId";
979
+ var _cS = "contentSafety";
980
+ var _cT = "contentType";
981
+ var _cl = "clear";
982
+ var _co = "code";
983
+ var _con = "configuration";
984
+ var _cont = "context";
985
+ var _cu = "cursor";
986
+ var _d = "detail";
987
+ var _dD = "deniedDocuments";
988
+ var _da = "data";
989
+ var _do = "document";
990
+ var _e = "error";
991
+ var _eA = "expiresAt";
992
+ var _en = "enabled";
993
+ var _er = "errors";
994
+ var _et = "etag";
995
+ var _ev = "events";
996
+ var _f = "folder";
997
+ var _fN = "fileName";
998
+ var _fW = "filter[name][startsWith]";
999
+ var _fi = "filter[folder][eq]";
1000
+ var _fil = "filter[status][eq]";
1001
+ var _gI = "guardrailId";
1002
+ var _h = "http";
1003
+ var _hE = "httpError";
1004
+ var _hH = "httpHeader";
1005
+ var _hQ = "httpQuery";
1006
+ var _i = "instructions";
1007
+ var _iK = "idempotencyKey";
1008
+ var _iM = "ifMatch";
1009
+ var _iT = "idempotencyToken";
1010
+ var _id = "identity";
1011
+ var _id_ = "id";
1012
+ var _it = "items";
1013
+ var _k = "kind";
1014
+ var _kB = "knowledgeBases";
1015
+ var _kBI = "knowledgeBaseId";
1016
+ var _l = "label";
1017
+ var _lEI = "lastEventId";
1018
+ var _li = "limit";
1019
+ var _lo = "location";
1020
+ var _m = "model";
1021
+ var _mF = "maxFiles";
1022
+ var _mP = "matchesProduction";
1023
+ var _mS = "minimumScore";
1024
+ var _mT = "mediaType";
1025
+ var _me = "message";
1026
+ var _n = "name";
1027
+ var _nC = "nextCursor";
1028
+ var _nOR = "numberOfResults";
1029
+ var _nP = "namePrefix";
1030
+ var _no = "note";
1031
+ var _o = "operation";
1032
+ var _p = "pointer";
1033
+ var _pF = "partialFailures";
1034
+ var _pa = "parameter";
1035
+ var _rAS = "retryAfterSeconds";
1036
+ var _rH = "requiredHeaders";
1037
+ var _rI = "requestId";
1038
+ var _s = "smithy.ts.sdk.synthetic.ai.caitlyn.v3";
1039
+ var _se = "server";
1040
+ var _sh = "sha256";
1041
+ var _so = "source";
1042
+ var _sor = "sort";
1043
+ var _st = "status";
1044
+ var _sta = "stage";
1045
+ var _str = "streaming";
1046
+ var _t = "type";
1047
+ var _tI = "targetId";
1048
+ var _ti = "title";
1049
+ var _ts = "text/event-stream";
1050
+ var _u = "uri";
1051
+ var _uA = "updatedAt";
1052
+ var _uI = "uploadId";
1053
+ var _uM = "uploadMethod";
1054
+ var _uU = "uploadUrl";
1055
+ var _v = "version";
1056
+ var n0 = "ai.caitlyn.v3";
1057
+ var _s_registry = new import_schema.TypeRegistry(_s);
1058
+ var CaitlynServiceException$ = [-3, _s, "CaitlynServiceException", 0, [], []];
1059
+ _s_registry.registerError(CaitlynServiceException$, CaitlynServiceException);
1060
+ var n0_registry = new import_schema.TypeRegistry(n0);
1061
+ var ConflictError$ = [
1062
+ -3,
1063
+ n0,
1064
+ _CE,
1065
+ { [_e]: _c, [_hE]: 409 },
1066
+ [_t, _ti, _st, _co, _rI, _d, _er],
1067
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1068
+ 5
1069
+ ];
1070
+ n0_registry.registerError(ConflictError$, ConflictError);
1071
+ var InternalError$ = [
1072
+ -3,
1073
+ n0,
1074
+ _IE,
1075
+ { [_e]: _se, [_hE]: 500 },
1076
+ [_t, _ti, _st, _co, _rI, _d, _er],
1077
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1078
+ 5
1079
+ ];
1080
+ n0_registry.registerError(InternalError$, InternalError);
1081
+ var NotFoundError$ = [
1082
+ -3,
1083
+ n0,
1084
+ _NFE,
1085
+ { [_e]: _c, [_hE]: 404 },
1086
+ [_t, _ti, _st, _co, _rI, _d, _er],
1087
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1088
+ 5
1089
+ ];
1090
+ n0_registry.registerError(NotFoundError$, NotFoundError);
1091
+ var PayloadTooLargeError$ = [
1092
+ -3,
1093
+ n0,
1094
+ _PTLE,
1095
+ { [_e]: _c, [_hE]: 413 },
1096
+ [_t, _ti, _st, _co, _rI, _d, _er],
1097
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1098
+ 5
1099
+ ];
1100
+ n0_registry.registerError(PayloadTooLargeError$, PayloadTooLargeError);
1101
+ var PermissionDeniedError$ = [
1102
+ -3,
1103
+ n0,
1104
+ _PDE,
1105
+ { [_e]: _c, [_hE]: 403 },
1106
+ [_t, _ti, _st, _co, _rI, _d, _er],
1107
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1108
+ 5
1109
+ ];
1110
+ n0_registry.registerError(PermissionDeniedError$, PermissionDeniedError);
1111
+ var PreconditionFailedError$ = [
1112
+ -3,
1113
+ n0,
1114
+ _PFE,
1115
+ { [_e]: _c, [_hE]: 412 },
1116
+ [_t, _ti, _st, _co, _rI, _d, _er],
1117
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1118
+ 5
1119
+ ];
1120
+ n0_registry.registerError(PreconditionFailedError$, PreconditionFailedError);
1121
+ var PreconditionRequiredError$ = [
1122
+ -3,
1123
+ n0,
1124
+ _PRE,
1125
+ { [_e]: _c, [_hE]: 428 },
1126
+ [_t, _ti, _st, _co, _rI, _d, _er],
1127
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1128
+ 5
1129
+ ];
1130
+ n0_registry.registerError(PreconditionRequiredError$, PreconditionRequiredError);
1131
+ var ServiceUnavailableError$ = [
1132
+ -3,
1133
+ n0,
1134
+ _SUE,
1135
+ { [_e]: _se, [_hE]: 503 },
1136
+ [_t, _ti, _st, _co, _rI, _d, _er, _rAS],
1137
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList, [1, { [_hH]: _RA }]],
1138
+ 5
1139
+ ];
1140
+ n0_registry.registerError(ServiceUnavailableError$, ServiceUnavailableError);
1141
+ var TooManyRequestsError$ = [
1142
+ -3,
1143
+ n0,
1144
+ _TMRE,
1145
+ { [_e]: _c, [_hE]: 429 },
1146
+ [_t, _ti, _st, _co, _rI, _d, _er, _rAS],
1147
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList, [1, { [_hH]: _RA }]],
1148
+ 5
1149
+ ];
1150
+ n0_registry.registerError(TooManyRequestsError$, TooManyRequestsError);
1151
+ var UnauthenticatedError$ = [
1152
+ -3,
1153
+ n0,
1154
+ _UE,
1155
+ { [_e]: _c, [_hE]: 401 },
1156
+ [_t, _ti, _st, _co, _rI, _d, _er],
1157
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1158
+ 5
1159
+ ];
1160
+ n0_registry.registerError(UnauthenticatedError$, UnauthenticatedError);
1161
+ var UnprocessableContentError$ = [
1162
+ -3,
1163
+ n0,
1164
+ _UCE,
1165
+ { [_e]: _c, [_hE]: 422 },
1166
+ [_t, _ti, _st, _co, _rI, _d, _er],
1167
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1168
+ 5
1169
+ ];
1170
+ n0_registry.registerError(UnprocessableContentError$, UnprocessableContentError);
1171
+ var ValidationError$ = [
1172
+ -3,
1173
+ n0,
1174
+ _VE,
1175
+ { [_e]: _c, [_hE]: 400 },
1176
+ [_t, _ti, _st, _co, _rI, _d, _er],
1177
+ [0, 0, 1, 0, 0, 0, () => FieldErrorList],
1178
+ 5
1179
+ ];
1180
+ n0_registry.registerError(ValidationError$, ValidationError);
1181
+ var errorTypeRegistries = [
1182
+ _s_registry,
1183
+ n0_registry
1184
+ ];
1185
+ var EventStreamBody = [0, n0, _ESB, { [_mT]: _ts, [_str]: 1 }, 42];
1186
+ var AgentConfiguration$ = [
1187
+ 3,
1188
+ n0,
1189
+ _AC,
1190
+ 0,
1191
+ [_i, _id, _m, _kB, _a, _cS, _dD],
1192
+ [0, 0, 0, () => KnowledgeBaseBindingList, () => AttachmentSettings$, () => ContentSafety$, 2],
1193
+ 1
1194
+ ];
1195
+ var AttachmentSettings$ = [
1196
+ 3,
1197
+ n0,
1198
+ _AS,
1199
+ 0,
1200
+ [_en, _mF],
1201
+ [2, 1]
1202
+ ];
1203
+ var ContentSafety$ = [
1204
+ 3,
1205
+ n0,
1206
+ _CS,
1207
+ 0,
1208
+ [_gI],
1209
+ [0]
1210
+ ];
1211
+ var ContextItem$ = [
1212
+ 3,
1213
+ n0,
1214
+ _CI,
1215
+ 0,
1216
+ [_t, _l, _u, _da],
1217
+ [0, 0, 0, 15],
1218
+ 2
1219
+ ];
1220
+ var CreateDocumentInput$ = [
1221
+ 3,
1222
+ n0,
1223
+ _CDI,
1224
+ 0,
1225
+ [_kBI, _uI, _f, _iK, _n],
1226
+ [[0, 1], 0, 0, [0, { [_hH]: _IK, [_iT]: 1 }], 0],
1227
+ 3
1228
+ ];
1229
+ var CreateDocumentOutput$ = [
1230
+ 3,
1231
+ n0,
1232
+ _CDO,
1233
+ 0,
1234
+ [_do, _o, _rI, _aV, _lo],
1235
+ [() => Document$, () => Operation$, [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }], [0, { [_hH]: _L }]],
1236
+ 2
1237
+ ];
1238
+ var CreateUploadInput$ = [
1239
+ 3,
1240
+ n0,
1241
+ _CUI,
1242
+ 0,
1243
+ [_fN, _cT, _bS, _sh, _iK],
1244
+ [0, 0, 1, 0, [0, { [_hH]: _IK, [_iT]: 1 }]],
1245
+ 4
1246
+ ];
1247
+ var CreateUploadOutput$ = [
1248
+ 3,
1249
+ n0,
1250
+ _CUO,
1251
+ 0,
1252
+ [_id_, _uU, _uM, _rH, _eA, _st, _rI, _aV, _lo],
1253
+ [0, 0, 0, 128 | 0, 5, 0, [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }], [0, { [_hH]: _L }]],
1254
+ 6
1255
+ ];
1256
+ var Document$ = [
1257
+ 3,
1258
+ n0,
1259
+ _D,
1260
+ 0,
1261
+ [_id_, _kBI, _n, _f, _st, _cA, _uA, _sta, _cT, _bS, _sh, _pF],
1262
+ [0, 0, 0, 0, 0, 5, 5, 0, 0, 1, 0, () => PartialFailureList],
1263
+ 7
1264
+ ];
1265
+ var FieldError$ = [
1266
+ 3,
1267
+ n0,
1268
+ _FE,
1269
+ 0,
1270
+ [_co, _p, _pa, _d],
1271
+ [0, 0, 0, 0],
1272
+ 1
1273
+ ];
1274
+ var GetAgentVersionInput$ = [
1275
+ 3,
1276
+ n0,
1277
+ _GAVI,
1278
+ 0,
1279
+ [_aI, _v],
1280
+ [[0, 1], [0, 1]],
1281
+ 2
1282
+ ];
1283
+ var GetAgentVersionOutput$ = [
1284
+ 3,
1285
+ n0,
1286
+ _GAVO,
1287
+ 0,
1288
+ [_et, _aI, _n, _cA, _con, _rI, _aV, _so, _bO, _mP, _no],
1289
+ [[0, { [_hH]: _ET }], 0, 0, 5, () => AgentConfiguration$, [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }], 0, 0, 2, 0],
1290
+ 5
1291
+ ];
1292
+ var KnowledgeBaseBinding$ = [
1293
+ 3,
1294
+ n0,
1295
+ _KBB,
1296
+ 0,
1297
+ [_kBI, _nOR, _mS],
1298
+ [0, 1, 1],
1299
+ 1
1300
+ ];
1301
+ var ListDocumentsInput$ = [
1302
+ 3,
1303
+ n0,
1304
+ _LDI,
1305
+ 0,
1306
+ [_kBI, _li, _cu, _sor, _f, _st, _nP],
1307
+ [[0, 1], [1, { [_hQ]: _li }], [0, { [_hQ]: _cu }], [0, { [_hQ]: _sor }], [0, { [_hQ]: _fi }], [0, { [_hQ]: _fil }], [0, { [_hQ]: _fW }]],
1308
+ 1
1309
+ ];
1310
+ var ListDocumentsOutput$ = [
1311
+ 3,
1312
+ n0,
1313
+ _LDO,
1314
+ 0,
1315
+ [_it, _rI, _aV, _nC],
1316
+ [() => DocumentList, [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }], 0],
1317
+ 1
1318
+ ];
1319
+ var Operation$ = [
1320
+ 3,
1321
+ n0,
1322
+ _O,
1323
+ 0,
1324
+ [_id_, _k, _st, _cA],
1325
+ [0, 0, 0, 5],
1326
+ 4
1327
+ ];
1328
+ var PartialFailure$ = [
1329
+ 3,
1330
+ n0,
1331
+ _PF,
1332
+ 0,
1333
+ [_co, _tI, _d],
1334
+ [0, 0, 0],
1335
+ 1
1336
+ ];
1337
+ var ResumeConversationStreamInput$ = [
1338
+ 3,
1339
+ n0,
1340
+ _RCSI,
1341
+ 0,
1342
+ [_cI, _lEI],
1343
+ [[0, 1], [0, { [_hH]: _LEI }]],
1344
+ 1
1345
+ ];
1346
+ var ResumeConversationStreamOutput$ = [
1347
+ 3,
1348
+ n0,
1349
+ _RCSO,
1350
+ 0,
1351
+ [_ev, _rI, _aV],
1352
+ [[() => EventStreamBody, 16], [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }]],
1353
+ 1
1354
+ ];
1355
+ var SendMessageInput$ = [
1356
+ 3,
1357
+ n0,
1358
+ _SMI,
1359
+ 0,
1360
+ [_cI, _me, _cont],
1361
+ [[0, 1], 0, () => ContextItemList],
1362
+ 2
1363
+ ];
1364
+ var SendMessageOutput$ = [
1365
+ 3,
1366
+ n0,
1367
+ _SMO,
1368
+ 0,
1369
+ [_ev, _rI, _aV],
1370
+ [[() => EventStreamBody, 16], [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }]],
1371
+ 1
1372
+ ];
1373
+ var UpdateDraftVersionInput$ = [
1374
+ 3,
1375
+ n0,
1376
+ _UDVI,
1377
+ 0,
1378
+ [_aI, _iM, _id, _i, _m, _kB, _a, _cS, _dD, _cl],
1379
+ [[0, 1], [0, { [_hH]: _IM }], 0, 0, 0, () => KnowledgeBaseBindingList, () => AttachmentSettings$, () => ContentSafety$, 2, 64 | 0],
1380
+ 2
1381
+ ];
1382
+ var UpdateDraftVersionOutput$ = [
1383
+ 3,
1384
+ n0,
1385
+ _UDVO,
1386
+ 0,
1387
+ [_et, _aI, _n, _cA, _con, _rI, _aV, _so, _bO, _mP, _no],
1388
+ [[0, { [_hH]: _ET }], 0, 0, 5, () => AgentConfiguration$, [0, { [_hH]: _CRI }], [0, { [_hH]: _CAV }], 0, 0, 2, 0],
1389
+ 5
1390
+ ];
1391
+ var ClearableDraftFieldList = 64 | 0;
1392
+ var ContextItemList = [
1393
+ 1,
1394
+ n0,
1395
+ _CIL,
1396
+ 0,
1397
+ () => ContextItem$
1398
+ ];
1399
+ var DocumentList = [
1400
+ 1,
1401
+ n0,
1402
+ _DL,
1403
+ 0,
1404
+ () => Document$
1405
+ ];
1406
+ var FieldErrorList = [
1407
+ 1,
1408
+ n0,
1409
+ _FEL,
1410
+ 0,
1411
+ () => FieldError$
1412
+ ];
1413
+ var KnowledgeBaseBindingList = [
1414
+ 1,
1415
+ n0,
1416
+ _KBBL,
1417
+ 0,
1418
+ () => KnowledgeBaseBinding$
1419
+ ];
1420
+ var PartialFailureList = [
1421
+ 1,
1422
+ n0,
1423
+ _PFL,
1424
+ 0,
1425
+ () => PartialFailure$
1426
+ ];
1427
+ var HeaderMap = 128 | 0;
1428
+ var CreateDocument$ = [
1429
+ 9,
1430
+ n0,
1431
+ _CD,
1432
+ { [_h]: ["POST", "/v3/knowledge-bases/{knowledgeBaseId}/documents", 202] },
1433
+ () => CreateDocumentInput$,
1434
+ () => CreateDocumentOutput$
1435
+ ];
1436
+ var CreateUpload$ = [
1437
+ 9,
1438
+ n0,
1439
+ _CU,
1440
+ { [_h]: ["POST", "/v3/uploads", 201] },
1441
+ () => CreateUploadInput$,
1442
+ () => CreateUploadOutput$
1443
+ ];
1444
+ var GetAgentVersion$ = [
1445
+ 9,
1446
+ n0,
1447
+ _GAV,
1448
+ { [_h]: ["GET", "/v3/agents/{agentId}/versions/{version}", 200] },
1449
+ () => GetAgentVersionInput$,
1450
+ () => GetAgentVersionOutput$
1451
+ ];
1452
+ var ListDocuments$ = [
1453
+ 9,
1454
+ n0,
1455
+ _LD,
1456
+ { [_h]: ["GET", "/v3/knowledge-bases/{knowledgeBaseId}/documents", 200] },
1457
+ () => ListDocumentsInput$,
1458
+ () => ListDocumentsOutput$
1459
+ ];
1460
+ var ResumeConversationStream$ = [
1461
+ 9,
1462
+ n0,
1463
+ _RCS,
1464
+ { [_h]: ["GET", "/v3/conversations/{conversationId}/stream", 200] },
1465
+ () => ResumeConversationStreamInput$,
1466
+ () => ResumeConversationStreamOutput$
1467
+ ];
1468
+ var SendMessage$ = [
1469
+ 9,
1470
+ n0,
1471
+ _SM,
1472
+ { [_h]: ["POST", "/v3/conversations/{conversationId}/send", 200] },
1473
+ () => SendMessageInput$,
1474
+ () => SendMessageOutput$
1475
+ ];
1476
+ var UpdateDraftVersion$ = [
1477
+ 9,
1478
+ n0,
1479
+ _UDV,
1480
+ { [_h]: ["PATCH", "/v3/agents/{agentId}/versions/draft", 200] },
1481
+ () => UpdateDraftVersionInput$,
1482
+ () => UpdateDraftVersionOutput$
1483
+ ];
1484
+
1485
+ // packages/sdk/src/runtimeConfig.shared.ts
1486
+ var getRuntimeConfig = (config) => {
1487
+ return {
1488
+ apiVersion: "3.0.0",
1489
+ base64Decoder: config?.base64Decoder ?? import_serde.fromBase64,
1490
+ base64Encoder: config?.base64Encoder ?? import_serde.toBase64,
1491
+ caitlynSdkVersion: config?.caitlynSdkVersion ?? "0.0.1",
1492
+ disableHostPrefix: config?.disableHostPrefix ?? false,
1493
+ endpointProvider: config?.endpointProvider ?? import_sdk_core.caitlynEndpointProvider,
1494
+ extensions: config?.extensions ?? [],
1495
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultCaitlynHttpAuthSchemeProvider,
1496
+ httpAuthSchemes: config?.httpAuthSchemes ?? [
1497
+ {
1498
+ schemeId: "smithy.api#httpBearerAuth",
1499
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
1500
+ signer: new import_core2.HttpBearerAuthSigner()
1501
+ }
1502
+ ],
1503
+ logger: config?.logger ?? new import_client3.NoOpLogger(),
1504
+ protocol: config?.protocol ?? import_sdk_core.CaitlynRestJsonProtocol,
1505
+ protocolSettings: config?.protocolSettings ?? { defaultNamespace: "ai.caitlyn.v3", errorTypeRegistries },
1506
+ retryStrategy: config?.retryStrategy ?? new import_sdk_core.CaitlynRetryStrategy(config?.maxAttempts ?? 3),
1507
+ sdkStreamMixin: config?.sdkStreamMixin ?? import_serde.sdkStreamMixin,
1508
+ sha256: config?.sha256 ?? void 0,
1509
+ urlParser: config?.urlParser ?? import_protocols.parseUrl,
1510
+ utf8Decoder: config?.utf8Decoder ?? import_serde.fromUtf8,
1511
+ utf8Encoder: config?.utf8Encoder ?? import_serde.toUtf8
1512
+ };
1513
+ };
1514
+
1515
+ // packages/sdk/src/runtimeConfig.ts
1516
+ var getRuntimeConfig2 = (config) => {
1517
+ (0, import_client4.emitWarningIfUnsupportedVersion)(process.version);
1518
+ const clientSharedValues = getRuntimeConfig(config);
1519
+ return {
1520
+ ...clientSharedValues,
1521
+ ...config,
1522
+ runtime: "node",
1523
+ bodyLengthChecker: config?.bodyLengthChecker ?? import_serde2.calculateBodyLength,
1524
+ maxAttempts: config?.maxAttempts ?? 3,
1525
+ requestHandler: import_node_http_handler.NodeHttpHandler.create(config?.requestHandler ?? (async () => void 0)),
1526
+ retryMode: config?.retryMode ?? "standard",
1527
+ streamCollector: config?.streamCollector ?? import_node_http_handler.streamCollector
1528
+ };
1529
+ };
1530
+
1531
+ // packages/sdk/src/runtimeExtensions.ts
1532
+ var import_client5 = require("@smithy/core/client");
1533
+ var import_protocols2 = require("@smithy/core/protocols");
1534
+
1535
+ // packages/sdk/src/auth/httpAuthExtensionConfiguration.ts
1536
+ var getHttpAuthExtensionConfiguration = (runtimeConfig) => {
1537
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
1538
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
1539
+ let _token = runtimeConfig.token;
1540
+ return {
1541
+ setHttpAuthScheme(httpAuthScheme) {
1542
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
1543
+ if (index === -1) {
1544
+ _httpAuthSchemes.push(httpAuthScheme);
1545
+ } else {
1546
+ _httpAuthSchemes.splice(index, 1, httpAuthScheme);
1547
+ }
1548
+ },
1549
+ httpAuthSchemes() {
1550
+ return _httpAuthSchemes;
1551
+ },
1552
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
1553
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
1554
+ },
1555
+ httpAuthSchemeProvider() {
1556
+ return _httpAuthSchemeProvider;
1557
+ },
1558
+ setToken(token) {
1559
+ _token = token;
1560
+ },
1561
+ token() {
1562
+ return _token;
1563
+ }
1564
+ };
1565
+ };
1566
+ var resolveHttpAuthRuntimeConfig = (config) => {
1567
+ return {
1568
+ httpAuthSchemes: config.httpAuthSchemes(),
1569
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
1570
+ token: config.token()
1571
+ };
1572
+ };
1573
+
1574
+ // packages/sdk/src/runtimeExtensions.ts
1575
+ var resolveRuntimeExtensions = (runtimeConfig, extensions) => {
1576
+ const extensionConfiguration = Object.assign(
1577
+ (0, import_client5.getDefaultExtensionConfiguration)(runtimeConfig),
1578
+ (0, import_protocols2.getHttpHandlerExtensionConfiguration)(runtimeConfig),
1579
+ getHttpAuthExtensionConfiguration(runtimeConfig)
1580
+ );
1581
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
1582
+ return Object.assign(
1583
+ runtimeConfig,
1584
+ (0, import_client5.resolveDefaultRuntimeConfig)(extensionConfiguration),
1585
+ (0, import_protocols2.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
1586
+ resolveHttpAuthRuntimeConfig(extensionConfiguration)
1587
+ );
1588
+ };
1589
+
1590
+ // packages/sdk/src/CaitlynClient.ts
1591
+ var CaitlynClient = class extends import_client6.Client {
1592
+ /**
1593
+ * The resolved configuration of CaitlynClient class. This is resolved and normalized from the {@link CaitlynClientConfig | constructor configuration interface}.
1594
+ */
1595
+ config;
1596
+ constructor(...[configuration]) {
1597
+ const _config_0 = getRuntimeConfig2(configuration || {});
1598
+ super(_config_0);
1599
+ this.initConfig = _config_0;
1600
+ const _config_1 = resolveClientEndpointParameters(_config_0);
1601
+ const _config_2 = (0, import_retry.resolveRetryConfig)(_config_1);
1602
+ const _config_3 = (0, import_endpoints.resolveEndpointConfig)(_config_2);
1603
+ const _config_4 = (0, import_endpoints.resolveEndpointRequiredConfig)(_config_3);
1604
+ const _config_5 = resolveHttpAuthSchemeConfig(_config_4);
1605
+ const _config_6 = resolveRuntimeExtensions(_config_5, configuration?.extensions || []);
1606
+ this.config = _config_6;
1607
+ this.middlewareStack.use((0, import_schema2.getSchemaSerdePlugin)(this.config));
1608
+ this.middlewareStack.use((0, import_retry.getRetryPlugin)(this.config));
1609
+ this.middlewareStack.use((0, import_protocols3.getContentLengthPlugin)(this.config));
1610
+ this.middlewareStack.use(
1611
+ (0, import_core3.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
1612
+ httpAuthSchemeParametersProvider: defaultCaitlynHttpAuthSchemeParametersProvider,
1613
+ identityProviderConfigProvider: async (config) => new import_core3.DefaultIdentityProviderConfig({
1614
+ "smithy.api#httpBearerAuth": config.token
1615
+ })
1616
+ })
1617
+ );
1618
+ this.middlewareStack.use((0, import_core3.getHttpSigningPlugin)(this.config));
1619
+ this.middlewareStack.use((0, import_sdk_core2.getCaitlynSdkPlugin)(this.config, {
1620
+ "retrySafeOperations": ["CreateDocument", "CreateUpload", "GetAgentVersion", "ListDocuments", "ResumeConversationStream", "UpdateDraftVersion"],
1621
+ sdkModel: "5.115.0",
1622
+ "since": ["CreateDocument=5.115.0", "CreateUpload=5.115.0", "GetAgentVersion=5.115.0", "ListDocuments=5.115.0", "ResumeConversationStream=5.115.0", "SendMessage=5.115.0", "UpdateDraftVersion=5.115.0"]
1623
+ }));
1624
+ }
1625
+ /**
1626
+ * Destroy underlying resources, like sockets. It's usually not necessary to do this.
1627
+ * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
1628
+ * Otherwise, sockets might stay open for quite a long time before the server terminates them.
1629
+ */
1630
+ destroy() {
1631
+ super.destroy();
1632
+ }
1633
+ };
1634
+
1635
+ // packages/sdk/src/sdk/client.ts
1636
+ var import_sdk_core4 = require("@caitlyn-ai/sdk-core");
1637
+
1638
+ // packages/sdk/src/sdk/operations.ts
1639
+ var import_sdk_core3 = require("@caitlyn-ai/sdk-core");
1640
+
1641
+ // packages/sdk/src/commandBuilder.ts
1642
+ var import_client7 = require("@smithy/core/client");
1643
+ var import_endpoints2 = require("@smithy/core/endpoints");
1644
+ var command = (0, import_client7.makeBuilder)(commonParams, "Caitlyn", "CaitlynClient", import_endpoints2.getEndpointPlugin);
1645
+ var _ep0 = {};
1646
+ var _mw0 = (Command, cs, config, o) => [];
1647
+
1648
+ // packages/sdk/src/commands/CreateDocumentCommand.ts
1649
+ var CreateDocumentCommand = class extends command(
1650
+ _ep0,
1651
+ _mw0,
1652
+ "CreateDocument",
1653
+ CreateDocument$
1654
+ ) {
1655
+ };
1656
+
1657
+ // packages/sdk/src/commands/CreateUploadCommand.ts
1658
+ var CreateUploadCommand = class extends command(
1659
+ _ep0,
1660
+ _mw0,
1661
+ "CreateUpload",
1662
+ CreateUpload$
1663
+ ) {
1664
+ };
1665
+
1666
+ // packages/sdk/src/commands/GetAgentVersionCommand.ts
1667
+ var GetAgentVersionCommand = class extends command(
1668
+ _ep0,
1669
+ _mw0,
1670
+ "GetAgentVersion",
1671
+ GetAgentVersion$
1672
+ ) {
1673
+ };
1674
+
1675
+ // packages/sdk/src/pagination/ListDocumentsPaginator.ts
1676
+ var import_core4 = require("@smithy/core");
1677
+
1678
+ // packages/sdk/src/commands/ListDocumentsCommand.ts
1679
+ var ListDocumentsCommand = class extends command(
1680
+ _ep0,
1681
+ _mw0,
1682
+ "ListDocuments",
1683
+ ListDocuments$
1684
+ ) {
1685
+ };
1686
+
1687
+ // packages/sdk/src/pagination/ListDocumentsPaginator.ts
1688
+ var paginateListDocuments = (0, import_core4.createPaginator)(CaitlynClient, ListDocumentsCommand, "cursor", "nextCursor", "limit");
1689
+
1690
+ // packages/sdk/src/commands/ResumeConversationStreamCommand.ts
1691
+ var ResumeConversationStreamCommand = class extends command(
1692
+ _ep0,
1693
+ _mw0,
1694
+ "ResumeConversationStream",
1695
+ ResumeConversationStream$
1696
+ ) {
1697
+ };
1698
+
1699
+ // packages/sdk/src/commands/SendMessageCommand.ts
1700
+ var SendMessageCommand = class extends command(
1701
+ _ep0,
1702
+ _mw0,
1703
+ "SendMessage",
1704
+ SendMessage$
1705
+ ) {
1706
+ };
1707
+
1708
+ // packages/sdk/src/commands/UpdateDraftVersionCommand.ts
1709
+ var UpdateDraftVersionCommand = class extends command(
1710
+ _ep0,
1711
+ _mw0,
1712
+ "UpdateDraftVersion",
1713
+ UpdateDraftVersion$
1714
+ ) {
1715
+ };
1716
+
1717
+ // packages/sdk/src/sdk/events.ts
1718
+ var ConversationEventNames = /* @__PURE__ */ new Set(["message.started", "phase.changed", "progress.updated", "text.delta", "citation.added", "tool.started", "tool.finished", "input.requested", "message.completed", "message.failed"]);
1719
+
1720
+ // packages/sdk/src/sdk/operations.ts
1721
+ var ERROR_CLASSES = {
1722
+ 400: ValidationError,
1723
+ 401: UnauthenticatedError,
1724
+ 403: PermissionDeniedError,
1725
+ 404: NotFoundError,
1726
+ 409: ConflictError,
1727
+ 412: PreconditionFailedError,
1728
+ 413: PayloadTooLargeError,
1729
+ 422: UnprocessableContentError,
1730
+ 428: PreconditionRequiredError,
1731
+ 429: TooManyRequestsError,
1732
+ 500: InternalError,
1733
+ 503: ServiceUnavailableError
1734
+ };
1735
+ var toError = (problem) => {
1736
+ const status = Number(problem.status ?? 0);
1737
+ const fault = status >= 500 ? "server" : "client";
1738
+ const message = String(problem.detail ?? problem.title ?? problem.code);
1739
+ const Typed = ERROR_CLASSES[status];
1740
+ const error = Typed ? new Typed({ $fault: fault, $metadata: {}, message }) : new CaitlynServiceException({ name: String(problem.code ?? "Error"), $fault: fault, $metadata: {}, message });
1741
+ return Object.assign(error, problem, { message });
1742
+ };
1743
+ function createDocument(client, input, options = {}) {
1744
+ const { signal, ...rest } = options;
1745
+ return client.send(new CreateDocumentCommand({ ...input, ...rest }), { abortSignal: signal });
1746
+ }
1747
+ function createUpload(client, input, options = {}) {
1748
+ const { signal, ...rest } = options;
1749
+ return client.send(new CreateUploadCommand({ ...input, ...rest }), { abortSignal: signal });
1750
+ }
1751
+ function getAgentVersion(client, input, options = {}) {
1752
+ const { signal, ...rest } = options;
1753
+ return client.send(new GetAgentVersionCommand({ ...input, ...rest }), { abortSignal: signal });
1754
+ }
1755
+ function listDocuments(client, input, options = {}) {
1756
+ const { signal, ...rest } = options;
1757
+ return {
1758
+ async *[Symbol.asyncIterator]() {
1759
+ const pages = paginateListDocuments({ client, pageSize: input.limit }, { ...input, ...rest }, { abortSignal: signal });
1760
+ for await (const page of pages) yield* page.items;
1761
+ }
1762
+ };
1763
+ }
1764
+ function resumeConversationStream(client, conversationId, input, options = {}) {
1765
+ const { signal, ...rest } = options;
1766
+ return new import_sdk_core3.SseStream(
1767
+ { known: ConversationEventNames, final: { event: "message.completed", member: "message" }, errorEvent: "message.failed", toError },
1768
+ async () => (await client.send(new ResumeConversationStreamCommand({ ...input, conversationId, ...rest }), { abortSignal: signal })).events,
1769
+ void 0,
1770
+ signal
1771
+ );
1772
+ }
1773
+ function sendMessage(client, conversationId, input, options = {}) {
1774
+ const { signal, ...rest } = options;
1775
+ return new import_sdk_core3.SseStream(
1776
+ { known: ConversationEventNames, final: { event: "message.completed", member: "message" }, errorEvent: "message.failed", toError },
1777
+ async () => (await client.send(new SendMessageCommand({ ...input, conversationId, ...rest }), { abortSignal: signal })).events,
1778
+ async (lastEventId) => (await client.send(new ResumeConversationStreamCommand({ conversationId, lastEventId }), { abortSignal: signal })).events,
1779
+ signal
1780
+ );
1781
+ }
1782
+ function updateDraftVersion(client, agentId, input, options) {
1783
+ const { signal, ...rest } = options;
1784
+ return client.send(new UpdateDraftVersionCommand({ ...input, agentId, ...rest }), { abortSignal: signal });
1785
+ }
1786
+ function createUploadFromFile(client, input, options = {}) {
1787
+ const { file, fileName, ...rest } = input;
1788
+ return (0, import_sdk_core3.uploadFile)(file, fileName, (meta) => createUpload(client, { ...rest, ...meta }, options), toError, options.signal);
1789
+ }
1790
+ async function uploadDocument(client, input, options = {}) {
1791
+ const { file, fileName, ...rest } = input;
1792
+ const upload = await createUploadFromFile(client, { file, fileName }, { signal: options.signal });
1793
+ return createDocument(client, { ...rest, uploadId: upload.id }, options);
1794
+ }
1795
+
1796
+ // packages/sdk/src/sdk/client.ts
1797
+ function createCaitlynClient(options, auth = (0, import_sdk_core4.createAuth)(options)) {
1798
+ const client = new CaitlynClient((0, import_sdk_core4.clientConfig)(options, auth));
1799
+ client.middlewareStack.use((0, import_sdk_core4.getCaitlynAuthPlugin)(auth));
1800
+ if (options.telemetry?.enabled !== false) client.middlewareStack.use((0, import_sdk_core4.getCaitlynTelemetryPlugin)(options.telemetry?.tracerProvider));
1801
+ return client;
1802
+ }
1803
+ var Caitlyn = class {
1804
+ client;
1805
+ /** The sign-in session: the current token, and the oauth mode's authorizationUrl(), handleCallback() and signOut(). */
1806
+ auth;
1807
+ constructor(options) {
1808
+ this.auth = (0, import_sdk_core4.createAuth)(options);
1809
+ this.client = createCaitlynClient(options, this.auth);
1810
+ }
1811
+ conversations = {
1812
+ resume: (...args) => resumeConversationStream(this.client, ...args),
1813
+ send: (...args) => sendMessage(this.client, ...args)
1814
+ };
1815
+ documents = {
1816
+ create: (...args) => createDocument(this.client, ...args),
1817
+ list: (...args) => listDocuments(this.client, ...args),
1818
+ upload: (...args) => uploadDocument(this.client, ...args)
1819
+ };
1820
+ uploads = {
1821
+ create: (...args) => createUploadFromFile(this.client, ...args),
1822
+ reserve: (...args) => createUpload(this.client, ...args)
1823
+ };
1824
+ versions = {
1825
+ get: (...args) => getAgentVersion(this.client, ...args),
1826
+ updateDraft: (...args) => updateDraftVersion(this.client, ...args)
1827
+ };
1828
+ };
1829
+
1830
+ // packages/sdk/src/models/enums.ts
1831
+ var ClearableDraftField = {
1832
+ /**
1833
+ * The agent's identity statement.
1834
+ */
1835
+ IDENTITY: "identity"
1836
+ };
1837
+ var VersionSource = {
1838
+ /**
1839
+ * Created from an imported agent file.
1840
+ */
1841
+ IMPORT: "import",
1842
+ /**
1843
+ * Carried over from the version model before v3.
1844
+ */
1845
+ MIGRATION: "migration",
1846
+ /**
1847
+ * Pinned from the draft, without changing production.
1848
+ */
1849
+ PIN: "pin",
1850
+ /**
1851
+ * Published, which also made it production.
1852
+ */
1853
+ PUBLISH: "publish"
1854
+ };
1855
+ var DocumentStatus = {
1856
+ /**
1857
+ * Being deleted.
1858
+ */
1859
+ DELETING: "deleting",
1860
+ /**
1861
+ * The document's content could not be processed. Final.
1862
+ */
1863
+ FAILED: "failed",
1864
+ /**
1865
+ * Searchable. Final.
1866
+ */
1867
+ INDEXED: "indexed",
1868
+ /**
1869
+ * Searchable, but some enrichments did not complete; see `partialFailures`. Final.
1870
+ */
1871
+ PARTIALLY_INDEXED: "partially_indexed",
1872
+ /**
1873
+ * Created; processing has not started.
1874
+ */
1875
+ PENDING: "pending",
1876
+ /**
1877
+ * Being processed. `stage` says what the server is doing.
1878
+ */
1879
+ PROCESSING: "processing"
1880
+ };
1881
+ var OperationKind = {
1882
+ /**
1883
+ * A document's ingestion: reading, enriching and indexing its content.
1884
+ */
1885
+ DOCUMENT_INGESTION: "document_ingestion"
1886
+ };
1887
+ var OperationStatus = {
1888
+ /**
1889
+ * Cancelled before it finished. Final.
1890
+ */
1891
+ CANCELLED: "cancelled",
1892
+ /**
1893
+ * The core work failed; see `error`. Final.
1894
+ */
1895
+ FAILED: "failed",
1896
+ /**
1897
+ * Waiting to start.
1898
+ */
1899
+ QUEUED: "queued",
1900
+ /**
1901
+ * Running.
1902
+ */
1903
+ RUNNING: "running",
1904
+ /**
1905
+ * Finished with no failures. Final.
1906
+ */
1907
+ SUCCEEDED: "succeeded",
1908
+ /**
1909
+ * Finished, but some enrichments did not complete; see `partialFailures`. Final.
1910
+ */
1911
+ SUCCEEDED_WITH_FAILURES: "succeeded_with_failures"
1912
+ };
1913
+ var UploadStatus = {
1914
+ /**
1915
+ * Reserved; the bytes have not arrived.
1916
+ */
1917
+ AWAITING_BYTES: "awaiting_bytes",
1918
+ /**
1919
+ * Used by an operation. Final.
1920
+ */
1921
+ CONSUMED: "consumed",
1922
+ /**
1923
+ * Not used before `expiresAt`. Final.
1924
+ */
1925
+ EXPIRED: "expired",
1926
+ /**
1927
+ * The bytes arrived and matched the checksum.
1928
+ */
1929
+ RECEIVED: "received"
1930
+ };
1931
+
1932
+ // packages/sdk/src/sdk/index.ts
1933
+ var import_sdk_core5 = require("@caitlyn-ai/sdk-core");
1934
+ // Annotate the CommonJS export names for ESM import in node:
1935
+ 0 && (module.exports = {
1936
+ Caitlyn,
1937
+ CaitlynAuthError,
1938
+ CaitlynError,
1939
+ ClearableDraftField,
1940
+ ConflictError,
1941
+ ConversationEventNames,
1942
+ DocumentStatus,
1943
+ InternalError,
1944
+ NotFoundError,
1945
+ NotSupportedByServer,
1946
+ OperationKind,
1947
+ OperationStatus,
1948
+ PayloadTooLargeError,
1949
+ PermissionDeniedError,
1950
+ PreconditionFailedError,
1951
+ PreconditionRequiredError,
1952
+ ServiceUnavailableError,
1953
+ SseStream,
1954
+ TooManyRequestsError,
1955
+ UnauthenticatedError,
1956
+ UnprocessableContentError,
1957
+ UploadStatus,
1958
+ ValidationError,
1959
+ VersionSource,
1960
+ WaiterError,
1961
+ createAuth,
1962
+ createCaitlynClient,
1963
+ createDocument,
1964
+ createUpload,
1965
+ createUploadFromFile,
1966
+ getAgentVersion,
1967
+ listDocuments,
1968
+ resumeConversationStream,
1969
+ sendMessage,
1970
+ updateDraftVersion,
1971
+ uploadDocument,
1972
+ workspaceAudience
1973
+ });
1974
+ //# sourceMappingURL=index.cjs.map