@prismer/sdk 1.7.4 → 1.8.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 +421 -3
- package/dist/cli.js +1342 -112
- package/dist/index.d.mts +758 -223
- package/dist/index.d.ts +758 -223
- package/dist/index.js +582 -12
- package/dist/index.mjs +580 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,185 +1,6 @@
|
|
|
1
|
+
import { AIPIdentity } from '@prismer/aip-sdk';
|
|
1
2
|
export { AIPIdentity, DIDDocument, SignedPayload } from '@prismer/aip-sdk';
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* Prismer Cloud Real-Time Client — WebSocket & SSE transports.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const ws = client.im.connectWS({ token: jwtToken });
|
|
9
|
-
* await ws.connect();
|
|
10
|
-
*
|
|
11
|
-
* ws.on('message.new', (msg) => console.log(msg.content));
|
|
12
|
-
* ws.joinConversation('conv-123');
|
|
13
|
-
* ws.sendMessage('conv-123', 'Hello!');
|
|
14
|
-
*
|
|
15
|
-
* // SSE (server-push only, auto-joins all conversations)
|
|
16
|
-
* const sse = client.im.connectSSE({ token: jwtToken });
|
|
17
|
-
* await sse.connect();
|
|
18
|
-
* sse.on('message.new', (msg) => console.log(msg.content));
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
interface AuthenticatedPayload {
|
|
22
|
-
userId: string;
|
|
23
|
-
username: string;
|
|
24
|
-
}
|
|
25
|
-
interface MessageNewPayload {
|
|
26
|
-
id: string;
|
|
27
|
-
conversationId: string;
|
|
28
|
-
content: string;
|
|
29
|
-
type: string;
|
|
30
|
-
senderId: string;
|
|
31
|
-
routing?: {
|
|
32
|
-
mode: string;
|
|
33
|
-
targets: Array<{
|
|
34
|
-
userId: string;
|
|
35
|
-
username?: string;
|
|
36
|
-
}>;
|
|
37
|
-
};
|
|
38
|
-
metadata?: Record<string, any>;
|
|
39
|
-
createdAt: string;
|
|
40
|
-
}
|
|
41
|
-
interface MessageEditPayload {
|
|
42
|
-
id: string;
|
|
43
|
-
conversationId: string;
|
|
44
|
-
content: string;
|
|
45
|
-
type: string;
|
|
46
|
-
editedAt: string;
|
|
47
|
-
editedBy: string;
|
|
48
|
-
metadata?: Record<string, any>;
|
|
49
|
-
}
|
|
50
|
-
interface MessageDeletedPayload {
|
|
51
|
-
id: string;
|
|
52
|
-
conversationId: string;
|
|
53
|
-
}
|
|
54
|
-
interface TypingIndicatorPayload {
|
|
55
|
-
conversationId: string;
|
|
56
|
-
userId: string;
|
|
57
|
-
isTyping: boolean;
|
|
58
|
-
}
|
|
59
|
-
interface PresenceChangedPayload {
|
|
60
|
-
userId: string;
|
|
61
|
-
status: string;
|
|
62
|
-
}
|
|
63
|
-
interface PongPayload {
|
|
64
|
-
requestId: string;
|
|
65
|
-
}
|
|
66
|
-
interface ErrorPayload {
|
|
67
|
-
message: string;
|
|
68
|
-
}
|
|
69
|
-
interface DisconnectedPayload {
|
|
70
|
-
code: number;
|
|
71
|
-
reason: string;
|
|
72
|
-
}
|
|
73
|
-
interface ReconnectingPayload {
|
|
74
|
-
attempt: number;
|
|
75
|
-
delayMs: number;
|
|
76
|
-
}
|
|
77
|
-
interface RealtimeEventMap {
|
|
78
|
-
'authenticated': AuthenticatedPayload;
|
|
79
|
-
'message.new': MessageNewPayload;
|
|
80
|
-
'message.edit': MessageEditPayload;
|
|
81
|
-
'message.deleted': MessageDeletedPayload;
|
|
82
|
-
'typing.indicator': TypingIndicatorPayload;
|
|
83
|
-
'presence.changed': PresenceChangedPayload;
|
|
84
|
-
'pong': PongPayload;
|
|
85
|
-
'error': ErrorPayload;
|
|
86
|
-
'connected': undefined;
|
|
87
|
-
'disconnected': DisconnectedPayload;
|
|
88
|
-
'reconnecting': ReconnectingPayload;
|
|
89
|
-
}
|
|
90
|
-
type RealtimeEventType = keyof RealtimeEventMap;
|
|
91
|
-
interface RealtimeCommand {
|
|
92
|
-
type: string;
|
|
93
|
-
payload: unknown;
|
|
94
|
-
requestId?: string;
|
|
95
|
-
}
|
|
96
|
-
interface RealtimeConfig {
|
|
97
|
-
/** JWT token for authentication */
|
|
98
|
-
token: string;
|
|
99
|
-
/** Auto-reconnect on disconnect (default: true) */
|
|
100
|
-
autoReconnect?: boolean;
|
|
101
|
-
/** Max reconnection attempts (default: 10, 0 = unlimited) */
|
|
102
|
-
maxReconnectAttempts?: number;
|
|
103
|
-
/** Base delay for exponential backoff in ms (default: 1000) */
|
|
104
|
-
reconnectBaseDelay?: number;
|
|
105
|
-
/** Max delay cap in ms (default: 30000) */
|
|
106
|
-
reconnectMaxDelay?: number;
|
|
107
|
-
/** Heartbeat interval in ms (default: 25000) */
|
|
108
|
-
heartbeatInterval?: number;
|
|
109
|
-
/** Custom WebSocket constructor (for Node <21 or test mocks) */
|
|
110
|
-
WebSocket?: new (url: string) => WebSocket;
|
|
111
|
-
/** Custom fetch implementation (for SSE streaming) */
|
|
112
|
-
fetch?: typeof fetch;
|
|
113
|
-
}
|
|
114
|
-
type RealtimeState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
115
|
-
type Listener$1<T> = (payload: T) => void;
|
|
116
|
-
declare class TypedEmitter {
|
|
117
|
-
private listeners;
|
|
118
|
-
on<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
119
|
-
off<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
120
|
-
once<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
121
|
-
protected emit<E extends RealtimeEventType>(event: E, payload: RealtimeEventMap[E]): void;
|
|
122
|
-
protected removeAllListeners(): void;
|
|
123
|
-
}
|
|
124
|
-
declare class RealtimeWSClient extends TypedEmitter {
|
|
125
|
-
private ws;
|
|
126
|
-
private reconnector;
|
|
127
|
-
private heartbeatTimer;
|
|
128
|
-
private pongTimer;
|
|
129
|
-
private reconnectTimer;
|
|
130
|
-
private pendingPings;
|
|
131
|
-
private _state;
|
|
132
|
-
private intentionalClose;
|
|
133
|
-
private readonly wsUrl;
|
|
134
|
-
private readonly config;
|
|
135
|
-
private readonly WS;
|
|
136
|
-
private pingCounter;
|
|
137
|
-
get state(): RealtimeState;
|
|
138
|
-
constructor(baseUrl: string, config: RealtimeConfig);
|
|
139
|
-
connect(): Promise<void>;
|
|
140
|
-
disconnect(code?: number, reason?: string): void;
|
|
141
|
-
joinConversation(conversationId: string): void;
|
|
142
|
-
sendMessage(conversationId: string, content: string, options?: string | {
|
|
143
|
-
type?: string;
|
|
144
|
-
metadata?: Record<string, any>;
|
|
145
|
-
parentId?: string;
|
|
146
|
-
}): void;
|
|
147
|
-
startTyping(conversationId: string): void;
|
|
148
|
-
stopTyping(conversationId: string): void;
|
|
149
|
-
updatePresence(status: string): void;
|
|
150
|
-
send(command: RealtimeCommand): void;
|
|
151
|
-
ping(): Promise<PongPayload>;
|
|
152
|
-
private sendRaw;
|
|
153
|
-
private handleMessage;
|
|
154
|
-
private handleClose;
|
|
155
|
-
private scheduleReconnect;
|
|
156
|
-
private startHeartbeat;
|
|
157
|
-
private stopHeartbeat;
|
|
158
|
-
private clearReconnectTimer;
|
|
159
|
-
private clearPendingPings;
|
|
160
|
-
}
|
|
161
|
-
declare class RealtimeSSEClient extends TypedEmitter {
|
|
162
|
-
private abortController;
|
|
163
|
-
private reconnector;
|
|
164
|
-
private reconnectTimer;
|
|
165
|
-
private heartbeatWatchdog;
|
|
166
|
-
private lastDataTime;
|
|
167
|
-
private _state;
|
|
168
|
-
private intentionalClose;
|
|
169
|
-
private readonly sseUrl;
|
|
170
|
-
private readonly config;
|
|
171
|
-
private readonly fetchFn;
|
|
172
|
-
get state(): RealtimeState;
|
|
173
|
-
constructor(baseUrl: string, config: RealtimeConfig);
|
|
174
|
-
connect(): Promise<void>;
|
|
175
|
-
disconnect(): void;
|
|
176
|
-
private readStream;
|
|
177
|
-
private scheduleReconnect;
|
|
178
|
-
private startHeartbeatWatchdog;
|
|
179
|
-
private stopHeartbeatWatchdog;
|
|
180
|
-
private clearReconnectTimer;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
4
|
/**
|
|
184
5
|
* Prismer SDK — Storage adapters for offline-first IM.
|
|
185
6
|
*
|
|
@@ -232,7 +53,7 @@ interface StoredContact {
|
|
|
232
53
|
}
|
|
233
54
|
interface OutboxOperation {
|
|
234
55
|
id: string;
|
|
235
|
-
type: 'message.send' | 'message.edit' | 'message.delete' | 'conversation.read';
|
|
56
|
+
type: 'message.send' | 'message.edit' | 'message.delete' | 'conversation.read' | 'community_post' | 'community_comment' | 'community_vote';
|
|
236
57
|
method: string;
|
|
237
58
|
path: string;
|
|
238
59
|
body?: unknown;
|
|
@@ -439,6 +260,22 @@ interface PrismerConfig {
|
|
|
439
260
|
imAgent?: string;
|
|
440
261
|
/** Enable offline-first mode for IM with local persistence and sync */
|
|
441
262
|
offline?: OfflineConfig;
|
|
263
|
+
/**
|
|
264
|
+
* AIP identity for automatic message signing (v1.8.0 S1).
|
|
265
|
+
* - `'auto'`: derive Ed25519 key from apiKey via SHA-256
|
|
266
|
+
* - `{ privateKey: string }`: Base64-encoded Ed25519 private key
|
|
267
|
+
* When set, all IM send requests auto-include senderDid + signature.
|
|
268
|
+
*/
|
|
269
|
+
identity?: 'auto' | {
|
|
270
|
+
privateKey: string;
|
|
271
|
+
};
|
|
272
|
+
/** v1.8.0 CommunityHub cache tuning (`im.community`) */
|
|
273
|
+
community?: CommunityHubConfig;
|
|
274
|
+
}
|
|
275
|
+
/** Options for `CommunityHub` (see `community-hub.ts`) */
|
|
276
|
+
interface CommunityHubConfig {
|
|
277
|
+
feedTTLMs?: number;
|
|
278
|
+
statsTTLMs?: number;
|
|
442
279
|
}
|
|
443
280
|
interface LoadOptions {
|
|
444
281
|
inputType?: 'auto' | 'url' | 'urls' | 'query';
|
|
@@ -717,12 +554,65 @@ interface IMGroupData {
|
|
|
717
554
|
members: IMGroupMember[];
|
|
718
555
|
}
|
|
719
556
|
interface IMContact {
|
|
557
|
+
userId: string;
|
|
720
558
|
username: string;
|
|
721
559
|
displayName: string;
|
|
722
560
|
role: string;
|
|
561
|
+
avatarUrl?: string;
|
|
562
|
+
isAgent?: boolean;
|
|
563
|
+
institution?: string;
|
|
564
|
+
lastSeenAt?: string;
|
|
565
|
+
remark?: string;
|
|
566
|
+
addedAt?: string;
|
|
723
567
|
lastMessageAt?: string;
|
|
568
|
+
lastMessage?: string;
|
|
724
569
|
unreadCount: number;
|
|
725
570
|
conversationId: string;
|
|
571
|
+
conversationType?: string;
|
|
572
|
+
}
|
|
573
|
+
interface IMUserProfile {
|
|
574
|
+
userId: string;
|
|
575
|
+
username: string;
|
|
576
|
+
displayName: string;
|
|
577
|
+
role: string;
|
|
578
|
+
avatarUrl?: string;
|
|
579
|
+
status?: string;
|
|
580
|
+
isAgent?: boolean;
|
|
581
|
+
agentType?: string;
|
|
582
|
+
capabilities?: string[];
|
|
583
|
+
description?: string;
|
|
584
|
+
institution?: string;
|
|
585
|
+
did?: string;
|
|
586
|
+
isContact?: boolean;
|
|
587
|
+
lastSeenAt?: string;
|
|
588
|
+
}
|
|
589
|
+
interface IMFriendRequest {
|
|
590
|
+
id: string;
|
|
591
|
+
fromUserId: string;
|
|
592
|
+
toUserId: string;
|
|
593
|
+
reason?: string;
|
|
594
|
+
source?: string;
|
|
595
|
+
status: 'pending' | 'accepted' | 'rejected' | 'expired';
|
|
596
|
+
createdAt: string;
|
|
597
|
+
updatedAt: string;
|
|
598
|
+
fromUser?: {
|
|
599
|
+
username: string;
|
|
600
|
+
displayName: string;
|
|
601
|
+
avatarUrl?: string;
|
|
602
|
+
};
|
|
603
|
+
toUser?: {
|
|
604
|
+
username: string;
|
|
605
|
+
displayName: string;
|
|
606
|
+
avatarUrl?: string;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
interface IMBlockedUser {
|
|
610
|
+
userId: string;
|
|
611
|
+
username: string;
|
|
612
|
+
displayName: string;
|
|
613
|
+
avatarUrl?: string;
|
|
614
|
+
reason?: string;
|
|
615
|
+
blockedAt: string;
|
|
726
616
|
}
|
|
727
617
|
interface IMDiscoverAgent {
|
|
728
618
|
username: string;
|
|
@@ -763,6 +653,9 @@ interface IMConversation {
|
|
|
763
653
|
lastMessage?: IMMessage;
|
|
764
654
|
unreadCount?: number;
|
|
765
655
|
members?: IMGroupMember[];
|
|
656
|
+
pinned?: boolean;
|
|
657
|
+
muted?: boolean;
|
|
658
|
+
archived?: boolean;
|
|
766
659
|
createdAt: string;
|
|
767
660
|
updatedAt?: string;
|
|
768
661
|
}
|
|
@@ -810,6 +703,8 @@ interface IMSendOptions {
|
|
|
810
703
|
type?: 'text' | 'markdown' | 'code' | 'image' | 'file' | 'tool_call' | 'tool_result' | 'system_event' | 'thinking';
|
|
811
704
|
metadata?: Record<string, any>;
|
|
812
705
|
parentId?: string;
|
|
706
|
+
/** Override auto-signing for this message (e.g., skip signing for system_event) */
|
|
707
|
+
skipSigning?: boolean;
|
|
813
708
|
}
|
|
814
709
|
interface IMPaginationOptions {
|
|
815
710
|
limit?: number;
|
|
@@ -1069,6 +964,34 @@ interface IMMemoryLoadResult {
|
|
|
1069
964
|
path: string;
|
|
1070
965
|
template: string;
|
|
1071
966
|
}
|
|
967
|
+
type KnowledgeLinkSource = 'memory' | 'gene' | 'capsule' | 'signal';
|
|
968
|
+
type KnowledgeLinkType = 'related' | 'derived_from' | 'applied_in' | 'contradicts';
|
|
969
|
+
interface IMKnowledgeLink {
|
|
970
|
+
id: string;
|
|
971
|
+
sourceType: KnowledgeLinkSource;
|
|
972
|
+
sourceId: string;
|
|
973
|
+
targetType: KnowledgeLinkSource;
|
|
974
|
+
targetId: string;
|
|
975
|
+
linkType: KnowledgeLinkType;
|
|
976
|
+
strength: number;
|
|
977
|
+
scope: string;
|
|
978
|
+
createdAt: string;
|
|
979
|
+
}
|
|
980
|
+
interface IMMemoryKnowledgeLinks {
|
|
981
|
+
links: Array<{
|
|
982
|
+
memoryId: string;
|
|
983
|
+
memoryPath: string;
|
|
984
|
+
genes: Array<{
|
|
985
|
+
geneId: string;
|
|
986
|
+
title: string;
|
|
987
|
+
linkType: string;
|
|
988
|
+
strength: number;
|
|
989
|
+
successRate: number;
|
|
990
|
+
}>;
|
|
991
|
+
}>;
|
|
992
|
+
unlinkedMemories: string[];
|
|
993
|
+
totalLinks: number;
|
|
994
|
+
}
|
|
1072
995
|
type DerivationMode = 'generated' | 'derived' | 'imported';
|
|
1073
996
|
interface IMRegisterKeyOptions {
|
|
1074
997
|
publicKey: string;
|
|
@@ -1340,29 +1263,287 @@ interface EvolutionSyncDelta {
|
|
|
1340
1263
|
}
|
|
1341
1264
|
|
|
1342
1265
|
/**
|
|
1343
|
-
* Prismer
|
|
1266
|
+
* Prismer Cloud Real-Time Client — WebSocket & SSE transports.
|
|
1344
1267
|
*
|
|
1345
|
-
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```typescript
|
|
1270
|
+
* const ws = client.im.connectWS({ token: jwtToken });
|
|
1271
|
+
* await ws.connect();
|
|
1272
|
+
*
|
|
1273
|
+
* ws.on('message.new', (msg) => console.log(msg.content));
|
|
1274
|
+
* ws.joinConversation('conv-123');
|
|
1275
|
+
* ws.sendMessage('conv-123', 'Hello!');
|
|
1276
|
+
*
|
|
1277
|
+
* // SSE (server-push only, auto-joins all conversations)
|
|
1278
|
+
* const sse = client.im.connectSSE({ token: jwtToken });
|
|
1279
|
+
* await sse.connect();
|
|
1280
|
+
* sse.on('message.new', (msg) => console.log(msg.content));
|
|
1281
|
+
* ```
|
|
1346
1282
|
*/
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
type: string;
|
|
1351
|
-
data: any;
|
|
1352
|
-
conversationId?: string;
|
|
1353
|
-
at: string;
|
|
1354
|
-
}
|
|
1355
|
-
interface SyncResult {
|
|
1356
|
-
events: SyncEvent[];
|
|
1357
|
-
cursor: number;
|
|
1358
|
-
hasMore: boolean;
|
|
1283
|
+
interface AuthenticatedPayload {
|
|
1284
|
+
userId: string;
|
|
1285
|
+
username: string;
|
|
1359
1286
|
}
|
|
1360
|
-
interface
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1287
|
+
interface MessageNewPayload {
|
|
1288
|
+
id: string;
|
|
1289
|
+
conversationId: string;
|
|
1290
|
+
content: string;
|
|
1291
|
+
type: string;
|
|
1292
|
+
senderId: string;
|
|
1293
|
+
routing?: {
|
|
1294
|
+
mode: string;
|
|
1295
|
+
targets: Array<{
|
|
1296
|
+
userId: string;
|
|
1297
|
+
username?: string;
|
|
1298
|
+
}>;
|
|
1299
|
+
};
|
|
1300
|
+
metadata?: Record<string, any>;
|
|
1301
|
+
createdAt: string;
|
|
1302
|
+
}
|
|
1303
|
+
interface MessageEditPayload {
|
|
1304
|
+
id: string;
|
|
1305
|
+
conversationId: string;
|
|
1306
|
+
content: string;
|
|
1307
|
+
type: string;
|
|
1308
|
+
editedAt: string;
|
|
1309
|
+
editedBy: string;
|
|
1310
|
+
metadata?: Record<string, any>;
|
|
1311
|
+
}
|
|
1312
|
+
interface MessageDeletedPayload {
|
|
1313
|
+
id: string;
|
|
1314
|
+
conversationId: string;
|
|
1315
|
+
}
|
|
1316
|
+
interface TypingIndicatorPayload {
|
|
1317
|
+
conversationId: string;
|
|
1318
|
+
userId: string;
|
|
1319
|
+
isTyping: boolean;
|
|
1320
|
+
}
|
|
1321
|
+
interface PresenceChangedPayload {
|
|
1322
|
+
userId: string;
|
|
1323
|
+
status: string;
|
|
1324
|
+
}
|
|
1325
|
+
interface PongPayload {
|
|
1326
|
+
requestId: string;
|
|
1327
|
+
}
|
|
1328
|
+
interface ErrorPayload {
|
|
1329
|
+
message: string;
|
|
1330
|
+
}
|
|
1331
|
+
interface DisconnectedPayload {
|
|
1332
|
+
code: number;
|
|
1333
|
+
reason: string;
|
|
1334
|
+
}
|
|
1335
|
+
interface ReconnectingPayload {
|
|
1336
|
+
attempt: number;
|
|
1337
|
+
delayMs: number;
|
|
1338
|
+
}
|
|
1339
|
+
interface RealtimeEventMap {
|
|
1340
|
+
'authenticated': AuthenticatedPayload;
|
|
1341
|
+
'message.new': MessageNewPayload;
|
|
1342
|
+
'message.edit': MessageEditPayload;
|
|
1343
|
+
'message.deleted': MessageDeletedPayload;
|
|
1344
|
+
'typing.indicator': TypingIndicatorPayload;
|
|
1345
|
+
'presence.changed': PresenceChangedPayload;
|
|
1346
|
+
'pong': PongPayload;
|
|
1347
|
+
'error': ErrorPayload;
|
|
1348
|
+
'connected': undefined;
|
|
1349
|
+
'disconnected': DisconnectedPayload;
|
|
1350
|
+
'reconnecting': ReconnectingPayload;
|
|
1351
|
+
'contact.request': {
|
|
1352
|
+
requestId: string;
|
|
1353
|
+
fromUserId: string;
|
|
1354
|
+
toUserId: string;
|
|
1355
|
+
fromUsername?: string;
|
|
1356
|
+
fromDisplayName?: string;
|
|
1357
|
+
reason?: string;
|
|
1358
|
+
source?: string;
|
|
1359
|
+
createdAt: string;
|
|
1360
|
+
};
|
|
1361
|
+
'contact.accepted': {
|
|
1362
|
+
fromUserId: string;
|
|
1363
|
+
toUserId: string;
|
|
1364
|
+
conversationId: string;
|
|
1365
|
+
username?: string;
|
|
1366
|
+
displayName?: string;
|
|
1367
|
+
acceptedAt: string;
|
|
1368
|
+
};
|
|
1369
|
+
'contact.rejected': {
|
|
1370
|
+
fromUserId: string;
|
|
1371
|
+
toUserId: string;
|
|
1372
|
+
requestId: string;
|
|
1373
|
+
rejectedAt: string;
|
|
1374
|
+
};
|
|
1375
|
+
'contact.removed': {
|
|
1376
|
+
userId: string;
|
|
1377
|
+
removedUserId: string;
|
|
1378
|
+
removedAt: string;
|
|
1379
|
+
};
|
|
1380
|
+
'contact.blocked': {
|
|
1381
|
+
userId: string;
|
|
1382
|
+
blockedUserId: string;
|
|
1383
|
+
blockedAt: string;
|
|
1384
|
+
};
|
|
1385
|
+
'conversation.created': {
|
|
1386
|
+
conversationId: string;
|
|
1387
|
+
type: string;
|
|
1388
|
+
participants: string[];
|
|
1389
|
+
createdAt: string;
|
|
1390
|
+
};
|
|
1391
|
+
'message.delivered': {
|
|
1392
|
+
conversationId: string;
|
|
1393
|
+
messageIds: string[];
|
|
1394
|
+
userId: string;
|
|
1395
|
+
deliveredAt: string;
|
|
1396
|
+
};
|
|
1397
|
+
'message.read': {
|
|
1398
|
+
conversationId: string;
|
|
1399
|
+
messageIds: string[];
|
|
1400
|
+
userId: string;
|
|
1401
|
+
readAt: string;
|
|
1402
|
+
};
|
|
1403
|
+
'community.reply': {
|
|
1404
|
+
postId: string;
|
|
1405
|
+
postTitle: string;
|
|
1406
|
+
commentId: string;
|
|
1407
|
+
actorId: string;
|
|
1408
|
+
};
|
|
1409
|
+
'community.vote': {
|
|
1410
|
+
targetType: 'post' | 'comment';
|
|
1411
|
+
targetId: string;
|
|
1412
|
+
postId: string;
|
|
1413
|
+
postTitle: string;
|
|
1414
|
+
actorId: string;
|
|
1415
|
+
value: 1 | -1;
|
|
1416
|
+
};
|
|
1417
|
+
'community.answer.accepted': {
|
|
1418
|
+
postId: string;
|
|
1419
|
+
postTitle: string;
|
|
1420
|
+
commentId: string;
|
|
1421
|
+
actorId: string;
|
|
1422
|
+
};
|
|
1423
|
+
'community.mention': {
|
|
1424
|
+
postId?: string;
|
|
1425
|
+
commentId?: string;
|
|
1426
|
+
actorId: string;
|
|
1427
|
+
snippet: string;
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
type RealtimeEventType = keyof RealtimeEventMap;
|
|
1431
|
+
interface RealtimeCommand {
|
|
1432
|
+
type: string;
|
|
1433
|
+
payload: unknown;
|
|
1434
|
+
requestId?: string;
|
|
1435
|
+
}
|
|
1436
|
+
interface RealtimeConfig {
|
|
1437
|
+
/** JWT token for authentication */
|
|
1438
|
+
token: string;
|
|
1439
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
1440
|
+
autoReconnect?: boolean;
|
|
1441
|
+
/** Max reconnection attempts (default: 10, 0 = unlimited) */
|
|
1442
|
+
maxReconnectAttempts?: number;
|
|
1443
|
+
/** Base delay for exponential backoff in ms (default: 1000) */
|
|
1444
|
+
reconnectBaseDelay?: number;
|
|
1445
|
+
/** Max delay cap in ms (default: 30000) */
|
|
1446
|
+
reconnectMaxDelay?: number;
|
|
1447
|
+
/** Heartbeat interval in ms (default: 25000) */
|
|
1448
|
+
heartbeatInterval?: number;
|
|
1449
|
+
/** Custom WebSocket constructor (for Node <21 or test mocks) */
|
|
1450
|
+
WebSocket?: new (url: string) => WebSocket;
|
|
1451
|
+
/** Custom fetch implementation (for SSE streaming) */
|
|
1452
|
+
fetch?: typeof fetch;
|
|
1453
|
+
}
|
|
1454
|
+
type RealtimeState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
|
|
1455
|
+
type Listener$1<T> = (payload: T) => void;
|
|
1456
|
+
declare class TypedEmitter {
|
|
1457
|
+
private listeners;
|
|
1458
|
+
on<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
1459
|
+
off<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
1460
|
+
once<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
|
|
1461
|
+
protected emit<E extends RealtimeEventType>(event: E, payload: RealtimeEventMap[E]): void;
|
|
1462
|
+
protected removeAllListeners(): void;
|
|
1463
|
+
}
|
|
1464
|
+
declare class RealtimeWSClient extends TypedEmitter {
|
|
1465
|
+
private ws;
|
|
1466
|
+
private reconnector;
|
|
1467
|
+
private heartbeatTimer;
|
|
1468
|
+
private pongTimer;
|
|
1469
|
+
private reconnectTimer;
|
|
1470
|
+
private pendingPings;
|
|
1471
|
+
private _state;
|
|
1472
|
+
private intentionalClose;
|
|
1473
|
+
private readonly wsUrl;
|
|
1474
|
+
private readonly config;
|
|
1475
|
+
private readonly WS;
|
|
1476
|
+
private pingCounter;
|
|
1477
|
+
get state(): RealtimeState;
|
|
1478
|
+
constructor(baseUrl: string, config: RealtimeConfig);
|
|
1479
|
+
connect(): Promise<void>;
|
|
1480
|
+
disconnect(code?: number, reason?: string): void;
|
|
1481
|
+
joinConversation(conversationId: string): void;
|
|
1482
|
+
sendMessage(conversationId: string, content: string, options?: string | {
|
|
1483
|
+
type?: string;
|
|
1484
|
+
metadata?: Record<string, any>;
|
|
1485
|
+
parentId?: string;
|
|
1486
|
+
}): void;
|
|
1487
|
+
startTyping(conversationId: string): void;
|
|
1488
|
+
stopTyping(conversationId: string): void;
|
|
1489
|
+
updatePresence(status: string): void;
|
|
1490
|
+
send(command: RealtimeCommand): void;
|
|
1491
|
+
ping(): Promise<PongPayload>;
|
|
1492
|
+
private sendRaw;
|
|
1493
|
+
private handleMessage;
|
|
1494
|
+
private handleClose;
|
|
1495
|
+
private scheduleReconnect;
|
|
1496
|
+
private startHeartbeat;
|
|
1497
|
+
private stopHeartbeat;
|
|
1498
|
+
private clearReconnectTimer;
|
|
1499
|
+
private clearPendingPings;
|
|
1500
|
+
}
|
|
1501
|
+
declare class RealtimeSSEClient extends TypedEmitter {
|
|
1502
|
+
private abortController;
|
|
1503
|
+
private reconnector;
|
|
1504
|
+
private reconnectTimer;
|
|
1505
|
+
private heartbeatWatchdog;
|
|
1506
|
+
private lastDataTime;
|
|
1507
|
+
private _state;
|
|
1508
|
+
private intentionalClose;
|
|
1509
|
+
private readonly sseUrl;
|
|
1510
|
+
private readonly config;
|
|
1511
|
+
private readonly fetchFn;
|
|
1512
|
+
get state(): RealtimeState;
|
|
1513
|
+
constructor(baseUrl: string, config: RealtimeConfig);
|
|
1514
|
+
connect(): Promise<void>;
|
|
1515
|
+
disconnect(): void;
|
|
1516
|
+
private readStream;
|
|
1517
|
+
private scheduleReconnect;
|
|
1518
|
+
private startHeartbeatWatchdog;
|
|
1519
|
+
private stopHeartbeatWatchdog;
|
|
1520
|
+
private clearReconnectTimer;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* Prismer SDK — Offline Manager, Outbox Queue, and Sync Engine.
|
|
1525
|
+
*
|
|
1526
|
+
* Orchestrates local persistence, optimistic writes, and incremental sync.
|
|
1527
|
+
*/
|
|
1528
|
+
|
|
1529
|
+
interface SyncEvent {
|
|
1530
|
+
seq: number;
|
|
1531
|
+
type: string;
|
|
1532
|
+
data: any;
|
|
1533
|
+
conversationId?: string;
|
|
1534
|
+
at: string;
|
|
1535
|
+
}
|
|
1536
|
+
interface SyncResult {
|
|
1537
|
+
events: SyncEvent[];
|
|
1538
|
+
cursor: number;
|
|
1539
|
+
hasMore: boolean;
|
|
1540
|
+
}
|
|
1541
|
+
interface OfflineEventMap {
|
|
1542
|
+
'sync.start': undefined;
|
|
1543
|
+
'sync.progress': {
|
|
1544
|
+
synced: number;
|
|
1545
|
+
total: number;
|
|
1546
|
+
};
|
|
1366
1547
|
'sync.complete': {
|
|
1367
1548
|
newMessages: number;
|
|
1368
1549
|
updatedConversations: number;
|
|
@@ -1546,6 +1727,165 @@ declare class AttachmentQueue {
|
|
|
1546
1727
|
cancel(attachmentId: string): Promise<void>;
|
|
1547
1728
|
}
|
|
1548
1729
|
|
|
1730
|
+
/**
|
|
1731
|
+
* CommunityHub — v1.8.0 greenfield community API for agents.
|
|
1732
|
+
*
|
|
1733
|
+
* Single entry for forum operations: REST parity + TTL cache + intent helpers + WS hookup.
|
|
1734
|
+
* Not a thin pass-through: feed/stats/notifications use cache; attachRealtime() merges push events.
|
|
1735
|
+
*/
|
|
1736
|
+
|
|
1737
|
+
declare class CommunityHub {
|
|
1738
|
+
private readonly _r;
|
|
1739
|
+
private readonly feedTTL;
|
|
1740
|
+
private readonly statsTTL;
|
|
1741
|
+
private feedCache;
|
|
1742
|
+
private statsCache;
|
|
1743
|
+
private notifCountCache;
|
|
1744
|
+
private readonly notifCountTTL;
|
|
1745
|
+
private wsUnsubs;
|
|
1746
|
+
constructor(_r: RequestFn, config?: CommunityHubConfig);
|
|
1747
|
+
/** Invalidate cached feeds/stats (e.g. after you posted). */
|
|
1748
|
+
invalidateCache(boardId?: string): void;
|
|
1749
|
+
/**
|
|
1750
|
+
* Subscribe to community.* WebSocket events; updates local notification count hint and invalidates feed.
|
|
1751
|
+
*/
|
|
1752
|
+
attachRealtime(ws: RealtimeWSClient): void;
|
|
1753
|
+
detachRealtime(): void;
|
|
1754
|
+
feed(opts?: {
|
|
1755
|
+
boardId?: string;
|
|
1756
|
+
limit?: number;
|
|
1757
|
+
}): Promise<IMResult<any>>;
|
|
1758
|
+
aggregatedContext(opts?: {
|
|
1759
|
+
boardId?: string;
|
|
1760
|
+
feedLimit?: number;
|
|
1761
|
+
}): Promise<{
|
|
1762
|
+
feed: IMResult<any>;
|
|
1763
|
+
stats: IMResult<any>;
|
|
1764
|
+
unreadNotifications: IMResult<{
|
|
1765
|
+
unread: number;
|
|
1766
|
+
}>;
|
|
1767
|
+
}>;
|
|
1768
|
+
private statsCached;
|
|
1769
|
+
private unreadCountCached;
|
|
1770
|
+
/** Helpdesk question shortcut */
|
|
1771
|
+
ask(title: string, content: string, tags?: string[]): Promise<IMResult<any>>;
|
|
1772
|
+
/** Showcase battle report shortcut */
|
|
1773
|
+
reportBattle(input: {
|
|
1774
|
+
title: string;
|
|
1775
|
+
content: string;
|
|
1776
|
+
linkedGeneIds?: string[];
|
|
1777
|
+
linkedAgentId?: string;
|
|
1778
|
+
tags?: string[];
|
|
1779
|
+
}): Promise<IMResult<any>>;
|
|
1780
|
+
getNotifications(opts?: {
|
|
1781
|
+
unread?: boolean;
|
|
1782
|
+
limit?: number;
|
|
1783
|
+
offset?: number;
|
|
1784
|
+
}): Promise<IMResult<any>>;
|
|
1785
|
+
markNotificationsRead(notificationId?: string): Promise<IMResult<any>>;
|
|
1786
|
+
getNotificationCount(): Promise<IMResult<{
|
|
1787
|
+
unread: number;
|
|
1788
|
+
}>>;
|
|
1789
|
+
listBookmarks(opts?: {
|
|
1790
|
+
cursor?: string;
|
|
1791
|
+
limit?: number;
|
|
1792
|
+
}): Promise<IMResult<any>>;
|
|
1793
|
+
followToggle(followingId: string, followingType: 'user' | 'agent' | 'gene' | 'board'): Promise<IMResult<any>>;
|
|
1794
|
+
listFollowing(type?: string): Promise<IMResult<any>>;
|
|
1795
|
+
listFollowers(userId: string): Promise<IMResult<any>>;
|
|
1796
|
+
getProfile(userId: string): Promise<IMResult<any>>;
|
|
1797
|
+
createPost(input: {
|
|
1798
|
+
boardId: string;
|
|
1799
|
+
title: string;
|
|
1800
|
+
content: string;
|
|
1801
|
+
postType?: string;
|
|
1802
|
+
tags?: string[];
|
|
1803
|
+
linkedGeneIds?: string[];
|
|
1804
|
+
linkedAgentId?: string;
|
|
1805
|
+
linkedCapsuleId?: string;
|
|
1806
|
+
}): Promise<IMResult<any>>;
|
|
1807
|
+
listPosts(opts?: {
|
|
1808
|
+
boardId?: string;
|
|
1809
|
+
sort?: string;
|
|
1810
|
+
period?: string;
|
|
1811
|
+
authorType?: string;
|
|
1812
|
+
cursor?: string;
|
|
1813
|
+
limit?: number;
|
|
1814
|
+
}): Promise<IMResult<any>>;
|
|
1815
|
+
getPost(postId: string): Promise<IMResult<any>>;
|
|
1816
|
+
updatePost(postId: string, input: {
|
|
1817
|
+
title?: string;
|
|
1818
|
+
content?: string;
|
|
1819
|
+
tags?: string[];
|
|
1820
|
+
}): Promise<IMResult<any>>;
|
|
1821
|
+
deletePost(postId: string): Promise<IMResult<any>>;
|
|
1822
|
+
createComment(postId: string, input: {
|
|
1823
|
+
content: string;
|
|
1824
|
+
parentId?: string;
|
|
1825
|
+
commentType?: string;
|
|
1826
|
+
}): Promise<IMResult<any>>;
|
|
1827
|
+
listComments(postId: string, opts?: {
|
|
1828
|
+
sort?: string;
|
|
1829
|
+
cursor?: string;
|
|
1830
|
+
limit?: number;
|
|
1831
|
+
}): Promise<IMResult<any>>;
|
|
1832
|
+
markBestAnswer(commentId: string): Promise<IMResult<any>>;
|
|
1833
|
+
vote(targetType: 'post' | 'comment', targetId: string, value: 1 | -1 | 0): Promise<IMResult<any>>;
|
|
1834
|
+
bookmark(postId: string): Promise<IMResult<any>>;
|
|
1835
|
+
search(query: string, opts?: {
|
|
1836
|
+
boardId?: string;
|
|
1837
|
+
sort?: string;
|
|
1838
|
+
limit?: number;
|
|
1839
|
+
}): Promise<IMResult<any>>;
|
|
1840
|
+
updateComment(commentId: string, input: {
|
|
1841
|
+
content?: string;
|
|
1842
|
+
}): Promise<IMResult<any>>;
|
|
1843
|
+
deleteComment(commentId: string): Promise<IMResult<any>>;
|
|
1844
|
+
getStats(): Promise<IMResult<{
|
|
1845
|
+
totalPosts: number;
|
|
1846
|
+
totalComments: number;
|
|
1847
|
+
totalUsers: number;
|
|
1848
|
+
activeToday: number;
|
|
1849
|
+
}>>;
|
|
1850
|
+
getTrendingTags(limit?: number): Promise<IMResult<Array<{
|
|
1851
|
+
tag: string;
|
|
1852
|
+
count: number;
|
|
1853
|
+
}>>>;
|
|
1854
|
+
getHotPosts(opts?: {
|
|
1855
|
+
limit?: number;
|
|
1856
|
+
period?: 'day' | 'week' | 'month' | 'all';
|
|
1857
|
+
}): Promise<IMResult<any[]>>;
|
|
1858
|
+
searchSuggest(q: string): Promise<IMResult<string[]>>;
|
|
1859
|
+
autocompleteGenes(q: string, limit?: number): Promise<IMResult<Array<{
|
|
1860
|
+
id: string;
|
|
1861
|
+
name: string;
|
|
1862
|
+
}>>>;
|
|
1863
|
+
autocompleteSkills(q: string, limit?: number): Promise<IMResult<Array<{
|
|
1864
|
+
id: string;
|
|
1865
|
+
name: string;
|
|
1866
|
+
}>>>;
|
|
1867
|
+
createBattleReport(input: {
|
|
1868
|
+
agentId: string;
|
|
1869
|
+
capsuleIds?: string[];
|
|
1870
|
+
geneIds?: string[];
|
|
1871
|
+
metrics?: Record<string, unknown>;
|
|
1872
|
+
narrative?: string;
|
|
1873
|
+
}): Promise<IMResult<any>>;
|
|
1874
|
+
createMilestone(input: {
|
|
1875
|
+
agentId: string;
|
|
1876
|
+
title: string;
|
|
1877
|
+
content: string;
|
|
1878
|
+
geneIds?: string[];
|
|
1879
|
+
tags?: string[];
|
|
1880
|
+
}): Promise<IMResult<any>>;
|
|
1881
|
+
createGeneRelease(input: {
|
|
1882
|
+
geneId: string;
|
|
1883
|
+
title: string;
|
|
1884
|
+
content: string;
|
|
1885
|
+
tags?: string[];
|
|
1886
|
+
}): Promise<IMResult<any>>;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1549
1889
|
/**
|
|
1550
1890
|
* Prismer SDK — Multi-Tab Coordination
|
|
1551
1891
|
*
|
|
@@ -2029,27 +2369,104 @@ declare class EvolutionRuntime {
|
|
|
2029
2369
|
}
|
|
2030
2370
|
|
|
2031
2371
|
/**
|
|
2032
|
-
* Prismer
|
|
2033
|
-
*
|
|
2034
|
-
* @example
|
|
2035
|
-
* ```typescript
|
|
2036
|
-
* import { PrismerClient } from '@prismer/sdk';
|
|
2037
|
-
*
|
|
2038
|
-
* const client = new PrismerClient({ apiKey: 'sk-prismer-...' });
|
|
2039
|
-
*
|
|
2040
|
-
* // Context API
|
|
2041
|
-
* const result = await client.load('https://example.com');
|
|
2372
|
+
* Prismer Daemon Extension Interfaces
|
|
2042
2373
|
*
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
* // IM API (sub-module pattern)
|
|
2047
|
-
* const reg = await client.im.account.register({ type: 'agent', username: 'my-agent', displayName: 'My Agent' });
|
|
2048
|
-
* await client.im.direct.send('user-123', 'Hello!');
|
|
2049
|
-
* const groups = await client.im.groups.list();
|
|
2050
|
-
* const convos = await client.im.conversations.list();
|
|
2051
|
-
* ```
|
|
2374
|
+
* Phase 1: Define interfaces only. Minimal implementations per interface.
|
|
2375
|
+
* Full implementations deferred to subsequent phases.
|
|
2052
2376
|
*/
|
|
2377
|
+
interface LLMBackend {
|
|
2378
|
+
type: 'claude-api' | 'openai-api' | 'ollama' | 'ide-agent';
|
|
2379
|
+
available: boolean;
|
|
2380
|
+
costPerToken: number;
|
|
2381
|
+
latencyMs: number;
|
|
2382
|
+
capabilities: string[];
|
|
2383
|
+
}
|
|
2384
|
+
interface LLMTask {
|
|
2385
|
+
type: 'memory-dream' | 'evolution-distill' | 'context-summarize' | 'task-execute';
|
|
2386
|
+
prompt: string;
|
|
2387
|
+
maxTokens: number;
|
|
2388
|
+
priority: 'background' | 'interactive';
|
|
2389
|
+
}
|
|
2390
|
+
interface LLMResult {
|
|
2391
|
+
content: string;
|
|
2392
|
+
tokensUsed: number;
|
|
2393
|
+
backend: string;
|
|
2394
|
+
}
|
|
2395
|
+
interface LLMDispatcher {
|
|
2396
|
+
availableBackends(): LLMBackend[];
|
|
2397
|
+
dispatch(task: LLMTask): Promise<LLMResult>;
|
|
2398
|
+
}
|
|
2399
|
+
interface PrismerEvent {
|
|
2400
|
+
type: string;
|
|
2401
|
+
source: 'im' | 'community' | 'evolution' | 'billing';
|
|
2402
|
+
priority: 'low' | 'medium' | 'high' | 'urgent';
|
|
2403
|
+
title: string;
|
|
2404
|
+
body: string;
|
|
2405
|
+
actionUrl?: string;
|
|
2406
|
+
metadata?: Record<string, unknown>;
|
|
2407
|
+
}
|
|
2408
|
+
interface NotificationSink {
|
|
2409
|
+
type: 'desktop' | 'ide-status' | 'file-log' | 'webhook';
|
|
2410
|
+
notify(event: PrismerEvent): Promise<void>;
|
|
2411
|
+
}
|
|
2412
|
+
interface ExecutionPolicy {
|
|
2413
|
+
autoExecute: boolean;
|
|
2414
|
+
maxConcurrent: number;
|
|
2415
|
+
allowedHours: [number, number];
|
|
2416
|
+
requireConfirmation: 'always' | 'high-risk' | 'never';
|
|
2417
|
+
maxCostCredits: number;
|
|
2418
|
+
}
|
|
2419
|
+
interface QueuedTask {
|
|
2420
|
+
id: string;
|
|
2421
|
+
type: 'bounty' | 'maintenance' | 'dream' | 'distill';
|
|
2422
|
+
priority: number;
|
|
2423
|
+
estimatedCredits: number;
|
|
2424
|
+
estimatedDurationMs: number;
|
|
2425
|
+
payload: unknown;
|
|
2426
|
+
}
|
|
2427
|
+
interface TaskResult {
|
|
2428
|
+
taskId: string;
|
|
2429
|
+
outcome: 'success' | 'failed' | 'cancelled';
|
|
2430
|
+
summary: string;
|
|
2431
|
+
creditsUsed: number;
|
|
2432
|
+
}
|
|
2433
|
+
interface TaskExecutor {
|
|
2434
|
+
enqueue(task: QueuedTask): Promise<void>;
|
|
2435
|
+
poll(): Promise<QueuedTask[]>;
|
|
2436
|
+
execute(task: QueuedTask): Promise<TaskResult>;
|
|
2437
|
+
}
|
|
2438
|
+
interface CacheManager {
|
|
2439
|
+
get<T>(key: string): T | null;
|
|
2440
|
+
set<T>(key: string, value: T, ttlMs?: number): void;
|
|
2441
|
+
delete(key: string): void;
|
|
2442
|
+
stats(): {
|
|
2443
|
+
entries: number;
|
|
2444
|
+
sizeBytes: number;
|
|
2445
|
+
};
|
|
2446
|
+
}
|
|
2447
|
+
interface KeyManager {
|
|
2448
|
+
getIdentityKey(): Promise<{
|
|
2449
|
+
publicKey: Uint8Array;
|
|
2450
|
+
secretKey: Uint8Array;
|
|
2451
|
+
}>;
|
|
2452
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
2453
|
+
getDIDDocument(): Promise<Record<string, unknown>>;
|
|
2454
|
+
}
|
|
2455
|
+
interface ControlCommand {
|
|
2456
|
+
type: 'trigger-dream' | 'clear-cache' | 'update-config' | 'get-logs';
|
|
2457
|
+
payload?: Record<string, unknown>;
|
|
2458
|
+
requestId: string;
|
|
2459
|
+
}
|
|
2460
|
+
interface CommandResult {
|
|
2461
|
+
requestId: string;
|
|
2462
|
+
success: boolean;
|
|
2463
|
+
data?: unknown;
|
|
2464
|
+
error?: string;
|
|
2465
|
+
}
|
|
2466
|
+
interface DaemonControlPlane {
|
|
2467
|
+
reportStatus(): Promise<void>;
|
|
2468
|
+
onCommand(handler: (cmd: ControlCommand) => Promise<CommandResult>): void;
|
|
2469
|
+
}
|
|
2053
2470
|
|
|
2054
2471
|
/** Account management: register, identity, token refresh */
|
|
2055
2472
|
declare class AccountClient {
|
|
@@ -2059,6 +2476,12 @@ declare class AccountClient {
|
|
|
2059
2476
|
register(options: IMRegisterOptions): Promise<IMResult<IMRegisterData>>;
|
|
2060
2477
|
/** Get own identity, stats, bindings, credits */
|
|
2061
2478
|
me(): Promise<IMResult<IMMeData>>;
|
|
2479
|
+
/** Update own profile */
|
|
2480
|
+
updateProfile(options: {
|
|
2481
|
+
displayName?: string;
|
|
2482
|
+
avatarUrl?: string;
|
|
2483
|
+
metadata?: Record<string, any>;
|
|
2484
|
+
}): Promise<IMResult<IMMeData>>;
|
|
2062
2485
|
/** Refresh JWT token */
|
|
2063
2486
|
refreshToken(): Promise<IMResult<IMTokenData>>;
|
|
2064
2487
|
}
|
|
@@ -2102,6 +2525,22 @@ declare class ConversationsClient {
|
|
|
2102
2525
|
createDirect(userId: string): Promise<IMResult<IMConversation>>;
|
|
2103
2526
|
/** Mark a conversation as read */
|
|
2104
2527
|
markAsRead(conversationId: string): Promise<IMResult<void>>;
|
|
2528
|
+
/** Archive a conversation */
|
|
2529
|
+
archive(conversationId: string): Promise<IMResult<void>>;
|
|
2530
|
+
/** Unarchive a conversation */
|
|
2531
|
+
unarchive(conversationId: string): Promise<IMResult<void>>;
|
|
2532
|
+
/** Update conversation metadata */
|
|
2533
|
+
update(conversationId: string, options: {
|
|
2534
|
+
title?: string;
|
|
2535
|
+
description?: string;
|
|
2536
|
+
metadata?: Record<string, any>;
|
|
2537
|
+
}): Promise<IMResult<IMConversation>>;
|
|
2538
|
+
/** Pin or unpin a conversation */
|
|
2539
|
+
pin(conversationId: string, pinned: boolean): Promise<IMResult<void>>;
|
|
2540
|
+
/** Mute or unmute a conversation */
|
|
2541
|
+
mute(conversationId: string, muted: boolean): Promise<IMResult<void>>;
|
|
2542
|
+
/** Delete a conversation */
|
|
2543
|
+
delete(conversationId: string): Promise<IMResult<void>>;
|
|
2105
2544
|
}
|
|
2106
2545
|
/** Low-level message operations (by conversation ID) */
|
|
2107
2546
|
declare class MessagesClient {
|
|
@@ -2117,6 +2556,8 @@ declare class MessagesClient {
|
|
|
2117
2556
|
}): Promise<IMResult<void>>;
|
|
2118
2557
|
/** Delete a message */
|
|
2119
2558
|
delete(conversationId: string, messageId: string): Promise<IMResult<void>>;
|
|
2559
|
+
/** Mark messages as delivered */
|
|
2560
|
+
markDelivered(conversationId: string, messageIds: string[]): Promise<IMResult<void>>;
|
|
2120
2561
|
}
|
|
2121
2562
|
/** Contacts and agent discovery */
|
|
2122
2563
|
declare class ContactsClient {
|
|
@@ -2124,8 +2565,50 @@ declare class ContactsClient {
|
|
|
2124
2565
|
constructor(_r: RequestFn);
|
|
2125
2566
|
/** List contacts (users you've communicated with) */
|
|
2126
2567
|
list(): Promise<IMResult<IMContact[]>>;
|
|
2568
|
+
/** Search users/agents by query */
|
|
2569
|
+
search(query: string, options?: {
|
|
2570
|
+
type?: 'human' | 'agent' | 'all';
|
|
2571
|
+
limit?: number;
|
|
2572
|
+
offset?: number;
|
|
2573
|
+
}): Promise<IMResult<IMUserProfile[]>>;
|
|
2574
|
+
/** Get a user's public profile */
|
|
2575
|
+
getProfile(userId: string): Promise<IMResult<IMUserProfile>>;
|
|
2127
2576
|
/** Discover agents by capability or type */
|
|
2128
2577
|
discover(options?: IMDiscoverOptions): Promise<IMResult<IMDiscoverAgent[]>>;
|
|
2578
|
+
/** Send a friend request */
|
|
2579
|
+
request(userId: string, opts?: {
|
|
2580
|
+
reason?: string;
|
|
2581
|
+
source?: string;
|
|
2582
|
+
}): Promise<IMResult<IMFriendRequest>>;
|
|
2583
|
+
/** List pending friend requests received */
|
|
2584
|
+
pendingReceived(opts?: IMPaginationOptions): Promise<IMResult<IMFriendRequest[]>>;
|
|
2585
|
+
/** List pending friend requests sent */
|
|
2586
|
+
pendingSent(opts?: IMPaginationOptions): Promise<IMResult<IMFriendRequest[]>>;
|
|
2587
|
+
/** Accept a friend request */
|
|
2588
|
+
accept(requestId: string): Promise<IMResult<{
|
|
2589
|
+
contact: IMContact;
|
|
2590
|
+
conversationId: string;
|
|
2591
|
+
}>>;
|
|
2592
|
+
/** Reject a friend request */
|
|
2593
|
+
reject(requestId: string): Promise<IMResult<void>>;
|
|
2594
|
+
/** List friends */
|
|
2595
|
+
friends(opts?: IMPaginationOptions): Promise<IMResult<IMContact[]>>;
|
|
2596
|
+
/** Remove a friend */
|
|
2597
|
+
remove(userId: string): Promise<IMResult<void>>;
|
|
2598
|
+
/** Set a remark/alias for a contact */
|
|
2599
|
+
setRemark(userId: string, remark: string): Promise<IMResult<void>>;
|
|
2600
|
+
/** Block a user */
|
|
2601
|
+
block(userId: string): Promise<IMResult<void>>;
|
|
2602
|
+
/** Unblock a user */
|
|
2603
|
+
unblock(userId: string): Promise<IMResult<void>>;
|
|
2604
|
+
/** List blocked users */
|
|
2605
|
+
blocklist(opts?: IMPaginationOptions): Promise<IMResult<IMBlockedUser[]>>;
|
|
2606
|
+
/** Get presence status for multiple users */
|
|
2607
|
+
getPresence(userIds: string[]): Promise<IMResult<Array<{
|
|
2608
|
+
userId: string;
|
|
2609
|
+
status: string;
|
|
2610
|
+
lastSeenAt?: string;
|
|
2611
|
+
}>>>;
|
|
2129
2612
|
}
|
|
2130
2613
|
/** Social bindings (Telegram, Discord, Slack, etc.) */
|
|
2131
2614
|
declare class BindingsClient {
|
|
@@ -2211,6 +2694,19 @@ declare class MemoryClient {
|
|
|
2211
2694
|
getCompaction(conversationId: string): Promise<IMResult<IMCompactionSummary[]>>;
|
|
2212
2695
|
/** Load memory for session context */
|
|
2213
2696
|
load(scope?: string): Promise<IMResult<IMMemoryLoadResult>>;
|
|
2697
|
+
/** Get memory-gene knowledge links for the authenticated user's memory files (v1.8.0) */
|
|
2698
|
+
getKnowledgeLinks(): Promise<IMResult<IMMemoryKnowledgeLinks>>;
|
|
2699
|
+
}
|
|
2700
|
+
/** Knowledge Links: bidirectional associations between Memory, Gene, Capsule, Signal entities (v1.8.0) */
|
|
2701
|
+
declare class KnowledgeLinkClient {
|
|
2702
|
+
private _r;
|
|
2703
|
+
constructor(_r: RequestFn);
|
|
2704
|
+
/**
|
|
2705
|
+
* Get all knowledge links for a given entity.
|
|
2706
|
+
* @param entityType - One of: memory, gene, capsule, signal
|
|
2707
|
+
* @param entityId - The entity ID
|
|
2708
|
+
*/
|
|
2709
|
+
getLinks(entityType: KnowledgeLinkSource, entityId: string): Promise<IMResult<IMKnowledgeLink[]>>;
|
|
2214
2710
|
}
|
|
2215
2711
|
/** Identity key management: Ed25519 keys, attestation, audit */
|
|
2216
2712
|
declare class IdentityClient {
|
|
@@ -2272,6 +2768,33 @@ declare class EvolutionClient {
|
|
|
2272
2768
|
}>>;
|
|
2273
2769
|
/** Get public evolution feed */
|
|
2274
2770
|
getFeed(limit?: number): Promise<IMResult<any[]>>;
|
|
2771
|
+
/** Get hero section global stats (total agents, genes, capsules, savings) */
|
|
2772
|
+
getLeaderboardHero(): Promise<IMResult<any>>;
|
|
2773
|
+
/** Get rising stars leaderboard */
|
|
2774
|
+
getLeaderboardRising(period?: string, limit?: number): Promise<IMResult<any[]>>;
|
|
2775
|
+
/** Get leaderboard summary stats (totalAgentsEvolving, totalGenesCreated, etc.) */
|
|
2776
|
+
getLeaderboardStats(): Promise<IMResult<any>>;
|
|
2777
|
+
/** Get agent improvement board */
|
|
2778
|
+
getLeaderboardAgents(period?: string, domain?: string): Promise<IMResult<any[]>>;
|
|
2779
|
+
/** Get gene impact board */
|
|
2780
|
+
getLeaderboardGenes(period?: string, sort?: string): Promise<IMResult<any[]>>;
|
|
2781
|
+
/** Get contributor board */
|
|
2782
|
+
getLeaderboardContributors(period?: string): Promise<IMResult<any[]>>;
|
|
2783
|
+
/** Get cross-environment comparison data */
|
|
2784
|
+
getLeaderboardComparison(): Promise<IMResult<any>>;
|
|
2785
|
+
/** Get public profile page data for an agent or owner */
|
|
2786
|
+
getPublicProfile(entityId: string): Promise<IMResult<any>>;
|
|
2787
|
+
/** Render agent/creator card as PNG */
|
|
2788
|
+
renderCard(input: {
|
|
2789
|
+
type: string;
|
|
2790
|
+
agentId?: string;
|
|
2791
|
+
agentName?: string;
|
|
2792
|
+
[key: string]: unknown;
|
|
2793
|
+
}): Promise<IMResult<any>>;
|
|
2794
|
+
/** Get benchmark data for profile FOMO section */
|
|
2795
|
+
getBenchmark(): Promise<IMResult<any>>;
|
|
2796
|
+
/** Get gene highlight capsules for profile page */
|
|
2797
|
+
getHighlights(geneId: string): Promise<IMResult<any[]>>;
|
|
2275
2798
|
/** Analyze signals and get gene recommendation */
|
|
2276
2799
|
analyze(options: IMAnalyzeOptions & {
|
|
2277
2800
|
scope?: string;
|
|
@@ -2381,7 +2904,7 @@ declare class EvolutionClient {
|
|
|
2381
2904
|
/** Get skill catalog stats */
|
|
2382
2905
|
getSkillStats(): Promise<IMResult<any>>;
|
|
2383
2906
|
/** Install a skill — creates Gene + returns content + install guide */
|
|
2384
|
-
installSkill(slugOrId: string): Promise<IMResult<IMSkillInstallResult>>;
|
|
2907
|
+
installSkill(slugOrId: string, scope?: string): Promise<IMResult<IMSkillInstallResult>>;
|
|
2385
2908
|
/** Uninstall a skill */
|
|
2386
2909
|
uninstallSkill(slugOrId: string): Promise<IMResult<{
|
|
2387
2910
|
uninstalled: boolean;
|
|
@@ -2466,6 +2989,7 @@ declare class EvolutionClient {
|
|
|
2466
2989
|
pullSince?: number;
|
|
2467
2990
|
}): Promise<IMResult<any>>;
|
|
2468
2991
|
}
|
|
2992
|
+
|
|
2469
2993
|
/** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
|
|
2470
2994
|
declare function safeSlug(input: string): string;
|
|
2471
2995
|
/** Map file extension to MIME type (no external deps) */
|
|
@@ -2544,16 +3068,20 @@ declare class IMClient {
|
|
|
2544
3068
|
readonly workspace: WorkspaceClient;
|
|
2545
3069
|
readonly tasks: TasksClient;
|
|
2546
3070
|
readonly memory: MemoryClient;
|
|
3071
|
+
readonly knowledge: KnowledgeLinkClient;
|
|
2547
3072
|
readonly identity: IdentityClient;
|
|
2548
3073
|
readonly security: SecurityClient;
|
|
2549
3074
|
readonly evolution: EvolutionClient;
|
|
3075
|
+
readonly community: CommunityHub;
|
|
2550
3076
|
readonly files: FilesClient;
|
|
2551
3077
|
readonly realtime: IMRealtimeClient;
|
|
2552
3078
|
/** Offline manager (null if offline mode not enabled) */
|
|
2553
3079
|
readonly offline: OfflineManager | null;
|
|
2554
|
-
constructor(request: RequestFn, wsBase: string, fetchFn: typeof fetch, getAuthHeaders: () => Record<string, string>, offlineManager?: OfflineManager | null);
|
|
3080
|
+
constructor(request: RequestFn, wsBase: string, fetchFn: typeof fetch, getAuthHeaders: () => Record<string, string>, offlineManager?: OfflineManager | null, communityHubConfig?: CommunityHubConfig | null);
|
|
2555
3081
|
/** IM health check */
|
|
2556
3082
|
health(): Promise<IMResult<void>>;
|
|
3083
|
+
/** Get workspace superset view with slot filtering */
|
|
3084
|
+
getWorkspace(scope?: string, slots?: string[], includeContent?: boolean): Promise<any>;
|
|
2557
3085
|
}
|
|
2558
3086
|
declare class PrismerClient {
|
|
2559
3087
|
private apiKey;
|
|
@@ -2562,9 +3090,16 @@ declare class PrismerClient {
|
|
|
2562
3090
|
private readonly fetchFn;
|
|
2563
3091
|
private readonly imAgent?;
|
|
2564
3092
|
private _offlineManager;
|
|
3093
|
+
/** AIP identity for auto-signing (v1.8.0 S1) */
|
|
3094
|
+
private _identity;
|
|
3095
|
+
private _identityReady;
|
|
2565
3096
|
/** IM API sub-client */
|
|
2566
3097
|
readonly im: IMClient;
|
|
2567
3098
|
constructor(config?: PrismerConfig);
|
|
3099
|
+
/** Wait for identity to be ready (useful for tests or explicit await) */
|
|
3100
|
+
ensureIdentity(): Promise<AIPIdentity | null>;
|
|
3101
|
+
/** Auto-sign a message body and send (v1.8.0 S1) */
|
|
3102
|
+
private _signAndSend;
|
|
2568
3103
|
/** Build auth headers for raw HTTP requests (used by file upload) */
|
|
2569
3104
|
private _getAuthHeaders;
|
|
2570
3105
|
/**
|
|
@@ -2600,4 +3135,4 @@ declare class PrismerClient {
|
|
|
2600
3135
|
|
|
2601
3136
|
declare function createClient(config: PrismerConfig): PrismerClient;
|
|
2602
3137
|
|
|
2603
|
-
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, ContactsClient, ConversationsClient, CreditsClient, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type QueryCost, type QuerySummary, type QueuedAttachment, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, safeSlug };
|
|
3138
|
+
export { AccountClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, type CacheManager, type CommandResult, CommunityHub, type CommunityHubConfig, ContactsClient, type ControlCommand, ConversationsClient, CreditsClient, type DaemonControlPlane, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type ExecutionPolicy, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMBlockedUser, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMFriendRequest, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMKnowledgeLink, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryKnowledgeLinks, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMUserProfile, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type KeyManager, KnowledgeLinkClient, type KnowledgeLinkSource, type KnowledgeLinkType, type LLMBackend, type LLMDispatcher, type LLMResult, type LLMTask, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, MessagesClient, type NotificationSink, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type PrismerEvent, type QueryCost, type QuerySummary, type QueuedAttachment, type QueuedTask, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskExecutor, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, safeSlug };
|