@kaiban/sdk 0.4.19 → 0.4.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.
Files changed (38) hide show
  1. package/dist/cjs/lib/client.js +4 -0
  2. package/dist/cjs/lib/resources/AgentsClient.js +18 -0
  3. package/dist/cjs/lib/resources/BoardsClient.js +18 -0
  4. package/dist/cjs/lib/resources/ExternalChannelsClient.js +9 -0
  5. package/dist/cjs/lib/resources/PositionsClient.js +42 -0
  6. package/dist/cjs/lib/resources/ResourcesClient.js +9 -0
  7. package/dist/cjs/lib/resources/SessionsClient.js +101 -0
  8. package/dist/cjs/lib/resources/TeamMembersClient.js +31 -0
  9. package/dist/cjs/lib/resources/TeamsClient.js +31 -0
  10. package/dist/cjs/types/entities/index.js +2 -0
  11. package/dist/cjs/types/entities/position.js +2 -0
  12. package/dist/cjs/types/entities/session.js +2 -0
  13. package/dist/esm/lib/client.js +4 -0
  14. package/dist/esm/lib/resources/AgentsClient.js +18 -0
  15. package/dist/esm/lib/resources/BoardsClient.js +18 -0
  16. package/dist/esm/lib/resources/ExternalChannelsClient.js +9 -0
  17. package/dist/esm/lib/resources/PositionsClient.js +38 -0
  18. package/dist/esm/lib/resources/ResourcesClient.js +9 -0
  19. package/dist/esm/lib/resources/SessionsClient.js +97 -0
  20. package/dist/esm/lib/resources/TeamMembersClient.js +31 -0
  21. package/dist/esm/lib/resources/TeamsClient.js +31 -0
  22. package/dist/esm/types/entities/index.js +2 -0
  23. package/dist/esm/types/entities/position.js +1 -0
  24. package/dist/esm/types/entities/session.js +1 -0
  25. package/dist/types/lib/client.d.ts +6 -0
  26. package/dist/types/lib/resources/AgentsClient.d.ts +16 -0
  27. package/dist/types/lib/resources/BoardsClient.d.ts +16 -0
  28. package/dist/types/lib/resources/ExternalChannelsClient.d.ts +28 -0
  29. package/dist/types/lib/resources/PositionsClient.d.ts +39 -0
  30. package/dist/types/lib/resources/ResourcesClient.d.ts +28 -0
  31. package/dist/types/lib/resources/SessionsClient.d.ts +89 -0
  32. package/dist/types/lib/resources/TeamMembersClient.d.ts +36 -0
  33. package/dist/types/lib/resources/TeamsClient.d.ts +34 -0
  34. package/dist/types/types/entities/index.d.ts +2 -0
  35. package/dist/types/types/entities/position.d.ts +13 -0
  36. package/dist/types/types/entities/session.d.ts +44 -0
  37. package/dist/types/types/entities/team.d.ts +5 -1
  38. package/package.json +1 -1
@@ -8,7 +8,9 @@ const BoardsClient_1 = require("./resources/BoardsClient");
8
8
  const CardsClient_1 = require("./resources/CardsClient");
9
9
  const ExternalChannelsClient_1 = require("./resources/ExternalChannelsClient");
10
10
  const ModelCost_1 = require("./resources/ModelCost");
11
+ const PositionsClient_1 = require("./resources/PositionsClient");
11
12
  const ResourcesClient_1 = require("./resources/ResourcesClient");
13
+ const SessionsClient_1 = require("./resources/SessionsClient");
12
14
  const TeamMembersClient_1 = require("./resources/TeamMembersClient");
13
15
  const TeamsClient_1 = require("./resources/TeamsClient");
14
16
  /**
@@ -51,6 +53,8 @@ function createKaibanClient(config) {
51
53
  boards: new BoardsClient_1.BoardsClient(http),
52
54
  resources: new ResourcesClient_1.ResourcesClient(http),
53
55
  externalChannels: new ExternalChannelsClient_1.ExternalChannelsClient(http),
56
+ positions: new PositionsClient_1.PositionsClient(http),
57
+ sessions: new SessionsClient_1.SessionsClient(http),
54
58
  costs: new ModelCost_1.ModelCost(),
55
59
  };
56
60
  }
@@ -155,6 +155,24 @@ class AgentsClient {
155
155
  update(id, data, options) {
156
156
  return this.http.put(`/agent/${encodeURIComponent(id)}`, data, options);
157
157
  }
158
+ /**
159
+ * Delete an agent by ID
160
+ *
161
+ * @param id - The unique identifier of the agent to delete
162
+ * @param options - Optional request configuration
163
+ *
164
+ * @returns Promise that resolves when the agent is deleted
165
+ *
166
+ * @throws {Error} If the agent is not found or deletion fails
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * await client.agents.delete('agent-123');
171
+ * ```
172
+ */
173
+ delete(id, options) {
174
+ return this.http.delete(`/agent/${encodeURIComponent(id)}`, options);
175
+ }
158
176
  /**
159
177
  * Create feedback for an agent
160
178
  *
@@ -116,5 +116,23 @@ class BoardsClient {
116
116
  };
117
117
  return this.http.post('/boards', payload, options);
118
118
  }
119
+ /**
120
+ * Delete a board by ID (and its cards and their activities)
121
+ *
122
+ * @param id - The unique identifier of the board to delete
123
+ * @param options - Optional request configuration
124
+ *
125
+ * @returns Promise that resolves when the board is deleted
126
+ *
127
+ * @throws {Error} If the board is not found or deletion fails
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * await client.boards.delete('board-123');
132
+ * ```
133
+ */
134
+ delete(id, options) {
135
+ return this.http.delete(`/board/${encodeURIComponent(id)}`, options);
136
+ }
119
137
  }
