@withone/cli 1.55.4 → 1.56.0

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
@@ -48,6 +48,8 @@ one login # Opens browser for authentication (global or per-directo
48
48
  one logout # Clear credentials (with scope picker and confirmation)
49
49
  ```
50
50
 
51
+ The browser consent page names the key and tags it with where this CLI is installed (scope, project path, machine, OS user, CLI version, chosen harnesses, and the per-install device id unless telemetry is off) so you can find and revoke it from Settings → API keys. The terminal prints exactly what will be sent before the browser opens.
52
+
51
53
  Requires Node.js 18+. `one sync` additionally needs Node 20+, because its
52
54
  local SQLite engine (`better-sqlite3`, an optional dependency) ships prebuilt
53
55
  binaries only for Node 20 and above. On Node 18 every other command works
@@ -162,6 +164,10 @@ one init --auth manual --api-key sk_live_... # headless / CI, no browser
162
164
  | `--auth <browser\|manual>` | Run setup with **no prompts**. `browser` opens a login window; `manual` uses `--api-key`. Scope from `-g`/`-p` (default global). |
163
165
  | `--api-key <key>` | API key for `--auth manual` (`sk_live_…` / `sk_test_…`) |
164
166
  | `--openai-key <key>` | Optional OpenAI key for `one mem` semantic search |
167
+ | `ONE_APP_URL` (env) | Dashboard origin the browser flows open (default `https://app.withone.ai`); use `http://localhost:4202` against a local frontend. |
168
+ | `ONE_API_BASE` (env) | API origin, overriding `apiBase` in config (default `https://api.withone.ai`); use `http://localhost:5005` against a local backend. |
169
+
170
+ Both overrides apply to the current process only and are never written to config, so a key minted against a local backend lands in your normal config and a cron job or MCP server without the variable would send it to the hosted API. Pair them with `ONE_HOME` (see below) to keep a local stack's credentials in a separate profile.
165
171
 
166
172
  ### `one add <platform>`
167
173
 
@@ -181,10 +181,18 @@ function getAccessControl() {
181
181
  }
182
182
  var DEFAULT_API_BASE = "https://api.withone.ai/v1";
183
183
  function getApiBase() {
184
+ const override = process.env.ONE_API_BASE?.trim();
185
+ if (override) return withV1(override);
186
+ const rc = readOneRc().ONE_API_BASE?.trim();
187
+ if (rc) return withV1(rc);
184
188
  const config = readConfig();
185
- if (config?.apiBase) return `${config.apiBase}/v1`;
189
+ if (config?.apiBase) return withV1(config.apiBase);
186
190
  return DEFAULT_API_BASE;
187
191
  }
192
+ function withV1(origin) {
193
+ const trimmed = origin.replace(/\/+$/, "");
194
+ return trimmed.endsWith("/v1") ? trimmed : `${trimmed}/v1`;
195
+ }
188
196
  function updateApiBase(url) {
189
197
  const config = readConfig();
190
198
  if (!config) return;
@@ -194,8 +202,23 @@ function updateApiBase(url) {
194
202
  delete config.apiBase;
195
203
  }
196
204
  delete config.whoami;
205
+ delete config.whoamiApiBase;
197
206
  writeConfig(config);
198
207
  }
