@aliyunrds/ctxdb 1.0.7 → 1.0.8-beta.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.internal.md +59 -0
- package/README.md +162 -12
- package/dist/{chunk-X2BX6LR6.js → chunk-3B7J5VUT.js} +1 -1
- package/dist/{chunk-S5W4FQ7M.js → chunk-KYW76CL7.js} +970 -771
- package/dist/{chunk-R2QS6ACP.js → chunk-LTAO6USK.js} +1 -1
- package/dist/{chunk-DPLMBHLU.js → chunk-NF5KFV2P.js} +5 -5
- package/dist/{chunk-QVXDI77N.js → chunk-NFAPLK4C.js} +1 -1
- package/dist/chunk-R67JELM7.js +20 -0
- package/dist/{chunk-DC5NWGDW.js → chunk-SGRMPSZU.js} +2 -2
- package/dist/{chunk-NFTGG6WK.js → chunk-TYW6ABNS.js} +2 -2
- package/dist/{chunk-Z6OHSEF2.js → chunk-ULAWTBBC.js} +34 -16
- package/dist/chunk-VIG4SYLU.js +8 -0
- package/dist/cli/main.js +1526 -73
- package/dist/hooks/hermes-post-llm-call.js +8 -6
- package/dist/hooks/hermes-pre-llm-call.js +11 -9
- package/dist/hooks/pre-tool-use.js +2 -1
- package/dist/hooks/session-start.js +10 -8
- package/dist/hooks/stop.js +8 -6
- package/dist/hooks/user-prompt-submit.js +10 -8
- package/dist/opencode/index.js +58 -2
- package/dist/setup/skills/contextdb-knowledge/SKILL.md +4 -4
- package/dist/setup/skills/contextdb-memory/SKILL.md +4 -4
- package/dist/workers/version-check.js +3 -1
- package/package.json +8 -2
- /package/dist/{chunk-UEKR2Z3S.js → chunk-5ML4VSXN.js} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
listKnowledgeBases
|
|
4
|
-
} from "./chunk-QVXDI77N.js";
|
|
5
2
|
import {
|
|
6
3
|
isConnectionError,
|
|
7
4
|
resetCircuit,
|
|
8
5
|
tripCircuit
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3B7J5VUT.js";
|
|
7
|
+
import {
|
|
8
|
+
listKnowledgeBases
|
|
9
|
+
} from "./chunk-NFAPLK4C.js";
|
|
10
10
|
import {
|
|
11
11
|
CtxdbError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KYW76CL7.js";
|
|
13
13
|
|
|
14
14
|
// src/lib/kb-catalog.ts
|
|
15
15
|
function sanitizeKeyEntities(raw) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
define_CTXDB_DISTRIBUTION_MANIFEST_default
|
|
4
|
+
} from "./chunk-VIG4SYLU.js";
|
|
5
|
+
|
|
6
|
+
// src/lib/distribution-capabilities.ts
|
|
7
|
+
var PUBLIC_DISTRIBUTION = {
|
|
8
|
+
id: "public",
|
|
9
|
+
packageName: "@aliyunrds/ctxdb",
|
|
10
|
+
packageRegistry: null,
|
|
11
|
+
capabilities: {
|
|
12
|
+
interactiveLogin: false,
|
|
13
|
+
managedCredentials: false
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var DISTRIBUTION_MANIFEST = typeof define_CTXDB_DISTRIBUTION_MANIFEST_default === "undefined" ? PUBLIC_DISTRIBUTION : define_CTXDB_DISTRIBUTION_MANIFEST_default;
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
DISTRIBUTION_MANIFEST
|
|
20
|
+
};
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
isConnectionError,
|
|
5
5
|
resetCircuit,
|
|
6
6
|
tripCircuit
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3B7J5VUT.js";
|
|
8
8
|
import {
|
|
9
9
|
CtxdbError,
|
|
10
10
|
debug,
|
|
11
11
|
isDebug
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KYW76CL7.js";
|
|
13
13
|
|
|
14
14
|
// src/lib/capture-orchestrator.ts
|
|
15
15
|
import {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
fetchKbCatalogBlock,
|
|
4
4
|
recallTurn
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NF5KFV2P.js";
|
|
6
6
|
import {
|
|
7
7
|
debug
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KYW76CL7.js";
|
|
9
9
|
|
|
10
10
|
// src/lib/warmup-recall.ts
|
|
11
11
|
import { execSync } from "child_process";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
DISTRIBUTION_MANIFEST
|
|
4
|
+
} from "./chunk-R67JELM7.js";
|
|
2
5
|
|
|
3
6
|
// src/lib/self-update.ts
|
|
4
7
|
import { spawnSync } from "child_process";
|
|
5
8
|
import { fileURLToPath } from "url";
|
|
6
9
|
import { dirname } from "path";
|
|
7
10
|
import semver from "semver";
|
|
8
|
-
var PACKAGE_NAME = "@aliyunrds/ctxdb";
|
|
9
11
|
var NPM_VIEW_TIMEOUT_MS = 1e4;
|
|
10
12
|
function npmCommand(platform = process.platform) {
|
|
11
13
|
return platform === "win32" ? "npm.cmd" : "npm";
|
|
@@ -17,6 +19,9 @@ function detectInstallMethod() {
|
|
|
17
19
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
18
20
|
return dir.includes("/node_modules/") || dir.includes("\\node_modules\\") ? "npm" : "unknown";
|
|
19
21
|
}
|
|
22
|
+
function registryArgs(registry) {
|
|
23
|
+
return registry ? ["--registry", registry] : [];
|
|
24
|
+
}
|
|
20
25
|
function checkLatestVersion(currentVersion, options = {}) {
|
|
21
26
|
const current = semver.valid(currentVersion);
|
|
22
27
|
if (!current) {
|
|
@@ -29,12 +34,18 @@ function checkLatestVersion(currentVersion, options = {}) {
|
|
|
29
34
|
}
|
|
30
35
|
const platform = options.platform ?? process.platform;
|
|
31
36
|
const run = options.spawnSyncFn ?? spawnSync;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
const packageName = options.packageName ?? DISTRIBUTION_MANIFEST.packageName;
|
|
38
|
+
const registry = options.registry === void 0 ? DISTRIBUTION_MANIFEST.packageRegistry : options.registry;
|
|
39
|
+
const result = run(
|
|
40
|
+
npmCommand(platform),
|
|
41
|
+
["view", packageName, "version", ...registryArgs(registry)],
|
|
42
|
+
{
|
|
43
|
+
encoding: "utf-8",
|
|
44
|
+
timeout: options.timeoutMs ?? NPM_VIEW_TIMEOUT_MS,
|
|
45
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
46
|
+
shell: platform === "win32"
|
|
47
|
+
}
|
|
48
|
+
);
|
|
38
49
|
if (result.status !== 0 || !result.stdout?.trim()) {
|
|
39
50
|
return {
|
|
40
51
|
latest: null,
|
|
@@ -82,7 +93,9 @@ function runSelfUpdate(currentVersion, passthroughArgs = [], options = {}) {
|
|
|
82
93
|
error: "ctxdb was not installed via npm. Update manually with your package manager."
|
|
83
94
|
};
|
|
84
95
|
}
|
|
85
|
-
const
|
|
96
|
+
const packageName = options.packageName ?? DISTRIBUTION_MANIFEST.packageName;
|
|
97
|
+
const registry = options.registry === void 0 ? DISTRIBUTION_MANIFEST.packageRegistry : options.registry;
|
|
98
|
+
const check = checkLatestVersion(currentVersion, { packageName, registry });
|
|
86
99
|
if (check.error) {
|
|
87
100
|
return {
|
|
88
101
|
ok: false,
|
|
@@ -98,13 +111,17 @@ function runSelfUpdate(currentVersion, passthroughArgs = [], options = {}) {
|
|
|
98
111
|
);
|
|
99
112
|
return { ok: true, updated: false, fromVersion: currentVersion };
|
|
100
113
|
}
|
|
101
|
-
process.stderr.write(`ctxdb: updating ${
|
|
114
|
+
process.stderr.write(`ctxdb: updating ${packageName} v${currentVersion} \u2192 v${check.latest}...
|
|
102
115
|
`);
|
|
103
|
-
const install = spawnSync(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
const install = spawnSync(
|
|
117
|
+
npmCommand(),
|
|
118
|
+
["install", "-g", `${packageName}@${check.latest}`, ...registryArgs(registry)],
|
|
119
|
+
{
|
|
120
|
+
stdio: "inherit",
|
|
121
|
+
encoding: "utf-8",
|
|
122
|
+
shell: process.platform === "win32"
|
|
123
|
+
}
|
|
124
|
+
);
|
|
108
125
|
if (install.status !== 0) {
|
|
109
126
|
return {
|
|
110
127
|
ok: false,
|
|
@@ -153,10 +170,11 @@ var NOTIFICATION_THROTTLE_MS = 3 * SUCCESS_TTL_MS;
|
|
|
153
170
|
var LOCK_STALE_AFTER_MS = 10 * 60 * 1e3;
|
|
154
171
|
function versionCheckPaths(home = homedir()) {
|
|
155
172
|
const cacheDir = join(home, ".ctxdb", "cache");
|
|
173
|
+
const distributionSuffix = DISTRIBUTION_MANIFEST.id === "public" ? "" : `-${DISTRIBUTION_MANIFEST.id}`;
|
|
156
174
|
return {
|
|
157
175
|
cacheDir,
|
|
158
|
-
statePath: join(cacheDir,
|
|
159
|
-
lockPath: join(cacheDir,
|
|
176
|
+
statePath: join(cacheDir, `version-check${distributionSuffix}.json`),
|
|
177
|
+
lockPath: join(cacheDir, `version-check${distributionSuffix}.lock`)
|
|
160
178
|
};
|
|
161
179
|
}
|
|
162
180
|
function createInitialVersionCheckState(currentVersion) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// <define:__CTXDB_DISTRIBUTION_MANIFEST__>
|
|
4
|
+
var define_CTXDB_DISTRIBUTION_MANIFEST_default = { id: "public", packageName: "@aliyunrds/ctxdb", packageRegistry: null, capabilities: { interactiveLogin: false, managedCredentials: false } };
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
define_CTXDB_DISTRIBUTION_MANIFEST_default
|
|
8
|
+
};
|