@withone/cli 2.12.0 → 2.13.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
@@ -748,6 +748,8 @@ Precedence: env var > `.onerc` > `~/.one/config.json`. The access keys are the e
748
748
 
749
749
  The access settings are enforced on every call to a connected app, whatever the command: `actions execute`, flows, sync and its validation runs. Headers named `x-one-secret`, `x-one-connection-key` or `x-one-action-id` cannot be passed with `--headers`, method-override headers are judged against the permission level, and a path variable cannot be `.` or `..`.
750
750
 
751
+ They also apply to commands that change One's own resources. Creating, updating or activating a relay needs the `write` level and deleting one needs `admin`; `connection delete` needs `admin`; knowledge-only refuses all of them. A relay's `passthrough` actions are checked like `actions execute` when they are set, because they run later on One's servers. `url` and `agent` relay actions are allowed only when the connection and action allowlists are both `*`. With a connection allowlist, relay endpoints, events and deliveries on other connections are hidden or refused.
752
+
751
753
  ```bash
752
754
  # .onerc
753
755
  ONE_SECRET=sk_live_xxx
@@ -3,7 +3,7 @@ import {
3
3
  readConfig,
4
4
  setOpenAiApiKey,
5
5
  writeConfig
6
- } from "./chunk-EWHFGWB3.js";
6
+ } from "./chunk-XUAUDMQE.js";
7
7
 
8
8
  // src/lib/memory/config.ts
9
9
  var DEFAULT_MEMORY_CONFIG = {
@@ -5,11 +5,11 @@ import {
5
5
  getMemoryConfig,
6
6
  getMemoryConfigOrDefault,
7
7
  updateMemoryConfig
8
- } from "./chunk-EITBMRUB.js";
8
+ } from "./chunk-2OIJGF77.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  homeDir
12
- } from "./chunk-EWHFGWB3.js";
12
+ } from "./chunk-XUAUDMQE.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-EITBMRUB.js";
8
+ } from "./chunk-2OIJGF77.js";
9
9
  import {
10
10
  getOpenAiApiKey,
11
11
  readConfig
12
- } from "./chunk-EWHFGWB3.js";
12
+ } from "./chunk-XUAUDMQE.js";
13
13
 
14
14
  // src/commands/mem/util.ts
15
15
  function requireMemoryInit() {
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  okJson,
6
6
  requireMemoryInit
7
- } from "./chunk-J7JWBH45.js";
7
+ } from "./chunk-B5YDLVY5.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-6IRGRC3G.js";
15
+ } from "./chunk-4H5L3SBY.js";
16
16
 
17
17
  // src/commands/mem/migrate.ts
18
18
  import fs4 from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireMemoryInit
3
- } from "./chunk-J7JWBH45.js";
3
+ } from "./chunk-B5YDLVY5.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-6IRGRC3G.js";
11
+ } from "./chunk-4H5L3SBY.js";
12
12
 
13
13
  // src/commands/mem/sql.ts
14
14
  async function memSqlCommand(sql) {
@@ -29,7 +29,7 @@ import {
29
29
  writeAnalyticsQueue,
30
30
  writeUsageLog,
31
31
  writeUsageState
32
- } from "./chunk-EWHFGWB3.js";
32
+ } from "./chunk-XUAUDMQE.js";
33
33
 
34
34
  // src/lib/flow-runner.ts
35
35
  import fs5 from "fs";
@@ -3000,7 +3000,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
3000
3000
  if (flowStack.includes(resolvedKey)) {
3001
3001
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
3002
3002
  }
3003
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-6QTY3U2C.js");
3003
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-Y4DW3UD3.js");
3004
3004
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
3005
3005
  const subContext = await executeFlow(
3006
3006
  subFlow,
@@ -78,6 +78,42 @@ function intersectAllowlists(a, b) {
78
78
  if (b.includes("*")) return a;
79
79
  return a.filter((x) => b.includes(x));
80
80
  }
81
+ function checkManagementAccess(settings, op, what) {
82
+ const permissions = settings.permissions ?? "admin";
83
+ if (settings.knowledgeAgent) {
84
+ throw new AccessDeniedError(`${what} is disabled (knowledge-only mode).`);
85
+ }
86
+ const method = op === "delete" ? "DELETE" : "POST";
87
+ if (!isMethodAllowed(method, permissions)) {
88
+ throw new AccessDeniedError(`${what} needs ${op === "delete" ? 'the "admin"' : 'the "write" or "admin"'} permission level (current: "${permissions}").`);
89
+ }
90
+ }
91
+ function allowlistsUnrestricted(settings) {
92
+ return (settings.actionIds ?? ["*"]).includes("*") && (settings.connectionKeys ?? ["*"]).includes("*");
93
+ }
94
+ async function checkRelayActions(settings, actions, methodOf) {
95
+ if (actions === void 0 || actions === null) return;
96
+ if (!Array.isArray(actions)) throw new AccessDeniedError("--actions must be a JSON array.");
97
+ for (const [i, raw] of actions.entries()) {
98
+ const action = raw ?? {};
99
+ if (action.type === "passthrough") {
100
+ const actionId = String(action.actionId ?? "");
101
+ const connectionKey = String(action.connectionKey ?? "");
102
+ if (!actionId || !connectionKey) {
103
+ throw new AccessDeniedError(`Relay action [${i}] needs an actionId and a connectionKey.`);
104
+ }
105
+ checkPassthroughAccess({ ...settings, permissions: "admin", knowledgeAgent: false }, { actionId, connectionKey, method: "GET" });
106
+ const headers = action.headers && typeof action.headers === "object" ? action.headers : void 0;
107
+ checkPassthroughAccess(settings, { actionId, connectionKey, method: await methodOf(actionId), headers });
108
+ continue;
109
+ }
110
+ if (!allowlistsUnrestricted(settings)) {
111
+ throw new AccessDeniedError(
112
+ `Relay action [${i}] of type "${String(action.type)}" forwards events outside the connection and action allowlists, so it is allowed only when both are "*".`
113
+ );
114
+ }
115
+ }
116
+ }
81
117
 
82
118
  // src/lib/config.ts
83
119
  function configDir() {
@@ -535,8 +571,11 @@ export {
535
571
  PERMISSION_METHODS,
536
572
  isMethodAllowed,
537
573
  isActionAllowed,
574
+ isConnectionAllowed,
538
575
  IDENTITY_HEADERS,
539
576
  checkPassthroughAccess,
577
+ checkManagementAccess,
578
+ checkRelayActions,
540
579
  getProjectRoot,
541
580
  getProjectConfigPath,
542
581
  getGlobalConfigPath,
@@ -2,8 +2,8 @@ import {
2
2
  defaultSearchableText,
3
3
  embed,
4
4
  embedBatch
5
- } from "./chunk-EITBMRUB.js";
6
- import "./chunk-EWHFGWB3.js";
5
+ } from "./chunk-2OIJGF77.js";
6
+ import "./chunk-XUAUDMQE.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-7ZBRP3BJ.js";
15
+ } from "./chunk-UZC3IHLW.js";
16
16
  import "./chunk-44CV5IMX.js";
17
17
  import "./chunk-Q6PWTATS.js";
18
- import "./chunk-EWHFGWB3.js";
18
+ import "./chunk-XUAUDMQE.js";
19
19
  export {
20
20
  FlowRunner,
21
21
  collectStepTypes,
package/dist/index.js CHANGED
@@ -39,10 +39,10 @@ import {
39
39
  validateActionInput,
40
40
  walkSteps,
41
41
  writeCache
42
- } from "./chunk-7ZBRP3BJ.js";
42
+ } from "./chunk-UZC3IHLW.js";
43
43
  import {
44
44
  memSqlCommand
45
- } from "./chunk-DGQOAFXJ.js";
45
+ } from "./chunk-TSMVFVQ3.js";
46
46
  import {
47
47
  collectIdentityKeys,
48
48
  countRecords,
@@ -73,7 +73,7 @@ import {
73
73
  writeDraftProfile,
74
74
  writePageToMemory,
75
75
  writeProfile
76
- } from "./chunk-WZTPSXHP.js";
76
+ } from "./chunk-LEJKEGB6.js";
77
77
  import {
78
78
  getByDotPath
79
79
  } from "./chunk-44CV5IMX.js";
@@ -87,7 +87,7 @@ import {
87
87
  requireMemoryInit,
88
88
  semanticSearchUpgradeHint,
89
89
  semanticSearchUpgradeLine
90
- } from "./chunk-J7JWBH45.js";
90
+ } from "./chunk-B5YDLVY5.js";
91
91
  import {
92
92
  cancel,
93
93
  createSpinner,
@@ -109,7 +109,7 @@ import {
109
109
  listBackendPlugins,
110
110
  loadBackendFromConfig,
111
111
  updateRecord
112
- } from "./chunk-6IRGRC3G.js";
112
+ } from "./chunk-4H5L3SBY.js";
113
113
  import {
114
114
  DEFAULT_MEMORY_CONFIG,
115
115
  defaultSearchableText,
@@ -119,9 +119,11 @@ import {
119
119
  memoryConfigExists,
120
120
  setOpenAiApiKey,
121
121
  updateMemoryConfig
122
- } from "./chunk-EITBMRUB.js";
122
+ } from "./chunk-2OIJGF77.js";
123
123
  import {
124
124
  PERMISSION_METHODS,
125
+ checkManagementAccess,
126
+ checkRelayActions,
125
127
  configExists,
126
128
  ensureWhoAmI,
127
129
  getAccessControl,
@@ -137,6 +139,7 @@ import {
137
139
  globalConfigExists,
138
140
  homeDir,
139
141
  isActionAllowed,
142
+ isConnectionAllowed,
140
143
  isMethodAllowed,
141
144
  projectConfigExists,
142
145
  readConfig,
@@ -148,7 +151,7 @@ import {
148
151
  updateApiBase,
149
152
  updateWhoAmI,
150
153
  writeConfig
151
- } from "./chunk-EWHFGWB3.js";
154
+ } from "./chunk-XUAUDMQE.js";
152
155
 
153
156
  // src/cli.ts
154
157
  import { createRequire } from "module";
@@ -2448,6 +2451,11 @@ async function connectionDeleteCommand(connectionKey, options) {
2448
2451
  if (!apiKey) {
2449
2452
  error("Not configured. Run `one init` first.");
2450
2453
  }
2454
+ try {
2455
+ checkManagementAccess(getAccessControlFromAllSources(), "delete", "Deleting a connection");
2456
+ } catch (error2) {
2457
+ error(error2 instanceof Error ? error2.message : String(error2));
2458
+ }
2451
2459
  const api = new OneApi(apiKey, getApiBase());
2452
2460
  const spinner = createSpinner();
2453
2461
  spinner.start("Finding connection...");
@@ -5525,9 +5533,45 @@ function getConfig3() {
5525
5533
  if (!apiKey) {
5526
5534
  error("Not configured. Run `one init` first.");
5527
5535
  }
5528
- const ac = getAccessControlFromAllSources();
5529
- const connectionKeys = ac.connectionKeys || ["*"];
5530
- return { apiKey, connectionKeys };
5536
+ const settings = getAccessControlFromAllSources();
5537
+ const connectionKeys = settings.connectionKeys || ["*"];
5538
+ return { apiKey, connectionKeys, settings };
5539
+ }
5540
+ async function connectionIdFilter(api, settings) {
5541
+ const keys = settings.connectionKeys ?? ["*"];
5542
+ if (keys.includes("*")) return () => true;
5543
+ const connections = await api.listConnections();
5544
+ const ids = new Set(connections.filter((c) => isConnectionAllowed(c.key, keys)).map((c) => c.id));
5545
+ return (id) => ids.has(id);
5546
+ }
5547
+ function restricted(settings) {
5548
+ return !(settings.connectionKeys ?? ["*"]).includes("*");
5549
+ }
5550
+ async function allowedEndpoint(api, settings, id) {
5551
+ const allowed = await connectionIdFilter(api, settings);
5552
+ const endpoint = await api.getRelayEndpoint(id);
5553
+ if (!allowed(endpoint.connectionId)) {
5554
+ throw new Error(`Relay endpoint "${id}" is on a connection that is not allowed.`);
5555
+ }
5556
+ return endpoint;
5557
+ }
5558
+ async function allowedEvent(api, settings, id) {
5559
+ const allowed = await connectionIdFilter(api, settings);
5560
+ const event = await api.getRelayEvent(id);
5561
+ if (!allowed(event.connectionId)) {
5562
+ throw new Error(`Relay event "${id}" is on a connection that is not allowed.`);
5563
+ }
5564
+ return event;
5565
+ }
5566
+ function actionMethod(api) {
5567
+ return async (actionId) => (await resolveActionDetails(api, actionId)).details.method;
5568
+ }
5569
+ function guard(check) {
5570
+ try {
5571
+ check();
5572
+ } catch (error2) {
5573
+ error(error2 instanceof Error ? error2.message : String(error2));
5574
+ }
5531
5575
  }
5532
5576
  function parseJsonArg3(value, argName) {
5533
5577
  try {
@@ -5537,7 +5581,8 @@ function parseJsonArg3(value, argName) {
5537
5581
  }
5538
5582
  }
5539
5583
  async function relayCreateCommand(options) {
5540
- const { apiKey, connectionKeys } = getConfig3();
5584
+ const { apiKey, connectionKeys, settings } = getConfig3();
5585
+ guard(() => checkManagementAccess(settings, "write", "Creating a relay endpoint"));
5541
5586
  if (!connectionKeys.includes("*") && !connectionKeys.includes(options.connectionKey)) {
5542
5587
  error(`Connection key "${options.connectionKey}" is not allowed.`);
5543
5588
  }
@@ -5577,7 +5622,7 @@ async function relayCreateCommand(options) {
5577
5622
  }
5578
5623
  }
5579
5624
  async function relayListCommand(options) {
5580
- const { apiKey } = getConfig3();
5625
+ const { apiKey, settings } = getConfig3();
5581
5626
  const api = new OneApi(apiKey, getApiBase());
5582
5627
  const spinner = createSpinner();
5583
5628
  spinner.start("Loading relay endpoints...");
@@ -5586,10 +5631,13 @@ async function relayListCommand(options) {
5586
5631
  if (options.limit) query.limit = options.limit;
5587
5632
  if (options.page) query.page = options.page;
5588
5633
  const result = await api.listRelayEndpoints(query);
5589
- const endpoints = result.rows || [];
5634
+ const allowed = await connectionIdFilter(api, settings);
5635
+ const endpoints = (result.rows || []).filter((e) => allowed(e.connectionId));
5590
5636
  if (isAgentMode()) {
5591
5637
  json({
5592
- total: result.total,
5638
+ // With a connection allowlist the server's total also counts rows
5639
+ // the allowlist hides, so report only what is shown.
5640
+ total: restricted(settings) ? endpoints.length : result.total,
5593
5641
  showing: endpoints.length,
5594
5642
  endpoints: endpoints.map((e) => ({
5595
5643
  id: e.id,
@@ -5630,12 +5678,12 @@ async function relayListCommand(options) {
5630
5678
  }
5631
5679
  }
5632
5680
  async function relayGetCommand(id) {
5633
- const { apiKey } = getConfig3();
5681
+ const { apiKey, settings } = getConfig3();
5634
5682
  const api = new OneApi(apiKey, getApiBase());
5635
5683
  const spinner = createSpinner();
5636
5684
  spinner.start("Loading relay endpoint...");
5637
5685
  try {
5638
- const result = await api.getRelayEndpoint(id);
5686
+ const result = await allowedEndpoint(api, settings, id);
5639
5687
  if (isAgentMode()) {
5640
5688
  json(result);
5641
5689
  return;
@@ -5661,7 +5709,8 @@ async function relayGetCommand(id) {
5661
5709
  }
5662
5710
  }
5663
5711
  async function relayUpdateCommand(id, options) {
5664
- const { apiKey } = getConfig3();
5712
+ const { apiKey, settings } = getConfig3();
5713
+ guard(() => checkManagementAccess(settings, "write", "Updating a relay endpoint"));
5665
5714
  const api = new OneApi(apiKey, getApiBase());
5666
5715
  const spinner = createSpinner();
5667
5716
  spinner.start("Updating relay endpoint...");
@@ -5672,6 +5721,9 @@ async function relayUpdateCommand(id, options) {
5672
5721
  if (options.eventFilters) body.eventFilters = parseJsonArg3(options.eventFilters, "--event-filters");
5673
5722
  if (options.tags) body.tags = parseJsonArg3(options.tags, "--tags");
5674
5723
  if (options.actions) body.actions = parseJsonArg3(options.actions, "--actions");
5724
+ const existing = await allowedEndpoint(api, settings, id);
5725
+ const effective = body.actions ?? (options.active === true ? existing.actions : void 0);
5726
+ await checkRelayActions(settings, effective, actionMethod(api));
5675
5727
  const result = await api.updateRelayEndpoint(id, body);
5676
5728
  if (isAgentMode()) {
5677
5729
  json(result);
@@ -5688,11 +5740,13 @@ async function relayUpdateCommand(id, options) {
5688
5740
  }
5689
5741
  }
5690
5742
  async function relayDeleteCommand(id) {
5691
- const { apiKey } = getConfig3();
5743
+ const { apiKey, settings } = getConfig3();
5744
+ guard(() => checkManagementAccess(settings, "delete", "Deleting a relay endpoint"));
5692
5745
  const api = new OneApi(apiKey, getApiBase());
5693
5746
  const spinner = createSpinner();
5694
5747
  spinner.start("Deleting relay endpoint...");
5695
5748
  try {
5749
+ await allowedEndpoint(api, settings, id);
5696
5750
  const result = await api.deleteRelayEndpoint(id);
5697
5751
  if (isAgentMode()) {
5698
5752
  json({ deleted: true, id: result.id });
@@ -5707,12 +5761,15 @@ async function relayDeleteCommand(id) {
5707
5761
  }
5708
5762
  }
5709
5763
  async function relayActivateCommand(id, options) {
5710
- const { apiKey } = getConfig3();
5764
+ const { apiKey, settings } = getConfig3();
5765
+ guard(() => checkManagementAccess(settings, "write", "Activating a relay endpoint"));
5711
5766
  const api = new OneApi(apiKey, getApiBase());
5712
5767
  const spinner = createSpinner();
5713
5768
  spinner.start("Activating relay endpoint...");
5714
5769
  try {
5715
5770
  const actions2 = parseJsonArg3(options.actions, "--actions");
5771
+ await allowedEndpoint(api, settings, id);
5772
+ await checkRelayActions(settings, actions2, actionMethod(api));
5716
5773
  const body = { actions: actions2 };
5717
5774
  if (options.webhookSecret) body.webhookSecret = options.webhookSecret;
5718
5775
  const result = await api.activateRelayEndpoint(id, body);
@@ -5731,7 +5788,7 @@ async function relayActivateCommand(id, options) {
5731
5788
  }
5732
5789
  }
5733
5790
  async function relayEventsCommand(options) {
5734
- const { apiKey } = getConfig3();
5791
+ const { apiKey, settings } = getConfig3();
5735
5792
  const api = new OneApi(apiKey, getApiBase());
5736
5793
  const spinner = createSpinner();
5737
5794
  spinner.start("Loading relay events...");
@@ -5744,10 +5801,13 @@ async function relayEventsCommand(options) {
5744
5801
  if (options.after) query.after = options.after;
5745
5802
  if (options.before) query.before = options.before;
5746
5803
  const result = await api.listRelayEvents(query);
5747
- const events = result.rows || [];
5804
+ const allowed = await connectionIdFilter(api, settings);
5805
+ const events = (result.rows || []).filter((e) => allowed(e.connectionId));
5748
5806
  if (isAgentMode()) {
5749
5807
  json({
5750
- total: result.total,
5808
+ // With a connection allowlist the server's total also counts rows
5809
+ // the allowlist hides, so report only what is shown.
5810
+ total: restricted(settings) ? events.length : result.total,
5751
5811
  showing: events.length,
5752
5812
  events: events.map((e) => ({
5753
5813
  id: e.id,
@@ -5783,12 +5843,12 @@ async function relayEventsCommand(options) {
5783
5843
  }
5784
5844
  }
5785
5845
  async function relayEventGetCommand(id) {
5786
- const { apiKey } = getConfig3();
5846
+ const { apiKey, settings } = getConfig3();
5787
5847
  const api = new OneApi(apiKey, getApiBase());
5788
5848
  const spinner = createSpinner();
5789
5849
  spinner.start("Loading relay event...");
5790
5850
  try {
5791
- const result = await api.getRelayEvent(id);
5851
+ const result = await allowedEvent(api, settings, id);
5792
5852
  if (isAgentMode()) {
5793
5853
  json(result);
5794
5854
  return;
@@ -5811,11 +5871,13 @@ async function relayDeliveriesCommand(options) {
5811
5871
  if (!options.endpointId && !options.eventId) {
5812
5872
  error("Provide either --endpoint-id or --event-id");
5813
5873
  }
5814
- const { apiKey } = getConfig3();
5874
+ const { apiKey, settings } = getConfig3();
5815
5875
  const api = new OneApi(apiKey, getApiBase());
5816
5876
  const spinner = createSpinner();
5817
5877
  spinner.start("Loading deliveries...");
5818
5878
  try {
5879
+ if (options.endpointId) await allowedEndpoint(api, settings, options.endpointId);
5880
+ else await allowedEvent(api, settings, options.eventId);
5819
5881
  const deliveries = options.endpointId ? await api.listRelayEndpointDeliveries(options.endpointId) : await api.listRelayEventDeliveries(options.eventId);
5820
5882
  const items = Array.isArray(deliveries) ? deliveries : deliveries.rows || [];
5821
5883
  if (isAgentMode()) {
@@ -7427,7 +7489,7 @@ async function syncModel(api, profile, options) {
7427
7489
  updateModelState(platform, model, { status: "failed", pagesProcessed, lastCursor }),
7428
7490
  (async () => {
7429
7491
  try {
7430
- const { getBackend: getBackend2 } = await import("./runtime-WB4J6RQK.js");
7492
+ const { getBackend: getBackend2 } = await import("./runtime-2OVXKNJS.js");
7431
7493
  const backend = await getBackend2();
7432
7494
  await Promise.race([
7433
7495
  backend.close(),
@@ -7793,7 +7855,7 @@ async function syncModel(api, profile, options) {
7793
7855
  db.exec(`DROP TABLE IF EXISTS _seen_ids`);
7794
7856
  }
7795
7857
  if (options.toMemory !== false) {
7796
- const backend = await (await import("./runtime-WB4J6RQK.js")).getBackend();
7858
+ const backend = await (await import("./runtime-2OVXKNJS.js")).getBackend();
7797
7859
  const type = `${platform}/${model}`;
7798
7860
  const existing = await backend.listKeysByType(type);
7799
7861
  const sourcePrefix = `${type}:`;
@@ -7894,7 +7956,7 @@ async function syncModel(api, profile, options) {
7894
7956
  let statusCounts;
7895
7957
  if (options.toMemory !== false) {
7896
7958
  try {
7897
- const backend = await (await import("./runtime-WB4J6RQK.js")).getBackend();
7959
+ const backend = await (await import("./runtime-2OVXKNJS.js")).getBackend();
7898
7960
  const typeName = `${platform}/${model}`;
7899
7961
  const [active, archived] = await Promise.all([
7900
7962
  backend.count(typeName, { status: "active" }),
@@ -9616,7 +9678,7 @@ ${result.total} results`);
9616
9678
  }