208
+ function saveCredentials(apiKey, scope, opts) {
209
+ const existing = scope === "project" ? readProjectConfig() : readGlobalConfig();
210
+ const next = {
211
+ ...existing,
212
+ apiKey,
213
+ installedAgents: existing?.installedAgents ?? [],
214
+ createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
215
+ whoami: opts.whoami,
216
+ whoamiApiBase: getApiBase()
217
+ };
218
+ if (opts.keyName) next.apiKeyName = opts.keyName;
219
+ else delete next.apiKeyName;
220
+ writeConfig(next, scope);
221
+ }
199
222
  function getCacheTtl() {
200
223
  if (process.env.ONE_CACHE_TTL) {
201
224
  const val = parseInt(process.env.ONE_CACHE_TTL, 10);
@@ -229,12 +252,17 @@ function updateAccessControl(settings) {
229
252
  writeConfig(config);
230
253
  }
231
254
  function getWhoAmI() {
232
- return readConfig()?.whoami ?? null;
255
+ const config = readConfig();
256
+ if (!config?.whoami) return null;
257
+ const fetchedFrom = config.whoamiApiBase ?? withV1(config.apiBase ?? DEFAULT_API_BASE);
258
+ if (fetchedFrom !== getApiBase()) return null;
259
+ return config.whoami;
233
260
  }
234
261
  function updateWhoAmI(whoami) {
235
262
  const config = readConfig();
236
263
  if (!config) return;
237
264
  config.whoami = whoami;
265
+ config.whoamiApiBase = getApiBase();
238
266
  writeConfig(config);
239
267
  }
240
268
  async function ensureWhoAmI(api) {
@@ -393,6 +421,7 @@ export {
393
421
  getAccessControl,
394
422
  getApiBase,
395
423
  updateApiBase,
424
+ saveCredentials,
396
425
  getCacheTtl,
397
426
  updateAccessControl,
398
427
  getWhoAmI,
@@ -3,10 +3,10 @@ import {
3
3
  isAgentMode,
4
4
  json,
5
5
  requireMemoryInit
6
- } from "./chunk-GNSR3NYN.js";
6
+ } from "./chunk-OLQ55K6B.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-DDCDPVJH.js";
9
+ } from "./chunk-VH46MAE4.js";
10
10
 
11
11
  // src/commands/mem/sql.ts
12
12
  async function memSqlCommand(sql) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getMemoryConfigOrDefault
3
- } from "./chunk-5O5KODGV.js";
3
+ } from "./chunk-YMUY55U2.js";
4
4
  import {
5
5
  getOpenAiApiKey,
6
6
  readConfig
7
- } from "./chunk-EVEUGRCB.js";
7
+ } from "./chunk-6UB623BG.js";
8
8
 
9
9
  // src/lib/output.ts
10
10
  import * as p from "@clack/prompts";
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  getCacheTtl,
7
7
  homeDir
8
- } from "./chunk-EVEUGRCB.js";
8
+ } from "./chunk-6UB623BG.js";
9
9
 
10
10
  // src/lib/flow-runner.ts
11
11
  import fs3 from "fs";
@@ -2354,7 +2354,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
2354
2354
  if (flowStack.includes(resolvedKey)) {
2355
2355
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
2356
2356
  }
2357
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-MVSJ2GB7.js");
2357
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-QQ675PJD.js");
2358
2358
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
2359
2359
  const subContext = await executeFlow(
2360
2360
  subFlow,
@@ -5,11 +5,11 @@ import {
5
5
  getMemoryConfig,
6
6
  getMemoryConfigOrDefault,
7
7
  updateMemoryConfig
8
- } from "./chunk-5O5KODGV.js";
8
+ } from "./chunk-YMUY55U2.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  homeDir
12
- } from "./chunk-EVEUGRCB.js";
12
+ } from "./chunk-6UB623BG.js";
13
13
 
14
14
  // src/lib/memory/schema.ts
15
15
  var SCHEMA_VERSION = "2.3.1";
@@ -6,11 +6,11 @@ import {
6
6
  note,
7
7
  okJson,
8
8
  requireMemoryInit
9
- } from "./chunk-GNSR3NYN.js";
9
+ } from "./chunk-OLQ55K6B.js";
10
10
  import {
11
11
  getBackend,
12
12
  upsertRecord
13
- } from "./chunk-DDCDPVJH.js";
13
+ } from "./chunk-VH46MAE4.js";
14
14
 
15
15
  // src/commands/mem/migrate.ts
16
16
  import fs4 from "fs";
@@ -3,7 +3,7 @@ import {
3
3
  readConfig,
4
4
  setOpenAiApiKey,
5
5
  writeConfig
6
- } from "./chunk-EVEUGRCB.js";
6
+ } from "./chunk-6UB623BG.js";
7
7
 
8
8
  // src/lib/memory/config.ts
9
9
  var DEFAULT_MEMORY_CONFIG = {
@@ -2,8 +2,8 @@ import {
2
2
  defaultSearchableText,
3
3
  embed,
4
4
  embedBatch
5
- } from "./chunk-5O5KODGV.js";
6
- import "./chunk-EVEUGRCB.js";
5
+ } from "./chunk-YMUY55U2.js";
6
+ import "./chunk-6UB623BG.js";
7
7
  export {
8
8
  defaultSearchableText,
9
9
  embed,
@@ -12,9 +12,9 @@ import {
12
12
  stripStepsAlias,
13
13
  summarizeFlowInputs,
14
14
  walkSteps
15
- } from "./chunk-WXJWF7QG.js";
15
+ } from "./chunk-QCXFSOTS.js";
16
16
  import "./chunk-44CV5IMX.js";
17
- import "./chunk-EVEUGRCB.js";
17
+ import "./chunk-6UB623BG.js";
18
18
  export {
19
19
  FlowRunner,
20
20
  collectStepTypes,