@use-aistack/cli 0.6.0 → 0.6.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ The default command. Scan your local transcripts (rolling 30 days), review the f
18
18
  npx @use-aistack/cli sync
19
19
  ```
20
20
 
21
- Requires a one-time `login` first.
21
+ On an unlinked machine, `sync` starts the login flow inline — your browser opens to approve the machine, then the sync continues. One command is the whole onboarding.
22
22
 
23
23
  ### `npx @use-aistack/cli sync --auto on` / `off`
24
24
 
@@ -34,7 +34,7 @@ The silent run (`sync --auto`) never prompts and publishes only under this opt-i
34
34
 
35
35
  ### `npx @use-aistack/cli login`
36
36
 
37
- Link this machine to your AI Stack account via browser.
37
+ Link this machine to your AI Stack account via browser. Optional — `sync` runs this inline when the machine is not linked yet.
38
38
 
39
39
  ```sh
40
40
  npx @use-aistack/cli login
package/dist/index.js CHANGED
@@ -1572,8 +1572,7 @@ function proposedMachineName(read = hostname) {
1572
1572
  return void 0;
1573
1573
  }
1574
1574
  }
1575
- async function loginCommand() {
1576
- intro2("login");
1575
+ async function performLogin() {
1577
1576
  const s = p5.spinner();
1578
1577
  s.start("Starting authentication...");
1579
1578
  let session;
@@ -1583,8 +1582,7 @@ async function loginCommand() {
1583
1582
  } catch (err) {
1584
1583
  s.stop("Failed to start authentication");
1585
1584
  p5.log.error(err instanceof Error ? err.message : String(err));
1586
- outroError("error");
1587
- process.exit(1);
1585
+ return false;
1588
1586
  }
1589
1587
  p5.log.info(`${dim("CODE")} ${limeBold(session.userCode)}`);
1590
1588
  p5.log.info(`${dim("OPEN")} ${dim(session.authUrl)}`);
@@ -1604,29 +1602,33 @@ async function loginCommand() {
1604
1602
  if (result.status === "approved" && result.token) {
1605
1603
  s.stop(lime("Authenticated"));
1606
1604
  saveToken(result.token, result.userId);
1607
- p5.log.success(
1608
- `Token saved. Run ${limeBold("npx @use-aistack/cli collect")} to get started.`
1609
- );
1610
- outro2(lime("done"));
1611
- return;
1605
+ return true;
1612
1606
  }
1613
1607
  if (result.status === "expired") {
1614
1608
  s.stop("Session expired");
1615
1609
  p5.log.error("Authentication session expired. Please try again.");
1616
- outroError("expired");
1617
- process.exit(1);
1610
+ return false;
1618
1611
  }
1619
1612
  } catch (err) {
1620
1613
  s.stop("Error polling");
1621
1614
  p5.log.error(err instanceof Error ? err.message : String(err));
1622
- outroError("error");
1623
- process.exit(1);
1615
+ return false;
1624
1616
  }
1625
1617
  }
1626
1618
  s.stop("Timed out");
1627
1619
  p5.log.error("Authentication timed out after 3 minutes. Please try again.");
1628
- outroError("timed out");
1629
- process.exit(1);
1620
+ return false;
1621
+ }
1622
+ async function loginCommand() {
1623
+ intro2("login");
1624
+ if (!await performLogin()) {
1625
+ outroError("error");
1626
+ process.exit(1);
1627
+ }
1628
+ p5.log.success(
1629
+ `Token saved. Run ${limeBold("npx @use-aistack/cli sync")} to publish your usage.`
1630
+ );
1631
+ outro2(lime("done"));
1630
1632
  }
1631
1633
 
1632
1634
  // src/commands/sync.ts
@@ -1912,7 +1914,7 @@ import { stat as stat2 } from "fs/promises";
1912
1914
 
1913
1915
  // src/harness/shared/pricing.ts
1914
1916
  var PRICING_TABLE_VERSION = "anthropic-list-2026-07-25";
1915
- var OPENAI_PRICING_TABLE_VERSION = "openai-list-2026-08-01";
1917
+ var OPENAI_PRICING_TABLE_VERSION = "openai-list-2026-08-02";
1916
1918
  var CACHE_WRITE_5M_MULTIPLIER = 1.25;
