@slates/test 1.0.0-rc.2 → 1.0.0-rc.21

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,26 +1,37 @@
1
- import * as vite from 'vite';
2
1
  import * as _slates_client from '@slates/client';
3
- import { createSlatesClient, createLocalSlateTransport, SlatesProtocolClientOptions } from '@slates/client';
4
- import { createVitestConfig } from '@lowerdeck/testing-tools';
2
+ import { createSlatesClient, SlatesProtocolClientOptions } from '@slates/client';
3
+ import * as vitest from 'vitest';
5
4
  import { SlatesProfileRecord } from '@slates/profiles';
5
+ import { z } from 'zod';
6
6
 
7
7
  interface SlatesRuntimeContext {
8
8
  integration: string | null;
9
9
  profileId: string | null;
10
+ authMethodId: string | null;
10
11
  profile: SlatesProfileRecord | null;
12
+ rootDir: string;
11
13
  storePath: string;
12
14
  cliDir: string;
13
15
  }
14
16
  type SlatesTestClient = ReturnType<typeof createSlatesClient>;
15
- type LocalSlate = Parameters<typeof createLocalSlateTransport>[0]['slate'];
17
+ interface LocalSlateLike {
18
+ readonly spec: unknown;
19
+ readonly actions: readonly unknown[];
20
+ }
16
21
  interface ExpectedSlateAction {
17
22
  id: string;
18
23
  name?: string;
19
24
  description?: string;
20
25
  readOnly?: boolean;
21
26
  destructive?: boolean;
27
+ }
28
+ interface ExpectedSlateTriggerGroup {
29
+ id: string;
30
+ name?: string;
31
+ description?: string;
22
32
  invocationType?: 'polling' | 'webhook';
23
33
  }
34
+ declare let getVitestExpect: () => vitest.ExpectStatic;
24
35
  declare let loadSlatesRuntimeContext: (opts?: {
25
36
  cwd?: string;
26
37
  profile?: string | null;
@@ -45,6 +56,25 @@ declare let expectToolCall: (d: {
45
56
  }) => Promise<{
46
57
  output: Record<string, any>;
47
58
  message?: string | undefined;
59
+ attachments?: {
60
+ content: {
61
+ type: "url";
62
+ url: string;
63
+ headers?: Record<string, string> | undefined;
64
+ query?: Record<string, string> | undefined;
65
+ refreshReference?: unknown;
66
+ refreshAt?: string | undefined;
67
+ } | {
68
+ type: "content";
69
+ encoding: "utf-8" | "base64";
70
+ content: string;
71
+ } | {
72
+ type: "upload_reference";
73
+ referenceId: string;
74
+ };
75
+ mimeType?: string | undefined;
76
+ attachmentHash?: string | undefined;
77
+ }[] | undefined;
48
78
  requestTraces?: {
49
79
  startedAt: string;
50
80
  durationMs: number;
@@ -75,7 +105,7 @@ declare let expectToolCall: (d: {
75
105
  }[] | undefined;
76
106
  }>;
77
107
  declare let createLocalSlateTestClient: (opts: {
78
- slate: LocalSlate;
108
+ slate: LocalSlateLike;
79
109
  state?: SlatesProtocolClientOptions["state"];
80
110
  participants?: SlatesProtocolClientOptions["participants"];
81
111
  }) => _slates_client.SlatesProtocolClient;
@@ -92,8 +122,14 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
92
122
  name: string;
93
123
  inputSchema: Record<string, any>;
94
124
  outputSchema: Record<string, any>;
125
+ docs: {
126
+ name: string;
127
+ url: string;
128
+ type?: "docs.action.general" | undefined;
129
+ }[];
95
130
  type: "action.tool";
96
131
  capabilities: Record<string, never>;
132
+ isPublic: boolean;
97
133
  description?: string | undefined;
98
134
  instructions?: string[] | undefined;
99
135
  constraints?: string[] | undefined;
@@ -107,21 +143,21 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
107
143
  OR: string[];
108
144
  }[];
109
145
  } | undefined;
146
+ authMethods?: string[] | undefined;
147
+ adapter?: string | null | undefined;
110
148
  } | {
111
149
  id: string;
112
150
  name: string;
113
151
  inputSchema: Record<string, any>;
114
152
  outputSchema: Record<string, any>;
153
+ docs: {
154
+ name: string;
155
+ url: string;
156
+ type?: "docs.action.general" | undefined;
157
+ }[];
115
158
  type: "action.trigger";
116
159
  capabilities: Record<string, never>;
117
- invocation: {
118
- type: "polling";
119
- intervalSeconds: number;
120
- } | {
121
- type: "webhook";
122
- autoRegistration: boolean;
123
- autoUnregistration: boolean;
124
- };
160
+ triggerGroupId: string;
125
161
  description?: string | undefined;
126
162
  instructions?: string[] | undefined;
127
163
  constraints?: string[] | undefined;
@@ -135,14 +171,22 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
135
171
  OR: string[];
136
172
  }[];
137
173
  } | undefined;
