@pnds/sdk 0.1.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/dist/client.d.ts +117 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +282 -0
- package/dist/constants.d.ts +72 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +88 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/types.d.ts +454 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/ws.d.ts +49 -0
- package/dist/ws.d.ts.map +1 -0
- package/dist/ws.js +198 -0
- package/package.json +31 -0
- package/src/client.ts +435 -0
- package/src/constants.ts +119 -0
- package/src/index.ts +6 -0
- package/src/types.ts +569 -0
- package/src/ws.ts +250 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AuthTokens, RegisterRequest, LoginRequest, CheckEmailResponse, User, Organization, OrgMember, OrgMemberRole, Chat, ChatMember, ChatMemberRole, CreateChatRequest, Message, SendMessageRequest, PatchMessageRequest, PaginatedResponse, Approval, PresignResponse, PresignUploadRequest, CreateAgentRequest, CreateAgentResponse, AgentWithRuntime, ApiKey, WsTicketResponse, HostedStatus, WorkspaceFiles, Task, CreateTaskRequest, UpdateTaskRequest, TaskRelation, CreateTaskRelationRequest } from './types.js';
|
|
2
|
+
export interface PondClientOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
token?: string;
|
|
5
|
+
onTokenExpired?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class PondClient {
|
|
8
|
+
private baseUrl;
|
|
9
|
+
private token;
|
|
10
|
+
private onTokenExpired?;
|
|
11
|
+
constructor(options?: PondClientOptions);
|
|
12
|
+
setToken(token: string | null): void;
|
|
13
|
+
getToken(): string | null;
|
|
14
|
+
private request;
|
|
15
|
+
register(req: RegisterRequest): Promise<AuthTokens>;
|
|
16
|
+
login(req: LoginRequest): Promise<AuthTokens>;
|
|
17
|
+
refreshToken(refreshToken: string): Promise<AuthTokens>;
|
|
18
|
+
logout(): Promise<void>;
|
|
19
|
+
checkEmail(email: string): Promise<CheckEmailResponse>;
|
|
20
|
+
verifyEmail(email: string, code: string): Promise<void>;
|
|
21
|
+
resendCode(email: string): Promise<void>;
|
|
22
|
+
getWsTicket(): Promise<WsTicketResponse>;
|
|
23
|
+
getMe(): Promise<User>;
|
|
24
|
+
updateMe(data: Partial<Pick<User, 'display_name' | 'avatar_url'>>): Promise<User>;
|
|
25
|
+
getUser(id: string): Promise<User>;
|
|
26
|
+
searchUsers(q: string): Promise<User[]>;
|
|
27
|
+
createOrg(data: {
|
|
28
|
+
name: string;
|
|
29
|
+
avatar_url?: string;
|
|
30
|
+
}): Promise<Organization>;
|
|
31
|
+
getOrgs(): Promise<Organization[]>;
|
|
32
|
+
getOrg(orgId: string): Promise<Organization>;
|
|
33
|
+
updateOrg(orgId: string, data: Partial<Pick<Organization, 'name' | 'avatar_url'>>): Promise<Organization>;
|
|
34
|
+
deleteOrg(orgId: string): Promise<void>;
|
|
35
|
+
getOrgMembers(orgId: string): Promise<OrgMember[]>;
|
|
36
|
+
addOrgMember(orgId: string, userId: string, role?: OrgMemberRole): Promise<void>;
|
|
37
|
+
removeOrgMember(orgId: string, userId: string): Promise<void>;
|
|
38
|
+
updateOrgMember(orgId: string, userId: string, role: OrgMemberRole): Promise<void>;
|
|
39
|
+
createChat(orgId: string, req: Omit<CreateChatRequest, 'org_id'>): Promise<Chat>;
|
|
40
|
+
getChats(orgId: string, params?: {
|
|
41
|
+
limit?: number;
|
|
42
|
+
cursor?: string;
|
|
43
|
+
}): Promise<PaginatedResponse<Chat>>;
|
|
44
|
+
getChat(orgId: string, chatId: string): Promise<Chat>;
|
|
45
|
+
updateChat(orgId: string, chatId: string, data: Partial<Pick<Chat, 'name' | 'avatar_url' | 'description'>>): Promise<Chat>;
|
|
46
|
+
deleteChat(orgId: string, chatId: string): Promise<void>;
|
|
47
|
+
getChatMembers(orgId: string, chatId: string): Promise<ChatMember[]>;
|
|
48
|
+
addChatMember(orgId: string, chatId: string, userId: string, role?: string): Promise<void>;
|
|
49
|
+
removeChatMember(orgId: string, chatId: string, userId: string): Promise<void>;
|
|
50
|
+
updateChatMemberRole(orgId: string, chatId: string, userId: string, role: ChatMemberRole): Promise<void>;
|
|
51
|
+
sendMessage(orgId: string, chatId: string, req: SendMessageRequest): Promise<Message>;
|
|
52
|
+
getMessages(orgId: string, chatId: string, params?: {
|
|
53
|
+
before?: string;
|
|
54
|
+
after?: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
thread_root_id?: string;
|
|
57
|
+
top_level?: boolean;
|
|
58
|
+
}): Promise<PaginatedResponse<Message>>;
|
|
59
|
+
getMessage(id: string): Promise<Message>;
|
|
60
|
+
editMessage(id: string, content: Message['content']): Promise<Message>;
|
|
61
|
+
deleteMessage(id: string): Promise<void>;
|
|
62
|
+
patchMessage(id: string, req: PatchMessageRequest): Promise<void>;
|
|
63
|
+
getMessageReplies(id: string, params?: {
|
|
64
|
+
limit?: number;
|
|
65
|
+
before?: string;
|
|
66
|
+
after?: string;
|
|
67
|
+
}): Promise<PaginatedResponse<Message>>;
|
|
68
|
+
getUploadPresignUrl(req: PresignUploadRequest): Promise<PresignResponse>;
|
|
69
|
+
completeUpload(attachmentId: string): Promise<{
|
|
70
|
+
attachment_id: string;
|
|
71
|
+
}>;
|
|
72
|
+
decideApproval(id: string, decision: 'approve' | 'reject'): Promise<Approval>;
|
|
73
|
+
getPendingApprovals(): Promise<Approval[]>;
|
|
74
|
+
createAgent(orgId: string, req: CreateAgentRequest): Promise<CreateAgentResponse>;
|
|
75
|
+
getAgents(orgId: string): Promise<AgentWithRuntime[]>;
|
|
76
|
+
updateAgent(orgId: string, agentId: string, data: Partial<CreateAgentRequest>): Promise<User>;
|
|
77
|
+
deleteAgent(orgId: string, agentId: string): Promise<void>;
|
|
78
|
+
createAgentApiKey(orgId: string, agentId: string): Promise<ApiKey>;
|
|
79
|
+
revokeAgentApiKey(orgId: string, agentId: string, key: string): Promise<void>;
|
|
80
|
+
getAgentActivity(orgId: string, agentId: string, params?: {
|
|
81
|
+
limit?: number;
|
|
82
|
+
}): Promise<Message[]>;
|
|
83
|
+
getAgentMonitor(orgId: string, agentId: string): Promise<unknown>;
|
|
84
|
+
startAgent(orgId: string, agentId: string): Promise<void>;
|
|
85
|
+
stopAgent(orgId: string, agentId: string): Promise<void>;
|
|
86
|
+
getHostedStatus(orgId: string, agentId: string): Promise<HostedStatus>;
|
|
87
|
+
updateWorkspace(orgId: string, agentId: string, files: WorkspaceFiles): Promise<void>;
|
|
88
|
+
getAgentLogs(orgId: string, agentId: string, lines?: number): Promise<{
|
|
89
|
+
data: string[];
|
|
90
|
+
}>;
|
|
91
|
+
getUnreadCounts(): Promise<Record<string, number>>;
|
|
92
|
+
markRead(orgId: string, chatId: string, messageId: string): Promise<void>;
|
|
93
|
+
createTask(orgId: string, data: CreateTaskRequest): Promise<Task>;
|
|
94
|
+
getTasks(orgId: string, params?: {
|
|
95
|
+
status?: string;
|
|
96
|
+
priority?: string;
|
|
97
|
+
assignee_id?: string;
|
|
98
|
+
parent_id?: string;
|
|
99
|
+
limit?: number;
|
|
100
|
+
cursor?: string;
|
|
101
|
+
sort?: string;
|
|
102
|
+
order?: string;
|
|
103
|
+
}): Promise<PaginatedResponse<Task>>;
|
|
104
|
+
getTask(orgId: string, taskId: string): Promise<Task>;
|
|
105
|
+
updateTask(orgId: string, taskId: string, data: UpdateTaskRequest): Promise<Task>;
|
|
106
|
+
deleteTask(orgId: string, taskId: string): Promise<void>;
|
|
107
|
+
getSubtasks(orgId: string, taskId: string): Promise<Task[]>;
|
|
108
|
+
createTaskRelation(orgId: string, taskId: string, data: CreateTaskRelationRequest): Promise<TaskRelation>;
|
|
109
|
+
getTaskRelations(orgId: string, taskId: string): Promise<TaskRelation[]>;
|
|
110
|
+
deleteTaskRelation(orgId: string, taskId: string, relationId: string): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
export declare class ApiError extends Error {
|
|
113
|
+
status: number;
|
|
114
|
+
code?: string | undefined;
|
|
115
|
+
constructor(status: number, message: string, code?: string | undefined);
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,aAAa,EACb,IAAI,EACJ,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,cAAc,CAAC,CAAa;gBAExB,OAAO,GAAE,iBAAsB;IAM3C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,QAAQ,IAAI,MAAM,GAAG,IAAI;YAIX,OAAO;IAkDf,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAInD,KAAK,CAAC,GAAG,EAAE,YAAY,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G,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAI9B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAK3D,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIzG,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAKxE,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3F;AAED,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;IAEd,IAAI,CAAC,EAAE,MAAM;gBAFb,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { ENDPOINTS } from './constants.js';
|
|
2
|
+
export class PondClient {
|
|
3
|
+
baseUrl;
|
|
4
|
+
token;
|
|
5
|
+
onTokenExpired;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.baseUrl = options.baseUrl ?? '';
|
|
8
|
+
this.token = options.token ?? null;
|
|
9
|
+
this.onTokenExpired = options.onTokenExpired;
|
|
10
|
+
}
|
|
11
|
+
setToken(token) {
|
|
12
|
+
this.token = token;
|
|
13
|
+
}
|
|
14
|
+
getToken() {
|
|
15
|
+
return this.token;
|
|
16
|
+
}
|
|
17
|
+
async request(method, path, body, query) {
|
|
18
|
+
let url = `${this.baseUrl}${path}`;
|
|
19
|
+
if (query) {
|
|
20
|
+
const params = new URLSearchParams();
|
|
21
|
+
for (const [key, value] of Object.entries(query)) {
|
|
22
|
+
if (value !== undefined) {
|
|
23
|
+
params.set(key, String(value));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const qs = params.toString();
|
|
27
|
+
if (qs)
|
|
28
|
+
url += `?${qs}`;
|
|
29
|
+
}
|
|
30
|
+
const headers = {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
};
|
|
33
|
+
if (this.token) {
|
|
34
|
+
headers['Authorization'] = `Bearer ${this.token}`;
|
|
35
|
+
}
|
|
36
|
+
const res = await fetch(url, {
|
|
37
|
+
method,
|
|
38
|
+
headers,
|
|
39
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
40
|
+
});
|
|
41
|
+
if (res.status === 401 && this.onTokenExpired) {
|
|
42
|
+
this.onTokenExpired();
|
|
43
|
+
}
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
const errorBody = await res.json().catch(() => ({}));
|
|
46
|
+
const errorObj = errorBody?.error && typeof errorBody.error === 'object' ? errorBody.error : undefined;
|
|
47
|
+
const errMsg = errorObj?.message ?? (typeof errorBody?.error === 'string' ? errorBody.error : undefined);
|
|
48
|
+
const errCode = errorObj?.code ?? (typeof errorBody?.code === 'string' ? errorBody.code : undefined);
|
|
49
|
+
throw new ApiError(res.status, errMsg ?? res.statusText, errCode);
|
|
50
|
+
}
|
|
51
|
+
if (res.status === 204)
|
|
52
|
+
return undefined;
|
|
53
|
+
return res.json();
|
|
54
|
+
}
|
|
55
|
+
// ---- Auth ----
|
|
56
|
+
async register(req) {
|
|
57
|
+
return this.request('POST', ENDPOINTS.AUTH_REGISTER, req);
|
|
58
|
+
}
|
|
59
|
+
async login(req) {
|
|
60
|
+
return this.request('POST', ENDPOINTS.AUTH_LOGIN, req);
|
|
61
|
+
}
|
|
62
|
+
async refreshToken(refreshToken) {
|
|
63
|
+
return this.request('POST', ENDPOINTS.AUTH_REFRESH, { refresh_token: refreshToken });
|
|
64
|
+
}
|
|
65
|
+
async logout() {
|
|
66
|
+
return this.request('POST', ENDPOINTS.AUTH_LOGOUT);
|
|
67
|
+
}
|
|
68
|
+
async checkEmail(email) {
|
|
69
|
+
return this.request('POST', ENDPOINTS.AUTH_CHECK_EMAIL, { email });
|
|
70
|
+
}
|
|
71
|
+
async verifyEmail(email, code) {
|
|
72
|
+
return this.request('POST', ENDPOINTS.AUTH_VERIFY_EMAIL, { email, code });
|
|
73
|
+
}
|
|
74
|
+
async resendCode(email) {
|
|
75
|
+
return this.request('POST', ENDPOINTS.AUTH_RESEND_CODE, { email });
|
|
76
|
+
}
|
|
77
|
+
// ---- WebSocket ----
|
|
78
|
+
async getWsTicket() {
|
|
79
|
+
return this.request('POST', ENDPOINTS.WS_TICKET);
|
|
80
|
+
}
|
|
81
|
+
// ---- Users ----
|
|
82
|
+
async getMe() {
|
|
83
|
+
return this.request('GET', ENDPOINTS.USERS_ME);
|
|
84
|
+
}
|
|
85
|
+
async updateMe(data) {
|
|
86
|
+
return this.request('PATCH', ENDPOINTS.USERS_ME, data);
|
|
87
|
+
}
|
|
88
|
+
async getUser(id) {
|
|
89
|
+
return this.request('GET', ENDPOINTS.USER(id));
|
|
90
|
+
}
|
|
91
|
+
async searchUsers(q) {
|
|
92
|
+
const res = await this.request('GET', ENDPOINTS.USERS_SEARCH, undefined, { q });
|
|
93
|
+
return res.data;
|
|
94
|
+
}
|
|
95
|
+
// ---- Organizations ----
|
|
96
|
+
async createOrg(data) {
|
|
97
|
+
return this.request('POST', ENDPOINTS.ORGS, data);
|
|
98
|
+
}
|
|
99
|
+
async getOrgs() {
|
|
100
|
+
const res = await this.request('GET', ENDPOINTS.ORGS);
|
|
101
|
+
return res.data;
|
|
102
|
+
}
|
|
103
|
+
async getOrg(orgId) {
|
|
104
|
+
return this.request('GET', ENDPOINTS.ORG(orgId));
|
|
105
|
+
}
|
|
106
|
+
async updateOrg(orgId, data) {
|
|
107
|
+
return this.request('PATCH', ENDPOINTS.ORG(orgId), data);
|
|
108
|
+
}
|
|
109
|
+
async deleteOrg(orgId) {
|
|
110
|
+
return this.request('DELETE', ENDPOINTS.ORG(orgId));
|
|
111
|
+
}
|
|
112
|
+
async getOrgMembers(orgId) {
|
|
113
|
+
const res = await this.request('GET', ENDPOINTS.ORG_MEMBERS(orgId));
|
|
114
|
+
return res.data;
|
|
115
|
+
}
|
|
116
|
+
async addOrgMember(orgId, userId, role) {
|
|
117
|
+
return this.request('POST', ENDPOINTS.ORG_MEMBERS(orgId), { user_id: userId, role: role ?? 'member' });
|
|
118
|
+
}
|
|
119
|
+
async removeOrgMember(orgId, userId) {
|
|
120
|
+
return this.request('DELETE', ENDPOINTS.ORG_MEMBER(orgId, userId));
|
|
121
|
+
}
|
|
122
|
+
async updateOrgMember(orgId, userId, role) {
|
|
123
|
+
return this.request('PATCH', ENDPOINTS.ORG_MEMBER(orgId, userId), { role });
|
|
124
|
+
}
|
|
125
|
+
// ---- Chats (org-scoped) ----
|
|
126
|
+
async createChat(orgId, req) {
|
|
127
|
+
return this.request('POST', ENDPOINTS.CHATS(orgId), req);
|
|
128
|
+
}
|
|
129
|
+
async getChats(orgId, params) {
|
|
130
|
+
return this.request('GET', ENDPOINTS.CHATS(orgId), undefined, params);
|
|
131
|
+
}
|
|
132
|
+
async getChat(orgId, chatId) {
|
|
133
|
+
return this.request('GET', ENDPOINTS.CHAT(orgId, chatId));
|
|
134
|
+
}
|
|
135
|
+
async updateChat(orgId, chatId, data) {
|
|
136
|
+
return this.request('PATCH', ENDPOINTS.CHAT(orgId, chatId), data);
|
|
137
|
+
}
|
|
138
|
+
async deleteChat(orgId, chatId) {
|
|
139
|
+
return this.request('DELETE', ENDPOINTS.CHAT(orgId, chatId));
|
|
140
|
+
}
|
|
141
|
+
// ---- Chat Members ----
|
|
142
|
+
async getChatMembers(orgId, chatId) {
|
|
143
|
+
const res = await this.request('GET', ENDPOINTS.CHAT_MEMBERS(orgId, chatId));
|
|
144
|
+
return res.data;
|
|
145
|
+
}
|
|
146
|
+
async addChatMember(orgId, chatId, userId, role) {
|
|
147
|
+
return this.request('POST', ENDPOINTS.CHAT_MEMBERS(orgId, chatId), { user_id: userId, role });
|
|
148
|
+
}
|
|
149
|
+
async removeChatMember(orgId, chatId, userId) {
|
|
150
|
+
return this.request('DELETE', ENDPOINTS.CHAT_MEMBER(orgId, chatId, userId));
|
|
151
|
+
}
|
|
152
|
+
async updateChatMemberRole(orgId, chatId, userId, role) {
|
|
153
|
+
return this.request('PATCH', ENDPOINTS.CHAT_MEMBER(orgId, chatId, userId), { role });
|
|
154
|
+
}
|
|
155
|
+
// ---- Messages ----
|
|
156
|
+
async sendMessage(orgId, chatId, req) {
|
|
157
|
+
return this.request('POST', ENDPOINTS.CHAT_MESSAGES(orgId, chatId), req);
|
|
158
|
+
}
|
|
159
|
+
async getMessages(orgId, chatId, params) {
|
|
160
|
+
return this.request('GET', ENDPOINTS.CHAT_MESSAGES(orgId, chatId), undefined, params);
|
|
161
|
+
}
|
|
162
|
+
async getMessage(id) {
|
|
163
|
+
return this.request('GET', ENDPOINTS.MESSAGE(id));
|
|
164
|
+
}
|
|
165
|
+
async editMessage(id, content) {
|
|
166
|
+
return this.request('PATCH', ENDPOINTS.MESSAGE(id), { content });
|
|
167
|
+
}
|
|
168
|
+
async deleteMessage(id) {
|
|
169
|
+
return this.request('DELETE', ENDPOINTS.MESSAGE(id));
|
|
170
|
+
}
|
|
171
|
+
async patchMessage(id, req) {
|
|
172
|
+
return this.request('POST', ENDPOINTS.MESSAGE_PATCHES(id), req);
|
|
173
|
+
}
|
|
174
|
+
async getMessageReplies(id, params) {
|
|
175
|
+
return this.request('GET', ENDPOINTS.MESSAGE_REPLIES(id), undefined, params);
|
|
176
|
+
}
|
|
177
|
+
// ---- File Upload ----
|
|
178
|
+
async getUploadPresignUrl(req) {
|
|
179
|
+
return this.request('POST', ENDPOINTS.UPLOAD_PRESIGN, req);
|
|
180
|
+
}
|
|
181
|
+
async completeUpload(attachmentId) {
|
|
182
|
+
return this.request('POST', ENDPOINTS.UPLOAD_COMPLETE, { attachment_id: attachmentId });
|
|
183
|
+
}
|
|
184
|
+
// ---- Approvals ----
|
|
185
|
+
async decideApproval(id, decision) {
|
|
186
|
+
return this.request('POST', ENDPOINTS.APPROVAL_DECIDE(id), { decision });
|
|
187
|
+
}
|
|
188
|
+
async getPendingApprovals() {
|
|
189
|
+
return this.request('GET', ENDPOINTS.APPROVALS_PENDING);
|
|
190
|
+
}
|
|
191
|
+
// ---- Agents (org-scoped) ----
|
|
192
|
+
async createAgent(orgId, req) {
|
|
193
|
+
return this.request('POST', ENDPOINTS.AGENTS(orgId), req);
|
|
194
|
+
}
|
|
195
|
+
async getAgents(orgId) {
|
|
196
|
+
const res = await this.request('GET', ENDPOINTS.AGENTS(orgId));
|
|
197
|
+
return res.data;
|
|
198
|
+
}
|
|
199
|
+
async updateAgent(orgId, agentId, data) {
|
|
200
|
+
return this.request('PATCH', ENDPOINTS.AGENT(orgId, agentId), data);
|
|
201
|
+
}
|
|
202
|
+
async deleteAgent(orgId, agentId) {
|
|
203
|
+
return this.request('DELETE', ENDPOINTS.AGENT(orgId, agentId));
|
|
204
|
+
}
|
|
205
|
+
async createAgentApiKey(orgId, agentId) {
|
|
206
|
+
return this.request('POST', ENDPOINTS.AGENT_API_KEYS(orgId, agentId));
|
|
207
|
+
}
|
|
208
|
+
async revokeAgentApiKey(orgId, agentId, key) {
|
|
209
|
+
return this.request('DELETE', ENDPOINTS.AGENT_API_KEY(orgId, agentId, key));
|
|
210
|
+
}
|
|
211
|
+
async getAgentActivity(orgId, agentId, params) {
|
|
212
|
+
const res = await this.request('GET', ENDPOINTS.AGENT_ACTIVITY(orgId, agentId), undefined, params);
|
|
213
|
+
return res.data;
|
|
214
|
+
}
|
|
215
|
+
async getAgentMonitor(orgId, agentId) {
|
|
216
|
+
const res = await this.request('GET', ENDPOINTS.AGENT_MONITOR(orgId, agentId));
|
|
217
|
+
return res.data;
|
|
218
|
+
}
|
|
219
|
+
async startAgent(orgId, agentId) {
|
|
220
|
+
return this.request('POST', ENDPOINTS.AGENT_START(orgId, agentId));
|
|
221
|
+
}
|
|
222
|
+
async stopAgent(orgId, agentId) {
|
|
223
|
+
return this.request('POST', ENDPOINTS.AGENT_STOP(orgId, agentId));
|
|
224
|
+
}
|
|
225
|
+
async getHostedStatus(orgId, agentId) {
|
|
226
|
+
return this.request('GET', ENDPOINTS.AGENT_HOSTED_STATUS(orgId, agentId));
|
|
227
|
+
}
|
|
228
|
+
async updateWorkspace(orgId, agentId, files) {
|
|
229
|
+
return this.request('PUT', ENDPOINTS.AGENT_WORKSPACE(orgId, agentId), files);
|
|
230
|
+
}
|
|
231
|
+
async getAgentLogs(orgId, agentId, lines = 100) {
|
|
232
|
+
return this.request('GET', ENDPOINTS.AGENT_LOGS(orgId, agentId), undefined, { lines });
|
|
233
|
+
}
|
|
234
|
+
// ---- Unread ----
|
|
235
|
+
async getUnreadCounts() {
|
|
236
|
+
const res = await this.request('GET', ENDPOINTS.UNREAD);
|
|
237
|
+
return res.data;
|
|
238
|
+
}
|
|
239
|
+
async markRead(orgId, chatId, messageId) {
|
|
240
|
+
return this.request('POST', ENDPOINTS.CHAT_READ(orgId, chatId), { message_id: messageId });
|
|
241
|
+
}
|
|
242
|
+
// ---- Tasks (org-scoped) ----
|
|
243
|
+
async createTask(orgId, data) {
|
|
244
|
+
return this.request('POST', ENDPOINTS.TASKS(orgId), data);
|
|
245
|
+
}
|
|
246
|
+
async getTasks(orgId, params) {
|
|
247
|
+
return this.request('GET', ENDPOINTS.TASKS(orgId), undefined, params);
|
|
248
|
+
}
|
|
249
|
+
async getTask(orgId, taskId) {
|
|
250
|
+
return this.request('GET', ENDPOINTS.TASK(orgId, taskId));
|
|
251
|
+
}
|
|
252
|
+
async updateTask(orgId, taskId, data) {
|
|
253
|
+
return this.request('PATCH', ENDPOINTS.TASK(orgId, taskId), data);
|
|
254
|
+
}
|
|
255
|
+
async deleteTask(orgId, taskId) {
|
|
256
|
+
return this.request('DELETE', ENDPOINTS.TASK(orgId, taskId));
|
|
257
|
+
}
|
|
258
|
+
async getSubtasks(orgId, taskId) {
|
|
259
|
+
const res = await this.request('GET', ENDPOINTS.TASK_SUBTASKS(orgId, taskId));
|
|
260
|
+
return res.data;
|
|
261
|
+
}
|
|
262
|
+
async createTaskRelation(orgId, taskId, data) {
|
|
263
|
+
return this.request('POST', ENDPOINTS.TASK_RELATIONS(orgId, taskId), data);
|
|
264
|
+
}
|
|
265
|
+
async getTaskRelations(orgId, taskId) {
|
|
266
|
+
const res = await this.request('GET', ENDPOINTS.TASK_RELATIONS(orgId, taskId));
|
|
267
|
+
return res.data;
|
|
268
|
+
}
|
|
269
|
+
async deleteTaskRelation(orgId, taskId, relationId) {
|
|
270
|
+
return this.request('DELETE', ENDPOINTS.TASK_RELATION(orgId, taskId, relationId));
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export class ApiError extends Error {
|
|
274
|
+
status;
|
|
275
|
+
code;
|
|
276
|
+
constructor(status, message, code) {
|
|
277
|
+
super(message);
|
|
278
|
+
this.status = status;
|
|
279
|
+
this.code = code;
|
|
280
|
+
this.name = 'ApiError';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const API_BASE = "/api/v1";
|
|
2
|
+
export declare const ENDPOINTS: {
|
|
3
|
+
readonly AUTH_REGISTER: "/api/v1/auth/register";
|
|
4
|
+
readonly AUTH_LOGIN: "/api/v1/auth/login";
|
|
5
|
+
readonly AUTH_REFRESH: "/api/v1/auth/refresh";
|
|
6
|
+
readonly AUTH_LOGOUT: "/api/v1/auth/logout";
|
|
7
|
+
readonly AUTH_CHECK_EMAIL: "/api/v1/auth/check-email";
|
|
8
|
+
readonly AUTH_VERIFY_EMAIL: "/api/v1/auth/verify-email";
|
|
9
|
+
readonly AUTH_RESEND_CODE: "/api/v1/auth/resend-code";
|
|
10
|
+
readonly USERS_ME: "/api/v1/users/me";
|
|
11
|
+
readonly USER: (id: string) => string;
|
|
12
|
+
readonly USERS_SEARCH: "/api/v1/users/search";
|
|
13
|
+
readonly WS_TICKET: "/api/v1/ws/ticket";
|
|
14
|
+
readonly ORGS: "/api/v1/orgs";
|
|
15
|
+
readonly ORG: (orgId: string) => string;
|
|
16
|
+
readonly ORG_MEMBERS: (orgId: string) => string;
|
|
17
|
+
readonly ORG_MEMBER: (orgId: string, userId: string) => string;
|
|
18
|
+
readonly CHATS: (orgId: string) => string;
|
|
19
|
+
readonly CHAT: (orgId: string, chatId: string) => string;
|
|
20
|
+
readonly CHAT_MEMBERS: (orgId: string, chatId: string) => string;
|
|
21
|
+
readonly CHAT_MEMBER: (orgId: string, chatId: string, userId: string) => string;
|
|
22
|
+
readonly CHAT_MESSAGES: (orgId: string, chatId: string) => string;
|
|
23
|
+
readonly MESSAGE: (id: string) => string;
|
|
24
|
+
readonly MESSAGE_PATCHES: (id: string) => string;
|
|
25
|
+
readonly MESSAGE_REPLIES: (id: string) => string;
|
|
26
|
+
readonly UPLOAD_PRESIGN: "/api/v1/upload/presign";
|
|
27
|
+
readonly UPLOAD_COMPLETE: "/api/v1/upload/complete";
|
|
28
|
+
readonly APPROVAL_DECIDE: (id: string) => string;
|
|
29
|
+
readonly APPROVALS_PENDING: "/api/v1/approvals/pending";
|
|
30
|
+
readonly AGENTS: (orgId: string) => string;
|
|
31
|
+
readonly AGENT: (orgId: string, agentId: string) => string;
|
|
32
|
+
readonly AGENT_API_KEYS: (orgId: string, agentId: string) => string;
|
|
33
|
+
readonly AGENT_API_KEY: (orgId: string, agentId: string, key: string) => string;
|
|
34
|
+
readonly AGENT_ACTIVITY: (orgId: string, agentId: string) => string;
|
|
35
|
+
readonly AGENT_MONITOR: (orgId: string, agentId: string) => string;
|
|
36
|
+
readonly AGENT_START: (orgId: string, agentId: string) => string;
|
|
37
|
+
readonly AGENT_STOP: (orgId: string, agentId: string) => string;
|
|
38
|
+
readonly AGENT_HOSTED_STATUS: (orgId: string, agentId: string) => string;
|
|
39
|
+
readonly AGENT_WORKSPACE: (orgId: string, agentId: string) => string;
|
|
40
|
+
readonly AGENT_LOGS: (orgId: string, agentId: string) => string;
|
|
41
|
+
readonly TASKS: (orgId: string) => string;
|
|
42
|
+
readonly TASK: (orgId: string, taskId: string) => string;
|
|
43
|
+
readonly TASK_SUBTASKS: (orgId: string, taskId: string) => string;
|
|
44
|
+
readonly TASK_RELATIONS: (orgId: string, taskId: string) => string;
|
|
45
|
+
readonly TASK_RELATION: (orgId: string, taskId: string, relId: string) => string;
|
|
46
|
+
readonly UNREAD: "/api/v1/me/unread";
|
|
47
|
+
readonly CHAT_READ: (orgId: string, chatId: string) => string;
|
|
48
|
+
};
|
|
49
|
+
export declare const WS_EVENTS: {
|
|
50
|
+
readonly PING: "ping";
|
|
51
|
+
readonly TYPING: "typing";
|
|
52
|
+
readonly ACK: "ack";
|
|
53
|
+
readonly READ: "read";
|
|
54
|
+
readonly WATCH: "watch";
|
|
55
|
+
readonly AGENT_HEARTBEAT: "agent.heartbeat";
|
|
56
|
+
readonly HELLO: "hello";
|
|
57
|
+
readonly PONG: "pong";
|
|
58
|
+
readonly WATCHING: "watching";
|
|
59
|
+
readonly MESSAGE_NEW: "message.new";
|
|
60
|
+
readonly MESSAGE_PATCH: "message.patch";
|
|
61
|
+
readonly MESSAGE_EDIT: "message.edit";
|
|
62
|
+
readonly MESSAGE_DELETE: "message.delete";
|
|
63
|
+
readonly TYPING_UPDATE: "typing.update";
|
|
64
|
+
readonly CHAT_UPDATE: "chat.update";
|
|
65
|
+
readonly APPROVAL_UPDATE: "approval.update";
|
|
66
|
+
readonly RECOVERY_OVERFLOW: "recovery.overflow";
|
|
67
|
+
readonly MEMBERSHIP_CHANGED: "membership.changed";
|
|
68
|
+
readonly TASK_CREATED: "task.created";
|
|
69
|
+
readonly TASK_UPDATED: "task.updated";
|
|
70
|
+
readonly TASK_DELETED: "task.deleted";
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,YAAY,CAAC;AAGlC,eAAO,MAAM,SAAS;;;;;;;;;wBAYT,MAAM;;;;0BASJ,MAAM;kCACE,MAAM;iCACP,MAAM,UAAU,MAAM;4BAI3B,MAAM;2BACP,MAAM,UAAU,MAAM;mCACd,MAAM,UAAU,MAAM;kCAEvB,MAAM,UAAU,MAAM,UAAU,MAAM;oCAEpC,MAAM,UAAU,MAAM;2BAI/B,MAAM;mCACE,MAAM;mCACN,MAAM;;;mCAON,MAAM;;6BAIZ,MAAM;4BACP,MAAM,WAAW,MAAM;qCACd,MAAM,WAAW,MAAM;oCAExB,MAAM,WAAW,MAAM,OAAO,MAAM;qCAEnC,MAAM,WAAW,MAAM;oCAExB,MAAM,WAAW,MAAM;kCAEzB,MAAM,WAAW,MAAM;iCAExB,MAAM,WAAW,MAAM;0CAEd,MAAM,WAAW,MAAM;sCAE3B,MAAM,WAAW,MAAM;iCAE5B,MAAM,WAAW,MAAM;4BAI5B,MAAM;2BACP,MAAM,UAAU,MAAM;oCACb,MAAM,UAAU,MAAM;qCAErB,MAAM,UAAU,MAAM;oCAEvB,MAAM,UAAU,MAAM,SAAS,MAAM;;gCAKzC,MAAM,UAAU,MAAM;CAGjC,CAAC;AAGX,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;CAyBZ,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// API base path
|
|
2
|
+
export const API_BASE = '/api/v1';
|
|
3
|
+
// REST endpoints
|
|
4
|
+
export const ENDPOINTS = {
|
|
5
|
+
// Auth
|
|
6
|
+
AUTH_REGISTER: `${API_BASE}/auth/register`,
|
|
7
|
+
AUTH_LOGIN: `${API_BASE}/auth/login`,
|
|
8
|
+
AUTH_REFRESH: `${API_BASE}/auth/refresh`,
|
|
9
|
+
AUTH_LOGOUT: `${API_BASE}/auth/logout`,
|
|
10
|
+
AUTH_CHECK_EMAIL: `${API_BASE}/auth/check-email`,
|
|
11
|
+
AUTH_VERIFY_EMAIL: `${API_BASE}/auth/verify-email`,
|
|
12
|
+
AUTH_RESEND_CODE: `${API_BASE}/auth/resend-code`,
|
|
13
|
+
// Users
|
|
14
|
+
USERS_ME: `${API_BASE}/users/me`,
|
|
15
|
+
USER: (id) => `${API_BASE}/users/${id}`,
|
|
16
|
+
USERS_SEARCH: `${API_BASE}/users/search`,
|
|
17
|
+
// WebSocket ticket
|
|
18
|
+
WS_TICKET: `${API_BASE}/ws/ticket`,
|
|
19
|
+
// Organizations (global)
|
|
20
|
+
ORGS: `${API_BASE}/orgs`,
|
|
21
|
+
// Org-scoped
|
|
22
|
+
ORG: (orgId) => `${API_BASE}/orgs/${orgId}`,
|
|
23
|
+
ORG_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/members`,
|
|
24
|
+
ORG_MEMBER: (orgId, userId) => `${API_BASE}/orgs/${orgId}/members/${userId}`,
|
|
25
|
+
// Chats (org-scoped)
|
|
26
|
+
CHATS: (orgId) => `${API_BASE}/orgs/${orgId}/chats`,
|
|
27
|
+
CHAT: (orgId, chatId) => `${API_BASE}/orgs/${orgId}/chats/${chatId}`,
|
|
28
|
+
CHAT_MEMBERS: (orgId, chatId) => `${API_BASE}/orgs/${orgId}/chats/${chatId}/members`,
|
|
29
|
+
CHAT_MEMBER: (orgId, chatId, userId) => `${API_BASE}/orgs/${orgId}/chats/${chatId}/members/${userId}`,
|
|
30
|
+
CHAT_MESSAGES: (orgId, chatId) => `${API_BASE}/orgs/${orgId}/chats/${chatId}/messages`,
|
|
31
|
+
// Messages (global, by message ID)
|
|
32
|
+
MESSAGE: (id) => `${API_BASE}/messages/${id}`,
|
|
33
|
+
MESSAGE_PATCHES: (id) => `${API_BASE}/messages/${id}/patches`,
|
|
34
|
+
MESSAGE_REPLIES: (id) => `${API_BASE}/messages/${id}/replies`,
|
|
35
|
+
// Upload (global)
|
|
36
|
+
UPLOAD_PRESIGN: `${API_BASE}/upload/presign`,
|
|
37
|
+
UPLOAD_COMPLETE: `${API_BASE}/upload/complete`,
|
|
38
|
+
// Approvals (global)
|
|
39
|
+
APPROVAL_DECIDE: (id) => `${API_BASE}/approvals/${id}/decide`,
|
|
40
|
+
APPROVALS_PENDING: `${API_BASE}/approvals/pending`,
|
|
41
|
+
// Agents (org-scoped)
|
|
42
|
+
AGENTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents`,
|
|
43
|
+
AGENT: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}`,
|
|
44
|
+
AGENT_API_KEYS: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/api-keys`,
|
|
45
|
+
AGENT_API_KEY: (orgId, agentId, key) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/api-keys/${key}`,
|
|
46
|
+
AGENT_ACTIVITY: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/activity`,
|
|
47
|
+
AGENT_MONITOR: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/monitor`,
|
|
48
|
+
AGENT_START: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/start`,
|
|
49
|
+
AGENT_STOP: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/stop`,
|
|
50
|
+
AGENT_HOSTED_STATUS: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/hosted-status`,
|
|
51
|
+
AGENT_WORKSPACE: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/workspace`,
|
|
52
|
+
AGENT_LOGS: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/agents/${agentId}/logs`,
|
|
53
|
+
// Tasks (org-scoped)
|
|
54
|
+
TASKS: (orgId) => `${API_BASE}/orgs/${orgId}/tasks`,
|
|
55
|
+
TASK: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}`,
|
|
56
|
+
TASK_SUBTASKS: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/subtasks`,
|
|
57
|
+
TASK_RELATIONS: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/relations`,
|
|
58
|
+
TASK_RELATION: (orgId, taskId, relId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/relations/${relId}`,
|
|
59
|
+
// Unread
|
|
60
|
+
UNREAD: `${API_BASE}/me/unread`,
|
|
61
|
+
CHAT_READ: (orgId, chatId) => `${API_BASE}/orgs/${orgId}/chats/${chatId}/read`,
|
|
62
|
+
};
|
|
63
|
+
// WebSocket event types
|
|
64
|
+
export const WS_EVENTS = {
|
|
65
|
+
// Client -> Server
|
|
66
|
+
PING: 'ping',
|
|
67
|
+
TYPING: 'typing',
|
|
68
|
+
ACK: 'ack',
|
|
69
|
+
READ: 'read',
|
|
70
|
+
WATCH: 'watch',
|
|
71
|
+
AGENT_HEARTBEAT: 'agent.heartbeat',
|
|
72
|
+
// Server -> Client
|
|
73
|
+
HELLO: 'hello',
|
|
74
|
+
PONG: 'pong',
|
|
75
|
+
WATCHING: 'watching',
|
|
76
|
+
MESSAGE_NEW: 'message.new',
|
|
77
|
+
MESSAGE_PATCH: 'message.patch',
|
|
78
|
+
MESSAGE_EDIT: 'message.edit',
|
|
79
|
+
MESSAGE_DELETE: 'message.delete',
|
|
80
|
+
TYPING_UPDATE: 'typing.update',
|
|
81
|
+
CHAT_UPDATE: 'chat.update',
|
|
82
|
+
APPROVAL_UPDATE: 'approval.update',
|
|
83
|
+
RECOVERY_OVERFLOW: 'recovery.overflow',
|
|
84
|
+
MEMBERSHIP_CHANGED: 'membership.changed',
|
|
85
|
+
TASK_CREATED: 'task.created',
|
|
86
|
+
TASK_UPDATED: 'task.updated',
|
|
87
|
+
TASK_DELETED: 'task.deleted',
|
|
88
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './constants.js';
|
|
3
|
+
export { PondClient, ApiError } from './client.js';
|
|
4
|
+
export type { PondClientOptions } from './client.js';
|
|
5
|
+
export { PondWs } from './ws.js';
|
|
6
|
+
export type { PondWsOptions, WsConnectionState, WsEventType, WsEventHandler } from './ws.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED