@slates/client 1.0.0-rc.3 → 1.0.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,4 @@
1
- import { SlatesProtocolVersion, SlatesParticipant, SlatesNotifications, SlatesRequests, SlatesResponses, slatesRequestsByMethod, slatesResponsesByMethod, SlatesAction, SlateAuthenticationMethod } from '@slates/proto';
2
- import z from 'zod';
1
+ import { SlatesProtocolVersion, SlatesParticipant, SlatesNotifications, SlatesRequests, SlatesResponses, SlatesResponsesByMethod, SlatesMessageProviderIdentifyResponse, SlatesMessageActionsListResponse, SlatesAction, SlatesMessageActionGetResponse, SlatesMessageConfigSchemaGetResponse, SlatesMessageConfigDefaultGetResponse, SlatesMessageConfigChangedResponse, SlateAuthenticationMethod, SlatesMessageAuthMethodGetResponse, SlatesMessageAuthDefaultInputGetResponse, SlatesMessageAuthInputChangedResponse, SlatesMessageAuthOutputGetResponse, SlatesMessageAuthAuthorizationUrlGetResponse, SlatesMessageAuthTokenRefreshHandleResponse, SlatesMessageAuthProfileGetResponse, SlatesMessageActionInvokeResponse, SlatesMessageActionTriggerEventMapResponse, SlatesMessageActionTriggerWebhookRegisterResponse, SlatesMessageActionTriggerWebhookHandleResponse, SlatesMessageActionTriggerWebhookUnregisterResponse } from '@slates/proto';
3
2
  import { Slate, SlateLogListener } from '@slates/provider';
4
3
 
5
4
  type SlatesJsonObject = Record<string, any>;
@@ -42,121 +41,14 @@ declare class SlatesProtocolClient {
42
41
  state: SlatesJsonObject;
43
42
  };
44
43
  private buildStateMessages;
45
- request<Key extends keyof typeof slatesRequestsByMethod>(method: Key, params: z.infer<(typeof slatesRequestsByMethod)[Key]>['params']): Promise<z.infer<(typeof slatesResponsesByMethod)[Key]>['result']>;
46
- identify(): Promise<{
47
- protocol: "slates@2026-01-01";
48
- provider: {
49
- type: "provider";
50
- id: string;
51
- name: string;
52
- description?: string | undefined;
53
- metadata?: Record<string, any> | undefined;
54
- };
55
- }>;
56
- listActions(): Promise<{
57
- actions: ({
58
- id: string;
59
- name: string;
60
- inputSchema: Record<string, any>;
61
- outputSchema: Record<string, any>;
62
- type: "action.tool";
63
- capabilities: Record<string, never>;
64
- description?: string | undefined;
65
- instructions?: string[] | undefined;
66
- constraints?: string[] | undefined;
67
- tags?: {
68
- destructive?: boolean | undefined;
69
- readOnly?: boolean | undefined;
70
- } | undefined;
71
- metadata?: Record<string, any> | undefined;
72
- scopes?: {
73
- AND: {
74
- OR: string[];
75
- }[];
76
- } | undefined;
77
- } | {
78
- id: string;
79
- name: string;
80
- inputSchema: Record<string, any>;
81
- outputSchema: Record<string, any>;
82
- type: "action.trigger";
83
- capabilities: Record<string, never>;
84
- invocation: {
85
- type: "polling";
86
- intervalSeconds: number;
87
- } | {
88
- type: "webhook";
89
- autoRegistration: boolean;
90
- autoUnregistration: boolean;
91
- };
92
- description?: string | undefined;
93
- instructions?: string[] | undefined;
94
- constraints?: string[] | undefined;
95
- tags?: {
96
- destructive?: boolean | undefined;
97
- readOnly?: boolean | undefined;
98
- } | undefined;
99
- metadata?: Record<string, any> | undefined;
100
- scopes?: {
101
- AND: {
102
- OR: string[];
103
- }[];
104
- } | undefined;
105
- })[];
106
- }>;
44
+ request<Key extends keyof SlatesResponsesByMethod & SlatesRequests['method']>(method: Key, params: Extract<SlatesRequests, {
45
+ method: Key;
46
+ }>['params']): Promise<SlatesResponsesByMethod[Key]['result']>;
47
+ identify(): Promise<SlatesMessageProviderIdentifyResponse['result']>;
48
+ listActions(): Promise<SlatesMessageActionsListResponse['result']>;
107
49
  listTools(): Promise<SlatesAction[]>;