174
+ authMethods?: string[] | undefined;
175
+ adapter?: string | null | undefined;
138
176
  })[];
139
177
  tools: {
140
178
  id: string;
141
179
  name: string;
142
180
  inputSchema: Record<string, any>;
143
181
  outputSchema: Record<string, any>;
182
+ docs: {
183
+ name: string;
184
+ url: string;
185
+ type?: "docs.action.general" | undefined;
186
+ }[];
144
187
  type: "action.tool";
145
188
  capabilities: Record<string, never>;
189
+ isPublic: boolean;
146
190
  description?: string | undefined;
147
191
  instructions?: string[] | undefined;
148
192
  constraints?: string[] | undefined;
@@ -156,22 +200,22 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
156
200
  OR: string[];
157
201
  }[];
158
202
  } | undefined;
203
+ authMethods?: string[] | undefined;
204
+ adapter?: string | null | undefined;
159
205
  }[];
160
206
  triggers: {
161
207
  id: string;
162
208
  name: string;
163
209
  inputSchema: Record<string, any>;
164
210
  outputSchema: Record<string, any>;
211
+ docs: {
212
+ name: string;
213
+ url: string;
214
+ type?: "docs.action.general" | undefined;
215
+ }[];
165
216
  type: "action.trigger";
166
217
  capabilities: Record<string, never>;
167
- invocation: {
168
- type: "polling";
169
- intervalSeconds: number;
170
- } | {
171
- type: "webhook";
172
- autoRegistration: boolean;
173
- autoUnregistration: boolean;
174
- };
218
+ triggerGroupId: string;
175
219
  description?: string | undefined;
176
220
  instructions?: string[] | undefined;
177
221
  constraints?: string[] | undefined;
@@ -185,6 +229,27 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
185
229
  OR: string[];
186
230
  }[];
187
231
  } | undefined;
232
+ authMethods?: string[] | undefined;
233
+ adapter?: string | null | undefined;
234
+ }[];
235
+ triggerGroups: {
236
+ id: string;
237
+ name: string;
238
+ invocation: {
239
+ type: "polling";
240
+ intervalSeconds: number;
241
+ } | {
242
+ type: "webhook";
243
+ registration: {
244
+ mode: "auto";
245
+ } | {
246
+ mode: "manual";
247
+ userConfigSchema: Record<string, any>;
248
+ fullConfigSchema: Record<string, any>;
249
+ };
250
+ };
251
+ description?: string | undefined;
252
+ metadata?: Record<string, any> | undefined;
188
253
  }[];
189
254
  authMethods: {
190
255
  id: string;
@@ -206,11 +271,17 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
206
271
  enabled: boolean;
207
272
  } | undefined;
208
273
  };
274
+ docs: {
275
+ name: string;
276
+ url: string;
277
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
278
+ }[];
209
279
  scopes?: {
210
280
  id: string;
211
281
  title: string;
212
282
  description?: string | undefined;
213
283
  }[] | undefined;
