@pnds/pond 1.10.0 → 1.10.1

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/gateway.ts +16 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnds/pond",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "OpenClaw channel plugin for Pond IM",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,8 +15,8 @@
15
15
  "openclaw.plugin.json"
16
16
  ],
17
17
  "dependencies": {
18
- "@pnds/cli": "1.10.0",
19
- "@pnds/sdk": "1.10.0"
18
+ "@pnds/sdk": "1.10.1",
19
+ "@pnds/cli": "1.10.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^22.0.0",
package/src/gateway.ts CHANGED
@@ -672,18 +672,22 @@ export const pondGateway: ChannelGatewayAdapter<ResolvedPondAccount> = {
672
672
  const count = await fetchAllChats(client, config.org_id, chatInfoMap);
673
673
  log?.info(`pond[${ctx.accountId}]: WebSocket connected, ${count} chats cached`);
674
674
 
675
- // Create AgentSession on first hello (session lives across dispatches)
676
- let activeSessionId: string | undefined;
677
- try {
678
- const session = await client.createAgentSession(config.org_id, agentUserId, {
679
- runtime_type: "openclaw",
680
- runtime_key: orchestratorKey,
681
- runtime_ref: { hostname: os.hostname(), pid: process.pid },
682
- });
683
- activeSessionId = session.id;
684
- log?.info(`pond[${ctx.accountId}]: created agent session ${session.id}`);
685
- } catch (err) {
686
- log?.warn(`pond[${ctx.accountId}]: failed to create agent session: ${String(err)}`);
675
+ // Create AgentSession on first hello (session lives across dispatches).
676
+ // On WS reconnect, preserve the existing session — only create if none exists.
677
+ const existingState = getPondAccountState(ctx.accountId);
678
+ let activeSessionId: string | undefined = existingState?.activeSessionId;
679
+ if (!activeSessionId) {
680
+ try {
681
+ const session = await client.createAgentSession(config.org_id, agentUserId, {
682
+ runtime_type: "openclaw",
683
+ runtime_key: orchestratorKey,
684
+ runtime_ref: { hostname: os.hostname(), pid: process.pid },
685
+ });
686
+ activeSessionId = session.id;
687
+ log?.info(`pond[${ctx.accountId}]: created agent session ${session.id}`);
688
+ } catch (err) {
689
+ log?.warn(`pond[${ctx.accountId}]: failed to create agent session: ${String(err)}`);
690
+ }
687
691
  }
688
692
 
689
693
  setPondAccountState(ctx.accountId, {