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

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,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,6 +271,11 @@ 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;
@@ -223,9 +293,11 @@ declare let expectSlateContract: (d: {
223
293
  };
224
294
  toolIds?: string[];
225
295
  triggerIds?: string[];
296
+ triggerGroupIds?: string[];
226
297
  authMethodIds?: string[];
227
298
  tools?: ExpectedSlateAction[];
228
299
  triggers?: ExpectedSlateAction[];
300
+ triggerGroups?: ExpectedSlateTriggerGroup[];
229
301
  }) => Promise<{
230
302
  provider: {
231
303
  type: "provider";
@@ -239,8 +311,14 @@ declare let expectSlateContract: (d: {
239
311
  name: string;
240
312
  inputSchema: Record<string, any>;
241
313
  outputSchema: Record<string, any>;
314
+ docs: {
315
+ name: string;
316
+ url: string;
317
+ type?: "docs.action.general" | undefined;
318
+ }[];
242
319
  type: "action.tool";
243
320
  capabilities: Record<string, never>;
321
+ isPublic: boolean;
244
322
  description?: string | undefined;
245
323
  instructions?: string[] | undefined;
246
324
  constraints?: string[] | undefined;
@@ -254,21 +332,21 @@ declare let expectSlateContract: (d: {
254
332
  OR: string[];
255
333
  }[];
256
334
  } | undefined;
335
+ authMethods?: string[] | undefined;
336
+ adapter?: string | null | undefined;
257
337
  } | {
258
338
  id: string;
259
339
  name: string;
260
340
  inputSchema: Record<string, any>;
261
341
  outputSchema: Record<string, any>;
342
+ docs: {
343
+ name: string;
344
+ url: string;
345
+ type?: "docs.action.general" | undefined;
346
+ }[];
262
347
  type: "action.trigger";
263
348
  capabilities: Record<string, never>;
264
- invocation: {
265
- type: "polling";
266
- intervalSeconds: number;
267
- } | {
268
- type: "webhook";
269
- autoRegistration: boolean;
270
- autoUnregistration: boolean;
271
- };
349
+ triggerGroupId: string;
272
350
  description?: string | undefined;
273
351
  instructions?: string[] | undefined;
274
352
  constraints?: string[] | undefined;
@@ -282,14 +360,22 @@ declare let expectSlateContract: (d: {
282
360
  OR: string[];
283
361
  }[];
284
362
  } | undefined;
363
+ authMethods?: string[] | undefined;
364
+ adapter?: string | null | undefined;
285
365
  })[];
286
366
  tools: {
287
367
  id: string;
288
368
  name: string;
289
369
  inputSchema: Record<string, any>;
290
370
  outputSchema: Record<string, any>;
371
+ docs: {
372
+ name: string;
373
+ url: string;
374
+ type?: "docs.action.general" | undefined;
375
+ }[];
291
376
  type: "action.tool";
292
377
  capabilities: Record<string, never>;
378
+ isPublic: boolean;
293
379
  description?: string | undefined;
294
380
  instructions?: string[] | undefined;
295
381
  constraints?: string[] | undefined;
@@ -303,22 +389,22 @@ declare let expectSlateContract: (d: {
303
389
  OR: string[];
304
390
  }[];
305
391
  } | undefined;
392
+ authMethods?: string[] | undefined;
393
+ adapter?: string | null | undefined;
306
394
  }[];
307
395
  triggers: {
308
396
  id: string;
309
397
  name: string;
310
398
  inputSchema: Record<string, any>;
311
399
  outputSchema: Record<string, any>;
400
+ docs: {
401
+ name: string;
402
+ url: string;
403
+ type?: "docs.action.general" | undefined;
404
+ }[];
312
405
  type: "action.trigger";
313
406
  capabilities: Record<string, never>;
314
- invocation: {
315
- type: "polling";
316
- intervalSeconds: number;
317
- } | {
318
- type: "webhook";
319
- autoRegistration: boolean;
320
- autoUnregistration: boolean;
321
- };
407
+ triggerGroupId: string;
322
408
  description?: string | undefined;
323
409
  instructions?: string[] | undefined;
324
410
  constraints?: string[] | undefined;
@@ -332,6 +418,27 @@ declare let expectSlateContract: (d: {
332
418
  OR: string[];
333
419
  }[];
334
420
  } | undefined;
421
+ authMethods?: string[] | undefined;
422
+ adapter?: string | null | undefined;
423
+ }[];
424
+ triggerGroups: {
425
+ id: string;
426
+ name: string;
427
+ invocation: {
428
+ type: "polling";
429
+ intervalSeconds: number;
430
+ } | {
431
+ type: "webhook";
432
+ registration: {
433
+ mode: "auto";
434
+ } | {
435
+ mode: "manual";
436
+ userConfigSchema: Record<string, any>;
437
+ fullConfigSchema: Record<string, any>;
438
+ };
439
+ };
440
+ description?: string | undefined;
441
+ metadata?: Record<string, any> | undefined;
335
442
  }[];
336
443
  authMethods: {
337
444
  id: string;
@@ -353,6 +460,11 @@ declare let expectSlateContract: (d: {
353
460
  enabled: boolean;
354
461
  } | undefined;
355
462
  };
463
+ docs: {
464
+ name: string;
465
+ url: string;
466
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
467
+ }[];
356
468
  scopes?: {
357
469
  id: string;
358
470
  title: string;
@@ -361,13 +473,55 @@ declare let expectSlateContract: (d: {
361
473
  }[];
362
474
  configSchema: Record<string, any>;
363
475
  }>;
364
- declare let registerSlateTriggerWebhook: (d: {
476
+ declare let registerSlateTriggerGroupWebhook: (d: {
365
477
  client: SlatesTestClient;
366
- triggerId: string;
367
- webhookBaseUrl: string;
478
+ triggerGroupId: string;
479
+ webhookTargetIdentifier: string;
480
+ webhookTargetPayload: any;
481
+ webhookUrl: string;
368
482
  }) => Promise<{
369
- registrationDetails: any;
483
+ webhookRegistrationIdentifier: string;
484
+ webhookRegistrationPayload: any;
485
+ requestTraces?: {
486
+ startedAt: string;
487
+ durationMs: number;
488
+ request: {
489
+ method: string;
490
+ url: string;
491
+ headers?: Record<string, string> | undefined;
492
+ body?: {
493
+ text: string;
494
+ contentType?: string | undefined;
495
+ truncated?: boolean | undefined;
496
+ } | undefined;
497
+ };
498
+ response?: {
499
+ status: number;
500
+ statusText?: string | undefined;
501
+ headers?: Record<string, string> | undefined;
502
+ body?: {
503
+ text: string;
504
+ contentType?: string | undefined;
505
+ truncated?: boolean | undefined;
506
+ } | undefined;
507
+ } | undefined;
508
+ error?: {
509
+ message: string;
510
+ code?: string | undefined;
511
+ } | undefined;
512
+ }[] | undefined;
513
+ }>;
514
+ declare let pollSlateTriggerGroupEvents: (d: {
515
+ client: SlatesTestClient;
516
+ triggerGroupId: string;
370
517
  state?: any;
518
+ }) => Promise<{
519
+ events: {
520
+ payload: Record<string, any>;
521
+ triggerIds: string[];
522
+ idempotencyKey?: string | undefined;
523
+ }[];
524
+ updatedState?: any;
371
525
  requestTraces?: {
372
526
  startedAt: string;
373
527
  durationMs: number;
@@ -397,17 +551,29 @@ declare let registerSlateTriggerWebhook: (d: {
397
551
  } | undefined;
398
552
  }[] | undefined;
399
553
  }>;
400
- declare let handleSlateTriggerWebhook: (d: {
554
+ declare let processSlateTriggerGroupWebhook: (d: {
401
555
  client: SlatesTestClient;
402
- triggerId: string;
556
+ triggerGroupId: string;
403
557
  url: string;
404
558
  method?: string;
405
559
  headers?: Record<string, string>;
406
560
  body?: string | Uint8Array | null;
407
- state?: any;
561
+ webhookRegistrationPayload?: any;
408
562
  }) => Promise<{
409
- inputs: Record<string, any>[];
410
- updatedState?: any;
563
+ events: {
564
+ matchers: Record<string, any>[];
565
+ payload: Record<string, any>;
566
+ triggerIds: string[];
567
+ idempotencyKey?: string | undefined;
568
+ }[];
569
+ response?: {
570
+ status: number;
571
+ headers: Record<string, string>;
572
+ body: {
573
+ encoding: "base64";
574
+ content: string;
575
+ } | null;
576
+ } | null | undefined;
411
577
  requestTraces?: {
412
578
  startedAt: string;
413
579
  durationMs: number;
@@ -437,12 +603,11 @@ declare let handleSlateTriggerWebhook: (d: {
437
603
  } | undefined;
438
604
  }[] | undefined;
439
605
  }>;
440
- declare let unregisterSlateTriggerWebhook: (d: {
606
+ declare let unregisterSlateTriggerGroupWebhook: (d: {
441
607
  client: SlatesTestClient;
442
- triggerId: string;
443
- webhookBaseUrl: string;
444
- registrationDetails: any;
445
- state?: any;
608
+ triggerGroupId: string;
609
+ webhookRegistrationIdentifier: string;
610
+ webhookRegistrationPayload: any;
446
611
  }) => Promise<{
447
612
  requestTraces?: {
448
613
  startedAt: string;
@@ -513,6 +678,16 @@ declare let mapSlateTriggerEvent: (d: {
513
678
  }[] | undefined;
514
679
  }>;
515
680
  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
681
 
518
- export { type ExpectedSlateAction, type SlatesRuntimeContext, type SlatesTestClient, createLocalSlateTestClient, createSlatesTestClient, createSlatesVitestConfig, expectSlateContract, expectSlateError, expectToolCall, getSlateContract, handleSlateTriggerWebhook, loadSlatesProfile, loadSlatesRuntimeContext, mapSlateTriggerEvent, registerSlateTriggerWebhook, unregisterSlateTriggerWebhook, withSlateProfile };
682
+ type ToolSchemaTarget = {
683
+ key: string;
684
+ inputSchema: z.ZodType;
685
+ };
686
+ type ToolSchemaSource = readonly unknown[] | {
687
+ actions: readonly unknown[];
688
+ };
689
+ declare let getMcpCompatibleToolSchemaCases: (source: ToolSchemaSource) => ReadonlyArray<readonly [string, ToolSchemaTarget]>;
690
+ declare let expectMcpCompatibleToolSchema: (tool: ToolSchemaTarget) => void;
691
+ declare let describeMcpCompatibleToolSchemas: (name: string, source: ToolSchemaSource) => void;
692
+
693
+ 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 };