@aliyunrds/ctxdb 1.0.10 → 1.0.11-beta.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 +22 -8
- package/dist/{chunk-5HPYYOPH.js → chunk-6XK3RDZ6.js} +1 -1
- package/dist/{chunk-XWJAZAMN.js → chunk-7RMETV4M.js} +1 -1
- package/dist/{chunk-LASAMQQY.js → chunk-EWCB3UQS.js} +6 -3
- package/dist/{chunk-QUPLZ7KF.js → chunk-G3MDJEX5.js} +1 -1
- package/dist/{chunk-TZFDXKLJ.js → chunk-HHKQPWYI.js} +1776 -1778
- package/dist/{chunk-SZ3AZDMU.js → chunk-JM7EOAQZ.js} +1 -1
- package/dist/chunk-SR3M7AL5.js +10 -0
- package/dist/{chunk-SG4LQTOF.js → chunk-WCVCSOFL.js} +2 -2
- package/dist/{chunk-VMBCSFGF.js → chunk-XEX5344F.js} +5 -5
- package/dist/cli/main.js +139 -99
- package/dist/hooks/hermes-post-llm-call.js +7 -6
- package/dist/hooks/hermes-pre-llm-call.js +11 -11
- package/dist/hooks/session-end.js +4 -4
- package/dist/hooks/session-start.js +8 -8
- package/dist/hooks/stop.js +7 -6
- package/dist/hooks/user-prompt-submit.js +8 -8
- package/dist/opencode/index.js +75 -54
- package/dist/workers/version-check.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Unified access layer for RDS ContextDatabase. One `ctxdb` CLI (memory + KB ops),
|
|
|
9
9
|
| **qwenwork** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.qwenwork/skills/ctxdb/` | hooks-driven (auto capture/recall) |
|
|
10
10
|
| **codex** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.codex/skills/ctxdb/` | hooks-driven (auto capture/recall) |
|
|
11
11
|
| **claude** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.claude/skills/ctxdb/` | hooks-driven (auto capture/recall) |
|
|
12
|
-
| **opencode** | Plugin
|
|
12
|
+
| **opencode** | Plugin bundle (`~/.config/opencode/plugins/ctxdb-bundle.js`) | `~/.config/opencode/skills/` | in-process plugin (auto capture/recall + KB catalog injection) |
|
|
13
13
|
| **hermes** | ✅ `pre_llm_call` + `post_llm_call` | `~/.hermes/skills/` | shell hooks (auto capture/recall + first-turn warmup) |
|
|
14
14
|
| **workbuddy** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.workbuddy/skills/` and `~/.workbuddy-ai/skills/` (existing homes) | CodeBuddy command hooks (complete shell command, no separate `args`) |
|
|
15
15
|
|
|
@@ -309,7 +309,7 @@ ctxdb status --agent codex --json
|
|
|
309
309
|
|
|
310
310
|
Setup first checks that the target agent home exists (`~/.qoder`, `~/.qoderwork`, `~/.qwenwork`, `~/.codex`, `~/.claude`, or either WorkBuddy home: `~/.workbuddy` / `~/.workbuddy-ai`; other declared CN variant homes also satisfy this check). Setup writes hooks and skills into every existing home, so a CN-only install does not create the international product home, and vice versa. If no home exists, install or start that agent once before running `ctxdb setup --agent <name>`. OpenCode and Hermes are config-dir style: setup creates `~/.config/opencode` / `~/.hermes` when they are missing.
|
|
311
311
|
|
|
312
|
-
For **qoder**, **qoderwork**, **qwenwork**, **codex**, **claude**, and **workbuddy**, restart the harness (CLI: just exit + restart; app: Cmd+R or quit/relaunch) so it picks up the new hooks/skill. For **codex**, setup also writes `[features].hooks = true` into `~/.codex/config.toml` (creating the file if missing) — Current Codex versions enable hooks by default; the explicit setting also supports older installs. Review and trust each installed or changed hook definition in `/hooks` before use. For **opencode**, restart OpenCode so it loads `~/.config/opencode/plugins/ctxdb.
|
|
312
|
+
For **qoder**, **qoderwork**, **qwenwork**, **codex**, **claude**, and **workbuddy**, restart the harness (CLI: just exit + restart; app: Cmd+R or quit/relaunch) so it picks up the new hooks/skill. For **codex**, setup also writes `[features].hooks = true` into `~/.codex/config.toml` (creating the file if missing) — Current Codex versions enable hooks by default; the explicit setting also supports older installs. Review and trust each installed or changed hook definition in `/hooks` before use. For **opencode**, restart OpenCode so it loads `~/.config/opencode/plugins/ctxdb-bundle.js`. For **hermes**, setup also checks `~/.hermes/shell-hooks-allowlist.json`; it reports setup as incomplete until both ctxdb hook commands are approved.
|
|
313
313
|
|
|
314
314
|
Hermes owns this security allowlist, so ctxdb only checks it and never writes approvals. Approve the ctxdb `pre_llm_call` and `post_llm_call` hooks with:
|
|
315
315
|
|
|
@@ -366,7 +366,7 @@ Implementation note: qoder/Claude/WorkBuddy consume the JSON `hookSpecificOutput
|
|
|
366
366
|
|
|
367
367
|
WorkBuddy 5.5.2 on macOS requires the full shell command in `command`; its runner ignores `args`. Native Auto (default routing label; underlying model unknown) and explicitly selected GPT-5.6-Sol completed automatic Skill Evaluate, suggestion delivery, generation, Upload/Complete, and exact Load. The final package also passed cold-cache Load for both versions. Sol required one native Retry after a platform error; Auto's extra execution was not proven fully isolated. Windows runner behavior and Memory capture/recall were not tested in this acceptance run. See the [Agent/model acceptance report](../../docs/skill-agent-acceptance-20260912.md) and [WorkBuddy evidence](../../docs/workbuddy-acceptance-20260912.md) for version scope, retained failures, and cleanup.
|
|
368
368
|
|
|
369
|
-
For **opencode**, `ctxdb setup --agent opencode` copies the self-contained plugin bundle to `~/.config/opencode/plugins/ctxdb-bundle.js`
|
|
369
|
+
For **opencode**, `ctxdb setup --agent opencode` copies the self-contained plugin bundle to `~/.config/opencode/plugins/ctxdb-bundle.js` as the single auto-loaded entry. Setup and `ctxdb upgrade --agent opencode` remove the older generated `ctxdb.ts` shim: OpenCode loads both `.ts` and `.js`, so keeping both files initializes the plugin twice. Run upgrade after updating the npm package, then restart OpenCode. An unrecognized `ctxdb.ts` is preserved and reported as a migration conflict.
|
|
370
370
|
|
|
371
371
|
For **hermes**, `ctxdb setup --agent hermes` writes two shell hooks under `~/.hermes/config.yaml`:
|
|
372
372
|
|
|
@@ -443,6 +443,17 @@ fact-extraction). Use it when the user explicitly asks for a verbatim
|
|
|
443
443
|
memory ("记住 / 请记忆 / 原文记下"); without `--no-infer` the server may
|
|
444
444
|
rewrite, merge, or skip details.
|
|
445
445
|
|
|
446
|
+
Memory uploads (`memory add`, including images, and automatic hook/plugin
|
|
447
|
+
capture) always send a top-level `agent_id`. `CTXDB_AGENT_ID` takes precedence
|
|
448
|
+
over the selected config's `agent_id`; when neither is set, uploads use the
|
|
449
|
+
current Agent name (`--agent`, then `CTXDB_AGENT`, then `default`; OpenCode's
|
|
450
|
+
plugin uses `opencode`). `default` means no specific host was selected.
|
|
451
|
+
This fallback applies only to uploads: default search/list and automatic
|
|
452
|
+
recall remain unchanged, so historical and other agents' memories can still
|
|
453
|
+
be retrieved. An explicitly configured `agent_id` continues to filter
|
|
454
|
+
automatic recall. The field records write attribution; server-side memory
|
|
455
|
+
organization may still deduplicate facts across agents within one Member.
|
|
456
|
+
|
|
446
457
|
`memory add [<text>] --image=<local-path>` adds an image-backed memory.
|
|
447
458
|
Repeat `--image` to attach multiple PNG, JPEG, or WebP files; text is optional
|
|
448
459
|
when at least one image is present. Image requests require inference, so they
|
|
@@ -861,8 +872,8 @@ Field reference:
|
|
|
861
872
|
| Key | Type | Default | Meaning |
|
|
862
873
|
|---|---|---|---|
|
|
863
874
|
| `user_id` | str | `"default"` | mem0-layer bucket key on every capture/recall call. The server's tenant isolation runs on `member_id` (injected from `X-API-Key`), so this is an optional per-user/agent slice. Override with `ctxdb setup --agent <a> --user-id <bucket>` or `CTXDB_USER_ID=<bucket>` when you need to isolate this install from another access layer or machine sharing the same workspace |
|
|
864
|
-
| `agent_id` | str | null |
|
|
865
|
-
| `app_id` | str | null | Optional app-scope dimension
|
|
875
|
+
| `agent_id` | str | null | Explicit memory upload attribution and automatic-recall filter. Uploads fall back to the current Agent name; automatic recall omits this filter unless explicitly configured. `CTXDB_AGENT_ID=<id>` overrides this value (no setup flag). This does not guarantee per-agent retention during server-side deduplication. |
|
|
876
|
+
| `app_id` | str | null | Optional app-scope dimension for automatic capture/recall; default null means not sent. Set via `CTXDB_APP_ID=<id>` (env-only). |
|
|
866
877
|
| `auto_capture` | bool | `true` | End-of-turn hook/plugin captures each turn into long-term memory for the selected agent |
|
|
867
878
|
| `auto_skill_evolution` | bool | `true` | Evidence collection and automatic evolution through the selected Agent hooks/plugin. Hermes delivers ready suggestions on the next genuine user turn. Disabling it keeps private Skill discovery and explicit commands available. |
|
|
868
879
|
| `auto_recall` | bool | `true` | UserPromptSubmit hook recalls memory on each user prompt for the selected agent |
|
|
@@ -872,7 +883,7 @@ Field reference:
|
|
|
872
883
|
| `knowledge_top_k` | int | `6` | KB chunks pulled per recall (only effective when `recall_knowledge: true`) |
|
|
873
884
|
| `debug` | bool | `false` | Configured preference for verbose hook logging and full recall tracing. Effective debug is forced on for every final `base_url` outside the exact official-production allowlist; see “Debug control and recall replay”. General logs go to `~/.ctxdb/logs/ctxdb.log`, structured full-content recall records to `~/.ctxdb/logs/recall-trace.jsonl` |
|
|
874
885
|
|
|
875
|
-
Env-var overrides apply to the selected agent config (env wins): `CTXDB_AGENT` / `CTXDB_ACCESS_TOKEN` / `CTXDB_API_KEY` / `CTXDB_BASE_URL` / `CTXDB_USER_ID` / `CTXDB_AGENT_ID` / `CTXDB_APP_ID`. The internal login command additionally reads `CTXDB_LOGIN_SERVER` as its provider-neutral login endpoint. The last two default to unset
|
|
886
|
+
Env-var overrides apply to the selected agent config (env wins): `CTXDB_AGENT` / `CTXDB_ACCESS_TOKEN` / `CTXDB_API_KEY` / `CTXDB_BASE_URL` / `CTXDB_USER_ID` / `CTXDB_AGENT_ID` / `CTXDB_APP_ID`. The internal login command additionally reads `CTXDB_LOGIN_SERVER` as its provider-neutral login endpoint. The last two default to unset: automatic recall omits both filters, while uploads still send the current Agent name as `agent_id`.
|
|
876
887
|
|
|
877
888
|
Downstream Agent hosts can set `CTXDB_ACCESS_TOKEN` to send `Authorization: Bearer <token>` to the Data API. It is runtime-only, never written to `~/.ctxdb/ctxdb.json`, and takes precedence over a managed session or API key for CLI, process hooks, and OpenCode; a rejected token does not fall back to another credential. `ctxdb setup` can use a managed reference or an environment AT for validation, but never persists the AT. An environment-only credential must remain available to the Agent runtime after setup.
|
|
878
889
|
|
|
@@ -903,7 +914,7 @@ Two npm packages total. `@aliyunrds/ctxdb-shared` stays separate because OpenCla
|
|
|
903
914
|
|
|
904
915
|
```sh
|
|
905
916
|
# 1. Strip hooks + skills + (optionally) config + logs while the binary still works.
|
|
906
|
-
ctxdb uninstall --purge-all #
|
|
917
|
+
ctxdb uninstall --purge-all # hooks, skills, and all ctxdb-owned local state
|
|
907
918
|
|
|
908
919
|
# 2. Then drop the npm binaries.
|
|
909
920
|
npm uninstall -g @aliyunrds/ctxdb @aliyunrds/ctxdb-shared
|
|
@@ -911,6 +922,8 @@ npm uninstall -g @aliyunrds/ctxdb @aliyunrds/ctxdb-shared
|
|
|
911
922
|
|
|
912
923
|
After step 1, `ctxdb uninstall` prints the exact `npm uninstall` command to run next — copy it from your terminal.
|
|
913
924
|
|
|
925
|
+
Stop running Agent sessions and transfers before purging. `--purge-all` deletes the shared credential store (public and internal logins), cache, sessions, and Skill state including local drafts. It preserves and reports unknown files. Local deletion does not revoke server sessions: log out of each login before uninstalling if you want to revoke them. Purge flags cannot be combined with `--agent`; that combination fails before changing any files.
|
|
926
|
+
|
|
914
927
|
### Partial removal
|
|
915
928
|
|
|
916
929
|
```sh
|
|
@@ -937,7 +950,8 @@ ctxdb uninstall --purge-logs # also deletes ~/.ctxdb/logs/
|
|
|
937
950
|
|
|
938
951
|
- **Hook entries in `~/.qoder/settings.json`, `~/.qoderwork/settings.json`, `~/.qwenwork/settings.json`, `~/.codex/hooks.json`, `~/.claude/settings.json`, `~/.workbuddy/settings.json`, `~/.workbuddy-ai/settings.json`, and `~/.hermes/config.yaml`**: stripped precisely by marker (`_ctxdb = @aliyunrds/ctxdb`, plus legacy keys `_ctxdbQoder` / `_ctxdbPackage` and the legacy `@aliyunrds/ctxdb-qoder` value for installs predating the unified marker). Any hooks you added yourself stay. A timestamped `*.bak-ctxdb-<TS>` is written before each modification (rotation keeps the 5 most recent).
|
|
939
952
|
- **Skill directories**: `~/.<agent>/skills/ctxdb/` for each set-up agent, plus legacy dirs (`ctxdb-qoder`, `rds-ctxdb-qoder`, `qoder-ctxdb`) under `~/.qoder/skills/` from older package names.
|
|
940
|
-
-
|
|
953
|
+
- **Hermes hook approvals**: removes ctxdb event/command entries from `~/.hermes/shell-hooks-allowlist.json`, preserving other approvals and metadata.
|
|
954
|
+
- **`~/.ctxdb/` state**: only with `--purge-config` / `--purge-logs` / `--purge-all`. Full purge removes `ctxdb.json`, `ctxdb.json.bak`, `credentials.json`, `logs`, `cache`, `circuit`, `sessions`, `skills`, `skill-evolution`, and interrupted config/credential writes. Unknown paths are preserved and listed; the root is removed when empty. Symlink targets are never recursively deleted. Deletion errors return a nonzero exit status and suppress the npm-uninstall hint so the cleanup can be retried.
|
|
941
955
|
- **`~/.codex/config.toml` `[features].hooks`**: **NOT** reverted. Setup adds `hooks = true` so Codex will fire ctxdb's hook entries; uninstall leaves the flag alone because (a) the user may have wanted it on for non-ctxdb hooks, and (b) it's harmless when `~/.codex/hooks.json` is empty. If you want it off, edit the file by hand.
|
|
942
956
|
- **`npm` itself**: never. `ctxdb uninstall` does not call your host package manager — that's the second command above.
|
|
943
957
|
|
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
isConnectionError,
|
|
5
5
|
resetCircuit,
|
|
6
6
|
tripCircuit
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7RMETV4M.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveMemoryUploadAgentId
|
|
10
|
+
} from "./chunk-SR3M7AL5.js";
|
|
8
11
|
import {
|
|
9
12
|
CtxdbError,
|
|
10
13
|
debug,
|
|
@@ -15,7 +18,7 @@ import {
|
|
|
15
18
|
selectTurnRows,
|
|
16
19
|
toKbDetectionMessages,
|
|
17
20
|
toParsedMessages
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-HHKQPWYI.js";
|
|
19
22
|
|
|
20
23
|
// src/lib/capture-orchestrator.ts
|
|
21
24
|
import {
|
|
@@ -117,9 +120,9 @@ async function captureParsedMessages(parsed, cfg, client, agent = "default", ses
|
|
|
117
120
|
const payload = {
|
|
118
121
|
messages,
|
|
119
122
|
user_id: cfg.userId,
|
|
123
|
+
agent_id: resolveMemoryUploadAgentId(cfg.agentId, agent),
|
|
120
124
|
async_mode: true
|
|
121
125
|
};
|
|
122
|
-
if (cfg.agentId) payload.agent_id = cfg.agentId;
|
|
123
126
|
if (cfg.appId) payload.app_id = cfg.appId;
|
|
124
127
|
if (sessionId) payload.run_id = sessionId;
|
|
125
128
|
let resp;
|
|
@@ -429,7 +429,7 @@ function shouldUseUpdateNotifier(argv, options = {}) {
|
|
|
429
429
|
return false;
|
|
430
430
|
}
|
|
431
431
|
const command = argv[0];
|
|
432
|
-
return
|
|
432
|
+
return !["update", "upgrade", "uninstall", "teardown"].includes(command);
|
|
433
433
|
}
|
|
434
434
|
function beginUpdateNotification(argv, options) {
|
|
435
435
|
try {
|