108
50
  listTriggers(): Promise<SlatesAction[]>;
109
- getAction(actionId: string): Promise<{
110
- action: {
111
- id: string;
112
- name: string;
113
- inputSchema: Record<string, any>;
114
- outputSchema: Record<string, any>;
115
- type: "action.tool";
116
- capabilities: Record<string, never>;
117
- description?: string | undefined;
118
- instructions?: string[] | undefined;
119
- constraints?: string[] | undefined;
120
- tags?: {
121
- destructive?: boolean | undefined;
122
- readOnly?: boolean | undefined;
123
- } | undefined;
124
- metadata?: Record<string, any> | undefined;
125
- scopes?: {
126
- AND: {
127
- OR: string[];
128
- }[];
129
- } | undefined;
130
- } | {
131
- id: string;
132
- name: string;
133
- inputSchema: Record<string, any>;
134
- outputSchema: Record<string, any>;
135
- type: "action.trigger";
136
- capabilities: Record<string, never>;
137
- invocation: {
138
- type: "polling";
139
- intervalSeconds: number;
140
- } | {
141
- type: "webhook";
142
- autoRegistration: boolean;
143
- autoUnregistration: boolean;
144
- };
145
- description?: string | undefined;
146
- instructions?: string[] | undefined;
147
- constraints?: string[] | undefined;
148
- tags?: {
149
- destructive?: boolean | undefined;
150
- readOnly?: boolean | undefined;
151
- } | undefined;
152
- metadata?: Record<string, any> | undefined;
153
- scopes?: {
154
- AND: {
155
- OR: string[];
156
- }[];
157
- } | undefined;
158
- };
159
- }>;
51
+ getAction(actionId: string): Promise<SlatesMessageActionGetResponse['result']>;
160
52
  getTool(actionId: string): Promise<{
161
53
  id: string;
162
54
  name: string;
@@ -207,208 +99,23 @@ declare class SlatesProtocolClient {
207
99
  }[];
208
100
  } | undefined;
209
101
  }>;
210
- getConfigSchema(): Promise<{
211
- schema: Record<string, any>;
212
- }>;
213
- getDefaultConfig(): Promise<{
214
- config: Record<string, any> | null;
215
- requestTraces?: {
216
- startedAt: string;
217
- durationMs: number;
218
- request: {
219
- method: string;
220
- url: string;
221
- headers?: Record<string, string> | undefined;
222
- body?: {
223
- text: string;
224
- contentType?: string | undefined;
225
- truncated?: boolean | undefined;
226
- } | undefined;
227
- };
228
- response?: {
229
- status: number;
230
- statusText?: string | undefined;
231
- headers?: Record<string, string> | undefined;
232
- body?: {
233
- text: string;
234
- contentType?: string | undefined;
235
- truncated?: boolean | undefined;
236
- } | undefined;
237
- } | undefined;
238
- error?: {
239
- message: string;
240
- code?: string | undefined;
241
- } | undefined;
242
- }[] | undefined;
243
- }>;
244
- updateConfig(previousConfig: Record<string, any> | null, newConfig: Record<string, any>): Promise<{
245
- success: boolean;
246
- config?: Record<string, any> | undefined;
247
- errors?: {
248
- code: string;
249
- message: string;
250
- path?: string[] | undefined;
251
- }[] | undefined;
252
- requestTraces?: {
253
- startedAt: string;
254
- durationMs: number;
255
- request: {
256
- method: string;
257
- url: string;
258
- headers?: Record<string, string> | undefined;
259
- body?: {
260
- text: string;
261
- contentType?: string | undefined;
262
- truncated?: boolean | undefined;
263
- } | undefined;
264
- };
265
- response?: {
266
- status: number;
267
- statusText?: string | undefined;
268
- headers?: Record<string, string> | undefined;
269
- body?: {
270
- text: string;
271
- contentType?: string | undefined;
272
- truncated?: boolean | undefined;
273
- } | undefined;
274
- } | undefined;
275
- error?: {
276
- message: string;
277
- code?: string | undefined;
278
- } | undefined;
279
- }[] | undefined;
280
- }>;
102
+ getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
103
+ getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
104
+ updateConfig(previousConfig: Record<string, any> | null, newConfig: Record<string, any>): Promise<SlatesMessageConfigChangedResponse['result']>;
281
105
  listAuthMethods(): Promise<{
282
106
  authenticationMethods: SlateAuthenticationMethod[];
283
107
  }>;
