@slates/client 1.0.0-rc.6 → 1.0.0-rc.8

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.ts 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,209 +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
- defaultChecked?: boolean | undefined;
310
- }[] | undefined;
311
- };
312
- }>;
313
- getDefaultAuthInput(authenticationMethodId: string): Promise<{
314
- input: Record<string, any>;
315
- requestTraces?: {
316
- startedAt: string;
317
- durationMs: number;
318
- request: {
319
- method: string;
320
- url: string;
321
- headers?: Record<string, string> | undefined;
322
- body?: {
323
- text: string;
324
- contentType?: string | undefined;
325
- truncated?: boolean | undefined;
326
- } | undefined;
327
- };
328
- response?: {
329
- status: number;
330
- statusText?: string | undefined;
331
- headers?: Record<string, string> | undefined;
332
- body?: {
333
- text: string;
334
- contentType?: string | undefined;
335
- truncated?: boolean | undefined;
336
- } | undefined;
337
- } | undefined;
338
- error?: {
339
- message: string;
340
- code?: string | undefined;
341
- } | undefined;
342
- }[] | undefined;
343
- }>;
108
+ getAuthMethod(authenticationMethodId: string): Promise<SlatesMessageAuthMethodGetResponse['result']>;
109
+ getDefaultAuthInput(authenticationMethodId: string): Promise<SlatesMessageAuthDefaultInputGetResponse['result']>;
344
110
  updateAuthInput(d: {
345
111
  authenticationMethodId: string;
346
112
  previousInput: Record<string, any> | null;
347
113
  newInput: Record<string, any>;
348
- }): Promise<{
349
- input?: Record<string, any> | undefined;
350
- requestTraces?: {
351
- startedAt: string;
352
- durationMs: number;
353
- request: {
354
- method: string;
355
- url: string;
356
- headers?: Record<string, string> | undefined;
357
- body?: {
358
- text: string;
359
- contentType?: string | undefined;
360
- truncated?: boolean | undefined;
361
- } | undefined;
362
- };
363
- response?: {
364
- status: number;
365
- statusText?: string | undefined;
366
- headers?: Record<string, string> | undefined;
367
- body?: {
368
- text: string;
369
- contentType?: string | undefined;
370
- truncated?: boolean | undefined;
371
- } | undefined;
372
- } | undefined;
373
- error?: {
374
- message: string;
375
- code?: string | undefined;
376
- } | undefined;
377
- }[] | undefined;
378
- }>;
114
+ }): Promise<SlatesMessageAuthInputChangedResponse['result']>;
379
115
  getAuthOutput(d: {
380
116
  authenticationMethodId: string;
381
117
  input: Record<string, any>;
382
- }): Promise<{
383
- output: Record<string, any>;
384
- requestTraces?: {
385
- startedAt: string;
386
- durationMs: number;
387
- request: {
388
- method: string;
389
- url: string;
390
- headers?: Record<string, string> | undefined;
391
- body?: {
392
- text: string;
393
- contentType?: string | undefined;
394
- truncated?: boolean | undefined;
395
- } | undefined;
396
- };
397
- response?: {
398
- status: number;
399
- statusText?: string | undefined;
400
- headers?: Record<string, string> | undefined;
401
- body?: {
402
- text: string;
403
- contentType?: string | undefined;
404
- truncated?: boolean | undefined;
405
- } | undefined;
406
- } | undefined;
407
- error?: {
408
- message: string;
409
- code?: string | undefined;
410
- } | undefined;
411
- }[] | undefined;
412
- }>;
118
+ }): Promise<SlatesMessageAuthOutputGetResponse['result']>;
413
119
  getAuthorizationUrl(d: {
414
120
  authenticationMethodId: string;
415
121
  redirectUri: string;
@@ -418,39 +124,7 @@ declare class SlatesProtocolClient {
418
124
  clientId: string;
419
125
  clientSecret: string;
420
126
  scopes: string[];
421
- }): Promise<{
422
- authorizationUrl: string;
423
- input?: Record<string, any> | undefined;
424
- callbackState?: Record<string, any> | undefined;
425
- requestTraces?: {
426
- startedAt: string;
427
- durationMs: number;
428
- request: {
429
- method: string;
430
- url: string;
431
- headers?: Record<string, string> | undefined;
432
- body?: {
433
- text: string;
434
- contentType?: string | undefined;
435
- truncated?: boolean | undefined;
436
- } | undefined;
437
- };
438
- response?: {
439
- status: number;
440
- statusText?: string | undefined;
441
- headers?: Record<string, string> | undefined;
442
- body?: {
443
- text: string;
444
- contentType?: string | undefined;
445
- truncated?: boolean | undefined;
446
- } | undefined;
447
- } | undefined;
448
- error?: {
449
- message: string;
450
- code?: string | undefined;
451
- } | undefined;
452
- }[] | undefined;
453
- }>;
127
+ }): Promise<SlatesMessageAuthAuthorizationUrlGetResponse['result']>;
454
128
  handleAuthorizationCallback(d: {
455
129
  authenticationMethodId: string;
456
130
  code: string;
@@ -460,6 +134,7 @@ declare class SlatesProtocolClient {
460
134
  clientId: string;
461
135
  clientSecret: string;
462
136
  scopes: string[];
137
+ callbackParams?: Record<string, string>;
463
138
  callbackState?: Record<string, any>;
464
139
  }): Promise<{
465
140
  output: Record<string, any>;
@@ -473,182 +148,16 @@ declare class SlatesProtocolClient {
473
148
  clientId: string;
474
149
  clientSecret: string;
475
150
  scopes: string[];
476
- }): Promise<{
477
- output: Record<string, any>;
478
- input?: Record<string, any> | undefined;
479
- requestTraces?: {
480
- startedAt: string;
481
- durationMs: number;
482
- request: {
483
- method: string;
484
- url: string;
485
- headers?: Record<string, string> | undefined;
486
- body?: {
487
- text: string;
488
- contentType?: string | undefined;
489
- truncated?: boolean | undefined;
490
- } | undefined;
491
- };
492
- response?: {
493
- status: number;
494
- statusText?: string | undefined;
495
- headers?: Record<string, string> | undefined;
496
- body?: {
497
- text: string;
498
- contentType?: string | undefined;
499
- truncated?: boolean | undefined;
500
- } | undefined;
501
- } | undefined;
502
- error?: {
503
- message: string;
504
- code?: string | undefined;
505
- } | undefined;
506
- }[] | undefined;
507
- }>;
151
+ }): Promise<SlatesMessageAuthTokenRefreshHandleResponse['result']>;
508
152
  getAuthProfile(d: {
509
153
  authenticationMethodId: string;
510
154
  output: Record<string, any>;
511
155
  input: Record<string, any>;
512
156
  scopes: string[];
513
- }): Promise<{
514
- profile: Record<string, any>;
515
- requestTraces?: {
516
- startedAt: string;
517
- durationMs: number;
518
- request: {
519
- method: string;
520
- url: string;
521
- headers?: Record<string, string> | undefined;
522
- body?: {
523
- text: string;
524
- contentType?: string | undefined;
525
- truncated?: boolean | undefined;
526
- } | undefined;
527
- };
528
- response?: {
529
- status: number;
530
- statusText?: string | undefined;
531
- headers?: Record<string, string> | undefined;
532
- body?: {
533
- text: string;
534
- contentType?: string | undefined;
535
- truncated?: boolean | undefined;
536
- } | undefined;
537
- } | undefined;
538
- error?: {
539
- message: string;
540
- code?: string | undefined;
541
- } | undefined;
542
- }[] | undefined;
543
- }>;
544
- invokeTool(actionId: string, input: Record<string, any>): Promise<{
545
- output: Record<string, any>;
546
- message?: string | undefined;
547
- attachments?: {
548
- content: {
549
- type: "url";
550
- url: string;
551
- } | {
552
- type: "content";
553
- encoding: "base64" | "utf-8";
554
- content: string;
555
- };
556
- mimeType?: string | undefined;
557
- }[] | undefined;
558
- requestTraces?: {
559
- startedAt: string;
560
- durationMs: number;
561
- request: {
562
- method: string;
563
- url: string;
564
- headers?: Record<string, string> | undefined;
565
- body?: {
566
- text: string;
567
- contentType?: string | undefined;
568
- truncated?: boolean | undefined;
569
- } | undefined;
570
- };
571
- response?: {
572
- status: number;
573
- statusText?: string | undefined;
574
- headers?: Record<string, string> | undefined;
575
- body?: {
576
- text: string;
577
- contentType?: string | undefined;
578
- truncated?: boolean | undefined;
579
- } | undefined;
580
- } | undefined;
581
- error?: {
582
- message: string;
583
- code?: string | undefined;
584
- } | undefined;
585
- }[] | undefined;
586
- }>;
587
- mapTriggerEvent(actionId: string, input: Record<string, any>): Promise<{
588
- type: string;
589
- id: string;
590
- output: Record<string, any>;
591
- requestTraces?: {
592
- startedAt: string;
593
- durationMs: number;
594
- request: {
595
- method: string;
596
- url: string;
597
- headers?: Record<string, string> | undefined;
598
- body?: {
599
- text: string;
600
- contentType?: string | undefined;
601
- truncated?: boolean | undefined;
602
- } | undefined;
603
- };
604
- response?: {
605
- status: number;
606
- statusText?: string | undefined;
607
- headers?: Record<string, string> | undefined;
608
- body?: {
609
- text: string;
610
- contentType?: string | undefined;
611
- truncated?: boolean | undefined;
612
- } | undefined;
613
- } | undefined;
614
- error?: {
615
- message: string;
616
- code?: string | undefined;
617
- } | undefined;
618
- }[] | undefined;
619
- }>;
620
- registerTriggerWebhook(actionId: string, webhookBaseUrl: string): Promise<{
621
- registrationDetails: any;
622
- state?: any;
623
- requestTraces?: {
624
- startedAt: string;
625
- durationMs: number;
626
- request: {
627
- method: string;
628
- url: string;
629
- headers?: Record<string, string> | undefined;
630
- body?: {
631
- text: string;
632
- contentType?: string | undefined;
633
- truncated?: boolean | undefined;
634
- } | undefined;
635
- };
636
- response?: {
637
- status: number;
638
- statusText?: string | undefined;
639
- headers?: Record<string, string> | undefined;
640
- body?: {
641
- text: string;
642
- contentType?: string | undefined;
643
- truncated?: boolean | undefined;
644
- } | undefined;
645
- } | undefined;
646
- error?: {
647
- message: string;
648
- code?: string | undefined;
649
- } | undefined;
650
- }[] | undefined;
651
- }>;
157
+ }): Promise<SlatesMessageAuthProfileGetResponse['result']>;
158
+ invokeTool(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionInvokeResponse['result']>;
159
+ mapTriggerEvent(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionTriggerEventMapResponse['result']>;
160
+ registerTriggerWebhook(actionId: string, webhookBaseUrl: string): Promise<SlatesMessageActionTriggerWebhookRegisterResponse['result']>;
652
161
  handleTriggerWebhook(d: {
653
162
  actionId: string;
654
163
  url: string;
@@ -656,73 +165,13 @@ declare class SlatesProtocolClient {
656
165
  headers?: Record<string, string>;
657
166
  body?: string | Uint8Array | null;
658
167
  state?: any;
659
- }): Promise<{
660
- inputs: Record<string, any>[];
661
- updatedState?: any;
662
- requestTraces?: {
663
- startedAt: string;
664
- durationMs: number;
665
- request: {
666
- method: string;
667
- url: string;
668
- headers?: Record<string, string> | undefined;
669
- body?: {
670
- text: string;
671
- contentType?: string | undefined;
672
- truncated?: boolean | undefined;
673
- } | undefined;
674
- };
675
- response?: {
676
- status: number;
677
- statusText?: string | undefined;
678
- headers?: Record<string, string> | undefined;
679
- body?: {
680
- text: string;
681
- contentType?: string | undefined;
682
- truncated?: boolean | undefined;
683
- } | undefined;
684
- } | undefined;
685
- error?: {
686
- message: string;
687
- code?: string | undefined;
688
- } | undefined;
689
- }[] | undefined;
690
- }>;
168
+ }): Promise<SlatesMessageActionTriggerWebhookHandleResponse['result']>;
691
169
  unregisterTriggerWebhook(d: {
692
170
  actionId: string;
693
171
  webhookBaseUrl: string;
694
172
  registrationDetails: any;
695
173
  state?: any;
696
- }): Promise<{
697
- requestTraces?: {
698
- startedAt: string;
699
- durationMs: number;
700
- request: {
701
- method: string;
702
- url: string;
703
- headers?: Record<string, string> | undefined;
704
- body?: {
705
- text: string;
706
- contentType?: string | undefined;
707
- truncated?: boolean | undefined;
708
- } | undefined;
709
- };
710
- response?: {
711
- status: number;
712
- statusText?: string | undefined;
713
- headers?: Record<string, string> | undefined;
714
- body?: {
715
- text: string;
716
- contentType?: string | undefined;
717
- truncated?: boolean | undefined;
718
- } | undefined;
719
- } | undefined;
720
- error?: {
721
- message: string;
722
- code?: string | undefined;
723
- } | undefined;
724
- }[] | undefined;
725
- }>;
174
+ }): Promise<SlatesMessageActionTriggerWebhookUnregisterResponse['result']>;
726
175
  close(): Promise<void>;
727
176
  }
728
177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/client",
3
- "version": "1.0.0-rc.6",
3
+ "version": "1.0.0-rc.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,9 +31,9 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@slates/proto": "1.0.0-rc.8",
35
- "@slates/provider": "1.0.0-rc.10",
36
- "@slates/provider-handler": "1.0.0-rc.9"
34
+ "@slates/proto": "1.0.0-rc.9",
35
+ "@slates/provider": "1.0.0-rc.12",
36
+ "@slates/provider-handler": "1.0.0-rc.11"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@slates/tsconfig": "1.0.0-rc.1",
@@ -599,7 +599,7 @@ describe('@slates/client local transport', () => {
599
599
  expect(trace?.request.url).not.toContain('request-secret');
600
600
  expect(trace?.request.headers).toMatchObject({
601
601
  accept: 'application/json, text/plain, */*',
602
- 'user-agent': 'slates.dev@1.0.0/trace-slate',
602
+ 'user-agent': 'slates.dev/1.0.0 trace-slate',
603
603
  'x-slates-provider': 'trace-slate'
604
604
  });
605
605
  expect(trace?.request.headers).not.toHaveProperty('authorization');