@astranova-live/cli 0.1.3 → 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 +28 -13
  2. package/package.json +3 -1
package/dist/astra.js CHANGED
@@ -482,7 +482,7 @@ var DEFAULT_MODELS = {
482
482
  "openai-oauth": "gpt-5.3-codex",
483
483
  claude: "claude-sonnet-4-20250514",
484
484
  openai: "gpt-4o-mini",
485
- google: "gemini-2.0-flash",
485
+ google: "gemini-2.5-flash",
486
486
  ollama: "llama3.1"
487
487
  };
488
488
  async function selectProvider() {
@@ -508,7 +508,7 @@ async function selectProvider() {
508
508
  {
509
509
  value: "google",
510
510
  label: "Gemini (Google)",
511
- hint: "coming soon"
511
+ hint: "API key"
512
512
  },
513
513
  {
514
514
  value: "ollama",
@@ -521,9 +521,8 @@ async function selectProvider() {
521
521
  clack.cancel("Setup cancelled.");
522
522
  process.exit(0);
523
523
  }
524
- if (provider === "google" || provider === "ollama") {
525
- const names = { google: "Gemini", ollama: "Ollama" };
526
- clack.log.warn(`${names[provider]} support is coming soon. Please choose another provider for now.`);
524
+ if (provider === "ollama") {
525
+ clack.log.warn("Ollama support is coming soon. Please choose another provider for now.");
527
526
  continue;
528
527
  }
529
528
  if (provider === "openai-oauth") {
@@ -780,7 +779,7 @@ async function apiCall(method, path6, body, agentName, retryOpts) {
780
779
  const response = await fetch(url, {
781
780
  method,
782
781
  headers,
783
- body: body ? JSON.stringify(body) : void 0,
782
+ body: method !== "GET" && body ? JSON.stringify(body) : void 0,
784
783
  signal: controller.signal
785
784
  });
786
785
  clearTimeout(timeoutId);
@@ -1828,6 +1827,7 @@ import { zodToJsonSchema } from "zod-to-json-schema";
1828
1827
  // src/agent/provider.ts
1829
1828
  import { createAnthropic } from "@ai-sdk/anthropic";
1830
1829
  import { createOpenAI } from "@ai-sdk/openai";
1830
+ import { createGoogleGenerativeAI } from "@ai-sdk/google";
1831
1831
  function isCodexOAuth() {
1832
1832
  const override = process.env.ASTRA_PROVIDER;
1833
1833
  if (override) return override === "openai-oauth";
@@ -1926,10 +1926,13 @@ function createModelFromConfig(config) {
1926
1926
  const openai = createOpenAI({ apiKey: auth.apiKey });
1927
1927
  return openai(model);
1928
1928
  }
1929
- case "google":
1930
- throw new Error(
1931
- "Gemini support is coming soon. Please use Claude or ChatGPT/Codex.\nTo switch, delete ~/.config/astranova/config.json and re-run astra."
1932
- );
1929
+ case "google": {
1930
+ if (auth.type !== "api-key" || !auth.apiKey) {
1931
+ throw new Error("Gemini requires an API key. Re-run onboarding to set one up.");
1932
+ }
1933
+ const google = createGoogleGenerativeAI({ apiKey: auth.apiKey });
1934
+ return google(model);
1935
+ }
1933
1936
  case "openai-oauth":
1934
1937
  throw new Error("Codex OAuth uses custom provider. This is a bug \u2014 please report.");
1935
1938
  case "ollama":
@@ -2463,14 +2466,26 @@ var apiCallTool = tool2({
2463
2466
  };
2464
2467
  }
2465
2468
  debugLog(`api_call raw: method=${method} path=${path6} body=${JSON.stringify(body)} bodyType=${typeof body} rest=${JSON.stringify(rest)}`);
2466
- const resolvedBody = resolveBody(body, rest, method);
2467
- 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)}`);
2468
2483
  const agentName = getActiveAgent();
2469
2484
  const noRetryPaths = ["/api/v1/trades", "/api/v1/board", "/api/v1/agents/register", "/api/v1/agents/me/rewards/claim"];
2470
2485
  const isRetryable = method === "GET" || method === "PUT" || !noRetryPaths.some((p) => path6.startsWith(p));
2471
2486
  const retryOpts = isRetryable ? {} : false;
2472
2487
  const isClaimPath = method === "POST" && path6.startsWith("/api/v1/agents/me/rewards/claim");
2473
- const result = await apiCall(method, path6, resolvedBody, agentName ?? void 0, retryOpts);
2488
+ const result = await apiCall(method, resolvedPath, resolvedBody, agentName ?? void 0, retryOpts);
2474
2489
  if (!result.ok) {
2475
2490
  if (isClaimPath && result.status === 409 && agentName) {
2476
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.3",
3
+ "version": "0.1.5",
4
4
  "description": "Terminal agent for the AstraNova living market universe",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,8 @@
21
21
  "start:debug": "node dist/astra.js --debug 2>debug.log",
22
22
  "start:gpt": "ASTRA_PROVIDER=openai ASTRA_MODEL=gpt-4o-mini node dist/astra.js",
23
23
  "start:gpt:debug": "ASTRA_PROVIDER=openai ASTRA_MODEL=gpt-4o-mini node dist/astra.js --debug 2>debug.log",
24
+ "start:claude:debug": "ASTRA_PROVIDER=claude ASTRA_MODEL=claude-haiku-4-5-20251001 node dist/astra.js --debug 2>debug.log",
25
+ "start:gemini:debug": "ASTRA_PROVIDER=google ASTRA_MODEL=gemini-2.5-flash node dist/astra.js --debug 2>debug.log",
24
26
  "dev": "tsup --watch",
25
27
  "build": "tsup",
26
28
  "lint": "eslint src/",