@clawlabz/clawskin 1.0.2 → 1.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawlabz/clawskin",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "Pixel Agent Skin Engine \u2014 Procedural 32\u00d732 character generator with scenes, animations & customization",
6
6
  "keywords": [
@@ -115,14 +115,10 @@ class ClawSkinApp {
115
115
  this.running = true;
116
116
  this.lastTime = performance.now();
117
117
 
118
- const config = this.settings.load();
119
-
120
- if (config.autoConnect && config.gatewayUrl) {
121
- this.connectToGateway(config.gatewayUrl, config.token);
122
- } else {
123
- this._startDemoMode();
124
- this._tryAutoDetect();
125
- }
118
+ // Always try to fetch fresh config from serve.cjs first.
119
+ // This ensures we have the latest token even if localStorage is stale.
120
+ this._startDemoMode();
121
+ this._tryAutoDetect();
126
122
 
127
123
  this._loop();
128
124
  }
@@ -168,6 +164,7 @@ class ClawSkinApp {
168
164
  const res = await fetch('/api/config', { signal: AbortSignal.timeout(2000) });
169
165
  if (res.ok) {
170
166
  const config = await res.json();
167
+ console.log('[ClawSkin] /api/config →', JSON.stringify(config));
171
168
  if (config?.gatewayUrl) {
172
169
  const saved = this.settings.load();
173
170
  const token = config.token || saved.token || '';
@@ -46,8 +46,15 @@ class GatewayClient {
46
46
  }
47
47
 
48
48
  _setState(state, detail) {
49
- if (state === 'error') this.lastError = detail || 'Unknown error';
50
- else if (state === 'connected') this.lastError = null;
49
+ if (state === 'error') {
50
+ this.lastError = detail || 'Unknown error';
51
+ console.warn('[GatewayClient]', state, detail || '');
52
+ } else if (state === 'connected') {
53
+ this.lastError = null;
54
+ console.log('[GatewayClient] connected');
55
+ } else {
56
+ console.log('[GatewayClient]', state, detail || '');
57
+ }
51
58
  if (this.onStateChange) this.onStateChange(state, detail);
52
59
  }
53
60
 
@@ -200,10 +207,9 @@ class GatewayClient {
200
207
  params.auth.token = this.token;
201
208
  }
202
209
 
203
- // Device identity — Gateway requires Ed25519 signed device identity.
204
- // The signed message MUST use the same role/scopes/clientId/clientMode
205
- // as the connect params, because Gateway reconstructs the message to verify.
206
- if (typeof DeviceIdentity !== 'undefined') {
210
+ // Device identity — only needed for clients that require Ed25519 pairing
211
+ // (e.g. webchat-ui, control-ui). The 'webchat' client type works without it.
212
+ if (typeof DeviceIdentity !== 'undefined' && this.clientId !== 'webchat') {
207
213
  try {
208
214
  const identity = await DeviceIdentity.getOrCreate();
209
215
  const device = await DeviceIdentity.sign(identity, {