@withone/cli 2.11.0 → 2.11.1

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
@@ -738,7 +738,7 @@ Drop a `.onerc` file in your project root to override global settings per-projec
738
738
  | Key | Purpose |
739
739
  |-----|---------|
740
740
  | `ONE_SECRET` | API key (also honored as env var) |
741
- | `ONE_API_BASE` | API base URL (also honored as env var) |
741
+ | `ONE_API_BASE` | API base URL, `https://api.withone.ai` or `https://development-api.withone.ai` only (the env var accepts any origin) |
742
742
  | `ONE_PERMISSIONS` | `admin` / `write` / `read` |
743
743
  | `ONE_CONNECTION_KEYS` | Comma-separated connection-key allowlist |
744
744
  | `ONE_ACTION_IDS` | Comma-separated action-ID allowlist |
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  okJson,
6
6
  requireMemoryInit
7
- } from "./chunk-VMFWA43Q.js";
7
+ } from "./chunk-VYOIHD4B.js";
8
8
  import {
9
9
  isAgentMode,
10
10
  note
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  getBackend,
14
14
  upsertRecord
15
- } from "./chunk-NOPTG4GC.js";
15
+ } from "./chunk-UYOXEMF5.js";
16
16
 
17
17
  // src/commands/mem/migrate.ts
18
18
  import fs4 from "fs";
@@ -180,11 +180,32 @@ function getAccessControl() {
180
180
  return readConfig()?.accessControl ?? {};
181
181
  }
182
182
  var DEFAULT_API_BASE = "https://api.withone.ai/v1";
