robot-resources 1.7.8 → 1.7.9

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 +67 -16
  2. package/package.json +4 -1
package/lib/wizard.js CHANGED
@@ -77,6 +77,44 @@ export async function runWizard({ nonInteractive = false } = {}) {
77
77
  }
78
78
  }
79
79
 
80
+ // ── Funnel marker: wizard_started ───────────────────────────────────────
81
+ //
82
+ // Sent immediately after auth so we have proof the wizard reached this
83
+ // point even if any install step crashes. Pairs with install_complete at
84
+ // the end to give us a "started → completed" funnel for diagnosing silent
85
+ // signups. Fire-and-forget — never fatal.
86
+ //
87
+ // Timeout asymmetry vs install_complete (5s, no retry vs 10s × 2 attempts):
88
+ // wizard_started is a best-effort funnel marker — losing it just means we
89
+ // miss one funnel datapoint. install_complete is a heartbeat that powers
90
+ // last_used_at and the "wizard ran successfully" signal, so it gets the
91
+ // longer timeout + retry to maximize delivery.
92
+
93
+ if (results.auth) {
94
+ try {
95
+ const config = readConfig();
96
+ const platformUrl = process.env.RR_PLATFORM_URL || 'https://api.robotresources.ai';
97
+ await fetch(`${platformUrl}/v1/telemetry`, {
98
+ method: 'POST',
99
+ headers: {
100
+ 'Authorization': `Bearer ${config.api_key}`,
101
+ 'Content-Type': 'application/json',
102
+ },
103
+ body: JSON.stringify({
104
+ product: 'cli',
105
+ event_type: 'wizard_started',
106
+ payload: {
107
+ auth_method: results.authMethod,
108
+ non_interactive: nonInteractive,
109
+ },
110
+ }),
111
+ signal: AbortSignal.timeout(5_000),
112
+ });
113
+ } catch {
114
+ // Non-fatal — wizard_started is best-effort
115
+ }
116
+ }
117
+
80
118
  // ── Step 1: Router Installation ─────────────────────────────────────────
81
119
 
82
120
  step('Checking Router...');
@@ -254,29 +292,42 @@ export async function runWizard({ nonInteractive = false } = {}) {
254
292
  //
255
293
  // Fire once after install, using the API key directly (not from config read-back).
256
294
  // This immediately populates last_used_at and proves the key works end-to-end.
295
+ //
296
+ // Retry once with longer timeout — Cloudflare analytics showed client-side
297
+ // aborts on the original 5s single-attempt, leaving stranded signups with
298
+ // no telemetry. Two 10s attempts catch the long tail. Still fire-and-forget.
257
299
 
258
300
  if (results.auth) {
259
301
  try {
260
302
  const config = readConfig();
261
303
  const platformUrl = process.env.RR_PLATFORM_URL || 'https://api.robotresources.ai';
262
- await fetch(`${platformUrl}/v1/telemetry`, {
263
- method: 'POST',
264
- headers: {
265
- 'Authorization': `Bearer ${config.api_key}`,
266
- 'Content-Type': 'application/json',
304
+ const body = JSON.stringify({
305
+ product: 'cli',
306
+ event_type: 'install_complete',
307
+ payload: {
308
+ router: results.router || false,
309
+ service: results.service || false,
310
+ scraper: results.scraper || false,
311
+ source: 'wizard',
267
312
  },
268
- body: JSON.stringify({
269
- product: 'cli',
270
- event_type: 'install_complete',
271
- payload: {
272
- router: results.router || false,
273
- service: results.service || false,
274
- scraper: results.scraper || false,
275
- source: 'wizard',
276
- },
277
- }),
278
- signal: AbortSignal.timeout(5_000),
279
313
  });
314
+
315
+ for (let attempt = 0; attempt < 2; attempt++) {
316
+ try {
317
+ const res = await fetch(`${platformUrl}/v1/telemetry`, {
318
+ method: 'POST',
319
+ headers: {
320
+ 'Authorization': `Bearer ${config.api_key}`,
321
+ 'Content-Type': 'application/json',
322
+ },
323
+ body,
324
+ signal: AbortSignal.timeout(10_000),
325
+ });
326
+ if (res.ok) break;
327
+ } catch {
328
+ // Try again on next iteration; outer catch handles total failure
329
+ }
330
+ }
280
331
  } catch {
281
332
  // Non-fatal — install_complete is best-effort
282
333
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robot-resources",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "Robot Resources — AI agent tools. One command to install everything.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,9 @@
21
21
  "@robot-resources/openclaw-plugin": "*",
22
22
  "@robot-resources/scraper": "^0.3.1"
23
23
  },
24
+ "optionalDependencies": {
25
+ "@robot-resources/router": "*"
26
+ },
24
27
  "devDependencies": {
25
28
  "vitest": "^1.2.0"
26
29
  },