@agentrouter/agentrouter 0.2.2 → 0.2.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/core.d.ts.map +1 -1
- package/dist/core.js +5 -17
- package/package.json +1 -1
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EAYX,KAAK,GAAG,EAET,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,oFAAoF;AACpF,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,4EAA4E;AAC5E,eAAO,MAAM,IAAI;;;;;;;;;;;CAWP,CAAC;AAEX,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EAYX,KAAK,GAAG,EAET,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,oFAAoF;AACpF,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,4EAA4E;AAC5E,eAAO,MAAM,IAAI;;;;;;;;;;;CAWP,CAAC;AAEX,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAwFD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAkc5E"}
|
package/dist/core.js
CHANGED
|
@@ -28,7 +28,7 @@ class CliError extends Error {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const API_KEY_FORMAT = /^ar_live_[0-9a-f]{16}_[A-Za-z0-9_-]{32,64}$/;
|
|
31
|
-
const BOOLEAN_FLAGS = new Set(["json", "wait", "help", "no-browser", "no-color", "
|
|
31
|
+
const BOOLEAN_FLAGS = new Set(["json", "wait", "help", "no-browser", "no-color", "version", "include-unavailable"]);
|
|
32
32
|
const REPEATABLE = new Set(["run", "scope"]);
|
|
33
33
|
function parseArgs(argv) {
|
|
34
34
|
const positional = [];
|
|
@@ -77,7 +77,6 @@ Use tools
|
|
|
77
77
|
|
|
78
78
|
Money and support
|
|
79
79
|
agentrouter balance
|
|
80
|
-
agentrouter topup --amount-usd 10 [--open] Creates a payment link; funds arrive after payment
|
|
81
80
|
agentrouter feedback --text "..." [--run id] [--category c]
|
|
82
81
|
agentrouter tools request --capability "..." --note "..."
|
|
83
82
|
agentrouter dispute create --run <id> [--run <id>] --goal "..." --reason "..." [--evidence "..."]
|
|
@@ -220,9 +219,11 @@ export async function runCli(argv, io = {}) {
|
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
221
|
function describeRun(run) {
|
|
222
|
+
const maxCost = run.billing.max_cost_usd;
|
|
223
|
+
const ceiling = maxCost == null ? "no per-call limit" : `max $${maxCost}`;
|
|
223
224
|
const lines = [
|
|
224
225
|
`${run.run_id} ${run.status} ${run.tool_id}`,
|
|
225
|
-
` charge $${run.billing.customer_charge_usd} (${run.billing.reason ?? "pending"}), multiplier ${run.billing.price_multiplier},
|
|
226
|
+
` charge $${run.billing.customer_charge_usd} (${run.billing.reason ?? "pending"}), multiplier ${run.billing.price_multiplier}, ${ceiling}`
|
|
226
227
|
];
|
|
227
228
|
if (run.queue)
|
|
228
229
|
lines.push(` queued: ${run.queue.reason}, waited ${Math.floor(run.queue.waited_ms / 1000)}s, reserved $${run.billing.reserved_usd}`);
|
|
@@ -275,7 +276,7 @@ export async function runCli(argv, io = {}) {
|
|
|
275
276
|
info("No interactive terminal: set AGENTROUTER_API_KEY instead of logging in.");
|
|
276
277
|
return EXIT.auth;
|
|
277
278
|
}
|
|
278
|
-
const scopes = ["read", "invoke", "
|
|
279
|
+
const scopes = ["read", "invoke", "feedback", "dispute"];
|
|
279
280
|
const result = await browserLogin({ baseUrl, scopes, openBrowser: !flags["no-browser"] && io.openBrowser !== false, timeoutMs: 5 * 60000, fetchImpl, log: info });
|
|
280
281
|
const stored = { kind: "oauth", baseUrl, accessToken: result.accessToken, refreshToken: result.refreshToken, expiresAt: Date.now() + result.expiresIn * 1000, scope: result.scope };
|
|
281
282
|
const path = await saveCredential(env, stored);
|
|
@@ -518,19 +519,6 @@ export async function runCli(argv, io = {}) {
|
|
|
518
519
|
print(result.json, `Available $${result.json.available_usd} · reserved $${result.json.reserved_usd} (USD)`);
|
|
519
520
|
return EXIT.ok;
|
|
520
521
|
}
|
|
521
|
-
case "topup": {
|
|
522
|
-
const amount = flags["amount-usd"];
|
|
523
|
-
if (typeof amount !== "string")
|
|
524
|
-
throw new CliError("usage: agentrouter topup --amount-usd 10", EXIT.usage);
|
|
525
|
-
const result = await http("POST", "/v1/wallet/topups", { amount_usd: amount });
|
|
526
|
-
if (result.status !== 200 && result.status !== 201)
|
|
527
|
-
fail(result);
|
|
528
|
-
const topup = result.json;
|
|
529
|
-
print(topup, `Pay $${topup.quote.total_usd} ($${topup.quote.amount_usd} to wallet + $${topup.quote.fee_usd} fee):\n${topup.checkout_url}\nThe balance changes only after payment completes.`);
|
|
530
|
-
if (flags.open)
|
|
531
|
-
(await import("./terminal.js")).openInBrowser(topup.checkout_url);
|
|
532
|
-
return EXIT.ok;
|
|
533
|
-
}
|
|
534
522
|
case "feedback": {
|
|
535
523
|
if (typeof flags.text !== "string")
|
|
536
524
|
throw new CliError('usage: agentrouter feedback --text "..." [--run id]', EXIT.usage);
|