120
138
  exports.BoardsClient = BoardsClient;
@@ -74,5 +74,14 @@ class ExternalChannelsClient {
74
74
  get(id, options) {
75
75
  return this.http.get(`/external-channel/${encodeURIComponent(id)}`, options);
76
76
  }
77
+ create(data, options) {
78
+ return this.http.post('/external-channels', data, options);
79
+ }
80
+ update(id, data, options) {
81
+ return this.http.put(`/external-channel/${encodeURIComponent(id)}`, data, options);
82
+ }
83
+ delete(id, options) {
84
+ return this.http.delete(`/external-channel/${encodeURIComponent(id)}`, options);
85
+ }
77
86
  }
78
87
  exports.ExternalChannelsClient = ExternalChannelsClient;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PositionsClient = void 0;
4
+ /**
5
+ * Client for managing positions in the Kaiban platform
6
+ * @category Resources
7
+ */
8
+ class PositionsClient {
9
+ constructor(http) {
10
+ this.http = http;
11
+ }
12
+ list(params, options) {
13
+ return this.http.list('/positions', params, options);
14
+ }
15
+ async *listAll(params, options) {
16
+ let cursor = undefined;
17
+ do {
18
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
19
+ for (const item of page.data)
20
+ yield item;
21
+ cursor = page.pagination.next_cursor;
22
+ } while (cursor);
23
+ }
24
+ get(id, options) {
25
+ return this.http.get(`/position/${encodeURIComponent(id)}`, options);
26
+ }
27
+ create(data, options) {
28
+ return this.http.post('/positions', {
29
+ ...data,
30
+ ai_skills: data.ai_skills ?? [],
31
+ tools_to_integrate: data.tools_to_integrate ?? [],
32
+ monthly_budget: data.monthly_budget ?? 0,
33
+ }, options);
34
+ }
35
+ update(id, data, options) {
36
+ return this.http.put(`/position/${encodeURIComponent(id)}`, data, options);
37
+ }
38
+ delete(id, options) {
39
+ return this.http.delete(`/position/${encodeURIComponent(id)}`, options);
40
+ }
41
+ }
42
+ exports.PositionsClient = PositionsClient;
@@ -74,5 +74,14 @@ class ResourcesClient {
74
74
  get(id, options) {
75
75
  return this.http.get(`/resource/${encodeURIComponent(id)}`, options);
76
76
  }
77
+ create(data, options) {
78
+ return this.http.post('/resources', data, options);
79
+ }
80
+ update(id, data, options) {
81
+ return this.http.put(`/resource/${encodeURIComponent(id)}`, data, options);
82
+ }
83
+ delete(id, options) {
84
+ return this.http.delete(`/resource/${encodeURIComponent(id)}`, options);
85
+ }
77
86
  }
78
87
  exports.ResourcesClient = ResourcesClient;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionsClient = void 0;
