@kaiban/sdk 0.1.1 → 0.1.2

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.
Files changed (67) hide show
  1. package/README.md +376 -80
  2. package/dist/index.d.ts +6 -7
  3. package/dist/index.js +6 -7
  4. package/dist/lib/client.d.ts +5 -8
  5. package/dist/lib/client.js +5 -7
  6. package/dist/lib/http/HttpClient.js +5 -3
  7. package/dist/lib/resources/ActivitiesClient.d.ts +86 -27
  8. package/dist/lib/resources/ActivitiesClient.js +90 -29
  9. package/dist/lib/resources/AgentsClient.d.ts +68 -15
  10. package/dist/lib/resources/AgentsClient.js +75 -17
  11. package/dist/lib/resources/BoardsClient.d.ts +3 -3
  12. package/dist/lib/resources/BoardsClient.js +2 -2
  13. package/dist/lib/resources/CardsClient.d.ts +139 -12
  14. package/dist/lib/resources/CardsClient.js +171 -25
  15. package/dist/lib/resources/ExternalChannelsClient.d.ts +3 -3
  16. package/dist/lib/resources/ExternalChannelsClient.js +2 -2
  17. package/dist/lib/resources/ResourcesClient.d.ts +3 -30
  18. package/dist/lib/resources/ResourcesClient.js +2 -26
  19. package/dist/lib/resources/TeamsClient.d.ts +3 -3
  20. package/dist/lib/resources/TeamsClient.js +2 -2
  21. package/dist/types/a2a-data-parts.d.ts +2 -2
  22. package/dist/types/entities/activities.d.ts +56 -14
  23. package/dist/types/entities/activities.js +73 -1
  24. package/dist/types/entities/agent.d.ts +47 -5
  25. package/dist/types/entities/agent.js +25 -1
  26. package/dist/types/entities/card.d.ts +16 -26
  27. package/dist/types/entities/card.js +26 -1
  28. package/dist/types/entities/external-channel.d.ts +25 -5
  29. package/dist/types/entities/external-channel.js +16 -1
  30. package/dist/types/entities/index.d.ts +4 -5
  31. package/dist/types/entities/index.js +4 -5
  32. package/dist/types/entities/resource.d.ts +21 -12
  33. package/dist/types/entities/resource.js +7 -1
  34. package/dist/types/responses.d.ts +10 -10
  35. package/package.json +33 -6
  36. package/dist/lib/resources/BenchmarkExecutionsClient.d.ts +0 -250
  37. package/dist/lib/resources/BenchmarkExecutionsClient.js +0 -261
  38. package/dist/lib/resources/BenchmarksClient.d.ts +0 -159
  39. package/dist/lib/resources/BenchmarksClient.js +0 -158
  40. package/dist/lib/resources/SupervisorFeedbackClient.d.ts +0 -75
  41. package/dist/lib/resources/SupervisorFeedbackClient.js +0 -67
  42. package/dist/lib/resources/TeamMembersClient.d.ts +0 -66
  43. package/dist/lib/resources/TeamMembersClient.js +0 -75
  44. package/dist/lib/resources/__tests__/ActivitiesClient.test.d.ts +0 -1
  45. package/dist/lib/resources/__tests__/ActivitiesClient.test.js +0 -33
  46. package/dist/lib/resources/__tests__/AgentsClient.test.d.ts +0 -1
  47. package/dist/lib/resources/__tests__/AgentsClient.test.js +0 -37
  48. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.d.ts +0 -1
  49. package/dist/lib/resources/__tests__/BenchmarkExecutionsClient.test.js +0 -59
  50. package/dist/lib/resources/__tests__/BenchmarksClient.test.d.ts +0 -1
  51. package/dist/lib/resources/__tests__/BenchmarksClient.test.js +0 -42
  52. package/dist/lib/resources/__tests__/BoardsClient.test.d.ts +0 -1
  53. package/dist/lib/resources/__tests__/BoardsClient.test.js +0 -26
  54. package/dist/lib/resources/__tests__/CardsClient.test.d.ts +0 -1
  55. package/dist/lib/resources/__tests__/CardsClient.test.js +0 -62
  56. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.d.ts +0 -1
  57. package/dist/lib/resources/__tests__/ExternalChannelsClient.test.js +0 -26
  58. package/dist/lib/resources/__tests__/ResourcesClient.test.d.ts +0 -1
  59. package/dist/lib/resources/__tests__/ResourcesClient.test.js +0 -28
  60. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.d.ts +0 -1
  61. package/dist/lib/resources/__tests__/SupervisorFeedbackClient.test.js +0 -24
  62. package/dist/lib/resources/__tests__/TeamMembersClient.test.d.ts +0 -1
  63. package/dist/lib/resources/__tests__/TeamMembersClient.test.js +0 -26
  64. package/dist/lib/resources/__tests__/TeamsClient.test.d.ts +0 -1
  65. package/dist/lib/resources/__tests__/TeamsClient.test.js +0 -26
  66. package/dist/types/entities/benchmark.d.ts +0 -82
  67. package/dist/types/entities/benchmark.js +0 -1
