@withone/cli 2.3.0 → 2.3.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.
@@ -3,7 +3,7 @@ import {
3
3
  readConfig,
4
4
  setOpenAiApiKey,
5
5
  writeConfig
6
- } from "./chunk-GGDXUXLM.js";
6
+ } from "./chunk-HTXZZQ6U.js";
7
7
 
8
8
  // src/lib/memory/config.ts
9
9
  var DEFAULT_MEMORY_CONFIG = {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  getCacheTtl,
7
7
  homeDir
8
- } from "./chunk-GGDXUXLM.js";
8
+ } from "./chunk-HTXZZQ6U.js";
9
9
 
10
10
  // src/lib/flow-runner.ts
11
11
  import fs3 from "fs";
@@ -2285,7 +2285,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
2285
2285
  if (flowStack.includes(resolvedKey)) {
2286
2286
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
2287
2287
  }
2288
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-YGRRUARS.js");
2288
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-SFECNAO2.js");
2289
2289
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
2290
2290
  const subContext = await executeFlow(
2291
2291
  subFlow,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getMemoryConfigOrDefault
3
- } from "./chunk-WMVVWO6N.js";
3
+ } from "./chunk-3HRC3IPE.js";
4
4
  import {
5
5
  getOpenAiApiKey,
6
6
  readConfig
7
- } from "./chunk-GGDXUXLM.js";
7
+ } from "./chunk-HTXZZQ6U.js";
8
8
 
9
9
  // src/lib/output.ts
10
10
  import * as p from "@clack/prompts";
@@ -205,6 +205,12 @@ function updateApiBase(url) {
205
205
  delete config.whoamiApiBase;
206
206
  writeConfig(config);
207
207
  }
208
+ function withKnowledgeAgent(accessControl, on) {
209
+ const next = { ...accessControl };
210
+ if (on) next.knowledgeAgent = true;
211
+ else delete next.knowledgeAgent;
212
+ return Object.keys(next).length ? next : void 0;
213
+ }
208
214
  function saveCredentials(apiKey, scope, opts) {
209
215
  const existing = scope === "project" ? readProjectConfig() : readGlobalConfig();
210
216
  const next = {
@@ -217,7 +223,14 @@ function saveCredentials(apiKey, scope, opts) {
217
223
  };
218
224
  if (opts.keyName) next.apiKeyName = opts.keyName;
219
225
  else delete next.apiKeyName;
220
- if (opts.knowledgeOnly) next.accessControl = { ...existing?.accessControl, knowledgeAgent: true };
226
+ const userSetKnowledge = !!existing?.accessControl?.knowledgeAgent && !existing.knowledgeAgentFromGrant;
227
+ if (opts.knowledgeOnly !== void 0 && !userSetKnowledge) {
228
+ const accessControl = withKnowledgeAgent(existing?.accessControl, opts.knowledgeOnly);
229
+ if (accessControl) next.accessControl = accessControl;
230
+ else delete next.accessControl;
231
+ if (opts.knowledgeOnly) next.knowledgeAgentFromGrant = true;
232
+ else delete next.knowledgeAgentFromGrant;
233
+ }
221
234
  writeConfig(next, scope);
222
235
  }
223
236
  function getCacheTtl() {
@@ -250,6 +263,7 @@ function updateAccessControl(settings) {
250
263
  } else {
251
264
  config.accessControl = cleaned;
252
265
  }
266
+ delete config.knowledgeAgentFromGrant;
253
267
  writeConfig(config);
254
268
  }
255
269
  function getWhoAmI() {
@@ -3,10 +3,10 @@ import {
3
3
  isAgentMode,
4
4
  json,
5
5
  requireMemoryInit
6
- } from "./chunk-5MDUKW5N.js";
6
+ } from "./chunk-FUCAK5RA.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-Y5JEZWWM.js";
9
+ } from "./chunk-NOPTG4GC.js";
10
10
 
11
11
  // src/commands/mem/sql.ts
12
12
  async function memSqlCommand(sql) {
@@ -5,11 +5,11 @@ import {
5
5
  getMemoryConfig,
6
6
  getMemoryConfigOrDefault,
7
7
  updateMemoryConfig
8
- } from "./chunk-WMVVWO6N.js";
8
+ } from "./chunk-3HRC3IPE.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  homeDir
12
- } from "./chunk-GGDXUXLM.js";
12
+ } from "./chunk-HTXZZQ6U.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-5MDUKW5N.js";
9
+ } from "./chunk-FUCAK5RA.js";
10
10
  import {
11
11
  getBackend,
12
12
  upsertRecord
13
- } from "./chunk-Y5JEZWWM.js";
13
+ } from "./chunk-NOPTG4GC.js";
14
14
 