9617
9679
  }
9618
9680
  async function syncSqlCommand(platformModel, sql) {
9619
- const { syncSqlCommand: runSyncSql } = await import("./sql-BNSA2GZM.js");
9681
+ const { syncSqlCommand: runSyncSql } = await import("./sql-KRQUWOPT.js");
9620
9682
  await runSyncSql(platformModel, sql);
9621
9683
  }
9622
9684
  async function syncDeleteCommand(platformModel, options) {
@@ -9694,7 +9756,7 @@ async function syncDeleteCommand(platformModel, options) {
9694
9756
  async function maybeAutoMigrateLegacy(platform, models) {
9695
9757
  const dbSize = getDatabaseSize(platform);
9696
9758
  if (!dbSize || dbSize === "0 B") return;
9697
- const { getBackend: getBackend2 } = await import("./runtime-WB4J6RQK.js");
9759
+ const { getBackend: getBackend2 } = await import("./runtime-2OVXKNJS.js");
9698
9760
  const backend = await getBackend2();
9699
9761
  let memoryHasData = false;
9700
9762
  for (const model of models) {
@@ -9710,7 +9772,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9710
9772
  ` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
9711
9773
  `
9712
9774
  );
9713
- const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-KKNH3745.js");
9775
+ const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-RJ7F2LPT.js");
9714
9776
  await memMigrateCommand3({ platform, yes: true });
9715
9777
  return;
9716
9778
  }
@@ -9719,7 +9781,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
9719
9781
  initialValue: true
9720
9782
  });
