@withone/cli 1.41.0 → 1.43.2

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.
@@ -0,0 +1,16 @@
1
+ import {
2
+ buildIdentityMap,
3
+ dotPathToJsonbExpr,
4
+ memMigrateCommand,
5
+ reviveStringifiedJson
6
+ } from "./chunk-AD4QM6R5.js";
7
+ import "./chunk-44CV5IMX.js";
8
+ import "./chunk-MRGKKO54.js";
9
+ import "./chunk-5TT27ORC.js";
10
+ import "./chunk-AU2ZEEMS.js";
11
+ export {
12
+ buildIdentityMap,
13
+ dotPathToJsonbExpr,
14
+ memMigrateCommand,
15
+ reviveStringifiedJson
16
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ addRecord,
3
+ getBackend,
4
+ resetBackendSingleton,
5
+ upsertRecord
6
+ } from "./chunk-5TT27ORC.js";
7
+ import "./chunk-AU2ZEEMS.js";
8
+ export {
9
+ addRecord,
10
+ getBackend,
11
+ resetBackendSingleton,
12
+ upsertRecord
13
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ memSqlCommand,
3
+ syncSqlCommand
4
+ } from "./chunk-7N5EJTYW.js";
5
+ import "./chunk-MRGKKO54.js";
6
+ import "./chunk-5TT27ORC.js";
7
+ import "./chunk-AU2ZEEMS.js";
8
+ export {
9
+ memSqlCommand,
10
+ syncSqlCommand
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "1.41.0",
3
+ "version": "1.43.2",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [
@@ -23,15 +23,19 @@
23
23
  "@clack/prompts": "^0.9.1",
24
24
  "commander": "^13.1.0",
25
25
  "open": "^10.1.0",
26
+ "pgserve": "^2.2.3",
26
27
  "picocolors": "^1.1.1",
27
28
  "smol-toml": "^1.6.0"
28
29
  },
29
30
  "optionalDependencies": {
30
- "better-sqlite3": "^11.7.0"
31
+ "@electric-sql/pglite": "^0.2.17",
32
+ "better-sqlite3": "^11.7.0",
33
+ "pg": "^8.20.0"
31
34
  },
32
35
  "devDependencies": {
33
36
  "@types/better-sqlite3": "^7.6.13",
34
37
  "@types/node": "^22.13.1",
38
+ "@types/pg": "^8.20.0",
35
39
  "tsup": "^8.3.6",
36
40
  "typescript": "^5.7.3"
37
41
  },
@@ -3,9 +3,11 @@
3
3
  "platform": "attio",
4
4
  "model": "attioCompanies",
5
5
  "connection": { "platform": "attio" },
6
- "actionId": "conn_mod_def::GJt0lFZ6kpk::attio-companies-list",
7
- "resultsPath": "companies",
8
- "idField": "id",
6
+ "identityKey": "values.domains[0].domain",
7
+ "actionId": "conn_mod_def::GJ0CbN-LPiU::A6h6M9QkS0Cs2Lt9CdPH7Q",
8
+ "pathVars": { "object": "companies" },
9
+ "resultsPath": "data",
10
+ "idField": "id.record_id",
9
11
  "pagination": {
10
12
  "type": "offset",
11
13
  "passAs": "body:offset"
@@ -3,10 +3,11 @@
3
3
  "platform": "attio",
4
4
  "model": "attioPeople",
5
5
  "connection": { "platform": "attio" },
6
- "identityKey": "primary_email_address",
7
- "actionId": "conn_mod_def::GJt0lFZ6kpk::attio-people-list",
8
- "resultsPath": "people",
9
- "idField": "id",
6
+ "identityKey": "values.email_addresses[0].email_address",
7
+ "actionId": "conn_mod_def::GJ0CbN-LPiU::A6h6M9QkS0Cs2Lt9CdPH7Q",
8
+ "pathVars": { "object": "people" },
9
+ "resultsPath": "data",
10
+ "idField": "id.record_id",
10
11
  "pagination": {
11
12
  "type": "offset",
12
13
  "passAs": "body:offset"
@@ -148,36 +148,109 @@ Knowledge and search responses are cached locally (`~/.one/cache/`). Subsequent
148
148
  - Manage cache: `one cache list`, `one cache clear`, `one cache update-all`
149
149
  - `actions execute` is NEVER cached — always fresh
150
150
 
151
- ## Local Data Sync
151
+ ## Unified Memory
152
152
 
153
- Sync platform data into local SQLite for instant queries, full-text search, scheduled refresh, and change-driven automation.
153
+ One ships a local memory store (a real Postgres process bootstrapped on demand via the bundled `embedded-postgres` plugin, with a `postgres` plugin available for remote/self-hosted Postgres) that backs both user-authored notes and synced platform data. `one mem <cmd>` is the primary surface; `one sync` is a namespaced alias (`one mem sync ...`) that writes synced rows into the same store.
154
+
155
+ **Zero-config.** The first `one mem` call on a new machine auto-initializes — no separate `mem init` step required. The `embedded-postgres` plugin downloads its Postgres binaries on first run (~52MB) and writes a daemon PID/port file at `~/.one/pg/.pgserve.json` so subsequent CLI invocations reuse the running cluster. If an OpenAI key is already resolvable (env, `.onerc`, or `config.openaiApiKey`), embeddings enable automatically and search becomes hybrid FTS + semantic. Otherwise you get FTS-only with a structured `_upgrade` hint on every response telling the user how to upgrade.
156
+
157
+ **Listing synced rows.** `mem list <type>` takes a positional namespaced type — there is no `--platform` flag. Synced rows live under `<platform>/<model>` types:
158
+
159
+ ```bash
160
+ one --agent mem list "gmail/threads"
161
+ one --agent mem list "attio/attioPeople" --limit 5
162
+ one --agent mem list "google-calendar/events"
163
+ ```
164
+
165
+ Underneath, the store has no `platform` column — `type` is the only platform-scoping mechanism. If you need raw SQL via `mem sql`, filter with `WHERE type LIKE 'platform/%'` (not `WHERE platform = ...`).
154
166
 
155
167
  ```bash
156
- # First time only
157
- one sync install
168
+ # User memories
169
+ one --agent mem add note '{"content":"..."}' --tags work --weight 7
170
+ one --agent mem search "deadline" # hybrid if key set, else FTS
171
+ one --agent mem list note --limit 20
172
+ one --agent mem link <from-id> <to-id> relates_to --bi
173
+
174
+ # Status + diagnostics
175
+ one --agent mem status # backend, provider, _upgrade hint
176
+ one --agent mem doctor # full health report
177
+ ```
178
+
179
+ ### Adding OpenAI for semantic search
180
+
181
+ Stored at the top level of `~/.one/config.json` as `openaiApiKey`, same precedence as `ONE_SECRET` (env > `.onerc OPENAI_API_KEY=...` > project > global). Three equivalent ways to set:
182
+
183
+ ```bash
184
+ # Via re-run of one init (interactive prompt)
185
+ one init
186
+
187
+ # Via config set (writes to top-level, not the memory block)
188
+ one --agent mem config set embedding.apiKey sk-...
158
189
 
190
+ # Via env var (no persistence)
191
+ export OPENAI_API_KEY=sk-...
192
+ ```
193
+
194
+ ### Syncing platforms into memory
195
+
196
+ ```bash
159
197
  # Check built-in profiles (pre-validated configs for common platforms)
160
198
  one --agent sync profiles
161
199
 
162
- # Setup (uses built-in if available, otherwise auto-infers + auto-tests)
200
+ # Setup seeds from the built-in, merges your --config overrides
163
201
  one --agent sync init stripe balanceTransactions
164
- # If _complete: true and _test.ok: true → go straight to sync run
165
-
166
- # Sync + query
202
+ # If _complete: true and _test.ok: true → ready to run
203
+
204
+ # Preview what gets embedded BEFORE paying embedding cost (agent declares paths)
205
+ one --agent sync init attio attioPeople --config '{
206
+ "memory": {
207
+ "embed": true,
208
+ "searchable": [
209
+ "values.name[0].full_name",
210
+ "values.job_title[0].value",
211
+ "values.description[0].value",
212
+ "values.email_addresses[0].email_address"
213
+ ]
214
+ }
215
+ }'
216
+ # Skip the "pick paths by reading knowledge" step — let the CLI rank them from a live sample
217
+ one --agent sync suggest-searchable attio/attioPeople
218
+ # → { suggestions: [{path, score, hitRate, avgLength, noiseFraction, sampleValue}], configPatch: {...paste-ready...} }
219
+
220
+ one --agent sync test attio/attioPeople --show-searchable
221
+ # → Previews across 5 samples. Each path has { hits, total, sample }:
222
+ # 5/5 = path resolves on every record (clean)
223
+ # 1/5 = field is real but sparse on this page
224
+ # 0/5 = typo, or field never populated in sampled records
225
+ # Iterate until the numbers match intent.
226
+
227
+ # Run — memory is always written; pass --no-memory to skip (rare)
167
228
  one --agent sync run stripe
168
229
  one --agent sync query stripe/balanceTransactions --where "status=available" --limit 20
169
- one --agent sync search "refund" # FTS across all synced platforms
230
+ one --agent sync search "refund" # hybrid across all synced platforms
170
231
  one --agent sync list stripe # progress + freshness
171
232
 
172
233
  # Schedule unattended syncs
173
234
  one sync schedule add stripe --every 1h
174
235
  ```
175
236
 
237
+ ### memory.searchable paths
238
+
239
+ Declared on the profile, drives what gets embedded + FTS-indexed. Supports numeric indexes AND `[]` wildcards for array fan-out:
240
+
241
+ ```
242
+ values.name[0].full_name # numeric index (first element)
243
+ messages[].snippet # wildcard — every element's .snippet
244
+ messages[].payload.parts[].body.data # nested wildcards
245
+ ```
246
+
247
+ Without declared paths, the default walker concatenates every string in the record — correct but often noisy for hierarchical APIs (Attio, HubSpot). **Always declare paths for any profile with `embed: true`.**
248
+
176
249
  **Sync rejects custom actions** — profiles must use passthrough. `sync init` only surfaces passthrough models; `sync run` aborts if the list or enrich action is tagged `custom`. If no passthrough exists, compose a flow instead.
177
250
 
178
251
  **Connections are late-bound** — profiles use `"connection": { "platform": "<name>" }`, not literal `connectionKey` strings. The key is resolved at sync time, so `one add <platform>` (re-auth) doesn't break the profile. For multi-account platforms, add `"tag": "<connection-tag>"` to disambiguate. Don't hardcode connection keys in profiles.
179
252
 
180
- **Advanced features** (enrich, transform, exclude, identityKey, hooks, --full-refresh, --where-sql delete, cursor resume): run `one guide sync` for the full reference.
253
+ **Advanced features** (enrich, transform, exclude, identityKey, hooks, --full-refresh, alternative backends, embedding tuning): run `one guide memory` or `one guide sync` for the full reference.
181
254
 
182
255
  ## Beyond Single Actions
183
256
 
@@ -16,6 +16,14 @@ one --agent connection list
16
16
 
17
17
  Identify source (sends webhooks) and destination (receives forwarded data). Note both connection keys.
18
18
 
19
+ If you're unsure whether the source platform supports relay at all, list relay-capable platforms first:
20
+
21
+ ```bash
22
+ one --agent relay platforms
23
+ ```
24
+
25
+ This returns `[{ "platform": "<name>", "eventTypeCount": <n> }, ...]` for every platform that One can receive webhooks from. If your source isn't in the list, relay won't work for it.
26
+
19
27
  ### Step 2: Get event types
20
28
 
21
29
  ```bash
@@ -173,6 +181,13 @@ one --agent relay activate <relay-id> --actions '[{
173
181
  }]'
174
182
  ```
175
183
 
184
+ ## Discovery Commands
185
+
186
+ ```bash
187
+ one --agent relay platforms # All relay-capable platforms + event type counts
188
+ one --agent relay event-types <platform> # Event types for a specific platform
189
+ ```
190
+
176
191
  ## Management Commands
177
192
 
178
193
  ```bash