15
15
  // src/commands/mem/migrate.ts
16
16
  import fs4 from "fs";
@@ -2,8 +2,8 @@ import {
2
2
  defaultSearchableText,
3
3
  embed,
4
4
  embedBatch
5
- } from "./chunk-WMVVWO6N.js";
6
- import "./chunk-GGDXUXLM.js";
5
+ } from "./chunk-3HRC3IPE.js";
6
+ import "./chunk-HTXZZQ6U.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-BWTPQPII.js";
15
+ } from "./chunk-6FA7KUNQ.js";
16
16
  import "./chunk-44CV5IMX.js";
17
- import "./chunk-GGDXUXLM.js";
17
+ import "./chunk-HTXZZQ6U.js";
18
18
  export {
19
19
  FlowRunner,
20
20
  collectStepTypes,
package/dist/index.js CHANGED
@@ -28,10 +28,10 @@ import {
28
28
  validateActionInput,
29
29
  walkSteps,
30
30
  writeCache
31
- } from "./chunk-BWTPQPII.js";
31
+ } from "./chunk-6FA7KUNQ.js";
32
32
  import {
33
33
  memSqlCommand
34
- } from "./chunk-V4LY2G2F.js";
34
+ } from "./chunk-IPAVHPRZ.js";
35
35
  import {
36
36
  collectIdentityKeys,
37
37
  countRecords,
@@ -62,7 +62,7 @@ import {
62
62
  writeDraftProfile,
63
63
  writePageToMemory,
64
64
  writeProfile
65
- } from "./chunk-C7GJ5GUQ.js";
65
+ } from "./chunk-SN6WYDOE.js";
66
66
  import {
67
67
  getByDotPath
68
68
  } from "./chunk-44CV5IMX.js";
@@ -86,7 +86,7 @@ import {
86
86
  semanticSearchUpgradeLine,
87
87
  setAgentMode,
88
88
  silenceWarningsInAgentMode
89
- } from "./chunk-5MDUKW5N.js";
89
+ } from "./chunk-FUCAK5RA.js";
90
90
  import {
91
91
  SCHEMA_VERSION,
92
92
  addRecord,
@@ -96,7 +96,7 @@ import {
96
96
  listBackendPlugins,
97
97
  loadBackendFromConfig,
98
98
  updateRecord
99
- } from "./chunk-Y5JEZWWM.js";
99
+ } from "./chunk-NOPTG4GC.js";
100
100
  import {
101
101
  DEFAULT_MEMORY_CONFIG,
102
102
  defaultSearchableText,
@@ -106,7 +106,7 @@ import {
106
106
  memoryConfigExists,
107
107
  setOpenAiApiKey,
108
108
  updateMemoryConfig
109
- } from "./chunk-WMVVWO6N.js";
109
+ } from "./chunk-3HRC3IPE.js";
110
110
  import {
111
111
  appendAnalyticsQueue,
112
112
  appendUsageLog,
@@ -143,7 +143,7 @@ import {
143
143
  writeConfig,
144
144
  writeUsageLog,
145
145
  writeUsageState
146
- } from "./chunk-GGDXUXLM.js";
146
+ } from "./chunk-HTXZZQ6U.js";
147
147
 
148
148
  // src/cli.ts
149
149
  import { createRequire as createRequire3 } from "module";