9721
9783
  if (p6.isCancel(shouldMigrate) || !shouldMigrate) return;
9722
- const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-KKNH3745.js");
9784
+ const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-RJ7F2LPT.js");
9723
9785
  await memMigrateCommand2({ platform, yes: true });
9724
9786
  }
9725
9787
  async function syncSuggestSearchableCommand(platformModel, options = {}) {
@@ -9780,7 +9842,7 @@ async function syncSuggestSearchableCommand(platformModel, options = {}) {
9780
9842
  async function syncListCommand(platform) {
9781
9843
  const profiles = listProfiles(platform);
9782
9844
  const state = await readSyncState();
9783
- const { getBackend: getBackend2 } = await import("./runtime-WB4J6RQK.js");
9845
+ const { getBackend: getBackend2 } = await import("./runtime-2OVXKNJS.js");
9784
9846
  const backend = await getBackend2();
9785
9847
  const syncs = await Promise.all(profiles.map(async (p9) => {
9786
9848
  const modelState = state[p9.platform]?.[p9.model];
@@ -10056,7 +10118,7 @@ function registerSyncSubcommands(sync) {
10056
10118
  await syncSqlCommand(platformModel, sql);
10057
10119
  });
10058
10120
  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-SDZZ7XZT.js");
10121
+ const { syncSchemaCommand } = await import("./schema-FIIT33OD.js");
10060
10122
  await syncSchemaCommand(platformModel);
10061
10123
  });
10062
10124
  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 +10895,7 @@ async function memDoctorCommand() {
10833
10895
  }
10834
10896
  if (cfg.embedding.provider === "openai") {
10835
10897
  try {
10836
- const { embed: embed2 } = await import("./embedding-7Q22D23K.js");
10898
+ const { embed: embed2 } = await import("./embedding-YIXO45HW.js");
10837
10899
  const result = await embed2("connectivity check");
10838
10900
  checks.push({
10839
10901
  name: "OpenAI embedding provider reachable",
@@ -3,13 +3,13 @@ import {
3
3
  dotPathToJsonbExpr,
4
4
  memMigrateCommand,
5
5
  reviveStringifiedJson
6
- } from "./chunk-WZTPSXHP.js";
6
+ } from "./chunk-LEJKEGB6.js";
7
7
  import "./chunk-44CV5IMX.js";
8
- import "./chunk-J7JWBH45.js";
8
+ import "./chunk-B5YDLVY5.js";
9
9
  import "./chunk-Q6PWTATS.js";
10
- import "./chunk-6IRGRC3G.js";
11
- import "./chunk-EITBMRUB.js";
12
- import "./chunk-EWHFGWB3.js";
10
+ import "./chunk-4H5L3SBY.js";
11
+ import "./chunk-2OIJGF77.js";
12
+ import "./chunk-XUAUDMQE.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-6IRGRC3G.js";
9
- import "./chunk-EITBMRUB.js";
10
- import "./chunk-EWHFGWB3.js";
8
+ } from "./chunk-4H5L3SBY.js";
9
+ import "./chunk-2OIJGF77.js";
10
+ import "./chunk-XUAUDMQE.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-J7JWBH45.js";
4
+ } from "./chunk-B5YDLVY5.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-6IRGRC3G.js";
12
- import "./chunk-EITBMRUB.js";
13
- import "./chunk-EWHFGWB3.js";
11
+ } from "./chunk-4H5L3SBY.js";
12
+ import "./chunk-2OIJGF77.js";
13
+ import "./chunk-XUAUDMQE.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-TSMVFVQ3.js";
5
+ import "./chunk-B5YDLVY5.js";
6
+ import "./chunk-Q6PWTATS.js";
7
+ import "./chunk-4H5L3SBY.js";
8
+ import "./chunk-2OIJGF77.js";
9
+ import "./chunk-XUAUDMQE.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.12.0",
3
+ "version": "2.13.0",
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-DGQOAFXJ.js";
5
- import "./chunk-J7JWBH45.js";
6
- import "./chunk-Q6PWTATS.js";
7
- import "./chunk-6IRGRC3G.js";
8
- import "./chunk-EITBMRUB.js";
9
- import "./chunk-EWHFGWB3.js";
10
- export {
11
- memSqlCommand,
12
- syncSqlCommand
13
- };