@spinalfluid/ultrac 0.1.20 → 0.1.21

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 (3) hide show
  1. package/README.md +3 -3
  2. package/dist/cli.js +13 -8
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,12 +10,12 @@ between input and output. The hosted API supports streaming and native tool call
10
10
 
11
11
  ```bash
12
12
  npm install -g @spinalfluid/ultrac
13
- ultrac login
14
- ultrac doctor
15
13
  ultrac
16
14
  ```
17
15
 
18
- The npm package is public. Model access still requires an approved Ultrac account and `ultrac login`.
16
+ The npm package is public. The first interactive `ultrac` launch opens browser sign-in automatically
17
+ and continues into the same terminal session after verification. Model access requires an approved
18
+ Ultrac account. You can also sign in explicitly with `ultrac login`.
19
19
  Requires Node.js >= 22.12.0. The command is `ultrac`; the package is `@spinalfluid/ultrac`.
20
20
  The unrelated public packages named `ultrac` and `ultracode` are different products.
21
21
 
package/dist/cli.js CHANGED
@@ -13811,13 +13811,9 @@ function registerLoginCommand(program2) {
13811
13811
  );
13812
13812
  }
13813
13813
  let apiKey = options.key?.trim();
13814
- let email;
13815
- let keyId;
13816
13814
  if (!apiKey && !options.manual) {
13817
- const signedIn = await browserLogin(baseUrl, options.browser);
13818
- apiKey = signedIn.apiKey;
13819
- email = signedIn.email;
13820
- keyId = signedIn.keyId;
13815
+ await signInWithBrowser({ baseUrl, browser: options.browser });
13816
+ return;
13821
13817
  } else if (!apiKey) {
13822
13818
  const loginUrl = loginUrlFor(baseUrl);
13823
13819
  console.log(`Create an API key at ${chalk4.cyan(loginUrl)} and paste it below.`);
@@ -13830,7 +13826,7 @@ function registerLoginCommand(program2) {
13830
13826
  stdin3.isTTY ? "No API key provided. Nothing was saved." : "No API key provided on stdin. Nothing was saved. Set ULTRAC_API_KEY for non-interactive use or pass an existing key with --key."
13831
13827
  );
13832
13828
  }
13833
- await verifyAndStore({ apiKey, baseUrl, email, keyId, pasted: Boolean(options.manual || options.key) });
13829
+ await verifyAndStore({ apiKey, baseUrl, pasted: Boolean(options.manual || options.key) });
13834
13830
  });
13835
13831
  program2.command("logout").description("Remove stored Ultrac credentials").action(async () => {
13836
13832
  const stored = await readCredentials();
@@ -13861,6 +13857,11 @@ function registerLoginCommand(program2) {
13861
13857
  if (stored?.createdAt) console.log(` since: ${stored.createdAt}`);
13862
13858
  });
13863
13859
  }
13860
+ async function signInWithBrowser(input) {
13861
+ const baseUrl = assertAllowedUltracBaseUrl(input.baseUrl);
13862
+ const signedIn = await browserLogin(baseUrl, input.browser !== false);
13863
+ await verifyAndStore({ ...signedIn, baseUrl, showStartupHint: !input.continueSession });
13864
+ }
13864
13865
  async function browserLogin(baseUrl, shouldOpen) {
13865
13866
  try {
13866
13867
  return await loginWithBrowser({
@@ -13905,7 +13906,7 @@ async function verifyAndStore(input) {
13905
13906
  });
13906
13907
  console.log(chalk4.green(`Signed in. Credentials saved to ${path}`));
13907
13908
  if (input.email) console.log(chalk4.gray(` ${input.email}`));
13908
- console.log(chalk4.gray("Run `ultrac` to start an interactive session."));
13909
+ if (input.showStartupHint !== false) console.log(chalk4.gray("Run `ultrac` to start an interactive session."));
13909
13910
  }
13910
13911
  async function revokeStoredKey(apiKey, baseUrl) {
13911
13912
  const url = currentKeyUrl(baseUrl);
@@ -19099,6 +19100,10 @@ async function runRepl(options, initialTask = "") {
19099
19100
  throw new Error("--max-steps must be a positive integer.");
19100
19101
  }
19101
19102
  const hasFallbackChain = Boolean(config.fallback?.chain?.length);
19103
+ if (providerName === "ultrac" && !hasFallbackChain && !await resolveUltracCredentials() && stdin5.isTTY && stdout5.isTTY) {
19104
+ console.log("Opening browser sign-in\u2026");
19105
+ await signInWithBrowser({ baseUrl: resolveBaseUrl().baseUrl, continueSession: true });
19106
+ }
19102
19107
  if (providerName === "ultrac" && !hasFallbackChain && !await resolveUltracCredentials()) {
19103
19108
  console.log(chalk11.yellow("You are not signed in to Ultrac."));
19104
19109
  console.log(`Run ${chalk11.white("ultrac login")} first, or start with ${chalk11.white("--provider echo")}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spinalfluid/ultrac",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Ultrac terminal agent harness for Cosmic 1, with local tools, browser sign-in, streamed answers, and resumable sessions.",
6
6
  "author": "Aditya Pundir",