183
+ var ONERC_API_HOSTS = /* @__PURE__ */ new Set(["api.withone.ai", "development-api.withone.ai"]);
184
+ function isHostedApiOrigin(value) {
185
+ try {
186
+ const url = new URL(value);
187
+ return url.protocol === "https:" && ONERC_API_HOSTS.has(url.hostname) && url.port === "" && url.username === "" && url.password === "";
188
+ } catch {
189
+ return false;
190
+ }
191
+ }
192
+ var warnedOneRcApiBase = false;
193
+ function warnIgnoredOneRcApiBase(value) {
194
+ if (warnedOneRcApiBase) return;
195
+ warnedOneRcApiBase = true;
196
+ process.stderr.write(
197
+ `Ignoring ONE_API_BASE=${value} from .onerc: only ${[...ONERC_API_HOSTS].map((h) => `https://${h}`).join(" and ")} are allowed there. Set ONE_API_BASE in the environment or apiBase in config for another backend.
198
+ `
199
+ );
200
+ }
183
201
  function getApiBase() {
184
202
  const override = process.env.ONE_API_BASE?.trim();
185
203
  if (override) return withV1(override);
186
204
  const rc = readOneRc().ONE_API_BASE?.trim();
187
- if (rc) return withV1(rc);
205
+ if (rc) {
206
+ if (isHostedApiOrigin(rc)) return withV1(rc);
207
+ warnIgnoredOneRcApiBase(rc);
208
+ }
188
209
  const config = readConfig();
189
210
  if (config?.apiBase) return withV1(config.apiBase);
190
211
  return DEFAULT_API_BASE;
@@ -3,7 +3,7 @@ import {
3
3
  readConfig,
4
4
  setOpenAiApiKey,
5
5
  writeConfig
6
- } from "./chunk-HTXZZQ6U.js";
6
+ } from "./chunk-FR4VGZUI.js";
7
7
 
8
8
  // src/lib/memory/config.ts
9
9
  var DEFAULT_MEMORY_CONFIG = {
@@ -24,7 +24,7 @@ import {
24
24
  writeAnalyticsQueue,
25
25
  writeUsageLog,
26
26
  writeUsageState
27
- } from "./chunk-HTXZZQ6U.js";
27
+ } from "./chunk-FR4VGZUI.js";
28
28
 
29
29
  // src/lib/flow-runner.ts
30
30
  import fs5 from "fs";
@@ -2977,7 +2977,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
2977
2977
  if (flowStack.includes(resolvedKey)) {
2978
2978
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
2979
2979
  }
2980
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-P23IZDWM.js");
2980
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-36I4G5BS.js");
2981
2981
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
2982
2982
  const subContext = await executeFlow(
2983
2983
  subFlow,
@@ -5,11 +5,11 @@ import {
5
5
  getMemoryConfig,
6
6
  getMemoryConfigOrDefault,
7
7
  updateMemoryConfig
8
- } from "./chunk-3HRC3IPE.js";
8
+ } from "./chunk-NC3HVQ7O.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  homeDir
12
- } from "./chunk-HTXZZQ6U.js";
12
+ } from "./chunk-FR4VGZUI.js";
13
13
 
14
14
  // src/lib/memory/schema.ts
15
15
  var SCHEMA_VERSION = "2.3.1";
@@ -5,11 +5,11 @@ import {
5
5
  } from "./chunk-Q6PWTATS.js";
6
6
  import {
7
7
  getMemoryConfigOrDefault
8
- } from "./chunk-3HRC3IPE.js";
8
+ } from "./chunk-NC3HVQ7O.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  readConfig
12
- } from "./chunk-HTXZZQ6U.js";
12
+ } from "./chunk-FR4VGZUI.js";
13
13
 
14
14
  // src/commands/mem/util.ts
15
15
  function requireMemoryInit() {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireMemoryInit
3
- } from "./chunk-VMFWA43Q.js";
3
+ } from "./chunk-VYOIHD4B.js";
4
4
  import {
5
5
  error,
6
6
  isAgentMode,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-Q6PWTATS.js";
9
9
  import {
10
10
  getBackend
11
- } from "./chunk-NOPTG4GC.js";
11
+ } from "./chunk-UYOXEMF5.js";
12
12
 
13
13
  // src/commands/mem/sql.ts
14
14
  async function memSqlCommand(sql) {
@@ -2,8 +2,8 @@ import {
2
2
  defaultSearchableText,
3
3
  embed,
4
4
  embedBatch
5
- } from "./chunk-3HRC3IPE.js";
6
- import "./chunk-HTXZZQ6U.js";
5
+ } from "./chunk-NC3HVQ7O.js";
6
+ import "./chunk-FR4VGZUI.js";
7
7
  export {
8
8
  defaultSearchableText,
9
9
  embed,
@@ -12,10 +12,10 @@ import {
12
12
  stripStepsAlias,
13
13
  summarizeFlowInputs,
14
14
  walkSteps
15
- } from "./chunk-5CPQHXTO.js";
15
+ } from "./chunk-RUVW6QYK.js";
16
16
  import "./chunk-44CV5IMX.js";
17
17
  import "./chunk-Q6PWTATS.js";
18
- import "./chunk-HTXZZQ6U.js";
18
+ import "./chunk-FR4VGZUI.js";
19
19
  export {
20
20
  FlowRunner,
21
21
  collectStepTypes,
package/dist/index.js CHANGED
@@ -42,10 +42,10 @@ import {
42
42
  validateActionInput,
43
43
  walkSteps,
44
44
  writeCache
45
- } from "./chunk-5CPQHXTO.js";
45
+ } from "./chunk-RUVW6QYK.js";
46
46
  import {
47
47
  memSqlCommand
48
- } from "./chunk-O3HDWHHS.js";
48
+ } from "./chunk-WWPH6JOO.js";
49
49
  import {
50
50
  collectIdentityKeys,
51
51
  countRecords,
@@ -76,7 +76,7 @@ import {
76
76
  writeDraftProfile,
77
77
  writePageToMemory,
78
78
  writeProfile
79
- } from "./chunk-PUQKTRYC.js";
79
+ } from "./chunk-5O5OUAHJ.js";
80
80
  import {
81
81
  getByDotPath
82
82
  } from "./chunk-44CV5IMX.js";
@@ -90,7 +90,7 @@ import {
90
90
  requireMemoryInit,
91
91
  semanticSearchUpgradeHint,
92
92
  semanticSearchUpgradeLine
93
- } from "./chunk-VMFWA43Q.js";
93
+ } from "./chunk-VYOIHD4B.js";
94
94
  import {
95
95
  cancel,
96
96
  createSpinner,
@@ -112,7 +112,7 @@ import {
112
112
  listBackendPlugins,
113
113
  loadBackendFromConfig,
114
114
  updateRecord
115
- } from "./chunk-NOPTG4GC.js";
115
+ } from "./chunk-UYOXEMF5.js";
116
116
  import {
117
117
  DEFAULT_MEMORY_CONFIG,
118
118
  defaultSearchableText,
@@ -122,7 +122,7 @@ import {
122
122
  memoryConfigExists,
123
123
  setOpenAiApiKey,
124
124
  updateMemoryConfig
125
- } from "./chunk-3HRC3IPE.js";
125
+ } from "./chunk-NC3HVQ7O.js";
126
126
  import {
127
127
  configExists,
128
128
  ensureWhoAmI,
@@ -148,7 +148,7 @@ import {
148
148
  updateApiBase,
149
149
  updateWhoAmI,
150
150
  writeConfig
151
- } from "./chunk-HTXZZQ6U.js";
151
+ } from "./chunk-FR4VGZUI.js";
152
152
 
153
153
  // src/cli.ts
154
154
  import { createRequire } from "module";
@@ -7427,7 +7427,7 @@ async function syncModel(api, profile, options) {
7427
7427
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
7428
7428
  (async () => {
7429
7429
  try {
7430
- const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
7430
+ const { getBackend: getBackend2 } = await import("./runtime-J4TQCY7Z.js");
7431
7431
  const backend = await getBackend2();
7432
7432
  await Promise.race([
7433
7433
  backend.close(),
@@ -7793,7 +7793,7 @@ async function syncModel(api, profile, options) {
7793
7793
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
7794
7794
  }
7795
7795
  if (options.toMemory !== false) {
7796
- const backend = await (await import("./runtime-HLW365HP.js")).getBackend();
7796
+ const backend = await (await import("./runtime-J4TQCY7Z.js")).getBackend();
7797
7797
  const type = `${platform}/${model}`;
7798
7798
  const existing = await backend.listKeysByType(type);
7799
7799
  const sourcePrefix = `${type}:`;
@@ -7894,7 +7894,7 @@ async function syncModel(api, profile, options) {
7894
7894
  let statusCounts;
7895
7895
  if (options.toMemory !== false) {
7896
7896
  try {
7897
- const backend = await (await import("./runtime-HLW365HP.js")).getBackend();
7897
+ const backend = await (await import("./runtime-J4TQCY7Z.js")).getBackend();
7898
7898
  const typeName = `${platform}/${model}`;
7899
7899
  const [active, archived] = await Promise.all([
7900
7900
  backend.count(typeName, { status: "active" }),
@@ -9616,7 +9616,7 @@ ${result.total} results`);
9616
9616
  }