4
+ /**
5
+ * Client for managing sessions and session data in the Kaiban platform.
6
+ * Sessions are workspaces for agents to work on cards; session data holds artifacts (e.g. analysis, drafts).
7
+ * @category Resources
8
+ */
9
+ class SessionsClient {
10
+ constructor(http) {
11
+ this.http = http;
12
+ }
13
+ /**
14
+ * Create a new session for a card
15
+ *
16
+ * @param data - Session creation data (card_id, created_by, optional metadata)
17
+ * @param options - Optional request configuration
18
+ * @returns The created session
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const session = await client.sessions.create({
23
+ * card_id: 'card_123',
24
+ * created_by: { id: 'agent_1', type: 'agent', name: 'Claude Agent' },
25
+ * });
26
+ * ```
27
+ */
28
+ create(data, options) {
29
+ return this.http.post('/sessions', data, options);
30
+ }
31
+ /**
32
+ * Get a session by ID
33
+ *
34
+ * @param id - Session ID
35
+ * @param options - Optional request configuration
36
+ * @returns The session
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const session = await client.sessions.get('session_abc123');
41
+ * ```
42
+ */
43
+ get(id, options) {
44
+ return this.http.get(`/session/${encodeURIComponent(id)}`, options);
45
+ }
46
+ /**
47
+ * Create session data (artifacts) for a session (batch).
48
+ *
49
+ * @param sessionId - Parent session ID
50
+ * @param items - Array of items (label optional, data required). At least one item.
51
+ * @param options - Optional request configuration
52
+ * @returns Array of created session data
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const created = await client.sessions.createData('session_abc', [
57
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
58
+ * ]);
59
+ * ```
60
+ */
61
+ createData(sessionId, items, options) {
62
+ return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, items, options);
63
+ }
64
+ /**
65
+ * List all session data for a session (ordered by created_at)
66
+ *
67
+ * @param sessionId - Session ID
68
+ * @param options - Optional request configuration
69
+ * @returns Array of session data
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const list = await client.sessions.getData('session_abc');
74
+ * ```
75
+ */
76
+ getData(sessionId, options) {
77
+ return this.http.get(`/session/${encodeURIComponent(sessionId)}/data`, options);
78
+ }
79
+ /**
80
+ * Update session data and record who made the change
81
+ *
82
+ * @param sessionId - Session ID
83
+ * @param dataId - Session data document ID
84
+ * @param data - Updated label, data payload, and updated_by
85
+ * @param options - Optional request configuration
86
+ * @returns The updated session data
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const updated = await client.sessions.updateData('session_abc', 'data_xyz', {
91
+ * label: 'analysis_v2',
92
+ * data: { result: 'corrected' },
93
+ * updated_by: { id: 'user_1', type: 'user', name: 'Jane Doe' },
94
+ * });
95
+ * ```
96
+ */
97
+ updateData(sessionId, dataId, data, options) {
98
+ return this.http.put(`/session/${encodeURIComponent(sessionId)}/data/${encodeURIComponent(dataId)}`, data, options);
99
+ }
100
+ }
101
+ exports.SessionsClient = SessionsClient;
@@ -98,5 +98,36 @@ class TeamMembersClient {
98
98
  get(id, options) {
99
99
  return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
100
100
  }
101
+ /**
102
+ * Create a new team member
103
+ *
104
+ * @param data - team_id, user_id, role, is_agent
105
+ * @param options - Optional request configuration
106
+ * @returns The newly created team member
107
+ */
108
+ create(data, options) {
109
+ return this.http.post('/team-members', data, options);
110
+ }
111
+ /**
112
+ * Update a team member by ID (partial: role, is_agent)
113
+ *
114
+ * @param id - The unique identifier of the team member
115
+ * @param data - Partial fields to update
116
+ * @param options - Optional request configuration
117
+ * @returns The updated team member
118
+ */
119
+ update(id, data, options) {
120
+ return this.http.put(`/team-member/${encodeURIComponent(id)}`, data, options);
121
+ }
122
+ /**
123
+ * Delete a team member by ID
124
+ *
125
+ * @param id - The unique identifier of the team member to delete
126
+ * @param options - Optional request configuration
127
+ * @returns Promise that resolves when the team member is deleted
128
+ */
129
+ delete(id, options) {
130
+ return this.http.delete(`/team-member/${encodeURIComponent(id)}`, options);
131
+ }
101
132
  }
102
133
  exports.TeamMembersClient = TeamMembersClient;
@@ -92,5 +92,36 @@ class TeamsClient {
92
92
  get(id, options) {
93
93
  return this.http.get(`/team/${encodeURIComponent(id)}`, options);
94
94
  }
95
+ /**
96
+ * Create a new team
97
+ *
98
+ * @param data - Team creation data (name, optional description)
99
+ * @param options - Optional request configuration
100
+ * @returns The newly created team
101
+ */
102
+ create(data, options) {
103
+ return this.http.post('/teams', { ...data, description: data.description ?? '' }, options);
104
+ }
105
+ /**
106
+ * Update a team by ID (partial update)
107
+ *
108
+ * @param id - The unique identifier of the team
109
+ * @param data - Partial team data (name, description)
110
+ * @param options - Optional request configuration
111
+ * @returns The updated team
112
+ */
113
+ update(id, data, options) {
114
+ return this.http.put(`/team/${encodeURIComponent(id)}`, data, options);
115
+ }
116
+ /**
117
+ * Delete a team by ID
118
+ *
119
+ * @param id - The unique identifier of the team to delete
120
+ * @param options - Optional request configuration
121
+ * @returns Promise that resolves when the team is deleted
122
+ */
123
+ delete(id, options) {
124
+ return this.http.delete(`/team/${encodeURIComponent(id)}`, options);
125
+ }
95
126
  }
96
127
  exports.TeamsClient = TeamsClient;
@@ -20,6 +20,8 @@ __exportStar(require("./agent"), exports);
20
20
  __exportStar(require("./board"), exports);
21
21
  __exportStar(require("./card"), exports);
22
22
  __exportStar(require("./external-channel"), exports);
23
+ __exportStar(require("./position"), exports);
23
24
  __exportStar(require("./resource"), exports);
25
+ __exportStar(require("./session"), exports);
24
26
  __exportStar(require("./shared"), exports);
