@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.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  fetchKbCatalogBlock,
4
4
  recallTurn
5
- } from "./chunk-DPLMBHLU.js";
5
+ } from "./chunk-NF5KFV2P.js";
6
6
 
7
7
  // src/lib/user-prompt-submit-compose.ts
8
8
  async function composeUserPromptSubmit(cfg, agent, client, prompt, sessionId = null) {
@@ -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-X2BX6LR6.js";
6
+ } from "./chunk-3B7J5VUT.js";
7
+ import {
8
+ listKnowledgeBases
9
+ } from "./chunk-NFAPLK4C.js";
10
10
  import {
11
11
  CtxdbError
12
- } from "./chunk-S5W4FQ7M.js";
12
+ } from "./chunk-KYW76CL7.js";
13
13
 
14
14
  // src/lib/kb-catalog.ts
15
15
  function sanitizeKeyEntities(raw) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CtxdbError
4
- } from "./chunk-S5W4FQ7M.js";
4
+ } from "./chunk-KYW76CL7.js";
5
5
 
6
6
  // src/lib/kb.ts
7
7
  import {
@@ -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-X2BX6LR6.js";
7
+ } from "./chunk-3B7J5VUT.js";
8
8
  import {
9
9
  CtxdbError,
10
10
  debug,
11
11
  isDebug
12
- } from "./chunk-S5W4FQ7M.js";
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-DPLMBHLU.js";
5
+ } from "./chunk-NF5KFV2P.js";
6
6
  import {
7
7
  debug
8
- } from "./chunk-S5W4FQ7M.js";
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 result = run(npmCommand(platform), ["view", PACKAGE_NAME, "version"], {
33
- encoding: "utf-8",
34
- timeout: options.timeoutMs ?? NPM_VIEW_TIMEOUT_MS,
35
- stdio: ["ignore", "pipe", "pipe"],
36
- shell: platform === "win32"
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 check = checkLatestVersion(currentVersion);
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 ${PACKAGE_NAME} v${currentVersion} \u2192 v${check.latest}...
114
+ process.stderr.write(`ctxdb: updating ${packageName} v${currentVersion} \u2192 v${check.latest}...
102
115
  `);
103
- const install = spawnSync(npmCommand(), ["install", "-g", `${PACKAGE_NAME}@${check.latest}`], {
104
- stdio: "inherit",
105
- encoding: "utf-8",
106
- shell: process.platform === "win32"
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, "version-check.json"),
159
- lockPath: join(cacheDir, "version-check.lock")
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
+ };