spawn-skill 1.0.0 → 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/CLAUDE.md CHANGED
@@ -3,5 +3,9 @@
3
3
 
4
4
  <!-- This section is auto-generated by claude-mem. Edit content outside the tags. -->
5
5
 
6
- *No recent activity*
6
+ ### Jan 29, 2026
7
+
8
+ | ID | Time | T | Title | Read |
9
+ |----|------|---|-------|------|
10
+ | #794 | 11:11 AM | ✅ | Simplified spawn-skill CLI package.json generation to use direct ws dependency | ~353 |
7
11
  </claude-mem-context>
package/bin/cli.js CHANGED
@@ -200,47 +200,83 @@ function getTypeScriptConnector(token, agentName) {
200
200
  * Run with: node connect.js
201
201
  */
202
202
 
203
- const { SpawnAgent } = require('./node_modules/@spawn/agent-sdk/dist/index.js');
203
+ import WebSocket from 'ws';
204
+
205
+ const TOKEN = '${token}';
206
+ const NAME = '${agentName}';
207
+ const RELAY = 'wss://spawn-relay.ngvsqdjj5r.workers.dev/v1/agent';
208
+
209
+ let ws;
210
+
211
+ function send(type, payload) {
212
+ if (ws?.readyState === WebSocket.OPEN) {
213
+ ws.send(JSON.stringify({
214
+ type,
215
+ id: \`msg_\${Date.now()}\`,
216
+ ts: Date.now(),
217
+ payload
218
+ }));
219
+ }
220
+ }
221
+
222
+ function sendText(text) {
223
+ send('message', { content_type: 'text', text, format: 'plain' });
224
+ }
204
225
 
205
- const agent = new SpawnAgent({
206
- token: '${token}',
207
- name: '${agentName}',
226
+ function updateStatus(status, label) {
227
+ send('status_update', { status, label });
228
+ }
229
+
230
+ function connect() {
231
+ ws = new WebSocket(RELAY, {
232
+ headers: { 'Authorization': \`Bearer \${TOKEN}\` }
233
+ });
208
234
 
209
- onConnect: () => {
235
+ ws.on('open', () => {
210
236
  console.log('Connected to Spawn.wtf!');
211
- agent.sendText('${agentName} is online and ready.');
212
- agent.updateStatus('idle', 'Ready for commands');
213
- },
237
+ // Auth happens via token in header - just start working
238
+ sendText(\`\${NAME} is online and ready.\`);
239
+ updateStatus('idle', 'Ready for commands');
240
+ });
214
241
 
215
- onMessage: (msg) => {
216
- console.log('Message from app:', msg);
242
+ ws.on('message', (data) => {
243
+ const msg = JSON.parse(data.toString());
244
+ console.log('Received:', msg.type);
217
245
 
218
246
  if (msg.type === 'message') {
219
- const text = msg.payload.text || '';
220
- agent.updateStatus('thinking', 'Processing...');
247
+ console.log('Message from app:', msg.payload);
248
+ const text = msg.payload?.text || '';
221
249
 
222
- // Echo back
250
+ updateStatus('thinking', 'Processing...');
223
251
  setTimeout(() => {
224
- agent.sendText(\`You said: "\${text}"\`);
225
- agent.updateStatus('idle', 'Ready');
252
+ sendText(\`You said: "\${text}"\`);
253
+ updateStatus('idle', 'Ready');
226
254
  }, 500);
227
255
  }
228
- },
256
+ });
229
257
 
230
- onDisconnect: () => {
231
- console.log('Disconnected from Spawn.wtf');
232
- },
258
+ ws.on('close', () => {
259
+ console.log('Disconnected from relay');
260
+ });
233
261
 
234
- onError: (err) => {
235
- console.error('Error:', err.message);
262
+ ws.on('error', (err) => {
263
+ console.error('WebSocket error:', err.message);
264
+ });
265
+ }
266
+
267
+ // Keep alive
268
+ setInterval(() => {
269
+ if (ws?.readyState === WebSocket.OPEN) {
270
+ send('ping', {});
236
271
  }
237
- });
272
+ }, 30000);
238
273
 
239
- agent.connect();
240
274
  console.log('Connecting to Spawn.wtf...');
275
+ connect();
241
276
 
242
277
  process.on('SIGINT', () => {
243
- agent.disconnect();
278
+ console.log('Shutting down...');
279
+ ws?.close();
244
280
  process.exit(0);
245
281
  });
246
282
  `;
@@ -337,16 +373,9 @@ class SpawnAgent:
337
373
  )
338
374
  self._connected = True
339
375
 
340
- # Send auth message
341
- await self._send({
342
- 'type': 'auth',
343
- 'id': f'auth_{int(asyncio.get_event_loop().time() * 1000)}',
344
- 'ts': int(asyncio.get_event_loop().time() * 1000),
345
- 'payload': {
346
- 'token': self.token,
347
- 'name': self.name
348
- }
349
- })
376
+ # Auth happens via token header - trigger connect immediately
377
+ if 'connect' in self._handlers:
378
+ await self._handlers['connect']()
350
379
 
351
380
  # Start message loop
352
381
  await self._message_loop()
@@ -363,10 +392,7 @@ class SpawnAgent:
363
392
  data = json.loads(message)
364
393
  msg_type = data.get('type', '')
365
394
 
366
- if msg_type == 'auth_success':
367
- if 'connect' in self._handlers:
368
- await self._handlers['connect']()
369
- elif msg_type == 'message':
395
+ if msg_type == 'message':
370
396
  if 'message' in self._handlers:
371
397
  await self._handlers['message'](data)
372
398
  elif msg_type == 'pong':
@@ -474,9 +500,9 @@ async function createSkillFiles(token, agentName, language) {
474
500
  const packageJson = {
475
501
  name: "spawn-agent",
476
502
  version: "1.0.0",
477
- type: "commonjs",
503
+ type: "module",
478
504
  dependencies: {
479
- "@spawn/agent-sdk": "github:SpawnWTF/spawn#main:sdk"
505
+ ws: "^8.16.0"
480
506
  }
481
507
  };
482
508
  fs.writeFileSync(path.join(skillDir, 'package.json'), JSON.stringify(packageJson, null, 2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-skill",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Connect your AI agent to Spawn.wtf",
5
5
  "bin": {
6
6
  "spawn-skill": "./bin/cli.js"