25
27
  __exportStar(require("./team"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,7 +5,9 @@ import { BoardsClient } from './resources/BoardsClient.js';
5
5
  import { CardsClient } from './resources/CardsClient.js';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient.js';
7
7
  import { ModelCost } from './resources/ModelCost.js';
8
+ import { PositionsClient } from './resources/PositionsClient.js';
8
9
  import { ResourcesClient } from './resources/ResourcesClient.js';
10
+ import { SessionsClient } from './resources/SessionsClient.js';
9
11
  import { TeamMembersClient } from './resources/TeamMembersClient.js';
10
12
  import { TeamsClient } from './resources/TeamsClient.js';
11
13
  /**
@@ -48,6 +50,8 @@ export function createKaibanClient(config) {
48
50
  boards: new BoardsClient(http),
49
51
  resources: new ResourcesClient(http),
50
52
  externalChannels: new ExternalChannelsClient(http),
53
+ positions: new PositionsClient(http),
54
+ sessions: new SessionsClient(http),
51
55
  costs: new ModelCost(),
52
56
  };
53
57
  }
@@ -152,6 +152,24 @@ export class AgentsClient {
152
152
  update(id, data, options) {
153
153
  return this.http.put(`/agent/${encodeURIComponent(id)}`, data, options);
154
154
  }
155
+ /**
156
+ * Delete an agent by ID
157
+ *
158
+ * @param id - The unique identifier of the agent to delete
159
+ * @param options - Optional request configuration
160
+ *
161
+ * @returns Promise that resolves when the agent is deleted
162
+ *
163
+ * @throws {Error} If the agent is not found or deletion fails
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * await client.agents.delete('agent-123');
168
+ * ```
169
+ */
170
+ delete(id, options) {
171
+ return this.http.delete(`/agent/${encodeURIComponent(id)}`, options);
172
+ }
155
173
  /**
156
174
  * Create feedback for an agent
157
175
  *
@@ -113,4 +113,22 @@ export class BoardsClient {
113
113
  };
114
114
  return this.http.post('/boards', payload, options);
115
115
  }
116
+ /**
117
+ * Delete a board by ID (and its cards and their activities)
118
+ *
119
+ * @param id - The unique identifier of the board to delete
120
+ * @param options - Optional request configuration
121
+ *
122
+ * @returns Promise that resolves when the board is deleted
123
+ *
124
+ * @throws {Error} If the board is not found or deletion fails
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * await client.boards.delete('board-123');
129
+ * ```
130
+ */
131
+ delete(id, options) {
132
+ return this.http.delete(`/board/${encodeURIComponent(id)}`, options);
133
+ }
116
134
  }
@@ -71,4 +71,13 @@ export class ExternalChannelsClient {
71
71
  get(id, options) {
72
72
  return this.http.get(`/external-channel/${encodeURIComponent(id)}`, options);
73
73
  }
74
+ create(data, options) {
75
+ return this.http.post('/external-channels', data, options);
76
+ }
77
+ update(id, data, options) {
78
+ return this.http.put(`/external-channel/${encodeURIComponent(id)}`, data, options);
79
+ }
80
+ delete(id, options) {
81
+ return this.http.delete(`/external-channel/${encodeURIComponent(id)}`, options);
82
+ }
74
83
  }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Client for managing positions in the Kaiban platform
3
+ * @category Resources
4
+ */
5
+ export class PositionsClient {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ list(params, options) {
10
+ return this.http.list('/positions', params, options);
11
+ }
12
+ async *listAll(params, options) {
13
+ let cursor = undefined;
14
+ do {
15
+ const page = await this.list({ ...(params || {}), after: cursor }, options);
16
+ for (const item of page.data)
17
+ yield item;
18
+ cursor = page.pagination.next_cursor;
19
+ } while (cursor);
20
+ }
21
+ get(id, options) {
22
+ return this.http.get(`/position/${encodeURIComponent(id)}`, options);
23
+ }
24
+ create(data, options) {
25
+ return this.http.post('/positions', {
26
+ ...data,
27
+ ai_skills: data.ai_skills ?? [],
28
+ tools_to_integrate: data.tools_to_integrate ?? [],
29
+ monthly_budget: data.monthly_budget ?? 0,
30
+ }, options);
31
+ }
32
+ update(id, data, options) {
33
+ return this.http.put(`/position/${encodeURIComponent(id)}`, data, options);
34
+ }
35
+ delete(id, options) {
36
+ return this.http.delete(`/position/${encodeURIComponent(id)}`, options);
37
+ }
38
+ }
@@ -71,4 +71,13 @@ export class ResourcesClient {
71
71
  get(id, options) {
72
72
  return this.http.get(`/resource/${encodeURIComponent(id)}`, options);
73
73
  }
74
+ create(data, options) {
75
+ return this.http.post('/resources', data, options);
76
+ }
77
+ update(id, data, options) {
78
+ return this.http.put(`/resource/${encodeURIComponent(id)}`, data, options);
79
+ }
80
+ delete(id, options) {
81
+ return this.http.delete(`/resource/${encodeURIComponent(id)}`, options);
82
+ }
74
83
  }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Client for managing sessions and session data in the Kaiban platform.
3
+ * Sessions are workspaces for agents to work on cards; session data holds artifacts (e.g. analysis, drafts).
4
+ * @category Resources
5
+ */
6
+ export class SessionsClient {
7
+ constructor(http) {
8
+ this.http = http;
9
+ }
10
+ /**
11
+ * Create a new session for a card
12
+ *
13
+ * @param data - Session creation data (card_id, created_by, optional metadata)
14
+ * @param options - Optional request configuration
15
+ * @returns The created session
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const session = await client.sessions.create({
20
+ * card_id: 'card_123',
21
+ * created_by: { id: 'agent_1', type: 'agent', name: 'Claude Agent' },
22
+ * });
23
+ * ```
24
+ */
25
+ create(data, options) {
26
+ return this.http.post('/sessions', data, options);
27
+ }
28
+ /**
29
+ * Get a session by ID
30
+ *
31
+ * @param id - Session ID
32
+ * @param options - Optional request configuration
33
+ * @returns The session
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const session = await client.sessions.get('session_abc123');
38
+ * ```
39
+ */
40
+ get(id, options) {
41
+ return this.http.get(`/session/${encodeURIComponent(id)}`, options);
42
+ }
43
+ /**
44
+ * Create session data (artifacts) for a session (batch).
45
+ *
46
+ * @param sessionId - Parent session ID
47
+ * @param items - Array of items (label optional, data required). At least one item.
48
+ * @param options - Optional request configuration
49
+ * @returns Array of created session data
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const created = await client.sessions.createData('session_abc', [
54
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
55
+ * ]);
56
+ * ```
57
+ */
58
+ createData(sessionId, items, options) {
59
+ return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, items, options);
60
+ }
61
+ /**
62
+ * List all session data for a session (ordered by created_at)
63
+ *
64
+ * @param sessionId - Session ID
65
+ * @param options - Optional request configuration
66
+ * @returns Array of session data
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const list = await client.sessions.getData('session_abc');
71
+ * ```
72
+ */
73
+ getData(sessionId, options) {
74
+ return this.http.get(`/session/${encodeURIComponent(sessionId)}/data`, options);
75
+ }
76
+ /**
77
+ * Update session data and record who made the change
78
+ *
79
+ * @param sessionId - Session ID
80
+ * @param dataId - Session data document ID
81
+ * @param data - Updated label, data payload, and updated_by
82
+ * @param options - Optional request configuration
83
+ * @returns The updated session data
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const updated = await client.sessions.updateData('session_abc', 'data_xyz', {
88
+ * label: 'analysis_v2',
89
+ * data: { result: 'corrected' },
90
+ * updated_by: { id: 'user_1', type: 'user', name: 'Jane Doe' },
91
+ * });
92
+ * ```
93
+ */
94
+ updateData(sessionId, dataId, data, options) {
95
+ return this.http.put(`/session/${encodeURIComponent(sessionId)}/data/${encodeURIComponent(dataId)}`, data, options);
96
+ }
97
+ }
@@ -95,4 +95,35 @@ export class TeamMembersClient {
95
95
  get(id, options) {
96
96
  return this.http.get(`/team-member/${encodeURIComponent(id)}`, options);
97
97
  }
98
+ /**
99
+ * Create a new team member
100
+ *
101
+ * @param data - team_id, user_id, role, is_agent
102
+ * @param options - Optional request configuration
103
+ * @returns The newly created team member
104
+ */
105
+ create(data, options) {
106
+ return this.http.post('/team-members', data, options);
107
+ }
108
+ /**
109
+ * Update a team member by ID (partial: role, is_agent)
110
+ *
111
+ * @param id - The unique identifier of the team member
112
+ * @param data - Partial fields to update
113
+ * @param options - Optional request configuration
114
+ * @returns The updated team member
115
+ */
116
+ update(id, data, options) {
117
+ return this.http.put(`/team-member/${encodeURIComponent(id)}`, data, options);
118
+ }
119
+ /**
120
+ * Delete a team member by ID
121
+ *
122
+ * @param id - The unique identifier of the team member to delete
123
+ * @param options - Optional request configuration
124
+ * @returns Promise that resolves when the team member is deleted
125
+ */
126
+ delete(id, options) {
127
+ return this.http.delete(`/team-member/${encodeURIComponent(id)}`, options);
128
+ }
98
129
  }
