@pnds/sdk 1.0.1 → 1.2.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 +48 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +102 -5
- package/dist/constants.d.ts +16 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +19 -1
- package/dist/types.d.ts +93 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/ws.d.ts +19 -0
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +133 -1
- package/package.json +1 -1
- package/src/client.ts +130 -6
- package/src/constants.ts +24 -1
- package/src/types.ts +118 -22
- package/src/ws.ts +131 -1
package/src/client.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type {
|
|
|
15
15
|
CreateChatRequest,
|
|
16
16
|
Message,
|
|
17
17
|
SendMessageRequest,
|
|
18
|
+
SendDirectMessageRequest,
|
|
19
|
+
DirectMessageResponse,
|
|
18
20
|
PatchMessageRequest,
|
|
19
21
|
PaginatedResponse,
|
|
20
22
|
Approval,
|
|
@@ -53,6 +55,7 @@ import type {
|
|
|
53
55
|
WikiChangeset,
|
|
54
56
|
WikiTreeResponse,
|
|
55
57
|
WikiBlob,
|
|
58
|
+
WikiNodeSectionArtifact,
|
|
56
59
|
WikiDiff,
|
|
57
60
|
CreateWikiRequest,
|
|
58
61
|
CreateWikiMountRequest,
|
|
@@ -62,6 +65,8 @@ import type {
|
|
|
62
65
|
RefreshWikiRepoTokenRequest,
|
|
63
66
|
WikiMountManifestV2,
|
|
64
67
|
WikiRepoToken,
|
|
68
|
+
InboxItem,
|
|
69
|
+
InboxUnreadCountResponse,
|
|
65
70
|
} from './types.js';
|
|
66
71
|
|
|
67
72
|
export interface PondClientOptions {
|
|
@@ -82,10 +87,13 @@ export class PondClient {
|
|
|
82
87
|
|
|
83
88
|
/** Auth endpoints excluded from automatic 401 refresh to prevent recursion. */
|
|
84
89
|
private static readonly AUTH_PATHS = new Set([
|
|
85
|
-
'/auth/login', '/auth/register', '/auth/refresh',
|
|
90
|
+
'/auth/login', '/auth/register', '/auth/refresh', '/auth/logout',
|
|
86
91
|
'/auth/verify-email', '/auth/resend-code', '/auth/check-email',
|
|
87
92
|
]);
|
|
88
93
|
|
|
94
|
+
/** Proactive refresh when token expires within this window (seconds). */
|
|
95
|
+
private static readonly REFRESH_THRESHOLD_S = 5 * 60;
|
|
96
|
+
|
|
89
97
|
constructor(options: PondClientOptions = {}) {
|
|
90
98
|
this.baseUrl = options.baseUrl ?? '';
|
|
91
99
|
this.token = options.token ?? null;
|
|
@@ -102,6 +110,38 @@ export class PondClient {
|
|
|
102
110
|
return this.token;
|
|
103
111
|
}
|
|
104
112
|
|
|
113
|
+
/** Decode the `exp` claim from a JWT without verifying the signature. */
|
|
114
|
+
private static decodeJwtExp(token: string): number | null {
|
|
115
|
+
try {
|
|
116
|
+
const parts = token.split('.');
|
|
117
|
+
if (parts.length !== 3) return null;
|
|
118
|
+
// base64url → standard base64
|
|
119
|
+
const b64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');
|
|
120
|
+
const padded = b64.padEnd(b64.length + ((4 - (b64.length % 4)) % 4), '=');
|
|
121
|
+
const payload = JSON.parse(atob(padded));
|
|
122
|
+
return typeof payload.exp === 'number' ? payload.exp : null;
|
|
123
|
+
} catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Proactive refresh: if the current access token expires within
|
|
130
|
+
* REFRESH_THRESHOLD_S, refresh it **before** sending the request.
|
|
131
|
+
* No-op when the token is still fresh, missing, or un-parseable.
|
|
132
|
+
*/
|
|
133
|
+
private async ensureFreshToken(path: string): Promise<void> {
|
|
134
|
+
if (!this.token || !this.getRefreshToken) return;
|
|
135
|
+
const pathSuffix = path.replace(/^\/api\/v1/, '');
|
|
136
|
+
if (PondClient.AUTH_PATHS.has(pathSuffix)) return;
|
|
137
|
+
|
|
138
|
+
const exp = PondClient.decodeJwtExp(this.token);
|
|
139
|
+
if (exp === null) return;
|
|
140
|
+
if (exp - Date.now() / 1000 > PondClient.REFRESH_THRESHOLD_S) return;
|
|
141
|
+
|
|
142
|
+
await this.tryRefresh();
|
|
143
|
+
}
|
|
144
|
+
|
|
105
145
|
/**
|
|
106
146
|
* Single-flight token refresh. Multiple concurrent 401s share one promise
|
|
107
147
|
* so only one refresh request is made.
|
|
@@ -133,6 +173,11 @@ export class PondClient {
|
|
|
133
173
|
query?: Record<string, string | number | boolean | undefined>,
|
|
134
174
|
retried = false,
|
|
135
175
|
): Promise<T> {
|
|
176
|
+
// Proactive refresh: block until token is fresh (no-op if still valid)
|
|
177
|
+
if (!retried) {
|
|
178
|
+
await this.ensureFreshToken(path);
|
|
179
|
+
}
|
|
180
|
+
|
|
136
181
|
let url = `${this.baseUrl}${path}`;
|
|
137
182
|
|
|
138
183
|
if (query) {
|
|
@@ -194,6 +239,12 @@ export class PondClient {
|
|
|
194
239
|
}
|
|
195
240
|
|
|
196
241
|
if (res.status === 204) return undefined as T;
|
|
242
|
+
// 202 Accepted may have an empty body (e.g., async restart) or a JSON body.
|
|
243
|
+
if (res.status === 202) {
|
|
244
|
+
const text = await res.text();
|
|
245
|
+
if (!text) return undefined as T;
|
|
246
|
+
return JSON.parse(text) as T;
|
|
247
|
+
}
|
|
197
248
|
return res.json() as Promise<T>;
|
|
198
249
|
}
|
|
199
250
|
|
|
@@ -247,10 +298,6 @@ export class PondClient {
|
|
|
247
298
|
return this.request('GET', ENDPOINTS.USER(id));
|
|
248
299
|
}
|
|
249
300
|
|
|
250
|
-
async searchUsers(q: string): Promise<User[]> {
|
|
251
|
-
const res = await this.request<{ data: User[] }>('GET', ENDPOINTS.USERS_SEARCH, undefined, { q });
|
|
252
|
-
return res.data;
|
|
253
|
-
}
|
|
254
301
|
|
|
255
302
|
// ---- Organizations ----
|
|
256
303
|
|
|
@@ -324,6 +371,12 @@ export class PondClient {
|
|
|
324
371
|
return this.request('GET', ENDPOINTS.INVITATION_BY_TOKEN(token));
|
|
325
372
|
}
|
|
326
373
|
|
|
374
|
+
// ---- Direct Messages (org-scoped) ----
|
|
375
|
+
|
|
376
|
+
async sendDirectMessage(orgId: string, req: SendDirectMessageRequest): Promise<DirectMessageResponse> {
|
|
377
|
+
return this.request('POST', ENDPOINTS.DM(orgId), req);
|
|
378
|
+
}
|
|
379
|
+
|
|
327
380
|
// ---- Chats (org-scoped) ----
|
|
328
381
|
|
|
329
382
|
async createChat(orgId: string, req: Omit<CreateChatRequest, 'org_id'>): Promise<Chat> {
|
|
@@ -504,6 +557,20 @@ export class PondClient {
|
|
|
504
557
|
return res.data;
|
|
505
558
|
}
|
|
506
559
|
|
|
560
|
+
/** Fetch all pending tasks (todo/in_progress) assigned to an agent. Pages automatically. */
|
|
561
|
+
async getAgentTasks(orgId: string, agentId: string): Promise<Task[]> {
|
|
562
|
+
const all: Task[] = [];
|
|
563
|
+
let cursor: string | undefined;
|
|
564
|
+
do {
|
|
565
|
+
const params: Record<string, string> = { limit: '100' };
|
|
566
|
+
if (cursor) params.cursor = cursor;
|
|
567
|
+
const res = await this.request<PaginatedResponse<Task>>('GET', ENDPOINTS.AGENT_TASKS(orgId, agentId), undefined, params);
|
|
568
|
+
all.push(...res.data);
|
|
569
|
+
cursor = res.has_more ? res.next_cursor : undefined;
|
|
570
|
+
} while (cursor);
|
|
571
|
+
return all;
|
|
572
|
+
}
|
|
573
|
+
|
|
507
574
|
// ---- Machines (org-scoped) ----
|
|
508
575
|
|
|
509
576
|
async getMachines(orgId: string): Promise<Machine[]> {
|
|
@@ -535,6 +602,14 @@ export class PondClient {
|
|
|
535
602
|
return this.request('GET', ENDPOINTS.MACHINE_LOGS(orgId, machineId), undefined, { lines });
|
|
536
603
|
}
|
|
537
604
|
|
|
605
|
+
async restartMachine(orgId: string, machineId: string): Promise<{ machine_id: string; command_id: string }> {
|
|
606
|
+
return this.request('POST', ENDPOINTS.MACHINE_RESTART(orgId, machineId));
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
async restartAllMachines(orgId: string): Promise<{ data: Array<{ machine_id: string; command_id?: string; status: string; error?: string }>; total: number }> {
|
|
610
|
+
return this.request('POST', ENDPOINTS.MACHINE_RESTART_ALL(orgId));
|
|
611
|
+
}
|
|
612
|
+
|
|
538
613
|
async updateMachineWorkspace(orgId: string, machineId: string, files: WorkspaceFiles): Promise<void> {
|
|
539
614
|
return this.request('PUT', ENDPOINTS.MACHINE_WORKSPACE(orgId, machineId), files);
|
|
540
615
|
}
|
|
@@ -562,6 +637,46 @@ export class PondClient {
|
|
|
562
637
|
return this.request('POST', ENDPOINTS.CHAT_READ(orgId, chatId), { message_id: messageId });
|
|
563
638
|
}
|
|
564
639
|
|
|
640
|
+
// ---- Inbox ----
|
|
641
|
+
|
|
642
|
+
async getInbox(orgId: string, params?: {
|
|
643
|
+
type?: string; reason?: string; read?: string;
|
|
644
|
+
limit?: number; cursor?: string;
|
|
645
|
+
}): Promise<PaginatedResponse<InboxItem>> {
|
|
646
|
+
return this.request('GET', ENDPOINTS.INBOX(orgId), undefined, params as Record<string, string>);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
async getInboxUnreadCount(orgId: string): Promise<InboxUnreadCountResponse> {
|
|
650
|
+
return this.request('GET', ENDPOINTS.INBOX_UNREAD_COUNT(orgId));
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
async markInboxRead(orgId: string, id: string): Promise<void> {
|
|
654
|
+
return this.request('PATCH', ENDPOINTS.INBOX_ITEM_READ(orgId, id));
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
async archiveInboxItem(orgId: string, id: string): Promise<void> {
|
|
658
|
+
return this.request('PATCH', ENDPOINTS.INBOX_ITEM_ARCHIVE(orgId, id));
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// snoozeInboxItem / unsnoozeInboxItem deferred until un-snooze cron worker is implemented
|
|
662
|
+
|
|
663
|
+
async markAllInboxRead(orgId: string): Promise<void> {
|
|
664
|
+
return this.request('POST', ENDPOINTS.INBOX_MARK_ALL_READ(orgId));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
async archiveAllInbox(orgId: string): Promise<void> {
|
|
668
|
+
return this.request('POST', ENDPOINTS.INBOX_ARCHIVE_ALL(orgId));
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** Mark an inbox item as read by its source (source_type + source_id) rather than inbox item ID. */
|
|
672
|
+
async ackInbox(orgId: string, source: { source_type: string; source_id: string }): Promise<void> {
|
|
673
|
+
return this.request('POST', ENDPOINTS.INBOX_ACK(orgId), source);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
async deleteInboxItem(orgId: string, id: string): Promise<void> {
|
|
677
|
+
return this.request('DELETE', ENDPOINTS.INBOX_ITEM(orgId, id));
|
|
678
|
+
}
|
|
679
|
+
|
|
565
680
|
// ---- Platform Config ----
|
|
566
681
|
|
|
567
682
|
/**
|
|
@@ -728,6 +843,10 @@ export class PondClient {
|
|
|
728
843
|
return this.request('GET', ENDPOINTS.WIKI_BLOB(orgId, wikiId), undefined, params);
|
|
729
844
|
}
|
|
730
845
|
|
|
846
|
+
async getWikiNodeSections(orgId: string, wikiId: string, params?: { ref?: string }): Promise<WikiNodeSectionArtifact> {
|
|
847
|
+
return this.request('GET', ENDPOINTS.WIKI_NODE_SECTIONS(orgId, wikiId), undefined, params);
|
|
848
|
+
}
|
|
849
|
+
|
|
731
850
|
async createWikiMount(orgId: string, wikiId: string, data: CreateWikiMountRequest): Promise<WikiMount> {
|
|
732
851
|
return this.request('POST', ENDPOINTS.WIKI_MOUNTS(orgId, wikiId), data);
|
|
733
852
|
}
|
|
@@ -750,7 +869,12 @@ export class PondClient {
|
|
|
750
869
|
return normalizeWikiChangeset(await this.request('GET', ENDPOINTS.WIKI_CHANGESET(orgId, wikiId, changesetId)));
|
|
751
870
|
}
|
|
752
871
|
|
|
753
|
-
async updateWikiChangeset(
|
|
872
|
+
async updateWikiChangeset(
|
|
873
|
+
orgId: string,
|
|
874
|
+
wikiId: string,
|
|
875
|
+
changesetId: string,
|
|
876
|
+
data: UpdateWikiChangesetRequest,
|
|
877
|
+
): Promise<WikiChangeset> {
|
|
754
878
|
return normalizeWikiChangeset(await this.request('PATCH', ENDPOINTS.WIKI_CHANGESET(orgId, wikiId, changesetId), data));
|
|
755
879
|
}
|
|
756
880
|
|
package/src/constants.ts
CHANGED
|
@@ -15,7 +15,6 @@ export const ENDPOINTS = {
|
|
|
15
15
|
// Users
|
|
16
16
|
USERS_ME: `${API_BASE}/users/me`,
|
|
17
17
|
USER: (id: string) => `${API_BASE}/users/${id}`,
|
|
18
|
-
USERS_SEARCH: `${API_BASE}/users/search`,
|
|
19
18
|
|
|
20
19
|
// WebSocket ticket
|
|
21
20
|
WS_TICKET: `${API_BASE}/ws/ticket`,
|
|
@@ -28,6 +27,9 @@ export const ENDPOINTS = {
|
|
|
28
27
|
ORG_MEMBER: (orgId: string, userId: string) =>
|
|
29
28
|
`${API_BASE}/orgs/${orgId}/members/${userId}`,
|
|
30
29
|
|
|
30
|
+
// Direct messages (org-scoped, atomic find-or-create + send)
|
|
31
|
+
DM: (orgId: string) => `${API_BASE}/orgs/${orgId}/dm`,
|
|
32
|
+
|
|
31
33
|
// Chats (org-scoped)
|
|
32
34
|
CHATS: (orgId: string) => `${API_BASE}/orgs/${orgId}/chats`,
|
|
33
35
|
CHAT: (orgId: string, chatId: string) => `${API_BASE}/orgs/${orgId}/chats/${chatId}`,
|
|
@@ -71,6 +73,8 @@ export const ENDPOINTS = {
|
|
|
71
73
|
`${API_BASE}/orgs/${orgId}/agents/${agentId}/runs/${runId}`,
|
|
72
74
|
AGENT_RUN_STEPS: (orgId: string, agentId: string, runId: string) =>
|
|
73
75
|
`${API_BASE}/orgs/${orgId}/agents/${agentId}/runs/${runId}/steps`,
|
|
76
|
+
AGENT_TASKS: (orgId: string, agentId: string) =>
|
|
77
|
+
`${API_BASE}/orgs/${orgId}/agents/${agentId}/tasks`,
|
|
74
78
|
// Machines (org-scoped)
|
|
75
79
|
MACHINES: (orgId: string) => `${API_BASE}/orgs/${orgId}/machines`,
|
|
76
80
|
MACHINE: (orgId: string, machineId: string) =>
|
|
@@ -83,6 +87,10 @@ export const ENDPOINTS = {
|
|
|
83
87
|
`${API_BASE}/orgs/${orgId}/machines/${machineId}/status`,
|
|
84
88
|
MACHINE_LOGS: (orgId: string, machineId: string) =>
|
|
85
89
|
`${API_BASE}/orgs/${orgId}/machines/${machineId}/logs`,
|
|
90
|
+
MACHINE_RESTART: (orgId: string, machineId: string) =>
|
|
91
|
+
`${API_BASE}/orgs/${orgId}/machines/${machineId}/restart`,
|
|
92
|
+
MACHINE_RESTART_ALL: (orgId: string) =>
|
|
93
|
+
`${API_BASE}/orgs/${orgId}/machines/restart-all`,
|
|
86
94
|
MACHINE_WORKSPACE: (orgId: string, machineId: string) =>
|
|
87
95
|
`${API_BASE}/orgs/${orgId}/machines/${machineId}/workspace`,
|
|
88
96
|
AGENT_WIKI_MOUNT_MANIFEST_V2: (orgId: string, agentId: string) =>
|
|
@@ -130,6 +138,7 @@ export const ENDPOINTS = {
|
|
|
130
138
|
WIKI: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}`,
|
|
131
139
|
WIKI_TREE: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}/tree`,
|
|
132
140
|
WIKI_BLOB: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}/blob`,
|
|
141
|
+
WIKI_NODE_SECTIONS: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}/node-sections`,
|
|
133
142
|
WIKI_MOUNTS: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}/mounts`,
|
|
134
143
|
WIKI_CHANGESETS: (orgId: string, wikiId: string) => `${API_BASE}/orgs/${orgId}/wikis/${wikiId}/changesets`,
|
|
135
144
|
WIKI_CHANGESET: (orgId: string, wikiId: string, changesetId: string) =>
|
|
@@ -141,6 +150,17 @@ export const ENDPOINTS = {
|
|
|
141
150
|
WIKI_CHANGESET_CLOSE: (orgId: string, wikiId: string, changesetId: string) =>
|
|
142
151
|
`${API_BASE}/orgs/${orgId}/wikis/${wikiId}/changesets/${changesetId}/close`,
|
|
143
152
|
|
|
153
|
+
// Inbox (org-scoped)
|
|
154
|
+
INBOX: (orgId: string) => `${API_BASE}/orgs/${orgId}/inbox`,
|
|
155
|
+
INBOX_UNREAD_COUNT: (orgId: string) => `${API_BASE}/orgs/${orgId}/inbox/unread-count`,
|
|
156
|
+
INBOX_ITEM_READ: (orgId: string, id: string) => `${API_BASE}/orgs/${orgId}/inbox/${id}/read`,
|
|
157
|
+
INBOX_ITEM_ARCHIVE: (orgId: string, id: string) => `${API_BASE}/orgs/${orgId}/inbox/${id}/archive`,
|
|
158
|
+
// Snooze/Unsnooze deferred until un-snooze cron worker is implemented
|
|
159
|
+
INBOX_MARK_ALL_READ: (orgId: string) => `${API_BASE}/orgs/${orgId}/inbox/mark-all-read`,
|
|
160
|
+
INBOX_ARCHIVE_ALL: (orgId: string) => `${API_BASE}/orgs/${orgId}/inbox/archive-all`,
|
|
161
|
+
INBOX_ITEM: (orgId: string, id: string) => `${API_BASE}/orgs/${orgId}/inbox/${id}`,
|
|
162
|
+
INBOX_ACK: (orgId: string) => `${API_BASE}/orgs/${orgId}/inbox/ack`,
|
|
163
|
+
|
|
144
164
|
// Unread
|
|
145
165
|
UNREAD: `${API_BASE}/me/unread`,
|
|
146
166
|
CHAT_READ: (orgId: string, chatId: string) =>
|
|
@@ -194,4 +214,7 @@ export const WS_EVENTS = {
|
|
|
194
214
|
PRESENCE_UPDATE: 'presence.update',
|
|
195
215
|
WIKI_CHANGESET_CREATED: 'wiki.changeset.created',
|
|
196
216
|
WIKI_CHANGESET_UPDATED: 'wiki.changeset.updated',
|
|
217
|
+
NOTIFICATION_NEW: 'notification.new',
|
|
218
|
+
NOTIFICATION_UPDATE: 'notification.update',
|
|
219
|
+
NOTIFICATION_BULK_UPDATE: 'notification.bulk_update',
|
|
197
220
|
} as const;
|
package/src/types.ts
CHANGED
|
@@ -143,18 +143,18 @@ export interface StateDeltaContent {
|
|
|
143
143
|
|
|
144
144
|
export type SystemEvent =
|
|
145
145
|
| 'chat_created'
|
|
146
|
-
| '
|
|
147
|
-
| '
|
|
146
|
+
| 'member_added'
|
|
147
|
+
| 'member_removed'
|
|
148
148
|
| 'member_role_changed'
|
|
149
149
|
| 'chat_renamed'
|
|
150
|
-
| 'chat_avatar_changed'
|
|
151
|
-
| 'agent_added'
|
|
152
|
-
| 'agent_removed';
|
|
150
|
+
| 'chat_avatar_changed';
|
|
153
151
|
|
|
154
152
|
export interface SystemContent {
|
|
155
153
|
event: SystemEvent;
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
actor_id: string;
|
|
155
|
+
actor_name: string;
|
|
156
|
+
target_id?: string;
|
|
157
|
+
target_name?: string;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
export type MessageContent =
|
|
@@ -183,6 +183,7 @@ export interface Message {
|
|
|
183
183
|
created_at: string;
|
|
184
184
|
idempotency_key: string | null;
|
|
185
185
|
agent_run_id?: string | null;
|
|
186
|
+
hints?: MessageHints | null;
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
export interface Attachment {
|
|
@@ -352,12 +353,32 @@ export interface CreateChatRequest {
|
|
|
352
353
|
member_ids: string[];
|
|
353
354
|
}
|
|
354
355
|
|
|
356
|
+
export interface MessageHints {
|
|
357
|
+
no_reply?: boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
355
360
|
export interface SendMessageRequest {
|
|
356
361
|
message_type: MessageType;
|
|
357
362
|
content: MessageContent;
|
|
358
363
|
thread_root_id?: string;
|
|
359
364
|
idempotency_key?: string;
|
|
360
365
|
agent_run_id?: string;
|
|
366
|
+
hints?: MessageHints;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export interface SendDirectMessageRequest {
|
|
370
|
+
user_id: string;
|
|
371
|
+
message_type: MessageType;
|
|
372
|
+
content: MessageContent;
|
|
373
|
+
thread_root_id?: string;
|
|
374
|
+
idempotency_key?: string;
|
|
375
|
+
agent_run_id?: string;
|
|
376
|
+
hints?: MessageHints;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface DirectMessageResponse {
|
|
380
|
+
chat: Chat;
|
|
381
|
+
message: Message;
|
|
361
382
|
}
|
|
362
383
|
|
|
363
384
|
export interface PatchMessageRequest {
|
|
@@ -673,6 +694,33 @@ export interface WikiBlob {
|
|
|
673
694
|
content: string;
|
|
674
695
|
}
|
|
675
696
|
|
|
697
|
+
export interface WikiNodeSection {
|
|
698
|
+
wiki_id: string;
|
|
699
|
+
wiki_slug: string;
|
|
700
|
+
wiki_name: string;
|
|
701
|
+
node_id: string;
|
|
702
|
+
path: string;
|
|
703
|
+
title: string;
|
|
704
|
+
heading_path?: string[];
|
|
705
|
+
section_path: string;
|
|
706
|
+
level: number;
|
|
707
|
+
start_line: number;
|
|
708
|
+
end_line: number;
|
|
709
|
+
content: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export interface WikiNodeSectionArtifact {
|
|
713
|
+
version: number;
|
|
714
|
+
generated_at: string;
|
|
715
|
+
wiki_id: string;
|
|
716
|
+
wiki_slug: string;
|
|
717
|
+
wiki_name: string;
|
|
718
|
+
ref: string;
|
|
719
|
+
manifest_digest: string;
|
|
720
|
+
file_count: number;
|
|
721
|
+
nodes: WikiNodeSection[];
|
|
722
|
+
}
|
|
723
|
+
|
|
676
724
|
export interface WikiDiffFile {
|
|
677
725
|
path: string;
|
|
678
726
|
additions: number;
|
|
@@ -766,21 +814,7 @@ export interface CreateWikiChangesetRequest {
|
|
|
766
814
|
status?: WikiChangesetStatus;
|
|
767
815
|
}
|
|
768
816
|
|
|
769
|
-
export interface UpdateWikiChangesetRequest {
|
|
770
|
-
base_ref?: string;
|
|
771
|
-
base_commit?: string;
|
|
772
|
-
head_branch?: string;
|
|
773
|
-
head_commit?: string;
|
|
774
|
-
title: string;
|
|
775
|
-
summary?: string;
|
|
776
|
-
source_chat_id?: string;
|
|
777
|
-
source_message_id?: string;
|
|
778
|
-
source_run_id?: string;
|
|
779
|
-
changed_paths?: string[];
|
|
780
|
-
diff_files?: WikiDiffFile[];
|
|
781
|
-
patch?: string;
|
|
782
|
-
status?: WikiChangesetStatus;
|
|
783
|
-
}
|
|
817
|
+
export interface UpdateWikiChangesetRequest extends CreateWikiChangesetRequest {}
|
|
784
818
|
|
|
785
819
|
export interface MintWikiRepoTokenRequest {
|
|
786
820
|
wiki_id: string;
|
|
@@ -826,6 +860,7 @@ export interface MessageNewData {
|
|
|
826
860
|
deleted_at?: string | null;
|
|
827
861
|
idempotency_key?: string | null;
|
|
828
862
|
agent_run_id?: string | null;
|
|
863
|
+
hints?: MessageHints | null;
|
|
829
864
|
}
|
|
830
865
|
|
|
831
866
|
export interface MessagePatchData {
|
|
@@ -928,6 +963,8 @@ export interface UpdateTaskCommentRequest {
|
|
|
928
963
|
|
|
929
964
|
export type TaskCreatedData = Task;
|
|
930
965
|
export type TaskUpdatedData = Task;
|
|
966
|
+
/** Sent to user:{agentID} channel when a task is assigned to an agent. Data is the full Task. */
|
|
967
|
+
export type TaskAssignedData = Task;
|
|
931
968
|
export interface TaskDeletedData {
|
|
932
969
|
task_id: string;
|
|
933
970
|
org_id: string;
|
|
@@ -1011,6 +1048,61 @@ export interface AgentStepNewData extends AgentStep {
|
|
|
1011
1048
|
export type WikiChangesetCreatedData = WikiChangeset & { org_id: string };
|
|
1012
1049
|
export type WikiChangesetUpdatedData = WikiChangeset & { org_id: string };
|
|
1013
1050
|
|
|
1051
|
+
// ============================================================
|
|
1052
|
+
// Inbox Types
|
|
1053
|
+
// ============================================================
|
|
1054
|
+
|
|
1055
|
+
export type InboxItemType =
|
|
1056
|
+
| 'mention' | 'task_assign' | 'task_update'
|
|
1057
|
+
| 'task_comment' | 'approval_request'
|
|
1058
|
+
| 'agent_alert' | 'invitation'
|
|
1059
|
+
| 'agent_dm';
|
|
1060
|
+
|
|
1061
|
+
export type InboxItemReason =
|
|
1062
|
+
| 'assigned' | 'mentioned' | 'authored'
|
|
1063
|
+
| 'subscribed' | 'approval_requested'
|
|
1064
|
+
| 'dm_received';
|
|
1065
|
+
|
|
1066
|
+
export interface InboxItem {
|
|
1067
|
+
id: string;
|
|
1068
|
+
org_id: string;
|
|
1069
|
+
recipient_id: string;
|
|
1070
|
+
actor_id: string | null;
|
|
1071
|
+
type: InboxItemType;
|
|
1072
|
+
reason: InboxItemReason;
|
|
1073
|
+
entity_type: string;
|
|
1074
|
+
entity_id: string;
|
|
1075
|
+
group_key: string;
|
|
1076
|
+
source_type: string;
|
|
1077
|
+
source_id: string;
|
|
1078
|
+
chat_id: string | null;
|
|
1079
|
+
task_id: string | null;
|
|
1080
|
+
title: string;
|
|
1081
|
+
body: string;
|
|
1082
|
+
read_at: string | null;
|
|
1083
|
+
archived_at: string | null;
|
|
1084
|
+
snoozed_until: string | null;
|
|
1085
|
+
created_at: string;
|
|
1086
|
+
updated_at: string;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
export type NotificationNewData = InboxItem;
|
|
1090
|
+
|
|
1091
|
+
export interface NotificationUpdateData {
|
|
1092
|
+
id: string;
|
|
1093
|
+
read_at?: string | null;
|
|
1094
|
+
archived_at?: string | null;
|
|
1095
|
+
snoozed_until?: string | null;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export interface NotificationBulkUpdateData {
|
|
1099
|
+
action: 'mark_all_read' | 'archive_all';
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
export interface InboxUnreadCountResponse {
|
|
1103
|
+
count: number;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1014
1106
|
export type WsEventMap = {
|
|
1015
1107
|
'hello': HelloData;
|
|
1016
1108
|
'message.new': MessageNewData;
|
|
@@ -1029,6 +1121,7 @@ export type WsEventMap = {
|
|
|
1029
1121
|
'task.created': TaskCreatedData;
|
|
1030
1122
|
'task.updated': TaskUpdatedData;
|
|
1031
1123
|
'task.deleted': TaskDeletedData;
|
|
1124
|
+
'task.assigned': TaskAssignedData;
|
|
1032
1125
|
'task.comment.created': TaskCommentCreatedData;
|
|
1033
1126
|
'task.comment.updated': TaskCommentUpdatedData;
|
|
1034
1127
|
'task.comment.deleted': TaskCommentDeletedData;
|
|
@@ -1045,6 +1138,9 @@ export type WsEventMap = {
|
|
|
1045
1138
|
'presence.update': PresenceUpdateData;
|
|
1046
1139
|
'wiki.changeset.created': WikiChangesetCreatedData;
|
|
1047
1140
|
'wiki.changeset.updated': WikiChangesetUpdatedData;
|
|
1141
|
+
'notification.new': NotificationNewData;
|
|
1142
|
+
'notification.update': NotificationUpdateData;
|
|
1143
|
+
'notification.bulk_update': NotificationBulkUpdateData;
|
|
1048
1144
|
};
|
|
1049
1145
|
|
|
1050
1146
|
// Invitation WS event data
|