284
+ adapters?: string[] | undefined;
214
285
  }[];
215
286
  configSchema: Record<string, any>;
216
287
  }>;
@@ -223,9 +294,11 @@ declare let expectSlateContract: (d: {
223
294
  };
224
295
  toolIds?: string[];
225
296
  triggerIds?: string[];
297
+ triggerGroupIds?: string[];
226
298
  authMethodIds?: string[];
227
299
  tools?: ExpectedSlateAction[];
228
300
  triggers?: ExpectedSlateAction[];
301
+ triggerGroups?: ExpectedSlateTriggerGroup[];
229
302
  }) => Promise<{
230
303
  provider: {
231
304
  type: "provider";
@@ -239,8 +312,14 @@ declare let expectSlateContract: (d: {
239
312
  name: string;
240
313
  inputSchema: Record<string, any>;
241
314
  outputSchema: Record<string, any>;
315
+ docs: {
316
+ name: string;
317
+ url: string;
318
+ type?: "docs.action.general" | undefined;
319
+ }[];
242
320
  type: "action.tool";
243
321
  capabilities: Record<string, never>;
322
+ isPublic: boolean;
244
323
  description?: string | undefined;
245
324
  instructions?: string[] | undefined;
246
325
  constraints?: string[] | undefined;
@@ -254,21 +333,21 @@ declare let expectSlateContract: (d: {
254
333
  OR: string[];
255
334
  }[];
256
335
  } | undefined;
336
+ authMethods?: string[] | undefined;
337
+ adapter?: string | null | undefined;
257
338
  } | {
258
339
  id: string;
259
340
  name: string;
260
341
  inputSchema: Record<string, any>;
261
342
  outputSchema: Record<string, any>;
343
+ docs: {
344
+ name: string;
345
+ url: string;
346
+ type?: "docs.action.general" | undefined;
347
+ }[];
262
348
  type: "action.trigger";
263
349
  capabilities: Record<string, never>;
264
- invocation: {
265
- type: "polling";
266
- intervalSeconds: number;
267
- } | {
268
- type: "webhook";
269
- autoRegistration: boolean;
270
- autoUnregistration: boolean;
271
- };
350
+ triggerGroupId: string;
272
351
  description?: string | undefined;
273
352
  instructions?: string[] | undefined;
274
353
  constraints?: string[] | undefined;
@@ -282,14 +361,22 @@ declare let expectSlateContract: (d: {
282
361
  OR: string[];
283
362
  }[];
284
363
  } | undefined;
364
+ authMethods?: string[] | undefined;
365
+ adapter?: string | null | undefined;
285
366
  })[];
286
367
  tools: {
287
368
  id: string;
288
369
  name: string;
289
370
  inputSchema: Record<string, any>;
290
371
  outputSchema: Record<string, any>;
372
+ docs: {
373
+ name: string;
374
+ url: string;
375
+ type?: "docs.action.general" | undefined;
376
+ }[];
291
377
  type: "action.tool";
292
378
  capabilities: Record<string, never>;
379
+ isPublic: boolean;
293
380
  description?: string | undefined;
294
381
  instructions?: string[] | undefined;
295
382
  constraints?: string[] | undefined;
@@ -303,22 +390,22 @@ declare let expectSlateContract: (d: {
303
390
  OR: string[];
304
391
  }[];
305
392
  } | undefined;
393
+ authMethods?: string[] | undefined;
394
+ adapter?: string | null | undefined;
306
395
  }[];
307
396
  triggers: {
308
397
  id: string;
309
398
  name: string;
310
399
  inputSchema: Record<string, any>;
311
400
  outputSchema: Record<string, any>;
401
+ docs: {
402
+ name: string;
403
+ url: string;
404
+ type?: "docs.action.general" | undefined;
405
+ }[];
312
406
  type: "action.trigger";
313
407
  capabilities: Record<string, never>;
314
- invocation: {
315
- type: "polling";
316
- intervalSeconds: number;
317
- } | {
318
- type: "webhook";
319
- autoRegistration: boolean;
320
- autoUnregistration: boolean;
321
- };
408
+ triggerGroupId: string;
322
409
  description?: string | undefined;
323
410
  instructions?: string[] | undefined;
324
411
  constraints?: string[] | undefined;
@@ -332,6 +419,27 @@ declare let expectSlateContract: (d: {
332
419
  OR: string[];
333
420
  }[];
334
421
  } | undefined;
422
+ authMethods?: string[] | undefined;
423
+ adapter?: string | null | undefined;
424
+ }[];
425
+ triggerGroups: {
426
+ id: string;
427
+ name: string;
428
+ invocation: {
429
+ type: "polling";
430
+ intervalSeconds: number;
431
+ } | {
432
+ type: "webhook";
433
+ registration: {
434
+ mode: "auto";
435
+ } | {
436
+ mode: "manual";
437
+ userConfigSchema: Record<string, any>;
438
+ fullConfigSchema: Record<string, any>;
439
+ };
440
+ };
441
+ description?: string | undefined;
442
+ metadata?: Record<string, any> | undefined;
335
443
  }[];
336
444
  authMethods: {
337
445
  id: string;
@@ -353,21 +461,69 @@ declare let expectSlateContract: (d: {
353
461
  enabled: boolean;
354
462
  } | undefined;
355
463
  };
464
+ docs: {
465
+ name: string;
466
+ url: string;
467
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
468
+ }[];
356
469
  scopes?: {
357
470
  id: string;
358
471
  title: string;
359
472
  description?: string | undefined;
360
473
  }[] | undefined;
474
+ adapters?: string[] | undefined;
361
475
  }[];
362
476
  configSchema: Record<string, any>;
363
477
  }>;
364
- declare let registerSlateTriggerWebhook: (d: {
478
+ declare let registerSlateTriggerGroupWebhook: (d: {
365
479
  client: SlatesTestClient;
366
- triggerId: string;
367
- webhookBaseUrl: string;
480
+ triggerGroupId: string;
481
+ webhookTargetIdentifier: string;
482
+ webhookTargetPayload: any;
483
+ webhookUrl: string;
368
484
  }) => Promise<{
369
- registrationDetails: any;
485
+ webhookRegistrationIdentifier: string;
486
+ webhookRegistrationPayload: any;
487
+ requestTraces?: {
488
+ startedAt: string;
489
+ durationMs: number;
490
+ request: {
491
+ method: string;
492
+ url: string;
493
+ headers?: Record<string, string> | undefined;
494
+ body?: {
495
+ text: string;
496
+ contentType?: string | undefined;
497
+ truncated?: boolean | undefined;
498
+ } | undefined;
499
+ };
500
+ response?: {
501
+ status: number;
502
+ statusText?: string | undefined;
503
+ headers?: Record<string, string> | undefined;
504
+ body?: {
505
+ text: string;
506
+ contentType?: string | undefined;
507
+ truncated?: boolean | undefined;
508
+ } | undefined;
509
+ } | undefined;
510
+ error?: {
511
+ message: string;
512
+ code?: string | undefined;
513
+ } | undefined;
514
+ }[] | undefined;
515
+ }>;
516
+ declare let pollSlateTriggerGroupEvents: (d: {
517
+ client: SlatesTestClient;
518
+ triggerGroupId: string;
370
519
  state?: any;
520
+ }) => Promise<{
521
+ events: {
522
+ payload: Record<string, any>;
523
+ triggerIds: string[];
524
+ idempotencyKey?: string | undefined;
525
+ }[];
526
+ updatedState?: any;
371
527
  requestTraces?: {
372
528
  startedAt: string;
373
529
  durationMs: number;
@@ -397,17 +553,29 @@ declare let registerSlateTriggerWebhook: (d: {
397
553
  } | undefined;
398
554
  }[] | undefined;
399
555
  }>;
400
- declare let handleSlateTriggerWebhook: (d: {
556
+ declare let processSlateTriggerGroupWebhook: (d: {
401
557
  client: SlatesTestClient;
402
- triggerId: string;
558
+ triggerGroupId: string;
403
559
  url: string;
404
560
  method?: string;
405
561
  headers?: Record<string, string>;
406
562
  body?: string | Uint8Array | null;
407
- state?: any;
563
+ webhookRegistrationPayload?: any;
408
564
  }) => Promise<{
409
- inputs: Record<string, any>[];
410
- updatedState?: any;
565
+ events: {
566
+ matchers: Record<string, any>[];
567
+ payload: Record<string, any>;
568
+ triggerIds: string[];
569
+ idempotencyKey?: string | undefined;
570
+ }[];
571
+ response?: {
572
+ status: number;
573
+ headers: Record<string, string>;
574
+ body: {
575
+ encoding: "base64";
576
+ content: string;
577
+ } | null;
578
+ } | null | undefined;
411
579
  requestTraces?: {
412
580
  startedAt: string;
413
581
  durationMs: number;
@@ -437,12 +605,11 @@ declare let handleSlateTriggerWebhook: (d: {
437
605
  } | undefined;
438
606
  }[] | undefined;
439
607
  }>;
440
- declare let unregisterSlateTriggerWebhook: (d: {
608
+ declare let unregisterSlateTriggerGroupWebhook: (d: {
441
609
  client: SlatesTestClient;
442
- triggerId: string;
443
- webhookBaseUrl: string;
444
- registrationDetails: any;
445
- state?: any;
610
+ triggerGroupId: string;
611
+ webhookRegistrationIdentifier: string;
612
+ webhookRegistrationPayload: any;
446
613
  }) => Promise<{
447
614
  requestTraces?: {
448
615
  startedAt: string;
@@ -513,6 +680,16 @@ declare let mapSlateTriggerEvent: (d: {
513
680
  }[] | undefined;
514
681
  }>;
515
682
  declare let expectSlateError: (run: Promise<unknown> | (() => Promise<unknown>), expected: Record<string, any> | string | RegExp) => Promise<unknown>;
516
- declare let createSlatesVitestConfig: (config?: Parameters<typeof createVitestConfig>[0]) => vite.UserConfig;
517
683
 
518
- export { type ExpectedSlateAction, type SlatesRuntimeContext, type SlatesTestClient, createLocalSlateTestClient, createSlatesTestClient, createSlatesVitestConfig, expectSlateContract, expectSlateError, expectToolCall, getSlateContract, handleSlateTriggerWebhook, loadSlatesProfile, loadSlatesRuntimeContext, mapSlateTriggerEvent, registerSlateTriggerWebhook, unregisterSlateTriggerWebhook, withSlateProfile };
684
+ type ToolSchemaTarget = {
685
+ key: string;
686
+ inputSchema: z.ZodType;
687
+ };
688
+ type ToolSchemaSource = readonly unknown[] | {
689
+ actions: readonly unknown[];
690
+ };
691
+ declare let getMcpCompatibleToolSchemaCases: (source: ToolSchemaSource) => ReadonlyArray<readonly [string, ToolSchemaTarget]>;
692
+ declare let expectMcpCompatibleToolSchema: (tool: ToolSchemaTarget) => void;
693
+ declare let describeMcpCompatibleToolSchemas: (name: string, source: ToolSchemaSource) => void;
694
+
695
+ export { type ExpectedSlateAction, type ExpectedSlateTriggerGroup, type SlatesRuntimeContext, type SlatesTestClient, createLocalSlateTestClient, createSlatesTestClient, describeMcpCompatibleToolSchemas, expectMcpCompatibleToolSchema, expectSlateContract, expectSlateError, expectToolCall, getMcpCompatibleToolSchemaCases, getSlateContract, getVitestExpect, loadSlatesProfile, loadSlatesRuntimeContext, mapSlateTriggerEvent, pollSlateTriggerGroupEvents, processSlateTriggerGroupWebhook, registerSlateTriggerGroupWebhook, unregisterSlateTriggerGroupWebhook, withSlateProfile };