284
- getAuthMethod(authenticationMethodId: string): Promise<{
285
- authenticationMethod: {
286
- id: string;
287
- name: string;
288
- type: "auth.oauth" | "auth.token" | "auth.service_account" | "auth.custom";
289
- inputSchema: Record<string, any>;
290
- outputSchema: Record<string, any>;
291
- capabilities: {
292
- getDefaultInput?: {
293
- enabled: boolean;
294
- } | undefined;
295
- handleChangedInput?: {
296
- enabled: boolean;
297
- } | undefined;
298
- handleTokenRefresh?: {
299
- enabled: boolean;
300
- } | undefined;
301
- getProfile?: {
302
- enabled: boolean;
303
- } | undefined;
304
- };
305
- scopes?: {
306
- id: string;
307
- title: string;
308
- description?: string | undefined;
309
- }[] | undefined;
310
- };
311
- }>;
312
- getDefaultAuthInput(authenticationMethodId: string): Promise<{
313
- input: Record<string, any>;
314
- requestTraces?: {
315
- startedAt: string;
316
- durationMs: number;
317
- request: {
318
- method: string;
319
- url: string;
320
- headers?: Record<string, string> | undefined;
321
- body?: {
322
- text: string;
323
- contentType?: string | undefined;
324
- truncated?: boolean | undefined;
325
- } | undefined;
326
- };
327
- response?: {
328
- status: number;
329
- statusText?: string | undefined;
330
- headers?: Record<string, string> | undefined;
331
- body?: {
332
- text: string;
333
- contentType?: string | undefined;
334
- truncated?: boolean | undefined;
335
- } | undefined;
336
- } | undefined;
337
- error?: {
338
- message: string;
339
- code?: string | undefined;
340
- } | undefined;
341
- }[] | undefined;
342
- }>;
108
+ getAuthMethod(authenticationMethodId: string): Promise<SlatesMessageAuthMethodGetResponse['result']>;
109
+ getDefaultAuthInput(authenticationMethodId: string): Promise<SlatesMessageAuthDefaultInputGetResponse['result']>;
343
110
  updateAuthInput(d: {
344
111
  authenticationMethodId: string;
345
112
  previousInput: Record<string, any> | null;
346
113
  newInput: Record<string, any>;
347
- }): Promise<{
348
- input?: Record<string, any> | undefined;
349
- requestTraces?: {
350
- startedAt: string;
351
- durationMs: number;
352
- request: {
353
- method: string;
354
- url: string;
355
- headers?: Record<string, string> | undefined;
356
- body?: {
357
- text: string;
358
- contentType?: string | undefined;
359
- truncated?: boolean | undefined;
360
- } | undefined;
361
- };
362
- response?: {
363
- status: number;
364
- statusText?: string | undefined;
365
- headers?: Record<string, string> | undefined;
366
- body?: {
367
- text: string;
368
- contentType?: string | undefined;
369
- truncated?: boolean | undefined;
370
- } | undefined;
371
- } | undefined;
372
- error?: {
373
- message: string;
374
- code?: string | undefined;
375
- } | undefined;
376
- }[] | undefined;
377
- }>;
114
+ }): Promise<SlatesMessageAuthInputChangedResponse['result']>;
378
115
  getAuthOutput(d: {
379
116
  authenticationMethodId: string;
380
117
  input: Record<string, any>;
381
- }): Promise<{
382
- output: Record<string, any>;
383
- requestTraces?: {
384
- startedAt: string;
385
- durationMs: number;
386
- request: {
387
- method: string;
388
- url: string;
389
- headers?: Record<string, string> | undefined;
390
- body?: {
391
- text: string;
392
- contentType?: string | undefined;
393
- truncated?: boolean | undefined;
394
- } | undefined;
395
- };
396
- response?: {
397
- status: number;
398
- statusText?: string | undefined;
399
- headers?: Record<string, string> | undefined;
400
- body?: {
401
- text: string;
402
- contentType?: string | undefined;
403
- truncated?: boolean | undefined;
404
- } | undefined;
405
- } | undefined;
406
- error?: {
407
- message: string;
408
- code?: string | undefined;
409
- } | undefined;
410
- }[] | undefined;
411
- }>;
118
+ }): Promise<SlatesMessageAuthOutputGetResponse['result']>;
412
119
  getAuthorizationUrl(d: {
413
120
  authenticationMethodId: string;
414
121
  redirectUri: string;
@@ -417,39 +124,7 @@ declare class SlatesProtocolClient {
417
124
  clientId: string;
418
125
  clientSecret: string;
419
126
  scopes: string[];
420
- }): Promise<{
421
- authorizationUrl: string;
422
- input?: Record<string, any> | undefined;
423
- callbackState?: Record<string, any> | undefined;
424
- requestTraces?: {
425
- startedAt: string;
426
- durationMs: number;
427
- request: {
428
- method: string;
429
- url: string;
430
- headers?: Record<string, string> | undefined;
431
- body?: {
432
- text: string;
433
- contentType?: string | undefined;
434
- truncated?: boolean | undefined;
435
- } | undefined;
436
- };
437
- response?: {
438
- status: number;
439
- statusText?: string | undefined;
440
- headers?: Record<string, string> | undefined;
441
- body?: {
442
- text: string;
443
- contentType?: string | undefined;
444
- truncated?: boolean | undefined;
445
- } | undefined;
446
- } | undefined;
447
- error?: {
448
- message: string;
449
- code?: string | undefined;
450
- } | undefined;
451
- }[] | undefined;
452
- }>;
127
+ }): Promise<SlatesMessageAuthAuthorizationUrlGetResponse['result']>;
453
128
  handleAuthorizationCallback(d: {
454
129
  authenticationMethodId: string;
455
130
  code: string;
@@ -472,182 +147,16 @@ declare class SlatesProtocolClient {
472
147
  clientId: string;
473
148
  clientSecret: string;
474
149
  scopes: string[];
475
- }): Promise<{
476
- output: Record<string, any>;
477
- input?: Record<string, any> | undefined;
478
- requestTraces?: {
479
- startedAt: string;
480
- durationMs: number;
481
- request: {
482
- method: string;
483
- url: string;
484
- headers?: Record<string, string> | undefined;
485
- body?: {
486
- text: string;
487
- contentType?: string | undefined;
488
- truncated?: boolean | undefined;
489
- } | undefined;
490
- };
491
- response?: {
492
- status: number;
493
- statusText?: string | undefined;
494
- headers?: Record<string, string> | undefined;
495
- body?: {
496
- text: string;
497
- contentType?: string | undefined;
498
- truncated?: boolean | undefined;
499
- } | undefined;
500
- } | undefined;
501
- error?: {
502
- message: string;
503
- code?: string | undefined;
504
- } | undefined;
505
- }[] | undefined;
506
- }>;
150
+ }): Promise<SlatesMessageAuthTokenRefreshHandleResponse['result']>;
507
151
  getAuthProfile(d: {
508
152
  authenticationMethodId: string;
509
153
  output: Record<string, any>;
510
154
  input: Record<string, any>;
511
155
  scopes: string[];
512
- }): Promise<{
513
- profile: Record<string, any>;
514
- requestTraces?: {
515
- startedAt: string;
516
- durationMs: number;
517
- request: {
518
- method: string;
519
- url: string;
520
- headers?: Record<string, string> | undefined;
521
- body?: {
522
- text: string;
523
- contentType?: string | undefined;
524
- truncated?: boolean | undefined;
525
- } | undefined;
526
- };
527
- response?: {
528
- status: number;
529
- statusText?: string | undefined;
530
- headers?: Record<string, string> | undefined;
531
- body?: {
532
- text: string;
533
- contentType?: string | undefined;
534
- truncated?: boolean | undefined;
535
- } | undefined;
536
- } | undefined;
537
- error?: {
538
- message: string;
539
- code?: string | undefined;
540
- } | undefined;
541
- }[] | undefined;
542
- }>;
543
- invokeTool(actionId: string, input: Record<string, any>): Promise<{
544
- output: Record<string, any>;
545
- message?: string | undefined;
546
- attachments?: {
547
- content: {
548
- type: "url";
549
- url: string;
550
- } | {
551
- type: "content";
552
- encoding: "base64" | "utf-8";
553
- content: string;
554
- };
555
- mimeType?: string | undefined;
556
- }[] | undefined;
557
- requestTraces?: {
558
- startedAt: string;
559
- durationMs: number;
560
- request: {
561
- method: string;
562
- url: string;
563
- headers?: Record<string, string> | undefined;
564
- body?: {
565
- text: string;
566
- contentType?: string | undefined;
567
- truncated?: boolean | undefined;
568
- } | undefined;
569
- };
570
- response?: {
571
- status: number;
572
- statusText?: string | undefined;
573
- headers?: Record<string, string> | undefined;
574
- body?: {
575
- text: string;
576
- contentType?: string | undefined;
577
- truncated?: boolean | undefined;
578
- } | undefined;
579
- } | undefined;
580
- error?: {
581
- message: string;
582
- code?: string | undefined;
583
- } | undefined;
584
- }[] | undefined;
585
- }>;
586
- mapTriggerEvent(actionId: string, input: Record<string, any>): Promise<{
587
- type: string;
588
- id: string;
589
- output: Record<string, any>;
590
- requestTraces?: {
591
- startedAt: string;
592
- durationMs: number;
593
- request: {
594
- method: string;
595
- url: string;
596
- headers?: Record<string, string> | undefined;
597
- body?: {
598
- text: string;
599
- contentType?: string | undefined;
600
- truncated?: boolean | undefined;
601
- } | undefined;
602
- };
603
- response?: {
604
- status: number;
605
- statusText?: string | undefined;
606
- headers?: Record<string, string> | undefined;
607
- body?: {
608
- text: string;
609
- contentType?: string | undefined;
610
- truncated?: boolean | undefined;
611
- } | undefined;
612
- } | undefined;
613
- error?: {
614
- message: string;
615
- code?: string | undefined;
616
- } | undefined;
617
- }[] | undefined;
618
- }>;
619
- registerTriggerWebhook(actionId: string, webhookBaseUrl: string): Promise<{
620
- registrationDetails: any;
621
- state?: any;
622
- requestTraces?: {
623
- startedAt: string;
624
- durationMs: number;
625
- request: {
626
- method: string;
627
- url: string;
628
- headers?: Record<string, string> | undefined;
629
- body?: {
630
- text: string;
631
- contentType?: string | undefined;
632
- truncated?: boolean | undefined;
633
- } | undefined;
634
- };
635
- response?: {
636
- status: number;
637
- statusText?: string | undefined;
638
- headers?: Record<string, string> | undefined;
639
- body?: {
640
- text: string;
641
- contentType?: string | undefined;
642
- truncated?: boolean | undefined;
643
- } | undefined;
644
- } | undefined;
645
- error?: {
646
- message: string;
647
- code?: string | undefined;
648
- } | undefined;
649
- }[] | undefined;
650
- }>;
156
+ }): Promise<SlatesMessageAuthProfileGetResponse['result']>;
157
+ invokeTool(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionInvokeResponse['result']>;
158
+ mapTriggerEvent(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionTriggerEventMapResponse['result']>;
159
+ registerTriggerWebhook(actionId: string, webhookBaseUrl: string): Promise<SlatesMessageActionTriggerWebhookRegisterResponse['result']>;
651
160
  handleTriggerWebhook(d: {
652
161
  actionId: string;
653
162
  url: string;
@@ -655,73 +164,13 @@ declare class SlatesProtocolClient {
655
164
  headers?: Record<string, string>;
656
165
  body?: string | Uint8Array | null;
657
166
  state?: any;
658
- }): Promise<{
659
- inputs: Record<string, any>[];
660
- updatedState?: any;
661
- requestTraces?: {
662
- startedAt: string;
663
- durationMs: number;
664
- request: {
665
- method: string;
666
- url: string;
667
- headers?: Record<string, string> | undefined;
668
- body?: {
669
- text: string;
670
- contentType?: string | undefined;
671
- truncated?: boolean | undefined;
672
- } | undefined;
673
- };
674
- response?: {
675
- status: number;
676
- statusText?: string | undefined;
677
- headers?: Record<string, string> | undefined;
678
- body?: {
679
- text: string;
680
- contentType?: string | undefined;
681
- truncated?: boolean | undefined;
682
- } | undefined;
683
- } | undefined;
684
- error?: {
685
- message: string;
686
- code?: string | undefined;
687
- } | undefined;
688
- }[] | undefined;
689
- }>;
167
+ }): Promise<SlatesMessageActionTriggerWebhookHandleResponse['result']>;
690
168
  unregisterTriggerWebhook(d: {
691
169
  actionId: string;
692
170
  webhookBaseUrl: string;
693
171
  registrationDetails: any;
694
172
  state?: any;
695
- }): Promise<{
696
- requestTraces?: {
697
- startedAt: string;
698
- durationMs: number;
699
- request: {
700
- method: string;
701
- url: string;
702
- headers?: Record<string, string> | undefined;
703
- body?: {
704
- text: string;
705
- contentType?: string | undefined;
706
- truncated?: boolean | undefined;
707
- } | undefined;
708
- };
709
- response?: {
710
- status: number;
711
- statusText?: string | undefined;
712
- headers?: Record<string, string> | undefined;
713
- body?: {
714
- text: string;
715
- contentType?: string | undefined;
716
- truncated?: boolean | undefined;
717
- } | undefined;
718
- } | undefined;
719
- error?: {
720
- message: string;
721
- code?: string | undefined;
722
- } | undefined;
723
- }[] | undefined;
724
- }>;
173
+ }): Promise<SlatesMessageActionTriggerWebhookUnregisterResponse['result']>;
725
174
  close(): Promise<void>;
726
175
  }
727
176
 
@@ -737,6 +186,7 @@ interface SlateProtocolErrorResponse {
737
186
  provider?: Record<string, unknown>;
738
187
  upstream?: Record<string, unknown>;
739
188
  baggage?: Record<string, unknown>;
189
+ requestTraces?: Array<Record<string, unknown>>;
740
190
  [key: string]: unknown;
741
191
  }
742
192
  declare class SlateProtocolError extends Error {
@@ -759,6 +209,7 @@ declare class SlateProtocolError extends Error {
759
209
  provider?: Record<string, unknown>;
760
210
  upstream?: Record<string, unknown>;
761
211
  baggage?: Record<string, unknown>;
212
+ requestTraces?: Array<Record<string, unknown>>;
762
213
  };
763
214
  static is(error: unknown): error is SlateProtocolError;
764
215
  static fromResponse(error: unknown, source?: SlateProtocolErrorSource): SlateProtocolError;