browse 0.8.4-alpha-bca916c → 0.8.4-alpha-3ecf09e

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.
@@ -5,6 +5,7 @@ import { homedir } from "node:os";
5
5
  import { delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { fail } from "../errors.js";
8
+ import { setRunTelemetryCompletion } from "../run-telemetry.js";
8
9
  import { defaultSkillsApiBaseUrl, isRecord, responseDetail } from "./shared.js";
9
10
  const defaultBlobBaseUrl = "https://gh0lfhlmyzhg6tww.public.blob.vercel-storage.com";
10
11
  const generatedSkillSuffixPattern = /-[A-Za-z0-9]{6}$/;
@@ -46,14 +47,18 @@ export function isBlobSkillId(skillId) {
46
47
  return generatedSkillSuffixPattern.test(skillId.task);
47
48
  }
48
49
  export async function installSkill(rawSkillId) {
49
- const skillId = parseSkillId(rawSkillId);
50
+ const skill = parseSkillId(rawSkillId);
51
+ // Attach only the validated, catalog-public id to telemetry — never the raw
52
+ // argument, which can contain arbitrary user input. Setting it right after
53
+ // parsing covers success and every downstream failure path.
54
+ setRunTelemetryCompletion({ skillId: skill.id });
50
55
  const npxPath = await findExecutable("npx");
51
56
  if (!npxPath) {
52
57
  fail("`npx` is not installed. Install Node.js from https://nodejs.org, then rerun `browse skills add`.", 1, { resultCode: "npx_missing" });
53
58
  }
54
- const files = await fetchSkillFiles(skillId);
59
+ const files = await fetchSkillFiles(skill);
55
60
  if (files.status === "found") {
56
- const result = await downloadBlobSkill(skillId, files.files);
61
+ const result = await downloadBlobSkill(skill, files.files);
57
62
  process.stdout.write(`Downloaded ${result.fileCount} skill file${result.fileCount === 1 ? "" : "s"} to ${result.installPath}\n`);
58
63
  await runSkillsInstall(npxPath, [
59
64
  "--yes",
@@ -64,7 +69,7 @@ export async function installSkill(rawSkillId) {
64
69
  return;
65
70
  }
66
71
  if (files.status === "not_found") {
67
- fail(`Skill "${skillId.id}" not found in the catalog. Run \`browse skills find ${skillId.domain}\` to discover available skills, or \`browse skills list\` to browse them.`, 1, { resultCode: "skill_not_found" });
72
+ fail(`Skill "${skill.id}" not found in the catalog. Run \`browse skills find ${skill.domain}\` to discover available skills, or \`browse skills list\` to browse them.`, 1, { resultCode: "skill_not_found" });
68
73
  }
69
74
  // Suffix-shaped (generated) ids, or a temporarily unavailable catalog, may
70
75
  // still resolve through the browse.sh GitHub repo.
@@ -74,10 +79,11 @@ export async function installSkill(rawSkillId) {
74
79
  "add",
75
80
  "browserbase/browse.sh",
76
81
  "--skill",
77
- skillId.id,
82
+ skill.id,
78
83
  ]);
79
84
  }
80
85
  export async function installBundledCliSkill() {
86
+ setRunTelemetryCompletion({ skillId: "bundled/browse" });
81
87
  const npxPath = await findExecutable("npx");
82
88
  if (!npxPath) {
83
89
  fail("`npx` is not installed. Install Node.js from https://nodejs.org, then rerun `browse skills install`.", 1, { resultCode: "npx_missing" });
@@ -147,6 +147,7 @@ function commandCompletedProperties(invocation, completion) {
147
147
  request_had_http_response: failureTelemetry?.requestHadHttpResponse ??
148
148
  runTelemetry.requestHadHttpResponse ??
149
149
  null,
150
+ skill_id: runTelemetry.skillId ?? null,
150
151
  };
151
152
  }
152
153
  function fallbackResultCode(success, errorType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browse",
3
- "version": "0.8.4-alpha-bca916c",
3
+ "version": "0.8.4-alpha-3ecf09e",
4
4
  "description": "Unified Browserbase CLI for browser automation and cloud APIs.",
5
5
  "type": "module",
6
6
  "private": false,