@pingagent/sdk 0.1.1 → 0.1.2
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/bin/pingagent.js +111 -6
- package/dist/chunk-MDGELIR5.js +1317 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/web-server.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +2 -0
- package/src/ws-subscription.ts +3 -0
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,8 @@ interface ConversationEntry {
|
|
|
151
151
|
target_did: string;
|
|
152
152
|
trusted: boolean;
|
|
153
153
|
created_at: number;
|
|
154
|
+
/** Server-side last message write time (ms). Omitted or null when unknown; client should fetch when missing. */
|
|
155
|
+
last_activity_at?: number | null;
|
|
154
156
|
}
|
|
155
157
|
interface ConversationListResponse {
|
|
156
158
|
conversations: ConversationEntry[];
|
|
@@ -473,6 +475,8 @@ interface WsSubscriptionOptions {
|
|
|
473
475
|
onMessage: (envelope: any, conversationId: string) => void;
|
|
474
476
|
onControl?: (control: WsControlPayload, conversationId: string) => void;
|
|
475
477
|
onError?: (err: Error) => void;
|
|
478
|
+
/** Called when a WebSocket opens or reopens; e.g. Skill can run catchUp to fill gaps. */
|
|
479
|
+
onOpen?: (conversationId: string) => void;
|
|
476
480
|
}
|
|
477
481
|
declare class WsSubscription {
|
|
478
482
|
private opts;
|
package/dist/index.js
CHANGED
package/dist/web-server.js
CHANGED
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -62,6 +62,8 @@ export interface ConversationEntry {
|
|
|
62
62
|
target_did: string;
|
|
63
63
|
trusted: boolean;
|
|
64
64
|
created_at: number;
|
|
65
|
+
/** Server-side last message write time (ms). Omitted or null when unknown; client should fetch when missing. */
|
|
66
|
+
last_activity_at?: number | null;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
export interface ConversationListResponse {
|
package/src/ws-subscription.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface WsSubscriptionOptions {
|
|
|
19
19
|
onMessage: (envelope: any, conversationId: string) => void;
|
|
20
20
|
onControl?: (control: WsControlPayload, conversationId: string) => void;
|
|
21
21
|
onError?: (err: Error) => void;
|
|
22
|
+
/** Called when a WebSocket opens or reopens; e.g. Skill can run catchUp to fill gaps. */
|
|
23
|
+
onOpen?: (conversationId: string) => void;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const RECONNECT_BASE_MS = 1000;
|
|
@@ -106,6 +108,7 @@ export class WsSubscription {
|
|
|
106
108
|
|
|
107
109
|
ws.on('open', () => {
|
|
108
110
|
this.reconnectAttempts.set(conversationId, 0);
|
|
111
|
+
this.opts.onOpen?.(conversationId);
|
|
109
112
|
// ws_connected will arrive as first message
|
|
110
113
|
});
|
|
111
114
|
|