@@ -1,158 +0,0 @@
1
- /**
2
- * Client for managing benchmarks in the Kaiban platform
3
- * Benchmarks are used to evaluate and test agent performance
4
- * @category Resources
5
- */
6
- export class BenchmarksClient {
7
- constructor(http) {
8
- this.http = http;
9
- }
10
- /**
11
- * List benchmarks with pagination, filters, and sorting
12
- *
13
- * @param params - Optional query parameters for filtering and pagination
14
- * @param params.cursor - Cursor for the next page of results
15
- * @param params.limit - Number of items per page
16
- * @param params.order_by - Fields to sort by
17
- * @param options - Optional request configuration
18
- *
19
- * @returns A paginated list of benchmarks
20
- *
21
- * @example
22
- * ```typescript
23
- * const result = await client.benchmarks.list({ limit: 10 });
24
- * console.log(result.items);
25
- * ```
26
- */
27
- list(params, options) {
28
- return this.http.list('/benchmarks', params, options);
29
- }
30
- /**
31
- * Iterate through all benchmarks using async generator
32
- * Automatically handles pagination by following next_page_token
33
- *
34
- * @param params - Optional query parameters (excluding cursor)
35
- * @param options - Optional request configuration
36
- *
37
- * @yields Individual Benchmark objects
38
- *
39
- * @example
40
- * ```typescript
41
- * for await (const benchmark of client.benchmarks.listAll()) {
42
- * console.log(benchmark.id, benchmark.name);
43
- * }
44
- * ```
45
- */
46
- async *listAll(params, options) {
47
- let pageToken = undefined;
48
- do {
49
- const page = await this.list({ ...(params || {}), cursor: pageToken }, options);
50
- for (const item of page.items)
51
- yield item;
52
- pageToken = page.next_page_token;
53
- } while (pageToken);
54
- }
55
- /**
56
- * Get a single benchmark by ID
57
- *
58
- * @param id - The unique identifier of the benchmark
59
- * @param options - Optional request configuration
60
- *
61
- * @returns The benchmark object
62
- *
63
- * @throws {Error} If the benchmark is not found or request fails
64
- *
65
- * @example
66
- * ```typescript
67
- * const benchmark = await client.benchmarks.get('benchmark-123');
68
- * console.log(benchmark.name, benchmark.description);
69
- * ```
70
- */
71
- get(id, options) {
72
- return this.http.get(`/benchmark/${encodeURIComponent(id)}`, options);
73
- }
74
- /**
75
- * Create a new benchmark
76
- *
77
- * @param data - Benchmark creation data
78
- * @param data.name - The benchmark name
79
- * @param data.description - Optional description
80
- * @param options - Optional request configuration
81
- *
82
- * @returns The newly created benchmark
83
- *
84
- * @throws {Error} If creation fails
85
- *
86
- * @example
87
- * ```typescript
88
- * const benchmark = await client.benchmarks.create({
89
- * name: 'Performance Test Suite',
90
- * description: 'Test agent response times',
91
- * test_cases: [...]
92
- * });
93
- * ```
94
- */
95
- create(data, options) {
96
- return this.http.post('/benchmarks', data, options);
97
- }
98
- /**
99
- * Update a benchmark's properties
100
- *
101
- * @param id - The unique identifier of the benchmark to update
102
- * @param data - Benchmark data with fields to update
103
- * @param options - Optional request configuration
104
- *
105
- * @returns The updated benchmark object
106
- *
107
- * @throws {Error} If the benchmark is not found or update fails
108
- *
109
- * @example
110
- * ```typescript
111
- * const updated = await client.benchmarks.update('benchmark-123', {
112
- * name: 'Updated Benchmark Name'
113
- * });
114
- * ```
115
- */
116
- update(id, data, options) {
117
- return this.http.put(`/benchmark/${encodeURIComponent(id)}`, data, options);
118
- }
119
- /**
120
- * Execute a benchmark against an agent
121
- * Runs the benchmark test suite with specified configuration
122
- *
123
- * @param params - Execution parameters
124
- * @param params.benchmark_id - The unique identifier of the benchmark to execute
125
- * @param params.body - Execution configuration
126
- * @param params.body.agentConfig - Agent configuration including ID, name, and card URL
127
- * @param params.body.thresholds - Optional performance thresholds
128
- * @param params.body.maxTests - Optional maximum number of tests to run
129
- * @param params.body.parallel - Optional flag to run tests in parallel
130
- * @param params.body.batchSize - Optional batch size for parallel execution
131
- * @param options - Optional request configuration
132
- *
133
- * @returns A response with execution status message
134
- *
135
- * @throws {Error} If the benchmark is not found or execution fails
136
- *
137
- * @example
138
- * ```typescript
139
- * const result = await client.benchmarks.execute({
140
- * benchmark_id: 'benchmark-123',
141
- * body: {
142
- * agentConfig: {
143
- * id: 'agent-456',
144
- * name: 'Test Agent',
145
- * cardUrl: 'https://example.com/agent-card'
146
- * },
147
- * maxTests: 100,
148
- * parallel: true,
149
- * batchSize: 10
150
- * }
151
- * });
152
- * console.log(result.message);
153
- * ```
154
- */
155
- execute(params, options) {
156
- return this.http.post(`/benchmark/${encodeURIComponent(params.benchmark_id)}/execute`, params.body, options);
157
- }
158
- }
@@ -1,75 +0,0 @@
1
- import { HttpClient } from '../http/HttpClient';
2
- import { RequestOptions } from '../http/types';
3
- import { ListParams, Paginated } from '../../types/responses';
4
- /**
5
- * Supervisor feedback item
6
- */
7
- export interface SupervisorFeedbackItem {
8
- /** Unique identifier for the feedback */
9
- id: string;
10
- /** The ID of the agent receiving feedback */
11
- agent_id: string;
12
- /** The feedback text */
13
- feedback: string;
14
- /** Timestamp when the feedback was created */
15
- created_at: string;
16
- }
17
- /**
18
- * Client for managing supervisor feedback in the Kaiban platform
19
- * Supervisor feedback tracks feedback given to agents by supervisors
20
- * @category Resources
21
- */
22
- export declare class SupervisorFeedbackClient {
23
- private readonly http;
24
- constructor(http: HttpClient);
25
- /**
26
- * List supervisor feedback for a specific agent
27
- *
28
- * @param params - Query parameters including agent_id and pagination options
29
- * @param params.agent_id - The unique identifier of the agent
30
- * @param params.cursor - Optional cursor for the next page of results
31
- * @param params.limit - Optional number of items per page
32
- * @param params.order_by - Optional fields to sort by
33
- * @param options - Optional request configuration
34
- *
35
- * @returns A paginated list of supervisor feedback items
36
- *
37
- * @example
38
- * ```typescript
39
- * const result = await client.supervisorFeedback.listByAgent({
40
- * agent_id: 'agent-123',
41
- * limit: 20,
42
- * order_by: ['created_at']
43
- * });
44
- *
45
- * result.items.forEach(feedback => {
46
- * console.log(feedback.feedback, feedback.created_at);
47
- * });
48
- * ```
49
- */
50
- listByAgent(params: {
51
- agent_id: string;
52
- } & ListParams, options?: RequestOptions): Promise<Paginated<SupervisorFeedbackItem>>;
53
- /**
54
- * Iterate through all feedback for a specific agent using async generator
55
- * Automatically handles pagination by following next_page_token
56
- *
57
- * @param params - Query parameters including agent_id (excluding cursor)
58
- * @param params.agent_id - The unique identifier of the agent
59
- * @param options - Optional request configuration
60
- *
61
- * @yields Individual SupervisorFeedbackItem objects
62
- *
63
- * @example
64
- * ```typescript
65
- * for await (const feedback of client.supervisorFeedback.listAllByAgent({
66
- * agent_id: 'agent-123'
67
- * })) {
68
- * console.log(feedback.feedback, feedback.created_at);
69
- * }
70
- * ```
71
- */
72
- listAllByAgent(params: {
73
- agent_id: string;
74
- } & Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<SupervisorFeedbackItem, void, unknown>;
75
- }
@@ -1,67 +0,0 @@
1
- /**
2
- * Client for managing supervisor feedback in the Kaiban platform
3
- * Supervisor feedback tracks feedback given to agents by supervisors
4
- * @category Resources
5
- */
6
- export class SupervisorFeedbackClient {
7
- constructor(http) {
8
- this.http = http;
9
- }
10
- /**
11
- * List supervisor feedback for a specific agent
12
- *
13
- * @param params - Query parameters including agent_id and pagination options
14
- * @param params.agent_id - The unique identifier of the agent
15
- * @param params.cursor - Optional cursor for the next page of results
16
- * @param params.limit - Optional number of items per page
17
- * @param params.order_by - Optional fields to sort by
18
- * @param options - Optional request configuration
19
- *
20
- * @returns A paginated list of supervisor feedback items
21
- *
22
- * @example
23
- * ```typescript
24
- * const result = await client.supervisorFeedback.listByAgent({
25
- * agent_id: 'agent-123',
26
- * limit: 20,
27
- * order_by: ['created_at']
28
- * });
29
- *
30
- * result.items.forEach(feedback => {
31
- * console.log(feedback.feedback, feedback.created_at);
32
- * });
33
- * ```
34
- */
35
- listByAgent(params, options) {
36
- const { agent_id, ...rest } = params;
37
- return this.http.list(`/supervisor-feedback/${encodeURIComponent(agent_id)}`, rest, options);
38
- }
39
- /**
40
- * Iterate through all feedback for a specific agent using async generator
41
- * Automatically handles pagination by following next_page_token
42
- *
43
- * @param params - Query parameters including agent_id (excluding cursor)
44
- * @param params.agent_id - The unique identifier of the agent
45
- * @param options - Optional request configuration
46
- *
47
- * @yields Individual SupervisorFeedbackItem objects
48
- *
49
- * @example
50
- * ```typescript
51
- * for await (const feedback of client.supervisorFeedback.listAllByAgent({
52
- * agent_id: 'agent-123'
53
- * })) {
54
- * console.log(feedback.feedback, feedback.created_at);
55
- * }
56
- * ```
57
- */
58
- async *listAllByAgent(params, options) {
59
- let cursor = undefined;
60
- do {
61
- const page = await this.listByAgent({ ...params, cursor }, options);
62
- for (const item of page.data)
63
- yield item;
64
- cursor = page.meta.next_cursor;
65
- } while (cursor);
66
- }
67
- }
@@ -1,66 +0,0 @@
1
- import { HttpClient } from '../http/HttpClient';
2
- import { RequestOptions } from '../http/types';
3
- import { TeamMember } from '../../types/entities';
4
- import { ListParams, Paginated } from '../../types/responses';
5
- /**
6
- * Client for managing team members in the Kaiban platform
7
- * @category Resources
8
- */
9
- export declare class TeamMembersClient {
10
- private readonly http;
11
- constructor(http: HttpClient);
12
- /**
13
- * List team members with pagination, filters, and sorting
14
- *
15
- * @param params - Optional query parameters for filtering and pagination
16
- * @param params.cursor - Cursor for the next page of results
17
- * @param params.limit - Number of items per page
18
- * @param params.order_by - Fields to sort by
19
- * @param options - Optional request configuration
20
- *
21
- * @returns A paginated list of team members
22
- *
23
- * @example
24
- * ```typescript
25
- * const result = await client.teamMembers.list({
26
- * limit: 50,
27
- * order_by: ['name']
28
- * });
29
- * ```
30
- */
31
- list(params?: ListParams, options?: RequestOptions): Promise<Paginated<TeamMember>>;
32
- /**
33
- * Iterate through all team members using async generator
34
- * Automatically handles pagination by following next_page_token
35
- *
36
- * @param params - Optional query parameters (excluding cursor)
37
- * @param options - Optional request configuration
38
- *
39
- * @yields Individual TeamMember objects
40
- *
41
- * @example
42
- * ```typescript
43
- * for await (const member of client.teamMembers.listAll()) {
44
- * console.log(member.id, member.name, member.role);
45
- * }
46
- * ```
47
- */
48
- listAll(params?: Omit<ListParams, 'cursor'>, options?: RequestOptions): AsyncGenerator<TeamMember, void, unknown>;
49
- /**
50
- * Get a single team member by ID
51
- *
52
- * @param id - The unique identifier of the team member
53
- * @param options - Optional request configuration
54
- *
55
- * @returns The team member object
56
- *
57
- * @throws {Error} If the team member is not found or request fails
58
- *
59
- * @example
60
- * ```typescript
61
- * const member = await client.teamMembers.get('member-123');
62
- * console.log(member.name, member.role);
63
- * ```
64
- */
65
- get(id: string, options?: RequestOptions): Promise<TeamMember>;
66
- }
@@ -1,75 +0,0 @@
1
- /**
2
- * Client for managing team members in the Kaiban platform
3
- * @category Resources
4
- */
5
- export class TeamMembersClient {
6
- constructor(http) {
7
- this.http = http;
8
- }
9
- /**
10
- * List team members with pagination, filters, and sorting
11
- *
12
- * @param params - Optional query parameters for filtering and pagination
13
- * @param params.cursor - Cursor for the next page of results
14
- * @param params.limit - Number of items per page
15
- * @param params.order_by - Fields to sort by
16
- * @param options - Optional request configuration
17
- *
18
- * @returns A paginated list of team members
19
- *
20
- * @example
21
- * ```typescript
22
- * const result = await client.teamMembers.list({
23
- * limit: 50,
24
- * order_by: ['name']
25
- * });
26
- * ```
27
- */
28
- list(params, options) {
29
- return this.http.list('/team-members', params, options);
30
- }
31
- /**
32
- * Iterate through all team members using async generator
33
- * Automatically handles pagination by following next_page_token
34
- *
35
- * @param params - Optional query parameters (excluding cursor)
36
- * @param options - Optional request configuration
37
- *
38
- * @yields Individual TeamMember objects
39
- *
40
- * @example
41
- * ```typescript
42
- * for await (const member of client.teamMembers.listAll()) {
43
- * console.log(member.id, member.name, member.role);
44
- * }
45
- * ```
46
- */
47
- async *listAll(params, options) {
48
- let pageToken = undefined;
49
- do {
50
- const page = await this.list({ ...(params || {}), cursor: pageToken }, options);
51
- for (const item of page.items)
52
- yield item;
53
- pageToken = page.next_page_token;
54
- } while (pageToken);
55
- }
56
- /**
57
- * Get a single team member by ID
58
- *
59
- * @param id - The unique identifier of the team member
60
- * @param options - Optional request configuration
61
- *
62
- * @returns The team member object
63
- *
64
- * @throws {Error} If the team member is not found or request fails
65
- *
66
- * @example
67
- * ```typescript
68
- * const member = await client.teamMembers.get('member-123');
69
- * console.log(member.name, member.role);
70
- * ```
71
- */
72
- get(id, options) {
73
- return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
74
- }
75
- }
@@ -1,33 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { createKaibanClient } from '../../client';
3
- import { createMockFetch, jsonOk } from '../../../test/helpers/mockFetch';
4
- function makeClient(responses) {
5
- const fetch = createMockFetch(responses);
6
- return createKaibanClient({ tenant: 't', token: 'x', fetch });
7
- }
8
- describe('ActivitiesClient', () => {
9
- it('lists activities and iterates', async () => {
10
- const client = makeClient([
11
- jsonOk({ items: [{ id: 'act1' }], next_page_token: 'n1' }),
12
- jsonOk({ items: [{ id: 'act2' }] }),
13
- ]);
14
- const page = await client.activities.list('c1', { page_size: 1 });
15
- expect(page.items[0].id).toBe('act1');
16
- const all = [];
17
- for await (const a of client.activities.listAll('c1', { page_size: 1 }))
18
- all.push(a);
19
- expect(all.map((x) => x.id)).toEqual(['act1', 'act2']);
20
- });
21
- it('creates an activity', async () => {
22
- const client = makeClient([jsonOk({ id: 'act1' })]);
23
- const res = await client.activities.create('c1', {
24
- board_id: 'b',
25
- card_id: 'c1',
26
- team_id: 't',
27
- type: 'card_created',
28
- description: 'd',
29
- actor: { id: 'x', type: 'system', name: 'n' },
30
- });
31
- expect(res.id).toBe('act1');
32
- });
33
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,37 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { createKaibanClient } from '../../client';
3
- import { createMockFetch, jsonOk } from '../../../test/helpers/mockFetch';
4
- function makeClient(responses) {
5
- const fetch = createMockFetch(responses);
6
- return createKaibanClient({ tenant: 't', token: 'x', fetch });
7
- }
8
- describe('AgentsClient', () => {
9
- it('lists agents with pagination', async () => {
10
- const client = makeClient([
11
- jsonOk({ items: [{ id: 'a1' }], next_page_token: 'n1' }),
12
- jsonOk({ items: [{ id: 'a2' }], next_page_token: undefined }),
13
- ]);
14
- const page1 = await client.agents.list({ page_size: 1 });
15
- expect(page1.items[0].id).toBe('a1');
16
- expect(page1.next_page_token).toBe('n1');
17
- const items = [];
18
- for await (const a of client.agents.listAll({ page_size: 1 }))
19
- items.push(a);
20
- expect(items.map((x) => x.id)).toEqual(['a1', 'a2']);
21
- });
22
- it('gets an agent', async () => {
23
- const client = makeClient([jsonOk({ id: 'a1', name: 'Agent' })]);
24
- const agent = await client.agents.get('a1');
25
- expect(agent.id).toBe('a1');
26
- });
27
- it('updates an agent', async () => {
28
- const client = makeClient([jsonOk({ id: 'a1', name: 'New' })]);
29
- const updated = await client.agents.update('a1', { name: 'New' });
30
- expect(updated.name).toBe('New');
31
- });
32
- it('creates feedback', async () => {
33
- const client = makeClient([jsonOk({})]);
34
- await client.agents.createFeedback('a1', { rating: 5 });
35
- expect(true).toBe(true);
36
- });
37
- });
@@ -1,59 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { createKaibanClient } from '../../client';
3
- import { createMockFetch, jsonOk } from '../../../test/helpers/mockFetch';
4
- function makeClient(responses) {
5
- const fetch = createMockFetch(responses);
6
- return createKaibanClient({ tenant: 't', token: 'x', fetch });
7
- }
8
- describe('BenchmarkExecutionsClient', () => {
9
- it('lists executions and iterates', async () => {
10
- const client = makeClient([
11
- jsonOk({ items: [{ id: 'e1' }], next_page_token: 'n1' }),
12
- jsonOk({ items: [{ id: 'e2' }] }),
13
- ]);
14
- const page = await client.benchmarkExecutions.list({ page_size: 1 });
15
- expect(page.items[0].id).toBe('e1');
16
- const all = [];
17
- for await (const e of client.benchmarkExecutions.listAll({ page_size: 1 }))
18
- all.push(e);
19
- expect(all.map((x) => x.id)).toEqual(['e1', 'e2']);
20
- });
21
- it('CRUD execution', async () => {
22
- const client = makeClient([jsonOk({ id: 'e1' }), jsonOk({ id: 'e1' }), jsonOk({})]);
23
- const c = await client.benchmarkExecutions.create({ benchmark_id: 'b', agent_id: 'a' });
24
- expect(c.id).toBe('e1');
25
- const g = await client.benchmarkExecutions.get('e1');
26
- expect(g.id).toBe('e1');
27
- await client.benchmarkExecutions.delete('e1');
28
- expect(true).toBe(true);
29
- });
30
- it('test cases: create, list, get, update, delete', async () => {
31
- const client = makeClient([
32
- jsonOk({ id: 't1' }),
33
- jsonOk({ items: [{ id: 't1' }] }),
34
- jsonOk({ id: 't1' }),
35
- jsonOk({ id: 't1', test_index: 1 }),
36
- jsonOk({}),
37
- ]);
38
- const tc = await client.benchmarkExecutions.createTestCase({
39
- execution_id: 'e1',
40
- body: { input: 'i', agent_output: 'o', execution_time: 1 },
41
- });
42
- expect(tc.id).toBe('t1');
43
- const list = await client.benchmarkExecutions.listTestCases({ execution_id: 'e1' });
44
- expect(list.items[0].id).toBe('t1');
45
- const g = await client.benchmarkExecutions.getTestCase({
46
- execution_id: 'e1',
47
- test_case_id: 't1',
48
- });
49
- expect(g.id).toBe('t1');
50
- const u = await client.benchmarkExecutions.updateTestCase({
51
- execution_id: 'e1',
52
- test_case_id: 't1',
53
- body: { test_index: 1 },
54
- });
55
- expect(u.test_index).toBe(1);
56
- await client.benchmarkExecutions.deleteTestCase({ execution_id: 'e1', test_case_id: 't1' });
57
- expect(true).toBe(true);
58
- });
59
- });
@@ -1,42 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { createKaibanClient } from '../../client';
3
- import { createMockFetch, jsonOk } from '../../../test/helpers/mockFetch';
4
- function makeClient(responses) {
5
- const fetch = createMockFetch(responses);
6
- return createKaibanClient({ tenant: 't', token: 'x', fetch });
7
- }
8
- describe('BenchmarksClient', () => {
9
- it('lists and iterates benchmarks', async () => {
10
- const client = makeClient([
11
- jsonOk({ items: [{ id: 'bm1' }], next_page_token: 'n1' }),
12
- jsonOk({ items: [{ id: 'bm2' }] }),
13
- ]);
14
- const page = await client.benchmarks.list({ page_size: 1 });
15
- expect(page.items[0].id).toBe('bm1');
16
- const all = [];
17
- for await (const b of client.benchmarks.listAll({ page_size: 1 }))
18
- all.push(b);
19
- expect(all.map((x) => x.id)).toEqual(['bm1', 'bm2']);
20
- });
21
- it('gets, creates and updates benchmark', async () => {
22
- const client = makeClient([
23
- jsonOk({ id: 'bm1' }),
24
- jsonOk({ id: 'bm2' }),
25
- jsonOk({ id: 'bm2', name: 'n' }),
26
- ]);
27
- const g = await client.benchmarks.get('bm1');
28
- expect(g.id).toBe('bm1');
29
- const c = await client.benchmarks.create({ name: 'x' });
30
- expect(c.id).toBe('bm2');
31
- const u = await client.benchmarks.update('bm2', { name: 'n' });
32
- expect(u.name).toBe('n');
33
- });
34
- it('executes a benchmark', async () => {
35
- const client = makeClient([jsonOk({ message: 'ok' })]);
36
- const res = await client.benchmarks.execute({
37
- benchmark_id: 'bm1',
38
- body: { agentConfig: { id: 'a' } },
39
- });
40
- expect(res.message).toBe('ok');
41
- });
42
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { createKaibanClient } from '../../client';
3
- import { createMockFetch, jsonOk } from '../../../test/helpers/mockFetch';
4
- function makeClient(responses) {
5
- const fetch = createMockFetch(responses);
6
- return createKaibanClient({ tenant: 't', token: 'x', fetch });
7
- }
8
- describe('BoardsClient', () => {
9
- it('lists boards and iterates', async () => {
10
- const client = makeClient([
11
- jsonOk({ items: [{ id: 'b1' }], next_page_token: 'n1' }),
12
- jsonOk({ items: [{ id: 'b2' }] }),
13
- ]);
14
- const page = await client.boards.list({ page_size: 1 });
15
- expect(page.items[0].id).toBe('b1');
16
- const all = [];
17
- for await (const b of client.boards.listAll({ page_size: 1 }))
18
- all.push(b);
19
- expect(all.map((x) => x.id)).toEqual(['b1', 'b2']);
20
- });
21
- it('gets a board', async () => {
22
- const client = makeClient([jsonOk({ id: 'b1' })]);
23
- const board = await client.boards.get('b1');
24
- expect(board.id).toBe('b1');
25
- });
26
- });
@@ -1 +0,0 @@
1
- export {};