9617
9617
  }
9618
9618
  async function syncSqlCommand(platformModel, sql) {
9619
- const { syncSqlCommand: runSyncSql } = await import("./sql-NDMMFQP6.js");
9619
+ const { syncSqlCommand: runSyncSql } = await import("./sql-XCMEVSVD.js");
9620
9620
  await runSyncSql(platformModel, sql);
9621
9621
  }
9622
9622
  async function syncDeleteCommand(platformModel, options) {
@@ -9694,7 +9694,7 @@ async function syncDeleteCommand(platformModel, options) {
9694
9694
  async function maybeAutoMigrateLegacy(platform, models) {
9695
9695
  const dbSize = getDatabaseSize(platform);
9696
9696
  if (!dbSize || dbSize === "0 B") return;
9697
- const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
9697
+ const { getBackend: getBackend2 } = await import("./runtime-J4TQCY7Z.js");
9698
9698
  const backend = await getBackend2();
9699
9699
  let memoryHasData = false;
9700
9700
  for (const model of models) {
@@ -9710,7 +9710,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9710
9710
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
9711
9711
  `
9712
9712
  );
9713
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-KWEEEQ3E.js");
9713
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-IKK2N3VW.js");
9714
9714
  await memMigrateCommand3({ platform, yes: true });
9715
9715
  return;
9716
9716
  }
@@ -9719,7 +9719,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9719
9719
  initialValue: true
9720
9720
  });
9721
9721
  if (p6.isCancel(shouldMigrate) || !shouldMigrate) return;
9722
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-KWEEEQ3E.js");
9722
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-IKK2N3VW.js");
9723
9723
  await memMigrateCommand2({ platform, yes: true });
9724
9724
  }
9725
9725
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -9780,7 +9780,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
9780
9780
  async function syncListCommand(platform) {
9781
9781
  const profiles = listProfiles(platform);
9782
9782
  const state = await readSyncState();
9783
- const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
9783
+ const { getBackend: getBackend2 } = await import("./runtime-J4TQCY7Z.js");
9784
9784
  const backend = await getBackend2();
9785
9785
  const syncs = await Promise.all(profiles.map(async (p9) => {
9786
9786
  const modelState = state[p9.platform]?.[p9.model];
@@ -10056,7 +10056,7 @@ function registerSyncSubcommands(sync) {
10056
10056
  await syncSqlCommand(platformModel, sql);
10057
10057
  });
10058
10058
  sync.command("schema <platform/model>").description("Inspect the JSON structure of synced records (field paths, types, examples) \u2014 useful before writing `sync sql` queries").action(async (platformModel) => {
10059
- const { syncSchemaCommand } = await import("./schema-YJ7JTGFL.js");
10059
+ const { syncSchemaCommand } = await import("./schema-JKYKFQZD.js");
10060
10060
  await syncSchemaCommand(platformModel);
10061
10061
  });
10062
10062
  sync.command("delete <platform/model>").description('Delete records from local sync data (e.g. one sync delete notion/pages --id "abc-123")').option("--id <value>", "Delete record by ID").option("--where <conditions>", 'Delete records matching conditions (e.g. "status=archived")').option("--where-sql <predicate>", `Delete using a raw SQL WHERE clause (e.g. "json_extract(data, '$.type') = 'promotion'")`).option("--yes", "Skip confirmation prompt").action(async (platformModel, options) => {
@@ -10833,7 +10833,7 @@ async function memDoctorCommand() {
10833
10833
  }
10834
10834
  if (cfg.embedding.provider === "openai") {
10835
10835
  try {
10836
- const { embed: embed2 } = await import("./embedding-C7FIKORV.js");
10836
+ const { embed: embed2 } = await import("./embedding-MVPO6QW7.js");
10837
10837
  const result = await embed2("connectivity check");
10838
10838
  checks.push({
10839
10839
  name: "OpenAI embedding provider reachable",
@@ -3,13 +3,13 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-PUQKTRYC.js";
6
+ } from "./chunk-5O5OUAHJ.js";
7
7
  import "./chunk-44CV5IMX.js";
8
- import "./chunk-VMFWA43Q.js";
8
+ import "./chunk-VYOIHD4B.js";
9
9
  import "./chunk-Q6PWTATS.js";
10
- import "./chunk-NOPTG4GC.js";
11
- import "./chunk-3HRC3IPE.js";
12
- import "./chunk-HTXZZQ6U.js";
10
+ import "./chunk-UYOXEMF5.js";
11
+ import "./chunk-NC3HVQ7O.js";
12
+ import "./chunk-FR4VGZUI.js";
13
13
  export {
14
14
  buildIdentityMap,
15
15
  dotPathToJsonbExpr,
@@ -5,9 +5,9 @@ import {
5
5
  resetBackendSingleton,
6
6
  updateRecord,
7
7
  upsertRecord
8
- } from "./chunk-NOPTG4GC.js";
9
- import "./chunk-3HRC3IPE.js";
10
- import "./chunk-HTXZZQ6U.js";
8
+ } from "./chunk-UYOXEMF5.js";
9
+ import "./chunk-NC3HVQ7O.js";
10
+ import "./chunk-FR4VGZUI.js";
11
11
  export {
12
12
  addRecord,
13
13
  closeBackendIfCached,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  okJson,
3
3
  requireMemoryInit
4
- } from "./chunk-VMFWA43Q.js";
4
+ } from "./chunk-VYOIHD4B.js";
5
5
  import {
6
6
  isAgentMode,
7
7
  note
8
8
  } from "./chunk-Q6PWTATS.js";
9
9
  import {
10
10
  getBackend
11
- } from "./chunk-NOPTG4GC.js";
12
- import "./chunk-3HRC3IPE.js";
13
- import "./chunk-HTXZZQ6U.js";
11
+ } from "./chunk-UYOXEMF5.js";
12
+ import "./chunk-NC3HVQ7O.js";
13
+ import "./chunk-FR4VGZUI.js";
14
14
 
15
15
  // src/lib/memory/sync/schema.ts
16
16
  import pc from "picocolors";
@@ -0,0 +1,13 @@
1
+ import {
2
+ memSqlCommand,
3
+ syncSqlCommand
4
+ } from "./chunk-WWPH6JOO.js";
5
+ import "./chunk-VYOIHD4B.js";
6
+ import "./chunk-Q6PWTATS.js";
7
+ import "./chunk-UYOXEMF5.js";
8
+ import "./chunk-NC3HVQ7O.js";
9
+ import "./chunk-FR4VGZUI.js";
10
+ export {
11
+ memSqlCommand,
12
+ syncSqlCommand
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,13 +0,0 @@
1
- import {
2
- memSqlCommand,
3
- syncSqlCommand
4
- } from "./chunk-O3HDWHHS.js";
5
- import "./chunk-VMFWA43Q.js";
6
- import "./chunk-Q6PWTATS.js";
7
- import "./chunk-NOPTG4GC.js";
8
- import "./chunk-3HRC3IPE.js";
9
- import "./chunk-HTXZZQ6U.js";
10
- export {
11
- memSqlCommand,
12
- syncSqlCommand
13
- };