@prismer/sdk 1.7.3 → 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/dist/index.d.mts CHANGED
@@ -1,182 +1,5 @@
1
- /**
2
- * Prismer Cloud Real-Time Client WebSocket & SSE transports.
3
- *
4
- * @example
5
- * ```typescript
6
- * const ws = client.im.connectWS({ token: jwtToken });
7
- * await ws.connect();
8
- *
9
- * ws.on('message.new', (msg) => console.log(msg.content));
10
- * ws.joinConversation('conv-123');
11
- * ws.sendMessage('conv-123', 'Hello!');
12
- *
13
- * // SSE (server-push only, auto-joins all conversations)
14
- * const sse = client.im.connectSSE({ token: jwtToken });
15
- * await sse.connect();
16
- * sse.on('message.new', (msg) => console.log(msg.content));
17
- * ```
18
- */
19
- interface AuthenticatedPayload {
20
- userId: string;
21
- username: string;
22
- }
23
- interface MessageNewPayload {
24
- id: string;
25
- conversationId: string;
26
- content: string;
27
- type: string;
28
- senderId: string;
29
- routing?: {
30
- mode: string;
31
- targets: Array<{
32
- userId: string;
33
- username?: string;
34
- }>;
35
- };
36
- metadata?: Record<string, any>;
37
- createdAt: string;
38
- }
39
- interface MessageEditPayload {
40
- id: string;
41
- conversationId: string;
42
- content: string;
43
- type: string;
44
- editedAt: string;
45
- editedBy: string;
46
- metadata?: Record<string, any>;
47
- }
48
- interface MessageDeletedPayload {
49
- id: string;
50
- conversationId: string;
51
- }
52
- interface TypingIndicatorPayload {
53
- conversationId: string;
54
- userId: string;
55
- isTyping: boolean;
56
- }
57
- interface PresenceChangedPayload {
58
- userId: string;
59
- status: string;
60
- }
61
- interface PongPayload {
62
- requestId: string;
63
- }
64
- interface ErrorPayload {
65
- message: string;
66
- }
67
- interface DisconnectedPayload {
68
- code: number;
69
- reason: string;
70
- }
71
- interface ReconnectingPayload {
72
- attempt: number;
73
- delayMs: number;
74
- }
75
- interface RealtimeEventMap {
76
- 'authenticated': AuthenticatedPayload;
77
- 'message.new': MessageNewPayload;
78
- 'message.edit': MessageEditPayload;
79
- 'message.deleted': MessageDeletedPayload;
80
- 'typing.indicator': TypingIndicatorPayload;
81
- 'presence.changed': PresenceChangedPayload;
82
- 'pong': PongPayload;
83
- 'error': ErrorPayload;
84
- 'connected': undefined;
85
- 'disconnected': DisconnectedPayload;
86
- 'reconnecting': ReconnectingPayload;
87
- }
88
- type RealtimeEventType = keyof RealtimeEventMap;
89
- interface RealtimeCommand {
90
- type: string;
91
- payload: unknown;
92
- requestId?: string;
93
- }
94
- interface RealtimeConfig {
95
- /** JWT token for authentication */
96
- token: string;
97
- /** Auto-reconnect on disconnect (default: true) */
98
- autoReconnect?: boolean;
99
- /** Max reconnection attempts (default: 10, 0 = unlimited) */
100
- maxReconnectAttempts?: number;
101
- /** Base delay for exponential backoff in ms (default: 1000) */
102
- reconnectBaseDelay?: number;
103
- /** Max delay cap in ms (default: 30000) */
104
- reconnectMaxDelay?: number;
105
- /** Heartbeat interval in ms (default: 25000) */
106
- heartbeatInterval?: number;
107
- /** Custom WebSocket constructor (for Node <21 or test mocks) */
108
- WebSocket?: new (url: string) => WebSocket;
109
- /** Custom fetch implementation (for SSE streaming) */
110
- fetch?: typeof fetch;
111
- }
112
- type RealtimeState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
113
- type Listener$1<T> = (payload: T) => void;
114
- declare class TypedEmitter {
115
- private listeners;
116
- on<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
117
- off<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
118
- once<E extends RealtimeEventType>(event: E, cb: Listener$1<RealtimeEventMap[E]>): this;
119
- protected emit<E extends RealtimeEventType>(event: E, payload: RealtimeEventMap[E]): void;
120
- protected removeAllListeners(): void;
121
- }
122
- declare class RealtimeWSClient extends TypedEmitter {
123
- private ws;
124
- private reconnector;
125
- private heartbeatTimer;
126
- private pongTimer;
127
- private reconnectTimer;
128
- private pendingPings;
129
- private _state;
130
- private intentionalClose;
131
- private readonly wsUrl;
132
- private readonly config;
133
- private readonly WS;
134
- private pingCounter;
135
- get state(): RealtimeState;
136
- constructor(baseUrl: string, config: RealtimeConfig);
137
- connect(): Promise<void>;
138
- disconnect(code?: number, reason?: string): void;
139
- joinConversation(conversationId: string): void;
140
- sendMessage(conversationId: string, content: string, options?: string | {
141
- type?: string;
142
- metadata?: Record<string, any>;
143
- parentId?: string;
144
- }): void;
145
- startTyping(conversationId: string): void;
146
- stopTyping(conversationId: string): void;
147
- updatePresence(status: string): void;
148
- send(command: RealtimeCommand): void;
149
- ping(): Promise<PongPayload>;
150
- private sendRaw;
151
- private handleMessage;
152
- private handleClose;
153
- private scheduleReconnect;
154
- private startHeartbeat;
155
- private stopHeartbeat;
156
- private clearReconnectTimer;
157
- private clearPendingPings;
158
- }
159
- declare class RealtimeSSEClient extends TypedEmitter {
160
- private abortController;
161
- private reconnector;
162
- private reconnectTimer;
163
- private heartbeatWatchdog;
164
- private lastDataTime;
165
- private _state;
166
- private intentionalClose;
167
- private readonly sseUrl;
168
- private readonly config;
169
- private readonly fetchFn;
170
- get state(): RealtimeState;
171
- constructor(baseUrl: string, config: RealtimeConfig);
172
- connect(): Promise<void>;
173
- disconnect(): void;
174
- private readStream;
175
- private scheduleReconnect;
176
- private startHeartbeatWatchdog;
177
- private stopHeartbeatWatchdog;
178
- private clearReconnectTimer;
179
- }
1
+ import { AIPIdentity } from '@prismer/aip-sdk';
2
+ export { AIPIdentity, DIDDocument, SignedPayload } from '@prismer/aip-sdk';
180
3
 
