@slates/client 1.0.0-rc.11 → 1.0.0-rc.13

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
@@ -54,6 +54,11 @@ declare class SlatesProtocolClient {
54
54
  name: string;
55
55
  inputSchema: Record<string, any>;
56
56
  outputSchema: Record<string, any>;
57
+ docs: {
58
+ name: string;
59
+ url: string;
60
+ type?: "docs.action.general" | undefined;
61
+ }[];
57
62
  type: "action.tool";
58
63
  capabilities: Record<string, never>;
59
64
  description?: string | undefined;
@@ -69,12 +74,18 @@ declare class SlatesProtocolClient {
69
74
  OR: string[];
70
75
  }[];
71
76
  } | undefined;
77
+ authMethods?: string[] | undefined;
72
78
  }>;
73
79
  getTrigger(actionId: string): Promise<{
74
80
  id: string;
75
81
  name: string;
76
82
  inputSchema: Record<string, any>;
77
83
  outputSchema: Record<string, any>;
84
+ docs: {
85
+ name: string;
86
+ url: string;
87
+ type?: "docs.action.general" | undefined;
88
+ }[];
78
89
  type: "action.trigger";
79
90
  capabilities: Record<string, never>;
80
91
  invocation: {
@@ -98,6 +109,7 @@ declare class SlatesProtocolClient {
98
109
  OR: string[];
99
110
  }[];
100
111
  } | undefined;
112
+ authMethods?: string[] | undefined;
101
113
  }>;
102
114
  getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
103
115
  getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
package/dist/index.d.ts CHANGED
@@ -54,6 +54,11 @@ declare class SlatesProtocolClient {
54
54
  name: string;
55
55
  inputSchema: Record<string, any>;
56
56
  outputSchema: Record<string, any>;
57
+ docs: {
58
+ name: string;
59
+ url: string;
60
+ type?: "docs.action.general" | undefined;
61
+ }[];
57
62
  type: "action.tool";
58
63
  capabilities: Record<string, never>;
59
64
  description?: string | undefined;
@@ -69,12 +74,18 @@ declare class SlatesProtocolClient {
69
74
  OR: string[];
70
75
  }[];
71
76
  } | undefined;
77
+ authMethods?: string[] | undefined;
72
78
  }>;
73
79
  getTrigger(actionId: string): Promise<{
74
80
  id: string;
75
81
  name: string;
76
82
  inputSchema: Record<string, any>;
77
83
  outputSchema: Record<string, any>;
84
+ docs: {
85
+ name: string;
86
+ url: string;
87
+ type?: "docs.action.general" | undefined;
88
+ }[];
78
89
  type: "action.trigger";
79
90
  capabilities: Record<string, never>;
80
91
  invocation: {
@@ -98,6 +109,7 @@ declare class SlatesProtocolClient {
98
109
  OR: string[];
99
110
  }[];
100
111
  } | undefined;
112
+ authMethods?: string[] | undefined;
101
113
  }>;
102
114
  getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
103
115
  getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/client",
3
- "version": "1.0.0-rc.11",
3
+ "version": "1.0.0-rc.13",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -31,9 +31,9 @@
31
31
  "biome:check": "biome check --write src"
32
32
  },
33
33
  "dependencies": {
34
- "@slates/proto": "1.0.0-rc.10",
35
- "@slates/provider": "1.0.0-rc.14",
36
- "@slates/provider-handler": "1.0.0-rc.15"
34
+ "@slates/proto": "1.0.0-rc.12",
35
+ "@slates/provider": "1.0.0-rc.16",
36
+ "@slates/provider-handler": "1.0.0-rc.18"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@slates/tsconfig": "1.0.0-rc.1",
@@ -30,9 +30,17 @@ let createDemoSlate = () => {
30
30
  z.object({
31
31
  prefix: z.string()
32
32
  })
33
- ).getDefaultConfig(() => ({
34
- prefix: 'Hello'
35
- }));
33
+ )
34
+ .getDefaultConfig(() => ({
35
+ prefix: 'Hello'
36
+ }))
37
+ .docs([
38
+ {
39
+ type: 'docs.config.general',
40
+ name: 'Demo config docs',
41
+ url: 'https://example.com/docs/config'
42
+ }
43
+ ]);
36
44
 
37
45
  let demoAuth = SlateAuth.create<{ token: string }>()
