spawn-skill 1.0.1 → 1.0.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/cli.js +9 -22
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -233,18 +233,15 @@ function connect() {
|
|
|
233
233
|
});
|
|
234
234
|
|
|
235
235
|
ws.on('open', () => {
|
|
236
|
-
console.log('Connected to
|
|
237
|
-
|
|
236
|
+
console.log('Connected to Spawn.wtf!');
|
|
237
|
+
// Auth happens via token in header - just start working
|
|
238
|
+
sendText(\`\${NAME} is online and ready.\`);
|
|
239
|
+
updateStatus('idle', 'Ready for commands');
|
|
238
240
|
});
|
|
239
241
|
|
|
240
242
|
ws.on('message', (data) => {
|
|
241
243
|
const msg = JSON.parse(data.toString());
|
|
242
|
-
|
|
243
|
-
if (msg.type === 'auth_success') {
|
|
244
|
-
console.log('Authenticated! Agent is online.');
|
|
245
|
-
sendText(\`\${NAME} is online and ready.\`);
|
|
246
|
-
updateStatus('idle', 'Ready for commands');
|
|
247
|
-
}
|
|
244
|
+
console.log('Received:', msg.type);
|
|
248
245
|
|
|
249
246
|
if (msg.type === 'message') {
|
|
250
247
|
console.log('Message from app:', msg.payload);
|
|
@@ -376,16 +373,9 @@ class SpawnAgent:
|
|
|
376
373
|
)
|
|
377
374
|
self._connected = True
|
|
378
375
|
|
|
379
|
-
#
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
'id': f'auth_{int(asyncio.get_event_loop().time() * 1000)}',
|
|
383
|
-
'ts': int(asyncio.get_event_loop().time() * 1000),
|
|
384
|
-
'payload': {
|
|
385
|
-
'token': self.token,
|
|
386
|
-
'name': self.name
|
|
387
|
-
}
|
|
388
|
-
})
|
|
376
|
+
# Auth happens via token header - trigger connect immediately
|
|
377
|
+
if 'connect' in self._handlers:
|
|
378
|
+
await self._handlers['connect']()
|
|
389
379
|
|
|
390
380
|
# Start message loop
|
|
391
381
|
await self._message_loop()
|
|
@@ -402,10 +392,7 @@ class SpawnAgent:
|
|
|
402
392
|
data = json.loads(message)
|
|
403
393
|
msg_type = data.get('type', '')
|
|
404
394
|
|
|
405
|
-
if msg_type == '
|
|
406
|
-
if 'connect' in self._handlers:
|
|
407
|
-
await self._handlers['connect']()
|
|
408
|
-
elif msg_type == 'message':
|
|
395
|
+
if msg_type == 'message':
|
|
409
396
|
if 'message' in self._handlers:
|
|
410
397
|
await self._handlers['message'](data)
|
|
411
398
|
elif msg_type == 'pong':
|