@kaiban/sdk 0.1.9 → 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 +187 -21
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/lib/client.js +56 -0
- package/dist/cjs/lib/http/HttpClient.js +243 -0
- package/dist/cjs/lib/http/errors.js +143 -0
- package/dist/cjs/lib/http/types.js +2 -0
- package/dist/cjs/lib/resources/ActivitiesClient.js +164 -0
- package/dist/cjs/lib/resources/AgentsClient.js +224 -0
- package/dist/cjs/lib/resources/BoardsClient.js +120 -0
- package/dist/cjs/lib/resources/CardsClient.js +352 -0
- package/dist/cjs/lib/resources/ExternalChannelsClient.js +78 -0
- package/dist/cjs/lib/resources/ModelCost.js +87 -0
- package/dist/cjs/lib/resources/ResourcesClient.js +78 -0
- package/dist/cjs/lib/resources/TeamMembersClient.js +102 -0
- package/dist/cjs/lib/resources/TeamsClient.js +96 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/test/helpers/mockFetch.js +27 -0
- package/dist/cjs/types/entities/a2a-dataparts.js +17 -0
- package/dist/cjs/types/entities/activities.js +72 -0
- package/dist/cjs/types/entities/agent.js +28 -0
- package/dist/cjs/types/entities/board.js +2 -0
- package/dist/cjs/types/entities/card.js +29 -0
- package/dist/cjs/types/entities/costs.js +2 -0
- package/dist/cjs/types/entities/external-channel.js +19 -0
- package/dist/cjs/types/entities/index.js +25 -0
- package/dist/cjs/types/entities/resource.js +10 -0
- package/dist/cjs/types/entities/shared.js +3 -0
- package/dist/cjs/types/entities/team.js +2 -0
- package/dist/cjs/types/entities.js +17 -0
- package/dist/cjs/types/responses.js +2 -0
- package/dist/esm/index.js +5 -0
- package/dist/{lib → esm/lib}/client.js +11 -9
- package/dist/{lib → esm/lib}/http/HttpClient.js +1 -1
- package/dist/{lib → esm/lib}/resources/AgentsClient.js +28 -0
- package/dist/{lib → esm/lib}/resources/BoardsClient.js +42 -0
- package/dist/{lib → esm/lib}/resources/CardsClient.js +1 -1
- package/dist/esm/lib/resources/TeamMembersClient.js +98 -0
- package/dist/{types → esm/types}/entities/activities.js +9 -13
- package/dist/esm/types/entities/index.js +9 -0
- package/dist/esm/types/entities.js +1 -0
- package/dist/esm/types/requests.js +19 -0
- package/dist/{lib → types/lib}/client.d.ts +3 -0
- package/dist/{lib → types/lib}/resources/AgentsClient.d.ts +26 -0
- package/dist/{lib → types/lib}/resources/BoardsClient.d.ts +34 -1
- package/dist/types/lib/resources/TeamMembersClient.d.ts +89 -0
- package/dist/types/{entities → types/entities}/activities.d.ts +14 -3
- package/dist/types/{entities → types/entities}/agent.d.ts +18 -10
- package/dist/types/{entities → types/entities}/board.d.ts +16 -5
- package/dist/types/{entities → types/entities}/card.d.ts +22 -13
- package/dist/types/{entities → types/entities}/external-channel.d.ts +1 -1
- package/dist/types/{entities → types/entities}/team.d.ts +4 -2
- package/package.json +18 -9
- package/dist/index.js +0 -5
- package/dist/types/entities/index.js +0 -9
- package/dist/types/entities.js +0 -1
- /package/dist/{types → cjs/types}/requests.js +0 -0
- /package/dist/{lib → esm/lib}/http/errors.js +0 -0
- /package/dist/{lib → esm/lib}/http/types.js +0 -0
- /package/dist/{lib → esm/lib}/resources/ActivitiesClient.js +0 -0
- /package/dist/{lib → esm/lib}/resources/ExternalChannelsClient.js +0 -0
- /package/dist/{lib → esm/lib}/resources/ModelCost.js +0 -0
- /package/dist/{lib → esm/lib}/resources/ResourcesClient.js +0 -0
- /package/dist/{lib → esm/lib}/resources/TeamsClient.js +0 -0
- /package/dist/{test → esm/test}/helpers/mockFetch.js +0 -0
- /package/dist/{types → esm/types}/entities/a2a-dataparts.js +0 -0
- /package/dist/{types → esm/types}/entities/agent.js +0 -0
- /package/dist/{types → esm/types}/entities/board.js +0 -0
- /package/dist/{types → esm/types}/entities/card.js +0 -0
- /package/dist/{types → esm/types}/entities/costs.js +0 -0
- /package/dist/{types → esm/types}/entities/external-channel.js +0 -0
- /package/dist/{types → esm/types}/entities/resource.js +0 -0
- /package/dist/{types → esm/types}/entities/shared.js +0 -0
- /package/dist/{types → esm/types}/entities/team.js +0 -0
- /package/dist/{types → esm/types}/responses.js +0 -0
- /package/dist/{index.d.ts → types/index.d.ts} +0 -0
- /package/dist/{lib → types/lib}/http/HttpClient.d.ts +0 -0
- /package/dist/{lib → types/lib}/http/errors.d.ts +0 -0
- /package/dist/{lib → types/lib}/http/types.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/ActivitiesClient.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/CardsClient.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/ExternalChannelsClient.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/ModelCost.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/ResourcesClient.d.ts +0 -0
- /package/dist/{lib → types/lib}/resources/TeamsClient.d.ts +0 -0
- /package/dist/{test → types/test}/helpers/mockFetch.d.ts +0 -0
- /package/dist/types/{entities → types/entities}/a2a-dataparts.d.ts +0 -0
- /package/dist/types/{entities → types/entities}/costs.d.ts +0 -0
- /package/dist/types/{entities → types/entities}/index.d.ts +0 -0
- /package/dist/types/{entities → types/entities}/resource.d.ts +0 -0
- /package/dist/types/{entities → types/entities}/shared.d.ts +0 -0
- /package/dist/types/{entities.d.ts → types/entities.d.ts} +0 -0
- /package/dist/types/{requests.d.ts → types/requests.d.ts} +0 -0
- /package/dist/types/{responses.d.ts → types/responses.d.ts} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TeamsClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for managing teams in the Kaiban platform
|
|
6
|
+
* @category Resources
|
|
7
|
+
*/
|
|
8
|
+
class TeamsClient {
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* List teams with pagination, filters, and sorting
|
|
14
|
+
*
|
|
15
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
16
|
+
* @param params.cursor - Cursor for pagination (from previous/next response)
|
|
17
|
+
* @param params.limit - Number of items per page (default: 50, max: 100)
|
|
18
|
+
* @param params.order_by - Fields to sort by. Use - prefix for descending order
|
|
19
|
+
* @param params.filters - Filter parameters (e.g., { status: 'active' })
|
|
20
|
+
* @param options - Optional request configuration
|
|
21
|
+
*
|
|
22
|
+
* @returns A paginated list of teams
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Basic pagination
|
|
27
|
+
* const result = await client.teams.list({ limit: 20 });
|
|
28
|
+
* console.log(result.data); // Current page items
|
|
29
|
+
* console.log(result.pagination.next_cursor); // Use for next page
|
|
30
|
+
*
|
|
31
|
+
* // With sorting
|
|
32
|
+
* const sorted = await client.teams.list({
|
|
33
|
+
* order_by: '-created_at',
|
|
34
|
+
* limit: 50
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // With filters
|
|
38
|
+
* const filtered = await client.teams.list({
|
|
39
|
+
* filters: { status: 'active' }
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Next page
|
|
43
|
+
* const nextPage = await client.teams.list({
|
|
44
|
+
* cursor: result.pagination.next_cursor
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
list(params, options) {
|
|
49
|
+
return this.http.list('/teams', params, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Iterate through all teams using async generator
|
|
53
|
+
* Automatically handles pagination by following next_page_token
|
|
54
|
+
*
|
|
55
|
+
* @param params - Optional query parameters (excluding cursor)
|
|
56
|
+
* @param options - Optional request configuration
|
|
57
|
+
*
|
|
58
|
+
* @yields Individual Team objects
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* for await (const team of client.teams.listAll()) {
|
|
63
|
+
* console.log(team.id, team.name);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
async *listAll(params, options) {
|
|
68
|
+
let cursor = undefined;
|
|
69
|
+
do {
|
|
70
|
+
const page = await this.list({ ...(params || {}), after: cursor }, options);
|
|
71
|
+
for (const item of page.data)
|
|
72
|
+
yield item;
|
|
73
|
+
cursor = page.pagination.next_cursor;
|
|
74
|
+
} while (cursor);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get a single team by ID
|
|
78
|
+
*
|
|
79
|
+
* @param id - The unique identifier of the team
|
|
80
|
+
* @param options - Optional request configuration
|
|
81
|
+
*
|
|
82
|
+
* @returns The team object
|
|
83
|
+
*
|
|
84
|
+
* @throws {Error} If the team is not found or request fails
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const team = await client.teams.get('team-123');
|
|
89
|
+
* console.log(team.name);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
get(id, options) {
|
|
93
|
+
return this.http.get(`/team/${encodeURIComponent(id)}`, options);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.TeamsClient = TeamsClient;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createMockFetch = createMockFetch;
|
|
4
|
+
exports.jsonOk = jsonOk;
|
|
5
|
+
exports.jsonError = jsonError;
|
|
6
|
+
function createMockFetch(sequence) {
|
|
7
|
+
let callIndex = 0;
|
|
8
|
+
const fetchImpl = async (input, init) => {
|
|
9
|
+
const item = sequence[Math.min(callIndex, sequence.length - 1)];
|
|
10
|
+
callIndex++;
|
|
11
|
+
const resolved = typeof item === 'function' ? await item(input, init) : item;
|
|
12
|
+
const headers = new Headers(resolved.headers || { 'content-type': 'application/json' });
|
|
13
|
+
const body = resolved.body === undefined || resolved.body === null
|
|
14
|
+
? null
|
|
15
|
+
: headers.get('content-type')?.includes('application/json')
|
|
16
|
+
? JSON.stringify(resolved.body)
|
|
17
|
+
: String(resolved.body);
|
|
18
|
+
return new Response(body, { status: resolved.status, headers });
|
|
19
|
+
};
|
|
20
|
+
return fetchImpl;
|
|
21
|
+
}
|
|
22
|
+
function jsonOk(body, headers) {
|
|
23
|
+
return { status: 200, headers: { 'content-type': 'application/json', ...(headers || {}) }, body };
|
|
24
|
+
}
|
|
25
|
+
function jsonError(status, body) {
|
|
26
|
+
return { status, headers: { 'content-type': 'application/json' }, body };
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.A2ADataPartType = void 0;
|
|
4
|
+
exports.A2ADataPartType = {
|
|
5
|
+
TOOL_CALL_START: 'tool_call_start',
|
|
6
|
+
TOOL_CALL_ARGS: 'tool_call_args',
|
|
7
|
+
TOOL_CALL_END: 'tool_call_end',
|
|
8
|
+
TOOL_CALL_RESULT: 'tool_call_result',
|
|
9
|
+
TASK_INFO_MESSAGE: 'task_info_message',
|
|
10
|
+
TASK_STEP_OUTPUT: 'task_step_output',
|
|
11
|
+
USER_EVALUATION: 'user_evaluation',
|
|
12
|
+
USER_THREAD_FEEDBACK: 'user_thread_feedback',
|
|
13
|
+
USER_CLOSE_THREAD: 'user_close_thread',
|
|
14
|
+
GENERATE_REPORT: 'generate_report',
|
|
15
|
+
KAIBAN_ACTIVITY: 'kaiban_activity',
|
|
16
|
+
AGENT_STATUS: 'agent_status',
|
|
17
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivityType = void 0;
|
|
4
|
+
exports.ActivityType = {
|
|
5
|
+
// Card status activities
|
|
6
|
+
CARD_STATUS_CHANGED: 'card_status_changed',
|
|
7
|
+
CARD_RESULT_PREVIEW: 'card_result_preview',
|
|
8
|
+
// Card task activities
|
|
9
|
+
CARD_TASK_COMPLETED: 'card_task_completed',
|
|
10
|
+
CARD_TASK_BLOCKED: 'card_task_blocked',
|
|
11
|
+
CARD_TASK_STARTED: 'card_task_started',
|
|
12
|
+
// Card modification activities
|
|
13
|
+
CARD_AGENT_ADDED: 'card_agent_added',
|
|
14
|
+
CARD_AGENT_REMOVED: 'card_agent_removed',
|
|
15
|
+
CARD_TITLE_CHANGED: 'card_title_changed',
|
|
16
|
+
CARD_DESCRIPTION_CHANGED: 'card_description_changed',
|
|
17
|
+
CARD_RESULT_CHANGED: 'card_result_changed',
|
|
18
|
+
CARD_PRIORITY_CHANGED: 'card_priority_changed',
|
|
19
|
+
CARD_MEMBER_ADDED: 'card_member_added',
|
|
20
|
+
CARD_MEMBER_REMOVED: 'card_member_removed',
|
|
21
|
+
CARD_COMMENT_ADDED: 'card_comment_added',
|
|
22
|
+
CARD_DELETED: 'card_deleted',
|
|
23
|
+
CARD_CREATED: 'card_created',
|
|
24
|
+
CARD_CLONED: 'card_cloned',
|
|
25
|
+
CARD_COLUMN_CHANGED: 'card_column_changed',
|
|
26
|
+
// A2A task status activities
|
|
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',
|
|
36
|
+
// Thread activities
|
|
37
|
+
THREAD_USER_MESSAGE: 'thread_user_message',
|
|
38
|
+
THREAD_AGENT_MESSAGE: 'thread_agent_message',
|
|
39
|
+
THREAD_AGENT_MESSAGE_EVALUATION: 'thread_agent_message_evaluation',
|
|
40
|
+
THREAD_FEEDBACK: 'thread_feedback',
|
|
41
|
+
THREAD_STEP_COSTS: 'thread_step_costs',
|
|
42
|
+
// Agent task status activities
|
|
43
|
+
AGENT_TASK_DOING: 'agent_task_doing',
|
|
44
|
+
AGENT_TASK_COMPLETED: 'agent_task_completed',
|
|
45
|
+
AGENT_TASK_DONE: 'agent_task_done',
|
|
46
|
+
AGENT_TASK_BLOCKED: 'agent_task_blocked',
|
|
47
|
+
AGENT_TASK_WAITING: 'agent_task_waiting',
|
|
48
|
+
AGENT_TASK_CANCELLED: 'agent_task_cancelled',
|
|
49
|
+
AGENT_TASK_FAILED: 'agent_task_failed',
|
|
50
|
+
// Agent action activities
|
|
51
|
+
AGENT_STATUS_OBSERVATION: 'agent_status_observation',
|
|
52
|
+
AGENT_STATUS_THINKING_END: 'agent_status_thinking_end',
|
|
53
|
+
AGENT_STATUS_UPDATED: 'agent_status_updated',
|
|
54
|
+
AGENT_REGISTER_APPROVAL: 'agent_register_approval',
|
|
55
|
+
AGENT_REGISTER_REJECTED: 'agent_register_rejected',
|
|
56
|
+
AGENT_RESPOND_FEEDBACK: 'agent_respond_feedback',
|
|
57
|
+
// Result feedback activities
|
|
58
|
+
RESULT_APPROVED: 'result_approved',
|
|
59
|
+
RESULT_REJECTED: 'result_rejected',
|
|
60
|
+
RESULT_FEEDBACK: 'result_feedback',
|
|
61
|
+
// Email activities
|
|
62
|
+
EMAIL_RECEIVED: 'email_received',
|
|
63
|
+
EMAIL_SENT: 'email_sent',
|
|
64
|
+
EMAIL_OPENED: 'email_opened',
|
|
65
|
+
EMAIL_CLICKED: 'email_clicked',
|
|
66
|
+
EMAIL_BOUNCED: 'email_bounced',
|
|
67
|
+
EMAIL_SPAM: 'email_spam',
|
|
68
|
+
// System tracing activities
|
|
69
|
+
SYSTEM_TRACE: 'system_trace',
|
|
70
|
+
// Resource activities
|
|
71
|
+
RESOURCE_PUBLISHED: 'resource_published',
|
|
72
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentFeedbackEvaluation = exports.AgentFeedbackType = exports.AgentFeedbackStatus = exports.AgentStatus = exports.AgentType = void 0;
|
|
4
|
+
exports.AgentType = {
|
|
5
|
+
KAIBANJS: 'kaibanjs',
|
|
6
|
+
CREWAI: 'crewai',
|
|
7
|
+
EXTERNAL: 'external',
|
|
8
|
+
A2A: 'a2a',
|
|
9
|
+
};
|
|
10
|
+
exports.AgentStatus = {
|
|
11
|
+
DRAFT: 'draft',
|
|
12
|
+
ACTIVE: 'active',
|
|
13
|
+
INACTIVE: 'inactive',
|
|
14
|
+
};
|
|
15
|
+
exports.AgentFeedbackStatus = {
|
|
16
|
+
UNPROCESSED: 'unprocessed',
|
|
17
|
+
REVIEWED: 'reviewed',
|
|
18
|
+
ANNOTATED: 'annotated',
|
|
19
|
+
};
|
|
20
|
+
exports.AgentFeedbackType = {
|
|
21
|
+
OPERATOR_EVALUATION_ADDED: 'operator_evaluation_added',
|
|
22
|
+
USER_CONVERSATION_FEEDBACK: 'user_conversation_feedback',
|
|
23
|
+
USER_MESSAGE_EVALUATION: 'user_message_evaluation',
|
|
24
|
+
};
|
|
25
|
+
exports.AgentFeedbackEvaluation = {
|
|
26
|
+
POSITIVE: 'positive',
|
|
27
|
+
NEGATIVE: 'negative',
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardStatus = void 0;
|
|
4
|
+
exports.CardStatus = {
|
|
5
|
+
BACKLOG: 'backlog',
|
|
6
|
+
TODO: 'todo',
|
|
7
|
+
DOING: 'doing',
|
|
8
|
+
BLOCKED: 'blocked',
|
|
9
|
+
DONE: 'done',
|
|
10
|
+
};
|
|
11
|
+
// export interface CreateCardInput {
|
|
12
|
+
// team_id: string;
|
|
13
|
+
// board_id: string;
|
|
14
|
+
// owner_id: string;
|
|
15
|
+
// agent_id: string;
|
|
16
|
+
// title: string;
|
|
17
|
+
// description?: string;
|
|
18
|
+
// status: Card['status'];
|
|
19
|
+
// column_key: string;
|
|
20
|
+
// priority: string;
|
|
21
|
+
// member_ids: string[];
|
|
22
|
+
// parts?: CardPart[];
|
|
23
|
+
// metadata?: Record<string, unknown>;
|
|
24
|
+
// }
|
|
25
|
+
// export type UpdateCardInput = Partial<
|
|
26
|
+
// Omit<CreateCardInput, 'team_id' | 'board_id' | 'owner_id'>
|
|
27
|
+
// > & {
|
|
28
|
+
// status?: Card['status'];
|
|
29
|
+
// };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExternalChannelPriority = exports.ExternalChannelStatus = exports.ExternalChannelType = void 0;
|
|
4
|
+
exports.ExternalChannelType = {
|
|
5
|
+
EMAIL: 'email',
|
|
6
|
+
FORM: 'form',
|
|
7
|
+
CALL: 'call',
|
|
8
|
+
SMS: 'sms',
|
|
9
|
+
CHATBOT: 'chatbot',
|
|
10
|
+
};
|
|
11
|
+
exports.ExternalChannelStatus = {
|
|
12
|
+
ACTIVE: 'active',
|
|
13
|
+
INACTIVE: 'inactive',
|
|
14
|
+
};
|
|
15
|
+
exports.ExternalChannelPriority = {
|
|
16
|
+
LOW: 'low',
|
|
17
|
+
MEDIUM: 'medium',
|
|
18
|
+
HIGH: 'high',
|
|
19
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./a2a-dataparts"), exports);
|
|
18
|
+
__exportStar(require("./activities"), exports);
|
|
19
|
+
__exportStar(require("./agent"), exports);
|
|
20
|
+
__exportStar(require("./board"), exports);
|
|
21
|
+
__exportStar(require("./card"), exports);
|
|
22
|
+
__exportStar(require("./external-channel"), exports);
|
|
23
|
+
__exportStar(require("./resource"), exports);
|
|
24
|
+
__exportStar(require("./shared"), exports);
|
|
25
|
+
__exportStar(require("./team"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResourceStatus = void 0;
|
|
4
|
+
exports.ResourceStatus = {
|
|
5
|
+
DRAFT: 'draft',
|
|
6
|
+
INDEXING: 'indexing',
|
|
7
|
+
INDEXING_ERROR: 'indexing_error',
|
|
8
|
+
PUBLISHED: 'published',
|
|
9
|
+
ARCHIVED: 'archived',
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./entities/index"), exports);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { HttpClient } from './http/HttpClient';
|
|
2
|
-
import { ActivitiesClient } from './resources/ActivitiesClient';
|
|
3
|
-
import { AgentsClient } from './resources/AgentsClient';
|
|
4
|
-
import { BoardsClient } from './resources/BoardsClient';
|
|
5
|
-
import { CardsClient } from './resources/CardsClient';
|
|
6
|
-
import { ExternalChannelsClient } from './resources/ExternalChannelsClient';
|
|
7
|
-
import { ModelCost } from './resources/ModelCost';
|
|
8
|
-
import { ResourcesClient } from './resources/ResourcesClient';
|
|
9
|
-
import {
|
|
1
|
+
import { HttpClient } from './http/HttpClient.js';
|
|
2
|
+
import { ActivitiesClient } from './resources/ActivitiesClient.js';
|
|
3
|
+
import { AgentsClient } from './resources/AgentsClient.js';
|
|
4
|
+
import { BoardsClient } from './resources/BoardsClient.js';
|
|
5
|
+
import { CardsClient } from './resources/CardsClient.js';
|
|
6
|
+
import { ExternalChannelsClient } from './resources/ExternalChannelsClient.js';
|
|
7
|
+
import { ModelCost } from './resources/ModelCost.js';
|
|
8
|
+
import { ResourcesClient } from './resources/ResourcesClient.js';
|
|
9
|
+
import { TeamMembersClient } from './resources/TeamMembersClient.js';
|
|
10
|
+
import { TeamsClient } from './resources/TeamsClient.js';
|
|
10
11
|
/**
|
|
11
12
|
* Create a Kaiban SDK client instance
|
|
12
13
|
*
|
|
@@ -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),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbortedError, RateLimitError, ServerError, TimeoutError, UnavailableError, mapHttpToSdkError, } from './errors';
|
|
1
|
+
import { AbortedError, RateLimitError, ServerError, TimeoutError, UnavailableError, mapHttpToSdkError, } from './errors.js';
|
|
2
2
|
function buildQuery(query) {
|
|
3
3
|
if (!query)
|
|
4
4
|
return '';
|
|
@@ -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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './a2a-dataparts.js';
|
|
2
|
+
export * from './activities.js';
|
|
3
|
+
export * from './agent.js';
|
|
4
|
+
export * from './board.js';
|
|
5
|
+
export * from './card.js';
|
|
6
|
+
export * from './external-channel.js';
|
|
7
|
+
export * from './resource.js';
|
|
8
|
+
export * from './shared.js';
|
|
9
|
+
export * from './team.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './entities/index.js';
|