@kaiban/sdk 0.2.0 → 0.3.0

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/README.md CHANGED
@@ -35,11 +35,12 @@ The SDK provides clients for the following API resources:
35
35
 
36
36
  ### Available Resource Clients
37
37
 
38
- - **agents**: `list`, `listAll`, `get`, `update`, `createFeedback`, `listSupervisorFeedback`
38
+ - **agents**: `list`, `listAll`, `get`, `create`, `update`, `createFeedback`, `listSupervisorFeedback`
39
+ - **teamMembers**: `list`, `listAll`, `get`
39
40
  - **cards**: `list`, `listAll`, `get`, `create`, `update`, `delete`, `moveToColumn`, `createActivity`, `createBatchActivities`, `listActivities`, `listAllActivities`
40
41
  - **activities**: `list`, `listAll`, `create`, `createBatch`
41
42
  - **teams**: `list`, `listAll`, `get`
42
- - **boards**: `list`, `listAll`, `get`
43
+ - **boards**: `list`, `listAll`, `get`, `create`
43
44
  - **resources**: `list`, `listAll`, `get`
44
45
  - **external_channels**: `list`, `listAll`, `get`
45
46
  - **costs**: `calculateCosts` (offline utility for model cost calculations)
@@ -358,6 +359,19 @@ for await (const agent of client.agents.listAll({ limit: 100 })) {
358
359
  // Get agent by id
359
360
  const agent = await client.agents.get('agent-123');
360
361
 
362
+ // Create a new agent
363
+ const newAgent = await client.agents.create({
364
+ name: 'SupportAgent',
365
+ description: 'Handles support tickets',
366
+ team_id: 'team_123',
367
+ owner_id: 'user_123',
368
+ created_by: 'user_123',
369
+ type: 'a2a',
370
+ status: 'active',
371
+ monthly_budget: 200,
372
+ examples: [],
373
+ });
374
+
361
375
  // Update agent
362
376
  const updated = await client.agents.update('agent-123', {
363
377
  name: 'Updated Name',
@@ -400,6 +414,24 @@ for await (const team of client.teams.listAll()) {
400
414
  const team = await client.teams.get('team-123');
401
415
  ```
402
416
 
417
+ ### Team Members
418
+
419
+ ```ts
420
+ // List team members with pagination
421
+ const result = await client.teamMembers.list({
422
+ limit: 20,
423
+ order_by: '-joined_at',
424
+ });
425
+
426
+ // Iterate through all team members
427
+ for await (const member of client.teamMembers.listAll({ limit: 100 })) {
428
+ console.log(member.id, member.user_id, member.role);
429
+ }
430
+
431
+ // Get a specific team member
432
+ const member = await client.teamMembers.get('tm-123');
433
+ ```
434
+
403
435
  ### Boards
404
436
 
405
437
  ```ts
@@ -413,6 +445,17 @@ for await (const board of client.boards.listAll()) {
413
445
 
414
446
  // Get a specific board
415
447
  const board = await client.boards.get('board-123');
448
+
449
+ // Create a new board
450
+ const newBoard = await client.boards.create({
451
+ name: 'Sales',
452
+ team_id: 'team_123',
453
+ owner_id: 'user_123',
454
+ created_by: 'user_123',
455
+ description: 'Manage pipeline',
456
+ columns: [],
457
+ // agent_ids, member_ids, and allowed_roles are optional (default to [])
458
+ });
416
459
  ```
417
460
 
418
461
  ### Cards
@@ -9,6 +9,7 @@ const CardsClient_1 = require("./resources/CardsClient");
9
9
  const ExternalChannelsClient_1 = require("./resources/ExternalChannelsClient");
10
10
  const ModelCost_1 = require("./resources/ModelCost");
11
11
  const ResourcesClient_1 = require("./resources/ResourcesClient");
12
+ const TeamMembersClient_1 = require("./resources/TeamMembersClient");
12
13
  const TeamsClient_1 = require("./resources/TeamsClient");
13
14
  /**
14
15
  * Create a Kaiban SDK client instance
@@ -46,6 +47,7 @@ function createKaibanClient(config) {
46
47
  cards: new CardsClient_1.CardsClient(http),
47
48
  activities: new ActivitiesClient_1.ActivitiesClient(http),
48
49
  teams: new TeamsClient_1.TeamsClient(http),
50
+ teamMembers: new TeamMembersClient_1.TeamMembersClient(http),
49
51
  boards: new BoardsClient_1.BoardsClient(http),
50
52
  resources: new ResourcesClient_1.ResourcesClient(http),
51
53
  external_channels: new ExternalChannelsClient_1.ExternalChannelsClient(http),
@@ -105,6 +105,34 @@ class AgentsClient {
105
105
  get(id, options) {
106
106
  return this.http.get(`/agent/${encodeURIComponent(id)}`, options);
107
107
  }
108
+ /**
109
+ * Create a new agent
110
+ *
111
+ * @param data - Agent creation data
112
+ * @param options - Optional request configuration
113
+ *
114
+ * @returns The newly created agent object
115
+ *
116
+ * @throws {Error} If creation fails
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const agent = await client.agents.create({
121
+ * name: 'SupportAgent',
122
+ * description: 'Handles support tickets',
123
+ * team_id: 'team_123',
124
+ * owner_id: 'user_123',
125
+ * created_by: 'user_123',
126
+ * type: 'a2a',
127
+ * status: 'active',
128
+ * monthly_budget: 200,
129
+ * examples: []
130
+ * });
131
+ * ```
132
+ */
133
+ create(data, options) {
134
+ return this.http.post('/agents', data, options);
135
+ }
108
136
  /**
109
137
  * Update an agent's properties
110
138
  *
@@ -74,5 +74,47 @@ class BoardsClient {
74
74
  get(id, options) {
75
75
  return this.http.get(`/board/${encodeURIComponent(id)}`, options);
76
76
  }
77
+ /**
78
+ * Create a new board
79
+ *
80
+ * @param data - Board creation data
81
+ * @param data.name - The board name
82
+ * @param data.team_id - The team this board belongs to
83
+ * @param data.owner_id - The owner of the board
84
+ * @param data.created_by - The user creating the board
85
+ * @param data.description - Board description
86
+ * @param data.agent_ids - Array of agent IDs
87
+ * @param data.member_ids - Array of member IDs
88
+ * @param data.allowed_roles - Array of allowed roles
89
+ * @param data.columns - Array of columns
90
+ * @param options - Optional request configuration
91
+ *
92
+ * @returns The newly created board
93
+ *
94
+ * @throws {Error} If creation fails
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const board = await client.boards.create({
99
+ * name: 'Sales',
100
+ * team_id: 'team_123',
101
+ * owner_id: 'user_123',
102
+ * created_by: 'user_123',
103
+ * description: 'Manage pipeline',
104
+ * columns: []
105
+ * // agent_ids, member_ids, and allowed_roles are optional (default to [])
106
+ * });
107
+ * ```
108
+ */
109
+ create(data, options) {
110
+ // Default empty arrays for optional fields
111
+ const payload = {
112
+ ...data,
113
+ agent_ids: data.agent_ids ?? [],
114
+ member_ids: data.member_ids ?? [],
115
+ allowed_roles: data.allowed_roles ?? [],
116
+ };
117
+ return this.http.post('/boards', payload, options);
118
+ }
77
119
  }
78
120
  exports.BoardsClient = BoardsClient;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TeamMembersClient = void 0;
4
+ /**
5
+ * Client for managing team members in the Kaiban platform
6
+ * @category Resources
7
+ */
8
+ class TeamMembersClient {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ /**
13
+ * List team members with pagination, filters, and sorting
14
+ *
15
+ * @param params - Optional query parameters for filtering and pagination
16
+ * @param params.limit - Number of items per page (default: 50, max: 100)
17
+ * @param params.after - Cursor to navigate forwards (get items after this cursor)
18
+ * @param params.before - Cursor to navigate backwards (get items before this cursor)
19
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
20
+ * @param params.filters - Filter parameters to narrow results
21
+ * @param options - Optional request configuration
22
+ *
23
+ * @returns A paginated list of team members
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // List first page of team members
28
+ * const result = await client.teamMembers.list({ limit: 10 });
29
+ * console.log(result.data); // Array of TeamMember objects
30
+ * console.log(result.pagination.next_cursor); // Cursor for next page
31
+ *
32
+ * // Get next page using cursor
33
+ * if (result.pagination.next_cursor) {
34
+ * const nextPage = await client.teamMembers.list({
35
+ * limit: 10,
36
+ * after: result.pagination.next_cursor
37
+ * });
38
+ * }
39
+ * ```
40
+ */
41
+ list(params, options) {
42
+ return this.http.list('/team-members', params, options);
43
+ }
44
+ /**
45
+ * Iterate through all team members using async generator
46
+ * Automatically handles pagination by following next_cursor
47
+ *
48
+ * @param params - Optional query parameters (excluding after/before cursors)
49
+ * @param params.limit - Number of items per page (used internally for pagination)
50
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
51
+ * @param params.filters - Filter parameters to narrow results
52
+ * @param options - Optional request configuration
53
+ *
54
+ * @yields Individual TeamMember objects
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * // Iterate through all team members
59
+ * for await (const member of client.teamMembers.listAll()) {
60
+ * console.log(member.id, member.user_id, member.role);
61
+ * }
62
+ *
63
+ * // With custom page size and sorting
64
+ * for await (const member of client.teamMembers.listAll({
65
+ * limit: 100,
66
+ * order_by: '-joined_at',
67
+ * filters: { team_id: 'team_123' }
68
+ * })) {
69
+ * console.log(member);
70
+ * }
71
+ * ```
72
+ */
73
+ async *listAll(params, options) {
74
+ let cursor = undefined;
75
+ do {
76
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
77
+ for (const item of page.data)
78
+ yield item;
79
+ cursor = page.pagination.next_cursor;
80
+ } while (cursor);
81
+ }
82
+ /**
83
+ * Get a single team member by ID
84
+ *
85
+ * @param id - The unique identifier of the team member
86
+ * @param options - Optional request configuration
87
+ *
88
+ * @returns The team member object
89
+ *
90
+ * @throws {Error} If the team member is not found or request fails
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * const member = await client.teamMembers.get('tm-123');
95
+ * console.log(member.user_id, member.role);
96
+ * ```
97
+ */
98
+ get(id, options) {
99
+ return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
100
+ }
101
+ }
102
+ exports.TeamMembersClient = TeamMembersClient;
@@ -24,19 +24,15 @@ exports.ActivityType = {
24
24
  CARD_CLONED: 'card_cloned',
25
25
  CARD_COLUMN_CHANGED: 'card_column_changed',
26
26
  // A2A task status activities
27
- // "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "rejected"
28
- // | "auth-required" | "unknown"
29
- // Types for A2A task status activities
30
- // TODO: Understand how to mix with the existing agent task status activities
31
- // A2A_TASK_STATUS_SUBMITTED: 'submitted',
32
- // A2A_TASK_STATUS_WORKING: 'working',
33
- // A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
34
- // A2A_TASK_STATUS_COMPLETED: 'completed',
35
- // A2A_TASK_STATUS_CANCELED: 'canceled',
36
- // A2A_TASK_STATUS_FAILED: 'failed',
37
- // A2A_TASK_STATUS_REJECTED: 'rejected',
38
- // A2A_TASK_STATUS_AUTH_REQUIRED: 'auth-required',
39
- // A2A_TASK_STATUS_UNKNOWN: 'unknown',
27
+ A2A_TASK_STATUS_SUBMITTED: 'submitted',
28
+ A2A_TASK_STATUS_WORKING: 'working',
29
+ A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
30
+ A2A_TASK_STATUS_COMPLETED: 'completed',
31
+ A2A_TASK_STATUS_CANCELED: 'canceled',
32
+ A2A_TASK_STATUS_FAILED: 'failed',
33
+ A2A_TASK_STATUS_REJECTED: 'rejected',
34
+ A2A_TASK_STATUS_AUTH_REQUIRED: 'auth-required',
35
+ A2A_TASK_STATUS_UNKNOWN: 'unknown',
40
36
  // Thread activities
41
37
  THREAD_USER_MESSAGE: 'thread_user_message',
42
38
  THREAD_AGENT_MESSAGE: 'thread_agent_message',
@@ -6,6 +6,7 @@ import { CardsClient } from './resources/CardsClient.js';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient.js';
7
7
  import { ModelCost } from './resources/ModelCost.js';
8
8
  import { ResourcesClient } from './resources/ResourcesClient.js';
9
+ import { TeamMembersClient } from './resources/TeamMembersClient.js';
9
10
  import { TeamsClient } from './resources/TeamsClient.js';
10
11
  /**
11
12
  * Create a Kaiban SDK client instance
@@ -43,6 +44,7 @@ export function createKaibanClient(config) {
43
44
  cards: new CardsClient(http),
44
45
  activities: new ActivitiesClient(http),
45
46
  teams: new TeamsClient(http),
47
+ teamMembers: new TeamMembersClient(http),
46
48
  boards: new BoardsClient(http),
47
49
  resources: new ResourcesClient(http),
48
50
  external_channels: new ExternalChannelsClient(http),
@@ -102,6 +102,34 @@ export class AgentsClient {
102
102
  get(id, options) {
103
103
  return this.http.get(`/agent/${encodeURIComponent(id)}`, options);
104
104
  }
105
+ /**
106
+ * Create a new agent
107
+ *
108
+ * @param data - Agent creation data
109
+ * @param options - Optional request configuration
110
+ *
111
+ * @returns The newly created agent object
112
+ *
113
+ * @throws {Error} If creation fails
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * const agent = await client.agents.create({
118
+ * name: 'SupportAgent',
119
+ * description: 'Handles support tickets',
120
+ * team_id: 'team_123',
121
+ * owner_id: 'user_123',
122
+ * created_by: 'user_123',
123
+ * type: 'a2a',
124
+ * status: 'active',
125
+ * monthly_budget: 200,
126
+ * examples: []
127
+ * });
128
+ * ```
129
+ */
130
+ create(data, options) {
131
+ return this.http.post('/agents', data, options);
132
+ }
105
133
  /**
106
134
  * Update an agent's properties
107
135
  *
@@ -71,4 +71,46 @@ export class BoardsClient {
71
71
  get(id, options) {
72
72
  return this.http.get(`/board/${encodeURIComponent(id)}`, options);
73
73
  }
74
+ /**
75
+ * Create a new board
76
+ *
77
+ * @param data - Board creation data
78
+ * @param data.name - The board name
79
+ * @param data.team_id - The team this board belongs to
80
+ * @param data.owner_id - The owner of the board
81
+ * @param data.created_by - The user creating the board
82
+ * @param data.description - Board description
83
+ * @param data.agent_ids - Array of agent IDs
84
+ * @param data.member_ids - Array of member IDs
85
+ * @param data.allowed_roles - Array of allowed roles
86
+ * @param data.columns - Array of columns
87
+ * @param options - Optional request configuration
88
+ *
89
+ * @returns The newly created board
90
+ *
91
+ * @throws {Error} If creation fails
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const board = await client.boards.create({
96
+ * name: 'Sales',
97
+ * team_id: 'team_123',
98
+ * owner_id: 'user_123',
99
+ * created_by: 'user_123',
100
+ * description: 'Manage pipeline',
101
+ * columns: []
102
+ * // agent_ids, member_ids, and allowed_roles are optional (default to [])
103
+ * });
104
+ * ```
105
+ */
106
+ create(data, options) {
107
+ // Default empty arrays for optional fields
108
+ const payload = {
109
+ ...data,
110
+ agent_ids: data.agent_ids ?? [],
111
+ member_ids: data.member_ids ?? [],
112
+ allowed_roles: data.allowed_roles ?? [],
113
+ };
114
+ return this.http.post('/boards', payload, options);
115
+ }
74
116
  }
@@ -0,0 +1,98 @@
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.limit - Number of items per page (default: 50, max: 100)
14
+ * @param params.after - Cursor to navigate forwards (get items after this cursor)
15
+ * @param params.before - Cursor to navigate backwards (get items before this cursor)
16
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
17
+ * @param params.filters - Filter parameters to narrow results
18
+ * @param options - Optional request configuration
19
+ *
20
+ * @returns A paginated list of team members
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // List first page of team members
25
+ * const result = await client.teamMembers.list({ limit: 10 });
26
+ * console.log(result.data); // Array of TeamMember objects
27
+ * console.log(result.pagination.next_cursor); // Cursor for next page
28
+ *
29
+ * // Get next page using cursor
30
+ * if (result.pagination.next_cursor) {
31
+ * const nextPage = await client.teamMembers.list({
32
+ * limit: 10,
33
+ * after: result.pagination.next_cursor
34
+ * });
35
+ * }
36
+ * ```
37
+ */
38
+ list(params, options) {
39
+ return this.http.list('/team-members', params, options);
40
+ }
41
+ /**
42
+ * Iterate through all team members using async generator
43
+ * Automatically handles pagination by following next_cursor
44
+ *
45
+ * @param params - Optional query parameters (excluding after/before cursors)
46
+ * @param params.limit - Number of items per page (used internally for pagination)
47
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
48
+ * @param params.filters - Filter parameters to narrow results
49
+ * @param options - Optional request configuration
50
+ *
51
+ * @yields Individual TeamMember objects
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * // Iterate through all team members
56
+ * for await (const member of client.teamMembers.listAll()) {
57
+ * console.log(member.id, member.user_id, member.role);
58
+ * }
59
+ *
60
+ * // With custom page size and sorting
61
+ * for await (const member of client.teamMembers.listAll({
62
+ * limit: 100,
63
+ * order_by: '-joined_at',
64
+ * filters: { team_id: 'team_123' }
65
+ * })) {
66
+ * console.log(member);
67
+ * }
68
+ * ```
69
+ */
70
+ async *listAll(params, options) {
71
+ let cursor = undefined;
72
+ do {
73
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
74
+ for (const item of page.data)
75
+ yield item;
76
+ cursor = page.pagination.next_cursor;
77
+ } while (cursor);
78
+ }
79
+ /**
80
+ * Get a single team member by ID
81
+ *
82
+ * @param id - The unique identifier of the team member
83
+ * @param options - Optional request configuration
84
+ *
85
+ * @returns The team member object
86
+ *
87
+ * @throws {Error} If the team member is not found or request fails
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const member = await client.teamMembers.get('tm-123');
92
+ * console.log(member.user_id, member.role);
93
+ * ```
94
+ */
95
+ get(id, options) {
96
+ return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
97
+ }
98
+ }
@@ -21,19 +21,15 @@ export const ActivityType = {
21
21
  CARD_CLONED: 'card_cloned',
22
22
  CARD_COLUMN_CHANGED: 'card_column_changed',
23
23
  // A2A task status activities
24
- // "submitted" | "working" | "input-required" | "completed" | "canceled" | "failed" | "rejected"
25
- // | "auth-required" | "unknown"
26
- // Types for A2A task status activities
27
- // TODO: Understand how to mix with the existing agent task status activities
28
- // A2A_TASK_STATUS_SUBMITTED: 'submitted',
29
- // A2A_TASK_STATUS_WORKING: 'working',
30
- // A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
31
- // A2A_TASK_STATUS_COMPLETED: 'completed',
32
- // A2A_TASK_STATUS_CANCELED: 'canceled',
33
- // A2A_TASK_STATUS_FAILED: 'failed',
34
- // A2A_TASK_STATUS_REJECTED: 'rejected',
35
- // A2A_TASK_STATUS_AUTH_REQUIRED: 'auth-required',
36
- // A2A_TASK_STATUS_UNKNOWN: 'unknown',
24
+ A2A_TASK_STATUS_SUBMITTED: 'submitted',
25
+ A2A_TASK_STATUS_WORKING: 'working',
26
+ A2A_TASK_STATUS_INPUT_REQUIRED: 'required',
27
+ A2A_TASK_STATUS_COMPLETED: 'completed',
28
+ A2A_TASK_STATUS_CANCELED: 'canceled',
29
+ A2A_TASK_STATUS_FAILED: 'failed',
30
+ A2A_TASK_STATUS_REJECTED: 'rejected',
31
+ A2A_TASK_STATUS_AUTH_REQUIRED: 'auth-required',
32
+ A2A_TASK_STATUS_UNKNOWN: 'unknown',
37
33
  // Thread activities
38
34
  THREAD_USER_MESSAGE: 'thread_user_message',
39
35
  THREAD_AGENT_MESSAGE: 'thread_agent_message',
@@ -6,6 +6,7 @@ import { CardsClient } from './resources/CardsClient';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient';
7
7
  import { ModelCost } from './resources/ModelCost';
8
8
  import { ResourcesClient } from './resources/ResourcesClient';
9
+ import { TeamMembersClient } from './resources/TeamMembersClient';
9
10
  import { TeamsClient } from './resources/TeamsClient';
10
11
  /**
11
12
  * Main Kaiban SDK client interface providing access to all API resources
@@ -25,6 +26,8 @@ export interface KaibanClient {
25
26
  activities: ActivitiesClient;
26
27
  /** Client for managing teams */
27
28
  teams: TeamsClient;
29
+ /** Client for managing team members */
30
+ teamMembers: TeamMembersClient;
28
31
  /** Client for managing boards */
29
32
  boards: BoardsClient;
30
33
  /** Client for managing resources */
@@ -93,6 +93,32 @@ export declare class AgentsClient {
93
93
  * ```
94
94
  */
95
95
  get(id: string, options?: RequestOptions): Promise<Agent>;
96
+ /**
97
+ * Create a new agent
98
+ *
99
+ * @param data - Agent creation data
100
+ * @param options - Optional request configuration
101
+ *
102
+ * @returns The newly created agent object
103
+ *
104
+ * @throws {Error} If creation fails
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const agent = await client.agents.create({
109
+ * name: 'SupportAgent',
110
+ * description: 'Handles support tickets',
111
+ * team_id: 'team_123',
112
+ * owner_id: 'user_123',
113
+ * created_by: 'user_123',
114
+ * type: 'a2a',
115
+ * status: 'active',
116
+ * monthly_budget: 200,
117
+ * examples: []
118
+ * });
119
+ * ```
120
+ */
121
+ create(data: Omit<Agent, 'id' | 'created_at' | 'updated_at' | 'last_active'>, options?: RequestOptions): Promise<Agent>;
96
122
  /**
97
123
  * Update an agent's properties
98
124
  *
@@ -1,4 +1,4 @@
1
- import { Board } from '../../types/entities';
1
+ import { Board, CreateBoardInput } from '../../types/entities';
2
2
  import { ListParams, Paginated } from '../../types/responses';
3
3
  import { HttpClient } from '../http/HttpClient';
4
4
  import { RequestOptions } from '../http/types';
@@ -62,4 +62,37 @@ export declare class BoardsClient {
62
62
  * ```
63
63
  */
64
64
  get(id: string, options?: RequestOptions): Promise<Board>;
65
+ /**
66
+ * Create a new board
67
+ *
68
+ * @param data - Board creation data
69
+ * @param data.name - The board name
70
+ * @param data.team_id - The team this board belongs to
71
+ * @param data.owner_id - The owner of the board
72
+ * @param data.created_by - The user creating the board
73
+ * @param data.description - Board description
74
+ * @param data.agent_ids - Array of agent IDs
75
+ * @param data.member_ids - Array of member IDs
76
+ * @param data.allowed_roles - Array of allowed roles
77
+ * @param data.columns - Array of columns
78
+ * @param options - Optional request configuration
79
+ *
80
+ * @returns The newly created board
81
+ *
82
+ * @throws {Error} If creation fails
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const board = await client.boards.create({
87
+ * name: 'Sales',
88
+ * team_id: 'team_123',
89
+ * owner_id: 'user_123',
90
+ * created_by: 'user_123',
91
+ * description: 'Manage pipeline',
92
+ * columns: []
93
+ * // agent_ids, member_ids, and allowed_roles are optional (default to [])
94
+ * });
95
+ * ```
96
+ */
97
+ create(data: CreateBoardInput, options?: RequestOptions): Promise<Board>;
65
98
  }
@@ -0,0 +1,89 @@
1
+ import { TeamMember } from '../../types/entities';
2
+ import { ListParams, Paginated } from '../../types/responses';
3
+ import { HttpClient } from '../http/HttpClient';
4
+ import { RequestOptions } from '../http/types';
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.limit - Number of items per page (default: 50, max: 100)
17
+ * @param params.after - Cursor to navigate forwards (get items after this cursor)
18
+ * @param params.before - Cursor to navigate backwards (get items before this cursor)
19
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
20
+ * @param params.filters - Filter parameters to narrow results
21
+ * @param options - Optional request configuration
22
+ *
23
+ * @returns A paginated list of team members
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // List first page of team members
28
+ * const result = await client.teamMembers.list({ limit: 10 });
29
+ * console.log(result.data); // Array of TeamMember objects
30
+ * console.log(result.pagination.next_cursor); // Cursor for next page
31
+ *
32
+ * // Get next page using cursor
33
+ * if (result.pagination.next_cursor) {
34
+ * const nextPage = await client.teamMembers.list({
35
+ * limit: 10,
36
+ * after: result.pagination.next_cursor
37
+ * });
38
+ * }
39
+ * ```
40
+ */
41
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<TeamMember>>;
42
+ /**
43
+ * Iterate through all team members using async generator
44
+ * Automatically handles pagination by following next_cursor
45
+ *
46
+ * @param params - Optional query parameters (excluding after/before cursors)
47
+ * @param params.limit - Number of items per page (used internally for pagination)
48
+ * @param params.order_by - Fields to sort by (prefix with - for descending order)
49
+ * @param params.filters - Filter parameters to narrow results
50
+ * @param options - Optional request configuration
51
+ *
52
+ * @yields Individual TeamMember objects
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Iterate through all team members
57
+ * for await (const member of client.teamMembers.listAll()) {
58
+ * console.log(member.id, member.user_id, member.role);
59
+ * }
60
+ *
61
+ * // With custom page size and sorting
62
+ * for await (const member of client.teamMembers.listAll({
63
+ * limit: 100,
64
+ * order_by: '-joined_at',
65
+ * filters: { team_id: 'team_123' }
66
+ * })) {
67
+ * console.log(member);
68
+ * }
69
+ * ```
70
+ */
71
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<TeamMember, void, unknown>;
72
+ /**
73
+ * Get a single team member by ID
74
+ *
75
+ * @param id - The unique identifier of the team member
76
+ * @param options - Optional request configuration
77
+ *
78
+ * @returns The team member object
79
+ *
80
+ * @throws {Error} If the team member is not found or request fails
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * const member = await client.teamMembers.get('tm-123');
85
+ * console.log(member.user_id, member.role);
86
+ * ```
87
+ */
88
+ get(id: string, options?: RequestOptions): Promise<TeamMember>;
89
+ }
@@ -18,6 +18,15 @@ export declare const ActivityType: {
18
18
  readonly CARD_CREATED: "card_created";
19
19
  readonly CARD_CLONED: "card_cloned";
20
20
  readonly CARD_COLUMN_CHANGED: "card_column_changed";
21
+ readonly A2A_TASK_STATUS_SUBMITTED: "submitted";
22
+ readonly A2A_TASK_STATUS_WORKING: "working";
23
+ readonly A2A_TASK_STATUS_INPUT_REQUIRED: "required";
24
+ readonly A2A_TASK_STATUS_COMPLETED: "completed";
25
+ readonly A2A_TASK_STATUS_CANCELED: "canceled";
26
+ readonly A2A_TASK_STATUS_FAILED: "failed";
27
+ readonly A2A_TASK_STATUS_REJECTED: "rejected";
28
+ readonly A2A_TASK_STATUS_AUTH_REQUIRED: "auth-required";
29
+ readonly A2A_TASK_STATUS_UNKNOWN: "unknown";
21
30
  readonly THREAD_USER_MESSAGE: "thread_user_message";
22
31
  readonly THREAD_AGENT_MESSAGE: "thread_agent_message";
23
32
  readonly THREAD_AGENT_MESSAGE_EVALUATION: "thread_agent_message_evaluation";
@@ -59,16 +68,18 @@ export interface ActivityChange {
59
68
  new_value: unknown;
60
69
  }
61
70
  export interface Activity {
62
- id: string;
71
+ id?: string;
63
72
  board_id: string;
64
- team_id: string;
65
73
  card_id: string;
66
74
  type: (typeof ActivityType)[keyof typeof ActivityType];
67
75
  description: string;
68
76
  actor: ActivityActor;
69
77
  changes?: ActivityChange[];
78
+ created_at?: ISODate;
79
+ created_by_session_id?: string;
70
80
  metadata?: Record<string, unknown>;
71
81
  user_id?: string;
72
- created_at: ISODate;
82
+ team_id: string;
83
+ marked_for_display?: boolean;
73
84
  }
74
85
  export type ActivityCreate = Omit<Activity, 'id' | 'created_at'>;
@@ -10,20 +10,28 @@ export declare const AgentStatus: {
10
10
  readonly ACTIVE: "active";
11
11
  readonly INACTIVE: "inactive";
12
12
  };
13
+ export interface AgentExample {
14
+ input: Record<string, unknown>;
15
+ output: string;
16
+ }
13
17
  export interface Agent {
14
18
  id: string;
15
- name: string;
19
+ created_by: string;
16
20
  description: string;
17
- team_id: string;
21
+ examples: AgentExample[];
22
+ integrations?: string[];
23
+ last_active: ISODate;
24
+ monthly_budget: number;
25
+ name: string;
26
+ owner_id: string;
27
+ roles?: string[];
18
28
  status: (typeof AgentStatus)[keyof typeof AgentStatus];
29
+ team_id: string;
19
30
  type: (typeof AgentType)[keyof typeof AgentType];
20
- roles: string[];
21
- owner_id: string;
22
- created_by: string;
23
- monthly_budget: number;
31
+ updated_at: ISODate;
32
+ active_cards?: number;
33
+ created_at?: ISODate;
24
34
  config?: Record<string, unknown>;
25
- created_at: ISODate;
26
- updated_at?: ISODate;
27
35
  }
28
36
  export declare const AgentFeedbackStatus: {
29
37
  readonly UNPROCESSED: "unprocessed";
@@ -53,10 +61,10 @@ export interface AgentFeedback {
53
61
  }
54
62
  export interface AgentSupervisorFeedback {
55
63
  id: string;
56
- agent_id: string;
57
- team_id: string;
58
64
  activity_id: string;
65
+ team_id: string;
59
66
  board_id: string;
67
+ agent_id: string;
60
68
  feedback: string;
61
69
  created_by: string;
62
70
  created_at: ISODate;
@@ -9,12 +9,23 @@ export interface Column {
9
9
  }
10
10
  export interface Board {
11
11
  id: string;
12
- name: string;
13
- description: string;
14
- team_id: string;
15
- owner_id: string;
16
12
  agent_ids: string[];
13
+ created_at: ISODate;
14
+ created_by: string;
15
+ description: string;
17
16
  member_ids: string[];
18
- allowed_roles: string[];
17
+ name: string;
18
+ owner_id: string;
19
+ team_id: string;
19
20
  columns: Column[];
21
+ allowed_roles: string[];
20
22
  }
23
+ /**
24
+ * Input type for creating a new board
25
+ * Fields agent_ids, member_ids, and allowed_roles are optional and default to []
26
+ */
27
+ export type CreateBoardInput = Omit<Board, 'id' | 'created_at'> & {
28
+ agent_ids?: string[];
29
+ member_ids?: string[];
30
+ allowed_roles?: string[];
31
+ };
@@ -6,19 +6,28 @@ export declare const CardStatus: {
6
6
  readonly BLOCKED: "blocked";
7
7
  readonly DONE: "done";
8
8
  };
9
- export type CardPart = {
9
+ export interface TextPart {
10
10
  type: 'text';
11
- text: {
12
- content: string;
13
- };
14
- } | {
11
+ text: string;
12
+ metadata?: Record<string, unknown>;
13
+ }
14
+ export interface FileContent {
15
+ name: string;
16
+ mimeType: string;
17
+ bytes?: string;
18
+ uri?: string;
19
+ }
20
+ export interface FilePart {
15
21
  type: 'file';
16
- file: {
17
- name: string;
18
- mimeType: string;
19
- uri: string;
20
- };
21
- };
22
+ file: FileContent;
23
+ metadata?: Record<string, unknown>;
24
+ }
25
+ export interface DataPart {
26
+ type: 'data';
27
+ data: Record<string, unknown>;
28
+ metadata?: Record<string, unknown>;
29
+ }
30
+ export type CardPart = TextPart | FilePart | DataPart;
22
31
  export interface Card {
23
32
  id: string;
24
33
  team_id: string;
@@ -29,12 +38,12 @@ export interface Card {
29
38
  description?: string;
30
39
  status: (typeof CardStatus)[keyof typeof CardStatus];
31
40
  column_key: string;
41
+ created_at?: ISODate;
42
+ updated_at?: ISODate;
32
43
  priority: string;
33
44
  result?: string;
34
45
  member_ids: string[];
35
46
  metadata?: Record<string, unknown>;
36
47
  enabled?: boolean;
37
48
  parts?: CardPart[];
38
- created_at: ISODate;
39
- updated_at?: ISODate;
40
49
  }
@@ -27,6 +27,6 @@ export interface ExternalChannel {
27
27
  status: (typeof ExternalChannelStatus)[keyof typeof ExternalChannelStatus];
28
28
  priority: (typeof ExternalChannelPriority)[keyof typeof ExternalChannelPriority];
29
29
  metadata?: Record<string, unknown>;
30
- created_at: ISODate;
30
+ created_at?: ISODate;
31
31
  updated_at?: ISODate;
32
32
  }
@@ -2,13 +2,15 @@ import { ISODate } from './shared';
2
2
  export interface Team {
3
3
  id: string;
4
4
  name: string;
5
+ description: string;
5
6
  created_at: ISODate;
6
7
  }
7
8
  export interface TeamMember {
8
9
  id: string;
9
- team_id: string;
10
- role: string;
11
10
  is_agent: boolean;
12
11
  joined_at: ISODate;
12
+ role: string;
13
+ team_id: string;
14
+ user_id: string;
13
15
  created_at: ISODate;
14
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaiban/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Official TypeScript SDK for the Kaiban API",
5
5
  "keywords": [
6
6
  "kaiban",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@eslint/js": "^9.12.0",
79
- "@vitest/coverage-v8": "^2.1.1",
79
+ "@vitest/coverage-v8": "^4.0.16",
80
80
  "eslint": "^9.12.0",
81
81
  "eslint-config-prettier": "^9.1.0",
82
82
  "prettier": "^3.3.3",
@@ -85,6 +85,6 @@
85
85
  "typedoc": "^0.28.14",
86
86
  "typescript": "^5.4.0",
87
87
  "typescript-eslint": "^8.8.0",
88
- "vitest": "^2.1.1"
88
+ "vitest": "^4.0.16"
89
89
  }
90
90
  }