@@ -89,4 +89,35 @@ export class TeamsClient {
89
89
  get(id, options) {
90
90
  return this.http.get(`/team/${encodeURIComponent(id)}`, options);
91
91
  }
92
+ /**
93
+ * Create a new team
94
+ *
95
+ * @param data - Team creation data (name, optional description)
96
+ * @param options - Optional request configuration
97
+ * @returns The newly created team
98
+ */
99
+ create(data, options) {
100
+ return this.http.post('/teams', { ...data, description: data.description ?? '' }, options);
101
+ }
102
+ /**
103
+ * Update a team by ID (partial update)
104
+ *
105
+ * @param id - The unique identifier of the team
106
+ * @param data - Partial team data (name, description)
107
+ * @param options - Optional request configuration
108
+ * @returns The updated team
109
+ */
110
+ update(id, data, options) {
111
+ return this.http.put(`/team/${encodeURIComponent(id)}`, data, options);
112
+ }
113
+ /**
114
+ * Delete a team by ID
115
+ *
116
+ * @param id - The unique identifier of the team to delete
117
+ * @param options - Optional request configuration
118
+ * @returns Promise that resolves when the team is deleted
119
+ */
120
+ delete(id, options) {
121
+ return this.http.delete(`/team/${encodeURIComponent(id)}`, options);
122
+ }
92
123
  }
@@ -4,6 +4,8 @@ export * from './agent.js';
4
4
  export * from './board.js';
5
5
  export * from './card.js';
6
6
  export * from './external-channel.js';
7
+ export * from './position.js';
7
8
  export * from './resource.js';
9
+ export * from './session.js';
8
10
  export * from './shared.js';
