@axonpush/wizard 0.0.2 → 0.0.4
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 = "
|
|
28
|
+
var DEFAULT_BASE_URL = "https://api.axonpush.xyz";
|
|
29
29
|
|
|
30
30
|
// src/frameworks/langchain.ts
|
|
31
31
|
var LANGCHAIN_CONFIG = {
|
|
@@ -190,6 +190,7 @@ function findPyFiles(dir, maxDepth, depth = 0) {
|
|
|
190
190
|
// src/lib/agent-runner.ts
|
|
191
191
|
import fs2 from "fs";
|
|
192
192
|
import path2 from "path";
|
|
193
|
+
import { fileURLToPath } from "url";
|
|
193
194
|
|
|
194
195
|
// src/lib/commandments.ts
|
|
195
196
|
var COMMANDMENTS = [
|
|
@@ -250,6 +251,7 @@ ${getCommandments()}`
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
// src/lib/agent-runner.ts
|
|
254
|
+
var __dirname = path2.dirname(fileURLToPath(import.meta.url));
|
|
253
255
|
function buildPrompt(opts) {
|
|
254
256
|
const skillPath = path2.resolve(__dirname, "..", "..", opts.config.skillDir, "SKILL.md");
|
|
255
257
|
let skillContent = "";
|
|
@@ -304,6 +306,48 @@ async function agentRunner(opts, onStatus) {
|
|
|
304
306
|
await runAgent(prompt, opts.projectDir, onStatus);
|
|
305
307
|
}
|
|
306
308
|
|
|
309
|
+
// src/lib/browser-auth.ts
|
|
310
|
+
import http from "http";
|
|
311
|
+
import { exec } from "child_process";
|
|
312
|
+
var DASHBOARD_URL = "https://axonpush.xyz";
|
|
313
|
+
var TIMEOUT_MS = 12e4;
|
|
314
|
+
function openBrowser(url) {
|
|
315
|
+
const cmd = process.platform === "win32" ? `start "" "${url}"` : process.platform === "darwin" ? `open "${url}"` : `xdg-open "${url}"`;
|
|
316
|
+
exec(cmd);
|
|
317
|
+
}
|
|
318
|
+
function browserAuth() {
|
|
319
|
+
return new Promise((resolve, reject) => {
|
|
320
|
+
const server = http.createServer((req, res) => {
|
|
321
|
+
const url = new URL(req.url, `http://${req.headers.host}`);
|
|
322
|
+
if (url.pathname === "/callback") {
|
|
323
|
+
const apiKey = url.searchParams.get("api_key");
|
|
324
|
+
const tenantId = url.searchParams.get("tenant_id");
|
|
325
|
+
if (apiKey && tenantId) {
|
|
326
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
327
|
+
res.end("<html><body><h2>Authenticated! You can close this tab.</h2></body></html>");
|
|
328
|
+
server.close();
|
|
329
|
+
resolve({ apiKey, tenantId });
|
|
330
|
+
} else {
|
|
331
|
+
res.writeHead(400, { "Content-Type": "text/html" });
|
|
332
|
+
res.end("<html><body><h2>Missing credentials. Please try again.</h2></body></html>");
|
|
333
|
+
}
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
337
|
+
res.end("<html><body><h2>Waiting for authentication...</h2></body></html>");
|
|
338
|
+
});
|
|
339
|
+
server.listen(0, "127.0.0.1", () => {
|
|
340
|
+
const port = server.address().port;
|
|
341
|
+
const authUrl = `${DASHBOARD_URL}/wizard-auth?port=${port}`;
|
|
342
|
+
openBrowser(authUrl);
|
|
343
|
+
});
|
|
344
|
+
setTimeout(() => {
|
|
345
|
+
server.close();
|
|
346
|
+
reject(new Error("Browser authentication timed out after 2 minutes"));
|
|
347
|
+
}, TIMEOUT_MS);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
307
351
|
// src/run.ts
|
|
308
352
|
async function run(args) {
|
|
309
353
|
const projectDir = args.installDir || process.cwd();
|
|
@@ -351,9 +395,32 @@ async function run(args) {
|
|
|
351
395
|
let tenantId = args.tenantId;
|
|
352
396
|
let baseUrl = args.baseUrl || DEFAULT_BASE_URL;
|
|
353
397
|
if (!apiKey) {
|
|
354
|
-
const
|
|
355
|
-
|
|
356
|
-
|
|
398
|
+
const { method } = await prompts({
|
|
399
|
+
type: "select",
|
|
400
|
+
name: "method",
|
|
401
|
+
message: "How would you like to authenticate?",
|
|
402
|
+
choices: [
|
|
403
|
+
{ title: "Log in via browser (recommended)", value: "browser" },
|
|
404
|
+
{ title: "Enter API key manually", value: "manual" }
|
|
405
|
+
]
|
|
406
|
+
});
|
|
407
|
+
if (!method) process.exit(0);
|
|
408
|
+
if (method === "browser") {
|
|
409
|
+
console.log(chalk.dim("\n Opening browser...\n"));
|
|
410
|
+
try {
|
|
411
|
+
const result = await browserAuth();
|
|
412
|
+
apiKey = result.apiKey;
|
|
413
|
+
tenantId = result.tenantId;
|
|
414
|
+
console.log(chalk.green(" Authenticated via browser!\n"));
|
|
415
|
+
} catch (err) {
|
|
416
|
+
console.log(chalk.red(` ${err instanceof Error ? err.message : err}`));
|
|
417
|
+
process.exit(1);
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
const res = await prompts({ type: "password", name: "value", message: "AxonPush API Key" });
|
|
421
|
+
apiKey = res.value;
|
|
422
|
+
if (!apiKey) process.exit(0);
|
|
423
|
+
}
|
|
357
424
|
}
|
|
358
425
|
if (!tenantId) {
|
|
359
426
|
const res = await prompts({ type: "text", name: "value", message: "Tenant ID", initial: "1" });
|
|
@@ -390,7 +457,7 @@ async function run(args) {
|
|
|
390
457
|
console.log();
|
|
391
458
|
console.log(chalk.green(" Next steps:"));
|
|
392
459
|
console.log(chalk.dim(" 1. Run your agent and check the AxonPush dashboard"));
|
|
393
|
-
console.log(chalk.dim(
|
|
460
|
+
console.log(chalk.dim(" 2. View traces at https://axonpush.xyz/traces"));
|
|
394
461
|
console.log();
|
|
395
462
|
}
|
|
396
463
|
|
package/package.json
CHANGED
|
@@ -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", "
|
|
25
|
+
base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
tracer = AxonPushAnthropicTracer(
|
package/skills/core/SKILL.md
CHANGED
|
@@ -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", "
|
|
24
|
+
base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
# Publish events from your code:
|
package/skills/crewai/SKILL.md
CHANGED
|
@@ -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", "
|
|
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", "
|
|
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", "
|
|
25
|
+
base_url=os.environ.get("AXONPUSH_BASE_URL", "https://api.axonpush.xyz"),
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
axonpush_hooks = AxonPushRunHooks(
|