181
4
  /**
182
5
  * Prismer SDK — Storage adapters for offline-first IM.
@@ -230,7 +53,7 @@ interface StoredContact {
230
53
  }
231
54
  interface OutboxOperation {
232
55
  id: string;
233
- 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';
234
57
  method: string;
235
58
  path: string;
236
59
  body?: unknown;
@@ -437,6 +260,22 @@ interface PrismerConfig {
437
260
  imAgent?: string;
438
261
  /** Enable offline-first mode for IM with local persistence and sync */
439
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;
440
279
  }
441
280
  interface LoadOptions {
442
281
  inputType?: 'auto' | 'url' | 'urls' | 'query';
@@ -715,12 +554,65 @@ interface IMGroupData {
715
554
  members: IMGroupMember[];
716
555
  }
717
556
  interface IMContact {
557
+ userId: string;
718
558
  username: string;
719
559
  displayName: string;
720
560
  role: string;
561
+ avatarUrl?: string;
562
+ isAgent?: boolean;
563
+ institution?: string;
564
+ lastSeenAt?: string;
565
+ remark?: string;
566
+ addedAt?: string;
721
567
  lastMessageAt?: string;
568
+ lastMessage?: string;
722
569
  unreadCount: number;
723
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;
724
616
  }
725
617
  interface IMDiscoverAgent {
726
618
  username: string;
@@ -761,6 +653,9 @@ interface IMConversation {
761
653
  lastMessage?: IMMessage;
762
654
  unreadCount?: number;
763
655
  members?: IMGroupMember[];
656
+ pinned?: boolean;
657
+ muted?: boolean;
658
+ archived?: boolean;
764
659
  createdAt: string;
765
660
  updatedAt?: string;
766
661
  }
@@ -808,6 +703,8 @@ interface IMSendOptions {
808
703
  type?: 'text' | 'markdown' | 'code' | 'image' | 'file' | 'tool_call' | 'tool_result' | 'system_event' | 'thinking';
809
704
  metadata?: Record<string, any>;
810
705
  parentId?: string;
706
+ /** Override auto-signing for this message (e.g., skip signing for system_event) */
707
+ skipSigning?: boolean;
811
708
  }
812
709
  interface IMPaginationOptions {
813
710
  limit?: number;
@@ -1067,6 +964,34 @@ interface IMMemoryLoadResult {
1067
964
  path: string;
1068
965
  template: string;
1069
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
+ }
1070
995
  type DerivationMode = 'generated' | 'derived' | 'imported';
1071
996
  interface IMRegisterKeyOptions {
1072
997
  publicKey: string;
@@ -1338,30 +1263,288 @@ interface EvolutionSyncDelta {
1338
1263
  }
1339
1264
 
1340
1265
  /**
1341
- * Prismer SDK Offline Manager, Outbox Queue, and Sync Engine.
1266
+ * Prismer Cloud Real-Time Client WebSocket & SSE transports.
1342
1267
  *
1343
- * Orchestrates local persistence, optimistic writes, and incremental sync.
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
+ * ```
1344
1282
  */
1345
-
1346
- interface SyncEvent {
1347
- seq: number;
1348
- type: string;
1349
- data: any;
1350
- conversationId?: string;
1351
- at: string;
1352
- }
1353
- interface SyncResult {
1354
- events: SyncEvent[];
1355
- cursor: number;
1356
- hasMore: boolean;
1283
+ interface AuthenticatedPayload {
1284
+ userId: string;
1285
+ username: string;
1357
1286
  }
1358
- interface OfflineEventMap {
1359
- 'sync.start': undefined;
1360
- 'sync.progress': {
1361
- synced: number;
1362
- total: number;
1363
- };
1364
- 'sync.complete': {
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
+ };
1547
+ 'sync.complete': {
1365
1548
  newMessages: number;
1366
1549
  updatedConversations: number;
1367
1550
  };
@@ -1544,6 +1727,165 @@ declare class AttachmentQueue {
1544
1727
  cancel(attachmentId: string): Promise<void>;
1545
1728
  }
1546
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
+
1547
1889
  /**
1548
1890
  * Prismer SDK — Multi-Tab Coordination
1549
1891
  *
@@ -1621,8 +1963,17 @@ declare class E2EEncryption {
1621
1963
  /**
1622
1964
  * Initialize encryption with user passphrase.
1623
1965
  * Derives a master key via PBKDF2 and generates an ECDH key pair.
1966
+ *
1967
+ * @param passphrase - User passphrase for master key derivation
1968
+ * @param salt - Optional Base64-encoded salt. If omitted, a random 16-byte salt is generated.
1969
+ * Store the salt (via exportSalt()) so you can re-derive the same master key later.
1624
1970
  */
1625
- init(passphrase: string): Promise<void>;
1971
+ init(passphrase: string, salt?: string): Promise<void>;
1972
+ /**
1973
+ * Export the salt as Base64 string for persistent storage.
1974
+ * You must store this and pass it back to init() to re-derive the same master key.
1975
+ */
1976
+ exportSalt(): string;
1626
1977
  /**
1627
1978
  * Export public key for sharing with conversation peers.
1628
1979
  */
@@ -1664,6 +2015,45 @@ declare class E2EEncryption {
1664
2015
  * Clear all keys and reset state.
1665
2016
  */
1666
2017
  destroy(): void;
2018
+ private messageCount;
2019
+ private static readonly KEY_ROTATION_THRESHOLD;
2020
+ private static readonly KEY_ROTATION_INTERVAL_MS;
2021
+ private lastRotation;
2022
+ /**
2023
+ * High-level encrypt-for-send pipeline.
2024
+ * Encrypts content, builds metadata, and handles key rotation.
2025
+ *
2026
+ * Returns { encryptedContent, metadata } ready to send.
2027
+ */
2028
+ encryptForSend(conversationId: string, content: string): Promise<{
2029
+ encryptedContent: string;
2030
+ metadata: Record<string, any>;
2031
+ }>;
2032
+ /**
2033
+ * High-level decrypt-on-receive pipeline.
2034
+ * Decrypts content and validates metadata.
2035
+ */
2036
+ decryptOnReceive(conversationId: string, encryptedContent: string, metadata?: Record<string, any>): Promise<string>;
2037
+ /**
2038
+ * High-level file encryption pipeline.
2039
+ */
2040
+ encryptFile(conversationId: string, fileData: ArrayBuffer): Promise<{
2041
+ encryptedData: string;
2042
+ metadata: Record<string, any>;
2043
+ }>;
2044
+ /**
2045
+ * High-level file decryption pipeline.
2046
+ */
2047
+ decryptFile(conversationId: string, encryptedData: string): Promise<ArrayBuffer>;
2048
+ /**
2049
+ * Check if key rotation is needed (1000 messages or 24 hours).
2050
+ */
2051
+ private shouldRotateKey;
2052
+ /**
2053
+ * Perform key rotation: generate new ECDH keypair and reset counters.
2054
+ * The caller is responsible for re-exchanging keys with peers.
2055
+ */
2056
+ rotateKeys(): Promise<JsonWebKey>;
1667
2057
  }
1668
2058
 
1669
2059
  /**
@@ -1979,27 +2369,104 @@ declare class EvolutionRuntime {
1979
2369
  }
1980
2370
 
1981
2371
  /**
1982
- * Prismer Cloud SDK for TypeScript/JavaScript
1983
- *
1984
- * @example
1985
- * ```typescript
1986
- * import { PrismerClient } from '@prismer/sdk';
1987
- *
1988
- * const client = new PrismerClient({ apiKey: 'sk-prismer-...' });
2372
+ * Prismer Daemon Extension Interfaces
1989
2373
  *
1990
- * // Context API
1991
- * const result = await client.load('https://example.com');
1992
- *
1993
- * // Parse API
1994
- * const pdf = await client.parsePdf('https://arxiv.org/pdf/2401.00001.pdf');
1995
- *
1996
- * // IM API (sub-module pattern)
1997
- * const reg = await client.im.account.register({ type: 'agent', username: 'my-agent', displayName: 'My Agent' });
1998
- * await client.im.direct.send('user-123', 'Hello!');
1999
- * const groups = await client.im.groups.list();
2000
- * const convos = await client.im.conversations.list();
2001
- * ```
2374
+ * Phase 1: Define interfaces only. Minimal implementations per interface.
2375
+ * Full implementations deferred to subsequent phases.
2002
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
+ }
2003
2470
 
2004
2471
  /** Account management: register, identity, token refresh */
2005
2472
  declare class AccountClient {
@@ -2009,6 +2476,12 @@ declare class AccountClient {
2009
2476
  register(options: IMRegisterOptions): Promise<IMResult<IMRegisterData>>;
2010
2477
  /** Get own identity, stats, bindings, credits */
2011
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>>;
2012
2485
  /** Refresh JWT token */
2013
2486
  refreshToken(): Promise<IMResult<IMTokenData>>;
2014
2487
  }
@@ -2052,6 +2525,22 @@ declare class ConversationsClient {
2052
2525
  createDirect(userId: string): Promise<IMResult<IMConversation>>;
2053
2526
  /** Mark a conversation as read */
2054
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>>;
2055
2544
  }
2056
2545
  /** Low-level message operations (by conversation ID) */
2057
2546
  declare class MessagesClient {
@@ -2067,6 +2556,8 @@ declare class MessagesClient {
2067
2556
  }): Promise<IMResult<void>>;
2068
2557
  /** Delete a message */
2069
2558
  delete(conversationId: string, messageId: string): Promise<IMResult<void>>;
2559
+ /** Mark messages as delivered */
2560
+ markDelivered(conversationId: string, messageIds: string[]): Promise<IMResult<void>>;
2070
2561
  }
2071
2562
  /** Contacts and agent discovery */
2072
2563
  declare class ContactsClient {
@@ -2074,8 +2565,50 @@ declare class ContactsClient {
2074
2565
  constructor(_r: RequestFn);
2075
2566
  /** List contacts (users you've communicated with) */
2076
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>>;
2077
2576
  /** Discover agents by capability or type */
2078
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
+ }>>>;
2079
2612
  }
2080
2613
  /** Social bindings (Telegram, Discord, Slack, etc.) */
2081
2614
  declare class BindingsClient {
@@ -2161,6 +2694,19 @@ declare class MemoryClient {
2161
2694
  getCompaction(conversationId: string): Promise<IMResult<IMCompactionSummary[]>>;
2162
2695
  /** Load memory for session context */
2163
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[]>>;
2164
2710
  }
2165
2711
  /** Identity key management: Ed25519 keys, attestation, audit */
2166
2712
  declare class IdentityClient {
@@ -2222,6 +2768,33 @@ declare class EvolutionClient {
2222
2768
  }>>;
2223
2769
  /** Get public evolution feed */
2224
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[]>>;
2225
2798
  /** Analyze signals and get gene recommendation */
2226
2799
  analyze(options: IMAnalyzeOptions & {
2227
2800
  scope?: string;
@@ -2331,7 +2904,7 @@ declare class EvolutionClient {
2331
2904
  /** Get skill catalog stats */
2332
2905
  getSkillStats(): Promise<IMResult<any>>;
2333
2906
  /** Install a skill — creates Gene + returns content + install guide */
2334
- installSkill(slugOrId: string): Promise<IMResult<IMSkillInstallResult>>;
2907
+ installSkill(slugOrId: string, scope?: string): Promise<IMResult<IMSkillInstallResult>>;
2335
2908
  /** Uninstall a skill */
2336
2909
  uninstallSkill(slugOrId: string): Promise<IMResult<{
2337
2910
  uninstalled: boolean;
@@ -2340,6 +2913,22 @@ declare class EvolutionClient {
2340
2913
  installedSkills(): Promise<IMResult<IMAgentSkillRecord[]>>;
2341
2914
  /** Get full skill content (SKILL.md + package info) */
2342
2915
  getSkillContent(slugOrId: string): Promise<IMResult<IMSkillContent>>;
2916
+ /** Create/submit a community skill */
2917
+ createSkill(input: {
2918
+ name: string;
2919
+ description: string;
2920
+ category: string;
2921
+ tags?: string[];
2922
+ content?: string;
2923
+ signals?: Array<{
2924
+ type: string;
2925
+ }>;
2926
+ author?: string;
2927
+ }): Promise<IMResult<any>>;
2928
+ /** Star a skill (increment community rating) */
2929
+ starSkill(skillId: string): Promise<IMResult<{
2930
+ stars: number;
2931
+ }>>;
2343
2932
  /**
2344
2933
  * Install a skill and write SKILL.md to local filesystem.
2345
2934
  * Combines cloud install + local file sync for Claude Code / OpenClaw / OpenCode.
@@ -2400,6 +2989,11 @@ declare class EvolutionClient {
2400
2989
  pullSince?: number;
2401
2990
  }): Promise<IMResult<any>>;
2402
2991
  }
2992
+
2993
+ /** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
2994
+ declare function safeSlug(input: string): string;
2995
+ /** Map file extension to MIME type (no external deps) */
2996
+ declare function guessMimeType(fileName: string): string;
2403
2997
  /** File upload management (presign → upload → confirm) */
2404
2998
  declare class FilesClient {
2405
2999
  private _r;
@@ -2474,16 +3068,20 @@ declare class IMClient {
2474
3068
  readonly workspace: WorkspaceClient;
2475
3069
  readonly tasks: TasksClient;
2476
3070
  readonly memory: MemoryClient;
3071
+ readonly knowledge: KnowledgeLinkClient;
2477
3072
  readonly identity: IdentityClient;
2478
3073
  readonly security: SecurityClient;
2479
3074
  readonly evolution: EvolutionClient;
3075
+ readonly community: CommunityHub;
2480
3076
  readonly files: FilesClient;
2481
3077
  readonly realtime: IMRealtimeClient;
2482
3078
  /** Offline manager (null if offline mode not enabled) */
2483
3079
  readonly offline: OfflineManager | null;
2484
- 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);
2485
3081
  /** IM health check */
2486
3082
  health(): Promise<IMResult<void>>;
3083
+ /** Get workspace superset view with slot filtering */
3084
+ getWorkspace(scope?: string, slots?: string[], includeContent?: boolean): Promise<any>;
2487
3085
  }
2488
3086
  declare class PrismerClient {
2489
3087
  private apiKey;
@@ -2492,9 +3090,16 @@ declare class PrismerClient {
2492
3090
  private readonly fetchFn;
2493
3091
  private readonly imAgent?;
2494
3092
  private _offlineManager;
3093
+ /** AIP identity for auto-signing (v1.8.0 S1) */
3094
+ private _identity;
3095
+ private _identityReady;
2495
3096
  /** IM API sub-client */
2496
3097
  readonly im: IMClient;
2497
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;
2498
3103
  /** Build auth headers for raw HTTP requests (used by file upload) */
2499
3104
  private _getAuthHeaders;
2500
3105
  /**
@@ -2530,4 +3135,4 @@ declare class PrismerClient {
2530
3135
 
2531
3136
  declare function createClient(config: PrismerConfig): PrismerClient;
2532
3137
 
2533
- 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 };
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 };