9
11
  export * from './team.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -5,7 +5,9 @@ import { BoardsClient } from './resources/BoardsClient';
5
5
  import { CardsClient } from './resources/CardsClient';
6
6
  import { ExternalChannelsClient } from './resources/ExternalChannelsClient';
7
7
  import { ModelCost } from './resources/ModelCost';
8
+ import { PositionsClient } from './resources/PositionsClient';
8
9
  import { ResourcesClient } from './resources/ResourcesClient';
10
+ import { SessionsClient } from './resources/SessionsClient';
9
11
  import { TeamMembersClient } from './resources/TeamMembersClient';
10
12
  import { TeamsClient } from './resources/TeamsClient';
11
13
  /**
@@ -34,6 +36,10 @@ export interface KaibanClient {
34
36
  resources: ResourcesClient;
35
37
  /** Client for managing external channels */
36
38
  externalChannels: ExternalChannelsClient;
39
+ /** Client for managing positions */
40
+ positions: PositionsClient;
41
+ /** Client for managing sessions and session data */
42
+ sessions: SessionsClient;
37
43
  /** Client for calculate model usage costs*/
38
44
  costs: ModelCost;
39
45
  }
@@ -139,6 +139,22 @@ export declare class AgentsClient {
139
139
  * ```
140
140
  */
141
141
  update(id: string, data: Partial<Agent>, options?: RequestOptions): Promise<Agent>;
142
+ /**
143
+ * Delete an agent by ID
144
+ *
145
+ * @param id - The unique identifier of the agent to delete
146
+ * @param options - Optional request configuration
147
+ *
148
+ * @returns Promise that resolves when the agent is deleted
149
+ *
150
+ * @throws {Error} If the agent is not found or deletion fails
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * await client.agents.delete('agent-123');
155
+ * ```
156
+ */
157
+ delete(id: string, options?: RequestOptions): Promise<void>;
142
158
  /**
143
159
  * Create feedback for an agent
144
160
  *
@@ -95,4 +95,20 @@ export declare class BoardsClient {
95
95
  * ```
96
96
  */
97
97
  create(data: CreateBoardInput, options?: RequestOptions): Promise<Board>;
98
+ /**
99
+ * Delete a board by ID (and its cards and their activities)
100
+ *
101
+ * @param id - The unique identifier of the board to delete
102
+ * @param options - Optional request configuration
103
+ *
104
+ * @returns Promise that resolves when the board is deleted
105
+ *
106
+ * @throws {Error} If the board is not found or deletion fails
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * await client.boards.delete('board-123');
111
+ * ```
112
+ */
113
+ delete(id: string, options?: RequestOptions): Promise<void>;
98
114
  }
@@ -62,4 +62,32 @@ export declare class ExternalChannelsClient {
62
62
  * ```
63
63
  */
64
64
  get(id: string, options?: RequestOptions): Promise<ExternalChannel>;
65
+ create(data: {
66
+ type: string;
67
+ name: string;
68
+ description?: string;
69
+ agent_id: string;
70
+ board_id: string;
71
+ initial_column_key: string;
72
+ team_id: string;
73
+ status?: string;
74
+ priority?: string;
75
+ metadata?: Record<string, unknown>;
76
+ }, options?: RequestOptions): Promise<ExternalChannel>;
77
+ update(id: string, data: {
78
+ type?: string;
79
+ name?: string;
80
+ description?: string;
81
+ agent_id?: string;
82
+ board_id?: string;
83
+ initial_column_key?: string;
84
+ team_id?: string;
85
+ status?: string;
86
+ priority?: string;
87
+ metadata?: Record<string, unknown>;
88
+ }, options?: RequestOptions): Promise<ExternalChannel>;
89
+ delete(id: string, options?: RequestOptions): Promise<{
90
+ deleted: true;
91
+ id: string;
92
+ }>;
65
93
  }
@@ -0,0 +1,39 @@
1
+ import { Position } 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 positions in the Kaiban platform
7
+ * @category Resources
8
+ */
9
+ export declare class PositionsClient {
10
+ private readonly http;
11
+ constructor(http: HttpClient);
12
+ list(params?: ListParams, options?: RequestOptions): Promise<Paginated<Position>>;
13
+ listAll(params?: Omit<ListParams, 'after' | 'before'>, options?: RequestOptions): AsyncGenerator<Position, void, unknown>;
14
+ get(id: string, options?: RequestOptions): Promise<Position>;
15
+ create(data: {
16
+ title: string;
17
+ job_description: string;
18
+ team_id: string;
19
+ created_by: string;
20
+ ai_skills?: string[];
21
+ tools_to_integrate?: string[];
22
+ monthly_budget?: number;
23
+ status?: 'active' | 'inactive';
24
+ }, options?: RequestOptions): Promise<Position>;
25
+ update(id: string, data: {
26
+ title?: string;
27
+ job_description?: string;
28
+ team_id?: string;
29
+ created_by?: string;
30
+ ai_skills?: string[];
31
+ tools_to_integrate?: string[];
32
+ monthly_budget?: number;
33
+ status?: 'active' | 'inactive';
34
+ }, options?: RequestOptions): Promise<Position>;
35
+ delete(id: string, options?: RequestOptions): Promise<{
36
+ deleted: true;
37
+ id: string;
38
+ }>;
39
+ }
@@ -62,4 +62,32 @@ export declare class ResourcesClient {
62
62
  * ```
63
63
  */
64
64
  get(id: string, options?: RequestOptions): Promise<Resource>;
65
+ create(data: {
66
+ title: string;
67
+ description: string;
68
+ version?: number;
69
+ status?: string;
70
+ team_id: string;
71
+ created_by: string;
72
+ last_edited_by?: string;
73
+ draft_content?: string;
74
+ published_content?: string;
75
+ vector_db_index_name?: string;
76
+ }, options?: RequestOptions): Promise<Resource>;
77
+ update(id: string, data: {
78
+ title?: string;
79
+ description?: string;
80
+ version?: number;
81
+ status?: string;
82
+ team_id?: string;
83
+ created_by?: string;
84
+ last_edited_by?: string;
85
+ draft_content?: string;
86
+ published_content?: string;
87
+ vector_db_index_name?: string;
88
+ }, options?: RequestOptions): Promise<Resource>;
89
+ delete(id: string, options?: RequestOptions): Promise<{
90
+ deleted: true;
91
+ id: string;
92
+ }>;
65
93
  }