1917
1919
  var CACHE_WRITE_1H_MULTIPLIER = 2;
1918
1920
  var CACHE_READ_MULTIPLIER = 0.1;
@@ -1935,11 +1937,23 @@ var PRICES = {
1935
1937
  "claude-opus-5#fast": [{ from: null, to: null, input: 10, output: 50 }],
1936
1938
  "claude-opus-4-8#fast": [{ from: null, to: null, input: 10, output: 50 }],
1937
1939
  // OpenAI (Codex) — standard-context tier (<272K; observed context window is
1938
- // 258,400). gpt-5.3-codex and the 5.6 line have NO published price yet, so
1939
- // they are deliberately absent and surface as unpriced (#66 decision 6).
1940
+ // 258,400).
1940
1941
  "gpt-5.5": [{ from: null, to: null, input: 5, output: 30 }],
1941
1942
  "gpt-5.4": [{ from: null, to: null, input: 2.5, output: 15 }],
1942
- "gpt-5.4-mini": [{ from: null, to: null, input: 0.75, output: 4.5 }]
1943
+ "gpt-5.4-mini": [{ from: null, to: null, input: 0.75, output: 4.5 }],
1944
+ "gpt-5.3-codex": [{ from: null, to: null, input: 1.75, output: 14 }],
1945
+ // The gpt-5.6 family launched 2026-07-29; Terra and Luna were repriced on
1946
+ // 2026-07-30 (-20% / -80%). The one-day launch rates are not on the list
1947
+ // page and are NOT encoded — a July-29 Terra/Luna record underprices for
1948
+ // one day rather than carrying a rate we cannot cite (#72).
1949
+ "gpt-5.6-sol": [{ from: null, to: null, input: 5, output: 30 }],
1950
+ "gpt-5.6-terra": [{ from: null, to: null, input: 2, output: 12 }],
1951
+ "gpt-5.6-luna": [{ from: null, to: null, input: 0.2, output: 1.2 }],
1952
+ // NOT on OpenAI's list page — an internal Codex routing label with no
1953
+ // official price (openai/codex#20981). Rate is the aggregator consensus
1954
+ // ($2.50 / $15.00), scoped in explicitly by ticket #72 because it carries
1955
+ // real token volume in Codex rollouts.
1956
+ "codex-auto-review": [{ from: null, to: null, input: 2.5, output: 15 }]
1943
1957
  };
1944
1958
  function normalizeModel(model) {
1945
1959
  const [base, suffix] = model.split("#");
@@ -3595,7 +3609,7 @@ async function stageSync(deps) {
3595
3609
  } else if (token === null) {
3596
3610
  blockedReason = "This machine is not linked. Run `npx @use-aistack/cli login` first.";
3597
3611
  } else if (config.stack === null) {
3598
- blockedReason = source === "bundled" ? "Could not fetch your settings from aistack, so the destination stack is unknown. Publish needs it. Check the network and preview again." : "The token resolves no destination stack. Run `npx @use-aistack/cli login` again to re-link this machine.";
3612
+ blockedReason = source === "bundled" ? "Could not fetch your settings from aistack, so the destination stack is unknown. Publish needs it. Check the network and preview again." : `The token resolves no destination stack. Create one at ${deps.baseUrl}/stacks/new, then sync again.`;
3599
3613
  }
3600
3614
  return {
3601
3615
  id: stageId(bodyJson),
@@ -3739,6 +3753,16 @@ async function syncCommand(options = {}) {
3739
3753
  process.exitCode = 1;
3740
3754
  return;
3741
3755
  }
3756
+ if (getToken() === null) {
3757
+ p7.log.message(
3758
+ "This machine is not linked to an aistack account yet \u2014 linking it first."
3759
+ );
3760
+ if (!await performLogin()) {
3761
+ outroError("login failed \u2014 nothing was sent");
3762
+ process.exitCode = 1;
3763
+ return;
3764
+ }
3765
+ }
3742
3766
  const s = p7.spinner();
3743
3767
  s.start("Scanning local agent transcripts");
3744
3768
  let staged;