@clawchatsai/connector 0.1.4 → 0.1.6

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 CHANGED
@@ -77,6 +77,69 @@ Config is read in priority order:
77
77
  2. `~/.openclaw/openclaw.json` (OpenClaw gateway config)
78
78
  3. `config.js` in the plugin directory (local override, gitignored)
79
79
 
80
+ ## Development
81
+
82
+ To work on the connector locally alongside the ClawChats frontend:
83
+
84
+ ### Prerequisites
85
+
86
+ - Node.js 22+
87
+ - OpenClaw installed and on your `PATH`
88
+ - The `clawchats` repo cloned at `~/clawchats` (or set `CONNECTOR_DIR` when calling its `dev.sh`)
89
+
90
+ ### Build
91
+
92
+ ```bash
93
+ npm install
94
+ npm run build # tsc — compiles src/ → dist/
95
+ node esbuild.config.mjs # bundles server/ → server.js (production deploy only)
96
+ ```
97
+
98
+ Or use the dev script:
99
+
100
+ ```bash
101
+ ./dev.sh # watch-mode tsc (recompiles on save)
102
+ ./dev.sh --once # single build
103
+ ./dev.sh --server # esbuild bundle (for deploy)
104
+ ```
105
+
106
+ ### Running the full stack
107
+
108
+ The connector runs as an OpenClaw plugin — it can't run standalone. Use the ClawChats dev stack to run everything together:
109
+
110
+ ```bash
111
+ # From the clawchats repo:
112
+ cd ~/clawchats && ./dev.sh --skip-build
113
+ ```
114
+
115
+ See the ClawChats frontend repo for the full dev stack setup flow.
116
+
117
+ ### Hot-reload loop
118
+
119
+ ```bash
120
+ # Terminal 1 — watch-mode compiler
121
+ cd ~/connector && ./dev.sh
122
+
123
+ # Terminal 2 — full stack (no rebuild)
124
+ cd ~/clawchats && ./dev.sh --skip-build
125
+ ```
126
+
127
+ After each tsc rebuild, reload the plugin:
128
+ ```bash
129
+ openclaw --dev gateway restart
130
+ ```
131
+
132
+ ### Publishing
133
+
134
+ Releases are automated via GitHub Actions. Push a tag to trigger:
135
+
136
+ ```bash
137
+ git tag v0.1.3
138
+ git push origin main --tags
139
+ ```
140
+
141
+ The workflow runs `npm publish` to `@clawchatsai/connector` automatically. Do not run `npm publish` manually.
142
+
80
143
  ## License
81
144
 
82
145
  [AGPL-3.0-only](LICENSE) — source is open for audit and contribution.
package/dist/index.js CHANGED
@@ -564,6 +564,7 @@ function setupDataChannelHandler(dc, connectionId, ctx) {
564
564
  dc.onClosed(() => {
565
565
  connectedClients.delete(connectionId);
566
566
  cleanupAuth(connectionId);
567
+ app?.debugLogger.handleClientDisconnect(dc);
567
568
  });
568
569
  }
569
570
  /**
@@ -661,6 +662,24 @@ function processAuthenticatedMessage(dc, connectionId, msg, ctx) {
661
662
  case 'ping':
662
663
  dc.send(JSON.stringify({ type: 'pong' }));
663
664
  break;
665
+ case 'clawchats':
666
+ case 'shellchat': {
667
+ if (!app)
668
+ break;
669
+ const action = msg['action'];
670
+ if (action === 'debug-start') {
671
+ const ts = typeof msg['ts'] === 'string' ? msg['ts'] : new Date().toISOString();
672
+ const r = app.debugLogger.start(ts, dc);
673
+ dc.send(JSON.stringify(r.error === 'already-active'
674
+ ? { type: 'clawchats', event: 'debug-error', error: 'Recording already active in another tab', sessionId: r.sessionId }
675
+ : { type: 'clawchats', event: 'debug-started', sessionId: r.sessionId }));
676
+ }
677
+ else if (action === 'debug-dump') {
678
+ const r = app.debugLogger.saveDump(msg);
679
+ dc.send(JSON.stringify({ type: 'clawchats', event: 'debug-saved', sessionId: r.sessionId, files: r.files }));
680
+ }
681
+ break;
682
+ }
664
683
  default:
665
684
  // Unknown message type — ignore silently.
666
685
  // (Sending an error response would break heartbeat backward-compat
@@ -1055,13 +1074,13 @@ async function handleSetupTotp() {
1055
1074
  }
1056
1075
  else {
1057
1076
  // Expired — generate a fresh one
1058
- totpSecret = generateTotpSecret();
1077
+ totpSecret = process.env.CLAWCHATS_DEV_TOTP_SECRET || generateTotpSecret();
1059
1078
  config.totpPending = { secret: totpSecret, generatedAt: new Date().toISOString() };
1060
1079
  saveConfig(config);
1061
1080
  }
1062
1081
  }
1063
1082
  else {
1064
- totpSecret = generateTotpSecret();
1083
+ totpSecret = process.env.CLAWCHATS_DEV_TOTP_SECRET || generateTotpSecret();
1065
1084
  config.totpPending = { secret: totpSecret, generatedAt: new Date().toISOString() };
1066
1085
  saveConfig(config);
1067
1086
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawchatsai/connector",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "ClawChats OpenClaw plugin — P2P tunnel + local API bridge",
6
6
  "main": "dist/index.js",
package/server/index.js CHANGED
@@ -344,6 +344,7 @@ export function createApp(config = {}) {
344
344
  closeAllDbs: closeAll,
345
345
  gatewayClient,
346
346
  setupBrowserWs,
347
+ debugLogger,
347
348
  dataDir: DATA_DIR,
348
349
  };
349
350
  }