@@ -0,0 +1,89 @@
1
+ import { CreateSessionDataBatchInput, CreateSessionInput, Session, SessionData, UpdateSessionDataInput } from '../../types/entities';
2
+ import { HttpClient } from '../http/HttpClient';
3
+ import { RequestOptions } from '../http/types';
4
+ /**
5
+ * Client for managing sessions and session data in the Kaiban platform.
6
+ * Sessions are workspaces for agents to work on cards; session data holds artifacts (e.g. analysis, drafts).
7
+ * @category Resources
8
+ */
9
+ export declare class SessionsClient {
10
+ private readonly http;
11
+ constructor(http: HttpClient);
12
+ /**
13
+ * Create a new session for a card
14
+ *
15
+ * @param data - Session creation data (card_id, created_by, optional metadata)
16
+ * @param options - Optional request configuration
17
+ * @returns The created session
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const session = await client.sessions.create({
22
+ * card_id: 'card_123',
23
+ * created_by: { id: 'agent_1', type: 'agent', name: 'Claude Agent' },
24
+ * });
25
+ * ```
26
+ */
27
+ create(data: CreateSessionInput, options?: RequestOptions): Promise<Session>;
28
+ /**
29
+ * Get a session by ID
30
+ *
31
+ * @param id - Session ID
32
+ * @param options - Optional request configuration
33
+ * @returns The session
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const session = await client.sessions.get('session_abc123');
38
+ * ```
39
+ */
40
+ get(id: string, options?: RequestOptions): Promise<Session>;
41
+ /**
42
+ * Create session data (artifacts) for a session (batch).
43
+ *
44
+ * @param sessionId - Parent session ID
45
+ * @param items - Array of items (label optional, data required). At least one item.
46
+ * @param options - Optional request configuration
47
+ * @returns Array of created session data
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const created = await client.sessions.createData('session_abc', [
52
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
53
+ * ]);
54
+ * ```
55
+ */
56
+ createData(sessionId: string, items: CreateSessionDataBatchInput, options?: RequestOptions): Promise<SessionData[]>;
57
+ /**
58
+ * List all session data for a session (ordered by created_at)
59
+ *
60
+ * @param sessionId - Session ID
61
+ * @param options - Optional request configuration
62
+ * @returns Array of session data
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const list = await client.sessions.getData('session_abc');
67
+ * ```
68
+ */
69
+ getData(sessionId: string, options?: RequestOptions): Promise<SessionData[]>;
70
+ /**
71
+ * Update session data and record who made the change
72
+ *
73
+ * @param sessionId - Session ID
74
+ * @param dataId - Session data document ID
75
+ * @param data - Updated label, data payload, and updated_by
76
+ * @param options - Optional request configuration
77
+ * @returns The updated session data
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * const updated = await client.sessions.updateData('session_abc', 'data_xyz', {
82
+ * label: 'analysis_v2',
83
+ * data: { result: 'corrected' },
84
+ * updated_by: { id: 'user_1', type: 'user', name: 'Jane Doe' },
85
+ * });
86
+ * ```
87
+ */
88
+ updateData(sessionId: string, dataId: string, data: UpdateSessionDataInput, options?: RequestOptions): Promise<SessionData>;
89
+ }
@@ -86,4 +86,40 @@ export declare class TeamMembersClient {
86
86
  * ```
87
87
  */
88
88
  get(id: string, options?: RequestOptions): Promise<TeamMember>;
89
+ /**
90
+ * Create a new team member
91
+ *
92
+ * @param data - team_id, user_id, role, is_agent
93
+ * @param options - Optional request configuration
94
+ * @returns The newly created team member
95
+ */
96
+ create(data: {
97
+ team_id: string;
98
+ user_id: string;
99
+ role: string;
100
+ is_agent: boolean;
101
+ }, options?: RequestOptions): Promise<TeamMember>;
102
+ /**
103
+ * Update a team member by ID (partial: role, is_agent)
104
+ *
105
+ * @param id - The unique identifier of the team member
106
+ * @param data - Partial fields to update
107
+ * @param options - Optional request configuration
108
+ * @returns The updated team member
109
+ */
110
+ update(id: string, data: {
111
+ role?: string;
112
+ is_agent?: boolean;
113
+ }, options?: RequestOptions): Promise<TeamMember>;
114
+ /**
115
+ * Delete a team member by ID
116
+ *
117
+ * @param id - The unique identifier of the team member to delete
118
+ * @param options - Optional request configuration
119
+ * @returns Promise that resolves when the team member is deleted
120
+ */
121
+ delete(id: string, options?: RequestOptions): Promise<{
122
+ deleted: true;
123
+ id: string;
124
+ }>;
89
125
  }
@@ -80,4 +80,38 @@ export declare class TeamsClient {
80
80
  * ```
81
81
  */
82
82
  get(id: string, options?: RequestOptions): Promise<Team>;
83
+ /**
84
+ * Create a new team
85
+ *
86
+ * @param data - Team creation data (name, optional description)
87
+ * @param options - Optional request configuration
88
+ * @returns The newly created team
89
+ */
90
+ create(data: {
91
+ name: string;
92
+ description?: string;
93
+ }, options?: RequestOptions): Promise<Team>;
94
+ /**
95
+ * Update a team by ID (partial update)
96
+ *
97
+ * @param id - The unique identifier of the team
98
+ * @param data - Partial team data (name, description)
99
+ * @param options - Optional request configuration
100
+ * @returns The updated team
101
+ */
102
+ update(id: string, data: {
103
+ name?: string;
104
+ description?: string;
105
+ }, options?: RequestOptions): Promise<Team>;
106
+ /**
107
+ * Delete a team by ID
108
+ *
109
+ * @param id - The unique identifier of the team to delete
110
+ * @param options - Optional request configuration
111
+ * @returns Promise that resolves when the team is deleted
112
+ */
113
+ delete(id: string, options?: RequestOptions): Promise<{
114
+ deleted: true;
115
+ id: string;
116
+ }>;
83
117
  }