38
46
  .output(
@@ -47,6 +55,13 @@ let createDemoSlate = () => {
47
55
  inputSchema: z.object({
48
56
  token: z.string()
49
57
  }),
58
+ docs: [
59
+ {
60
+ type: 'docs.auth.token',
61
+ name: 'Demo token auth docs',
62
+ url: 'https://example.com/docs/auth/token'
63
+ }
64
+ ],
50
65
  getDefaultInput: async () => ({
51
66
  token: 'default-token'
52
67
  }),
@@ -58,7 +73,8 @@ let createDemoSlate = () => {
58
73
  getOutput: async (ctx: { input: { token: string } }) => ({
59
74
  output: {
60
75
  token: ctx.input.token
61
- }
76
+ },
77
+ scopes: [`scope:${ctx.input.token}`]
62
78
  }),
63
79
  getProfile: async (ctx: { output: { token: string } }) => ({
64
80
  profile: {
@@ -71,13 +87,26 @@ let createDemoSlate = () => {
71
87
  key: 'demo-slate',
72
88
  name: 'Demo Slate',
73
89
  description: 'A tiny test slate',
90
+ docs: [
91
+ {
92
+ name: 'Demo provider docs',
93
+ url: 'https://example.com/docs/provider'
94
+ }
95
+ ],
74
96
  config: demoConfig,
75
97
  auth: demoAuth
76
98
  });
77
99
 
78
100
  let echoTool = SlateTool.create(spec, {
79
101
  key: 'echo',
80
- name: 'Echo'
102
+ name: 'Echo',
103
+ docs: [
104
+ {
105
+ type: 'docs.action.general',
106
+ name: 'Echo tool docs',
107
+ url: 'https://example.com/docs/actions/echo'
108
+ }
109
+ ]
81
110
  })
82
111
  .input(
83
112
  z.object({
@@ -97,6 +126,7 @@ let createDemoSlate = () => {
97
126
  }
98
127
  ]
99
128
  })
129
+ .authMethods(['token_auth'])
100
130
  .handleInvocation(async ctx => ({
101
131
  output: {
102
132
  greeting: `${ctx.config.prefix} ${ctx.input.name}`,
@@ -408,10 +438,23 @@ describe('@slates/client local transport', () => {
408
438
 
409
439
  let provider = await client.identify();
410
440
  expect(provider.provider.id).toBe('demo-slate');
441
+ expect(provider.docs).toEqual([
442
+ {
443
+ name: 'Demo provider docs',
444
+ url: 'https://example.com/docs/provider'
445
+ }
446
+ ]);
411
447
 
412
448
  let actions = await client.listTools();
413
449
  expect(actions).toHaveLength(1);
414
450
  expect(actions[0]!.id).toBe('echo');
451
+ expect(actions[0]!.docs).toEqual([
452
+ {
453
+ type: 'docs.action.general',
454
+ name: 'Echo tool docs',
455
+ url: 'https://example.com/docs/actions/echo'
456
+ }
457
+ ]);
415
458
  expect(actions[0]!.scopes).toEqual({
416
459
  AND: [
417
460
  {
@@ -419,9 +462,17 @@ describe('@slates/client local transport', () => {
419
462
  }
420
463
  ]
421
464
  });
465
+ expect(actions[0]!.authMethods).toEqual(['token_auth']);
422
466
 
423
467
  let configSchema = await client.getConfigSchema();
424
468
  expect(configSchema.schema.properties.prefix.type).toBe('string');
469
+ expect(configSchema.docs).toEqual([
470
+ {
471
+ type: 'docs.config.general',
472
+ name: 'Demo config docs',
473
+ url: 'https://example.com/docs/config'
474
+ }
475
+ ]);
425
476
 
426
477
  let defaultConfig = await client.getDefaultConfig();
427
478
  expect(defaultConfig.config).toEqual({ prefix: 'Hello' });
@@ -429,6 +480,13 @@ describe('@slates/client local transport', () => {
429
480
  let authMethods = await client.listAuthMethods();
430
481
  expect(authMethods.authenticationMethods).toHaveLength(1);
431
482
  expect(authMethods.authenticationMethods[0]!.type).toBe('auth.token');
483
+ expect(authMethods.authenticationMethods[0]!.docs).toEqual([
484
+ {
485
+ type: 'docs.auth.token',
486
+ name: 'Demo token auth docs',
487
+ url: 'https://example.com/docs/auth/token'
488
+ }
489
+ ]);
432
490
 
433
491
  let defaultInput = await client.getDefaultAuthInput('token_auth');
434
492
  expect(defaultInput.input).toEqual({ token: 'default-token' });
@@ -445,6 +503,7 @@ describe('@slates/client local transport', () => {
445
503
  input: changedInput.input ?? { token: '' }
446
504
  });
447
505
  expect(authOutput.output).toEqual({ token: 'trimmed-token' });
506
+ expect(authOutput.scopes).toEqual(['scope:trimmed-token']);
448
507
 
449
508
  client.setConfig({ prefix: 'Hi' });
450
509
  client.setAuth({