spawn-skill 1.0.0 → 1.0.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.
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,86 @@ 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
+ }
225
+
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
+ });
204
234
 
205
- const agent = new SpawnAgent({
206
- token: '${token}',
207
- name: '${agentName}',
235
+ ws.on('open', () => {
236
+ console.log('Connected to relay, authenticating...');
237
+ send('auth', { token: TOKEN, name: NAME });
238
+ });
208
239
 
209
- onConnect: () => {
210
- console.log('Connected to Spawn.wtf!');
211
- agent.sendText('${agentName} is online and ready.');
212
- agent.updateStatus('idle', 'Ready for commands');
213
- },
240
+ ws.on('message', (data) => {
241
+ const msg = JSON.parse(data.toString());
214
242
 
215
- onMessage: (msg) => {
216
- console.log('Message from app:', msg);
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
+ }
217
248
 
218
249
  if (msg.type === 'message') {
219
- const text = msg.payload.text || '';
220
- agent.updateStatus('thinking', 'Processing...');
250
+ console.log('Message from app:', msg.payload);
251
+ const text = msg.payload?.text || '';
221
252
 
222
- // Echo back
253
+ updateStatus('thinking', 'Processing...');
223
254
  setTimeout(() => {
224
- agent.sendText(\`You said: "\${text}"\`);
225
- agent.updateStatus('idle', 'Ready');
255
+ sendText(\`You said: "\${text}"\`);
256
+ updateStatus('idle', 'Ready');
226
257
  }, 500);
227
258
  }
228
- },
259
+ });
260
+
261
+ ws.on('close', () => {
262
+ console.log('Disconnected from relay');
263
+ });
229
264
 
230
- onDisconnect: () => {
231
- console.log('Disconnected from Spawn.wtf');
232
- },
265
+ ws.on('error', (err) => {
266
+ console.error('WebSocket error:', err.message);
267
+ });
268
+ }
233
269
 
234
- onError: (err) => {
235
- console.error('Error:', err.message);
270
+ // Keep alive
271
+ setInterval(() => {
272
+ if (ws?.readyState === WebSocket.OPEN) {
273
+ send('ping', {});
236
274
  }
237
- });
275
+ }, 30000);
238
276
 
239
- agent.connect();
240
277
  console.log('Connecting to Spawn.wtf...');
278
+ connect();
241
279
 
242
280
  process.on('SIGINT', () => {
243
- agent.disconnect();
281
+ console.log('Shutting down...');
282
+ ws?.close();
244
283
  process.exit(0);
245
284
  });
246
285
  `;
@@ -474,9 +513,9 @@ async function createSkillFiles(token, agentName, language) {
474
513
  const packageJson = {
475
514
  name: "spawn-agent",
476
515
  version: "1.0.0",
477
- type: "commonjs",
516
+ type: "module",
478
517
  dependencies: {
479
- "@spawn/agent-sdk": "github:SpawnWTF/spawn#main:sdk"
518
+ ws: "^8.16.0"
480
519
  }
481
520
  };
482
521
  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.1",
4
4
  "description": "Connect your AI agent to Spawn.wtf",
5
5
  "bin": {
6
6
  "spawn-skill": "./bin/cli.js"