@@ -1794,7 +1794,7 @@ async function nonInteractiveInit(options) {
1794
1794
  let apiKey;
1795
1795
  let keyName;
1796
1796
  let grant;
1797
- let knowledgeOnly = false;
1797
+ let knowledgeOnly;
1798
1798
  let whoami;
1799
1799
  if (auth === "browser") {
1800
1800
  const result = await browserLogin({ scope });
@@ -2066,7 +2066,7 @@ async function handleUpdateKey(statuses, scope) {
2066
2066
  let newKey;
2067
2067
  let keyName;
2068
2068
  let grant;
2069
- let knowledgeOnly = false;
2069
+ let knowledgeOnly;
2070
2070
  let whoamiResult;
2071
2071
  if (authMethod === "browser") {
2072
2072
  const result = await browserLogin({ scope });
@@ -2136,7 +2136,8 @@ ${pc4.cyan(getApiKeyUrl())}`, `API Key ${scopeLabel(scope)}`);
2136
2136
  ].join("\n"),
2137
2137
  "Account"
2138
2138
  );
2139
- const ac = getAccessControl();
2139
+ saveCredentials(newKey, scope, { keyName, whoami: whoamiResult, knowledgeOnly });
2140
+ const ac = (scope === "project" ? readProjectConfig() : readGlobalConfig())?.accessControl ?? {};
2140
2141
  const reinstalled = [];
2141
2142
  for (const s of statuses) {
2142
2143
  if (s.globalMcp) {
@@ -2148,7 +2149,6 @@ ${pc4.cyan(getApiKeyUrl())}`, `API Key ${scopeLabel(scope)}`);
2148
2149
  reinstalled.push(`${s.agent.name} (project)`);
2149
2150
  }
2150
2151
  }
2151
- saveCredentials(newKey, scope, { keyName, whoami: whoamiResult, knowledgeOnly });
2152
2152
  if (reinstalled.length > 0) {
2153
2153
  p3.log.success(`Updated MCP configs: ${reinstalled.join(", ")}`);
2154
2154
  }
@@ -7413,7 +7413,7 @@ async function syncModel(api, profile, options) {
7413
7413
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
7414
7414
  (async () => {
7415
7415
  try {
7416
- const { getBackend: getBackend2 } = await import("./runtime-DTKLN6KX.js");
7416
+ const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
7417
7417
  const backend = await getBackend2();
7418
7418
  await Promise.race([
7419
7419
  backend.close(),
@@ -7779,7 +7779,7 @@ async function syncModel(api, profile, options) {
7779
7779
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
7780
7780
  }
7781
7781
  if (options.toMemory !== false) {
7782
- const backend = await (await import("./runtime-DTKLN6KX.js")).getBackend();
7782
+ const backend = await (await import("./runtime-HLW365HP.js")).getBackend();
7783
7783
  const type = `${platform}/${model}`;
7784
7784
  const existing = await backend.listKeysByType(type);
7785
7785
  const sourcePrefix = `${type}:`;
@@ -7880,7 +7880,7 @@ async function syncModel(api, profile, options) {
7880
7880
  let statusCounts;
7881
7881
  if (options.toMemory !== false) {
7882
7882
  try {
7883
- const backend = await (await import("./runtime-DTKLN6KX.js")).getBackend();
7883
+ const backend = await (await import("./runtime-HLW365HP.js")).getBackend();
7884
7884
  const typeName = `${platform}/${model}`;
7885
7885
  const [active, archived] = await Promise.all([
7886
7886
  backend.count(typeName, { status: "active" }),
@@ -9602,7 +9602,7 @@ ${result.total} results`);
9602
9602
  }
9603
9603
  }
9604
9604
  async function syncSqlCommand(platformModel, sql) {
9605
- const { syncSqlCommand: runSyncSql } = await import("./sql-5GNNGVNH.js");
9605
+ const { syncSqlCommand: runSyncSql } = await import("./sql-6I4LWPZF.js");
9606
9606
  await runSyncSql(platformModel, sql);
9607
9607
  }
9608
9608
  async function syncDeleteCommand(platformModel, options) {
@@ -9680,7 +9680,7 @@ async function syncDeleteCommand(platformModel, options) {
9680
9680
  async function maybeAutoMigrateLegacy(platform, models) {
9681
9681
  const dbSize = getDatabaseSize(platform);
9682
9682
  if (!dbSize || dbSize === "0 B") return;
9683
- const { getBackend: getBackend2 } = await import("./runtime-DTKLN6KX.js");
9683
+ const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
9684
9684
  const backend = await getBackend2();
9685
9685
  let memoryHasData = false;
9686
9686
  for (const model of models) {
@@ -9696,7 +9696,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9696
9696
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
9697
9697
  `
9698
9698
  );
9699
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-DWRR6FWW.js");
9699
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-GN3I6EZM.js");
9700
9700
  await memMigrateCommand3({ platform, yes: true });
9701
9701
  return;
9702
9702
  }
@@ -9705,7 +9705,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9705
9705
  initialValue: true
9706
9706
  });
9707
9707
  if (p6.isCancel(shouldMigrate) || !shouldMigrate) return;
9708
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-DWRR6FWW.js");
9708
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-GN3I6EZM.js");
9709
9709
  await memMigrateCommand2({ platform, yes: true });
9710
9710
  }
9711
9711
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -9766,7 +9766,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
9766
9766
  async function syncListCommand(platform) {
9767
9767
  const profiles = listProfiles(platform);
9768
9768
  const state = await readSyncState();
9769
- const { getBackend: getBackend2 } = await import("./runtime-DTKLN6KX.js");
9769
+ const { getBackend: getBackend2 } = await import("./runtime-HLW365HP.js");
9770
9770
  const backend = await getBackend2();
9771
9771
  const syncs = await Promise.all(profiles.map(async (p9) => {
9772
9772
  const modelState = state[p9.platform]?.[p9.model];
@@ -10042,7 +10042,7 @@ function registerSyncSubcommands(sync) {
10042
10042
  await syncSqlCommand(platformModel, sql);
10043
10043
  });
10044
10044
  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) => {
10045
- const { syncSchemaCommand } = await import("./schema-SQA46NFA.js");
10045
+ const { syncSchemaCommand } = await import("./schema-G7XYVIZG.js");
10046
10046
  await syncSchemaCommand(platformModel);
10047
10047
  });
10048
10048
  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) => {
@@ -10819,7 +10819,7 @@ async function memDoctorCommand() {
10819
10819
  }
10820
10820
  if (cfg.embedding.provider === "openai") {
10821
10821
  try {
10822
- const { embed: embed2 } = await import("./embedding-DRTGVWP3.js");
10822
+ const { embed: embed2 } = await import("./embedding-C7FIKORV.js");
10823
10823
  const result = await embed2("connectivity check");
10824
10824
  checks.push({
10825
10825
  name: "OpenAI embedding provider reachable",
@@ -3,12 +3,12 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-C7GJ5GUQ.js";
6
+ } from "./chunk-SN6WYDOE.js";
7
7
  import "./chunk-44CV5IMX.js";
8
- import "./chunk-5MDUKW5N.js";
9
- import "./chunk-Y5JEZWWM.js";
10
- import "./chunk-WMVVWO6N.js";
11
- import "./chunk-GGDXUXLM.js";
8
+ import "./chunk-FUCAK5RA.js";
9
+ import "./chunk-NOPTG4GC.js";
10
+ import "./chunk-3HRC3IPE.js";
11
+ import "./chunk-HTXZZQ6U.js";
12
12
  export {
13
13
  buildIdentityMap,
14
14
  dotPathToJsonbExpr,
@@ -5,9 +5,9 @@ import {
5
5
  resetBackendSingleton,
6
6
  updateRecord,
7
7
  upsertRecord
8
- } from "./chunk-Y5JEZWWM.js";
9
- import "./chunk-WMVVWO6N.js";
10
- import "./chunk-GGDXUXLM.js";
8
+ } from "./chunk-NOPTG4GC.js";
9
+ import "./chunk-3HRC3IPE.js";
10
+ import "./chunk-HTXZZQ6U.js";
11
11
  export {
12
12
  addRecord,
13
13
  closeBackendIfCached,
@@ -3,12 +3,12 @@ import {
3
3
  note,
4
4
  okJson,
5
5
  requireMemoryInit
6
- } from "./chunk-5MDUKW5N.js";
6
+ } from "./chunk-FUCAK5RA.js";
7
7
  import {
8
8
  getBackend
9
- } from "./chunk-Y5JEZWWM.js";
10
- import "./chunk-WMVVWO6N.js";
11
- import "./chunk-GGDXUXLM.js";
9
+ } from "./chunk-NOPTG4GC.js";
10
+ import "./chunk-3HRC3IPE.js";
11
+ import "./chunk-HTXZZQ6U.js";
12
12
 
13
13
  // src/lib/memory/sync/schema.ts
14
14
  import pc from "picocolors";
@@ -0,0 +1,12 @@
1
+ import {
2
+ memSqlCommand,
3
+ syncSqlCommand
4
+ } from "./chunk-IPAVHPRZ.js";
5
+ import "./chunk-FUCAK5RA.js";
6
+ import "./chunk-NOPTG4GC.js";
7
+ import "./chunk-3HRC3IPE.js";
8
+ import "./chunk-HTXZZQ6U.js";
9
+ export {
10
+ memSqlCommand,
11
+ syncSqlCommand
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,12 +0,0 @@
1
- import {
2
- memSqlCommand,
3
- syncSqlCommand
4
- } from "./chunk-V4LY2G2F.js";
5
- import "./chunk-5MDUKW5N.js";
6
- import "./chunk-Y5JEZWWM.js";
7
- import "./chunk-WMVVWO6N.js";
8
- import "./chunk-GGDXUXLM.js";
9
- export {
10
- memSqlCommand,
11
- syncSqlCommand
12
- };