@axonpush/wizard 0.0.2 → 0.0.3

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/dist/bin.js CHANGED
@@ -25,7 +25,7 @@ var INTEGRATION_LABELS = {
25
25
  ["crewai" /* crewai */]: "CrewAI",
26
26
  ["core" /* core */]: "Core SDK (no framework)"
27
27
  };
28
- var DEFAULT_BASE_URL = "http://localhost:3000";
28
+ var DEFAULT_BASE_URL = "https://api.axonpush.xyz";
29
29
 
30
30
  // src/frameworks/langchain.ts
31
31
  var LANGCHAIN_CONFIG = {
@@ -304,6 +304,48 @@ async function agentRunner(opts, onStatus) {
304
304
  await runAgent(prompt, opts.projectDir, onStatus);
305
305
  }
306
306
 
307
+ // src/lib/browser-auth.ts
308
+ import http from "http";
309
+ import { exec } from "child_process";
310
+ var DASHBOARD_URL = "https://axonpush.xyz";
311
+ var TIMEOUT_MS = 12e4;
312
+ function openBrowser(url) {
313
+ const cmd = process.platform === "win32" ? `start "" "${url}"` : process.platform === "darwin" ? `open "${url}"` : `xdg-open "${url}"`;
314
+ exec(cmd);
315
+ }
316
+ function browserAuth() {
317
+ return new Promise((resolve, reject) => {
318
+ const server = http.createServer((req, res) => {
319
+ const url = new URL(req.url, `http://${req.headers.host}`);
320
+ if (url.pathname === "/callback") {
321
+ const apiKey = url.searchParams.get("api_key");
322
+ const tenantId = url.searchParams.get("tenant_id");
323
+ if (apiKey && tenantId) {
324
+ res.writeHead(200, { "Content-Type": "text/html" });
325
+ res.end("<html><body><h2>Authenticated! You can close this tab.</h2></body></html>");
326
+ server.close();
327
+ resolve({ apiKey, tenantId });
328
+ } else {
329
+ res.writeHead(400, { "Content-Type": "text/html" });
330
+ res.end("<html><body><h2>Missing credentials. Please try again.</h2></body></html>");
331
+ }
332
+ return;
333
+ }
334
+ res.writeHead(200, { "Content-Type": "text/html" });
335
+ res.end("<html><body><h2>Waiting for authentication...</h2></body></html>");
336
+ });
337
+ server.listen(0, "127.0.0.1", () => {
338
+ const port = server.address().port;
339
+ const authUrl = `${DASHBOARD_URL}/wizard-auth?port=${port}`;
340
+ openBrowser(authUrl);
341
+ });
342
+ setTimeout(() => {
343
+ server.close();
344
+ reject(new Error("Browser authentication timed out after 2 minutes"));
345
+ }, TIMEOUT_MS);
346
+ });
347
+ }
348
+
307
349
  // src/run.ts
308
350
  async function run(args) {
309
351
  const projectDir = args.installDir || process.cwd();
@@ -351,9 +393,32 @@ async function run(args) {
351
393
  let tenantId = args.tenantId;
352
394
  let baseUrl = args.baseUrl || DEFAULT_BASE_URL;
353
395
  if (!apiKey) {
354
- const res = await prompts({ type: "password", name: "value", message: "AxonPush API Key" });
355
- apiKey = res.value;
356
- if (!apiKey) process.exit(0);
396
+ const { method } = await prompts({
397
+ type: "select",
398
+ name: "method",
399
+ message: "How would you like to authenticate?",
400
+ choices: [
401
+ { title: "Log in via browser (recommended)", value: "browser" },
402
+ { title: "Enter API key manually", value: "manual" }
403
+ ]
404
+ });
405
+ if (!method) process.exit(0);
406
+ if (method === "browser") {
407
+ console.log(chalk.dim("\n Opening browser...\n"));
408
+ try {
409
+ const result = await browserAuth();
410
+ apiKey = result.apiKey;
411
+ tenantId = result.tenantId;
412
+ console.log(chalk.green(" Authenticated via browser!\n"));
413
+ } catch (err) {
414
+ console.log(chalk.red(` ${err instanceof Error ? err.message : err}`));
415
+ process.exit(1);
416
+ }
417
+ } else {
418
+ const res = await prompts({ type: "password", name: "value", message: "AxonPush API Key" });
419
+ apiKey = res.value;
420
+ if (!apiKey) process.exit(0);
421
+ }
357
422
  }
358
423
  if (!tenantId) {
359
424
  const res = await prompts({ type: "text", name: "value", message: "Tenant ID", initial: "1" });
@@ -390,7 +455,7 @@ async function run(args) {
390
455
  console.log();
391
456
  console.log(chalk.green(" Next steps:"));
392
457
  console.log(chalk.dim(" 1. Run your agent and check the AxonPush dashboard"));
393
- console.log(chalk.dim(` 2. View traces at ${baseUrl.replace("3000", "5173")}/traces`));
458
+ console.log(chalk.dim(" 2. View traces at https://axonpush.xyz/traces"));
394
459
  console.log();
395
460
  }
396
461
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axonpush/wizard",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "AI-powered wizard to integrate AxonPush into your AI agent project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,7 +22,7 @@ from axonpush.integrations.anthropic import AxonPushAnthropicTracer
22
22
  axonpush_client = AxonPush(
23
23
  api_key=os.environ["AXONPUSH_API_KEY"],
24
24
  tenant_id=os.environ["AXONPUSH_TENANT_ID"],
25
- base_url=os.environ.get("AXONPUSH_BASE_URL", "http://localhost:3000"),
25
+ base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
26
26
  )
27
27
 
28
28
  tracer = AxonPushAnthropicTracer(
@@ -21,7 +21,7 @@ from axonpush import AxonPush, EventType
21
21
  axonpush_client = AxonPush(
22
22
  api_key=os.environ["AXONPUSH_API_KEY"],
23
23
  tenant_id=os.environ["AXONPUSH_TENANT_ID"],
24
- base_url=os.environ.get("AXONPUSH_BASE_URL", "http://localhost:3000"),
24
+ base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
25
25
  )
26
26
 
27
27
  # Publish events from your code:
@@ -22,7 +22,7 @@ from axonpush.integrations.crewai import AxonPushCrewCallbacks
22
22
  axonpush_client = AxonPush(
23
23
  api_key=os.environ["AXONPUSH_API_KEY"],
24
24
  tenant_id=os.environ["AXONPUSH_TENANT_ID"],
25
- base_url=os.environ.get("AXONPUSH_BASE_URL", "http://localhost:3000"),
25
+ base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
26
26
  )
27
27
 
28
28
  axonpush_callbacks = AxonPushCrewCallbacks(
@@ -22,7 +22,7 @@ from axonpush.integrations.langchain import AxonPushCallbackHandler
22
22
  axonpush_client = AxonPush(
23
23
  api_key=os.environ["AXONPUSH_API_KEY"],
24
24
  tenant_id=os.environ["AXONPUSH_TENANT_ID"],
25
- base_url=os.environ.get("AXONPUSH_BASE_URL", "http://localhost:3000"),
25
+ base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
26
26
  )
27
27
 
28
28
  axonpush_handler = AxonPushCallbackHandler(
@@ -22,7 +22,7 @@ from axonpush.integrations.openai_agents import AxonPushRunHooks
22
22
  axonpush_client = AsyncAxonPush(
23
23
  api_key=os.environ["AXONPUSH_API_KEY"],
24
24
  tenant_id=os.environ["AXONPUSH_TENANT_ID"],
25
- base_url=os.environ.get("AXONPUSH_BASE_URL", "http://localhost:3000"),
25
+ base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
26
26
  )
27
27
 
28
28
  axonpush_hooks = AxonPushRunHooks(