@agentrouter/agentrouter 0.2.0 → 0.2.2

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.
@@ -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;AAyFD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAuc5E"}
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;AAyFD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CA0c5E"}
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", "open", "version"]);
31
+ const BOOLEAN_FLAGS = new Set(["json", "wait", "help", "no-browser", "no-color", "open", "version", "include-unavailable"]);
32
32
  const REPEATABLE = new Set(["run", "scope"]);
33
33
  function parseArgs(argv) {
34
34
  const positional = [];
@@ -67,7 +67,7 @@ Sign in
67
67
  agentrouter keys list | add <name> [--scope s]... | remove <key_id> | activate <key> | set | clear
68
68
 
69
69
  Use tools
70
- agentrouter find "<task>" [--limit n] [--provider id] [--category id,id] [--group id,id]
70
+ agentrouter find "<task>" [--limit n] [--provider id] [--category id,id] [--group id,id] [--include-unavailable]
71
71
  agentrouter describe <tool_id>
72
72
  agentrouter invoke <tool_id> --input <json|@file> [--max-cost-usd 0.05] [--session id]
73
73
  [--idempotency-key k] [--wait] [--timeout-ms n] [--output file]
@@ -224,6 +224,8 @@ export async function runCli(argv, io = {}) {
224
224
  `${run.run_id} ${run.status} ${run.tool_id}`,
225
225
  ` charge $${run.billing.customer_charge_usd} (${run.billing.reason ?? "pending"}), multiplier ${run.billing.price_multiplier}, max $${run.billing.max_cost_usd}`
226
226
  ];
227
+ if (run.queue)
228
+ lines.push(` queued: ${run.queue.reason}, waited ${Math.floor(run.queue.waited_ms / 1000)}s, reserved $${run.billing.reserved_usd}`);
227
229
  if (run.error)
228
230
  lines.push(` error ${run.error.code}: ${run.error.message}`);
229
231
  if (run.provider_response?.request_id)
@@ -378,12 +380,13 @@ export async function runCli(argv, io = {}) {
378
380
  const query = [sub, ...rest].filter(Boolean).join(" ");
379
381
  if (!query)
380
382
  throw new CliError('usage: agentrouter find "<task>"', EXIT.usage);
381
- const result = await http("POST", "/v1/find", { query, limit: flags.limit ? Number(flags.limit) : undefined, provider: flags.provider, category_ids: typeof flags.category === "string" ? flags.category.split(",").map((id) => id.trim()) : undefined, group_ids: typeof flags.group === "string" ? flags.group.split(",").map((id) => id.trim()) : undefined }, {}, true);
383
+ const result = await http("POST", "/v1/find", { query, ...(flags["include-unavailable"] && { include_unavailable: true }), limit: flags.limit ? Number(flags.limit) : undefined, provider: flags.provider, category_ids: typeof flags.category === "string" ? flags.category.split(",").map((id) => id.trim()) : undefined, group_ids: typeof flags.group === "string" ? flags.group.split(",").map((id) => id.trim()) : undefined }, {}, true);
382
384
  if (result.status !== 200)
383
385
  fail(result);
384
386
  const found = result.json;
385
- const lines = found.tools.map((tool) => `${tool.tool_id.padEnd(34)} ${tool.fit.padEnd(7)} ${tool.price.summary} [health ${tool.health.status}]\n ${tool.summary}`);
386
- print(found, found.match === "none" ? "No matching tool. Request it: agentrouter tools request --capability \"…\" --note \"…\"" : `match: ${found.match}\n${lines.join("\n")}`);
387
+ const lines = found.tools.map((tool) => `${tool.tool_id.padEnd(34)} ${tool.fit.padEnd(7)} ${tool.price.summary} [${tool.availability?.status === "temporarily_unavailable" ? "temporarily unavailable" : "health " + tool.health.status}]\n ${tool.summary}`);
388
+ const unavailable = found.hints?.find((hint) => hint.code === "TEMPORARILY_UNAVAILABLE");
389
+ print(found, unavailable ? unavailable.message : found.match === "none" ? "No matching tool. Request it: agentrouter tools request --capability \"…\" --note \"…\"" : `match: ${found.match}\n${lines.join("\n")}`);
387
390
  return EXIT.ok;
388
391
  }
389
392
  case "describe": {
@@ -398,6 +401,7 @@ export async function runCli(argv, io = {}) {
398
401
  print(tool, [
399
402
  `${tool.tool_id} (${tool.tool_version}) — ${tool.title}`,
400
403
  ` ${tool.description}`,
404
+ ...(tool.availability?.status === "temporarily_unavailable" ? [" Temporarily unavailable. Choose another tool or check back later."] : []),
401
405
  ` required input: ${required}`,
402
406
  ` price: ${tool.pricing.summary} [${tool.pricing.multiplier_label}] pricing_version ${tool.pricing.pricing_version}`,
403
407
  ` provider errors: ${tool.pricing.rules.provider_error}; empty results: ${tool.pricing.rules.empty_result}`,
@@ -456,7 +460,7 @@ export async function runCli(argv, io = {}) {
456
460
  fail(result);
457
461
  }
458
462
  let final = result;
459
- if (result.json?.run_id && ["RUNNING", "READY"].includes(result.json.status) && flags.wait) {
463
+ if (result.json?.run_id && ["READY", "RUNNING", "STOPPING"].includes(result.json.status) && flags.wait) {
460
464
  final = await waitForRun(result.json.run_id, Number(flags["timeout-ms"]) || 10 * 60000);
461
465
  }
462
466
  const run = final.json?.run_id ? final.json : final.json?.run;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentrouter/agentrouter",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AgentRouter CLI: find, describe and invoke provider tools with one wallet.",
5
5
  "type": "module",
6
6
  "bin": {