@@ -4,6 +4,8 @@ export * from './agent';
4
4
  export * from './board';
5
5
  export * from './card';
6
6
  export * from './external-channel';
7
+ export * from './position';
7
8
  export * from './resource';
9
+ export * from './session';
8
10
  export * from './shared';
9
11
  export * from './team';
@@ -0,0 +1,13 @@
1
+ import { ISODate } from './shared';
2
+ export interface Position {
3
+ id: string;
4
+ title: string;
5
+ job_description: string;
6
+ team_id: string;
7
+ created_by: string;
8
+ created_at: ISODate;
9
+ ai_skills: string[];
10
+ tools_to_integrate: string[];
11
+ monthly_budget: number;
12
+ status: 'active' | 'inactive';
13
+ }
@@ -0,0 +1,44 @@
1
+ import { ISODate } from './shared';
2
+ /** Actor reference for who created or modified session/session data */
3
+ export interface SessionActor {
4
+ id: string;
5
+ type: 'agent' | 'user';
6
+ name: string;
7
+ }
8
+ /** Session – minimal workspace for agents to work on a card */
9
+ export interface Session {
10
+ id: string;
11
+ card_id: string;
12
+ created_by: SessionActor;
13
+ metadata?: Record<string, unknown>;
14
+ created_at: ISODate;
15
+ }
16
+ /** Input for creating a session (POST /v1/sessions) */
17
+ export type CreateSessionInput = {
18
+ card_id: string;
19
+ created_by: SessionActor;
20
+ metadata?: Record<string, unknown>;
21
+ };
22
+ /** Session data artifact – payload and optional label, with edit tracking */
23
+ export interface SessionData {
24
+ id: string;
25
+ session_id: string;
26
+ label?: string;
27
+ data: Record<string, unknown>;
28
+ updated_by?: SessionActor;
29
+ created_at: ISODate;
30
+ updated_at: ISODate;
31
+ }
32
+ /** Input for a single session data item (one element of the batch) */
33
+ export type CreateSessionDataInput = {
34
+ label?: string;
35
+ data: Record<string, unknown>;
36
+ };
37
+ /** Batch input for creating session data (POST /v1/session/:sessionId/data). Must send at least one item. */
38
+ export type CreateSessionDataBatchInput = CreateSessionDataInput[];
39
+ /** Input for updating session data (PUT /v1/session/:sessionId/data/:id) */
40
+ export type UpdateSessionDataInput = {
41
+ label?: string;
42
+ data: Record<string, unknown>;
43
+ updated_by: SessionActor;
44
+ };
@@ -12,5 +12,9 @@ export interface TeamMember {
12
12
  role: string;
13
13
  team_id: string;
14
14
  user_id: string;
15
- created_at: ISODate;
15
+ created_at?: ISODate;
16
+ /** Enriched from profiles when available */
17
+ full_name?: string;
18
+ email?: string;
19
+ avatar_url?: string;
16
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaiban/sdk",
3
- "version": "0.4.19",
3
+ "version": "0.4.21",
4
4
  "description": "Official TypeScript SDK for the Kaiban API",
5
5
  "keywords": [
6
6
  "kaiban",