@astranova-live/cli 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/astra.js +16 -4
  2. package/package.json +1 -1
package/dist/astra.js CHANGED
@@ -779,7 +779,7 @@ async function apiCall(method, path6, body, agentName, retryOpts) {
779
779
  const response = await fetch(url, {
780
780
  method,
781
781
  headers,
782
- body: body ? JSON.stringify(body) : void 0,
782
+ body: method !== "GET" && body ? JSON.stringify(body) : void 0,
783
783
  signal: controller.signal
784
784
  });
785
785
  clearTimeout(timeoutId);
@@ -2466,14 +2466,26 @@ var apiCallTool = tool2({
2466
2466
  };
2467
2467
  }
2468
2468
  debugLog(`api_call raw: method=${method} path=${path6} body=${JSON.stringify(body)} bodyType=${typeof body} rest=${JSON.stringify(rest)}`);
2469
- const resolvedBody = resolveBody(body, rest, method);
2470
- debugLog(`api_call resolved: ${method} ${path6} body=${JSON.stringify(resolvedBody)}`);
2469
+ let resolvedBody = resolveBody(body, rest, method);
2470
+ let resolvedPath = path6;
2471
+ if (method === "GET" && resolvedBody) {
2472
+ const params = new URLSearchParams();
2473
+ for (const [k, v] of Object.entries(resolvedBody)) {
2474
+ if (v !== void 0 && v !== null) params.set(k, String(v));
2475
+ }
2476
+ const qs = params.toString();
2477
+ if (qs) {
2478
+ resolvedPath += (path6.includes("?") ? "&" : "?") + qs;
2479
+ }
2480
+ resolvedBody = void 0;
2481
+ }
2482
+ debugLog(`api_call resolved: ${method} ${resolvedPath} body=${JSON.stringify(resolvedBody)}`);
2471
2483
  const agentName = getActiveAgent();
2472
2484
  const noRetryPaths = ["/api/v1/trades", "/api/v1/board", "/api/v1/agents/register", "/api/v1/agents/me/rewards/claim"];
2473
2485
  const isRetryable = method === "GET" || method === "PUT" || !noRetryPaths.some((p) => path6.startsWith(p));
2474
2486
  const retryOpts = isRetryable ? {} : false;
2475
2487
  const isClaimPath = method === "POST" && path6.startsWith("/api/v1/agents/me/rewards/claim");
2476
- const result = await apiCall(method, path6, resolvedBody, agentName ?? void 0, retryOpts);
2488
+ const result = await apiCall(method, resolvedPath, resolvedBody, agentName ?? void 0, retryOpts);
2477
2489
  if (!result.ok) {
2478
2490
  if (isClaimPath && result.status === 409 && agentName) {
2479
2491
  const cached = loadPendingClaim(agentName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astranova-live/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Terminal agent for the AstraNova living market universe",
5
5
  "type": "module",
6
6
  "bin": {