robot-resources 1.6.0 → 1.7.0

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.
Files changed (2) hide show
  1. package/lib/wizard.js +62 -8
  2. package/package.json +2 -2
package/lib/wizard.js CHANGED
@@ -69,14 +69,12 @@ export async function runWizard({ nonInteractive = false } = {}) {
69
69
 
70
70
  if (res.ok) {
71
71
  const { data } = await res.json();
72
- if (data.api_key !== 'existing') {
73
- writeConfig({
74
- api_key: data.api_key,
75
- key_id: data.key_id,
76
- claim_url: data.claim_url,
77
- signup_source: 'auto',
78
- });
79
- }
72
+ writeConfig({
73
+ api_key: data.api_key,
74
+ key_id: data.key_id,
75
+ claim_url: data.claim_url,
76
+ signup_source: 'auto',
77
+ });
80
78
  results.auth = true;
81
79
  results.authMethod = 'auto';
82
80
  results.claimUrl = data.claim_url;
@@ -267,6 +265,38 @@ export async function runWizard({ nonInteractive = false } = {}) {
267
265
  }
268
266
  }
269
267
 
268
+ // ── Install Complete Telemetry ───────────────────────────────────────────
269
+ //
270
+ // Fire once after install, using the API key directly (not from config read-back).
271
+ // This immediately populates last_used_at and proves the key works end-to-end.
272
+
273
+ if (results.auth) {
274
+ try {
275
+ const config = readConfig();
276
+ const platformUrl = process.env.RR_PLATFORM_URL || 'https://api.robotresources.ai';
277
+ await fetch(`${platformUrl}/v1/telemetry`, {
278
+ method: 'POST',
279
+ headers: {
280
+ 'Authorization': `Bearer ${config.api_key}`,
281
+ 'Content-Type': 'application/json',
282
+ },
283
+ body: JSON.stringify({
284
+ product: 'cli',
285
+ event_type: 'install_complete',
286
+ payload: {
287
+ router: results.router || false,
288
+ service: results.service || false,
289
+ scraper: results.scraper || false,
290
+ source: 'wizard',
291
+ },
292
+ }),
293
+ signal: AbortSignal.timeout(5_000),
294
+ });
295
+ } catch {
296
+ // Non-fatal — install_complete is best-effort
297
+ }
298
+ }
299
+
270
300
  // ── Summary ─────────────────────────────────────────────────────────────
271
301
 
272
302
  const somethingInstalled = results.router || results.service || results.scraper;
@@ -324,6 +354,30 @@ export async function runWizard({ nonInteractive = false } = {}) {
324
354
  blank();
325
355
  }
326
356
 
357
+ // ── Status file (persists results for agents that lose the session) ─────
358
+
359
+ if (somethingInstalled) {
360
+ try {
361
+ const { readFileSync: readFs, writeFileSync: writeFs, mkdirSync: mkFs } = await import('node:fs');
362
+ const { join: joinP } = await import('node:path');
363
+ const { homedir: homeP } = await import('node:os');
364
+ const statusDir = joinP(homeP(), '.robot-resources');
365
+ mkFs(statusDir, { recursive: true });
366
+ const pkgVersion = JSON.parse(readFs(new URL('../package.json', import.meta.url), 'utf-8')).version;
367
+ writeFs(joinP(statusDir, 'wizard-status.json'), JSON.stringify({
368
+ completed_at: new Date().toISOString(),
369
+ version: pkgVersion,
370
+ router: results.router || false,
371
+ service: results.service || false,
372
+ scraper: results.scraper || false,
373
+ plugin: results.tools?.some(r => r.action === 'installed') || false,
374
+ claim_url: results.claimUrl || readConfig().claim_url || null,
375
+ }, null, 2) + '\n', 'utf-8');
376
+ } catch {
377
+ // Non-fatal — status file is a convenience, not required
378
+ }
379
+ }
380
+
327
381
  // ── Best-effort: Single gateway restart ────────────────────────────────
328
382
  //
329
383
  // Merged from two previous restarts (after plugin install + after scraper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Robot Resources — AI agent runtime tools. One command to install everything.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@robot-resources/cli-core": "*",
21
21
  "@robot-resources/openclaw-plugin": "*",
22
- "@robot-resources/scraper": "^0.2.0"
22
+ "@robot-resources/scraper": "^0.3.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "vitest": "^1.2.0"